common

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 21 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MaxHashLen   = 20
	MMJsonObjStr = `` /* 1335-byte string literal not displayed */

)
View Source
const (
	ParamOwner   = "0x00"
	ParamManager = "0x01"
)
View Source
const (
	ChainTypeCkb       ChainType = 0 // ckb short address
	ChainTypeEth       ChainType = 1
	ChainTypeTron      ChainType = 3
	ChainTypeMixin     ChainType = 4
	ChainTypeCkbMulti  ChainType = 5
	ChainTypeCkbSingle ChainType = 6
	ChainTypeDogeCoin  ChainType = 7
	ChainTypeWebauthn  ChainType = 8

	HexPreFix              = "0x"
	TronPreFix             = "41"
	TronBase58PreFix       = "T"
	DogeCoinBase58PreFix   = "D"
	DasLockCkbPreFix       = "00"
	DasLockCkbMultiPreFix  = "01"
	DasLockCkbSinglePreFix = "02"
	DasLockEthPreFix       = "03"
	DasLockTronPreFix      = "04"
	DasLockEth712PreFix    = "05"
	DasLockEd25519PreFix   = "06"
	DasLockDogePreFix      = "07"
	DasLockWebauthnPreFix  = "08"

	DogeCoinBase58Version = 30
)
View Source
const (
	TronMessageHeader    = "\x19TRON Signed Message:\n%d"
	EthMessageHeader     = "\x19Ethereum Signed Message:\n%d"
	Ed25519MessageHeader = "\x18Ed25519 Signed Message:\n%d"
	DogeMessageHeader    = "\x19Dogecoin Signed Message:\n"
)
View Source
const (
	DasAccountSuffix       = ".bit"
	DasLockArgsLen         = 42
	DasLockArgsLenMax      = 66
	DasLockArgsLenWebAuthn = 44
	DasAccountIdLen        = 20
	HashBytesLen           = 32

	ExpireTimeLen    = 8
	NextAccountIdLen = 20

	ExpireTimeEndIndex      = HashBytesLen + DasAccountIdLen + NextAccountIdLen + ExpireTimeLen
	NextAccountIdStartIndex = HashBytesLen + DasAccountIdLen
	NextAccountIdEndIndex   = NextAccountIdStartIndex + NextAccountIdLen
)
View Source
const (
	OneCkb                            = uint64(1e8)
	DasLockWithBalanceTypeOccupiedCkb = uint64(116 * 1e8)
	ProposalCellOccupiedCkb           = uint64(106 * 1e8)
	MinCellOccupiedCkb                = uint64(61 * 1e8)
	PercentRateBase                   = 1e4
	UsdRateBase                       = 1e6

	AccountStatusNormal     uint8 = 0
	AccountStatusOnSale     uint8 = 1
	AccountStatusOnAuction  uint8 = 2
	AccountStatusOnCross    uint8 = 3
	AccountStatusOnApproval uint8 = 4

	OneYearSec       = int64(3600 * 24 * 365)
	BlackHoleAddress = "0x0000000000000000000000000000000000000000"

	DotBitPrefix string = "From .bit: "
)
View Source
const (
	ArgsQuoteCell  = "0x00"
	ArgsTimeCell   = "0x01"
	ArgsHeightCell = "0x02"
)
View Source
const (
	WitnessDas                  = "das"
	WitnessDasCharLen           = 3
	WitnessDasTableTypeEndIndex = 7
)
View Source
const (
	DataTypeNew          DataType = 0
	DataTypeOld          DataType = 1
	DataTypeDep          DataType = 2
	GoDataEntityVersion1 uint32   = 1
	GoDataEntityVersion2 uint32   = 2
	GoDataEntityVersion3 uint32   = 3
	GoDataEntityVersion4 uint32   = 4
	GoDataEntityVersion           = GoDataEntityVersion4
)
View Source
const (
	DasLockWebauthnSubPreFix = "07"
)
View Source
const LabelTopDID = "topdid.com"
View Source
const (
	WitnessDataSizeLimit = 32 * 1e3
)

Variables

View Source
var CharSetTypeDigitMap = make(map[string]struct{})
View Source
var CharSetTypeEmojiMap = make(map[string]struct{})
View Source
var CharSetTypeEnMap = make(map[string]struct{})
View Source
var CharSetTypeHanSMap = make(map[string]struct{})
View Source
var CharSetTypeHanTMap = make(map[string]struct{})
View Source
var CharSetTypeJaMap = make(map[string]struct{})
View Source
var CharSetTypeKoMap = make(map[string]struct{})
View Source
var CharSetTypeRuMap = make(map[string]struct{})
View Source
var CharSetTypeThMap = make(map[string]struct{})
View Source
var CharSetTypeTrMap = make(map[string]struct{})
View Source
var CharSetTypeViMap = make(map[string]struct{})
View Source
var RecordsAddressCoinTypeMap = map[string]string{
	"address.1815":  "address.ada",
	"address.118":   "address.atom",
	"address.9000":  "address.avalanche",
	"address.145":   "address.bch",
	"address.9006":  "address.bsc",
	"address.236":   "address.bsv",
	"address.0":     "address.btc",
	"address.52752": "address.celo",
	"address.309":   "address.ckb",
	"address.5":     "address.dash",
	"address.223":   "address.dfinity",
	"address.3":     "address.doge",
	"address.354":   "address.dot",
	"address.194":   "address.eos",
	"address.61":    "address.etc",
	"address.60":    "address.eth",
	"address.461":   "address.fil",
	"address.539":   "address.flow",
	"address.1010":  "address.heco",
	"address.291":   "address.iost",
	"address.4218":  "address.iota",
	"address.434":   "address.ksm",
	"address.2":     "address.ltc",
	"address.397":   "address.near",
	"address.966":   "address.polygon",
	"address.1991":  "address.sc",
	"address.501":   "address.sol",
	"address.5757":  "address.stacks",
	"address.330":   "address.terra",
	"address.195":   "address.trx",
	"address.818":   "address.vet",
	"address.43":    "address.xem",
	"address.148":   "address.xlm",
	"address.128":   "address.xmr",
	"address.144":   "address.xrp",
	"address.1729":  "address.xtz",
	"address.133":   "address.zec",
	"address.313":   "address.zil",
}
View Source
var RecordsAddressKeyMap = map[string]string{
	"address.xmr":       "address.128",
	"address.xrp":       "address.144",
	"address.iota":      "address.4218",
	"address.ltc":       "address.2",
	"address.xem":       "address.43",
	"address.terra":     "address.330",
	"address.celo":      "address.52752",
	"address.eth":       "address.60",
	"address.sc":        "address.1991",
	"address.trx":       "address.195",
	"address.zil":       "address.313",
	"address.ada":       "address.1815",
	"address.atom":      "address.118",
	"address.bsv":       "address.236",
	"address.fil":       "address.461",
	"address.near":      "address.397",
	"address.sol":       "address.501",
	"address.eos":       "address.194",
	"address.etc":       "address.61",
	"address.zec":       "address.133",
	"address.avalanche": "address.9000",
	"address.dash":      "address.5",
	"address.dfinity":   "address.223",
	"address.ckb":       "address.309",
	"address.stacks":    "address.5757",
	"address.bsc":       "address.9006",
	"address.dot":       "address.354",
	"address.polygon":   "address.966",
	"address.flow":      "address.539",
	"address.heco":      "address.1010",
	"address.iost":      "address.291",
	"address.ksm":       "address.434",
	"address.vet":       "address.818",
	"address.bch":       "address.145",
	"address.btc":       "address.0",
	"address.doge":      "address.3",
	"address.xlm":       "address.148",
	"address.xtz":       "address.1729",
}
View Source
var TokenId2RecordKeyMap = map[string][]string{
	"eth_eth":        {"eth", "60"},
	"bsc_bnb":        {"bnb", "9006"},
	"tron_trx":       {"trx", "195"},
	"eth_erc20_usdt": {"eth", "60"},
	"bsc_bep20_usdt": {"bnb", "9006"},
	"doge_doge":      {"doge", "3"},
}

Functions

func AccountCharTypeToUint64 added in v1.0.1

func AccountCharTypeToUint64(accountCharType AccountCharType) uint64

func AccountCharsToAccount

func AccountCharsToAccount(accountChars *molecule.AccountChars) string

func Base58CheckDecode added in v1.0.1

func Base58CheckDecode(addr string, version byte) (string, error)

func Base58CheckEncode added in v1.0.1

func Base58CheckEncode(payload string, version byte) (string, error)

func Blake2b

func Blake2b(acc []byte) []byte

func Bytes2Hex

func Bytes2Hex(b []byte) string

func CalculateCid1 added in v1.1.0

func CalculateCid1(cid string) (cid1 []byte)

cid' = hash(cid)*5 [:10]

func CalculatePk1 added in v1.1.0

func CalculatePk1(pk *ecdsa.PublicKey) (cid1 []byte)

pk' = hash(X+Y)*5 [:10]

func CalculateWebauthnPayload added in v1.1.0

func CalculateWebauthnPayload(cid1, pk1 []byte) (payload string)

func Capacity2Str

func Capacity2Str(capacity uint64) string

func CheckAccountCharSetList added in v1.0.1

func CheckAccountCharSetList(list []AccountCharSet) (account string, err error)

func CheckAccountCharTypeDiff added in v1.0.1

func CheckAccountCharTypeDiff(list []AccountCharSet) bool

func ConvertAccountCharsToCharsetNum added in v1.0.1

func ConvertAccountCharsToCharsetNum(accountChars *molecule.AccountChars) uint64

func ConvertRecordsAddressCoinType

func ConvertRecordsAddressCoinType(addressCoinType string) string

func ConvertRecordsAddressKey

func ConvertRecordsAddressKey(addressKey string) string

func ConvertScriptToAddress

func ConvertScriptToAddress(mode address.Mode, script *types.Script) (string, error)

func ConvertToAccountChars

func ConvertToAccountChars(accountCharSet []AccountCharSet) *molecule.AccountChars

func EcdsaRecover added in v1.1.0

func EcdsaRecover(curve elliptic.Curve, recoverData [2]RecoverData) (pk *ecdsa.PublicKey, err error)

func FormatAddressByCoinType added in v1.0.1

func FormatAddressByCoinType(coinType string, address string) (string, error)

func FormatAddressPayload added in v1.0.1

func FormatAddressPayload(payload []byte, algId DasAlgorithmId) string

func GetAccountCellExpiredAtFromOutputData

func GetAccountCellExpiredAtFromOutputData(data []byte) (uint64, error)

func GetAccountCellNextAccountIdFromOutputData

func GetAccountCellNextAccountIdFromOutputData(data []byte) ([]byte, error)

func GetAccountCharType

func GetAccountCharType(res map[AccountCharType]struct{}, list []AccountCharSet)

GetAccountCharType 'res' for sub-account multi AccountCharType

func GetAccountIdByAccount

func GetAccountIdByAccount(acc string) []byte

func GetAccountLength

func GetAccountLength(account string) uint8

deprecated

func GetDotBitAccountLength added in v1.0.1

func GetDotBitAccountLength(account string) ([]string, int, error)

func GetMaxHashLenData

func GetMaxHashLenData(data []byte) string

func GetMaxHashLenParams

func GetMaxHashLenParams(s string) string

func GetMaxHashLenScript

func GetMaxHashLenScript(script *types.Script, dasContractName DasContractName) string

func GetNormalLockScript

func GetNormalLockScript(args string) *types.Script

GetNormalLockScript normal script

func GetNormalLockScriptByMultiSig

func GetNormalLockScriptByMultiSig(args string) *types.Script

GetNormalLockScriptByMultiSig multi sig

func GetScript

func GetScript(codeHash, args string) *types.Script

func GetWebauthnPayload added in v1.1.0

func GetWebauthnPayload(cid string, pk *ecdsa.PublicKey) (payload string)

func Has0xPrefix

func Has0xPrefix(str string) bool

func Hex2Bytes

func Hex2Bytes(s string) []byte

func InitDigitMap added in v1.0.1

func InitDigitMap(numbers []string)

func InitEmojiMap added in v1.0.1

func InitEmojiMap(emojis []string)

func InitEnMap added in v1.0.1

func InitEnMap(ens []string)

func InitHanSMap added in v1.0.1

func InitHanSMap(hanSs []string)

func InitHanTMap added in v1.0.1

func InitHanTMap(hanTs []string)

func InitJaMap added in v1.0.1

func InitJaMap(jas []string)

func InitKoMap added in v1.0.1

func InitKoMap(kos []string)

func InitRuMap added in v1.0.1

func InitRuMap(rus []string)

func InitThMap added in v1.0.1

func InitThMap(ths []string)

func InitTrMap added in v1.0.1

func InitTrMap(trs []string)

func InitViMap added in v1.0.1

func InitViMap(vis []string)

func OutPoint2String

func OutPoint2String(txHash string, index uint) string

func OutPointStruct2String

func OutPointStruct2String(o *types.OutPoint) string

func OutputDataToAccountId

func OutputDataToAccountId(data []byte) ([]byte, error)

func OutputDataToSMTRoot

func OutputDataToSMTRoot(data []byte) ([]byte, error)

func ScriptToTypeId

func ScriptToTypeId(script *types.Script) types.Hash

script to type id

func String2OutPoint

func String2OutPoint(str string) (txHash string, index uint)

func String2OutPointStruct

func String2OutPointStruct(str string) *types.OutPoint

func TronBase58ToHex

func TronBase58ToHex(address string) (string, error)

func TronHexToBase58

func TronHexToBase58(address string) (string, error)

func Uint64ToAccountCharType added in v1.0.1

func Uint64ToAccountCharType(num uint64) map[AccountCharType]struct{}

Types

type AccountCharSet

type AccountCharSet struct {
	CharSetName AccountCharType `json:"char_set_name"`
	Char        string          `json:"char"`
}

func AccountToAccountChars

func AccountToAccountChars(account string) ([]AccountCharSet, error)

deprecated

func ConvertToAccountCharSets

func ConvertToAccountCharSets(accountChars *molecule.AccountChars) []AccountCharSet

func GetAccountCharSetList added in v1.1.0

func GetAccountCharSetList(account string) ([]AccountCharSet, error)

type AccountCharType

type AccountCharType uint32
const (
	AccountCharTypeEmoji AccountCharType = 0
	AccountCharTypeDigit AccountCharType = 1
	AccountCharTypeEn    AccountCharType = 2  // English
	AccountCharTypeHanS  AccountCharType = 3  // Chinese Simplified
	AccountCharTypeHanT  AccountCharType = 4  // Chinese Traditional
	AccountCharTypeJa    AccountCharType = 5  // Japanese
	AccountCharTypeKo    AccountCharType = 6  // Korean
	AccountCharTypeRu    AccountCharType = 7  // Russian
	AccountCharTypeTr    AccountCharType = 8  // Turkish
	AccountCharTypeTh    AccountCharType = 9  // Thai
	AccountCharTypeVi    AccountCharType = 10 // Vietnamese
)

type ActionDataType

type ActionDataType = string
const (
	ActionDataTypeActionData                    ActionDataType = "0x00000000" // action data
	ActionDataTypeAccountCell                   ActionDataType = "0x01000000" // account cell
	ActionDataTypeAccountSaleCell               ActionDataType = "0x02000000" // account sale cell
	ActionDataTypeAccountAuctionCell            ActionDataType = "0x03000000" // account auction cell
	ActionDataTypeProposalCell                  ActionDataType = "0x04000000" // proposal cell
	ActionDataTypePreAccountCell                ActionDataType = "0x05000000" // pre account cell
	ActionDataTypeIncomeCell                    ActionDataType = "0x06000000" // income cell
	ActionDataTypeOfferCell                     ActionDataType = "0x07000000" // offer cell
	ActionDataTypeSubAccount                    ActionDataType = "0x08000000" // sub account
	ActionDataTypeSubAccountMintSign            ActionDataType = "0x09000000"
	ActionDataTypeReverseSmt                    ActionDataType = "0x0a000000" // reverse smt
	ActionDataTypeSubAccountPriceRules          ActionDataType = "0x0b000000"
	ActionDataTypeSubAccountPreservedRules      ActionDataType = "0x0c000000"
	ActionDataTypeKeyListCfgCell                ActionDataType = "0x0d000000" // keylist config cell
	ActionDataTypeSubAccountRenewSign           ActionDataType = "0x0e000000" // sub_account renew sign
	ActionDataTypeKeyListCfgCellData            ActionDataType = "0x0f000000" //
	ActionDataTypeSubAccountCreateApprovalSign  ActionDataType = "0x10000000"
	ActionDataTypeSubAccountDelayApprovalSign   ActionDataType = "0x11000000"
	ActionDataTypeSubAccountRevokeApprovalSign  ActionDataType = "0x12000000"
	ActionDataTypeSubAccountFulfillApprovalSign ActionDataType = "0x13000000"
)

type ChainId

type ChainId string //BIP-44
const (
	ChainIdEthMainNet     ChainId = "1"
	ChainIdBscMainNet     ChainId = "56"
	ChainIdPolygonMainNet ChainId = "137"

	ChainIdEthTestNet     ChainId = "5" // Goerli
	ChainIdBscTestNet     ChainId = "97"
	ChainIdPolygonTestNet ChainId = "80001"
)

type ChainType

type ChainType int

func FormatChainIdToDasChainType

func FormatChainIdToDasChainType(netType DasNetType, chainId ChainId) ChainType

func FormatCoinTypeToDasChainType

func FormatCoinTypeToDasChainType(coinType CoinType) ChainType

func (ChainType) ToDasAlgorithmId

func (c ChainType) ToDasAlgorithmId(is712 bool) DasAlgorithmId

func (ChainType) ToString

func (c ChainType) ToString() string

type CoinType

type CoinType string // EIP-155
const (
	CoinTypeEth      CoinType = "60"
	CoinTypeTrx      CoinType = "195"
	CoinTypeBNB      CoinType = "714"
	CoinTypeBSC      CoinType = "9006"
	CoinTypeMatic    CoinType = "966"
	CoinTypeDogeCoin CoinType = "3"
	CoinTypeCKB      CoinType = "309"
)

https://github.com/satoshilabs/slips/blob/master/slip-0044.md

type ConfigCellTypeArgs

type ConfigCellTypeArgs = string
const (
	ConfigCellTypeArgsAccount             ConfigCellTypeArgs = "0x64000000"
	ConfigCellTypeArgsApply               ConfigCellTypeArgs = "0x65000000"
	ConfigCellTypeArgsIncome              ConfigCellTypeArgs = "0x67000000"
	ConfigCellTypeArgsMain                ConfigCellTypeArgs = "0x68000000"
	ConfigCellTypeArgsPrice               ConfigCellTypeArgs = "0x69000000"
	ConfigCellTypeArgsProposal            ConfigCellTypeArgs = "0x6a000000"
	ConfigCellTypeArgsProfitRate          ConfigCellTypeArgs = "0x6b000000"
	ConfigCellTypeArgsRecordNamespace     ConfigCellTypeArgs = "0x6c000000"
	ConfigCellTypeArgsRelease             ConfigCellTypeArgs = "0x6d000000"
	ConfigCellTypeArgsUnavailable         ConfigCellTypeArgs = "0x6e000000"
	ConfigCellTypeArgsSecondaryMarket     ConfigCellTypeArgs = "0x6f000000"
	ConfigCellTypeArgsReverseRecord       ConfigCellTypeArgs = "0x70000000"
	ConfigCellTypeArgsSubAccount          ConfigCellTypeArgs = "0x71000000"
	ConfigCellTypeArgsSubAccountWhiteList ConfigCellTypeArgs = "0x72000000"
	ConfigCellTypeArgsSystemStatus        ConfigCellTypeArgs = "0x73000000"
	ConfigCellTypeArgsSMTNodeWhitelist    ConfigCellTypeArgs = "0x74000000"

	ConfigCellTypeArgsPreservedAccount00 ConfigCellTypeArgs = "0x10270000"
	ConfigCellTypeArgsPreservedAccount01 ConfigCellTypeArgs = "0x11270000"
	ConfigCellTypeArgsPreservedAccount02 ConfigCellTypeArgs = "0x12270000"
	ConfigCellTypeArgsPreservedAccount03 ConfigCellTypeArgs = "0x13270000"
	ConfigCellTypeArgsPreservedAccount04 ConfigCellTypeArgs = "0x14270000"
	ConfigCellTypeArgsPreservedAccount05 ConfigCellTypeArgs = "0x15270000"
	ConfigCellTypeArgsPreservedAccount06 ConfigCellTypeArgs = "0x16270000"
	ConfigCellTypeArgsPreservedAccount07 ConfigCellTypeArgs = "0x17270000"
	ConfigCellTypeArgsPreservedAccount08 ConfigCellTypeArgs = "0x18270000"
	ConfigCellTypeArgsPreservedAccount09 ConfigCellTypeArgs = "0x19270000"
	ConfigCellTypeArgsPreservedAccount10 ConfigCellTypeArgs = "0x1a270000"
	ConfigCellTypeArgsPreservedAccount11 ConfigCellTypeArgs = "0x1b270000"
	ConfigCellTypeArgsPreservedAccount12 ConfigCellTypeArgs = "0x1c270000"
	ConfigCellTypeArgsPreservedAccount13 ConfigCellTypeArgs = "0x1d270000"
	ConfigCellTypeArgsPreservedAccount14 ConfigCellTypeArgs = "0x1e270000"
	ConfigCellTypeArgsPreservedAccount15 ConfigCellTypeArgs = "0x1f270000"
	ConfigCellTypeArgsPreservedAccount16 ConfigCellTypeArgs = "0x20270000"
	ConfigCellTypeArgsPreservedAccount17 ConfigCellTypeArgs = "0x21270000"
	ConfigCellTypeArgsPreservedAccount18 ConfigCellTypeArgs = "0x22270000"
	ConfigCellTypeArgsPreservedAccount19 ConfigCellTypeArgs = "0x23270000"

	ConfigCellTypeArgsCharSetEmoji ConfigCellTypeArgs = "0xa0860100"
	ConfigCellTypeArgsCharSetDigit ConfigCellTypeArgs = "0xa1860100"
	ConfigCellTypeArgsCharSetEn    ConfigCellTypeArgs = "0xa2860100"
	ConfigCellTypeArgsCharSetHanS  ConfigCellTypeArgs = "0xa3860100"
	ConfigCellTypeArgsCharSetHanT  ConfigCellTypeArgs = "0xa4860100"
	ConfigCellTypeArgsCharSetJa    ConfigCellTypeArgs = "0xa5860100"
	ConfigCellTypeArgsCharSetKo    ConfigCellTypeArgs = "0xa6860100"
	ConfigCellTypeArgsCharSetRu    ConfigCellTypeArgs = "0xa7860100"
	ConfigCellTypeArgsCharSetTr    ConfigCellTypeArgs = "0xa8860100"
	ConfigCellTypeArgsCharSetTh    ConfigCellTypeArgs = "0xa9860100"
	ConfigCellTypeArgsCharSetVi    ConfigCellTypeArgs = "0xaa860100"
)

func GetConfigCellTypeArgsPreservedAccountByIndex

func GetConfigCellTypeArgsPreservedAccountByIndex(index uint32) ConfigCellTypeArgs

type ContractStatus added in v1.0.1

type ContractStatus struct {
	Version string
	Status  uint8
}

func (ContractStatus) VersionInfo added in v1.0.1

func (cs ContractStatus) VersionInfo() (x, y, z int64)

type DasAction

type DasAction = string
const (
	DasActionConfig                 DasAction = "config"
	DasActionApplyRegister          DasAction = "apply_register"
	DasActionRefundApply            DasAction = "refund_apply"
	DasActionPreRegister            DasAction = "pre_register"
	DasActionRefundPreRegister      DasAction = "refund_pre_register"
	DasActionPropose                DasAction = "propose"
	DasActionTransferAccount        DasAction = "transfer_account"
	DasActionRenewAccount           DasAction = "renew_account"
	DasActionExtendPropose          DasAction = "extend_proposal"
	DasActionConfirmProposal        DasAction = "confirm_proposal"
	DasActionRecycleProposal        DasAction = "recycle_proposal"
	DasActionWithdrawFromWallet     DasAction = "withdraw_from_wallet"
	DasActionEditManager            DasAction = "edit_manager"
	DasActionEditRecords            DasAction = "edit_records"
	DasActionStartAccountSale       DasAction = "start_account_sale"
	DasActionEditAccountSale        DasAction = "edit_account_sale"
	DasActionCancelAccountSale      DasAction = "cancel_account_sale"
	DasActionBuyAccount             DasAction = "buy_account"
	DasActionSellAccount            DasAction = "sell_account"
	DasActionCreateIncome           DasAction = "create_income"
	DasActionConsolidateIncome      DasAction = "consolidate_income"
	DasActionDeclareReverseRecord   DasAction = "declare_reverse_record"
	DasActionRedeclareReverseRecord DasAction = "redeclare_reverse_record"
	DasActionRetractReverseRecord   DasAction = "retract_reverse_record"
	DasActionTransfer               DasAction = "transfer"
	DasActionCreateApproval         DasAction = "create_approval"
	DasActionDelayApproval          DasAction = "delay_approval"
	DasActionRevokeApproval         DasAction = "revoke_approval"
	DasActionFulfillApproval        DasAction = "fulfill_approval"

	DasActionMakeOffer   DasAction = "make_offer"
	DasActionEditOffer   DasAction = "edit_offer"
	DasActionCancelOffer DasAction = "cancel_offer"
	DasActionAcceptOffer DasAction = "accept_offer"

	DasActionEnableSubAccount               DasAction = "enable_sub_account"
	DasActionCreateSubAccount               DasAction = "create_sub_account"
	DasActionEditSubAccount                 DasAction = "edit_sub_account"
	DasActionRenewSubAccount                DasAction = "renew_sub_account"
	DasActionRecycleSubAccount              DasAction = "recycle_sub_account"
	DasActionLockSubAccountForCrossChain    DasAction = "lock_sub_account_for_cross_chain"
	DasActionUnlockSubAccountForCrossChain  DasAction = "unlock_sub_account_for_cross_chain"
	DasActionConfigSubAccountCustomScript   DasAction = "config_sub_account_custom_script"
	DasActionConfigSubAccount               DasAction = "config_sub_account"
	DasActionCollectSubAccountProfit        DasAction = "collect_sub_account_profit"
	DasActionUpdateSubAccount               DasAction = "update_sub_account"
	DasActionCollectSubAccountChannelProfit DasAction = "collect_sub_account_channel_profit"

	DasActionLockAccountForCrossChain   DasAction = "lock_account_for_cross_chain"
	DasActionUnlockAccountForCrossChain DasAction = "unlock_account_for_cross_chain"
	DasActionForceRecoverAccountStatus  DasAction = "force_recover_account_status"
	DasActionRecycleExpiredAccount      DasAction = "recycle_expired_account"

	DasActionUpdateReverseRecordRoot DasAction = "update_reverse_record_root"

	DasActionCreateKeyList DasAction = "create_device_key_list"
	DasActionUpdateKeyList DasAction = "update_device_key_list"
)

type DasAlgorithmId

type DasAlgorithmId int
const (
	DasAlgorithmIdCkb       DasAlgorithmId = 0
	DasAlgorithmIdCkbMulti  DasAlgorithmId = 1
	DasAlgorithmIdCkbSingle DasAlgorithmId = 2
	DasAlgorithmIdEth       DasAlgorithmId = 3
	DasAlgorithmIdTron      DasAlgorithmId = 4
	DasAlgorithmIdEth712    DasAlgorithmId = 5
	DasAlgorithmIdEd25519   DasAlgorithmId = 6
	DasAlgorithmIdDogeChain DasAlgorithmId = 7
	DasAlgorithmIdWebauthn  DasAlgorithmId = 8
)

func (DasAlgorithmId) Bytes

func (d DasAlgorithmId) Bytes() []byte

func (DasAlgorithmId) ToChainType

func (d DasAlgorithmId) ToChainType() ChainType

func (DasAlgorithmId) ToCoinType added in v1.1.0

func (d DasAlgorithmId) ToCoinType() CoinType

func (DasAlgorithmId) ToSoScriptType

func (d DasAlgorithmId) ToSoScriptType() SoScriptType

type DasContractName

type DasContractName string
const (
	DasContractNameAlwaysSuccess  DasContractName = "always-success"
	DasContractNameConfigCellType DasContractName = "config-cell-type"

	DasContractNameDispatchCellType DasContractName = "das-lock"
	DasContractNameAccountCellType  DasContractName = "account-cell-type"
	DasContractNameBalanceCellType  DasContractName = "balance-cell-type"

	DasContractNameApplyRegisterCellType DasContractName = "apply-register-cell-type"
	DasContractNamePreAccountCellType    DasContractName = "pre-account-cell-type"
	DasContractNameProposalCellType      DasContractName = "proposal-cell-type"

	DasContractNameIncomeCellType      DasContractName = "income-cell-type"
	DasContractNameAccountSaleCellType DasContractName = "account-sale-cell-type"

	DasContractNameReverseRecordCellType DasContractName = "reverse-record-cell-type"
	DASContractNameOfferCellType         DasContractName = "offer-cell-type"
	DASContractNameSubAccountCellType    DasContractName = "sub-account-cell-type"
	DASContractNameEip712LibCellType     DasContractName = "eip712-lib"

	DasContractNameReverseRecordRootCellType DasContractName = "reverse-record-root-cell-type"

	DasKeyListCellType DasContractName = "key-list-cell-type"
)

type DasNetType

type DasNetType = int
const (
	DasNetTypeMainNet  DasNetType = 1
	DasNetTypeTestnet2 DasNetType = 2
	DasNetTypeTestnet3 DasNetType = 3
)

type DasSubAlgorithmId added in v1.1.0

type DasSubAlgorithmId int
const (
	DasWebauthnSubAlgorithmIdES256 DasSubAlgorithmId = 7
)

type DataType

type DataType = int

type EditKey added in v1.0.1

type EditKey = string
const (
	EditKeyOwner        EditKey = "owner"
	EditKeyManager      EditKey = "manager"
	EditKeyRecords      EditKey = "records"
	EditKeyExpiredAt    EditKey = "expired_at"
	EditKeyManual       EditKey = "manual"
	EditKeyCustomRule   EditKey = "custom_rule"
	EditKeyCustomScript EditKey = "custom_script"
	EditKeyApproval     EditKey = "approval"
)

type MMJsonAction

type MMJsonAction struct {
	Action string `json:"action"`
	Params string `json:"params"`
}

type MMJsonCellInfo

type MMJsonCellInfo struct {
	Capacity  string `json:"capacity"`
	LockStr   string `json:"lock"`
	TypeStr   string `json:"type"`
	Data      string `json:"data"`
	ExtraData string `json:"extraData"`
}

type MMJsonObj

type MMJsonObj struct {
	Types struct {
		EIP712Domain []struct {
			Name string `json:"name"`
			Type string `json:"type"`
		} `json:"EIP712Domain"`
		Action []struct {
			Name string `json:"name"`
			Type string `json:"type"`
		} `json:"Action"`
		Cell []struct {
			Name string `json:"name"`
			Type string `json:"type"`
		} `json:"Cell"`
		Transaction []struct {
			Name string `json:"name"`
			Type string `json:"type"`
		} `json:"Transaction"`
	} `json:"types"`
	PrimaryType string `json:"primaryType"`
	Domain      struct {
		ChainID           int64  `json:"chainId"`
		Name              string `json:"name"`
		VerifyingContract string `json:"verifyingContract"`
		Version           string `json:"version"`
	} `json:"domain"`
	Message struct {
		DasMessage      string           `json:"DAS_MESSAGE"`
		InputsCapacity  string           `json:"inputsCapacity"`
		OutputsCapacity string           `json:"outputsCapacity"`
		Fee             string           `json:"fee"`
		Digest          string           `json:"digest"`
		Action          *MMJsonAction    `json:"action"`
		Inputs          []MMJsonCellInfo `json:"inputs"`
		Outputs         []MMJsonCellInfo `json:"outputs"`
	} `json:"message"`
}

func (*MMJsonObj) String

func (m *MMJsonObj) String() string

type RecoverData added in v1.1.0

type RecoverData struct {
	SignDigest []byte
	R, S       *big.Int
}

type SoScriptType

type SoScriptType string
const (
	SoScriptTypeEd25519   SoScriptType = "Ed25519"
	SoScriptTypeEth       SoScriptType = "Eth"
	SoScriptTypeTron      SoScriptType = "Tron"
	SoScriptTypeCkbMulti  SoScriptType = "CkbMulti"
	SoScriptTypeCkbSingle SoScriptType = "CkbSingle"
	SoScriptTypeDogeCoin  SoScriptType = "Doge"
	SoScriptWebauthn      SoScriptType = "Webauthn"
)

type SubAction added in v1.0.1

type SubAction = string
const (
	SubActionCreate           SubAction = "create"
	SubActionEdit             SubAction = "edit"
	SubActionRenew            SubAction = "renew"
	SubActionRecycle          SubAction = "recycle"
	SubActionCreateApproval   SubAction = "create_approval"
	SubActionDelayApproval    SubAction = "delay_approval"
	SubActionRevokeApproval   SubAction = "revoke_approval"
	SubActionFullfillApproval SubAction = "fulfill_approval"
)

type WebAuchonKeyOperate added in v1.1.0

type WebAuchonKeyOperate = string
const (
	AddWebAuthnKey    WebAuchonKeyOperate = "add"
	DeleteWebAuthnKey WebAuchonKeyOperate = "delete"
)

Jump to

Keyboard shortcuts

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