utils

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: 10 Imported by: 0

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

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

func GenerateSudtAmount

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

func GetMaxMatureBlockNumber

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

GetMaxMatureBlockNumber return max mature block number

func IsChequeCell

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

func IsMature

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

IsMature check if a cellbase live cell is mature

func ParseSudtAmount

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

func RemoveCellOutput

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

func RemoveCellOutputData

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

func SinceFromAbsoluteBlockNumber

func SinceFromAbsoluteBlockNumber(blockNumber uint64) uint64

func SinceFromAbsoluteEpochNumber

func SinceFromAbsoluteEpochNumber(epochNumber uint64) uint64

func SinceFromAbsoluteTimestamp

func SinceFromAbsoluteTimestamp(timestamp uint64) uint64

func SinceFromRelativeBlockNumber

func SinceFromRelativeBlockNumber(blockNumber uint64) uint64

func SinceFromRelativeEpochNumber

func SinceFromRelativeEpochNumber(epochNumber uint64) uint64

func SinceFromRelativeTimestamp

func SinceFromRelativeTimestamp(timestamp uint64) uint64

Types

type Option

type Option func(*SystemScripts)

func ACPCell

func ACPCell(acpCell *SystemScriptCell) Option

ACPCell set a custom acp system script cell to SystemScripts

func ChequeCell

func ChequeCell(chequeCell *SystemScriptCell) Option

ChequeCell set a custom cheque script cell to SystemScripts

func DaoCell

func DaoCell(daoCell *SystemScriptCell) Option

DaoCell set a custom dao cell to SystemScripts

func SUDTCell

func SUDTCell(sudtCell *SystemScriptCell) Option

SUDTCell set a custom sudt system script cell to SystemScripts

func SecpMultiSigCell

func SecpMultiSigCell(secpMultiSigCell *SystemScriptCell) Option

SecpMultiSigCell set a custom secp mutisig cell to SystemScripts

func SecpSingleSigCell

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