@ckb-ccc/core 1.12.5 → 1.14.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 +51 -0
- package/dist/address.advanced-BmJKF_Lg.mjs +2 -0
- package/dist/address.advanced-BmJKF_Lg.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-C-sr5NLL.mjs +7 -0
- package/dist/barrel-C-sr5NLL.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-D9nKvIr3.js +2 -0
- package/dist.commonjs/address.advanced-D9nKvIr3.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-SuR9mcfv.js +21 -0
- package/dist.commonjs/barrel-SuR9mcfv.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 +42 -34
- package/src/address/address.advanced.ts +3 -3
- 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 +18 -10
- 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 +48 -153
- 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 +53 -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,91 +1,104 @@
|
|
|
1
1
|
import { bytesFrom, bytesTo } from "../bytes/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Codec, CodecBytes } from "../codec/index.js";
|
|
3
|
+
import { Hex, HexLike } from "../hex/index.js";
|
|
4
|
+
import { byteVec, option, vector } from "./codec.js";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
CodecBool as Bool,
|
|
8
|
+
CodecByte as Byte,
|
|
9
|
+
CodecByte16 as Byte16,
|
|
10
|
+
CodecByte32 as Byte32,
|
|
11
|
+
CodecByte4 as Byte4,
|
|
12
|
+
CodecByte8 as Byte8,
|
|
13
|
+
CodecUint128 as Uint128,
|
|
14
|
+
CodecUint128BE as Uint128BE,
|
|
15
|
+
CodecUint128LE as Uint128LE,
|
|
16
|
+
CodecUint16 as Uint16,
|
|
17
|
+
CodecUint16BE as Uint16BE,
|
|
18
|
+
CodecUint16LE as Uint16LE,
|
|
19
|
+
CodecUint256 as Uint256,
|
|
20
|
+
CodecUint256BE as Uint256BE,
|
|
21
|
+
CodecUint256LE as Uint256LE,
|
|
22
|
+
CodecUint32 as Uint32,
|
|
23
|
+
CodecUint32BE as Uint32BE,
|
|
24
|
+
CodecUint32LE as Uint32LE,
|
|
25
|
+
CodecUint512 as Uint512,
|
|
26
|
+
CodecUint512BE as Uint512BE,
|
|
27
|
+
CodecUint512LE as Uint512LE,
|
|
28
|
+
CodecUint64 as Uint64,
|
|
29
|
+
CodecUint64BE as Uint64BE,
|
|
30
|
+
CodecUint64LE as Uint64LE,
|
|
31
|
+
CodecUint8 as Uint8,
|
|
32
|
+
} from "../codec/index.js";
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
Bool,
|
|
36
|
+
Byte,
|
|
37
|
+
Byte16,
|
|
38
|
+
Byte32,
|
|
39
|
+
Byte4,
|
|
40
|
+
Byte8,
|
|
41
|
+
Uint128,
|
|
42
|
+
Uint128BE,
|
|
43
|
+
Uint128LE,
|
|
44
|
+
Uint16,
|
|
45
|
+
Uint16BE,
|
|
46
|
+
Uint16LE,
|
|
47
|
+
Uint256,
|
|
48
|
+
Uint256BE,
|
|
49
|
+
Uint256LE,
|
|
50
|
+
Uint32,
|
|
51
|
+
Uint32BE,
|
|
52
|
+
Uint32LE,
|
|
53
|
+
Uint512,
|
|
54
|
+
Uint512BE,
|
|
55
|
+
Uint512LE,
|
|
56
|
+
Uint64,
|
|
57
|
+
Uint64BE,
|
|
58
|
+
Uint64LE,
|
|
59
|
+
Uint8,
|
|
60
|
+
};
|
|
4
61
|
|
|
5
|
-
export const Uint8 = uintNumber(1, true);
|
|
6
62
|
export const Uint8Opt = option(Uint8);
|
|
7
63
|
export const Uint8Vec = vector(Uint8);
|
|
8
64
|
|
|
9
|
-
export const Uint16LE = uintNumber(2, true);
|
|
10
|
-
export const Uint16BE = uintNumber(2);
|
|
11
|
-
export const Uint16 = Uint16LE;
|
|
12
65
|
export const Uint16Opt = option(Uint16);
|
|
13
66
|
export const Uint16Vec = vector(Uint16);
|
|
14
67
|
|
|
15
|
-
export const Uint32LE = uintNumber(4, true);
|
|
16
|
-
export const Uint32BE = uintNumber(4);
|
|
17
|
-
export const Uint32 = Uint32LE;
|
|
18
68
|
export const Uint32Opt = option(Uint32);
|
|
19
69
|
export const Uint32Vec = vector(Uint32);
|
|
20
70
|
|
|
21
|
-
export const Uint64LE = uint(8, true);
|
|
22
|
-
export const Uint64BE = uint(8);
|
|
23
|
-
export const Uint64 = Uint64LE;
|
|
24
71
|
export const Uint64Opt = option(Uint64);
|
|
25
72
|
export const Uint64Vec = vector(Uint64);
|
|
26
73
|
|
|
27
|
-
export const Uint128LE = uint(16, true);
|
|
28
|
-
export const Uint128BE = uint(16);
|
|
29
|
-
export const Uint128 = Uint128LE;
|
|
30
74
|
export const Uint128Opt = option(Uint128);
|
|
31
75
|
export const Uint128Vec = vector(Uint128);
|
|
32
76
|
|
|
33
|
-
export const Uint256LE = uint(32, true);
|
|
34
|
-
export const Uint256BE = uint(32);
|
|
35
|
-
export const Uint256 = Uint256LE;
|
|
36
77
|
export const Uint256Opt = option(Uint256);
|
|
37
78
|
export const Uint256Vec = vector(Uint256);
|
|
38
79
|
|
|
39
|
-
export const Uint512LE = uint(64, true);
|
|
40
|
-
export const Uint512BE = uint(64);
|
|
41
|
-
export const Uint512 = Uint512LE;
|
|
42
80
|
export const Uint512Opt = option(Uint512);
|
|
43
81
|
export const Uint512Vec = vector(Uint512);
|
|
44
82
|
|
|
45
|
-
export const Bytes: Codec<HexLike, Hex> = byteVec(
|
|
46
|
-
encode: (value) => bytesFrom(value),
|
|
47
|
-
decode: (buffer) => hexFrom(buffer),
|
|
48
|
-
});
|
|
83
|
+
export const Bytes: Codec<HexLike, Hex> = byteVec(CodecBytes);
|
|
49
84
|
export const BytesOpt = option(Bytes);
|
|
50
85
|
export const BytesVec = vector(Bytes);
|
|
51
86
|
|
|
52
|
-
export const Bool: Codec<boolean> = Codec.from({
|
|
53
|
-
byteLength: 1,
|
|
54
|
-
encode: (value) => bytesFrom(value ? [1] : [0]),
|
|
55
|
-
decode: (buffer) => bytesFrom(buffer)[0] !== 0,
|
|
56
|
-
});
|
|
57
87
|
export const BoolOpt = option(Bool);
|
|
58
88
|
export const BoolVec = vector(Bool);
|
|
59
89
|
|
|
60
|
-
export const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
decode: (buffer) => hexFrom(buffer),
|
|
64
|
-
});
|
|
90
|
+
export const ByteOpt = option(Byte);
|
|
91
|
+
export const ByteVec = vector(Byte);
|
|
92
|
+
|
|
65
93
|
export const Byte4Opt = option(Byte4);
|
|
66
94
|
export const Byte4Vec = vector(Byte4);
|
|
67
95
|
|
|
68
|
-
export const Byte8: Codec<HexLike, Hex> = Codec.from({
|
|
69
|
-
byteLength: 8,
|
|
70
|
-
encode: (value) => bytesFrom(value),
|
|
71
|
-
decode: (buffer) => hexFrom(buffer),
|
|
72
|
-
});
|
|
73
96
|
export const Byte8Opt = option(Byte8);
|
|
74
97
|
export const Byte8Vec = vector(Byte8);
|
|
75
98
|
|
|
76
|
-
export const Byte16: Codec<HexLike, Hex> = Codec.from({
|
|
77
|
-
byteLength: 16,
|
|
78
|
-
encode: (value) => bytesFrom(value),
|
|
79
|
-
decode: (buffer) => hexFrom(buffer),
|
|
80
|
-
});
|
|
81
99
|
export const Byte16Opt = option(Byte16);
|
|
82
100
|
export const Byte16Vec = vector(Byte16);
|
|
83
101
|
|
|
84
|
-
export const Byte32: Codec<HexLike, Hex> = Codec.from({
|
|
85
|
-
byteLength: 32,
|
|
86
|
-
encode: (value) => bytesFrom(value),
|
|
87
|
-
decode: (buffer) => hexFrom(buffer),
|
|
88
|
-
});
|
|
89
102
|
export const Byte32Opt = option(Byte32);
|
|
90
103
|
export const Byte32Vec = vector(Byte32);
|
|
91
104
|
|
package/src/signer/btc/index.ts
CHANGED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Hex, HexLike, hexFrom } from "../../hex/index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for signing a PSBT (Partially Signed Bitcoin Transaction)
|
|
5
|
+
*/
|
|
6
|
+
export type SignPsbtOptionsLike = {
|
|
7
|
+
/**
|
|
8
|
+
* Whether to finalize the PSBT after signing.
|
|
9
|
+
* Default is true.
|
|
10
|
+
*/
|
|
11
|
+
autoFinalized?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Array of inputs to sign
|
|
14
|
+
*/
|
|
15
|
+
inputsToSign?: InputToSignLike[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export class SignPsbtOptions {
|
|
19
|
+
constructor(
|
|
20
|
+
public autoFinalized: boolean,
|
|
21
|
+
public inputsToSign: InputToSign[],
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
static from(options?: SignPsbtOptionsLike): SignPsbtOptions {
|
|
25
|
+
if (options instanceof SignPsbtOptions) {
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
return new SignPsbtOptions(
|
|
29
|
+
options?.autoFinalized ?? true,
|
|
30
|
+
options?.inputsToSign?.map((i) => InputToSign.from(i)) ?? [],
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Specification for an input to sign in a PSBT.
|
|
37
|
+
* Must specify at least one of: address or pubkey.
|
|
38
|
+
*/
|
|
39
|
+
export type InputToSignLike = {
|
|
40
|
+
/**
|
|
41
|
+
* Which input to sign (index in the PSBT inputs array)
|
|
42
|
+
*/
|
|
43
|
+
index: number;
|
|
44
|
+
/**
|
|
45
|
+
* (Optional) Sighash types to use for signing.
|
|
46
|
+
*/
|
|
47
|
+
sighashTypes?: number[];
|
|
48
|
+
/**
|
|
49
|
+
* (Optional) When signing and unlocking Taproot addresses, the tweakSigner is used by default
|
|
50
|
+
* for signature generation. Setting this to true allows for signing with the original private key.
|
|
51
|
+
* Default value is false.
|
|
52
|
+
*/
|
|
53
|
+
disableTweakSigner?: boolean;
|
|
54
|
+
} & (
|
|
55
|
+
| {
|
|
56
|
+
/**
|
|
57
|
+
* The address whose corresponding private key to use for signing.
|
|
58
|
+
*/
|
|
59
|
+
address: string;
|
|
60
|
+
/**
|
|
61
|
+
* The public key whose corresponding private key to use for signing.
|
|
62
|
+
*/
|
|
63
|
+
publicKey?: HexLike;
|
|
64
|
+
}
|
|
65
|
+
| {
|
|
66
|
+
/**
|
|
67
|
+
* The address whose corresponding private key to use for signing.
|
|
68
|
+
*/
|
|
69
|
+
address?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The public key whose corresponding private key to use for signing.
|
|
72
|
+
*/
|
|
73
|
+
publicKey: HexLike;
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export class InputToSign {
|
|
78
|
+
constructor(
|
|
79
|
+
public index: number,
|
|
80
|
+
public sighashTypes?: number[],
|
|
81
|
+
public disableTweakSigner?: boolean,
|
|
82
|
+
public address?: string,
|
|
83
|
+
public publicKey?: Hex,
|
|
84
|
+
) {}
|
|
85
|
+
|
|
86
|
+
static from(input: InputToSignLike): InputToSign {
|
|
87
|
+
if (input instanceof InputToSign) {
|
|
88
|
+
return input;
|
|
89
|
+
}
|
|
90
|
+
return new InputToSign(
|
|
91
|
+
input.index,
|
|
92
|
+
input.sighashTypes,
|
|
93
|
+
input.disableTweakSigner,
|
|
94
|
+
input.address,
|
|
95
|
+
input.publicKey ? hexFrom(input.publicKey) : undefined,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -2,9 +2,10 @@ import { Address } from "../../address/index.js";
|
|
|
2
2
|
import { bytesConcat, bytesFrom } from "../../bytes/index.js";
|
|
3
3
|
import { Transaction, TransactionLike, WitnessArgs } from "../../ckb/index.js";
|
|
4
4
|
import { KnownScript } from "../../client/index.js";
|
|
5
|
-
import { HexLike, hexFrom } from "../../hex/index.js";
|
|
5
|
+
import { Hex, HexLike, hexFrom } from "../../hex/index.js";
|
|
6
6
|
import { numToBytes } from "../../num/index.js";
|
|
7
7
|
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
8
|
+
import { SignPsbtOptionsLike } from "./psbt.js";
|
|
8
9
|
import { btcEcdsaPublicKeyHash } from "./verify.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -22,6 +23,21 @@ export abstract class SignerBtc extends Signer {
|
|
|
22
23
|
return SignerSignType.BtcEcdsa;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Sign and broadcast a PSBT.
|
|
28
|
+
*
|
|
29
|
+
* @param psbtHex - The hex string of PSBT to sign and broadcast.
|
|
30
|
+
* @param options - Options for signing the PSBT.
|
|
31
|
+
* @returns A promise that resolves to the transaction ID as a Hex string.
|
|
32
|
+
*/
|
|
33
|
+
async signAndBroadcastPsbt(
|
|
34
|
+
psbtHex: HexLike,
|
|
35
|
+
options?: SignPsbtOptionsLike,
|
|
36
|
+
): Promise<Hex> {
|
|
37
|
+
const signedPsbt = await this.signPsbt(psbtHex, options);
|
|
38
|
+
return this.broadcastPsbt(signedPsbt, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
25
41
|
/**
|
|
26
42
|
* Gets the Bitcoin account associated with the signer.
|
|
27
43
|
*
|
|
@@ -123,4 +139,28 @@ export abstract class SignerBtc extends Signer {
|
|
|
123
139
|
tx.setWitnessArgsAt(info.position, witness);
|
|
124
140
|
return tx;
|
|
125
141
|
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Signs a Partially Signed Bitcoin Transaction (PSBT).
|
|
145
|
+
*
|
|
146
|
+
* @param psbtHex - The hex string of PSBT to sign.
|
|
147
|
+
* @param options - Options for signing the PSBT
|
|
148
|
+
* @returns A promise that resolves to the signed PSBT as a Hex string.
|
|
149
|
+
*/
|
|
150
|
+
abstract signPsbt(
|
|
151
|
+
psbtHex: HexLike,
|
|
152
|
+
options?: SignPsbtOptionsLike,
|
|
153
|
+
): Promise<Hex>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Broadcasts a PSBT to the Bitcoin network.
|
|
157
|
+
*
|
|
158
|
+
* @param psbtHex - The hex string of the PSBT to broadcast.
|
|
159
|
+
* @param options - Options for broadcasting the PSBT.
|
|
160
|
+
* @returns A promise that resolves to the transaction ID as a Hex string.
|
|
161
|
+
*/
|
|
162
|
+
abstract broadcastPsbt(
|
|
163
|
+
psbtHex: HexLike,
|
|
164
|
+
options?: SignPsbtOptionsLike,
|
|
165
|
+
): Promise<Hex>;
|
|
126
166
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Client } from "../../client/index.js";
|
|
2
2
|
import { Hex, HexLike, hexFrom } from "../../hex/index.js";
|
|
3
|
+
import { SignPsbtOptionsLike } from "./psbt.js";
|
|
3
4
|
import { SignerBtc } from "./signerBtc.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -70,4 +71,18 @@ export class SignerBtcPublicKeyReadonly extends SignerBtc {
|
|
|
70
71
|
async getBtcPublicKey(): Promise<Hex> {
|
|
71
72
|
return this.publicKey;
|
|
72
73
|
}
|
|
74
|
+
|
|
75
|
+
async signPsbt(
|
|
76
|
+
_psbtHex: HexLike,
|
|
77
|
+
_options?: SignPsbtOptionsLike,
|
|
78
|
+
): Promise<Hex> {
|
|
79
|
+
throw new Error("Read-only signer does not support signPsbt");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async broadcastPsbt(
|
|
83
|
+
_psbtHex: HexLike,
|
|
84
|
+
_options?: SignPsbtOptionsLike,
|
|
85
|
+
): Promise<Hex> {
|
|
86
|
+
throw new Error("Read-only signer does not support broadcastPsbt");
|
|
87
|
+
}
|
|
73
88
|
}
|
package/src/signer/btc/verify.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
2
|
import { ripemd160 } from "@noble/hashes/legacy.js";
|
|
3
3
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
4
4
|
import bs58check from "bs58check";
|
|
@@ -98,5 +98,6 @@ export function verifyMessageBtcEcdsa(
|
|
|
98
98
|
bytesFrom(rawSign),
|
|
99
99
|
messageHashBtcEcdsa(challenge),
|
|
100
100
|
bytesFrom(publicKey),
|
|
101
|
+
{ prehash: false },
|
|
101
102
|
);
|
|
102
103
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
2
|
import { bytesConcat, bytesFrom, BytesLike } from "../../bytes/index.js";
|
|
3
3
|
import { Transaction, TransactionLike, WitnessArgs } from "../../ckb/index.js";
|
|
4
4
|
import { Client } from "../../client/index.js";
|
|
5
5
|
import { Hex, hexFrom, HexLike } from "../../hex/index.js";
|
|
6
|
-
import { numBeToBytes } from "../../num/index.js";
|
|
7
6
|
import { SignerCkbPublicKey } from "./signerCkbPublicKey.js";
|
|
8
7
|
import { messageHashCkbSecp256k1 } from "./verifyCkbSecp256k1.js";
|
|
9
8
|
|
|
@@ -27,16 +26,12 @@ export class SignerCkbPrivateKey extends SignerCkbPublicKey {
|
|
|
27
26
|
const signature = secp256k1.sign(
|
|
28
27
|
bytesFrom(message),
|
|
29
28
|
bytesFrom(this.privateKey),
|
|
29
|
+
{
|
|
30
|
+
format: "recovered",
|
|
31
|
+
prehash: false,
|
|
32
|
+
},
|
|
30
33
|
);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return hexFrom(
|
|
34
|
-
bytesConcat(
|
|
35
|
-
numBeToBytes(r, 32),
|
|
36
|
-
numBeToBytes(s, 32),
|
|
37
|
-
numBeToBytes(recovery, 1),
|
|
38
|
-
),
|
|
39
|
-
);
|
|
34
|
+
return hexFrom(bytesConcat(signature.slice(1), signature.slice(0, 1)));
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
async signMessageRaw(message: string | BytesLike): Promise<Hex> {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
2
|
-
import {
|
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
|
+
import { bytesConcat, bytesFrom, BytesLike } from "../../bytes/index.js";
|
|
3
3
|
import { hashCkb } from "../../hasher/index.js";
|
|
4
4
|
import { Hex, hexFrom } from "../../hex/index.js";
|
|
5
|
-
import { numFrom } from "../../num/index.js";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @public
|
|
@@ -21,15 +20,12 @@ export function verifyMessageCkbSecp256k1(
|
|
|
21
20
|
signature: string,
|
|
22
21
|
publicKey: string,
|
|
23
22
|
): boolean {
|
|
24
|
-
const
|
|
23
|
+
const raw = bytesFrom(signature);
|
|
24
|
+
|
|
25
25
|
return secp256k1.verify(
|
|
26
|
-
|
|
27
|
-
numFrom(signatureBytes.slice(0, 32)),
|
|
28
|
-
numFrom(signatureBytes.slice(32, 64)),
|
|
29
|
-
)
|
|
30
|
-
.addRecoveryBit(Number(numFrom(signatureBytes.slice(64, 65))))
|
|
31
|
-
.toBytes(),
|
|
26
|
+
bytesConcat(raw.slice(64), raw.slice(0, 64)),
|
|
32
27
|
bytesFrom(messageHashCkbSecp256k1(message)),
|
|
33
28
|
bytesFrom(publicKey),
|
|
29
|
+
{ format: "recovered", prehash: false },
|
|
34
30
|
);
|
|
35
31
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
2
|
import {
|
|
3
3
|
Bytes,
|
|
4
4
|
bytesConcat,
|
|
@@ -87,10 +87,13 @@ export class SignerDogePrivateKey extends SignerDoge {
|
|
|
87
87
|
const signature = secp256k1.sign(
|
|
88
88
|
messageHashDogeEcdsa(challenge),
|
|
89
89
|
this.privateKey,
|
|
90
|
+
{
|
|
91
|
+
format: "recovered",
|
|
92
|
+
prehash: false,
|
|
93
|
+
},
|
|
90
94
|
);
|
|
91
|
-
|
|
92
95
|
return bytesTo(
|
|
93
|
-
bytesConcat([31 + signature
|
|
96
|
+
bytesConcat([31 + Number(signature[0])], signature.slice(1)),
|
|
94
97
|
"base64",
|
|
95
98
|
);
|
|
96
99
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
2
|
import { Bytes, bytesFrom, BytesLike } from "../../bytes/index.js";
|
|
3
3
|
import { hexFrom } from "../../hex/index.js";
|
|
4
4
|
import {
|
|
@@ -38,18 +38,17 @@ export function verifyMessageDogeEcdsa(
|
|
|
38
38
|
const challenge =
|
|
39
39
|
typeof message === "string" ? message : hexFrom(message).slice(2);
|
|
40
40
|
const signatureBytes = bytesFrom(signature, "base64");
|
|
41
|
-
|
|
42
|
-
const rawSign = signatureBytes.slice(1);
|
|
43
|
-
|
|
44
|
-
const sig = secp256k1.Signature.fromCompact(
|
|
45
|
-
hexFrom(rawSign).slice(2),
|
|
46
|
-
).addRecoveryBit(recoveryBit - 31);
|
|
41
|
+
signatureBytes[0] -= 31;
|
|
47
42
|
|
|
48
43
|
return (
|
|
49
44
|
btcPublicKeyFromP2pkhAddress(address) ===
|
|
50
45
|
hexFrom(
|
|
51
46
|
btcEcdsaPublicKeyHash(
|
|
52
|
-
|
|
47
|
+
secp256k1.recoverPublicKey(
|
|
48
|
+
signatureBytes,
|
|
49
|
+
messageHashDogeEcdsa(challenge),
|
|
50
|
+
{ prehash: false },
|
|
51
|
+
),
|
|
53
52
|
),
|
|
54
53
|
)
|
|
55
54
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { schnorr } from "@noble/curves/secp256k1";
|
|
1
|
+
import { schnorr } from "@noble/curves/secp256k1.js";
|
|
2
2
|
import { bech32 } from "bech32";
|
|
3
|
+
import { Bytes, bytesFrom, BytesLike } from "../../bytes/index.js";
|
|
3
4
|
import { Client } from "../../client/index.js";
|
|
4
|
-
import {
|
|
5
|
+
import { hexFrom } from "../../hex/index.js";
|
|
5
6
|
import { NostrEvent } from "./signerNostr.js";
|
|
6
7
|
import { SignerNostrPublicKeyReadonly } from "./signerNostrPublicKeyReadonly.js";
|
|
7
8
|
import { nostrEventHash } from "./verify.js";
|
|
@@ -11,22 +12,22 @@ import { nostrEventHash } from "./verify.js";
|
|
|
11
12
|
* Support nsec and hex format
|
|
12
13
|
*/
|
|
13
14
|
export class SignerNostrPrivateKey extends SignerNostrPublicKeyReadonly {
|
|
14
|
-
private readonly privateKey:
|
|
15
|
+
private readonly privateKey: Bytes;
|
|
15
16
|
|
|
16
|
-
constructor(client: Client, privateKeyLike:
|
|
17
|
+
constructor(client: Client, privateKeyLike: BytesLike) {
|
|
17
18
|
const privateKey = (() => {
|
|
18
19
|
if (
|
|
19
20
|
typeof privateKeyLike === "string" &&
|
|
20
21
|
privateKeyLike.startsWith("nsec")
|
|
21
22
|
) {
|
|
22
23
|
const { words } = bech32.decode(privateKeyLike);
|
|
23
|
-
return
|
|
24
|
+
return bytesFrom(bech32.fromWords(words));
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
return
|
|
27
|
+
return bytesFrom(privateKeyLike);
|
|
27
28
|
})();
|
|
28
29
|
|
|
29
|
-
super(client, schnorr.getPublicKey(privateKey
|
|
30
|
+
super(client, schnorr.getPublicKey(privateKey));
|
|
30
31
|
|
|
31
32
|
this.privateKey = privateKey;
|
|
32
33
|
}
|
|
@@ -34,7 +35,7 @@ export class SignerNostrPrivateKey extends SignerNostrPublicKeyReadonly {
|
|
|
34
35
|
async signNostrEvent(event: NostrEvent): Promise<Required<NostrEvent>> {
|
|
35
36
|
const pubkey = (await this.getNostrPublicKey()).slice(2);
|
|
36
37
|
const eventHash = nostrEventHash({ ...event, pubkey });
|
|
37
|
-
const signature = schnorr.sign(eventHash, this.privateKey
|
|
38
|
+
const signature = schnorr.sign(eventHash, this.privateKey);
|
|
38
39
|
|
|
39
40
|
return {
|
|
40
41
|
...event,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { schnorr } from "@noble/curves/secp256k1";
|
|
1
|
+
import { schnorr } from "@noble/curves/secp256k1.js";
|
|
2
2
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3
3
|
import { bech32 } from "bech32";
|
|
4
4
|
import { Bytes, BytesLike, bytesFrom } from "../../bytes/index.js";
|
|
@@ -65,7 +65,7 @@ export function verifyMessageNostrEvent(
|
|
|
65
65
|
const eventHash = nostrEventHash({ ...event, pubkey });
|
|
66
66
|
|
|
67
67
|
try {
|
|
68
|
-
return schnorr.verify(
|
|
68
|
+
return schnorr.verify(bytesFrom(signature), eventHash, bytesFrom(pubkey));
|
|
69
69
|
} catch (_) {
|
|
70
70
|
return false;
|
|
71
71
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Zero } from "../fixedPoint/index.js";
|
|
2
|
+
import { NumLike, numFrom, numToHex, type Num } from "../num/index.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
@@ -196,3 +197,21 @@ export function stringify(val: unknown) {
|
|
|
196
197
|
return value;
|
|
197
198
|
});
|
|
198
199
|
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Calculate the greatest common divisor (GCD) of two NumLike values using the Euclidean algorithm.
|
|
203
|
+
*
|
|
204
|
+
* @param a - First operand.
|
|
205
|
+
* @param b - Second operand.
|
|
206
|
+
* @returns GCD(a, b) as a Num.
|
|
207
|
+
*/
|
|
208
|
+
export function gcd(a: NumLike, b: NumLike): Num {
|
|
209
|
+
a = numFrom(a);
|
|
210
|
+
b = numFrom(b);
|
|
211
|
+
a = a < Zero ? -a : a;
|
|
212
|
+
b = b < Zero ? -b : b;
|
|
213
|
+
while (b !== Zero) {
|
|
214
|
+
[a, b] = [b, a % b];
|
|
215
|
+
}
|
|
216
|
+
return a;
|
|
217
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineConfig } from "tsdown";
|
|
2
|
+
|
|
3
|
+
const common = {
|
|
4
|
+
minify: true,
|
|
5
|
+
dts: true,
|
|
6
|
+
platform: "neutral" as const,
|
|
7
|
+
sourcemap: true,
|
|
8
|
+
exports: true,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const entry = {
|
|
12
|
+
index: "src/index.ts",
|
|
13
|
+
barrel: "src/barrel.ts",
|
|
14
|
+
advanced: "src/advanced.ts",
|
|
15
|
+
advancedBarrel: "src/advancedBarrel.ts",
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
const bundleDeps = [
|
|
19
|
+
"@noble/curves",
|
|
20
|
+
"@noble/hashes",
|
|
21
|
+
"@noble/ciphers",
|
|
22
|
+
"@noble/curves/*",
|
|
23
|
+
"@noble/hashes/*",
|
|
24
|
+
"@noble/ciphers/*",
|
|
25
|
+
"bs58check",
|
|
26
|
+
"bs58", // By bs58check
|
|
27
|
+
"base-x", // By bs58 - bs58check
|
|
28
|
+
] as string[];
|
|
29
|
+
|
|
30
|
+
export default defineConfig(
|
|
31
|
+
(
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
entry,
|
|
35
|
+
deps: {
|
|
36
|
+
onlyBundle: [] as string[],
|
|
37
|
+
},
|
|
38
|
+
format: "esm",
|
|
39
|
+
copy: "./misc/basedirs/dist/*",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
entry,
|
|
43
|
+
deps: {
|
|
44
|
+
alwaysBundle: bundleDeps,
|
|
45
|
+
onlyBundle: bundleDeps,
|
|
46
|
+
},
|
|
47
|
+
format: "cjs",
|
|
48
|
+
outDir: "dist.commonjs",
|
|
49
|
+
copy: "./misc/basedirs/dist.commonjs/*",
|
|
50
|
+
},
|
|
51
|
+
] as const
|
|
52
|
+
).map((c) => ({ ...c, ...common })),
|
|
53
|
+
);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Client } from "../client/index.js";
|
|
2
|
-
import { type AddressLike } from "./index.js";
|
|
3
|
-
/**
|
|
4
|
-
* Parses an address string into an address information object.
|
|
5
|
-
*
|
|
6
|
-
* @param address - The address string to parse.
|
|
7
|
-
* @returns An object containing the address prefix, address format, and payload array.
|
|
8
|
-
*
|
|
9
|
-
* @throws Will throw an error if the address format is unknown.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const addressInfo = addressPayloadFromString("ckt1112139193129");
|
|
14
|
-
* console.log(addressInfo.prefix); // Outputs the address prefix
|
|
15
|
-
* console.log(addressInfo.format); // Outputs the address format
|
|
16
|
-
* console.log(addressInfo.payload); // Outputs the payload array
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function addressPayloadFromString(address: string): {
|
|
20
|
-
prefix: string;
|
|
21
|
-
format: AddressFormat;
|
|
22
|
-
payload: number[];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Converts an address payload into an address-like object.
|
|
26
|
-
*
|
|
27
|
-
* @param prefix - The address prefix.
|
|
28
|
-
* @param format - The format of the address, as defined by the AddressFormat enum.
|
|
29
|
-
* @param payload - The payload array containing the address data.
|
|
30
|
-
* @param client - The client instance used to fetch known scripts.
|
|
31
|
-
* @returns A promise that resolves to an AddressLike object.
|
|
32
|
-
*
|
|
33
|
-
* @throws Will throw an error if the payload length is insufficient or if the script type is unknown.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* const address = await addressFromPayload("ckt", AddressFormat.Full, [/* payload data *\/], client);
|
|
38
|
-
* console.log(address.script); // Outputs the script object
|
|
39
|
-
* console.log(address.prefix); // Outputs the address prefix
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare function addressFromPayload(prefix: string, format: AddressFormat, payload: number[], client: Client): Promise<AddressLike>;
|
|
43
|
-
export declare enum AddressFormat {
|
|
44
|
-
/**
|
|
45
|
-
* full version identifies the hashType
|
|
46
|
-
*/
|
|
47
|
-
Full = 0,
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated
|
|
50
|
-
* short version for locks with Known codeHash, deprecated
|
|
51
|
-
*/
|
|
52
|
-
Short = 1,
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated
|
|
55
|
-
* full version with hashType = "Data", deprecated
|
|
56
|
-
*/
|
|
57
|
-
FullData = 2,
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated
|
|
60
|
-
* full version with hashType = "Type", deprecated
|
|
61
|
-
*/
|
|
62
|
-
FullType = 4
|
|
63
|
-
}
|
|
64
|
-
export declare const ADDRESS_BECH32_LIMIT = 1023;
|
|
65
|
-
//# sourceMappingURL=address.advanced.d.ts.map
|