operations

package
v0.0.0-...-798156f Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeNames = map[xdr.OperationType]string{
	xdr.OperationTypeCreateAccount:      "create_account",
	xdr.OperationTypePayment:            "payment",
	xdr.OperationTypePathPayment:        "path_payment",
	xdr.OperationTypeManageOffer:        "manage_offer",
	xdr.OperationTypeCreatePassiveOffer: "create_passive_offer",
	xdr.OperationTypeSetOptions:         "set_options",
	xdr.OperationTypeChangeTrust:        "change_trust",
	xdr.OperationTypeAllowTrust:         "allow_trust",
	xdr.OperationTypeAccountMerge:       "account_merge",
	xdr.OperationTypeInflation:          "inflation",
	xdr.OperationTypeManageData:         "manage_data",
}

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

Functions

func New

func New(
	ctx context.Context,
	row history.Operation,
	ledger history.Ledger,
) (result hal.Pageable, err error)

New creates a new operation resource, finding the appropriate type to use based upon the row's type.

Types

type AccountMerge

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

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

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

type Base

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"`
	SourceAccount   string    `json:"source_account"`
	Type            string    `json:"type"`
	TypeI           int32     `json:"type_i"`
	LedgerCloseTime time.Time `json:"created_at"`
	TransactionHash string    `json:"transaction_hash"`
}

Base represents the common attributes of an operation resource

func (Base) PagingToken

func (this Base) PagingToken() string

PagingToken implements hal.Pageable

func (*Base) Populate

func (this *Base) Populate(
	ctx context.Context,
	row history.Operation,
	ledger history.Ledger,
)

Populate fills out this resource using `row` as the source.

type ChangeTrust

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

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 CreatePassiveOffer

type CreatePassiveOffer 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"`
}

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

type Inflation

type Inflation struct {
	Base
}

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

type ManageData

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 frontier API.

type ManageOffer

type ManageOffer struct {
	CreatePassiveOffer
	OfferID int64 `json:"offer_id"`
}

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

type PathPayment

type PathPayment struct {
	Payment
	Path              []base.Asset `json:"path"`
	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 Payment

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

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.

Jump to

Keyboard shortcuts

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