koilib 2.2.0 → 2.5.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/README.md +17 -8
- package/dist/koinos.js +5862 -5750
- package/dist/koinos.min.js +1 -1
- package/dist/koinos.min.js.LICENSE.txt +1 -10
- package/lib/Contract.d.ts +47 -152
- package/lib/Contract.js +61 -148
- package/lib/Contract.js.map +1 -1
- package/lib/Provider.d.ts +8 -9
- package/lib/Provider.js +67 -16
- package/lib/Provider.js.map +1 -1
- package/lib/Serializer.d.ts +81 -0
- package/lib/Serializer.js +169 -0
- package/lib/Serializer.js.map +1 -0
- package/lib/Signer.d.ts +130 -24
- package/lib/Signer.js +162 -59
- package/lib/Signer.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/index2.js +2 -0
- package/lib/index2.js.map +1 -1
- package/lib/interface.d.ts +179 -24
- package/lib/{krc20-proto.json → jsonDescriptors/krc20-proto.json} +1 -1
- package/lib/{protocol-proto.json → jsonDescriptors/protocol-proto.json} +22 -18
- package/lib/utils.d.ts +250 -2
- package/lib/utils.js +15 -20
- package/lib/utils.js.map +1 -1
- package/package.json +7 -9
package/lib/Signer.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { Provider
|
|
2
|
-
import { TransactionJson, ActiveTransactionData } from "./interface";
|
|
3
|
-
import {
|
|
1
|
+
import { Provider } from "./Provider";
|
|
2
|
+
import { TransactionJson, ActiveTransactionData, Abi, SendTransactionResponse, RecoverPublicKeyOptions, BlockJson } from "./interface";
|
|
3
|
+
import { Serializer } from "./Serializer";
|
|
4
4
|
export interface SignerInterface {
|
|
5
5
|
provider?: Provider;
|
|
6
|
+
serializer?: Serializer;
|
|
6
7
|
getAddress(compressed?: boolean): string;
|
|
7
8
|
getPrivateKey(format: "wif" | "hex", compressed?: boolean): string;
|
|
8
9
|
signTransaction(tx: TransactionJson): Promise<TransactionJson>;
|
|
9
10
|
sendTransaction(tx: TransactionJson, abis?: Record<string, Abi>): Promise<SendTransactionResponse>;
|
|
10
11
|
encodeTransaction(activeData: ActiveTransactionData): Promise<TransactionJson>;
|
|
12
|
+
decodeTransaction(tx: TransactionJson): Promise<ActiveTransactionData>;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* The Signer Class contains the private key needed to sign transactions.
|
|
@@ -16,7 +18,8 @@ export interface SignerInterface {
|
|
|
16
18
|
* @example
|
|
17
19
|
* using private key as hex string
|
|
18
20
|
* ```ts
|
|
19
|
-
* var
|
|
21
|
+
* var privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
22
|
+
* var signer = new Signer({ privateKey });
|
|
20
23
|
* ```
|
|
21
24
|
* <br>
|
|
22
25
|
*
|
|
@@ -28,14 +31,15 @@ export interface SignerInterface {
|
|
|
28
31
|
* 1, 203, 55, 128, 187, 2, 192, 249,
|
|
29
32
|
* 205, 254, 157, 9, 218, 173, 223, 156
|
|
30
33
|
* ]);
|
|
31
|
-
* var signer = new Signer(buffer);
|
|
34
|
+
* var signer = new Signer({ privateKey: buffer });
|
|
32
35
|
* ```
|
|
33
36
|
*
|
|
34
37
|
* <br>
|
|
35
38
|
*
|
|
36
39
|
* using private key as bigint
|
|
37
40
|
* ```ts
|
|
38
|
-
* var
|
|
41
|
+
* var privateKey = 106982601049961974618234078204952280507266494766432547312316920283818886029212n;
|
|
42
|
+
* var signer = new Signer({ privateKey });
|
|
39
43
|
* ```
|
|
40
44
|
*
|
|
41
45
|
* <br>
|
|
@@ -57,7 +61,8 @@ export interface SignerInterface {
|
|
|
57
61
|
* defining a provider
|
|
58
62
|
* ```ts
|
|
59
63
|
* var provider = new Provider(["https://example.com/jsonrpc"]);
|
|
60
|
-
* var
|
|
64
|
+
* var privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
65
|
+
* var signer = new Signer({ privateKey, provider });
|
|
61
66
|
* ```
|
|
62
67
|
*/
|
|
63
68
|
export declare class Signer implements SignerInterface {
|
|
@@ -73,9 +78,13 @@ export declare class Signer implements SignerInterface {
|
|
|
73
78
|
*/
|
|
74
79
|
address: string;
|
|
75
80
|
/**
|
|
76
|
-
* Provider
|
|
81
|
+
* Provider to connect with the blockchain
|
|
77
82
|
*/
|
|
78
|
-
provider
|
|
83
|
+
provider?: Provider;
|
|
84
|
+
/**
|
|
85
|
+
* Serializer to serialize/deserialize data types
|
|
86
|
+
*/
|
|
87
|
+
serializer?: Serializer;
|
|
79
88
|
/**
|
|
80
89
|
* The constructor receives de private key as hexstring, bigint or Uint8Array.
|
|
81
90
|
* See also the functions [[Signer.fromWif]] and [[Signer.fromSeed]]
|
|
@@ -86,12 +95,24 @@ export declare class Signer implements SignerInterface {
|
|
|
86
95
|
* @param provider - provider to connect with the blockchain
|
|
87
96
|
* @example
|
|
88
97
|
* ```ts
|
|
89
|
-
*
|
|
98
|
+
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
99
|
+
* cons signer = new Signer({ privateKey });
|
|
90
100
|
* console.log(signer.getAddress());
|
|
91
101
|
* // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
|
|
92
102
|
* ```
|
|
93
103
|
*/
|
|
94
|
-
constructor(
|
|
104
|
+
constructor(c: {
|
|
105
|
+
privateKey: string | number | bigint | Uint8Array;
|
|
106
|
+
compressed?: boolean;
|
|
107
|
+
provider?: Provider;
|
|
108
|
+
/**
|
|
109
|
+
* Set this option if you can not use _eval_ functions
|
|
110
|
+
* in the current environment. In such cases, the
|
|
111
|
+
* serializer must come from an environment where it
|
|
112
|
+
* is able to use those functions.
|
|
113
|
+
*/
|
|
114
|
+
serializer?: Serializer;
|
|
115
|
+
});
|
|
95
116
|
/**
|
|
96
117
|
* Function to import a private key from the WIF
|
|
97
118
|
* @param wif - Private key in WIF format
|
|
@@ -160,24 +181,109 @@ export declare class Signer implements SignerInterface {
|
|
|
160
181
|
*/
|
|
161
182
|
sendTransaction(tx: TransactionJson, _abis?: Record<string, Abi>): Promise<SendTransactionResponse>;
|
|
162
183
|
/**
|
|
163
|
-
* Function to recover the public key from a signed
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
184
|
+
* Function to recover the public key from a signed
|
|
185
|
+
* transaction or block.
|
|
186
|
+
* The output format can be compressed (default) or uncompressed.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* const publicKey = await Signer.recoverPublicKey(tx);
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* If the signature data contains more data, like in the
|
|
194
|
+
* blocks for PoW consensus, use the "transformSignature"
|
|
195
|
+
* function to extract the signature.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* const powDescriptorJson = {
|
|
200
|
+
* nested: {
|
|
201
|
+
* mypackage: {
|
|
202
|
+
* nested: {
|
|
203
|
+
* pow_signature_data: {
|
|
204
|
+
* fields: {
|
|
205
|
+
* nonce: {
|
|
206
|
+
* type: "bytes",
|
|
207
|
+
* id: 1,
|
|
208
|
+
* },
|
|
209
|
+
* recoverable_signature: {
|
|
210
|
+
* type: "bytes",
|
|
211
|
+
* id: 2,
|
|
212
|
+
* },
|
|
213
|
+
* },
|
|
214
|
+
* },
|
|
215
|
+
* },
|
|
216
|
+
* },
|
|
217
|
+
* },
|
|
218
|
+
* };
|
|
219
|
+
*
|
|
220
|
+
* const serializer = new Serializer(powDescriptorJson, {
|
|
221
|
+
* defaultTypeName: "pow_signature_data",
|
|
222
|
+
* });
|
|
223
|
+
*
|
|
224
|
+
* const signer = await Signer.recoverPublicKey(block, {
|
|
225
|
+
* transformSignature: async (signatureData) => {
|
|
226
|
+
* const powSignatureData = await serializer.deserialize(signatureData);
|
|
227
|
+
* return powSignatureData.recoverable_signature;
|
|
228
|
+
* },
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
167
231
|
*/
|
|
168
|
-
static recoverPublicKey(
|
|
232
|
+
static recoverPublicKey(txOrBlock: TransactionJson | BlockJson, opts?: RecoverPublicKeyOptions): Promise<string>;
|
|
169
233
|
/**
|
|
170
|
-
* Function to recover the signer address from a signed
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* @
|
|
234
|
+
* Function to recover the signer address from a signed
|
|
235
|
+
* transaction or block.
|
|
236
|
+
* The output format can be compressed (default) or uncompressed.
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* const publicKey = await Signer.recoverAddress(tx);
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* If the signature data contains more data, like in the
|
|
243
|
+
* blocks for PoW consensus, use the "transformSignature"
|
|
244
|
+
* function to extract the signature.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* const powDescriptorJson = {
|
|
249
|
+
* nested: {
|
|
250
|
+
* mypackage: {
|
|
251
|
+
* nested: {
|
|
252
|
+
* pow_signature_data: {
|
|
253
|
+
* fields: {
|
|
254
|
+
* nonce: {
|
|
255
|
+
* type: "bytes",
|
|
256
|
+
* id: 1,
|
|
257
|
+
* },
|
|
258
|
+
* recoverable_signature: {
|
|
259
|
+
* type: "bytes",
|
|
260
|
+
* id: 2,
|
|
261
|
+
* },
|
|
262
|
+
* },
|
|
263
|
+
* },
|
|
264
|
+
* },
|
|
265
|
+
* },
|
|
266
|
+
* },
|
|
267
|
+
* };
|
|
268
|
+
*
|
|
269
|
+
* const serializer = new Serializer(powDescriptorJson, {
|
|
270
|
+
* defaultTypeName: "pow_signature_data",
|
|
271
|
+
* });
|
|
272
|
+
*
|
|
273
|
+
* const signer = await Signer.recoverAddress(block, {
|
|
274
|
+
* transformSignature: async (signatureData) => {
|
|
275
|
+
* const powSignatureData = await serializer.deserialize(signatureData);
|
|
276
|
+
* return powSignatureData.recoverable_signature;
|
|
277
|
+
* },
|
|
278
|
+
* });
|
|
279
|
+
* ```
|
|
174
280
|
*/
|
|
175
|
-
static recoverAddress(
|
|
281
|
+
static recoverAddress(txOrBlock: TransactionJson | BlockJson, opts?: RecoverPublicKeyOptions): Promise<string>;
|
|
176
282
|
/**
|
|
177
283
|
* Function to encode a transaction
|
|
178
|
-
* @param activeData - Active data consists of nonce,
|
|
284
|
+
* @param activeData - Active data consists of nonce, rc_limit, and
|
|
179
285
|
* operations. Do not set the nonce to get it from the blockchain
|
|
180
|
-
* using the provider. The
|
|
286
|
+
* using the provider. The rc_limit is 1000000 by default.
|
|
181
287
|
* @returns A transaction encoded. The active field is encoded in
|
|
182
288
|
* base64url
|
|
183
289
|
*/
|
|
@@ -185,6 +291,6 @@ export declare class Signer implements SignerInterface {
|
|
|
185
291
|
/**
|
|
186
292
|
* Function to decode a transaction
|
|
187
293
|
*/
|
|
188
|
-
|
|
294
|
+
decodeTransaction(tx: TransactionJson): Promise<ActiveTransactionData>;
|
|
189
295
|
}
|
|
190
296
|
export default Signer;
|
package/lib/Signer.js
CHANGED
|
@@ -24,13 +24,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.Signer = void 0;
|
|
26
26
|
/* eslint-disable no-param-reassign */
|
|
27
|
-
const
|
|
28
|
-
const secp = __importStar(require("noble
|
|
29
|
-
const
|
|
30
|
-
const protocol_proto_json_1 = __importDefault(require("./protocol-proto.json"));
|
|
27
|
+
const sha256_1 = require("@noble/hashes/lib/sha256");
|
|
28
|
+
const secp = __importStar(require("@noble/secp256k1"));
|
|
29
|
+
const protocol_proto_json_1 = __importDefault(require("./jsonDescriptors/protocol-proto.json"));
|
|
31
30
|
const utils_1 = require("./utils");
|
|
32
|
-
const
|
|
33
|
-
const ActiveTxDataMsg = root.lookupType("active_transaction_data");
|
|
31
|
+
const Serializer_1 = require("./Serializer");
|
|
34
32
|
/**
|
|
35
33
|
* The Signer Class contains the private key needed to sign transactions.
|
|
36
34
|
* It can be created using the seed, wif, or private key
|
|
@@ -38,7 +36,8 @@ const ActiveTxDataMsg = root.lookupType("active_transaction_data");
|
|
|
38
36
|
* @example
|
|
39
37
|
* using private key as hex string
|
|
40
38
|
* ```ts
|
|
41
|
-
* var
|
|
39
|
+
* var privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
40
|
+
* var signer = new Signer({ privateKey });
|
|
42
41
|
* ```
|
|
43
42
|
* <br>
|
|
44
43
|
*
|
|
@@ -50,14 +49,15 @@ const ActiveTxDataMsg = root.lookupType("active_transaction_data");
|
|
|
50
49
|
* 1, 203, 55, 128, 187, 2, 192, 249,
|
|
51
50
|
* 205, 254, 157, 9, 218, 173, 223, 156
|
|
52
51
|
* ]);
|
|
53
|
-
* var signer = new Signer(buffer);
|
|
52
|
+
* var signer = new Signer({ privateKey: buffer });
|
|
54
53
|
* ```
|
|
55
54
|
*
|
|
56
55
|
* <br>
|
|
57
56
|
*
|
|
58
57
|
* using private key as bigint
|
|
59
58
|
* ```ts
|
|
60
|
-
* var
|
|
59
|
+
* var privateKey = 106982601049961974618234078204952280507266494766432547312316920283818886029212n;
|
|
60
|
+
* var signer = new Signer({ privateKey });
|
|
61
61
|
* ```
|
|
62
62
|
*
|
|
63
63
|
* <br>
|
|
@@ -79,7 +79,8 @@ const ActiveTxDataMsg = root.lookupType("active_transaction_data");
|
|
|
79
79
|
* defining a provider
|
|
80
80
|
* ```ts
|
|
81
81
|
* var provider = new Provider(["https://example.com/jsonrpc"]);
|
|
82
|
-
* var
|
|
82
|
+
* var privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
83
|
+
* var signer = new Signer({ privateKey, provider });
|
|
83
84
|
* ```
|
|
84
85
|
*/
|
|
85
86
|
class Signer {
|
|
@@ -93,21 +94,31 @@ class Signer {
|
|
|
93
94
|
* @param provider - provider to connect with the blockchain
|
|
94
95
|
* @example
|
|
95
96
|
* ```ts
|
|
96
|
-
*
|
|
97
|
+
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
98
|
+
* cons signer = new Signer({ privateKey });
|
|
97
99
|
* console.log(signer.getAddress());
|
|
98
100
|
* // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
|
|
99
101
|
* ```
|
|
100
102
|
*/
|
|
101
|
-
constructor(
|
|
102
|
-
this.compressed = compressed;
|
|
103
|
-
this.privateKey = privateKey;
|
|
104
|
-
this.provider = provider;
|
|
105
|
-
if (
|
|
106
|
-
this.
|
|
103
|
+
constructor(c) {
|
|
104
|
+
this.compressed = typeof c.compressed === "undefined" ? true : c.compressed;
|
|
105
|
+
this.privateKey = c.privateKey;
|
|
106
|
+
this.provider = c.provider;
|
|
107
|
+
if (c.serializer) {
|
|
108
|
+
this.serializer = c.serializer;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.serializer = new Serializer_1.Serializer(protocol_proto_json_1.default, {
|
|
112
|
+
defaultTypeName: "active_transaction_data",
|
|
113
|
+
bytesConversion: false,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (typeof c.privateKey === "string") {
|
|
117
|
+
this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
|
|
107
118
|
this.address = utils_1.bitcoinAddress(utils_1.toUint8Array(this.publicKey));
|
|
108
119
|
}
|
|
109
120
|
else {
|
|
110
|
-
this.publicKey = secp.getPublicKey(privateKey, this.compressed);
|
|
121
|
+
this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
|
|
111
122
|
this.address = utils_1.bitcoinAddress(this.publicKey);
|
|
112
123
|
}
|
|
113
124
|
}
|
|
@@ -125,7 +136,10 @@ class Signer {
|
|
|
125
136
|
static fromWif(wif) {
|
|
126
137
|
const compressed = wif[0] !== "5";
|
|
127
138
|
const privateKey = utils_1.bitcoinDecode(wif);
|
|
128
|
-
return new Signer(
|
|
139
|
+
return new Signer({
|
|
140
|
+
privateKey: utils_1.toHexString(privateKey),
|
|
141
|
+
compressed,
|
|
142
|
+
});
|
|
129
143
|
}
|
|
130
144
|
/**
|
|
131
145
|
* Function to import a private key from the seed
|
|
@@ -140,8 +154,8 @@ class Signer {
|
|
|
140
154
|
* @returns Signer object
|
|
141
155
|
*/
|
|
142
156
|
static fromSeed(seed, compressed) {
|
|
143
|
-
const privateKey =
|
|
144
|
-
return new Signer(privateKey, compressed);
|
|
157
|
+
const privateKey = sha256_1.sha256(seed);
|
|
158
|
+
return new Signer({ privateKey, compressed });
|
|
145
159
|
}
|
|
146
160
|
/**
|
|
147
161
|
* @param compressed - determines if the address should be
|
|
@@ -205,18 +219,17 @@ class Signer {
|
|
|
205
219
|
async signTransaction(tx) {
|
|
206
220
|
if (!tx.active)
|
|
207
221
|
throw new Error("Active data is not defined");
|
|
208
|
-
const hash =
|
|
209
|
-
const [
|
|
222
|
+
const hash = sha256_1.sha256(utils_1.decodeBase64(tx.active));
|
|
223
|
+
const [compSignature, recovery] = await secp.sign(hash, this.privateKey, {
|
|
210
224
|
recovered: true,
|
|
211
225
|
canonical: true,
|
|
226
|
+
der: false, // compact signature
|
|
212
227
|
});
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
tx.signatureData = utils_1.encodeBase64(utils_1.toUint8Array(recId + rHex + sHex));
|
|
219
|
-
const multihash = `0x1220${hash}`; // 12: code sha2-256. 20: length (32 bytes)
|
|
228
|
+
const compactSignature = new Uint8Array(65);
|
|
229
|
+
compactSignature.set([recovery + 31], 0);
|
|
230
|
+
compactSignature.set(compSignature, 1);
|
|
231
|
+
tx.signature_data = utils_1.encodeBase64(compactSignature);
|
|
232
|
+
const multihash = `0x1220${utils_1.toHexString(hash)}`; // 12: code sha2-256. 20: length (32 bytes)
|
|
220
233
|
tx.id = multihash;
|
|
221
234
|
return tx;
|
|
222
235
|
}
|
|
@@ -230,32 +243,83 @@ class Signer {
|
|
|
230
243
|
* @returns
|
|
231
244
|
*/
|
|
232
245
|
async sendTransaction(tx, _abis) {
|
|
233
|
-
if (!tx.
|
|
246
|
+
if (!tx.signature_data || !tx.id)
|
|
234
247
|
await this.signTransaction(tx);
|
|
235
248
|
if (!this.provider)
|
|
236
249
|
throw new Error("provider is undefined");
|
|
237
250
|
return this.provider.sendTransaction(tx);
|
|
238
251
|
}
|
|
239
252
|
/**
|
|
240
|
-
* Function to recover the public key from a signed
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
253
|
+
* Function to recover the public key from a signed
|
|
254
|
+
* transaction or block.
|
|
255
|
+
* The output format can be compressed (default) or uncompressed.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* const publicKey = await Signer.recoverPublicKey(tx);
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* If the signature data contains more data, like in the
|
|
263
|
+
* blocks for PoW consensus, use the "transformSignature"
|
|
264
|
+
* function to extract the signature.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* const powDescriptorJson = {
|
|
269
|
+
* nested: {
|
|
270
|
+
* mypackage: {
|
|
271
|
+
* nested: {
|
|
272
|
+
* pow_signature_data: {
|
|
273
|
+
* fields: {
|
|
274
|
+
* nonce: {
|
|
275
|
+
* type: "bytes",
|
|
276
|
+
* id: 1,
|
|
277
|
+
* },
|
|
278
|
+
* recoverable_signature: {
|
|
279
|
+
* type: "bytes",
|
|
280
|
+
* id: 2,
|
|
281
|
+
* },
|
|
282
|
+
* },
|
|
283
|
+
* },
|
|
284
|
+
* },
|
|
285
|
+
* },
|
|
286
|
+
* },
|
|
287
|
+
* };
|
|
288
|
+
*
|
|
289
|
+
* const serializer = new Serializer(powDescriptorJson, {
|
|
290
|
+
* defaultTypeName: "pow_signature_data",
|
|
291
|
+
* });
|
|
292
|
+
*
|
|
293
|
+
* const signer = await Signer.recoverPublicKey(block, {
|
|
294
|
+
* transformSignature: async (signatureData) => {
|
|
295
|
+
* const powSignatureData = await serializer.deserialize(signatureData);
|
|
296
|
+
* return powSignatureData.recoverable_signature;
|
|
297
|
+
* },
|
|
298
|
+
* });
|
|
299
|
+
* ```
|
|
244
300
|
*/
|
|
245
|
-
static recoverPublicKey(
|
|
246
|
-
if (!
|
|
247
|
-
throw new Error("
|
|
248
|
-
if (!
|
|
249
|
-
throw new Error("
|
|
250
|
-
|
|
251
|
-
|
|
301
|
+
static async recoverPublicKey(txOrBlock, opts) {
|
|
302
|
+
if (!txOrBlock.active)
|
|
303
|
+
throw new Error("active is not defined");
|
|
304
|
+
if (!txOrBlock.signature_data)
|
|
305
|
+
throw new Error("signature_data is not defined");
|
|
306
|
+
let signatureData = txOrBlock.signature_data;
|
|
307
|
+
if (opts && typeof opts.transformSignature === "function") {
|
|
308
|
+
signatureData = await opts.transformSignature(txOrBlock.signature_data);
|
|
309
|
+
}
|
|
310
|
+
let compressed = true;
|
|
311
|
+
if (opts && typeof opts.compressed !== "undefined") {
|
|
312
|
+
compressed = opts.compressed;
|
|
313
|
+
}
|
|
314
|
+
const hash = sha256_1.sha256(utils_1.decodeBase64(txOrBlock.active));
|
|
315
|
+
const compactSignatureHex = utils_1.toHexString(utils_1.decodeBase64(signatureData));
|
|
252
316
|
const recovery = Number(`0x${compactSignatureHex.slice(0, 2)}`) - 31;
|
|
253
317
|
const rHex = compactSignatureHex.slice(2, 66);
|
|
254
318
|
const sHex = compactSignatureHex.slice(66);
|
|
255
319
|
const r = BigInt(`0x${rHex}`);
|
|
256
320
|
const s = BigInt(`0x${sHex}`);
|
|
257
321
|
const sig = new secp.Signature(r, s);
|
|
258
|
-
const publicKey = secp.recoverPublicKey(hash, sig.toHex(), recovery);
|
|
322
|
+
const publicKey = secp.recoverPublicKey(utils_1.toHexString(hash), sig.toHex(), recovery);
|
|
259
323
|
if (!publicKey)
|
|
260
324
|
throw new Error("Public key cannot be recovered");
|
|
261
325
|
if (!compressed)
|
|
@@ -263,20 +327,62 @@ class Signer {
|
|
|
263
327
|
return secp.Point.fromHex(publicKey).toHex(true);
|
|
264
328
|
}
|
|
265
329
|
/**
|
|
266
|
-
* Function to recover the signer address from a signed
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* @
|
|
330
|
+
* Function to recover the signer address from a signed
|
|
331
|
+
* transaction or block.
|
|
332
|
+
* The output format can be compressed (default) or uncompressed.
|
|
333
|
+
* @example
|
|
334
|
+
* ```ts
|
|
335
|
+
* const publicKey = await Signer.recoverAddress(tx);
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* If the signature data contains more data, like in the
|
|
339
|
+
* blocks for PoW consensus, use the "transformSignature"
|
|
340
|
+
* function to extract the signature.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```ts
|
|
344
|
+
* const powDescriptorJson = {
|
|
345
|
+
* nested: {
|
|
346
|
+
* mypackage: {
|
|
347
|
+
* nested: {
|
|
348
|
+
* pow_signature_data: {
|
|
349
|
+
* fields: {
|
|
350
|
+
* nonce: {
|
|
351
|
+
* type: "bytes",
|
|
352
|
+
* id: 1,
|
|
353
|
+
* },
|
|
354
|
+
* recoverable_signature: {
|
|
355
|
+
* type: "bytes",
|
|
356
|
+
* id: 2,
|
|
357
|
+
* },
|
|
358
|
+
* },
|
|
359
|
+
* },
|
|
360
|
+
* },
|
|
361
|
+
* },
|
|
362
|
+
* },
|
|
363
|
+
* };
|
|
364
|
+
*
|
|
365
|
+
* const serializer = new Serializer(powDescriptorJson, {
|
|
366
|
+
* defaultTypeName: "pow_signature_data",
|
|
367
|
+
* });
|
|
368
|
+
*
|
|
369
|
+
* const signer = await Signer.recoverAddress(block, {
|
|
370
|
+
* transformSignature: async (signatureData) => {
|
|
371
|
+
* const powSignatureData = await serializer.deserialize(signatureData);
|
|
372
|
+
* return powSignatureData.recoverable_signature;
|
|
373
|
+
* },
|
|
374
|
+
* });
|
|
375
|
+
* ```
|
|
270
376
|
*/
|
|
271
|
-
static recoverAddress(
|
|
272
|
-
const publicKey = Signer.recoverPublicKey(
|
|
377
|
+
static async recoverAddress(txOrBlock, opts) {
|
|
378
|
+
const publicKey = await Signer.recoverPublicKey(txOrBlock, opts);
|
|
273
379
|
return utils_1.bitcoinAddress(utils_1.toUint8Array(publicKey));
|
|
274
380
|
}
|
|
275
381
|
/**
|
|
276
382
|
* Function to encode a transaction
|
|
277
|
-
* @param activeData - Active data consists of nonce,
|
|
383
|
+
* @param activeData - Active data consists of nonce, rc_limit, and
|
|
278
384
|
* operations. Do not set the nonce to get it from the blockchain
|
|
279
|
-
* using the provider. The
|
|
385
|
+
* using the provider. The rc_limit is 1000000 by default.
|
|
280
386
|
* @returns A transaction encoded. The active field is encoded in
|
|
281
387
|
* base64url
|
|
282
388
|
*/
|
|
@@ -289,15 +395,14 @@ class Signer {
|
|
|
289
395
|
// this depends on the final architecture for names on Koinos
|
|
290
396
|
nonce = await this.provider.getNonce(this.getAddress());
|
|
291
397
|
}
|
|
292
|
-
const rcLimit = activeData.
|
|
398
|
+
const rcLimit = activeData.rc_limit === undefined ? 1000000 : activeData.rc_limit;
|
|
293
399
|
const operations = activeData.operations ? activeData.operations : [];
|
|
294
400
|
const activeData2 = {
|
|
295
|
-
rcLimit,
|
|
401
|
+
rc_limit: rcLimit,
|
|
296
402
|
nonce,
|
|
297
403
|
operations,
|
|
298
404
|
};
|
|
299
|
-
const
|
|
300
|
-
const buffer = ActiveTxDataMsg.encode(message).finish();
|
|
405
|
+
const buffer = await this.serializer.serialize(activeData2);
|
|
301
406
|
return {
|
|
302
407
|
active: utils_1.encodeBase64(buffer),
|
|
303
408
|
};
|
|
@@ -305,12 +410,10 @@ class Signer {
|
|
|
305
410
|
/**
|
|
306
411
|
* Function to decode a transaction
|
|
307
412
|
*/
|
|
308
|
-
|
|
413
|
+
async decodeTransaction(tx) {
|
|
309
414
|
if (!tx.active)
|
|
310
415
|
throw new Error("Active data is not defined");
|
|
311
|
-
|
|
312
|
-
const message = ActiveTxDataMsg.decode(buffer);
|
|
313
|
-
return ActiveTxDataMsg.toObject(message, { longs: String });
|
|
416
|
+
return this.serializer.deserialize(tx.active);
|
|
314
417
|
}
|
|
315
418
|
}
|
|
316
419
|
exports.Signer = Signer;
|
package/lib/Signer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Signer.js","sourceRoot":"","sources":["../src/Signer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"Signer.js","sourceRoot":"","sources":["../src/Signer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,qDAAkD;AAClD,uDAAyC;AAUzC,gGAAiE;AACjE,mCAQiB;AACjB,6CAA0C;AAkB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAa,MAAM;IA0BjB;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAWX;QACC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,CAAC,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC5E,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;QAC3B,IAAI,CAAC,CAAC,UAAU,EAAE;YAChB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;SAChC;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,CAAC,6BAAY,EAAE;gBAC7C,eAAe,EAAE,yBAAyB;gBAC1C,eAAe,EAAE,KAAK;aACvB,CAA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QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAW,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAE7D,OAAO;YACL,MAAM,EAAE,oBAAY,CAAC,MAAM,CAAC;SACV,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,EAAmB;QACzC,IAAI,CAAC,EAAE,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,UAAW,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;CACF;AAvYD,wBAuYC;AAED,kBAAe,MAAM,CAAC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -30,4 +30,5 @@ exports.interfaces = __importStar(require("./interface"));
|
|
|
30
30
|
__exportStar(require("./Contract"), exports);
|
|
31
31
|
__exportStar(require("./Signer"), exports);
|
|
32
32
|
__exportStar(require("./Provider"), exports);
|
|
33
|
+
__exportStar(require("./Serializer"), exports);
|
|
33
34
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,iCAAiC;AACjC,iDAAiC;AACjC,0DAA0C;AAC1C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,iCAAiC;AACjC,iDAAiC;AACjC,0DAA0C;AAC1C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,+CAA6B"}
|
package/lib/index2.js
CHANGED
|
@@ -24,8 +24,10 @@ const utils = __importStar(require("./utils"));
|
|
|
24
24
|
const Contract_1 = require("./Contract");
|
|
25
25
|
const Signer_1 = require("./Signer");
|
|
26
26
|
const Provider_1 = require("./Provider");
|
|
27
|
+
const Serializer_1 = require("./Serializer");
|
|
27
28
|
window.utils = utils;
|
|
28
29
|
window.Contract = Contract_1.Contract;
|
|
29
30
|
window.Signer = Signer_1.Signer;
|
|
30
31
|
window.Provider = Provider_1.Provider;
|
|
32
|
+
window.Serializer = Serializer_1.Serializer;
|
|
31
33
|
//# sourceMappingURL=index2.js.map
|
package/lib/index2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.js","sourceRoot":"","sources":["../src/index2.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;;;;;;;;;;;;;;;;;;;AAExE,+CAAiC;AACjC,yCAAsC;AACtC,qCAAkC;AAClC,yCAAsC;
|
|
1
|
+
{"version":3,"file":"index2.js","sourceRoot":"","sources":["../src/index2.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;;;;;;;;;;;;;;;;;;;AAExE,+CAAiC;AACjC,yCAAsC;AACtC,qCAAkC;AAClC,yCAAsC;AACtC,6CAA0C;AAI1C,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,MAAM,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AAC3B,MAAM,CAAC,MAAM,GAAG,eAAM,CAAC;AACvB,MAAM,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AAC3B,MAAM,CAAC,UAAU,GAAG,uBAAU,CAAC"}
|