transaction

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Secp256k1EmptyWitnessArg            = NewEmptyWitnessArg(65)
	Secp256k1EmptyWitnessArgPlaceholder = make([]byte, 85)
	Secp256k1SignaturePlaceholder       = make([]byte, 65)
)

Functions

func AddInputsForTransaction

func AddInputsForTransaction(transaction *types.Transaction, inputs []*types.CellInput, signatureLengthInBytes uint) ([]int, *types.WitnessArgs, error)

func CalculateTransactionFee

func CalculateTransactionFee(tx *types.Transaction, feeRate uint64) uint64

func MsgFromTxForMultiSig

func MsgFromTxForMultiSig(transaction *types.Transaction, group []int, multisigScript []byte) ([]byte, error)

func MultiSignTransaction

func MultiSignTransaction(transaction *types.Transaction, group []int, witnessArgs *types.WitnessArgs, serialize []byte, signatures ...[]byte) error

func NewEmptyWitnessArg

func NewEmptyWitnessArg(LockScriptLength uint) *types.WitnessArgs

func NewSecp256k1HybirdSigTx

func NewSecp256k1HybirdSigTx(scripts *utils.SystemScripts) *types.Transaction

func NewSecp256k1MultiSigTx

func NewSecp256k1MultiSigTx(scripts *utils.SystemScripts) *types.Transaction

func NewSecp256k1SingleSigTx

func NewSecp256k1SingleSigTx(scripts *utils.SystemScripts) *types.Transaction

func SingleSegmentSignMessage

func SingleSegmentSignMessage(transaction *types.Transaction, start int, end int, witnessArgs *types.WitnessArgs) ([]byte, error)

func SingleSegmentSignTransaction

func SingleSegmentSignTransaction(transaction *types.Transaction, start int, end int, witnessArgs *types.WitnessArgs, key crypto.Key) error

func SingleSignTransaction

func SingleSignTransaction(transaction *types.Transaction, group []int, witnessArgs *types.WitnessArgs, key crypto.Key) error

group is an array, which content is the index of input after grouping

Types

type Context

type Context struct {
	Key     *secp256k1.Secp256k1Key
	Payload interface{}
}

func NewContext

func NewContext(ecPrivateKey string) (*Context, error)

func NewContextWithPayload

func NewContextWithPayload(ecPrivateKey string, payload interface{}) (*Context, error)

type Contexts

type Contexts []*Context

func NewContexts

func NewContexts() Contexts

func (*Contexts) Add

func (r *Contexts) Add(context *Context) bool

func (*Contexts) AddByPrivateKeys

func (r *Contexts) AddByPrivateKeys(ecPrivateKeys ...string) error

type ScriptGroup

type ScriptGroup struct {
	Script        *types.Script `json:"script"`
	GroupType     ScriptType    `json:"group_type"`
	InputIndices  []uint32      `json:"input_indices"`
	OutputIndices []uint32      `json:"output_indices"`
}

func (*ScriptGroup) UnmarshalJSON

func (r *ScriptGroup) UnmarshalJSON(input []byte) error

type ScriptType

type ScriptType string
const (
	ScriptTypeLock ScriptType = "lock"
	ScriptTypeType ScriptType = "type"
)

func (*ScriptType) UnmarshalJSON

func (r *ScriptType) UnmarshalJSON(input []byte) error

type TransactionWithScriptGroups

type TransactionWithScriptGroups struct {
	TxView       *types.Transaction `json:"tx_view"`
	ScriptGroups []*ScriptGroup     `json:"script_groups"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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