txnbuild

package
v0.0.0-...-b787f32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package txnbuild implements transactions and operations on the Stellar network. TODO: More explanation + links here

Index

Constants

AuthImmutable is a flag that if set prevents any authorization flags from being set, and prevents the account from ever being merged (deleted).

AuthRequired is a flag that requires the issuing account to give other accounts permission before they can hold the issuing account's credit.

AuthRevocable is a flag that allows the issuing account to revoke its credit held by other accounts.

Variables

This section is empty.

Functions

func NewHomeDomain

func NewHomeDomain(hd string) *string

NewHomeDomain is syntactic sugar that makes instantiating SetOptions more convenient.

func NewInflationDestination

func NewInflationDestination(ai string) *string

NewInflationDestination is syntactic sugar that makes instantiating SetOptions more convenient.

Types

type Account

type Account struct {
	ID             string
	SequenceNumber xdr.SequenceNumber
}

Account represents a Stellar Account from the perspective of a Transaction.

type AccountFlag

type AccountFlag uint32

AccountFlag represents the bitmask flags used to set and clear account authorization options.

type AccountMerge

type AccountMerge struct {
	Destination string
	// contains filtered or unexported fields
}

AccountMerge represents the Stellar merge account operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*AccountMerge) BuildXDR

func (am *AccountMerge) BuildXDR() (xdr.Operation, error)

BuildXDR for AccountMerge returns a fully configured XDR Operation.

type AllowTrust

type AllowTrust struct {
	Trustor   string
	Type      *Asset
	Authorize bool
	// contains filtered or unexported fields
}

AllowTrust represents the Stellar allow trust operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*AllowTrust) BuildXDR

func (at *AllowTrust) BuildXDR() (xdr.Operation, error)

BuildXDR for AllowTrust returns a fully configured XDR Operation.

type Asset

type Asset struct {
	Code   string
	Issuer string
}

Asset represents assets on the Stellar network.

func NewAsset

func NewAsset(code, issuer string) *Asset

NewAsset is syntactic sugar that makes instantiating *Asset more convenient.

func NewNativeAsset

func NewNativeAsset() *Asset

NewNativeAsset is syntactic sugar that makes instantiating an XLM *Asset more convenient.

func (*Asset) IsNative

func (a *Asset) IsNative() bool

IsNative for Asset returns true if this is an XLM asset.

func (*Asset) ToXDR

func (a *Asset) ToXDR() (xdr.Asset, error)

ToXDR for Asset produces a corresponding XDR asset.

func (*Asset) ToXDRAllowTrustOpAsset

func (a *Asset) ToXDRAllowTrustOpAsset() (xdr.AllowTrustOpAsset, error)

ToXDRAllowTrustOpAsset for Asset produces a corresponding XDR "allow trust" asset, used by the XDR allow trust operation.

type BumpSequence

type BumpSequence struct {
	BumpTo int64
	// contains filtered or unexported fields
}

BumpSequence represents the Stellar bump sequence operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*BumpSequence) BuildXDR

func (bs *BumpSequence) BuildXDR() (xdr.Operation, error)

BuildXDR for BumpSequence returns a fully configured XDR Operation.

type ChangeTrust

type ChangeTrust struct {
	Line  *Asset
	Limit string
	// contains filtered or unexported fields
}

ChangeTrust represents the Stellar change trust operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func NewRemoveTrustlineOp

func NewRemoveTrustlineOp(issuedAsset *Asset) ChangeTrust

NewRemoveTrustlineOp returns a ChangeTrust operation to remove the trustline of the described asset, by setting the limit to "0".

func (*ChangeTrust) BuildXDR

func (ct *ChangeTrust) BuildXDR() (xdr.Operation, error)

BuildXDR for ChangeTrust returns a fully configured XDR Operation.

type CreateAccount

type CreateAccount struct {
	Destination string
	Amount      string
	Asset       string // TODO: Not used yet
	// contains filtered or unexported fields
}

CreateAccount represents the Stellar create account operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*CreateAccount) BuildXDR

func (ca *CreateAccount) BuildXDR() (xdr.Operation, error)

BuildXDR for CreateAccount returns a fully configured XDR Operation.

type Inflation

type Inflation struct {
	// contains filtered or unexported fields
}

Inflation represents the Stellar inflation operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*Inflation) BuildXDR

func (inf *Inflation) BuildXDR() (xdr.Operation, error)

BuildXDR for Inflation returns a fully configured XDR Operation.

type ManageData

type ManageData struct {
	Name  string
	Value []byte
	// contains filtered or unexported fields
}

ManageData represents the Stellar manage data operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*ManageData) BuildXDR

func (md *ManageData) BuildXDR() (xdr.Operation, error)

BuildXDR for ManageData returns a fully configured XDR Operation.

type Operation

type Operation interface {
	BuildXDR() (xdr.Operation, error)
}

Operation represents the operation types of the Stellar network.

type Payment

type Payment struct {
	Destination string
	Amount      string
	Asset       *Asset
	// contains filtered or unexported fields
}

Payment represents the Stellar payment operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*Payment) BuildXDR

func (p *Payment) BuildXDR() (xdr.Operation, error)

BuildXDR for Payment returns a fully configured XDR Operation.

type SetOptions

type SetOptions struct {
	InflationDestination *string
	SetFlags             []AccountFlag
	ClearFlags           []AccountFlag
	MasterWeight         *Threshold
	LowThreshold         *Threshold
	MediumThreshold      *Threshold
	HighThreshold        *Threshold
	HomeDomain           *string
	Signer               *Signer
	// contains filtered or unexported fields
}

SetOptions represents the Stellar set options operation. See https://www.stellar.org/developers/guides/concepts/list-of-operations.html

func (*SetOptions) BuildXDR

func (so *SetOptions) BuildXDR() (xdr.Operation, error)

BuildXDR for SetOptions returns a fully configured XDR Operation.

type Signer

type Signer struct {
	Address string
	Weight  Threshold
}

Signer represents the Signer in a SetOptions operation. If the signer already exists, it is updated. If the weight is 0, the signer is deleted.

type Threshold

type Threshold uint8

Threshold is the datatype for MasterWeight, Signer.Weight, and Thresholds. Each is a number between 0-255 inclusive.

func NewThreshold

func NewThreshold(t Threshold) *Threshold

NewThreshold is syntactic sugar that makes instantiating SetOptions more convenient.

type Transaction

type Transaction struct {
	SourceAccount Account
	Operations    []Operation

	BaseFee uint64 // TODO: Why is this a uint 64? Can it be a plain int?

	Network string
	// contains filtered or unexported fields
}

Transaction represents a Stellar Transaction.

func (*Transaction) Base64

func (tx *Transaction) Base64() (string, error)

Base64 returns the base 64 XDR representation of the Transaction.

func (*Transaction) Build

func (tx *Transaction) Build() error

Build for Transaction completely configures the Transaction. After calling Build, the Transaction is ready to be serialised or signed.

func (*Transaction) Hash

func (tx *Transaction) Hash() ([32]byte, error)

Hash provides a signable object representing the Transaction on the specified network.

func (*Transaction) MarshalBinary

func (tx *Transaction) MarshalBinary() ([]byte, error)

MarshalBinary returns the binary XDR representation of the Transaction.

func (*Transaction) SetDefaultFee

func (tx *Transaction) SetDefaultFee()

SetDefaultFee sets a sensible minimum default for the Transaction fee, if one has not already been set. It is a linear function of the number of Operations in the Transaction.

func (*Transaction) Sign

func (tx *Transaction) Sign(kp *keypair.Full) error

Sign for Transaction signs a previously built transaction. A signed transaction may be submitted to the network.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL