Documentation
¶
Index ¶
- func CheckError(err error) xc.ClientError
- func FindAssociatedTokenAddress(addr string, contract string) (string, error)
- func NewAddressBuilder(asset xc.ITask) (xc.AddressBuilder, error)
- func NewSigner(cfgI xc.ITask) (xc.Signer, error)
- func NewTxBuilder(asset xc.ITask) (xc.TxBuilder, error)
- type AddressBuilder
- type Client
- func (client *Client) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
- func (client *Client) FetchBalanceForAsset(ctx context.Context, address xc.Address, assetCfg xc.ITask) (xc.AmountBlockchain, error)
- func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
- func (client *Client) FetchTxInfo(ctx context.Context, txHash xc.TxHash) (xc.TxInfo, error)
- func (client *Client) FetchTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)
- func (client *Client) SubmitTx(ctx context.Context, txInput xc.Tx) error
- type Signer
- type Tx
- func (tx Tx) AddSignatures(signatures ...xc.TxSignature) error
- func (tx Tx) Amount() xc.AmountBlockchain
- func (tx Tx) ContractAddress() xc.ContractAddress
- func (tx Tx) From() xc.Address
- func (tx Tx) Hash() xc.TxHash
- func (tx *Tx) ParseTransfer()
- func (tx Tx) RecentBlockhash() string
- func (tx Tx) Serialize() ([]byte, error)
- func (tx *Tx) SetAssociatedTokenAccount(ata *token.Account)
- func (tx Tx) Sighashes() ([]xc.TxDataToSign, error)
- func (tx Tx) To() xc.Address
- func (tx Tx) ToAlt() xc.Address
- type TxBuilder
- func (txBuilder TxBuilder) BuildUnwrapEverythingTx(from xc.Address, to xc.Address, amount xc.AmountBlockchain, txInput *TxInput) (xc.Tx, error)
- func (txBuilder TxBuilder) BuildWrapTx(from xc.Address, to xc.Address, amount xc.AmountBlockchain, txInput *TxInput) (xc.Tx, error)
- func (txBuilder TxBuilder) NewNativeTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
- func (txBuilder TxBuilder) NewTask(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
- func (txBuilder TxBuilder) NewTokenTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
- func (txBuilder TxBuilder) NewTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
- type TxInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶ added in v0.3.0
func CheckError(err error) xc.ClientError
func FindAssociatedTokenAddress ¶
FindAssociatedTokenAddress returns the associated token account (ATA) for a given account and token
func NewAddressBuilder ¶
func NewAddressBuilder(asset xc.ITask) (xc.AddressBuilder, error)
NewAddressBuilder creates a new Solana AddressBuilder
Types ¶
type AddressBuilder ¶
type AddressBuilder struct { }
AddressBuilder for Solana
func (AddressBuilder) GetAddressFromPublicKey ¶
func (ab AddressBuilder) GetAddressFromPublicKey(publicKeyBytes []byte) (xc.Address, error)
GetAddressFromPublicKey returns an Address given a public key
func (AddressBuilder) GetAllPossibleAddressesFromPublicKey ¶
func (ab AddressBuilder) GetAllPossibleAddressesFromPublicKey(publicKeyBytes []byte) ([]xc.PossibleAddress, error)
GetAllPossibleAddressesFromPublicKey returns all PossubleAddress(es) given a public key
type Client ¶
Client for Solana
func (*Client) FetchBalance ¶ added in v0.2.0
func (client *Client) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
FetchBalance fetches token balance for a Solana address
func (*Client) FetchBalanceForAsset ¶ added in v0.3.0
func (client *Client) FetchBalanceForAsset(ctx context.Context, address xc.Address, assetCfg xc.ITask) (xc.AmountBlockchain, error)
FetchBalanceForAsset fetches a specific token balance which may not be the asset configured for the client
func (*Client) FetchNativeBalance ¶ added in v0.2.0
func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
FetchNativeBalance fetches account balance for a Solana address
func (*Client) FetchTxInfo ¶
FetchTxInfo returns tx info for a Solana tx
type Signer ¶
type Signer struct { }
Signer for Solana
func (Signer) ImportPrivateKey ¶ added in v0.2.0
func (signer Signer) ImportPrivateKey(privateKey string) (xc.PrivateKey, error)
ImportPrivateKey imports a Solana private key
func (Signer) Sign ¶
func (signer Signer) Sign(privateKey xc.PrivateKey, data xc.TxDataToSign) (xc.TxSignature, error)
Sign a Solana tx
type Tx ¶
type Tx struct { SolTx *solana.Transaction ParsedSolTx *rpc.ParsedTransaction // similar, but different type // contains filtered or unexported fields }
Tx for Solana, encapsulating a solana.Transaction and other info
func (Tx) AddSignatures ¶ added in v0.3.0
func (tx Tx) AddSignatures(signatures ...xc.TxSignature) error
AddSignatures adds a signature to Tx
func (Tx) Amount ¶ added in v0.2.0
func (tx Tx) Amount() xc.AmountBlockchain
Amount returns the tx amount
func (Tx) ContractAddress ¶
func (tx Tx) ContractAddress() xc.ContractAddress
ContractAddress returns the contract address for a token transfer
func (*Tx) ParseTransfer ¶
func (tx *Tx) ParseTransfer()
ParseTransfer parses a tx and extracts higher-level transfer information
func (Tx) RecentBlockhash ¶
RecentBlockhash returns the recent block hash used as a nonce for a Solana tx
func (*Tx) SetAssociatedTokenAccount ¶
SetAssociatedTokenAccount sets the associated token account
type TxBuilder ¶
TxBuilder for Solana
func (TxBuilder) BuildUnwrapEverythingTx ¶ added in v0.3.0
func (TxBuilder) BuildWrapTx ¶ added in v0.3.0
func (TxBuilder) NewNativeTransfer ¶
func (txBuilder TxBuilder) NewNativeTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
NewNativeTransfer creates a new transfer for a native asset
type TxInput ¶
type TxInput struct { xc.TxInputEnvelope RecentBlockHash solana.Hash ToIsATA bool ShouldCreateATA bool }
TxInput for Solana
func NewTxInput ¶ added in v0.3.0
func NewTxInput() *TxInput
NewTxInput returns a new Solana TxInput