utils

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	FlagSinceRelative    = 0x8000000000000000
	FlagSinceEpochNumber = 0x2000000000000000
	FlagSinceBlockNumber = 0x0
	FlagSinceTimestamp   = 0x4000000000000000
)

define some useful const https://github.com/nervosnetwork/ckb/blob/35392279150fe4e61b7904516be91bda18c46f05/test/src/utils.rs#L24

View Source
const (
	AnyoneCanPayCodeHashOnLina   = "0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354"
	AnyoneCanPayCodeHashOnAggron = "0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356"
)

Variables

This section is empty.

Functions

func ChequeCellArgs added in v0.3.0

func ChequeCellArgs(senderLock, receiverLock *types.Script) ([]byte, error)

func GenerateSudtAmount added in v0.2.0

func GenerateSudtAmount(amount *big.Int) []byte

func GetMaxMatureBlockNumber added in v0.41.0

func GetMaxMatureBlockNumber(client rpc.Client, ctx context.Context) (uint64, error)

GetMaxMatureBlockNumber return max mature block number

func IsChequeCell added in v0.3.0

func IsChequeCell(o *types.CellOutput, systemScripts *SystemScripts) bool

func IsMature added in v0.41.0

func IsMature(cell *indexer.LiveCell, maxMatureBlockNumber uint64) bool

IsMature check if a cellbase live cell is mature

func ParseSudtAmount added in v0.2.0

func ParseSudtAmount(outputData []byte) (*big.Int, error)

func RemoveCellOutput added in v0.3.0

func RemoveCellOutput(cellOutputs []*types.CellOutput, index int) []*types.CellOutput

func RemoveCellOutputData added in v0.3.0

func RemoveCellOutputData(cellOutputData [][]byte, index int) [][]byte

func SinceFromAbsoluteBlockNumber added in v0.3.0

func SinceFromAbsoluteBlockNumber(blockNumber uint64) uint64

func SinceFromAbsoluteEpochNumber added in v0.3.0

func SinceFromAbsoluteEpochNumber(epochNumber uint64) uint64

func SinceFromAbsoluteTimestamp added in v0.3.0

func SinceFromAbsoluteTimestamp(timestamp uint64) uint64

func SinceFromRelativeBlockNumber added in v0.3.0

func SinceFromRelativeBlockNumber(blockNumber uint64) uint64

func SinceFromRelativeEpochNumber added in v0.3.0

func SinceFromRelativeEpochNumber(epochNumber uint64) uint64

func SinceFromRelativeTimestamp added in v0.3.0

func SinceFromRelativeTimestamp(timestamp uint64) uint64

Types

type Option added in v0.3.0

type Option func(*SystemScripts)

func ACPCell added in v0.3.0

func ACPCell(acpCell *SystemScriptCell) Option

ACPCell set a custom acp system script cell to SystemScripts

func ChequeCell added in v0.3.0

func ChequeCell(chequeCell *SystemScriptCell) Option

ChequeCell set a custom cheque script cell to SystemScripts

func DaoCell added in v0.3.0

func DaoCell(daoCell *SystemScriptCell) Option

DaoCell set a custom dao cell to SystemScripts

func SUDTCell added in v0.3.0

func SUDTCell(sudtCell *SystemScriptCell) Option

SUDTCell set a custom sudt system script cell to SystemScripts

func SecpMultiSigCell added in v0.3.0

func SecpMultiSigCell(secpMultiSigCell *SystemScriptCell) Option

SecpMultiSigCell set a custom secp mutisig cell to SystemScripts

func SecpSingleSigCell added in v0.3.0

func SecpSingleSigCell(secpSingleSigCell *SystemScriptCell) Option

SecpSingleSigCell set a custom secp single sig cell to SystemScripts

type SystemScriptCell

type SystemScriptCell struct {
	CellHash types.Hash
	OutPoint *types.OutPoint
	HashType types.ScriptHashType
	DepType  types.DepType
}

type SystemScripts

type SystemScripts struct {
	SecpSingleSigCell *SystemScriptCell
	SecpMultiSigCell  *SystemScriptCell
	DaoCell           *SystemScriptCell
	ACPCell           *SystemScriptCell
	SUDTCell          *SystemScriptCell
	ChequeCell        *SystemScriptCell
}

func NewSystemScripts

func NewSystemScripts(client rpc.Client, options ...Option) (*SystemScripts, error)

NewSystemScripts returns a SystemScripts object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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