gotype

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountCellRegisterCap

func AccountCellRegisterCap(configCell *ConfigCell, account celltype.DasAccount) (uint64, error)

func BindConfigCellDataFromTx

func BindConfigCellDataFromTx(tx *types.Transaction, configCell *ConfigCell) error

func CalAccountCellExpiredAt

func CalAccountCellExpiredAt(param celltype.CalAccountCellExpiredAtParam, registerAt int64) (uint64, error)

func CalAccountSpend

func CalAccountSpend(account celltype.DasAccount) uint64

func CalBuyAccountYearSec

func CalBuyAccountYearSec(years uint) int64

func CalDasAwardCap

func CalDasAwardCap(cap uint64, rate float64) (uint64, error)

func CalPreAccountCellCap

func CalPreAccountCellCap(years uint, price, quote, discountRate uint64, configCell *ConfigCell, account celltype.DasAccount, isRenew bool) (uint64, error)

func GetDasLockScript

func GetDasLockScript(chainType celltype.ChainType, address Address) (*ckbTypes.Script, error)

func GetOwnerArgsFromDasLockArgs

func GetOwnerArgsFromDasLockArgs(args []byte) (celltype.ChainType, string)

ckb argsHexStr, eth address

func GetScriptTypeFromLockScript

func GetScriptTypeFromLockScript(ckbSysScript *utils.SystemScripts, lockScript *ckbTypes.Script) (celltype.LockScriptType, error)

func IsCancelAccountAuctionTx

func IsCancelAccountAuctionTx(tx types.Transaction) bool

func IsCancelAccountSaleTx

func IsCancelAccountSaleTx(tx types.Transaction) bool

func IsConfirmProposeTx

func IsConfirmProposeTx(ctx context.Context, rpcClient rpc.Client, inputs []*types.CellInput) error

func IsEditManagerTx

func IsEditManagerTx(tx types.Transaction) bool

func IsEditRecordsTx

func IsEditRecordsTx(tx types.Transaction) bool

func IsRenewAccountTx

func IsRenewAccountTx(tx types.Transaction) bool

func IsStartAccountAuctionTx

func IsStartAccountAuctionTx(tx types.Transaction) bool

func IsStartAccountSaleTx

func IsStartAccountSaleTx(tx types.Transaction) (bool, int)

func IsTransferAccountTx

func IsTransferAccountTx(tx types.Transaction) bool

func VersionCompatibleAccountCellDataFromSlice

func VersionCompatibleAccountCellDataFromSlice(cellData *celltype.DataEntity) (*celltype.VersionAccountCell, error)

Types

type AccountCell

type AccountCell struct {
	CellCap       uint64                     `json:"cell_cap"`
	AccountId     celltype.DasAccountId      `json:"account_id"`
	Status        uint8                      `json:"status"`
	Point         types.OutPoint             `json:"point"`
	WitnessStatus celltype.AccountCellStatus `json:"witness_status"`
	Data          []byte                     `json:"-"`
	WitnessData   []byte                     `json:"-"`
	DasLockArgs   []byte                     `json:"-"`
}

func BytesToAccountCellTxValue

func BytesToAccountCellTxValue(bys []byte) (*AccountCell, error)

func (*AccountCell) Bytes

func (a *AccountCell) Bytes() ([]byte, error)

func (*AccountCell) CellDep

func (a *AccountCell) CellDep() *types.CellDep

func (*AccountCell) CellInput

func (a *AccountCell) CellInput() *types.CellInput

func (*AccountCell) DasLockManagerBytes

func (a *AccountCell) DasLockManagerBytes() []byte

func (*AccountCell) DasLockOwnerBytes

func (a *AccountCell) DasLockOwnerBytes() []byte

func (*AccountCell) ExpiredAt

func (a *AccountCell) ExpiredAt() (int64, error)

func (*AccountCell) GetDepWitness

func (a *AccountCell) GetDepWitness() *celltype.CellDepWithWitness

func (*AccountCell) GetNewAccountCellData

func (a *AccountCell) GetNewAccountCellData() (*celltype.VersionAccountCell, error)

func (*AccountCell) GetOldAccountCellData

func (a *AccountCell) GetOldAccountCellData() (*celltype.VersionAccountCell, error)

func (*AccountCell) JudgeExpireStatus

func (a *AccountCell) JudgeExpireStatus(expiredCheck, frozenCheck bool, frozenRange int64) (bool, bool, error)

func (*AccountCell) NextAccountId

func (a *AccountCell) NextAccountId() (celltype.DasAccountId, error)

func (*AccountCell) ParseDasLockArgsIndexType

func (*AccountCell) SameManager

func (a *AccountCell) SameManager(indexHashType celltype.DasLockCodeHashIndexType, args []byte) error

func (*AccountCell) SameOwner

func (a *AccountCell) SameOwner(indexHashType celltype.DasLockCodeHashIndexType, args []byte) error

func (*AccountCell) SameTx

func (a *AccountCell) SameTx(target *AccountCell) bool

func (*AccountCell) SetNextAccountId

func (a *AccountCell) SetNextAccountId(accountId celltype.DasAccountId)

func (*AccountCell) ToDasLockArgParam

func (a *AccountCell) ToDasLockArgParam() *celltype.DasLockParam

func (*AccountCell) TypeInputCell

func (a *AccountCell) TypeInputCell(checkOwnerSign bool) *celltype.TypeInputCell

func (*AccountCell) TypeInputCellInConfirmPropose

func (a *AccountCell) TypeInputCellInConfirmPropose() *celltype.TypeInputCell

func (*AccountCell) UpdateAccountCellInfos

func (a *AccountCell) UpdateAccountCellInfos(
	testNet bool,
	callback func(param *InOutputWitnessCallbackParam) bool,
	setOwner func() (indexType celltype.DasLockCodeHashIndexType, args []byte),
	setManager func() (indexType celltype.DasLockCodeHashIndexType, args []byte)) (*UpdateAccountCellInfo, error)

callback method return 'true' means use the oldData to newData

func (*AccountCell) UpdateAccountCellNextId

func (a *AccountCell) UpdateAccountCellNextId(testNet bool, nextAccountId celltype.DasAccountId) (*UpdateAccountCellInfo, error)

type AccountCellList

type AccountCellList []AccountCell

func (AccountCellList) AccountCellExistMap

func (a AccountCellList) AccountCellExistMap() map[types.Hash]bool

func (AccountCellList) Hash

func (a AccountCellList) Hash(i int) types.Hash

func (AccountCellList) Obj

func (a AccountCellList) Obj(i int) interface{}

func (AccountCellList) Size

func (a AccountCellList) Size() int

type Address

type Address string

func PubkeyHashToAddress

func PubkeyHashToAddress(chainType celltype.ChainType, pubKeyHex string) Address

func (Address) BTCLockScript

func (r Address) BTCLockScript() (*types.Script, error)

func (Address) CKBLockScript

func (r Address) CKBLockScript(singleSigCellHash types.Hash) (*types.Script, error)

func (Address) DasLockScript

func (r Address) DasLockScript(indexType celltype.DasLockCodeHashIndexType) (*types.Script, error)

func (Address) DasLockScript_CKB

func (r Address) DasLockScript_CKB() (*types.Script, error)

func (Address) HexBys

func (r Address) HexBys(singleSigCellHash types.Hash) ([]byte, error)

func (Address) OriginStr

func (r Address) OriginStr() string

func (Address) Str

func (r Address) Str() string

type ConfigCell

type ConfigCell struct {
	ConfigCellChildMap syncmap.Map
}

func NewDefaultConfigCell

func NewDefaultConfigCell(neyType celltype.DasNetType) *ConfigCell

func (*ConfigCell) AccountCellBaseCap

func (c *ConfigCell) AccountCellBaseCap() (uint64, error)

func (*ConfigCell) AccountCellPrepareCap

func (c *ConfigCell) AccountCellPrepareCap() (uint64, error)

func (*ConfigCell) AccountExpirationGracePeriod

func (c *ConfigCell) AccountExpirationGracePeriod() (uint32, error)

frozen

func (*ConfigCell) AccountMaxLength

func (c *ConfigCell) AccountMaxLength() (uint32, error)

account_max_length

func (*ConfigCell) AccountTTL

func (c *ConfigCell) AccountTTL() (uint32, error)

func (*ConfigCell) ApplyMaxWaitingBlockNumber

func (c *ConfigCell) ApplyMaxWaitingBlockNumber() (uint32, error)

apply_max_waiting_time

func (*ConfigCell) ApplyMinWaitingBlockNumber

func (c *ConfigCell) ApplyMinWaitingBlockNumber() (uint32, error)

apply_min_waiting_time

func (*ConfigCell) CKBMultiSoCellDepHash

func (c *ConfigCell) CKBMultiSoCellDepHash() types.Hash

func (*ConfigCell) CKBSingleSoCellDepHash

func (c *ConfigCell) CKBSingleSoCellDepHash() types.Hash

func (*ConfigCell) ETHSoCellDepHash

func (c *ConfigCell) ETHSoCellDepHash() types.Hash

func (*ConfigCell) EditManagerFee

func (c *ConfigCell) EditManagerFee() (uint64, error)

func (*ConfigCell) EditManagerThrottle

func (c *ConfigCell) EditManagerThrottle() (uint32, error)

func (*ConfigCell) EditRecordsFee

func (c *ConfigCell) EditRecordsFee() (uint64, error)

func (*ConfigCell) EditRecordsThrottle

func (c *ConfigCell) EditRecordsThrottle() (uint32, error)

func (*ConfigCell) GetAccountPrice

func (c *ConfigCell) GetAccountPrice(account celltype.DasAccount, isRenew bool) (*celltype.PriceConfig, uint64, error)

func (*ConfigCell) GetAccountPriceConfig

func (c *ConfigCell) GetAccountPriceConfig(account celltype.DasAccount) (*celltype.PriceConfig, error)

func (*ConfigCell) GetAccountRenewPrice

func (c *ConfigCell) GetAccountRenewPrice(account celltype.DasAccount) (*celltype.PriceConfig, uint64, error)

func (*ConfigCell) GetProfitOfChannel

func (c *ConfigCell) GetProfitOfChannel() (decimal.Decimal, error)

func (*ConfigCell) GetProfitOfInviter

func (c *ConfigCell) GetProfitOfInviter() (decimal.Decimal, error)

func (*ConfigCell) GetRegisterProfitConfig

func (c *ConfigCell) GetRegisterProfitConfig() *celltype.ConfigCellProfitRate

func (*ConfigCell) GetWitnessCellDep

func (c *ConfigCell) GetWitnessCellDep(cfgType celltype.TableType) *celltype.CellDepWithWitness

func (*ConfigCell) IncomeCellBaseCap

func (c *ConfigCell) IncomeCellBaseCap() (uint64, error)

func (*ConfigCell) IncomeCellMinTransferValue

func (c *ConfigCell) IncomeCellMinTransferValue() (uint64, error)

func (*ConfigCell) InvitedDiscount

func (c *ConfigCell) InvitedDiscount() (uint32, error)

func (*ConfigCell) InvitedDiscountFormatDiscountObj

func (c *ConfigCell) InvitedDiscountFormatDiscountObj() (float64, error)

func (*ConfigCell) InvitedDiscountFormatValue

func (c *ConfigCell) InvitedDiscountFormatValue() (float64, error)

func (*ConfigCell) OpenStatus

func (c *ConfigCell) OpenStatus() (uint8, error)

func (*ConfigCell) PreparedFeeCapacity

func (c *ConfigCell) PreparedFeeCapacity() (uint64, error)

func (*ConfigCell) ProposalMaxPreAccountContain

func (c *ConfigCell) ProposalMaxPreAccountContain() (uint32, error)

func (*ConfigCell) ProposalMinConfirmRequire

func (c *ConfigCell) ProposalMinConfirmRequire() (uint8, error)

func (*ConfigCell) ProposalMinExtendInterval

func (c *ConfigCell) ProposalMinExtendInterval() (uint8, error)

func (*ConfigCell) ProposalMinRecycleInterval

func (c *ConfigCell) ProposalMinRecycleInterval() (uint8, error)

func (*ConfigCell) Ready

func (c *ConfigCell) Ready() bool

func (*ConfigCell) ReleaseRules

func (c *ConfigCell) ReleaseRules() ([]ReleaseRuleItem, error)

func (*ConfigCell) RemoveConfigFromMap

func (c *ConfigCell) RemoveConfigFromMap(tableType celltype.TableType)

func (*ConfigCell) StorePreservedAccountMap

func (c *ConfigCell) StorePreservedAccountMap(xx *configcells.CfgPreservedAccountXX)

func (*ConfigCell) TRONSoCellDepHash

func (c *ConfigCell) TRONSoCellDepHash() types.Hash

func (*ConfigCell) TransferAccountFee

func (c *ConfigCell) TransferAccountFee() (uint64, error)

func (*ConfigCell) TransferThrottle

func (c *ConfigCell) TransferThrottle() (uint32, error)

type FindTargetTypeScriptRet

type FindTargetTypeScriptRet struct {
	Output        *ckbTypes.CellOutput
	Data          []byte
	Tx            *ckbTypes.Transaction
	PreviousIndex uint
}

type InOutputWitnessCallbackParam

type InOutputWitnessCallbackParam struct {
	OldData    *celltype.VersionAccountCell
	NewBuilder *celltype.AccountCellDataBuilder
	ExpiredAt  *int64
}

type PayTypeLockScriptsRet

type PayTypeLockScriptsRet struct {
	FeeCellScript    *ckbTypes.Script
	UserScript       *ckbTypes.Script
	ScriptType       celltype.LockScriptType
	DasLockArgsParam celltype.DasLockArgsPairParam
	Err              error
}

func PayTypeLockScripts

func PayTypeLockScripts(sysWallet *ckbTypes.Script, sysScripts *utils.SystemScripts, payType celltype.ChainType, address Address) PayTypeLockScriptsRet

type PreCurAccountCell

type PreCurAccountCell struct {
	Pre *AccountCell `json:"pre"`
	Cur *AccountCell `json:"cur"`
}

type ProfitRate

type ProfitRate struct {
	Invite         float64
	Channel        float64
	ProposeCreate  float64
	ProposeConfirm float64
	MergeRate      float64
}

func ParseRegisterProfitConfig

func ParseRegisterProfitConfig(configCell *ConfigCell) (*ProfitRate, error)

type QuoteCell

type QuoteCell struct {
	Data    []byte
	CellDep types.CellDep
}

func (*QuoteCell) Quote

func (q *QuoteCell) Quote() (int64, error)

type ReleaseRuleItem

type ReleaseRuleItem struct {
	Length         uint32
	StartTimestamp uint64
	EndTimestamp   uint64
}

type ReqFindTargetTypeScriptParam

type ReqFindTargetTypeScriptParam struct {
	Ctx       context.Context
	RpcClient rpc.Client
	InputList []*ckbTypes.CellInput
	IsLock    bool
	CodeHash  ckbTypes.Hash
}

type UpdateAccountCellInfo

type UpdateAccountCellInfo struct {
	OldData           *celltype.VersionAccountCell
	OutputAccountCell *celltype.AccountCell
	NewData           *celltype.VersionAccountCell
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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