builder

package
v0.0.0-...-2d2c1de Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTxInputOptions

func WithTxInputOptions(txInput xc.TxInput, timeStamp int64, priorityMaybe xc.GasFeePriority) (xc.TxInput, error)

Previously the crosschain abstraction would require callers to set options directly on the transaction input, if the interface was implemented on the input type. However, wasn't very clear or easy to use. This function bridges the gap, to allow callers to use a more natural interface with options. Chain transaction builders can call this to safely set provided options on the old transaction input setters.

Types

type BuilderOption

type BuilderOption func(opts *builderOptions) error

func OptionContractAddress

func OptionContractAddress(contract xc.ContractAddress, decimalsMaybe ...int) BuilderOption

func OptionContractDecimals

func OptionContractDecimals(decimals int) BuilderOption

func OptionFeePayer

func OptionFeePayer(feePayer xc.Address, feePayerPublicKey []byte) BuilderOption

func OptionFeePayerIdentity

func OptionFeePayerIdentity(feePayerIdentity string) BuilderOption

The identity may be needed if the chain requires it (e.g. EOS)

func OptionFromIdentity

func OptionFromIdentity(fromIdentity string) BuilderOption

The identity may be needed if the chain requires it (e.g. EOS)

func OptionInclusiveFeeSpending

func OptionInclusiveFeeSpending(inclusiveFeeSpending bool) BuilderOption

func OptionMemo

func OptionMemo(memo string) BuilderOption

func OptionPriority

func OptionPriority(priority xc.GasFeePriority) BuilderOption

func OptionPublicKey

func OptionPublicKey(publicKey []byte) BuilderOption

func OptionStakeAccount

func OptionStakeAccount(account string) BuilderOption

func OptionStakeOwner

func OptionStakeOwner(owner xc.Address) BuilderOption

Set an alternative owner of the stake from the from address

func OptionTimestamp

func OptionTimestamp(ts int64) BuilderOption

func OptionToIdentity

func OptionToIdentity(toIdentity string) BuilderOption

The identity may be needed if the chain requires it (e.g. EOS)

func OptionTransactionAttempts

func OptionTransactionAttempts(transactionAttempts []string) BuilderOption

func OptionValidator

func OptionValidator(validator string) BuilderOption

type BuilderRequiresIdentity

type BuilderRequiresIdentity interface {
	RequiresIdentityEOS()
}

Indicator to show that this chain requires an identity to be set for destination addresses. * The identity may be looked up dynamically for sending addresses * This is currently only used by EOS.

type BuilderSupportsFeePayer

type BuilderSupportsFeePayer interface {
	SupportsFeePayer()
}

Marker to indicate if fee payer is supported, until we support it everywhere

type FullBuilder

type FullBuilder interface {
	FullTransferBuilder
	Staking
}

type FullTransferBuilder

type FullTransferBuilder interface {
	Transfer
}

type MultiTransfer

type MultiTransfer interface {
	MultiTransfer(args MultiTransferArgs, input xc.MultiTransferInput) (xc.Tx, error)
}

type MultiTransferArgs

type MultiTransferArgs struct {
	// contains filtered or unexported fields
}

func NewMultiTransferArgs

func NewMultiTransferArgs(chain xc.NativeAsset, spenders []*Sender, receivers []*Receiver, options ...BuilderOption) (*MultiTransferArgs, error)

func NewMultiTransferArgsFromSingle

func NewMultiTransferArgsFromSingle(chain xc.NativeAsset, single *TransferArgs, options ...BuilderOption) (*MultiTransferArgs, error)

func (*MultiTransferArgs) AsAccountTransfers

func (args *MultiTransferArgs) AsAccountTransfers() ([]*TransferArgs, error)

func (*MultiTransferArgs) AsUtxoTransfers

func (args *MultiTransferArgs) AsUtxoTransfers() ([]*TransferArgs, error)

func (*MultiTransferArgs) DeductFee

func (args *MultiTransferArgs) DeductFee(amount xc.AmountBlockchain, chainId xc.NativeAsset, contract xc.ContractAddress) error

Deduct fee from the first matching receiver Used for inclusive fee spending.

func (*MultiTransferArgs) GetFeePayer

func (args *MultiTransferArgs) GetFeePayer() (xc.Address, bool)

func (*MultiTransferArgs) GetFeePayerIdentity

func (args *MultiTransferArgs) GetFeePayerIdentity() (string, bool)

func (*MultiTransferArgs) GetFeePayerPublicKey

func (args *MultiTransferArgs) GetFeePayerPublicKey() ([]byte, bool)

func (*MultiTransferArgs) GetMemo

func (args *MultiTransferArgs) GetMemo() (string, bool)

func (*MultiTransferArgs) GetPriority

func (args *MultiTransferArgs) GetPriority() (xc.GasFeePriority, bool)

func (*MultiTransferArgs) GetTransactionAttempts

func (args *MultiTransferArgs) GetTransactionAttempts() []string

func (*MultiTransferArgs) Receivers

func (args *MultiTransferArgs) Receivers() []*Receiver

func (*MultiTransferArgs) SetFeePayer

func (args *MultiTransferArgs) SetFeePayer(feePayer xc.Address)

func (*MultiTransferArgs) Spenders

func (args *MultiTransferArgs) Spenders() []*Sender

type Receiver

type Receiver struct {
	// contains filtered or unexported fields
}

func NewReceiver

func NewReceiver(address xc.Address, amount xc.AmountBlockchain, options ...BuilderOption) (*Receiver, error)

func (*Receiver) GetAmount

func (args *Receiver) GetAmount() xc.AmountBlockchain

func (*Receiver) GetContract

func (args *Receiver) GetContract() (xc.ContractAddress, bool)

func (*Receiver) GetDecimals

func (args *Receiver) GetDecimals() (int, bool)

func (*Receiver) GetMemo

func (args *Receiver) GetMemo() (string, bool)

func (*Receiver) GetTo

func (args *Receiver) GetTo() xc.Address

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

func NewSender

func NewSender(address xc.Address, publicKey []byte, options ...BuilderOption) (*Sender, error)

func (*Sender) GetFrom

func (args *Sender) GetFrom() xc.Address

func (*Sender) GetFromIdentity

func (args *Sender) GetFromIdentity() (string, bool)

func (*Sender) GetPublicKey

func (args *Sender) GetPublicKey() []byte

type StakeArgs

type StakeArgs struct {
	// contains filtered or unexported fields
}

func NewStakeArgs

func NewStakeArgs(chain xc.NativeAsset, from xc.Address, amount xc.AmountBlockchain, options ...BuilderOption) (StakeArgs, error)

func (*StakeArgs) GetAmount

func (args *StakeArgs) GetAmount() xc.AmountBlockchain

func (*StakeArgs) GetFeePayer

func (args *StakeArgs) GetFeePayer() (xc.Address, bool)

func (*StakeArgs) GetFeePayerIdentity

func (args *StakeArgs) GetFeePayerIdentity() (string, bool)

func (*StakeArgs) GetFeePayerPublicKey

func (args *StakeArgs) GetFeePayerPublicKey() ([]byte, bool)

func (*StakeArgs) GetFrom

func (args *StakeArgs) GetFrom() xc.Address

Staking arguments

func (*StakeArgs) GetFromIdentity

func (args *StakeArgs) GetFromIdentity() (string, bool)

func (*StakeArgs) GetMemo

func (args *StakeArgs) GetMemo() (string, bool)

Exposed options

func (*StakeArgs) GetPriority

func (args *StakeArgs) GetPriority() (xc.GasFeePriority, bool)

func (*StakeArgs) GetPublicKey

func (args *StakeArgs) GetPublicKey() ([]byte, bool)

func (*StakeArgs) GetStakeAccount

func (args *StakeArgs) GetStakeAccount() (string, bool)

func (*StakeArgs) GetStakeOwner

func (args *StakeArgs) GetStakeOwner() (xc.Address, bool)

func (*StakeArgs) GetTimestamp

func (args *StakeArgs) GetTimestamp() (int64, bool)

func (*StakeArgs) GetValidator

func (args *StakeArgs) GetValidator() (string, bool)

Staking options

type Staking

type Staking interface {
	Stake(stakingArgs StakeArgs, input xc.StakeTxInput) (xc.Tx, error)
	Unstake(stakingArgs StakeArgs, input xc.UnstakeTxInput) (xc.Tx, error)
	Withdraw(stakingArgs StakeArgs, input xc.WithdrawTxInput) (xc.Tx, error)
}

type TransactionOptions

type TransactionOptions interface {
	GetMemo() (string, bool)
	GetTimestamp() (int64, bool)
	GetPriority() (xc.GasFeePriority, bool)
	GetPublicKey() ([]byte, bool)
}

All ArgumentBuilders should provide base arguments for transactions

type Transfer

type Transfer interface {
	Transfer(args TransferArgs, input xc.TxInput) (xc.Tx, error)
}

type TransferArgs

type TransferArgs struct {
	// contains filtered or unexported fields
}

func NewTransferArgs

func NewTransferArgs(from xc.Address, to xc.Address, amount xc.AmountBlockchain, options ...BuilderOption) (TransferArgs, error)

func (*TransferArgs) GetAmount

func (args *TransferArgs) GetAmount() xc.AmountBlockchain

func (*TransferArgs) GetContract

func (args *TransferArgs) GetContract() (xc.ContractAddress, bool)

func (*TransferArgs) GetDecimals

func (args *TransferArgs) GetDecimals() (int, bool)

Decimals for token contract, which may be needed for token transfers on some chains

func (*TransferArgs) GetFeePayer

func (args *TransferArgs) GetFeePayer() (xc.Address, bool)

func (*TransferArgs) GetFeePayerIdentity

func (args *TransferArgs) GetFeePayerIdentity() (string, bool)

func (*TransferArgs) GetFeePayerPublicKey

func (args *TransferArgs) GetFeePayerPublicKey() ([]byte, bool)

func (*TransferArgs) GetFrom

func (args *TransferArgs) GetFrom() xc.Address

Transfer relevant arguments

func (*TransferArgs) GetFromIdentity

func (args *TransferArgs) GetFromIdentity() (string, bool)

func (*TransferArgs) GetMemo

func (args *TransferArgs) GetMemo() (string, bool)

Exposed options

func (*TransferArgs) GetPriority

func (args *TransferArgs) GetPriority() (xc.GasFeePriority, bool)

func (*TransferArgs) GetPublicKey

func (args *TransferArgs) GetPublicKey() ([]byte, bool)

func (*TransferArgs) GetTimestamp

func (args *TransferArgs) GetTimestamp() (int64, bool)

func (*TransferArgs) GetTo

func (args *TransferArgs) GetTo() xc.Address

func (*TransferArgs) GetToIdentity

func (args *TransferArgs) GetToIdentity() (string, bool)

func (*TransferArgs) GetTransactionAttempts

func (args *TransferArgs) GetTransactionAttempts() []string

func (*TransferArgs) InclusiveFeeSpendingEnabled

func (args *TransferArgs) InclusiveFeeSpendingEnabled() bool

func (*TransferArgs) SetAmount

func (args *TransferArgs) SetAmount(amount xc.AmountBlockchain)

func (*TransferArgs) SetContract

func (args *TransferArgs) SetContract(contract xc.ContractAddress)

func (*TransferArgs) SetFeePayer

func (args *TransferArgs) SetFeePayer(feePayer xc.Address)

func (*TransferArgs) SetFeePayerPublicKey

func (args *TransferArgs) SetFeePayerPublicKey(feePayerPublicKey []byte)

func (*TransferArgs) SetFrom

func (args *TransferArgs) SetFrom(from xc.Address)

func (*TransferArgs) SetFromIdentity

func (args *TransferArgs) SetFromIdentity(fromIdentity string)

func (*TransferArgs) SetInclusiveFeeSpending

func (args *TransferArgs) SetInclusiveFeeSpending(inclusiveFeeSpending bool)

func (*TransferArgs) SetPublicKey

func (args *TransferArgs) SetPublicKey(publicKey []byte)

func (*TransferArgs) SetTo

func (args *TransferArgs) SetTo(to xc.Address)

func (*TransferArgs) SetToIdentity

func (args *TransferArgs) SetToIdentity(toIdentity string)

func (*TransferArgs) SetTransactionAttempts

func (args *TransferArgs) SetTransactionAttempts(previousTransactionAttempts []string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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