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

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 (215) 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 +1226 -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 +486 -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 +985 -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 +485 -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 +784 -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 +574 -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 +80 -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/stark/codegen/codegen.d.ts +2 -0
  88. package/lib/stark/codegen/codegen.d.ts.map +1 -0
  89. package/lib/stark/codegen/codegen.js +109 -0
  90. package/lib/stark/codegen/codegen.js.map +1 -0
  91. package/lib/stark/codegen/index.d.ts +2 -0
  92. package/lib/stark/codegen/index.d.ts.map +1 -0
  93. package/lib/stark/codegen/index.js +2 -0
  94. package/lib/stark/codegen/index.js.map +1 -0
  95. package/lib/stark/codegen/run.d.ts +2 -0
  96. package/lib/stark/codegen/run.d.ts.map +1 -0
  97. package/lib/stark/codegen/run.js +11 -0
  98. package/lib/stark/codegen/run.js.map +1 -0
  99. package/lib/stark/codegen/utils.d.ts +2 -0
  100. package/lib/stark/codegen/utils.d.ts.map +1 -0
  101. package/lib/stark/codegen/utils.js +4 -0
  102. package/lib/stark/codegen/utils.js.map +1 -0
  103. package/lib/stark/context.d.ts +28 -0
  104. package/lib/stark/context.d.ts.map +1 -0
  105. package/lib/stark/context.js +59 -0
  106. package/lib/stark/context.js.map +1 -0
  107. package/lib/stark/contract.d.ts +12 -0
  108. package/lib/stark/contract.d.ts.map +1 -0
  109. package/lib/stark/contract.js +43 -0
  110. package/lib/stark/contract.js.map +1 -0
  111. package/lib/stark/event.d.ts +7 -0
  112. package/lib/stark/event.d.ts.map +1 -0
  113. package/lib/stark/event.js +11 -0
  114. package/lib/stark/event.js.map +1 -0
  115. package/lib/stark/index.d.ts +7 -0
  116. package/lib/stark/index.d.ts.map +1 -0
  117. package/lib/stark/index.js +7 -0
  118. package/lib/stark/index.js.map +1 -0
  119. package/lib/stark/starknet-plugin.d.ts +17 -0
  120. package/lib/stark/starknet-plugin.d.ts.map +1 -0
  121. package/lib/stark/starknet-plugin.js +78 -0
  122. package/lib/stark/starknet-plugin.js.map +1 -0
  123. package/lib/stark/starknet-processor.d.ts +32 -0
  124. package/lib/stark/starknet-processor.d.ts.map +1 -0
  125. package/lib/stark/starknet-processor.js +111 -0
  126. package/lib/stark/starknet-processor.js.map +1 -0
  127. package/lib/stark/types.d.ts +11 -0
  128. package/lib/stark/types.d.ts.map +1 -0
  129. package/lib/stark/types.js +2 -0
  130. package/lib/stark/types.js.map +1 -0
  131. package/lib/store/cache.d.ts +14 -0
  132. package/lib/store/cache.d.ts.map +1 -0
  133. package/lib/store/cache.js +35 -0
  134. package/lib/store/cache.js.map +1 -0
  135. package/lib/store/store.d.ts +2 -3
  136. package/lib/store/store.d.ts.map +1 -1
  137. package/lib/store/store.js +34 -9
  138. package/lib/store/store.js.map +1 -1
  139. package/lib/sui/context.d.ts +1 -1
  140. package/lib/sui/context.d.ts.map +1 -1
  141. package/lib/sui/sui-processor.d.ts +1 -1
  142. package/lib/sui/sui-processor.d.ts.map +1 -1
  143. package/lib/sui/sui-processor.js +1 -1
  144. package/lib/sui/sui-processor.js.map +1 -1
  145. package/lib/testing/aptos-facet.d.ts +1 -1
  146. package/lib/testing/aptos-facet.js +2 -2
  147. package/lib/testing/starknet-facet.d.ts +9 -0
  148. package/lib/testing/starknet-facet.d.ts.map +1 -0
  149. package/lib/testing/starknet-facet.js +52 -0
  150. package/lib/testing/starknet-facet.js.map +1 -0
  151. package/lib/testing/sui-facet.js +1 -1
  152. package/lib/testing/test-processor-server.d.ts +2 -0
  153. package/lib/testing/test-processor-server.d.ts.map +1 -1
  154. package/lib/testing/test-processor-server.js +3 -0
  155. package/lib/testing/test-processor-server.js.map +1 -1
  156. package/lib/tsup.config.ts +3 -15
  157. package/lib/utils/dex-price.d.ts +1 -0
  158. package/lib/utils/dex-price.d.ts.map +1 -1
  159. package/lib/utils/dex-price.js +13 -2
  160. package/lib/utils/dex-price.js.map +1 -1
  161. package/package.json +21 -10
  162. package/src/aptos/aptos-processor.ts +1 -1
  163. package/src/aptos/context.ts +2 -2
  164. package/src/aptos/ext/aptos-dex.ts +1 -1
  165. package/src/aptos/ext/coin-event.ts +1 -1
  166. package/src/aptos/ext/coin.ts +2 -2
  167. package/src/bundle.config.ts +23 -0
  168. package/src/eth/account-processor.ts +28 -12
  169. package/src/eth/base-processor-template.ts +16 -8
  170. package/src/eth/base-processor.ts +25 -16
  171. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1554 -123
  172. package/src/eth/builtin/internal/erc1155-processor.ts +659 -42
  173. package/src/eth/builtin/internal/erc20-processor.ts +1266 -90
  174. package/src/eth/builtin/internal/erc20bytes-processor.ts +639 -49
  175. package/src/eth/builtin/internal/erc721-processor.ts +1035 -70
  176. package/src/eth/builtin/internal/weth9-processor.ts +758 -63
  177. package/src/eth/codegen/event-handler.ts +1 -1
  178. package/src/eth/codegen/file.ts +26 -3
  179. package/src/eth/codegen/function-calls.ts +96 -8
  180. package/src/eth/codegen/types.ts +22 -1
  181. package/src/eth/context.ts +7 -0
  182. package/src/eth/eth-plugin.ts +34 -26
  183. package/src/eth/eth.ts +1 -2
  184. package/src/eth/generic-processor.ts +1 -1
  185. package/src/eth/index.ts +5 -1
  186. package/src/solana/builtin/spl-token-processor.ts +1 -1
  187. package/src/solana/solana-context.ts +2 -2
  188. package/src/stark/codegen/codegen.ts +124 -0
  189. package/src/stark/codegen/index.ts +1 -0
  190. package/src/stark/codegen/run.ts +10 -0
  191. package/src/stark/codegen/utils.ts +3 -0
  192. package/src/stark/context.ts +78 -0
  193. package/src/stark/contract.ts +55 -0
  194. package/src/stark/event.ts +7 -0
  195. package/src/stark/index.ts +9 -0
  196. package/src/stark/starknet-plugin.ts +108 -0
  197. package/src/stark/starknet-processor.ts +140 -0
  198. package/src/stark/types.ts +11 -0
  199. package/src/store/cache.ts +46 -0
  200. package/src/store/store.ts +40 -22
  201. package/src/sui/context.ts +1 -1
  202. package/src/sui/sui-processor.ts +1 -1
  203. package/src/testing/aptos-facet.ts +2 -2
  204. package/src/testing/starknet-facet.ts +61 -0
  205. package/src/testing/sui-facet.ts +1 -1
  206. package/src/testing/test-processor-server.ts +3 -0
  207. package/src/tsup.config.ts +3 -15
  208. package/src/utils/dex-price.ts +15 -2
  209. package/lib/eth/provider.d.ts +0 -5
  210. package/lib/eth/provider.d.ts.map +0 -1
  211. package/lib/eth/provider.js +0 -134
  212. package/lib/eth/provider.js.map +0 -1
  213. package/lib/utils/chainlink-oracles-sepolia.csv +0 -19
  214. package/lib/utils/chainlink-oracles.csv +0 -217
  215. 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 { ERC1155__factory } from "./index.js";
3
7
  const templateContract = ERC1155__factory.connect("0x0", DummyProvider);
4
8
  export class ERC1155ContractView extends ContractView {
@@ -6,8 +10,23 @@ export class ERC1155ContractView extends ContractView {
6
10
  super(contract);
7
11
  this.callStatic.contract = contract;
8
12
  }
9
- async balanceOf(account, id, overrides) {
13
+ async balanceOf(account, id, overrides, preparedData, ethCallContext) {
10
14
  try {
15
+ if (preparedData?.ethCallResults && ethCallContext) {
16
+ const iface = new Interface([
17
+ "function balanceOf(address,uint256) view returns (uint256)",
18
+ ]);
19
+ const calldata = iface.encodeFunctionData("balanceOf", [account, id]);
20
+ const key = makeEthCallKey({
21
+ context: ethCallContext,
22
+ calldata,
23
+ });
24
+ const ret = preparedData.ethCallResults[key];
25
+ if (ret) {
26
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
27
+ return result.length == 1 ? result[0] : result;
28
+ }
29
+ }
11
30
  return await this.contract.getFunction("balanceOf(address,uint256)")(account, id, overrides || {});
12
31
  }
13
32
  catch (e) {
@@ -15,8 +34,28 @@ export class ERC1155ContractView extends ContractView {
15
34
  throw transformEtherError(e, undefined, stack);
16
35
  }
17
36
  }
18
- async balanceOfBatch(accounts, ids, overrides) {
37
+ async balanceOfBatch(accounts, ids, overrides, preparedData, ethCallContext) {
19
38
  try {
39
+ if (preparedData?.ethCallResults && ethCallContext) {
40
+ const iface = new Interface([
41
+ "function balanceOfBatch(address[],uint256[]) view returns (uint256[])",
42
+ ]);
43
+ const calldata = iface.encodeFunctionData("balanceOfBatch", [
44
+ accounts,
45
+ ids,
46
+ ]);
47
+ const key = makeEthCallKey({
48
+ context: ethCallContext,
49
+ calldata,
50
+ });
51
+ const ret = preparedData.ethCallResults[key];
52
+ if (ret) {
53
+ const result = iface
54
+ .decodeFunctionResult("balanceOfBatch", ret)
55
+ .toArray();
56
+ return result.length == 1 ? result[0] : result;
57
+ }
58
+ }
20
59
  return await this.contract.getFunction("balanceOfBatch(address[],uint256[])")(accounts, ids, overrides || {});
21
60
  }
22
61
  catch (e) {
@@ -24,8 +63,28 @@ export class ERC1155ContractView extends ContractView {
24
63
  throw transformEtherError(e, undefined, stack);
25
64
  }
26
65
  }
27
- async isApprovedForAll(account, operator, overrides) {
66
+ async isApprovedForAll(account, operator, overrides, preparedData, ethCallContext) {
28
67
  try {
68
+ if (preparedData?.ethCallResults && ethCallContext) {
69
+ const iface = new Interface([
70
+ "function isApprovedForAll(address,address) view returns (bool)",
71
+ ]);
72
+ const calldata = iface.encodeFunctionData("isApprovedForAll", [
73
+ account,
74
+ operator,
75
+ ]);
76
+ const key = makeEthCallKey({
77
+ context: ethCallContext,
78
+ calldata,
79
+ });
80
+ const ret = preparedData.ethCallResults[key];
81
+ if (ret) {
82
+ const result = iface
83
+ .decodeFunctionResult("isApprovedForAll", ret)
84
+ .toArray();
85
+ return result.length == 1 ? result[0] : result;
86
+ }
87
+ }
29
88
  return await this.contract.getFunction("isApprovedForAll(address,address)")(account, operator, overrides || {});
30
89
  }
31
90
  catch (e) {
@@ -33,8 +92,27 @@ export class ERC1155ContractView extends ContractView {
33
92
  throw transformEtherError(e, undefined, stack);
34
93
  }
35
94
  }
36
- async supportsInterface(interfaceId, overrides) {
95
+ async supportsInterface(interfaceId, overrides, preparedData, ethCallContext) {
37
96
  try {
97
+ if (preparedData?.ethCallResults && ethCallContext) {
98
+ const iface = new Interface([
99
+ "function supportsInterface(bytes4) view returns (bool)",
100
+ ]);
101
+ const calldata = iface.encodeFunctionData("supportsInterface", [
102
+ interfaceId,
103
+ ]);
104
+ const key = makeEthCallKey({
105
+ context: ethCallContext,
106
+ calldata,
107
+ });
108
+ const ret = preparedData.ethCallResults[key];
109
+ if (ret) {
110
+ const result = iface
111
+ .decodeFunctionResult("supportsInterface", ret)
112
+ .toArray();
113
+ return result.length == 1 ? result[0] : result;
114
+ }
115
+ }
38
116
  return await this.contract.getFunction("supportsInterface(bytes4)")(interfaceId, overrides || {});
39
117
  }
40
118
  catch (e) {
@@ -42,8 +120,23 @@ export class ERC1155ContractView extends ContractView {
42
120
  throw transformEtherError(e, undefined, stack);
43
121
  }
44
122
  }
45
- async uri(id, overrides) {
123
+ async uri(id, overrides, preparedData, ethCallContext) {
46
124
  try {
125
+ if (preparedData?.ethCallResults && ethCallContext) {
126
+ const iface = new Interface([
127
+ "function uri(uint256) view returns (string)",
128
+ ]);
129
+ const calldata = iface.encodeFunctionData("uri", [id]);
130
+ const key = makeEthCallKey({
131
+ context: ethCallContext,
132
+ calldata,
133
+ });
134
+ const ret = preparedData.ethCallResults[key];
135
+ if (ret) {
136
+ const result = iface.decodeFunctionResult("uri", ret).toArray();
137
+ return result.length == 1 ? result[0] : result;
138
+ }
139
+ }
47
140
  return await this.contract.getFunction("uri(uint256)")(id, overrides || {});
48
141
  }
49
142
  catch (e) {
@@ -53,8 +146,31 @@ export class ERC1155ContractView extends ContractView {
53
146
  }
54
147
  callStatic = {
55
148
  contract: this.contract,
56
- async safeBatchTransferFrom(from, to, ids, amounts, data, overrides) {
149
+ async safeBatchTransferFrom(from, to, ids, amounts, data, overrides, preparedData, ethCallContext) {
57
150
  try {
151
+ if (preparedData?.ethCallResults && ethCallContext) {
152
+ const iface = new Interface([
153
+ "function safeBatchTransferFrom(address,address,uint256[],uint256[],bytes) nonpayable returns ()",
154
+ ]);
155
+ const calldata = iface.encodeFunctionData("safeBatchTransferFrom", [
156
+ from,
157
+ to,
158
+ ids,
159
+ amounts,
160
+ data,
161
+ ]);
162
+ const key = makeEthCallKey({
163
+ context: ethCallContext,
164
+ calldata,
165
+ });
166
+ const ret = preparedData.ethCallResults[key];
167
+ if (ret) {
168
+ const result = iface
169
+ .decodeFunctionResult("safeBatchTransferFrom", ret)
170
+ .toArray();
171
+ return result.length == 1 ? result[0] : result;
172
+ }
173
+ }
58
174
  return await this.contract
59
175
  .getFunction("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)")
60
176
  .staticCall(from, to, ids, amounts, data, overrides || {});
@@ -64,8 +180,31 @@ export class ERC1155ContractView extends ContractView {
64
180
  throw transformEtherError(e, undefined, stack);
65
181
  }
66
182
  },
67
- async safeTransferFrom(from, to, id, amount, data, overrides) {
183
+ async safeTransferFrom(from, to, id, amount, data, overrides, preparedData, ethCallContext) {
68
184
  try {
185
+ if (preparedData?.ethCallResults && ethCallContext) {
186
+ const iface = new Interface([
187
+ "function safeTransferFrom(address,address,uint256,uint256,bytes) nonpayable returns ()",
188
+ ]);
189
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
190
+ from,
191
+ to,
192
+ id,
193
+ amount,
194
+ data,
195
+ ]);
196
+ const key = makeEthCallKey({
197
+ context: ethCallContext,
198
+ calldata,
199
+ });
200
+ const ret = preparedData.ethCallResults[key];
201
+ if (ret) {
202
+ const result = iface
203
+ .decodeFunctionResult("safeTransferFrom", ret)
204
+ .toArray();
205
+ return result.length == 1 ? result[0] : result;
206
+ }
207
+ }
69
208
  return await this.contract
70
209
  .getFunction("safeTransferFrom(address,address,uint256,uint256,bytes)")
71
210
  .staticCall(from, to, id, amount, data, overrides || {});
@@ -75,8 +214,28 @@ export class ERC1155ContractView extends ContractView {
75
214
  throw transformEtherError(e, undefined, stack);
76
215
  }
77
216
  },
78
- async setApprovalForAll(operator, approved, overrides) {
217
+ async setApprovalForAll(operator, approved, overrides, preparedData, ethCallContext) {
79
218
  try {
219
+ if (preparedData?.ethCallResults && ethCallContext) {
220
+ const iface = new Interface([
221
+ "function setApprovalForAll(address,bool) nonpayable returns ()",
222
+ ]);
223
+ const calldata = iface.encodeFunctionData("setApprovalForAll", [
224
+ operator,
225
+ approved,
226
+ ]);
227
+ const key = makeEthCallKey({
228
+ context: ethCallContext,
229
+ calldata,
230
+ });
231
+ const ret = preparedData.ethCallResults[key];
232
+ if (ret) {
233
+ const result = iface
234
+ .decodeFunctionResult("setApprovalForAll", ret)
235
+ .toArray();
236
+ return result.length == 1 ? result[0] : result;
237
+ }
238
+ }
80
239
  return await this.contract
81
240
  .getFunction("setApprovalForAll(address,bool)")
82
241
  .staticCall(operator, approved, overrides || {});
@@ -87,59 +246,370 @@ export class ERC1155ContractView extends ContractView {
87
246
  }
88
247
  },
89
248
  };
249
+ encodeCall = {
250
+ balanceOf(account, id, ethCallContext) {
251
+ try {
252
+ const iface = new Interface(["function balanceOf(address,uint256)"]);
253
+ const calldata = iface.encodeFunctionData("balanceOf", [account, id]);
254
+ return {
255
+ context: ethCallContext,
256
+ calldata,
257
+ };
258
+ }
259
+ catch (e) {
260
+ const stack = new Error().stack;
261
+ throw transformEtherError(e, undefined, stack);
262
+ }
263
+ },
264
+ balanceOfBatch(accounts, ids, ethCallContext) {
265
+ try {
266
+ const iface = new Interface([
267
+ "function balanceOfBatch(address[],uint256[])",
268
+ ]);
269
+ const calldata = iface.encodeFunctionData("balanceOfBatch", [
270
+ accounts,
271
+ ids,
272
+ ]);
273
+ return {
274
+ context: ethCallContext,
275
+ calldata,
276
+ };
277
+ }
278
+ catch (e) {
279
+ const stack = new Error().stack;
280
+ throw transformEtherError(e, undefined, stack);
281
+ }
282
+ },
283
+ isApprovedForAll(account, operator, ethCallContext) {
284
+ try {
285
+ const iface = new Interface([
286
+ "function isApprovedForAll(address,address)",
287
+ ]);
288
+ const calldata = iface.encodeFunctionData("isApprovedForAll", [
289
+ account,
290
+ operator,
291
+ ]);
292
+ return {
293
+ context: ethCallContext,
294
+ calldata,
295
+ };
296
+ }
297
+ catch (e) {
298
+ const stack = new Error().stack;
299
+ throw transformEtherError(e, undefined, stack);
300
+ }
301
+ },
302
+ safeBatchTransferFrom(from, to, ids, amounts, data, ethCallContext) {
303
+ try {
304
+ const iface = new Interface([
305
+ "function safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)",
306
+ ]);
307
+ const calldata = iface.encodeFunctionData("safeBatchTransferFrom", [
308
+ from,
309
+ to,
310
+ ids,
311
+ amounts,
312
+ data,
313
+ ]);
314
+ return {
315
+ context: ethCallContext,
316
+ calldata,
317
+ };
318
+ }
319
+ catch (e) {
320
+ const stack = new Error().stack;
321
+ throw transformEtherError(e, undefined, stack);
322
+ }
323
+ },
324
+ safeTransferFrom(from, to, id, amount, data, ethCallContext) {
325
+ try {
326
+ const iface = new Interface([
327
+ "function safeTransferFrom(address,address,uint256,uint256,bytes)",
328
+ ]);
329
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
330
+ from,
331
+ to,
332
+ id,
333
+ amount,
334
+ data,
335
+ ]);
336
+ return {
337
+ context: ethCallContext,
338
+ calldata,
339
+ };
340
+ }
341
+ catch (e) {
342
+ const stack = new Error().stack;
343
+ throw transformEtherError(e, undefined, stack);
344
+ }
345
+ },
346
+ setApprovalForAll(operator, approved, ethCallContext) {
347
+ try {
348
+ const iface = new Interface([
349
+ "function setApprovalForAll(address,bool)",
350
+ ]);
351
+ const calldata = iface.encodeFunctionData("setApprovalForAll", [
352
+ operator,
353
+ approved,
354
+ ]);
355
+ return {
356
+ context: ethCallContext,
357
+ calldata,
358
+ };
359
+ }
360
+ catch (e) {
361
+ const stack = new Error().stack;
362
+ throw transformEtherError(e, undefined, stack);
363
+ }
364
+ },
365
+ supportsInterface(interfaceId, ethCallContext) {
366
+ try {
367
+ const iface = new Interface(["function supportsInterface(bytes4)"]);
368
+ const calldata = iface.encodeFunctionData("supportsInterface", [
369
+ interfaceId,
370
+ ]);
371
+ return {
372
+ context: ethCallContext,
373
+ calldata,
374
+ };
375
+ }
376
+ catch (e) {
377
+ const stack = new Error().stack;
378
+ throw transformEtherError(e, undefined, stack);
379
+ }
380
+ },
381
+ uri(id, ethCallContext) {
382
+ try {
383
+ const iface = new Interface(["function uri(uint256)"]);
384
+ const calldata = iface.encodeFunctionData("uri", [id]);
385
+ return {
386
+ context: ethCallContext,
387
+ calldata,
388
+ };
389
+ }
390
+ catch (e) {
391
+ const stack = new Error().stack;
392
+ throw transformEtherError(e, undefined, stack);
393
+ }
394
+ },
395
+ };
90
396
  }
91
397
  export class ERC1155BoundContractView extends BoundContractView {
92
398
  async balanceOf(account, id, overrides) {
399
+ const ethCallContext = {
400
+ chainId: this.context.chainId,
401
+ blockTag: "0x" + this.context.blockNumber.toString(16),
402
+ address: this.context.address,
403
+ };
93
404
  return await this.view.balanceOf(account, id, {
94
405
  blockTag: this.context.blockNumber,
95
406
  ...overrides,
96
- });
407
+ }, this.context.preparedData, ethCallContext);
97
408
  }
98
409
  async balanceOfBatch(accounts, ids, overrides) {
410
+ const ethCallContext = {
411
+ chainId: this.context.chainId,
412
+ blockTag: "0x" + this.context.blockNumber.toString(16),
413
+ address: this.context.address,
414
+ };
99
415
  return await this.view.balanceOfBatch(accounts, ids, {
100
416
  blockTag: this.context.blockNumber,
101
417
  ...overrides,
102
- });
418
+ }, this.context.preparedData, ethCallContext);
103
419
  }
104
420
  async isApprovedForAll(account, operator, overrides) {
421
+ const ethCallContext = {
422
+ chainId: this.context.chainId,
423
+ blockTag: "0x" + this.context.blockNumber.toString(16),
424
+ address: this.context.address,
425
+ };
105
426
  return await this.view.isApprovedForAll(account, operator, {
106
427
  blockTag: this.context.blockNumber,
107
428
  ...overrides,
108
- });
429
+ }, this.context.preparedData, ethCallContext);
109
430
  }
110
431
  async supportsInterface(interfaceId, overrides) {
432
+ const ethCallContext = {
433
+ chainId: this.context.chainId,
434
+ blockTag: "0x" + this.context.blockNumber.toString(16),
435
+ address: this.context.address,
436
+ };
111
437
  return await this.view.supportsInterface(interfaceId, {
112
438
  blockTag: this.context.blockNumber,
113
439
  ...overrides,
114
- });
440
+ }, this.context.preparedData, ethCallContext);
115
441
  }
116
442
  async uri(id, overrides) {
443
+ const ethCallContext = {
444
+ chainId: this.context.chainId,
445
+ blockTag: "0x" + this.context.blockNumber.toString(16),
446
+ address: this.context.address,
447
+ };
117
448
  return await this.view.uri(id, {
118
449
  blockTag: this.context.blockNumber,
119
450
  ...overrides,
120
- });
451
+ }, this.context.preparedData, ethCallContext);
121
452
  }
122
453
  callStatic = {
123
454
  view: this.view,
124
455
  context: this.context,
125
456
  async safeBatchTransferFrom(from, to, ids, amounts, data, overrides) {
457
+ const ethCallContext = {
458
+ chainId: this.context.chainId,
459
+ blockTag: "0x" + this.context.blockNumber.toString(16),
460
+ address: this.context.address,
461
+ };
126
462
  return await this.view.callStatic.safeBatchTransferFrom(from, to, ids, amounts, data, {
127
463
  blockTag: this.context.blockNumber,
128
464
  ...overrides,
129
- });
465
+ }, this.context.preparedData, ethCallContext);
130
466
  },
131
467
  async safeTransferFrom(from, to, id, amount, data, overrides) {
468
+ const ethCallContext = {
469
+ chainId: this.context.chainId,
470
+ blockTag: "0x" + this.context.blockNumber.toString(16),
471
+ address: this.context.address,
472
+ };
132
473
  return await this.view.callStatic.safeTransferFrom(from, to, id, amount, data, {
133
474
  blockTag: this.context.blockNumber,
134
475
  ...overrides,
135
- });
476
+ }, this.context.preparedData, ethCallContext);
136
477
  },
137
478
  async setApprovalForAll(operator, approved, overrides) {
479
+ const ethCallContext = {
480
+ chainId: this.context.chainId,
481
+ blockTag: "0x" + this.context.blockNumber.toString(16),
482
+ address: this.context.address,
483
+ };
138
484
  return await this.view.callStatic.setApprovalForAll(operator, approved, {
139
485
  blockTag: this.context.blockNumber,
140
486
  ...overrides,
487
+ }, this.context.preparedData, ethCallContext);
488
+ },
489
+ };
490
+ encodeCall = {
491
+ view: this.view,
492
+ context: this.context,
493
+ balanceOf(account, id, overrides) {
494
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
495
+ const address = this.context.address;
496
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
497
+ if (overrides?.blockTag) {
498
+ blockTag =
499
+ typeof overrides.blockTag == "string"
500
+ ? overrides.blockTag
501
+ : "0x" + overrides.blockTag.toString(16);
502
+ }
503
+ return this.view.encodeCall.balanceOf(account, id, {
504
+ chainId,
505
+ address,
506
+ blockTag,
507
+ });
508
+ },
509
+ balanceOfBatch(accounts, ids, overrides) {
510
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
511
+ const address = this.context.address;
512
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
513
+ if (overrides?.blockTag) {
514
+ blockTag =
515
+ typeof overrides.blockTag == "string"
516
+ ? overrides.blockTag
517
+ : "0x" + overrides.blockTag.toString(16);
518
+ }
519
+ return this.view.encodeCall.balanceOfBatch(accounts, ids, {
520
+ chainId,
521
+ address,
522
+ blockTag,
523
+ });
524
+ },
525
+ isApprovedForAll(account, operator, overrides) {
526
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
527
+ const address = this.context.address;
528
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
529
+ if (overrides?.blockTag) {
530
+ blockTag =
531
+ typeof overrides.blockTag == "string"
532
+ ? overrides.blockTag
533
+ : "0x" + overrides.blockTag.toString(16);
534
+ }
535
+ return this.view.encodeCall.isApprovedForAll(account, operator, {
536
+ chainId,
537
+ address,
538
+ blockTag,
539
+ });
540
+ },
541
+ safeBatchTransferFrom(from, to, ids, amounts, data, overrides) {
542
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
543
+ const address = this.context.address;
544
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
545
+ if (overrides?.blockTag) {
546
+ blockTag =
547
+ typeof overrides.blockTag == "string"
548
+ ? overrides.blockTag
549
+ : "0x" + overrides.blockTag.toString(16);
550
+ }
551
+ return this.view.encodeCall.safeBatchTransferFrom(from, to, ids, amounts, data, { chainId, address, blockTag });
552
+ },
553
+ safeTransferFrom(from, to, id, amount, data, overrides) {
554
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
555
+ const address = this.context.address;
556
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
557
+ if (overrides?.blockTag) {
558
+ blockTag =
559
+ typeof overrides.blockTag == "string"
560
+ ? overrides.blockTag
561
+ : "0x" + overrides.blockTag.toString(16);
562
+ }
563
+ return this.view.encodeCall.safeTransferFrom(from, to, id, amount, data, {
564
+ chainId,
565
+ address,
566
+ blockTag,
567
+ });
568
+ },
569
+ setApprovalForAll(operator, approved, overrides) {
570
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
571
+ const address = this.context.address;
572
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
573
+ if (overrides?.blockTag) {
574
+ blockTag =
575
+ typeof overrides.blockTag == "string"
576
+ ? overrides.blockTag
577
+ : "0x" + overrides.blockTag.toString(16);
578
+ }
579
+ return this.view.encodeCall.setApprovalForAll(operator, approved, {
580
+ chainId,
581
+ address,
582
+ blockTag,
583
+ });
584
+ },
585
+ supportsInterface(interfaceId, overrides) {
586
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
587
+ const address = this.context.address;
588
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
589
+ if (overrides?.blockTag) {
590
+ blockTag =
591
+ typeof overrides.blockTag == "string"
592
+ ? overrides.blockTag
593
+ : "0x" + overrides.blockTag.toString(16);
594
+ }
595
+ return this.view.encodeCall.supportsInterface(interfaceId, {
596
+ chainId,
597
+ address,
598
+ blockTag,
141
599
  });
142
600
  },
601
+ uri(id, overrides) {
602
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
603
+ const address = this.context.address;
604
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
605
+ if (overrides?.blockTag) {
606
+ blockTag =
607
+ typeof overrides.blockTag == "string"
608
+ ? overrides.blockTag
609
+ : "0x" + overrides.blockTag.toString(16);
610
+ }
611
+ return this.view.encodeCall.uri(id, { chainId, address, blockTag });
612
+ },
143
613
  };
144
614
  }
145
615
  export class ERC1155Processor extends BaseProcessor {