client

package
v0.0.0-...-15c384e Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAssetCode

func GetAssetCode(asset xdr.Asset) xc.NativeAsset

Conversion from xdr.Asset to xc.NativeAsset

func ProcessPathPayment

func ProcessPathPayment(txInfo *xclient.TxInfo, sourceAsset xc.NativeAsset, destinationAsset xc.NativeAsset, source xdr.MuxedAccount, destination xdr.MuxedAccount, sourceAmount xdr.Int64, destinationAmount xdr.Int64) error

Process cross asset payments. This type of operation produce two movements: one for source account and one for destination account

func ProcessPayment

func ProcessPayment(txInfo *xclient.TxInfo, asset xc.NativeAsset, source xdr.MuxedAccount, destination xdr.MuxedAccount, amount xdr.Int64) error

Process payment like operation. This type of operations produce one movement containing source and destination.

Types

type Client

type Client struct {
	Url        string
	HttpClient *http.Client
	Asset      xc.ITask
	Passphrase string
}

func NewClient

func NewClient(cfgI xc.ITask) (*Client, error)

func (*Client) FetchAccountDetails

func (client *Client) FetchAccountDetails(address xc.Address) (types.GetAccountResult, error)

func (*Client) FetchBalance

func (client *Client) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

func (*Client) FetchBalanceByAsset

func (client *Client) FetchBalanceByAsset(address xc.Address, fetchNative bool, assetID string) (xc.AmountBlockchain, error)

Fetch asset balance by asset code

func (*Client) FetchDecimals

func (client *Client) FetchDecimals(ctx context.Context, contract xc.ContractAddress) (int, error)

func (*Client) FetchLatestLedgerInfo

func (client *Client) FetchLatestLedgerInfo() (types.GetLedgerResult, error)

func (*Client) FetchLedgerInfo

func (client *Client) FetchLedgerInfo(sequence uint64) (types.GetLedgerResult, error)

func (*Client) FetchLegacyTxInfo

func (client *Client) FetchLegacyTxInfo(ctx context.Context, txHash xc.TxHash) (xc.LegacyTxInfo, error)

Returns transaction info - legacy/old endpoint

func (*Client) FetchLegacyTxInput

func (client *Client) FetchLegacyTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)

Deprecated method - use FetchTransferInput

func (*Client) FetchNativeBalance

func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

func (*Client) FetchTransferInput

func (client *Client) FetchTransferInput(ctx context.Context, args xcbuilder.TransferArgs) (xc.TxInput, error)

FetchTransferInput returns tx input for a Stellar tx

func (*Client) FetchTxInfo

func (client *Client) FetchTxInfo(ctx context.Context, txHash xc.TxHash) (xclient.TxInfo, error)

Returns transaction info - new endpoint

func (*Client) Get

func (client *Client) Get(url string, response any) error

Send a GET request

func (*Client) InitializeTxInfo

func (client *Client) InitializeTxInfo(txHash xc.TxHash, transaction types.GetTransactionResult) (xclient.TxInfo, error)

Fetch ledger data and create xclient.TxInfo

func (*Client) Post

func (client *Client) Post(url string, requestBody any, response any) error

Send a POST request

func (*Client) SubmitTx

func (client *Client) SubmitTx(ctx context.Context, tx xc.Tx) error

Broadcast a signed transaction to the chain

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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