core

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: 28 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRejectedOutPoint  = errors.New("RejectedOutPoint")
	ErrInsufficientFunds = errors.New("InsufficientFunds")
	ErrNotEnoughChange   = errors.New("NotEnoughChange")
)
View Source
var (
	DasContractMap           syncmap.Map                               // map[contact name]{contract info}
	DasContractByTypeIdMap   = make(map[string]common.DasContractName) // map[contract type id]{contract name}
	DasConfigCellMap         syncmap.Map                               // map[ConfigCellTypeArgs]config cell info
	DasConfigCellByTxHashMap syncmap.Map                               // map[tx hash]{true}
	DasSoScriptMap           syncmap.Map                               // map[so script type]
)
View Source
var EnvMainNet = Env{
	THQCodeHash:      "0x9e537bf5b8ec044ca3f53355e879f3fd8832217e4a9b41d9994cf0c547241a79",
	ContractArgs:     "0xc126635ece567c71c50f7482c5db80603852c306",
	ContractCodeHash: "0x00000000000000000000000000000000000000000000000000545950455f4944",
	MapContract: map[common.DasContractName]string{
		common.DasContractNameConfigCellType:            "0x3775c65aabe8b79980c4933dd2f4347fa5ef03611cef64328685618aa7535794",
		common.DasContractNameAccountCellType:           "0x96dc231bbbee6aa474076468640f9e0ad27cf13b1343716a7ce04b116ea18ba8",
		common.DasContractNameBalanceCellType:           "0xbdc8f42643ccad23e8df3d2e8dbdea9201812cd1b7f84c46e69b020529629822",
		common.DasContractNameDispatchCellType:          "0xda22fd296682488687a6035b5fc97c269b72d7de128034389bd03041b40309c0",
		common.DasContractNameIncomeCellType:            "0x108fba6a9b9f2898b4cdf11383ba2a6ed3da951b458c48e5f5de0353bbca2d46",
		common.DasContractNameAccountSaleCellType:       "0xb782d5f4e24603340997494871ba8f7d175e6920e63ead6b8137170b2e370469",
		common.DasContractNameAlwaysSuccess:             "0xca5016f232830f8a73e6827b5e1108aca68e7cf8baea4847ac40ef1da43c4c50",
		common.DasContractNameApplyRegisterCellType:     "0xf18c3eab9fd28adbb793c38be9a59864989c1f739c22d2b6dc3f4284f047a69d",
		common.DasContractNamePreAccountCellType:        "0xf6574955079797010689a22cd172ce55b52d2c34d1e9bc6596e97babc2906f7e",
		common.DasContractNameProposalCellType:          "0xd7b779b1b30f86a77db6b292c9492906f2437b7d88a8a5994e722619bb1d41c8",
		common.DasContractNameReverseRecordCellType:     "0x000f3e1a89d85d268ed6d36578d474ecf91d8809f4f696dd2e5b97fe67b84a2e",
		common.DASContractNameOfferCellType:             "0x3ffc0f8b0ce4bc09f700ca84355a092447d79fc5224a6fbd64af95af840af91b",
		common.DASContractNameSubAccountCellType:        "0x97b19f14184f24d55b1247596a5d7637f133c7bb7735f0ae962dc709c5fc1e2e",
		common.DASContractNameEip712LibCellType:         "0xa71fc12ca4ce4127dc911dbe8006f1907c850957849e282ef1f26e3ee50ba7bf",
		common.DasContractNameReverseRecordRootCellType: "0x3bd4491a15b3c84de133f4d619f5f7317fe7df7098a5c8dfd0ff073e448321a7",
		common.DasKeyListCellType:                       "0x97e271bfd332cc2e68feb6a4fa21a1dc010c53011d02d9acdbfc4d417d8efadd",
		common.DasContractNameDpCellType:                "0x5aa67507980f2bfdef75bf4f14caf886202f044d84fb4300858c9c823e3bb651",
		common.DasContractNameDidCellType:               "0x62312cd846659e188b05da11dc3f080b083c27371ea701d6026e11e713e0e3de",
	},
	MapSoScript: map[common.SoScriptType]string{
		common.SoScriptTypeEd25519:   "0xac4689bcb177af6ff0fee8c0c3bf0d8803b263381a5d5b22f1ca1b687eb5eb4a",
		common.SoScriptTypeEth:       "0x748005446caeda5b04e30bca42a65bb0b5275d2bd02694f08ecb8d3d07c41433",
		common.SoScriptTypeTron:      "0xb29620c50fd4fde746eae4d27e40b42d0900d1718fbf25ecae704e6a693215db",
		common.SoScriptTypeCkbMulti:  "0xab8a94c35890712763c70130db080fbbb7fe99ec74e7c87e4fdd44f4a6155646",
		common.SoScriptTypeCkbSingle: "0x4eed7961fdeaa659aa9ff59a242a2bc40f63dc043c1eba44c207ee6e05e02e9f",
		common.SoScriptTypeDogeCoin:  "0x2388d84e42714e51cbb1a60c4ab2df3321c632a204b7d963d7f9b89a50ceaa3c",
		common.SoScriptWebauthn:      "0x3dd5981ead36572330cc90b0bd4795062483392bfeea09f6ff8f02c830988998",
		common.SoScriptBitcoin:       "0xbeeb821fccb98acb8713cd0702c2d74729909222608ee78be42c6a15c1eb2014",
	},
}
View Source
var EnvTestnet2 = Env{
	THQCodeHash:      "0x96248cdefb09eed910018a847cfb51ad044c2d7db650112931760e3ef34a7e9a",
	ContractArgs:     "0xbc502a34a430e3e167c82a24db6f9237b15ebf35",
	ContractCodeHash: "0x00000000000000000000000000000000000000000000000000545950455f4944",
	MapContract: map[common.DasContractName]string{
		common.DasContractNameConfigCellType:            "0x34363fad2018db0b3b6919c26870f302da74c3c4ef4456e5665b82c4118eda51",
		common.DasContractNameAccountCellType:           "0x6f0b8328b703617508d62d1f017b0d91fab2056de320a7b7faed4c777a356b7b",
		common.DasContractNameBalanceCellType:           "0x27560fe2daa6150b771621300d1d4ea127832b7b326f2d70eed63f5333b4a8a9",
		common.DasContractNameDispatchCellType:          "0xeedd10c7d8fee85c119daf2077fea9cf76b9a92ddca546f1f8e0031682e65aee",
		common.DasContractNameIncomeCellType:            "0xd7b9d8213671aec03f3a3ab95171e0e79481db2c084586b9ea99914c00ff3716",
		common.DasContractNameAccountSaleCellType:       "0xed5d7fc00a3f8605bfe3f6717747bb0ed529fa064c2b8ce56e9677a0c46c2c1c",
		common.DasContractNameAlwaysSuccess:             "0x7821c662b7efd50e7f6cf2b036efe53e07eccaf2e3447a2a470ee07ae455ab92",
		common.DasContractNameApplyRegisterCellType:     "0xc78fa9066af1624e600ccfb21df9546f900b2afe5d7940d91aefc115653f90d9",
		common.DasContractNamePreAccountCellType:        "0xd3f7ad59632a2ebdc2fe9d41aa69708ed1069b074cd8b297b205f835335d3a6b",
		common.DasContractNameProposalCellType:          "0x03d0bb128bd10e666975d9a07c148f6abebe811f511e9574048b30600b065b9a",
		common.DasContractNameReverseRecordCellType:     "0x334d7841eb156b8aa5abd7b09277e91e782d840140905496bb5bff0ea6ce9d75",
		common.DASContractNameOfferCellType:             "0x443b2d1b3b00ffab1a2287d84c47b2c31a11aad24b183d732c213a69e3d6d390",
		common.DASContractNameSubAccountCellType:        "0x63ca3e26cc69809f06735c6d9139ec2d84f2a277f13509a54060d6ee19423b5b",
		common.DASContractNameEip712LibCellType:         "0x16549cab7e92afb5f157141bc9da7781ce692a3144e47e2b8879a8d5a57b87c6",
		common.DasContractNameReverseRecordRootCellType: "0xd7dbb55237fca8aa544d160e26a22424b4edc6b9ce136994df977fa057e468ae",
		common.DasKeyListCellType:                       "0xf80a65bd78e54f66614eb5d17c980e66c1944e7808510b6f08bb46ae5407147c",
		common.DasContractNameDpCellType:                "0xf5af4173248dbeaf4a54d1aa93958e094b98c90400be92bb2b1daa61dfc37785",
		common.DasContractNameDidCellType:               "0x80f0d4bf6b3951911aa6b98cc609d477a8a10b903b35cfd528d098e95c36f680",
	},
	MapSoScript: map[common.SoScriptType]string{
		common.SoScriptTypeEd25519:   "0x6cd3e59963ebd6aec1ee99968f2ec418ced3273ad636a561cd5459836c903c2d",
		common.SoScriptTypeEth:       "0x644ead361f2a2fe32431a81489a7a0f8d7332ba17918ab5184461d588f011a82",
		common.SoScriptTypeTron:      "0x2df08d17fe6ff0994b741344fe62e100b7576c31e006f8bc83d26f26ede8d82e",
		common.SoScriptTypeCkbMulti:  "0x393ac0be9d3bf4a282d2cf0b80a4a910206b87451fc6a3fb04d176f3d0c1f73a",
		common.SoScriptTypeCkbSingle: "0x249b06f89e76f98cebcd945bea47926d6ff88908cbbc8be2ccfb0a915e349b21",
		common.SoScriptTypeDogeCoin:  "0x4d801e313bca5426c254fb9ac73fcdb79f9eee216a911ec39526a00e3379f496",
		common.SoScriptWebauthn:      "0xe8e93df527c7dd6f4deb2d5ac3a071649f5794a4ed8d565adca74e7bee634c48",
		common.SoScriptBitcoin:       "0xaaa8f5e85e59392a3c26eb0533851efaf9daf8793349a2d117025d6b474be3fa",
	},
}
View Source
var EnvTestnet3 = Env{
	THQCodeHash:      "0x96248cdefb09eed910018a847cfb51ad044c2d7db650112931760e3ef34a7e9a",
	ContractArgs:     "0xbc502a34a430e3e167c82a24db6f9237b15ebf35",
	ContractCodeHash: "0x00000000000000000000000000000000000000000000000000545950455f4944",
	MapContract: map[common.DasContractName]string{
		common.DasContractNameConfigCellType:            "0xe9fa679290f63ba1debc74f04e96f299d1b61a03a24e7a1a51c7ccad416ec16a",
		common.DasContractNameAccountCellType:           "0x1c7d62798d412351ec9a4262aacc2c2837712b780d90e0720051ffa6d6304e32",
		common.DasContractNameBalanceCellType:           "0x301127f501c2620174b60945f305d78a4f5cdf67dd44009001265ca133d0088d",
		common.DasContractNameDispatchCellType:          "0xeedd10c7d8fee85c119daf2077fea9cf76b9a92ddca546f1f8e0031682e65aee",
		common.DasContractNameIncomeCellType:            "0x0af1f2332b1f742136ef0ffec849d415c4b5b8c4426de5d245f2e7ac0a9f5773",
		common.DasContractNameAccountSaleCellType:       "0xaf446d756fca5b51fad915a3f0526221527f1dd5f32898408ee86e73dc9d9814",
		common.DasContractNameAlwaysSuccess:             "0x7821c662b7efd50e7f6cf2b036efe53e07eccaf2e3447a2a470ee07ae455ab92",
		common.DasContractNameApplyRegisterCellType:     "0xb12e454a3896b910030e669e8a81bf99c351cb58be8d1529e1c7023265db6084",
		common.DasContractNamePreAccountCellType:        "0x919e8036ded6670b923958db207527b5d1d3b95955e446e3475bfd7f949898c1",
		common.DasContractNameProposalCellType:          "0x2eecc2c70936609d14872acdedc9ba8b265c26240d49d66b6db027c5cfdb4256",
		common.DasContractNameReverseRecordCellType:     "0x80963278cbdc61cdafd5250555984b71ad016798b8879adc0e6b1ee7e01b7912",
		common.DASContractNameOfferCellType:             "0xc69186c17e41fead0f87eb1f94829778e98a398be202655ac59fdb9567d05bae",
		common.DASContractNameSubAccountCellType:        "0x57498a2df0c0137146ced681fa1854599e404da5804c1a5ff45d954c3cc89bfd",
		common.DASContractNameEip712LibCellType:         "0xd21b1f02b6057d6776bf7f1c7a26f550f1b383a930349620507f328e4cc07f2e",
		common.DasContractNameReverseRecordRootCellType: "0xeb54ad6c4be167c902470c4fe9b04a4d8e2b5ef46f4b2725e814518d7baa15ca",
		common.DasKeyListCellType:                       "0x449bb468a1fefb93e5b034a070d46e6772fcd25712dc56fc8bcc191b4433f1a0",
		common.DasContractNameDpCellType:                "",
		common.DasContractNameDidCellType:               "",
	},
	MapSoScript: map[common.SoScriptType]string{
		common.SoScriptTypeEd25519:   "0x6cd3e59963ebd6aec1ee99968f2ec418ced3273ad636a561cd5459836c903c2d",
		common.SoScriptTypeEth:       "0x644ead361f2a2fe32431a81489a7a0f8d7332ba17918ab5184461d588f011a82",
		common.SoScriptTypeTron:      "0x2df08d17fe6ff0994b741344fe62e100b7576c31e006f8bc83d26f26ede8d82e",
		common.SoScriptTypeCkbMulti:  "0x393ac0be9d3bf4a282d2cf0b80a4a910206b87451fc6a3fb04d176f3d0c1f73a",
		common.SoScriptTypeCkbSingle: "0x249b06f89e76f98cebcd945bea47926d6ff88908cbbc8be2ccfb0a915e349b21",
		common.SoScriptTypeDogeCoin:  "0x4d801e313bca5426c254fb9ac73fcdb79f9eee216a911ec39526a00e3379f496",
		common.SoScriptWebauthn:      "0xe8e93df527c7dd6f4deb2d5ac3a071649f5794a4ed8d565adca74e7bee634c48",
	},
}
View Source
var ErrContractMajorVersionDiff = errors.New("the major version of the contract is different")
View Source
var SubAccountNotFound = errors.New("sub-account not found")

Functions

func GetSatisfiedCapacityLiveCell

func GetSatisfiedCapacityLiveCell(client rpc.Client, dasCache *dascache.DasCache, dasLockScript, dasTypeScript *types.Script, capacityNeed, capacityForChange uint64) ([]*indexer.LiveCell, uint64, error)

func GetSatisfiedCapacityLiveCellWithOrder

func GetSatisfiedCapacityLiveCellWithOrder(client rpc.Client, dasCache *dascache.DasCache, dasLockScript, dasTypeScript *types.Script, capacityNeed, capacityForChange uint64, order indexer.SearchOrder) ([]*indexer.LiveCell, uint64, error)

func GetSatisfiedLimitLiveCell

func GetSatisfiedLimitLiveCell(client rpc.Client, dasCache *dascache.DasCache, searchKey *indexer.SearchKey, needLimit uint64, order indexer.SearchOrder) ([]*indexer.LiveCell, error)

func SetLogLevel

func SetLogLevel(level int)

func SplitOutputCell

func SplitOutputCell(total, base, limit uint64, lockScript, typeScript *types.Script) ([]*types.CellOutput, error)

func SplitOutputCell2 added in v1.0.1

func SplitOutputCell2(total, base, limit uint64, lockScript, typeScript *types.Script, splitOrder indexer.SearchOrder) ([]*types.CellOutput, error)

func UpdateAccountCellDasLockToEip712

func UpdateAccountCellDasLockToEip712(cell *indexer.LiveCell) error

Types

type AnyLockName added in v1.2.0

type AnyLockName string
const (
	AnyLockNameOmniLock AnyLockName = "omni-lock"
	AnyLockNameJoyID    AnyLockName = "joyid"
	AnyLockNameNoStr    AnyLockName = "nostr"
)

type ChainTypeAddress

type ChainTypeAddress struct {
	Type    string  `json:"type"` // blockchain
	KeyInfo KeyInfo `json:"key_info"`
}

func FormatChainTypeAddress added in v1.1.0

func FormatChainTypeAddress(net common.DasNetType, chainType common.ChainType, key string) ChainTypeAddress

func (*ChainTypeAddress) FormatChainTypeAddress

func (c *ChainTypeAddress) FormatChainTypeAddress(net common.DasNetType, is712 bool) (*DasAddressHex, error)

func (*ChainTypeAddress) FormatChainTypeAddressToScript added in v1.1.0

func (c *ChainTypeAddress) FormatChainTypeAddressToScript(net common.DasNetType, is712 bool) (*types.Script, *types.Script, error)

func (*ChainTypeAddress) GetChainId added in v1.2.0

func (c *ChainTypeAddress) GetChainId(net common.DasNetType) (chainId int64)

type DasAddressFormat

type DasAddressFormat struct {
	DasNetType common.DasNetType
}

func (*DasAddressFormat) ArgsToHex

func (d *DasAddressFormat) ArgsToHex(args []byte) (ownerHex, managerHex DasAddressHex, e error)

only for .bit args

func (*DasAddressFormat) ArgsToNormal

func (d *DasAddressFormat) ArgsToNormal(args []byte) (ownerNormal, managerNormal DasAddressNormal, e error)

only for .bit args

func (*DasAddressFormat) HexToArgs

func (d *DasAddressFormat) HexToArgs(owner, manager DasAddressHex) (args []byte, e error)

only for .bit hex address

func (*DasAddressFormat) HexToHalfArgs

func (d *DasAddressFormat) HexToHalfArgs(p DasAddressHex) (args []byte, e error)

only for .bit hex address

func (*DasAddressFormat) HexToNormal

func (d *DasAddressFormat) HexToNormal(p DasAddressHex) (r DasAddressNormal, e error)

only for .bit hex address

func (*DasAddressFormat) HexToScript

func (d *DasAddressFormat) HexToScript(p DasAddressHex) (lockScript, typeScript *types.Script, e error)

only for .bit hex address

func (*DasAddressFormat) NormalToHex

func (d *DasAddressFormat) NormalToHex(p DasAddressNormal) (r DasAddressHex, e error)

only for .bit normal address

func (*DasAddressFormat) ScriptToHex

func (d *DasAddressFormat) ScriptToHex(s *types.Script) (ownerHex, managerHex DasAddressHex, e error)

for .bit or normal ckb script

type DasAddressHex

type DasAddressHex struct {
	DasAlgorithmId    common.DasAlgorithmId
	DasSubAlgorithmId common.DasSubAlgorithmId
	AddressHex        string
	AddressPayload    []byte
	IsMulti           bool
	ChainType         common.ChainType // format normal address ckb chain type
	ParsedAddress     *address.ParsedAddress
}

func (*DasAddressHex) FormatAnyLock added in v1.2.0

func (d *DasAddressHex) FormatAnyLock() (*DasAddressHex, error)

func (*DasAddressHex) Payload added in v1.2.0

func (d *DasAddressHex) Payload() string

type DasAddressNormal

type DasAddressNormal struct {
	ChainType     common.ChainType
	AddressNormal string
	Is712         bool
}

type DasConfigCellInfo

type DasConfigCellInfo struct {
	Name        string
	OutPoint    types.OutPoint
	BlockNumber uint64
}

config cell info

func GetDasConfigCellInfo

func GetDasConfigCellInfo(configCellTypeArgs common.ConfigCellTypeArgs) (*DasConfigCellInfo, error)

func (*DasConfigCellInfo) ToCellDep

func (d *DasConfigCellInfo) ToCellDep() *types.CellDep

type DasContractInfo

type DasContractInfo struct {
	ContractName   common.DasContractName
	OutPoint       *types.OutPoint   // contract outpoint
	OutPut         *types.CellOutput // contract script
	ContractTypeId types.Hash        // contract type id
}

func GetDasContractInfo

func GetDasContractInfo(contractName common.DasContractName) (*DasContractInfo, error)

func (*DasContractInfo) IsSameTypeId

func (d *DasContractInfo) IsSameTypeId(codeHash types.Hash) bool

func (*DasContractInfo) ToCellDep

func (d *DasContractInfo) ToCellDep() *types.CellDep

func (*DasContractInfo) ToScript

func (d *DasContractInfo) ToScript(args []byte) *types.Script

type DasCore

type DasCore struct {
	// contains filtered or unexported fields
}

func NewDasCore

func NewDasCore(ctx context.Context, wg *sync.WaitGroup, opts ...DasCoreOption) *DasCore

func (*DasCore) AddPkIndexForSignMsg added in v1.1.0

func (d *DasCore) AddPkIndexForSignMsg(signMsg *string, idx int)

func (*DasCore) AsyncDasConfigCell

func (d *DasCore) AsyncDasConfigCell() error

func (*DasCore) CheckContractStatusOK added in v1.0.1

func (d *DasCore) CheckContractStatusOK(contractName common.DasContractName) (bool, error)

func (*DasCore) CheckContractVersion added in v1.0.1

func (d *DasCore) CheckContractVersion(contractName common.DasContractName) (defaultV, ChainV string, err error)

func (*DasCore) CheckContractVersionV2 added in v1.0.1

func (d *DasCore) CheckContractVersionV2(systemStatus *witness.ConfigCellDataBuilder, contractName common.DasContractName) (defaultV, ChainV string, err error)

func (*DasCore) Client

func (d *DasCore) Client() rpc.Client

func (*DasCore) ConfigCellDataBuilderByTypeArgs

func (d *DasCore) ConfigCellDataBuilderByTypeArgs(configCellTypeArgs common.ConfigCellTypeArgs) (*witness.ConfigCellDataBuilder, error)

func (*DasCore) ConfigCellDataBuilderByTypeArgsList

func (d *DasCore) ConfigCellDataBuilderByTypeArgsList(list ...common.ConfigCellTypeArgs) (*witness.ConfigCellDataBuilder, error)

func (*DasCore) Daf

func (d *DasCore) Daf() *DasAddressFormat

func (*DasCore) GetAccountCellOnChainByAlgorithmId

func (d *DasCore) GetAccountCellOnChainByAlgorithmId(oID, mID common.DasAlgorithmId, oA, mA, account string) (*indexer.LiveCell, error)

func (*DasCore) GetAccountCharSetList added in v1.0.1

func (d *DasCore) GetAccountCharSetList(account string) ([]common.AccountCharSet, error)

func (*DasCore) GetAnyLockCellDep added in v1.2.0

func (d *DasCore) GetAnyLockCellDep(anyLockName AnyLockName) (*types.CellDep, error)

func (*DasCore) GetBalanceCellWithLock added in v1.2.0

func (d *DasCore) GetBalanceCellWithLock(p *ParamGetBalanceCells) (uint64, []*indexer.LiveCell, error)

func (*DasCore) GetBalanceCells

func (d *DasCore) GetBalanceCells(p *ParamGetBalanceCells) ([]*indexer.LiveCell, uint64, error)

func (*DasCore) GetBalanceCellsFilter added in v1.2.0

func (d *DasCore) GetBalanceCellsFilter(p *ParamGetBalanceCells) ([]*indexer.LiveCell, uint64, error)

func (*DasCore) GetCustomScriptLiveCell

func (d *DasCore) GetCustomScriptLiveCell(data []byte) (*indexer.LiveCell, error)

func (*DasCore) GetDPBaseCapacity added in v1.2.0

func (d *DasCore) GetDPBaseCapacity() (uint64, uint64, error)

func (*DasCore) GetDPointCapacityRecycleWhitelist added in v1.2.0

func (d *DasCore) GetDPointCapacityRecycleWhitelist() (map[string]*types.Script, error)

func (*DasCore) GetDPointTransferWhitelist added in v1.2.0

func (d *DasCore) GetDPointTransferWhitelist() (map[string]*types.Script, error)

func (*DasCore) GetDasLock

func (d *DasCore) GetDasLock() *types.Script

func (*DasCore) GetDidCellOccupiedCapacity added in v1.2.0

func (d *DasCore) GetDidCellOccupiedCapacity(lock *types.Script, account string) (uint64, error)

func (*DasCore) GetDpCells added in v1.2.0

func (d *DasCore) GetDpCells(p *ParamGetDpCells) ([]*indexer.LiveCell, uint64, uint64, error)

func (*DasCore) GetHeightCell

func (d *DasCore) GetHeightCell() (*HeightCell, error)

func (*DasCore) GetHeightCellList added in v1.0.1

func (d *DasCore) GetHeightCellList() ([]*HeightCell, error)

func (*DasCore) GetIdxOfKeylist added in v1.1.0

func (d *DasCore) GetIdxOfKeylist(loginAddr, signAddr DasAddressHex) (int, error)

func (*DasCore) GetIdxOfKeylistByOutPoint added in v1.1.0

func (d *DasCore) GetIdxOfKeylistByOutPoint(LoginkeyListOp *types.OutPoint, signAddr DasAddressHex) (int, error)

func (*DasCore) GetInputsDPInfo added in v1.2.0

func (d *DasCore) GetInputsDPInfo(tx *types.Transaction) (map[string]TxDPInfo, error)

func (*DasCore) GetKeyListCell added in v1.1.0

func (d *DasCore) GetKeyListCell(args []byte) (*indexer.LiveCell, error)

func (*DasCore) GetOutputsDPInfo added in v1.2.0

func (d *DasCore) GetOutputsDPInfo(tx *types.Transaction) (map[string]TxDPInfo, error)

func (*DasCore) GetQuoteCell

func (d *DasCore) GetQuoteCell() (*QuoteCell, error)

func (*DasCore) GetQuoteCellList added in v1.0.1

func (d *DasCore) GetQuoteCellList() ([]*QuoteCell, error)

func (*DasCore) GetReverseRecordSmtCell added in v1.0.1

func (d *DasCore) GetReverseRecordSmtCell() (*indexer.LiveCell, error)

func (*DasCore) GetSubAccountCell

func (d *DasCore) GetSubAccountCell(parentAccountId string) (*indexer.LiveCell, error)

func (*DasCore) GetTimeCell

func (d *DasCore) GetTimeCell() (*TimeCell, error)

func (*DasCore) GetTimeCellList added in v1.0.1

func (d *DasCore) GetTimeCellList() ([]*TimeCell, error)

func (*DasCore) GetTxQuote added in v1.2.0

func (d *DasCore) GetTxQuote(tx *types.Transaction) (uint64, error)

func (*DasCore) InitDasConfigCell

func (d *DasCore) InitDasConfigCell() error

func (*DasCore) InitDasContract

func (d *DasCore) InitDasContract(mapDasContractTypeArgs map[common.DasContractName]string)

func (*DasCore) InitDasSoScript

func (d *DasCore) InitDasSoScript() error

func (*DasCore) NetType

func (d *DasCore) NetType() common.DasNetType

func (*DasCore) RunAsyncDasConfigCell

func (d *DasCore) RunAsyncDasConfigCell(t time.Duration)

func (*DasCore) RunAsyncDasContract

func (d *DasCore) RunAsyncDasContract(t time.Duration)

update contract info

func (*DasCore) RunAsyncDasSoScript

func (d *DasCore) RunAsyncDasSoScript(t time.Duration)

func (*DasCore) SplitDPCell added in v1.2.0

func (d *DasCore) SplitDPCell(p *ParamSplitDPCell) ([]*types.CellOutput, [][]byte, uint64, error)

func (*DasCore) TxToDidCellEntityAndAction added in v1.2.0

func (d *DasCore) TxToDidCellEntityAndAction(tx *types.Transaction) (common.DidCellAction, TxDidCellMap, error)

func (*DasCore) UpdateAccountCellDasLockToEip712

func (d *DasCore) UpdateAccountCellDasLockToEip712(cell *indexer.LiveCell)

type DasCoreOption

type DasCoreOption func(*DasCore)

func WithClient

func WithClient(client rpc.Client) DasCoreOption

func WithDasContractArgs

func WithDasContractArgs(dasContractArgs string) DasCoreOption

func WithDasContractCodeHash

func WithDasContractCodeHash(dasContractCodeHash string) DasCoreOption

func WithDasNetType

func WithDasNetType(net common.DasNetType) DasCoreOption

func WithTHQCodeHash

func WithTHQCodeHash(thqCodeHash string) DasCoreOption

type DidCellInfo added in v1.2.0

type DidCellInfo struct {
	Index       uint64
	OutPoint    *types.OutPoint
	Lock        *types.Script
	OutputsData []byte
}

func (*DidCellInfo) GetDataInfo added in v1.2.0

func (d *DidCellInfo) GetDataInfo() (*witness.SporeData, *witness.DidCellDataLV, error)

func (*DidCellInfo) GetLockAddress added in v1.2.0

func (d *DidCellInfo) GetLockAddress(netType common.DasNetType) (string, error)

type Env

type Env struct {
	THQCodeHash      string
	ContractArgs     string
	ContractCodeHash string
	MapContract      map[common.DasContractName]string
	MapSoScript      map[common.SoScriptType]string
}

func InitEnv

func InitEnv(net common.DasNetType) Env

func InitEnvOpt

func InitEnvOpt(net common.DasNetType, names ...common.DasContractName) Env

type HeightCell

type HeightCell struct {
	LiveCell *indexer.LiveCell
}

func (*HeightCell) BlockNumber

func (t *HeightCell) BlockNumber() int64

func (*HeightCell) ToCellDep

func (t *HeightCell) ToCellDep() *types.CellDep

type KeyInfo

type KeyInfo struct {
	CoinType common.CoinType `json:"coin_type"`
	ChainId  common.ChainId  `json:"chain_id"`
	Key      string          `json:"key"`
}

type ParamGetBalanceCells

type ParamGetBalanceCells struct {
	DasCache           *dascache.DasCache
	LockScript         *types.Script
	CapacityNeed       uint64
	CapacityForChange  uint64
	CurrentBlockNumber uint64
	SearchOrder        indexer.SearchOrder
	OutputDataLenRange *[2]uint64
}

type ParamGetDpCells added in v1.2.0

type ParamGetDpCells struct {
	DasCache           *dascache.DasCache
	LockScript         *types.Script
	AmountNeed         uint64
	CurrentBlockNumber uint64
	SearchOrder        indexer.SearchOrder
}

type ParamSplitDPCell added in v1.2.0

type ParamSplitDPCell struct {
	FromLock           *types.Script
	ToLock             *types.Script
	DPLiveCell         []*indexer.LiveCell
	DPLiveCellCapacity uint64
	DPTotalAmount      uint64
	DPTransferAmount   uint64
	DPSplitCount       int
	DPSplitAmount      uint64
	NormalCellLock     *types.Script
	SplitToLock        bool
	NormalCellLockFee  bool
}

type QuoteCell

type QuoteCell struct {
	LiveCell *indexer.LiveCell
}

func (*QuoteCell) Quote

func (q *QuoteCell) Quote() uint64

func (*QuoteCell) ToCellDep

func (q *QuoteCell) ToCellDep() *types.CellDep

type SoScript

type SoScript struct {
	Name         common.SoScriptType
	OutPoint     types.OutPoint
	SoScriptArgs string
}

func GetDasSoScript

func GetDasSoScript(soScriptName common.SoScriptType) (*SoScript, error)

func (*SoScript) ToCellDep

func (d *SoScript) ToCellDep() *types.CellDep

type TimeCell

type TimeCell struct {
	LiveCell *indexer.LiveCell
}

func (*TimeCell) Timestamp

func (t *TimeCell) Timestamp() int64

func (*TimeCell) ToCellDep

func (t *TimeCell) ToCellDep() *types.CellDep

type TxDPInfo added in v1.2.0

type TxDPInfo struct {
	AlgId    common.DasAlgorithmId    `json:"alg_id"`
	SubAlgId common.DasSubAlgorithmId `json:"sub_alg_id"`
	Payload  string                   `json:"payload"`
	AmountDP uint64                   `json:"amount_dp"`
	Args     []byte                   `json:"args"`
}

type TxDidCellMap added in v1.2.0

type TxDidCellMap struct {
	Inputs  map[string]DidCellInfo
	Outputs map[string]DidCellInfo
}

Jump to

Keyboard shortcuts

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