builder

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Overview

Package builder implements CKB transaction builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CkbTransactionBuilder

type CkbTransactionBuilder struct {
	SimpleTransactionBuilder
	FeeRate uint
	// contains filtered or unexported fields
}

func NewCkbTransactionBuilder

func NewCkbTransactionBuilder(network types.Network, iterator collector.CellIterator) *CkbTransactionBuilder

func (*CkbTransactionBuilder) AddChangeOutputByAddress

func (r *CkbTransactionBuilder) AddChangeOutputByAddress(addr string) error

func (*CkbTransactionBuilder) AddDaoDepositOutputByAddress

func (r *CkbTransactionBuilder) AddDaoDepositOutputByAddress(addr string, capacity uint64) error

func (*CkbTransactionBuilder) Build

func (r *CkbTransactionBuilder) Build(contexts ...interface{}) (*transaction.TransactionWithScriptGroups, error)

type DaoTransactionBuilder

type DaoTransactionBuilder struct {
	CkbTransactionBuilder
	// contains filtered or unexported fields
}

func NewDaoTransactionBuilder

func NewDaoTransactionBuilder(network types.Network, iterator collector.CellIterator, daoOutPoint *types.OutPoint, client rpc.Client) (*DaoTransactionBuilder, error)

func (*DaoTransactionBuilder) AddWithdrawOutput

func (r *DaoTransactionBuilder) AddWithdrawOutput(addr string) error

type DaoTransactionType

type DaoTransactionType uint
const (
	DaoTransactionTypeWithdraw DaoTransactionType = iota
	DaoTransactionTypeClaim
)

type SimpleTransactionBuilder

type SimpleTransactionBuilder struct {
	Version     uint32
	CellDeps    []*types.CellDep
	HeaderDeps  []types.Hash
	Inputs      []*types.CellInput
	Outputs     []*types.CellOutput
	OutputsData [][]byte
	Witnesses   [][]byte

	ScriptHandlers []collector.ScriptHandler
	// contains filtered or unexported fields
}

func NewSimpleTransactionBuilder

func NewSimpleTransactionBuilder(network types.Network) *SimpleTransactionBuilder

NewSimpleTransactionBuilder creates a new transaction builder and register the collector.ScriptHandler of popular scripts for the specific network.

To create an empty builder without script handlers, just uses '&SimpleTransactionBuilder{}'.

func (*SimpleTransactionBuilder) AddCellDep

func (r *SimpleTransactionBuilder) AddCellDep(cellDep *types.CellDep) int

func (*SimpleTransactionBuilder) AddHeaderDep

func (r *SimpleTransactionBuilder) AddHeaderDep(headerDep types.Hash) int

func (*SimpleTransactionBuilder) AddInput

func (r *SimpleTransactionBuilder) AddInput(input *types.CellInput) int

func (*SimpleTransactionBuilder) AddOutput

func (r *SimpleTransactionBuilder) AddOutput(output *types.CellOutput, data []byte) int

func (*SimpleTransactionBuilder) AddOutputByAddress

func (r *SimpleTransactionBuilder) AddOutputByAddress(addr string, capacity uint64) error

func (*SimpleTransactionBuilder) AddScriptGroup

func (r *SimpleTransactionBuilder) AddScriptGroup(group *transaction.ScriptGroup) int

func (*SimpleTransactionBuilder) Build

func (r *SimpleTransactionBuilder) Build(contexts ...interface{}) (*transaction.TransactionWithScriptGroups, error)

func (*SimpleTransactionBuilder) BuildTransaction

func (*SimpleTransactionBuilder) Register

func (r *SimpleTransactionBuilder) Register(handler collector.ScriptHandler)

func (*SimpleTransactionBuilder) SetOutputData

func (r *SimpleTransactionBuilder) SetOutputData(index uint, data []byte) error

func (*SimpleTransactionBuilder) SetSince

func (r *SimpleTransactionBuilder) SetSince(index uint, since uint64) error

func (*SimpleTransactionBuilder) SetVersion

func (r *SimpleTransactionBuilder) SetVersion(version uint32)

func (*SimpleTransactionBuilder) SetWitness

func (r *SimpleTransactionBuilder) SetWitness(index uint, witnessType types.WitnessType, data []byte) error

type SudtTransactionBuilder

type SudtTransactionBuilder struct {
	SimpleTransactionBuilder
	FeeRate  uint
	SudtType *types.Script
	// contains filtered or unexported fields
}

func NewSudtTransactionBuilderFromSudtArgs

func NewSudtTransactionBuilderFromSudtArgs(network types.Network, iterator collector.CellIterator,
	transactionType SudtTransactionType, sudtArgs []byte) *SudtTransactionBuilder

func NewSudtTransactionBuilderFromSudtOwnerAddress

func NewSudtTransactionBuilderFromSudtOwnerAddress(network types.Network, iterator collector.CellIterator,
	transactionType SudtTransactionType, sudtOwnerAddress string) (*SudtTransactionBuilder, error)

func (*SudtTransactionBuilder) AddChangeOutputByAddress

func (r *SudtTransactionBuilder) AddChangeOutputByAddress(addr string) error

func (*SudtTransactionBuilder) AddSudtOutputByAddress

func (r *SudtTransactionBuilder) AddSudtOutputByAddress(addr string, sudtAmount *big.Int) (int, error)

func (*SudtTransactionBuilder) AddSudtOutputWithCapacityByAddress

func (r *SudtTransactionBuilder) AddSudtOutputWithCapacityByAddress(addr string, capacity uint64, sudtAmount *big.Int) (int, error)

func (*SudtTransactionBuilder) Build

func (r *SudtTransactionBuilder) Build(contexts ...interface{}) (*transaction.TransactionWithScriptGroups, error)

type SudtTransactionType

type SudtTransactionType uint
const (
	SudtTransactionTypeIssue SudtTransactionType = iota
	SudtTransactionTypeTransfer
)

Jump to

Keyboard shortcuts

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