go: github.com/stellar/go/protocols/horizon/operations Index | Files

package operations

import "github.com/stellar/go/protocols/horizon/operations"

Index

Package Files

main.go

Variables

var TypeNames = map[xdr.OperationType]string{
    xdr.OperationTypeCreateAccount:            "create_account",
    xdr.OperationTypePayment:                  "payment",
    xdr.OperationTypePathPaymentStrictReceive: "path_payment_strict_receive",
    xdr.OperationTypeManageSellOffer:          "manage_sell_offer",
    xdr.OperationTypeCreatePassiveSellOffer:   "create_passive_sell_offer",
    xdr.OperationTypeSetOptions:               "set_options",
    xdr.OperationTypeChangeTrust:              "change_trust",
    xdr.OperationTypeAllowTrust:               "allow_trust",
    xdr.OperationTypeAccountMerge:             "account_merge",
    xdr.OperationTypeInflation:                "inflation",
    xdr.OperationTypeManageData:               "manage_data",
    xdr.OperationTypeBumpSequence:             "bump_sequence",
    xdr.OperationTypeManageBuyOffer:           "manage_buy_offer",
    xdr.OperationTypePathPaymentStrictSend:    "path_payment_strict_send",
}

TypeNames maps from operation type to the string used to represent that type in horizon's JSON responses

type AccountMerge Uses

type AccountMerge struct {
    Base
    Account string `json:"account"`
    Into    string `json:"into"`
}

AccountMerge is the json resource representing a single operation whose type is AccountMerge.

type AllowTrust Uses

type AllowTrust struct {
    Base
    base.Asset
    Trustee                        string `json:"trustee"`
    Trustor                        string `json:"trustor"`
    Authorize                      bool   `json:"authorize"`
    AuthorizeToMaintainLiabilities bool   `json:"authorize_to_maintain_liabilities"`
}

AllowTrust is the json resource representing a single operation whose type is AllowTrust.

type Base Uses

type Base struct {
    Links struct {
        Self        hal.Link `json:"self"`
        Transaction hal.Link `json:"transaction"`
        Effects     hal.Link `json:"effects"`
        Succeeds    hal.Link `json:"succeeds"`
        Precedes    hal.Link `json:"precedes"`
    }   `json:"_links"`

    ID  string `json:"id"`
    PT  string `json:"paging_token"`
    // TransactionSuccessful defines if this operation is part of
    // successful transaction.
    TransactionSuccessful bool      `json:"transaction_successful"`
    SourceAccount         string    `json:"source_account"`
    Type                  string    `json:"type"`
    TypeI                 int32     `json:"type_i"`
    LedgerCloseTime       time.Time `json:"created_at"`
    // TransactionHash is the hash of the transaction which created the operation
    // Note that the Transaction field below is not always present in the Operation response.
    // If the Transaction field is present TransactionHash is redundant since the same information
    // is present in Transaction. But, if the Transaction field is nil then TransactionHash is useful.
    // Transaction is non nil when the "join=transactions" parameter is present in the operations request
    TransactionHash string               `json:"transaction_hash"`
    Transaction     *horizon.Transaction `json:"transaction,omitempty"`
}

Base represents the common attributes of an operation resource

func (Base) GetID Uses

func (base Base) GetID() string

func (Base) GetTransactionHash Uses

func (base Base) GetTransactionHash() string

func (Base) GetType Uses

func (base Base) GetType() string

GetType returns the type of operation

func (Base) GetTypeI Uses

func (base Base) GetTypeI() int32

GetTypeI returns the ID of type of operation

func (Base) IsTransactionSuccessful Uses

func (base Base) IsTransactionSuccessful() bool

func (Base) PagingToken Uses

func (base Base) PagingToken() string

PagingToken implements hal.Pageable

type BumpSequence Uses

type BumpSequence struct {
    Base
    BumpTo string `json:"bump_to"`
}

BumpSequence is the json resource representing a single operation whose type is BumpSequence.

type ChangeTrust Uses

type ChangeTrust struct {
    Base
    base.Asset
    Limit   string `json:"limit"`
    Trustee string `json:"trustee"`
    Trustor string `json:"trustor"`
}

ChangeTrust is the json resource representing a single operation whose type is ChangeTrust.

type CreateAccount Uses

type CreateAccount struct {
    Base
    StartingBalance string `json:"starting_balance"`
    Funder          string `json:"funder"`
    Account         string `json:"account"`
}

CreateAccount is the json resource representing a single operation whose type is CreateAccount.

type CreatePassiveSellOffer Uses

type CreatePassiveSellOffer struct {
    Offer
}

CreatePassiveSellOffer is the json resource representing a single operation whose type is CreatePassiveSellOffer.

type Inflation Uses

type Inflation struct {
    Base
}

Inflation is the json resource representing a single operation whose type is Inflation.

type ManageBuyOffer Uses

type ManageBuyOffer struct {
    Offer
    OfferID int64 `json:"offer_id,string"`
}

ManageBuyOffer is the json resource representing a single operation whose type is ManageBuyOffer.

type ManageData Uses

type ManageData struct {
    Base
    Name  string `json:"name"`
    Value string `json:"value"`
}

ManageData represents a ManageData operation as it is serialized into json for the horizon API.

type ManageSellOffer Uses

type ManageSellOffer struct {
    Offer
    OfferID int64 `json:"offer_id,string"`
}

ManageSellOffer is the json resource representing a single operation whose type is ManageSellOffer.

type Offer Uses

type Offer struct {
    Base
    Amount             string     `json:"amount"`
    Price              string     `json:"price"`
    PriceR             base.Price `json:"price_r"`
    BuyingAssetType    string     `json:"buying_asset_type"`
    BuyingAssetCode    string     `json:"buying_asset_code,omitempty"`
    BuyingAssetIssuer  string     `json:"buying_asset_issuer,omitempty"`
    SellingAssetType   string     `json:"selling_asset_type"`
    SellingAssetCode   string     `json:"selling_asset_code,omitempty"`
    SellingAssetIssuer string     `json:"selling_asset_issuer,omitempty"`
}

Offer is an embedded resource used in offer type operations.

type Operation Uses

type Operation interface {
    PagingToken() string
    GetType() string
    GetID() string
    GetTransactionHash() string
    IsTransactionSuccessful() bool
}

Operation interface contains methods implemented by the operation types

func UnmarshalOperation Uses

func UnmarshalOperation(operationTypeID int32, dataString []byte) (ops Operation, err error)

UnmarshalOperation decodes responses to the correct operation struct

type OperationsPage Uses

type OperationsPage struct {
    Links    hal.Links `json:"_links"`
    Embedded struct {
        Records []Operation
    }   `json:"_embedded"`
}

OperationsPage is the json resource representing a page of operations. OperationsPage.Record can contain various operation types.

func (*OperationsPage) UnmarshalJSON Uses

func (ops *OperationsPage) UnmarshalJSON(data []byte) error

type PathPayment Uses

type PathPayment struct {
    Payment
    Path              []base.Asset `json:"path"`
    SourceAmount      string       `json:"source_amount"`
    SourceMax         string       `json:"source_max"`
    SourceAssetType   string       `json:"source_asset_type"`
    SourceAssetCode   string       `json:"source_asset_code,omitempty"`
    SourceAssetIssuer string       `json:"source_asset_issuer,omitempty"`
}

PathPayment is the json resource representing a single operation whose type is PathPayment.

type PathPaymentStrictSend Uses

type PathPaymentStrictSend struct {
    Payment
    Path              []base.Asset `json:"path"`
    SourceAmount      string       `json:"source_amount"`
    DestinationMin    string       `json:"destination_min"`
    SourceAssetType   string       `json:"source_asset_type"`
    SourceAssetCode   string       `json:"source_asset_code,omitempty"`
    SourceAssetIssuer string       `json:"source_asset_issuer,omitempty"`
}

PathPaymentStrictSend is the json resource representing a single operation whose type is PathPaymentStrictSend.

type Payment Uses

type Payment struct {
    Base
    base.Asset
    From   string `json:"from"`
    To     string `json:"to"`
    Amount string `json:"amount"`
}

Payment is the json resource representing a single operation whose type is Payment.

type SetOptions Uses

type SetOptions struct {
    Base
    HomeDomain    string `json:"home_domain,omitempty"`
    InflationDest string `json:"inflation_dest,omitempty"`

    MasterKeyWeight *int   `json:"master_key_weight,omitempty"`
    SignerKey       string `json:"signer_key,omitempty"`
    SignerWeight    *int   `json:"signer_weight,omitempty"`

    SetFlags    []int    `json:"set_flags,omitempty"`
    SetFlagsS   []string `json:"set_flags_s,omitempty"`
    ClearFlags  []int    `json:"clear_flags,omitempty"`
    ClearFlagsS []string `json:"clear_flags_s,omitempty"`

    LowThreshold  *int `json:"low_threshold,omitempty"`
    MedThreshold  *int `json:"med_threshold,omitempty"`
    HighThreshold *int `json:"high_threshold,omitempty"`
}

SetOptions is the json resource representing a single operation whose type is SetOptions.

Package operations imports 7 packages (graph) and is imported by 13 packages. Updated 2020-04-29. Refresh now. Tools for package owners.