@ckb-ccc/core 0.0.12-alpha.1 → 0.0.13-alpha.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 +15 -0
- package/README.md +10 -7
- package/dist/address/index.d.ts +4 -0
- package/dist/address/index.d.ts.map +1 -1
- package/dist/address/index.js +1 -0
- package/dist/advancedBarrel.d.ts +1 -0
- package/dist/advancedBarrel.d.ts.map +1 -1
- package/dist/advancedBarrel.js +1 -0
- package/dist/bytes/advanced.d.ts +1 -0
- package/dist/bytes/advanced.d.ts.map +1 -1
- package/dist/bytes/index.d.ts +9 -0
- package/dist/bytes/index.d.ts.map +1 -1
- package/dist/bytes/index.js +3 -0
- package/dist/ckb/index.d.ts +1 -0
- package/dist/ckb/index.d.ts.map +1 -1
- package/dist/ckb/index.js +1 -0
- package/dist/ckb/script.d.ts +15 -0
- package/dist/ckb/script.d.ts.map +1 -1
- package/dist/ckb/script.js +6 -0
- package/dist/ckb/transaction.d.ts +65 -11
- package/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +41 -14
- package/dist/ckb/transactionLumos.d.ts +29 -0
- package/dist/ckb/transactionLumos.d.ts.map +1 -0
- package/dist/ckb/transactionLumos.js +1 -0
- package/dist/client/client.d.ts +13 -1
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +10 -1
- package/dist/client/clientPublicMainnet.d.ts +3 -0
- package/dist/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist/client/clientPublicMainnet.js +3 -0
- package/dist/client/clientPublicTestnet.d.ts +3 -0
- package/dist/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist/client/clientPublicTestnet.js +3 -0
- package/dist/client/clientTypes.d.ts +50 -0
- package/dist/client/clientTypes.d.ts.map +1 -1
- package/dist/client/clientTypes.js +9 -0
- package/dist/client/jsonRpc/index.d.ts +6 -6
- package/dist/client/jsonRpc/index.d.ts.map +1 -1
- package/dist/client/jsonRpc/index.js +3 -3
- package/dist/client/jsonRpc/transformers.d.ts +7 -2
- package/dist/client/jsonRpc/transformers.d.ts.map +1 -1
- package/dist/client/jsonRpc/transformers.js +7 -1
- package/dist/fixedPoint/index.d.ts +6 -0
- package/dist/fixedPoint/index.d.ts.map +1 -1
- package/dist/fixedPoint/index.js +5 -0
- package/dist/hasher/hasher.d.ts +3 -0
- package/dist/hasher/hasher.d.ts.map +1 -1
- package/dist/hasher/hasherCkb.d.ts +6 -1
- package/dist/hasher/hasherCkb.d.ts.map +1 -1
- package/dist/hasher/hasherCkb.js +6 -1
- package/dist/hasher/hasherKeecak256.d.ts +3 -0
- package/dist/hasher/hasherKeecak256.d.ts.map +1 -1
- package/dist/hasher/hasherKeecak256.js +3 -0
- package/dist/hex/index.d.ts +3 -0
- package/dist/hex/index.d.ts.map +1 -1
- package/dist/hex/index.js +1 -0
- package/dist/keystore/index.d.ts +6 -0
- package/dist/keystore/index.d.ts.map +1 -1
- package/dist/keystore/index.js +6 -0
- package/dist/num/index.d.ts +11 -0
- package/dist/num/index.d.ts.map +1 -1
- package/dist/num/index.js +9 -0
- package/dist/package.json +1 -1
- package/dist/signer/btc/signerBtc.d.ts +1 -0
- package/dist/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist/signer/btc/signerBtc.js +1 -0
- package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts +1 -0
- package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
- package/dist/signer/btc/signerBtcPublicKeyReadonly.js +1 -0
- package/dist/signer/btc/verify.d.ts +3 -0
- package/dist/signer/btc/verify.d.ts.map +1 -1
- package/dist/signer/btc/verify.js +3 -0
- package/dist/signer/ckb/signerCkbPrivateKey.d.ts +3 -0
- package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
- package/dist/signer/ckb/signerCkbPrivateKey.js +3 -0
- package/dist/signer/ckb/signerCkbPublicKey.d.ts +3 -0
- package/dist/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
- package/dist/signer/ckb/signerCkbPublicKey.js +3 -0
- package/dist/signer/ckb/signerCkbScriptReadonly.d.ts +1 -0
- package/dist/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
- package/dist/signer/ckb/signerCkbScriptReadonly.js +1 -0
- package/dist/signer/ckb/verifyCkbSecp256k1.d.ts +6 -0
- package/dist/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
- package/dist/signer/ckb/verifyCkbSecp256k1.js +6 -0
- package/dist/signer/ckb/verifyJoyId.d.ts +3 -0
- package/dist/signer/ckb/verifyJoyId.d.ts.map +1 -1
- package/dist/signer/ckb/verifyJoyId.js +3 -0
- package/dist/signer/dummy/alwaysError.d.ts +3 -0
- package/dist/signer/dummy/alwaysError.d.ts.map +1 -1
- package/dist/signer/dummy/alwaysError.js +3 -0
- package/dist/signer/dummy/dummy.d.ts +3 -0
- package/dist/signer/dummy/dummy.d.ts.map +1 -1
- package/dist/signer/dummy/dummy.js +3 -0
- package/dist/signer/dummy/openLink.d.ts +3 -0
- package/dist/signer/dummy/openLink.d.ts.map +1 -1
- package/dist/signer/dummy/openLink.js +3 -0
- package/dist/signer/evm/signerEvm.d.ts +1 -0
- package/dist/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist/signer/evm/signerEvm.js +1 -0
- package/dist/signer/evm/signerEvmAddressReadonly.d.ts +1 -0
- package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
- package/dist/signer/evm/signerEvmAddressReadonly.js +1 -0
- package/dist/signer/evm/verify.d.ts +3 -0
- package/dist/signer/evm/verify.d.ts.map +1 -1
- package/dist/signer/evm/verify.js +3 -0
- package/dist/signer/nostr/signerNostr.d.ts +6 -0
- package/dist/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist/signer/nostr/signerNostr.js +3 -0
- package/dist/signer/nostr/verify.d.ts +3 -0
- package/dist/signer/nostr/verify.d.ts.map +1 -1
- package/dist/signer/nostr/verify.js +3 -0
- package/dist/signer/signer/index.d.ts +26 -3
- package/dist/signer/signer/index.d.ts.map +1 -1
- package/dist/signer/signer/index.js +12 -3
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +13 -0
- package/dist.commonjs/address/index.d.ts +4 -0
- package/dist.commonjs/address/index.d.ts.map +1 -1
- package/dist.commonjs/address/index.js +1 -0
- package/dist.commonjs/advancedBarrel.d.ts +1 -0
- package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
- package/dist.commonjs/advancedBarrel.js +1 -0
- package/dist.commonjs/bytes/advanced.d.ts +1 -0
- package/dist.commonjs/bytes/advanced.d.ts.map +1 -1
- package/dist.commonjs/bytes/index.d.ts +9 -0
- package/dist.commonjs/bytes/index.d.ts.map +1 -1
- package/dist.commonjs/bytes/index.js +3 -0
- package/dist.commonjs/ckb/index.d.ts +1 -0
- package/dist.commonjs/ckb/index.d.ts.map +1 -1
- package/dist.commonjs/ckb/index.js +1 -0
- package/dist.commonjs/ckb/script.d.ts +15 -0
- package/dist.commonjs/ckb/script.d.ts.map +1 -1
- package/dist.commonjs/ckb/script.js +6 -0
- package/dist.commonjs/ckb/transaction.d.ts +65 -11
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +41 -14
- package/dist.commonjs/ckb/transactionLumos.d.ts +29 -0
- package/dist.commonjs/ckb/transactionLumos.d.ts.map +1 -0
- package/dist.commonjs/ckb/transactionLumos.js +2 -0
- package/dist.commonjs/client/client.d.ts +13 -1
- package/dist.commonjs/client/client.d.ts.map +1 -1
- package/dist.commonjs/client/client.js +10 -1
- package/dist.commonjs/client/clientPublicMainnet.d.ts +3 -0
- package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicMainnet.js +3 -0
- package/dist.commonjs/client/clientPublicTestnet.d.ts +3 -0
- package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicTestnet.js +3 -0
- package/dist.commonjs/client/clientTypes.d.ts +50 -0
- package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
- package/dist.commonjs/client/clientTypes.js +9 -0
- package/dist.commonjs/client/jsonRpc/index.d.ts +6 -6
- package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
- package/dist.commonjs/client/jsonRpc/index.js +3 -3
- package/dist.commonjs/client/jsonRpc/transformers.d.ts +7 -2
- package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +1 -1
- package/dist.commonjs/client/jsonRpc/transformers.js +35 -29
- package/dist.commonjs/fixedPoint/index.d.ts +6 -0
- package/dist.commonjs/fixedPoint/index.d.ts.map +1 -1
- package/dist.commonjs/fixedPoint/index.js +5 -0
- package/dist.commonjs/hasher/hasher.d.ts +3 -0
- package/dist.commonjs/hasher/hasher.d.ts.map +1 -1
- package/dist.commonjs/hasher/hasherCkb.d.ts +6 -1
- package/dist.commonjs/hasher/hasherCkb.d.ts.map +1 -1
- package/dist.commonjs/hasher/hasherCkb.js +6 -1
- package/dist.commonjs/hasher/hasherKeecak256.d.ts +3 -0
- package/dist.commonjs/hasher/hasherKeecak256.d.ts.map +1 -1
- package/dist.commonjs/hasher/hasherKeecak256.js +3 -0
- package/dist.commonjs/hex/index.d.ts +3 -0
- package/dist.commonjs/hex/index.d.ts.map +1 -1
- package/dist.commonjs/hex/index.js +1 -0
- package/dist.commonjs/keystore/index.d.ts +6 -0
- package/dist.commonjs/keystore/index.d.ts.map +1 -1
- package/dist.commonjs/keystore/index.js +6 -0
- package/dist.commonjs/num/index.d.ts +11 -0
- package/dist.commonjs/num/index.d.ts.map +1 -1
- package/dist.commonjs/num/index.js +9 -0
- package/dist.commonjs/signer/btc/signerBtc.d.ts +1 -0
- package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/signerBtc.js +1 -0
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +1 -0
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +1 -0
- package/dist.commonjs/signer/btc/verify.d.ts +3 -0
- package/dist.commonjs/signer/btc/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/verify.js +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +3 -0
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +1 -0
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +1 -0
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +6 -0
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +6 -0
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +3 -0
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/verifyJoyId.js +3 -0
- package/dist.commonjs/signer/dummy/alwaysError.d.ts +3 -0
- package/dist.commonjs/signer/dummy/alwaysError.d.ts.map +1 -1
- package/dist.commonjs/signer/dummy/alwaysError.js +3 -0
- package/dist.commonjs/signer/dummy/dummy.d.ts +3 -0
- package/dist.commonjs/signer/dummy/dummy.d.ts.map +1 -1
- package/dist.commonjs/signer/dummy/dummy.js +3 -0
- package/dist.commonjs/signer/dummy/openLink.d.ts +3 -0
- package/dist.commonjs/signer/dummy/openLink.d.ts.map +1 -1
- package/dist.commonjs/signer/dummy/openLink.js +3 -0
- package/dist.commonjs/signer/evm/signerEvm.d.ts +1 -0
- package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/signerEvm.js +1 -0
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +1 -0
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +1 -0
- package/dist.commonjs/signer/evm/verify.d.ts +3 -0
- package/dist.commonjs/signer/evm/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/verify.js +3 -0
- package/dist.commonjs/signer/nostr/signerNostr.d.ts +6 -0
- package/dist.commonjs/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist.commonjs/signer/nostr/signerNostr.js +3 -0
- package/dist.commonjs/signer/nostr/verify.d.ts +3 -0
- package/dist.commonjs/signer/nostr/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/nostr/verify.js +3 -0
- package/dist.commonjs/signer/signer/index.d.ts +26 -3
- package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
- package/dist.commonjs/signer/signer/index.js +12 -3
- package/dist.commonjs/utils/index.d.ts +12 -0
- package/dist.commonjs/utils/index.d.ts.map +1 -1
- package/dist.commonjs/utils/index.js +13 -0
- package/package.json +8 -10
- package/src/address/index.ts +4 -1
- package/src/advancedBarrel.ts +1 -0
- package/src/bytes/advanced.ts +1 -0
- package/src/bytes/index.ts +9 -0
- package/src/ckb/index.ts +1 -0
- package/src/ckb/script.ts +15 -0
- package/src/ckb/transaction.ts +72 -16
- package/src/ckb/transactionLumos.ts +26 -0
- package/src/client/client.ts +13 -1
- package/src/client/clientPublicMainnet.ts +3 -0
- package/src/client/clientPublicTestnet.ts +3 -0
- package/src/client/clientTypes.ts +50 -0
- package/src/client/jsonRpc/index.ts +5 -6
- package/src/client/jsonRpc/transformers.ts +16 -3
- package/src/fixedPoint/index.ts +6 -0
- package/src/hasher/hasher.ts +3 -0
- package/src/hasher/hasherCkb.ts +6 -1
- package/src/hasher/hasherKeecak256.ts +3 -0
- package/src/hex/index.ts +3 -0
- package/src/keystore/index.ts +6 -0
- package/src/num/index.ts +11 -0
- package/src/signer/btc/signerBtc.ts +1 -0
- package/src/signer/btc/signerBtcPublicKeyReadonly.ts +1 -0
- package/src/signer/btc/verify.ts +3 -0
- package/src/signer/ckb/signerCkbPrivateKey.ts +3 -0
- package/src/signer/ckb/signerCkbPublicKey.ts +3 -0
- package/src/signer/ckb/signerCkbScriptReadonly.ts +1 -0
- package/src/signer/ckb/verifyCkbSecp256k1.ts +6 -0
- package/src/signer/ckb/verifyJoyId.ts +3 -0
- package/src/signer/dummy/alwaysError.ts +3 -0
- package/src/signer/dummy/dummy.ts +3 -0
- package/src/signer/dummy/openLink.ts +3 -0
- package/src/signer/evm/signerEvm.ts +1 -0
- package/src/signer/evm/signerEvmAddressReadonly.ts +1 -0
- package/src/signer/evm/verify.ts +3 -0
- package/src/signer/nostr/signerNostr.ts +6 -0
- package/src/signer/nostr/verify.ts +3 -0
- package/src/signer/signer/index.ts +26 -14
- package/src/utils/index.ts +22 -0
- package/typedoc.json +6 -0
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JsonRpcTransformers = void 0;
|
|
4
4
|
const index_js_1 = require("../../ckb/index.js");
|
|
5
|
-
const index_js_2 = require("../../
|
|
6
|
-
const index_js_3 = require("../../
|
|
5
|
+
const index_js_2 = require("../../hex/index.js");
|
|
6
|
+
const index_js_3 = require("../../num/index.js");
|
|
7
|
+
const index_js_4 = require("../../utils/index.js");
|
|
7
8
|
const clientTypes_js_1 = require("../clientTypes.js");
|
|
8
9
|
class JsonRpcTransformers {
|
|
9
10
|
static hashTypeFrom(hashType) {
|
|
@@ -46,7 +47,7 @@ class JsonRpcTransformers {
|
|
|
46
47
|
static outPointFrom(outPointLike) {
|
|
47
48
|
const outPoint = index_js_1.OutPoint.from(outPointLike);
|
|
48
49
|
return {
|
|
49
|
-
index: (0,
|
|
50
|
+
index: (0, index_js_3.numToHex)(outPoint.index),
|
|
50
51
|
tx_hash: outPoint.txHash,
|
|
51
52
|
};
|
|
52
53
|
}
|
|
@@ -60,7 +61,7 @@ class JsonRpcTransformers {
|
|
|
60
61
|
const cellInput = index_js_1.CellInput.from(cellInputLike);
|
|
61
62
|
return {
|
|
62
63
|
previous_output: JsonRpcTransformers.outPointFrom(cellInput.previousOutput),
|
|
63
|
-
since: (0,
|
|
64
|
+
since: (0, index_js_3.numToHex)(cellInput.since),
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
67
|
static cellInputTo(cellInput) {
|
|
@@ -71,16 +72,16 @@ class JsonRpcTransformers {
|
|
|
71
72
|
}
|
|
72
73
|
static cellOutputFrom(cellOutput) {
|
|
73
74
|
return {
|
|
74
|
-
capacity: (0,
|
|
75
|
+
capacity: (0, index_js_3.numToHex)(cellOutput.capacity),
|
|
75
76
|
lock: JsonRpcTransformers.scriptFrom(cellOutput.lock),
|
|
76
|
-
type: (0,
|
|
77
|
+
type: (0, index_js_4.apply)(JsonRpcTransformers.scriptFrom, cellOutput.type),
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
static cellOutputTo(cellOutput) {
|
|
80
81
|
return index_js_1.CellOutput.from({
|
|
81
82
|
capacity: cellOutput.capacity,
|
|
82
83
|
lock: JsonRpcTransformers.scriptTo(cellOutput.lock),
|
|
83
|
-
type: (0,
|
|
84
|
+
type: (0, index_js_4.apply)(JsonRpcTransformers.scriptTo, cellOutput.type),
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
static cellDepFrom(cellDep) {
|
|
@@ -98,7 +99,7 @@ class JsonRpcTransformers {
|
|
|
98
99
|
static transactionFrom(txLike) {
|
|
99
100
|
const tx = index_js_1.Transaction.from(txLike);
|
|
100
101
|
return {
|
|
101
|
-
version: (0,
|
|
102
|
+
version: (0, index_js_3.numToHex)(tx.version),
|
|
102
103
|
cell_deps: tx.cellDeps.map((c) => JsonRpcTransformers.cellDepFrom(c)),
|
|
103
104
|
header_deps: tx.headerDeps,
|
|
104
105
|
inputs: tx.inputs.map((i) => JsonRpcTransformers.cellInputFrom(i)),
|
|
@@ -118,29 +119,34 @@ class JsonRpcTransformers {
|
|
|
118
119
|
witnesses: tx.witnesses,
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
|
-
static transactionResponseTo({ tx_status: { status }, transaction, }) {
|
|
122
|
+
static transactionResponseTo({ cycles, tx_status: { status, block_number, block_hash, tx_index, reason }, transaction, }) {
|
|
122
123
|
if (transaction == null) {
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
126
|
return {
|
|
126
127
|
transaction: JsonRpcTransformers.transactionTo(transaction),
|
|
127
128
|
status,
|
|
129
|
+
cycles: (0, index_js_4.apply)(index_js_3.numFrom, cycles),
|
|
130
|
+
blockHash: (0, index_js_4.apply)(index_js_2.hexFrom, block_hash),
|
|
131
|
+
blockNumber: (0, index_js_4.apply)(index_js_3.numFrom, block_number),
|
|
132
|
+
txIndex: (0, index_js_4.apply)(index_js_3.numFrom, tx_index),
|
|
133
|
+
reason,
|
|
128
134
|
};
|
|
129
135
|
}
|
|
130
136
|
static blockHeaderTo(header) {
|
|
131
137
|
return {
|
|
132
|
-
compactTarget: (0,
|
|
138
|
+
compactTarget: (0, index_js_3.numFrom)(header.compact_target),
|
|
133
139
|
dao: header.dao,
|
|
134
|
-
epoch: (0,
|
|
140
|
+
epoch: (0, index_js_3.numFrom)(header.epoch),
|
|
135
141
|
extraHash: header.extra_hash,
|
|
136
142
|
hash: header.hash,
|
|
137
|
-
nonce: (0,
|
|
138
|
-
number: (0,
|
|
143
|
+
nonce: (0, index_js_3.numFrom)(header.nonce),
|
|
144
|
+
number: (0, index_js_3.numFrom)(header.number),
|
|
139
145
|
parentHash: header.parent_hash,
|
|
140
146
|
proposalsHash: header.proposals_hash,
|
|
141
|
-
timestamp: (0,
|
|
147
|
+
timestamp: (0, index_js_3.numFrom)(header.timestamp),
|
|
142
148
|
transactionsRoot: header.transactions_root,
|
|
143
|
-
version: (0,
|
|
149
|
+
version: (0, index_js_3.numFrom)(header.version),
|
|
144
150
|
};
|
|
145
151
|
}
|
|
146
152
|
static blockUncleTo(block) {
|
|
@@ -158,17 +164,17 @@ class JsonRpcTransformers {
|
|
|
158
164
|
};
|
|
159
165
|
}
|
|
160
166
|
static rangeFrom([a, b]) {
|
|
161
|
-
return [(0,
|
|
167
|
+
return [(0, index_js_3.numToHex)(a), (0, index_js_3.numToHex)(b)];
|
|
162
168
|
}
|
|
163
169
|
static indexerSearchKeyFilterFrom(filter) {
|
|
164
170
|
return {
|
|
165
|
-
script: (0,
|
|
166
|
-
script_len_range: (0,
|
|
171
|
+
script: (0, index_js_4.apply)(JsonRpcTransformers.scriptFrom, filter.script),
|
|
172
|
+
script_len_range: (0, index_js_4.apply)(JsonRpcTransformers.rangeFrom, filter.scriptLenRange),
|
|
167
173
|
output_data: filter.outputData,
|
|
168
174
|
output_data_filter_mode: filter.outputDataSearchMode,
|
|
169
|
-
output_data_len_range: (0,
|
|
170
|
-
output_capacity_range: (0,
|
|
171
|
-
block_range: (0,
|
|
175
|
+
output_data_len_range: (0, index_js_4.apply)(JsonRpcTransformers.rangeFrom, filter.outputDataLenRange),
|
|
176
|
+
output_capacity_range: (0, index_js_4.apply)(JsonRpcTransformers.rangeFrom, filter.outputCapacityRange),
|
|
177
|
+
block_range: (0, index_js_4.apply)(JsonRpcTransformers.rangeFrom, filter.blockRange),
|
|
172
178
|
};
|
|
173
179
|
}
|
|
174
180
|
static indexerSearchKeyFrom(keyLike) {
|
|
@@ -177,7 +183,7 @@ class JsonRpcTransformers {
|
|
|
177
183
|
script: JsonRpcTransformers.scriptFrom(key.script),
|
|
178
184
|
script_type: key.scriptType,
|
|
179
185
|
script_search_mode: key.scriptSearchMode,
|
|
180
|
-
filter: (0,
|
|
186
|
+
filter: (0, index_js_4.apply)(JsonRpcTransformers.indexerSearchKeyFilterFrom, key.filter),
|
|
181
187
|
with_data: key.withData,
|
|
182
188
|
};
|
|
183
189
|
}
|
|
@@ -197,7 +203,7 @@ class JsonRpcTransformers {
|
|
|
197
203
|
script: JsonRpcTransformers.scriptFrom(key.script),
|
|
198
204
|
script_type: key.scriptType,
|
|
199
205
|
script_search_mode: key.scriptSearchMode,
|
|
200
|
-
filter: (0,
|
|
206
|
+
filter: (0, index_js_4.apply)(JsonRpcTransformers.indexerSearchKeyFilterFrom, key.filter),
|
|
201
207
|
group_by_transaction: key.groupByTransaction,
|
|
202
208
|
};
|
|
203
209
|
}
|
|
@@ -213,9 +219,9 @@ class JsonRpcTransformers {
|
|
|
213
219
|
lastCursor: last_cursor,
|
|
214
220
|
transactions: objects.map((tx) => ({
|
|
215
221
|
txHash: tx.tx_hash,
|
|
216
|
-
blockNumber: (0,
|
|
217
|
-
txIndex: (0,
|
|
218
|
-
cellIndex: (0,
|
|
222
|
+
blockNumber: (0, index_js_3.numFrom)(tx.block_number),
|
|
223
|
+
txIndex: (0, index_js_3.numFrom)(tx.tx_index),
|
|
224
|
+
cellIndex: (0, index_js_3.numFrom)(tx.io_index),
|
|
219
225
|
isInput: tx.io_type === "input",
|
|
220
226
|
})),
|
|
221
227
|
};
|
|
@@ -224,11 +230,11 @@ class JsonRpcTransformers {
|
|
|
224
230
|
lastCursor: last_cursor,
|
|
225
231
|
transactions: objects.map((tx) => ({
|
|
226
232
|
txHash: tx.tx_hash,
|
|
227
|
-
blockNumber: (0,
|
|
228
|
-
txIndex: (0,
|
|
233
|
+
blockNumber: (0, index_js_3.numFrom)(tx.block_number),
|
|
234
|
+
txIndex: (0, index_js_3.numFrom)(tx.tx_index),
|
|
229
235
|
cells: tx.cells.map(([type, i]) => ({
|
|
230
236
|
isInput: type === "input",
|
|
231
|
-
cellIndex: (0,
|
|
237
|
+
cellIndex: (0, index_js_3.numFrom)(i),
|
|
232
238
|
})),
|
|
233
239
|
})),
|
|
234
240
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a fixed point value as a bigint.
|
|
3
|
+
* @public
|
|
3
4
|
*/
|
|
4
5
|
export type FixedPoint = bigint;
|
|
5
6
|
/**
|
|
6
7
|
* Represents a value that can be converted to a fixed point value.
|
|
7
8
|
* It can be a bigint, string, or number.
|
|
9
|
+
* @public
|
|
8
10
|
*/
|
|
9
11
|
export type FixedPointLike = bigint | string | number;
|
|
10
12
|
/**
|
|
11
13
|
* Converts a FixedPointLike value to its string representation with fixed-point decimals.
|
|
14
|
+
* @public
|
|
12
15
|
*
|
|
13
16
|
* @param val - The value to convert, which can be a bigint, string, or number.
|
|
14
17
|
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
|
|
@@ -24,6 +27,7 @@ export type FixedPointLike = bigint | string | number;
|
|
|
24
27
|
export declare function fixedPointToString(val: FixedPointLike, decimals?: number): string;
|
|
25
28
|
/**
|
|
26
29
|
* Converts a FixedPointLike value to a FixedPoint (bigint) with fixed-point decimals.
|
|
30
|
+
* @public
|
|
27
31
|
*
|
|
28
32
|
* @param val - The value to convert, which can be a bigint, string, or number.
|
|
29
33
|
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
|
|
@@ -39,11 +43,13 @@ export declare function fixedPointToString(val: FixedPointLike, decimals?: numbe
|
|
|
39
43
|
export declare function fixedPointFrom(val: FixedPointLike, decimals?: number): FixedPoint;
|
|
40
44
|
/**
|
|
41
45
|
* Represents the fixed point value of zero as a bigint.
|
|
46
|
+
* @public
|
|
42
47
|
*/
|
|
43
48
|
export declare const Zero: FixedPoint;
|
|
44
49
|
/**
|
|
45
50
|
* Represents the fixed point value of one as a FixedPoint (bigint).
|
|
46
51
|
* Equivalent to 1 in fixed-point representation with default decimals (8).
|
|
52
|
+
* @public
|
|
47
53
|
*/
|
|
48
54
|
export declare const One: FixedPoint;
|
|
49
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixedPoint/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixedPoint/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,SAAI,GAAG,MAAM,CAa5E;AAED;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,SAAI,GAAG,UAAU,CAc5E;AAED;;;GAGG;AAEH,eAAO,MAAM,IAAI,EAAE,UAAe,CAAC;AAEnC;;;;GAIG;AAEH,eAAO,MAAM,GAAG,EAAE,UAAgC,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Represents a fixed point value as a bigint.
|
|
4
|
+
* @public
|
|
4
5
|
*/
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
7
|
exports.One = exports.Zero = exports.fixedPointFrom = exports.fixedPointToString = void 0;
|
|
7
8
|
/**
|
|
8
9
|
* Converts a FixedPointLike value to its string representation with fixed-point decimals.
|
|
10
|
+
* @public
|
|
9
11
|
*
|
|
10
12
|
* @param val - The value to convert, which can be a bigint, string, or number.
|
|
11
13
|
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
|
|
@@ -33,6 +35,7 @@ function fixedPointToString(val, decimals = 8) {
|
|
|
33
35
|
exports.fixedPointToString = fixedPointToString;
|
|
34
36
|
/**
|
|
35
37
|
* Converts a FixedPointLike value to a FixedPoint (bigint) with fixed-point decimals.
|
|
38
|
+
* @public
|
|
36
39
|
*
|
|
37
40
|
* @param val - The value to convert, which can be a bigint, string, or number.
|
|
38
41
|
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
|
|
@@ -59,10 +62,12 @@ function fixedPointFrom(val, decimals = 8) {
|
|
|
59
62
|
exports.fixedPointFrom = fixedPointFrom;
|
|
60
63
|
/**
|
|
61
64
|
* Represents the fixed point value of zero as a bigint.
|
|
65
|
+
* @public
|
|
62
66
|
*/
|
|
63
67
|
exports.Zero = 0n;
|
|
64
68
|
/**
|
|
65
69
|
* Represents the fixed point value of one as a FixedPoint (bigint).
|
|
66
70
|
* Equivalent to 1 in fixed-point representation with default decimals (8).
|
|
71
|
+
* @public
|
|
67
72
|
*/
|
|
68
73
|
exports.One = fixedPointFrom("1");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../src/hasher/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,WAAW,MAAM;IACrB;;;;;;;;;;;;OAYG;IAEH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAEhC;;;;;;;;;;;OAWG;IAEH,MAAM,IAAI,GAAG,CAAC;CACf"}
|
|
1
|
+
{"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../src/hasher/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;;;;OAYG;IAEH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAEhC;;;;;;;;;;;OAWG;IAEH,MAAM,IAAI,GAAG,CAAC;CACf"}
|
|
@@ -3,6 +3,9 @@ import { CellInputLike } from "../ckb/index.js";
|
|
|
3
3
|
import { Hex } from "../hex/index.js";
|
|
4
4
|
import { NumLike } from "../num/index.js";
|
|
5
5
|
import { Hasher } from "./hasher.js";
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
export declare class HasherCkb implements Hasher {
|
|
7
10
|
private readonly hasher;
|
|
8
11
|
/**
|
|
@@ -42,6 +45,7 @@ export declare class HasherCkb implements Hasher {
|
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Computes the CKB hash of the given data using the Blake2b algorithm.
|
|
48
|
+
* @public
|
|
45
49
|
*
|
|
46
50
|
* @param data - The data to hash.
|
|
47
51
|
* @returns The hexadecimal string representation of the hash.
|
|
@@ -54,8 +58,9 @@ export declare class HasherCkb implements Hasher {
|
|
|
54
58
|
export declare function hashCkb(...data: BytesLike[]): Hex;
|
|
55
59
|
/**
|
|
56
60
|
* Computes the Type ID hash of the given data.
|
|
61
|
+
* @public
|
|
57
62
|
*
|
|
58
|
-
* @param
|
|
63
|
+
* @param cellInputLike - The first cell input of the transaction.
|
|
59
64
|
* @param outputIndex - The output index of the Type ID cell.
|
|
60
65
|
* @returns The hexadecimal string representation of the hash.
|
|
61
66
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasherCkb.d.ts","sourceRoot":"","sources":["../../src/hasher/hasherCkb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAa,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAgB,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,qBAAa,SAAU,YAAW,MAAM;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAEhE;;;;;OAKG;gBAES,SAAS,SAAK,EAAE,QAAQ,SAAuB;IAO3D;;;;;;;;;;;;OAYG;IAEH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS;IAKlC;;;;;;;;;;;OAWG;IAEH,MAAM,IAAI,GAAG;CAGd;AAED
|
|
1
|
+
{"version":3,"file":"hasherCkb.d.ts","sourceRoot":"","sources":["../../src/hasher/hasherCkb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAa,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAgB,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,qBAAa,SAAU,YAAW,MAAM;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAEhE;;;;;OAKG;gBAES,SAAS,SAAK,EAAE,QAAQ,SAAuB;IAO3D;;;;;;;;;;;;OAYG;IAEH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS;IAKlC;;;;;;;;;;;OAWG;IAEH,MAAM,IAAI,GAAG;CAGd;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,OAAO,CAAC,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,CAIjD;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,UAAU,CACxB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,OAAO,GACnB,GAAG,CAKL"}
|
|
@@ -7,6 +7,9 @@ const index_js_2 = require("../ckb/index.js");
|
|
|
7
7
|
const index_js_3 = require("../hex/index.js");
|
|
8
8
|
const index_js_4 = require("../num/index.js");
|
|
9
9
|
const advanced_js_1 = require("./advanced.js");
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
10
13
|
class HasherCkb {
|
|
11
14
|
/**
|
|
12
15
|
* Creates an instance of Hasher.
|
|
@@ -56,6 +59,7 @@ class HasherCkb {
|
|
|
56
59
|
exports.HasherCkb = HasherCkb;
|
|
57
60
|
/**
|
|
58
61
|
* Computes the CKB hash of the given data using the Blake2b algorithm.
|
|
62
|
+
* @public
|
|
59
63
|
*
|
|
60
64
|
* @param data - The data to hash.
|
|
61
65
|
* @returns The hexadecimal string representation of the hash.
|
|
@@ -73,8 +77,9 @@ function hashCkb(...data) {
|
|
|
73
77
|
exports.hashCkb = hashCkb;
|
|
74
78
|
/**
|
|
75
79
|
* Computes the Type ID hash of the given data.
|
|
80
|
+
* @public
|
|
76
81
|
*
|
|
77
|
-
* @param
|
|
82
|
+
* @param cellInputLike - The first cell input of the transaction.
|
|
78
83
|
* @param outputIndex - The output index of the Type ID cell.
|
|
79
84
|
* @returns The hexadecimal string representation of the hash.
|
|
80
85
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasherKeecak256.d.ts","sourceRoot":"","sources":["../../src/hasher/hasherKeecak256.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,qBAAa,eAAgB,YAAW,MAAM;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE;;OAEG;;IAMH;;;;;;;;;;;;OAYG;IAEH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe;IAKxC;;;;;;;;;;;OAWG;IAEH,MAAM,IAAI,GAAG;CAGd"}
|
|
1
|
+
{"version":3,"file":"hasherKeecak256.d.ts","sourceRoot":"","sources":["../../src/hasher/hasherKeecak256.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,qBAAa,eAAgB,YAAW,MAAM;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE;;OAEG;;IAMH;;;;;;;;;;;;OAYG;IAEH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe;IAKxC;;;;;;;;;;;OAWG;IAEH,MAAM,IAAI,GAAG;CAGd"}
|
|
@@ -4,6 +4,9 @@ exports.HasherKeecak256 = void 0;
|
|
|
4
4
|
const sha3_1 = require("@noble/hashes/sha3");
|
|
5
5
|
const index_js_1 = require("../bytes/index.js");
|
|
6
6
|
const index_js_2 = require("../hex/index.js");
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
7
10
|
class HasherKeecak256 {
|
|
8
11
|
/**
|
|
9
12
|
* Creates an instance of Hasher.
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { BytesLike } from "../bytes/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Represents a hexadecimal string prefixed with "0x".
|
|
4
|
+
* @public
|
|
4
5
|
*/
|
|
5
6
|
export type Hex = `0x${string}`;
|
|
6
7
|
/**
|
|
7
8
|
* Represents a value that can be converted to a hexadecimal string.
|
|
8
9
|
* It extends the BytesLike type.
|
|
10
|
+
* @public
|
|
9
11
|
*/
|
|
10
12
|
export type HexLike = BytesLike;
|
|
11
13
|
/**
|
|
12
14
|
* Converts a HexLike value to a Hex string.
|
|
15
|
+
* @public
|
|
13
16
|
*
|
|
14
17
|
* @param hex - The value to convert, which can be a string, Uint8Array, ArrayBuffer, or number array.
|
|
15
18
|
* @returns A Hex string representing the value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hex/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAW,MAAM,mBAAmB,CAAC;AAElE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hex/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAW,MAAM,mBAAmB,CAAC;AAElE;;;GAGG;AACH,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAChC;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC;AAEhC;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,CAEzC"}
|
|
@@ -4,6 +4,7 @@ exports.hexFrom = void 0;
|
|
|
4
4
|
const index_js_1 = require("../bytes/index.js");
|
|
5
5
|
/**
|
|
6
6
|
* Converts a HexLike value to a Hex string.
|
|
7
|
+
* @public
|
|
7
8
|
*
|
|
8
9
|
* @param hex - The value to convert, which can be a string, Uint8Array, ArrayBuffer, or number array.
|
|
9
10
|
* @returns A Hex string representing the value.
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Bytes, BytesLike } from "../bytes/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
2
5
|
export declare function keystoreEncrypt(privateKeyLike: BytesLike, chainCodeLike: BytesLike, password: string): Promise<{
|
|
3
6
|
id: string;
|
|
4
7
|
crypto: {
|
|
@@ -18,6 +21,9 @@ export declare function keystoreEncrypt(privateKeyLike: BytesLike, chainCodeLike
|
|
|
18
21
|
mac: string;
|
|
19
22
|
};
|
|
20
23
|
}>;
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
21
27
|
export declare function keystoreDecrypt(keystore: unknown, password: string): Promise<{
|
|
22
28
|
privateKey: Bytes;
|
|
23
29
|
chainCode: Bytes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keystore/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,SAAS,EAA0B,MAAM,mBAAmB,CAAC;AAgB7E,wBAAsB,eAAe,CACnC,cAAc,EAAE,SAAS,EACzB,aAAa,EAAE,SAAS,EACxB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IACT,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE;YACZ,EAAE,EAAE,MAAM,CAAC;SACZ,CAAC;QACF,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE;YACT,CAAC,EAAE,MAAM,CAAC;YACV,CAAC,EAAE,MAAM,CAAC;YACV,CAAC,EAAE,MAAM,CAAC;YACV,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,CAAC,CAqCD;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IACT,UAAU,EAAE,KAAK,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC;CAClB,CAAC,CAoED"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keystore/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,SAAS,EAA0B,MAAM,mBAAmB,CAAC;AAgB7E;;GAEG;AACH,wBAAsB,eAAe,CACnC,cAAc,EAAE,SAAS,EACzB,aAAa,EAAE,SAAS,EACxB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IACT,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE;YACZ,EAAE,EAAE,MAAM,CAAC;SACZ,CAAC;QACF,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE;YACT,CAAC,EAAE,MAAM,CAAC;YACV,CAAC,EAAE,MAAM,CAAC;YACV,CAAC,EAAE,MAAM,CAAC;YACV,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,CAAC,CAqCD;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IACT,UAAU,EAAE,KAAK,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC;CAClB,CAAC,CAoED"}
|
|
@@ -16,6 +16,9 @@ const DEFAULT_SCRYPT_PARAM_N = 262144;
|
|
|
16
16
|
function mac(derivedKey, cipherText) {
|
|
17
17
|
return (0, index_js_2.hexFrom)((0, sha3_1.keccak_256)((0, index_js_1.bytesConcat)(derivedKey.slice(16, 32), cipherText))).slice(2);
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
19
22
|
async function keystoreEncrypt(privateKeyLike, chainCodeLike, password) {
|
|
20
23
|
const salt = (0, utils_1.randomBytes)(32);
|
|
21
24
|
const iv = (0, utils_1.randomBytes)(16);
|
|
@@ -49,6 +52,9 @@ async function keystoreEncrypt(privateKeyLike, chainCodeLike, password) {
|
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
54
|
exports.keystoreEncrypt = keystoreEncrypt;
|
|
55
|
+
/**
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
52
58
|
async function keystoreDecrypt(keystore, password) {
|
|
53
59
|
if (typeof keystore !== "object" ||
|
|
54
60
|
keystore === null ||
|
|
@@ -2,15 +2,18 @@ import { Bytes, BytesLike } from "../bytes/index.js";
|
|
|
2
2
|
import { Hex, HexLike } from "../hex/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a numeric value as a bigint.
|
|
5
|
+
* @public
|
|
5
6
|
*/
|
|
6
7
|
export type Num = bigint;
|
|
7
8
|
/**
|
|
8
9
|
* Represents a value that can be converted to a numeric value.
|
|
9
10
|
* It can be a string, number, bigint, or HexLike.
|
|
11
|
+
* @public
|
|
10
12
|
*/
|
|
11
13
|
export type NumLike = string | number | bigint | HexLike;
|
|
12
14
|
/**
|
|
13
15
|
* Get the max among all numbers.
|
|
16
|
+
* @public
|
|
14
17
|
*
|
|
15
18
|
* @param numbers - numbers.
|
|
16
19
|
* @returns The max numbers among them.
|
|
@@ -23,6 +26,7 @@ export type NumLike = string | number | bigint | HexLike;
|
|
|
23
26
|
export declare function numMax(a: NumLike, ...numbers: NumLike[]): Num;
|
|
24
27
|
/**
|
|
25
28
|
* Converts a NumLike value to a Num (bigint).
|
|
29
|
+
* @public
|
|
26
30
|
*
|
|
27
31
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
28
32
|
* @returns A Num (bigint) representing the value.
|
|
@@ -36,6 +40,7 @@ export declare function numMax(a: NumLike, ...numbers: NumLike[]): Num;
|
|
|
36
40
|
export declare function numFrom(val: NumLike): Num;
|
|
37
41
|
/**
|
|
38
42
|
* Converts a NumLike value to a hexadecimal string.
|
|
43
|
+
* @public
|
|
39
44
|
*
|
|
40
45
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
41
46
|
* @returns A Hex string representing the numeric value.
|
|
@@ -48,6 +53,7 @@ export declare function numFrom(val: NumLike): Num;
|
|
|
48
53
|
export declare function numToHex(val: NumLike): Hex;
|
|
49
54
|
/**
|
|
50
55
|
* Converts a NumLike value to a byte array in little-endian order.
|
|
56
|
+
* @public
|
|
51
57
|
*
|
|
52
58
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
53
59
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -61,6 +67,7 @@ export declare function numToHex(val: NumLike): Hex;
|
|
|
61
67
|
export declare function numToBytes(val: NumLike, bytes?: number): Bytes;
|
|
62
68
|
/**
|
|
63
69
|
* Converts a NumLike value to a byte array in little-endian order.
|
|
70
|
+
* @public
|
|
64
71
|
*
|
|
65
72
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
66
73
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -74,6 +81,7 @@ export declare function numToBytes(val: NumLike, bytes?: number): Bytes;
|
|
|
74
81
|
export declare function numLeToBytes(val: NumLike, bytes?: number): Bytes;
|
|
75
82
|
/**
|
|
76
83
|
* Converts a NumLike value to a byte array in big-endian order.
|
|
84
|
+
* @public
|
|
77
85
|
*
|
|
78
86
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
79
87
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -87,6 +95,7 @@ export declare function numLeToBytes(val: NumLike, bytes?: number): Bytes;
|
|
|
87
95
|
export declare function numBeToBytes(val: NumLike, bytes?: number): Bytes;
|
|
88
96
|
/**
|
|
89
97
|
* Converts a byte array to a Num (bigint) assuming little-endian order.
|
|
98
|
+
* @public
|
|
90
99
|
*
|
|
91
100
|
* @param val - The byte array to convert.
|
|
92
101
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -99,6 +108,7 @@ export declare function numBeToBytes(val: NumLike, bytes?: number): Bytes;
|
|
|
99
108
|
export declare function numFromBytes(val: BytesLike): Num;
|
|
100
109
|
/**
|
|
101
110
|
* Converts a byte array to a Num (bigint) assuming little-endian order.
|
|
111
|
+
* @public
|
|
102
112
|
*
|
|
103
113
|
* @param val - The byte array to convert.
|
|
104
114
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -111,6 +121,7 @@ export declare function numFromBytes(val: BytesLike): Num;
|
|
|
111
121
|
export declare function numLeFromBytes(val: BytesLike): Num;
|
|
112
122
|
/**
|
|
113
123
|
* Converts a byte array to a Num (bigint) assuming big-endian order.
|
|
124
|
+
* @public
|
|
114
125
|
*
|
|
115
126
|
* @param val - The byte array to convert.
|
|
116
127
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/num/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAA0B,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/num/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAA0B,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AAEzB;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAS7D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,CAUzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,CAE1C;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAE9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAEhE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAUhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,GAAG,GAAG,CAEhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,GAAG,CAElD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,GAAG,CAElD"}
|
|
@@ -5,6 +5,7 @@ const index_js_1 = require("../bytes/index.js");
|
|
|
5
5
|
const index_js_2 = require("../hex/index.js");
|
|
6
6
|
/**
|
|
7
7
|
* Get the max among all numbers.
|
|
8
|
+
* @public
|
|
8
9
|
*
|
|
9
10
|
* @param numbers - numbers.
|
|
10
11
|
* @returns The max numbers among them.
|
|
@@ -27,6 +28,7 @@ function numMax(a, ...numbers) {
|
|
|
27
28
|
exports.numMax = numMax;
|
|
28
29
|
/**
|
|
29
30
|
* Converts a NumLike value to a Num (bigint).
|
|
31
|
+
* @public
|
|
30
32
|
*
|
|
31
33
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
32
34
|
* @returns A Num (bigint) representing the value.
|
|
@@ -49,6 +51,7 @@ function numFrom(val) {
|
|
|
49
51
|
exports.numFrom = numFrom;
|
|
50
52
|
/**
|
|
51
53
|
* Converts a NumLike value to a hexadecimal string.
|
|
54
|
+
* @public
|
|
52
55
|
*
|
|
53
56
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
54
57
|
* @returns A Hex string representing the numeric value.
|
|
@@ -64,6 +67,7 @@ function numToHex(val) {
|
|
|
64
67
|
exports.numToHex = numToHex;
|
|
65
68
|
/**
|
|
66
69
|
* Converts a NumLike value to a byte array in little-endian order.
|
|
70
|
+
* @public
|
|
67
71
|
*
|
|
68
72
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
69
73
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -80,6 +84,7 @@ function numToBytes(val, bytes) {
|
|
|
80
84
|
exports.numToBytes = numToBytes;
|
|
81
85
|
/**
|
|
82
86
|
* Converts a NumLike value to a byte array in little-endian order.
|
|
87
|
+
* @public
|
|
83
88
|
*
|
|
84
89
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
85
90
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -96,6 +101,7 @@ function numLeToBytes(val, bytes) {
|
|
|
96
101
|
exports.numLeToBytes = numLeToBytes;
|
|
97
102
|
/**
|
|
98
103
|
* Converts a NumLike value to a byte array in big-endian order.
|
|
104
|
+
* @public
|
|
99
105
|
*
|
|
100
106
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
101
107
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -116,6 +122,7 @@ function numBeToBytes(val, bytes) {
|
|
|
116
122
|
exports.numBeToBytes = numBeToBytes;
|
|
117
123
|
/**
|
|
118
124
|
* Converts a byte array to a Num (bigint) assuming little-endian order.
|
|
125
|
+
* @public
|
|
119
126
|
*
|
|
120
127
|
* @param val - The byte array to convert.
|
|
121
128
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -131,6 +138,7 @@ function numFromBytes(val) {
|
|
|
131
138
|
exports.numFromBytes = numFromBytes;
|
|
132
139
|
/**
|
|
133
140
|
* Converts a byte array to a Num (bigint) assuming little-endian order.
|
|
141
|
+
* @public
|
|
134
142
|
*
|
|
135
143
|
* @param val - The byte array to convert.
|
|
136
144
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -146,6 +154,7 @@ function numLeFromBytes(val) {
|
|
|
146
154
|
exports.numLeFromBytes = numLeFromBytes;
|
|
147
155
|
/**
|
|
148
156
|
* Converts a byte array to a Num (bigint) assuming big-endian order.
|
|
157
|
+
* @public
|
|
149
158
|
*
|
|
150
159
|
* @param val - The byte array to convert.
|
|
151
160
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -6,6 +6,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
|
6
6
|
* An abstract class extending the Signer class for Bitcoin-like signing operations.
|
|
7
7
|
* This class provides methods to get Bitcoin account, public key, and internal address,
|
|
8
8
|
* as well as signing transactions.
|
|
9
|
+
* @public
|
|
9
10
|
*/
|
|
10
11
|
export declare abstract class SignerBtc extends Signer {
|
|
11
12
|
get type(): SignerType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signerBtc.d.ts","sourceRoot":"","sources":["../../../src/signer/btc/signerBtc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAW,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"signerBtc.d.ts","sourceRoot":"","sources":["../../../src/signer/btc/signerBtc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAW,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExE;;;;;GAKG;AACH,8BAAsB,SAAU,SAAQ,MAAM;IAC5C,IAAI,IAAI,IAAI,UAAU,CAErB;IAED,IAAI,QAAQ,IAAI,cAAc,CAE7B;IAED;;;;OAIG;IACH,QAAQ,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAEzC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAE5C;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAIpC;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAa1C;;;;;OAKG;IACG,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAQvE;;;;;OAKG;IACG,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;CA+BzE"}
|
|
@@ -14,6 +14,7 @@ const index_js_7 = require("../signer/index.js");
|
|
|
14
14
|
* An abstract class extending the Signer class for Bitcoin-like signing operations.
|
|
15
15
|
* This class provides methods to get Bitcoin account, public key, and internal address,
|
|
16
16
|
* as well as signing transactions.
|
|
17
|
+
* @public
|
|
17
18
|
*/
|
|
18
19
|
class SignerBtc extends index_js_7.Signer {
|
|
19
20
|
get type() {
|
|
@@ -4,6 +4,7 @@ import { SignerBtc } from "./signerBtc.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* A class extending SignerBtc that provides read-only access to a Bitcoin public key and account.
|
|
6
6
|
* This class does not support signing operations.
|
|
7
|
+
* @public
|
|
7
8
|
*/
|
|
8
9
|
export declare class SignerBtcPublicKeyReadonly extends SignerBtc {
|
|
9
10
|
private readonly account;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signerBtcPublicKeyReadonly.d.ts","sourceRoot":"","sources":["../../../src/signer/btc/signerBtcPublicKeyReadonly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"signerBtcPublicKeyReadonly.d.ts","sourceRoot":"","sources":["../../../src/signer/btc/signerBtcPublicKeyReadonly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,SAAS;IAYrD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAX1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAM;IAEhC;;;;;;OAMG;gBAED,MAAM,EAAE,MAAM,EACG,OAAO,EAAE,MAAM,EAChC,SAAS,EAAE,OAAO;IAOpB;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrC;;;;;;;;;OASG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;;;;;;;;OASG;IACG,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;CAGtC"}
|
|
@@ -6,6 +6,7 @@ const signerBtc_js_1 = require("./signerBtc.js");
|
|
|
6
6
|
/**
|
|
7
7
|
* A class extending SignerBtc that provides read-only access to a Bitcoin public key and account.
|
|
8
8
|
* This class does not support signing operations.
|
|
9
|
+
* @public
|
|
9
10
|
*/
|
|
10
11
|
class SignerBtcPublicKeyReadonly extends signerBtc_js_1.SignerBtc {
|
|
11
12
|
/**
|