@ckb-ccc/core 1.12.5 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/address.advanced-CWGrVD-M.mjs +2 -0
- package/dist/address.advanced-CWGrVD-M.mjs.map +1 -0
- package/dist/advanced.d.mts +2 -0
- package/dist/advanced.mjs +1 -0
- package/dist/advancedBarrel-BD7EAPVd.d.mts +5480 -0
- package/dist/advancedBarrel-BD7EAPVd.d.mts.map +1 -0
- package/dist/advancedBarrel.d.mts +2 -0
- package/dist/advancedBarrel.mjs +2 -0
- package/dist/advancedBarrel.mjs.map +1 -0
- package/dist/barrel-DchA_RPN.mjs +7 -0
- package/dist/barrel-DchA_RPN.mjs.map +1 -0
- package/dist/barrel.d.mts +2 -0
- package/dist/barrel.mjs +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/rolldown-runtime-DK3Fl9T5.mjs +1 -0
- package/dist.commonjs/address.advanced-COp7SNhZ.js +2 -0
- package/dist.commonjs/address.advanced-COp7SNhZ.js.map +1 -0
- package/dist.commonjs/advanced.d.ts +2 -3
- package/dist.commonjs/advanced.js +1 -41
- package/dist.commonjs/advancedBarrel-DRDT4GBS.d.ts +5481 -0
- package/dist.commonjs/advancedBarrel-DRDT4GBS.d.ts.map +1 -0
- package/dist.commonjs/advancedBarrel.d.ts +2 -7
- package/dist.commonjs/advancedBarrel.js +2 -22
- package/dist.commonjs/advancedBarrel.js.map +1 -0
- package/dist.commonjs/barrel-CXC2Uy5L.js +7 -0
- package/dist.commonjs/barrel-CXC2Uy5L.js.map +1 -0
- package/dist.commonjs/barrel.d.ts +2 -14
- package/dist.commonjs/barrel.js +1 -29
- package/dist.commonjs/index.d.ts +2 -3
- package/dist.commonjs/index.js +1 -41
- package/package.json +20 -23
- package/src/barrel.ts +1 -0
- package/src/ckb/epoch.ts +489 -0
- package/src/ckb/index.ts +1 -0
- package/src/ckb/script.ts +4 -3
- package/src/ckb/transaction.ts +83 -94
- package/src/client/client.ts +377 -1
- package/src/client/clientPublicMainnet.advanced.ts +23 -0
- package/src/client/clientPublicTestnet.advanced.ts +23 -0
- package/src/client/clientTypes.ts +1 -2
- package/src/client/jsonRpc/transformers.ts +2 -2
- package/src/client/knownScript.ts +1 -0
- package/src/codec/codec.ts +108 -0
- package/src/{molecule → codec}/entity.ts +17 -7
- package/src/codec/predefined.ts +145 -0
- package/src/hasher/advanced.ts +3 -1
- package/src/hasher/hasherCkb.ts +1 -1
- package/src/hasher/hasherKeecak256.ts +1 -1
- package/src/keystore/index.ts +4 -4
- package/src/molecule/barrel.ts +10 -1
- package/src/molecule/codec.ts +33 -138
- package/src/molecule/predefined.ts +63 -50
- package/src/signer/btc/index.ts +1 -0
- package/src/signer/btc/psbt.ts +98 -0
- package/src/signer/btc/signerBtc.ts +41 -1
- package/src/signer/btc/signerBtcPublicKeyReadonly.ts +15 -0
- package/src/signer/btc/verify.ts +2 -1
- package/src/signer/ckb/signerCkbPrivateKey.ts +6 -11
- package/src/signer/ckb/verifyCkbSecp256k1.ts +6 -10
- package/src/signer/doge/signerDogePrivateKey.ts +6 -3
- package/src/signer/doge/verify.ts +7 -8
- package/src/signer/nostr/signerNostrPrivateKey.ts +9 -8
- package/src/signer/nostr/verify.ts +2 -2
- package/src/utils/index.ts +20 -1
- package/tsdown.config.mts +44 -0
- package/dist/address/address.advanced.d.ts +0 -65
- package/dist/address/address.advanced.d.ts.map +0 -1
- package/dist/address/address.advanced.js +0 -147
- package/dist/address/advanced.d.ts +0 -2
- package/dist/address/advanced.d.ts.map +0 -1
- package/dist/address/advanced.js +0 -1
- package/dist/address/index.d.ts +0 -58
- package/dist/address/index.d.ts.map +0 -1
- package/dist/address/index.js +0 -78
- package/dist/advanced.d.ts +0 -3
- package/dist/advanced.d.ts.map +0 -1
- package/dist/advanced.js +0 -2
- package/dist/advancedBarrel.d.ts +0 -7
- package/dist/advancedBarrel.d.ts.map +0 -1
- package/dist/advancedBarrel.js +0 -6
- package/dist/barrel.d.ts +0 -14
- package/dist/barrel.d.ts.map +0 -1
- package/dist/barrel.js +0 -13
- package/dist/bytes/advanced.d.ts +0 -6
- package/dist/bytes/advanced.d.ts.map +0 -1
- package/dist/bytes/advanced.js +0 -1
- package/dist/bytes/index.d.ts +0 -112
- package/dist/bytes/index.d.ts.map +0 -1
- package/dist/bytes/index.js +0 -155
- package/dist/ckb/advanced.d.ts +0 -3
- package/dist/ckb/advanced.d.ts.map +0 -1
- package/dist/ckb/advanced.js +0 -2
- package/dist/ckb/hash.d.ts +0 -18
- package/dist/ckb/hash.d.ts.map +0 -1
- package/dist/ckb/hash.js +0 -19
- package/dist/ckb/index.d.ts +0 -6
- package/dist/ckb/index.d.ts.map +0 -1
- package/dist/ckb/index.js +0 -5
- package/dist/ckb/script.advanced.d.ts +0 -5
- package/dist/ckb/script.advanced.d.ts.map +0 -1
- package/dist/ckb/script.advanced.js +0 -13
- package/dist/ckb/script.d.ts +0 -156
- package/dist/ckb/script.d.ts.map +0 -1
- package/dist/ckb/script.js +0 -184
- package/dist/ckb/transaction.advanced.d.ts +0 -5
- package/dist/ckb/transaction.advanced.d.ts.map +0 -1
- package/dist/ckb/transaction.advanced.js +0 -9
- package/dist/ckb/transaction.d.ts +0 -1401
- package/dist/ckb/transaction.d.ts.map +0 -1
- package/dist/ckb/transaction.js +0 -1880
- package/dist/ckb/transactionErrors.d.ts +0 -15
- package/dist/ckb/transactionErrors.d.ts.map +0 -1
- package/dist/ckb/transactionErrors.js +0 -21
- package/dist/ckb/transactionLumos.d.ts +0 -30
- package/dist/ckb/transactionLumos.d.ts.map +0 -1
- package/dist/ckb/transactionLumos.js +0 -1
- package/dist/client/advanced.d.ts +0 -6
- package/dist/client/advanced.d.ts.map +0 -1
- package/dist/client/advanced.js +0 -5
- package/dist/client/cache/advanced.d.ts +0 -2
- package/dist/client/cache/advanced.d.ts.map +0 -1
- package/dist/client/cache/advanced.js +0 -1
- package/dist/client/cache/cache.d.ts +0 -98
- package/dist/client/cache/cache.d.ts.map +0 -1
- package/dist/client/cache/cache.js +0 -139
- package/dist/client/cache/index.d.ts +0 -3
- package/dist/client/cache/index.d.ts.map +0 -1
- package/dist/client/cache/index.js +0 -2
- package/dist/client/cache/memory.advanced.d.ts +0 -52
- package/dist/client/cache/memory.advanced.d.ts.map +0 -1
- package/dist/client/cache/memory.advanced.js +0 -149
- package/dist/client/cache/memory.d.ts +0 -53
- package/dist/client/cache/memory.d.ts.map +0 -1
- package/dist/client/cache/memory.js +0 -148
- package/dist/client/client.d.ts +0 -107
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js +0 -328
- package/dist/client/clientPublicMainnet.advanced.d.ts +0 -4
- package/dist/client/clientPublicMainnet.advanced.d.ts.map +0 -1
- package/dist/client/clientPublicMainnet.advanced.js +0 -402
- package/dist/client/clientPublicMainnet.d.ts +0 -17
- package/dist/client/clientPublicMainnet.d.ts.map +0 -1
- package/dist/client/clientPublicMainnet.js +0 -40
- package/dist/client/clientPublicTestnet.advanced.d.ts +0 -4
- package/dist/client/clientPublicTestnet.advanced.d.ts.map +0 -1
- package/dist/client/clientPublicTestnet.advanced.js +0 -412
- package/dist/client/clientPublicTestnet.d.ts +0 -17
- package/dist/client/clientPublicTestnet.d.ts.map +0 -1
- package/dist/client/clientPublicTestnet.js +0 -40
- package/dist/client/clientTypes.advanced.d.ts +0 -25
- package/dist/client/clientTypes.advanced.d.ts.map +0 -1
- package/dist/client/clientTypes.advanced.js +0 -6
- package/dist/client/clientTypes.d.ts +0 -335
- package/dist/client/clientTypes.d.ts.map +0 -1
- package/dist/client/clientTypes.js +0 -232
- package/dist/client/index.d.ts +0 -8
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -7
- package/dist/client/jsonRpc/advanced.d.ts +0 -3
- package/dist/client/jsonRpc/advanced.d.ts.map +0 -1
- package/dist/client/jsonRpc/advanced.js +0 -2
- package/dist/client/jsonRpc/client.d.ts +0 -160
- package/dist/client/jsonRpc/client.d.ts.map +0 -1
- package/dist/client/jsonRpc/client.js +0 -223
- package/dist/client/jsonRpc/index.d.ts +0 -2
- package/dist/client/jsonRpc/index.d.ts.map +0 -1
- package/dist/client/jsonRpc/index.js +0 -1
- package/dist/client/jsonRpc/transformers.d.ts +0 -51
- package/dist/client/jsonRpc/transformers.d.ts.map +0 -1
- package/dist/client/jsonRpc/transformers.js +0 -247
- package/dist/client/jsonRpc/types.d.ts +0 -101
- package/dist/client/jsonRpc/types.d.ts.map +0 -1
- package/dist/client/jsonRpc/types.js +0 -1
- package/dist/client/knownScript.d.ts +0 -27
- package/dist/client/knownScript.d.ts.map +0 -1
- package/dist/client/knownScript.js +0 -28
- package/dist/fixedPoint/index.d.ts +0 -55
- package/dist/fixedPoint/index.d.ts.map +0 -1
- package/dist/fixedPoint/index.js +0 -68
- package/dist/hasher/advanced.d.ts +0 -2
- package/dist/hasher/advanced.d.ts.map +0 -1
- package/dist/hasher/advanced.js +0 -1
- package/dist/hasher/hasher.d.ts +0 -35
- package/dist/hasher/hasher.d.ts.map +0 -1
- package/dist/hasher/hasher.js +0 -1
- package/dist/hasher/hasherCkb.d.ts +0 -57
- package/dist/hasher/hasherCkb.d.ts.map +0 -1
- package/dist/hasher/hasherCkb.js +0 -70
- package/dist/hasher/hasherKeecak256.d.ts +0 -41
- package/dist/hasher/hasherKeecak256.d.ts.map +0 -1
- package/dist/hasher/hasherKeecak256.js +0 -46
- package/dist/hasher/index.d.ts +0 -4
- package/dist/hasher/index.d.ts.map +0 -1
- package/dist/hasher/index.js +0 -3
- package/dist/hex/index.d.ts +0 -27
- package/dist/hex/index.d.ts.map +0 -1
- package/dist/hex/index.js +0 -17
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/jsonRpc/advanced.d.ts +0 -2
- package/dist/jsonRpc/advanced.d.ts.map +0 -1
- package/dist/jsonRpc/advanced.js +0 -1
- package/dist/jsonRpc/index.d.ts +0 -2
- package/dist/jsonRpc/index.d.ts.map +0 -1
- package/dist/jsonRpc/index.js +0 -1
- package/dist/jsonRpc/requestor.d.ts +0 -49
- package/dist/jsonRpc/requestor.d.ts.map +0 -1
- package/dist/jsonRpc/requestor.js +0 -109
- package/dist/jsonRpc/transports/advanced.d.ts +0 -6
- package/dist/jsonRpc/transports/advanced.d.ts.map +0 -1
- package/dist/jsonRpc/transports/advanced.js +0 -5
- package/dist/jsonRpc/transports/factory.d.ts +0 -6
- package/dist/jsonRpc/transports/factory.d.ts.map +0 -1
- package/dist/jsonRpc/transports/factory.js +0 -8
- package/dist/jsonRpc/transports/fallback.d.ts +0 -8
- package/dist/jsonRpc/transports/fallback.d.ts.map +0 -1
- package/dist/jsonRpc/transports/fallback.js +0 -22
- package/dist/jsonRpc/transports/http.d.ts +0 -8
- package/dist/jsonRpc/transports/http.d.ts.map +0 -1
- package/dist/jsonRpc/transports/http.js +0 -22
- package/dist/jsonRpc/transports/transport.d.ts +0 -18
- package/dist/jsonRpc/transports/transport.d.ts.map +0 -1
- package/dist/jsonRpc/transports/transport.js +0 -1
- package/dist/jsonRpc/transports/webSocket.d.ts +0 -11
- package/dist/jsonRpc/transports/webSocket.d.ts.map +0 -1
- package/dist/jsonRpc/transports/webSocket.js +0 -87
- package/dist/keystore/index.d.ts +0 -31
- package/dist/keystore/index.d.ts.map +0 -1
- package/dist/keystore/index.js +0 -106
- package/dist/molecule/barrel.d.ts +0 -4
- package/dist/molecule/barrel.d.ts.map +0 -1
- package/dist/molecule/codec.d.ts +0 -146
- package/dist/molecule/codec.d.ts.map +0 -1
- package/dist/molecule/codec.js +0 -516
- package/dist/molecule/entity.d.ts +0 -112
- package/dist/molecule/entity.d.ts.map +0 -1
- package/dist/molecule/entity.js +0 -142
- package/dist/molecule/index.d.ts +0 -2
- package/dist/molecule/index.d.ts.map +0 -1
- package/dist/molecule/index.js +0 -1
- package/dist/molecule/predefined.d.ts +0 -57
- package/dist/molecule/predefined.d.ts.map +0 -1
- package/dist/molecule/predefined.js +0 -83
- package/dist/num/index.d.ts +0 -148
- package/dist/num/index.d.ts.map +0 -1
- package/dist/num/index.js +0 -204
- package/dist/signer/btc/index.d.ts +0 -4
- package/dist/signer/btc/index.d.ts.map +0 -1
- package/dist/signer/btc/index.js +0 -3
- package/dist/signer/btc/signerBtc.d.ts +0 -59
- package/dist/signer/btc/signerBtc.d.ts.map +0 -1
- package/dist/signer/btc/signerBtc.js +0 -83
- package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts +0 -55
- package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +0 -1
- package/dist/signer/btc/signerBtcPublicKeyReadonly.js +0 -61
- package/dist/signer/btc/verify.d.ts +0 -40
- package/dist/signer/btc/verify.d.ts.map +0 -1
- package/dist/signer/btc/verify.js +0 -69
- package/dist/signer/ckb/index.d.ts +0 -6
- package/dist/signer/ckb/index.d.ts.map +0 -1
- package/dist/signer/ckb/index.js +0 -5
- package/dist/signer/ckb/signerCkbPrivateKey.d.ts +0 -16
- package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +0 -1
- package/dist/signer/ckb/signerCkbPrivateKey.js +0 -42
- package/dist/signer/ckb/signerCkbPublicKey.d.ts +0 -27
- package/dist/signer/ckb/signerCkbPublicKey.d.ts.map +0 -1
- package/dist/signer/ckb/signerCkbPublicKey.js +0 -101
- package/dist/signer/ckb/signerCkbScriptReadonly.d.ts +0 -68
- package/dist/signer/ckb/signerCkbScriptReadonly.d.ts.map +0 -1
- package/dist/signer/ckb/signerCkbScriptReadonly.js +0 -78
- package/dist/signer/ckb/verifyCkbSecp256k1.d.ts +0 -11
- package/dist/signer/ckb/verifyCkbSecp256k1.d.ts.map +0 -1
- package/dist/signer/ckb/verifyCkbSecp256k1.js +0 -22
- package/dist/signer/ckb/verifyJoyId.d.ts +0 -6
- package/dist/signer/ckb/verifyJoyId.d.ts.map +0 -1
- package/dist/signer/ckb/verifyJoyId.js +0 -16
- package/dist/signer/doge/index.d.ts +0 -5
- package/dist/signer/doge/index.d.ts.map +0 -1
- package/dist/signer/doge/index.js +0 -4
- package/dist/signer/doge/signerDoge.d.ts +0 -52
- package/dist/signer/doge/signerDoge.d.ts.map +0 -1
- package/dist/signer/doge/signerDoge.js +0 -82
- package/dist/signer/doge/signerDogeAddressReadonly.d.ts +0 -41
- package/dist/signer/doge/signerDogeAddressReadonly.d.ts.map +0 -1
- package/dist/signer/doge/signerDogeAddressReadonly.js +0 -45
- package/dist/signer/doge/signerDogePrivateKey.d.ts +0 -52
- package/dist/signer/doge/signerDogePrivateKey.d.ts.map +0 -1
- package/dist/signer/doge/signerDogePrivateKey.js +0 -68
- package/dist/signer/doge/verify.d.ts +0 -17
- package/dist/signer/doge/verify.d.ts.map +0 -1
- package/dist/signer/doge/verify.js +0 -29
- package/dist/signer/dummy/alwaysError.d.ts +0 -12
- package/dist/signer/dummy/alwaysError.d.ts.map +0 -1
- package/dist/signer/dummy/alwaysError.js +0 -13
- package/dist/signer/dummy/dummy.d.ts +0 -15
- package/dist/signer/dummy/dummy.d.ts.map +0 -1
- package/dist/signer/dummy/dummy.js +0 -22
- package/dist/signer/dummy/index.d.ts +0 -4
- package/dist/signer/dummy/index.d.ts.map +0 -1
- package/dist/signer/dummy/index.js +0 -3
- package/dist/signer/dummy/openLink.d.ts +0 -12
- package/dist/signer/dummy/openLink.d.ts.map +0 -1
- package/dist/signer/dummy/openLink.js +0 -13
- package/dist/signer/evm/index.d.ts +0 -4
- package/dist/signer/evm/index.d.ts.map +0 -1
- package/dist/signer/evm/index.js +0 -3
- package/dist/signer/evm/signerEvm.d.ts +0 -59
- package/dist/signer/evm/signerEvm.d.ts.map +0 -1
- package/dist/signer/evm/signerEvm.js +0 -139
- package/dist/signer/evm/signerEvmAddressReadonly.d.ts +0 -47
- package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +0 -1
- package/dist/signer/evm/signerEvmAddressReadonly.js +0 -51
- package/dist/signer/evm/verify.d.ts +0 -6
- package/dist/signer/evm/verify.d.ts.map +0 -1
- package/dist/signer/evm/verify.js +0 -9
- package/dist/signer/index.d.ts +0 -8
- package/dist/signer/index.d.ts.map +0 -1
- package/dist/signer/index.js +0 -7
- package/dist/signer/nostr/index.d.ts +0 -5
- package/dist/signer/nostr/index.d.ts.map +0 -1
- package/dist/signer/nostr/index.js +0 -4
- package/dist/signer/nostr/signerNostr.d.ts +0 -72
- package/dist/signer/nostr/signerNostr.d.ts.map +0 -1
- package/dist/signer/nostr/signerNostr.js +0 -96
- package/dist/signer/nostr/signerNostrPrivateKey.d.ts +0 -14
- package/dist/signer/nostr/signerNostrPrivateKey.d.ts.map +0 -1
- package/dist/signer/nostr/signerNostrPrivateKey.js +0 -34
- package/dist/signer/nostr/signerNostrPublicKeyReadonly.d.ts +0 -15
- package/dist/signer/nostr/signerNostrPublicKeyReadonly.d.ts.map +0 -1
- package/dist/signer/nostr/signerNostrPublicKeyReadonly.js +0 -26
- package/dist/signer/nostr/verify.d.ts +0 -9
- package/dist/signer/nostr/verify.d.ts.map +0 -1
- package/dist/signer/nostr/verify.js +0 -55
- package/dist/signer/signer/index.d.ts +0 -256
- package/dist/signer/signer/index.d.ts.map +0 -1
- package/dist/signer/signer/index.js +0 -305
- package/dist/utils/index.d.ts +0 -97
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -55
- package/dist.commonjs/address/address.advanced.d.ts +0 -65
- package/dist.commonjs/address/address.advanced.d.ts.map +0 -1
- package/dist.commonjs/address/address.advanced.js +0 -152
- package/dist.commonjs/address/advanced.d.ts +0 -2
- package/dist.commonjs/address/advanced.d.ts.map +0 -1
- package/dist.commonjs/address/advanced.js +0 -17
- package/dist.commonjs/address/index.d.ts +0 -58
- package/dist.commonjs/address/index.d.ts.map +0 -1
- package/dist.commonjs/address/index.js +0 -82
- package/dist.commonjs/advanced.d.ts.map +0 -1
- package/dist.commonjs/advancedBarrel.d.ts.map +0 -1
- package/dist.commonjs/barrel.d.ts.map +0 -1
- package/dist.commonjs/bytes/advanced.d.ts +0 -6
- package/dist.commonjs/bytes/advanced.d.ts.map +0 -1
- package/dist.commonjs/bytes/advanced.js +0 -2
- package/dist.commonjs/bytes/index.d.ts +0 -112
- package/dist.commonjs/bytes/index.d.ts.map +0 -1
- package/dist.commonjs/bytes/index.js +0 -163
- package/dist.commonjs/ckb/advanced.d.ts +0 -3
- package/dist.commonjs/ckb/advanced.d.ts.map +0 -1
- package/dist.commonjs/ckb/advanced.js +0 -18
- package/dist.commonjs/ckb/hash.d.ts +0 -18
- package/dist.commonjs/ckb/hash.d.ts.map +0 -1
- package/dist.commonjs/ckb/hash.js +0 -22
- package/dist.commonjs/ckb/index.d.ts +0 -6
- package/dist.commonjs/ckb/index.d.ts.map +0 -1
- package/dist.commonjs/ckb/index.js +0 -21
- package/dist.commonjs/ckb/script.advanced.d.ts +0 -5
- package/dist.commonjs/ckb/script.advanced.d.ts.map +0 -1
- package/dist.commonjs/ckb/script.advanced.js +0 -16
- package/dist.commonjs/ckb/script.d.ts +0 -156
- package/dist.commonjs/ckb/script.d.ts.map +0 -1
- package/dist.commonjs/ckb/script.js +0 -190
- package/dist.commonjs/ckb/transaction.advanced.d.ts +0 -5
- package/dist.commonjs/ckb/transaction.advanced.d.ts.map +0 -1
- package/dist.commonjs/ckb/transaction.advanced.js +0 -12
- package/dist.commonjs/ckb/transaction.d.ts +0 -1401
- package/dist.commonjs/ckb/transaction.d.ts.map +0 -1
- package/dist.commonjs/ckb/transaction.js +0 -1894
- package/dist.commonjs/ckb/transactionErrors.d.ts +0 -15
- package/dist.commonjs/ckb/transactionErrors.d.ts.map +0 -1
- package/dist.commonjs/ckb/transactionErrors.js +0 -26
- package/dist.commonjs/ckb/transactionLumos.d.ts +0 -30
- package/dist.commonjs/ckb/transactionLumos.d.ts.map +0 -1
- package/dist.commonjs/ckb/transactionLumos.js +0 -2
- package/dist.commonjs/client/advanced.d.ts +0 -6
- package/dist.commonjs/client/advanced.d.ts.map +0 -1
- package/dist.commonjs/client/advanced.js +0 -21
- package/dist.commonjs/client/cache/advanced.d.ts +0 -2
- package/dist.commonjs/client/cache/advanced.d.ts.map +0 -1
- package/dist.commonjs/client/cache/advanced.js +0 -17
- package/dist.commonjs/client/cache/cache.d.ts +0 -98
- package/dist.commonjs/client/cache/cache.d.ts.map +0 -1
- package/dist.commonjs/client/cache/cache.js +0 -143
- package/dist.commonjs/client/cache/index.d.ts +0 -3
- package/dist.commonjs/client/cache/index.d.ts.map +0 -1
- package/dist.commonjs/client/cache/index.js +0 -18
- package/dist.commonjs/client/cache/memory.advanced.d.ts +0 -52
- package/dist.commonjs/client/cache/memory.advanced.d.ts.map +0 -1
- package/dist.commonjs/client/cache/memory.advanced.js +0 -158
- package/dist.commonjs/client/cache/memory.d.ts +0 -53
- package/dist.commonjs/client/cache/memory.d.ts.map +0 -1
- package/dist.commonjs/client/cache/memory.js +0 -152
- package/dist.commonjs/client/client.d.ts +0 -107
- package/dist.commonjs/client/client.d.ts.map +0 -1
- package/dist.commonjs/client/client.js +0 -332
- package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +0 -4
- package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +0 -1
- package/dist.commonjs/client/clientPublicMainnet.advanced.js +0 -405
- package/dist.commonjs/client/clientPublicMainnet.d.ts +0 -17
- package/dist.commonjs/client/clientPublicMainnet.d.ts.map +0 -1
- package/dist.commonjs/client/clientPublicMainnet.js +0 -47
- package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +0 -4
- package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts.map +0 -1
- package/dist.commonjs/client/clientPublicTestnet.advanced.js +0 -415
- package/dist.commonjs/client/clientPublicTestnet.d.ts +0 -17
- package/dist.commonjs/client/clientPublicTestnet.d.ts.map +0 -1
- package/dist.commonjs/client/clientPublicTestnet.js +0 -47
- package/dist.commonjs/client/clientTypes.advanced.d.ts +0 -25
- package/dist.commonjs/client/clientTypes.advanced.d.ts.map +0 -1
- package/dist.commonjs/client/clientTypes.advanced.js +0 -10
- package/dist.commonjs/client/clientTypes.d.ts +0 -335
- package/dist.commonjs/client/clientTypes.d.ts.map +0 -1
- package/dist.commonjs/client/clientTypes.js +0 -251
- package/dist.commonjs/client/index.d.ts +0 -8
- package/dist.commonjs/client/index.d.ts.map +0 -1
- package/dist.commonjs/client/index.js +0 -23
- package/dist.commonjs/client/jsonRpc/advanced.d.ts +0 -3
- package/dist.commonjs/client/jsonRpc/advanced.d.ts.map +0 -1
- package/dist.commonjs/client/jsonRpc/advanced.js +0 -18
- package/dist.commonjs/client/jsonRpc/client.d.ts +0 -160
- package/dist.commonjs/client/jsonRpc/client.d.ts.map +0 -1
- package/dist.commonjs/client/jsonRpc/client.js +0 -227
- package/dist.commonjs/client/jsonRpc/index.d.ts +0 -2
- package/dist.commonjs/client/jsonRpc/index.d.ts.map +0 -1
- package/dist.commonjs/client/jsonRpc/index.js +0 -17
- package/dist.commonjs/client/jsonRpc/transformers.d.ts +0 -51
- package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +0 -1
- package/dist.commonjs/client/jsonRpc/transformers.js +0 -251
- package/dist.commonjs/client/jsonRpc/types.d.ts +0 -101
- package/dist.commonjs/client/jsonRpc/types.d.ts.map +0 -1
- package/dist.commonjs/client/jsonRpc/types.js +0 -2
- package/dist.commonjs/client/knownScript.d.ts +0 -27
- package/dist.commonjs/client/knownScript.d.ts.map +0 -1
- package/dist.commonjs/client/knownScript.js +0 -31
- package/dist.commonjs/fixedPoint/index.d.ts +0 -55
- package/dist.commonjs/fixedPoint/index.d.ts.map +0 -1
- package/dist.commonjs/fixedPoint/index.js +0 -73
- package/dist.commonjs/hasher/advanced.d.ts +0 -2
- package/dist.commonjs/hasher/advanced.d.ts.map +0 -1
- package/dist.commonjs/hasher/advanced.js +0 -4
- package/dist.commonjs/hasher/hasher.d.ts +0 -35
- package/dist.commonjs/hasher/hasher.d.ts.map +0 -1
- package/dist.commonjs/hasher/hasher.js +0 -2
- package/dist.commonjs/hasher/hasherCkb.d.ts +0 -57
- package/dist.commonjs/hasher/hasherCkb.d.ts.map +0 -1
- package/dist.commonjs/hasher/hasherCkb.js +0 -75
- package/dist.commonjs/hasher/hasherKeecak256.d.ts +0 -41
- package/dist.commonjs/hasher/hasherKeecak256.d.ts.map +0 -1
- package/dist.commonjs/hasher/hasherKeecak256.js +0 -50
- package/dist.commonjs/hasher/index.d.ts +0 -4
- package/dist.commonjs/hasher/index.d.ts.map +0 -1
- package/dist.commonjs/hasher/index.js +0 -19
- package/dist.commonjs/hex/index.d.ts +0 -27
- package/dist.commonjs/hex/index.d.ts.map +0 -1
- package/dist.commonjs/hex/index.js +0 -20
- package/dist.commonjs/index.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/advanced.d.ts +0 -2
- package/dist.commonjs/jsonRpc/advanced.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/advanced.js +0 -17
- package/dist.commonjs/jsonRpc/index.d.ts +0 -2
- package/dist.commonjs/jsonRpc/index.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/index.js +0 -17
- package/dist.commonjs/jsonRpc/requestor.d.ts +0 -49
- package/dist.commonjs/jsonRpc/requestor.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/requestor.js +0 -113
- package/dist.commonjs/jsonRpc/transports/advanced.d.ts +0 -6
- package/dist.commonjs/jsonRpc/transports/advanced.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/transports/advanced.js +0 -21
- package/dist.commonjs/jsonRpc/transports/factory.d.ts +0 -6
- package/dist.commonjs/jsonRpc/transports/factory.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/transports/factory.js +0 -11
- package/dist.commonjs/jsonRpc/transports/fallback.d.ts +0 -8
- package/dist.commonjs/jsonRpc/transports/fallback.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/transports/fallback.js +0 -26
- package/dist.commonjs/jsonRpc/transports/http.d.ts +0 -8
- package/dist.commonjs/jsonRpc/transports/http.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/transports/http.js +0 -26
- package/dist.commonjs/jsonRpc/transports/transport.d.ts +0 -18
- package/dist.commonjs/jsonRpc/transports/transport.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/transports/transport.js +0 -2
- package/dist.commonjs/jsonRpc/transports/webSocket.d.ts +0 -11
- package/dist.commonjs/jsonRpc/transports/webSocket.d.ts.map +0 -1
- package/dist.commonjs/jsonRpc/transports/webSocket.js +0 -94
- package/dist.commonjs/keystore/index.d.ts +0 -31
- package/dist.commonjs/keystore/index.d.ts.map +0 -1
- package/dist.commonjs/keystore/index.js +0 -110
- package/dist.commonjs/molecule/barrel.d.ts +0 -4
- package/dist.commonjs/molecule/barrel.d.ts.map +0 -1
- package/dist.commonjs/molecule/barrel.js +0 -19
- package/dist.commonjs/molecule/codec.d.ts +0 -146
- package/dist.commonjs/molecule/codec.d.ts.map +0 -1
- package/dist.commonjs/molecule/codec.js +0 -531
- package/dist.commonjs/molecule/entity.d.ts +0 -112
- package/dist.commonjs/molecule/entity.d.ts.map +0 -1
- package/dist.commonjs/molecule/entity.js +0 -147
- package/dist.commonjs/molecule/index.d.ts +0 -2
- package/dist.commonjs/molecule/index.d.ts.map +0 -1
- package/dist.commonjs/molecule/index.js +0 -37
- package/dist.commonjs/molecule/predefined.d.ts +0 -57
- package/dist.commonjs/molecule/predefined.d.ts.map +0 -1
- package/dist.commonjs/molecule/predefined.js +0 -87
- package/dist.commonjs/num/index.d.ts +0 -148
- package/dist.commonjs/num/index.d.ts.map +0 -1
- package/dist.commonjs/num/index.js +0 -216
- package/dist.commonjs/signer/btc/index.d.ts +0 -4
- package/dist.commonjs/signer/btc/index.d.ts.map +0 -1
- package/dist.commonjs/signer/btc/index.js +0 -19
- package/dist.commonjs/signer/btc/signerBtc.d.ts +0 -59
- package/dist.commonjs/signer/btc/signerBtc.d.ts.map +0 -1
- package/dist.commonjs/signer/btc/signerBtc.js +0 -87
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +0 -55
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +0 -1
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +0 -65
- package/dist.commonjs/signer/btc/verify.d.ts +0 -40
- package/dist.commonjs/signer/btc/verify.d.ts.map +0 -1
- package/dist.commonjs/signer/btc/verify.js +0 -80
- package/dist.commonjs/signer/ckb/index.d.ts +0 -6
- package/dist.commonjs/signer/ckb/index.d.ts.map +0 -1
- package/dist.commonjs/signer/ckb/index.js +0 -21
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +0 -16
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +0 -1
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +0 -46
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +0 -27
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts.map +0 -1
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +0 -105
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +0 -68
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts.map +0 -1
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +0 -82
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +0 -11
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts.map +0 -1
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +0 -26
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +0 -6
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts.map +0 -1
- package/dist.commonjs/signer/ckb/verifyJoyId.js +0 -19
- package/dist.commonjs/signer/doge/index.d.ts +0 -5
- package/dist.commonjs/signer/doge/index.d.ts.map +0 -1
- package/dist.commonjs/signer/doge/index.js +0 -20
- package/dist.commonjs/signer/doge/signerDoge.d.ts +0 -52
- package/dist.commonjs/signer/doge/signerDoge.d.ts.map +0 -1
- package/dist.commonjs/signer/doge/signerDoge.js +0 -89
- package/dist.commonjs/signer/doge/signerDogeAddressReadonly.d.ts +0 -41
- package/dist.commonjs/signer/doge/signerDogeAddressReadonly.d.ts.map +0 -1
- package/dist.commonjs/signer/doge/signerDogeAddressReadonly.js +0 -49
- package/dist.commonjs/signer/doge/signerDogePrivateKey.d.ts +0 -52
- package/dist.commonjs/signer/doge/signerDogePrivateKey.d.ts.map +0 -1
- package/dist.commonjs/signer/doge/signerDogePrivateKey.js +0 -72
- package/dist.commonjs/signer/doge/verify.d.ts +0 -17
- package/dist.commonjs/signer/doge/verify.d.ts.map +0 -1
- package/dist.commonjs/signer/doge/verify.js +0 -33
- package/dist.commonjs/signer/dummy/alwaysError.d.ts +0 -12
- package/dist.commonjs/signer/dummy/alwaysError.d.ts.map +0 -1
- package/dist.commonjs/signer/dummy/alwaysError.js +0 -17
- package/dist.commonjs/signer/dummy/dummy.d.ts +0 -15
- package/dist.commonjs/signer/dummy/dummy.d.ts.map +0 -1
- package/dist.commonjs/signer/dummy/dummy.js +0 -26
- package/dist.commonjs/signer/dummy/index.d.ts +0 -4
- package/dist.commonjs/signer/dummy/index.d.ts.map +0 -1
- package/dist.commonjs/signer/dummy/index.js +0 -19
- package/dist.commonjs/signer/dummy/openLink.d.ts +0 -12
- package/dist.commonjs/signer/dummy/openLink.d.ts.map +0 -1
- package/dist.commonjs/signer/dummy/openLink.js +0 -17
- package/dist.commonjs/signer/evm/index.d.ts +0 -4
- package/dist.commonjs/signer/evm/index.d.ts.map +0 -1
- package/dist.commonjs/signer/evm/index.js +0 -19
- package/dist.commonjs/signer/evm/signerEvm.d.ts +0 -59
- package/dist.commonjs/signer/evm/signerEvm.d.ts.map +0 -1
- package/dist.commonjs/signer/evm/signerEvm.js +0 -143
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +0 -47
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts.map +0 -1
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +0 -55
- package/dist.commonjs/signer/evm/verify.d.ts +0 -6
- package/dist.commonjs/signer/evm/verify.d.ts.map +0 -1
- package/dist.commonjs/signer/evm/verify.js +0 -12
- package/dist.commonjs/signer/index.d.ts +0 -8
- package/dist.commonjs/signer/index.d.ts.map +0 -1
- package/dist.commonjs/signer/index.js +0 -23
- package/dist.commonjs/signer/nostr/index.d.ts +0 -5
- package/dist.commonjs/signer/nostr/index.d.ts.map +0 -1
- package/dist.commonjs/signer/nostr/index.js +0 -20
- package/dist.commonjs/signer/nostr/signerNostr.d.ts +0 -72
- package/dist.commonjs/signer/nostr/signerNostr.d.ts.map +0 -1
- package/dist.commonjs/signer/nostr/signerNostr.js +0 -100
- package/dist.commonjs/signer/nostr/signerNostrPrivateKey.d.ts +0 -14
- package/dist.commonjs/signer/nostr/signerNostrPrivateKey.d.ts.map +0 -1
- package/dist.commonjs/signer/nostr/signerNostrPrivateKey.js +0 -38
- package/dist.commonjs/signer/nostr/signerNostrPublicKeyReadonly.d.ts +0 -15
- package/dist.commonjs/signer/nostr/signerNostrPublicKeyReadonly.d.ts.map +0 -1
- package/dist.commonjs/signer/nostr/signerNostrPublicKeyReadonly.js +0 -30
- package/dist.commonjs/signer/nostr/verify.d.ts +0 -9
- package/dist.commonjs/signer/nostr/verify.d.ts.map +0 -1
- package/dist.commonjs/signer/nostr/verify.js +0 -60
- package/dist.commonjs/signer/signer/index.d.ts +0 -256
- package/dist.commonjs/signer/signer/index.d.ts.map +0 -1
- package/dist.commonjs/signer/signer/index.js +0 -311
- package/dist.commonjs/utils/index.d.ts +0 -97
- package/dist.commonjs/utils/index.d.ts.map +0 -1
- package/dist.commonjs/utils/index.js +0 -62
- /package/{dist/molecule/barrel.js → src/codec/index.ts} +0 -0
|
@@ -1,1401 +0,0 @@
|
|
|
1
|
-
import { Bytes, BytesLike } from "../bytes/index.js";
|
|
2
|
-
import type { ClientCollectableSearchKeyFilterLike } from "../client/clientTypes.advanced.js";
|
|
3
|
-
import { ClientBlockHeader, type CellDepInfoLike, type Client, type ClientBlockHeaderLike } from "../client/index.js";
|
|
4
|
-
import { KnownScript } from "../client/knownScript.js";
|
|
5
|
-
import { Hasher } from "../hasher/index.js";
|
|
6
|
-
import { Hex, HexLike } from "../hex/index.js";
|
|
7
|
-
import { mol } from "../molecule/index.js";
|
|
8
|
-
import { Num, NumLike } from "../num/index.js";
|
|
9
|
-
import type { Signer } from "../signer/index.js";
|
|
10
|
-
import { Script, ScriptLike } from "./script.js";
|
|
11
|
-
import type { LumosTransactionSkeletonType } from "./transactionLumos.js";
|
|
12
|
-
export declare const DepTypeCodec: mol.Codec<DepTypeLike, DepType>;
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export type DepTypeLike = string | number | bigint;
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export type DepType = "depGroup" | "code";
|
|
21
|
-
/**
|
|
22
|
-
* Converts a DepTypeLike value to a DepType.
|
|
23
|
-
* @public
|
|
24
|
-
*
|
|
25
|
-
* @param val - The value to convert, which can be a string, number, or bigint.
|
|
26
|
-
* @returns The corresponding DepType.
|
|
27
|
-
*
|
|
28
|
-
* @throws Will throw an error if the input value is not a valid dep type.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* const depType = depTypeFrom(1); // Outputs "code"
|
|
33
|
-
* const depType = depTypeFrom("depGroup"); // Outputs "depGroup"
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare function depTypeFrom(val: DepTypeLike): DepType;
|
|
37
|
-
/**
|
|
38
|
-
* Converts a DepTypeLike value to its corresponding byte representation.
|
|
39
|
-
* @public
|
|
40
|
-
*
|
|
41
|
-
* @param depType - The dep type value to convert.
|
|
42
|
-
* @returns A Uint8Array containing the byte representation of the dep type.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const depTypeBytes = depTypeToBytes("code"); // Outputs Uint8Array [1]
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function depTypeToBytes(depType: DepTypeLike): Bytes;
|
|
50
|
-
/**
|
|
51
|
-
* Converts a byte-like value to a DepType.
|
|
52
|
-
* @public
|
|
53
|
-
*
|
|
54
|
-
* @param bytes - The byte-like value to convert.
|
|
55
|
-
* @returns The corresponding DepType.
|
|
56
|
-
*
|
|
57
|
-
* @throws Will throw an error if the input bytes do not correspond to a valid dep type.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* const depType = depTypeFromBytes(new Uint8Array([1])); // Outputs "code"
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare function depTypeFromBytes(bytes: BytesLike): DepType;
|
|
65
|
-
/**
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
export type OutPointLike = {
|
|
69
|
-
txHash: HexLike;
|
|
70
|
-
index: NumLike;
|
|
71
|
-
};
|
|
72
|
-
declare const OutPoint_base: (abstract new () => {
|
|
73
|
-
toBytes(): Bytes;
|
|
74
|
-
clone(): OutPoint;
|
|
75
|
-
eq(other: OutPointLike): boolean;
|
|
76
|
-
hash(): Hex;
|
|
77
|
-
}) & {
|
|
78
|
-
byteLength?: number;
|
|
79
|
-
encode(_: OutPointLike): Bytes;
|
|
80
|
-
decode(_: BytesLike): OutPoint;
|
|
81
|
-
fromBytes(_bytes: BytesLike): OutPoint;
|
|
82
|
-
from(_: OutPointLike): OutPoint;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* @public
|
|
86
|
-
*/
|
|
87
|
-
export declare class OutPoint extends OutPoint_base {
|
|
88
|
-
txHash: Hex;
|
|
89
|
-
index: Num;
|
|
90
|
-
/**
|
|
91
|
-
* Creates an instance of OutPoint.
|
|
92
|
-
*
|
|
93
|
-
* @param txHash - The transaction hash.
|
|
94
|
-
* @param index - The index of the output in the transaction.
|
|
95
|
-
*/
|
|
96
|
-
constructor(txHash: Hex, index: Num);
|
|
97
|
-
/**
|
|
98
|
-
* Creates an OutPoint instance from an OutPointLike object.
|
|
99
|
-
*
|
|
100
|
-
* @param outPoint - An OutPointLike object or an instance of OutPoint.
|
|
101
|
-
* @returns An OutPoint instance.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* const outPoint = OutPoint.from({ txHash: "0x...", index: 0 });
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
static from(outPoint: OutPointLike): OutPoint;
|
|
109
|
-
/**
|
|
110
|
-
* Clone a OutPoint.
|
|
111
|
-
*
|
|
112
|
-
* @returns A cloned OutPoint instance.
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```typescript
|
|
116
|
-
* const outPoint1 = outPoint0.clone();
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
clone(): OutPoint;
|
|
120
|
-
/**
|
|
121
|
-
* Check if the OutPoint is equal to another OutPoint.
|
|
122
|
-
* @public
|
|
123
|
-
* @param other - The other OutPoint to compare with
|
|
124
|
-
* @returns True if the OutPoints are equal, false otherwise
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* const isEqual = outPoint0.eq(outPoint1);
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
eq(other: OutPointLike): boolean;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* @public
|
|
135
|
-
*/
|
|
136
|
-
export type CellOutputLike = {
|
|
137
|
-
capacity?: NumLike | null;
|
|
138
|
-
lock: ScriptLike;
|
|
139
|
-
type?: ScriptLike | null;
|
|
140
|
-
};
|
|
141
|
-
declare const CellOutput_base: (abstract new () => {
|
|
142
|
-
toBytes(): Bytes;
|
|
143
|
-
clone(): CellOutput;
|
|
144
|
-
eq(other: CellOutputLike): boolean;
|
|
145
|
-
hash(): Hex;
|
|
146
|
-
}) & {
|
|
147
|
-
byteLength?: number;
|
|
148
|
-
encode(_: CellOutputLike): Bytes;
|
|
149
|
-
decode(_: BytesLike): CellOutput;
|
|
150
|
-
fromBytes(_bytes: BytesLike): CellOutput;
|
|
151
|
-
from(_: CellOutputLike): CellOutput;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
export declare class CellOutput extends CellOutput_base {
|
|
157
|
-
capacity: Num;
|
|
158
|
-
lock: Script;
|
|
159
|
-
type?: Script | undefined;
|
|
160
|
-
/**
|
|
161
|
-
* Creates an instance of CellOutput.
|
|
162
|
-
*
|
|
163
|
-
* @param capacity - The capacity of the cell.
|
|
164
|
-
* @param lock - The lock script of the cell.
|
|
165
|
-
* @param type - The optional type script of the cell.
|
|
166
|
-
*/
|
|
167
|
-
constructor(capacity: Num, lock: Script, type?: Script | undefined);
|
|
168
|
-
get occupiedSize(): number;
|
|
169
|
-
/**
|
|
170
|
-
* Creates a CellOutput instance from a CellOutputLike object.
|
|
171
|
-
* This method supports automatic capacity calculation when outputData is provided and capacity is 0 or omitted.
|
|
172
|
-
*
|
|
173
|
-
* @param cellOutput - A CellOutputLike object or an instance of CellOutput.
|
|
174
|
-
* @param outputData - Optional output data used for automatic capacity calculation.
|
|
175
|
-
* When provided and capacity is 0, the capacity will be calculated
|
|
176
|
-
* as occupiedSize + outputData.length.
|
|
177
|
-
* @returns A CellOutput instance.
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* ```typescript
|
|
181
|
-
* // Basic usage with explicit capacity
|
|
182
|
-
* const cellOutput1 = CellOutput.from({
|
|
183
|
-
* capacity: 1000n,
|
|
184
|
-
* lock: { codeHash: "0x...", hashType: "type", args: "0x..." },
|
|
185
|
-
* type: { codeHash: "0x...", hashType: "type", args: "0x..." }
|
|
186
|
-
* });
|
|
187
|
-
*
|
|
188
|
-
* // Automatic capacity calculation
|
|
189
|
-
* const cellOutput2 = CellOutput.from({
|
|
190
|
-
* lock: { codeHash: "0x...", hashType: "type", args: "0x..." }
|
|
191
|
-
* }, "0x1234"); // Capacity will be calculated automatically
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
static from(cellOutput: CellOutputLike, outputData?: HexLike | null): CellOutput;
|
|
195
|
-
/**
|
|
196
|
-
* Clone a CellOutput.
|
|
197
|
-
*
|
|
198
|
-
* @returns A cloned CellOutput instance.
|
|
199
|
-
*
|
|
200
|
-
* @example
|
|
201
|
-
* ```typescript
|
|
202
|
-
* const cellOutput1 = cellOutput0.clone();
|
|
203
|
-
* ```
|
|
204
|
-
*/
|
|
205
|
-
clone(): CellOutput;
|
|
206
|
-
}
|
|
207
|
-
export declare const CellOutputVec: mol.Codec<CellOutputLike[], CellOutput[]>;
|
|
208
|
-
/**
|
|
209
|
-
* @public
|
|
210
|
-
* Represents a cell-like object that may or may not be on-chain.
|
|
211
|
-
* It can optionally have an `outPoint` (or `previousOutput`).
|
|
212
|
-
* This is used as a flexible input for creating `CellAny` instances.
|
|
213
|
-
* @see CellAny
|
|
214
|
-
*/
|
|
215
|
-
export type CellAnyLike = {
|
|
216
|
-
outPoint?: OutPointLike | null;
|
|
217
|
-
previousOutput?: OutPointLike | null;
|
|
218
|
-
cellOutput: CellOutputLike;
|
|
219
|
-
outputData?: HexLike | null;
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* Represents a CKB cell that can be either on-chain (with an `outPoint`) or off-chain (without an `outPoint`).
|
|
223
|
-
* This class provides a unified interface for handling cells before they are included in a transaction,
|
|
224
|
-
* or for cells that are already part of the blockchain state.
|
|
225
|
-
*
|
|
226
|
-
* @public
|
|
227
|
-
*/
|
|
228
|
-
export declare class CellAny {
|
|
229
|
-
cellOutput: CellOutput;
|
|
230
|
-
outputData: Hex;
|
|
231
|
-
outPoint: OutPoint | undefined;
|
|
232
|
-
/**
|
|
233
|
-
* Creates an instance of CellAny.
|
|
234
|
-
*
|
|
235
|
-
* @param cellOutput - The cell output of the cell.
|
|
236
|
-
* @param outputData - The output data of the cell.
|
|
237
|
-
* @param outPoint - The optional output point of the cell. If provided, the cell is considered on-chain.
|
|
238
|
-
*/
|
|
239
|
-
constructor(cellOutput: CellOutput, outputData: Hex, outPoint?: OutPoint);
|
|
240
|
-
/**
|
|
241
|
-
* Creates a `CellAny` instance from a `CellAnyLike` object.
|
|
242
|
-
* This factory method provides a convenient way to create `CellAny` instances
|
|
243
|
-
* from plain objects, automatically handling the optional `outPoint` or `previousOutput`.
|
|
244
|
-
*
|
|
245
|
-
* @param cell - A `CellAnyLike` object.
|
|
246
|
-
* @returns A new `CellAny` instance.
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* ```typescript
|
|
250
|
-
* // Create an off-chain cell (e.g., a new output)
|
|
251
|
-
* const offChainCell = CellAny.from({
|
|
252
|
-
* cellOutput: { capacity: 1000n, lock: lockScript },
|
|
253
|
-
* outputData: "0x"
|
|
254
|
-
* });
|
|
255
|
-
*
|
|
256
|
-
* // Create an on-chain cell from an input
|
|
257
|
-
* const onChainCell = CellAny.from({
|
|
258
|
-
* outPoint: { txHash: "0x...", index: 0 },
|
|
259
|
-
* cellOutput: { capacity: 2000n, lock: lockScript },
|
|
260
|
-
* outputData: "0x1234"
|
|
261
|
-
* });
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
static from(cell: CellAnyLike): CellAny;
|
|
265
|
-
/**
|
|
266
|
-
* Calculates the total occupied size of the cell in bytes.
|
|
267
|
-
* This includes the size of the `CellOutput` structure plus the size of the `outputData`.
|
|
268
|
-
*
|
|
269
|
-
* @returns The total occupied size in bytes.
|
|
270
|
-
*/
|
|
271
|
-
get occupiedSize(): number;
|
|
272
|
-
/**
|
|
273
|
-
* Calculates the free capacity of the cell.
|
|
274
|
-
* Free capacity is the total capacity minus the capacity occupied by the cell's structure and data.
|
|
275
|
-
*
|
|
276
|
-
* @returns The free capacity in shannons as a `Num`.
|
|
277
|
-
*/
|
|
278
|
-
get capacityFree(): bigint;
|
|
279
|
-
/**
|
|
280
|
-
* Checks if the cell is a Nervos DAO cell and optionally checks its phase.
|
|
281
|
-
*
|
|
282
|
-
* @param client - A CKB client instance to fetch known script information.
|
|
283
|
-
* @param phase - Optional phase to check: "deposited" or "withdrew".
|
|
284
|
-
* If omitted, it checks if the cell is a DAO cell regardless of phase.
|
|
285
|
-
* @returns A promise that resolves to `true` if the cell is a matching Nervos DAO cell, `false` otherwise.
|
|
286
|
-
*/
|
|
287
|
-
isNervosDao(client: Client, phase?: "deposited" | "withdrew"): Promise<boolean>;
|
|
288
|
-
/**
|
|
289
|
-
* Clones the `CellAny` instance.
|
|
290
|
-
*
|
|
291
|
-
* @returns A new `CellAny` instance that is a deep copy of the current one.
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* ```typescript
|
|
295
|
-
* const clonedCell = cellAny.clone();
|
|
296
|
-
* ```
|
|
297
|
-
*/
|
|
298
|
-
clone(): CellAny;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Represents a cell-like object that is guaranteed to be on-chain.
|
|
302
|
-
* It must have an `outPoint` (or its alias `previousOutput`).
|
|
303
|
-
* This is used as a type constraint for creating `Cell` instances.
|
|
304
|
-
* @see Cell
|
|
305
|
-
* @public
|
|
306
|
-
*/
|
|
307
|
-
export type CellLike = CellAnyLike & ({
|
|
308
|
-
outPoint: OutPointLike;
|
|
309
|
-
previousOutput?: undefined | null;
|
|
310
|
-
} | {
|
|
311
|
-
outPoint?: undefined | null;
|
|
312
|
-
previousOutput: OutPointLike;
|
|
313
|
-
});
|
|
314
|
-
/**
|
|
315
|
-
* Represents an on-chain CKB cell, which is a `CellAny` that is guaranteed to have an `outPoint`.
|
|
316
|
-
* This class is typically used for cells that are already part of the blockchain state, such as transaction inputs.
|
|
317
|
-
* @public
|
|
318
|
-
*/
|
|
319
|
-
export declare class Cell extends CellAny {
|
|
320
|
-
outPoint: OutPoint;
|
|
321
|
-
/**
|
|
322
|
-
* Creates an instance of an on-chain Cell.
|
|
323
|
-
*
|
|
324
|
-
* @param outPoint - The output point of the cell.
|
|
325
|
-
* @param cellOutput - The cell output of the cell.
|
|
326
|
-
* @param outputData - The output data of the cell.
|
|
327
|
-
*/
|
|
328
|
-
constructor(outPoint: OutPoint, cellOutput: CellOutput, outputData: Hex);
|
|
329
|
-
/**
|
|
330
|
-
* Creates a Cell instance from a CellLike object.
|
|
331
|
-
* This method accepts either `outPoint` or `previousOutput` to specify the cell's location,
|
|
332
|
-
* and supports automatic capacity calculation for the cell output.
|
|
333
|
-
*
|
|
334
|
-
* @param cell - A CellLike object or an instance of Cell. The object can use either:
|
|
335
|
-
* - `outPoint`: For referencing a cell output
|
|
336
|
-
* - `previousOutput`: For referencing a cell input (alternative name for outPoint)
|
|
337
|
-
* The cellOutput can omit capacity for automatic calculation.
|
|
338
|
-
* @returns A Cell instance.
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
341
|
-
* ```typescript
|
|
342
|
-
* // Using outPoint with explicit capacity
|
|
343
|
-
* const cell1 = Cell.from({
|
|
344
|
-
* outPoint: { txHash: "0x...", index: 0 },
|
|
345
|
-
* cellOutput: {
|
|
346
|
-
* capacity: 1000n,
|
|
347
|
-
* lock: { codeHash: "0x...", hashType: "type", args: "0x..." }
|
|
348
|
-
* },
|
|
349
|
-
* outputData: "0x"
|
|
350
|
-
* });
|
|
351
|
-
*
|
|
352
|
-
* // Using previousOutput with automatic capacity calculation
|
|
353
|
-
* const cell2 = Cell.from({
|
|
354
|
-
* previousOutput: { txHash: "0x...", index: 0 },
|
|
355
|
-
* cellOutput: {
|
|
356
|
-
* lock: { codeHash: "0x...", hashType: "type", args: "0x..." }
|
|
357
|
-
* // capacity will be calculated automatically
|
|
358
|
-
* },
|
|
359
|
-
* outputData: "0x1234"
|
|
360
|
-
* });
|
|
361
|
-
* ```
|
|
362
|
-
*/
|
|
363
|
-
static from(cell: CellLike): Cell;
|
|
364
|
-
/**
|
|
365
|
-
* Gets confirmed Nervos DAO profit of a Cell
|
|
366
|
-
* It returns non-zero value only when the cell is in withdrawal phase 2
|
|
367
|
-
* See https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0023-dao-deposit-withdraw/0023-dao-deposit-withdraw.md
|
|
368
|
-
*
|
|
369
|
-
* @param client - A client for searching DAO related headers
|
|
370
|
-
* @returns Profit
|
|
371
|
-
*
|
|
372
|
-
* @example
|
|
373
|
-
* ```typescript
|
|
374
|
-
* const profit = await cell.getDaoProfit(client);
|
|
375
|
-
* ```
|
|
376
|
-
*/
|
|
377
|
-
getDaoProfit(client: Client): Promise<Num>;
|
|
378
|
-
/**
|
|
379
|
-
* Retrieves detailed information about a Nervos DAO cell, including its deposit and withdrawal headers.
|
|
380
|
-
*
|
|
381
|
-
* @param client - A CKB client instance to fetch cell and header data.
|
|
382
|
-
* @returns A promise that resolves to an object containing header information.
|
|
383
|
-
* - If not a DAO cell, returns `{}`.
|
|
384
|
-
* - If a deposited DAO cell, returns `{ depositHeader }`.
|
|
385
|
-
* - If a withdrawn DAO cell, returns `{ depositHeader, withdrawHeader }`.
|
|
386
|
-
*
|
|
387
|
-
* @throws If the cell is a DAO cell but its corresponding headers cannot be fetched.
|
|
388
|
-
*
|
|
389
|
-
* @example
|
|
390
|
-
* ```typescript
|
|
391
|
-
* const daoInfo = await cell.getNervosDaoInfo(client);
|
|
392
|
-
* ```
|
|
393
|
-
*/
|
|
394
|
-
getNervosDaoInfo(client: Client): Promise<{
|
|
395
|
-
depositHeader?: undefined;
|
|
396
|
-
withdrawHeader?: undefined;
|
|
397
|
-
} | {
|
|
398
|
-
depositHeader: ClientBlockHeader;
|
|
399
|
-
withdrawHeader?: undefined;
|
|
400
|
-
} | {
|
|
401
|
-
depositHeader: ClientBlockHeader;
|
|
402
|
-
withdrawHeader: ClientBlockHeader;
|
|
403
|
-
}>;
|
|
404
|
-
/**
|
|
405
|
-
* Clone a Cell
|
|
406
|
-
*
|
|
407
|
-
* @returns A cloned Cell instance.
|
|
408
|
-
*
|
|
409
|
-
* @example
|
|
410
|
-
* ```typescript
|
|
411
|
-
* const cell1 = cell0.clone();
|
|
412
|
-
* ```
|
|
413
|
-
*/
|
|
414
|
-
clone(): Cell;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* @public
|
|
418
|
-
*/
|
|
419
|
-
export type EpochLike = [NumLike, NumLike, NumLike];
|
|
420
|
-
/**
|
|
421
|
-
* @public
|
|
422
|
-
*/
|
|
423
|
-
export type Epoch = [Num, Num, Num];
|
|
424
|
-
/**
|
|
425
|
-
* @public
|
|
426
|
-
*/
|
|
427
|
-
export declare function epochFrom(epochLike: EpochLike): Epoch;
|
|
428
|
-
/**
|
|
429
|
-
* @public
|
|
430
|
-
*/
|
|
431
|
-
export declare function epochFromHex(hex: HexLike): Epoch;
|
|
432
|
-
/**
|
|
433
|
-
* @public
|
|
434
|
-
*/
|
|
435
|
-
export declare function epochToHex(epochLike: EpochLike): Hex;
|
|
436
|
-
/**
|
|
437
|
-
* @public
|
|
438
|
-
*/
|
|
439
|
-
export type SinceLike = {
|
|
440
|
-
relative: "absolute" | "relative";
|
|
441
|
-
metric: "blockNumber" | "epoch" | "timestamp";
|
|
442
|
-
value: NumLike;
|
|
443
|
-
} | NumLike;
|
|
444
|
-
declare const Since_base: (abstract new () => {
|
|
445
|
-
toBytes(): Bytes;
|
|
446
|
-
clone(): Since;
|
|
447
|
-
eq(other: SinceLike): boolean;
|
|
448
|
-
hash(): Hex;
|
|
449
|
-
}) & {
|
|
450
|
-
byteLength?: number;
|
|
451
|
-
encode(_: SinceLike): Bytes;
|
|
452
|
-
decode(_: BytesLike): Since;
|
|
453
|
-
fromBytes(_bytes: BytesLike): Since;
|
|
454
|
-
from(_: SinceLike): Since;
|
|
455
|
-
};
|
|
456
|
-
/**
|
|
457
|
-
* @public
|
|
458
|
-
*/
|
|
459
|
-
export declare class Since extends Since_base {
|
|
460
|
-
relative: "absolute" | "relative";
|
|
461
|
-
metric: "blockNumber" | "epoch" | "timestamp";
|
|
462
|
-
value: Num;
|
|
463
|
-
/**
|
|
464
|
-
* Creates an instance of Since.
|
|
465
|
-
*
|
|
466
|
-
* @param relative - Absolute or relative
|
|
467
|
-
* @param metric - The metric of since
|
|
468
|
-
* @param value - The value of since
|
|
469
|
-
*/
|
|
470
|
-
constructor(relative: "absolute" | "relative", metric: "blockNumber" | "epoch" | "timestamp", value: Num);
|
|
471
|
-
/**
|
|
472
|
-
* Clone a Since.
|
|
473
|
-
*
|
|
474
|
-
* @returns A cloned Since instance.
|
|
475
|
-
*
|
|
476
|
-
* @example
|
|
477
|
-
* ```typescript
|
|
478
|
-
* const since1 = since0.clone();
|
|
479
|
-
* ```
|
|
480
|
-
*/
|
|
481
|
-
clone(): Since;
|
|
482
|
-
/**
|
|
483
|
-
* Creates a Since instance from a SinceLike object.
|
|
484
|
-
*
|
|
485
|
-
* @param since - A SinceLike object or an instance of Since.
|
|
486
|
-
* @returns A Since instance.
|
|
487
|
-
*
|
|
488
|
-
* @example
|
|
489
|
-
* ```typescript
|
|
490
|
-
* const since = Since.from("0x1234567812345678");
|
|
491
|
-
* ```
|
|
492
|
-
*/
|
|
493
|
-
static from(since: SinceLike): Since;
|
|
494
|
-
/**
|
|
495
|
-
* Converts the Since instance to num.
|
|
496
|
-
*
|
|
497
|
-
* @returns A num
|
|
498
|
-
*
|
|
499
|
-
* @example
|
|
500
|
-
* ```typescript
|
|
501
|
-
* const num = since.toNum();
|
|
502
|
-
* ```
|
|
503
|
-
*/
|
|
504
|
-
toNum(): Num;
|
|
505
|
-
/**
|
|
506
|
-
* Creates a Since instance from a num-like value.
|
|
507
|
-
*
|
|
508
|
-
* @param numLike - The num-like value to convert.
|
|
509
|
-
* @returns A Since instance.
|
|
510
|
-
*
|
|
511
|
-
* @example
|
|
512
|
-
* ```typescript
|
|
513
|
-
* const since = Since.fromNum("0x0");
|
|
514
|
-
* ```
|
|
515
|
-
*/
|
|
516
|
-
static fromNum(numLike: NumLike): Since;
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* @public
|
|
520
|
-
*/
|
|
521
|
-
export type CellInputLike = ({
|
|
522
|
-
previousOutput: OutPointLike;
|
|
523
|
-
} | {
|
|
524
|
-
outPoint: OutPointLike;
|
|
525
|
-
}) & {
|
|
526
|
-
since?: SinceLike | NumLike | null;
|
|
527
|
-
cellOutput?: CellOutputLike | null;
|
|
528
|
-
outputData?: HexLike | null;
|
|
529
|
-
};
|
|
530
|
-
declare const CellInput_base: (abstract new () => {
|
|
531
|
-
toBytes(): Bytes;
|
|
532
|
-
clone(): CellInput;
|
|
533
|
-
eq(other: CellInputLike): boolean;
|
|
534
|
-
hash(): Hex;
|
|
535
|
-
}) & {
|
|
536
|
-
byteLength?: number;
|
|
537
|
-
encode(_: CellInputLike): Bytes;
|
|
538
|
-
decode(_: BytesLike): CellInput;
|
|
539
|
-
fromBytes(_bytes: BytesLike): CellInput;
|
|
540
|
-
from(_: CellInputLike): CellInput;
|
|
541
|
-
};
|
|
542
|
-
/**
|
|
543
|
-
* @public
|
|
544
|
-
*/
|
|
545
|
-
export declare class CellInput extends CellInput_base {
|
|
546
|
-
previousOutput: OutPoint;
|
|
547
|
-
since: Num;
|
|
548
|
-
cellOutput?: CellOutput | undefined;
|
|
549
|
-
outputData?: Hex | undefined;
|
|
550
|
-
/**
|
|
551
|
-
* Creates an instance of CellInput.
|
|
552
|
-
*
|
|
553
|
-
* @param previousOutput - The previous outpoint of the cell.
|
|
554
|
-
* @param since - The since value of the cell input.
|
|
555
|
-
* @param cellOutput - The optional cell output associated with the cell input.
|
|
556
|
-
* @param outputData - The optional output data associated with the cell input.
|
|
557
|
-
*/
|
|
558
|
-
constructor(previousOutput: OutPoint, since: Num, cellOutput?: CellOutput | undefined, outputData?: Hex | undefined);
|
|
559
|
-
/**
|
|
560
|
-
* Creates a CellInput instance from a CellInputLike object.
|
|
561
|
-
*
|
|
562
|
-
* @param cellInput - A CellInputLike object or an instance of CellInput.
|
|
563
|
-
* @returns A CellInput instance.
|
|
564
|
-
*
|
|
565
|
-
* @example
|
|
566
|
-
* ```typescript
|
|
567
|
-
* const cellInput = CellInput.from({
|
|
568
|
-
* previousOutput: { txHash: "0x...", index: 0 },
|
|
569
|
-
* since: 0n
|
|
570
|
-
* });
|
|
571
|
-
* ```
|
|
572
|
-
*/
|
|
573
|
-
static from(cellInput: CellInputLike): CellInput;
|
|
574
|
-
getCell(client: Client): Promise<Cell>;
|
|
575
|
-
/**
|
|
576
|
-
* Complete extra infos in the input. Including
|
|
577
|
-
* - Previous cell output
|
|
578
|
-
* - Previous cell data
|
|
579
|
-
* The instance will be modified.
|
|
580
|
-
*
|
|
581
|
-
* @returns true if succeed.
|
|
582
|
-
* @example
|
|
583
|
-
* ```typescript
|
|
584
|
-
* await cellInput.completeExtraInfos(client);
|
|
585
|
-
* ```
|
|
586
|
-
*/
|
|
587
|
-
completeExtraInfos(client: Client): Promise<void>;
|
|
588
|
-
/**
|
|
589
|
-
* The extra capacity created when consume this input.
|
|
590
|
-
* This is usually NervosDAO interest, see https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0023-dao-deposit-withdraw/0023-dao-deposit-withdraw.md.
|
|
591
|
-
* And it can also be miners' income. (But this is not implemented yet)
|
|
592
|
-
*/
|
|
593
|
-
getExtraCapacity(client: Client): Promise<Num>;
|
|
594
|
-
/**
|
|
595
|
-
* Clone a CellInput.
|
|
596
|
-
*
|
|
597
|
-
* @returns A cloned CellInput instance.
|
|
598
|
-
*
|
|
599
|
-
* @example
|
|
600
|
-
* ```typescript
|
|
601
|
-
* const cellInput1 = cellInput0.clone();
|
|
602
|
-
* ```
|
|
603
|
-
*/
|
|
604
|
-
clone(): CellInput;
|
|
605
|
-
}
|
|
606
|
-
export declare const CellInputVec: mol.Codec<CellInputLike[], CellInput[]>;
|
|
607
|
-
/**
|
|
608
|
-
* @public
|
|
609
|
-
*/
|
|
610
|
-
export type CellDepLike = {
|
|
611
|
-
outPoint: OutPointLike;
|
|
612
|
-
depType: DepTypeLike;
|
|
613
|
-
};
|
|
614
|
-
declare const CellDep_base: (abstract new () => {
|
|
615
|
-
toBytes(): Bytes;
|
|
616
|
-
clone(): CellDep;
|
|
617
|
-
eq(other: CellDepLike): boolean;
|
|
618
|
-
hash(): Hex;
|
|
619
|
-
}) & {
|
|
620
|
-
byteLength?: number;
|
|
621
|
-
encode(_: CellDepLike): Bytes;
|
|
622
|
-
decode(_: BytesLike): CellDep;
|
|
623
|
-
fromBytes(_bytes: BytesLike): CellDep;
|
|
624
|
-
from(_: CellDepLike): CellDep;
|
|
625
|
-
};
|
|
626
|
-
/**
|
|
627
|
-
* @public
|
|
628
|
-
*/
|
|
629
|
-
export declare class CellDep extends CellDep_base {
|
|
630
|
-
outPoint: OutPoint;
|
|
631
|
-
depType: DepType;
|
|
632
|
-
/**
|
|
633
|
-
* Creates an instance of CellDep.
|
|
634
|
-
*
|
|
635
|
-
* @param outPoint - The outpoint of the cell dependency.
|
|
636
|
-
* @param depType - The dependency type.
|
|
637
|
-
*/
|
|
638
|
-
constructor(outPoint: OutPoint, depType: DepType);
|
|
639
|
-
/**
|
|
640
|
-
* Creates a CellDep instance from a CellDepLike object.
|
|
641
|
-
*
|
|
642
|
-
* @param cellDep - A CellDepLike object or an instance of CellDep.
|
|
643
|
-
* @returns A CellDep instance.
|
|
644
|
-
*
|
|
645
|
-
* @example
|
|
646
|
-
* ```typescript
|
|
647
|
-
* const cellDep = CellDep.from({
|
|
648
|
-
* outPoint: { txHash: "0x...", index: 0 },
|
|
649
|
-
* depType: "depGroup"
|
|
650
|
-
* });
|
|
651
|
-
* ```
|
|
652
|
-
*/
|
|
653
|
-
static from(cellDep: CellDepLike): CellDep;
|
|
654
|
-
/**
|
|
655
|
-
* Clone a CellDep.
|
|
656
|
-
*
|
|
657
|
-
* @returns A cloned CellDep instance.
|
|
658
|
-
*
|
|
659
|
-
* @example
|
|
660
|
-
* ```typescript
|
|
661
|
-
* const cellDep1 = cellDep0.clone();
|
|
662
|
-
* ```
|
|
663
|
-
*/
|
|
664
|
-
clone(): CellDep;
|
|
665
|
-
}
|
|
666
|
-
export declare const CellDepVec: mol.Codec<CellDepLike[], CellDep[]>;
|
|
667
|
-
/**
|
|
668
|
-
* @public
|
|
669
|
-
*/
|
|
670
|
-
export type WitnessArgsLike = {
|
|
671
|
-
lock?: HexLike | null;
|
|
672
|
-
inputType?: HexLike | null;
|
|
673
|
-
outputType?: HexLike | null;
|
|
674
|
-
};
|
|
675
|
-
declare const WitnessArgs_base: (abstract new () => {
|
|
676
|
-
toBytes(): Bytes;
|
|
677
|
-
clone(): WitnessArgs;
|
|
678
|
-
eq(other: WitnessArgsLike): boolean;
|
|
679
|
-
hash(): Hex;
|
|
680
|
-
}) & {
|
|
681
|
-
byteLength?: number;
|
|
682
|
-
encode(_: WitnessArgsLike): Bytes;
|
|
683
|
-
decode(_: BytesLike): WitnessArgs;
|
|
684
|
-
fromBytes(_bytes: BytesLike): WitnessArgs;
|
|
685
|
-
from(_: WitnessArgsLike): WitnessArgs;
|
|
686
|
-
};
|
|
687
|
-
/**
|
|
688
|
-
* @public
|
|
689
|
-
*/
|
|
690
|
-
export declare class WitnessArgs extends WitnessArgs_base {
|
|
691
|
-
lock?: Hex | undefined;
|
|
692
|
-
inputType?: Hex | undefined;
|
|
693
|
-
outputType?: Hex | undefined;
|
|
694
|
-
/**
|
|
695
|
-
* Creates an instance of WitnessArgs.
|
|
696
|
-
*
|
|
697
|
-
* @param lock - The optional lock field of the witness.
|
|
698
|
-
* @param inputType - The optional input type field of the witness.
|
|
699
|
-
* @param outputType - The optional output type field of the witness.
|
|
700
|
-
*/
|
|
701
|
-
constructor(lock?: Hex | undefined, inputType?: Hex | undefined, outputType?: Hex | undefined);
|
|
702
|
-
/**
|
|
703
|
-
* Creates a WitnessArgs instance from a WitnessArgsLike object.
|
|
704
|
-
*
|
|
705
|
-
* @param witnessArgs - A WitnessArgsLike object or an instance of WitnessArgs.
|
|
706
|
-
* @returns A WitnessArgs instance.
|
|
707
|
-
*
|
|
708
|
-
* @example
|
|
709
|
-
* ```typescript
|
|
710
|
-
* const witnessArgs = WitnessArgs.from({
|
|
711
|
-
* lock: "0x...",
|
|
712
|
-
* inputType: "0x...",
|
|
713
|
-
* outputType: "0x..."
|
|
714
|
-
* });
|
|
715
|
-
* ```
|
|
716
|
-
*/
|
|
717
|
-
static from(witnessArgs: WitnessArgsLike): WitnessArgs;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Convert a bytes to a num.
|
|
721
|
-
*
|
|
722
|
-
* @public
|
|
723
|
-
*/
|
|
724
|
-
export declare function udtBalanceFrom(dataLike: BytesLike): Num;
|
|
725
|
-
export declare const RawTransaction: mol.Codec<mol.EncodableRecord<{
|
|
726
|
-
version: mol.Codec<NumLike, number>;
|
|
727
|
-
cellDeps: mol.Codec<CellDepLike[], CellDep[]>;
|
|
728
|
-
headerDeps: mol.Codec<BytesLike[], `0x${string}`[]>;
|
|
729
|
-
inputs: mol.Codec<CellInputLike[], CellInput[]>;
|
|
730
|
-
outputs: mol.Codec<CellOutputLike[], CellOutput[]>;
|
|
731
|
-
outputsData: mol.Codec<BytesLike[], `0x${string}`[]>;
|
|
732
|
-
}>, mol.DecodedRecord<{
|
|
733
|
-
version: mol.Codec<NumLike, number>;
|
|
734
|
-
cellDeps: mol.Codec<CellDepLike[], CellDep[]>;
|
|
735
|
-
headerDeps: mol.Codec<BytesLike[], `0x${string}`[]>;
|
|
736
|
-
inputs: mol.Codec<CellInputLike[], CellInput[]>;
|
|
737
|
-
outputs: mol.Codec<CellOutputLike[], CellOutput[]>;
|
|
738
|
-
outputsData: mol.Codec<BytesLike[], `0x${string}`[]>;
|
|
739
|
-
}>>;
|
|
740
|
-
/**
|
|
741
|
-
* @public
|
|
742
|
-
*/
|
|
743
|
-
export type TransactionLike = {
|
|
744
|
-
version?: NumLike | null;
|
|
745
|
-
cellDeps?: CellDepLike[] | null;
|
|
746
|
-
headerDeps?: HexLike[] | null;
|
|
747
|
-
inputs?: CellInputLike[] | null;
|
|
748
|
-
outputs?: (Omit<CellOutputLike, "capacity"> & Partial<Pick<CellOutputLike, "capacity">>)[] | null;
|
|
749
|
-
outputsData?: HexLike[] | null;
|
|
750
|
-
witnesses?: HexLike[] | null;
|
|
751
|
-
};
|
|
752
|
-
declare const Transaction_base: (abstract new () => {
|
|
753
|
-
toBytes(): Bytes;
|
|
754
|
-
clone(): Transaction;
|
|
755
|
-
eq(other: TransactionLike): boolean;
|
|
756
|
-
hash(): Hex;
|
|
757
|
-
}) & {
|
|
758
|
-
byteLength?: number;
|
|
759
|
-
encode(_: TransactionLike): Bytes;
|
|
760
|
-
decode(_: BytesLike): Transaction;
|
|
761
|
-
fromBytes(_bytes: BytesLike): Transaction;
|
|
762
|
-
from(_: TransactionLike): Transaction;
|
|
763
|
-
};
|
|
764
|
-
/**
|
|
765
|
-
* @public
|
|
766
|
-
*/
|
|
767
|
-
export declare class Transaction extends Transaction_base {
|
|
768
|
-
version: Num;
|
|
769
|
-
cellDeps: CellDep[];
|
|
770
|
-
headerDeps: Hex[];
|
|
771
|
-
inputs: CellInput[];
|
|
772
|
-
outputs: CellOutput[];
|
|
773
|
-
outputsData: Hex[];
|
|
774
|
-
witnesses: Hex[];
|
|
775
|
-
/**
|
|
776
|
-
* Creates an instance of Transaction.
|
|
777
|
-
*
|
|
778
|
-
* @param version - The version of the transaction.
|
|
779
|
-
* @param cellDeps - The cell dependencies of the transaction.
|
|
780
|
-
* @param headerDeps - The header dependencies of the transaction.
|
|
781
|
-
* @param inputs - The inputs of the transaction.
|
|
782
|
-
* @param outputs - The outputs of the transaction.
|
|
783
|
-
* @param outputsData - The data associated with the outputs.
|
|
784
|
-
* @param witnesses - The witnesses of the transaction.
|
|
785
|
-
*/
|
|
786
|
-
constructor(version: Num, cellDeps: CellDep[], headerDeps: Hex[], inputs: CellInput[], outputs: CellOutput[], outputsData: Hex[], witnesses: Hex[]);
|
|
787
|
-
/**
|
|
788
|
-
* Creates a default Transaction instance with empty fields.
|
|
789
|
-
*
|
|
790
|
-
* @returns A default Transaction instance.
|
|
791
|
-
*
|
|
792
|
-
* @example
|
|
793
|
-
* ```typescript
|
|
794
|
-
* const defaultTx = Transaction.default();
|
|
795
|
-
* ```
|
|
796
|
-
*/
|
|
797
|
-
static default(): Transaction;
|
|
798
|
-
/**
|
|
799
|
-
* Copy every properties from another transaction.
|
|
800
|
-
* This method replaces all properties of the current transaction with those from the provided transaction.
|
|
801
|
-
*
|
|
802
|
-
* @param txLike - The transaction-like object to copy properties from.
|
|
803
|
-
*
|
|
804
|
-
* @example
|
|
805
|
-
* ```typescript
|
|
806
|
-
* this.copy(Transaction.default());
|
|
807
|
-
* ```
|
|
808
|
-
*/
|
|
809
|
-
copy(txLike: TransactionLike): void;
|
|
810
|
-
/**
|
|
811
|
-
* Creates a deep copy of the transaction.
|
|
812
|
-
* This method creates a new Transaction instance with all nested objects cloned,
|
|
813
|
-
* ensuring that modifications to the cloned transaction do not affect the original.
|
|
814
|
-
*
|
|
815
|
-
* @returns A new Transaction instance that is a deep copy of the current transaction.
|
|
816
|
-
*
|
|
817
|
-
* @example
|
|
818
|
-
* ```typescript
|
|
819
|
-
* const originalTx = Transaction.from({
|
|
820
|
-
* version: 0,
|
|
821
|
-
* inputs: [{ previousOutput: { txHash: "0x...", index: 0 } }],
|
|
822
|
-
* outputs: [{ capacity: 1000n, lock: lockScript }],
|
|
823
|
-
* outputsData: ["0x"],
|
|
824
|
-
* witnesses: ["0x"]
|
|
825
|
-
* });
|
|
826
|
-
*
|
|
827
|
-
* const clonedTx = originalTx.clone();
|
|
828
|
-
*
|
|
829
|
-
* // Modifications to clonedTx won't affect originalTx
|
|
830
|
-
* clonedTx.addOutput({ capacity: 2000n, lock: anotherLockScript });
|
|
831
|
-
* console.log(originalTx.outputs.length); // Still 1
|
|
832
|
-
* console.log(clonedTx.outputs.length); // Now 2
|
|
833
|
-
* ```
|
|
834
|
-
*
|
|
835
|
-
* @remarks
|
|
836
|
-
* The clone operation performs deep copying for:
|
|
837
|
-
* - Cell dependencies (cellDeps) - each CellDep is cloned
|
|
838
|
-
* - Inputs - each CellInput is cloned
|
|
839
|
-
* - Outputs - each CellOutput is cloned
|
|
840
|
-
*
|
|
841
|
-
* The following are shallow copied (references to immutable data):
|
|
842
|
-
* - Header dependencies (headerDeps) - Hex strings are immutable
|
|
843
|
-
* - Output data (outputsData) - Hex strings are immutable
|
|
844
|
-
* - Witnesses - Hex strings are immutable
|
|
845
|
-
* - Version - bigint is immutable
|
|
846
|
-
*/
|
|
847
|
-
clone(): Transaction;
|
|
848
|
-
/**
|
|
849
|
-
* Creates a Transaction instance from a TransactionLike object.
|
|
850
|
-
*
|
|
851
|
-
* @param tx - A TransactionLike object or an instance of Transaction.
|
|
852
|
-
* @returns A Transaction instance.
|
|
853
|
-
*
|
|
854
|
-
* @example
|
|
855
|
-
* ```typescript
|
|
856
|
-
* const transaction = Transaction.from({
|
|
857
|
-
* version: 0,
|
|
858
|
-
* cellDeps: [],
|
|
859
|
-
* headerDeps: [],
|
|
860
|
-
* inputs: [],
|
|
861
|
-
* outputs: [],
|
|
862
|
-
* outputsData: [],
|
|
863
|
-
* witnesses: []
|
|
864
|
-
* });
|
|
865
|
-
* ```
|
|
866
|
-
*/
|
|
867
|
-
static from(tx: TransactionLike): Transaction;
|
|
868
|
-
/**
|
|
869
|
-
* Creates a Transaction instance from a Lumos skeleton.
|
|
870
|
-
*
|
|
871
|
-
* @param skeleton - The Lumos transaction skeleton.
|
|
872
|
-
* @returns A Transaction instance.
|
|
873
|
-
*
|
|
874
|
-
* @throws Will throw an error if an input's outPoint is missing.
|
|
875
|
-
*
|
|
876
|
-
* @example
|
|
877
|
-
* ```typescript
|
|
878
|
-
* const transaction = Transaction.fromLumosSkeleton(skeleton);
|
|
879
|
-
* ```
|
|
880
|
-
*/
|
|
881
|
-
static fromLumosSkeleton(skeleton: LumosTransactionSkeletonType): Transaction;
|
|
882
|
-
/**
|
|
883
|
-
* @deprecated
|
|
884
|
-
* Use ccc.stringify instead.
|
|
885
|
-
* stringify the tx to JSON string.
|
|
886
|
-
*/
|
|
887
|
-
stringify(): string;
|
|
888
|
-
/**
|
|
889
|
-
* Converts the raw transaction data to bytes.
|
|
890
|
-
*
|
|
891
|
-
* @returns A Uint8Array containing the raw transaction bytes.
|
|
892
|
-
*
|
|
893
|
-
* @example
|
|
894
|
-
* ```typescript
|
|
895
|
-
* const rawTxBytes = transaction.rawToBytes();
|
|
896
|
-
* ```
|
|
897
|
-
*/
|
|
898
|
-
rawToBytes(): Bytes;
|
|
899
|
-
/**
|
|
900
|
-
* Calculates the hash of the transaction without witnesses. This is the transaction hash in the usual sense.
|
|
901
|
-
* To calculate the hash of the whole transaction including the witnesses, use transaction.hashFull() instead.
|
|
902
|
-
*
|
|
903
|
-
* @returns The hash of the transaction.
|
|
904
|
-
*
|
|
905
|
-
* @example
|
|
906
|
-
* ```typescript
|
|
907
|
-
* const txHash = transaction.hash();
|
|
908
|
-
* ```
|
|
909
|
-
*/
|
|
910
|
-
hash(): Hex;
|
|
911
|
-
/**
|
|
912
|
-
* Calculates the hash of the transaction with witnesses.
|
|
913
|
-
*
|
|
914
|
-
* @returns The hash of the transaction with witnesses.
|
|
915
|
-
*
|
|
916
|
-
* @example
|
|
917
|
-
* ```typescript
|
|
918
|
-
* const txFullHash = transaction.hashFull();
|
|
919
|
-
* ```
|
|
920
|
-
*/
|
|
921
|
-
hashFull(): Hex;
|
|
922
|
-
/**
|
|
923
|
-
* Hashes a witness and updates the hasher.
|
|
924
|
-
*
|
|
925
|
-
* @param witness - The witness to hash.
|
|
926
|
-
* @param hasher - The hasher instance to update.
|
|
927
|
-
*
|
|
928
|
-
* @example
|
|
929
|
-
* ```typescript
|
|
930
|
-
* Transaction.hashWitnessToHasher("0x...", hasher);
|
|
931
|
-
* ```
|
|
932
|
-
*/
|
|
933
|
-
static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
|
|
934
|
-
/**
|
|
935
|
-
* Computes the signing hash information for a given script.
|
|
936
|
-
*
|
|
937
|
-
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
938
|
-
* @param client - The client for complete extra infos in the transaction.
|
|
939
|
-
* @returns A promise that resolves to an object containing the signing message and the witness position,
|
|
940
|
-
* or undefined if no matching input is found.
|
|
941
|
-
*
|
|
942
|
-
* @example
|
|
943
|
-
* ```typescript
|
|
944
|
-
* const signHashInfo = await tx.getSignHashInfo(scriptLike, client);
|
|
945
|
-
* if (signHashInfo) {
|
|
946
|
-
* console.log(signHashInfo.message); // Outputs the signing message
|
|
947
|
-
* console.log(signHashInfo.position); // Outputs the witness position
|
|
948
|
-
* }
|
|
949
|
-
* ```
|
|
950
|
-
*/
|
|
951
|
-
getSignHashInfo(scriptLike: ScriptLike, client: Client, hasher?: Hasher): Promise<{
|
|
952
|
-
message: Hex;
|
|
953
|
-
position: number;
|
|
954
|
-
} | undefined>;
|
|
955
|
-
/**
|
|
956
|
-
* Find the first occurrence of a input with the specified lock id
|
|
957
|
-
*
|
|
958
|
-
* @param scriptIdLike - The script associated with the transaction, represented as a ScriptLike object without args.
|
|
959
|
-
* @param client - The client for complete extra infos in the transaction.
|
|
960
|
-
* @returns A promise that resolves to the found index
|
|
961
|
-
*
|
|
962
|
-
* @example
|
|
963
|
-
* ```typescript
|
|
964
|
-
* const index = await tx.findInputIndexByLockId(scriptIdLike, client);
|
|
965
|
-
* ```
|
|
966
|
-
*/
|
|
967
|
-
findInputIndexByLockId(scriptIdLike: Pick<ScriptLike, "codeHash" | "hashType">, client: Client): Promise<number | undefined>;
|
|
968
|
-
/**
|
|
969
|
-
* Find the first occurrence of a input with the specified lock
|
|
970
|
-
*
|
|
971
|
-
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
972
|
-
* @param client - The client for complete extra infos in the transaction.
|
|
973
|
-
* @returns A promise that resolves to the found index, or undefined if no matching input is found.
|
|
974
|
-
*
|
|
975
|
-
* @example
|
|
976
|
-
* ```typescript
|
|
977
|
-
* const index = await tx.findInputIndexByLock(scriptLike, client);
|
|
978
|
-
* ```
|
|
979
|
-
*/
|
|
980
|
-
findInputIndexByLock(scriptLike: ScriptLike, client: Client): Promise<number | undefined>;
|
|
981
|
-
/**
|
|
982
|
-
* Find the last occurrence of a input with the specified lock
|
|
983
|
-
*
|
|
984
|
-
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
985
|
-
* @param client - The client for complete extra infos in the transaction.
|
|
986
|
-
* @returns A promise that resolves to the found index, or undefined if no matching input is found.
|
|
987
|
-
*
|
|
988
|
-
* @example
|
|
989
|
-
* ```typescript
|
|
990
|
-
* const index = await tx.findLastInputIndexByLock(scriptLike, client);
|
|
991
|
-
* ```
|
|
992
|
-
*/
|
|
993
|
-
findLastInputIndexByLock(scriptLike: ScriptLike, client: Client): Promise<number | undefined>;
|
|
994
|
-
/**
|
|
995
|
-
* Add cell deps if they are not existed
|
|
996
|
-
*
|
|
997
|
-
* @param cellDepLikes - The cell deps to add
|
|
998
|
-
*
|
|
999
|
-
* @example
|
|
1000
|
-
* ```typescript
|
|
1001
|
-
* tx.addCellDeps(cellDep);
|
|
1002
|
-
* ```
|
|
1003
|
-
*/
|
|
1004
|
-
addCellDeps(...cellDepLikes: (CellDepLike | CellDepLike[])[]): void;
|
|
1005
|
-
/**
|
|
1006
|
-
* Add cell deps at the start if they are not existed
|
|
1007
|
-
*
|
|
1008
|
-
* @param cellDepLikes - The cell deps to add
|
|
1009
|
-
*
|
|
1010
|
-
* @example
|
|
1011
|
-
* ```typescript
|
|
1012
|
-
* tx.addCellDepsAtBegin(cellDep);
|
|
1013
|
-
* ```
|
|
1014
|
-
*/
|
|
1015
|
-
addCellDepsAtStart(...cellDepLikes: (CellDepLike | CellDepLike[])[]): void;
|
|
1016
|
-
/**
|
|
1017
|
-
* Add cell dep from infos if they are not existed
|
|
1018
|
-
*
|
|
1019
|
-
* @param client - A client for searching cell deps
|
|
1020
|
-
* @param cellDepInfoLikes - The cell dep infos to add
|
|
1021
|
-
*
|
|
1022
|
-
* @example
|
|
1023
|
-
* ```typescript
|
|
1024
|
-
* tx.addCellDepInfos(client, cellDepInfos);
|
|
1025
|
-
* ```
|
|
1026
|
-
*/
|
|
1027
|
-
addCellDepInfos(client: Client, ...cellDepInfoLikes: (CellDepInfoLike | CellDepInfoLike[])[]): Promise<void>;
|
|
1028
|
-
/**
|
|
1029
|
-
* Add cell deps from known script
|
|
1030
|
-
*
|
|
1031
|
-
* @param client - The client for searching known script and cell deps
|
|
1032
|
-
* @param scripts - The known scripts to add
|
|
1033
|
-
*
|
|
1034
|
-
* @example
|
|
1035
|
-
* ```typescript
|
|
1036
|
-
* tx.addCellDepsOfKnownScripts(client, KnownScript.OmniLock);
|
|
1037
|
-
* ```
|
|
1038
|
-
*/
|
|
1039
|
-
addCellDepsOfKnownScripts(client: Client, ...scripts: (KnownScript | KnownScript[])[]): Promise<void>;
|
|
1040
|
-
/**
|
|
1041
|
-
* Set output data at index.
|
|
1042
|
-
*
|
|
1043
|
-
* @param index - The index of the output data.
|
|
1044
|
-
* @param data - The data to set.
|
|
1045
|
-
*
|
|
1046
|
-
* @example
|
|
1047
|
-
* ```typescript
|
|
1048
|
-
* tx.setOutputDataAt(0, "0x00");
|
|
1049
|
-
* ```
|
|
1050
|
-
*/
|
|
1051
|
-
setOutputDataAt(index: number, data: HexLike): void;
|
|
1052
|
-
/**
|
|
1053
|
-
* get input
|
|
1054
|
-
*
|
|
1055
|
-
* @param index - The cell input index
|
|
1056
|
-
*
|
|
1057
|
-
* @example
|
|
1058
|
-
* ```typescript
|
|
1059
|
-
* await tx.getInput(0);
|
|
1060
|
-
* ```
|
|
1061
|
-
*/
|
|
1062
|
-
getInput(index: NumLike): CellInput | undefined;
|
|
1063
|
-
/**
|
|
1064
|
-
* add input
|
|
1065
|
-
*
|
|
1066
|
-
* @param inputLike - The cell input.
|
|
1067
|
-
*
|
|
1068
|
-
* @example
|
|
1069
|
-
* ```typescript
|
|
1070
|
-
* await tx.addInput({ });
|
|
1071
|
-
* ```
|
|
1072
|
-
*/
|
|
1073
|
-
addInput(inputLike: CellInputLike): number;
|
|
1074
|
-
/**
|
|
1075
|
-
* get output
|
|
1076
|
-
*
|
|
1077
|
-
* @param index - The cell output index
|
|
1078
|
-
*
|
|
1079
|
-
* @example
|
|
1080
|
-
* ```typescript
|
|
1081
|
-
* await tx.getOutput(0);
|
|
1082
|
-
* ```
|
|
1083
|
-
*/
|
|
1084
|
-
getOutput(index: NumLike): CellAny | undefined;
|
|
1085
|
-
/**
|
|
1086
|
-
* Provides an iterable over the transaction's output cells.
|
|
1087
|
-
*
|
|
1088
|
-
* This getter is a convenient way to iterate through all the output cells (`CellAny`)
|
|
1089
|
-
* of the transaction, combining the `outputs` and `outputsData` arrays.
|
|
1090
|
-
* It can be used with `for...of` loops or other iterable-consuming patterns.
|
|
1091
|
-
*
|
|
1092
|
-
* @public
|
|
1093
|
-
* @category Getter
|
|
1094
|
-
* @returns An `Iterable<CellAny>` that yields each output cell of the transaction.
|
|
1095
|
-
*
|
|
1096
|
-
* @example
|
|
1097
|
-
* ```typescript
|
|
1098
|
-
* for (const cell of tx.outputCells) {
|
|
1099
|
-
* console.log(`Output cell capacity: ${cell.cellOutput.capacity}`);
|
|
1100
|
-
* }
|
|
1101
|
-
* ```
|
|
1102
|
-
*/
|
|
1103
|
-
get outputCells(): Iterable<CellAny>;
|
|
1104
|
-
/**
|
|
1105
|
-
* Adds an output to the transaction.
|
|
1106
|
-
*
|
|
1107
|
-
* This method supports two overloads for adding an output:
|
|
1108
|
-
* 1. By providing a `CellAnyLike` object, which encapsulates both `cellOutput` and `outputData`.
|
|
1109
|
-
* 2. By providing a `CellOutputLike` object and an optional `outputData`.
|
|
1110
|
-
*
|
|
1111
|
-
* @param cellOrOutputLike - A cell-like object containing both cell output and data, or just the cell output object.
|
|
1112
|
-
* @param outputDataLike - Optional data for the cell output. Defaults to "0x" if not provided in the first argument.
|
|
1113
|
-
* @returns The new number of outputs in the transaction.
|
|
1114
|
-
*
|
|
1115
|
-
* @example
|
|
1116
|
-
* ```typescript
|
|
1117
|
-
* // 1. Add an output using a CellAnyLike object
|
|
1118
|
-
* const newLength1 = tx.addOutput({
|
|
1119
|
-
* cellOutput: { lock: recipientLock }, // capacity is calculated automatically
|
|
1120
|
-
* outputData: "0x1234",
|
|
1121
|
-
* });
|
|
1122
|
-
*
|
|
1123
|
-
* // 2. Add an output using CellOutputLike and data separately
|
|
1124
|
-
* const newLength2 = tx.addOutput({ lock: recipientLock }, "0xabcd");
|
|
1125
|
-
* ```
|
|
1126
|
-
*/
|
|
1127
|
-
addOutput(cellLike: CellAnyLike): number;
|
|
1128
|
-
addOutput(outputLike: CellOutputLike, outputDataLike?: HexLike | null): number;
|
|
1129
|
-
/**
|
|
1130
|
-
* Get witness at index as WitnessArgs
|
|
1131
|
-
*
|
|
1132
|
-
* @param index - The index of the witness.
|
|
1133
|
-
* @returns The witness parsed as WitnessArgs.
|
|
1134
|
-
*
|
|
1135
|
-
* @example
|
|
1136
|
-
* ```typescript
|
|
1137
|
-
* const witnessArgs = await tx.getWitnessArgsAt(0);
|
|
1138
|
-
* ```
|
|
1139
|
-
*/
|
|
1140
|
-
getWitnessArgsAt(index: number): WitnessArgs | undefined;
|
|
1141
|
-
/**
|
|
1142
|
-
* Set witness at index by WitnessArgs
|
|
1143
|
-
*
|
|
1144
|
-
* @param index - The index of the witness.
|
|
1145
|
-
* @param witness - The WitnessArgs to set.
|
|
1146
|
-
*
|
|
1147
|
-
* @example
|
|
1148
|
-
* ```typescript
|
|
1149
|
-
* await tx.setWitnessArgsAt(0, witnessArgs);
|
|
1150
|
-
* ```
|
|
1151
|
-
*/
|
|
1152
|
-
setWitnessArgsAt(index: number, witness: WitnessArgs): void;
|
|
1153
|
-
/**
|
|
1154
|
-
* Set witness at index
|
|
1155
|
-
*
|
|
1156
|
-
* @param index - The index of the witness.
|
|
1157
|
-
* @param witness - The witness to set.
|
|
1158
|
-
*
|
|
1159
|
-
* @example
|
|
1160
|
-
* ```typescript
|
|
1161
|
-
* await tx.setWitnessAt(0, witness);
|
|
1162
|
-
* ```
|
|
1163
|
-
*/
|
|
1164
|
-
setWitnessAt(index: number, witness: HexLike): void;
|
|
1165
|
-
/**
|
|
1166
|
-
* Prepare dummy witness for sighash all method
|
|
1167
|
-
*
|
|
1168
|
-
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
1169
|
-
* @param lockLen - The length of dummy lock bytes.
|
|
1170
|
-
* @param client - The client for complete extra infos in the transaction.
|
|
1171
|
-
* @returns A promise that resolves to the prepared transaction
|
|
1172
|
-
*
|
|
1173
|
-
* @example
|
|
1174
|
-
* ```typescript
|
|
1175
|
-
* await tx.prepareSighashAllWitness(scriptLike, 85, client);
|
|
1176
|
-
* ```
|
|
1177
|
-
*/
|
|
1178
|
-
prepareSighashAllWitness(scriptLike: ScriptLike, lockLen: number, client: Client): Promise<void>;
|
|
1179
|
-
getInputsCapacityExtra(client: Client): Promise<Num>;
|
|
1180
|
-
getInputsCapacity(client: Client): Promise<Num>;
|
|
1181
|
-
getOutputsCapacity(): Num;
|
|
1182
|
-
getInputsUdtBalance(client: Client, type: ScriptLike): Promise<Num>;
|
|
1183
|
-
getOutputsUdtBalance(type: ScriptLike): Num;
|
|
1184
|
-
completeInputs<T>(from: Signer, filter: ClientCollectableSearchKeyFilterLike, accumulator: (acc: T, v: Cell, i: number, array: Cell[]) => Promise<T | undefined> | T | undefined, init: T): Promise<{
|
|
1185
|
-
addedCount: number;
|
|
1186
|
-
accumulated?: T;
|
|
1187
|
-
}>;
|
|
1188
|
-
completeInputsByCapacity(from: Signer, capacityTweak?: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<number>;
|
|
1189
|
-
completeInputsAll(from: Signer, filter?: ClientCollectableSearchKeyFilterLike): Promise<number>;
|
|
1190
|
-
/**
|
|
1191
|
-
* Complete inputs by UDT balance
|
|
1192
|
-
*
|
|
1193
|
-
* This method succeeds only if enough balance is collected.
|
|
1194
|
-
*
|
|
1195
|
-
* It will try to collect at least two inputs, even when the first input already contains enough balance, to avoid extra occupation fees introduced by the change cell. An edge case: If the first cell has the same amount as the output, a new cell is not needed.
|
|
1196
|
-
* @param from - The signer to complete the inputs.
|
|
1197
|
-
* @param type - The type script of the UDT.
|
|
1198
|
-
* @param balanceTweak - The tweak of the balance.
|
|
1199
|
-
* @returns A promise that resolves to the number of inputs added.
|
|
1200
|
-
*/
|
|
1201
|
-
completeInputsByUdt(from: Signer, type: ScriptLike, balanceTweak?: NumLike): Promise<number>;
|
|
1202
|
-
completeInputsAddOne(from: Signer, filter?: ClientCollectableSearchKeyFilterLike): Promise<number>;
|
|
1203
|
-
completeInputsAtLeastOne(from: Signer, filter?: ClientCollectableSearchKeyFilterLike): Promise<number>;
|
|
1204
|
-
getFee(client: Client): Promise<Num>;
|
|
1205
|
-
getFeeRate(client: Client): Promise<Num>;
|
|
1206
|
-
estimateFee(feeRate: NumLike): Num;
|
|
1207
|
-
/**
|
|
1208
|
-
* Completes the transaction fee by adding inputs and handling change outputs.
|
|
1209
|
-
* This method automatically calculates the required fee based on the transaction size and fee rate,
|
|
1210
|
-
* adds necessary inputs to cover the fee, and handles change outputs through the provided change function.
|
|
1211
|
-
*
|
|
1212
|
-
* @param from - The signer to complete inputs from and prepare the transaction.
|
|
1213
|
-
* @param change - A function that handles change capacity. It receives the transaction and excess capacity,
|
|
1214
|
-
* and should return the additional capacity needed (0 if change is handled successfully,
|
|
1215
|
-
* positive number if more capacity is needed for change cell creation).
|
|
1216
|
-
* @param expectedFeeRate - The expected fee rate in shannons per 1000 bytes. If not provided,
|
|
1217
|
-
* it will be fetched from the client.
|
|
1218
|
-
* @param filter - Optional filter for selecting cells when adding inputs.
|
|
1219
|
-
* @param options - Optional configuration object.
|
|
1220
|
-
* @param options.feeRateBlockRange - Block range for fee rate calculation when expectedFeeRate is not provided.
|
|
1221
|
-
* @param options.maxFeeRate - Maximum allowed fee rate.
|
|
1222
|
-
* @param options.shouldAddInputs - Whether to add inputs automatically. Defaults to true.
|
|
1223
|
-
* @returns A promise that resolves to a tuple containing:
|
|
1224
|
-
* - The number of inputs added during the process
|
|
1225
|
-
* - A boolean indicating whether change outputs were created (true) or fee was paid without change (false)
|
|
1226
|
-
*
|
|
1227
|
-
* @throws {ErrorTransactionInsufficientCapacity} When there's not enough capacity to cover the fee.
|
|
1228
|
-
* @throws {Error} When the change function doesn't properly handle the available capacity.
|
|
1229
|
-
*
|
|
1230
|
-
* @example
|
|
1231
|
-
* ```typescript
|
|
1232
|
-
* const [addedInputs, hasChange] = await tx.completeFee(
|
|
1233
|
-
* signer,
|
|
1234
|
-
* (tx, capacity) => {
|
|
1235
|
-
* if (capacity >= 61_00000000n) { // Minimum for a change cell
|
|
1236
|
-
* tx.addOutput({ capacity, lock: changeScript });
|
|
1237
|
-
* return 0;
|
|
1238
|
-
* }
|
|
1239
|
-
* return 61_00000000n; // Need more capacity for change cell
|
|
1240
|
-
* },
|
|
1241
|
-
* 1000n // 1000 shannons per 1000 bytes
|
|
1242
|
-
* );
|
|
1243
|
-
* ```
|
|
1244
|
-
*/
|
|
1245
|
-
completeFee(from: Signer, change: (tx: Transaction, capacity: Num) => Promise<NumLike> | NumLike, expectedFeeRate?: NumLike, filter?: ClientCollectableSearchKeyFilterLike, options?: {
|
|
1246
|
-
feeRateBlockRange?: NumLike;
|
|
1247
|
-
maxFeeRate?: NumLike;
|
|
1248
|
-
shouldAddInputs?: boolean;
|
|
1249
|
-
}): Promise<[number, boolean]>;
|
|
1250
|
-
/**
|
|
1251
|
-
* Completes the transaction fee by adding inputs and creating a change output with the specified lock script.
|
|
1252
|
-
* This is a convenience method that automatically creates a change cell with the provided lock script
|
|
1253
|
-
* when there's excess capacity after paying the transaction fee.
|
|
1254
|
-
*
|
|
1255
|
-
* @param from - The signer to complete inputs from and prepare the transaction.
|
|
1256
|
-
* @param change - The lock script for the change output cell.
|
|
1257
|
-
* @param feeRate - Optional fee rate in shannons per 1000 bytes. If not provided, it will be fetched from the client.
|
|
1258
|
-
* @param filter - Optional filter for selecting cells when adding inputs.
|
|
1259
|
-
* @param options - Optional configuration object.
|
|
1260
|
-
* @param options.feeRateBlockRange - Block range for fee rate calculation when feeRate is not provided.
|
|
1261
|
-
* @param options.maxFeeRate - Maximum allowed fee rate.
|
|
1262
|
-
* @param options.shouldAddInputs - Whether to add inputs automatically. Defaults to true.
|
|
1263
|
-
* @returns A promise that resolves to a tuple containing:
|
|
1264
|
-
* - The number of inputs added during the process
|
|
1265
|
-
* - A boolean indicating whether change outputs were created (true) or fee was paid without change (false)
|
|
1266
|
-
*
|
|
1267
|
-
* @example
|
|
1268
|
-
* ```typescript
|
|
1269
|
-
* const changeScript = Script.from({
|
|
1270
|
-
* codeHash: "0x...",
|
|
1271
|
-
* hashType: "type",
|
|
1272
|
-
* args: "0x..."
|
|
1273
|
-
* });
|
|
1274
|
-
*
|
|
1275
|
-
* const [addedInputs, hasChange] = await tx.completeFeeChangeToLock(
|
|
1276
|
-
* signer,
|
|
1277
|
-
* changeScript,
|
|
1278
|
-
* 1000n // 1000 shannons per 1000 bytes
|
|
1279
|
-
* );
|
|
1280
|
-
* ```
|
|
1281
|
-
*/
|
|
1282
|
-
completeFeeChangeToLock(from: Signer, change: ScriptLike, feeRate?: NumLike, filter?: ClientCollectableSearchKeyFilterLike, options?: {
|
|
1283
|
-
feeRateBlockRange?: NumLike;
|
|
1284
|
-
maxFeeRate?: NumLike;
|
|
1285
|
-
shouldAddInputs?: boolean;
|
|
1286
|
-
}): Promise<[number, boolean]>;
|
|
1287
|
-
/**
|
|
1288
|
-
* Completes the transaction fee using the signer's recommended address for change.
|
|
1289
|
-
* This is a convenience method that automatically uses the signer's recommended
|
|
1290
|
-
* address as the change destination, making it easier to complete transactions
|
|
1291
|
-
* without manually specifying a change address.
|
|
1292
|
-
*
|
|
1293
|
-
* @param from - The signer to complete inputs from and prepare the transaction.
|
|
1294
|
-
* @param feeRate - Optional fee rate in shannons per 1000 bytes. If not provided, it will be fetched from the client.
|
|
1295
|
-
* @param filter - Optional filter for selecting cells when adding inputs.
|
|
1296
|
-
* @param options - Optional configuration object.
|
|
1297
|
-
* @param options.feeRateBlockRange - Block range for fee rate calculation when feeRate is not provided.
|
|
1298
|
-
* @param options.maxFeeRate - Maximum allowed fee rate.
|
|
1299
|
-
* @param options.shouldAddInputs - Whether to add inputs automatically. Defaults to true.
|
|
1300
|
-
* @returns A promise that resolves to a tuple containing:
|
|
1301
|
-
* - The number of inputs added during the process
|
|
1302
|
-
* - A boolean indicating whether change outputs were created (true) or fee was paid without change (false)
|
|
1303
|
-
*
|
|
1304
|
-
* @example
|
|
1305
|
-
* ```typescript
|
|
1306
|
-
* const [addedInputs, hasChange] = await tx.completeFeeBy(
|
|
1307
|
-
* signer,
|
|
1308
|
-
* 1000n // 1000 shannons per 1000 bytes
|
|
1309
|
-
* );
|
|
1310
|
-
*
|
|
1311
|
-
* // Change will automatically go to signer's recommended address
|
|
1312
|
-
* ```
|
|
1313
|
-
*/
|
|
1314
|
-
completeFeeBy(from: Signer, feeRate?: NumLike, filter?: ClientCollectableSearchKeyFilterLike, options?: {
|
|
1315
|
-
feeRateBlockRange?: NumLike;
|
|
1316
|
-
maxFeeRate?: NumLike;
|
|
1317
|
-
shouldAddInputs?: boolean;
|
|
1318
|
-
}): Promise<[number, boolean]>;
|
|
1319
|
-
/**
|
|
1320
|
-
* Completes the transaction fee by adding excess capacity to an existing output.
|
|
1321
|
-
* Instead of creating a new change output, this method adds any excess capacity
|
|
1322
|
-
* to the specified existing output in the transaction.
|
|
1323
|
-
*
|
|
1324
|
-
* @param from - The signer to complete inputs from and prepare the transaction.
|
|
1325
|
-
* @param index - The index of the existing output to add excess capacity to.
|
|
1326
|
-
* @param feeRate - Optional fee rate in shannons per 1000 bytes. If not provided, it will be fetched from the client.
|
|
1327
|
-
* @param filter - Optional filter for selecting cells when adding inputs.
|
|
1328
|
-
* @param options - Optional configuration object.
|
|
1329
|
-
* @param options.feeRateBlockRange - Block range for fee rate calculation when feeRate is not provided.
|
|
1330
|
-
* @param options.maxFeeRate - Maximum allowed fee rate.
|
|
1331
|
-
* @param options.shouldAddInputs - Whether to add inputs automatically. Defaults to true.
|
|
1332
|
-
* @returns A promise that resolves to a tuple containing:
|
|
1333
|
-
* - The number of inputs added during the process
|
|
1334
|
-
* - A boolean indicating whether change was applied (true) or fee was paid without change (false)
|
|
1335
|
-
*
|
|
1336
|
-
* @throws {Error} When the specified output index doesn't exist.
|
|
1337
|
-
*
|
|
1338
|
-
* @example
|
|
1339
|
-
* ```typescript
|
|
1340
|
-
* // Add excess capacity to the first output (index 0)
|
|
1341
|
-
* const [addedInputs, hasChange] = await tx.completeFeeChangeToOutput(
|
|
1342
|
-
* signer,
|
|
1343
|
-
* 0, // Output index
|
|
1344
|
-
* 1000n // 1000 shannons per 1000 bytes
|
|
1345
|
-
* );
|
|
1346
|
-
* ```
|
|
1347
|
-
*/
|
|
1348
|
-
completeFeeChangeToOutput(from: Signer, index: NumLike, feeRate?: NumLike, filter?: ClientCollectableSearchKeyFilterLike, options?: {
|
|
1349
|
-
feeRateBlockRange?: NumLike;
|
|
1350
|
-
maxFeeRate?: NumLike;
|
|
1351
|
-
shouldAddInputs?: boolean;
|
|
1352
|
-
}): Promise<[number, boolean]>;
|
|
1353
|
-
}
|
|
1354
|
-
/**
|
|
1355
|
-
* Calculate Nervos DAO profit between two blocks.
|
|
1356
|
-
* This function computes the profit earned from a Nervos DAO deposit
|
|
1357
|
-
* based on the capacity and the time period between deposit and withdrawal.
|
|
1358
|
-
*
|
|
1359
|
-
* @param profitableCapacity - The capacity that earns profit (total capacity minus occupied capacity).
|
|
1360
|
-
* @param depositHeaderLike - The block header when the DAO deposit was made.
|
|
1361
|
-
* @param withdrawHeaderLike - The block header when the DAO withdrawal is made.
|
|
1362
|
-
* @returns The profit amount in CKB (capacity units).
|
|
1363
|
-
*
|
|
1364
|
-
* @example
|
|
1365
|
-
* ```typescript
|
|
1366
|
-
* const profit = calcDaoProfit(
|
|
1367
|
-
* ccc.fixedPointFrom(100), // 100 CKB profitable capacity
|
|
1368
|
-
* depositHeader,
|
|
1369
|
-
* withdrawHeader
|
|
1370
|
-
* );
|
|
1371
|
-
* console.log(`Profit: ${profit} shannons`);
|
|
1372
|
-
* ```
|
|
1373
|
-
*
|
|
1374
|
-
* @see {@link https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0023-dao-deposit-withdraw/0023-dao-deposit-withdraw.md | Nervos DAO RFC}
|
|
1375
|
-
*/
|
|
1376
|
-
export declare function calcDaoProfit(profitableCapacity: NumLike, depositHeaderLike: ClientBlockHeaderLike, withdrawHeaderLike: ClientBlockHeaderLike): Num;
|
|
1377
|
-
/**
|
|
1378
|
-
* Calculate claimable epoch for Nervos DAO withdrawal.
|
|
1379
|
-
* This function determines the earliest epoch when a Nervos DAO withdrawal
|
|
1380
|
-
* can be claimed based on the deposit and withdrawal epochs.
|
|
1381
|
-
*
|
|
1382
|
-
* @param depositHeader - The block header when the DAO deposit was made.
|
|
1383
|
-
* @param withdrawHeader - The block header when the DAO withdrawal was initiated.
|
|
1384
|
-
* @returns The epoch when the withdrawal can be claimed, represented as [number, index, length].
|
|
1385
|
-
*
|
|
1386
|
-
* @example
|
|
1387
|
-
* ```typescript
|
|
1388
|
-
* const claimEpoch = calcDaoClaimEpoch(depositHeader, withdrawHeader);
|
|
1389
|
-
* console.log(`Can claim at epoch: ${claimEpoch[0]}, index: ${claimEpoch[1]}, length: ${claimEpoch[2]}`);
|
|
1390
|
-
* ```
|
|
1391
|
-
*
|
|
1392
|
-
* @remarks
|
|
1393
|
-
* The Nervos DAO has a minimum lock period of 180 epochs (~30 days).
|
|
1394
|
-
* This function calculates the exact epoch when the withdrawal becomes claimable
|
|
1395
|
-
* based on the deposit epoch and withdrawal epoch timing.
|
|
1396
|
-
*
|
|
1397
|
-
* @see {@link https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0023-dao-deposit-withdraw/0023-dao-deposit-withdraw.md | Nervos DAO RFC}
|
|
1398
|
-
*/
|
|
1399
|
-
export declare function calcDaoClaimEpoch(depositHeader: ClientBlockHeaderLike, withdrawHeader: ClientBlockHeaderLike): Epoch;
|
|
1400
|
-
export {};
|
|
1401
|
-
//# sourceMappingURL=transaction.d.ts.map
|