@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
|
@@ -8,23 +8,43 @@ import {
|
|
|
8
8
|
clientSearchKeyRangeFrom,
|
|
9
9
|
} from "./clientTypes.advanced.js";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
11
14
|
export type OutputsValidator = "passthrough" | "well_known_scripts_only";
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
13
19
|
export type TransactionStatus =
|
|
14
20
|
| "pending"
|
|
15
21
|
| "proposed"
|
|
16
22
|
| "committed"
|
|
17
23
|
| "unknown"
|
|
18
24
|
| "rejected";
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
19
28
|
export type ClientTransactionResponse = {
|
|
20
29
|
transaction: Transaction;
|
|
21
30
|
status: TransactionStatus;
|
|
31
|
+
cycles?: Num;
|
|
32
|
+
blockHash?: Hex;
|
|
33
|
+
blockNumber?: Num;
|
|
34
|
+
txIndex?: Num;
|
|
35
|
+
reason?: string;
|
|
22
36
|
};
|
|
23
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
24
41
|
export type ClientIndexerSearchKeyFilterLike =
|
|
25
42
|
ClientCollectableSearchKeyFilterLike & {
|
|
26
43
|
blockRange?: [NumLike, NumLike] | null;
|
|
27
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
28
48
|
export class ClientIndexerSearchKeyFilter {
|
|
29
49
|
constructor(
|
|
30
50
|
public script: Script | undefined,
|
|
@@ -51,10 +71,16 @@ export class ClientIndexerSearchKeyFilter {
|
|
|
51
71
|
}
|
|
52
72
|
}
|
|
53
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
54
77
|
export type ClientIndexerSearchKeyLike = ClientCollectableSearchKeyLike & {
|
|
55
78
|
filter?: ClientIndexerSearchKeyFilterLike | null;
|
|
56
79
|
};
|
|
57
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
58
84
|
export class ClientIndexerSearchKey {
|
|
59
85
|
constructor(
|
|
60
86
|
public script: Script,
|
|
@@ -75,11 +101,17 @@ export class ClientIndexerSearchKey {
|
|
|
75
101
|
}
|
|
76
102
|
}
|
|
77
103
|
|
|
104
|
+
/**
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
78
107
|
export type ClientFindCellsResponse = {
|
|
79
108
|
lastCursor: string;
|
|
80
109
|
cells: Cell[];
|
|
81
110
|
};
|
|
82
111
|
|
|
112
|
+
/**
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
83
115
|
export type ClientIndexerSearchKeyTransactionLike = Omit<
|
|
84
116
|
ClientCollectableSearchKeyLike,
|
|
85
117
|
"withData"
|
|
@@ -88,6 +120,9 @@ export type ClientIndexerSearchKeyTransactionLike = Omit<
|
|
|
88
120
|
groupByTransaction?: boolean | null;
|
|
89
121
|
};
|
|
90
122
|
|
|
123
|
+
/**
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
91
126
|
export class ClientIndexerSearchKeyTransaction {
|
|
92
127
|
constructor(
|
|
93
128
|
public script: Script,
|
|
@@ -110,6 +145,9 @@ export class ClientIndexerSearchKeyTransaction {
|
|
|
110
145
|
}
|
|
111
146
|
}
|
|
112
147
|
|
|
148
|
+
/**
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
113
151
|
export type ClientFindTransactionsResponse = {
|
|
114
152
|
lastCursor: string;
|
|
115
153
|
transactions: {
|
|
@@ -121,6 +159,9 @@ export type ClientFindTransactionsResponse = {
|
|
|
121
159
|
}[];
|
|
122
160
|
};
|
|
123
161
|
|
|
162
|
+
/**
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
124
165
|
export type ClientFindTransactionsGroupedResponse = {
|
|
125
166
|
lastCursor: string;
|
|
126
167
|
transactions: {
|
|
@@ -134,6 +175,9 @@ export type ClientFindTransactionsGroupedResponse = {
|
|
|
134
175
|
}[];
|
|
135
176
|
};
|
|
136
177
|
|
|
178
|
+
/**
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
137
181
|
export type ClientBlockHeader = {
|
|
138
182
|
compactTarget: Num;
|
|
139
183
|
dao: Hex;
|
|
@@ -149,11 +193,17 @@ export type ClientBlockHeader = {
|
|
|
149
193
|
version: Num;
|
|
150
194
|
};
|
|
151
195
|
|
|
196
|
+
/**
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
152
199
|
export type ClientBlockUncle = {
|
|
153
200
|
header: ClientBlockHeader;
|
|
154
201
|
proposals: Hex[];
|
|
155
202
|
};
|
|
156
203
|
|
|
204
|
+
/**
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
157
207
|
export type ClientBlock = {
|
|
158
208
|
header: ClientBlockHeader;
|
|
159
209
|
proposals: Hex[];
|
|
@@ -5,7 +5,6 @@ import { Hex, HexLike, hexFrom } from "../../hex/index.js";
|
|
|
5
5
|
import { Num, NumLike, numFrom, numToHex } from "../../num/index.js";
|
|
6
6
|
import { Client } from "../client.js";
|
|
7
7
|
import {
|
|
8
|
-
ClientBlock,
|
|
9
8
|
ClientFindCellsResponse,
|
|
10
9
|
ClientIndexerSearchKeyLike,
|
|
11
10
|
ClientTransactionResponse,
|
|
@@ -46,7 +45,7 @@ export abstract class ClientJsonRpc extends Client {
|
|
|
46
45
|
/**
|
|
47
46
|
* Creates an instance of ClientJsonRpc.
|
|
48
47
|
*
|
|
49
|
-
* @param
|
|
48
|
+
* @param url_ - The URL of the JSON-RPC server.
|
|
50
49
|
* @param timeout - The timeout for requests in milliseconds, default is 30000.
|
|
51
50
|
*/
|
|
52
51
|
|
|
@@ -84,26 +83,26 @@ export abstract class ClientJsonRpc extends Client {
|
|
|
84
83
|
*
|
|
85
84
|
* @param blockNumber - The block number.
|
|
86
85
|
* @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
|
|
87
|
-
* @param
|
|
86
|
+
* @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
|
|
88
87
|
* @returns Block
|
|
89
88
|
*/
|
|
90
89
|
getBlockByNumber = this.buildSender(
|
|
91
90
|
"get_block_by_number",
|
|
92
91
|
[(v: NumLike) => numToHex(numFrom(v))],
|
|
93
92
|
(b) => apply(JsonRpcTransformers.blockTo, b),
|
|
94
|
-
) as
|
|
93
|
+
) as Client["getBlockByNumber"];
|
|
95
94
|
|
|
96
95
|
/**
|
|
97
96
|
* Get block by block hash
|
|
98
97
|
*
|
|
99
98
|
* @param blockHash - The block hash.
|
|
100
99
|
* @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
|
|
101
|
-
* @param
|
|
100
|
+
* @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
|
|
102
101
|
* @returns Block
|
|
103
102
|
*/
|
|
104
103
|
getBlockByHash = this.buildSender("get_block", [hexFrom], (b) =>
|
|
105
104
|
apply(JsonRpcTransformers.blockTo, b),
|
|
106
|
-
) as
|
|
105
|
+
) as Client["getBlockByHash"];
|
|
107
106
|
|
|
108
107
|
/**
|
|
109
108
|
* Send a transaction to node.
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
depTypeFrom,
|
|
20
20
|
hashTypeFrom,
|
|
21
21
|
} from "../../ckb/index.js";
|
|
22
|
-
import { Hex } from "../../hex/index.js";
|
|
22
|
+
import { Hex, HexLike, hexFrom } from "../../hex/index.js";
|
|
23
23
|
import { NumLike, numFrom, numToHex } from "../../num/index.js";
|
|
24
24
|
import { apply } from "../../utils/index.js";
|
|
25
25
|
import {
|
|
@@ -172,10 +172,18 @@ export class JsonRpcTransformers {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
static transactionResponseTo({
|
|
175
|
-
|
|
175
|
+
cycles,
|
|
176
|
+
tx_status: { status, block_number, block_hash, tx_index, reason },
|
|
176
177
|
transaction,
|
|
177
178
|
}: {
|
|
178
|
-
|
|
179
|
+
cycles?: NumLike;
|
|
180
|
+
tx_status: {
|
|
181
|
+
status: TransactionStatus;
|
|
182
|
+
block_hash?: HexLike;
|
|
183
|
+
tx_index?: NumLike;
|
|
184
|
+
block_number?: NumLike;
|
|
185
|
+
reason?: string;
|
|
186
|
+
};
|
|
179
187
|
transaction: JsonRpcTransaction | null;
|
|
180
188
|
}): ClientTransactionResponse | undefined {
|
|
181
189
|
if (transaction == null) {
|
|
@@ -185,6 +193,11 @@ export class JsonRpcTransformers {
|
|
|
185
193
|
return {
|
|
186
194
|
transaction: JsonRpcTransformers.transactionTo(transaction),
|
|
187
195
|
status,
|
|
196
|
+
cycles: apply(numFrom, cycles),
|
|
197
|
+
blockHash: apply(hexFrom, block_hash),
|
|
198
|
+
blockNumber: apply(numFrom, block_number),
|
|
199
|
+
txIndex: apply(numFrom, tx_index),
|
|
200
|
+
reason,
|
|
188
201
|
};
|
|
189
202
|
}
|
|
190
203
|
static blockHeaderTo(header: JsonRpcBlockHeader): ClientBlockHeader {
|
package/src/fixedPoint/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a fixed point value as a bigint.
|
|
3
|
+
* @public
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
export type FixedPoint = bigint;
|
|
@@ -7,12 +8,14 @@ export type FixedPoint = bigint;
|
|
|
7
8
|
/**
|
|
8
9
|
* Represents a value that can be converted to a fixed point value.
|
|
9
10
|
* It can be a bigint, string, or number.
|
|
11
|
+
* @public
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
14
|
export type FixedPointLike = bigint | string | number;
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Converts a FixedPointLike value to its string representation with fixed-point decimals.
|
|
18
|
+
* @public
|
|
16
19
|
*
|
|
17
20
|
* @param val - The value to convert, which can be a bigint, string, or number.
|
|
18
21
|
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
|
|
@@ -43,6 +46,7 @@ export function fixedPointToString(val: FixedPointLike, decimals = 8): string {
|
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
48
|
* Converts a FixedPointLike value to a FixedPoint (bigint) with fixed-point decimals.
|
|
49
|
+
* @public
|
|
46
50
|
*
|
|
47
51
|
* @param val - The value to convert, which can be a bigint, string, or number.
|
|
48
52
|
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
|
|
@@ -74,6 +78,7 @@ export function fixedPointFrom(val: FixedPointLike, decimals = 8): FixedPoint {
|
|
|
74
78
|
|
|
75
79
|
/**
|
|
76
80
|
* Represents the fixed point value of zero as a bigint.
|
|
81
|
+
* @public
|
|
77
82
|
*/
|
|
78
83
|
|
|
79
84
|
export const Zero: FixedPoint = 0n;
|
|
@@ -81,6 +86,7 @@ export const Zero: FixedPoint = 0n;
|
|
|
81
86
|
/**
|
|
82
87
|
* Represents the fixed point value of one as a FixedPoint (bigint).
|
|
83
88
|
* Equivalent to 1 in fixed-point representation with default decimals (8).
|
|
89
|
+
* @public
|
|
84
90
|
*/
|
|
85
91
|
|
|
86
92
|
export const One: FixedPoint = fixedPointFrom("1");
|
package/src/hasher/hasher.ts
CHANGED
package/src/hasher/hasherCkb.ts
CHANGED
|
@@ -6,6 +6,9 @@ import { NumLike, numLeToBytes } from "../num/index.js";
|
|
|
6
6
|
import { CKB_BLAKE2B_PERSONAL } from "./advanced.js";
|
|
7
7
|
import { Hasher } from "./hasher.js";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
export class HasherCkb implements Hasher {
|
|
10
13
|
private readonly hasher: ReturnType<(typeof blake2b)["create"]>;
|
|
11
14
|
|
|
@@ -62,6 +65,7 @@ export class HasherCkb implements Hasher {
|
|
|
62
65
|
|
|
63
66
|
/**
|
|
64
67
|
* Computes the CKB hash of the given data using the Blake2b algorithm.
|
|
68
|
+
* @public
|
|
65
69
|
*
|
|
66
70
|
* @param data - The data to hash.
|
|
67
71
|
* @returns The hexadecimal string representation of the hash.
|
|
@@ -80,8 +84,9 @@ export function hashCkb(...data: BytesLike[]): Hex {
|
|
|
80
84
|
|
|
81
85
|
/**
|
|
82
86
|
* Computes the Type ID hash of the given data.
|
|
87
|
+
* @public
|
|
83
88
|
*
|
|
84
|
-
* @param
|
|
89
|
+
* @param cellInputLike - The first cell input of the transaction.
|
|
85
90
|
* @param outputIndex - The output index of the Type ID cell.
|
|
86
91
|
* @returns The hexadecimal string representation of the hash.
|
|
87
92
|
*
|
|
@@ -3,6 +3,9 @@ import { BytesLike, bytesFrom } from "../bytes/index.js";
|
|
|
3
3
|
import { Hex, hexFrom } from "../hex/index.js";
|
|
4
4
|
import { Hasher } from "./hasher.js";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
export class HasherKeecak256 implements Hasher {
|
|
7
10
|
private readonly hasher: ReturnType<(typeof keccak_256)["create"]>;
|
|
8
11
|
|
package/src/hex/index.ts
CHANGED
|
@@ -2,16 +2,19 @@ import { bytesFrom, BytesLike, bytesTo } from "../bytes/index.js";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a hexadecimal string prefixed with "0x".
|
|
5
|
+
* @public
|
|
5
6
|
*/
|
|
6
7
|
export type Hex = `0x${string}`;
|
|
7
8
|
/**
|
|
8
9
|
* Represents a value that can be converted to a hexadecimal string.
|
|
9
10
|
* It extends the BytesLike type.
|
|
11
|
+
* @public
|
|
10
12
|
*/
|
|
11
13
|
export type HexLike = BytesLike;
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Converts a HexLike value to a Hex string.
|
|
17
|
+
* @public
|
|
15
18
|
*
|
|
16
19
|
* @param hex - The value to convert, which can be a string, Uint8Array, ArrayBuffer, or number array.
|
|
17
20
|
* @returns A Hex string representing the value.
|
package/src/keystore/index.ts
CHANGED
|
@@ -18,6 +18,9 @@ function mac(derivedKey: Bytes, cipherText: Bytes) {
|
|
|
18
18
|
).slice(2);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
21
24
|
export async function keystoreEncrypt(
|
|
22
25
|
privateKeyLike: BytesLike,
|
|
23
26
|
chainCodeLike: BytesLike,
|
|
@@ -79,6 +82,9 @@ export async function keystoreEncrypt(
|
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
/**
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
82
88
|
export async function keystoreDecrypt(
|
|
83
89
|
keystore: unknown,
|
|
84
90
|
password: string,
|
package/src/num/index.ts
CHANGED
|
@@ -3,17 +3,20 @@ import { Hex, HexLike, hexFrom } from "../hex/index.js";
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a numeric value as a bigint.
|
|
6
|
+
* @public
|
|
6
7
|
*/
|
|
7
8
|
export type Num = bigint;
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Represents a value that can be converted to a numeric value.
|
|
11
12
|
* It can be a string, number, bigint, or HexLike.
|
|
13
|
+
* @public
|
|
12
14
|
*/
|
|
13
15
|
export type NumLike = string | number | bigint | HexLike;
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Get the max among all numbers.
|
|
19
|
+
* @public
|
|
17
20
|
*
|
|
18
21
|
* @param numbers - numbers.
|
|
19
22
|
* @returns The max numbers among them.
|
|
@@ -36,6 +39,7 @@ export function numMax(a: NumLike, ...numbers: NumLike[]): Num {
|
|
|
36
39
|
|
|
37
40
|
/**
|
|
38
41
|
* Converts a NumLike value to a Num (bigint).
|
|
42
|
+
* @public
|
|
39
43
|
*
|
|
40
44
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
41
45
|
* @returns A Num (bigint) representing the value.
|
|
@@ -60,6 +64,7 @@ export function numFrom(val: NumLike): Num {
|
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* Converts a NumLike value to a hexadecimal string.
|
|
67
|
+
* @public
|
|
63
68
|
*
|
|
64
69
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
65
70
|
* @returns A Hex string representing the numeric value.
|
|
@@ -75,6 +80,7 @@ export function numToHex(val: NumLike): Hex {
|
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
82
|
* Converts a NumLike value to a byte array in little-endian order.
|
|
83
|
+
* @public
|
|
78
84
|
*
|
|
79
85
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
80
86
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -92,6 +98,7 @@ export function numToBytes(val: NumLike, bytes?: number): Bytes {
|
|
|
92
98
|
|
|
93
99
|
/**
|
|
94
100
|
* Converts a NumLike value to a byte array in little-endian order.
|
|
101
|
+
* @public
|
|
95
102
|
*
|
|
96
103
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
97
104
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -108,6 +115,7 @@ export function numLeToBytes(val: NumLike, bytes?: number): Bytes {
|
|
|
108
115
|
|
|
109
116
|
/**
|
|
110
117
|
* Converts a NumLike value to a byte array in big-endian order.
|
|
118
|
+
* @public
|
|
111
119
|
*
|
|
112
120
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
113
121
|
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
|
|
@@ -132,6 +140,7 @@ export function numBeToBytes(val: NumLike, bytes?: number): Bytes {
|
|
|
132
140
|
|
|
133
141
|
/**
|
|
134
142
|
* Converts a byte array to a Num (bigint) assuming little-endian order.
|
|
143
|
+
* @public
|
|
135
144
|
*
|
|
136
145
|
* @param val - The byte array to convert.
|
|
137
146
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -147,6 +156,7 @@ export function numFromBytes(val: BytesLike): Num {
|
|
|
147
156
|
|
|
148
157
|
/**
|
|
149
158
|
* Converts a byte array to a Num (bigint) assuming little-endian order.
|
|
159
|
+
* @public
|
|
150
160
|
*
|
|
151
161
|
* @param val - The byte array to convert.
|
|
152
162
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -162,6 +172,7 @@ export function numLeFromBytes(val: BytesLike): Num {
|
|
|
162
172
|
|
|
163
173
|
/**
|
|
164
174
|
* Converts a byte array to a Num (bigint) assuming big-endian order.
|
|
175
|
+
* @public
|
|
165
176
|
*
|
|
166
177
|
* @param val - The byte array to convert.
|
|
167
178
|
* @returns A Num (bigint) representing the numeric value.
|
|
@@ -12,6 +12,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
|
12
12
|
* An abstract class extending the Signer class for Bitcoin-like signing operations.
|
|
13
13
|
* This class provides methods to get Bitcoin account, public key, and internal address,
|
|
14
14
|
* as well as signing transactions.
|
|
15
|
+
* @public
|
|
15
16
|
*/
|
|
16
17
|
export abstract class SignerBtc extends Signer {
|
|
17
18
|
get type(): SignerType {
|
|
@@ -5,6 +5,7 @@ import { SignerBtc } from "./signerBtc.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* A class extending SignerBtc that provides read-only access to a Bitcoin public key and account.
|
|
7
7
|
* This class does not support signing operations.
|
|
8
|
+
* @public
|
|
8
9
|
*/
|
|
9
10
|
export class SignerBtcPublicKeyReadonly extends SignerBtc {
|
|
10
11
|
private readonly publicKey: Hex;
|
package/src/signer/btc/verify.ts
CHANGED
|
@@ -3,6 +3,9 @@ import { magicHash } from "bitcoinjs-message";
|
|
|
3
3
|
import { BytesLike, bytesFrom } from "../../bytes/index.js";
|
|
4
4
|
import { hexFrom } from "../../hex/index.js";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
export function verifyMessageBtcEcdsa(
|
|
7
10
|
message: string | BytesLike,
|
|
8
11
|
signature: string,
|
|
@@ -7,6 +7,9 @@ import { numBeToBytes } from "../../num/index.js";
|
|
|
7
7
|
import { SignerCkbPublicKey } from "./signerCkbPublicKey.js";
|
|
8
8
|
import { messageHashCkbSecp256k1 } from "./verifyCkbSecp256k1.js";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
10
13
|
export class SignerCkbPrivateKey extends SignerCkbPublicKey {
|
|
11
14
|
public readonly privateKey: Hex;
|
|
12
15
|
|
|
@@ -6,6 +6,9 @@ import { hashCkb } from "../../hasher/index.js";
|
|
|
6
6
|
import { Hex, HexLike, hexFrom } from "../../hex/index.js";
|
|
7
7
|
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
export class SignerCkbPublicKey extends Signer {
|
|
10
13
|
get type(): SignerType {
|
|
11
14
|
return SignerType.CKB;
|
|
@@ -6,6 +6,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* A class extending Signer that provides read-only access to a CKB script.
|
|
8
8
|
* This class does not support signing operations.
|
|
9
|
+
* @public
|
|
9
10
|
*/
|
|
10
11
|
export class SignerCkbScriptReadonly extends Signer {
|
|
11
12
|
get type(): SignerType {
|
|
@@ -4,12 +4,18 @@ import { hashCkb } from "../../hasher/index.js";
|
|
|
4
4
|
import { Hex, hexFrom } from "../../hex/index.js";
|
|
5
5
|
import { numFrom } from "../../num/index.js";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
7
10
|
export function messageHashCkbSecp256k1(message: string | BytesLike): Hex {
|
|
8
11
|
const msg = typeof message === "string" ? message : hexFrom(message);
|
|
9
12
|
const buffer = bytesFrom(`Nervos Message:${msg}`, "utf8");
|
|
10
13
|
return hashCkb(buffer);
|
|
11
14
|
}
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
13
19
|
export function verifyMessageCkbSecp256k1(
|
|
14
20
|
message: string | BytesLike,
|
|
15
21
|
signature: string,
|
|
@@ -2,6 +2,9 @@ import { Address } from "../../address/index.js";
|
|
|
2
2
|
import { Client } from "../../client/index.js";
|
|
3
3
|
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
5
8
|
export abstract class SignerDummy extends Signer {
|
|
6
9
|
get signType(): SignerSignType {
|
|
7
10
|
return SignerSignType.Unknown;
|
|
@@ -16,6 +16,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
|
16
16
|
/**
|
|
17
17
|
* An abstract class extending Signer for Ethereum Virtual Machine (EVM) based signing operations.
|
|
18
18
|
* This class provides methods to get EVM account, internal address, and signing transactions.
|
|
19
|
+
* @public
|
|
19
20
|
*/
|
|
20
21
|
export abstract class SignerEvm extends Signer {
|
|
21
22
|
get type(): SignerType {
|
|
@@ -5,6 +5,7 @@ import { SignerEvm } from "./signerEvm.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* A class extending SignerEvm that provides read-only access to an EVM address.
|
|
7
7
|
* This class does not support signing operations.
|
|
8
|
+
* @public
|
|
8
9
|
*/
|
|
9
10
|
export class SignerEvmAddressReadonly extends SignerEvm {
|
|
10
11
|
private readonly address: Hex;
|
package/src/signer/evm/verify.ts
CHANGED
|
@@ -8,6 +8,9 @@ import { Hex, hexFrom } from "../../hex/index.js";
|
|
|
8
8
|
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
9
9
|
import { buildNostrEventFromMessage } from "./verify.js";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
11
14
|
export interface NostrEvent {
|
|
12
15
|
id?: string;
|
|
13
16
|
pubkey?: string;
|
|
@@ -18,6 +21,9 @@ export interface NostrEvent {
|
|
|
18
21
|
content: string;
|
|
19
22
|
}
|
|
20
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
21
27
|
export abstract class SignerNostr extends Signer {
|
|
22
28
|
static CKB_SIG_HASH_ALL_TAG = "ckb_sighash_all";
|
|
23
29
|
static CKB_UNLOCK_EVENT_KIND = 23334;
|
|
@@ -5,6 +5,9 @@ import { BytesLike, bytesFrom } from "../../bytes/index.js";
|
|
|
5
5
|
import { hexFrom } from "../../hex/index.js";
|
|
6
6
|
import { NostrEvent } from "./signerNostr.js";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
8
11
|
export function buildNostrEventFromMessage(
|
|
9
12
|
message: string | BytesLike,
|
|
10
13
|
): NostrEvent {
|