@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.
- 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 +1226 -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 +486 -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 +985 -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 +485 -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 +784 -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 +574 -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 +80 -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/stark/codegen/codegen.d.ts +2 -0
- package/lib/stark/codegen/codegen.d.ts.map +1 -0
- package/lib/stark/codegen/codegen.js +109 -0
- package/lib/stark/codegen/codegen.js.map +1 -0
- package/lib/stark/codegen/index.d.ts +2 -0
- package/lib/stark/codegen/index.d.ts.map +1 -0
- package/lib/stark/codegen/index.js +2 -0
- package/lib/stark/codegen/index.js.map +1 -0
- package/lib/stark/codegen/run.d.ts +2 -0
- package/lib/stark/codegen/run.d.ts.map +1 -0
- package/lib/stark/codegen/run.js +11 -0
- package/lib/stark/codegen/run.js.map +1 -0
- package/lib/stark/codegen/utils.d.ts +2 -0
- package/lib/stark/codegen/utils.d.ts.map +1 -0
- package/lib/stark/codegen/utils.js +4 -0
- package/lib/stark/codegen/utils.js.map +1 -0
- package/lib/stark/context.d.ts +28 -0
- package/lib/stark/context.d.ts.map +1 -0
- package/lib/stark/context.js +59 -0
- package/lib/stark/context.js.map +1 -0
- package/lib/stark/contract.d.ts +12 -0
- package/lib/stark/contract.d.ts.map +1 -0
- package/lib/stark/contract.js +43 -0
- package/lib/stark/contract.js.map +1 -0
- package/lib/stark/event.d.ts +7 -0
- package/lib/stark/event.d.ts.map +1 -0
- package/lib/stark/event.js +11 -0
- package/lib/stark/event.js.map +1 -0
- package/lib/stark/index.d.ts +7 -0
- package/lib/stark/index.d.ts.map +1 -0
- package/lib/stark/index.js +7 -0
- package/lib/stark/index.js.map +1 -0
- package/lib/stark/starknet-plugin.d.ts +17 -0
- package/lib/stark/starknet-plugin.d.ts.map +1 -0
- package/lib/stark/starknet-plugin.js +78 -0
- package/lib/stark/starknet-plugin.js.map +1 -0
- package/lib/stark/starknet-processor.d.ts +32 -0
- package/lib/stark/starknet-processor.d.ts.map +1 -0
- package/lib/stark/starknet-processor.js +111 -0
- package/lib/stark/starknet-processor.js.map +1 -0
- package/lib/stark/types.d.ts +11 -0
- package/lib/stark/types.d.ts.map +1 -0
- package/lib/stark/types.js +2 -0
- package/lib/stark/types.js.map +1 -0
- 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/starknet-facet.d.ts +9 -0
- package/lib/testing/starknet-facet.d.ts.map +1 -0
- package/lib/testing/starknet-facet.js +52 -0
- package/lib/testing/starknet-facet.js.map +1 -0
- package/lib/testing/sui-facet.js +1 -1
- package/lib/testing/test-processor-server.d.ts +2 -0
- package/lib/testing/test-processor-server.d.ts.map +1 -1
- package/lib/testing/test-processor-server.js +3 -0
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/tsup.config.ts +3 -15
- 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 +21 -10
- 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/bundle.config.ts +23 -0
- 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 +1554 -123
- package/src/eth/builtin/internal/erc1155-processor.ts +659 -42
- package/src/eth/builtin/internal/erc20-processor.ts +1266 -90
- package/src/eth/builtin/internal/erc20bytes-processor.ts +639 -49
- package/src/eth/builtin/internal/erc721-processor.ts +1035 -70
- package/src/eth/builtin/internal/weth9-processor.ts +758 -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 +96 -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/stark/codegen/codegen.ts +124 -0
- package/src/stark/codegen/index.ts +1 -0
- package/src/stark/codegen/run.ts +10 -0
- package/src/stark/codegen/utils.ts +3 -0
- package/src/stark/context.ts +78 -0
- package/src/stark/contract.ts +55 -0
- package/src/stark/event.ts +7 -0
- package/src/stark/index.ts +9 -0
- package/src/stark/starknet-plugin.ts +108 -0
- package/src/stark/starknet-processor.ts +140 -0
- package/src/stark/types.ts +11 -0
- 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/starknet-facet.ts +61 -0
- package/src/testing/sui-facet.ts +1 -1
- package/src/testing/test-processor-server.ts +3 -0
- package/src/tsup.config.ts +3 -15
- 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 { 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 {
|