koilib 5.6.1 → 5.7.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 (64) hide show
  1. package/LICENSE +21 -21
  2. package/dist/koinos.js +1493 -637
  3. package/dist/koinos.min.js +1 -1
  4. package/lib/Contract.d.ts +4 -4
  5. package/lib/Contract.js +4 -4
  6. package/lib/Contract.js.map +1 -1
  7. package/lib/Provider.d.ts +42 -12
  8. package/lib/Provider.js +99 -6
  9. package/lib/Provider.js.map +1 -1
  10. package/lib/Serializer.d.ts +20 -0
  11. package/lib/Serializer.js +4 -0
  12. package/lib/Serializer.js.map +1 -1
  13. package/lib/Signer.d.ts +0 -10
  14. package/lib/Signer.js +1 -123
  15. package/lib/Signer.js.map +1 -1
  16. package/lib/Transaction.d.ts +3 -3
  17. package/lib/Transaction.js +4 -4
  18. package/lib/Transaction.js.map +1 -1
  19. package/lib/browser/Contract.d.ts +4 -4
  20. package/lib/browser/Contract.js +4 -4
  21. package/lib/browser/Contract.js.map +1 -1
  22. package/lib/browser/Provider.d.ts +42 -12
  23. package/lib/browser/Provider.js +99 -6
  24. package/lib/browser/Provider.js.map +1 -1
  25. package/lib/browser/Serializer.d.ts +20 -0
  26. package/lib/browser/Serializer.js +4 -0
  27. package/lib/browser/Serializer.js.map +1 -1
  28. package/lib/browser/Signer.d.ts +0 -10
  29. package/lib/browser/Signer.js +1 -123
  30. package/lib/browser/Signer.js.map +1 -1
  31. package/lib/browser/Transaction.d.ts +3 -3
  32. package/lib/browser/Transaction.js +4 -4
  33. package/lib/browser/Transaction.js.map +1 -1
  34. package/lib/browser/index.d.ts +1 -1
  35. package/lib/browser/index.js +2 -2
  36. package/lib/browser/index.js.map +1 -1
  37. package/lib/browser/interface.d.ts +17 -2
  38. package/lib/browser/jsonDescriptors/chain-proto.json +74 -3
  39. package/lib/browser/jsonDescriptors/token-proto.json +5 -26
  40. package/lib/browser/protoModules/protocol-proto.js +823 -0
  41. package/lib/browser/protoModules/protocol-proto.js.map +1 -1
  42. package/lib/browser/utilsNode.d.ts +72 -117
  43. package/lib/index.d.ts +1 -1
  44. package/lib/index.js +2 -2
  45. package/lib/index.js.map +1 -1
  46. package/lib/interface.d.ts +17 -2
  47. package/lib/jsonDescriptors/chain-proto.json +74 -3
  48. package/lib/jsonDescriptors/token-proto.json +5 -26
  49. package/lib/protoModules/protocol-proto.js +823 -0
  50. package/lib/protoModules/protocol-proto.js.map +1 -1
  51. package/lib/utilsNode.d.ts +72 -117
  52. package/package.json +1 -1
  53. package/src/Contract.ts +6 -5
  54. package/src/Provider.ts +150 -20
  55. package/src/Serializer.ts +27 -0
  56. package/src/Signer.ts +1 -150
  57. package/src/Transaction.ts +8 -8
  58. package/src/index.ts +1 -1
  59. package/src/interface.ts +19 -2
  60. package/src/jsonDescriptors/chain-proto.json +74 -3
  61. package/src/jsonDescriptors/pow-proto.json +1 -1
  62. package/src/jsonDescriptors/token-proto.json +5 -26
  63. package/src/jsonDescriptors/value-proto.json +13 -23
  64. package/src/protoModules/protocol-proto.js +1043 -4
@@ -269,6 +269,22 @@ export declare const ChainTypes: {
269
269
  go_package: string;
270
270
  };
271
271
  nested: {
272
+ object_space: {
273
+ fields: {
274
+ system: {
275
+ type: string;
276
+ id: number;
277
+ };
278
+ zone: {
279
+ type: string;
280
+ id: number;
281
+ };
282
+ id: {
283
+ type: string;
284
+ id: number;
285
+ };
286
+ };
287
+ };
272
288
  event_data: {
273
289
  fields: {
274
290
  sequence: {
@@ -287,123 +303,7 @@ export declare const ChainTypes: {
287
303
  id: number;
288
304
  };
289
305
  data: {
290
- type: string; /**
291
- * Function to encode genesis data in order to launch a
292
- * new blockchain. The different values are serialized using
293
- * protobuffers. One of the arguments is the dictionary which
294
- * contains the relevant information to perform the serialization.
295
- * By default the function contains the dictionary for the
296
- * following keys:
297
- *
298
- * - "object_key::head_block"
299
- * - "object_key::chain_id"
300
- * - "object_key::genesis_key"
301
- * - "object_key::resource_limit_data"
302
- * - "object_key::max_account_resources"
303
- * - "object_key::protocol_descriptor"
304
- * - "object_key::compute_bandwidth_registry"
305
- * - "object_key::block_hash_code"
306
- *
307
- * @param genesisDataDecoded - Genesis data where the values are
308
- * objects.
309
- * @param dictionary - Set of keys which contains the relevant
310
- * information to perform the serialization
311
- *
312
- * @example
313
- *
314
- * ```ts
315
- * const signer = Signer.fromSeed("seed");
316
- * const genesisDataDecoded = {
317
- * entries: [
318
- * {
319
- * space: { system: true },
320
- * alias: "object_key::genesis_key",
321
- * value: signer.address,
322
- * },
323
- * ],
324
- * };
325
- *
326
- * const genesisData = await encodeGenesisData(genesisDataDecoded);
327
- * console.log(genesisData);
328
- *
329
- * // {
330
- * // entries: [
331
- * // {
332
- * // space: { system: true },
333
- * // key: "EiC3nO+XbeKg4C8ugW7M7XdfmJKY4i3l91KoJWxosQPImA==",
334
- * // value: "AMpASH7CjUHBpl2QR8E5lGKVjVLAvJRg5g==",
335
- * // },
336
- * // ],
337
- * // }
338
- * ```
339
- *
340
- * @example adding a custom dictionary
341
- *
342
- * ```ts
343
- * const contractId = Signer.fromSeed("seed").address;
344
- * const zone = encodeBase64(decodeBase58(contractId));
345
- * const genesisDataDecoded = {
346
- * entries: [
347
- * {
348
- * space: { system: true, zone, id: 1 },
349
- * key: "difficulty_metadata_key",
350
- * value: {
351
- * target: encodeBase64url(toUint8Array("F".repeat(64))),
352
- * last_block_time: "1641038400000",
353
- * difficulty: encodeBase64url(toUint8Array("1".repeat(64))),
354
- * target_block_interval: "10",
355
- * },
356
- * },
357
- * ],
358
- * };
359
- *
360
- * const powJson = {
361
- * nested: {
362
- * mypackage: {
363
- * nested: {
364
- * difficulty_metadata: {
365
- * "fields": {
366
- * "target": { "type": "bytes", "id": 1 },
367
- * "last_block_time": { "type": "uint64", "id": 2,
368
- * "options": { "jstype": "JS_STRING" }
369
- * },
370
- * "difficulty": { "type": "bytes", "id": 3 },
371
- * "target_block_interval": { "type": "uint64", "id": 4,
372
- * "options": { "jstype": "JS_STRING" }
373
- * }
374
- * }
375
- * },
376
- * }
377
- * }
378
- * }
379
- * }
380
- *
381
- * const dic = {
382
- * difficulty_metadata_key: {
383
- * serializer: new Serializer(powJson),
384
- * typeName: "difficulty_metadata",
385
- * },
386
- * };
387
- *
388
- * const genesisData = await encodeGenesisData(genesisDataDecoded, dic);
389
- * console.log(genesisData);
390
- *
391
- * // {
392
- * // entries: [
393
- * // {
394
- * // key: "difficulty_metadata_key",
395
- * // space: {
396
- * // id: 1,
397
- * // system: true,
398
- * // zone: "AMpASH7CjUHBpl2QR8E5lGKVjVLAvJRg5g==",
399
- * // },
400
- * // value:
401
- * // "CiD//////////////////////////////////////////xCAlIus4S8aIBERERERERERERERERERERERERERERERERERERERERERIAo=",
402
- * // },
403
- * // ],
404
- * // };
405
- * ```
406
- */
306
+ type: string;
407
307
  id: number;
408
308
  };
409
309
  impacted: {
@@ -684,6 +584,11 @@ export declare const ChainTypes: {
684
584
  type: string;
685
585
  id: number;
686
586
  };
587
+ state_delta_entries: {
588
+ rule: string;
589
+ type: string;
590
+ id: number;
591
+ };
687
592
  };
688
593
  };
689
594
  block_header: {
@@ -814,6 +719,56 @@ export declare const ChainTypes: {
814
719
  type: string;
815
720
  id: number;
816
721
  };
722
+ disk_storage_charged: {
723
+ type: string;
724
+ id: number;
725
+ options: {
726
+ jstype: string;
727
+ };
728
+ };
729
+ network_bandwidth_charged: {
730
+ type: string;
731
+ id: number;
732
+ options: {
733
+ jstype: string;
734
+ };
735
+ };
736
+ compute_bandwidth_charged: {
737
+ type: string;
738
+ id: number;
739
+ options: {
740
+ jstype: string;
741
+ };
742
+ };
743
+ state_delta_entries: {
744
+ rule: string;
745
+ type: string;
746
+ id: number;
747
+ };
748
+ };
749
+ };
750
+ state_delta_entry: {
751
+ oneofs: {
752
+ _value: {
753
+ oneof: string[];
754
+ };
755
+ };
756
+ fields: {
757
+ object_space: {
758
+ type: string;
759
+ id: number;
760
+ };
761
+ key: {
762
+ type: string;
763
+ id: number;
764
+ };
765
+ value: {
766
+ type: string;
767
+ id: number;
768
+ options: {
769
+ proto3_optional: boolean;
770
+ };
771
+ };
817
772
  };
818
773
  };
819
774
  };
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
2
2
  export * as utils from "./indexUtils";
3
- export * as interfaces from "./interface";
3
+ export * from "./interface";
4
4
  export * from "./Contract";
5
5
  export * from "./Signer";
6
6
  export * from "./Provider";
package/lib/index.js CHANGED
@@ -26,11 +26,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.interfaces = exports.utils = void 0;
29
+ exports.utils = void 0;
30
30
  /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
31
31
  // eslint-disable import/no-cycle
32
32
  exports.utils = __importStar(require("./indexUtils"));
33
- exports.interfaces = __importStar(require("./interface"));
33
+ __exportStar(require("./interface"), exports);
34
34
  __exportStar(require("./Contract"), exports);
35
35
  __exportStar(require("./Signer"), exports);
36
36
  __exportStar(require("./Provider"), exports);
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,sDAAsC;AACtC,0DAA0C;AAC1C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,gDAA8B;AAC9B,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,iCAAiC;AACjC,sDAAsC;AACtC,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,gDAA8B;AAC9B,+CAA6B"}
@@ -293,7 +293,7 @@ export interface TransactionOptions extends SendTransactionOptions {
293
293
  * is not set it will be taken by querying the
294
294
  * actual mana of the payer
295
295
  */
296
- rcLimit?: string;
296
+ rcLimit?: string | number;
297
297
  /**
298
298
  * Transaction nonce
299
299
  *
@@ -573,7 +573,7 @@ export interface TransactionHeaderJson {
573
573
  /**
574
574
  * Resource credits limit
575
575
  */
576
- rc_limit?: string;
576
+ rc_limit?: string | number;
577
577
  /**
578
578
  * Account nonce
579
579
  */
@@ -633,6 +633,11 @@ export interface BlockJson {
633
633
  signature?: string;
634
634
  [x: string]: unknown;
635
635
  }
636
+ export interface BlockTopology {
637
+ id: string;
638
+ height: string;
639
+ previous: string;
640
+ }
636
641
  export interface ValueType {
637
642
  uint64_value?: string;
638
643
  [x: string]: unknown;
@@ -647,6 +652,15 @@ export interface EventData {
647
652
  export interface DecodedEventData extends EventData {
648
653
  args: Record<string, unknown>;
649
654
  }
655
+ export interface StateDeltaEntry {
656
+ object_space: {
657
+ system: boolean;
658
+ zone: string;
659
+ id: number;
660
+ };
661
+ key: string;
662
+ value: string;
663
+ }
650
664
  export interface TransactionReceipt {
651
665
  id: string;
652
666
  payer: string;
@@ -658,5 +672,6 @@ export interface TransactionReceipt {
658
672
  compute_bandwidth_used: string;
659
673
  reverted: boolean;
660
674
  events: EventData[];
675
+ state_delta_entries: StateDeltaEntry[];
661
676
  logs: string[];
662
677
  }
@@ -2,7 +2,7 @@
2
2
  "nested": {
3
3
  "koinos": {
4
4
  "options": {
5
- "go_package": "github.com/koinos/koinos-proto-golang/koinos"
5
+ "go_package": "github.com/koinos/koinos-proto-golang/v2/koinos"
6
6
  },
7
7
  "nested": {
8
8
  "block_topology": {
@@ -32,9 +32,25 @@
32
32
  },
33
33
  "protocol": {
34
34
  "options": {
35
- "go_package": "github.com/koinos/koinos-proto-golang/koinos/protocol"
35
+ "go_package": "github.com/koinos/koinos-proto-golang/v2/koinos/protocol"
36
36
  },
37
37
  "nested": {
38
+ "object_space": {
39
+ "fields": {
40
+ "system": {
41
+ "type": "bool",
42
+ "id": 1
43
+ },
44
+ "zone": {
45
+ "type": "bytes",
46
+ "id": 2
47
+ },
48
+ "id": {
49
+ "type": "uint32",
50
+ "id": 3
51
+ }
52
+ }
53
+ },
38
54
  "event_data": {
39
55
  "fields": {
40
56
  "sequence": {
@@ -338,6 +354,11 @@
338
354
  "rule": "repeated",
339
355
  "type": "string",
340
356
  "id": 11
357
+ },
358
+ "state_delta_entries": {
359
+ "rule": "repeated",
360
+ "type": "state_delta_entry",
361
+ "id": 12
341
362
  }
342
363
  }
343
364
  },
@@ -468,6 +489,56 @@
468
489
  "rule": "repeated",
469
490
  "type": "string",
470
491
  "id": 9
492
+ },
493
+ "disk_storage_charged": {
494
+ "type": "uint64",
495
+ "id": 10,
496
+ "options": {
497
+ "jstype": "JS_STRING"
498
+ }
499
+ },
500
+ "network_bandwidth_charged": {
501
+ "type": "uint64",
502
+ "id": 11,
503
+ "options": {
504
+ "jstype": "JS_STRING"
505
+ }
506
+ },
507
+ "compute_bandwidth_charged": {
508
+ "type": "uint64",
509
+ "id": 12,
510
+ "options": {
511
+ "jstype": "JS_STRING"
512
+ }
513
+ },
514
+ "state_delta_entries": {
515
+ "rule": "repeated",
516
+ "type": "state_delta_entry",
517
+ "id": 13
518
+ }
519
+ }
520
+ },
521
+ "state_delta_entry": {
522
+ "oneofs": {
523
+ "_value": {
524
+ "oneof": ["value"]
525
+ }
526
+ },
527
+ "fields": {
528
+ "object_space": {
529
+ "type": "object_space",
530
+ "id": 1
531
+ },
532
+ "key": {
533
+ "type": "bytes",
534
+ "id": 2
535
+ },
536
+ "value": {
537
+ "type": "bytes",
538
+ "id": 3,
539
+ "options": {
540
+ "proto3_optional": true
541
+ }
471
542
  }
472
543
  }
473
544
  }
@@ -475,7 +546,7 @@
475
546
  },
476
547
  "chain": {
477
548
  "options": {
478
- "go_package": "github.com/koinos/koinos-proto-golang/koinos/chain"
549
+ "go_package": "github.com/koinos/koinos-proto-golang/v2/koinos/chain"
479
550
  },
480
551
  "nested": {
481
552
  "error_data": {
@@ -6,7 +6,7 @@
6
6
  "nested": {
7
7
  "token": {
8
8
  "options": {
9
- "go_package": "github.com/koinos/koinos-proto-golang/koinos/contracts/token"
9
+ "go_package": "github.com/koinos/koinos-proto-golang/v2/koinos/contracts/token"
10
10
  },
11
11
  "nested": {
12
12
  "name_arguments": {
@@ -100,6 +100,10 @@
100
100
  "options": {
101
101
  "jstype": "JS_STRING"
102
102
  }
103
+ },
104
+ "memo": {
105
+ "type": "string",
106
+ "id": 4
103
107
  }
104
108
  }
105
109
  },
@@ -159,31 +163,6 @@
159
163
  }
160
164
  }
161
165
  },
162
- "mana_balance_object": {
163
- "fields": {
164
- "balance": {
165
- "type": "uint64",
166
- "id": 1,
167
- "options": {
168
- "jstype": "JS_STRING"
169
- }
170
- },
171
- "mana": {
172
- "type": "uint64",
173
- "id": 2,
174
- "options": {
175
- "jstype": "JS_STRING"
176
- }
177
- },
178
- "last_mana_update": {
179
- "type": "uint64",
180
- "id": 3,
181
- "options": {
182
- "jstype": "JS_STRING"
183
- }
184
- }
185
- }
186
- },
187
166
  "burn_event": {
188
167
  "fields": {
189
168
  "from": {