@sentio/sdk 2.40.0-rc.4 → 2.40.0-rc.41

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 (224) hide show
  1. package/lib/aptos/aptos-processor.d.ts +1 -1
  2. package/lib/aptos/aptos-processor.d.ts.map +1 -1
  3. package/lib/aptos/aptos-processor.js +1 -1
  4. package/lib/aptos/aptos-processor.js.map +1 -1
  5. package/lib/aptos/context.d.ts +2 -2
  6. package/lib/aptos/context.d.ts.map +1 -1
  7. package/lib/aptos/context.js +1 -1
  8. package/lib/aptos/ext/aptos-dex.d.ts +1 -1
  9. package/lib/aptos/ext/aptos-dex.d.ts.map +1 -1
  10. package/lib/aptos/ext/aptos-dex.js +1 -1
  11. package/lib/aptos/ext/aptos-dex.js.map +1 -1
  12. package/lib/aptos/ext/coin-event.d.ts +1 -1
  13. package/lib/aptos/ext/coin-event.d.ts.map +1 -1
  14. package/lib/aptos/ext/coin.js +2 -2
  15. package/lib/aptos/ext/coin.js.map +1 -1
  16. package/lib/aptos/move-coder.d.ts.map +1 -1
  17. package/lib/aptos/move-coder.js +6 -5
  18. package/lib/aptos/move-coder.js.map +1 -1
  19. package/lib/aptos/network.d.ts +2 -0
  20. package/lib/aptos/network.d.ts.map +1 -1
  21. package/lib/aptos/network.js +7 -1
  22. package/lib/aptos/network.js.map +1 -1
  23. package/lib/eth/account-processor.d.ts +21 -7
  24. package/lib/eth/account-processor.d.ts.map +1 -1
  25. package/lib/eth/account-processor.js +2 -2
  26. package/lib/eth/account-processor.js.map +1 -1
  27. package/lib/eth/base-processor-template.d.ts +24 -8
  28. package/lib/eth/base-processor-template.d.ts.map +1 -1
  29. package/lib/eth/base-processor-template.js.map +1 -1
  30. package/lib/eth/base-processor.d.ts +30 -10
  31. package/lib/eth/base-processor.d.ts.map +1 -1
  32. package/lib/eth/base-processor.js +6 -6
  33. package/lib/eth/base-processor.js.map +1 -1
  34. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +100 -31
  35. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  36. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +1226 -46
  37. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  38. package/lib/eth/builtin/internal/erc1155-processor.d.ts +55 -16
  39. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  40. package/lib/eth/builtin/internal/erc1155-processor.js +486 -16
  41. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  42. package/lib/eth/builtin/internal/erc20-processor.d.ts +79 -24
  43. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  44. package/lib/eth/builtin/internal/erc20-processor.js +985 -36
  45. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  46. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +46 -13
  47. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  48. package/lib/eth/builtin/internal/erc20bytes-processor.js +485 -18
  49. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  50. package/lib/eth/builtin/internal/erc721-processor.d.ts +67 -20
  51. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  52. package/lib/eth/builtin/internal/erc721-processor.js +784 -28
  53. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  54. package/lib/eth/builtin/internal/weth9-processor.d.ts +64 -19
  55. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  56. package/lib/eth/builtin/internal/weth9-processor.js +574 -22
  57. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  58. package/lib/eth/codegen/event-handler.js +1 -1
  59. package/lib/eth/codegen/file.d.ts.map +1 -1
  60. package/lib/eth/codegen/file.js +21 -3
  61. package/lib/eth/codegen/file.js.map +1 -1
  62. package/lib/eth/codegen/function-calls.d.ts +4 -0
  63. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  64. package/lib/eth/codegen/function-calls.js +80 -5
  65. package/lib/eth/codegen/function-calls.js.map +1 -1
  66. package/lib/eth/codegen/types.d.ts +1 -0
  67. package/lib/eth/codegen/types.d.ts.map +1 -1
  68. package/lib/eth/codegen/types.js +13 -0
  69. package/lib/eth/codegen/types.js.map +1 -1
  70. package/lib/eth/context.d.ts +4 -0
  71. package/lib/eth/context.d.ts.map +1 -1
  72. package/lib/eth/context.js +4 -0
  73. package/lib/eth/context.js.map +1 -1
  74. package/lib/eth/eth-plugin.d.ts +27 -9
  75. package/lib/eth/eth-plugin.d.ts.map +1 -1
  76. package/lib/eth/eth-plugin.js +20 -17
  77. package/lib/eth/eth-plugin.js.map +1 -1
  78. package/lib/eth/eth.d.ts.map +1 -1
  79. package/lib/eth/eth.js +1 -1
  80. package/lib/eth/eth.js.map +1 -1
  81. package/lib/eth/generic-processor.js +1 -1
  82. package/lib/eth/generic-processor.js.map +1 -1
  83. package/lib/eth/generic-processor.test.js.map +1 -1
  84. package/lib/eth/index.d.ts +2 -1
  85. package/lib/eth/index.d.ts.map +1 -1
  86. package/lib/eth/index.js +2 -1
  87. package/lib/eth/index.js.map +1 -1
  88. package/lib/solana/builtin/spl-token-processor.d.ts +1 -1
  89. package/lib/solana/builtin/spl-token-processor.d.ts.map +1 -1
  90. package/lib/solana/builtin/spl-token-processor.js +1 -1
  91. package/lib/solana/builtin/spl-token-processor.js.map +1 -1
  92. package/lib/solana/solana-context.d.ts +1 -1
  93. package/lib/solana/solana-context.js +2 -2
  94. package/lib/stark/codegen/codegen.d.ts +2 -0
  95. package/lib/stark/codegen/codegen.d.ts.map +1 -0
  96. package/lib/stark/codegen/codegen.js +109 -0
  97. package/lib/stark/codegen/codegen.js.map +1 -0
  98. package/lib/stark/codegen/index.d.ts +2 -0
  99. package/lib/stark/codegen/index.d.ts.map +1 -0
  100. package/lib/stark/codegen/index.js +2 -0
  101. package/lib/stark/codegen/index.js.map +1 -0
  102. package/lib/stark/codegen/run.d.ts +2 -0
  103. package/lib/stark/codegen/run.d.ts.map +1 -0
  104. package/lib/stark/codegen/run.js +11 -0
  105. package/lib/stark/codegen/run.js.map +1 -0
  106. package/lib/stark/codegen/utils.d.ts +2 -0
  107. package/lib/stark/codegen/utils.d.ts.map +1 -0
  108. package/lib/stark/codegen/utils.js +4 -0
  109. package/lib/stark/codegen/utils.js.map +1 -0
  110. package/lib/stark/context.d.ts +28 -0
  111. package/lib/stark/context.d.ts.map +1 -0
  112. package/lib/stark/context.js +59 -0
  113. package/lib/stark/context.js.map +1 -0
  114. package/lib/stark/contract.d.ts +12 -0
  115. package/lib/stark/contract.d.ts.map +1 -0
  116. package/lib/stark/contract.js +43 -0
  117. package/lib/stark/contract.js.map +1 -0
  118. package/lib/stark/event.d.ts +7 -0
  119. package/lib/stark/event.d.ts.map +1 -0
  120. package/lib/stark/event.js +11 -0
  121. package/lib/stark/event.js.map +1 -0
  122. package/lib/stark/index.d.ts +7 -0
  123. package/lib/stark/index.d.ts.map +1 -0
  124. package/lib/stark/index.js +7 -0
  125. package/lib/stark/index.js.map +1 -0
  126. package/lib/stark/starknet-plugin.d.ts +17 -0
  127. package/lib/stark/starknet-plugin.d.ts.map +1 -0
  128. package/lib/stark/starknet-plugin.js +78 -0
  129. package/lib/stark/starknet-plugin.js.map +1 -0
  130. package/lib/stark/starknet-processor.d.ts +32 -0
  131. package/lib/stark/starknet-processor.d.ts.map +1 -0
  132. package/lib/stark/starknet-processor.js +111 -0
  133. package/lib/stark/starknet-processor.js.map +1 -0
  134. package/lib/stark/types.d.ts +11 -0
  135. package/lib/stark/types.d.ts.map +1 -0
  136. package/lib/stark/types.js +2 -0
  137. package/lib/stark/types.js.map +1 -0
  138. package/lib/store/cache.d.ts +14 -0
  139. package/lib/store/cache.d.ts.map +1 -0
  140. package/lib/store/cache.js +35 -0
  141. package/lib/store/cache.js.map +1 -0
  142. package/lib/store/store.d.ts +2 -3
  143. package/lib/store/store.d.ts.map +1 -1
  144. package/lib/store/store.js +34 -9
  145. package/lib/store/store.js.map +1 -1
  146. package/lib/sui/context.d.ts +1 -1
  147. package/lib/sui/context.d.ts.map +1 -1
  148. package/lib/sui/sui-processor.d.ts +1 -1
  149. package/lib/sui/sui-processor.d.ts.map +1 -1
  150. package/lib/sui/sui-processor.js +1 -1
  151. package/lib/sui/sui-processor.js.map +1 -1
  152. package/lib/testing/aptos-facet.d.ts +1 -1
  153. package/lib/testing/aptos-facet.js +2 -2
  154. package/lib/testing/starknet-facet.d.ts +9 -0
  155. package/lib/testing/starknet-facet.d.ts.map +1 -0
  156. package/lib/testing/starknet-facet.js +52 -0
  157. package/lib/testing/starknet-facet.js.map +1 -0
  158. package/lib/testing/sui-facet.js +1 -1
  159. package/lib/testing/test-processor-server.d.ts +2 -0
  160. package/lib/testing/test-processor-server.d.ts.map +1 -1
  161. package/lib/testing/test-processor-server.js +3 -0
  162. package/lib/testing/test-processor-server.js.map +1 -1
  163. package/lib/tsup.config.ts +3 -15
  164. package/lib/utils/dex-price.d.ts +1 -0
  165. package/lib/utils/dex-price.d.ts.map +1 -1
  166. package/lib/utils/dex-price.js +13 -2
  167. package/lib/utils/dex-price.js.map +1 -1
  168. package/package.json +21 -10
  169. package/src/aptos/aptos-processor.ts +1 -1
  170. package/src/aptos/context.ts +2 -2
  171. package/src/aptos/ext/aptos-dex.ts +1 -1
  172. package/src/aptos/ext/coin-event.ts +1 -1
  173. package/src/aptos/ext/coin.ts +2 -2
  174. package/src/aptos/move-coder.ts +7 -5
  175. package/src/aptos/network.ts +7 -1
  176. package/src/bundle.config.ts +23 -0
  177. package/src/eth/account-processor.ts +28 -12
  178. package/src/eth/base-processor-template.ts +16 -8
  179. package/src/eth/base-processor.ts +25 -16
  180. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1554 -123
  181. package/src/eth/builtin/internal/erc1155-processor.ts +659 -42
  182. package/src/eth/builtin/internal/erc20-processor.ts +1266 -90
  183. package/src/eth/builtin/internal/erc20bytes-processor.ts +639 -49
  184. package/src/eth/builtin/internal/erc721-processor.ts +1035 -70
  185. package/src/eth/builtin/internal/weth9-processor.ts +758 -63
  186. package/src/eth/codegen/event-handler.ts +1 -1
  187. package/src/eth/codegen/file.ts +26 -3
  188. package/src/eth/codegen/function-calls.ts +96 -8
  189. package/src/eth/codegen/types.ts +22 -1
  190. package/src/eth/context.ts +7 -0
  191. package/src/eth/eth-plugin.ts +34 -26
  192. package/src/eth/eth.ts +1 -2
  193. package/src/eth/generic-processor.ts +1 -1
  194. package/src/eth/index.ts +5 -1
  195. package/src/solana/builtin/spl-token-processor.ts +1 -1
  196. package/src/solana/solana-context.ts +2 -2
  197. package/src/stark/codegen/codegen.ts +124 -0
  198. package/src/stark/codegen/index.ts +1 -0
  199. package/src/stark/codegen/run.ts +10 -0
  200. package/src/stark/codegen/utils.ts +3 -0
  201. package/src/stark/context.ts +78 -0
  202. package/src/stark/contract.ts +55 -0
  203. package/src/stark/event.ts +7 -0
  204. package/src/stark/index.ts +9 -0
  205. package/src/stark/starknet-plugin.ts +108 -0
  206. package/src/stark/starknet-processor.ts +140 -0
  207. package/src/stark/types.ts +11 -0
  208. package/src/store/cache.ts +46 -0
  209. package/src/store/store.ts +40 -22
  210. package/src/sui/context.ts +1 -1
  211. package/src/sui/sui-processor.ts +1 -1
  212. package/src/testing/aptos-facet.ts +2 -2
  213. package/src/testing/starknet-facet.ts +61 -0
  214. package/src/testing/sui-facet.ts +1 -1
  215. package/src/testing/test-processor-server.ts +3 -0
  216. package/src/tsup.config.ts +3 -15
  217. package/src/utils/dex-price.ts +15 -2
  218. package/lib/eth/provider.d.ts +0 -5
  219. package/lib/eth/provider.d.ts.map +0 -1
  220. package/lib/eth/provider.js +0 -134
  221. package/lib/eth/provider.js.map +0 -1
  222. package/lib/utils/chainlink-oracles-sepolia.csv +0 -19
  223. package/lib/utils/chainlink-oracles.csv +0 -217
  224. package/src/eth/provider.ts +0 -163
@@ -1,7 +1,7 @@
1
1
  /* Autogenerated file. Do not edit manually. */
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
- import { BigNumberish, Overrides, BytesLike } from "ethers";
4
+ import { BigNumberish, Overrides, BytesLike, Interface } from "ethers";
5
5
  import {
6
6
  addContractByABI,
7
7
  getContractByABI,
@@ -21,7 +21,9 @@ import {
21
21
  EthContext,
22
22
  EthFetchConfig,
23
23
  PreprocessResult,
24
+ makeEthCallKey,
24
25
  } from "@sentio/sdk/eth";
26
+ import { EthCallParam, EthCallContext, PreparedData } from "@sentio/protos";
25
27
 
26
28
  import { ERC721__factory } from "./index.js";
27
29
  import {
@@ -155,8 +157,29 @@ export class ERC721ContractView extends ContractView<ERC721> {
155
157
  this.callStatic.contract = contract;
156
158
  }
157
159
 
158
- async totalSupply(overrides?: Overrides): Promise<bigint> {
160
+ async totalSupply(
161
+ overrides?: Overrides,
162
+ preparedData?: PreparedData,
163
+ ethCallContext?: EthCallContext
164
+ ): Promise<bigint> {
159
165
  try {
166
+ if (preparedData?.ethCallResults && ethCallContext) {
167
+ const iface = new Interface([
168
+ "function totalSupply() view returns (uint256)",
169
+ ]);
170
+ const calldata = iface.encodeFunctionData("totalSupply", []);
171
+ const key = makeEthCallKey({
172
+ context: ethCallContext,
173
+ calldata,
174
+ });
175
+ const ret = preparedData.ethCallResults[key];
176
+ if (ret) {
177
+ const result = iface
178
+ .decodeFunctionResult("totalSupply", ret)
179
+ .toArray();
180
+ return result.length == 1 ? result[0] : result;
181
+ }
182
+ }
160
183
  return await this.contract.getFunction("totalSupply()")(overrides || {});
161
184
  } catch (e) {
162
185
  const stack = new Error().stack;
@@ -164,8 +187,28 @@ export class ERC721ContractView extends ContractView<ERC721> {
164
187
  }
165
188
  }
166
189
 
167
- async balanceOf(owner: string, overrides?: Overrides): Promise<bigint> {
190
+ async balanceOf(
191
+ owner: string,
192
+ overrides?: Overrides,
193
+ preparedData?: PreparedData,
194
+ ethCallContext?: EthCallContext
195
+ ): Promise<bigint> {
168
196
  try {
197
+ if (preparedData?.ethCallResults && ethCallContext) {
198
+ const iface = new Interface([
199
+ "function balanceOf(address) view returns (uint256)",
200
+ ]);
201
+ const calldata = iface.encodeFunctionData("balanceOf", [owner]);
202
+ const key = makeEthCallKey({
203
+ context: ethCallContext,
204
+ calldata,
205
+ });
206
+ const ret = preparedData.ethCallResults[key];
207
+ if (ret) {
208
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
209
+ return result.length == 1 ? result[0] : result;
210
+ }
211
+ }
169
212
  return await this.contract.getFunction("balanceOf(address)")(
170
213
  owner,
171
214
  overrides || {}
@@ -178,9 +221,28 @@ export class ERC721ContractView extends ContractView<ERC721> {
178
221
 
179
222
  async getApproved(
180
223
  tokenId: BigNumberish,
181
- overrides?: Overrides
224
+ overrides?: Overrides,
225
+ preparedData?: PreparedData,
226
+ ethCallContext?: EthCallContext
182
227
  ): Promise<string> {
183
228
  try {
229
+ if (preparedData?.ethCallResults && ethCallContext) {
230
+ const iface = new Interface([
231
+ "function getApproved(uint256) view returns (address)",
232
+ ]);
233
+ const calldata = iface.encodeFunctionData("getApproved", [tokenId]);
234
+ const key = makeEthCallKey({
235
+ context: ethCallContext,
236
+ calldata,
237
+ });
238
+ const ret = preparedData.ethCallResults[key];
239
+ if (ret) {
240
+ const result = iface
241
+ .decodeFunctionResult("getApproved", ret)
242
+ .toArray();
243
+ return result.length == 1 ? result[0] : result;
244
+ }
245
+ }
184
246
  return await this.contract.getFunction("getApproved(uint256)")(
185
247
  tokenId,
186
248
  overrides || {}
@@ -194,9 +256,31 @@ export class ERC721ContractView extends ContractView<ERC721> {
194
256
  async isApprovedForAll(
195
257
  owner: string,
196
258
  operator: string,
197
- overrides?: Overrides
259
+ overrides?: Overrides,
260
+ preparedData?: PreparedData,
261
+ ethCallContext?: EthCallContext
198
262
  ): Promise<boolean> {
199
263
  try {
264
+ if (preparedData?.ethCallResults && ethCallContext) {
265
+ const iface = new Interface([
266
+ "function isApprovedForAll(address,address) view returns (bool)",
267
+ ]);
268
+ const calldata = iface.encodeFunctionData("isApprovedForAll", [
269
+ owner,
270
+ operator,
271
+ ]);
272
+ const key = makeEthCallKey({
273
+ context: ethCallContext,
274
+ calldata,
275
+ });
276
+ const ret = preparedData.ethCallResults[key];
277
+ if (ret) {
278
+ const result = iface
279
+ .decodeFunctionResult("isApprovedForAll", ret)
280
+ .toArray();
281
+ return result.length == 1 ? result[0] : result;
282
+ }
283
+ }
200
284
  return await this.contract.getFunction(
201
285
  "isApprovedForAll(address,address)"
202
286
  )(owner, operator, overrides || {});
@@ -206,8 +290,25 @@ export class ERC721ContractView extends ContractView<ERC721> {
206
290
  }
207
291
  }
208
292
 
209
- async name(overrides?: Overrides): Promise<string> {
293
+ async name(
294
+ overrides?: Overrides,
295
+ preparedData?: PreparedData,
296
+ ethCallContext?: EthCallContext
297
+ ): Promise<string> {
210
298
  try {
299
+ if (preparedData?.ethCallResults && ethCallContext) {
300
+ const iface = new Interface(["function name() view returns (string)"]);
301
+ const calldata = iface.encodeFunctionData("name", []);
302
+ const key = makeEthCallKey({
303
+ context: ethCallContext,
304
+ calldata,
305
+ });
306
+ const ret = preparedData.ethCallResults[key];
307
+ if (ret) {
308
+ const result = iface.decodeFunctionResult("name", ret).toArray();
309
+ return result.length == 1 ? result[0] : result;
310
+ }
311
+ }
211
312
  return await this.contract.getFunction("name()")(overrides || {});
212
313
  } catch (e) {
213
314
  const stack = new Error().stack;
@@ -215,8 +316,28 @@ export class ERC721ContractView extends ContractView<ERC721> {
215
316
  }
216
317
  }
217
318
 
218
- async ownerOf(tokenId: BigNumberish, overrides?: Overrides): Promise<string> {
319
+ async ownerOf(
320
+ tokenId: BigNumberish,
321
+ overrides?: Overrides,
322
+ preparedData?: PreparedData,
323
+ ethCallContext?: EthCallContext
324
+ ): Promise<string> {
219
325
  try {
326
+ if (preparedData?.ethCallResults && ethCallContext) {
327
+ const iface = new Interface([
328
+ "function ownerOf(uint256) view returns (address)",
329
+ ]);
330
+ const calldata = iface.encodeFunctionData("ownerOf", [tokenId]);
331
+ const key = makeEthCallKey({
332
+ context: ethCallContext,
333
+ calldata,
334
+ });
335
+ const ret = preparedData.ethCallResults[key];
336
+ if (ret) {
337
+ const result = iface.decodeFunctionResult("ownerOf", ret).toArray();
338
+ return result.length == 1 ? result[0] : result;
339
+ }
340
+ }
220
341
  return await this.contract.getFunction("ownerOf(uint256)")(
221
342
  tokenId,
222
343
  overrides || {}
@@ -229,9 +350,30 @@ export class ERC721ContractView extends ContractView<ERC721> {
229
350
 
230
351
  async supportsInterface(
231
352
  interfaceId: BytesLike,
232
- overrides?: Overrides
353
+ overrides?: Overrides,
354
+ preparedData?: PreparedData,
355
+ ethCallContext?: EthCallContext
233
356
  ): Promise<boolean> {
234
357
  try {
358
+ if (preparedData?.ethCallResults && ethCallContext) {
359
+ const iface = new Interface([
360
+ "function supportsInterface(bytes4) view returns (bool)",
361
+ ]);
362
+ const calldata = iface.encodeFunctionData("supportsInterface", [
363
+ interfaceId,
364
+ ]);
365
+ const key = makeEthCallKey({
366
+ context: ethCallContext,
367
+ calldata,
368
+ });
369
+ const ret = preparedData.ethCallResults[key];
370
+ if (ret) {
371
+ const result = iface
372
+ .decodeFunctionResult("supportsInterface", ret)
373
+ .toArray();
374
+ return result.length == 1 ? result[0] : result;
375
+ }
376
+ }
235
377
  return await this.contract.getFunction("supportsInterface(bytes4)")(
236
378
  interfaceId,
237
379
  overrides || {}
@@ -242,8 +384,27 @@ export class ERC721ContractView extends ContractView<ERC721> {
242
384
  }
243
385
  }
244
386
 
245
- async symbol(overrides?: Overrides): Promise<string> {
387
+ async symbol(
388
+ overrides?: Overrides,
389
+ preparedData?: PreparedData,
390
+ ethCallContext?: EthCallContext
391
+ ): Promise<string> {
246
392
  try {
393
+ if (preparedData?.ethCallResults && ethCallContext) {
394
+ const iface = new Interface([
395
+ "function symbol() view returns (string)",
396
+ ]);
397
+ const calldata = iface.encodeFunctionData("symbol", []);
398
+ const key = makeEthCallKey({
399
+ context: ethCallContext,
400
+ calldata,
401
+ });
402
+ const ret = preparedData.ethCallResults[key];
403
+ if (ret) {
404
+ const result = iface.decodeFunctionResult("symbol", ret).toArray();
405
+ return result.length == 1 ? result[0] : result;
406
+ }
407
+ }
247
408
  return await this.contract.getFunction("symbol()")(overrides || {});
248
409
  } catch (e) {
249
410
  const stack = new Error().stack;
@@ -253,9 +414,26 @@ export class ERC721ContractView extends ContractView<ERC721> {
253
414
 
254
415
  async tokenURI(
255
416
  tokenId: BigNumberish,
256
- overrides?: Overrides
417
+ overrides?: Overrides,
418
+ preparedData?: PreparedData,
419
+ ethCallContext?: EthCallContext
257
420
  ): Promise<string> {
258
421
  try {
422
+ if (preparedData?.ethCallResults && ethCallContext) {
423
+ const iface = new Interface([
424
+ "function tokenURI(uint256) view returns (string)",
425
+ ]);
426
+ const calldata = iface.encodeFunctionData("tokenURI", [tokenId]);
427
+ const key = makeEthCallKey({
428
+ context: ethCallContext,
429
+ calldata,
430
+ });
431
+ const ret = preparedData.ethCallResults[key];
432
+ if (ret) {
433
+ const result = iface.decodeFunctionResult("tokenURI", ret).toArray();
434
+ return result.length == 1 ? result[0] : result;
435
+ }
436
+ }
259
437
  return await this.contract.getFunction("tokenURI(uint256)")(
260
438
  tokenId,
261
439
  overrides || {}
@@ -272,9 +450,26 @@ export class ERC721ContractView extends ContractView<ERC721> {
272
450
  async approve(
273
451
  to: string,
274
452
  tokenId: BigNumberish,
275
- overrides?: Overrides
453
+ overrides?: Overrides,
454
+ preparedData?: PreparedData,
455
+ ethCallContext?: EthCallContext
276
456
  ): Promise<void> {
277
457
  try {
458
+ if (preparedData?.ethCallResults && ethCallContext) {
459
+ const iface = new Interface([
460
+ "function approve(address,uint256) nonpayable returns ()",
461
+ ]);
462
+ const calldata = iface.encodeFunctionData("approve", [to, tokenId]);
463
+ const key = makeEthCallKey({
464
+ context: ethCallContext,
465
+ calldata,
466
+ });
467
+ const ret = preparedData.ethCallResults[key];
468
+ if (ret) {
469
+ const result = iface.decodeFunctionResult("approve", ret).toArray();
470
+ return result.length == 1 ? result[0] : result;
471
+ }
472
+ }
278
473
  return await this.contract
279
474
  .getFunction("approve(address,uint256)")
280
475
  .staticCall(to, tokenId, overrides || {});
@@ -287,9 +482,32 @@ export class ERC721ContractView extends ContractView<ERC721> {
287
482
  from: string,
288
483
  to: string,
289
484
  tokenId: BigNumberish,
290
- overrides?: Overrides
485
+ overrides?: Overrides,
486
+ preparedData?: PreparedData,
487
+ ethCallContext?: EthCallContext
291
488
  ): Promise<void> {
292
489
  try {
490
+ if (preparedData?.ethCallResults && ethCallContext) {
491
+ const iface = new Interface([
492
+ "function safeTransferFrom(address,address,uint256) nonpayable returns ()",
493
+ ]);
494
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
495
+ from,
496
+ to,
497
+ tokenId,
498
+ ]);
499
+ const key = makeEthCallKey({
500
+ context: ethCallContext,
501
+ calldata,
502
+ });
503
+ const ret = preparedData.ethCallResults[key];
504
+ if (ret) {
505
+ const result = iface
506
+ .decodeFunctionResult("safeTransferFrom", ret)
507
+ .toArray();
508
+ return result.length == 1 ? result[0] : result;
509
+ }
510
+ }
293
511
  return await this.contract
294
512
  .getFunction("safeTransferFrom(address,address,uint256)")
295
513
  .staticCall(from, to, tokenId, overrides || {});
@@ -303,9 +521,33 @@ export class ERC721ContractView extends ContractView<ERC721> {
303
521
  to: string,
304
522
  tokenId: BigNumberish,
305
523
  data: BytesLike,
306
- overrides?: Overrides
524
+ overrides?: Overrides,
525
+ preparedData?: PreparedData,
526
+ ethCallContext?: EthCallContext
307
527
  ): Promise<void> {
308
528
  try {
529
+ if (preparedData?.ethCallResults && ethCallContext) {
530
+ const iface = new Interface([
531
+ "function safeTransferFrom(address,address,uint256,bytes) nonpayable returns ()",
532
+ ]);
533
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
534
+ from,
535
+ to,
536
+ tokenId,
537
+ data,
538
+ ]);
539
+ const key = makeEthCallKey({
540
+ context: ethCallContext,
541
+ calldata,
542
+ });
543
+ const ret = preparedData.ethCallResults[key];
544
+ if (ret) {
545
+ const result = iface
546
+ .decodeFunctionResult("safeTransferFrom", ret)
547
+ .toArray();
548
+ return result.length == 1 ? result[0] : result;
549
+ }
550
+ }
309
551
  return await this.contract
310
552
  .getFunction("safeTransferFrom(address,address,uint256,bytes)")
311
553
  .staticCall(from, to, tokenId, data, overrides || {});
@@ -317,9 +559,31 @@ export class ERC721ContractView extends ContractView<ERC721> {
317
559
  async setApprovalForAll(
318
560
  operator: string,
319
561
  _approved: boolean,
320
- overrides?: Overrides
562
+ overrides?: Overrides,
563
+ preparedData?: PreparedData,
564
+ ethCallContext?: EthCallContext
321
565
  ): Promise<void> {
322
566
  try {
567
+ if (preparedData?.ethCallResults && ethCallContext) {
568
+ const iface = new Interface([
569
+ "function setApprovalForAll(address,bool) nonpayable returns ()",
570
+ ]);
571
+ const calldata = iface.encodeFunctionData("setApprovalForAll", [
572
+ operator,
573
+ _approved,
574
+ ]);
575
+ const key = makeEthCallKey({
576
+ context: ethCallContext,
577
+ calldata,
578
+ });
579
+ const ret = preparedData.ethCallResults[key];
580
+ if (ret) {
581
+ const result = iface
582
+ .decodeFunctionResult("setApprovalForAll", ret)
583
+ .toArray();
584
+ return result.length == 1 ? result[0] : result;
585
+ }
586
+ }
323
587
  return await this.contract
324
588
  .getFunction("setApprovalForAll(address,bool)")
325
589
  .staticCall(operator, _approved, overrides || {});
@@ -332,9 +596,32 @@ export class ERC721ContractView extends ContractView<ERC721> {
332
596
  from: string,
333
597
  to: string,
334
598
  tokenId: BigNumberish,
335
- overrides?: Overrides
599
+ overrides?: Overrides,
600
+ preparedData?: PreparedData,
601
+ ethCallContext?: EthCallContext
336
602
  ): Promise<void> {
337
603
  try {
604
+ if (preparedData?.ethCallResults && ethCallContext) {
605
+ const iface = new Interface([
606
+ "function transferFrom(address,address,uint256) nonpayable returns ()",
607
+ ]);
608
+ const calldata = iface.encodeFunctionData("transferFrom", [
609
+ from,
610
+ to,
611
+ tokenId,
612
+ ]);
613
+ const key = makeEthCallKey({
614
+ context: ethCallContext,
615
+ calldata,
616
+ });
617
+ const ret = preparedData.ethCallResults[key];
618
+ if (ret) {
619
+ const result = iface
620
+ .decodeFunctionResult("transferFrom", ret)
621
+ .toArray();
622
+ return result.length == 1 ? result[0] : result;
623
+ }
624
+ }
338
625
  return await this.contract
339
626
  .getFunction("transferFrom(address,address,uint256)")
340
627
  .staticCall(from, to, tokenId, overrides || {});
@@ -344,6 +631,262 @@ export class ERC721ContractView extends ContractView<ERC721> {
344
631
  }
345
632
  },
346
633
  };
634
+
635
+ encodeCall = {
636
+ approve(
637
+ to: string,
638
+ tokenId: BigNumberish,
639
+ ethCallContext: EthCallContext
640
+ ): EthCallParam {
641
+ try {
642
+ const iface = new Interface(["function approve(address,uint256)"]);
643
+ const calldata = iface.encodeFunctionData("approve", [to, tokenId]);
644
+ return {
645
+ context: ethCallContext,
646
+ calldata,
647
+ };
648
+ } catch (e) {
649
+ const stack = new Error().stack;
650
+ throw transformEtherError(e, undefined, stack);
651
+ }
652
+ },
653
+ totalSupply(ethCallContext: EthCallContext): EthCallParam {
654
+ try {
655
+ const iface = new Interface(["function totalSupply()"]);
656
+ const calldata = iface.encodeFunctionData("totalSupply", []);
657
+ return {
658
+ context: ethCallContext,
659
+ calldata,
660
+ };
661
+ } catch (e) {
662
+ const stack = new Error().stack;
663
+ throw transformEtherError(e, undefined, stack);
664
+ }
665
+ },
666
+ balanceOf(owner: string, ethCallContext: EthCallContext): EthCallParam {
667
+ try {
668
+ const iface = new Interface(["function balanceOf(address)"]);
669
+ const calldata = iface.encodeFunctionData("balanceOf", [owner]);
670
+ return {
671
+ context: ethCallContext,
672
+ calldata,
673
+ };
674
+ } catch (e) {
675
+ const stack = new Error().stack;
676
+ throw transformEtherError(e, undefined, stack);
677
+ }
678
+ },
679
+ getApproved(
680
+ tokenId: BigNumberish,
681
+ ethCallContext: EthCallContext
682
+ ): EthCallParam {
683
+ try {
684
+ const iface = new Interface(["function getApproved(uint256)"]);
685
+ const calldata = iface.encodeFunctionData("getApproved", [tokenId]);
686
+ return {
687
+ context: ethCallContext,
688
+ calldata,
689
+ };
690
+ } catch (e) {
691
+ const stack = new Error().stack;
692
+ throw transformEtherError(e, undefined, stack);
693
+ }
694
+ },
695
+ isApprovedForAll(
696
+ owner: string,
697
+ operator: string,
698
+ ethCallContext: EthCallContext
699
+ ): EthCallParam {
700
+ try {
701
+ const iface = new Interface([
702
+ "function isApprovedForAll(address,address)",
703
+ ]);
704
+ const calldata = iface.encodeFunctionData("isApprovedForAll", [
705
+ owner,
706
+ operator,
707
+ ]);
708
+ return {
709
+ context: ethCallContext,
710
+ calldata,
711
+ };
712
+ } catch (e) {
713
+ const stack = new Error().stack;
714
+ throw transformEtherError(e, undefined, stack);
715
+ }
716
+ },
717
+ name(ethCallContext: EthCallContext): EthCallParam {
718
+ try {
719
+ const iface = new Interface(["function name()"]);
720
+ const calldata = iface.encodeFunctionData("name", []);
721
+ return {
722
+ context: ethCallContext,
723
+ calldata,
724
+ };
725
+ } catch (e) {
726
+ const stack = new Error().stack;
727
+ throw transformEtherError(e, undefined, stack);
728
+ }
729
+ },
730
+ ownerOf(
731
+ tokenId: BigNumberish,
732
+ ethCallContext: EthCallContext
733
+ ): EthCallParam {
734
+ try {
735
+ const iface = new Interface(["function ownerOf(uint256)"]);
736
+ const calldata = iface.encodeFunctionData("ownerOf", [tokenId]);
737
+ return {
738
+ context: ethCallContext,
739
+ calldata,
740
+ };
741
+ } catch (e) {
742
+ const stack = new Error().stack;
743
+ throw transformEtherError(e, undefined, stack);
744
+ }
745
+ },
746
+ safeTransferFrom_address_address_uint256(
747
+ from: string,
748
+ to: string,
749
+ tokenId: BigNumberish,
750
+ ethCallContext: EthCallContext
751
+ ): EthCallParam {
752
+ try {
753
+ const iface = new Interface([
754
+ "function safeTransferFrom(address,address,uint256)",
755
+ ]);
756
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
757
+ from,
758
+ to,
759
+ tokenId,
760
+ ]);
761
+ return {
762
+ context: ethCallContext,
763
+ calldata,
764
+ };
765
+ } catch (e) {
766
+ const stack = new Error().stack;
767
+ throw transformEtherError(e, undefined, stack);
768
+ }
769
+ },
770
+ safeTransferFrom_address_address_uint256_bytes(
771
+ from: string,
772
+ to: string,
773
+ tokenId: BigNumberish,
774
+ data: BytesLike,
775
+ ethCallContext: EthCallContext
776
+ ): EthCallParam {
777
+ try {
778
+ const iface = new Interface([
779
+ "function safeTransferFrom(address,address,uint256,bytes)",
780
+ ]);
781
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
782
+ from,
783
+ to,
784
+ tokenId,
785
+ data,
786
+ ]);
787
+ return {
788
+ context: ethCallContext,
789
+ calldata,
790
+ };
791
+ } catch (e) {
792
+ const stack = new Error().stack;
793
+ throw transformEtherError(e, undefined, stack);
794
+ }
795
+ },
796
+ setApprovalForAll(
797
+ operator: string,
798
+ _approved: boolean,
799
+ ethCallContext: EthCallContext
800
+ ): EthCallParam {
801
+ try {
802
+ const iface = new Interface([
803
+ "function setApprovalForAll(address,bool)",
804
+ ]);
805
+ const calldata = iface.encodeFunctionData("setApprovalForAll", [
806
+ operator,
807
+ _approved,
808
+ ]);
809
+ return {
810
+ context: ethCallContext,
811
+ calldata,
812
+ };
813
+ } catch (e) {
814
+ const stack = new Error().stack;
815
+ throw transformEtherError(e, undefined, stack);
816
+ }
817
+ },
818
+ supportsInterface(
819
+ interfaceId: BytesLike,
820
+ ethCallContext: EthCallContext
821
+ ): EthCallParam {
822
+ try {
823
+ const iface = new Interface(["function supportsInterface(bytes4)"]);
824
+ const calldata = iface.encodeFunctionData("supportsInterface", [
825
+ interfaceId,
826
+ ]);
827
+ return {
828
+ context: ethCallContext,
829
+ calldata,
830
+ };
831
+ } catch (e) {
832
+ const stack = new Error().stack;
833
+ throw transformEtherError(e, undefined, stack);
834
+ }
835
+ },
836
+ symbol(ethCallContext: EthCallContext): EthCallParam {
837
+ try {
838
+ const iface = new Interface(["function symbol()"]);
839
+ const calldata = iface.encodeFunctionData("symbol", []);
840
+ return {
841
+ context: ethCallContext,
842
+ calldata,
843
+ };
844
+ } catch (e) {
845
+ const stack = new Error().stack;
846
+ throw transformEtherError(e, undefined, stack);
847
+ }
848
+ },
849
+ tokenURI(
850
+ tokenId: BigNumberish,
851
+ ethCallContext: EthCallContext
852
+ ): EthCallParam {
853
+ try {
854
+ const iface = new Interface(["function tokenURI(uint256)"]);
855
+ const calldata = iface.encodeFunctionData("tokenURI", [tokenId]);
856
+ return {
857
+ context: ethCallContext,
858
+ calldata,
859
+ };
860
+ } catch (e) {
861
+ const stack = new Error().stack;
862
+ throw transformEtherError(e, undefined, stack);
863
+ }
864
+ },
865
+ transferFrom(
866
+ from: string,
867
+ to: string,
868
+ tokenId: BigNumberish,
869
+ ethCallContext: EthCallContext
870
+ ): EthCallParam {
871
+ try {
872
+ const iface = new Interface([
873
+ "function transferFrom(address,address,uint256)",
874
+ ]);
875
+ const calldata = iface.encodeFunctionData("transferFrom", [
876
+ from,
877
+ to,
878
+ tokenId,
879
+ ]);
880
+ return {
881
+ context: ethCallContext,
882
+ calldata,
883
+ };
884
+ } catch (e) {
885
+ const stack = new Error().stack;
886
+ throw transformEtherError(e, undefined, stack);
887
+ }
888
+ },
889
+ };
347
890
  }
348
891
 
349
892
  export class ERC721BoundContractView extends BoundContractView<
@@ -351,27 +894,56 @@ export class ERC721BoundContractView extends BoundContractView<
351
894
  ERC721ContractView
352
895
  > {
353
896
  async totalSupply(overrides?: Overrides): Promise<bigint> {
354
- return await this.view.totalSupply({
355
- blockTag: this.context.blockNumber,
356
- ...overrides,
357
- });
897
+ const ethCallContext = {
898
+ chainId: this.context.chainId,
899
+ blockTag: "0x" + this.context.blockNumber.toString(16),
900
+ address: this.context.address,
901
+ };
902
+ return await this.view.totalSupply(
903
+ {
904
+ blockTag: this.context.blockNumber,
905
+ ...overrides,
906
+ },
907
+ this.context.preparedData,
908
+ ethCallContext
909
+ );
358
910
  }
359
911
 
360
912
  async balanceOf(owner: string, overrides?: Overrides): Promise<bigint> {
361
- return await this.view.balanceOf(owner, {
362
- blockTag: this.context.blockNumber,
363
- ...overrides,
364
- });
913
+ const ethCallContext = {
914
+ chainId: this.context.chainId,
915
+ blockTag: "0x" + this.context.blockNumber.toString(16),
916
+ address: this.context.address,
917
+ };
918
+ return await this.view.balanceOf(
919
+ owner,
920
+ {
921
+ blockTag: this.context.blockNumber,
922
+ ...overrides,
923
+ },
924
+ this.context.preparedData,
925
+ ethCallContext
926
+ );
365
927
  }
366
928
 
367
929
  async getApproved(
368
930
  tokenId: BigNumberish,
369
931
  overrides?: Overrides
370
932
  ): Promise<string> {
371
- return await this.view.getApproved(tokenId, {
372
- blockTag: this.context.blockNumber,
373
- ...overrides,
374
- });
933
+ const ethCallContext = {
934
+ chainId: this.context.chainId,
935
+ blockTag: "0x" + this.context.blockNumber.toString(16),
936
+ address: this.context.address,
937
+ };
938
+ return await this.view.getApproved(
939
+ tokenId,
940
+ {
941
+ blockTag: this.context.blockNumber,
942
+ ...overrides,
943
+ },
944
+ this.context.preparedData,
945
+ ethCallContext
946
+ );
375
947
  }
376
948
 
377
949
  async isApprovedForAll(
@@ -379,51 +951,110 @@ export class ERC721BoundContractView extends BoundContractView<
379
951
  operator: string,
380
952
  overrides?: Overrides
381
953
  ): Promise<boolean> {
382
- return await this.view.isApprovedForAll(owner, operator, {
383
- blockTag: this.context.blockNumber,
384
- ...overrides,
385
- });
954
+ const ethCallContext = {
955
+ chainId: this.context.chainId,
956
+ blockTag: "0x" + this.context.blockNumber.toString(16),
957
+ address: this.context.address,
958
+ };
959
+ return await this.view.isApprovedForAll(
960
+ owner,
961
+ operator,
962
+ {
963
+ blockTag: this.context.blockNumber,
964
+ ...overrides,
965
+ },
966
+ this.context.preparedData,
967
+ ethCallContext
968
+ );
386
969
  }
387
970
 
388
971
  async name(overrides?: Overrides): Promise<string> {
389
- return await this.view.name({
390
- blockTag: this.context.blockNumber,
391
- ...overrides,
392
- });
972
+ const ethCallContext = {
973
+ chainId: this.context.chainId,
974
+ blockTag: "0x" + this.context.blockNumber.toString(16),
975
+ address: this.context.address,
976
+ };
977
+ return await this.view.name(
978
+ {
979
+ blockTag: this.context.blockNumber,
980
+ ...overrides,
981
+ },
982
+ this.context.preparedData,
983
+ ethCallContext
984
+ );
393
985
  }
394
986
 
395
987
  async ownerOf(tokenId: BigNumberish, overrides?: Overrides): Promise<string> {
396
- return await this.view.ownerOf(tokenId, {
397
- blockTag: this.context.blockNumber,
398
- ...overrides,
399
- });
988
+ const ethCallContext = {
989
+ chainId: this.context.chainId,
990
+ blockTag: "0x" + this.context.blockNumber.toString(16),
991
+ address: this.context.address,
992
+ };
993
+ return await this.view.ownerOf(
994
+ tokenId,
995
+ {
996
+ blockTag: this.context.blockNumber,
997
+ ...overrides,
998
+ },
999
+ this.context.preparedData,
1000
+ ethCallContext
1001
+ );
400
1002
  }
401
1003
 
402
1004
  async supportsInterface(
403
1005
  interfaceId: BytesLike,
404
1006
  overrides?: Overrides
405
1007
  ): Promise<boolean> {
406
- return await this.view.supportsInterface(interfaceId, {
407
- blockTag: this.context.blockNumber,
408
- ...overrides,
409
- });
1008
+ const ethCallContext = {
1009
+ chainId: this.context.chainId,
1010
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1011
+ address: this.context.address,
1012
+ };
1013
+ return await this.view.supportsInterface(
1014
+ interfaceId,
1015
+ {
1016
+ blockTag: this.context.blockNumber,
1017
+ ...overrides,
1018
+ },
1019
+ this.context.preparedData,
1020
+ ethCallContext
1021
+ );
410
1022
  }
411
1023
 
412
1024
  async symbol(overrides?: Overrides): Promise<string> {
413
- return await this.view.symbol({
414
- blockTag: this.context.blockNumber,
415
- ...overrides,
416
- });
1025
+ const ethCallContext = {
1026
+ chainId: this.context.chainId,
1027
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1028
+ address: this.context.address,
1029
+ };
1030
+ return await this.view.symbol(
1031
+ {
1032
+ blockTag: this.context.blockNumber,
1033
+ ...overrides,
1034
+ },
1035
+ this.context.preparedData,
1036
+ ethCallContext
1037
+ );
417
1038
  }
418
1039
 
419
1040
  async tokenURI(
420
1041
  tokenId: BigNumberish,
421
1042
  overrides?: Overrides
422
1043
  ): Promise<string> {
423
- return await this.view.tokenURI(tokenId, {
424
- blockTag: this.context.blockNumber,
425
- ...overrides,
426
- });
1044
+ const ethCallContext = {
1045
+ chainId: this.context.chainId,
1046
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1047
+ address: this.context.address,
1048
+ };
1049
+ return await this.view.tokenURI(
1050
+ tokenId,
1051
+ {
1052
+ blockTag: this.context.blockNumber,
1053
+ ...overrides,
1054
+ },
1055
+ this.context.preparedData,
1056
+ ethCallContext
1057
+ );
427
1058
  }
428
1059
 
429
1060
  callStatic = {
@@ -435,10 +1066,21 @@ export class ERC721BoundContractView extends BoundContractView<
435
1066
  tokenId: BigNumberish,
436
1067
  overrides?: Overrides
437
1068
  ): Promise<void> {
438
- return await this.view.callStatic.approve(to, tokenId, {
439
- blockTag: this.context.blockNumber,
440
- ...overrides,
441
- });
1069
+ const ethCallContext = {
1070
+ chainId: this.context.chainId,
1071
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1072
+ address: this.context.address,
1073
+ };
1074
+ return await this.view.callStatic.approve(
1075
+ to,
1076
+ tokenId,
1077
+ {
1078
+ blockTag: this.context.blockNumber,
1079
+ ...overrides,
1080
+ },
1081
+ this.context.preparedData,
1082
+ ethCallContext
1083
+ );
442
1084
  },
443
1085
  async safeTransferFrom_address_address_uint256(
444
1086
  from: string,
@@ -446,6 +1088,11 @@ export class ERC721BoundContractView extends BoundContractView<
446
1088
  tokenId: BigNumberish,
447
1089
  overrides?: Overrides
448
1090
  ): Promise<void> {
1091
+ const ethCallContext = {
1092
+ chainId: this.context.chainId,
1093
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1094
+ address: this.context.address,
1095
+ };
449
1096
  return await this.view.callStatic.safeTransferFrom_address_address_uint256(
450
1097
  from,
451
1098
  to,
@@ -453,7 +1100,9 @@ export class ERC721BoundContractView extends BoundContractView<
453
1100
  {
454
1101
  blockTag: this.context.blockNumber,
455
1102
  ...overrides,
456
- }
1103
+ },
1104
+ this.context.preparedData,
1105
+ ethCallContext
457
1106
  );
458
1107
  },
459
1108
  async safeTransferFrom_address_address_uint256_bytes(
@@ -463,6 +1112,11 @@ export class ERC721BoundContractView extends BoundContractView<
463
1112
  data: BytesLike,
464
1113
  overrides?: Overrides
465
1114
  ): Promise<void> {
1115
+ const ethCallContext = {
1116
+ chainId: this.context.chainId,
1117
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1118
+ address: this.context.address,
1119
+ };
466
1120
  return await this.view.callStatic.safeTransferFrom_address_address_uint256_bytes(
467
1121
  from,
468
1122
  to,
@@ -471,7 +1125,9 @@ export class ERC721BoundContractView extends BoundContractView<
471
1125
  {
472
1126
  blockTag: this.context.blockNumber,
473
1127
  ...overrides,
474
- }
1128
+ },
1129
+ this.context.preparedData,
1130
+ ethCallContext
475
1131
  );
476
1132
  },
477
1133
  async setApprovalForAll(
@@ -479,10 +1135,21 @@ export class ERC721BoundContractView extends BoundContractView<
479
1135
  _approved: boolean,
480
1136
  overrides?: Overrides
481
1137
  ): Promise<void> {
482
- return await this.view.callStatic.setApprovalForAll(operator, _approved, {
483
- blockTag: this.context.blockNumber,
484
- ...overrides,
485
- });
1138
+ const ethCallContext = {
1139
+ chainId: this.context.chainId,
1140
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1141
+ address: this.context.address,
1142
+ };
1143
+ return await this.view.callStatic.setApprovalForAll(
1144
+ operator,
1145
+ _approved,
1146
+ {
1147
+ blockTag: this.context.blockNumber,
1148
+ ...overrides,
1149
+ },
1150
+ this.context.preparedData,
1151
+ ethCallContext
1152
+ );
486
1153
  },
487
1154
  async transferFrom(
488
1155
  from: string,
@@ -490,9 +1157,301 @@ export class ERC721BoundContractView extends BoundContractView<
490
1157
  tokenId: BigNumberish,
491
1158
  overrides?: Overrides
492
1159
  ): Promise<void> {
493
- return await this.view.callStatic.transferFrom(from, to, tokenId, {
494
- blockTag: this.context.blockNumber,
495
- ...overrides,
1160
+ const ethCallContext = {
1161
+ chainId: this.context.chainId,
1162
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1163
+ address: this.context.address,
1164
+ };
1165
+ return await this.view.callStatic.transferFrom(
1166
+ from,
1167
+ to,
1168
+ tokenId,
1169
+ {
1170
+ blockTag: this.context.blockNumber,
1171
+ ...overrides,
1172
+ },
1173
+ this.context.preparedData,
1174
+ ethCallContext
1175
+ );
1176
+ },
1177
+ };
1178
+
1179
+ encodeCall = {
1180
+ view: this.view,
1181
+ context: this.context,
1182
+
1183
+ approve(
1184
+ to: string,
1185
+ tokenId: BigNumberish,
1186
+ overrides?: Overrides
1187
+ ): EthCallParam {
1188
+ const chainId =
1189
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1190
+ const address = this.context.address;
1191
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1192
+ if (overrides?.blockTag) {
1193
+ blockTag =
1194
+ typeof overrides.blockTag == "string"
1195
+ ? overrides.blockTag
1196
+ : "0x" + overrides.blockTag.toString(16);
1197
+ }
1198
+
1199
+ return this.view.encodeCall.approve(to, tokenId, {
1200
+ chainId,
1201
+ address,
1202
+ blockTag,
1203
+ });
1204
+ },
1205
+ totalSupply(overrides?: Overrides): EthCallParam {
1206
+ const chainId =
1207
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1208
+ const address = this.context.address;
1209
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1210
+ if (overrides?.blockTag) {
1211
+ blockTag =
1212
+ typeof overrides.blockTag == "string"
1213
+ ? overrides.blockTag
1214
+ : "0x" + overrides.blockTag.toString(16);
1215
+ }
1216
+
1217
+ return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
1218
+ },
1219
+ balanceOf(owner: string, overrides?: Overrides): EthCallParam {
1220
+ const chainId =
1221
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1222
+ const address = this.context.address;
1223
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1224
+ if (overrides?.blockTag) {
1225
+ blockTag =
1226
+ typeof overrides.blockTag == "string"
1227
+ ? overrides.blockTag
1228
+ : "0x" + overrides.blockTag.toString(16);
1229
+ }
1230
+
1231
+ return this.view.encodeCall.balanceOf(owner, {
1232
+ chainId,
1233
+ address,
1234
+ blockTag,
1235
+ });
1236
+ },
1237
+ getApproved(tokenId: BigNumberish, overrides?: Overrides): EthCallParam {
1238
+ const chainId =
1239
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1240
+ const address = this.context.address;
1241
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1242
+ if (overrides?.blockTag) {
1243
+ blockTag =
1244
+ typeof overrides.blockTag == "string"
1245
+ ? overrides.blockTag
1246
+ : "0x" + overrides.blockTag.toString(16);
1247
+ }
1248
+
1249
+ return this.view.encodeCall.getApproved(tokenId, {
1250
+ chainId,
1251
+ address,
1252
+ blockTag,
1253
+ });
1254
+ },
1255
+ isApprovedForAll(
1256
+ owner: string,
1257
+ operator: string,
1258
+ overrides?: Overrides
1259
+ ): EthCallParam {
1260
+ const chainId =
1261
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1262
+ const address = this.context.address;
1263
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1264
+ if (overrides?.blockTag) {
1265
+ blockTag =
1266
+ typeof overrides.blockTag == "string"
1267
+ ? overrides.blockTag
1268
+ : "0x" + overrides.blockTag.toString(16);
1269
+ }
1270
+
1271
+ return this.view.encodeCall.isApprovedForAll(owner, operator, {
1272
+ chainId,
1273
+ address,
1274
+ blockTag,
1275
+ });
1276
+ },
1277
+ name(overrides?: Overrides): EthCallParam {
1278
+ const chainId =
1279
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1280
+ const address = this.context.address;
1281
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1282
+ if (overrides?.blockTag) {
1283
+ blockTag =
1284
+ typeof overrides.blockTag == "string"
1285
+ ? overrides.blockTag
1286
+ : "0x" + overrides.blockTag.toString(16);
1287
+ }
1288
+
1289
+ return this.view.encodeCall.name({ chainId, address, blockTag });
1290
+ },
1291
+ ownerOf(tokenId: BigNumberish, overrides?: Overrides): EthCallParam {
1292
+ const chainId =
1293
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1294
+ const address = this.context.address;
1295
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1296
+ if (overrides?.blockTag) {
1297
+ blockTag =
1298
+ typeof overrides.blockTag == "string"
1299
+ ? overrides.blockTag
1300
+ : "0x" + overrides.blockTag.toString(16);
1301
+ }
1302
+
1303
+ return this.view.encodeCall.ownerOf(tokenId, {
1304
+ chainId,
1305
+ address,
1306
+ blockTag,
1307
+ });
1308
+ },
1309
+ safeTransferFrom_address_address_uint256(
1310
+ from: string,
1311
+ to: string,
1312
+ tokenId: BigNumberish,
1313
+ overrides?: Overrides
1314
+ ): EthCallParam {
1315
+ const chainId =
1316
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1317
+ const address = this.context.address;
1318
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1319
+ if (overrides?.blockTag) {
1320
+ blockTag =
1321
+ typeof overrides.blockTag == "string"
1322
+ ? overrides.blockTag
1323
+ : "0x" + overrides.blockTag.toString(16);
1324
+ }
1325
+
1326
+ return this.view.encodeCall.safeTransferFrom_address_address_uint256(
1327
+ from,
1328
+ to,
1329
+ tokenId,
1330
+ { chainId, address, blockTag }
1331
+ );
1332
+ },
1333
+ safeTransferFrom_address_address_uint256_bytes(
1334
+ from: string,
1335
+ to: string,
1336
+ tokenId: BigNumberish,
1337
+ data: BytesLike,
1338
+ overrides?: Overrides
1339
+ ): EthCallParam {
1340
+ const chainId =
1341
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1342
+ const address = this.context.address;
1343
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1344
+ if (overrides?.blockTag) {
1345
+ blockTag =
1346
+ typeof overrides.blockTag == "string"
1347
+ ? overrides.blockTag
1348
+ : "0x" + overrides.blockTag.toString(16);
1349
+ }
1350
+
1351
+ return this.view.encodeCall.safeTransferFrom_address_address_uint256_bytes(
1352
+ from,
1353
+ to,
1354
+ tokenId,
1355
+ data,
1356
+ { chainId, address, blockTag }
1357
+ );
1358
+ },
1359
+ setApprovalForAll(
1360
+ operator: string,
1361
+ _approved: boolean,
1362
+ overrides?: Overrides
1363
+ ): EthCallParam {
1364
+ const chainId =
1365
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1366
+ const address = this.context.address;
1367
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1368
+ if (overrides?.blockTag) {
1369
+ blockTag =
1370
+ typeof overrides.blockTag == "string"
1371
+ ? overrides.blockTag
1372
+ : "0x" + overrides.blockTag.toString(16);
1373
+ }
1374
+
1375
+ return this.view.encodeCall.setApprovalForAll(operator, _approved, {
1376
+ chainId,
1377
+ address,
1378
+ blockTag,
1379
+ });
1380
+ },
1381
+ supportsInterface(
1382
+ interfaceId: BytesLike,
1383
+ overrides?: Overrides
1384
+ ): EthCallParam {
1385
+ const chainId =
1386
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1387
+ const address = this.context.address;
1388
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1389
+ if (overrides?.blockTag) {
1390
+ blockTag =
1391
+ typeof overrides.blockTag == "string"
1392
+ ? overrides.blockTag
1393
+ : "0x" + overrides.blockTag.toString(16);
1394
+ }
1395
+
1396
+ return this.view.encodeCall.supportsInterface(interfaceId, {
1397
+ chainId,
1398
+ address,
1399
+ blockTag,
1400
+ });
1401
+ },
1402
+ symbol(overrides?: Overrides): EthCallParam {
1403
+ const chainId =
1404
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1405
+ const address = this.context.address;
1406
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1407
+ if (overrides?.blockTag) {
1408
+ blockTag =
1409
+ typeof overrides.blockTag == "string"
1410
+ ? overrides.blockTag
1411
+ : "0x" + overrides.blockTag.toString(16);
1412
+ }
1413
+
1414
+ return this.view.encodeCall.symbol({ chainId, address, blockTag });
1415
+ },
1416
+ tokenURI(tokenId: BigNumberish, overrides?: Overrides): EthCallParam {
1417
+ const chainId =
1418
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1419
+ const address = this.context.address;
1420
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1421
+ if (overrides?.blockTag) {
1422
+ blockTag =
1423
+ typeof overrides.blockTag == "string"
1424
+ ? overrides.blockTag
1425
+ : "0x" + overrides.blockTag.toString(16);
1426
+ }
1427
+
1428
+ return this.view.encodeCall.tokenURI(tokenId, {
1429
+ chainId,
1430
+ address,
1431
+ blockTag,
1432
+ });
1433
+ },
1434
+ transferFrom(
1435
+ from: string,
1436
+ to: string,
1437
+ tokenId: BigNumberish,
1438
+ overrides?: Overrides
1439
+ ): EthCallParam {
1440
+ const chainId =
1441
+ overrides?.chainId?.toString() ?? this.context.chainId.toString();
1442
+ const address = this.context.address;
1443
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1444
+ if (overrides?.blockTag) {
1445
+ blockTag =
1446
+ typeof overrides.blockTag == "string"
1447
+ ? overrides.blockTag
1448
+ : "0x" + overrides.blockTag.toString(16);
1449
+ }
1450
+
1451
+ return this.view.encodeCall.transferFrom(from, to, tokenId, {
1452
+ chainId,
1453
+ address,
1454
+ blockTag,
496
1455
  });
497
1456
  },
498
1457
  };
@@ -510,7 +1469,8 @@ export class ERC721Processor extends BaseProcessor<
510
1469
  fetchConfig?: Partial<EthFetchConfig>,
511
1470
  preprocessHandler?: (
512
1471
  event: ApprovalEvent,
513
- ctx: ERC721Context
1472
+ ctx: ERC721Context,
1473
+ preprocessStore: { [k: string]: any }
514
1474
  ) => Promise<PreprocessResult>
515
1475
  ): this {
516
1476
  if (!filter) {
@@ -529,7 +1489,8 @@ export class ERC721Processor extends BaseProcessor<
529
1489
  fetchConfig?: Partial<EthFetchConfig>,
530
1490
  preprocessHandler?: (
531
1491
  event: ApprovalForAllEvent,
532
- ctx: ERC721Context
1492
+ ctx: ERC721Context,
1493
+ preprocessStore: { [k: string]: any }
533
1494
  ) => Promise<PreprocessResult>
534
1495
  ): this {
535
1496
  if (!filter) {
@@ -548,7 +1509,8 @@ export class ERC721Processor extends BaseProcessor<
548
1509
  fetchConfig?: Partial<EthFetchConfig>,
549
1510
  preprocessHandler?: (
550
1511
  event: TransferEvent,
551
- ctx: ERC721Context
1512
+ ctx: ERC721Context,
1513
+ preprocessStore: { [k: string]: any }
552
1514
  ) => Promise<PreprocessResult>
553
1515
  ): this {
554
1516
  if (!filter) {
@@ -867,7 +1829,8 @@ export class ERC721ProcessorTemplate extends BaseProcessorTemplate<
867
1829
  fetchConfig?: Partial<EthFetchConfig>,
868
1830
  preprocessHandler?: (
869
1831
  event: ApprovalEvent,
870
- ctx: ERC721Context
1832
+ ctx: ERC721Context,
1833
+ preprocessStore: { [k: string]: any }
871
1834
  ) => Promise<PreprocessResult>
872
1835
  ): this {
873
1836
  if (!filter) {
@@ -886,7 +1849,8 @@ export class ERC721ProcessorTemplate extends BaseProcessorTemplate<
886
1849
  fetchConfig?: Partial<EthFetchConfig>,
887
1850
  preprocessHandler?: (
888
1851
  event: ApprovalForAllEvent,
889
- ctx: ERC721Context
1852
+ ctx: ERC721Context,
1853
+ preprocessStore: { [k: string]: any }
890
1854
  ) => Promise<PreprocessResult>
891
1855
  ): this {
892
1856
  if (!filter) {
@@ -905,7 +1869,8 @@ export class ERC721ProcessorTemplate extends BaseProcessorTemplate<
905
1869
  fetchConfig?: Partial<EthFetchConfig>,
906
1870
  preprocessHandler?: (
907
1871
  event: TransferEvent,
908
- ctx: ERC721Context
1872
+ ctx: ERC721Context,
1873
+ preprocessStore: { [k: string]: any }
909
1874
  ) => Promise<PreprocessResult>
910
1875
  ): this {
911
1876
  if (!filter) {