@sentio/sdk 2.40.0-rc.2 → 2.40.0-rc.21

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 (135) 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/eth/account-processor.d.ts +21 -7
  17. package/lib/eth/account-processor.d.ts.map +1 -1
  18. package/lib/eth/account-processor.js +2 -2
  19. package/lib/eth/account-processor.js.map +1 -1
  20. package/lib/eth/base-processor-template.d.ts +24 -8
  21. package/lib/eth/base-processor-template.d.ts.map +1 -1
  22. package/lib/eth/base-processor-template.js.map +1 -1
  23. package/lib/eth/base-processor.d.ts +30 -10
  24. package/lib/eth/base-processor.d.ts.map +1 -1
  25. package/lib/eth/base-processor.js +6 -6
  26. package/lib/eth/base-processor.js.map +1 -1
  27. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +100 -31
  28. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  29. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +1295 -46
  30. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  31. package/lib/eth/builtin/internal/erc1155-processor.d.ts +55 -16
  32. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  33. package/lib/eth/builtin/internal/erc1155-processor.js +510 -16
  34. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  35. package/lib/eth/builtin/internal/erc20-processor.d.ts +79 -24
  36. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  37. package/lib/eth/builtin/internal/erc20-processor.js +1039 -36
  38. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  39. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +46 -13
  40. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  41. package/lib/eth/builtin/internal/erc20bytes-processor.js +512 -18
  42. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  43. package/lib/eth/builtin/internal/erc721-processor.d.ts +67 -20
  44. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  45. package/lib/eth/builtin/internal/erc721-processor.js +826 -28
  46. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  47. package/lib/eth/builtin/internal/weth9-processor.d.ts +64 -19
  48. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  49. package/lib/eth/builtin/internal/weth9-processor.js +607 -22
  50. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  51. package/lib/eth/codegen/event-handler.js +1 -1
  52. package/lib/eth/codegen/file.d.ts.map +1 -1
  53. package/lib/eth/codegen/file.js +21 -3
  54. package/lib/eth/codegen/file.js.map +1 -1
  55. package/lib/eth/codegen/function-calls.d.ts +4 -0
  56. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  57. package/lib/eth/codegen/function-calls.js +83 -5
  58. package/lib/eth/codegen/function-calls.js.map +1 -1
  59. package/lib/eth/codegen/types.d.ts +1 -0
  60. package/lib/eth/codegen/types.d.ts.map +1 -1
  61. package/lib/eth/codegen/types.js +13 -0
  62. package/lib/eth/codegen/types.js.map +1 -1
  63. package/lib/eth/context.d.ts +4 -0
  64. package/lib/eth/context.d.ts.map +1 -1
  65. package/lib/eth/context.js +4 -0
  66. package/lib/eth/context.js.map +1 -1
  67. package/lib/eth/eth-plugin.d.ts +27 -9
  68. package/lib/eth/eth-plugin.d.ts.map +1 -1
  69. package/lib/eth/eth-plugin.js +17 -17
  70. package/lib/eth/eth-plugin.js.map +1 -1
  71. package/lib/eth/generic-processor.test.js.map +1 -1
  72. package/lib/eth/index.d.ts +1 -0
  73. package/lib/eth/index.d.ts.map +1 -1
  74. package/lib/eth/index.js +1 -0
  75. package/lib/eth/index.js.map +1 -1
  76. package/lib/solana/builtin/spl-token-processor.d.ts +1 -1
  77. package/lib/solana/builtin/spl-token-processor.d.ts.map +1 -1
  78. package/lib/solana/builtin/spl-token-processor.js +1 -1
  79. package/lib/solana/builtin/spl-token-processor.js.map +1 -1
  80. package/lib/solana/solana-context.d.ts +1 -1
  81. package/lib/solana/solana-context.js +2 -2
  82. package/lib/store/cache.d.ts +14 -0
  83. package/lib/store/cache.d.ts.map +1 -0
  84. package/lib/store/cache.js +35 -0
  85. package/lib/store/cache.js.map +1 -0
  86. package/lib/store/store.d.ts +2 -3
  87. package/lib/store/store.d.ts.map +1 -1
  88. package/lib/store/store.js +33 -8
  89. package/lib/store/store.js.map +1 -1
  90. package/lib/sui/context.d.ts +1 -1
  91. package/lib/sui/context.d.ts.map +1 -1
  92. package/lib/sui/sui-processor.d.ts +1 -1
  93. package/lib/sui/sui-processor.d.ts.map +1 -1
  94. package/lib/sui/sui-processor.js +1 -1
  95. package/lib/sui/sui-processor.js.map +1 -1
  96. package/lib/testing/aptos-facet.d.ts +1 -1
  97. package/lib/testing/aptos-facet.js +2 -2
  98. package/lib/testing/sui-facet.js +1 -1
  99. package/lib/utils/dex-price.d.ts +1 -0
  100. package/lib/utils/dex-price.d.ts.map +1 -1
  101. package/lib/utils/dex-price.js +13 -2
  102. package/lib/utils/dex-price.js.map +1 -1
  103. package/package.json +8 -7
  104. package/src/aptos/aptos-processor.ts +1 -1
  105. package/src/aptos/context.ts +2 -2
  106. package/src/aptos/ext/aptos-dex.ts +1 -1
  107. package/src/aptos/ext/coin-event.ts +1 -1
  108. package/src/aptos/ext/coin.ts +2 -2
  109. package/src/eth/account-processor.ts +28 -12
  110. package/src/eth/base-processor-template.ts +16 -8
  111. package/src/eth/base-processor.ts +25 -16
  112. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1643 -123
  113. package/src/eth/builtin/internal/erc1155-processor.ts +724 -42
  114. package/src/eth/builtin/internal/erc20-processor.ts +1368 -90
  115. package/src/eth/builtin/internal/erc20bytes-processor.ts +685 -49
  116. package/src/eth/builtin/internal/erc721-processor.ts +1116 -70
  117. package/src/eth/builtin/internal/weth9-processor.ts +798 -63
  118. package/src/eth/codegen/event-handler.ts +1 -1
  119. package/src/eth/codegen/file.ts +26 -3
  120. package/src/eth/codegen/function-calls.ts +101 -8
  121. package/src/eth/codegen/types.ts +22 -1
  122. package/src/eth/context.ts +7 -0
  123. package/src/eth/eth-plugin.ts +31 -26
  124. package/src/eth/index.ts +2 -0
  125. package/src/solana/builtin/spl-token-processor.ts +1 -1
  126. package/src/solana/solana-context.ts +2 -2
  127. package/src/store/cache.ts +46 -0
  128. package/src/store/store.ts +39 -21
  129. package/src/sui/context.ts +1 -1
  130. package/src/sui/sui-processor.ts +1 -1
  131. package/src/testing/aptos-facet.ts +2 -2
  132. package/src/testing/sui-facet.ts +1 -1
  133. package/src/utils/dex-price.ts +15 -2
  134. package/lib/utils/chainlink-oracles-sepolia.csv +0 -19
  135. package/lib/utils/chainlink-oracles.csv +0 -217
@@ -1,4 +1,8 @@
1
- import { addContractByABI, getContractByABI, addProcessor, getProcessor, getProvider, transformEtherError, BaseProcessor, BaseProcessorTemplate, BoundContractView, ContractView, DummyProvider, } from "@sentio/sdk/eth";
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, makeEthCallKey, } from "@sentio/sdk/eth";
2
6
  import { WETH9__factory } from "./index.js";
3
7
  const templateContract = WETH9__factory.connect("0x0", DummyProvider);
4
8
  export class WETH9ContractView extends ContractView {
@@ -6,8 +10,24 @@ export class WETH9ContractView extends ContractView {
6
10
  super(contract);
7
11
  this.callStatic.contract = contract;
8
12
  }
9
- async name(overrides) {
13
+ async name(overrides, preparedData, ethCallContext) {
10
14
  try {
15
+ if (preparedData?.ethCallResults && ethCallContext) {
16
+ const iface = new Interface(["function name() view returns (string)"]);
17
+ const calldata = iface.encodeFunctionData("name", []);
18
+ const key = makeEthCallKey({
19
+ context: ethCallContext,
20
+ calldata,
21
+ });
22
+ console.debug("looking up eth call key:", key);
23
+ const ret = preparedData.ethCallResults[key];
24
+ if (ret) {
25
+ console.debug("prepared eth call found:", key);
26
+ const result = iface.decodeFunctionResult("name", ret).toArray();
27
+ return result.length == 1 ? result[0] : result;
28
+ }
29
+ console.debug("missing eth call key:", "name", key);
30
+ }
11
31
  return await this.contract.getFunction("name()")(overrides || {});
12
32
  }
13
33
  catch (e) {
@@ -15,8 +35,28 @@ export class WETH9ContractView extends ContractView {
15
35
  throw transformEtherError(e, undefined, stack);
16
36
  }
17
37
  }
18
- async totalSupply(overrides) {
38
+ async totalSupply(overrides, preparedData, ethCallContext) {
19
39
  try {
40
+ if (preparedData?.ethCallResults && ethCallContext) {
41
+ const iface = new Interface([
42
+ "function totalSupply() view returns (uint256)",
43
+ ]);
44
+ const calldata = iface.encodeFunctionData("totalSupply", []);
45
+ const key = makeEthCallKey({
46
+ context: ethCallContext,
47
+ calldata,
48
+ });
49
+ console.debug("looking up eth call key:", key);
50
+ const ret = preparedData.ethCallResults[key];
51
+ if (ret) {
52
+ console.debug("prepared eth call found:", key);
53
+ const result = iface
54
+ .decodeFunctionResult("totalSupply", ret)
55
+ .toArray();
56
+ return result.length == 1 ? result[0] : result;
57
+ }
58
+ console.debug("missing eth call key:", "totalSupply", key);
59
+ }
20
60
  return await this.contract.getFunction("totalSupply()")(overrides || {});
21
61
  }
22
62
  catch (e) {
@@ -24,8 +64,26 @@ export class WETH9ContractView extends ContractView {
24
64
  throw transformEtherError(e, undefined, stack);
25
65
  }
26
66
  }
27
- async decimals(overrides) {
67
+ async decimals(overrides, preparedData, ethCallContext) {
28
68
  try {
69
+ if (preparedData?.ethCallResults && ethCallContext) {
70
+ const iface = new Interface([
71
+ "function decimals() view returns (uint8)",
72
+ ]);
73
+ const calldata = iface.encodeFunctionData("decimals", []);
74
+ const key = makeEthCallKey({
75
+ context: ethCallContext,
76
+ calldata,
77
+ });
78
+ console.debug("looking up eth call key:", key);
79
+ const ret = preparedData.ethCallResults[key];
80
+ if (ret) {
81
+ console.debug("prepared eth call found:", key);
82
+ const result = iface.decodeFunctionResult("decimals", ret).toArray();
83
+ return result.length == 1 ? result[0] : result;
84
+ }
85
+ console.debug("missing eth call key:", "decimals", key);
86
+ }
29
87
  return await this.contract.getFunction("decimals()")(overrides || {});
30
88
  }
31
89
  catch (e) {
@@ -33,8 +91,26 @@ export class WETH9ContractView extends ContractView {
33
91
  throw transformEtherError(e, undefined, stack);
34
92
  }
35
93
  }
36
- async balanceOf(arg0, overrides) {
94
+ async balanceOf(arg0, overrides, preparedData, ethCallContext) {
37
95
  try {
96
+ if (preparedData?.ethCallResults && ethCallContext) {
97
+ const iface = new Interface([
98
+ "function balanceOf(address) view returns (uint256)",
99
+ ]);
100
+ const calldata = iface.encodeFunctionData("balanceOf", [arg0]);
101
+ const key = makeEthCallKey({
102
+ context: ethCallContext,
103
+ calldata,
104
+ });
105
+ console.debug("looking up eth call key:", key);
106
+ const ret = preparedData.ethCallResults[key];
107
+ if (ret) {
108
+ console.debug("prepared eth call found:", key);
109
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
110
+ return result.length == 1 ? result[0] : result;
111
+ }
112
+ console.debug("missing eth call key:", "balanceOf", arg0, key);
113
+ }
38
114
  return await this.contract.getFunction("balanceOf(address)")(arg0, overrides || {});
39
115
  }
40
116
  catch (e) {
@@ -42,8 +118,26 @@ export class WETH9ContractView extends ContractView {
42
118
  throw transformEtherError(e, undefined, stack);
43
119
  }
44
120
  }
45
- async symbol(overrides) {
121
+ async symbol(overrides, preparedData, ethCallContext) {
46
122
  try {
123
+ if (preparedData?.ethCallResults && ethCallContext) {
124
+ const iface = new Interface([
125
+ "function symbol() view returns (string)",
126
+ ]);
127
+ const calldata = iface.encodeFunctionData("symbol", []);
128
+ const key = makeEthCallKey({
129
+ context: ethCallContext,
130
+ calldata,
131
+ });
132
+ console.debug("looking up eth call key:", key);
133
+ const ret = preparedData.ethCallResults[key];
134
+ if (ret) {
135
+ console.debug("prepared eth call found:", key);
136
+ const result = iface.decodeFunctionResult("symbol", ret).toArray();
137
+ return result.length == 1 ? result[0] : result;
138
+ }
139
+ console.debug("missing eth call key:", "symbol", key);
140
+ }
47
141
  return await this.contract.getFunction("symbol()")(overrides || {});
48
142
  }
49
143
  catch (e) {
@@ -51,8 +145,26 @@ export class WETH9ContractView extends ContractView {
51
145
  throw transformEtherError(e, undefined, stack);
52
146
  }
53
147
  }
54
- async allowance(arg0, arg1, overrides) {
148
+ async allowance(arg0, arg1, overrides, preparedData, ethCallContext) {
55
149
  try {
150
+ if (preparedData?.ethCallResults && ethCallContext) {
151
+ const iface = new Interface([
152
+ "function allowance(address,address) view returns (uint256)",
153
+ ]);
154
+ const calldata = iface.encodeFunctionData("allowance", [arg0, arg1]);
155
+ const key = makeEthCallKey({
156
+ context: ethCallContext,
157
+ calldata,
158
+ });
159
+ console.debug("looking up eth call key:", key);
160
+ const ret = preparedData.ethCallResults[key];
161
+ if (ret) {
162
+ console.debug("prepared eth call found:", key);
163
+ const result = iface.decodeFunctionResult("allowance", ret).toArray();
164
+ return result.length == 1 ? result[0] : result;
165
+ }
166
+ console.debug("missing eth call key:", "allowance", arg0, arg1, key);
167
+ }
56
168
  return await this.contract.getFunction("allowance(address,address)")(arg0, arg1, overrides || {});
57
169
  }
58
170
  catch (e) {
@@ -62,8 +174,26 @@ export class WETH9ContractView extends ContractView {
62
174
  }
63
175
  callStatic = {
64
176
  contract: this.contract,
65
- async approve(guy, wad, overrides) {
177
+ async approve(guy, wad, overrides, preparedData, ethCallContext) {
66
178
  try {
179
+ if (preparedData?.ethCallResults && ethCallContext) {
180
+ const iface = new Interface([
181
+ "function approve(address,uint256) nonpayable returns (bool)",
182
+ ]);
183
+ const calldata = iface.encodeFunctionData("approve", [guy, wad]);
184
+ const key = makeEthCallKey({
185
+ context: ethCallContext,
186
+ calldata,
187
+ });
188
+ console.debug("looking up eth call key:", key);
189
+ const ret = preparedData.ethCallResults[key];
190
+ if (ret) {
191
+ console.debug("prepared eth call found:", key);
192
+ const result = iface.decodeFunctionResult("approve", ret).toArray();
193
+ return result.length == 1 ? result[0] : result;
194
+ }
195
+ console.debug("missing eth call key:", "approve", guy, wad, key);
196
+ }
67
197
  return await this.contract
68
198
  .getFunction("approve(address,uint256)")
69
199
  .staticCall(guy, wad, overrides || {});
@@ -73,8 +203,32 @@ export class WETH9ContractView extends ContractView {
73
203
  throw transformEtherError(e, undefined, stack);
74
204
  }
75
205
  },
76
- async transferFrom(src, dst, wad, overrides) {
206
+ async transferFrom(src, dst, wad, overrides, preparedData, ethCallContext) {
77
207
  try {
208
+ if (preparedData?.ethCallResults && ethCallContext) {
209
+ const iface = new Interface([
210
+ "function transferFrom(address,address,uint256) nonpayable returns (bool)",
211
+ ]);
212
+ const calldata = iface.encodeFunctionData("transferFrom", [
213
+ src,
214
+ dst,
215
+ wad,
216
+ ]);
217
+ const key = makeEthCallKey({
218
+ context: ethCallContext,
219
+ calldata,
220
+ });
221
+ console.debug("looking up eth call key:", key);
222
+ const ret = preparedData.ethCallResults[key];
223
+ if (ret) {
224
+ console.debug("prepared eth call found:", key);
225
+ const result = iface
226
+ .decodeFunctionResult("transferFrom", ret)
227
+ .toArray();
228
+ return result.length == 1 ? result[0] : result;
229
+ }
230
+ console.debug("missing eth call key:", "transferFrom", src, dst, wad, key);
231
+ }
78
232
  return await this.contract
79
233
  .getFunction("transferFrom(address,address,uint256)")
80
234
  .staticCall(src, dst, wad, overrides || {});
@@ -84,8 +238,28 @@ export class WETH9ContractView extends ContractView {
84
238
  throw transformEtherError(e, undefined, stack);
85
239
  }
86
240
  },
87
- async withdraw(wad, overrides) {
241
+ async withdraw(wad, overrides, preparedData, ethCallContext) {
88
242
  try {
243
+ if (preparedData?.ethCallResults && ethCallContext) {
244
+ const iface = new Interface([
245
+ "function withdraw(uint256) nonpayable returns ()",
246
+ ]);
247
+ const calldata = iface.encodeFunctionData("withdraw", [wad]);
248
+ const key = makeEthCallKey({
249
+ context: ethCallContext,
250
+ calldata,
251
+ });
252
+ console.debug("looking up eth call key:", key);
253
+ const ret = preparedData.ethCallResults[key];
254
+ if (ret) {
255
+ console.debug("prepared eth call found:", key);
256
+ const result = iface
257
+ .decodeFunctionResult("withdraw", ret)
258
+ .toArray();
259
+ return result.length == 1 ? result[0] : result;
260
+ }
261
+ console.debug("missing eth call key:", "withdraw", wad, key);
262
+ }
89
263
  return await this.contract
90
264
  .getFunction("withdraw(uint256)")
91
265
  .staticCall(wad, overrides || {});
@@ -95,8 +269,28 @@ export class WETH9ContractView extends ContractView {
95
269
  throw transformEtherError(e, undefined, stack);
96
270
  }
97
271
  },
98
- async transfer(dst, wad, overrides) {
272
+ async transfer(dst, wad, overrides, preparedData, ethCallContext) {
99
273
  try {
274
+ if (preparedData?.ethCallResults && ethCallContext) {
275
+ const iface = new Interface([
276
+ "function transfer(address,uint256) nonpayable returns (bool)",
277
+ ]);
278
+ const calldata = iface.encodeFunctionData("transfer", [dst, wad]);
279
+ const key = makeEthCallKey({
280
+ context: ethCallContext,
281
+ calldata,
282
+ });
283
+ console.debug("looking up eth call key:", key);
284
+ const ret = preparedData.ethCallResults[key];
285
+ if (ret) {
286
+ console.debug("prepared eth call found:", key);
287
+ const result = iface
288
+ .decodeFunctionResult("transfer", ret)
289
+ .toArray();
290
+ return result.length == 1 ? result[0] : result;
291
+ }
292
+ console.debug("missing eth call key:", "transfer", dst, wad, key);
293
+ }
100
294
  return await this.contract
101
295
  .getFunction("transfer(address,uint256)")
102
296
  .staticCall(dst, wad, overrides || {});
@@ -106,8 +300,26 @@ export class WETH9ContractView extends ContractView {
106
300
  throw transformEtherError(e, undefined, stack);
107
301
  }
108
302
  },
109
- async deposit(overrides) {
303
+ async deposit(overrides, preparedData, ethCallContext) {
110
304
  try {
305
+ if (preparedData?.ethCallResults && ethCallContext) {
306
+ const iface = new Interface([
307
+ "function deposit() payable returns ()",
308
+ ]);
309
+ const calldata = iface.encodeFunctionData("deposit", []);
310
+ const key = makeEthCallKey({
311
+ context: ethCallContext,
312
+ calldata,
313
+ });
314
+ console.debug("looking up eth call key:", key);
315
+ const ret = preparedData.ethCallResults[key];
316
+ if (ret) {
317
+ console.debug("prepared eth call found:", key);
318
+ const result = iface.decodeFunctionResult("deposit", ret).toArray();
319
+ return result.length == 1 ? result[0] : result;
320
+ }
321
+ console.debug("missing eth call key:", "deposit", key);
322
+ }
111
323
  return await this.contract
112
324
  .getFunction("deposit()")
113
325
  .staticCall(overrides || {});
@@ -118,75 +330,448 @@ export class WETH9ContractView extends ContractView {
118
330
  }
119
331
  },
120
332
  };
333
+ encodeCall = {
334
+ name(ethCallContext) {
335
+ try {
336
+ const iface = new Interface(["function name()"]);
337
+ const calldata = iface.encodeFunctionData("name", []);
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
+ }
347
+ },
348
+ approve(guy, wad, ethCallContext) {
349
+ try {
350
+ const iface = new Interface(["function approve(address,uint256)"]);
351
+ const calldata = iface.encodeFunctionData("approve", [guy, wad]);
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
+ }
361
+ },
362
+ totalSupply(ethCallContext) {
363
+ try {
364
+ const iface = new Interface(["function totalSupply()"]);
365
+ const calldata = iface.encodeFunctionData("totalSupply", []);
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
+ }
375
+ },
376
+ transferFrom(src, dst, wad, ethCallContext) {
377
+ try {
378
+ const iface = new Interface([
379
+ "function transferFrom(address,address,uint256)",
380
+ ]);
381
+ const calldata = iface.encodeFunctionData("transferFrom", [
382
+ src,
383
+ dst,
384
+ wad,
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
+ }
395
+ },
396
+ withdraw(wad, ethCallContext) {
397
+ try {
398
+ const iface = new Interface(["function withdraw(uint256)"]);
399
+ const calldata = iface.encodeFunctionData("withdraw", [wad]);
400
+ return {
401
+ context: ethCallContext,
402
+ calldata,
403
+ };
404
+ }
405
+ catch (e) {
406
+ const stack = new Error().stack;
407
+ throw transformEtherError(e, undefined, stack);
408
+ }
409
+ },
410
+ decimals(ethCallContext) {
411
+ try {
412
+ const iface = new Interface(["function decimals()"]);
413
+ const calldata = iface.encodeFunctionData("decimals", []);
414
+ return {
415
+ context: ethCallContext,
416
+ calldata,
417
+ };
418
+ }
419
+ catch (e) {
420
+ const stack = new Error().stack;
421
+ throw transformEtherError(e, undefined, stack);
422
+ }
423
+ },
424
+ balanceOf(arg0, ethCallContext) {
425
+ try {
426
+ const iface = new Interface(["function balanceOf(address)"]);
427
+ const calldata = iface.encodeFunctionData("balanceOf", [arg0]);
428
+ return {
429
+ context: ethCallContext,
430
+ calldata,
431
+ };
432
+ }
433
+ catch (e) {
434
+ const stack = new Error().stack;
435
+ throw transformEtherError(e, undefined, stack);
436
+ }
437
+ },
438
+ symbol(ethCallContext) {
439
+ try {
440
+ const iface = new Interface(["function symbol()"]);
441
+ const calldata = iface.encodeFunctionData("symbol", []);
442
+ return {
443
+ context: ethCallContext,
444
+ calldata,
445
+ };
446
+ }
447
+ catch (e) {
448
+ const stack = new Error().stack;
449
+ throw transformEtherError(e, undefined, stack);
450
+ }
451
+ },
452
+ transfer(dst, wad, ethCallContext) {
453
+ try {
454
+ const iface = new Interface(["function transfer(address,uint256)"]);
455
+ const calldata = iface.encodeFunctionData("transfer", [dst, wad]);
456
+ return {
457
+ context: ethCallContext,
458
+ calldata,
459
+ };
460
+ }
461
+ catch (e) {
462
+ const stack = new Error().stack;
463
+ throw transformEtherError(e, undefined, stack);
464
+ }
465
+ },
466
+ deposit(ethCallContext) {
467
+ try {
468
+ const iface = new Interface(["function deposit()"]);
469
+ const calldata = iface.encodeFunctionData("deposit", []);
470
+ return {
471
+ context: ethCallContext,
472
+ calldata,
473
+ };
474
+ }
475
+ catch (e) {
476
+ const stack = new Error().stack;
477
+ throw transformEtherError(e, undefined, stack);
478
+ }
479
+ },
480
+ allowance(arg0, arg1, ethCallContext) {
481
+ try {
482
+ const iface = new Interface(["function allowance(address,address)"]);
483
+ const calldata = iface.encodeFunctionData("allowance", [arg0, arg1]);
484
+ return {
485
+ context: ethCallContext,
486
+ calldata,
487
+ };
488
+ }
489
+ catch (e) {
490
+ const stack = new Error().stack;
491
+ throw transformEtherError(e, undefined, stack);
492
+ }
493
+ },
494
+ };
121
495
  }
122
496
  export class WETH9BoundContractView extends BoundContractView {
123
497
  async name(overrides) {
498
+ const ethCallContext = {
499
+ chainId: this.context.chainId,
500
+ blockTag: "0x" + this.context.blockNumber.toString(16),
501
+ address: this.context.address,
502
+ };
124
503
  return await this.view.name({
125
504
  blockTag: this.context.blockNumber,
126
505
  ...overrides,
127
- });
506
+ }, this.context.preparedData, ethCallContext);
128
507
  }
129
508
  async totalSupply(overrides) {
509
+ const ethCallContext = {
510
+ chainId: this.context.chainId,
511
+ blockTag: "0x" + this.context.blockNumber.toString(16),
512
+ address: this.context.address,
513
+ };
130
514
  return await this.view.totalSupply({
131
515
  blockTag: this.context.blockNumber,
132
516
  ...overrides,
133
- });
517
+ }, this.context.preparedData, ethCallContext);
134
518
  }
135
519
  async decimals(overrides) {
520
+ const ethCallContext = {
521
+ chainId: this.context.chainId,
522
+ blockTag: "0x" + this.context.blockNumber.toString(16),
523
+ address: this.context.address,
524
+ };
136
525
  return await this.view.decimals({
137
526
  blockTag: this.context.blockNumber,
138
527
  ...overrides,
139
- });
528
+ }, this.context.preparedData, ethCallContext);
140
529
  }
141
530
  async balanceOf(arg0, overrides) {
531
+ const ethCallContext = {
532
+ chainId: this.context.chainId,
533
+ blockTag: "0x" + this.context.blockNumber.toString(16),
534
+ address: this.context.address,
535
+ };
142
536
  return await this.view.balanceOf(arg0, {
143
537
  blockTag: this.context.blockNumber,
144
538
  ...overrides,
145
- });
539
+ }, this.context.preparedData, ethCallContext);
146
540
  }
147
541
  async symbol(overrides) {
542
+ const ethCallContext = {
543
+ chainId: this.context.chainId,
544
+ blockTag: "0x" + this.context.blockNumber.toString(16),
545
+ address: this.context.address,
546
+ };
148
547
  return await this.view.symbol({
149
548
  blockTag: this.context.blockNumber,
150
549
  ...overrides,
151
- });
550
+ }, this.context.preparedData, ethCallContext);
152
551
  }
153
552
  async allowance(arg0, arg1, overrides) {
553
+ const ethCallContext = {
554
+ chainId: this.context.chainId,
555
+ blockTag: "0x" + this.context.blockNumber.toString(16),
556
+ address: this.context.address,
557
+ };
154
558
  return await this.view.allowance(arg0, arg1, {
155
559
  blockTag: this.context.blockNumber,
156
560
  ...overrides,
157
- });
561
+ }, this.context.preparedData, ethCallContext);
158
562
  }
159
563
  callStatic = {
160
564
  view: this.view,
161
565
  context: this.context,
162
566
  async approve(guy, wad, overrides) {
567
+ const ethCallContext = {
568
+ chainId: this.context.chainId,
569
+ blockTag: "0x" + this.context.blockNumber.toString(16),
570
+ address: this.context.address,
571
+ };
163
572
  return await this.view.callStatic.approve(guy, wad, {
164
573
  blockTag: this.context.blockNumber,
165
574
  ...overrides,
166
- });
575
+ }, this.context.preparedData, ethCallContext);
167
576
  },
168
577
  async transferFrom(src, dst, wad, overrides) {
578
+ const ethCallContext = {
579
+ chainId: this.context.chainId,
580
+ blockTag: "0x" + this.context.blockNumber.toString(16),
581
+ address: this.context.address,
582
+ };
169
583
  return await this.view.callStatic.transferFrom(src, dst, wad, {
170
584
  blockTag: this.context.blockNumber,
171
585
  ...overrides,
172
- });
586
+ }, this.context.preparedData, ethCallContext);
173
587
  },
174
588
  async withdraw(wad, overrides) {
589
+ const ethCallContext = {
590
+ chainId: this.context.chainId,
591
+ blockTag: "0x" + this.context.blockNumber.toString(16),
592
+ address: this.context.address,
593
+ };
175
594
  return await this.view.callStatic.withdraw(wad, {
176
595
  blockTag: this.context.blockNumber,
177
596
  ...overrides,
178
- });
597
+ }, this.context.preparedData, ethCallContext);
179
598
  },
180
599
  async transfer(dst, wad, overrides) {
600
+ const ethCallContext = {
601
+ chainId: this.context.chainId,
602
+ blockTag: "0x" + this.context.blockNumber.toString(16),
603
+ address: this.context.address,
604
+ };
181
605
  return await this.view.callStatic.transfer(dst, wad, {
182
606
  blockTag: this.context.blockNumber,
183
607
  ...overrides,
184
- });
608
+ }, this.context.preparedData, ethCallContext);
185
609
  },
186
610
  async deposit(overrides) {
611
+ const ethCallContext = {
612
+ chainId: this.context.chainId,
613
+ blockTag: "0x" + this.context.blockNumber.toString(16),
614
+ address: this.context.address,
615
+ };
187
616
  return await this.view.callStatic.deposit({
188
617
  blockTag: this.context.blockNumber,
189
618
  ...overrides,
619
+ }, this.context.preparedData, ethCallContext);
620
+ },
621
+ };
622
+ encodeCall = {
623
+ view: this.view,
624
+ context: this.context,
625
+ name(overrides) {
626
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
627
+ const address = this.context.address;
628
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
629
+ if (overrides?.blockTag) {
630
+ blockTag =
631
+ typeof overrides.blockTag == "string"
632
+ ? overrides.blockTag
633
+ : "0x" + overrides.blockTag.toString(16);
634
+ }
635
+ return this.view.encodeCall.name({ chainId, address, blockTag });
636
+ },
637
+ approve(guy, wad, overrides) {
638
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
639
+ const address = this.context.address;
640
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
641
+ if (overrides?.blockTag) {
642
+ blockTag =
643
+ typeof overrides.blockTag == "string"
644
+ ? overrides.blockTag
645
+ : "0x" + overrides.blockTag.toString(16);
646
+ }
647
+ return this.view.encodeCall.approve(guy, wad, {
648
+ chainId,
649
+ address,
650
+ blockTag,
651
+ });
652
+ },
653
+ totalSupply(overrides) {
654
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
655
+ const address = this.context.address;
656
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
657
+ if (overrides?.blockTag) {
658
+ blockTag =
659
+ typeof overrides.blockTag == "string"
660
+ ? overrides.blockTag
661
+ : "0x" + overrides.blockTag.toString(16);
662
+ }
663
+ return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
664
+ },
665
+ transferFrom(src, dst, wad, overrides) {
666
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
667
+ const address = this.context.address;
668
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
669
+ if (overrides?.blockTag) {
670
+ blockTag =
671
+ typeof overrides.blockTag == "string"
672
+ ? overrides.blockTag
673
+ : "0x" + overrides.blockTag.toString(16);
674
+ }
675
+ return this.view.encodeCall.transferFrom(src, dst, wad, {
676
+ chainId,
677
+ address,
678
+ blockTag,
679
+ });
680
+ },
681
+ withdraw(wad, overrides) {
682
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
683
+ const address = this.context.address;
684
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
685
+ if (overrides?.blockTag) {
686
+ blockTag =
687
+ typeof overrides.blockTag == "string"
688
+ ? overrides.blockTag
689
+ : "0x" + overrides.blockTag.toString(16);
690
+ }
691
+ return this.view.encodeCall.withdraw(wad, { chainId, address, blockTag });
692
+ },
693
+ decimals(overrides) {
694
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
695
+ const address = this.context.address;
696
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
697
+ if (overrides?.blockTag) {
698
+ blockTag =
699
+ typeof overrides.blockTag == "string"
700
+ ? overrides.blockTag
701
+ : "0x" + overrides.blockTag.toString(16);
702
+ }
703
+ return this.view.encodeCall.decimals({ chainId, address, blockTag });
704
+ },
705
+ balanceOf(arg0, overrides) {
706
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
707
+ const address = this.context.address;
708
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
709
+ if (overrides?.blockTag) {
710
+ blockTag =
711
+ typeof overrides.blockTag == "string"
712
+ ? overrides.blockTag
713
+ : "0x" + overrides.blockTag.toString(16);
714
+ }
715
+ return this.view.encodeCall.balanceOf(arg0, {
716
+ chainId,
717
+ address,
718
+ blockTag,
719
+ });
720
+ },
721
+ symbol(overrides) {
722
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
723
+ const address = this.context.address;
724
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
725
+ if (overrides?.blockTag) {
726
+ blockTag =
727
+ typeof overrides.blockTag == "string"
728
+ ? overrides.blockTag
729
+ : "0x" + overrides.blockTag.toString(16);
730
+ }
731
+ return this.view.encodeCall.symbol({ chainId, address, blockTag });
732
+ },
733
+ transfer(dst, wad, overrides) {
734
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
735
+ const address = this.context.address;
736
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
737
+ if (overrides?.blockTag) {
738
+ blockTag =
739
+ typeof overrides.blockTag == "string"
740
+ ? overrides.blockTag
741
+ : "0x" + overrides.blockTag.toString(16);
742
+ }
743
+ return this.view.encodeCall.transfer(dst, wad, {
744
+ chainId,
745
+ address,
746
+ blockTag,
747
+ });
748
+ },
749
+ deposit(overrides) {
750
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
751
+ const address = this.context.address;
752
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
753
+ if (overrides?.blockTag) {
754
+ blockTag =
755
+ typeof overrides.blockTag == "string"
756
+ ? overrides.blockTag
757
+ : "0x" + overrides.blockTag.toString(16);
758
+ }
759
+ return this.view.encodeCall.deposit({ chainId, address, blockTag });
760
+ },
761
+ allowance(arg0, arg1, overrides) {
762
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
763
+ const address = this.context.address;
764
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
765
+ if (overrides?.blockTag) {
766
+ blockTag =
767
+ typeof overrides.blockTag == "string"
768
+ ? overrides.blockTag
769
+ : "0x" + overrides.blockTag.toString(16);
770
+ }
771
+ return this.view.encodeCall.allowance(arg0, arg1, {
772
+ chainId,
773
+ address,
774
+ blockTag,
190
775
  });
191
776
  },
192
777
  };