koilib 2.6.1 → 3.0.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.
Files changed (66) hide show
  1. package/README.md +66 -12
  2. package/dist/koinos.js +8533 -274
  3. package/dist/koinos.min.js +1 -1
  4. package/lib/Contract.d.ts +53 -16
  5. package/lib/Contract.js +99 -31
  6. package/lib/Contract.js.map +1 -1
  7. package/lib/Provider.d.ts +39 -19
  8. package/lib/Provider.js +119 -87
  9. package/lib/Provider.js.map +1 -1
  10. package/lib/Serializer.d.ts +8 -3
  11. package/lib/Serializer.js +60 -41
  12. package/lib/Serializer.js.map +1 -1
  13. package/lib/Signer.d.ts +53 -39
  14. package/lib/Signer.js +320 -91
  15. package/lib/Signer.js.map +1 -1
  16. package/lib/browser/Contract.d.ts +53 -16
  17. package/lib/browser/Contract.js +99 -31
  18. package/lib/browser/Contract.js.map +1 -1
  19. package/lib/browser/Provider.d.ts +39 -19
  20. package/lib/browser/Provider.js +119 -87
  21. package/lib/browser/Provider.js.map +1 -1
  22. package/lib/browser/Serializer.d.ts +8 -3
  23. package/lib/browser/Serializer.js +60 -41
  24. package/lib/browser/Serializer.js.map +1 -1
  25. package/lib/browser/Signer.d.ts +53 -39
  26. package/lib/browser/Signer.js +320 -91
  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 -65
  35. package/lib/browser/jsonDescriptors/chain-proto.json +676 -0
  36. package/lib/browser/jsonDescriptors/krc20-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 +18 -254
  41. package/lib/browser/utils.js +140 -12
  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 -65
  53. package/lib/jsonDescriptors/chain-proto.json +676 -0
  54. package/lib/jsonDescriptors/krc20-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 +18 -254
  59. package/lib/utils.js +140 -12
  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,18 +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
- defaultTypeName: "active_transaction_data",
113
- bytesConversion: false,
114
- });
115
- }
116
165
  if (typeof c.privateKey === "string") {
117
166
  this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
118
167
  this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
@@ -121,6 +170,8 @@ class Signer {
121
170
  this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
122
171
  this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
123
172
  }
173
+ if (c.chainId)
174
+ this.chainId = c.chainId;
124
175
  }
125
176
  /**
126
177
  * Function to import a private key from the WIF
@@ -133,12 +184,12 @@ class Signer {
133
184
  * ```
134
185
  * @returns Signer object
135
186
  */
136
- static fromWif(wif) {
137
- const compressed = wif[0] !== "5";
187
+ static fromWif(wif, compressed) {
188
+ const comp = compressed === undefined ? wif[0] !== "5" : compressed;
138
189
  const privateKey = (0, utils_1.bitcoinDecode)(wif);
139
190
  return new Signer({
140
191
  privateKey: (0, utils_1.toHexString)(privateKey),
141
- compressed,
192
+ compressed: comp,
142
193
  });
143
194
  }
144
195
  /**
@@ -211,15 +262,11 @@ class Signer {
211
262
  }
212
263
  }
213
264
  /**
214
- * Function to sign a transaction. It's important to remark that
215
- * the transaction parameter is modified inside this function.
216
- * @param tx - Unsigned transaction
217
- * @returns
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
218
268
  */
219
- async signTransaction(tx) {
220
- if (!tx.active)
221
- throw new Error("Active data is not defined");
222
- const hash = (0, sha256_1.sha256)((0, utils_1.decodeBase64)(tx.active));
269
+ async signHash(hash) {
223
270
  const [compSignature, recovery] = await secp.sign(hash, this.privateKey, {
224
271
  recovered: true,
225
272
  canonical: true,
@@ -228,11 +275,42 @@ class Signer {
228
275
  const compactSignature = new Uint8Array(65);
229
276
  compactSignature.set([recovery + 31], 0);
230
277
  compactSignature.set(compSignature, 1);
231
- tx.signature_data = (0, utils_1.encodeBase64)(compactSignature);
232
- const multihash = `0x1220${(0, utils_1.toHexString)(hash)}`; // 12: code sha2-256. 20: length (32 bytes)
233
- tx.id = multihash;
278
+ return compactSignature;
279
+ }
280
+ /**
281
+ * Function to sign a transaction. It's important to remark that
282
+ * the transaction parameter is modified inside this function.
283
+ * @param tx - Unsigned transaction
284
+ */
285
+ async signTransaction(tx, _abis) {
286
+ if (!tx.id)
287
+ throw new Error("Missing transaction id");
288
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
289
+ // tx id is a stringified multihash, need to extract the hash digest only
290
+ const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
291
+ const signature = await this.signHash(hash);
292
+ if (!tx.signatures)
293
+ tx.signatures = [];
294
+ tx.signatures.push((0, utils_1.encodeBase64url)(signature));
234
295
  return tx;
235
296
  }
297
+ /**
298
+ * Function to sign a block for federated consensus. That is,
299
+ * just the ecdsa signature. For other algorithms, like PoW,
300
+ * you have to sign the block and then process the signature
301
+ * to add the extra data (nonce in the case of PoW).
302
+ * @param block - Unsigned block
303
+ */
304
+ async signBlock(block) {
305
+ if (!block.id)
306
+ throw new Error("Missing block id");
307
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
308
+ // block id is a stringified multihash, need to extract the hash digest only
309
+ const hash = (0, utils_1.toUint8Array)(block.id.slice(6));
310
+ const signature = await this.signHash(hash);
311
+ block.signature = (0, utils_1.encodeBase64url)(signature);
312
+ return block;
313
+ }
236
314
  /**
237
315
  * Function to sign and send a transaction. It internally uses
238
316
  * [[Provider.sendTransaction]]
@@ -243,20 +321,51 @@ class Signer {
243
321
  * @returns
244
322
  */
245
323
  async sendTransaction(tx, _abis) {
246
- if (!tx.signature_data || !tx.id)
247
- await this.signTransaction(tx);
324
+ var _a;
325
+ if (!tx.signatures || !((_a = tx.signatures) === null || _a === void 0 ? void 0 : _a.length))
326
+ tx = await this.signTransaction(tx);
248
327
  if (!this.provider)
249
328
  throw new Error("provider is undefined");
250
- return this.provider.sendTransaction(tx);
329
+ await this.provider.sendTransaction(tx);
330
+ tx.wait = async (type = "byBlock", timeout = 30000) => {
331
+ if (!this.provider)
332
+ throw new Error("provider is undefined");
333
+ return this.provider.wait(tx.id, type, timeout);
334
+ };
335
+ return tx;
251
336
  }
252
337
  /**
253
- * Function to recover the public key from a signed
338
+ * Function to recover the public key from hash and signature
339
+ * @param hash - hash sha256
340
+ * @param signature - compact signature
341
+ * @param compressed - default true
342
+ */
343
+ static recoverPublicKey(hash, signature, compressed = true) {
344
+ const compactSignatureHex = (0, utils_1.toHexString)(signature);
345
+ const recovery = Number(`0x${compactSignatureHex.slice(0, 2)}`) - 31;
346
+ const rHex = compactSignatureHex.slice(2, 66);
347
+ const sHex = compactSignatureHex.slice(66);
348
+ const r = BigInt(`0x${rHex}`);
349
+ const s = BigInt(`0x${sHex}`);
350
+ const sig = new secp.Signature(r, s);
351
+ const publicKey = secp.recoverPublicKey((0, utils_1.toHexString)(hash), sig.toHex(), recovery);
352
+ if (!publicKey)
353
+ throw new Error("Public key cannot be recovered");
354
+ if (!compressed) {
355
+ return (0, utils_1.toHexString)(publicKey);
356
+ }
357
+ else {
358
+ return secp.Point.fromHex(publicKey).toHex(true);
359
+ }
360
+ }
361
+ /**
362
+ * Function to recover the publics keys from a signed
254
363
  * transaction or block.
255
364
  * The output format can be compressed (default) or uncompressed.
256
365
  *
257
366
  * @example
258
367
  * ```ts
259
- * const publicKey = await Signer.recoverPublicKey(tx);
368
+ * const publicKeys = await Signer.recoverPublicKeys(tx);
260
369
  * ```
261
370
  *
262
371
  * If the signature data contains more data, like in the
@@ -290,7 +399,7 @@ class Signer {
290
399
  * defaultTypeName: "pow_signature_data",
291
400
  * });
292
401
  *
293
- * const signer = await Signer.recoverPublicKey(block, {
402
+ * const publicKeys = await signer.recoverPublicKeys(block, {
294
403
  * transformSignature: async (signatureData) => {
295
404
  * const powSignatureData = await serializer.deserialize(signatureData);
296
405
  * return powSignatureData.recoverable_signature;
@@ -298,41 +407,50 @@ class Signer {
298
407
  * });
299
408
  * ```
300
409
  */
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
- }
410
+ async recoverPublicKeys(txOrBlock, opts) {
310
411
  let compressed = true;
311
- if (opts && typeof opts.compressed !== "undefined") {
412
+ if (opts && opts.compressed !== undefined) {
312
413
  compressed = opts.compressed;
313
414
  }
314
- const hash = (0, sha256_1.sha256)((0, utils_1.decodeBase64)(txOrBlock.active));
315
- const compactSignatureHex = (0, utils_1.toHexString)((0, utils_1.decodeBase64)(signatureData));
316
- const recovery = Number(`0x${compactSignatureHex.slice(0, 2)}`) - 31;
317
- const rHex = compactSignatureHex.slice(2, 66);
318
- const sHex = compactSignatureHex.slice(66);
319
- const r = BigInt(`0x${rHex}`);
320
- const s = BigInt(`0x${sHex}`);
321
- const sig = new secp.Signature(r, s);
322
- const publicKey = secp.recoverPublicKey((0, utils_1.toHexString)(hash), sig.toHex(), recovery);
323
- if (!publicKey)
324
- throw new Error("Public key cannot be recovered");
325
- if (!compressed)
326
- return (0, utils_1.toHexString)(publicKey);
327
- return secp.Point.fromHex(publicKey).toHex(true);
415
+ let signatures = [];
416
+ let headerBytes;
417
+ const block = txOrBlock;
418
+ if (block.signature) {
419
+ if (!block.header)
420
+ throw new Error("Missing block header");
421
+ if (!block.signature)
422
+ throw new Error("Missing block signature");
423
+ signatures = [block.signature];
424
+ const headerDecoded = (0, utils_1.btypeDecode)(block.header, btypeBlockHeader);
425
+ const message = protocol_proto_js_1.koinos.protocol.block_header.create(headerDecoded);
426
+ headerBytes = protocol_proto_js_1.koinos.protocol.block_header.encode(message).finish();
427
+ }
428
+ else {
429
+ const transaction = txOrBlock;
430
+ if (!transaction.header)
431
+ throw new Error("Missing transaction header");
432
+ if (!transaction.signatures)
433
+ throw new Error("Missing transaction signatures");
434
+ signatures = transaction.signatures;
435
+ const headerDecoded = (0, utils_1.btypeDecode)(transaction.header, btypeTransactionHeader);
436
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
437
+ headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header.encode(message).finish();
438
+ }
439
+ const hash = (0, sha256_1.sha256)(headerBytes);
440
+ return Promise.all(signatures.map(async (signature) => {
441
+ if (opts && typeof opts.transformSignature === "function") {
442
+ signature = await opts.transformSignature(signature);
443
+ }
444
+ return Signer.recoverPublicKey(hash, (0, utils_1.decodeBase64url)(signature), compressed);
445
+ }));
328
446
  }
329
447
  /**
330
- * Function to recover the signer address from a signed
448
+ * Function to recover the signer addresses from a signed
331
449
  * transaction or block.
332
450
  * The output format can be compressed (default) or uncompressed.
333
451
  * @example
334
452
  * ```ts
335
- * const publicKey = await Signer.recoverAddress(tx);
453
+ * const addresses = await signer.recoverAddress(tx);
336
454
  * ```
337
455
  *
338
456
  * If the signature data contains more data, like in the
@@ -366,7 +484,7 @@ class Signer {
366
484
  * defaultTypeName: "pow_signature_data",
367
485
  * });
368
486
  *
369
- * const signer = await Signer.recoverAddress(block, {
487
+ * const addresses = await signer.recoverAddress(block, {
370
488
  * transformSignature: async (signatureData) => {
371
489
  * const powSignatureData = await serializer.deserialize(signatureData);
372
490
  * return powSignatureData.recoverable_signature;
@@ -374,46 +492,157 @@ class Signer {
374
492
  * });
375
493
  * ```
376
494
  */
377
- static async recoverAddress(txOrBlock, opts) {
378
- const publicKey = await Signer.recoverPublicKey(txOrBlock, opts);
379
- return (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(publicKey));
495
+ async recoverAddresses(txOrBlock, opts) {
496
+ const publicKeys = await this.recoverPublicKeys(txOrBlock, opts);
497
+ return publicKeys.map((publicKey) => (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(publicKey)));
380
498
  }
381
499
  /**
382
- * Function to encode a transaction
383
- * @param activeData - Active data consists of nonce, rc_limit, and
384
- * operations. Do not set the nonce to get it from the blockchain
385
- * using the provider. The rc_limit is 1000000 by default.
386
- * @returns A transaction encoded. The active field is encoded in
387
- * base64url
500
+ * Function to prepare a transaction
501
+ * @param tx - Do not set the nonce to get it from the blockchain
502
+ * using the provider. The rc_limit is 1e8 by default.
503
+ * @returns A prepared transaction. ()
388
504
  */
389
- async encodeTransaction(activeData) {
390
- let { nonce } = activeData;
391
- if (activeData.nonce === undefined) {
505
+ async prepareTransaction(tx) {
506
+ var _a, _b;
507
+ if (!tx.header) {
508
+ tx.header = {};
509
+ }
510
+ const payer = (_a = tx.header.payer) !== null && _a !== void 0 ? _a : this.address;
511
+ const { payee } = tx.header;
512
+ let nonce;
513
+ if (tx.header.nonce === undefined) {
392
514
  if (!this.provider)
393
- throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the parameters");
394
- // TODO: Option to resolve names
395
- // this depends on the final architecture for names on Koinos
396
- nonce = await this.provider.getNonce(this.getAddress());
515
+ throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the transaction header");
516
+ const oldNonce = (await this.provider.getNonce(payee || payer));
517
+ const message = protocol_proto_js_1.koinos.chain.value_type.create({
518
+ // todo: consider using bigint for big nonces
519
+ uint64_value: String(oldNonce + 1),
520
+ });
521
+ const nonceEncoded = protocol_proto_js_1.koinos.chain.value_type
522
+ .encode(message)
523
+ .finish();
524
+ nonce = (0, utils_1.encodeBase64url)(nonceEncoded);
397
525
  }
398
- const rcLimit = activeData.rc_limit === undefined ? 1000000 : activeData.rc_limit;
399
- const operations = activeData.operations ? activeData.operations : [];
400
- const activeData2 = {
526
+ else {
527
+ nonce = tx.header.nonce;
528
+ }
529
+ let rcLimit;
530
+ if (tx.header.rc_limit === undefined) {
531
+ if (!this.provider)
532
+ throw new Error("Cannot get the rc_limit because provider is undefined. To skip this call set a rc_limit in the transaction header");
533
+ rcLimit = await this.provider.getAccountRc(payer);
534
+ }
535
+ else {
536
+ rcLimit = tx.header.rc_limit;
537
+ }
538
+ let chainId = tx.header.chain_id || this.chainId;
539
+ if (!chainId) {
540
+ if (!this.provider)
541
+ throw new Error("Cannot get the chain_id because provider is undefined. To skip this call set a chain_id in the Signer");
542
+ chainId = await this.provider.getChainId();
543
+ this.chainId = chainId;
544
+ }
545
+ const operationsHashes = [];
546
+ if (tx.operations) {
547
+ for (let index = 0; index < ((_b = tx.operations) === null || _b === void 0 ? void 0 : _b.length); index += 1) {
548
+ const operationDecoded = (0, utils_1.btypeDecode)(tx.operations[index], btypesOperation);
549
+ const message = protocol_proto_js_1.koinos.protocol.operation.create(operationDecoded);
550
+ const operationEncoded = protocol_proto_js_1.koinos.protocol.operation
551
+ .encode(message)
552
+ .finish();
553
+ operationsHashes.push((0, sha256_1.sha256)(operationEncoded));
554
+ }
555
+ }
556
+ const operationMerkleRoot = (0, utils_1.encodeBase64url)(new Uint8Array([
557
+ // multihash sha256: 18, 32
558
+ 18,
559
+ 32,
560
+ ...(0, utils_1.calculateMerkleRoot)(operationsHashes),
561
+ ]));
562
+ tx.header = {
563
+ chain_id: chainId,
401
564
  rc_limit: rcLimit,
402
565
  nonce,
403
- operations,
404
- };
405
- const buffer = await this.serializer.serialize(activeData2);
406
- return {
407
- active: (0, utils_1.encodeBase64)(buffer),
566
+ operation_merkle_root: operationMerkleRoot,
567
+ payer,
568
+ ...(payee && { payee }),
569
+ // TODO: Option to resolve names (payer, payee)
408
570
  };
571
+ const headerDecoded = (0, utils_1.btypeDecode)(tx.header, btypeTransactionHeader);
572
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
573
+ const headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header
574
+ .encode(message)
575
+ .finish();
576
+ const hash = (0, sha256_1.sha256)(headerBytes);
577
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
578
+ tx.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
579
+ return tx;
409
580
  }
410
581
  /**
411
- * Function to decode a transaction
582
+ * Function to prepare a block
583
+ * @param block -
584
+ * @returns A prepared block. ()
412
585
  */
413
- async decodeTransaction(tx) {
414
- if (!tx.active)
415
- throw new Error("Active data is not defined");
416
- return this.serializer.deserialize(tx.active);
586
+ async prepareBlock(block) {
587
+ var _a;
588
+ if (!block.header) {
589
+ block.header = {};
590
+ }
591
+ const hashes = [];
592
+ if (block.transactions) {
593
+ for (let index = 0; index < block.transactions.length; index++) {
594
+ const tx = block.transactions[index];
595
+ const headerDecoded = (0, utils_1.btypeDecode)(tx.header, btypeTransactionHeader);
596
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
597
+ const headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header
598
+ .encode(message)
599
+ .finish();
600
+ hashes.push((0, sha256_1.sha256)(headerBytes));
601
+ let signaturesBytes = new Uint8Array();
602
+ (_a = tx.signatures) === null || _a === void 0 ? void 0 : _a.forEach((sig) => {
603
+ signaturesBytes = new Uint8Array([
604
+ ...signaturesBytes,
605
+ ...(0, utils_1.decodeBase64url)(sig),
606
+ ]);
607
+ });
608
+ hashes.push((0, sha256_1.sha256)(signaturesBytes));
609
+ }
610
+ }
611
+ // retrieve head info if not provided
612
+ // eslint-disable-next-line @typescript-eslint/naming-convention
613
+ let { height, previous, previous_state_merkle_root } = block.header;
614
+ if (!height || !previous || !previous_state_merkle_root) {
615
+ if (!this.provider) {
616
+ throw new Error("Cannot get the head info because provider is undefined.");
617
+ }
618
+ const headInfo = await this.provider.getHeadInfo();
619
+ height = height || `${Number(headInfo.head_topology.height) + 1}`;
620
+ previous = previous || headInfo.head_topology.id;
621
+ previous_state_merkle_root =
622
+ previous_state_merkle_root || headInfo.head_state_merkle_root;
623
+ }
624
+ block.header = {
625
+ height,
626
+ previous,
627
+ previous_state_merkle_root,
628
+ timestamp: block.header.timestamp || `${Date.now()}`,
629
+ transaction_merkle_root: (0, utils_1.encodeBase64url)(new Uint8Array([
630
+ // multihash sha256: 18, 32
631
+ 18,
632
+ 32,
633
+ ...(0, utils_1.calculateMerkleRoot)(hashes),
634
+ ])),
635
+ signer: this.address,
636
+ };
637
+ const headerDecoded = (0, utils_1.btypeDecode)(block.header, btypeBlockHeader);
638
+ const message = protocol_proto_js_1.koinos.protocol.block_header.create(headerDecoded);
639
+ const headerBytes = protocol_proto_js_1.koinos.protocol.block_header
640
+ .encode(message)
641
+ .finish();
642
+ const hash = (0, sha256_1.sha256)(headerBytes);
643
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
644
+ block.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
645
+ return block;
417
646
  }
418
647
  }
419
648
  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,UAA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ib - 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexUtils.js","sourceRoot":"","sources":["../../src/indexUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B"}