@sentio/sdk 2.40.0-rc.3 → 2.40.0-rc.30

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 (147) 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 +20 -17
  70. package/lib/eth/eth-plugin.js.map +1 -1
  71. package/lib/eth/eth.d.ts.map +1 -1
  72. package/lib/eth/eth.js +1 -1
  73. package/lib/eth/eth.js.map +1 -1
  74. package/lib/eth/generic-processor.js +1 -1
  75. package/lib/eth/generic-processor.js.map +1 -1
  76. package/lib/eth/generic-processor.test.js.map +1 -1
  77. package/lib/eth/index.d.ts +2 -1
  78. package/lib/eth/index.d.ts.map +1 -1
  79. package/lib/eth/index.js +2 -1
  80. package/lib/eth/index.js.map +1 -1
  81. package/lib/solana/builtin/spl-token-processor.d.ts +1 -1
  82. package/lib/solana/builtin/spl-token-processor.d.ts.map +1 -1
  83. package/lib/solana/builtin/spl-token-processor.js +1 -1
  84. package/lib/solana/builtin/spl-token-processor.js.map +1 -1
  85. package/lib/solana/solana-context.d.ts +1 -1
  86. package/lib/solana/solana-context.js +2 -2
  87. package/lib/store/cache.d.ts +14 -0
  88. package/lib/store/cache.d.ts.map +1 -0
  89. package/lib/store/cache.js +35 -0
  90. package/lib/store/cache.js.map +1 -0
  91. package/lib/store/store.d.ts +2 -3
  92. package/lib/store/store.d.ts.map +1 -1
  93. package/lib/store/store.js +34 -9
  94. package/lib/store/store.js.map +1 -1
  95. package/lib/sui/context.d.ts +1 -1
  96. package/lib/sui/context.d.ts.map +1 -1
  97. package/lib/sui/sui-processor.d.ts +1 -1
  98. package/lib/sui/sui-processor.d.ts.map +1 -1
  99. package/lib/sui/sui-processor.js +1 -1
  100. package/lib/sui/sui-processor.js.map +1 -1
  101. package/lib/testing/aptos-facet.d.ts +1 -1
  102. package/lib/testing/aptos-facet.js +2 -2
  103. package/lib/testing/sui-facet.js +1 -1
  104. package/lib/utils/dex-price.d.ts +1 -0
  105. package/lib/utils/dex-price.d.ts.map +1 -1
  106. package/lib/utils/dex-price.js +13 -2
  107. package/lib/utils/dex-price.js.map +1 -1
  108. package/package.json +8 -7
  109. package/src/aptos/aptos-processor.ts +1 -1
  110. package/src/aptos/context.ts +2 -2
  111. package/src/aptos/ext/aptos-dex.ts +1 -1
  112. package/src/aptos/ext/coin-event.ts +1 -1
  113. package/src/aptos/ext/coin.ts +2 -2
  114. package/src/eth/account-processor.ts +28 -12
  115. package/src/eth/base-processor-template.ts +16 -8
  116. package/src/eth/base-processor.ts +25 -16
  117. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1643 -123
  118. package/src/eth/builtin/internal/erc1155-processor.ts +724 -42
  119. package/src/eth/builtin/internal/erc20-processor.ts +1368 -90
  120. package/src/eth/builtin/internal/erc20bytes-processor.ts +685 -49
  121. package/src/eth/builtin/internal/erc721-processor.ts +1116 -70
  122. package/src/eth/builtin/internal/weth9-processor.ts +798 -63
  123. package/src/eth/codegen/event-handler.ts +1 -1
  124. package/src/eth/codegen/file.ts +26 -3
  125. package/src/eth/codegen/function-calls.ts +101 -8
  126. package/src/eth/codegen/types.ts +22 -1
  127. package/src/eth/context.ts +7 -0
  128. package/src/eth/eth-plugin.ts +34 -26
  129. package/src/eth/eth.ts +1 -2
  130. package/src/eth/generic-processor.ts +1 -1
  131. package/src/eth/index.ts +5 -1
  132. package/src/solana/builtin/spl-token-processor.ts +1 -1
  133. package/src/solana/solana-context.ts +2 -2
  134. package/src/store/cache.ts +46 -0
  135. package/src/store/store.ts +40 -22
  136. package/src/sui/context.ts +1 -1
  137. package/src/sui/sui-processor.ts +1 -1
  138. package/src/testing/aptos-facet.ts +2 -2
  139. package/src/testing/sui-facet.ts +1 -1
  140. package/src/utils/dex-price.ts +15 -2
  141. package/lib/eth/provider.d.ts +0 -5
  142. package/lib/eth/provider.d.ts.map +0 -1
  143. package/lib/eth/provider.js +0 -134
  144. package/lib/eth/provider.js.map +0 -1
  145. package/lib/utils/chainlink-oracles-sepolia.csv +0 -19
  146. package/lib/utils/chainlink-oracles.csv +0 -217
  147. package/src/eth/provider.ts +0 -163
@@ -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 { ERC20__factory } from "./index.js";
3
7
  const templateContract = ERC20__factory.connect("0x0", DummyProvider);
4
8
  export class ERC20ContractView extends ContractView {
@@ -6,8 +10,29 @@ export class ERC20ContractView extends ContractView {
6
10
  super(contract);
7
11
  this.callStatic.contract = contract;
8
12
  }
9
- async allowance(owner, spender, overrides) {
13
+ async allowance(owner, spender, overrides, preparedData, ethCallContext) {
10
14
  try {
15
+ if (preparedData?.ethCallResults && ethCallContext) {
16
+ const iface = new Interface([
17
+ "function allowance(address,address) view returns (uint256)",
18
+ ]);
19
+ const calldata = iface.encodeFunctionData("allowance", [
20
+ owner,
21
+ spender,
22
+ ]);
23
+ const key = makeEthCallKey({
24
+ context: ethCallContext,
25
+ calldata,
26
+ });
27
+ console.debug("looking up eth call key:", key);
28
+ const ret = preparedData.ethCallResults[key];
29
+ if (ret) {
30
+ console.debug("prepared eth call found:", key);
31
+ const result = iface.decodeFunctionResult("allowance", ret).toArray();
32
+ return result.length == 1 ? result[0] : result;
33
+ }
34
+ console.debug("missing eth call key:", "allowance", owner, spender, key);
35
+ }
11
36
  return await this.contract.getFunction("allowance(address,address)")(owner, spender, overrides || {});
12
37
  }
13
38
  catch (e) {
@@ -15,8 +40,26 @@ export class ERC20ContractView extends ContractView {
15
40
  throw transformEtherError(e, undefined, stack);
16
41
  }
17
42
  }
18
- async balanceOf(account, overrides) {
43
+ async balanceOf(account, overrides, preparedData, ethCallContext) {
19
44
  try {
45
+ if (preparedData?.ethCallResults && ethCallContext) {
46
+ const iface = new Interface([
47
+ "function balanceOf(address) view returns (uint256)",
48
+ ]);
49
+ const calldata = iface.encodeFunctionData("balanceOf", [account]);
50
+ const key = makeEthCallKey({
51
+ context: ethCallContext,
52
+ calldata,
53
+ });
54
+ console.debug("looking up eth call key:", key);
55
+ const ret = preparedData.ethCallResults[key];
56
+ if (ret) {
57
+ console.debug("prepared eth call found:", key);
58
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
59
+ return result.length == 1 ? result[0] : result;
60
+ }
61
+ console.debug("missing eth call key:", "balanceOf", account, key);
62
+ }
20
63
  return await this.contract.getFunction("balanceOf(address)")(account, overrides || {});
21
64
  }
22
65
  catch (e) {
@@ -24,8 +67,26 @@ export class ERC20ContractView extends ContractView {
24
67
  throw transformEtherError(e, undefined, stack);
25
68
  }
26
69
  }
27
- async decimals(overrides) {
70
+ async decimals(overrides, preparedData, ethCallContext) {
28
71
  try {
72
+ if (preparedData?.ethCallResults && ethCallContext) {
73
+ const iface = new Interface([
74
+ "function decimals() view returns (uint8)",
75
+ ]);
76
+ const calldata = iface.encodeFunctionData("decimals", []);
77
+ const key = makeEthCallKey({
78
+ context: ethCallContext,
79
+ calldata,
80
+ });
81
+ console.debug("looking up eth call key:", key);
82
+ const ret = preparedData.ethCallResults[key];
83
+ if (ret) {
84
+ console.debug("prepared eth call found:", key);
85
+ const result = iface.decodeFunctionResult("decimals", ret).toArray();
86
+ return result.length == 1 ? result[0] : result;
87
+ }
88
+ console.debug("missing eth call key:", "decimals", key);
89
+ }
29
90
  return await this.contract.getFunction("decimals()")(overrides || {});
30
91
  }
31
92
  catch (e) {
@@ -33,8 +94,26 @@ export class ERC20ContractView extends ContractView {
33
94
  throw transformEtherError(e, undefined, stack);
34
95
  }
35
96
  }
36
- async locker(overrides) {
97
+ async locker(overrides, preparedData, ethCallContext) {
37
98
  try {
99
+ if (preparedData?.ethCallResults && ethCallContext) {
100
+ const iface = new Interface([
101
+ "function locker() view returns (address)",
102
+ ]);
103
+ const calldata = iface.encodeFunctionData("locker", []);
104
+ const key = makeEthCallKey({
105
+ context: ethCallContext,
106
+ calldata,
107
+ });
108
+ console.debug("looking up eth call key:", key);
109
+ const ret = preparedData.ethCallResults[key];
110
+ if (ret) {
111
+ console.debug("prepared eth call found:", key);
112
+ const result = iface.decodeFunctionResult("locker", ret).toArray();
113
+ return result.length == 1 ? result[0] : result;
114
+ }
115
+ console.debug("missing eth call key:", "locker", key);
116
+ }
38
117
  return await this.contract.getFunction("locker()")(overrides || {});
39
118
  }
40
119
  catch (e) {
@@ -42,8 +121,24 @@ export class ERC20ContractView extends ContractView {
42
121
  throw transformEtherError(e, undefined, stack);
43
122
  }
44
123
  }
45
- async name(overrides) {
124
+ async name(overrides, preparedData, ethCallContext) {
46
125
  try {
126
+ if (preparedData?.ethCallResults && ethCallContext) {
127
+ const iface = new Interface(["function name() view returns (string)"]);
128
+ const calldata = iface.encodeFunctionData("name", []);
129
+ const key = makeEthCallKey({
130
+ context: ethCallContext,
131
+ calldata,
132
+ });
133
+ console.debug("looking up eth call key:", key);
134
+ const ret = preparedData.ethCallResults[key];
135
+ if (ret) {
136
+ console.debug("prepared eth call found:", key);
137
+ const result = iface.decodeFunctionResult("name", ret).toArray();
138
+ return result.length == 1 ? result[0] : result;
139
+ }
140
+ console.debug("missing eth call key:", "name", key);
141
+ }
47
142
  return await this.contract.getFunction("name()")(overrides || {});
48
143
  }
49
144
  catch (e) {
@@ -51,8 +146,26 @@ export class ERC20ContractView extends ContractView {
51
146
  throw transformEtherError(e, undefined, stack);
52
147
  }
53
148
  }
54
- async owner(overrides) {
149
+ async owner(overrides, preparedData, ethCallContext) {
55
150
  try {
151
+ if (preparedData?.ethCallResults && ethCallContext) {
152
+ const iface = new Interface([
153
+ "function owner() view returns (address)",
154
+ ]);
155
+ const calldata = iface.encodeFunctionData("owner", []);
156
+ const key = makeEthCallKey({
157
+ context: ethCallContext,
158
+ calldata,
159
+ });
160
+ console.debug("looking up eth call key:", key);
161
+ const ret = preparedData.ethCallResults[key];
162
+ if (ret) {
163
+ console.debug("prepared eth call found:", key);
164
+ const result = iface.decodeFunctionResult("owner", ret).toArray();
165
+ return result.length == 1 ? result[0] : result;
166
+ }
167
+ console.debug("missing eth call key:", "owner", key);
168
+ }
56
169
  return await this.contract.getFunction("owner()")(overrides || {});
57
170
  }
58
171
  catch (e) {
@@ -60,8 +173,26 @@ export class ERC20ContractView extends ContractView {
60
173
  throw transformEtherError(e, undefined, stack);
61
174
  }
62
175
  }
63
- async symbol(overrides) {
176
+ async symbol(overrides, preparedData, ethCallContext) {
64
177
  try {
178
+ if (preparedData?.ethCallResults && ethCallContext) {
179
+ const iface = new Interface([
180
+ "function symbol() view returns (string)",
181
+ ]);
182
+ const calldata = iface.encodeFunctionData("symbol", []);
183
+ const key = makeEthCallKey({
184
+ context: ethCallContext,
185
+ calldata,
186
+ });
187
+ console.debug("looking up eth call key:", key);
188
+ const ret = preparedData.ethCallResults[key];
189
+ if (ret) {
190
+ console.debug("prepared eth call found:", key);
191
+ const result = iface.decodeFunctionResult("symbol", ret).toArray();
192
+ return result.length == 1 ? result[0] : result;
193
+ }
194
+ console.debug("missing eth call key:", "symbol", key);
195
+ }
65
196
  return await this.contract.getFunction("symbol()")(overrides || {});
66
197
  }
67
198
  catch (e) {
@@ -69,8 +200,28 @@ export class ERC20ContractView extends ContractView {
69
200
  throw transformEtherError(e, undefined, stack);
70
201
  }
71
202
  }
72
- async totalSupply(overrides) {
203
+ async totalSupply(overrides, preparedData, ethCallContext) {
73
204
  try {
205
+ if (preparedData?.ethCallResults && ethCallContext) {
206
+ const iface = new Interface([
207
+ "function totalSupply() view returns (uint256)",
208
+ ]);
209
+ const calldata = iface.encodeFunctionData("totalSupply", []);
210
+ const key = makeEthCallKey({
211
+ context: ethCallContext,
212
+ calldata,
213
+ });
214
+ console.debug("looking up eth call key:", key);
215
+ const ret = preparedData.ethCallResults[key];
216
+ if (ret) {
217
+ console.debug("prepared eth call found:", key);
218
+ const result = iface
219
+ .decodeFunctionResult("totalSupply", ret)
220
+ .toArray();
221
+ return result.length == 1 ? result[0] : result;
222
+ }
223
+ console.debug("missing eth call key:", "totalSupply", key);
224
+ }
74
225
  return await this.contract.getFunction("totalSupply()")(overrides || {});
75
226
  }
76
227
  catch (e) {
@@ -80,8 +231,29 @@ export class ERC20ContractView extends ContractView {
80
231
  }
81
232
  callStatic = {
82
233
  contract: this.contract,
83
- async approve(spender, amount, overrides) {
234
+ async approve(spender, amount, overrides, preparedData, ethCallContext) {
84
235
  try {
236
+ if (preparedData?.ethCallResults && ethCallContext) {
237
+ const iface = new Interface([
238
+ "function approve(address,uint256) nonpayable returns (bool)",
239
+ ]);
240
+ const calldata = iface.encodeFunctionData("approve", [
241
+ spender,
242
+ amount,
243
+ ]);
244
+ const key = makeEthCallKey({
245
+ context: ethCallContext,
246
+ calldata,
247
+ });
248
+ console.debug("looking up eth call key:", key);
249
+ const ret = preparedData.ethCallResults[key];
250
+ if (ret) {
251
+ console.debug("prepared eth call found:", key);
252
+ const result = iface.decodeFunctionResult("approve", ret).toArray();
253
+ return result.length == 1 ? result[0] : result;
254
+ }
255
+ console.debug("missing eth call key:", "approve", spender, amount, key);
256
+ }
85
257
  return await this.contract
86
258
  .getFunction("approve(address,uint256)")
87
259
  .staticCall(spender, amount, overrides || {});
@@ -91,8 +263,26 @@ export class ERC20ContractView extends ContractView {
91
263
  throw transformEtherError(e, undefined, stack);
92
264
  }
93
265
  },
94
- async burn(amount, overrides) {
266
+ async burn(amount, overrides, preparedData, ethCallContext) {
95
267
  try {
268
+ if (preparedData?.ethCallResults && ethCallContext) {
269
+ const iface = new Interface([
270
+ "function burn(uint256) nonpayable returns ()",
271
+ ]);
272
+ const calldata = iface.encodeFunctionData("burn", [amount]);
273
+ const key = makeEthCallKey({
274
+ context: ethCallContext,
275
+ calldata,
276
+ });
277
+ console.debug("looking up eth call key:", key);
278
+ const ret = preparedData.ethCallResults[key];
279
+ if (ret) {
280
+ console.debug("prepared eth call found:", key);
281
+ const result = iface.decodeFunctionResult("burn", ret).toArray();
282
+ return result.length == 1 ? result[0] : result;
283
+ }
284
+ console.debug("missing eth call key:", "burn", amount, key);
285
+ }
96
286
  return await this.contract
97
287
  .getFunction("burn(uint256)")
98
288
  .staticCall(amount, overrides || {});
@@ -102,8 +292,31 @@ export class ERC20ContractView extends ContractView {
102
292
  throw transformEtherError(e, undefined, stack);
103
293
  }
104
294
  },
105
- async burnFrom(account, amount, overrides) {
295
+ async burnFrom(account, amount, overrides, preparedData, ethCallContext) {
106
296
  try {
297
+ if (preparedData?.ethCallResults && ethCallContext) {
298
+ const iface = new Interface([
299
+ "function burnFrom(address,uint256) nonpayable returns ()",
300
+ ]);
301
+ const calldata = iface.encodeFunctionData("burnFrom", [
302
+ account,
303
+ amount,
304
+ ]);
305
+ const key = makeEthCallKey({
306
+ context: ethCallContext,
307
+ calldata,
308
+ });
309
+ console.debug("looking up eth call key:", key);
310
+ const ret = preparedData.ethCallResults[key];
311
+ if (ret) {
312
+ console.debug("prepared eth call found:", key);
313
+ const result = iface
314
+ .decodeFunctionResult("burnFrom", ret)
315
+ .toArray();
316
+ return result.length == 1 ? result[0] : result;
317
+ }
318
+ console.debug("missing eth call key:", "burnFrom", account, amount, key);
319
+ }
107
320
  return await this.contract
108
321
  .getFunction("burnFrom(address,uint256)")
109
322
  .staticCall(account, amount, overrides || {});
@@ -113,8 +326,31 @@ export class ERC20ContractView extends ContractView {
113
326
  throw transformEtherError(e, undefined, stack);
114
327
  }
115
328
  },
116
- async decreaseAllowance(spender, subtractedValue, overrides) {
329
+ async decreaseAllowance(spender, subtractedValue, overrides, preparedData, ethCallContext) {
117
330
  try {
331
+ if (preparedData?.ethCallResults && ethCallContext) {
332
+ const iface = new Interface([
333
+ "function decreaseAllowance(address,uint256) nonpayable returns (bool)",
334
+ ]);
335
+ const calldata = iface.encodeFunctionData("decreaseAllowance", [
336
+ spender,
337
+ subtractedValue,
338
+ ]);
339
+ const key = makeEthCallKey({
340
+ context: ethCallContext,
341
+ calldata,
342
+ });
343
+ console.debug("looking up eth call key:", key);
344
+ const ret = preparedData.ethCallResults[key];
345
+ if (ret) {
346
+ console.debug("prepared eth call found:", key);
347
+ const result = iface
348
+ .decodeFunctionResult("decreaseAllowance", ret)
349
+ .toArray();
350
+ return result.length == 1 ? result[0] : result;
351
+ }
352
+ console.debug("missing eth call key:", "decreaseAllowance", spender, subtractedValue, key);
353
+ }
118
354
  return await this.contract
119
355
  .getFunction("decreaseAllowance(address,uint256)")
120
356
  .staticCall(spender, subtractedValue, overrides || {});
@@ -124,8 +360,31 @@ export class ERC20ContractView extends ContractView {
124
360
  throw transformEtherError(e, undefined, stack);
125
361
  }
126
362
  },
127
- async increaseAllowance(spender, addedValue, overrides) {
363
+ async increaseAllowance(spender, addedValue, overrides, preparedData, ethCallContext) {
128
364
  try {
365
+ if (preparedData?.ethCallResults && ethCallContext) {
366
+ const iface = new Interface([
367
+ "function increaseAllowance(address,uint256) nonpayable returns (bool)",
368
+ ]);
369
+ const calldata = iface.encodeFunctionData("increaseAllowance", [
370
+ spender,
371
+ addedValue,
372
+ ]);
373
+ const key = makeEthCallKey({
374
+ context: ethCallContext,
375
+ calldata,
376
+ });
377
+ console.debug("looking up eth call key:", key);
378
+ const ret = preparedData.ethCallResults[key];
379
+ if (ret) {
380
+ console.debug("prepared eth call found:", key);
381
+ const result = iface
382
+ .decodeFunctionResult("increaseAllowance", ret)
383
+ .toArray();
384
+ return result.length == 1 ? result[0] : result;
385
+ }
386
+ console.debug("missing eth call key:", "increaseAllowance", spender, addedValue, key);
387
+ }
129
388
  return await this.contract
130
389
  .getFunction("increaseAllowance(address,uint256)")
131
390
  .staticCall(spender, addedValue, overrides || {});
@@ -135,8 +394,28 @@ export class ERC20ContractView extends ContractView {
135
394
  throw transformEtherError(e, undefined, stack);
136
395
  }
137
396
  },
138
- async renounceOwnership(overrides) {
397
+ async renounceOwnership(overrides, preparedData, ethCallContext) {
139
398
  try {
399
+ if (preparedData?.ethCallResults && ethCallContext) {
400
+ const iface = new Interface([
401
+ "function renounceOwnership() nonpayable returns ()",
402
+ ]);
403
+ const calldata = iface.encodeFunctionData("renounceOwnership", []);
404
+ const key = makeEthCallKey({
405
+ context: ethCallContext,
406
+ calldata,
407
+ });
408
+ console.debug("looking up eth call key:", key);
409
+ const ret = preparedData.ethCallResults[key];
410
+ if (ret) {
411
+ console.debug("prepared eth call found:", key);
412
+ const result = iface
413
+ .decodeFunctionResult("renounceOwnership", ret)
414
+ .toArray();
415
+ return result.length == 1 ? result[0] : result;
416
+ }
417
+ console.debug("missing eth call key:", "renounceOwnership", key);
418
+ }
140
419
  return await this.contract
141
420
  .getFunction("renounceOwnership()")
142
421
  .staticCall(overrides || {});
@@ -146,8 +425,28 @@ export class ERC20ContractView extends ContractView {
146
425
  throw transformEtherError(e, undefined, stack);
147
426
  }
148
427
  },
149
- async setLocker(_locker, overrides) {
428
+ async setLocker(_locker, overrides, preparedData, ethCallContext) {
150
429
  try {
430
+ if (preparedData?.ethCallResults && ethCallContext) {
431
+ const iface = new Interface([
432
+ "function setLocker(address) nonpayable returns ()",
433
+ ]);
434
+ const calldata = iface.encodeFunctionData("setLocker", [_locker]);
435
+ const key = makeEthCallKey({
436
+ context: ethCallContext,
437
+ calldata,
438
+ });
439
+ console.debug("looking up eth call key:", key);
440
+ const ret = preparedData.ethCallResults[key];
441
+ if (ret) {
442
+ console.debug("prepared eth call found:", key);
443
+ const result = iface
444
+ .decodeFunctionResult("setLocker", ret)
445
+ .toArray();
446
+ return result.length == 1 ? result[0] : result;
447
+ }
448
+ console.debug("missing eth call key:", "setLocker", _locker, key);
449
+ }
151
450
  return await this.contract
152
451
  .getFunction("setLocker(address)")
153
452
  .staticCall(_locker, overrides || {});
@@ -157,8 +456,31 @@ export class ERC20ContractView extends ContractView {
157
456
  throw transformEtherError(e, undefined, stack);
158
457
  }
159
458
  },
160
- async transfer(recipient, amount, overrides) {
459
+ async transfer(recipient, amount, overrides, preparedData, ethCallContext) {
161
460
  try {
461
+ if (preparedData?.ethCallResults && ethCallContext) {
462
+ const iface = new Interface([
463
+ "function transfer(address,uint256) nonpayable returns (bool)",
464
+ ]);
465
+ const calldata = iface.encodeFunctionData("transfer", [
466
+ recipient,
467
+ amount,
468
+ ]);
469
+ const key = makeEthCallKey({
470
+ context: ethCallContext,
471
+ calldata,
472
+ });
473
+ console.debug("looking up eth call key:", key);
474
+ const ret = preparedData.ethCallResults[key];
475
+ if (ret) {
476
+ console.debug("prepared eth call found:", key);
477
+ const result = iface
478
+ .decodeFunctionResult("transfer", ret)
479
+ .toArray();
480
+ return result.length == 1 ? result[0] : result;
481
+ }
482
+ console.debug("missing eth call key:", "transfer", recipient, amount, key);
483
+ }
162
484
  return await this.contract
163
485
  .getFunction("transfer(address,uint256)")
164
486
  .staticCall(recipient, amount, overrides || {});
@@ -168,8 +490,32 @@ export class ERC20ContractView extends ContractView {
168
490
  throw transformEtherError(e, undefined, stack);
169
491
  }
170
492
  },
171
- async transferFrom(sender, recipient, amount, overrides) {
493
+ async transferFrom(sender, recipient, amount, overrides, preparedData, ethCallContext) {
172
494
  try {
495
+ if (preparedData?.ethCallResults && ethCallContext) {
496
+ const iface = new Interface([
497
+ "function transferFrom(address,address,uint256) nonpayable returns (bool)",
498
+ ]);
499
+ const calldata = iface.encodeFunctionData("transferFrom", [
500
+ sender,
501
+ recipient,
502
+ amount,
503
+ ]);
504
+ const key = makeEthCallKey({
505
+ context: ethCallContext,
506
+ calldata,
507
+ });
508
+ console.debug("looking up eth call key:", key);
509
+ const ret = preparedData.ethCallResults[key];
510
+ if (ret) {
511
+ console.debug("prepared eth call found:", key);
512
+ const result = iface
513
+ .decodeFunctionResult("transferFrom", ret)
514
+ .toArray();
515
+ return result.length == 1 ? result[0] : result;
516
+ }
517
+ console.debug("missing eth call key:", "transferFrom", sender, recipient, amount, key);
518
+ }
173
519
  return await this.contract
174
520
  .getFunction("transferFrom(address,address,uint256)")
175
521
  .staticCall(sender, recipient, amount, overrides || {});
@@ -179,8 +525,30 @@ export class ERC20ContractView extends ContractView {
179
525
  throw transformEtherError(e, undefined, stack);
180
526
  }
181
527
  },
182
- async transferOwnership(newOwner, overrides) {
528
+ async transferOwnership(newOwner, overrides, preparedData, ethCallContext) {
183
529
  try {
530
+ if (preparedData?.ethCallResults && ethCallContext) {
531
+ const iface = new Interface([
532
+ "function transferOwnership(address) nonpayable returns ()",
533
+ ]);
534
+ const calldata = iface.encodeFunctionData("transferOwnership", [
535
+ newOwner,
536
+ ]);
537
+ const key = makeEthCallKey({
538
+ context: ethCallContext,
539
+ calldata,
540
+ });
541
+ console.debug("looking up eth call key:", key);
542
+ const ret = preparedData.ethCallResults[key];
543
+ if (ret) {
544
+ console.debug("prepared eth call found:", key);
545
+ const result = iface
546
+ .decodeFunctionResult("transferOwnership", ret)
547
+ .toArray();
548
+ return result.length == 1 ? result[0] : result;
549
+ }
550
+ console.debug("missing eth call key:", "transferOwnership", newOwner, key);
551
+ }
184
552
  return await this.contract
185
553
  .getFunction("transferOwnership(address)")
186
554
  .staticCall(newOwner, overrides || {});
@@ -191,117 +559,752 @@ export class ERC20ContractView extends ContractView {
191
559
  }
192
560
  },
193
561
  };
562
+ encodeCall = {
563
+ allowance(owner, spender, ethCallContext) {
564
+ try {
565
+ const iface = new Interface(["function allowance(address,address)"]);
566
+ const calldata = iface.encodeFunctionData("allowance", [
567
+ owner,
568
+ spender,
569
+ ]);
570
+ return {
571
+ context: ethCallContext,
572
+ calldata,
573
+ };
574
+ }
575
+ catch (e) {
576
+ const stack = new Error().stack;
577
+ throw transformEtherError(e, undefined, stack);
578
+ }
579
+ },
580
+ approve(spender, amount, ethCallContext) {
581
+ try {
582
+ const iface = new Interface(["function approve(address,uint256)"]);
583
+ const calldata = iface.encodeFunctionData("approve", [spender, amount]);
584
+ return {
585
+ context: ethCallContext,
586
+ calldata,
587
+ };
588
+ }
589
+ catch (e) {
590
+ const stack = new Error().stack;
591
+ throw transformEtherError(e, undefined, stack);
592
+ }
593
+ },
594
+ balanceOf(account, ethCallContext) {
595
+ try {
596
+ const iface = new Interface(["function balanceOf(address)"]);
597
+ const calldata = iface.encodeFunctionData("balanceOf", [account]);
598
+ return {
599
+ context: ethCallContext,
600
+ calldata,
601
+ };
602
+ }
603
+ catch (e) {
604
+ const stack = new Error().stack;
605
+ throw transformEtherError(e, undefined, stack);
606
+ }
607
+ },
608
+ burn(amount, ethCallContext) {
609
+ try {
610
+ const iface = new Interface(["function burn(uint256)"]);
611
+ const calldata = iface.encodeFunctionData("burn", [amount]);
612
+ return {
613
+ context: ethCallContext,
614
+ calldata,
615
+ };
616
+ }
617
+ catch (e) {
618
+ const stack = new Error().stack;
619
+ throw transformEtherError(e, undefined, stack);
620
+ }
621
+ },
622
+ burnFrom(account, amount, ethCallContext) {
623
+ try {
624
+ const iface = new Interface(["function burnFrom(address,uint256)"]);
625
+ const calldata = iface.encodeFunctionData("burnFrom", [
626
+ account,
627
+ amount,
628
+ ]);
629
+ return {
630
+ context: ethCallContext,
631
+ calldata,
632
+ };
633
+ }
634
+ catch (e) {
635
+ const stack = new Error().stack;
636
+ throw transformEtherError(e, undefined, stack);
637
+ }
638
+ },
639
+ decimals(ethCallContext) {
640
+ try {
641
+ const iface = new Interface(["function decimals()"]);
642
+ const calldata = iface.encodeFunctionData("decimals", []);
643
+ return {
644
+ context: ethCallContext,
645
+ calldata,
646
+ };
647
+ }
648
+ catch (e) {
649
+ const stack = new Error().stack;
650
+ throw transformEtherError(e, undefined, stack);
651
+ }
652
+ },
653
+ decreaseAllowance(spender, subtractedValue, ethCallContext) {
654
+ try {
655
+ const iface = new Interface([
656
+ "function decreaseAllowance(address,uint256)",
657
+ ]);
658
+ const calldata = iface.encodeFunctionData("decreaseAllowance", [
659
+ spender,
660
+ subtractedValue,
661
+ ]);
662
+ return {
663
+ context: ethCallContext,
664
+ calldata,
665
+ };
666
+ }
667
+ catch (e) {
668
+ const stack = new Error().stack;
669
+ throw transformEtherError(e, undefined, stack);
670
+ }
671
+ },
672
+ increaseAllowance(spender, addedValue, ethCallContext) {
673
+ try {
674
+ const iface = new Interface([
675
+ "function increaseAllowance(address,uint256)",
676
+ ]);
677
+ const calldata = iface.encodeFunctionData("increaseAllowance", [
678
+ spender,
679
+ addedValue,
680
+ ]);
681
+ return {
682
+ context: ethCallContext,
683
+ calldata,
684
+ };
685
+ }
686
+ catch (e) {
687
+ const stack = new Error().stack;
688
+ throw transformEtherError(e, undefined, stack);
689
+ }
690
+ },
691
+ locker(ethCallContext) {
692
+ try {
693
+ const iface = new Interface(["function locker()"]);
694
+ const calldata = iface.encodeFunctionData("locker", []);
695
+ return {
696
+ context: ethCallContext,
697
+ calldata,
698
+ };
699
+ }
700
+ catch (e) {
701
+ const stack = new Error().stack;
702
+ throw transformEtherError(e, undefined, stack);
703
+ }
704
+ },
705
+ name(ethCallContext) {
706
+ try {
707
+ const iface = new Interface(["function name()"]);
708
+ const calldata = iface.encodeFunctionData("name", []);
709
+ return {
710
+ context: ethCallContext,
711
+ calldata,
712
+ };
713
+ }
714
+ catch (e) {
715
+ const stack = new Error().stack;
716
+ throw transformEtherError(e, undefined, stack);
717
+ }
718
+ },
719
+ owner(ethCallContext) {
720
+ try {
721
+ const iface = new Interface(["function owner()"]);
722
+ const calldata = iface.encodeFunctionData("owner", []);
723
+ return {
724
+ context: ethCallContext,
725
+ calldata,
726
+ };
727
+ }
728
+ catch (e) {
729
+ const stack = new Error().stack;
730
+ throw transformEtherError(e, undefined, stack);
731
+ }
732
+ },
733
+ renounceOwnership(ethCallContext) {
734
+ try {
735
+ const iface = new Interface(["function renounceOwnership()"]);
736
+ const calldata = iface.encodeFunctionData("renounceOwnership", []);
737
+ return {
738
+ context: ethCallContext,
739
+ calldata,
740
+ };
741
+ }
742
+ catch (e) {
743
+ const stack = new Error().stack;
744
+ throw transformEtherError(e, undefined, stack);
745
+ }
746
+ },
747
+ setLocker(_locker, ethCallContext) {
748
+ try {
749
+ const iface = new Interface(["function setLocker(address)"]);
750
+ const calldata = iface.encodeFunctionData("setLocker", [_locker]);
751
+ return {
752
+ context: ethCallContext,
753
+ calldata,
754
+ };
755
+ }
756
+ catch (e) {
757
+ const stack = new Error().stack;
758
+ throw transformEtherError(e, undefined, stack);
759
+ }
760
+ },
761
+ symbol(ethCallContext) {
762
+ try {
763
+ const iface = new Interface(["function symbol()"]);
764
+ const calldata = iface.encodeFunctionData("symbol", []);
765
+ return {
766
+ context: ethCallContext,
767
+ calldata,
768
+ };
769
+ }
770
+ catch (e) {
771
+ const stack = new Error().stack;
772
+ throw transformEtherError(e, undefined, stack);
773
+ }
774
+ },
775
+ totalSupply(ethCallContext) {
776
+ try {
777
+ const iface = new Interface(["function totalSupply()"]);
778
+ const calldata = iface.encodeFunctionData("totalSupply", []);
779
+ return {
780
+ context: ethCallContext,
781
+ calldata,
782
+ };
783
+ }
784
+ catch (e) {
785
+ const stack = new Error().stack;
786
+ throw transformEtherError(e, undefined, stack);
787
+ }
788
+ },
789
+ transfer(recipient, amount, ethCallContext) {
790
+ try {
791
+ const iface = new Interface(["function transfer(address,uint256)"]);
792
+ const calldata = iface.encodeFunctionData("transfer", [
793
+ recipient,
794
+ amount,
795
+ ]);
796
+ return {
797
+ context: ethCallContext,
798
+ calldata,
799
+ };
800
+ }
801
+ catch (e) {
802
+ const stack = new Error().stack;
803
+ throw transformEtherError(e, undefined, stack);
804
+ }
805
+ },
806
+ transferFrom(sender, recipient, amount, ethCallContext) {
807
+ try {
808
+ const iface = new Interface([
809
+ "function transferFrom(address,address,uint256)",
810
+ ]);
811
+ const calldata = iface.encodeFunctionData("transferFrom", [
812
+ sender,
813
+ recipient,
814
+ amount,
815
+ ]);
816
+ return {
817
+ context: ethCallContext,
818
+ calldata,
819
+ };
820
+ }
821
+ catch (e) {
822
+ const stack = new Error().stack;
823
+ throw transformEtherError(e, undefined, stack);
824
+ }
825
+ },
826
+ transferOwnership(newOwner, ethCallContext) {
827
+ try {
828
+ const iface = new Interface(["function transferOwnership(address)"]);
829
+ const calldata = iface.encodeFunctionData("transferOwnership", [
830
+ newOwner,
831
+ ]);
832
+ return {
833
+ context: ethCallContext,
834
+ calldata,
835
+ };
836
+ }
837
+ catch (e) {
838
+ const stack = new Error().stack;
839
+ throw transformEtherError(e, undefined, stack);
840
+ }
841
+ },
842
+ };
194
843
  }
195
844
  export class ERC20BoundContractView extends BoundContractView {
196
845
  async allowance(owner, spender, overrides) {
846
+ const ethCallContext = {
847
+ chainId: this.context.chainId,
848
+ blockTag: "0x" + this.context.blockNumber.toString(16),
849
+ address: this.context.address,
850
+ };
197
851
  return await this.view.allowance(owner, spender, {
198
852
  blockTag: this.context.blockNumber,
199
853
  ...overrides,
200
- });
854
+ }, this.context.preparedData, ethCallContext);
201
855
  }
202
856
  async balanceOf(account, overrides) {
857
+ const ethCallContext = {
858
+ chainId: this.context.chainId,
859
+ blockTag: "0x" + this.context.blockNumber.toString(16),
860
+ address: this.context.address,
861
+ };
203
862
  return await this.view.balanceOf(account, {
204
863
  blockTag: this.context.blockNumber,
205
864
  ...overrides,
206
- });
865
+ }, this.context.preparedData, ethCallContext);
207
866
  }
208
867
  async decimals(overrides) {
868
+ const ethCallContext = {
869
+ chainId: this.context.chainId,
870
+ blockTag: "0x" + this.context.blockNumber.toString(16),
871
+ address: this.context.address,
872
+ };
209
873
  return await this.view.decimals({
210
874
  blockTag: this.context.blockNumber,
211
875
  ...overrides,
212
- });
876
+ }, this.context.preparedData, ethCallContext);
213
877
  }
214
878
  async locker(overrides) {
879
+ const ethCallContext = {
880
+ chainId: this.context.chainId,
881
+ blockTag: "0x" + this.context.blockNumber.toString(16),
882
+ address: this.context.address,
883
+ };
215
884
  return await this.view.locker({
216
885
  blockTag: this.context.blockNumber,
217
886
  ...overrides,
218
- });
887
+ }, this.context.preparedData, ethCallContext);
219
888
  }
220
889
  async name(overrides) {
890
+ const ethCallContext = {
891
+ chainId: this.context.chainId,
892
+ blockTag: "0x" + this.context.blockNumber.toString(16),
893
+ address: this.context.address,
894
+ };
221
895
  return await this.view.name({
222
896
  blockTag: this.context.blockNumber,
223
897
  ...overrides,
224
- });
898
+ }, this.context.preparedData, ethCallContext);
225
899
  }
226
900
  async owner(overrides) {
901
+ const ethCallContext = {
902
+ chainId: this.context.chainId,
903
+ blockTag: "0x" + this.context.blockNumber.toString(16),
904
+ address: this.context.address,
905
+ };
227
906
  return await this.view.owner({
228
907
  blockTag: this.context.blockNumber,
229
908
  ...overrides,
230
- });
909
+ }, this.context.preparedData, ethCallContext);
231
910
  }
232
911
  async symbol(overrides) {
912
+ const ethCallContext = {
913
+ chainId: this.context.chainId,
914
+ blockTag: "0x" + this.context.blockNumber.toString(16),
915
+ address: this.context.address,
916
+ };
233
917
  return await this.view.symbol({
234
918
  blockTag: this.context.blockNumber,
235
919
  ...overrides,
236
- });
920
+ }, this.context.preparedData, ethCallContext);
237
921
  }
238
922
  async totalSupply(overrides) {
923
+ const ethCallContext = {
924
+ chainId: this.context.chainId,
925
+ blockTag: "0x" + this.context.blockNumber.toString(16),
926
+ address: this.context.address,
927
+ };
239
928
  return await this.view.totalSupply({
240
929
  blockTag: this.context.blockNumber,
241
930
  ...overrides,
242
- });
931
+ }, this.context.preparedData, ethCallContext);
243
932
  }
244
933
  callStatic = {
245
934
  view: this.view,
246
935
  context: this.context,
247
936
  async approve(spender, amount, overrides) {
937
+ const ethCallContext = {
938
+ chainId: this.context.chainId,
939
+ blockTag: "0x" + this.context.blockNumber.toString(16),
940
+ address: this.context.address,
941
+ };
248
942
  return await this.view.callStatic.approve(spender, amount, {
249
943
  blockTag: this.context.blockNumber,
250
944
  ...overrides,
251
- });
945
+ }, this.context.preparedData, ethCallContext);
252
946
  },
253
947
  async burn(amount, overrides) {
948
+ const ethCallContext = {
949
+ chainId: this.context.chainId,
950
+ blockTag: "0x" + this.context.blockNumber.toString(16),
951
+ address: this.context.address,
952
+ };
254
953
  return await this.view.callStatic.burn(amount, {
255
954
  blockTag: this.context.blockNumber,
256
955
  ...overrides,
257
- });
956
+ }, this.context.preparedData, ethCallContext);
258
957
  },
259
958
  async burnFrom(account, amount, overrides) {
959
+ const ethCallContext = {
960
+ chainId: this.context.chainId,
961
+ blockTag: "0x" + this.context.blockNumber.toString(16),
962
+ address: this.context.address,
963
+ };
260
964
  return await this.view.callStatic.burnFrom(account, amount, {
261
965
  blockTag: this.context.blockNumber,
262
966
  ...overrides,
263
- });
967
+ }, this.context.preparedData, ethCallContext);
264
968
  },
265
969
  async decreaseAllowance(spender, subtractedValue, overrides) {
970
+ const ethCallContext = {
971
+ chainId: this.context.chainId,
972
+ blockTag: "0x" + this.context.blockNumber.toString(16),
973
+ address: this.context.address,
974
+ };
266
975
  return await this.view.callStatic.decreaseAllowance(spender, subtractedValue, {
267
976
  blockTag: this.context.blockNumber,
268
977
  ...overrides,
269
- });
978
+ }, this.context.preparedData, ethCallContext);
270
979
  },
271
980
  async increaseAllowance(spender, addedValue, overrides) {
981
+ const ethCallContext = {
982
+ chainId: this.context.chainId,
983
+ blockTag: "0x" + this.context.blockNumber.toString(16),
984
+ address: this.context.address,
985
+ };
272
986
  return await this.view.callStatic.increaseAllowance(spender, addedValue, {
273
987
  blockTag: this.context.blockNumber,
274
988
  ...overrides,
275
- });
989
+ }, this.context.preparedData, ethCallContext);
276
990
  },
277
991
  async renounceOwnership(overrides) {
992
+ const ethCallContext = {
993
+ chainId: this.context.chainId,
994
+ blockTag: "0x" + this.context.blockNumber.toString(16),
995
+ address: this.context.address,
996
+ };
278
997
  return await this.view.callStatic.renounceOwnership({
279
998
  blockTag: this.context.blockNumber,
280
999
  ...overrides,
281
- });
1000
+ }, this.context.preparedData, ethCallContext);
282
1001
  },
283
1002
  async setLocker(_locker, overrides) {
1003
+ const ethCallContext = {
1004
+ chainId: this.context.chainId,
1005
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1006
+ address: this.context.address,
1007
+ };
284
1008
  return await this.view.callStatic.setLocker(_locker, {
285
1009
  blockTag: this.context.blockNumber,
286
1010
  ...overrides,
287
- });
1011
+ }, this.context.preparedData, ethCallContext);
288
1012
  },
289
1013
  async transfer(recipient, amount, overrides) {
1014
+ const ethCallContext = {
1015
+ chainId: this.context.chainId,
1016
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1017
+ address: this.context.address,
1018
+ };
290
1019
  return await this.view.callStatic.transfer(recipient, amount, {
291
1020
  blockTag: this.context.blockNumber,
292
1021
  ...overrides,
293
- });
1022
+ }, this.context.preparedData, ethCallContext);
294
1023
  },
295
1024
  async transferFrom(sender, recipient, amount, overrides) {
1025
+ const ethCallContext = {
1026
+ chainId: this.context.chainId,
1027
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1028
+ address: this.context.address,
1029
+ };
296
1030
  return await this.view.callStatic.transferFrom(sender, recipient, amount, {
297
1031
  blockTag: this.context.blockNumber,
298
1032
  ...overrides,
299
- });
1033
+ }, this.context.preparedData, ethCallContext);
300
1034
  },
301
1035
  async transferOwnership(newOwner, overrides) {
1036
+ const ethCallContext = {
1037
+ chainId: this.context.chainId,
1038
+ blockTag: "0x" + this.context.blockNumber.toString(16),
1039
+ address: this.context.address,
1040
+ };
302
1041
  return await this.view.callStatic.transferOwnership(newOwner, {
303
1042
  blockTag: this.context.blockNumber,
304
1043
  ...overrides,
1044
+ }, this.context.preparedData, ethCallContext);
1045
+ },
1046
+ };
1047
+ encodeCall = {
1048
+ view: this.view,
1049
+ context: this.context,
1050
+ allowance(owner, spender, overrides) {
1051
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1052
+ const address = this.context.address;
1053
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1054
+ if (overrides?.blockTag) {
1055
+ blockTag =
1056
+ typeof overrides.blockTag == "string"
1057
+ ? overrides.blockTag
1058
+ : "0x" + overrides.blockTag.toString(16);
1059
+ }
1060
+ return this.view.encodeCall.allowance(owner, spender, {
1061
+ chainId,
1062
+ address,
1063
+ blockTag,
1064
+ });
1065
+ },
1066
+ approve(spender, amount, overrides) {
1067
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1068
+ const address = this.context.address;
1069
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1070
+ if (overrides?.blockTag) {
1071
+ blockTag =
1072
+ typeof overrides.blockTag == "string"
1073
+ ? overrides.blockTag
1074
+ : "0x" + overrides.blockTag.toString(16);
1075
+ }
1076
+ return this.view.encodeCall.approve(spender, amount, {
1077
+ chainId,
1078
+ address,
1079
+ blockTag,
1080
+ });
1081
+ },
1082
+ balanceOf(account, overrides) {
1083
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1084
+ const address = this.context.address;
1085
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1086
+ if (overrides?.blockTag) {
1087
+ blockTag =
1088
+ typeof overrides.blockTag == "string"
1089
+ ? overrides.blockTag
1090
+ : "0x" + overrides.blockTag.toString(16);
1091
+ }
1092
+ return this.view.encodeCall.balanceOf(account, {
1093
+ chainId,
1094
+ address,
1095
+ blockTag,
1096
+ });
1097
+ },
1098
+ burn(amount, overrides) {
1099
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1100
+ const address = this.context.address;
1101
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1102
+ if (overrides?.blockTag) {
1103
+ blockTag =
1104
+ typeof overrides.blockTag == "string"
1105
+ ? overrides.blockTag
1106
+ : "0x" + overrides.blockTag.toString(16);
1107
+ }
1108
+ return this.view.encodeCall.burn(amount, { chainId, address, blockTag });
1109
+ },
1110
+ burnFrom(account, amount, overrides) {
1111
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1112
+ const address = this.context.address;
1113
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1114
+ if (overrides?.blockTag) {
1115
+ blockTag =
1116
+ typeof overrides.blockTag == "string"
1117
+ ? overrides.blockTag
1118
+ : "0x" + overrides.blockTag.toString(16);
1119
+ }
1120
+ return this.view.encodeCall.burnFrom(account, amount, {
1121
+ chainId,
1122
+ address,
1123
+ blockTag,
1124
+ });
1125
+ },
1126
+ decimals(overrides) {
1127
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1128
+ const address = this.context.address;
1129
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1130
+ if (overrides?.blockTag) {
1131
+ blockTag =
1132
+ typeof overrides.blockTag == "string"
1133
+ ? overrides.blockTag
1134
+ : "0x" + overrides.blockTag.toString(16);
1135
+ }
1136
+ return this.view.encodeCall.decimals({ chainId, address, blockTag });
1137
+ },
1138
+ decreaseAllowance(spender, subtractedValue, overrides) {
1139
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1140
+ const address = this.context.address;
1141
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1142
+ if (overrides?.blockTag) {
1143
+ blockTag =
1144
+ typeof overrides.blockTag == "string"
1145
+ ? overrides.blockTag
1146
+ : "0x" + overrides.blockTag.toString(16);
1147
+ }
1148
+ return this.view.encodeCall.decreaseAllowance(spender, subtractedValue, {
1149
+ chainId,
1150
+ address,
1151
+ blockTag,
1152
+ });
1153
+ },
1154
+ increaseAllowance(spender, addedValue, overrides) {
1155
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1156
+ const address = this.context.address;
1157
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1158
+ if (overrides?.blockTag) {
1159
+ blockTag =
1160
+ typeof overrides.blockTag == "string"
1161
+ ? overrides.blockTag
1162
+ : "0x" + overrides.blockTag.toString(16);
1163
+ }
1164
+ return this.view.encodeCall.increaseAllowance(spender, addedValue, {
1165
+ chainId,
1166
+ address,
1167
+ blockTag,
1168
+ });
1169
+ },
1170
+ locker(overrides) {
1171
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1172
+ const address = this.context.address;
1173
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1174
+ if (overrides?.blockTag) {
1175
+ blockTag =
1176
+ typeof overrides.blockTag == "string"
1177
+ ? overrides.blockTag
1178
+ : "0x" + overrides.blockTag.toString(16);
1179
+ }
1180
+ return this.view.encodeCall.locker({ chainId, address, blockTag });
1181
+ },
1182
+ name(overrides) {
1183
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1184
+ const address = this.context.address;
1185
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1186
+ if (overrides?.blockTag) {
1187
+ blockTag =
1188
+ typeof overrides.blockTag == "string"
1189
+ ? overrides.blockTag
1190
+ : "0x" + overrides.blockTag.toString(16);
1191
+ }
1192
+ return this.view.encodeCall.name({ chainId, address, blockTag });
1193
+ },
1194
+ owner(overrides) {
1195
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1196
+ const address = this.context.address;
1197
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1198
+ if (overrides?.blockTag) {
1199
+ blockTag =
1200
+ typeof overrides.blockTag == "string"
1201
+ ? overrides.blockTag
1202
+ : "0x" + overrides.blockTag.toString(16);
1203
+ }
1204
+ return this.view.encodeCall.owner({ chainId, address, blockTag });
1205
+ },
1206
+ renounceOwnership(overrides) {
1207
+ const chainId = 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
+ return this.view.encodeCall.renounceOwnership({
1217
+ chainId,
1218
+ address,
1219
+ blockTag,
1220
+ });
1221
+ },
1222
+ setLocker(_locker, overrides) {
1223
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1224
+ const address = this.context.address;
1225
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1226
+ if (overrides?.blockTag) {
1227
+ blockTag =
1228
+ typeof overrides.blockTag == "string"
1229
+ ? overrides.blockTag
1230
+ : "0x" + overrides.blockTag.toString(16);
1231
+ }
1232
+ return this.view.encodeCall.setLocker(_locker, {
1233
+ chainId,
1234
+ address,
1235
+ blockTag,
1236
+ });
1237
+ },
1238
+ symbol(overrides) {
1239
+ const chainId = 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
+ return this.view.encodeCall.symbol({ chainId, address, blockTag });
1249
+ },
1250
+ totalSupply(overrides) {
1251
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1252
+ const address = this.context.address;
1253
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1254
+ if (overrides?.blockTag) {
1255
+ blockTag =
1256
+ typeof overrides.blockTag == "string"
1257
+ ? overrides.blockTag
1258
+ : "0x" + overrides.blockTag.toString(16);
1259
+ }
1260
+ return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
1261
+ },
1262
+ transfer(recipient, amount, overrides) {
1263
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1264
+ const address = this.context.address;
1265
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1266
+ if (overrides?.blockTag) {
1267
+ blockTag =
1268
+ typeof overrides.blockTag == "string"
1269
+ ? overrides.blockTag
1270
+ : "0x" + overrides.blockTag.toString(16);
1271
+ }
1272
+ return this.view.encodeCall.transfer(recipient, amount, {
1273
+ chainId,
1274
+ address,
1275
+ blockTag,
1276
+ });
1277
+ },
1278
+ transferFrom(sender, recipient, amount, overrides) {
1279
+ const chainId = 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
+ return this.view.encodeCall.transferFrom(sender, recipient, amount, {
1289
+ chainId,
1290
+ address,
1291
+ blockTag,
1292
+ });
1293
+ },
1294
+ transferOwnership(newOwner, overrides) {
1295
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
1296
+ const address = this.context.address;
1297
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
1298
+ if (overrides?.blockTag) {
1299
+ blockTag =
1300
+ typeof overrides.blockTag == "string"
1301
+ ? overrides.blockTag
1302
+ : "0x" + overrides.blockTag.toString(16);
1303
+ }
1304
+ return this.view.encodeCall.transferOwnership(newOwner, {
1305
+ chainId,
1306
+ address,
1307
+ blockTag,
305
1308
  });
306
1309
  },
307
1310
  };