tx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFee

type ClientFee interface {
	sdk.Fee
	SetGas(uint64)
	SetAmount(sdk.Coins)
}

type ClientSignature

type ClientSignature interface {
	sdk.Signature
	SetPubKey(crypto.PubKey) error
	SetSignature([]byte)
}

type ClientTx

type ClientTx interface {
	sdk.Tx
	codec.ProtoMarshaler

	SetMsgs(...sdk.Msg) error
	GetSignatures() []sdk.Signature
	SetSignatures(...ClientSignature) error
	GetFee() sdk.Fee
	SetFee(ClientFee) error
	GetMemo() string
	SetMemo(string)

	// CanonicalSignBytes returns the canonical JSON bytes to sign over, given a
	// chain ID, along with an account and sequence number. The JSON encoding
	// ensures all field names adhere to their proto definition, default values
	// are omitted, and follows the JSON Canonical Form.
	CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error)
}

ClientTx defines an interface which an application-defined concrete transaction type must implement. Namely, it must be able to set messages, generate signatures, and provide canonical bytes to sign over. The transaction must also know how to encode itself.

type Factory

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

Factory implements a transaction context created in SDK modules.

func NewFactory

func NewFactory() *Factory

NewFactory return a point of the instance of Factory.

func (*Factory) AccountNumber

func (f *Factory) AccountNumber() uint64

AccountNumber returns accountNumber.

func (*Factory) Address

func (f *Factory) Address() string

Address returns the address.

func (*Factory) BuildAndSign

func (f *Factory) BuildAndSign(name string, msgs []sdk.Msg, json bool) ([]byte, error)

func (*Factory) BuildUnsignedTx

func (f *Factory) BuildUnsignedTx(msgs []sdk.Msg) (sdk.TxBuilder, error)

func (*Factory) ChainID

func (f *Factory) ChainID() string

ChainID returns the chainID of the current chain.

func (*Factory) Fees

func (f *Factory) Fees() sdk.Coins

Fees returns the fee of the transaction.

func (*Factory) Gas

func (f *Factory) Gas() uint64

Gas returns the gas of the transaction.

func (Factory) GasAdjustment

func (f Factory) GasAdjustment() float64

GasAdjustment returns the gasAdjustment.

func (*Factory) KeyManager

func (f *Factory) KeyManager() sdk.KeyManager

KeyManager returns keyManager.

func (*Factory) Memo

func (f *Factory) Memo() string

Memo returns memo.

func (*Factory) Mode

func (f *Factory) Mode() sdk.BroadcastMode

Mode returns mode.

func (*Factory) Password

func (f *Factory) Password() string

Password returns password.

func (*Factory) Sequence

func (f *Factory) Sequence() uint64

Sequence returns the sequence of the account.

func (*Factory) Sign

func (f *Factory) Sign(name string, txBuilder sdk.TxBuilder) error

Sign signs a transaction given a name, passphrase, and a single message to signed. An error is returned if signing fails.

func (*Factory) SimulateAndExecute

func (f *Factory) SimulateAndExecute() bool

SimulateAndExecute returns the option to simulateAndExecute and then execute the transaction using the gas from the simulation results

func (*Factory) WithAccountNumber

func (f *Factory) WithAccountNumber(accnum uint64) *Factory

WithAccountNumber returns a pointer of the context with an account number.

func (*Factory) WithAddress

func (f *Factory) WithAddress(address string) *Factory

WithAddress returns a pointer of the context with a password.

func (*Factory) WithChainID

func (f *Factory) WithChainID(chainID string) *Factory

WithChainID returns a pointer of the context with an updated ChainID.

func (*Factory) WithFee

func (f *Factory) WithFee(fee sdk.Coins) *Factory

WithFee returns a pointer of the context with an updated Fee.

func (*Factory) WithGas

func (f *Factory) WithGas(gas uint64) *Factory

WithGas returns a pointer of the context with an updated Gas.

func (*Factory) WithGasAdjustment

func (f *Factory) WithGasAdjustment(gasAdjustment float64) *Factory

WithGasAdjustment returns a pointer of the context with an updated gasAdjustment.

func (*Factory) WithKeyManager

func (f *Factory) WithKeyManager(keyManager sdk.KeyManager) *Factory

WithKeyManager returns a pointer of the context with a KeyManager.

func (*Factory) WithMemo

func (f *Factory) WithMemo(memo string) *Factory

WithMemo returns a pointer of the context with an updated memo.

func (*Factory) WithMode

func (f *Factory) WithMode(mode sdk.BroadcastMode) *Factory

WithMode returns a pointer of the context with a Mode.

func (*Factory) WithPassword

func (f *Factory) WithPassword(password string) *Factory

WithPassword returns a pointer of the context with a password.

func (*Factory) WithQueryFunc

func (f *Factory) WithQueryFunc(queryFunc QueryWithData) *Factory

WithQueryFunc returns a pointer of the context with an queryFunc.

func (*Factory) WithSequence

func (f *Factory) WithSequence(sequence uint64) *Factory

WithSequence returns a pointer of the context with an updated sequence number.

func (*Factory) WithSignModeHandler

func (f *Factory) WithSignModeHandler(signModeHandler sdk.SignModeHandler) *Factory

WithSignModeHandler returns a pointer of the context with an signModeHandler.

func (*Factory) WithSimulateAndExecute

func (f *Factory) WithSimulateAndExecute(simulate bool) *Factory

WithSimulateAndExecute returns a pointer of the context with a simulateAndExecute.

func (*Factory) WithTxConfig

func (f *Factory) WithTxConfig(txConfig sdk.TxConfig) *Factory

WithTxConfig returns a pointer of the context with an TxConfig

type Generator

type Generator interface {
	NewTx() ClientTx
	NewFee() ClientFee
	NewSignature() ClientSignature
}

Generator defines an interface a client can utilize to generate an application-defined concrete transaction type. The type returned must implement ClientTx.

type QueryWithData

type QueryWithData func(string, []byte) ([]byte, int64, error)

QueryWithData implements a query method from cschain.

Jump to

Keyboard shortcuts

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