@ckb-ccc/core 0.0.10-alpha.4 → 0.0.10-alpha.5
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/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +1 -2
- package/dist.commonjs/address/address.advanced.d.ts +24 -29
- package/dist.commonjs/address/address.advanced.js +89 -115
- package/dist.commonjs/address/advanced.d.ts +1 -1
- package/dist.commonjs/address/advanced.js +14 -30
- package/dist.commonjs/address/index.d.ts +44 -51
- package/dist.commonjs/address/index.js +65 -84
- package/dist.commonjs/advanced.d.ts +1 -1
- package/dist.commonjs/advanced.js +22 -47
- package/dist.commonjs/advancedBarrel.d.ts +1 -1
- package/dist.commonjs/advancedBarrel.js +14 -30
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.js +14 -30
- package/dist.commonjs/bytes/advanced.d.ts +2 -11
- package/dist.commonjs/bytes/index.d.ts +3 -9
- package/dist.commonjs/bytes/index.js +26 -28
- package/dist.commonjs/ckb/advanced.d.ts +1 -1
- package/dist.commonjs/ckb/advanced.js +22 -47
- package/dist.commonjs/ckb/index.d.ts +1 -1
- package/dist.commonjs/ckb/index.js +14 -30
- package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +260 -420
- package/dist.commonjs/ckb/molecule.advanced/generated.js +1332 -1536
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
- package/dist.commonjs/ckb/molecule.advanced/index.js +18 -34
- package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
- package/dist.commonjs/ckb/script.advanced.js +9 -12
- package/dist.commonjs/ckb/script.d.ts +117 -121
- package/dist.commonjs/ckb/script.js +176 -220
- package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
- package/dist.commonjs/ckb/transaction.advanced.js +4 -4
- package/dist.commonjs/ckb/transaction.d.ts +722 -806
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +1190 -1424
- package/dist.commonjs/client/advanced.d.ts +1 -1
- package/dist.commonjs/client/advanced.js +14 -30
- package/dist.commonjs/client/client.advanced.d.ts +6 -23
- package/dist.commonjs/client/client.advanced.js +61 -89
- package/dist.commonjs/client/client.d.ts +54 -114
- package/dist.commonjs/client/client.js +182 -215
- package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +4 -8
- package/dist.commonjs/client/clientPublicMainnet.advanced.js +189 -215
- package/dist.commonjs/client/clientPublicMainnet.d.ts +6 -8
- package/dist.commonjs/client/clientPublicMainnet.js +15 -17
- package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +3 -6
- package/dist.commonjs/client/clientPublicTestnet.advanced.js +199 -227
- package/dist.commonjs/client/clientPublicTestnet.d.ts +6 -8
- package/dist.commonjs/client/clientPublicTestnet.js +13 -13
- package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
- package/dist.commonjs/client/clientTypes.advanced.js +1 -1
- package/dist.commonjs/client/clientTypes.d.ts +26 -51
- package/dist.commonjs/client/clientTypes.js +22 -56
- package/dist.commonjs/client/index.d.ts +1 -1
- package/dist.commonjs/client/index.js +14 -30
- package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
- package/dist.commonjs/client/jsonRpc/advanced.js +14 -30
- package/dist.commonjs/client/jsonRpc/index.d.ts +75 -94
- package/dist.commonjs/client/jsonRpc/index.js +108 -135
- package/dist.commonjs/client/jsonRpc/transformers.d.ts +36 -76
- package/dist.commonjs/client/jsonRpc/transformers.js +152 -174
- package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
- package/dist.commonjs/fixedPoint/index.d.ts +3 -9
- package/dist.commonjs/fixedPoint/index.js +20 -26
- package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
- package/dist.commonjs/fixedPoint/index.test.js +36 -42
- package/dist.commonjs/hasher/advanced.d.ts +1 -1
- package/dist.commonjs/hasher/index.d.ts +37 -40
- package/dist.commonjs/hasher/index.js +48 -58
- package/dist.commonjs/hex/index.d.ts +1 -1
- package/dist.commonjs/hex/index.js +1 -1
- package/dist.commonjs/index.d.ts +1 -1
- package/dist.commonjs/index.js +22 -47
- package/dist.commonjs/num/index.d.ts +1 -1
- package/dist.commonjs/num/index.js +27 -39
- package/dist.commonjs/signer/btc/index.d.ts +1 -1
- package/dist.commonjs/signer/btc/index.js +14 -30
- package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
- package/dist.commonjs/signer/btc/signerBtc.js +66 -89
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
- package/dist.commonjs/signer/btc/verify.d.ts +2 -6
- package/dist.commonjs/signer/btc/verify.js +3 -10
- package/dist.commonjs/signer/ckb/index.d.ts +1 -1
- package/dist.commonjs/signer/ckb/index.js +14 -30
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +5 -5
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +27 -41
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +11 -11
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +35 -45
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +3 -9
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +5 -13
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +2 -6
- package/dist.commonjs/signer/ckb/verifyJoyId.js +8 -11
- package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
- package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
- package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
- package/dist.commonjs/signer/dummy/dummy.js +16 -16
- package/dist.commonjs/signer/dummy/index.d.ts +1 -1
- package/dist.commonjs/signer/dummy/index.js +14 -30
- package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
- package/dist.commonjs/signer/dummy/openLink.js +7 -7
- package/dist.commonjs/signer/evm/index.d.ts +1 -1
- package/dist.commonjs/signer/evm/index.js +14 -30
- package/dist.commonjs/signer/evm/signerEvm.d.ts +38 -42
- package/dist.commonjs/signer/evm/signerEvm.js +70 -105
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
- package/dist.commonjs/signer/evm/verify.d.ts +2 -6
- package/dist.commonjs/signer/evm/verify.js +2 -7
- package/dist.commonjs/signer/index.d.ts +1 -1
- package/dist.commonjs/signer/index.js +14 -30
- package/dist.commonjs/signer/nostr/index.d.ts +1 -1
- package/dist.commonjs/signer/nostr/index.js +14 -30
- package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
- package/dist.commonjs/signer/nostr/signerNostr.js +71 -100
- package/dist.commonjs/signer/nostr/verify.d.ts +3 -9
- package/dist.commonjs/signer/nostr/verify.js +39 -50
- package/dist.commonjs/signer/signer/index.d.ts +162 -171
- package/dist.commonjs/signer/signer/index.js +198 -234
- package/dist.commonjs/utils/index.d.ts +9 -42
- package/dist.commonjs/utils/index.js +12 -18
- package/package.json +3 -3
|
@@ -8,51 +8,51 @@ import { Signer, SignerSignType, SignerType } from "../signer";
|
|
|
8
8
|
* as well as signing transactions.
|
|
9
9
|
*/
|
|
10
10
|
export declare abstract class SignerBtc extends Signer {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
11
|
+
get type(): SignerType;
|
|
12
|
+
get signType(): SignerSignType;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the Bitcoin account associated with the signer.
|
|
15
|
+
*
|
|
16
|
+
* @returns A promise that resolves to a string representing the Bitcoin account.
|
|
17
|
+
*/
|
|
18
|
+
abstract getBtcAccount(): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the Bitcoin public key associated with the signer.
|
|
21
|
+
*
|
|
22
|
+
* @returns A promise that resolves to a HexLike value representing the Bitcoin public key.
|
|
23
|
+
*/
|
|
24
|
+
abstract getBtcPublicKey(): Promise<HexLike>;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the internal address, which is the Bitcoin account in this case.
|
|
27
|
+
*
|
|
28
|
+
* @returns A promise that resolves to a string representing the internal address.
|
|
29
|
+
*/
|
|
30
|
+
getInternalAddress(): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the identity, which is the Bitcoin public key in this case.
|
|
33
|
+
*
|
|
34
|
+
* @returns A promise that resolves to a string representing the identity
|
|
35
|
+
*/
|
|
36
|
+
getIdentity(): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Gets an array of Address objects representing the known script addresses for the signer.
|
|
39
|
+
*
|
|
40
|
+
* @returns A promise that resolves to an array of Address objects.
|
|
41
|
+
*/
|
|
42
|
+
getAddressObjs(): Promise<Address[]>;
|
|
43
|
+
/**
|
|
44
|
+
* prepare a transaction before signing. This method is not implemented and should be overridden by subclasses.
|
|
45
|
+
*
|
|
46
|
+
* @param txLike - The transaction to prepare, represented as a TransactionLike object.
|
|
47
|
+
* @returns A promise that resolves to the prepared Transaction object.
|
|
48
|
+
*/
|
|
49
|
+
prepareTransaction(txLike: TransactionLike): Promise<Transaction>;
|
|
50
|
+
/**
|
|
51
|
+
* Signs a transaction without modifying it.
|
|
52
|
+
*
|
|
53
|
+
* @param txLike - The transaction to sign, represented as a TransactionLike object.
|
|
54
|
+
* @returns A promise that resolves to a signed Transaction object.
|
|
55
|
+
*/
|
|
56
|
+
signOnlyTransaction(txLike: TransactionLike): Promise<Transaction>;
|
|
57
57
|
}
|
|
58
|
-
//# sourceMappingURL=signerBtc.d.ts.map
|
|
58
|
+
//# sourceMappingURL=signerBtc.d.ts.map
|
|
@@ -16,95 +16,72 @@ const signer_1 = require("../signer");
|
|
|
16
16
|
* as well as signing transactions.
|
|
17
17
|
*/
|
|
18
18
|
class SignerBtc extends signer_1.Signer {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!info) {
|
|
86
|
-
return tx;
|
|
19
|
+
get type() {
|
|
20
|
+
return signer_1.SignerType.BTC;
|
|
21
|
+
}
|
|
22
|
+
get signType() {
|
|
23
|
+
return signer_1.SignerSignType.BtcEcdsa;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the internal address, which is the Bitcoin account in this case.
|
|
27
|
+
*
|
|
28
|
+
* @returns A promise that resolves to a string representing the internal address.
|
|
29
|
+
*/
|
|
30
|
+
async getInternalAddress() {
|
|
31
|
+
return this.getBtcAccount();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gets the identity, which is the Bitcoin public key in this case.
|
|
35
|
+
*
|
|
36
|
+
* @returns A promise that resolves to a string representing the identity
|
|
37
|
+
*/
|
|
38
|
+
async getIdentity() {
|
|
39
|
+
return (0, hex_1.hexFrom)(await this.getBtcPublicKey()).slice(2);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets an array of Address objects representing the known script addresses for the signer.
|
|
43
|
+
*
|
|
44
|
+
* @returns A promise that resolves to an array of Address objects.
|
|
45
|
+
*/
|
|
46
|
+
async getAddressObjs() {
|
|
47
|
+
const publicKey = await this.getBtcPublicKey();
|
|
48
|
+
const hash = (0, ripemd160_1.ripemd160)((0, sha256_1.sha256)((0, bytes_1.bytesFrom)(publicKey)));
|
|
49
|
+
return [
|
|
50
|
+
await address_1.Address.fromKnownScript(this.client, client_1.KnownScript.OmniLock, (0, hex_1.hexFrom)([0x04, ...hash, 0x00])),
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* prepare a transaction before signing. This method is not implemented and should be overridden by subclasses.
|
|
55
|
+
*
|
|
56
|
+
* @param txLike - The transaction to prepare, represented as a TransactionLike object.
|
|
57
|
+
* @returns A promise that resolves to the prepared Transaction object.
|
|
58
|
+
*/
|
|
59
|
+
async prepareTransaction(txLike) {
|
|
60
|
+
const tx = ckb_1.Transaction.from(txLike);
|
|
61
|
+
const { script } = await this.getRecommendedAddressObj();
|
|
62
|
+
await tx.addCellDepsOfKnownScripts(this.client, client_1.KnownScript.OmniLock);
|
|
63
|
+
await tx.prepareSighashAllWitness(script, 85, this.client);
|
|
64
|
+
return tx;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Signs a transaction without modifying it.
|
|
68
|
+
*
|
|
69
|
+
* @param txLike - The transaction to sign, represented as a TransactionLike object.
|
|
70
|
+
* @returns A promise that resolves to a signed Transaction object.
|
|
71
|
+
*/
|
|
72
|
+
async signOnlyTransaction(txLike) {
|
|
73
|
+
const tx = ckb_1.Transaction.from(txLike);
|
|
74
|
+
const { script } = await this.getRecommendedAddressObj();
|
|
75
|
+
const info = await tx.getSignHashInfo(script, this.client);
|
|
76
|
+
if (!info) {
|
|
77
|
+
return tx;
|
|
78
|
+
}
|
|
79
|
+
const signature = (0, bytes_1.bytesFrom)(await this.signMessageRaw(`CKB (Bitcoin Layer) transaction: ${info.message}`), "base64");
|
|
80
|
+
signature[0] = 31 + ((signature[0] - 27) % 4);
|
|
81
|
+
const witness = ckb_1.WitnessArgs.fromBytes(tx.witnesses[info.position]);
|
|
82
|
+
witness.lock = (0, hex_1.hexFrom)((0, bytes_1.bytesConcat)((0, num_1.numToBytes)(5 * 4 + signature.length, 4), (0, num_1.numToBytes)(4 * 4, 4), (0, num_1.numToBytes)(5 * 4 + signature.length, 4), (0, num_1.numToBytes)(5 * 4 + signature.length, 4), (0, num_1.numToBytes)(signature.length, 4), signature));
|
|
83
|
+
tx.setWitnessArgsAt(info.position, witness);
|
|
84
|
+
return tx;
|
|
87
85
|
}
|
|
88
|
-
const signature = (0, bytes_1.bytesFrom)(
|
|
89
|
-
await this.signMessageRaw(
|
|
90
|
-
`CKB (Bitcoin Layer) transaction: ${info.message}`,
|
|
91
|
-
),
|
|
92
|
-
"base64",
|
|
93
|
-
);
|
|
94
|
-
signature[0] = 31 + ((signature[0] - 27) % 4);
|
|
95
|
-
const witness = ckb_1.WitnessArgs.fromBytes(tx.witnesses[info.position]);
|
|
96
|
-
witness.lock = (0, hex_1.hexFrom)(
|
|
97
|
-
(0, bytes_1.bytesConcat)(
|
|
98
|
-
(0, num_1.numToBytes)(5 * 4 + signature.length, 4),
|
|
99
|
-
(0, num_1.numToBytes)(4 * 4, 4),
|
|
100
|
-
(0, num_1.numToBytes)(5 * 4 + signature.length, 4),
|
|
101
|
-
(0, num_1.numToBytes)(5 * 4 + signature.length, 4),
|
|
102
|
-
(0, num_1.numToBytes)(signature.length, 4),
|
|
103
|
-
signature,
|
|
104
|
-
),
|
|
105
|
-
);
|
|
106
|
-
tx.setWitnessArgsAt(info.position, witness);
|
|
107
|
-
return tx;
|
|
108
|
-
}
|
|
109
86
|
}
|
|
110
87
|
exports.SignerBtc = SignerBtc;
|
|
@@ -6,49 +6,49 @@ import { SignerBtc } from "./signerBtc";
|
|
|
6
6
|
* This class does not support signing operations.
|
|
7
7
|
*/
|
|
8
8
|
export declare class SignerBtcPublicKeyReadonly extends SignerBtc {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
9
|
+
private readonly account;
|
|
10
|
+
private readonly publicKey;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of SignerBtcPublicKeyReadonly.
|
|
13
|
+
*
|
|
14
|
+
* @param client - The client instance used for communication.
|
|
15
|
+
* @param account - The Bitcoin account associated with the signer.
|
|
16
|
+
* @param publicKey - The public key associated with the signer.
|
|
17
|
+
*/
|
|
18
|
+
constructor(client: Client, account: string, publicKey: HexLike);
|
|
19
|
+
/**
|
|
20
|
+
* Connects to the client. This implementation does nothing as the class is read-only.
|
|
21
|
+
*
|
|
22
|
+
* @returns A promise that resolves when the connection is complete.
|
|
23
|
+
*/
|
|
24
|
+
connect(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if the signer is connected.
|
|
27
|
+
*
|
|
28
|
+
* @returns A promise that resolves the connection status.
|
|
29
|
+
*/
|
|
30
|
+
isConnected(): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the Bitcoin account associated with the signer.
|
|
33
|
+
*
|
|
34
|
+
* @returns A promise that resolves to a string representing the Bitcoin account.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const account = await signer.getBtcAccount(); // Outputs the Bitcoin account
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
getBtcAccount(): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the Bitcoin public key associated with the signer.
|
|
44
|
+
*
|
|
45
|
+
* @returns A promise that resolves to a Hex string representing the Bitcoin public key.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const publicKey = await signer.getBtcPublicKey(); // Outputs the Bitcoin public key
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
getBtcPublicKey(): Promise<Hex>;
|
|
53
53
|
}
|
|
54
|
-
//# sourceMappingURL=signerBtcPublicKeyReadonly.d.ts.map
|
|
54
|
+
//# sourceMappingURL=signerBtcPublicKeyReadonly.d.ts.map
|
|
@@ -8,57 +8,57 @@ const signerBtc_1 = require("./signerBtc");
|
|
|
8
8
|
* This class does not support signing operations.
|
|
9
9
|
*/
|
|
10
10
|
class SignerBtcPublicKeyReadonly extends signerBtc_1.SignerBtc {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of SignerBtcPublicKeyReadonly.
|
|
13
|
+
*
|
|
14
|
+
* @param client - The client instance used for communication.
|
|
15
|
+
* @param account - The Bitcoin account associated with the signer.
|
|
16
|
+
* @param publicKey - The public key associated with the signer.
|
|
17
|
+
*/
|
|
18
|
+
constructor(client, account, publicKey) {
|
|
19
|
+
super(client);
|
|
20
|
+
this.account = account;
|
|
21
|
+
this.publicKey = (0, hex_1.hexFrom)(publicKey);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Connects to the client. This implementation does nothing as the class is read-only.
|
|
25
|
+
*
|
|
26
|
+
* @returns A promise that resolves when the connection is complete.
|
|
27
|
+
*/
|
|
28
|
+
async connect() { }
|
|
29
|
+
/**
|
|
30
|
+
* Check if the signer is connected.
|
|
31
|
+
*
|
|
32
|
+
* @returns A promise that resolves the connection status.
|
|
33
|
+
*/
|
|
34
|
+
async isConnected() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the Bitcoin account associated with the signer.
|
|
39
|
+
*
|
|
40
|
+
* @returns A promise that resolves to a string representing the Bitcoin account.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const account = await signer.getBtcAccount(); // Outputs the Bitcoin account
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
async getBtcAccount() {
|
|
48
|
+
return this.account;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the Bitcoin public key associated with the signer.
|
|
52
|
+
*
|
|
53
|
+
* @returns A promise that resolves to a Hex string representing the Bitcoin public key.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const publicKey = await signer.getBtcPublicKey(); // Outputs the Bitcoin public key
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
async getBtcPublicKey() {
|
|
61
|
+
return this.publicKey;
|
|
62
|
+
}
|
|
63
63
|
}
|
|
64
64
|
exports.SignerBtcPublicKeyReadonly = SignerBtcPublicKeyReadonly;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { BytesLike } from "../../bytes";
|
|
2
|
-
export declare function verifyMessageBtcEcdsa(
|
|
3
|
-
|
|
4
|
-
signature: string,
|
|
5
|
-
publicKey: string,
|
|
6
|
-
): boolean;
|
|
7
|
-
//# sourceMappingURL=verify.d.ts.map
|
|
2
|
+
export declare function verifyMessageBtcEcdsa(message: string | BytesLike, signature: string, publicKey: string): boolean;
|
|
3
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -6,15 +6,8 @@ const bitcoinjs_message_1 = require("bitcoinjs-message");
|
|
|
6
6
|
const bytes_1 = require("../../bytes");
|
|
7
7
|
const hex_1 = require("../../hex");
|
|
8
8
|
function verifyMessageBtcEcdsa(message, signature, publicKey) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
: (0, hex_1.hexFrom)(message).slice(2);
|
|
13
|
-
const [_, ...rawSign] = (0, bytes_1.bytesFrom)(signature, "base64");
|
|
14
|
-
return secp256k1_1.secp256k1.verify(
|
|
15
|
-
(0, bytes_1.bytesFrom)(rawSign),
|
|
16
|
-
(0, bitcoinjs_message_1.magicHash)(challenge),
|
|
17
|
-
publicKey,
|
|
18
|
-
);
|
|
9
|
+
const challenge = typeof message === "string" ? message : (0, hex_1.hexFrom)(message).slice(2);
|
|
10
|
+
const [_, ...rawSign] = (0, bytes_1.bytesFrom)(signature, "base64");
|
|
11
|
+
return secp256k1_1.secp256k1.verify((0, bytes_1.bytesFrom)(rawSign), (0, bitcoinjs_message_1.magicHash)(challenge), publicKey);
|
|
19
12
|
}
|
|
20
13
|
exports.verifyMessageBtcEcdsa = verifyMessageBtcEcdsa;
|
|
@@ -1,34 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}
|
|
21
|
-
: function (o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
});
|
|
25
|
-
var __exportStar =
|
|
26
|
-
(this && this.__exportStar) ||
|
|
27
|
-
function (m, exports) {
|
|
28
|
-
for (var p in m)
|
|
29
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
30
|
-
__createBinding(exports, m, p);
|
|
31
|
-
};
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
32
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
17
|
__exportStar(require("./signerCkbPrivateKey"), exports);
|
|
34
18
|
__exportStar(require("./signerCkbPublicKey"), exports);
|
|
@@ -4,9 +4,9 @@ import { Client } from "../../client";
|
|
|
4
4
|
import { Hex, HexLike } from "../../hex";
|
|
5
5
|
import { SignerCkbPublicKey } from "./signerCkbPublicKey";
|
|
6
6
|
export declare class SignerCkbPrivateKey extends SignerCkbPublicKey {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
readonly privateKey: Hex;
|
|
8
|
+
constructor(client: Client, privateKey: HexLike);
|
|
9
|
+
signMessageRaw(message: string | BytesLike): Promise<Hex>;
|
|
10
|
+
signOnlyTransaction(txLike: TransactionLike): Promise<Transaction>;
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=signerCkbPrivateKey.d.ts.map
|
|
12
|
+
//# sourceMappingURL=signerCkbPrivateKey.d.ts.map
|