Versions in this module Expand all Collapse all v1 v1.1.2 Sep 16, 2021 Changes in this version + var ChainTxMergeGas = uint64(6000000) + var ChainTxUtxoNum = 5 + var ErrAction = errors.New("errors occurred in one or more actions") + var ErrBadAmount = errors.New("bad asset amount") + var ErrBadContractArgType = errors.New("invalid contract argument type") + var ErrBadInstructionCount = errors.New("too many signing instructions in template") + var ErrBadRefData = errors.New("transaction reference data does not match previous template's reference data") + var ErrBadTxInputIdx = errors.New("unsigned tx missing input") + var ErrBadWitnessComponent = errors.New("invalid witness component") + var ErrBlankCheck = errors.New("unsafe transaction: leaves assets free to control") + var ErrEmptyProgram = errors.New("empty signature program") + var ErrExtTxFee = errors.New("transaction fee exceed max limit") + var ErrMissingFields = errors.New("required field is missing") + var ErrMissingRawTx = errors.New("missing raw tx") + var ErrNoGasInput = errors.New("transaction has no gas input") + var ErrNoTxSighashAttempt = errors.New("no tx sighash attempted") + var ErrNoTxSighashCommitment = errors.New("no commitment to tx sighash") + var ErrOrphanTx = errors.New("finalize can't find transaction input utxo") + var ErrRejected = errors.New("transaction rejected") + var ErrTxSignatureFailure = errors.New("tx signature was attempted but failed") + func AddContractArgs(sigInst *SigningInstruction, arguments []ContractArgument) error + func CalculateTxFee(tx *types.Tx) (fee uint64) + func FinalizeTx(ctx context.Context, c *protocol.Chain, tx *types.Tx) error + func MissingFieldsError(name ...string) error + func Sign(ctx context.Context, tpl *Template, auth string, signFn SignFunc) error + func SignProgress(txTemplate *Template) bool + type Action interface + ActionType func() string + Build func(context.Context, *TemplateBuilder) error + func DecodeControlAddressAction(data []byte) (Action, error) + func DecodeControlProgramAction(data []byte) (Action, error) + func DecodeRetireAction(data []byte) (Action, error) + type BoolArgument struct + Value bool + type ContractArgument struct + RawData json.RawMessage + Type string + type DataArgument struct + Value chainjson.HexBytes + type DataWitness chainjson.HexBytes + func (dw DataWitness) MarshalJSON() ([]byte, error) + type EstimateTxGasInfo struct + ChainTxNeu int64 + FlexibleNeu int64 + StorageNeu int64 + TotalNeu int64 + VMNeu int64 + func EstimateChainTxGas(templates []Template) (*EstimateTxGasInfo, error) + func EstimateTxGas(template Template) (*EstimateTxGasInfo, error) + type IntegerArgument struct + Value int64 + type RawTxSigArgument struct + Path []chainjson.HexBytes + RootXPub chainkd.XPub + type RawTxSigWitness struct + Keys []keyID + Quorum int + Sigs []chainjson.HexBytes + func (sw RawTxSigWitness) MarshalJSON() ([]byte, error) + type Receiver struct + Address string + ControlProgram chainjson.HexBytes + type SignFunc func(context.Context, chainkd.XPub, [][]byte, [32]byte, string) ([]byte, error) + type SignatureWitness struct + Keys []keyID + Program chainjson.HexBytes + Quorum int + Sigs []chainjson.HexBytes + func (sw SignatureWitness) MarshalJSON() ([]byte, error) + type SigningInstruction struct + Position uint32 + WitnessComponents []witnessComponent + func (si *SigningInstruction) AddRawWitnessKeys(xpubs []chainkd.XPub, path [][]byte, quorum int) + func (si *SigningInstruction) AddWitnessKeys(xpubs []chainkd.XPub, path [][]byte, quorum int) + func (si *SigningInstruction) UnmarshalJSON(b []byte) error + type StrArgument struct + Value string + type Template struct + AllowAdditional bool + Fee uint64 + SigningInstructions []*SigningInstruction + Transaction *types.Tx + func Build(ctx context.Context, tx *types.TxData, actions []Action, maxTime time.Time, ...) (*Template, error) + func (t *Template) Hash(idx uint32) bc.Hash + type TemplateBuilder struct + func NewBuilder(maxTime time.Time) *TemplateBuilder + func (b *TemplateBuilder) AddInput(in *types.TxInput, sigInstruction *SigningInstruction) error + func (b *TemplateBuilder) AddOutput(o *types.TxOutput) error + func (b *TemplateBuilder) Build() (*Template, *types.TxData, error) + func (b *TemplateBuilder) InputCount() int + func (b *TemplateBuilder) MaxTime() time.Time + func (b *TemplateBuilder) OnBuild(buildFn func() error) + func (b *TemplateBuilder) OnRollback(rollbackFn func()) + func (b *TemplateBuilder) RestrictMaxTime(t time.Time) + func (b *TemplateBuilder) RestrictMinTime(t time.Time) + func (b *TemplateBuilder) Rollback()