Documentation ¶
Overview ¶
Package transactionbuilder is a helper for doing transactions with simpler input that just using the package Provider Underneath uses the package Provider
Index ¶
- Variables
- type ChainID
- type CoinDenom
- type Provider
- type Signer
- type TransactionBuilder
- func (t *TransactionBuilder) CreateTransaction(chainID ChainID, txMsg TransactionMessage, options *TransactionOptions) (*provider.SendTransactionInput, error)
- func (t *TransactionBuilder) Submit(chainID ChainID, txMsg TransactionMessage, options *TransactionOptions) (*provider.SendTransactionOutput, error)
- func (t *TransactionBuilder) SubmitWithCtx(ctx context.Context, chainID ChainID, txMsg TransactionMessage, ...) (*provider.SendTransactionOutput, error)
- type TransactionMessage
- func NewSend(fromAddress, toAddress string, amount int64) (TransactionMessage, error)
- func NewStakeApp(publicKey string, chains []string, amount int64) (TransactionMessage, error)
- func NewStakeNode(publicKey, serviceURL, outputAddress string, chains []string, amount int64) (TransactionMessage, error)
- func NewUnjailApp(address string) (TransactionMessage, error)
- func NewUnjailNode(fromAddress, operatorAddress string) (TransactionMessage, error)
- func NewUnstakeApp(address string) (TransactionMessage, error)
- func NewUnstakeNode(fromAddress, operatorAddress string) (TransactionMessage, error)
- type TransactionOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSigner error when no signer is provided ErrNoSigner = errors.New("no signer provided") // ErrNoProvider error when no provider is provided ErrNoProvider = errors.New("no provider provided") // ErrNoChainID error when no chain ID is provided ErrNoChainID = errors.New("no chain id provided") // ErrNoTransactionMessage error when no Transaction Message is provided ErrNoTransactionMessage = errors.New("no transaction message provided") )
Functions ¶
This section is empty.
Types ¶
type CoinDenom ¶
type CoinDenom string
CoinDenom enum that represents all coin denominations of Pocket
type Provider ¶
type Provider interface {
SendTransactionWithCtx(ctx context.Context, input *provider.SendTransactionInput) (*provider.SendTransactionOutput, error)
}
Provider interface representing provider functions necessary for Transaction Builder Package
type Signer ¶
type Signer interface { SignBytes(payload []byte) ([]byte, error) GetAddress() string GetPublicKey() string }
Signer interface representing signer functions necessary for Transaction Builder package
type TransactionBuilder ¶
type TransactionBuilder struct {
// contains filtered or unexported fields
}
TransactionBuilder represents implementation of transaction builder package
func NewTransactionBuilder ¶
func NewTransactionBuilder(provider Provider, signer Signer) *TransactionBuilder
NewTransactionBuilder returns an instance of TransactionBuilder
func (*TransactionBuilder) CreateTransaction ¶
func (t *TransactionBuilder) CreateTransaction(chainID ChainID, txMsg TransactionMessage, options *TransactionOptions) (*provider.SendTransactionInput, error)
CreateTransaction returns input necessary for doing a transaction
func (*TransactionBuilder) Submit ¶
func (t *TransactionBuilder) Submit(chainID ChainID, txMsg TransactionMessage, options *TransactionOptions) (*provider.SendTransactionOutput, error)
Submit does the transaction from raw input
func (*TransactionBuilder) SubmitWithCtx ¶ added in v0.13.1
func (t *TransactionBuilder) SubmitWithCtx(ctx context.Context, chainID ChainID, txMsg TransactionMessage, options *TransactionOptions) (*provider.SendTransactionOutput, error)
SubmitWithCtx does the transaction from raw input
type TransactionMessage ¶
TransactionMessage interface that represents message to be sent as transaction
func NewSend ¶
func NewSend(fromAddress, toAddress string, amount int64) (TransactionMessage, error)
NewSend returns message for send transaction
func NewStakeApp ¶
func NewStakeApp(publicKey string, chains []string, amount int64) (TransactionMessage, error)
NewStakeApp returns message for Stake App transaction
func NewStakeNode ¶
func NewStakeNode(publicKey, serviceURL, outputAddress string, chains []string, amount int64) (TransactionMessage, error)
NewStakeNode returns message for Stake Node transaction
func NewUnjailApp ¶
func NewUnjailApp(address string) (TransactionMessage, error)
NewUnjailApp returns message for Unjail App transaction
func NewUnjailNode ¶
func NewUnjailNode(fromAddress, operatorAddress string) (TransactionMessage, error)
NewUnjailNode returns message for Unjail Node transaction
func NewUnstakeApp ¶
func NewUnstakeApp(address string) (TransactionMessage, error)
NewUnstakeApp returns message for Unstake App transaction
func NewUnstakeNode ¶
func NewUnstakeNode(fromAddress, operatorAddress string) (TransactionMessage, error)
NewUnstakeNode returns message for Unstake Node transaction
type TransactionOptions ¶
TransactionOptions represents optional parameters for transaction request