koilib 5.7.0 → 7.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 (45) hide show
  1. package/README.md +39 -40
  2. package/dist/koinos.js +1649 -83
  3. package/dist/koinos.min.js +1 -1
  4. package/lib/Contract.d.ts +12 -24
  5. package/lib/Contract.js +11 -23
  6. package/lib/Contract.js.map +1 -1
  7. package/lib/Provider.d.ts +257 -12
  8. package/lib/Provider.js +262 -9
  9. package/lib/Provider.js.map +1 -1
  10. package/lib/Signer.d.ts +75 -6
  11. package/lib/Signer.js +87 -6
  12. package/lib/Signer.js.map +1 -1
  13. package/lib/Transaction.d.ts +4 -3
  14. package/lib/Transaction.js +13 -10
  15. package/lib/Transaction.js.map +1 -1
  16. package/lib/browser/Contract.d.ts +12 -24
  17. package/lib/browser/Contract.js +11 -23
  18. package/lib/browser/Contract.js.map +1 -1
  19. package/lib/browser/Provider.d.ts +257 -12
  20. package/lib/browser/Provider.js +262 -9
  21. package/lib/browser/Provider.js.map +1 -1
  22. package/lib/browser/Signer.d.ts +75 -6
  23. package/lib/browser/Signer.js +87 -6
  24. package/lib/browser/Signer.js.map +1 -1
  25. package/lib/browser/Transaction.d.ts +4 -3
  26. package/lib/browser/Transaction.js +13 -10
  27. package/lib/browser/Transaction.js.map +1 -1
  28. package/lib/browser/interface.d.ts +33 -0
  29. package/lib/browser/utils.d.ts +39 -0
  30. package/lib/browser/utils.js +1276 -27
  31. package/lib/browser/utils.js.map +1 -1
  32. package/lib/interface.d.ts +33 -0
  33. package/lib/utils.d.ts +39 -0
  34. package/lib/utils.js +1276 -27
  35. package/lib/utils.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/Contract.ts +12 -24
  38. package/src/Provider.ts +271 -20
  39. package/src/Signer.ts +126 -7
  40. package/src/Transaction.ts +17 -16
  41. package/src/interface.ts +38 -0
  42. package/src/utils.ts +1283 -23
  43. package/lib/browser/jsonDescriptors/token-proto.json +0 -234
  44. package/lib/jsonDescriptors/token-proto.json +0 -234
  45. package/src/jsonDescriptors/token-proto.json +0 -234
package/dist/koinos.js CHANGED
@@ -22712,46 +22712,34 @@ const Transaction_1 = __webpack_require__(7592);
22712
22712
  *
22713
22713
  * ```ts
22714
22714
  * const { Contract, Provider, Signer, utils } = require("koilib");
22715
- * const rpcNodes = ["http://api.koinos.io:8080"];
22715
+ * const rpcNodes = ["http://api.koinos.io"];
22716
22716
  * const privateKey = "f186a5de49797bfd52dc42505c33d75a46822ed5b60046e09d7c336242e20200";
22717
22717
  * const provider = new Provider(rpcNodes);
22718
22718
  * const signer = new Signer({ privateKey, provider });
22719
22719
  * const koinContract = new Contract({
22720
- * id: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
22720
+ * id: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
22721
22721
  * abi: utils.tokenAbi,
22722
22722
  * provider,
22723
22723
  * signer,
22724
22724
  * });
22725
22725
  * const koin = koinContract.functions;
22726
22726
  *
22727
- * // optional: preformat argument/return
22728
- * koinContract.abi.methods.balanceOf.preformat_argument = (owner) =>
22729
- * ({ owner });
22730
- * koinContract.abi.methods.balanceOf.preformat_return = (res) =>
22731
- * utils.formatUnits(res.value, 8);
22732
- * koinContract.abi.methods.transfer.preformat_argument = (arg) => ({
22733
- * from: signer.getAddress(),
22734
- * to: arg.to,
22735
- * value: utils.parseUnits(arg.value, 8),
22736
- * });
22737
- *
22738
22727
  * async funtion main() {
22739
22728
  * // Get balance
22740
- * const { result } = await koin.balanceOf("12fN2CQnuJM8cMnWZ1hPtM4knjLME8E4PD");
22729
+ * const { result } = await koin.balanceOf({
22730
+ * owner: "12fN2CQnuJM8cMnWZ1hPtM4knjLME8E4PD",
22731
+ * });
22741
22732
  * console.log(result)
22742
22733
  *
22743
22734
  * // Transfer
22744
22735
  * const { transaction, receipt } = await koin.transfer({
22736
+ * from: signer.getAddress(),
22745
22737
  * to: "172AB1FgCsYrRAW5cwQ8KjadgxofvgPFd6",
22746
- * value: "10.0001",
22738
+ * value: "1000010000", // 10.00010000
22747
22739
  * });
22748
22740
  * console.log(`Transaction id ${transaction.id} submitted. Receipt:`);
22749
22741
  * console.log(receipt);
22750
22742
  *
22751
- * if (receipt.logs) {
22752
- * console.log(`Transfer failed. Logs: ${receipt.logs.join(",")}`);
22753
- * }
22754
- *
22755
22743
  * // wait to be mined
22756
22744
  * const blockNumber = await transaction.wait();
22757
22745
  * console.log(`Transaction mined. Block number: ${blockNumber}`);
@@ -22921,7 +22909,7 @@ class Contract {
22921
22909
  * @example
22922
22910
  * ```ts
22923
22911
  * const privateKey = "f186a5de49797bfd52dc42505c33d75a46822ed5b60046e09d7c336242e20200";
22924
- * const provider = new Provider(["http://api.koinos.io:8080"]);
22912
+ * const provider = new Provider(["http://api.koinos.io"]);
22925
22913
  * const signer = new Signer({ privateKey, provider });
22926
22914
  * const bytecode = new Uint8Array([1, 2, 3, 4]);
22927
22915
  * const contract = new Contract({ signer, provider, bytecode });
@@ -23112,12 +23100,12 @@ class Contract {
23112
23100
  * @example
23113
23101
  * ```ts
23114
23102
  * const contract = new Contract({
23115
- * id: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
23103
+ * id: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
23116
23104
  * abi: utils.tokenAbi,
23117
23105
  * });
23118
23106
  * const event = {
23119
23107
  * sequence: 1,
23120
- * source: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
23108
+ * source: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
23121
23109
  * name: "koinos.contracts.token.mint_event",
23122
23110
  * data: "ChkAxjdqxuwS-B50lPQ-lqhRBA3bf2b2ooAHENrw3Ek=",
23123
23111
  * impacted: ["1K55BRw87nd64a7aiRarp6DLGRzYvoJo8J"],
@@ -23126,7 +23114,7 @@ class Contract {
23126
23114
  * console.log(eventDecoded);
23127
23115
  * // {
23128
23116
  * // sequence: 1,
23129
- * // source: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
23117
+ * // source: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
23130
23118
  * // name: "koinos.contracts.token.mint_event",
23131
23119
  * // data: "ChkAxjdqxuwS-B50lPQ-lqhRBA3bf2b2ooAHENrw3Ek=",
23132
23120
  * // impacted: ["1K55BRw87nd64a7aiRarp6DLGRzYvoJo8J"],
@@ -23183,8 +23171,8 @@ class Provider {
23183
23171
  * @example
23184
23172
  * ```ts
23185
23173
  * const provider = new Provider([
23186
- * "http://45.56.104.152:8080",
23187
- * "http://159.203.119.0:8080"
23174
+ * "https://api.koinos.io",
23175
+ * "https://api.koinosblocks.com"
23188
23176
  * ]);
23189
23177
  * ```
23190
23178
  */
@@ -23201,6 +23189,151 @@ class Provider {
23201
23189
  * @param method - jsonrpc method
23202
23190
  * @param params - jsonrpc params
23203
23191
  * @returns Result of jsonrpc response
23192
+ *
23193
+ * To know the full list of possible calls check the services
23194
+ * listed in the [rpc folder of koinos-proto](https://github.com/koinos/koinos-proto/tree/master/koinos/rpc)
23195
+ * and the corresponding proto files.
23196
+ *
23197
+ * @example
23198
+ * Let's take "account_history" as an example. Go to [account_history_rpc.proto](https://github.com/koinos/koinos-proto/blob/master/koinos/rpc/account_history/account_history_rpc.proto).
23199
+ * The `account_history_request` message has 1 single method: `get_account_history`.
23200
+ *
23201
+ * Now search the message `get_account_history_request`. This message is telling us
23202
+ * the expected fields in the body of the call:
23203
+ *
23204
+ * ```ts
23205
+ * message get_account_history_request {
23206
+ * bytes address = 1 [(btype) = ADDRESS];
23207
+ * optional uint64 seq_num = 2 [jstype = JS_STRING];
23208
+ * uint64 limit = 3 [jstype = JS_STRING];
23209
+ * bool ascending = 4;
23210
+ * bool irreversible = 5;
23211
+ * }
23212
+ * ```
23213
+ *
23214
+ * And search the message `get_account_history_response` to see the format of the response:
23215
+ * ```ts
23216
+ * message get_account_history_response {
23217
+ * repeated account_history_entry values = 1;
23218
+ * }
23219
+ * ```
23220
+ *
23221
+ * With this information we can now call the RPC node. It should be done in this way:
23222
+ * ```ts
23223
+ * const provider = new Provider(["https://api.koinos.io"]);
23224
+ * const result = await provider.call(
23225
+ * "account_history.get_account_history",
23226
+ * {
23227
+ * address: "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe",
23228
+ * limit: 2,
23229
+ * ascending: true,
23230
+ * irreversible: true,
23231
+ * }
23232
+ * );
23233
+ * console.log(result);
23234
+ *
23235
+ * // {
23236
+ * // "values": [
23237
+ * // {
23238
+ * // "trx": {
23239
+ * // "transaction": {
23240
+ * // "id": "0x12205b566701d6afcf1f5e45b5e9f5443def75728c219f7c1e897ed0ce1ef491223c",
23241
+ * // "header": {
23242
+ * // "chain_id": "EiBZK_GGVP0H_fXVAM3j6EAuz3-B-l3ejxRSewi7qIBfSA==",
23243
+ * // "rc_limit": "961224079493",
23244
+ * // "nonce": "KAE=",
23245
+ * // "operation_merkle_root": "EiA32K_GrZ2VsvWSrM4QZhyEmvm8ID1P6aE4vP00RnY9hg==",
23246
+ * // "payer": "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18"
23247
+ * // },
23248
+ * // "operations": [
23249
+ * // {
23250
+ * // "call_contract": {
23251
+ * // "contract_id": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
23252
+ * // "entry_point": 670398154,
23253
+ * // "args": "ChkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHEhkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrGIDC1y8="
23254
+ * // }
23255
+ * // }
23256
+ * // ],
23257
+ * // "signatures": [
23258
+ * // "ICBdTcH6jzhDpl9ZB0ZqNcvSy8wiOokHFtkQ66Lc04K1LhXd77tqaQdMhJOAfYotg5npVmfSgyO9CwgLJmtMIjg="
23259
+ * // ]
23260
+ * // },
23261
+ * // "receipt": {
23262
+ * // "id": "0x12205b566701d6afcf1f5e45b5e9f5443def75728c219f7c1e897ed0ce1ef491223c",
23263
+ * // "payer": "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18",
23264
+ * // "max_payer_rc": "961224079493",
23265
+ * // "rc_limit": "961224079493",
23266
+ * // "rc_used": "3009833",
23267
+ * // "disk_storage_used": "112",
23268
+ * // "network_bandwidth_used": "313",
23269
+ * // "compute_bandwidth_used": "561439",
23270
+ * // "events": [
23271
+ * // {
23272
+ * // "sequence": 2,
23273
+ * // "source": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
23274
+ * // "name": "koinos.contracts.token.transfer_event",
23275
+ * // "data": "ChkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHEhkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrGIDC1y8=",
23276
+ * // "impacted": [
23277
+ * // "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe",
23278
+ * // "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18"
23279
+ * // ]
23280
+ * // }
23281
+ * // ]
23282
+ * // }
23283
+ * // }
23284
+ * // },
23285
+ * // {
23286
+ * // "seq_num": "1",
23287
+ * // "trx": {
23288
+ * // "transaction": {
23289
+ * // "id": "0x1220a08183a5237e57a08e1ae539017c4253ddfbc23f9b7b6f5e263669aacd3fed47",
23290
+ * // "header": {
23291
+ * // "chain_id": "EiBZK_GGVP0H_fXVAM3j6EAuz3-B-l3ejxRSewi7qIBfSA==",
23292
+ * // "rc_limit": "100000000",
23293
+ * // "nonce": "KAE=",
23294
+ * // "operation_merkle_root": "EiBAmutXQlPyAGctNBNhKEUUEUtwj2KQeNrdFBqpN9RWDg==",
23295
+ * // "payer": "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe"
23296
+ * // },
23297
+ * // "operations": [
23298
+ * // {
23299
+ * // "call_contract": {
23300
+ * // "contract_id": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
23301
+ * // "entry_point": 670398154,
23302
+ * // "args": "ChkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrEhkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHGJBO"
23303
+ * // }
23304
+ * // }
23305
+ * // ],
23306
+ * // "signatures": [
23307
+ * // "IF5FBloKjEfnqlGJRL_aPy4L36On-Q8XXzpAQagK_X-xZ6DgioBhZOhKEnhKyhaoROAgGwRuy6BsdRqya8fCHU8="
23308
+ * // ]
23309
+ * // },
23310
+ * // "receipt": {
23311
+ * // "id": "0x1220a08183a5237e57a08e1ae539017c4253ddfbc23f9b7b6f5e263669aacd3fed47",
23312
+ * // "payer": "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe",
23313
+ * // "max_payer_rc": "100000000",
23314
+ * // "rc_limit": "100000000",
23315
+ * // "rc_used": "2657385",
23316
+ * // "disk_storage_used": "35",
23317
+ * // "network_bandwidth_used": "309",
23318
+ * // "compute_bandwidth_used": "566375",
23319
+ * // "events": [
23320
+ * // {
23321
+ * // "sequence": 2,
23322
+ * // "source": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
23323
+ * // "name": "koinos.contracts.token.transfer_event",
23324
+ * // "data": "ChkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrEhkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHGJBO",
23325
+ * // "impacted": [
23326
+ * // "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18",
23327
+ * // "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe"
23328
+ * // ]
23329
+ * // }
23330
+ * // ]
23331
+ * // }
23332
+ * // }
23333
+ * // }
23334
+ * // ]
23335
+ * // }
23336
+ * ```
23204
23337
  */
23205
23338
  async call(method, params) {
23206
23339
  /* eslint-disable no-await-in-loop */
@@ -23311,11 +23444,29 @@ class Provider {
23311
23444
  return this.call("block_store.get_blocks_by_id", {
23312
23445
  block_ids: blockIds,
23313
23446
  return_block: opts && opts.returnBlock !== undefined ? opts.returnBlock : true,
23314
- return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt : false,
23447
+ return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt : true,
23315
23448
  });
23316
23449
  }
23317
23450
  /**
23318
23451
  * Function to get info from the head block in the blockchain
23452
+ *
23453
+ * @example
23454
+ * ```ts
23455
+ * const provider = new Provider("https://api.koinos.io");
23456
+ * const headInfo = await provider.getHeadInfo();
23457
+ * console.log(headInfo);
23458
+ *
23459
+ * // {
23460
+ * // head_topology: {
23461
+ * // id: '0x12209f7c9b4d695eefd6f87465d490654e495fe25a3d7d2e1eb80658acdc49bad962',
23462
+ * // height: '14957951',
23463
+ * // previous: '0x1220bc3b94e3a2adc3ca09d61a4418df1f4acfa78a69686f592877c194ea50642cd2'
23464
+ * // },
23465
+ * // last_irreversible_block: '14957891',
23466
+ * // head_state_merkle_root: 'EiCriqXooNUXBG23EUKLz2qq3h9ZAC8w1W7w185YQ9MzIA==',
23467
+ * // head_block_time: '1713874497290'
23468
+ * // }
23469
+ * ```
23319
23470
  */
23320
23471
  async getHeadInfo() {
23321
23472
  return this.call("chain.get_head_info", {});
@@ -23346,14 +23497,80 @@ class Provider {
23346
23497
  ancestor_start_height: height,
23347
23498
  num_blocks: numBlocks,
23348
23499
  return_block: opts && opts.returnBlock !== undefined ? opts.returnBlock : true,
23349
- return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt : false,
23500
+ return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt : true,
23350
23501
  })).block_items;
23351
23502
  }
23352
23503
  /**
23353
23504
  * Function to get a block by its height
23505
+ *
23506
+ * @example
23507
+ * ```ts
23508
+ * const provider = new Provider("https://api.koinos.io");
23509
+ * const block = await provider.getBlock(14951433);
23510
+ * console.log(block);
23511
+ *
23512
+ * // {
23513
+ * // block_id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
23514
+ * // block_height: '14951433',
23515
+ * // block: {
23516
+ * // id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
23517
+ * // header: {
23518
+ * // previous: '0x1220a3c4cbc57ccee4d02b4a1849a9e504122ee93b904deff711d926def2ea2cc878',
23519
+ * // height: '14951433',
23520
+ * // timestamp: '1713854518430',
23521
+ * // previous_state_merkle_root: 'EiCPcnYosMvEBYeCcJrdIJJG0mp4TJ796UGxa0NY6EvzbQ==',
23522
+ * // transaction_merkle_root: 'EiBGPKwttckB7c_BafwnHHmHTBa9S1vKBKauj_yLVNb0tg==',
23523
+ * // signer: '1EPZaqve43k9Jq5mNeT2ydCjUiytTTU4U',
23524
+ * // approved_proposals: [Array]
23525
+ * // },
23526
+ * // transactions: [ [Object] ],
23527
+ * // signature: 'ClEDnHKX1F-pQVbFhmz2qnrwGfP-RbEfTdRFUrvmhmqMeoejtmm2Q0yIPbD5kN5xpIEb
23528
+ * // 8vVwsIJ3lTrgFz2E8w0Paxkgv1E_gMaYNq5UUqtHnl0SIhIgAAbuPHmfMKh9R0Yi5y1D
23529
+ * // TpjjdN0DYKaIUseXzLiLg_QaQR9jRinZf0g_qo2_4wOx9gDBunIij0r5CycHrNMsuT_V
23530
+ * // _UvrJOYuwj7aUCA-qnF2tCBQoNQZ3ww7WvKHrMdChxxy'
23531
+ * // },
23532
+ * // receipt: {
23533
+ * // id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
23534
+ * // height: '14951433',
23535
+ * // disk_storage_used: '35',
23536
+ * // network_bandwidth_used: '760',
23537
+ * // compute_bandwidth_used: '5253506',
23538
+ * // events: [ [Object], [Object] ],
23539
+ * // transaction_receipts: [ [Object] ],
23540
+ * // disk_storage_charged: '35',
23541
+ * // network_bandwidth_charged: '760',
23542
+ * // compute_bandwidth_charged: '5180427',
23543
+ * // state_delta_entries: [
23544
+ * // [Object], [Object],
23545
+ * // [Object], [Object],
23546
+ * // [Object], [Object],
23547
+ * // [Object], [Object],
23548
+ * // [Object], [Object]
23549
+ * // ]
23550
+ * // }
23551
+ * // }
23552
+ * ```
23553
+ *
23554
+ * Use the options to get less information. This helps to reduce
23555
+ * the bandwidth of the call.
23556
+ *
23557
+ * @example
23558
+ * ```ts
23559
+ * const provider = new Provider("https://api.koinos.io");
23560
+ * const block = await provider.getBlock(14951433, {
23561
+ * returnReceipt: false,
23562
+ * returnBlock: false
23563
+ * });
23564
+ * console.log(block);
23565
+ *
23566
+ * // {
23567
+ * // block_id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
23568
+ * // block_height: '14951433'
23569
+ * // }
23570
+ * ```
23354
23571
  */
23355
- async getBlock(height) {
23356
- return (await this.getBlocks(height, 1))[0];
23572
+ async getBlock(height, opts) {
23573
+ return (await this.getBlocks(height, 1, undefined, opts))[0];
23357
23574
  }
23358
23575
  /**
23359
23576
  * Function to wait for a transaction to be mined.
@@ -23466,9 +23683,11 @@ class Provider {
23466
23683
  */
23467
23684
  async sendTransaction(transaction, broadcast = true) {
23468
23685
  const response = await this.call("chain.submit_transaction", { transaction, broadcast });
23469
- transaction.wait = async (type = "byBlock", timeout = 15000) => {
23470
- return this.wait(transaction.id, type, timeout);
23471
- };
23686
+ if (broadcast) {
23687
+ transaction.wait = async (type = "byBlock", timeout = 15000) => {
23688
+ return this.wait(transaction.id, type, timeout);
23689
+ };
23690
+ }
23472
23691
  return { ...response, transaction: transaction };
23473
23692
  }
23474
23693
  /**
@@ -23520,6 +23739,28 @@ class Provider {
23520
23739
  const result = await serializer.deserialize(response.value, serializer.returnTypeName);
23521
23740
  return result;
23522
23741
  }
23742
+ /**
23743
+ * Function to get the contract metadata of a specific contract.
23744
+ * @param contractId contract ID
23745
+ *
23746
+ * @example
23747
+ * ```ts
23748
+ * const provider = new Provider("https://api.koinos.io");
23749
+ * const result = await provider.invokeGetContractMetadata("15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL");
23750
+ * console.log(result);
23751
+ *
23752
+ * // {
23753
+ * // value: {
23754
+ * // hash: '0x1220c57e3573189868970a3a1662a667c366b15015d9b7900ffed415c5e944036e88',
23755
+ * // system: true,
23756
+ * // authorizes_call_contract: true,
23757
+ * // authorizes_transaction_application: true,
23758
+ * // authorizes_upload_contract: true
23759
+ * // }
23760
+ * // }
23761
+ *
23762
+ * ```
23763
+ */
23523
23764
  async invokeGetContractMetadata(contractId) {
23524
23765
  const serializer = new Serializer_1.Serializer({
23525
23766
  nested: {
@@ -23924,6 +24165,7 @@ exports.Signer = void 0;
23924
24165
  /* eslint-disable no-param-reassign, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
23925
24166
  const sha256_1 = __webpack_require__(3061);
23926
24167
  const secp = __importStar(__webpack_require__(9656));
24168
+ const Transaction_1 = __webpack_require__(7592);
23927
24169
  const utils_1 = __webpack_require__(8593);
23928
24170
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23929
24171
  // @ts-ignore
@@ -24007,6 +24249,8 @@ class Signer {
24007
24249
  * @param privateKey - Private key as hexstring, bigint or Uint8Array
24008
24250
  * @param compressed - compressed format is true by default
24009
24251
  * @param provider - provider to connect with the blockchain
24252
+ * @param sendOptions - Send options
24253
+ * @param rcOptions - options for mana estimation
24010
24254
  * @example
24011
24255
  * ```ts
24012
24256
  * const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
@@ -24014,12 +24258,42 @@ class Signer {
24014
24258
  * console.log(signer.getAddress());
24015
24259
  * // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
24016
24260
  * ```
24261
+ *
24262
+ * By default the mana is estimated as 110% the mana used. This
24263
+ * estimation is computed using the "broadcast:false" option.
24264
+ * For instance, if the transaction consumes 1 mana, the rc_limit
24265
+ * will be set to 1.1 mana.
24266
+ *
24267
+ * You can also adjust the rc limit.
24268
+ * @example
24269
+ * ```ts
24270
+ * const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
24271
+ * cons signer = new Signer({
24272
+ * privateKey,
24273
+ * provider,
24274
+ * rcOptions: {
24275
+ * estimateRc: true,
24276
+ * // use 2 times rc_used as rc_limit
24277
+ * adjustRcLimit: (r) => 2 * Number(r.rc_used),
24278
+ * },
24279
+ * });
24280
+ * ```
24281
+ *
24282
+ * The rpc node must be highly trusted because the transaction
24283
+ * is signed during the estimation of the mana. You can also
24284
+ * disable the mana estimation:
24285
+ * @example
24286
+ * ```ts
24287
+ * const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
24288
+ * cons signer = new Signer({
24289
+ * privateKey,
24290
+ * provider,
24291
+ * rcOptions: { estimateRc: false },
24292
+ * });
24293
+ * ```
24017
24294
  */
24018
24295
  constructor(c) {
24019
- /**
24020
- * Chain id
24021
- */
24022
- this.chainId = "";
24296
+ var _a;
24023
24297
  this.compressed = typeof c.compressed === "undefined" ? true : c.compressed;
24024
24298
  this.privateKey = c.privateKey;
24025
24299
  this.provider = c.provider;
@@ -24031,12 +24305,14 @@ class Signer {
24031
24305
  this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
24032
24306
  this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
24033
24307
  }
24034
- if (c.chainId)
24035
- this.chainId = c.chainId;
24036
24308
  this.sendOptions = {
24037
24309
  broadcast: true,
24038
24310
  ...c.sendOptions,
24039
24311
  };
24312
+ this.rcOptions = (_a = c.rcOptions) !== null && _a !== void 0 ? _a : {
24313
+ estimateRc: true,
24314
+ adjustRcLimit: (receipt) => Promise.resolve(Math.min(Number(receipt.max_payer_rc), Math.floor(1.1 * Number(receipt.rc_used)))),
24315
+ };
24040
24316
  }
24041
24317
  /**
24042
24318
  * Function to import a private key from the WIF
@@ -24156,6 +24432,15 @@ class Signer {
24156
24432
  async signTransaction(tx, _abis) {
24157
24433
  if (!tx.id)
24158
24434
  throw new Error("Missing transaction id");
24435
+ // estimation of rcLimit
24436
+ if (this.rcOptions.estimateRc &&
24437
+ (!tx.signatures || tx.signatures.length === 0)) {
24438
+ const receipt = await this.estimateReceipt(tx);
24439
+ tx.header.rc_limit = this.rcOptions.adjustRcLimit
24440
+ ? await this.rcOptions.adjustRcLimit(receipt)
24441
+ : receipt.rc_used;
24442
+ tx.id = Transaction_1.Transaction.computeTransactionId(tx.header);
24443
+ }
24159
24444
  // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
24160
24445
  // tx id is a stringified multihash, need to extract the hash digest only
24161
24446
  const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
@@ -24204,6 +24489,43 @@ class Signer {
24204
24489
  }
24205
24490
  return this.provider.sendTransaction(transaction, opts.broadcast);
24206
24491
  }
24492
+ /**
24493
+ * Estimate the receipt associated to the transaction if
24494
+ * it sent to the blockchain. It is useful to estimate the
24495
+ * consumption of mana.
24496
+ * The transaction is signed during this process and sent
24497
+ * to the rpc node with the "broadcast:false" option to
24498
+ * just compute the transaction without broadcasting it to
24499
+ * the network.
24500
+ * After that, the initial signatures are restored (if any)
24501
+ * and the ones used for the estimation will be removed.
24502
+ */
24503
+ async estimateReceipt(tx) {
24504
+ if (!tx.id)
24505
+ throw new Error("Missing transaction id");
24506
+ if (!tx.signatures)
24507
+ tx.signatures = [];
24508
+ const signaturesCopy = [...tx.signatures];
24509
+ // sign if there are no signatures
24510
+ if (tx.signatures.length === 0) {
24511
+ const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
24512
+ const signature = await this.signHash(hash);
24513
+ tx.signatures.push((0, utils_1.encodeBase64url)(signature));
24514
+ }
24515
+ try {
24516
+ const { receipt } = await this.sendTransaction(tx, {
24517
+ broadcast: false,
24518
+ });
24519
+ // restore signatures
24520
+ tx.signatures = signaturesCopy;
24521
+ return receipt;
24522
+ }
24523
+ catch (error) {
24524
+ // restore signatures
24525
+ tx.signatures = signaturesCopy;
24526
+ throw error;
24527
+ }
24528
+ }
24207
24529
  /**
24208
24530
  * Function to recover the public key from hash and signature
24209
24531
  * @param hash - hash sha256
@@ -24538,7 +24860,7 @@ class Transaction {
24538
24860
  * @example
24539
24861
  * ```ts
24540
24862
  * const koin = new Contract({
24541
- * id: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
24863
+ * id: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
24542
24864
  * abi: utils.tokenAbi,
24543
24865
  * }).functions;
24544
24866
  * const signer = Signer.fromSeed("my seed");
@@ -24612,6 +24934,16 @@ class Transaction {
24612
24934
  this.transaction.operations = [];
24613
24935
  this.transaction.operations.push(operation);
24614
24936
  }
24937
+ static computeTransactionId(txHeader) {
24938
+ const headerDecoded = (0, utils_1.btypeDecode)(txHeader, btypeTransactionHeader, false);
24939
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
24940
+ const headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header
24941
+ .encode(message)
24942
+ .finish();
24943
+ const hash = (0, sha256_1.sha256)(headerBytes);
24944
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
24945
+ return `0x1220${(0, utils_1.toHexString)(hash)}`;
24946
+ }
24615
24947
  /**
24616
24948
  * Function to prepare a transaction
24617
24949
  * @param tx - Do not set the nonce to get it from the blockchain
@@ -24680,18 +25012,11 @@ class Transaction {
24680
25012
  ...(payee && { payee }),
24681
25013
  // TODO: Option to resolve names (payer, payee)
24682
25014
  };
24683
- const headerDecoded = (0, utils_1.btypeDecode)(tx.header, btypeTransactionHeader, false);
24684
- const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
24685
- const headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header
24686
- .encode(message)
24687
- .finish();
24688
- const hash = (0, sha256_1.sha256)(headerBytes);
24689
- // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
24690
- tx.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
25015
+ tx.id = Transaction.computeTransactionId(tx.header);
24691
25016
  return tx;
24692
25017
  }
24693
25018
  /**
24694
- * Functon to prepare the transaction (set headers, merkle
25019
+ * Function to prepare the transaction (set headers, merkle
24695
25020
  * root, etc)
24696
25021
  */
24697
25022
  async prepare(options) {
@@ -24836,15 +25161,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
24836
25161
  __setModuleDefault(result, mod);
24837
25162
  return result;
24838
25163
  };
24839
- var __importDefault = (this && this.__importDefault) || function (mod) {
24840
- return (mod && mod.__esModule) ? mod : { "default": mod };
24841
- };
24842
25164
  Object.defineProperty(exports, "__esModule", ({ value: true }));
24843
- exports.tokenAbi = exports.btypeEncode = exports.btypeDecode = exports.btypeEncodeValue = exports.btypeDecodeValue = exports.parseUnits = exports.formatUnits = exports.isChecksumWif = exports.isChecksumAddress = exports.isChecksum = exports.bitcoinAddress = exports.bitcoinDecode = exports.bitcoinEncode = exports.calculateMerkleRoot = exports.decodeBase64 = exports.multihash = exports.encodeBase64 = exports.decodeBase64url = exports.encodeBase64url = exports.decodeBase58 = exports.encodeBase58 = exports.toHexString = exports.toUint8Array = void 0;
25165
+ exports.nftAbi = exports.tokenAbi = exports.btypeEncode = exports.btypeDecode = exports.btypeEncodeValue = exports.btypeDecodeValue = exports.parseUnits = exports.formatUnits = exports.isChecksumWif = exports.isChecksumAddress = exports.isChecksum = exports.bitcoinAddress = exports.bitcoinDecode = exports.bitcoinEncode = exports.calculateMerkleRoot = exports.decodeBase64 = exports.multihash = exports.encodeBase64 = exports.decodeBase64url = exports.encodeBase64url = exports.decodeBase58 = exports.encodeBase58 = exports.toHexString = exports.toUint8Array = void 0;
24844
25166
  const multibase = __importStar(__webpack_require__(6957));
24845
25167
  const sha256_1 = __webpack_require__(3061);
24846
25168
  const ripemd160_1 = __webpack_require__(830);
24847
- const token_proto_json_1 = __importDefault(__webpack_require__(6567));
24848
25169
  /**
24849
25170
  * Converts an hex string to Uint8Array
24850
25171
  */
@@ -25268,57 +25589,1310 @@ function btypeEncode(valueDecoded, fields, verifyChecksum) {
25268
25589
  exports.btypeEncode = btypeEncode;
25269
25590
  /**
25270
25591
  * ABI for tokens
25592
+ *
25593
+ * @example
25594
+ * ```ts
25595
+ * import { Contract, Provider, utils } from "koilib";
25596
+ *
25597
+ * const provider = new Provider("https://api.koinos.io");
25598
+ * const koinContract = new Contract({
25599
+ * id: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
25600
+ * provider,
25601
+ * abi: utils.tokenAbi,
25602
+ * });
25603
+ * ```
25271
25604
  */
25272
25605
  exports.tokenAbi = {
25273
25606
  methods: {
25274
25607
  name: {
25275
- entry_point: 0x82a3537f,
25276
- argument: "name_arguments",
25277
- return: "name_result",
25608
+ argument: "",
25609
+ return: "token.str",
25610
+ description: "Get name of the token",
25278
25611
  read_only: true,
25612
+ entry_point: 0x82a3537f,
25279
25613
  },
25280
25614
  symbol: {
25281
- entry_point: 0xb76a7ca1,
25282
- argument: "symbol_arguments",
25283
- return: "symbol_result",
25615
+ argument: "",
25616
+ return: "token.str",
25617
+ description: "Get the symbol of the token",
25284
25618
  read_only: true,
25619
+ entry_point: 0xb76a7ca1,
25285
25620
  },
25286
25621
  decimals: {
25622
+ argument: "",
25623
+ return: "token.uint32",
25624
+ description: "Get the decimals of the token",
25625
+ read_only: true,
25287
25626
  entry_point: 0xee80fd2f,
25288
- argument: "decimals_arguments",
25289
- return: "decimals_result",
25627
+ },
25628
+ getInfo: {
25629
+ argument: "",
25630
+ return: "token.info",
25631
+ description: "Get name, symbol and decimals",
25290
25632
  read_only: true,
25633
+ entry_point: 0xbd7f6850,
25291
25634
  },
25292
25635
  totalSupply: {
25293
- entry_point: 0xb0da3934,
25294
- argument: "total_supply_arguments",
25295
- return: "total_supply_result",
25636
+ argument: "",
25637
+ return: "token.uint64",
25638
+ description: "Get total supply",
25296
25639
  read_only: true,
25640
+ entry_point: 0xb0da3934,
25297
25641
  },
25298
25642
  balanceOf: {
25643
+ argument: "token.balance_of_args",
25644
+ return: "token.uint64",
25645
+ description: "Get balance of an account",
25646
+ read_only: true,
25299
25647
  entry_point: 0x5c721497,
25300
- argument: "balance_of_arguments",
25301
- return: "balance_of_result",
25648
+ default_output: { value: "0" },
25649
+ },
25650
+ allowance: {
25651
+ argument: "token.allowance_args",
25652
+ return: "token.uint64",
25653
+ description: "Get allowance",
25302
25654
  read_only: true,
25655
+ entry_point: 0x32f09fa1,
25656
+ },
25657
+ getAllowances: {
25658
+ argument: "token.get_allowances_args",
25659
+ return: "token.get_allowances_return",
25660
+ description: "Get allowances of an account",
25661
+ read_only: true,
25662
+ entry_point: 0x8fa16456,
25663
+ },
25664
+ approve: {
25665
+ argument: "token.approve_args",
25666
+ return: "",
25667
+ description: "Grant permissions to other account to manage the tokens owned by the user. The user must approve only the accounts he trust.",
25668
+ read_only: false,
25669
+ entry_point: 0x74e21680,
25670
+ },
25671
+ transfer: {
25672
+ argument: "token.transfer_args",
25673
+ return: "",
25674
+ description: "Transfer tokens",
25675
+ read_only: false,
25676
+ entry_point: 0x27f576ca,
25677
+ },
25678
+ mint: {
25679
+ argument: "token.mint_args",
25680
+ return: "",
25681
+ description: "Mint new tokens",
25682
+ read_only: false,
25683
+ entry_point: 0xdc6f17bb,
25684
+ },
25685
+ },
25686
+ types: "CpoICiJrb2lub3MvY29udHJhY3RzL3Rva2VuL3Rva2VuLnByb3RvEhZrb2lub3MuY29udHJhY3RzLnRva2VuGhRrb2lub3Mvb3B0aW9ucy5wcm90byIQCg5uYW1lX2FyZ3VtZW50cyIjCgtuYW1lX3Jlc3VsdBIUCgV2YWx1ZRgBIAEoCVIFdmFsdWUiEgoQc3ltYm9sX2FyZ3VtZW50cyIlCg1zeW1ib2xfcmVzdWx0EhQKBXZhbHVlGAEgASgJUgV2YWx1ZSIUChJkZWNpbWFsc19hcmd1bWVudHMiJwoPZGVjaW1hbHNfcmVzdWx0EhQKBXZhbHVlGAEgASgNUgV2YWx1ZSIYChZ0b3RhbF9zdXBwbHlfYXJndW1lbnRzIi8KE3RvdGFsX3N1cHBseV9yZXN1bHQSGAoFdmFsdWUYASABKARCAjABUgV2YWx1ZSIyChRiYWxhbmNlX29mX2FyZ3VtZW50cxIaCgVvd25lchgBIAEoDEIEgLUYBlIFb3duZXIiLQoRYmFsYW5jZV9vZl9yZXN1bHQSGAoFdmFsdWUYASABKARCAjABUgV2YWx1ZSJeChJ0cmFuc2Zlcl9hcmd1bWVudHMSGAoEZnJvbRgBIAEoDEIEgLUYBlIEZnJvbRIUCgJ0bxgCIAEoDEIEgLUYBlICdG8SGAoFdmFsdWUYAyABKARCAjABUgV2YWx1ZSIRCg90cmFuc2Zlcl9yZXN1bHQiQAoObWludF9hcmd1bWVudHMSFAoCdG8YASABKAxCBIC1GAZSAnRvEhgKBXZhbHVlGAIgASgEQgIwAVIFdmFsdWUiDQoLbWludF9yZXN1bHQiRAoOYnVybl9hcmd1bWVudHMSGAoEZnJvbRgBIAEoDEIEgLUYBlIEZnJvbRIYCgV2YWx1ZRgCIAEoBEICMAFSBXZhbHVlIg0KC2J1cm5fcmVzdWx0IioKDmJhbGFuY2Vfb2JqZWN0EhgKBXZhbHVlGAEgASgEQgIwAVIFdmFsdWUiQAoKYnVybl9ldmVudBIYCgRmcm9tGAEgASgMQgSAtRgGUgRmcm9tEhgKBXZhbHVlGAIgASgEQgIwAVIFdmFsdWUiPAoKbWludF9ldmVudBIUCgJ0bxgBIAEoDEIEgLUYBlICdG8SGAoFdmFsdWUYAiABKARCAjABUgV2YWx1ZSJaCg50cmFuc2Zlcl9ldmVudBIYCgRmcm9tGAEgASgMQgSAtRgGUgRmcm9tEhQKAnRvGAIgASgMQgSAtRgGUgJ0bxIYCgV2YWx1ZRgDIAEoBEICMAFSBXZhbHVlQj5aPGdpdGh1Yi5jb20va29pbm9zL2tvaW5vcy1wcm90by1nb2xhbmcva29pbm9zL2NvbnRyYWN0cy90b2tlbmIGcHJvdG8zCvMKCgt0b2tlbi5wcm90bxIFdG9rZW4aFGtvaW5vcy9vcHRpb25zLnByb3RvIhsKA3N0chIUCgV2YWx1ZRgBIAEoCVIFdmFsdWUiHgoGdWludDMyEhQKBXZhbHVlGAEgASgNUgV2YWx1ZSIiCgZ1aW50NjQSGAoFdmFsdWUYASABKARCAjABUgV2YWx1ZSIdCgVib29sZRIUCgV2YWx1ZRgBIAEoCFIFdmFsdWUicAoEaW5mbxISCgRuYW1lGAEgASgJUgRuYW1lEhYKBnN5bWJvbBgCIAEoCVIGc3ltYm9sEhoKCGRlY2ltYWxzGAMgASgNUghkZWNpbWFscxIgCgtkZXNjcmlwdGlvbhgEIAEoCVILZGVzY3JpcHRpb24iLQoPYmFsYW5jZV9vZl9hcmdzEhoKBW93bmVyGAEgASgMQgSAtRgGUgVvd25lciJtCg10cmFuc2Zlcl9hcmdzEhgKBGZyb20YASABKAxCBIC1GAZSBGZyb20SFAoCdG8YAiABKAxCBIC1GAZSAnRvEhgKBXZhbHVlGAMgASgEQgIwAVIFdmFsdWUSEgoEbWVtbxgEIAEoCVIEbWVtbyI7CgltaW50X2FyZ3MSFAoCdG8YASABKAxCBIC1GAZSAnRvEhgKBXZhbHVlGAIgASgEQgIwAVIFdmFsdWUiPwoJYnVybl9hcmdzEhgKBGZyb20YASABKAxCBIC1GAZSBGZyb20SGAoFdmFsdWUYAiABKARCAjABUgV2YWx1ZSJkCgxhcHByb3ZlX2FyZ3MSGgoFb3duZXIYASABKAxCBIC1GAZSBW93bmVyEh4KB3NwZW5kZXIYAiABKAxCBIC1GAZSB3NwZW5kZXISGAoFdmFsdWUYAyABKARCAjABUgV2YWx1ZSJMCg5hbGxvd2FuY2VfYXJncxIaCgVvd25lchgBIAEoDEIEgLUYBlIFb3duZXISHgoHc3BlbmRlchgCIAEoDEIEgLUYBlIHc3BlbmRlciKDAQoTZ2V0X2FsbG93YW5jZXNfYXJncxIaCgVvd25lchgBIAEoDEIEgLUYBlIFb3duZXISGgoFc3RhcnQYAiABKAxCBIC1GAZSBXN0YXJ0EhQKBWxpbWl0GAMgASgFUgVsaW1pdBIeCgpkZXNjZW5kaW5nGAQgASgIUgpkZXNjZW5kaW5nIkkKDXNwZW5kZXJfdmFsdWUSHgoHc3BlbmRlchgBIAEoDEIEgLUYBlIHc3BlbmRlchIYCgV2YWx1ZRgCIAEoBEICMAFSBXZhbHVlImkKFWdldF9hbGxvd2FuY2VzX3JldHVybhIaCgVvd25lchgBIAEoDEIEgLUYBlIFb3duZXISNAoKYWxsb3dhbmNlcxgCIAMoCzIULnRva2VuLnNwZW5kZXJfdmFsdWVSCmFsbG93YW5jZXMiWgoOdHJhbnNmZXJfZXZlbnQSGAoEZnJvbRgBIAEoDEIEgLUYBlIEZnJvbRIUCgJ0bxgCIAEoDEIEgLUYBlICdG8SGAoFdmFsdWUYAyABKARCAjABUgV2YWx1ZSI8CgptaW50X2V2ZW50EhQKAnRvGAEgASgMQgSAtRgGUgJ0bxIYCgV2YWx1ZRgCIAEoBEICMAFSBXZhbHVlIkAKCmJ1cm5fZXZlbnQSGAoEZnJvbRgBIAEoDEIEgLUYBlIEZnJvbRIYCgV2YWx1ZRgCIAEoBEICMAFSBXZhbHVlImUKDWFwcHJvdmVfZXZlbnQSGgoFb3duZXIYASABKAxCBIC1GAZSBW93bmVyEh4KB3NwZW5kZXIYAiABKAxCBIC1GAZSB3NwZW5kZXISGAoFdmFsdWUYAyABKARCAjABUgV2YWx1ZWIGcHJvdG8z",
25687
+ koilib_types: {
25688
+ nested: {
25689
+ koinos: {
25690
+ options: {
25691
+ go_package: "github.com/koinos/koinos-proto-golang/koinos",
25692
+ },
25693
+ nested: {
25694
+ contracts: {
25695
+ nested: {
25696
+ token: {
25697
+ options: {
25698
+ go_package: "github.com/koinos/koinos-proto-golang/koinos/contracts/token",
25699
+ },
25700
+ nested: {
25701
+ name_arguments: {
25702
+ fields: {},
25703
+ },
25704
+ name_result: {
25705
+ fields: {
25706
+ value: {
25707
+ type: "string",
25708
+ id: 1,
25709
+ },
25710
+ },
25711
+ },
25712
+ symbol_arguments: {
25713
+ fields: {},
25714
+ },
25715
+ symbol_result: {
25716
+ fields: {
25717
+ value: {
25718
+ type: "string",
25719
+ id: 1,
25720
+ },
25721
+ },
25722
+ },
25723
+ decimals_arguments: {
25724
+ fields: {},
25725
+ },
25726
+ decimals_result: {
25727
+ fields: {
25728
+ value: {
25729
+ type: "uint32",
25730
+ id: 1,
25731
+ },
25732
+ },
25733
+ },
25734
+ total_supply_arguments: {
25735
+ fields: {},
25736
+ },
25737
+ total_supply_result: {
25738
+ fields: {
25739
+ value: {
25740
+ type: "uint64",
25741
+ id: 1,
25742
+ options: {
25743
+ jstype: "JS_STRING",
25744
+ },
25745
+ },
25746
+ },
25747
+ },
25748
+ balance_of_arguments: {
25749
+ fields: {
25750
+ owner: {
25751
+ type: "bytes",
25752
+ id: 1,
25753
+ options: {
25754
+ "(btype)": "ADDRESS",
25755
+ },
25756
+ },
25757
+ },
25758
+ },
25759
+ balance_of_result: {
25760
+ fields: {
25761
+ value: {
25762
+ type: "uint64",
25763
+ id: 1,
25764
+ options: {
25765
+ jstype: "JS_STRING",
25766
+ },
25767
+ },
25768
+ },
25769
+ },
25770
+ transfer_arguments: {
25771
+ fields: {
25772
+ from: {
25773
+ type: "bytes",
25774
+ id: 1,
25775
+ options: {
25776
+ "(btype)": "ADDRESS",
25777
+ },
25778
+ },
25779
+ to: {
25780
+ type: "bytes",
25781
+ id: 2,
25782
+ options: {
25783
+ "(btype)": "ADDRESS",
25784
+ },
25785
+ },
25786
+ value: {
25787
+ type: "uint64",
25788
+ id: 3,
25789
+ options: {
25790
+ jstype: "JS_STRING",
25791
+ },
25792
+ },
25793
+ },
25794
+ },
25795
+ transfer_result: {
25796
+ fields: {},
25797
+ },
25798
+ mint_arguments: {
25799
+ fields: {
25800
+ to: {
25801
+ type: "bytes",
25802
+ id: 1,
25803
+ options: {
25804
+ "(btype)": "ADDRESS",
25805
+ },
25806
+ },
25807
+ value: {
25808
+ type: "uint64",
25809
+ id: 2,
25810
+ options: {
25811
+ jstype: "JS_STRING",
25812
+ },
25813
+ },
25814
+ },
25815
+ },
25816
+ mint_result: {
25817
+ fields: {},
25818
+ },
25819
+ burn_arguments: {
25820
+ fields: {
25821
+ from: {
25822
+ type: "bytes",
25823
+ id: 1,
25824
+ options: {
25825
+ "(btype)": "ADDRESS",
25826
+ },
25827
+ },
25828
+ value: {
25829
+ type: "uint64",
25830
+ id: 2,
25831
+ options: {
25832
+ jstype: "JS_STRING",
25833
+ },
25834
+ },
25835
+ },
25836
+ },
25837
+ burn_result: {
25838
+ fields: {},
25839
+ },
25840
+ balance_object: {
25841
+ fields: {
25842
+ value: {
25843
+ type: "uint64",
25844
+ id: 1,
25845
+ options: {
25846
+ jstype: "JS_STRING",
25847
+ },
25848
+ },
25849
+ },
25850
+ },
25851
+ burn_event: {
25852
+ fields: {
25853
+ from: {
25854
+ type: "bytes",
25855
+ id: 1,
25856
+ options: {
25857
+ "(btype)": "ADDRESS",
25858
+ },
25859
+ },
25860
+ value: {
25861
+ type: "uint64",
25862
+ id: 2,
25863
+ options: {
25864
+ jstype: "JS_STRING",
25865
+ },
25866
+ },
25867
+ },
25868
+ },
25869
+ mint_event: {
25870
+ fields: {
25871
+ to: {
25872
+ type: "bytes",
25873
+ id: 1,
25874
+ options: {
25875
+ "(btype)": "ADDRESS",
25876
+ },
25877
+ },
25878
+ value: {
25879
+ type: "uint64",
25880
+ id: 2,
25881
+ options: {
25882
+ jstype: "JS_STRING",
25883
+ },
25884
+ },
25885
+ },
25886
+ },
25887
+ transfer_event: {
25888
+ fields: {
25889
+ from: {
25890
+ type: "bytes",
25891
+ id: 1,
25892
+ options: {
25893
+ "(btype)": "ADDRESS",
25894
+ },
25895
+ },
25896
+ to: {
25897
+ type: "bytes",
25898
+ id: 2,
25899
+ options: {
25900
+ "(btype)": "ADDRESS",
25901
+ },
25902
+ },
25903
+ value: {
25904
+ type: "uint64",
25905
+ id: 3,
25906
+ options: {
25907
+ jstype: "JS_STRING",
25908
+ },
25909
+ },
25910
+ },
25911
+ },
25912
+ },
25913
+ },
25914
+ },
25915
+ },
25916
+ bytes_type: {
25917
+ values: {
25918
+ BASE64: 0,
25919
+ BASE58: 1,
25920
+ HEX: 2,
25921
+ BLOCK_ID: 3,
25922
+ TRANSACTION_ID: 4,
25923
+ CONTRACT_ID: 5,
25924
+ ADDRESS: 6,
25925
+ },
25926
+ },
25927
+ btype: {
25928
+ type: "bytes_type",
25929
+ id: 50000,
25930
+ extend: "google.protobuf.FieldOptions",
25931
+ options: {
25932
+ proto3_optional: true,
25933
+ },
25934
+ },
25935
+ },
25936
+ },
25937
+ token: {
25938
+ nested: {
25939
+ str: {
25940
+ fields: {
25941
+ value: {
25942
+ type: "string",
25943
+ id: 1,
25944
+ },
25945
+ },
25946
+ },
25947
+ uint32: {
25948
+ fields: {
25949
+ value: {
25950
+ type: "uint32",
25951
+ id: 1,
25952
+ },
25953
+ },
25954
+ },
25955
+ uint64: {
25956
+ fields: {
25957
+ value: {
25958
+ type: "uint64",
25959
+ id: 1,
25960
+ options: {
25961
+ jstype: "JS_STRING",
25962
+ },
25963
+ },
25964
+ },
25965
+ },
25966
+ boole: {
25967
+ fields: {
25968
+ value: {
25969
+ type: "bool",
25970
+ id: 1,
25971
+ },
25972
+ },
25973
+ },
25974
+ info: {
25975
+ fields: {
25976
+ name: {
25977
+ type: "string",
25978
+ id: 1,
25979
+ },
25980
+ symbol: {
25981
+ type: "string",
25982
+ id: 2,
25983
+ },
25984
+ decimals: {
25985
+ type: "uint32",
25986
+ id: 3,
25987
+ },
25988
+ description: {
25989
+ type: "string",
25990
+ id: 4,
25991
+ },
25992
+ },
25993
+ },
25994
+ balance_of_args: {
25995
+ fields: {
25996
+ owner: {
25997
+ type: "bytes",
25998
+ id: 1,
25999
+ options: {
26000
+ "(koinos.btype)": "ADDRESS",
26001
+ },
26002
+ },
26003
+ },
26004
+ },
26005
+ transfer_args: {
26006
+ fields: {
26007
+ from: {
26008
+ type: "bytes",
26009
+ id: 1,
26010
+ options: {
26011
+ "(koinos.btype)": "ADDRESS",
26012
+ },
26013
+ },
26014
+ to: {
26015
+ type: "bytes",
26016
+ id: 2,
26017
+ options: {
26018
+ "(koinos.btype)": "ADDRESS",
26019
+ },
26020
+ },
26021
+ value: {
26022
+ type: "uint64",
26023
+ id: 3,
26024
+ options: {
26025
+ jstype: "JS_STRING",
26026
+ },
26027
+ },
26028
+ memo: {
26029
+ type: "string",
26030
+ id: 4,
26031
+ },
26032
+ },
26033
+ },
26034
+ mint_args: {
26035
+ fields: {
26036
+ to: {
26037
+ type: "bytes",
26038
+ id: 1,
26039
+ options: {
26040
+ "(koinos.btype)": "ADDRESS",
26041
+ },
26042
+ },
26043
+ value: {
26044
+ type: "uint64",
26045
+ id: 2,
26046
+ options: {
26047
+ jstype: "JS_STRING",
26048
+ },
26049
+ },
26050
+ },
26051
+ },
26052
+ burn_args: {
26053
+ fields: {
26054
+ from: {
26055
+ type: "bytes",
26056
+ id: 1,
26057
+ options: {
26058
+ "(koinos.btype)": "ADDRESS",
26059
+ },
26060
+ },
26061
+ value: {
26062
+ type: "uint64",
26063
+ id: 2,
26064
+ options: {
26065
+ jstype: "JS_STRING",
26066
+ },
26067
+ },
26068
+ },
26069
+ },
26070
+ approve_args: {
26071
+ fields: {
26072
+ owner: {
26073
+ type: "bytes",
26074
+ id: 1,
26075
+ options: {
26076
+ "(koinos.btype)": "ADDRESS",
26077
+ },
26078
+ },
26079
+ spender: {
26080
+ type: "bytes",
26081
+ id: 2,
26082
+ options: {
26083
+ "(koinos.btype)": "ADDRESS",
26084
+ },
26085
+ },
26086
+ value: {
26087
+ type: "uint64",
26088
+ id: 3,
26089
+ options: {
26090
+ jstype: "JS_STRING",
26091
+ },
26092
+ },
26093
+ },
26094
+ },
26095
+ allowance_args: {
26096
+ fields: {
26097
+ owner: {
26098
+ type: "bytes",
26099
+ id: 1,
26100
+ options: {
26101
+ "(koinos.btype)": "ADDRESS",
26102
+ },
26103
+ },
26104
+ spender: {
26105
+ type: "bytes",
26106
+ id: 2,
26107
+ options: {
26108
+ "(koinos.btype)": "ADDRESS",
26109
+ },
26110
+ },
26111
+ },
26112
+ },
26113
+ get_allowances_args: {
26114
+ fields: {
26115
+ owner: {
26116
+ type: "bytes",
26117
+ id: 1,
26118
+ options: {
26119
+ "(koinos.btype)": "ADDRESS",
26120
+ },
26121
+ },
26122
+ start: {
26123
+ type: "bytes",
26124
+ id: 2,
26125
+ options: {
26126
+ "(koinos.btype)": "ADDRESS",
26127
+ },
26128
+ },
26129
+ limit: {
26130
+ type: "int32",
26131
+ id: 3,
26132
+ },
26133
+ descending: {
26134
+ type: "bool",
26135
+ id: 4,
26136
+ },
26137
+ },
26138
+ },
26139
+ spender_value: {
26140
+ fields: {
26141
+ spender: {
26142
+ type: "bytes",
26143
+ id: 1,
26144
+ options: {
26145
+ "(koinos.btype)": "ADDRESS",
26146
+ },
26147
+ },
26148
+ value: {
26149
+ type: "uint64",
26150
+ id: 2,
26151
+ options: {
26152
+ jstype: "JS_STRING",
26153
+ },
26154
+ },
26155
+ },
26156
+ },
26157
+ get_allowances_return: {
26158
+ fields: {
26159
+ owner: {
26160
+ type: "bytes",
26161
+ id: 1,
26162
+ options: {
26163
+ "(koinos.btype)": "ADDRESS",
26164
+ },
26165
+ },
26166
+ allowances: {
26167
+ rule: "repeated",
26168
+ type: "spender_value",
26169
+ id: 2,
26170
+ },
26171
+ },
26172
+ },
26173
+ transfer_event: {
26174
+ fields: {
26175
+ from: {
26176
+ type: "bytes",
26177
+ id: 1,
26178
+ options: {
26179
+ "(koinos.btype)": "ADDRESS",
26180
+ },
26181
+ },
26182
+ to: {
26183
+ type: "bytes",
26184
+ id: 2,
26185
+ options: {
26186
+ "(koinos.btype)": "ADDRESS",
26187
+ },
26188
+ },
26189
+ value: {
26190
+ type: "uint64",
26191
+ id: 3,
26192
+ options: {
26193
+ jstype: "JS_STRING",
26194
+ },
26195
+ },
26196
+ },
26197
+ },
26198
+ mint_event: {
26199
+ fields: {
26200
+ to: {
26201
+ type: "bytes",
26202
+ id: 1,
26203
+ options: {
26204
+ "(koinos.btype)": "ADDRESS",
26205
+ },
26206
+ },
26207
+ value: {
26208
+ type: "uint64",
26209
+ id: 2,
26210
+ options: {
26211
+ jstype: "JS_STRING",
26212
+ },
26213
+ },
26214
+ },
26215
+ },
26216
+ burn_event: {
26217
+ fields: {
26218
+ from: {
26219
+ type: "bytes",
26220
+ id: 1,
26221
+ options: {
26222
+ "(koinos.btype)": "ADDRESS",
26223
+ },
26224
+ },
26225
+ value: {
26226
+ type: "uint64",
26227
+ id: 2,
26228
+ options: {
26229
+ jstype: "JS_STRING",
26230
+ },
26231
+ },
26232
+ },
26233
+ },
26234
+ approve_event: {
26235
+ fields: {
26236
+ owner: {
26237
+ type: "bytes",
26238
+ id: 1,
26239
+ options: {
26240
+ "(koinos.btype)": "ADDRESS",
26241
+ },
26242
+ },
26243
+ spender: {
26244
+ type: "bytes",
26245
+ id: 2,
26246
+ options: {
26247
+ "(koinos.btype)": "ADDRESS",
26248
+ },
26249
+ },
26250
+ value: {
26251
+ type: "uint64",
26252
+ id: 3,
26253
+ options: {
26254
+ jstype: "JS_STRING",
26255
+ },
26256
+ },
26257
+ },
26258
+ },
26259
+ },
26260
+ },
26261
+ },
26262
+ },
26263
+ };
26264
+ /**
26265
+ * ABI for NFTs
26266
+ *
26267
+ * @example
26268
+ * ```ts
26269
+ * import { Contract, Provider, utils } from "koilib";
26270
+ *
26271
+ * const provider = new Provider("https://api.koinos.io");
26272
+ * const nicknamesContract = new Contract({
26273
+ * id: "1KD9Es7LBBjA1FY3ViCgQJ7e6WH1ipKbhz",
26274
+ * provider,
26275
+ * abi: utils.nftAbi,
26276
+ * });
26277
+ * const nicknames = nicknamesContract.functions;
26278
+ *
26279
+ * ...
26280
+ *
26281
+ * // get the address linked to the nickname "pob"
26282
+ * const pobId = `0x${utils.toHexString(new TextEncoder().encode("pob"))}`;
26283
+ * const { result } = await nicknames.ownerOf({ token_id: pobId });
26284
+ * console.log(result);
26285
+ *
26286
+ * // { value: '159myq5YUhhoVWu3wsHKHiJYKPKGUrGiyv' }
26287
+ })();
26288
+ * ```
26289
+ */
26290
+ exports.nftAbi = {
26291
+ methods: {
26292
+ name: {
26293
+ argument: "",
26294
+ return: "common.str",
26295
+ description: "Get name of the NFT",
26296
+ read_only: true,
26297
+ entry_point: 0x82a3537f,
26298
+ },
26299
+ symbol: {
26300
+ argument: "",
26301
+ return: "common.str",
26302
+ description: "Get the symbol of the NFT",
26303
+ read_only: true,
26304
+ entry_point: 0xb76a7ca1,
26305
+ },
26306
+ uri: {
26307
+ argument: "",
26308
+ return: "common.str",
26309
+ description: "Get URI of the NFT",
26310
+ read_only: true,
26311
+ entry_point: 0x70e5d7b6,
26312
+ },
26313
+ getInfo: {
26314
+ argument: "",
26315
+ return: "nft.info",
26316
+ description: "Get name, symbol and decimals",
26317
+ read_only: true,
26318
+ entry_point: 0xbd7f6850,
26319
+ },
26320
+ owner: {
26321
+ argument: "",
26322
+ return: "common.address",
26323
+ description: "Get the owner of the collection",
26324
+ read_only: true,
26325
+ entry_point: 0x4c102969,
26326
+ },
26327
+ totalSupply: {
26328
+ argument: "",
26329
+ return: "common.uint64",
26330
+ description: "Get total supply",
26331
+ read_only: true,
26332
+ entry_point: 0xb0da3934,
26333
+ },
26334
+ royalties: {
26335
+ argument: "",
26336
+ return: "nft.royalties",
26337
+ description: "Get royalties",
26338
+ read_only: true,
26339
+ entry_point: 0x36e90cd0,
26340
+ },
26341
+ balanceOf: {
26342
+ argument: "nft.balance_of_args",
26343
+ return: "common.uint64",
26344
+ description: "Get balance of an account",
26345
+ read_only: true,
26346
+ entry_point: 0x5c721497,
25303
26347
  default_output: { value: "0" },
25304
26348
  },
26349
+ ownerOf: {
26350
+ argument: "nft.token",
26351
+ return: "common.address",
26352
+ description: "Get the owner of a token",
26353
+ read_only: true,
26354
+ entry_point: 0xed61c847,
26355
+ },
26356
+ metadataOf: {
26357
+ argument: "nft.token",
26358
+ return: "common.str",
26359
+ description: "Get the metadata of a token",
26360
+ read_only: true,
26361
+ entry_point: 0x176c8f7f,
26362
+ },
26363
+ getTokens: {
26364
+ argument: "nft.get_tokens_args",
26365
+ return: "nft.token_ids",
26366
+ description: "Get list of token IDs",
26367
+ read_only: true,
26368
+ entry_point: 0x7d5b5ed7,
26369
+ },
26370
+ getTokensByOwner: {
26371
+ argument: "nft.get_tokens_by_owner_args",
26372
+ return: "nft.token_ids",
26373
+ description: "Get tokens owned by an address",
26374
+ read_only: true,
26375
+ entry_point: 0xfc13eb75,
26376
+ },
26377
+ getApproved: {
26378
+ argument: "nft.token",
26379
+ return: "common.address",
26380
+ description: "Check if an account is approved to operate a token ID",
26381
+ read_only: true,
26382
+ entry_point: 0x4c731020,
26383
+ },
26384
+ isApprovedForAll: {
26385
+ argument: "nft.is_approved_for_all_args",
26386
+ return: "common.boole",
26387
+ description: "Check if an account is approved to operate all tokens owned by other account",
26388
+ read_only: true,
26389
+ entry_point: 0xe7ab8ce5,
26390
+ },
26391
+ getOperatorApprovals: {
26392
+ argument: "nft.get_operators_args",
26393
+ return: "nft.get_operators_return",
26394
+ description: "Get allowances of an account",
26395
+ read_only: true,
26396
+ entry_point: 0xdb1bf60e,
26397
+ },
26398
+ transferOwnership: {
26399
+ argument: "common.address",
26400
+ return: "",
26401
+ description: "Transfer ownership of the collection",
26402
+ read_only: false,
26403
+ entry_point: 0x394be702,
26404
+ },
26405
+ setRoyalties: {
26406
+ argument: "nft.royalties",
26407
+ return: "",
26408
+ description: "Set royalties",
26409
+ read_only: false,
26410
+ entry_point: 0x3b5bb56b,
26411
+ },
26412
+ setMetadata: {
26413
+ argument: "nft.metadata_args",
26414
+ return: "",
26415
+ description: "Set metadata",
26416
+ read_only: false,
26417
+ entry_point: 0x3d59af19,
26418
+ },
26419
+ approve: {
26420
+ argument: "nft.approve_args",
26421
+ return: "",
26422
+ description: "Grant permissions to other account to manage a specific Token owned by the user. The user must approve only the accounts he trust.",
26423
+ read_only: false,
26424
+ entry_point: 0x74e21680,
26425
+ },
26426
+ setApprovalForAll: {
26427
+ argument: "nft.set_approval_for_all_args",
26428
+ return: "",
26429
+ description: "Grant permissions to other account to manage all Tokens owned by the user. The user must approve only the accounts he trust.",
26430
+ read_only: false,
26431
+ entry_point: 0x20442216,
26432
+ },
25305
26433
  transfer: {
26434
+ argument: "nft.transfer_args",
26435
+ return: "",
26436
+ description: "Transfer NFT",
26437
+ read_only: false,
25306
26438
  entry_point: 0x27f576ca,
25307
- argument: "transfer_arguments",
25308
- return: "transfer_result",
25309
26439
  },
25310
26440
  mint: {
26441
+ argument: "nft.mint_args",
26442
+ return: "",
26443
+ description: "Mint NFT",
26444
+ read_only: false,
25311
26445
  entry_point: 0xdc6f17bb,
25312
- argument: "mint_arguments",
25313
- return: "mint_result",
25314
26446
  },
25315
- burn: {
25316
- entry_point: 0x859facc5,
25317
- argument: "burn_arguments",
25318
- return: "burn_result",
26447
+ },
26448
+ types: "CoQDCidrb2lub3Nib3gtcHJvdG8vbWFuYXNoYXJlci9jb21tb24ucHJvdG8SBmNvbW1vbhoUa29pbm9zL29wdGlvbnMucHJvdG8iGwoDc3RyEhQKBXZhbHVlGAEgASgJUgV2YWx1ZSIeCgZ1aW50MzISFAoFdmFsdWUYASABKA1SBXZhbHVlIiIKBnVpbnQ2NBIYCgV2YWx1ZRgBIAEoBEICMAFSBXZhbHVlIh0KBWJvb2xlEhQKBXZhbHVlGAEgASgIUgV2YWx1ZSIlCgdhZGRyZXNzEhoKBXZhbHVlGAEgASgMQgSAtRgGUgV2YWx1ZSJdCglsaXN0X2FyZ3MSGgoFc3RhcnQYASABKAxCBIC1GAZSBXN0YXJ0EhQKBWxpbWl0GAIgASgFUgVsaW1pdBIeCgpkZXNjZW5kaW5nGAMgASgIUgpkZXNjZW5kaW5nIi0KCWFkZHJlc3NlcxIgCghhY2NvdW50cxgBIAMoDEIEgLUYBlIIYWNjb3VudHNiBnByb3RvMwqQDAoJbmZ0LnByb3RvEgNuZnQaFGtvaW5vcy9vcHRpb25zLnByb3RvIk0KB3JveWFsdHkSIgoKcGVyY2VudGFnZRgBIAEoBEICMAFSCnBlcmNlbnRhZ2USHgoHYWRkcmVzcxgCIAEoDEIEgLUYBlIHYWRkcmVzcyIvCglyb3lhbHRpZXMSIgoFdmFsdWUYASADKAsyDC5uZnQucm95YWx0eVIFdmFsdWUiTAoNbWV0YWRhdGFfYXJncxIfCgh0b2tlbl9pZBgBIAEoDEIEgLUYAlIHdG9rZW5JZBIaCghtZXRhZGF0YRgCIAEoCVIIbWV0YWRhdGEiZgoEaW5mbxISCgRuYW1lGAEgASgJUgRuYW1lEhYKBnN5bWJvbBgCIAEoCVIGc3ltYm9sEhAKA3VyaRgDIAEoCVIDdXJpEiAKC2Rlc2NyaXB0aW9uGAQgASgJUgtkZXNjcmlwdGlvbiItCg9iYWxhbmNlX29mX2FyZ3MSGgoFb3duZXIYASABKAxCBIC1GAZSBW93bmVyIigKBXRva2VuEh8KCHRva2VuX2lkGAEgASgMQgSAtRgCUgd0b2tlbklkIlgKGGlzX2FwcHJvdmVkX2Zvcl9hbGxfYXJncxIaCgVvd25lchgBIAEoDEIEgLUYBlIFb3duZXISIAoIb3BlcmF0b3IYAiABKAxCBIC1GAZSCG9wZXJhdG9yIkIKCW1pbnRfYXJncxIUCgJ0bxgBIAEoDEIEgLUYBlICdG8SHwoIdG9rZW5faWQYAiABKAxCBIC1GAJSB3Rva2VuSWQiLAoJYnVybl9hcmdzEh8KCHRva2VuX2lkGAEgASgMQgSAtRgCUgd0b2tlbklkInQKDXRyYW5zZmVyX2FyZ3MSGAoEZnJvbRgBIAEoDEIEgLUYBlIEZnJvbRIUCgJ0bxgCIAEoDEIEgLUYBlICdG8SHwoIdG9rZW5faWQYAyABKAxCBIC1GAJSB3Rva2VuSWQSEgoEbWVtbxgEIAEoCVIEbWVtbyJ2CgxhcHByb3ZlX2FyZ3MSLwoQYXBwcm92ZXJfYWRkcmVzcxgBIAEoDEIEgLUYBlIPYXBwcm92ZXJBZGRyZXNzEhQKAnRvGAIgASgMQgSAtRgGUgJ0bxIfCgh0b2tlbl9pZBgDIAEoDEIEgLUYAlIHdG9rZW5JZCKZAQoZc2V0X2FwcHJvdmFsX2Zvcl9hbGxfYXJncxIvChBhcHByb3Zlcl9hZGRyZXNzGAEgASgMQgSAtRgGUg9hcHByb3ZlckFkZHJlc3MSLwoQb3BlcmF0b3JfYWRkcmVzcxgCIAEoDEIEgLUYBlIPb3BlcmF0b3JBZGRyZXNzEhoKCGFwcHJvdmVkGAMgASgIUghhcHByb3ZlZCKCAQoSZ2V0X29wZXJhdG9yc19hcmdzEhoKBW93bmVyGAEgASgMQgSAtRgGUgVvd25lchIaCgVzdGFydBgCIAEoDEIEgLUYBlIFc3RhcnQSFAoFbGltaXQYAyABKAVSBWxpbWl0Eh4KCmRlc2NlbmRpbmcYBCABKAhSCmRlc2NlbmRpbmciVgoUZ2V0X29wZXJhdG9yc19yZXR1cm4SGgoFb3duZXIYASABKAxCBIC1GAZSBW93bmVyEiIKCW9wZXJhdG9ycxgCIAMoDEIEgLUYBlIJb3BlcmF0b3JzImMKD2dldF90b2tlbnNfYXJncxIaCgVzdGFydBgBIAEoDEIEgLUYAlIFc3RhcnQSFAoFbGltaXQYAiABKAVSBWxpbWl0Eh4KCmRlc2NlbmRpbmcYAyABKAhSCmRlc2NlbmRpbmciiAEKGGdldF90b2tlbnNfYnlfb3duZXJfYXJncxIaCgVvd25lchgBIAEoDEIEgLUYBlIFb3duZXISGgoFc3RhcnQYAiABKAxCBIC1GAJSBXN0YXJ0EhQKBWxpbWl0GAMgASgFUgVsaW1pdBIeCgpkZXNjZW5kaW5nGAQgASgIUgpkZXNjZW5kaW5nIi4KCXRva2VuX2lkcxIhCgl0b2tlbl9pZHMYASADKAxCBIC1GAJSCHRva2VuSWRzYgZwcm90bzM=",
26449
+ koilib_types: {
26450
+ nested: {
26451
+ common: {
26452
+ nested: {
26453
+ str: {
26454
+ fields: {
26455
+ value: {
26456
+ type: "string",
26457
+ id: 1,
26458
+ },
26459
+ },
26460
+ },
26461
+ uint32: {
26462
+ fields: {
26463
+ value: {
26464
+ type: "uint32",
26465
+ id: 1,
26466
+ },
26467
+ },
26468
+ },
26469
+ uint64: {
26470
+ fields: {
26471
+ value: {
26472
+ type: "uint64",
26473
+ id: 1,
26474
+ options: {
26475
+ jstype: "JS_STRING",
26476
+ },
26477
+ },
26478
+ },
26479
+ },
26480
+ boole: {
26481
+ fields: {
26482
+ value: {
26483
+ type: "bool",
26484
+ id: 1,
26485
+ },
26486
+ },
26487
+ },
26488
+ address: {
26489
+ fields: {
26490
+ value: {
26491
+ type: "bytes",
26492
+ id: 1,
26493
+ options: {
26494
+ "(koinos.btype)": "ADDRESS",
26495
+ },
26496
+ },
26497
+ },
26498
+ },
26499
+ list_args: {
26500
+ fields: {
26501
+ start: {
26502
+ type: "bytes",
26503
+ id: 1,
26504
+ options: {
26505
+ "(koinos.btype)": "ADDRESS",
26506
+ },
26507
+ },
26508
+ limit: {
26509
+ type: "int32",
26510
+ id: 2,
26511
+ },
26512
+ descending: {
26513
+ type: "bool",
26514
+ id: 3,
26515
+ },
26516
+ },
26517
+ },
26518
+ addresses: {
26519
+ fields: {
26520
+ accounts: {
26521
+ rule: "repeated",
26522
+ type: "bytes",
26523
+ id: 1,
26524
+ options: {
26525
+ "(koinos.btype)": "ADDRESS",
26526
+ },
26527
+ },
26528
+ },
26529
+ },
26530
+ },
26531
+ },
26532
+ koinos: {
26533
+ options: {
26534
+ go_package: "github.com/koinos/koinos-proto-golang/koinos",
26535
+ },
26536
+ nested: {
26537
+ bytes_type: {
26538
+ values: {
26539
+ BASE64: 0,
26540
+ BASE58: 1,
26541
+ HEX: 2,
26542
+ BLOCK_ID: 3,
26543
+ TRANSACTION_ID: 4,
26544
+ CONTRACT_ID: 5,
26545
+ ADDRESS: 6,
26546
+ },
26547
+ },
26548
+ btype: {
26549
+ type: "bytes_type",
26550
+ id: 50000,
26551
+ extend: "google.protobuf.FieldOptions",
26552
+ options: {
26553
+ proto3_optional: true,
26554
+ },
26555
+ },
26556
+ },
26557
+ },
26558
+ nft: {
26559
+ nested: {
26560
+ royalty: {
26561
+ fields: {
26562
+ percentage: {
26563
+ type: "uint64",
26564
+ id: 1,
26565
+ options: {
26566
+ jstype: "JS_STRING",
26567
+ },
26568
+ },
26569
+ address: {
26570
+ type: "bytes",
26571
+ id: 2,
26572
+ options: {
26573
+ "(koinos.btype)": "ADDRESS",
26574
+ },
26575
+ },
26576
+ },
26577
+ },
26578
+ royalties: {
26579
+ fields: {
26580
+ value: {
26581
+ rule: "repeated",
26582
+ type: "royalty",
26583
+ id: 1,
26584
+ },
26585
+ },
26586
+ },
26587
+ metadata_args: {
26588
+ fields: {
26589
+ token_id: {
26590
+ type: "bytes",
26591
+ id: 1,
26592
+ options: {
26593
+ "(koinos.btype)": "HEX",
26594
+ },
26595
+ },
26596
+ metadata: {
26597
+ type: "string",
26598
+ id: 2,
26599
+ },
26600
+ },
26601
+ },
26602
+ info: {
26603
+ fields: {
26604
+ name: {
26605
+ type: "string",
26606
+ id: 1,
26607
+ },
26608
+ symbol: {
26609
+ type: "string",
26610
+ id: 2,
26611
+ },
26612
+ uri: {
26613
+ type: "string",
26614
+ id: 3,
26615
+ },
26616
+ description: {
26617
+ type: "string",
26618
+ id: 4,
26619
+ },
26620
+ },
26621
+ },
26622
+ balance_of_args: {
26623
+ fields: {
26624
+ owner: {
26625
+ type: "bytes",
26626
+ id: 1,
26627
+ options: {
26628
+ "(koinos.btype)": "ADDRESS",
26629
+ },
26630
+ },
26631
+ },
26632
+ },
26633
+ token: {
26634
+ fields: {
26635
+ token_id: {
26636
+ type: "bytes",
26637
+ id: 1,
26638
+ options: {
26639
+ "(koinos.btype)": "HEX",
26640
+ },
26641
+ },
26642
+ },
26643
+ },
26644
+ is_approved_for_all_args: {
26645
+ fields: {
26646
+ owner: {
26647
+ type: "bytes",
26648
+ id: 1,
26649
+ options: {
26650
+ "(koinos.btype)": "ADDRESS",
26651
+ },
26652
+ },
26653
+ operator: {
26654
+ type: "bytes",
26655
+ id: 2,
26656
+ options: {
26657
+ "(koinos.btype)": "ADDRESS",
26658
+ },
26659
+ },
26660
+ },
26661
+ },
26662
+ mint_args: {
26663
+ fields: {
26664
+ to: {
26665
+ type: "bytes",
26666
+ id: 1,
26667
+ options: {
26668
+ "(koinos.btype)": "ADDRESS",
26669
+ },
26670
+ },
26671
+ token_id: {
26672
+ type: "bytes",
26673
+ id: 2,
26674
+ options: {
26675
+ "(koinos.btype)": "HEX",
26676
+ },
26677
+ },
26678
+ },
26679
+ },
26680
+ burn_args: {
26681
+ fields: {
26682
+ token_id: {
26683
+ type: "bytes",
26684
+ id: 1,
26685
+ options: {
26686
+ "(koinos.btype)": "HEX",
26687
+ },
26688
+ },
26689
+ },
26690
+ },
26691
+ transfer_args: {
26692
+ fields: {
26693
+ from: {
26694
+ type: "bytes",
26695
+ id: 1,
26696
+ options: {
26697
+ "(koinos.btype)": "ADDRESS",
26698
+ },
26699
+ },
26700
+ to: {
26701
+ type: "bytes",
26702
+ id: 2,
26703
+ options: {
26704
+ "(koinos.btype)": "ADDRESS",
26705
+ },
26706
+ },
26707
+ token_id: {
26708
+ type: "bytes",
26709
+ id: 3,
26710
+ options: {
26711
+ "(koinos.btype)": "HEX",
26712
+ },
26713
+ },
26714
+ memo: {
26715
+ type: "string",
26716
+ id: 4,
26717
+ },
26718
+ },
26719
+ },
26720
+ approve_args: {
26721
+ fields: {
26722
+ approver_address: {
26723
+ type: "bytes",
26724
+ id: 1,
26725
+ options: {
26726
+ "(koinos.btype)": "ADDRESS",
26727
+ },
26728
+ },
26729
+ to: {
26730
+ type: "bytes",
26731
+ id: 2,
26732
+ options: {
26733
+ "(koinos.btype)": "ADDRESS",
26734
+ },
26735
+ },
26736
+ token_id: {
26737
+ type: "bytes",
26738
+ id: 3,
26739
+ options: {
26740
+ "(koinos.btype)": "HEX",
26741
+ },
26742
+ },
26743
+ },
26744
+ },
26745
+ set_approval_for_all_args: {
26746
+ fields: {
26747
+ approver_address: {
26748
+ type: "bytes",
26749
+ id: 1,
26750
+ options: {
26751
+ "(koinos.btype)": "ADDRESS",
26752
+ },
26753
+ },
26754
+ operator_address: {
26755
+ type: "bytes",
26756
+ id: 2,
26757
+ options: {
26758
+ "(koinos.btype)": "ADDRESS",
26759
+ },
26760
+ },
26761
+ approved: {
26762
+ type: "bool",
26763
+ id: 3,
26764
+ },
26765
+ },
26766
+ },
26767
+ get_operators_args: {
26768
+ fields: {
26769
+ owner: {
26770
+ type: "bytes",
26771
+ id: 1,
26772
+ options: {
26773
+ "(koinos.btype)": "ADDRESS",
26774
+ },
26775
+ },
26776
+ start: {
26777
+ type: "bytes",
26778
+ id: 2,
26779
+ options: {
26780
+ "(koinos.btype)": "ADDRESS",
26781
+ },
26782
+ },
26783
+ limit: {
26784
+ type: "int32",
26785
+ id: 3,
26786
+ },
26787
+ descending: {
26788
+ type: "bool",
26789
+ id: 4,
26790
+ },
26791
+ },
26792
+ },
26793
+ get_operators_return: {
26794
+ fields: {
26795
+ owner: {
26796
+ type: "bytes",
26797
+ id: 1,
26798
+ options: {
26799
+ "(koinos.btype)": "ADDRESS",
26800
+ },
26801
+ },
26802
+ operators: {
26803
+ rule: "repeated",
26804
+ type: "bytes",
26805
+ id: 2,
26806
+ options: {
26807
+ "(koinos.btype)": "ADDRESS",
26808
+ },
26809
+ },
26810
+ },
26811
+ },
26812
+ get_tokens_args: {
26813
+ fields: {
26814
+ start: {
26815
+ type: "bytes",
26816
+ id: 1,
26817
+ options: {
26818
+ "(koinos.btype)": "HEX",
26819
+ },
26820
+ },
26821
+ limit: {
26822
+ type: "int32",
26823
+ id: 2,
26824
+ },
26825
+ descending: {
26826
+ type: "bool",
26827
+ id: 3,
26828
+ },
26829
+ },
26830
+ },
26831
+ get_tokens_by_owner_args: {
26832
+ fields: {
26833
+ owner: {
26834
+ type: "bytes",
26835
+ id: 1,
26836
+ options: {
26837
+ "(koinos.btype)": "ADDRESS",
26838
+ },
26839
+ },
26840
+ start: {
26841
+ type: "bytes",
26842
+ id: 2,
26843
+ options: {
26844
+ "(koinos.btype)": "HEX",
26845
+ },
26846
+ },
26847
+ limit: {
26848
+ type: "int32",
26849
+ id: 3,
26850
+ },
26851
+ descending: {
26852
+ type: "bool",
26853
+ id: 4,
26854
+ },
26855
+ },
26856
+ },
26857
+ token_ids: {
26858
+ fields: {
26859
+ token_ids: {
26860
+ rule: "repeated",
26861
+ type: "bytes",
26862
+ id: 1,
26863
+ options: {
26864
+ "(koinos.btype)": "HEX",
26865
+ },
26866
+ },
26867
+ },
26868
+ },
26869
+ },
26870
+ },
26871
+ },
26872
+ },
26873
+ events: {
26874
+ "collections.owner_event": {
26875
+ argument: "common.address",
26876
+ },
26877
+ "collections.royalties_event": {
26878
+ argument: "nft.royalties",
26879
+ },
26880
+ "collections.set_metadata_event": {
26881
+ argument: "nft.metadata_args",
26882
+ },
26883
+ "collections.token_approval_event": {
26884
+ argument: "nft.approve_args",
26885
+ },
26886
+ "collections.operator_approval_event": {
26887
+ argument: "nft.set_approval_for_all_args",
26888
+ },
26889
+ "collections.transfer_event": {
26890
+ argument: "nft.transfer_args",
26891
+ },
26892
+ "collections.mint_event": {
26893
+ argument: "nft.mint_args",
25319
26894
  },
25320
26895
  },
25321
- koilib_types: token_proto_json_1.default,
25322
26896
  };
25323
26897
  //export const ProtocolTypes = protocolJson;
25324
26898
 
@@ -34511,14 +36085,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
34511
36085
 
34512
36086
  /* (ignored) */
34513
36087
 
34514
- /***/ }),
34515
-
34516
- /***/ 6567:
34517
- /***/ ((module) => {
34518
-
34519
- "use strict";
34520
- module.exports = JSON.parse('{"nested":{"koinos":{"nested":{"contracts":{"nested":{"token":{"options":{"go_package":"github.com/koinos/koinos-proto-golang/v2/koinos/contracts/token"},"nested":{"name_arguments":{"fields":{}},"name_result":{"fields":{"value":{"type":"string","id":1}}},"symbol_arguments":{"fields":{}},"symbol_result":{"fields":{"value":{"type":"string","id":1}}},"decimals_arguments":{"fields":{}},"decimals_result":{"fields":{"value":{"type":"uint32","id":1}}},"total_supply_arguments":{"fields":{}},"total_supply_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"balance_of_arguments":{"fields":{"owner":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}}}},"balance_of_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"transfer_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}},"memo":{"type":"string","id":4}}},"transfer_result":{"fields":{}},"mint_arguments":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_result":{"fields":{}},"burn_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"burn_result":{"fields":{}},"balance_object":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"burn_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_event":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"transfer_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}}}}}}}}}}');
34521
-
34522
36088
  /***/ })
34523
36089
 
34524
36090
  /******/ });