Documentation
¶
Index ¶
- type BootstrapWitness
- type Tx
- func (t *Tx) AddInputs(inputs ...*TxInput) error
- func (t *Tx) AddOutputs(outputs ...*TxOutput) error
- func (t *Tx) Bytes() ([]byte, error)
- func (t *Tx) CalculateAuxiliaryDataHash() error
- func (t *Tx) Fee(lfee *fees.LinearFee) (uint, error)
- func (t *Tx) Hash() ([32]byte, error)
- func (t *Tx) Hex() (string, error)
- func (t *Tx) SetFee(fee uint)
- type TxBody
- type TxBuilder
- func (tb *TxBuilder) AddChangeIfNeeded(addr address.Address)
- func (tb *TxBuilder) AddInputs(inputs ...*TxInput)
- func (tb *TxBuilder) AddOutputs(outputs ...*TxOutput)
- func (tb *TxBuilder) Build() (tx Tx, err error)
- func (tb TxBuilder) MinFee() (fee uint)
- func (tb *TxBuilder) SetTTL(ttl uint32)
- func (tb *TxBuilder) Sign(xprv bip32.XPrv)
- func (tb *TxBuilder) Tx() (tx *Tx)
- type TxInput
- type TxOutput
- type VKeyWitness
- type Witness
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootstrapWitness ¶
type BootstrapWitness struct {
VKey []byte
Signature []byte
ChainCode []byte
Attributes []byte
// contains filtered or unexported fields
}
BootstrapWitness for use with Byron/Legacy based transactions
type Tx ¶
type Tx struct {
Body *TxBody
Witness *Witness
Valid bool
Metadata interface{}
// contains filtered or unexported fields
}
func (*Tx) AddOutputs ¶
AddOutputs adds the outputs to the transaction body
func (*Tx) CalculateAuxiliaryDataHash ¶
func (*Tx) Fee ¶
Fee returns the fee(in lovelaces) required by the transaction from the linear formula fee = txFeeFixed + txFeePerByte*tx_len_in_bytes
func (*Tx) Hash ¶
Hash performs a blake2b hash of the transaction body and returns a slice of [32]byte
type TxBody ¶
type TxBody struct {
Inputs []*TxInput `cbor:"0,keyasint"`
Outputs []*TxOutput `cbor:"1,keyasint"`
Fee uint64 `cbor:"2,keyasint"`
TTL uint32 `cbor:"3,keyasint,omitempty"`
AuxiliaryDataHash []byte `cbor:"7,keyasint,omitempty"`
}
TxBody contains the inputs, outputs, fee and titme to live for the transaction.
type TxBuilder ¶
type TxBuilder struct {
// contains filtered or unexported fields
}
TxBuilder - used to create, validate and sign transactions.
func NewTxBuilder ¶
NewTxBuilder returns pointer to a new TxBuilder.
func (*TxBuilder) AddChangeIfNeeded ¶
AddChangeIfNeeded calculates the excess change from UTXO inputs - outputs and adds it to the transaction body.
func (*TxBuilder) AddOutputs ¶
AddOutputs add outputs to the transaction body
func (*TxBuilder) Build ¶
Build creates hash of transaction, signs the hash using supplied witnesses and adds them to the transaction.
type TxInput ¶
func NewTxInput ¶
NewTxInput creates and returns a *TxInput from Transaction Hash(Hex Encoded), Transaction Index and Amount.
func (*TxInput) MarshalCBOR ¶
type TxOutput ¶
type VKeyWitness ¶
VKeyWitness - Witness for use with Shelley based transactions
func NewVKeyWitness ¶
func NewVKeyWitness(vkey, signature []byte) *VKeyWitness
NewVKeyWitness creates a Witness for Shelley Based transactions from a verification key and transaction signature.
type Witness ¶
type Witness struct {
Keys []*VKeyWitness `cbor:"0,keyasint,omitempty"`
}
func NewTXWitness ¶
func NewTXWitness(keys ...*VKeyWitness) *Witness
NewTXWitness returns a pointer to a Witness created from VKeyWitnesses.