koilib 6.0.0 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +39 -40
  2. package/dist/koinos.js +1675 -84
  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 +288 -10
  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 +288 -10
  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 +34 -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 +34 -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 +303 -24
  39. package/src/Signer.ts +126 -7
  40. package/src/Transaction.ts +17 -16
  41. package/src/interface.ts +39 -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.
@@ -23465,10 +23682,37 @@ class Provider {
23465
23682
  * and the transaction with the arrow function "wait" (see [[wait]])
23466
23683
  */
23467
23684
  async sendTransaction(transaction, broadcast = true) {
23468
- 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
- };
23685
+ let response;
23686
+ try {
23687
+ response = await this.call("chain.submit_transaction", { transaction, broadcast });
23688
+ }
23689
+ catch (error) {
23690
+ if (!error.message.includes("rpc failed, context deadline exceeded")) {
23691
+ throw error;
23692
+ }
23693
+ response = {
23694
+ receipt: {
23695
+ id: transaction.id,
23696
+ payer: transaction.header.payer,
23697
+ max_payer_rc: "",
23698
+ rc_limit: transaction.header.rc_limit.toString(),
23699
+ rc_used: "",
23700
+ disk_storage_used: "",
23701
+ network_bandwidth_used: "",
23702
+ compute_bandwidth_used: "",
23703
+ reverted: false,
23704
+ events: [],
23705
+ state_delta_entries: [],
23706
+ logs: [],
23707
+ rpc_error: JSON.parse(error.message),
23708
+ },
23709
+ };
23710
+ }
23711
+ if (broadcast) {
23712
+ transaction.wait = async (type = "byBlock", timeout = 15000) => {
23713
+ return this.wait(transaction.id, type, timeout);
23714
+ };
23715
+ }
23472
23716
  return { ...response, transaction: transaction };
23473
23717
  }
23474
23718
  /**
@@ -23520,6 +23764,28 @@ class Provider {
23520
23764
  const result = await serializer.deserialize(response.value, serializer.returnTypeName);
23521
23765
  return result;
23522
23766
  }
23767
+ /**
23768
+ * Function to get the contract metadata of a specific contract.
23769
+ * @param contractId contract ID
23770
+ *
23771
+ * @example
23772
+ * ```ts
23773
+ * const provider = new Provider("https://api.koinos.io");
23774
+ * const result = await provider.invokeGetContractMetadata("15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL");
23775
+ * console.log(result);
23776
+ *
23777
+ * // {
23778
+ * // value: {
23779
+ * // hash: '0x1220c57e3573189868970a3a1662a667c366b15015d9b7900ffed415c5e944036e88',
23780
+ * // system: true,
23781
+ * // authorizes_call_contract: true,
23782
+ * // authorizes_transaction_application: true,
23783
+ * // authorizes_upload_contract: true
23784
+ * // }
23785
+ * // }
23786
+ *
23787
+ * ```
23788
+ */
23523
23789
  async invokeGetContractMetadata(contractId) {
23524
23790
  const serializer = new Serializer_1.Serializer({
23525
23791
  nested: {
@@ -23924,6 +24190,7 @@ exports.Signer = void 0;
23924
24190
  /* eslint-disable no-param-reassign, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
23925
24191
  const sha256_1 = __webpack_require__(3061);
23926
24192
  const secp = __importStar(__webpack_require__(9656));
24193
+ const Transaction_1 = __webpack_require__(7592);
23927
24194
  const utils_1 = __webpack_require__(8593);
23928
24195
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23929
24196
  // @ts-ignore
@@ -24007,6 +24274,8 @@ class Signer {
24007
24274
  * @param privateKey - Private key as hexstring, bigint or Uint8Array
24008
24275
  * @param compressed - compressed format is true by default
24009
24276
  * @param provider - provider to connect with the blockchain
24277
+ * @param sendOptions - Send options
24278
+ * @param rcOptions - options for mana estimation
24010
24279
  * @example
24011
24280
  * ```ts
24012
24281
  * const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
@@ -24014,12 +24283,42 @@ class Signer {
24014
24283
  * console.log(signer.getAddress());
24015
24284
  * // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
24016
24285
  * ```
24286
+ *
24287
+ * By default the mana is estimated as 110% the mana used. This
24288
+ * estimation is computed using the "broadcast:false" option.
24289
+ * For instance, if the transaction consumes 1 mana, the rc_limit
24290
+ * will be set to 1.1 mana.
24291
+ *
24292
+ * You can also adjust the rc limit.
24293
+ * @example
24294
+ * ```ts
24295
+ * const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
24296
+ * cons signer = new Signer({
24297
+ * privateKey,
24298
+ * provider,
24299
+ * rcOptions: {
24300
+ * estimateRc: true,
24301
+ * // use 2 times rc_used as rc_limit
24302
+ * adjustRcLimit: (r) => 2 * Number(r.rc_used),
24303
+ * },
24304
+ * });
24305
+ * ```
24306
+ *
24307
+ * The rpc node must be highly trusted because the transaction
24308
+ * is signed during the estimation of the mana. You can also
24309
+ * disable the mana estimation:
24310
+ * @example
24311
+ * ```ts
24312
+ * const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
24313
+ * cons signer = new Signer({
24314
+ * privateKey,
24315
+ * provider,
24316
+ * rcOptions: { estimateRc: false },
24317
+ * });
24318
+ * ```
24017
24319
  */
24018
24320
  constructor(c) {
24019
- /**
24020
- * Chain id
24021
- */
24022
- this.chainId = "";
24321
+ var _a;
24023
24322
  this.compressed = typeof c.compressed === "undefined" ? true : c.compressed;
24024
24323
  this.privateKey = c.privateKey;
24025
24324
  this.provider = c.provider;
@@ -24031,12 +24330,14 @@ class Signer {
24031
24330
  this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
24032
24331
  this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
24033
24332
  }
24034
- if (c.chainId)
24035
- this.chainId = c.chainId;
24036
24333
  this.sendOptions = {
24037
24334
  broadcast: true,
24038
24335
  ...c.sendOptions,
24039
24336
  };
24337
+ this.rcOptions = (_a = c.rcOptions) !== null && _a !== void 0 ? _a : {
24338
+ estimateRc: true,
24339
+ adjustRcLimit: (receipt) => Promise.resolve(Math.min(Number(receipt.max_payer_rc), Math.floor(1.1 * Number(receipt.rc_used)))),
24340
+ };
24040
24341
  }
24041
24342
  /**
24042
24343
  * Function to import a private key from the WIF
@@ -24156,6 +24457,15 @@ class Signer {
24156
24457
  async signTransaction(tx, _abis) {
24157
24458
  if (!tx.id)
24158
24459
  throw new Error("Missing transaction id");
24460
+ // estimation of rcLimit
24461
+ if (this.rcOptions.estimateRc &&
24462
+ (!tx.signatures || tx.signatures.length === 0)) {
24463
+ const receipt = await this.estimateReceipt(tx);
24464
+ tx.header.rc_limit = this.rcOptions.adjustRcLimit
24465
+ ? await this.rcOptions.adjustRcLimit(receipt)
24466
+ : receipt.rc_used;
24467
+ tx.id = Transaction_1.Transaction.computeTransactionId(tx.header);
24468
+ }
24159
24469
  // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
24160
24470
  // tx id is a stringified multihash, need to extract the hash digest only
24161
24471
  const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
@@ -24204,6 +24514,43 @@ class Signer {
24204
24514
  }
24205
24515
  return this.provider.sendTransaction(transaction, opts.broadcast);
24206
24516
  }
24517
+ /**
24518
+ * Estimate the receipt associated to the transaction if
24519
+ * it sent to the blockchain. It is useful to estimate the
24520
+ * consumption of mana.
24521
+ * The transaction is signed during this process and sent
24522
+ * to the rpc node with the "broadcast:false" option to
24523
+ * just compute the transaction without broadcasting it to
24524
+ * the network.
24525
+ * After that, the initial signatures are restored (if any)
24526
+ * and the ones used for the estimation will be removed.
24527
+ */
24528
+ async estimateReceipt(tx) {
24529
+ if (!tx.id)
24530
+ throw new Error("Missing transaction id");
24531
+ if (!tx.signatures)
24532
+ tx.signatures = [];
24533
+ const signaturesCopy = [...tx.signatures];
24534
+ // sign if there are no signatures
24535
+ if (tx.signatures.length === 0) {
24536
+ const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
24537
+ const signature = await this.signHash(hash);
24538
+ tx.signatures.push((0, utils_1.encodeBase64url)(signature));
24539
+ }
24540
+ try {
24541
+ const { receipt } = await this.sendTransaction(tx, {
24542
+ broadcast: false,
24543
+ });
24544
+ // restore signatures
24545
+ tx.signatures = signaturesCopy;
24546
+ return receipt;
24547
+ }
24548
+ catch (error) {
24549
+ // restore signatures
24550
+ tx.signatures = signaturesCopy;
24551
+ throw error;
24552
+ }
24553
+ }
24207
24554
  /**
24208
24555
  * Function to recover the public key from hash and signature
24209
24556
  * @param hash - hash sha256
@@ -24538,7 +24885,7 @@ class Transaction {
24538
24885
  * @example
24539
24886
  * ```ts
24540
24887
  * const koin = new Contract({
24541
- * id: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
24888
+ * id: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
24542
24889
  * abi: utils.tokenAbi,
24543
24890
  * }).functions;
24544
24891
  * const signer = Signer.fromSeed("my seed");
@@ -24612,6 +24959,16 @@ class Transaction {
24612
24959
  this.transaction.operations = [];
24613
24960
  this.transaction.operations.push(operation);
24614
24961
  }
24962
+ static computeTransactionId(txHeader) {
24963
+ const headerDecoded = (0, utils_1.btypeDecode)(txHeader, btypeTransactionHeader, false);
24964
+ const message = protocol_proto_js_1.koinos.protocol.transaction_header.create(headerDecoded);
24965
+ const headerBytes = protocol_proto_js_1.koinos.protocol.transaction_header
24966
+ .encode(message)
24967
+ .finish();
24968
+ const hash = (0, sha256_1.sha256)(headerBytes);
24969
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
24970
+ return `0x1220${(0, utils_1.toHexString)(hash)}`;
24971
+ }
24615
24972
  /**
24616
24973
  * Function to prepare a transaction
24617
24974
  * @param tx - Do not set the nonce to get it from the blockchain
@@ -24680,18 +25037,11 @@ class Transaction {
24680
25037
  ...(payee && { payee }),
24681
25038
  // TODO: Option to resolve names (payer, payee)
24682
25039
  };
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)}`;
25040
+ tx.id = Transaction.computeTransactionId(tx.header);
24691
25041
  return tx;
24692
25042
  }
24693
25043
  /**
24694
- * Functon to prepare the transaction (set headers, merkle
25044
+ * Function to prepare the transaction (set headers, merkle
24695
25045
  * root, etc)
24696
25046
  */
24697
25047
  async prepare(options) {
@@ -24836,15 +25186,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
24836
25186
  __setModuleDefault(result, mod);
24837
25187
  return result;
24838
25188
  };
24839
- var __importDefault = (this && this.__importDefault) || function (mod) {
24840
- return (mod && mod.__esModule) ? mod : { "default": mod };
24841
- };
24842
25189
  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;
25190
+ 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
25191
  const multibase = __importStar(__webpack_require__(6957));
24845
25192
  const sha256_1 = __webpack_require__(3061);
24846
25193
  const ripemd160_1 = __webpack_require__(830);
24847
- const token_proto_json_1 = __importDefault(__webpack_require__(6567));
24848
25194
  /**
24849
25195
  * Converts an hex string to Uint8Array
24850
25196
  */
@@ -25268,57 +25614,1310 @@ function btypeEncode(valueDecoded, fields, verifyChecksum) {
25268
25614
  exports.btypeEncode = btypeEncode;
25269
25615
  /**
25270
25616
  * ABI for tokens
25617
+ *
25618
+ * @example
25619
+ * ```ts
25620
+ * import { Contract, Provider, utils } from "koilib";
25621
+ *
25622
+ * const provider = new Provider("https://api.koinos.io");
25623
+ * const koinContract = new Contract({
25624
+ * id: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
25625
+ * provider,
25626
+ * abi: utils.tokenAbi,
25627
+ * });
25628
+ * ```
25271
25629
  */
25272
25630
  exports.tokenAbi = {
25273
25631
  methods: {
25274
25632
  name: {
25275
- entry_point: 0x82a3537f,
25276
- argument: "name_arguments",
25277
- return: "name_result",
25633
+ argument: "",
25634
+ return: "token.str",
25635
+ description: "Get name of the token",
25278
25636
  read_only: true,
25637
+ entry_point: 0x82a3537f,
25279
25638
  },
25280
25639
  symbol: {
25281
- entry_point: 0xb76a7ca1,
25282
- argument: "symbol_arguments",
25283
- return: "symbol_result",
25640
+ argument: "",
25641
+ return: "token.str",
25642
+ description: "Get the symbol of the token",
25284
25643
  read_only: true,
25644
+ entry_point: 0xb76a7ca1,
25285
25645
  },
25286
25646
  decimals: {
25647
+ argument: "",
25648
+ return: "token.uint32",
25649
+ description: "Get the decimals of the token",
25650
+ read_only: true,
25287
25651
  entry_point: 0xee80fd2f,
25288
- argument: "decimals_arguments",
25289
- return: "decimals_result",
25652
+ },
25653
+ getInfo: {
25654
+ argument: "",
25655
+ return: "token.info",
25656
+ description: "Get name, symbol and decimals",
25290
25657
  read_only: true,
25658
+ entry_point: 0xbd7f6850,
25291
25659
  },
25292
25660
  totalSupply: {
25293
- entry_point: 0xb0da3934,
25294
- argument: "total_supply_arguments",
25295
- return: "total_supply_result",
25661
+ argument: "",
25662
+ return: "token.uint64",
25663
+ description: "Get total supply",
25296
25664
  read_only: true,
25665
+ entry_point: 0xb0da3934,
25297
25666
  },
25298
25667
  balanceOf: {
25668
+ argument: "token.balance_of_args",
25669
+ return: "token.uint64",
25670
+ description: "Get balance of an account",
25671
+ read_only: true,
25299
25672
  entry_point: 0x5c721497,
25300
- argument: "balance_of_arguments",
25301
- return: "balance_of_result",
25673
+ default_output: { value: "0" },
25674
+ },
25675
+ allowance: {
25676
+ argument: "token.allowance_args",
25677
+ return: "token.uint64",
25678
+ description: "Get allowance",
25679
+ read_only: true,
25680
+ entry_point: 0x32f09fa1,
25681
+ },
25682
+ getAllowances: {
25683
+ argument: "token.get_allowances_args",
25684
+ return: "token.get_allowances_return",
25685
+ description: "Get allowances of an account",
25302
25686
  read_only: true,
25687
+ entry_point: 0x8fa16456,
25688
+ },
25689
+ approve: {
25690
+ argument: "token.approve_args",
25691
+ return: "",
25692
+ description: "Grant permissions to other account to manage the tokens owned by the user. The user must approve only the accounts he trust.",
25693
+ read_only: false,
25694
+ entry_point: 0x74e21680,
25695
+ },
25696
+ transfer: {
25697
+ argument: "token.transfer_args",
25698
+ return: "",
25699
+ description: "Transfer tokens",
25700
+ read_only: false,
25701
+ entry_point: 0x27f576ca,
25702
+ },
25703
+ mint: {
25704
+ argument: "token.mint_args",
25705
+ return: "",
25706
+ description: "Mint new tokens",
25707
+ read_only: false,
25708
+ entry_point: 0xdc6f17bb,
25709
+ },
25710
+ },
25711
+ types: "CpoICiJrb2lub3MvY29udHJhY3RzL3Rva2VuL3Rva2VuLnByb3RvEhZr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dG8z",
25712
+ koilib_types: {
25713
+ nested: {
25714
+ koinos: {
25715
+ options: {
25716
+ go_package: "github.com/koinos/koinos-proto-golang/koinos",
25717
+ },
25718
+ nested: {
25719
+ contracts: {
25720
+ nested: {
25721
+ token: {
25722
+ options: {
25723
+ go_package: "github.com/koinos/koinos-proto-golang/koinos/contracts/token",
25724
+ },
25725
+ nested: {
25726
+ name_arguments: {
25727
+ fields: {},
25728
+ },
25729
+ name_result: {
25730
+ fields: {
25731
+ value: {
25732
+ type: "string",
25733
+ id: 1,
25734
+ },
25735
+ },
25736
+ },
25737
+ symbol_arguments: {
25738
+ fields: {},
25739
+ },
25740
+ symbol_result: {
25741
+ fields: {
25742
+ value: {
25743
+ type: "string",
25744
+ id: 1,
25745
+ },
25746
+ },
25747
+ },
25748
+ decimals_arguments: {
25749
+ fields: {},
25750
+ },
25751
+ decimals_result: {
25752
+ fields: {
25753
+ value: {
25754
+ type: "uint32",
25755
+ id: 1,
25756
+ },
25757
+ },
25758
+ },
25759
+ total_supply_arguments: {
25760
+ fields: {},
25761
+ },
25762
+ total_supply_result: {
25763
+ fields: {
25764
+ value: {
25765
+ type: "uint64",
25766
+ id: 1,
25767
+ options: {
25768
+ jstype: "JS_STRING",
25769
+ },
25770
+ },
25771
+ },
25772
+ },
25773
+ balance_of_arguments: {
25774
+ fields: {
25775
+ owner: {
25776
+ type: "bytes",
25777
+ id: 1,
25778
+ options: {
25779
+ "(btype)": "ADDRESS",
25780
+ },
25781
+ },
25782
+ },
25783
+ },
25784
+ balance_of_result: {
25785
+ fields: {
25786
+ value: {
25787
+ type: "uint64",
25788
+ id: 1,
25789
+ options: {
25790
+ jstype: "JS_STRING",
25791
+ },
25792
+ },
25793
+ },
25794
+ },
25795
+ transfer_arguments: {
25796
+ fields: {
25797
+ from: {
25798
+ type: "bytes",
25799
+ id: 1,
25800
+ options: {
25801
+ "(btype)": "ADDRESS",
25802
+ },
25803
+ },
25804
+ to: {
25805
+ type: "bytes",
25806
+ id: 2,
25807
+ options: {
25808
+ "(btype)": "ADDRESS",
25809
+ },
25810
+ },
25811
+ value: {
25812
+ type: "uint64",
25813
+ id: 3,
25814
+ options: {
25815
+ jstype: "JS_STRING",
25816
+ },
25817
+ },
25818
+ },
25819
+ },
25820
+ transfer_result: {
25821
+ fields: {},
25822
+ },
25823
+ mint_arguments: {
25824
+ fields: {
25825
+ to: {
25826
+ type: "bytes",
25827
+ id: 1,
25828
+ options: {
25829
+ "(btype)": "ADDRESS",
25830
+ },
25831
+ },
25832
+ value: {
25833
+ type: "uint64",
25834
+ id: 2,
25835
+ options: {
25836
+ jstype: "JS_STRING",
25837
+ },
25838
+ },
25839
+ },
25840
+ },
25841
+ mint_result: {
25842
+ fields: {},
25843
+ },
25844
+ burn_arguments: {
25845
+ fields: {
25846
+ from: {
25847
+ type: "bytes",
25848
+ id: 1,
25849
+ options: {
25850
+ "(btype)": "ADDRESS",
25851
+ },
25852
+ },
25853
+ value: {
25854
+ type: "uint64",
25855
+ id: 2,
25856
+ options: {
25857
+ jstype: "JS_STRING",
25858
+ },
25859
+ },
25860
+ },
25861
+ },
25862
+ burn_result: {
25863
+ fields: {},
25864
+ },
25865
+ balance_object: {
25866
+ fields: {
25867
+ value: {
25868
+ type: "uint64",
25869
+ id: 1,
25870
+ options: {
25871
+ jstype: "JS_STRING",
25872
+ },
25873
+ },
25874
+ },
25875
+ },
25876
+ burn_event: {
25877
+ fields: {
25878
+ from: {
25879
+ type: "bytes",
25880
+ id: 1,
25881
+ options: {
25882
+ "(btype)": "ADDRESS",
25883
+ },
25884
+ },
25885
+ value: {
25886
+ type: "uint64",
25887
+ id: 2,
25888
+ options: {
25889
+ jstype: "JS_STRING",
25890
+ },
25891
+ },
25892
+ },
25893
+ },
25894
+ mint_event: {
25895
+ fields: {
25896
+ to: {
25897
+ type: "bytes",
25898
+ id: 1,
25899
+ options: {
25900
+ "(btype)": "ADDRESS",
25901
+ },
25902
+ },
25903
+ value: {
25904
+ type: "uint64",
25905
+ id: 2,
25906
+ options: {
25907
+ jstype: "JS_STRING",
25908
+ },
25909
+ },
25910
+ },
25911
+ },
25912
+ transfer_event: {
25913
+ fields: {
25914
+ from: {
25915
+ type: "bytes",
25916
+ id: 1,
25917
+ options: {
25918
+ "(btype)": "ADDRESS",
25919
+ },
25920
+ },
25921
+ to: {
25922
+ type: "bytes",
25923
+ id: 2,
25924
+ options: {
25925
+ "(btype)": "ADDRESS",
25926
+ },
25927
+ },
25928
+ value: {
25929
+ type: "uint64",
25930
+ id: 3,
25931
+ options: {
25932
+ jstype: "JS_STRING",
25933
+ },
25934
+ },
25935
+ },
25936
+ },
25937
+ },
25938
+ },
25939
+ },
25940
+ },
25941
+ bytes_type: {
25942
+ values: {
25943
+ BASE64: 0,
25944
+ BASE58: 1,
25945
+ HEX: 2,
25946
+ BLOCK_ID: 3,
25947
+ TRANSACTION_ID: 4,
25948
+ CONTRACT_ID: 5,
25949
+ ADDRESS: 6,
25950
+ },
25951
+ },
25952
+ btype: {
25953
+ type: "bytes_type",
25954
+ id: 50000,
25955
+ extend: "google.protobuf.FieldOptions",
25956
+ options: {
25957
+ proto3_optional: true,
25958
+ },
25959
+ },
25960
+ },
25961
+ },
25962
+ token: {
25963
+ nested: {
25964
+ str: {
25965
+ fields: {
25966
+ value: {
25967
+ type: "string",
25968
+ id: 1,
25969
+ },
25970
+ },
25971
+ },
25972
+ uint32: {
25973
+ fields: {
25974
+ value: {
25975
+ type: "uint32",
25976
+ id: 1,
25977
+ },
25978
+ },
25979
+ },
25980
+ uint64: {
25981
+ fields: {
25982
+ value: {
25983
+ type: "uint64",
25984
+ id: 1,
25985
+ options: {
25986
+ jstype: "JS_STRING",
25987
+ },
25988
+ },
25989
+ },
25990
+ },
25991
+ boole: {
25992
+ fields: {
25993
+ value: {
25994
+ type: "bool",
25995
+ id: 1,
25996
+ },
25997
+ },
25998
+ },
25999
+ info: {
26000
+ fields: {
26001
+ name: {
26002
+ type: "string",
26003
+ id: 1,
26004
+ },
26005
+ symbol: {
26006
+ type: "string",
26007
+ id: 2,
26008
+ },
26009
+ decimals: {
26010
+ type: "uint32",
26011
+ id: 3,
26012
+ },
26013
+ description: {
26014
+ type: "string",
26015
+ id: 4,
26016
+ },
26017
+ },
26018
+ },
26019
+ balance_of_args: {
26020
+ fields: {
26021
+ owner: {
26022
+ type: "bytes",
26023
+ id: 1,
26024
+ options: {
26025
+ "(koinos.btype)": "ADDRESS",
26026
+ },
26027
+ },
26028
+ },
26029
+ },
26030
+ transfer_args: {
26031
+ fields: {
26032
+ from: {
26033
+ type: "bytes",
26034
+ id: 1,
26035
+ options: {
26036
+ "(koinos.btype)": "ADDRESS",
26037
+ },
26038
+ },
26039
+ to: {
26040
+ type: "bytes",
26041
+ id: 2,
26042
+ options: {
26043
+ "(koinos.btype)": "ADDRESS",
26044
+ },
26045
+ },
26046
+ value: {
26047
+ type: "uint64",
26048
+ id: 3,
26049
+ options: {
26050
+ jstype: "JS_STRING",
26051
+ },
26052
+ },
26053
+ memo: {
26054
+ type: "string",
26055
+ id: 4,
26056
+ },
26057
+ },
26058
+ },
26059
+ mint_args: {
26060
+ fields: {
26061
+ to: {
26062
+ type: "bytes",
26063
+ id: 1,
26064
+ options: {
26065
+ "(koinos.btype)": "ADDRESS",
26066
+ },
26067
+ },
26068
+ value: {
26069
+ type: "uint64",
26070
+ id: 2,
26071
+ options: {
26072
+ jstype: "JS_STRING",
26073
+ },
26074
+ },
26075
+ },
26076
+ },
26077
+ burn_args: {
26078
+ fields: {
26079
+ from: {
26080
+ type: "bytes",
26081
+ id: 1,
26082
+ options: {
26083
+ "(koinos.btype)": "ADDRESS",
26084
+ },
26085
+ },
26086
+ value: {
26087
+ type: "uint64",
26088
+ id: 2,
26089
+ options: {
26090
+ jstype: "JS_STRING",
26091
+ },
26092
+ },
26093
+ },
26094
+ },
26095
+ approve_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
+ value: {
26112
+ type: "uint64",
26113
+ id: 3,
26114
+ options: {
26115
+ jstype: "JS_STRING",
26116
+ },
26117
+ },
26118
+ },
26119
+ },
26120
+ allowance_args: {
26121
+ fields: {
26122
+ owner: {
26123
+ type: "bytes",
26124
+ id: 1,
26125
+ options: {
26126
+ "(koinos.btype)": "ADDRESS",
26127
+ },
26128
+ },
26129
+ spender: {
26130
+ type: "bytes",
26131
+ id: 2,
26132
+ options: {
26133
+ "(koinos.btype)": "ADDRESS",
26134
+ },
26135
+ },
26136
+ },
26137
+ },
26138
+ get_allowances_args: {
26139
+ fields: {
26140
+ owner: {
26141
+ type: "bytes",
26142
+ id: 1,
26143
+ options: {
26144
+ "(koinos.btype)": "ADDRESS",
26145
+ },
26146
+ },
26147
+ start: {
26148
+ type: "bytes",
26149
+ id: 2,
26150
+ options: {
26151
+ "(koinos.btype)": "ADDRESS",
26152
+ },
26153
+ },
26154
+ limit: {
26155
+ type: "int32",
26156
+ id: 3,
26157
+ },
26158
+ descending: {
26159
+ type: "bool",
26160
+ id: 4,
26161
+ },
26162
+ },
26163
+ },
26164
+ spender_value: {
26165
+ fields: {
26166
+ spender: {
26167
+ type: "bytes",
26168
+ id: 1,
26169
+ options: {
26170
+ "(koinos.btype)": "ADDRESS",
26171
+ },
26172
+ },
26173
+ value: {
26174
+ type: "uint64",
26175
+ id: 2,
26176
+ options: {
26177
+ jstype: "JS_STRING",
26178
+ },
26179
+ },
26180
+ },
26181
+ },
26182
+ get_allowances_return: {
26183
+ fields: {
26184
+ owner: {
26185
+ type: "bytes",
26186
+ id: 1,
26187
+ options: {
26188
+ "(koinos.btype)": "ADDRESS",
26189
+ },
26190
+ },
26191
+ allowances: {
26192
+ rule: "repeated",
26193
+ type: "spender_value",
26194
+ id: 2,
26195
+ },
26196
+ },
26197
+ },
26198
+ transfer_event: {
26199
+ fields: {
26200
+ from: {
26201
+ type: "bytes",
26202
+ id: 1,
26203
+ options: {
26204
+ "(koinos.btype)": "ADDRESS",
26205
+ },
26206
+ },
26207
+ to: {
26208
+ type: "bytes",
26209
+ id: 2,
26210
+ options: {
26211
+ "(koinos.btype)": "ADDRESS",
26212
+ },
26213
+ },
26214
+ value: {
26215
+ type: "uint64",
26216
+ id: 3,
26217
+ options: {
26218
+ jstype: "JS_STRING",
26219
+ },
26220
+ },
26221
+ },
26222
+ },
26223
+ mint_event: {
26224
+ fields: {
26225
+ to: {
26226
+ type: "bytes",
26227
+ id: 1,
26228
+ options: {
26229
+ "(koinos.btype)": "ADDRESS",
26230
+ },
26231
+ },
26232
+ value: {
26233
+ type: "uint64",
26234
+ id: 2,
26235
+ options: {
26236
+ jstype: "JS_STRING",
26237
+ },
26238
+ },
26239
+ },
26240
+ },
26241
+ burn_event: {
26242
+ fields: {
26243
+ from: {
26244
+ type: "bytes",
26245
+ id: 1,
26246
+ options: {
26247
+ "(koinos.btype)": "ADDRESS",
26248
+ },
26249
+ },
26250
+ value: {
26251
+ type: "uint64",
26252
+ id: 2,
26253
+ options: {
26254
+ jstype: "JS_STRING",
26255
+ },
26256
+ },
26257
+ },
26258
+ },
26259
+ approve_event: {
26260
+ fields: {
26261
+ owner: {
26262
+ type: "bytes",
26263
+ id: 1,
26264
+ options: {
26265
+ "(koinos.btype)": "ADDRESS",
26266
+ },
26267
+ },
26268
+ spender: {
26269
+ type: "bytes",
26270
+ id: 2,
26271
+ options: {
26272
+ "(koinos.btype)": "ADDRESS",
26273
+ },
26274
+ },
26275
+ value: {
26276
+ type: "uint64",
26277
+ id: 3,
26278
+ options: {
26279
+ jstype: "JS_STRING",
26280
+ },
26281
+ },
26282
+ },
26283
+ },
26284
+ },
26285
+ },
26286
+ },
26287
+ },
26288
+ };
26289
+ /**
26290
+ * ABI for NFTs
26291
+ *
26292
+ * @example
26293
+ * ```ts
26294
+ * import { Contract, Provider, utils } from "koilib";
26295
+ *
26296
+ * const provider = new Provider("https://api.koinos.io");
26297
+ * const nicknamesContract = new Contract({
26298
+ * id: "1KD9Es7LBBjA1FY3ViCgQJ7e6WH1ipKbhz",
26299
+ * provider,
26300
+ * abi: utils.nftAbi,
26301
+ * });
26302
+ * const nicknames = nicknamesContract.functions;
26303
+ *
26304
+ * ...
26305
+ *
26306
+ * // get the address linked to the nickname "pob"
26307
+ * const pobId = `0x${utils.toHexString(new TextEncoder().encode("pob"))}`;
26308
+ * const { result } = await nicknames.ownerOf({ token_id: pobId });
26309
+ * console.log(result);
26310
+ *
26311
+ * // { value: '159myq5YUhhoVWu3wsHKHiJYKPKGUrGiyv' }
26312
+ })();
26313
+ * ```
26314
+ */
26315
+ exports.nftAbi = {
26316
+ methods: {
26317
+ name: {
26318
+ argument: "",
26319
+ return: "common.str",
26320
+ description: "Get name of the NFT",
26321
+ read_only: true,
26322
+ entry_point: 0x82a3537f,
26323
+ },
26324
+ symbol: {
26325
+ argument: "",
26326
+ return: "common.str",
26327
+ description: "Get the symbol of the NFT",
26328
+ read_only: true,
26329
+ entry_point: 0xb76a7ca1,
26330
+ },
26331
+ uri: {
26332
+ argument: "",
26333
+ return: "common.str",
26334
+ description: "Get URI of the NFT",
26335
+ read_only: true,
26336
+ entry_point: 0x70e5d7b6,
26337
+ },
26338
+ getInfo: {
26339
+ argument: "",
26340
+ return: "nft.info",
26341
+ description: "Get name, symbol and decimals",
26342
+ read_only: true,
26343
+ entry_point: 0xbd7f6850,
26344
+ },
26345
+ owner: {
26346
+ argument: "",
26347
+ return: "common.address",
26348
+ description: "Get the owner of the collection",
26349
+ read_only: true,
26350
+ entry_point: 0x4c102969,
26351
+ },
26352
+ totalSupply: {
26353
+ argument: "",
26354
+ return: "common.uint64",
26355
+ description: "Get total supply",
26356
+ read_only: true,
26357
+ entry_point: 0xb0da3934,
26358
+ },
26359
+ royalties: {
26360
+ argument: "",
26361
+ return: "nft.royalties",
26362
+ description: "Get royalties",
26363
+ read_only: true,
26364
+ entry_point: 0x36e90cd0,
26365
+ },
26366
+ balanceOf: {
26367
+ argument: "nft.balance_of_args",
26368
+ return: "common.uint64",
26369
+ description: "Get balance of an account",
26370
+ read_only: true,
26371
+ entry_point: 0x5c721497,
25303
26372
  default_output: { value: "0" },
25304
26373
  },
26374
+ ownerOf: {
26375
+ argument: "nft.token",
26376
+ return: "common.address",
26377
+ description: "Get the owner of a token",
26378
+ read_only: true,
26379
+ entry_point: 0xed61c847,
26380
+ },
26381
+ metadataOf: {
26382
+ argument: "nft.token",
26383
+ return: "common.str",
26384
+ description: "Get the metadata of a token",
26385
+ read_only: true,
26386
+ entry_point: 0x176c8f7f,
26387
+ },
26388
+ getTokens: {
26389
+ argument: "nft.get_tokens_args",
26390
+ return: "nft.token_ids",
26391
+ description: "Get list of token IDs",
26392
+ read_only: true,
26393
+ entry_point: 0x7d5b5ed7,
26394
+ },
26395
+ getTokensByOwner: {
26396
+ argument: "nft.get_tokens_by_owner_args",
26397
+ return: "nft.token_ids",
26398
+ description: "Get tokens owned by an address",
26399
+ read_only: true,
26400
+ entry_point: 0xfc13eb75,
26401
+ },
26402
+ getApproved: {
26403
+ argument: "nft.token",
26404
+ return: "common.address",
26405
+ description: "Check if an account is approved to operate a token ID",
26406
+ read_only: true,
26407
+ entry_point: 0x4c731020,
26408
+ },
26409
+ isApprovedForAll: {
26410
+ argument: "nft.is_approved_for_all_args",
26411
+ return: "common.boole",
26412
+ description: "Check if an account is approved to operate all tokens owned by other account",
26413
+ read_only: true,
26414
+ entry_point: 0xe7ab8ce5,
26415
+ },
26416
+ getOperatorApprovals: {
26417
+ argument: "nft.get_operators_args",
26418
+ return: "nft.get_operators_return",
26419
+ description: "Get allowances of an account",
26420
+ read_only: true,
26421
+ entry_point: 0xdb1bf60e,
26422
+ },
26423
+ transferOwnership: {
26424
+ argument: "common.address",
26425
+ return: "",
26426
+ description: "Transfer ownership of the collection",
26427
+ read_only: false,
26428
+ entry_point: 0x394be702,
26429
+ },
26430
+ setRoyalties: {
26431
+ argument: "nft.royalties",
26432
+ return: "",
26433
+ description: "Set royalties",
26434
+ read_only: false,
26435
+ entry_point: 0x3b5bb56b,
26436
+ },
26437
+ setMetadata: {
26438
+ argument: "nft.metadata_args",
26439
+ return: "",
26440
+ description: "Set metadata",
26441
+ read_only: false,
26442
+ entry_point: 0x3d59af19,
26443
+ },
26444
+ approve: {
26445
+ argument: "nft.approve_args",
26446
+ return: "",
26447
+ description: "Grant permissions to other account to manage a specific Token owned by the user. The user must approve only the accounts he trust.",
26448
+ read_only: false,
26449
+ entry_point: 0x74e21680,
26450
+ },
26451
+ setApprovalForAll: {
26452
+ argument: "nft.set_approval_for_all_args",
26453
+ return: "",
26454
+ description: "Grant permissions to other account to manage all Tokens owned by the user. The user must approve only the accounts he trust.",
26455
+ read_only: false,
26456
+ entry_point: 0x20442216,
26457
+ },
25305
26458
  transfer: {
26459
+ argument: "nft.transfer_args",
26460
+ return: "",
26461
+ description: "Transfer NFT",
26462
+ read_only: false,
25306
26463
  entry_point: 0x27f576ca,
25307
- argument: "transfer_arguments",
25308
- return: "transfer_result",
25309
26464
  },
25310
26465
  mint: {
26466
+ argument: "nft.mint_args",
26467
+ return: "",
26468
+ description: "Mint NFT",
26469
+ read_only: false,
25311
26470
  entry_point: 0xdc6f17bb,
25312
- argument: "mint_arguments",
25313
- return: "mint_result",
25314
26471
  },
25315
- burn: {
25316
- entry_point: 0x859facc5,
25317
- argument: "burn_arguments",
25318
- return: "burn_result",
26472
+ },
26473
+ types: "CoQDCidrb2lub3Nib3gtcHJvdG8vbWFuYXNoYXJlci9jb21tb24ucHJvdG8SBmNvbW1vbhoUa29pbm9zL29wdGlvbnMucHJvdG8iGwoDc3RyEhQKBXZhbHVlGAEgASgJUgV2YWx1ZSIeCgZ1aW50MzISFAoFdmFsdWUYASABKA1SBXZhbHVlIiIKBnVpbnQ2NBIYCgV2YWx1ZRgBIAEoBEICMAFSBXZhbHVlIh0KBWJvb2xlE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3duZXJfYXJncxIaCgVvd25lchgBIAEoDEIEgLUYBlIFb3duZXISGgoFc3RhcnQYAiABKAxCBIC1GAJSBXN0YXJ0EhQKBWxpbWl0GAMgASgFUgVsaW1pdBIeCgpkZXNjZW5kaW5nGAQgASgIUgpkZXNjZW5kaW5nIi4KCXRva2VuX2lkcxIhCgl0b2tlbl9pZHMYASADKAxCBIC1GAJSCHRva2VuSWRzYgZwcm90bzM=",
26474
+ koilib_types: {
26475
+ nested: {
26476
+ common: {
26477
+ nested: {
26478
+ str: {
26479
+ fields: {
26480
+ value: {
26481
+ type: "string",
26482
+ id: 1,
26483
+ },
26484
+ },
26485
+ },
26486
+ uint32: {
26487
+ fields: {
26488
+ value: {
26489
+ type: "uint32",
26490
+ id: 1,
26491
+ },
26492
+ },
26493
+ },
26494
+ uint64: {
26495
+ fields: {
26496
+ value: {
26497
+ type: "uint64",
26498
+ id: 1,
26499
+ options: {
26500
+ jstype: "JS_STRING",
26501
+ },
26502
+ },
26503
+ },
26504
+ },
26505
+ boole: {
26506
+ fields: {
26507
+ value: {
26508
+ type: "bool",
26509
+ id: 1,
26510
+ },
26511
+ },
26512
+ },
26513
+ address: {
26514
+ fields: {
26515
+ value: {
26516
+ type: "bytes",
26517
+ id: 1,
26518
+ options: {
26519
+ "(koinos.btype)": "ADDRESS",
26520
+ },
26521
+ },
26522
+ },
26523
+ },
26524
+ list_args: {
26525
+ fields: {
26526
+ start: {
26527
+ type: "bytes",
26528
+ id: 1,
26529
+ options: {
26530
+ "(koinos.btype)": "ADDRESS",
26531
+ },
26532
+ },
26533
+ limit: {
26534
+ type: "int32",
26535
+ id: 2,
26536
+ },
26537
+ descending: {
26538
+ type: "bool",
26539
+ id: 3,
26540
+ },
26541
+ },
26542
+ },
26543
+ addresses: {
26544
+ fields: {
26545
+ accounts: {
26546
+ rule: "repeated",
26547
+ type: "bytes",
26548
+ id: 1,
26549
+ options: {
26550
+ "(koinos.btype)": "ADDRESS",
26551
+ },
26552
+ },
26553
+ },
26554
+ },
26555
+ },
26556
+ },
26557
+ koinos: {
26558
+ options: {
26559
+ go_package: "github.com/koinos/koinos-proto-golang/koinos",
26560
+ },
26561
+ nested: {
26562
+ bytes_type: {
26563
+ values: {
26564
+ BASE64: 0,
26565
+ BASE58: 1,
26566
+ HEX: 2,
26567
+ BLOCK_ID: 3,
26568
+ TRANSACTION_ID: 4,
26569
+ CONTRACT_ID: 5,
26570
+ ADDRESS: 6,
26571
+ },
26572
+ },
26573
+ btype: {
26574
+ type: "bytes_type",
26575
+ id: 50000,
26576
+ extend: "google.protobuf.FieldOptions",
26577
+ options: {
26578
+ proto3_optional: true,
26579
+ },
26580
+ },
26581
+ },
26582
+ },
26583
+ nft: {
26584
+ nested: {
26585
+ royalty: {
26586
+ fields: {
26587
+ percentage: {
26588
+ type: "uint64",
26589
+ id: 1,
26590
+ options: {
26591
+ jstype: "JS_STRING",
26592
+ },
26593
+ },
26594
+ address: {
26595
+ type: "bytes",
26596
+ id: 2,
26597
+ options: {
26598
+ "(koinos.btype)": "ADDRESS",
26599
+ },
26600
+ },
26601
+ },
26602
+ },
26603
+ royalties: {
26604
+ fields: {
26605
+ value: {
26606
+ rule: "repeated",
26607
+ type: "royalty",
26608
+ id: 1,
26609
+ },
26610
+ },
26611
+ },
26612
+ metadata_args: {
26613
+ fields: {
26614
+ token_id: {
26615
+ type: "bytes",
26616
+ id: 1,
26617
+ options: {
26618
+ "(koinos.btype)": "HEX",
26619
+ },
26620
+ },
26621
+ metadata: {
26622
+ type: "string",
26623
+ id: 2,
26624
+ },
26625
+ },
26626
+ },
26627
+ info: {
26628
+ fields: {
26629
+ name: {
26630
+ type: "string",
26631
+ id: 1,
26632
+ },
26633
+ symbol: {
26634
+ type: "string",
26635
+ id: 2,
26636
+ },
26637
+ uri: {
26638
+ type: "string",
26639
+ id: 3,
26640
+ },
26641
+ description: {
26642
+ type: "string",
26643
+ id: 4,
26644
+ },
26645
+ },
26646
+ },
26647
+ balance_of_args: {
26648
+ fields: {
26649
+ owner: {
26650
+ type: "bytes",
26651
+ id: 1,
26652
+ options: {
26653
+ "(koinos.btype)": "ADDRESS",
26654
+ },
26655
+ },
26656
+ },
26657
+ },
26658
+ token: {
26659
+ fields: {
26660
+ token_id: {
26661
+ type: "bytes",
26662
+ id: 1,
26663
+ options: {
26664
+ "(koinos.btype)": "HEX",
26665
+ },
26666
+ },
26667
+ },
26668
+ },
26669
+ is_approved_for_all_args: {
26670
+ fields: {
26671
+ owner: {
26672
+ type: "bytes",
26673
+ id: 1,
26674
+ options: {
26675
+ "(koinos.btype)": "ADDRESS",
26676
+ },
26677
+ },
26678
+ operator: {
26679
+ type: "bytes",
26680
+ id: 2,
26681
+ options: {
26682
+ "(koinos.btype)": "ADDRESS",
26683
+ },
26684
+ },
26685
+ },
26686
+ },
26687
+ mint_args: {
26688
+ fields: {
26689
+ to: {
26690
+ type: "bytes",
26691
+ id: 1,
26692
+ options: {
26693
+ "(koinos.btype)": "ADDRESS",
26694
+ },
26695
+ },
26696
+ token_id: {
26697
+ type: "bytes",
26698
+ id: 2,
26699
+ options: {
26700
+ "(koinos.btype)": "HEX",
26701
+ },
26702
+ },
26703
+ },
26704
+ },
26705
+ burn_args: {
26706
+ fields: {
26707
+ token_id: {
26708
+ type: "bytes",
26709
+ id: 1,
26710
+ options: {
26711
+ "(koinos.btype)": "HEX",
26712
+ },
26713
+ },
26714
+ },
26715
+ },
26716
+ transfer_args: {
26717
+ fields: {
26718
+ from: {
26719
+ type: "bytes",
26720
+ id: 1,
26721
+ options: {
26722
+ "(koinos.btype)": "ADDRESS",
26723
+ },
26724
+ },
26725
+ to: {
26726
+ type: "bytes",
26727
+ id: 2,
26728
+ options: {
26729
+ "(koinos.btype)": "ADDRESS",
26730
+ },
26731
+ },
26732
+ token_id: {
26733
+ type: "bytes",
26734
+ id: 3,
26735
+ options: {
26736
+ "(koinos.btype)": "HEX",
26737
+ },
26738
+ },
26739
+ memo: {
26740
+ type: "string",
26741
+ id: 4,
26742
+ },
26743
+ },
26744
+ },
26745
+ approve_args: {
26746
+ fields: {
26747
+ approver_address: {
26748
+ type: "bytes",
26749
+ id: 1,
26750
+ options: {
26751
+ "(koinos.btype)": "ADDRESS",
26752
+ },
26753
+ },
26754
+ to: {
26755
+ type: "bytes",
26756
+ id: 2,
26757
+ options: {
26758
+ "(koinos.btype)": "ADDRESS",
26759
+ },
26760
+ },
26761
+ token_id: {
26762
+ type: "bytes",
26763
+ id: 3,
26764
+ options: {
26765
+ "(koinos.btype)": "HEX",
26766
+ },
26767
+ },
26768
+ },
26769
+ },
26770
+ set_approval_for_all_args: {
26771
+ fields: {
26772
+ approver_address: {
26773
+ type: "bytes",
26774
+ id: 1,
26775
+ options: {
26776
+ "(koinos.btype)": "ADDRESS",
26777
+ },
26778
+ },
26779
+ operator_address: {
26780
+ type: "bytes",
26781
+ id: 2,
26782
+ options: {
26783
+ "(koinos.btype)": "ADDRESS",
26784
+ },
26785
+ },
26786
+ approved: {
26787
+ type: "bool",
26788
+ id: 3,
26789
+ },
26790
+ },
26791
+ },
26792
+ get_operators_args: {
26793
+ fields: {
26794
+ owner: {
26795
+ type: "bytes",
26796
+ id: 1,
26797
+ options: {
26798
+ "(koinos.btype)": "ADDRESS",
26799
+ },
26800
+ },
26801
+ start: {
26802
+ type: "bytes",
26803
+ id: 2,
26804
+ options: {
26805
+ "(koinos.btype)": "ADDRESS",
26806
+ },
26807
+ },
26808
+ limit: {
26809
+ type: "int32",
26810
+ id: 3,
26811
+ },
26812
+ descending: {
26813
+ type: "bool",
26814
+ id: 4,
26815
+ },
26816
+ },
26817
+ },
26818
+ get_operators_return: {
26819
+ fields: {
26820
+ owner: {
26821
+ type: "bytes",
26822
+ id: 1,
26823
+ options: {
26824
+ "(koinos.btype)": "ADDRESS",
26825
+ },
26826
+ },
26827
+ operators: {
26828
+ rule: "repeated",
26829
+ type: "bytes",
26830
+ id: 2,
26831
+ options: {
26832
+ "(koinos.btype)": "ADDRESS",
26833
+ },
26834
+ },
26835
+ },
26836
+ },
26837
+ get_tokens_args: {
26838
+ fields: {
26839
+ start: {
26840
+ type: "bytes",
26841
+ id: 1,
26842
+ options: {
26843
+ "(koinos.btype)": "HEX",
26844
+ },
26845
+ },
26846
+ limit: {
26847
+ type: "int32",
26848
+ id: 2,
26849
+ },
26850
+ descending: {
26851
+ type: "bool",
26852
+ id: 3,
26853
+ },
26854
+ },
26855
+ },
26856
+ get_tokens_by_owner_args: {
26857
+ fields: {
26858
+ owner: {
26859
+ type: "bytes",
26860
+ id: 1,
26861
+ options: {
26862
+ "(koinos.btype)": "ADDRESS",
26863
+ },
26864
+ },
26865
+ start: {
26866
+ type: "bytes",
26867
+ id: 2,
26868
+ options: {
26869
+ "(koinos.btype)": "HEX",
26870
+ },
26871
+ },
26872
+ limit: {
26873
+ type: "int32",
26874
+ id: 3,
26875
+ },
26876
+ descending: {
26877
+ type: "bool",
26878
+ id: 4,
26879
+ },
26880
+ },
26881
+ },
26882
+ token_ids: {
26883
+ fields: {
26884
+ token_ids: {
26885
+ rule: "repeated",
26886
+ type: "bytes",
26887
+ id: 1,
26888
+ options: {
26889
+ "(koinos.btype)": "HEX",
26890
+ },
26891
+ },
26892
+ },
26893
+ },
26894
+ },
26895
+ },
26896
+ },
26897
+ },
26898
+ events: {
26899
+ "collections.owner_event": {
26900
+ argument: "common.address",
26901
+ },
26902
+ "collections.royalties_event": {
26903
+ argument: "nft.royalties",
26904
+ },
26905
+ "collections.set_metadata_event": {
26906
+ argument: "nft.metadata_args",
26907
+ },
26908
+ "collections.token_approval_event": {
26909
+ argument: "nft.approve_args",
26910
+ },
26911
+ "collections.operator_approval_event": {
26912
+ argument: "nft.set_approval_for_all_args",
26913
+ },
26914
+ "collections.transfer_event": {
26915
+ argument: "nft.transfer_args",
26916
+ },
26917
+ "collections.mint_event": {
26918
+ argument: "nft.mint_args",
25319
26919
  },
25320
26920
  },
25321
- koilib_types: token_proto_json_1.default,
25322
26921
  };
25323
26922
  //export const ProtocolTypes = protocolJson;
25324
26923
 
@@ -34511,14 +36110,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
34511
36110
 
34512
36111
  /* (ignored) */
34513
36112
 
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
36113
  /***/ })
34523
36114
 
34524
36115
  /******/ });