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