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