koilib 2.8.0 → 3.1.1

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.
Files changed (66) hide show
  1. package/README.md +75 -12
  2. package/dist/koinos.js +8535 -284
  3. package/dist/koinos.min.js +1 -1
  4. package/lib/Contract.d.ts +66 -18
  5. package/lib/Contract.js +103 -40
  6. package/lib/Contract.js.map +1 -1
  7. package/lib/Provider.d.ts +22 -7
  8. package/lib/Provider.js +60 -21
  9. package/lib/Provider.js.map +1 -1
  10. package/lib/Serializer.d.ts +3 -1
  11. package/lib/Serializer.js +103 -83
  12. package/lib/Serializer.js.map +1 -1
  13. package/lib/Signer.d.ts +54 -42
  14. package/lib/Signer.js +305 -114
  15. package/lib/Signer.js.map +1 -1
  16. package/lib/browser/Contract.d.ts +66 -18
  17. package/lib/browser/Contract.js +103 -40
  18. package/lib/browser/Contract.js.map +1 -1
  19. package/lib/browser/Provider.d.ts +22 -7
  20. package/lib/browser/Provider.js +60 -21
  21. package/lib/browser/Provider.js.map +1 -1
  22. package/lib/browser/Serializer.d.ts +3 -1
  23. package/lib/browser/Serializer.js +103 -83
  24. package/lib/browser/Serializer.js.map +1 -1
  25. package/lib/browser/Signer.d.ts +54 -42
  26. package/lib/browser/Signer.js +305 -114
  27. package/lib/browser/Signer.js.map +1 -1
  28. package/lib/browser/index.d.ts +1 -1
  29. package/lib/browser/index.js +1 -1
  30. package/lib/browser/index.js.map +1 -1
  31. package/lib/browser/indexUtils.d.ts +2 -0
  32. package/lib/browser/indexUtils.js +15 -0
  33. package/lib/browser/indexUtils.js.map +1 -0
  34. package/lib/browser/interface.d.ts +242 -46
  35. package/lib/browser/jsonDescriptors/chain-proto.json +676 -0
  36. package/lib/browser/jsonDescriptors/{krc20-proto.json → token-proto.json} +47 -4
  37. package/lib/browser/protoModules/protocol-proto.d.ts +2 -0
  38. package/lib/browser/protoModules/protocol-proto.js +6336 -0
  39. package/lib/browser/protoModules/protocol-proto.js.map +1 -0
  40. package/lib/browser/utils.d.ts +19 -255
  41. package/lib/browser/utils.js +170 -15
  42. package/lib/browser/utils.js.map +1 -1
  43. package/lib/browser/utilsNode.d.ts +1021 -0
  44. package/lib/browser/utilsNode.js +346 -0
  45. package/lib/browser/utilsNode.js.map +1 -0
  46. package/lib/index.d.ts +1 -1
  47. package/lib/index.js +1 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/indexUtils.d.ts +2 -0
  50. package/lib/indexUtils.js +15 -0
  51. package/lib/indexUtils.js.map +1 -0
  52. package/lib/interface.d.ts +242 -46
  53. package/lib/jsonDescriptors/chain-proto.json +676 -0
  54. package/lib/jsonDescriptors/{krc20-proto.json → token-proto.json} +47 -4
  55. package/lib/protoModules/protocol-proto.d.ts +2 -0
  56. package/lib/protoModules/protocol-proto.js +6336 -0
  57. package/lib/protoModules/protocol-proto.js.map +1 -0
  58. package/lib/utils.d.ts +19 -255
  59. package/lib/utils.js +170 -15
  60. package/lib/utils.js.map +1 -1
  61. package/lib/utilsNode.d.ts +1021 -0
  62. package/lib/utilsNode.js +346 -0
  63. package/lib/utilsNode.js.map +1 -0
  64. package/package.json +1 -1
  65. package/lib/browser/jsonDescriptors/protocol-proto.json +0 -246
  66. package/lib/jsonDescriptors/protocol-proto.json +0 -246
@@ -18,17 +18,71 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
21
  Object.defineProperty(exports, "__esModule", { value: true });
25
22
  exports.Signer = void 0;
26
- /* eslint-disable no-param-reassign */
23
+ /* eslint-disable no-param-reassign, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
27
24
  const sha256_1 = require("@noble/hashes/sha256");
28
25
  const secp = __importStar(require("@noble/secp256k1"));
29
- const protocol_proto_json_1 = __importDefault(require("./jsonDescriptors/protocol-proto.json"));
30
26
  const utils_1 = require("./utils");
31
- const Serializer_1 = require("./Serializer");
27
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
+ // @ts-ignore
29
+ const protocol_proto_js_1 = require("./protoModules/protocol-proto.js");
30
+ const btypeBlockHeader = {
31
+ previous: { type: "bytes", btype: "BLOCK_ID" },
32
+ height: { type: "uint64" },
33
+ timestamp: { type: "uint64" },
34
+ previous_state_merkle_root: { type: "bytes" },
35
+ transaction_merkle_root: { type: "bytes" },
36
+ signer: { type: "bytes", btype: "ADDRESS" },
37
+ };
38
+ const btypeTransactionHeader = {
39
+ chain_id: { type: "bytes" },
40
+ rc_limit: { type: "uint64" },
41
+ nonce: { type: "bytes" },
42
+ operation_merkle_root: { type: "bytes" },
43
+ payer: { type: "bytes", btype: "ADDRESS" },
44
+ payee: { type: "bytes", btype: "ADDRESS" },
45
+ };
46
+ const btypesOperation = {
47
+ upload_contract: {
48
+ type: "object",
49
+ subtypes: {
50
+ contract_id: { type: "bytes", btype: "CONTRACT_ID" },
51
+ bytecode: { type: "bytes" },
52
+ abi: { type: "string" },
53
+ authorizes_call_contract: { type: "bool" },
54
+ authorizes_transaction_application: { type: "bool" },
55
+ authorizes_upload_contract: { type: "bool" },
56
+ },
57
+ },
58
+ call_contract: {
59
+ type: "object",
60
+ subtypes: {
61
+ contract_id: { type: "bytes", btype: "CONTRACT_ID" },
62
+ entry_point: { type: "uint32" },
63
+ args: { type: "bytes" },
64
+ },
65
+ },
66
+ set_system_call: {
67
+ type: "object",
68
+ subtypes: {
69
+ call_id: { type: "uint32" },
70
+ target: {
71
+ type: "object",
72
+ subtypes: {
73
+ thunk_id: { type: "uint32" },
74
+ system_call_bundle: {
75
+ type: "object",
76
+ subtypes: {
77
+ contract_id: { type: "bytes", btype: "CONTRACT_ID" },
78
+ entry_point: { type: "uint32" },
79
+ },
80
+ },
81
+ },
82
+ },
83
+ },
84
+ },
85
+ };
32
86
  /**
33
87
  * The Signer Class contains the private key needed to sign transactions.
34
88
  * It can be created using the seed, wif, or private key
@@ -101,17 +155,13 @@ class Signer {
101
155
  * ```
102
156
  */
103
157
  constructor(c) {
158
+ /**
159
+ * Chain id
160
+ */
161
+ this.chainId = "";
104
162
  this.compressed = typeof c.compressed === "undefined" ? true : c.compressed;
105
163
  this.privateKey = c.privateKey;
106
164
  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
- bytesConversion: false,
113
- });
114
- }
115
165
  if (typeof c.privateKey === "string") {
116
166
  this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
117
167
  this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
@@ -120,6 +170,8 @@ class Signer {
120
170
  this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
121
171
  this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
122
172
  }
173
+ if (c.chainId)
174
+ this.chainId = c.chainId;
123
175
  }
124
176
  /**
125
177
  * Function to import a private key from the WIF
@@ -132,12 +184,12 @@ class Signer {
132
184
  * ```
133
185
  * @returns Signer object
134
186
  */
135
- static fromWif(wif) {
136
- const compressed = wif[0] !== "5";
187
+ static fromWif(wif, compressed = true) {
188
+ const comp = compressed === undefined ? wif[0] !== "5" : compressed;
137
189
  const privateKey = (0, utils_1.bitcoinDecode)(wif);
138
190
  return new Signer({
139
191
  privateKey: (0, utils_1.toHexString)(privateKey),
140
- compressed,
192
+ compressed: comp,
141
193
  });
142
194
  }
143
195
  /**
@@ -152,7 +204,7 @@ class Signer {
152
204
  * ```
153
205
  * @returns Signer object
154
206
  */
155
- static fromSeed(seed, compressed) {
207
+ static fromSeed(seed, compressed = true) {
156
208
  const privateKey = (0, sha256_1.sha256)(seed);
157
209
  return new Signer({ privateKey, compressed });
158
210
  }
@@ -210,10 +262,9 @@ class Signer {
210
262
  }
211
263
  }
212
264
  /**
213
- * Function to sign a hash value. It returns the signature encoded
214
- * in base64. The signature is in compact format with the
215
- * recovery byte
216
- * @param hash Hash value. Also known as digest
265
+ * Function to sign a hash value. It returns the bytes signature.
266
+ * The signature is in compact format with the recovery byte
267
+ * @param hash - Hash value. Also known as digest
217
268
  */
218
269
  async signHash(hash) {
219
270
  const [compSignature, recovery] = await secp.sign(hash, this.privateKey, {
@@ -224,20 +275,29 @@ class Signer {
224
275
  const compactSignature = new Uint8Array(65);
225
276
  compactSignature.set([recovery + 31], 0);
226
277
  compactSignature.set(compSignature, 1);
227
- return (0, utils_1.encodeBase64)(compactSignature);
278
+ return compactSignature;
279
+ }
280
+ /**
281
+ * Function to sign a message, which could be a string or a Uint8Array
282
+ */
283
+ async signMessage(message) {
284
+ return this.signHash((0, sha256_1.sha256)(message));
228
285
  }
229
286
  /**
230
287
  * Function to sign a transaction. It's important to remark that
231
288
  * the transaction parameter is modified inside this function.
232
289
  * @param tx - Unsigned transaction
233
290
  */
234
- async signTransaction(tx) {
235
- if (!tx.active)
236
- throw new Error("Active data is not defined");
237
- const hash = (0, sha256_1.sha256)((0, utils_1.decodeBase64)(tx.active));
238
- tx.signature_data = await this.signHash(hash);
291
+ async signTransaction(tx, _abis) {
292
+ if (!tx.id)
293
+ throw new Error("Missing transaction id");
239
294
  // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
240
- tx.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
295
+ // tx id is a stringified multihash, need to extract the hash digest only
296
+ const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
297
+ const signature = await this.signHash(hash);
298
+ if (!tx.signatures)
299
+ tx.signatures = [];
300
+ tx.signatures.push((0, utils_1.encodeBase64url)(signature));
241
301
  return tx;
242
302
  }
243
303
  /**
@@ -248,15 +308,13 @@ class Signer {
248
308
  * @param block - Unsigned block
249
309
  */
250
310
  async signBlock(block) {
251
- const activeBytes = (0, utils_1.decodeBase64)(block.active);
252
- const headerBytes = await this.serializer.serialize(block.header, "block_header", { bytesConversion: true });
253
- const headerActiveBytes = new Uint8Array(headerBytes.length + activeBytes.length);
254
- headerActiveBytes.set(headerBytes, 0);
255
- headerActiveBytes.set(activeBytes, headerBytes.length);
256
- const hash = (0, sha256_1.sha256)(headerActiveBytes);
257
- block.signature_data = await this.signHash(hash);
311
+ if (!block.id)
312
+ throw new Error("Missing block id");
258
313
  // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
259
- block.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
314
+ // block id is a stringified multihash, need to extract the hash digest only
315
+ const hash = (0, utils_1.toUint8Array)(block.id.slice(6));
316
+ const signature = await this.signHash(hash);
317
+ block.signature = (0, utils_1.encodeBase64url)(signature);
260
318
  return block;
261
319
  }
262
320
  /**
@@ -269,28 +327,54 @@ class Signer {
269
327
  * @returns
270
328
  */
271
329
  async sendTransaction(tx, _abis) {
272
- if (!tx.signature_data || !tx.id)
273
- await this.signTransaction(tx);
330
+ var _a;
331
+ if (!tx.signatures || !((_a = tx.signatures) === null || _a === void 0 ? void 0 : _a.length))
332
+ tx = await this.signTransaction(tx);
274
333
  if (!this.provider)
275
334
  throw new Error("provider is undefined");
276
- await this.provider.sendTransaction(tx);
277
- return {
278
- ...tx,
279
- wait: async (type = "byBlock", timeout = 30000) => {
280
- if (!this.provider)
281
- throw new Error("provider is undefined");
282
- return this.provider.wait(tx.id, type, timeout);
283
- },
335
+ const { receipt } = await this.provider.sendTransaction(tx);
336
+ tx.wait = async (type = "byBlock", timeout = 60000) => {
337
+ if (!this.provider)
338
+ throw new Error("provider is undefined");
339
+ return this.provider.wait(tx.id, type, timeout);
284
340
  };
341
+ return { receipt, transaction: tx };
342
+ }
343
+ /**
344
+ * Function to recover the public key from hash and signature
345
+ * @param hash - hash sha256
346
+ * @param signature - compact signature
347
+ * @param compressed - default true
348
+ */
349
+ static recoverPublicKey(hash, signature, compressed = true) {
350
+ const compactSignatureHex = (0, utils_1.toHexString)(signature);
351
+ const recovery = Number(`0x${compactSignatureHex.slice(0, 2)}`) - 31;
352
+ const rHex = compactSignatureHex.slice(2, 66);
353
+ const sHex = compactSignatureHex.slice(66);
354
+ const r = BigInt(`0x${rHex}`);
355
+ const s = BigInt(`0x${sHex}`);
356
+ const sig = new secp.Signature(r, s);
357
+ const publicKey = secp.recoverPublicKey((0, utils_1.toHexString)(hash), sig.toHex(), recovery);
358
+ if (!publicKey)
359
+ throw new Error("Public key cannot be recovered");
360
+ if (!compressed) {
361
+ return (0, utils_1.toHexString)(publicKey);
362
+ }
363
+ else {
364
+ return secp.Point.fromHex(publicKey).toHex(true);
365
+ }
366
+ }
367
+ static recoverAddress(hash, signature, compressed = true) {
368
+ return (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(Signer.recoverPublicKey(hash, signature, compressed)));
285
369
  }
286
370
  /**
287
- * Function to recover the public key from a signed
371
+ * Function to recover the publics keys from a signed
288
372
  * transaction or block.
289
373
  * The output format can be compressed (default) or uncompressed.
290
374
  *
291
375
  * @example
292
376
  * ```ts
293
- * const publicKey = await Signer.recoverPublicKey(tx);
377
+ * const publicKeys = await Signer.recoverPublicKeys(tx);
294
378
  * ```
295
379
  *
296
380
  * If the signature data contains more data, like in the
@@ -324,7 +408,7 @@ class Signer {
324
408
  * defaultTypeName: "pow_signature_data",
325
409
  * });
326
410
  *
327
- * const signer = await signer.recoverPublicKey(block, {
411
+ * const publicKeys = await signer.recoverPublicKeys(block, {
328
412
  * transformSignature: async (signatureData) => {
329
413
  * const powSignatureData = await serializer.deserialize(signatureData);
330
414
  * return powSignatureData.recoverable_signature;
@@ -332,54 +416,50 @@ class Signer {
332
416
  * });
333
417
  * ```
334
418
  */
335
- async recoverPublicKey(txOrBlock, opts) {
336
- if (!txOrBlock.active)
337
- throw new Error("active is not defined");
338
- if (!txOrBlock.signature_data)
339
- throw new Error("signature_data is not defined");
340
- let signatureData = txOrBlock.signature_data;
341
- if (opts && typeof opts.transformSignature === "function") {
342
- signatureData = await opts.transformSignature(txOrBlock.signature_data);
343
- }
419
+ async recoverPublicKeys(txOrBlock, opts) {
344
420
  let compressed = true;
345
- if (opts && typeof opts.compressed !== "undefined") {
421
+ if (opts && opts.compressed !== undefined) {
346
422
  compressed = opts.compressed;
347
423
  }
424
+ let signatures = [];
425
+ let headerBytes;
348
426
  const block = txOrBlock;
349
- let hash;
350
- const activeBytes = (0, utils_1.decodeBase64)(block.active);
351
- if (block.header) {
352
- const headerBytes = await this.serializer.serialize(block.header, "block_header", { bytesConversion: true });
353
- const headerActiveBytes = new Uint8Array(headerBytes.length + activeBytes.length);
354
- headerActiveBytes.set(headerBytes, 0);
355
- headerActiveBytes.set(activeBytes, headerBytes.length);
356
- hash = (0, sha256_1.sha256)(headerActiveBytes);
427
+ if (block.signature) {
428
+ if (!block.header)
429
+ throw new Error("Missing block header");
430
+ if (!block.signature)
431
+ throw new Error("Missing block signature");
432
+ signatures = [block.signature];
433
+ const headerDecoded = (0, utils_1.btypeDecode)(block.header, btypeBlockHeader);
434
+ const message = protocol_proto_js_1.koinos.protocol.block_header.create(headerDecoded);
435
+ headerBytes = protocol_proto_js_1.koinos.protocol.block_header.encode(message).finish();
357
436
  }
358
437
  else {
359
- // transaction
360
- hash = (0, sha256_1.sha256)(activeBytes);
438
+ const transaction = txOrBlock;
439
+ if (!transaction.header)
440
+ throw new Error("Missing transaction header");
441
+ if (!transaction.signatures)
442
+ throw new Error("Missing transaction signatures");
443
+ signatures = transaction.signatures;
444
+ const headerDecoded = (0, utils_1.btypeDecode)(transaction.header, btypeTransactionHeader);
445
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
446
+ headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header.encode(message).finish();
361
447
  }
362
- const compactSignatureHex = (0, utils_1.toHexString)((0, utils_1.decodeBase64)(signatureData));
363
- const recovery = Number(`0x${compactSignatureHex.slice(0, 2)}`) - 31;
364
- const rHex = compactSignatureHex.slice(2, 66);
365
- const sHex = compactSignatureHex.slice(66);
366
- const r = BigInt(`0x${rHex}`);
367
- const s = BigInt(`0x${sHex}`);
368
- const sig = new secp.Signature(r, s);
369
- const publicKey = secp.recoverPublicKey((0, utils_1.toHexString)(hash), sig.toHex(), recovery);
370
- if (!publicKey)
371
- throw new Error("Public key cannot be recovered");
372
- if (!compressed)
373
- return (0, utils_1.toHexString)(publicKey);
374
- return secp.Point.fromHex(publicKey).toHex(true);
448
+ const hash = (0, sha256_1.sha256)(headerBytes);
449
+ return Promise.all(signatures.map(async (signature) => {
450
+ if (opts && typeof opts.transformSignature === "function") {
451
+ signature = await opts.transformSignature(signature);
452
+ }
453
+ return Signer.recoverPublicKey(hash, (0, utils_1.decodeBase64url)(signature), compressed);
454
+ }));
375
455
  }
376
456
  /**
377
- * Function to recover the signer address from a signed
457
+ * Function to recover the signer addresses from a signed
378
458
  * transaction or block.
379
459
  * The output format can be compressed (default) or uncompressed.
380
460
  * @example
381
461
  * ```ts
382
- * const publicKey = await signer.recoverAddress(tx);
462
+ * const addresses = await signer.recoverAddress(tx);
383
463
  * ```
384
464
  *
385
465
  * If the signature data contains more data, like in the
@@ -413,7 +493,7 @@ class Signer {
413
493
  * defaultTypeName: "pow_signature_data",
414
494
  * });
415
495
  *
416
- * const signer = await signer.recoverAddress(block, {
496
+ * const addresses = await signer.recoverAddress(block, {
417
497
  * transformSignature: async (signatureData) => {
418
498
  * const powSignatureData = await serializer.deserialize(signatureData);
419
499
  * return powSignatureData.recoverable_signature;
@@ -421,46 +501,157 @@ class Signer {
421
501
  * });
422
502
  * ```
423
503
  */
424
- async recoverAddress(txOrBlock, opts) {
425
- const publicKey = await this.recoverPublicKey(txOrBlock, opts);
426
- return (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(publicKey));
504
+ async recoverAddresses(txOrBlock, opts) {
505
+ const publicKeys = await this.recoverPublicKeys(txOrBlock, opts);
506
+ return publicKeys.map((publicKey) => (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(publicKey)));
427
507
  }
428
508
  /**
429
- * Function to encode a transaction
430
- * @param activeData - Active data consists of nonce, rc_limit, and
431
- * operations. Do not set the nonce to get it from the blockchain
509
+ * Function to prepare a transaction
510
+ * @param tx - Do not set the nonce to get it from the blockchain
432
511
  * using the provider. The rc_limit is 1e8 by default.
433
- * @returns A transaction encoded. The active field is encoded in
434
- * base64url
512
+ * @returns A prepared transaction. ()
435
513
  */
436
- async encodeTransaction(activeData) {
437
- let { nonce } = activeData;
438
- if (activeData.nonce === undefined) {
514
+ async prepareTransaction(tx) {
515
+ var _a, _b;
516
+ if (!tx.header) {
517
+ tx.header = {};
518
+ }
519
+ const payer = (_a = tx.header.payer) !== null && _a !== void 0 ? _a : this.address;
520
+ const { payee } = tx.header;
521
+ let nonce;
522
+ if (tx.header.nonce === undefined) {
523
+ if (!this.provider)
524
+ throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the transaction header");
525
+ const oldNonce = (await this.provider.getNonce(payee || payer));
526
+ const message = protocol_proto_js_1.koinos.chain.value_type.create({
527
+ // todo: consider using bigint for big nonces
528
+ uint64_value: String(oldNonce + 1),
529
+ });
530
+ const nonceEncoded = protocol_proto_js_1.koinos.chain.value_type
531
+ .encode(message)
532
+ .finish();
533
+ nonce = (0, utils_1.encodeBase64url)(nonceEncoded);
534
+ }
535
+ else {
536
+ nonce = tx.header.nonce;
537
+ }
538
+ let rcLimit;
539
+ if (tx.header.rc_limit === undefined) {
439
540
  if (!this.provider)
440
- throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the parameters");
441
- // TODO: Option to resolve names
442
- // this depends on the final architecture for names on Koinos
443
- nonce = await this.provider.getNonce(this.getAddress());
541
+ throw new Error("Cannot get the rc_limit because provider is undefined. To skip this call set a rc_limit in the transaction header");
542
+ rcLimit = await this.provider.getAccountRc(payer);
444
543
  }
445
- const rcLimit = activeData.rc_limit === undefined ? 1e8 : activeData.rc_limit;
446
- const operations = activeData.operations ? activeData.operations : [];
447
- const activeData2 = {
544
+ else {
545
+ rcLimit = tx.header.rc_limit;
546
+ }
547
+ let chainId = tx.header.chain_id || this.chainId;
548
+ if (!chainId) {
549
+ if (!this.provider)
550
+ throw new Error("Cannot get the chain_id because provider is undefined. To skip this call set a chain_id in the Signer");
551
+ chainId = await this.provider.getChainId();
552
+ this.chainId = chainId;
553
+ }
554
+ const operationsHashes = [];
555
+ if (tx.operations) {
556
+ for (let index = 0; index < ((_b = tx.operations) === null || _b === void 0 ? void 0 : _b.length); index += 1) {
557
+ const operationDecoded = (0, utils_1.btypeDecode)(tx.operations[index], btypesOperation);
558
+ const message = protocol_proto_js_1.koinos.protocol.operation.create(operationDecoded);
559
+ const operationEncoded = protocol_proto_js_1.koinos.protocol.operation
560
+ .encode(message)
561
+ .finish();
562
+ operationsHashes.push((0, sha256_1.sha256)(operationEncoded));
563
+ }
564
+ }
565
+ const operationMerkleRoot = (0, utils_1.encodeBase64url)(new Uint8Array([
566
+ // multihash sha256: 18, 32
567
+ 18,
568
+ 32,
569
+ ...(0, utils_1.calculateMerkleRoot)(operationsHashes),
570
+ ]));
571
+ tx.header = {
572
+ chain_id: chainId,
448
573
  rc_limit: rcLimit,
449
574
  nonce,
450
- operations,
451
- };
452
- const buffer = await this.serializer.serialize(activeData2, "active_transaction_data");
453
- return {
454
- active: (0, utils_1.encodeBase64)(buffer),
575
+ operation_merkle_root: operationMerkleRoot,
576
+ payer,
577
+ ...(payee && { payee }),
578
+ // TODO: Option to resolve names (payer, payee)
455
579
  };
580
+ const headerDecoded = (0, utils_1.btypeDecode)(tx.header, btypeTransactionHeader);
581
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
582
+ const headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header
583
+ .encode(message)
584
+ .finish();
585
+ const hash = (0, sha256_1.sha256)(headerBytes);
586
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
587
+ tx.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
588
+ return tx;
456
589
  }
457
590
  /**
458
- * Function to decode a transaction
591
+ * Function to prepare a block
592
+ * @param block -
593
+ * @returns A prepared block. ()
459
594
  */
460
- async decodeTransaction(tx) {
461
- if (!tx.active)
462
- throw new Error("Active data is not defined");
463
- return this.serializer.deserialize(tx.active, "active_transaction_data");
595
+ async prepareBlock(block) {
596
+ var _a;
597
+ if (!block.header) {
598
+ block.header = {};
599
+ }
600
+ const hashes = [];
601
+ if (block.transactions) {
602
+ for (let index = 0; index < block.transactions.length; index++) {
603
+ const tx = block.transactions[index];
604
+ const headerDecoded = (0, utils_1.btypeDecode)(tx.header, btypeTransactionHeader);
605
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
606
+ const headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header
607
+ .encode(message)
608
+ .finish();
609
+ hashes.push((0, sha256_1.sha256)(headerBytes));
610
+ let signaturesBytes = new Uint8Array();
611
+ (_a = tx.signatures) === null || _a === void 0 ? void 0 : _a.forEach((sig) => {
612
+ signaturesBytes = new Uint8Array([
613
+ ...signaturesBytes,
614
+ ...(0, utils_1.decodeBase64url)(sig),
615
+ ]);
616
+ });
617
+ hashes.push((0, sha256_1.sha256)(signaturesBytes));
618
+ }
619
+ }
620
+ // retrieve head info if not provided
621
+ // eslint-disable-next-line @typescript-eslint/naming-convention
622
+ let { height, previous, previous_state_merkle_root } = block.header;
623
+ if (!height || !previous || !previous_state_merkle_root) {
624
+ if (!this.provider) {
625
+ throw new Error("Cannot get the head info because provider is undefined.");
626
+ }
627
+ const headInfo = await this.provider.getHeadInfo();
628
+ height = height || `${Number(headInfo.head_topology.height) + 1}`;
629
+ previous = previous || headInfo.head_topology.id;
630
+ previous_state_merkle_root =
631
+ previous_state_merkle_root || headInfo.head_state_merkle_root;
632
+ }
633
+ block.header = {
634
+ height,
635
+ previous,
636
+ previous_state_merkle_root,
637
+ timestamp: block.header.timestamp || `${Date.now()}`,
638
+ transaction_merkle_root: (0, utils_1.encodeBase64url)(new Uint8Array([
639
+ // multihash sha256: 18, 32
640
+ 18,
641
+ 32,
642
+ ...(0, utils_1.calculateMerkleRoot)(hashes),
643
+ ])),
644
+ signer: this.address,
645
+ };
646
+ const headerDecoded = (0, utils_1.btypeDecode)(block.header, btypeBlockHeader);
647
+ const message = protocol_proto_js_1.koinos.protocol.block_header.create(headerDecoded);
648
+ const headerBytes = protocol_proto_js_1.koinos.protocol.block_header
649
+ .encode(message)
650
+ .finish();
651
+ const hash = (0, sha256_1.sha256)(headerBytes);
652
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
653
+ block.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
654
+ return block;
464
655
  }
465
656
  }
466
657
  exports.Signer = Signer;
@@ -1 +1 @@
1
- {"version":3,"file":"Signer.js","sourceRoot":"","sources":["../../src/Signer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,iDAA8C;AAC9C,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,KAAK;aACvB,CAAC,CAAC;SACJ;QACD,IAAI,OAAO,CAAC,CA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AC,MAAM,CAAC;aAC/B,CAAC,CACH;YACD,MAAM,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;QAEF,MAAM,aAAa,GAAG,IAAA,mBAAW,EAAC,KAAK,CAAC,MAAM,EAAE,gBAAiB,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,0BAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,0BAAM,CAAC,QAAQ,CAAC,YAAY;aAC7C,MAAM,CAAC,OAAO,CAAC;aACf,MAAM,EAAgB,CAAC;QAE1B,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC;QAEjC,6DAA6D;QAC7D,KAAK,CAAC,EAAE,GAAG,SAAS,IAAA,mBAAW,EAAC,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA5nBD,wBA4nBC;AAED,kBAAe,MAAM,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
2
- export * as utils from "./utils";
2
+ export * as utils from "./indexUtils";
3
3
  export * as interfaces from "./interface";
4
4
  export * from "./Contract";
5
5
  export * from "./Signer";
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.interfaces = exports.utils = void 0;
26
26
  /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
27
27
  // eslint-disable import/no-cycle
28
- exports.utils = __importStar(require("./utils"));
28
+ exports.utils = __importStar(require("./indexUtils"));
29
29
  exports.interfaces = __importStar(require("./interface"));
30
30
  __exportStar(require("./Contract"), exports);
31
31
  __exportStar(require("./Signer"), exports);
@@ -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;AAC3B,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,iCAAiC;AACjC,sDAAsC;AACtC,0DAA0C;AAC1C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,+CAA6B"}
@@ -0,0 +1,2 @@
1
+ export * from "./utils";
2
+ export * from "./utilsNode";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./utils"), exports);
14
+ __exportStar(require("./utilsNode"), exports);
15
+ //# sourceMappingURL=indexUtils.js.map