transactionbuilder

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: MIT Imports: 14 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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 ChainID

type ChainID string

ChainID enum that represents possible chain IDs for transactions

const (
	// Mainnet use for connecting to Pocket Mainnet
	Mainnet ChainID = "mainnet"
	// Testnet use for connecting to Pocket Testnet
	Testnet ChainID = "testnet"
	// Localnet use for connecting to Pocket Localnet
	Localnet ChainID = "localnet"
)

type CoinDenom

type CoinDenom string

CoinDenom enum that represents all coin denominations of Pocket

const (
	// Upokt represents upokt denomination
	Upokt CoinDenom = "upokt"
	// Pokt represents pokt denomination
	Pokt CoinDenom = "pokt"
)

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

Submit does the transaction from raw input

func (*TransactionBuilder) SubmitWithCtx added in v0.13.1

SubmitWithCtx does the transaction from raw input

type TransactionMessage

type TransactionMessage interface {
	coreTypes.ProtoMsg
}

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

type TransactionOptions struct {
	Memo      string
	Fee       int64
	CoinDenom CoinDenom
}

TransactionOptions represents optional parameters for transaction request

Jump to

Keyboard shortcuts

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