@sentio/sdk 2.45.2 → 2.45.3-rc.2

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 (89) hide show
  1. package/lib/aptos/builtin/0x1.d.ts +2 -2
  2. package/lib/aptos/builtin/0x1.d.ts.map +1 -1
  3. package/lib/aptos/builtin/0x1.js +1 -2
  4. package/lib/aptos/builtin/0x1.js.map +1 -1
  5. package/lib/aptos/builtin/0x3.d.ts +2 -2
  6. package/lib/aptos/builtin/0x3.d.ts.map +1 -1
  7. package/lib/aptos/builtin/0x3.js +1 -2
  8. package/lib/aptos/builtin/0x3.js.map +1 -1
  9. package/lib/aptos/builtin/0x4.d.ts +2 -2
  10. package/lib/aptos/builtin/0x4.d.ts.map +1 -1
  11. package/lib/aptos/builtin/0x4.js +1 -2
  12. package/lib/aptos/builtin/0x4.js.map +1 -1
  13. package/lib/aptos/codegen/codegen.js +7 -1
  14. package/lib/aptos/codegen/codegen.js.map +1 -1
  15. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +23 -23
  16. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  17. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +93 -659
  18. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  19. package/lib/eth/builtin/internal/erc1155-processor.d.ts +8 -8
  20. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  21. package/lib/eth/builtin/internal/erc1155-processor.js +33 -264
  22. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  23. package/lib/eth/builtin/internal/erc20-processor.d.ts +18 -18
  24. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  25. package/lib/eth/builtin/internal/erc20-processor.js +75 -538
  26. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  27. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +9 -9
  28. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  29. package/lib/eth/builtin/internal/erc20bytes-processor.js +37 -268
  30. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  31. package/lib/eth/builtin/internal/erc721-processor.d.ts +14 -14
  32. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  33. package/lib/eth/builtin/internal/erc721-processor.js +57 -430
  34. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  35. package/lib/eth/builtin/internal/weth9-processor.d.ts +11 -11
  36. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  37. package/lib/eth/builtin/internal/weth9-processor.js +45 -321
  38. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  39. package/lib/eth/codegen/file.d.ts.map +1 -1
  40. package/lib/eth/codegen/file.js +3 -6
  41. package/lib/eth/codegen/file.js.map +1 -1
  42. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  43. package/lib/eth/codegen/function-calls.js +5 -27
  44. package/lib/eth/codegen/function-calls.js.map +1 -1
  45. package/lib/eth/context.d.ts +4 -2
  46. package/lib/eth/context.d.ts.map +1 -1
  47. package/lib/eth/context.js +15 -0
  48. package/lib/eth/context.js.map +1 -1
  49. package/lib/eth/eth.d.ts +2 -0
  50. package/lib/eth/eth.d.ts.map +1 -1
  51. package/lib/eth/eth.js +15 -1
  52. package/lib/eth/eth.js.map +1 -1
  53. package/lib/move/shared-network-codegen.d.ts.map +1 -1
  54. package/lib/move/shared-network-codegen.js +2 -3
  55. package/lib/move/shared-network-codegen.js.map +1 -1
  56. package/lib/sui/builtin/0x1.d.ts +751 -12
  57. package/lib/sui/builtin/0x1.d.ts.map +1 -1
  58. package/lib/sui/builtin/0x1.js +3857 -0
  59. package/lib/sui/builtin/0x1.js.map +1 -1
  60. package/lib/sui/builtin/0x2.d.ts +3876 -14
  61. package/lib/sui/builtin/0x2.d.ts.map +1 -1
  62. package/lib/sui/builtin/0x2.js +14389 -188
  63. package/lib/sui/builtin/0x2.js.map +1 -1
  64. package/lib/sui/builtin/0x3.d.ts +1923 -0
  65. package/lib/sui/builtin/0x3.d.ts.map +1 -1
  66. package/lib/sui/builtin/0x3.js +5425 -0
  67. package/lib/sui/builtin/0x3.js.map +1 -1
  68. package/lib/sui/codegen/codegen.js +5 -1
  69. package/lib/sui/codegen/codegen.js.map +1 -1
  70. package/package.json +6 -6
  71. package/src/aptos/builtin/0x1.ts +5 -5
  72. package/src/aptos/builtin/0x3.ts +5 -5
  73. package/src/aptos/builtin/0x4.ts +5 -5
  74. package/src/aptos/codegen/codegen.ts +7 -1
  75. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +189 -662
  76. package/src/eth/builtin/internal/erc1155-processor.ts +69 -261
  77. package/src/eth/builtin/internal/erc20-processor.ts +136 -535
  78. package/src/eth/builtin/internal/erc20bytes-processor.ts +68 -265
  79. package/src/eth/builtin/internal/erc721-processor.ts +118 -433
  80. package/src/eth/builtin/internal/weth9-processor.ts +81 -318
  81. package/src/eth/codegen/file.ts +2 -6
  82. package/src/eth/codegen/function-calls.ts +7 -29
  83. package/src/eth/context.ts +19 -2
  84. package/src/eth/eth.ts +21 -1
  85. package/src/move/shared-network-codegen.ts +1 -4
  86. package/src/sui/builtin/0x1.ts +5590 -19
  87. package/src/sui/builtin/0x2.ts +21779 -92
  88. package/src/sui/builtin/0x3.ts +8825 -15
  89. package/src/sui/codegen/codegen.ts +6 -1
@@ -1,26 +1,6 @@
1
- /* Autogenerated file. Do not edit manually. */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- import { Interface } from "ethers";
5
- import { addContractByABI, getContractByABI, addProcessor, getProcessor, getProvider, transformEtherError, BaseProcessor, BaseProcessorTemplate, BoundContractView, ContractView, DummyProvider, } from "@sentio/sdk/eth";
1
+ import { addContractByABI, getContractByABI, addProcessor, getProcessor, getProvider, transformEtherError, BaseProcessor, BaseProcessorTemplate, BoundContractView, ContractView, DummyProvider, encodeCallData, } from "@sentio/sdk/eth";
6
2
  import { ERC721__factory } from "./index.js";
7
3
  const templateContract = ERC721__factory.connect("0x0", DummyProvider);
8
- const iface = new Interface([
9
- "function approve(address to, uint256 tokenId) returns ()",
10
- "function totalSupply() view returns (uint256)",
11
- "function balanceOf(address owner) view returns (uint256 balance)",
12
- "function getApproved(uint256 tokenId) view returns (address operator)",
13
- "function isApprovedForAll(address owner, address operator) view returns (bool)",
14
- "function name() view returns (string)",
15
- "function ownerOf(uint256 tokenId) view returns (address owner)",
16
- "function safeTransferFrom(address from, address to, uint256 tokenId) returns ()",
17
- "function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns ()",
18
- "function setApprovalForAll(address operator, bool _approved) returns ()",
19
- "function supportsInterface(bytes4 interfaceId) view returns (bool)",
20
- "function symbol() view returns (string)",
21
- "function tokenURI(uint256 tokenId) view returns (string)",
22
- "function transferFrom(address from, address to, uint256 tokenId) returns ()",
23
- ]);
24
4
  export class ERC721ContractView extends ContractView {
25
5
  constructor(contract) {
26
6
  super(contract);
@@ -166,591 +146,238 @@ export class ERC721ContractView extends ContractView {
166
146
  },
167
147
  };
168
148
  encodeCall = {
169
- approve(to, tokenId, ethCallContext) {
170
- try {
171
- const iface = new Interface(["function approve(address,uint256)"]);
172
- const calldata = iface.encodeFunctionData("approve", [to, tokenId]);
173
- return {
174
- context: ethCallContext,
175
- calldata,
176
- };
177
- }
178
- catch (e) {
179
- const stack = new Error().stack;
180
- throw transformEtherError(e, undefined, stack);
181
- }
149
+ approve(to, tokenId, callContext) {
150
+ return encodeCallData(callContext, "approve", "function approve(address,uint256)", [to, tokenId]);
182
151
  },
183
- totalSupply(ethCallContext) {
184
- try {
185
- const iface = new Interface(["function totalSupply()"]);
186
- const calldata = iface.encodeFunctionData("totalSupply", []);
187
- return {
188
- context: ethCallContext,
189
- calldata,
190
- };
191
- }
192
- catch (e) {
193
- const stack = new Error().stack;
194
- throw transformEtherError(e, undefined, stack);
195
- }
152
+ totalSupply(callContext) {
153
+ return encodeCallData(callContext, "totalSupply", "function totalSupply()", []);
196
154
  },
197
- balanceOf(owner, ethCallContext) {
198
- try {
199
- const iface = new Interface(["function balanceOf(address)"]);
200
- const calldata = iface.encodeFunctionData("balanceOf", [owner]);
201
- return {
202
- context: ethCallContext,
203
- calldata,
204
- };
205
- }
206
- catch (e) {
207
- const stack = new Error().stack;
208
- throw transformEtherError(e, undefined, stack);
209
- }
155
+ balanceOf(owner, callContext) {
156
+ return encodeCallData(callContext, "balanceOf", "function balanceOf(address)", [owner]);
210
157
  },
211
- getApproved(tokenId, ethCallContext) {
212
- try {
213
- const iface = new Interface(["function getApproved(uint256)"]);
214
- const calldata = iface.encodeFunctionData("getApproved", [tokenId]);
215
- return {
216
- context: ethCallContext,
217
- calldata,
218
- };
219
- }
220
- catch (e) {
221
- const stack = new Error().stack;
222
- throw transformEtherError(e, undefined, stack);
223
- }
158
+ getApproved(tokenId, callContext) {
159
+ return encodeCallData(callContext, "getApproved", "function getApproved(uint256)", [tokenId]);
224
160
  },
225
- isApprovedForAll(owner, operator, ethCallContext) {
226
- try {
227
- const iface = new Interface([
228
- "function isApprovedForAll(address,address)",
229
- ]);
230
- const calldata = iface.encodeFunctionData("isApprovedForAll", [
231
- owner,
232
- operator,
233
- ]);
234
- return {
235
- context: ethCallContext,
236
- calldata,
237
- };
238
- }
239
- catch (e) {
240
- const stack = new Error().stack;
241
- throw transformEtherError(e, undefined, stack);
242
- }
161
+ isApprovedForAll(owner, operator, callContext) {
162
+ return encodeCallData(callContext, "isApprovedForAll", "function isApprovedForAll(address,address)", [owner, operator]);
243
163
  },
244
- name(ethCallContext) {
245
- try {
246
- const iface = new Interface(["function name()"]);
247
- const calldata = iface.encodeFunctionData("name", []);
248
- return {
249
- context: ethCallContext,
250
- calldata,
251
- };
252
- }
253
- catch (e) {
254
- const stack = new Error().stack;
255
- throw transformEtherError(e, undefined, stack);
256
- }
164
+ name(callContext) {
165
+ return encodeCallData(callContext, "name", "function name()", []);
257
166
  },
258
- ownerOf(tokenId, ethCallContext) {
259
- try {
260
- const iface = new Interface(["function ownerOf(uint256)"]);
261
- const calldata = iface.encodeFunctionData("ownerOf", [tokenId]);
262
- return {
263
- context: ethCallContext,
264
- calldata,
265
- };
266
- }
267
- catch (e) {
268
- const stack = new Error().stack;
269
- throw transformEtherError(e, undefined, stack);
270
- }
167
+ ownerOf(tokenId, callContext) {
168
+ return encodeCallData(callContext, "ownerOf", "function ownerOf(uint256)", [tokenId]);
271
169
  },
272
- safeTransferFrom_address_address_uint256(from, to, tokenId, ethCallContext) {
273
- try {
274
- const iface = new Interface([
275
- "function safeTransferFrom(address,address,uint256)",
276
- ]);
277
- const calldata = iface.encodeFunctionData("safeTransferFrom", [
278
- from,
279
- to,
280
- tokenId,
281
- ]);
282
- return {
283
- context: ethCallContext,
284
- calldata,
285
- };
286
- }
287
- catch (e) {
288
- const stack = new Error().stack;
289
- throw transformEtherError(e, undefined, stack);
290
- }
170
+ safeTransferFrom_address_address_uint256(from, to, tokenId, callContext) {
171
+ return encodeCallData(callContext, "safeTransferFrom", "function safeTransferFrom(address,address,uint256)", [from, to, tokenId]);
291
172
  },
292
- safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, ethCallContext) {
293
- try {
294
- const iface = new Interface([
295
- "function safeTransferFrom(address,address,uint256,bytes)",
296
- ]);
297
- const calldata = iface.encodeFunctionData("safeTransferFrom", [
298
- from,
299
- to,
300
- tokenId,
301
- data,
302
- ]);
303
- return {
304
- context: ethCallContext,
305
- calldata,
306
- };
307
- }
308
- catch (e) {
309
- const stack = new Error().stack;
310
- throw transformEtherError(e, undefined, stack);
311
- }
173
+ safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, callContext) {
174
+ return encodeCallData(callContext, "safeTransferFrom", "function safeTransferFrom(address,address,uint256,bytes)", [from, to, tokenId, data]);
312
175
  },
313
- setApprovalForAll(operator, _approved, ethCallContext) {
314
- try {
315
- const iface = new Interface([
316
- "function setApprovalForAll(address,bool)",
317
- ]);
318
- const calldata = iface.encodeFunctionData("setApprovalForAll", [
319
- operator,
320
- _approved,
321
- ]);
322
- return {
323
- context: ethCallContext,
324
- calldata,
325
- };
326
- }
327
- catch (e) {
328
- const stack = new Error().stack;
329
- throw transformEtherError(e, undefined, stack);
330
- }
176
+ setApprovalForAll(operator, _approved, callContext) {
177
+ return encodeCallData(callContext, "setApprovalForAll", "function setApprovalForAll(address,bool)", [operator, _approved]);
331
178
  },
332
- supportsInterface(interfaceId, ethCallContext) {
333
- try {
334
- const iface = new Interface(["function supportsInterface(bytes4)"]);
335
- const calldata = iface.encodeFunctionData("supportsInterface", [
336
- interfaceId,
337
- ]);
338
- return {
339
- context: ethCallContext,
340
- calldata,
341
- };
342
- }
343
- catch (e) {
344
- const stack = new Error().stack;
345
- throw transformEtherError(e, undefined, stack);
346
- }
179
+ supportsInterface(interfaceId, callContext) {
180
+ return encodeCallData(callContext, "supportsInterface", "function supportsInterface(bytes4)", [interfaceId]);
347
181
  },
348
- symbol(ethCallContext) {
349
- try {
350
- const iface = new Interface(["function symbol()"]);
351
- const calldata = iface.encodeFunctionData("symbol", []);
352
- return {
353
- context: ethCallContext,
354
- calldata,
355
- };
356
- }
357
- catch (e) {
358
- const stack = new Error().stack;
359
- throw transformEtherError(e, undefined, stack);
360
- }
182
+ symbol(callContext) {
183
+ return encodeCallData(callContext, "symbol", "function symbol()", []);
361
184
  },
362
- tokenURI(tokenId, ethCallContext) {
363
- try {
364
- const iface = new Interface(["function tokenURI(uint256)"]);
365
- const calldata = iface.encodeFunctionData("tokenURI", [tokenId]);
366
- return {
367
- context: ethCallContext,
368
- calldata,
369
- };
370
- }
371
- catch (e) {
372
- const stack = new Error().stack;
373
- throw transformEtherError(e, undefined, stack);
374
- }
185
+ tokenURI(tokenId, callContext) {
186
+ return encodeCallData(callContext, "tokenURI", "function tokenURI(uint256)", [tokenId]);
375
187
  },
376
- transferFrom(from, to, tokenId, ethCallContext) {
377
- try {
378
- const iface = new Interface([
379
- "function transferFrom(address,address,uint256)",
380
- ]);
381
- const calldata = iface.encodeFunctionData("transferFrom", [
382
- from,
383
- to,
384
- tokenId,
385
- ]);
386
- return {
387
- context: ethCallContext,
388
- calldata,
389
- };
390
- }
391
- catch (e) {
392
- const stack = new Error().stack;
393
- throw transformEtherError(e, undefined, stack);
394
- }
188
+ transferFrom(from, to, tokenId, callContext) {
189
+ return encodeCallData(callContext, "transferFrom", "function transferFrom(address,address,uint256)", [from, to, tokenId]);
395
190
  },
396
191
  };
397
192
  }
398
193
  export class ERC721BoundContractView extends BoundContractView {
399
194
  async totalSupply(overrides) {
400
- const ethCallContext = {
401
- chainId: this.context.chainId,
402
- blockTag: "0x" + this.context.blockNumber.toString(16),
403
- address: this.context.address,
404
- };
405
195
  return await this.view.totalSupply({
406
196
  blockTag: this.context.blockNumber,
407
197
  ...overrides,
408
- }, this.context.preparedData, ethCallContext);
198
+ }, this.context.preparedData, this.context.getEthCallContext());
409
199
  }
410
200
  async balanceOf(owner, overrides) {
411
- const ethCallContext = {
412
- chainId: this.context.chainId,
413
- blockTag: "0x" + this.context.blockNumber.toString(16),
414
- address: this.context.address,
415
- };
416
201
  return await this.view.balanceOf(owner, {
417
202
  blockTag: this.context.blockNumber,
418
203
  ...overrides,
419
- }, this.context.preparedData, ethCallContext);
204
+ }, this.context.preparedData, this.context.getEthCallContext());
420
205
  }
421
206
  async getApproved(tokenId, overrides) {
422
- const ethCallContext = {
423
- chainId: this.context.chainId,
424
- blockTag: "0x" + this.context.blockNumber.toString(16),
425
- address: this.context.address,
426
- };
427
207
  return await this.view.getApproved(tokenId, {
428
208
  blockTag: this.context.blockNumber,
429
209
  ...overrides,
430
- }, this.context.preparedData, ethCallContext);
210
+ }, this.context.preparedData, this.context.getEthCallContext());
431
211
  }
432
212
  async isApprovedForAll(owner, operator, overrides) {
433
- const ethCallContext = {
434
- chainId: this.context.chainId,
435
- blockTag: "0x" + this.context.blockNumber.toString(16),
436
- address: this.context.address,
437
- };
438
213
  return await this.view.isApprovedForAll(owner, operator, {
439
214
  blockTag: this.context.blockNumber,
440
215
  ...overrides,
441
- }, this.context.preparedData, ethCallContext);
216
+ }, this.context.preparedData, this.context.getEthCallContext());
442
217
  }
443
218
  async name(overrides) {
444
- const ethCallContext = {
445
- chainId: this.context.chainId,
446
- blockTag: "0x" + this.context.blockNumber.toString(16),
447
- address: this.context.address,
448
- };
449
219
  return await this.view.name({
450
220
  blockTag: this.context.blockNumber,
451
221
  ...overrides,
452
- }, this.context.preparedData, ethCallContext);
222
+ }, this.context.preparedData, this.context.getEthCallContext());
453
223
  }
454
224
  async ownerOf(tokenId, overrides) {
455
- const ethCallContext = {
456
- chainId: this.context.chainId,
457
- blockTag: "0x" + this.context.blockNumber.toString(16),
458
- address: this.context.address,
459
- };
460
225
  return await this.view.ownerOf(tokenId, {
461
226
  blockTag: this.context.blockNumber,
462
227
  ...overrides,
463
- }, this.context.preparedData, ethCallContext);
228
+ }, this.context.preparedData, this.context.getEthCallContext());
464
229
  }
465
230
  async supportsInterface(interfaceId, overrides) {
466
- const ethCallContext = {
467
- chainId: this.context.chainId,
468
- blockTag: "0x" + this.context.blockNumber.toString(16),
469
- address: this.context.address,
470
- };
471
231
  return await this.view.supportsInterface(interfaceId, {
472
232
  blockTag: this.context.blockNumber,
473
233
  ...overrides,
474
- }, this.context.preparedData, ethCallContext);
234
+ }, this.context.preparedData, this.context.getEthCallContext());
475
235
  }
476
236
  async symbol(overrides) {
477
- const ethCallContext = {
478
- chainId: this.context.chainId,
479
- blockTag: "0x" + this.context.blockNumber.toString(16),
480
- address: this.context.address,
481
- };
482
237
  return await this.view.symbol({
483
238
  blockTag: this.context.blockNumber,
484
239
  ...overrides,
485
- }, this.context.preparedData, ethCallContext);
240
+ }, this.context.preparedData, this.context.getEthCallContext());
486
241
  }
487
242
  async tokenURI(tokenId, overrides) {
488
- const ethCallContext = {
489
- chainId: this.context.chainId,
490
- blockTag: "0x" + this.context.blockNumber.toString(16),
491
- address: this.context.address,
492
- };
493
243
  return await this.view.tokenURI(tokenId, {
494
244
  blockTag: this.context.blockNumber,
495
245
  ...overrides,
496
- }, this.context.preparedData, ethCallContext);
246
+ }, this.context.preparedData, this.context.getEthCallContext());
497
247
  }
498
248
  callStatic = {
499
249
  view: this.view,
500
250
  context: this.context,
501
251
  async approve(to, tokenId, overrides) {
502
- const ethCallContext = {
503
- chainId: this.context.chainId,
504
- blockTag: "0x" + this.context.blockNumber.toString(16),
505
- address: this.context.address,
506
- };
507
252
  return await this.view.callStatic.approve(to, tokenId, {
508
253
  blockTag: this.context.blockNumber,
509
254
  ...overrides,
510
- }, this.context.preparedData, ethCallContext);
255
+ }, this.context.preparedData, this.context.getEthCallContext());
511
256
  },
512
257
  async safeTransferFrom_address_address_uint256(from, to, tokenId, overrides) {
513
- const ethCallContext = {
514
- chainId: this.context.chainId,
515
- blockTag: "0x" + this.context.blockNumber.toString(16),
516
- address: this.context.address,
517
- };
518
258
  return await this.view.callStatic.safeTransferFrom_address_address_uint256(from, to, tokenId, {
519
259
  blockTag: this.context.blockNumber,
520
260
  ...overrides,
521
- }, this.context.preparedData, ethCallContext);
261
+ }, this.context.preparedData, this.context.getEthCallContext());
522
262
  },
523
263
  async safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, overrides) {
524
- const ethCallContext = {
525
- chainId: this.context.chainId,
526
- blockTag: "0x" + this.context.blockNumber.toString(16),
527
- address: this.context.address,
528
- };
529
264
  return await this.view.callStatic.safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, {
530
265
  blockTag: this.context.blockNumber,
531
266
  ...overrides,
532
- }, this.context.preparedData, ethCallContext);
267
+ }, this.context.preparedData, this.context.getEthCallContext());
533
268
  },
534
269
  async setApprovalForAll(operator, _approved, overrides) {
535
- const ethCallContext = {
536
- chainId: this.context.chainId,
537
- blockTag: "0x" + this.context.blockNumber.toString(16),
538
- address: this.context.address,
539
- };
540
270
  return await this.view.callStatic.setApprovalForAll(operator, _approved, {
541
271
  blockTag: this.context.blockNumber,
542
272
  ...overrides,
543
- }, this.context.preparedData, ethCallContext);
273
+ }, this.context.preparedData, this.context.getEthCallContext());
544
274
  },
545
275
  async transferFrom(from, to, tokenId, overrides) {
546
- const ethCallContext = {
547
- chainId: this.context.chainId,
548
- blockTag: "0x" + this.context.blockNumber.toString(16),
549
- address: this.context.address,
550
- };
551
276
  return await this.view.callStatic.transferFrom(from, to, tokenId, {
552
277
  blockTag: this.context.blockNumber,
553
278
  ...overrides,
554
- }, this.context.preparedData, ethCallContext);
279
+ }, this.context.preparedData, this.context.getEthCallContext());
555
280
  },
556
281
  };
557
282
  encodeCall = {
558
283
  view: this.view,
559
284
  context: this.context,
560
285
  approve(to, tokenId, overrides) {
561
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
562
- if (overrides?.blockTag) {
563
- blockTagWithOverride =
564
- typeof overrides.blockTag == "string"
565
- ? overrides.blockTag
566
- : "0x" + overrides.blockTag.toString(16);
567
- }
568
286
  return this.view.encodeCall.approve(to, tokenId, {
569
287
  chainId: this.context.chainId.toString(),
570
288
  address: this.context.address,
571
- blockTag: blockTagWithOverride,
289
+ blockTag: this.context.getBlockTag(overrides),
572
290
  });
573
291
  },
574
292
  totalSupply(overrides) {
575
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
576
- if (overrides?.blockTag) {
577
- blockTagWithOverride =
578
- typeof overrides.blockTag == "string"
579
- ? overrides.blockTag
580
- : "0x" + overrides.blockTag.toString(16);
581
- }
582
293
  return this.view.encodeCall.totalSupply({
583
294
  chainId: this.context.chainId.toString(),
584
295
  address: this.context.address,
585
- blockTag: blockTagWithOverride,
296
+ blockTag: this.context.getBlockTag(overrides),
586
297
  });
587
298
  },
588
299
  balanceOf(owner, overrides) {
589
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
590
- if (overrides?.blockTag) {
591
- blockTagWithOverride =
592
- typeof overrides.blockTag == "string"
593
- ? overrides.blockTag
594
- : "0x" + overrides.blockTag.toString(16);
595
- }
596
300
  return this.view.encodeCall.balanceOf(owner, {
597
301
  chainId: this.context.chainId.toString(),
598
302
  address: this.context.address,
599
- blockTag: blockTagWithOverride,
303
+ blockTag: this.context.getBlockTag(overrides),
600
304
  });
601
305
  },
602
306
  getApproved(tokenId, overrides) {
603
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
604
- if (overrides?.blockTag) {
605
- blockTagWithOverride =
606
- typeof overrides.blockTag == "string"
607
- ? overrides.blockTag
608
- : "0x" + overrides.blockTag.toString(16);
609
- }
610
307
  return this.view.encodeCall.getApproved(tokenId, {
611
308
  chainId: this.context.chainId.toString(),
612
309
  address: this.context.address,
613
- blockTag: blockTagWithOverride,
310
+ blockTag: this.context.getBlockTag(overrides),
614
311
  });
615
312
  },
616
313
  isApprovedForAll(owner, operator, overrides) {
617
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
618
- if (overrides?.blockTag) {
619
- blockTagWithOverride =
620
- typeof overrides.blockTag == "string"
621
- ? overrides.blockTag
622
- : "0x" + overrides.blockTag.toString(16);
623
- }
624
314
  return this.view.encodeCall.isApprovedForAll(owner, operator, {
625
315
  chainId: this.context.chainId.toString(),
626
316
  address: this.context.address,
627
- blockTag: blockTagWithOverride,
317
+ blockTag: this.context.getBlockTag(overrides),
628
318
  });
629
319
  },
630
320
  name(overrides) {
631
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
632
- if (overrides?.blockTag) {
633
- blockTagWithOverride =
634
- typeof overrides.blockTag == "string"
635
- ? overrides.blockTag
636
- : "0x" + overrides.blockTag.toString(16);
637
- }
638
321
  return this.view.encodeCall.name({
639
322
  chainId: this.context.chainId.toString(),
640
323
  address: this.context.address,
641
- blockTag: blockTagWithOverride,
324
+ blockTag: this.context.getBlockTag(overrides),
642
325
  });
643
326
  },
644
327
  ownerOf(tokenId, overrides) {
645
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
646
- if (overrides?.blockTag) {
647
- blockTagWithOverride =
648
- typeof overrides.blockTag == "string"
649
- ? overrides.blockTag
650
- : "0x" + overrides.blockTag.toString(16);
651
- }
652
328
  return this.view.encodeCall.ownerOf(tokenId, {
653
329
  chainId: this.context.chainId.toString(),
654
330
  address: this.context.address,
655
- blockTag: blockTagWithOverride,
331
+ blockTag: this.context.getBlockTag(overrides),
656
332
  });
657
333
  },
658
334
  safeTransferFrom_address_address_uint256(from, to, tokenId, overrides) {
659
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
660
- if (overrides?.blockTag) {
661
- blockTagWithOverride =
662
- typeof overrides.blockTag == "string"
663
- ? overrides.blockTag
664
- : "0x" + overrides.blockTag.toString(16);
665
- }
666
335
  return this.view.encodeCall.safeTransferFrom_address_address_uint256(from, to, tokenId, {
667
336
  chainId: this.context.chainId.toString(),
668
337
  address: this.context.address,
669
- blockTag: blockTagWithOverride,
338
+ blockTag: this.context.getBlockTag(overrides),
670
339
  });
671
340
  },
672
341
  safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, overrides) {
673
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
674
- if (overrides?.blockTag) {
675
- blockTagWithOverride =
676
- typeof overrides.blockTag == "string"
677
- ? overrides.blockTag
678
- : "0x" + overrides.blockTag.toString(16);
679
- }
680
342
  return this.view.encodeCall.safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, {
681
343
  chainId: this.context.chainId.toString(),
682
344
  address: this.context.address,
683
- blockTag: blockTagWithOverride,
345
+ blockTag: this.context.getBlockTag(overrides),
684
346
  });
685
347
  },
686
348
  setApprovalForAll(operator, _approved, overrides) {
687
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
688
- if (overrides?.blockTag) {
689
- blockTagWithOverride =
690
- typeof overrides.blockTag == "string"
691
- ? overrides.blockTag
692
- : "0x" + overrides.blockTag.toString(16);
693
- }
694
349
  return this.view.encodeCall.setApprovalForAll(operator, _approved, {
695
350
  chainId: this.context.chainId.toString(),
696
351
  address: this.context.address,
697
- blockTag: blockTagWithOverride,
352
+ blockTag: this.context.getBlockTag(overrides),
698
353
  });
699
354
  },
700
355
  supportsInterface(interfaceId, overrides) {
701
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
702
- if (overrides?.blockTag) {
703
- blockTagWithOverride =
704
- typeof overrides.blockTag == "string"
705
- ? overrides.blockTag
706
- : "0x" + overrides.blockTag.toString(16);
707
- }
708
356
  return this.view.encodeCall.supportsInterface(interfaceId, {
709
357
  chainId: this.context.chainId.toString(),
710
358
  address: this.context.address,
711
- blockTag: blockTagWithOverride,
359
+ blockTag: this.context.getBlockTag(overrides),
712
360
  });
713
361
  },
714
362
  symbol(overrides) {
715
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
716
- if (overrides?.blockTag) {
717
- blockTagWithOverride =
718
- typeof overrides.blockTag == "string"
719
- ? overrides.blockTag
720
- : "0x" + overrides.blockTag.toString(16);
721
- }
722
363
  return this.view.encodeCall.symbol({
723
364
  chainId: this.context.chainId.toString(),
724
365
  address: this.context.address,
725
- blockTag: blockTagWithOverride,
366
+ blockTag: this.context.getBlockTag(overrides),
726
367
  });
727
368
  },
728
369
  tokenURI(tokenId, overrides) {
729
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
730
- if (overrides?.blockTag) {
731
- blockTagWithOverride =
732
- typeof overrides.blockTag == "string"
733
- ? overrides.blockTag
734
- : "0x" + overrides.blockTag.toString(16);
735
- }
736
370
  return this.view.encodeCall.tokenURI(tokenId, {
737
371
  chainId: this.context.chainId.toString(),
738
372
  address: this.context.address,
739
- blockTag: blockTagWithOverride,
373
+ blockTag: this.context.getBlockTag(overrides),
740
374
  });
741
375
  },
742
376
  transferFrom(from, to, tokenId, overrides) {
743
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
744
- if (overrides?.blockTag) {
745
- blockTagWithOverride =
746
- typeof overrides.blockTag == "string"
747
- ? overrides.blockTag
748
- : "0x" + overrides.blockTag.toString(16);
749
- }
750
377
  return this.view.encodeCall.transferFrom(from, to, tokenId, {
751
378
  chainId: this.context.chainId.toString(),
752
379
  address: this.context.address,
753
- blockTag: blockTagWithOverride,
380
+ blockTag: this.context.getBlockTag(overrides),
754
381
  });
755
382
  },
756
383
  };