Documentation ¶
Index ¶
- Constants
- type AccountMergeOperation
- type AllowTrustOperation
- type Asset
- type ChangeTrustOperation
- type CreateAccountOperation
- type CreatePassiveOfferOperation
- type InflationOperation
- type ManageDataOperation
- type ManageOfferOperation
- type Operation
- type OperationType
- type PathPaymentOperation
- type PaymentOperation
- type SetOptionsOperation
- type Signature
- type Transaction
Constants ¶
const ( DefaultNetwork = "default" TestNetwork = "test" )
const NativeAssetCode = "XLM"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountMergeOperation ¶
type AccountMergeOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Destination string `json:"destination,omitempty" yaml:"destination,omitempty" mapstructure:"destination,omitempty"` }
AccountMergeOperation sends assets to another account
func (*AccountMergeOperation) GetOperationType ¶
func (op *AccountMergeOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type AllowTrustOperation ¶
type AllowTrustOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Trustor string `json:"trustor,omitempty" yaml:"trustor,omitempty" mapstructure:"trustor,omitempty"` Asset Asset `json:"asset,omitempty" yaml:"asset,omitempty" mapstructure:"asset,omitempty"` Authorize bool `json:"authorize,omitempty" yaml:"authorize,omitempty" mapstructure:"authorize,omitempty"` }
AllowTrustOperation sends assets to another account
func (*AllowTrustOperation) GetOperationType ¶
func (op *AllowTrustOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type Asset ¶
type Asset struct { Code string `json:"code,omitempty" yaml:"code,omitempty" mapstructure:"code,omitempty"` Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty" mapstructure:"issuer,omitempty"` Native bool `json:"native,omitempty" yaml:"native,omitempty" mapstructure:"native,omitempty"` }
Asset represents a asset in the network
type ChangeTrustOperation ¶
type ChangeTrustOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Line Asset `json:"line,omitempty" yaml:"line,omitempty" mapstructure:"line,omitempty"` Limit string `json:"limit,omitempty" yaml:"limit,omitempty" mapstructure:"limit,omitempty"` }
ChangeTrustOperation sends assets to another account
func (*ChangeTrustOperation) GetOperationType ¶
func (op *ChangeTrustOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type CreateAccountOperation ¶
type CreateAccountOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Destination string `json:"destination,omitempty" yaml:"destination,omitempty" mapstructure:"destination,omitempty"` StartingBalance string `json:"starting_balance,omitempty" yaml:"starting_balance,omitempty" mapstructure:"starting_balance,omitempty"` }
CreateAccountOperation creates a account on the ledger and funds it
func (*CreateAccountOperation) GetOperationType ¶
func (op *CreateAccountOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type CreatePassiveOfferOperation ¶
type CreatePassiveOfferOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Selling Asset `json:"selling,omitempty" yaml:"selling,omitempty" mapstructure:"selling,omitempty"` Buying Asset `json:"buying,omitempty" yaml:"buying,omitempty" mapstructure:"buying,omitempty"` Amount string `json:"amount,omitempty" yaml:"amount,omitempty" mapstructure:"amount,omitempty"` Price string `json:"price,omitempty" yaml:"price,omitempty" mapstructure:"price,omitempty"` }
CreatePassiveOfferOperation sends assets to another account
func (*CreatePassiveOfferOperation) GetOperationType ¶
func (op *CreatePassiveOfferOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type InflationOperation ¶
type InflationOperation struct {
Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"`
}
InflationOperation sends assets to another account
func (*InflationOperation) GetOperationType ¶
func (op *InflationOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type ManageDataOperation ¶
type ManageDataOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name,omitempty"` Value string `json:"value,omitempty" yaml:"value,omitempty" mapstructure:"value,omitempty"` }
ManageDataOperation sends assets to another account
func (*ManageDataOperation) GetOperationType ¶
func (op *ManageDataOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type ManageOfferOperation ¶
type ManageOfferOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Selling Asset `json:"selling,omitempty" yaml:"selling,omitempty" mapstructure:"selling,omitempty"` Buying Asset `json:"buying,omitempty" yaml:"buying,omitempty" mapstructure:"buying,omitempty"` Amount string `json:"amount,omitempty" yaml:"amount,omitempty" mapstructure:"amount,omitempty"` Price string `json:"price,omitempty" yaml:"price,omitempty" mapstructure:"price,omitempty"` OfferID uint64 `json:"offer_id,omitempty" yaml:"offer_id,omitempty" mapstructure:"offer_id,omitempty"` }
ManageOfferOperation sends assets to another account
func (*ManageOfferOperation) GetOperationType ¶
func (op *ManageOfferOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type Operation ¶
type Operation interface {
GetOperationType() OperationType
}
Operation defines the common interface of all ops
type OperationType ¶
type OperationType string
OperationType is the type which represents the operation type constants
const ( CreateAccount OperationType = "create-account" Payment OperationType = "payment" PathPayment OperationType = "path-payment" ManageOffer OperationType = "manage-offer" CreatePassiveOffer OperationType = "create-passive-offer" SetOptions OperationType = "set-options" ChangeTrust OperationType = "change-trust" AllowTrust OperationType = "allow-trust" AccountMerge OperationType = "account-merge" Inflation OperationType = "inflation" ManageData OperationType = "manage-data" )
type PathPaymentOperation ¶
type PathPaymentOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` SourceAccount string `json:"source_account,omitempty" yaml:"source_account,omitempty" mapstructure:"source_account,omitempty"` SendAsset Asset `json:"send_asset,omitempty" yaml:"send_asset,omitempty" mapstructure:"send_asset,omitempty"` SendMax string `json:"send_max,omitempty" yaml:"send_max,omitempty" mapstructure:"send_max,omitempty"` Destination string `json:"destination,omitempty" yaml:"destination,omitempty" mapstructure:"destination,omitempty"` DestinationAsset Asset `json:"destination_asset,omitempty" yaml:"destination_asset,omitempty" mapstructure:"destination_asset,omitempty"` DestinationAmount string `json:"destination_amount,omitempty" yaml:"destination_amount,omitempty" mapstructure:"destination_amount,omitempty"` Path []Asset `json:"path,omitempty" yaml:"path,omitempty" mapstructure:"path,omitempty"` }
PathPaymentOperation sends assets to another account
func (*PathPaymentOperation) GetOperationType ¶
func (op *PathPaymentOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type PaymentOperation ¶
type PaymentOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` Destination string `json:"destination,omitempty" yaml:"destination,omitempty" mapstructure:"destination,omitempty"` SourceAccount string `json:"source_account,omitempty" yaml:"source_account,omitempty" mapstructure:"source_account,omitempty"` Asset Asset `json:"asset,omitempty" yaml:"asset,omitempty" mapstructure:"asset,omitempty"` Amount string `json:"amount,omitempty" yaml:"amount,omitempty" mapstructure:"amount,omitempty"` }
PaymentOperation sends assets to another account
func (*PaymentOperation) GetOperationType ¶
func (op *PaymentOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type SetOptionsOperation ¶
type SetOptionsOperation struct { Type OperationType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` InflationDestination string `json:"inflation_destination,omitempty" yaml:"inflation_destination,omitempty" mapstructure:"inflation_destination,omitempty"` SetFlags uint32 `json:"set_flags,omitempty" yaml:"set_flags,omitempty" mapstructure:"set_flags,omitempty"` ClearFlags uint32 `json:"clear_flags,omitempty" yaml:"clear_flags,omitempty" mapstructure:"clear_flags,omitempty"` MasterWeight uint32 `json:"master_weight,omitempty" yaml:"master_weight,omitempty" mapstructure:"master_weight,omitempty"` LowThreshold uint32 `json:"low_threshold,omitempty" yaml:"low_threshold,omitempty" mapstructure:"low_threshold,omitempty"` MediumThreshold uint32 `json:"medium_threshold,omitempty" yaml:"medium_threshold,omitempty" mapstructure:"medium_threshold,omitempty"` HighThreshold uint32 `json:"high_threshold,omitempty" yaml:"high_threshold,omitempty" mapstructure:"high_threshold,omitempty"` HomeDomain string `json:"home_domain,omitempty" yaml:"home_domain,omitempty" mapstructure:"home_domain,omitempty"` Signer *struct { PublicKey string `json:"public_key,omitempty" yaml:"public_key,omitempty" mapstructure:"public_key,omitempty"` Weight uint32 `json:"weight,omitempty" yaml:"weight,omitempty" mapstructure:"weight,omitempty"` } `json:"signer,omitempty" yaml:"signer,omitempty" mapstructure:"signer,omitempty"` }
SetOptionsOperation sends assets to another account
func (*SetOptionsOperation) GetOperationType ¶
func (op *SetOptionsOperation) GetOperationType() OperationType
GetOperationType implements the operation interface
type Signature ¶
type Signature struct { Signature string `json:"signature,omitempty" yaml:"signature,omitempty" mapstructure:"signature,omitempty"` Hint []byte `json:"hint,omitempty" yaml:"hint,omitempty" mapstructure:"hint,omitempty"` }
Signature contains a signature of a tx
type Transaction ¶
type Transaction struct { Network string `json:"network,omitempty" yaml:"network,omitempty" mapstructure:"network,emitempty"` SourceAccount string `json:"source_account,omitempty" yaml:"source_account,omitempty" mapstructure:"source_account,omitempty,emitempty"` SequenceID uint64 `json:"sequence_id,omitempty" yaml:"sequence_id,omitempty" mapstructure:"sequence_id,omitempty,emitempty"` Operations []Operation `json:"operations,omitempty" yaml:"operations,omitempty" mapstructure:"operations,omitempty,emitempty"` Memo string `json:"memo,omitempty" yaml:"memo,omitempty" mapstructure:"memo,omitempty,emitempty"` NotBefore time.Time `json:"not_before,omitempty" yaml:"not_before,omitempty" mapstructure:"not_before,omitempty,emitempty"` NotAfter time.Time `json:"not_after,omitempty" yaml:"not_after,omitempty" mapstructure:"not_after,omitempty,emitempty"` Signatures []*Signature `json:"signatures,omitempty" yaml:"signatures,omitempty" mapstructure:"signatures,omitempty,emitempty"` // contains filtered or unexported fields }
Transaction represents a stellar transaction
func FromYAML ¶
func FromYAML(data []byte) (*Transaction, error)
FromYAML parses a transaction from a YAML encoded form
func New ¶
func New(sequenceProvider *horizon.Client) *Transaction
func (*Transaction) SetSequenceProvider ¶
func (tx *Transaction) SetSequenceProvider(cli *horizon.Client)
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(seed string) error
func (*Transaction) ToTransactionBuilder ¶
func (tx *Transaction) ToTransactionBuilder() (*build.TransactionBuilder, error)
ToTransactionBuilder returns the transaction builder for this tx
func (*Transaction) ToXDR ¶
func (tx *Transaction) ToXDR() (string, error)