koilib 4.1.2 → 5.1.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 (54) hide show
  1. package/README.md +74 -11
  2. package/dist/koinos.js +1099 -543
  3. package/dist/koinos.min.js +1 -1
  4. package/lib/Contract.d.ts +2 -0
  5. package/lib/Contract.js +36 -30
  6. package/lib/Contract.js.map +1 -1
  7. package/lib/Provider.d.ts +17 -5
  8. package/lib/Provider.js +33 -14
  9. package/lib/Provider.js.map +1 -1
  10. package/lib/Serializer.js +2 -0
  11. package/lib/Serializer.js.map +1 -1
  12. package/lib/Signer.d.ts +14 -9
  13. package/lib/Signer.js +23 -10
  14. package/lib/Signer.js.map +1 -1
  15. package/lib/browser/Contract.d.ts +2 -0
  16. package/lib/browser/Contract.js +36 -30
  17. package/lib/browser/Contract.js.map +1 -1
  18. package/lib/browser/Provider.d.ts +17 -5
  19. package/lib/browser/Provider.js +33 -14
  20. package/lib/browser/Provider.js.map +1 -1
  21. package/lib/browser/Serializer.js +2 -0
  22. package/lib/browser/Serializer.js.map +1 -1
  23. package/lib/browser/Signer.d.ts +14 -9
  24. package/lib/browser/Signer.js +23 -10
  25. package/lib/browser/Signer.js.map +1 -1
  26. package/lib/browser/index.js +5 -1
  27. package/lib/browser/index.js.map +1 -1
  28. package/lib/browser/index2.js +5 -1
  29. package/lib/browser/index2.js.map +1 -1
  30. package/lib/browser/indexUtils.js +5 -1
  31. package/lib/browser/indexUtils.js.map +1 -1
  32. package/lib/browser/interface.d.ts +68 -3
  33. package/lib/browser/jsonDescriptors/chain-proto.json +50 -0
  34. package/lib/browser/jsonDescriptors/token-proto.json +37 -8
  35. package/lib/browser/protoModules/protocol-proto.js +518 -201
  36. package/lib/browser/protoModules/protocol-proto.js.map +1 -1
  37. package/lib/browser/utils.js +5 -1
  38. package/lib/browser/utils.js.map +1 -1
  39. package/lib/browser/utilsNode.d.ts +50 -0
  40. package/lib/index.js +5 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/index2.js +5 -1
  43. package/lib/index2.js.map +1 -1
  44. package/lib/indexUtils.js +5 -1
  45. package/lib/indexUtils.js.map +1 -1
  46. package/lib/interface.d.ts +68 -3
  47. package/lib/jsonDescriptors/chain-proto.json +50 -0
  48. package/lib/jsonDescriptors/token-proto.json +37 -8
  49. package/lib/protoModules/protocol-proto.js +518 -201
  50. package/lib/protoModules/protocol-proto.js.map +1 -1
  51. package/lib/utils.js +5 -1
  52. package/lib/utils.js.map +1 -1
  53. package/lib/utilsNode.d.ts +50 -0
  54. package/package.json +29 -28
@@ -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;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"}
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"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"indexUtils.js","sourceRoot":"","sources":["../../src/indexUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B"}
1
+ {"version":3,"file":"indexUtils.js","sourceRoot":"","sources":["../../src/indexUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B"}
@@ -171,10 +171,26 @@ export interface BaseTransactionOptions {
171
171
  * Send transaction
172
172
  *
173
173
  * Boolean to define if the transaction should be signed
174
- * ans broadcasted to the blockchain. By default it is
174
+ * and sent to the RPC node. By default it is
175
175
  * true.
176
176
  */
177
177
  sendTransaction?: boolean;
178
+ /**
179
+ * Broadcast
180
+ *
181
+ * Boolean to define if the transaction should be broadcasted
182
+ * to the different nodes in the network. By default it is true.
183
+ *
184
+ * Set it to false if you want to interact with a contract for
185
+ * testing purposes and check the possible events triggered.
186
+ */
187
+ broadcast?: boolean;
188
+ /**
189
+ * Function to be called before sending a transaction to the
190
+ * blockchain. It is useful to apply multisignatures to
191
+ * the transaction
192
+ */
193
+ beforeSend?: (tx: TransactionJson) => Promise<void>;
178
194
  }
179
195
  export interface TransactionOptions extends BaseTransactionOptions {
180
196
  /**
@@ -219,6 +235,52 @@ export interface DeployOptions extends BaseTransactionOptions {
219
235
  */
220
236
  authorizesUploadContract?: boolean;
221
237
  }
238
+ export interface SendTransactionOptions {
239
+ /**
240
+ * Broadcast
241
+ *
242
+ * Boolean to define if the transaction should be broadcasted
243
+ * to the different nodes in the network. By default it is true.
244
+ *
245
+ * Set it to false if you want to interact with a contract for
246
+ * testing purposes and check the possible events triggered.
247
+ */
248
+ broadcast?: boolean;
249
+ /**
250
+ * Collection of Abis so that the receiver can parse the
251
+ * operations in the transaction
252
+ */
253
+ abis?: Record<string, Abi>;
254
+ /**
255
+ * Function to be called before sending a transaction to the
256
+ * blockchain. It is useful to apply multisignatures to
257
+ * the transaction.
258
+ *
259
+ * @example
260
+ * ```ts
261
+ * const signer2 = Signer.fromSeed("signer2");
262
+ * const signer3 = Signer.fromSeed("signer3");
263
+ *
264
+ * const addMoreSignatures = async (tx) => {
265
+ * await signer2.signTransaction(tx);
266
+ * await signer3.signTransaction(tx);
267
+ * };
268
+ *
269
+ * const { transaction } = await koin.transfer(
270
+ * {
271
+ * from: "16MT1VQFgsVxEfJrSGinrA5buiqBsN5ViJ",
272
+ * to: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
273
+ * value: "1000000",
274
+ * },
275
+ * {
276
+ * payer: signer2.getAddress(),
277
+ * beforeSend: addMoreSignatures,
278
+ * }
279
+ * );
280
+ * ```
281
+ */
282
+ beforeSend?: (tx: TransactionJson) => Promise<void>;
283
+ }
222
284
  export interface RecoverPublicKeyOptions {
223
285
  /**
224
286
  * Boolean to define if the public key should
@@ -251,9 +313,12 @@ export interface RecoverPublicKeyOptions {
251
313
  *
252
314
  * When _byTransactionId_ is used it returns the block id.
253
315
  *
254
- * @param timeout - Timeout in milliseconds. By default it is 60000
316
+ * @param timeout - Timeout in milliseconds. By default it is 15000
255
317
  */
256
- export declare type WaitFunction = (type?: "byBlock" | "byTransactionId", timeout?: number) => Promise<string | number>;
318
+ export declare type WaitFunction = (type?: "byBlock" | "byTransactionId", timeout?: number) => Promise<{
319
+ blockId: string;
320
+ blockNumber?: number;
321
+ }>;
257
322
  export interface GenesisDataEntryEncoded {
258
323
  space: {
259
324
  system?: boolean;
@@ -378,6 +378,14 @@
378
378
  "options": {
379
379
  "(btype)": "ADDRESS"
380
380
  }
381
+ },
382
+ "approved_proposals": {
383
+ "rule": "repeated",
384
+ "type": "bytes",
385
+ "id": 7,
386
+ "options": {
387
+ "(btype)": "TRANSACTION_ID"
388
+ }
381
389
  }
382
390
  }
383
391
  },
@@ -470,6 +478,31 @@
470
478
  "go_package": "github.com/koinos/koinos-proto-golang/koinos/chain"
471
479
  },
472
480
  "nested": {
481
+ "error_data": {
482
+ "fields": {
483
+ "message": {
484
+ "type": "string",
485
+ "id": 1
486
+ }
487
+ }
488
+ },
489
+ "result": {
490
+ "oneofs": {
491
+ "value": {
492
+ "oneof": ["object", "error"]
493
+ }
494
+ },
495
+ "fields": {
496
+ "object": {
497
+ "type": "bytes",
498
+ "id": 1
499
+ },
500
+ "error": {
501
+ "type": "error_data",
502
+ "id": 2
503
+ }
504
+ }
505
+ },
473
506
  "object_space": {
474
507
  "fields": {
475
508
  "system": {
@@ -552,6 +585,18 @@
552
585
  }
553
586
  }
554
587
  },
588
+ "argument_data": {
589
+ "fields": {
590
+ "entry_point": {
591
+ "type": "uint32",
592
+ "id": 1
593
+ },
594
+ "arguments": {
595
+ "type": "bytes",
596
+ "id": 2
597
+ }
598
+ }
599
+ },
555
600
  "resource_limit_data": {
556
601
  "fields": {
557
602
  "disk_storage_limit": {
@@ -667,6 +712,11 @@
667
712
  "id": 1
668
713
  }
669
714
  }
715
+ },
716
+ "dsa": {
717
+ "values": {
718
+ "ecdsa_secp256k1": 0
719
+ }
670
720
  }
671
721
  }
672
722
  }
@@ -104,12 +104,7 @@
104
104
  }
105
105
  },
106
106
  "transfer_result": {
107
- "fields": {
108
- "value": {
109
- "type": "bool",
110
- "id": 1
111
- }
112
- }
107
+ "fields": {}
113
108
  },
114
109
  "mint_arguments": {
115
110
  "fields": {
@@ -130,13 +125,29 @@
130
125
  }
131
126
  },
132
127
  "mint_result": {
128
+ "fields": {}
129
+ },
130
+ "burn_arguments": {
133
131
  "fields": {
132
+ "from": {
133
+ "type": "bytes",
134
+ "id": 1,
135
+ "options": {
136
+ "(btype)": "ADDRESS"
137
+ }
138
+ },
134
139
  "value": {
135
- "type": "bool",
136
- "id": 1
140
+ "type": "uint64",
141
+ "id": 2,
142
+ "options": {
143
+ "jstype": "JS_STRING"
144
+ }
137
145
  }
138
146
  }
139
147
  },
148
+ "burn_result": {
149
+ "fields": {}
150
+ },
140
151
  "balance_object": {
141
152
  "fields": {
142
153
  "value": {
@@ -173,6 +184,24 @@
173
184
  }
174
185
  }
175
186
  },
187
+ "burn_event": {
188
+ "fields": {
189
+ "from": {
190
+ "type": "bytes",
191
+ "id": 1,
192
+ "options": {
193
+ "(btype)": "ADDRESS"
194
+ }
195
+ },
196
+ "value": {
197
+ "type": "uint64",
198
+ "id": 2,
199
+ "options": {
200
+ "jstype": "JS_STRING"
201
+ }
202
+ }
203
+ }
204
+ },
176
205
  "mint_event": {
177
206
  "fields": {
178
207
  "to": {