txs

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAminoCodec added in v0.19.0

func NewAminoCodec() *aminoCodec

func NewJSONCodec added in v0.19.0

func NewJSONCodec() *jsonCodec

Types

type Codec added in v0.19.0

type Codec interface {
	Encoder
	Decoder
}

type Decoder added in v0.18.0

type Decoder interface {
	DecodeTx(txBytes []byte) (*Envelope, error)
}

type Encoder added in v0.18.0

type Encoder interface {
	EncodeTx(envelope *Envelope) ([]byte, error)
}

type Envelope added in v0.19.0

type Envelope struct {
	Signatories []Signatory
	Tx          *Tx
}

An envelope contains both the signable Tx and the signatures for each input (in signatories)

func Enclose added in v0.19.0

func Enclose(chainID string, payload payload.Payload) *Envelope

Enclose a Payload in an Envelope so it is ready to be signed by first wrapping the Payload as a Tx (including ChainID) and writing it to the Tx field of the Envelope

func (*Envelope) Sign added in v0.19.0

func (txEnv *Envelope) Sign(signingAccounts ...acm.AddressableSigner) error

Sign the Tx Envelope by adding Signatories containing the signatures for each TxInput. signing accounts for each input must be provided (in any order).

func (*Envelope) String added in v0.19.0

func (txEnv *Envelope) String() string

func (*Envelope) Validate added in v0.19.0

func (txEnv *Envelope) Validate() error

Returns an error if Envelope has a nil transaction or zero signatures (and therefore could not possibly be valid)

func (*Envelope) Verify added in v0.19.0

func (txEnv *Envelope) Verify(getter state.AccountGetter) error

Verifies the validity of the Signatories' Signatures in the Envelope. The Signatories must appear in the same order as the inputs as returned by Tx.GetInputs().

type Receipt

type Receipt struct {
	TxHash          binary.HexBytes
	CreatesContract bool
	ContractAddress crypto.Address
}

BroadcastTx or Transaction receipt

type Signatory added in v0.19.0

type Signatory struct {
	Address   *crypto.Address
	PublicKey *crypto.PublicKey
	crypto.Signature
}

Signatory contains signature and one or both of Address and PublicKey to identify the signer

func (*Signatory) RealisePublicKey added in v0.19.0

func (s *Signatory) RealisePublicKey(getter state.AccountGetter) error

Attempts to 'realise' the PublicKey and Address of a Signatory possibly referring to state in the case where the Signatory contains an Address by no PublicKey. Checks consistency in other cases, possibly generating the Address from the PublicKey

type Tx

type Tx struct {
	ChainID string
	payload.Payload
	// contains filtered or unexported fields
}

Tx is the canonical object that we serialise to produce the SignBytes that we sign

func NewTx added in v0.19.0

func NewTx(payload payload.Payload) *Tx

Wrap the Payload in Tx required for signing and serialisation

func (*Tx) Enclose added in v0.19.0

func (tx *Tx) Enclose() *Envelope

Enclose this Tx in an Envelope to be signed

func (*Tx) GenerateReceipt added in v0.19.0

func (tx *Tx) GenerateReceipt() *Receipt

Generate a transaction Receipt containing the Tx hash and other information if the Tx is call. Returned by ABCI methods.

func (*Tx) Hash added in v0.18.0

func (tx *Tx) Hash() []byte

Generate a Hash for this transaction based on the SignBytes. The hash is memoized over the lifetime of the Tx so repeated calls to Hash() are effectively free

func (*Tx) MarshalJSON added in v0.19.0

func (tx *Tx) MarshalJSON() ([]byte, error)

func (*Tx) MustSignBytes added in v0.19.0

func (tx *Tx) MustSignBytes() []byte

Generate SignBytes, panicking on any failure

func (*Tx) Rehash added in v0.19.0

func (tx *Tx) Rehash() []byte

Regenerate the Tx hash if it has been mutated or as called by Hash() in first instance

func (*Tx) Sign added in v0.18.0

func (tx *Tx) Sign(signingAccounts ...acm.AddressableSigner) (*Envelope, error)

Encloses in Envelope and signs envelope

func (*Tx) SignBytes added in v0.19.0

func (tx *Tx) SignBytes() ([]byte, error)

Produces the canonical SignBytes (the Tx message that will be signed) for a Tx

func (*Tx) String added in v0.18.0

func (tx *Tx) String() string

func (*Tx) Type added in v0.19.0

func (tx *Tx) Type() payload.Type

func (*Tx) UnmarshalJSON added in v0.19.0

func (tx *Tx) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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