witness

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DidCellCellDepsFalgTestnet string = "0x16d2cc212e94a5016435586c36b4ef4bba45f160d931a9515d8bd088e56576ab"
	DidCellCellDepsFalgMainnet string = "0x2ffaa212ed7e00cf595b42765d5e6b8908b18d444ace76113cb707247033ec99"
	ClusterIdTestnet           string = "0x38ab2c230a9f44b4ed7ebb4f7f15a7c9ecf79b3d723a2caf4a8e1b621f61dd71"
	ClusterIdMainnet           string = "0xcff856f49d7a01d48c6a167b5f1bf974d31c375548eea3cf63145a233929f938"
	DidCellDataLVVersion       uint8  = 1
	DidCellDataLVFlag          uint8  = 0
)
View Source
const (
	ItemIdWitnessDataDidCellV0 ItemIdWitnessData = 0

	SourceTypeInputs   SourceType = 0
	SourceTypeOutputs  SourceType = 1
	SourceTypeCellDeps SourceType = 2
)
View Source
const (
	ReverseSmtRecordVersion1 ReverseSmtRecordVersion = 1

	ReverseSmtRecordActionUpdate ReverseSmtRecordAction = "update"
	ReverseSmtRecordActionRemove ReverseSmtRecordAction = "remove"
)
View Source
const (
	FlagTypeDefault     FlagType = 0
	FlagTypeCustomPrice FlagType = 1
	FlagTypeCustomRule  FlagType = 255

	AutoDistributionDefault AutoDistribution = 0
	AutoDistributionEnable  AutoDistribution = 1
)
View Source
const (
	SubAccountMintSignVersion1 SubAccountMintSignVersion = 1

	SubAccountVersion1      SubAccountVersion = 1
	SubAccountVersion2      SubAccountVersion = 2
	SubAccountVersionLatest                   = SubAccountVersion2
)
View Source
const (
	ReturnTypeBool        ReturnType = "bool"
	ReturnTypeNumber      ReturnType = "number"
	ReturnTypeString      ReturnType = "string"
	ReturnTypeStringArray ReturnType = "string[]"
	ReturnTypeUnknown     ReturnType = "unknown"

	Operator ExpressionType = "operator"
	Function ExpressionType = "function"
	Variable ExpressionType = "variable"
	Value    ExpressionType = "value"

	Not SymbolType = "not"
	And SymbolType = "and"
	Or  SymbolType = "or"
	Gt  SymbolType = ">"
	Gte SymbolType = ">="
	Lt  SymbolType = "<"
	Lte SymbolType = "<="
	Equ SymbolType = "=="

	FunctionIncludeCharts      FunctionType = "include_chars"
	FunctionIncludeWords       FunctionType = "include_words"
	FunctionOnlyIncludeCharset FunctionType = "only_include_charset"
	FunctionInList             FunctionType = "in_list"
	FunctionIncludeCharset     FunctionType = "include_charset"
	FunctionStartsWith         FunctionType = "starts_with"
	FunctionEndsWith           FunctionType = "ends_with"

	Account       VariableName = "account"
	AccountChars  VariableName = "account_chars"
	AccountLength VariableName = "account_length"

	Bool        ValueType = "bool"
	Uint8       ValueType = "uint8"
	Uint32      ValueType = "uint32"
	Uint64      ValueType = "uint64"
	Binary      ValueType = "binary"
	BinaryArray ValueType = "binary[]"
	String      ValueType = "string"
	StringArray ValueType = "string[]"
	Charset     ValueType = "charset_type"

	SubAccountRuleVersionV1 SubAccountRuleVersion = 1
)
View Source
const DasWitnessTagName = "witness"
View Source
const (
	IncomeCellCurrentVersion = common.GoDataEntityVersion1
)
View Source
const (
	Script001 = "script-001"
)

Variables

View Source
var (
	ErrDataEntityOptIsNil = errors.New("DataEntityOpt is nil")
	ErrNotExistWitness    = errors.New("the witness wanted not exist")

	DataEntityVersion1 = molecule.GoU32ToMoleculeU32(common.GoDataEntityVersion1)
	DataEntityVersion2 = molecule.GoU32ToMoleculeU32(common.GoDataEntityVersion2)
	DataEntityVersion3 = molecule.GoU32ToMoleculeU32(common.GoDataEntityVersion3)
	DataEntityVersion4 = molecule.GoU32ToMoleculeU32(common.GoDataEntityVersion4)
	DataEntityVersion  = DataEntityVersion4
)
View Source
var ErrCustomScriptPriceNotExist = errors.New("CustomScriptPrice not exist")
View Source
var ErrNotExistActionData = errors.New("not exist action data")
View Source
var ErrNotExistCustomScriptConfig = errors.New("not exist custom-script-config")
View Source
var (
	ErrNotExistDPOrderInfo = errors.New("not exist dp order info")
)
View Source
var (
	ErrNotExistNewIncomeCell = errors.New("not exist new income cell")
)
View Source
var (
	ErrorNotDidEntityWitness = errors.New("not did entity witness")
)
View Source
var TypeOfDasWitness = reflect.TypeOf((*DasWitness)(nil)).Elem()

Functions

func AccountCellDataBuilderMapFromTx

func AccountCellDataBuilderMapFromTx(tx *types.Transaction, dataType common.DataType) (map[string]*AccountCellDataBuilder, error)

func AccountIdCellDataBuilderFromTx

func AccountIdCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (map[string]*AccountCellDataBuilder, error)

func BuildCustomScriptConfig

func BuildCustomScriptConfig(csc CustomScriptConfig) (wit []byte, hash []byte)

func BuildSubAccountCellOutputData

func BuildSubAccountCellOutputData(detail SubAccountCellDataDetail) []byte

func ConfigCellDataBuilderRefByTypeArgs

func ConfigCellDataBuilderRefByTypeArgs(builder *ConfigCellDataBuilder, tx *types.Transaction, configCellTypeArgs common.ConfigCellTypeArgs) error

func ConvertCapacity

func ConvertCapacity(capacity uint64) string

func ConvertChainInfo added in v1.0.1

func ConvertChainInfo(chainInfo ChainInfo) *molecule.ChainId

func ConvertDPDataToBys added in v1.2.0

func ConvertDPDataToBys(data DPData) ([]byte, error)

func ConvertDay

func ConvertDay(day uint32) string

func ConvertDollar

func ConvertDollar(dollar uint64) string

func ConvertMinute

func ConvertMinute(minute uint32) string

func ConvertRate

func ConvertRate(rate uint32) string

func ConvertTimestamp

func ConvertTimestamp(timestamp int64) string

func ConvertToCellRecords

func ConvertToCellRecords(cellRecords []Record) *molecule.Records

func ConvertToWebKeyList added in v1.1.0

func ConvertToWebKeyList(keyLists []WebauthnKey) (*molecule.DeviceKeyList, error)

func CreateIncomeCellWitness

func CreateIncomeCellWitness(p *NewIncomeCellParam) ([]byte, []byte, error)

CreateIncomeCellWitness the first element in belongTos and capacities must be the one who create the income cell

func GenActionDataWitness

func GenActionDataWitness(action common.DasAction, params ...[]byte) ([]byte, error)

func GenActionDataWitnessV2

func GenActionDataWitnessV2(action common.DasAction, params []byte, signer string) ([]byte, error)

func GenActionDataWitnessV3 added in v1.1.0

func GenActionDataWitnessV3(action common.DasAction, params []byte) ([]byte, error)

func GenBatchIncomeWitnessData

func GenBatchIncomeWitnessData(p *IncomeCellParam) ([][]byte, [][]byte, error)

func GenBuyAccountParams

func GenBuyAccountParams(inviterScript, channelScript *types.Script) []byte

func GenDPOrderInfoWitness added in v1.2.0

func GenDPOrderInfoWitness(info DPOrderInfo) (witness []byte, data []byte, err error)

func GenDasDataWitness

func GenDasDataWitness(action common.ActionDataType, data *molecule.Data) []byte

func GenDasDataWitnessWithByte

func GenDasDataWitnessWithByte(action common.ActionDataType, data []byte) []byte

func GenDasDataWitnessWithStruct added in v1.0.1

func GenDasDataWitnessWithStruct(action common.ActionDataType, obj interface{}) ([]byte, error)

func GenIncomeCellWitness

func GenIncomeCellWitness(p *NewIncomeCellParam) ([]byte, []byte, error)

func GenWitnessData added in v1.0.1

func GenWitnessData(obj interface{}) ([]byte, error)

func GetClusterId added in v1.2.0

func GetClusterId(net common.DasNetType) []byte

func GetDidCellRecycleCellDeps added in v1.2.0

func GetDidCellRecycleCellDeps(net common.DasNetType) *types.CellDep

func GetWebAuthnPubkeyByWitness0 added in v1.1.0

func GetWebAuthnPubkeyByWitness0(witness []byte) (pubkey []byte, err error)

func GetWitnessDataFromTx

func GetWitnessDataFromTx(tx *types.Transaction, handle FuncParseWitness) error

func OfferCellDataBuilderMapFromTx

func OfferCellDataBuilderMapFromTx(tx *types.Transaction, dataType common.DataType) (map[string]*OfferCellBuilder, error)

func ParseFromBytes added in v1.0.1

func ParseFromBytes(data []byte, obj interface{}) error

func ParseFromBytesV2 added in v1.2.0

func ParseFromBytesV2(data []byte, obj interface{}) error

func ParseFromTx added in v1.0.1

func ParseFromTx(tx *types.Transaction, action common.ActionDataType, obj interface{}) error

func ParserAccountAuctionCell

func ParserAccountAuctionCell(witnessByte []byte) interface{}

func ParserAccountCell

func ParserAccountCell(witnessByte []byte) interface{}

func ParserAccountSaleCell

func ParserAccountSaleCell(witnessByte []byte) interface{}

func ParserActionData

func ParserActionData(witnessByte []byte) interface{}

func ParserActionDataTypeKeyListCfgCell added in v1.1.0

func ParserActionDataTypeKeyListCfgCell(witnessBytes []byte) interface{}

func ParserActionDataTypeReverseSmt added in v1.1.0

func ParserActionDataTypeReverseSmt(witnessBytes []byte) interface{}

func ParserActionDataTypeSubAccountMintSign added in v1.1.0

func ParserActionDataTypeSubAccountMintSign(witnessBytes []byte) interface{}

func ParserConfigCellAccount

func ParserConfigCellAccount(witnessByte []byte) interface{}

func ParserConfigCellApply

func ParserConfigCellApply(witnessByte []byte) interface{}

func ParserConfigCellIncome

func ParserConfigCellIncome(witnessByte []byte) interface{}

func ParserConfigCellMain

func ParserConfigCellMain(witnessByte []byte) interface{}

func ParserConfigCellPrice

func ParserConfigCellPrice(witnessByte []byte) interface{}

func ParserConfigCellProfitRate

func ParserConfigCellProfitRate(witnessByte []byte) interface{}

func ParserConfigCellProposal

func ParserConfigCellProposal(witnessByte []byte) interface{}

func ParserConfigCellRecordNamespace

func ParserConfigCellRecordNamespace(witnessByte []byte) interface{}

func ParserConfigCellRelease

func ParserConfigCellRelease(witnessByte []byte) interface{}

func ParserConfigCellReverseRecord

func ParserConfigCellReverseRecord(witnessByte []byte) interface{}

func ParserConfigCellSecondaryMarket

func ParserConfigCellSecondaryMarket(witnessByte []byte) interface{}

func ParserConfigCellSubAccount

func ParserConfigCellSubAccount(witnessByte []byte) interface{}

func ParserConfigCellSubAccountWhiteList

func ParserConfigCellSubAccountWhiteList(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetDigit

func ParserConfigCellTypeArgsCharSetDigit(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetEmoji

func ParserConfigCellTypeArgsCharSetEmoji(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetEn

func ParserConfigCellTypeArgsCharSetEn(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetHanS

func ParserConfigCellTypeArgsCharSetHanS(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetHanT

func ParserConfigCellTypeArgsCharSetHanT(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetJa added in v1.0.1

func ParserConfigCellTypeArgsCharSetJa(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetKr added in v1.0.1

func ParserConfigCellTypeArgsCharSetKr(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetRu added in v1.0.1

func ParserConfigCellTypeArgsCharSetRu(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetTh added in v1.0.1

func ParserConfigCellTypeArgsCharSetTh(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetTr added in v1.0.1

func ParserConfigCellTypeArgsCharSetTr(witnessByte []byte) interface{}

func ParserConfigCellTypeArgsCharSetVn added in v1.0.1

func ParserConfigCellTypeArgsCharSetVn(witnessByte []byte) interface{}

func ParserConfigCellUnavailable

func ParserConfigCellUnavailable(witnessByte []byte, action string) interface{}

func ParserIncomeCell

func ParserIncomeCell(witnessByte []byte) interface{}

func ParserOfferCell

func ParserOfferCell(witnessByte []byte) interface{}

func ParserPreAccountCell

func ParserPreAccountCell(witnessByte []byte) interface{}

func ParserProposalCell

func ParserProposalCell(witnessByte []byte) interface{}

func ParserSubAccount

func ParserSubAccount(witnessByte []byte) interface{}

func ParserWitnessAction

func ParserWitnessAction(witnessByte []byte) string

func ParserWitnessData

func ParserWitnessData(witnessByte []byte) interface{}

func PreAccountCellDataBuilderMapFromTx

func PreAccountCellDataBuilderMapFromTx(tx *types.Transaction, dataType common.DataType) (map[string]*PreAccountCellDataBuilder, error)

func PreAccountIdCellDataBuilderFromTx

func PreAccountIdCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (map[string]*PreAccountCellDataBuilder, error)

Types

type AccountApproval added in v1.1.0

type AccountApproval struct {
	Action AccountApprovalAction `json:"action"`
	Params AccountApprovalParams `json:"params"`
}

func AccountApprovalFromSlice added in v1.1.0

func AccountApprovalFromSlice(bs []byte) (*AccountApproval, error)

func (*AccountApproval) GenToMolecule added in v1.1.0

func (approval *AccountApproval) GenToMolecule() (*molecule.AccountApproval, error)

type AccountApprovalAction added in v1.1.0

type AccountApprovalAction string
const (
	AccountApprovalActionTransfer AccountApprovalAction = "transfer"
)

type AccountApprovalParams added in v1.1.0

type AccountApprovalParams struct {
	Transfer AccountApprovalParamsTransfer `json:"transfer"`
}

type AccountApprovalParamsTransfer added in v1.1.0

type AccountApprovalParamsTransfer struct {
	PlatformLock     *types.Script `json:"platform_lock"`
	ProtectedUntil   uint64        `json:"protected_until"`
	SealedUntil      uint64        `json:"sealed_until"`
	DelayCountRemain uint8         `json:"delay_count_remain"`
	ToLock           *types.Script `json:"to_lock"`
}

type AccountCellDataBuilder

type AccountCellDataBuilder struct {
	Index                 uint32
	Version               uint32
	AccountId             string
	NextAccountId         string
	Account               string
	Status                uint8
	RegisteredAt          uint64
	UpdatedAt             uint64
	LastTransferAccountAt uint64
	LastEditManagerAt     uint64
	LastEditRecordsAt     uint64
	ExpiredAt             uint64
	EnableSubAccount      uint8
	RenewSubAccountPrice  uint64
	AccountApproval       AccountApproval
	Records               []Record
	RecordsHashBys        []byte
	AccountCellDataV1     *molecule.AccountCellDataV1
	AccountCellDataV2     *molecule.AccountCellDataV2
	AccountCellDataV3     *molecule.AccountCellDataV3
	AccountCellData       *molecule.AccountCellData
	DataEntityOpt         *molecule.DataEntityOpt
	AccountChars          *molecule.AccountChars
}

func AccountCellDataBuilderFromTx

func AccountCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (*AccountCellDataBuilder, error)

func AccountCellDataBuilderFromTxByName added in v1.1.0

func AccountCellDataBuilderFromTxByName(tx *types.Transaction, dataType common.DataType, acc string) (*AccountCellDataBuilder, error)

func (*AccountCellDataBuilder) ConvertToAccountCellData

func (a *AccountCellDataBuilder) ConvertToAccountCellData(slice []byte) error

func (*AccountCellDataBuilder) ConvertToAccountCellDataV1

func (a *AccountCellDataBuilder) ConvertToAccountCellDataV1(slice []byte) error

func (*AccountCellDataBuilder) ConvertToAccountCellDataV2

func (a *AccountCellDataBuilder) ConvertToAccountCellDataV2(slice []byte) error

func (*AccountCellDataBuilder) ConvertToAccountCellDataV3 added in v1.1.0

func (a *AccountCellDataBuilder) ConvertToAccountCellDataV3(slice []byte) error

func (*AccountCellDataBuilder) GenWitness

func (a *AccountCellDataBuilder) GenWitness(p *AccountCellParam) ([]byte, []byte, error)

type AccountCellParam

type AccountCellParam struct {
	OldIndex              uint32
	NewIndex              uint32
	Status                uint8
	Action                string
	AccountId             string
	RegisterAt            uint64
	SubAction             string
	AccountChars          *molecule.AccountChars
	LastEditRecordsAt     int64
	LastEditManagerAt     int64
	LastTransferAccountAt int64
	InitialRecords        *molecule.Records
	Records               []Record
	EnableSubAccount      uint8
	RenewSubAccountPrice  uint64
	IsCustomScript        bool
	IsClearRecords        bool
	AccountApproval       AccountApproval
	IsUpgradeDidCell      bool
}

type AccountSaleCellDataBuilder

type AccountSaleCellDataBuilder struct {
	Index                  uint32
	Version                uint32
	AccountSaleCellDataV1  *molecule.AccountSaleCellDataV1
	AccountSaleCellData    *molecule.AccountSaleCellData
	DataEntityOpt          *molecule.DataEntityOpt
	AccountId              string
	Account                string
	Description            string
	Price                  uint64
	StartedAt              uint64
	BuyerInviterProfitRate uint32
}

func AccountSaleCellDataBuilderFromTx

func AccountSaleCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (*AccountSaleCellDataBuilder, error)

func (*AccountSaleCellDataBuilder) ConvertToAccountSaleCellData

func (a *AccountSaleCellDataBuilder) ConvertToAccountSaleCellData(slice []byte) error

func (*AccountSaleCellDataBuilder) ConvertToAccountSaleCellDataV1

func (a *AccountSaleCellDataBuilder) ConvertToAccountSaleCellDataV1(slice []byte) error

func (*AccountSaleCellDataBuilder) GenWitness

type AccountSaleCellParam

type AccountSaleCellParam struct {
	OldIndex               uint32
	NewIndex               uint32
	Account                string
	Description            string
	Price                  uint64
	StartAt                uint64
	BuyerInviterProfitRate uint32
	Action                 string
}

type ActionDataBuilder

type ActionDataBuilder struct {
	ActionData *molecule.ActionData
	Action     common.DasAction
	Params     [][]byte
	ParamsStr  string
}

func ActionDataBuilderFromTx

func ActionDataBuilderFromTx(tx *types.Transaction) (*ActionDataBuilder, error)

func ActionDataBuilderFromWitness

func ActionDataBuilderFromWitness(wit []byte) (*ActionDataBuilder, error)

func (*ActionDataBuilder) ActionBuyAccountChannelScript

func (a *ActionDataBuilder) ActionBuyAccountChannelScript() (*molecule.Script, error)

func (*ActionDataBuilder) ActionBuyAccountInviterScript

func (a *ActionDataBuilder) ActionBuyAccountInviterScript() (*molecule.Script, error)

func (*ActionDataBuilder) ConvertToActionData

func (a *ActionDataBuilder) ConvertToActionData(slice []byte) error

type AstExpression added in v1.1.0

type AstExpression struct {
	Type        ExpressionType `json:"type"`
	Name        string         `json:"name,omitempty"`
	Symbol      SymbolType     `json:"symbol,omitempty"`
	Value       interface{}    `json:"value,omitempty"`
	ValueType   ValueType      `json:"value_type,omitempty"`
	Arguments   AstExpressions `json:"arguments,omitempty"`
	Expressions AstExpressions `json:"expressions,omitempty"`
	// contains filtered or unexported fields
}

func (*AstExpression) Check added in v1.1.0

func (e *AstExpression) Check(checkHit bool, account string) (hit bool, err error)

func (*AstExpression) GenMoleculeASTExpression added in v1.1.0

func (e *AstExpression) GenMoleculeASTExpression(preExp *AstExpression) (*molecule.ASTExpression, error)

func (*AstExpression) GetNumberValue added in v1.1.0

func (e *AstExpression) GetNumberValue(account string) float64

func (*AstExpression) GetStringArray added in v1.1.0

func (e *AstExpression) GetStringArray(account string) []string

func (*AstExpression) GetStringValue added in v1.1.0

func (e *AstExpression) GetStringValue(account string) string

func (*AstExpression) ProcessOperator added in v1.1.0

func (e *AstExpression) ProcessOperator(checkHit bool, account string) (hit bool, err error)

func (*AstExpression) ReturnType added in v1.1.0

func (e *AstExpression) ReturnType() ReturnType

type AstExpressions added in v1.1.0

type AstExpressions []*AstExpression

type AutoDistribution added in v1.1.0

type AutoDistribution uint8

type CellMeta added in v1.2.0

type CellMeta struct {
	Index  uint64     `json:"index"`
	Source SourceType `json:"source"`
}

type ChainInfo added in v1.0.1

type ChainInfo struct {
	Checked  bool
	CoinType string
	ChainId  string
}

func ConvertMoleculeChainId added in v1.0.1

func ConvertMoleculeChainId(chainInfo *molecule.ChainId) (res ChainInfo)

type CharsetType added in v1.1.0

type CharsetType string

type CharsetsType added in v1.1.0

type CharsetsType []CharsetType

func (CharsetsType) Include added in v1.1.0

func (cs CharsetsType) Include(charset CharsetType) bool

type ConfigCellDataBuilder

type ConfigCellDataBuilder struct {
	ConfigCellAccount                *molecule.ConfigCellAccount
	ConfigCellPrice                  *molecule.ConfigCellPrice
	PriceConfigMap                   map[uint8]*molecule.PriceConfig
	PriceMaxLength                   uint8
	ConfigCellSecondaryMarket        *molecule.ConfigCellSecondaryMarket
	ConfigCellIncome                 *molecule.ConfigCellIncome
	ConfigCellProfitRate             *molecule.ConfigCellProfitRate
	ConfigCellMain                   *molecule.ConfigCellMain
	ConfigCellReverseResolution      *molecule.ConfigCellReverseResolution
	ConfigCellProposal               *molecule.ConfigCellProposal
	ConfigCellApply                  *molecule.ConfigCellApply
	ConfigCellRelease                *molecule.ConfigCellRelease
	ConfigCellSubAccount             *molecule.ConfigCellSubAccount
	ConfigCellSystemStatus           *molecule.ConfigCellSystemStatus
	ConfigCellRecordKeys             []string
	ConfigCellEmojis                 []string
	ConfigCellCharSetDigit           []string
	ConfigCellCharSetEn              []string
	ConfigCellCharSetHanS            []string
	ConfigCellCharSetHanT            []string
	ConfigCellCharSetJa              []string
	ConfigCellCharSetKo              []string
	ConfigCellCharSetRu              []string
	ConfigCellCharSetTr              []string
	ConfigCellCharSetTh              []string
	ConfigCellCharSetVi              []string
	ConfigCellUnavailableAccountMap  map[string]struct{}
	ConfigCellPreservedAccountMap    map[string]struct{}
	ConfigCellSubAccountWhiteListMap map[string]struct{}
	ConfigCellDPoint                 *molecule.ConfigCellDPoint
}

func ConfigCellDataBuilderByTypeArgs

func ConfigCellDataBuilderByTypeArgs(tx *types.Transaction, configCellTypeArgs common.ConfigCellTypeArgs) (*ConfigCellDataBuilder, error)

func (*ConfigCellDataBuilder) AccountCommonFee

func (c *ConfigCellDataBuilder) AccountCommonFee() (uint64, error)

func (*ConfigCellDataBuilder) AccountPrice

func (c *ConfigCellDataBuilder) AccountPrice(length uint8) (uint64, uint64, error)

func (*ConfigCellDataBuilder) BasicCapacity

func (c *ConfigCellDataBuilder) BasicCapacity() (uint64, error)

func (*ConfigCellDataBuilder) BasicCapacityFromOwnerDasAlgorithmId

func (c *ConfigCellDataBuilder) BasicCapacityFromOwnerDasAlgorithmId(args string) (uint64, error)

func (*ConfigCellDataBuilder) CommonFee

func (c *ConfigCellDataBuilder) CommonFee() (uint64, error)

func (*ConfigCellDataBuilder) EditManagerThrottle

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

func (*ConfigCellDataBuilder) EditRecordsThrottle

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

func (*ConfigCellDataBuilder) ExpirationAuctionPeriod added in v1.2.0

func (c *ConfigCellDataBuilder) ExpirationAuctionPeriod() (uint32, error)

func (*ConfigCellDataBuilder) ExpirationAuctionStartPremiums added in v1.2.0

func (c *ConfigCellDataBuilder) ExpirationAuctionStartPremiums() (uint32, error)

func (*ConfigCellDataBuilder) ExpirationDeliverPeriod added in v1.2.0

func (c *ConfigCellDataBuilder) ExpirationDeliverPeriod() (uint32, error)

func (*ConfigCellDataBuilder) ExpirationGracePeriod

func (c *ConfigCellDataBuilder) ExpirationGracePeriod() (uint32, error)

func (*ConfigCellDataBuilder) GetContractStatus added in v1.0.1

func (c *ConfigCellDataBuilder) GetContractStatus(contractName common.DasContractName) (res common.ContractStatus, err error)

func (*ConfigCellDataBuilder) GetDPBaseCapacity added in v1.2.0

func (c *ConfigCellDataBuilder) GetDPBaseCapacity() (uint64, uint64, error)

func (*ConfigCellDataBuilder) GetDPointCapacityRecycleWhitelist added in v1.2.0

func (c *ConfigCellDataBuilder) GetDPointCapacityRecycleWhitelist() (map[string]*types.Script, error)

func (*ConfigCellDataBuilder) GetDPointTransferWhitelist added in v1.2.0

func (c *ConfigCellDataBuilder) GetDPointTransferWhitelist() (map[string]*types.Script, error)

func (*ConfigCellDataBuilder) IncomeBasicCapacity

func (c *ConfigCellDataBuilder) IncomeBasicCapacity() (uint64, error)

func (*ConfigCellDataBuilder) IncomeMinTransferCapacity

func (c *ConfigCellDataBuilder) IncomeMinTransferCapacity() (uint64, error)

func (*ConfigCellDataBuilder) LuckyNumber

func (c *ConfigCellDataBuilder) LuckyNumber() (uint32, error)

func (*ConfigCellDataBuilder) MaxLength

func (c *ConfigCellDataBuilder) MaxLength() (uint32, error)

func (*ConfigCellDataBuilder) NewSubAccountPrice

func (c *ConfigCellDataBuilder) NewSubAccountPrice() (uint64, error)

func (*ConfigCellDataBuilder) OfferCellBasicCapacity

func (c *ConfigCellDataBuilder) OfferCellBasicCapacity() (uint64, error)

func (*ConfigCellDataBuilder) OfferCellPreparedFeeCapacity

func (c *ConfigCellDataBuilder) OfferCellPreparedFeeCapacity() (uint64, error)

func (*ConfigCellDataBuilder) OfferMessageBytesLimit

func (c *ConfigCellDataBuilder) OfferMessageBytesLimit() (uint32, error)

func (*ConfigCellDataBuilder) OfferMinPrice

func (c *ConfigCellDataBuilder) OfferMinPrice() (uint64, error)

func (*ConfigCellDataBuilder) PreparedFeeCapacity

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

func (*ConfigCellDataBuilder) PriceConfig

func (c *ConfigCellDataBuilder) PriceConfig(length uint8) *molecule.PriceConfig

func (*ConfigCellDataBuilder) PriceInvitedDiscount

func (c *ConfigCellDataBuilder) PriceInvitedDiscount() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateChannel

func (c *ConfigCellDataBuilder) ProfitRateChannel() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateIncomeConsolidate

func (c *ConfigCellDataBuilder) ProfitRateIncomeConsolidate() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateInviter

func (c *ConfigCellDataBuilder) ProfitRateInviter() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateProposalConfirm

func (c *ConfigCellDataBuilder) ProfitRateProposalConfirm() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateProposalCreate

func (c *ConfigCellDataBuilder) ProfitRateProposalCreate() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateSaleBuyerChannel

func (c *ConfigCellDataBuilder) ProfitRateSaleBuyerChannel() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateSaleBuyerInviter

func (c *ConfigCellDataBuilder) ProfitRateSaleBuyerInviter() (uint32, error)

func (*ConfigCellDataBuilder) ProfitRateSaleDas

func (c *ConfigCellDataBuilder) ProfitRateSaleDas() (uint32, error)

func (*ConfigCellDataBuilder) RecordBasicCapacity

func (c *ConfigCellDataBuilder) RecordBasicCapacity() (uint64, error)

func (*ConfigCellDataBuilder) RecordCommonFee

func (c *ConfigCellDataBuilder) RecordCommonFee() (uint64, error)

func (*ConfigCellDataBuilder) RecordMinTtl

func (c *ConfigCellDataBuilder) RecordMinTtl() (uint32, error)

func (*ConfigCellDataBuilder) RecordPreparedFeeCapacity

func (c *ConfigCellDataBuilder) RecordPreparedFeeCapacity() (uint64, error)

func (*ConfigCellDataBuilder) RenewSubAccountPrice

func (c *ConfigCellDataBuilder) RenewSubAccountPrice() (uint64, error)

func (*ConfigCellDataBuilder) SaleCellBasicCapacity

func (c *ConfigCellDataBuilder) SaleCellBasicCapacity() (uint64, error)

func (*ConfigCellDataBuilder) SaleCellPreparedFeeCapacity

func (c *ConfigCellDataBuilder) SaleCellPreparedFeeCapacity() (uint64, error)

func (*ConfigCellDataBuilder) SaleMinPrice

func (c *ConfigCellDataBuilder) SaleMinPrice() (uint64, error)

func (*ConfigCellDataBuilder) Status

func (c *ConfigCellDataBuilder) Status() (uint8, error)

func (*ConfigCellDataBuilder) TransferAccountThrottle

func (c *ConfigCellDataBuilder) TransferAccountThrottle() (uint32, error)

type CustomScriptConfig

type CustomScriptConfig struct {
	Header    string                      `json:"header"`  // 10
	Version   uint32                      `json:"version"` // 4
	Body      map[uint8]CustomScriptPrice `json:"body"`
	MaxLength uint8                       `json:"max_length"`
}

===================== custom script config ====================

func ConvertCustomScriptConfig

func ConvertCustomScriptConfig(wit []byte) (*CustomScriptConfig, error)

func ConvertCustomScriptConfigByTx

func ConvertCustomScriptConfigByTx(tx *types.Transaction) ([]byte, *CustomScriptConfig, error)

func (*CustomScriptConfig) GetPrice

func (c *CustomScriptConfig) GetPrice(length uint8) (*CustomScriptPrice, error)

func (*CustomScriptConfig) GetPriceBySubAccount

func (c *CustomScriptConfig) GetPriceBySubAccount(subAccount string) (*CustomScriptPrice, error)

type CustomScriptPrice

type CustomScriptPrice struct {
	New   uint64 `json:"new"`
	Renew uint64 `json:"renew"`
}

type DPAction added in v1.2.0

type DPAction string
const (
	DPActionDefault         DPAction = ""
	DPActionMint            DPAction = "mint"
	DPActionBurn            DPAction = "burn"
	DPActionTransfer        DPAction = "transfer"
	DPActionTransferDeposit DPAction = "transfer_deposit"
	DPActionTransferRefund  DPAction = "transfer_refund"
	DPActionTransferTLDID   DPAction = "transfer_tldid"
	DPActionTransferSLDID   DPAction = "transfer_sldid"
	DPActionTransferAuction DPAction = "transfer_auction"
	DPActionTransferCoupon  DPAction = "transfer_coupon"
)

type DPData added in v1.2.0

type DPData struct {
	Value uint64
}

func ConvertBysToDPData added in v1.2.0

func ConvertBysToDPData(data []byte) (DPData, error)

type DPOrderInfo added in v1.2.0

type DPOrderInfo struct {
	OrderId string   `json:"order_id"`
	Action  DPAction `json:"action"`
}

func ConvertDPOrderInfoWitness added in v1.2.0

func ConvertDPOrderInfoWitness(dataBys []byte) (DPOrderInfo, error)

func DPOrderInfoFromTx added in v1.2.0

func DPOrderInfoFromTx(tx *types.Transaction) (DPOrderInfo, error)

type DasWitness added in v1.0.1

type DasWitness interface {
	Gen() ([]byte, error)
	Parse([]byte) (DasWitness, error)
}

type DidCellDataLV added in v1.2.0

type DidCellDataLV struct {
	Flag        uint8
	Version     uint8
	WitnessHash []byte
	ExpireAt    uint64
	Account     string
}

func (*DidCellDataLV) BysToObj added in v1.2.0

func (d *DidCellDataLV) BysToObj(bys []byte) error

func (*DidCellDataLV) ObjToBys added in v1.2.0

func (d *DidCellDataLV) ObjToBys() ([]byte, error)

type DidCellWitnessDataV0 added in v1.2.0

type DidCellWitnessDataV0 struct {
	Records []Record
}

type DidEntity added in v1.2.0

type DidEntity struct {
	Target               CellMeta              `json:"target"`
	ItemId               ItemIdWitnessData     `json:"item_id"`
	DidCellWitnessDataV0 *DidCellWitnessDataV0 `json:"witness_data_v_0"`
	// contains filtered or unexported fields
}

func (*DidEntity) BysToObj added in v1.2.0

func (d *DidEntity) BysToObj(bys []byte) error

func (*DidEntity) Hash added in v1.2.0

func (d *DidEntity) Hash() string

func (*DidEntity) HashBys added in v1.2.0

func (d *DidEntity) HashBys() []byte

func (*DidEntity) ObjToBys added in v1.2.0

func (d *DidEntity) ObjToBys() ([]byte, error)

type ExpressionType added in v1.1.0

type ExpressionType string

type ExpressionsType added in v1.1.0

type ExpressionsType []ExpressionType

type FlagType added in v1.1.0

type FlagType uint8

type FuncParseWitness

type FuncParseWitness func(actionDataType common.ActionDataType, dataBys []byte, index int) (bool, error)

type FunctionType added in v1.1.0

type FunctionType string

type FunctionsType added in v1.1.0

type FunctionsType []FunctionType

func (FunctionsType) Include added in v1.1.0

func (fs FunctionsType) Include(functionType FunctionType) bool

type IncomeCellDataBuilder

type IncomeCellDataBuilder struct {
	Index          uint32
	Version        uint32
	IncomeCellData *molecule.IncomeCellData
	DataEntityOpt  *molecule.DataEntityOpt
}

func IncomeCellDataBuilderFromTx

func IncomeCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (*IncomeCellDataBuilder, error)

func IncomeCellDataBuilderListFromTx

func IncomeCellDataBuilderListFromTx(tx *types.Transaction, dataType common.DataType) ([]*IncomeCellDataBuilder, error)

func (*IncomeCellDataBuilder) Creator

func (i *IncomeCellDataBuilder) Creator() *molecule.Script

func (*IncomeCellDataBuilder) NewIncomeCellWitness

func (*IncomeCellDataBuilder) Records

func (i *IncomeCellDataBuilder) Records() []IncomeCellRecord

type IncomeCellParam

type IncomeCellParam struct {
	OldRecordsDataList []*molecule.IncomeCellData
	Creators           []*molecule.Script
	NewRecords         []*molecule.IncomeRecords
	Action             string
}

type IncomeCellRecord

type IncomeCellRecord struct {
	BelongTo *molecule.Script
	Capacity uint64
}

type ItemIdWitnessData added in v1.2.0

type ItemIdWitnessData uint32

type NewIncomeCellParam

type NewIncomeCellParam struct {
	Creator     *molecule.Script
	BelongTos   []*types.Script
	Capacities  []uint64
	OutputIndex uint32
}

type OfferCellBuilder

type OfferCellBuilder struct {
	Index         uint32
	Version       uint32
	OfferCellData *molecule.OfferCellData
	DataEntityOpt *molecule.DataEntityOpt
	Account       string
	Price         uint64
	Message       string
	InviterLock   *molecule.Script
	ChannelLock   *molecule.Script
}

func OfferCellDataBuilderFromTx

func OfferCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (*OfferCellBuilder, error)

func (*OfferCellBuilder) GenWitness

func (o *OfferCellBuilder) GenWitness(p *OfferCellParam) ([]byte, []byte, error)

type OfferCellParam

type OfferCellParam struct {
	Action        common.DasAction
	Account       string
	Price         uint64
	Message       string
	InviterScript *types.Script
	ChannelScript *types.Script
	OldIndex      uint32
}

type ParamNewIncomeCellWitness

type ParamNewIncomeCellWitness struct {
	Creator      *types.Script
	CapacityList []uint64
	BelongTo     []*types.Script
	OldIndex     uint32
	NewIndex     uint32
}

type PreAccountCellDataBuilder

type PreAccountCellDataBuilder struct {
	Index             uint32
	Version           uint32
	AccountChars      *molecule.AccountChars
	Account           string
	RefundLock        *molecule.Script
	OwnerLockArgs     string
	InviterId         string
	InviterLock       *molecule.Script
	ChannelLock       *molecule.Script
	Price             *molecule.PriceConfig
	Quote             *molecule.Uint64
	InvitedDiscount   *molecule.Uint32
	CreatedAt         *molecule.Uint64
	InitialRecords    *molecule.Records
	InitialCrossChain *molecule.ChainId
	// contains filtered or unexported fields
}

func PreAccountCellDataBuilderFromTx

func PreAccountCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (*PreAccountCellDataBuilder, error)

func (*PreAccountCellDataBuilder) GenWitness

func (p *PreAccountCellDataBuilder) GenWitness(param *PreAccountCellParam) ([]byte, []byte, error)

func (*PreAccountCellDataBuilder) PreAccountCellDataV1FromSlice added in v1.0.1

func (p *PreAccountCellDataBuilder) PreAccountCellDataV1FromSlice(bys []byte) error

func (*PreAccountCellDataBuilder) PreAccountCellDataV2FromSlice added in v1.0.1

func (p *PreAccountCellDataBuilder) PreAccountCellDataV2FromSlice(bys []byte) error

func (*PreAccountCellDataBuilder) PreAccountCellDataV3FromSlice added in v1.0.1

func (p *PreAccountCellDataBuilder) PreAccountCellDataV3FromSlice(bys []byte) error

type PreAccountCellParam

type PreAccountCellParam struct {
	OldIndex uint32
	NewIndex uint32
	Status   uint8
	Action   string

	CreatedAt       int64
	InvitedDiscount uint32
	Quote           uint64
	InviterScript   *types.Script
	ChannelScript   *types.Script
	InviterId       []byte
	OwnerLockArgs   []byte
	RefundLock      *types.Script
	Price           molecule.PriceConfig
	AccountChars    molecule.AccountChars

	InitialRecords    []Record
	InitialCrossChain ChainInfo
}

type ProposalCellDataBuilder

type ProposalCellDataBuilder struct {
	Index            uint32
	ProposalCellData *molecule.ProposalCellData
	DataEntityOpt    *molecule.DataEntityOpt
}

func ProposalCellDataBuilderFromTx

func ProposalCellDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (*ProposalCellDataBuilder, error)

func (*ProposalCellDataBuilder) GenWitness

func (a *ProposalCellDataBuilder) GenWitness(p *ProposalCellParam) ([]byte, []byte, error)

type ProposalCellParam

type ProposalCellParam struct {
	ProposerLock *molecule.Script
	AccountList  [][]string
	CreateAt     uint64
	Action       common.ActionDataType
	OldIndex     uint32
	NewIndex     uint32
}

type Record

type Record struct {
	Key   string `json:"key"`
	Type  string `json:"type"`
	Label string `json:"label"`
	Value string `json:"value"`
	TTL   uint32 `json:"ttl"`
}

func ConvertToRecords

func ConvertToRecords(records *molecule.Records) []Record

type ReturnType added in v1.1.0

type ReturnType string

type ReverseSmtRecord added in v1.0.1

type ReverseSmtRecord struct {
	Version     ReverseSmtRecordVersion
	Action      ReverseSmtRecordAction
	Signature   []byte
	SignType    uint8
	Address     []byte
	Proof       []byte
	PrevNonce   uint32 `witness:",omitempty"`
	PrevAccount string
	NextRoot    []byte
	NextAccount string
}

func (*ReverseSmtRecord) GetP2SHP2WPKH added in v1.2.0

func (r *ReverseSmtRecord) GetP2SHP2WPKH(netType common.DasNetType) (string, error)

func (*ReverseSmtRecord) GetP2TR added in v1.2.0

func (r *ReverseSmtRecord) GetP2TR(netType common.DasNetType) (string, error)

type ReverseSmtRecordAction added in v1.0.1

type ReverseSmtRecordAction string

type ReverseSmtRecordVersion added in v1.0.1

type ReverseSmtRecordVersion uint32

type SourceType added in v1.2.0

type SourceType byte

type SporeData added in v1.2.0

type SporeData struct {
	ContentType []byte
	Content     []byte
	ClusterId   []byte
}

func (*SporeData) BysToObj added in v1.2.0

func (s *SporeData) BysToObj(bys []byte) error

func (*SporeData) ContentToDidCellDataLV added in v1.2.0

func (s *SporeData) ContentToDidCellDataLV() (*DidCellDataLV, error)

func (*SporeData) ObjToBys added in v1.2.0

func (s *SporeData) ObjToBys() ([]byte, error)

type SubAccountCellDataDetail

type SubAccountCellDataDetail struct {
	Action             common.DasAction
	SmtRoot            []byte           // 32
	DasProfit          uint64           // 8
	OwnerProfit        uint64           // 8
	Flag               FlagType         // 1
	CustomScriptArgs   []byte           // 32
	CustomScriptConfig []byte           // 10
	AutoDistribution   AutoDistribution // 1
	PriceRulesHash     []byte           // 10
	PreservedRulesHash []byte           // 10
}

func ConvertSubAccountCellOutputData

func ConvertSubAccountCellOutputData(data []byte) (detail SubAccountCellDataDetail)

func (*SubAccountCellDataDetail) ArgsAndConfigHash

func (s *SubAccountCellDataDetail) ArgsAndConfigHash() string

func (*SubAccountCellDataDetail) HasCustomScriptArgs

func (s *SubAccountCellDataDetail) HasCustomScriptArgs() bool

func (*SubAccountCellDataDetail) IsSameCustomScriptConfig

func (s *SubAccountCellDataDetail) IsSameCustomScriptConfig(customScriptConfigHex string) bool

type SubAccountData added in v1.0.1

type SubAccountData struct {
	Version              SubAccountVersion       `json:"version"`
	Lock                 *types.Script           `json:"lock"`
	AccountId            string                  `json:"account_id"`
	AccountCharSet       []common.AccountCharSet `json:"account_char_set"`
	Suffix               string                  `json:"suffix"`
	RegisteredAt         uint64                  `json:"registered_at"`
	ExpiredAt            uint64                  `json:"expired_at"`
	Status               uint8                   `json:"status"`
	Records              []Record                `json:"records"`
	Nonce                uint64                  `json:"nonce"`
	EnableSubAccount     uint8                   `json:"enable_sub_account"`
	RenewSubAccountPrice uint64                  `json:"renew_sub_account_price"`
	AccountApproval      AccountApproval         `json:"account_approval"`
}

=== SubAccountData ===

func (*SubAccountData) Account added in v1.0.1

func (s *SubAccountData) Account() string

func (*SubAccountData) ConvertToMoleculeSubAccount added in v1.0.1

func (s *SubAccountData) ConvertToMoleculeSubAccount() ([]byte, error)

func (*SubAccountData) ToH256 added in v1.0.1

func (s *SubAccountData) ToH256() ([]byte, error)

type SubAccountMintSign added in v1.0.1

type SubAccountMintSign struct {
	Version            SubAccountMintSignVersion
	Signature          []byte
	SignRole           []byte
	ExpiredAt          uint64
	AccountListSmtRoot []byte
	// contains filtered or unexported fields
}

func (*SubAccountMintSign) GenSubAccountMintSignBytes added in v1.0.1

func (s *SubAccountMintSign) GenSubAccountMintSignBytes() (dataBys []byte)

func (*SubAccountMintSign) GenWitness added in v1.0.1

func (s *SubAccountMintSign) GenWitness() []byte

func (*SubAccountMintSign) GenWitnessWithAction added in v1.1.0

func (s *SubAccountMintSign) GenWitnessWithAction(action common.ActionDataType) []byte

type SubAccountMintSignVersion added in v1.0.1

type SubAccountMintSignVersion = uint32

type SubAccountNew added in v1.0.1

type SubAccountNew struct {
	// v2
	Index   int
	Version SubAccountNewVersion
	Action  string

	Signature     []byte
	SignRole      []byte
	SignExpiredAt uint64

	NewRoot              []byte
	Proof                []byte
	OldSubAccountVersion SubAccountVersion
	NewSubAccountVersion SubAccountVersion
	SubAccountData       *SubAccountData

	EditKey common.EditKey

	EditValue []byte
	//
	EditLockArgs          []byte
	EditRecords           []Record
	CurrentSubAccountData *SubAccountData
	Account               string
	// v1
	PrevRoot    []byte
	CurrentRoot []byte
	// contains filtered or unexported fields
}

func (*SubAccountNew) GenSubAccountNewBytes added in v1.0.1

func (s *SubAccountNew) GenSubAccountNewBytes() (dataBys []byte, err error)

func (*SubAccountNew) GenWitness added in v1.0.1

func (s *SubAccountNew) GenWitness() ([]byte, error)

type SubAccountNewBuilder added in v1.0.1

type SubAccountNewBuilder struct{}

func (*SubAccountNewBuilder) ConvertSubAccountDataFromBytes added in v1.0.1

func (s *SubAccountNewBuilder) ConvertSubAccountDataFromBytes(version SubAccountVersion, dataBys []byte) (*SubAccountData, error)

func (*SubAccountNewBuilder) ConvertSubAccountMintSignFromBytes added in v1.0.1

func (s *SubAccountNewBuilder) ConvertSubAccountMintSignFromBytes(dataBys []byte) (*SubAccountMintSign, error)

func (*SubAccountNewBuilder) ConvertSubAccountNewFromBytes added in v1.0.1

func (s *SubAccountNewBuilder) ConvertSubAccountNewFromBytes(dataBys []byte) (*SubAccountNew, error)

func (*SubAccountNewBuilder) SubAccountNewMapFromTx added in v1.0.1

func (s *SubAccountNewBuilder) SubAccountNewMapFromTx(tx *types.Transaction) (map[string]*SubAccountNew, error)

type SubAccountNewVersion added in v1.0.1

type SubAccountNewVersion = uint32
const (
	SubAccountNewVersion1      SubAccountNewVersion = 1
	SubAccountNewVersion2      SubAccountNewVersion = 2
	SubAccountNewVersion3      SubAccountNewVersion = 3
	SubAccountNewVersionLatest                      = SubAccountNewVersion3
)

type SubAccountRule added in v1.1.0

type SubAccountRule struct {
	Index  uint32        `json:"index"`
	Name   string        `json:"name"`
	Note   string        `json:"note"`
	Price  float64       `json:"price,omitempty"`
	Ast    AstExpression `json:"ast"`
	Status uint8         `json:"status"`
}

func NewSubAccountRule added in v1.1.0

func NewSubAccountRule() *SubAccountRule

func (*SubAccountRule) Hit added in v1.1.0

func (s *SubAccountRule) Hit(account string) (hit bool, err error)

func (*SubAccountRule) Parser added in v1.1.0

func (s *SubAccountRule) Parser(data []byte) (err error)

type SubAccountRuleEntity added in v1.1.0

type SubAccountRuleEntity struct {
	ParentAccount string                `json:"-"`
	Version       SubAccountRuleVersion `json:"version"`
	Rules         SubAccountRuleSlice   `json:"rules"`
}

func NewSubAccountRuleEntity added in v1.1.0

func NewSubAccountRuleEntity(parentAccount string, versions ...SubAccountRuleVersion) *SubAccountRuleEntity

func (*SubAccountRuleEntity) Check added in v1.1.0

func (s *SubAccountRuleEntity) Check() (err error)

func (*SubAccountRuleEntity) GenDasData added in v1.1.0

func (s *SubAccountRuleEntity) GenDasData(action common.ActionDataType, ruleData [][]byte) ([][]byte, error)

func (*SubAccountRuleEntity) GenData added in v1.1.0

func (s *SubAccountRuleEntity) GenData() ([][]byte, error)

func (*SubAccountRuleEntity) GenWitnessData added in v1.1.0

func (s *SubAccountRuleEntity) GenWitnessData(action common.ActionDataType) ([][]byte, error)

func (*SubAccountRuleEntity) GenWitnessDataWithRuleData added in v1.1.0

func (s *SubAccountRuleEntity) GenWitnessDataWithRuleData(ruleData [][]byte) ([][]byte, error)

func (*SubAccountRuleEntity) Hit added in v1.1.0

func (s *SubAccountRuleEntity) Hit(account string) (hit bool, index int, err error)

func (*SubAccountRuleEntity) ParseFromDasActionWitnessData added in v1.1.0

func (s *SubAccountRuleEntity) ParseFromDasActionWitnessData(data [][]byte) error

func (*SubAccountRuleEntity) ParseFromJSON added in v1.1.0

func (s *SubAccountRuleEntity) ParseFromJSON(data []byte) (err error)

func (*SubAccountRuleEntity) ParseFromMolecule added in v1.1.0

func (s *SubAccountRuleEntity) ParseFromMolecule(astExp *molecule.ASTExpression) (*AstExpression, error)

func (*SubAccountRuleEntity) ParseFromTx added in v1.1.0

func (s *SubAccountRuleEntity) ParseFromTx(tx *types.Transaction, action common.ActionDataType) error

func (*SubAccountRuleEntity) ParseFromWitnessData added in v1.1.0

func (s *SubAccountRuleEntity) ParseFromWitnessData(data [][]byte) error

type SubAccountRuleSlice added in v1.1.0

type SubAccountRuleSlice []*SubAccountRule

type SubAccountRuleVersion added in v1.1.0

type SubAccountRuleVersion uint32

type SubAccountVersion added in v1.1.0

type SubAccountVersion = uint32

type SymbolType added in v1.1.0

type SymbolType string

type SymbolsType added in v1.1.0

type SymbolsType []SymbolType

type TxDidEntityWitness added in v1.2.0

type TxDidEntityWitness struct {
	CellDeps map[uint64]DidEntity
	Inputs   map[uint64]DidEntity
	Outputs  map[uint64]DidEntity
}

func GetDidEntityFromTx added in v1.2.0

func GetDidEntityFromTx(tx *types.Transaction) (TxDidEntityWitness, error)

type ValueType added in v1.1.0

type ValueType string

func (*ValueType) Gen added in v1.1.0

func (v *ValueType) Gen(data interface{}, preExp *AstExpression) (molecule.Bytes, error)

func (*ValueType) Parse added in v1.1.0

func (v *ValueType) Parse(data []byte) (interface{}, error)

type ValuesType added in v1.1.0

type ValuesType []ValueType

type VariableName added in v1.1.0

type VariableName string

type VariablesName added in v1.1.0

type VariablesName []VariableName

type WebAuthnKeyListDataBuilder added in v1.1.0

type WebAuthnKeyListDataBuilder struct {
	WebauthnKeyList       []WebauthnKey
	Index                 uint32
	Version               uint32
	DeviceKeyListCellData *molecule.DeviceKeyListCellData
	DataEntityOpt         *molecule.DataEntityOpt
}

func WebAuthnKeyListDataBuilderFromTx added in v1.1.0

func WebAuthnKeyListDataBuilderFromTx(tx *types.Transaction, dataType common.DataType) (*WebAuthnKeyListDataBuilder, error)

func (*WebAuthnKeyListDataBuilder) GenWitness added in v1.1.0

func (w *WebAuthnKeyListDataBuilder) GenWitness(p *WebauchnKeyListCellParam) (witness []byte, accData []byte, err error)

type WebauchnKeyListCellParam added in v1.1.0

type WebauchnKeyListCellParam struct {
	UpdateWebauthnKey []WebauthnKey //keylist need to be added
	Operation         common.WebAuchonKeyOperate
	Action            string
	OldIndex          uint32
	NewIndex          uint32
}

type WebauthnKey added in v1.1.0

type WebauthnKey struct {
	MinAlgId uint8  `json:"min_alg_id"`
	SubAlgId uint8  `json:"sub_alg_id"`
	Cid      string `json:"cid"`
	PubKey   string `json:"pubkey"`
}

func ConvertToWebauthnKeyList added in v1.1.0

func ConvertToWebauthnKeyList(keyLists *molecule.DeviceKeyList) []WebauthnKey

type WebauthnSignLv added in v1.1.0

type WebauthnSignLv struct {
	PkIndex          int
	Signature        string
	PubKey           string
	AuthnticatorData string
	ClientDataJson   string
}

func GetWebAuthnSignByWitnessArgs added in v1.1.0

func GetWebAuthnSignByWitnessArgs(witness []byte) (sign WebauthnSignLv, err error)

Jump to

Keyboard shortcuts

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