@sentio/sdk 2.57.11 → 2.57.12-rc.a
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/ext/token.d.ts.map +1 -1
- package/lib/aptos/ext/token.js +4 -6
- package/lib/aptos/ext/token.js.map +1 -1
- package/lib/chunk-24EEMT46.js +3 -0
- package/lib/chunk-24EEMT46.js.map +1 -0
- package/lib/chunk-2R7O6UGY.js +3 -0
- package/lib/chunk-2R7O6UGY.js.map +1 -0
- package/lib/chunk-4JXRK4YH.js +29 -0
- package/lib/chunk-4JXRK4YH.js.map +1 -0
- package/lib/chunk-7QZC3R57.js +3 -0
- package/lib/chunk-7QZC3R57.js.map +1 -0
- package/lib/chunk-AK5E6DKD.js +6 -0
- package/lib/chunk-AK5E6DKD.js.map +1 -0
- package/lib/chunk-ATZBHPQN.js +3 -0
- package/lib/chunk-ATZBHPQN.js.map +1 -0
- package/lib/chunk-B6U7F4GY.js +29 -0
- package/lib/chunk-B6U7F4GY.js.map +1 -0
- package/lib/chunk-DGKULIPW.js +3 -0
- package/lib/chunk-DGKULIPW.js.map +1 -0
- package/lib/chunk-DS2LOABN.js +3 -0
- package/lib/chunk-DS2LOABN.js.map +1 -0
- package/lib/chunk-FMBGZMT4.js +6 -0
- package/lib/chunk-FMBGZMT4.js.map +1 -0
- package/lib/chunk-FMZDKD72.js +8 -0
- package/lib/chunk-FMZDKD72.js.map +1 -0
- package/lib/chunk-G5BIPHMS.js +3 -0
- package/lib/chunk-G5BIPHMS.js.map +1 -0
- package/lib/chunk-G6XPDWDE.js +3 -0
- package/lib/chunk-G6XPDWDE.js.map +1 -0
- package/lib/chunk-GJX3DL4J.js +499 -0
- package/lib/chunk-GJX3DL4J.js.map +1 -0
- package/lib/chunk-GTITFWMU.js +259 -0
- package/lib/chunk-GTITFWMU.js.map +1 -0
- package/lib/chunk-J7Z2TKQE.js +33 -0
- package/lib/chunk-J7Z2TKQE.js.map +1 -0
- package/lib/chunk-JQ4LTUIX.js +995 -0
- package/lib/chunk-JQ4LTUIX.js.map +1 -0
- package/lib/chunk-LG2TF5WR.js +8 -0
- package/lib/chunk-LG2TF5WR.js.map +1 -0
- package/lib/chunk-LVWOFGF2.js +3 -0
- package/lib/chunk-LVWOFGF2.js.map +1 -0
- package/lib/chunk-O564J2U6.js +11 -0
- package/lib/chunk-O564J2U6.js.map +1 -0
- package/lib/chunk-QGIFUSFI.js +84 -0
- package/lib/chunk-QGIFUSFI.js.map +1 -0
- package/lib/chunk-QGPJOTWP.js +3 -0
- package/lib/chunk-QGPJOTWP.js.map +1 -0
- package/lib/chunk-RA75ESSD.js +3 -0
- package/lib/chunk-RA75ESSD.js.map +1 -0
- package/lib/chunk-RVAYZJ7X.js +5 -0
- package/lib/chunk-RVAYZJ7X.js.map +1 -0
- package/lib/chunk-SPY3PKUB.js +3 -0
- package/lib/chunk-SPY3PKUB.js.map +1 -0
- package/lib/chunk-SUCYR7EB.js +3 -0
- package/lib/chunk-SUCYR7EB.js.map +1 -0
- package/lib/chunk-TGIXVAHB.js +7 -0
- package/lib/chunk-TGIXVAHB.js.map +1 -0
- package/lib/chunk-TSEQGMTN.js +5 -0
- package/lib/chunk-TSEQGMTN.js.map +1 -0
- package/lib/chunk-ZHI6ULD5.js +3 -0
- package/lib/chunk-ZHI6ULD5.js.map +1 -0
- package/lib/multipart-parser-J6QPYJHT.js +4 -0
- package/lib/multipart-parser-J6QPYJHT.js.map +1 -0
- package/package.json +4 -4
- package/src/aptos/builtin/0x1.d.ts +6451 -0
- package/src/aptos/builtin/0x1.d.ts.map +1 -0
- package/src/aptos/builtin/0x1.js +7138 -0
- package/src/aptos/builtin/0x1.js.map +1 -0
- package/src/aptos/builtin/0x3.d.ts +1122 -0
- package/src/aptos/builtin/0x3.d.ts.map +1 -0
- package/src/aptos/builtin/0x3.js +937 -0
- package/src/aptos/builtin/0x3.js.map +1 -0
- package/src/aptos/builtin/0x4.d.ts +551 -0
- package/src/aptos/builtin/0x4.d.ts.map +1 -0
- package/src/aptos/builtin/0x4.js +529 -0
- package/src/aptos/builtin/0x4.js.map +1 -0
- package/src/aptos/builtin/index.d.ts +4 -0
- package/src/aptos/builtin/index.d.ts.map +1 -0
- package/src/aptos/builtin/index.js +7 -0
- package/src/aptos/builtin/index.js.map +1 -0
- package/src/aptos/ext/token.ts +4 -6
- package/src/eth/builtin/eacaggregatorproxy.d.ts +5 -0
- package/src/eth/builtin/eacaggregatorproxy.d.ts.map +1 -0
- package/src/eth/builtin/eacaggregatorproxy.js +8 -0
- package/src/eth/builtin/eacaggregatorproxy.js.map +1 -0
- package/src/eth/builtin/erc1155.d.ts +5 -0
- package/src/eth/builtin/erc1155.d.ts.map +1 -0
- package/src/eth/builtin/erc1155.js +8 -0
- package/src/eth/builtin/erc1155.js.map +1 -0
- package/src/eth/builtin/erc20.d.ts +5 -0
- package/src/eth/builtin/erc20.d.ts.map +1 -0
- package/src/eth/builtin/erc20.js +8 -0
- package/src/eth/builtin/erc20.js.map +1 -0
- package/src/eth/builtin/erc20bytes.d.ts +5 -0
- package/src/eth/builtin/erc20bytes.d.ts.map +1 -0
- package/src/eth/builtin/erc20bytes.js +8 -0
- package/src/eth/builtin/erc20bytes.js.map +1 -0
- package/src/eth/builtin/erc721.d.ts +5 -0
- package/src/eth/builtin/erc721.d.ts.map +1 -0
- package/src/eth/builtin/erc721.js +8 -0
- package/src/eth/builtin/erc721.js.map +1 -0
- package/src/eth/builtin/index.d.ts +13 -0
- package/src/eth/builtin/index.d.ts.map +1 -0
- package/src/eth/builtin/index.js +16 -0
- package/src/eth/builtin/index.js.map +1 -0
- package/src/eth/builtin/internal/EACAggregatorProxy.d.ts +50 -0
- package/src/eth/builtin/internal/EACAggregatorProxy.d.ts.map +1 -0
- package/src/eth/builtin/internal/EACAggregatorProxy.js +2 -0
- package/src/eth/builtin/internal/EACAggregatorProxy.js.map +1 -0
- package/src/eth/builtin/internal/ERC1155.d.ts +57 -0
- package/src/eth/builtin/internal/ERC1155.d.ts.map +1 -0
- package/src/eth/builtin/internal/ERC1155.js +2 -0
- package/src/eth/builtin/internal/ERC1155.js.map +1 -0
- package/src/eth/builtin/internal/ERC20.d.ts +41 -0
- package/src/eth/builtin/internal/ERC20.d.ts.map +1 -0
- package/src/eth/builtin/internal/ERC20.js +2 -0
- package/src/eth/builtin/internal/ERC20.js.map +1 -0
- package/src/eth/builtin/internal/ERC20Bytes.d.ts +32 -0
- package/src/eth/builtin/internal/ERC20Bytes.d.ts.map +1 -0
- package/src/eth/builtin/internal/ERC20Bytes.js +2 -0
- package/src/eth/builtin/internal/ERC20Bytes.js.map +1 -0
- package/src/eth/builtin/internal/ERC721.d.ts +43 -0
- package/src/eth/builtin/internal/ERC721.d.ts.map +1 -0
- package/src/eth/builtin/internal/ERC721.js +2 -0
- package/src/eth/builtin/internal/ERC721.js.map +1 -0
- package/src/eth/builtin/internal/WETH9.d.ts +47 -0
- package/src/eth/builtin/internal/WETH9.d.ts.map +1 -0
- package/src/eth/builtin/internal/WETH9.js +2 -0
- package/src/eth/builtin/internal/WETH9.js.map +1 -0
- package/src/eth/builtin/internal/common.d.ts +3 -0
- package/src/eth/builtin/internal/common.d.ts.map +1 -0
- package/src/eth/builtin/internal/common.js +8 -0
- package/src/eth/builtin/internal/common.js.map +1 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +373 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.js +1355 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts +7 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts.map +1 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js +55 -0
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js.map +1 -0
- package/src/eth/builtin/internal/erc1155-processor.d.ts +173 -0
- package/src/eth/builtin/internal/erc1155-processor.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc1155-processor.js +596 -0
- package/src/eth/builtin/internal/erc1155-processor.js.map +1 -0
- package/src/eth/builtin/internal/erc1155-test-utils.d.ts +7 -0
- package/src/eth/builtin/internal/erc1155-test-utils.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc1155-test-utils.js +55 -0
- package/src/eth/builtin/internal/erc1155-test-utils.js.map +1 -0
- package/src/eth/builtin/internal/erc20-processor.d.ts +244 -0
- package/src/eth/builtin/internal/erc20-processor.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc20-processor.js +1109 -0
- package/src/eth/builtin/internal/erc20-processor.js.map +1 -0
- package/src/eth/builtin/internal/erc20-test-utils.d.ts +6 -0
- package/src/eth/builtin/internal/erc20-test-utils.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc20-test-utils.js +44 -0
- package/src/eth/builtin/internal/erc20-test-utils.js.map +1 -0
- package/src/eth/builtin/internal/erc20bytes-processor.d.ts +144 -0
- package/src/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc20bytes-processor.js +594 -0
- package/src/eth/builtin/internal/erc20bytes-processor.js.map +1 -0
- package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts +5 -0
- package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc20bytes-test-utils.js +33 -0
- package/src/eth/builtin/internal/erc20bytes-test-utils.js.map +1 -0
- package/src/eth/builtin/internal/erc721-processor.d.ts +215 -0
- package/src/eth/builtin/internal/erc721-processor.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc721-processor.js +895 -0
- package/src/eth/builtin/internal/erc721-processor.js.map +1 -0
- package/src/eth/builtin/internal/erc721-test-utils.d.ts +6 -0
- package/src/eth/builtin/internal/erc721-test-utils.d.ts.map +1 -0
- package/src/eth/builtin/internal/erc721-test-utils.js +44 -0
- package/src/eth/builtin/internal/erc721-test-utils.js.map +1 -0
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts +400 -0
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts.map +1 -0
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js +524 -0
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js.map +1 -0
- package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts +251 -0
- package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts.map +1 -0
- package/src/eth/builtin/internal/factories/ERC1155__factory.js +329 -0
- package/src/eth/builtin/internal/factories/ERC1155__factory.js.map +1 -0
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts +185 -0
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts.map +1 -0
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js +251 -0
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js.map +1 -0
- package/src/eth/builtin/internal/factories/ERC20__factory.d.ts +303 -0
- package/src/eth/builtin/internal/factories/ERC20__factory.d.ts.map +1 -0
- package/src/eth/builtin/internal/factories/ERC20__factory.js +401 -0
- package/src/eth/builtin/internal/factories/ERC20__factory.js.map +1 -0
- package/src/eth/builtin/internal/factories/ERC721__factory.d.ts +273 -0
- package/src/eth/builtin/internal/factories/ERC721__factory.d.ts.map +1 -0
- package/src/eth/builtin/internal/factories/ERC721__factory.js +361 -0
- package/src/eth/builtin/internal/factories/ERC721__factory.js.map +1 -0
- package/src/eth/builtin/internal/factories/WETH9__factory.d.ts +220 -0
- package/src/eth/builtin/internal/factories/WETH9__factory.d.ts.map +1 -0
- package/src/eth/builtin/internal/factories/WETH9__factory.js +294 -0
- package/src/eth/builtin/internal/factories/WETH9__factory.js.map +1 -0
- package/src/eth/builtin/internal/factories/index.d.ts +7 -0
- package/src/eth/builtin/internal/factories/index.d.ts.map +1 -0
- package/src/eth/builtin/internal/factories/index.js +10 -0
- package/src/eth/builtin/internal/factories/index.js.map +1 -0
- package/src/eth/builtin/internal/index.d.ts +14 -0
- package/src/eth/builtin/internal/index.d.ts.map +1 -0
- package/src/eth/builtin/internal/index.js +8 -0
- package/src/eth/builtin/internal/index.js.map +1 -0
- package/src/eth/builtin/internal/weth9-processor.d.ts +172 -0
- package/src/eth/builtin/internal/weth9-processor.d.ts.map +1 -0
- package/src/eth/builtin/internal/weth9-processor.js +729 -0
- package/src/eth/builtin/internal/weth9-processor.js.map +1 -0
- package/src/eth/builtin/internal/weth9-test-utils.d.ts +7 -0
- package/src/eth/builtin/internal/weth9-test-utils.d.ts.map +1 -0
- package/src/eth/builtin/internal/weth9-test-utils.js +55 -0
- package/src/eth/builtin/internal/weth9-test-utils.js.map +1 -0
- package/src/eth/builtin/weth9.d.ts +5 -0
- package/src/eth/builtin/weth9.d.ts.map +1 -0
- package/src/eth/builtin/weth9.js +8 -0
- package/src/eth/builtin/weth9.js.map +1 -0
- package/src/solana/builtin/index.d.ts +2 -0
- package/src/solana/builtin/index.d.ts.map +1 -0
- package/src/solana/builtin/index.js +2 -0
- package/src/solana/builtin/index.js.map +1 -0
- package/src/solana/builtin/spl-token-processor.d.ts +40 -0
- package/src/solana/builtin/spl-token-processor.d.ts.map +1 -0
- package/src/solana/builtin/spl-token-processor.js +254 -0
- package/src/solana/builtin/spl-token-processor.js.map +1 -0
- package/src/solana/builtin/types.d.ts +428 -0
- package/src/solana/builtin/types.d.ts.map +1 -0
- package/src/solana/builtin/types.js +201 -0
- package/src/solana/builtin/types.js.map +1 -0
- package/src/sui/builtin/0x1.d.ts +114 -0
- package/src/sui/builtin/0x1.d.ts.map +1 -0
- package/src/sui/builtin/0x1.js +159 -0
- package/src/sui/builtin/0x1.js.map +1 -0
- package/src/sui/builtin/0x2.d.ts +1250 -0
- package/src/sui/builtin/0x2.d.ts.map +1 -0
- package/src/sui/builtin/0x2.js +1511 -0
- package/src/sui/builtin/0x2.js.map +1 -0
- package/src/sui/builtin/0x3.d.ts +774 -0
- package/src/sui/builtin/0x3.d.ts.map +1 -0
- package/src/sui/builtin/0x3.js +720 -0
- package/src/sui/builtin/0x3.js.map +1 -0
- package/src/sui/builtin/index.d.ts +4 -0
- package/src/sui/builtin/index.d.ts.map +1 -0
- package/src/sui/builtin/index.js +7 -0
- package/src/sui/builtin/index.js.map +1 -0
@@ -0,0 +1,1109 @@
|
|
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, } from "@sentio/sdk/eth";
|
6
|
+
import { ERC20__factory } from "./index.js";
|
7
|
+
const templateContract = ERC20__factory.connect("0x0", DummyProvider);
|
8
|
+
const iface = new Interface([
|
9
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
10
|
+
"function approve(address spender, uint256 amount) returns (bool)",
|
11
|
+
"function balanceOf(address account) view returns (uint256)",
|
12
|
+
"function burn(uint256 amount) returns ()",
|
13
|
+
"function burnFrom(address account, uint256 amount) returns ()",
|
14
|
+
"function decimals() view returns (uint8)",
|
15
|
+
"function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)",
|
16
|
+
"function increaseAllowance(address spender, uint256 addedValue) returns (bool)",
|
17
|
+
"function locker() view returns (address)",
|
18
|
+
"function name() view returns (string)",
|
19
|
+
"function owner() view returns (address)",
|
20
|
+
"function renounceOwnership() returns ()",
|
21
|
+
"function setLocker(address _locker) returns ()",
|
22
|
+
"function symbol() view returns (string)",
|
23
|
+
"function totalSupply() view returns (uint256)",
|
24
|
+
"function transfer(address recipient, uint256 amount) returns (bool)",
|
25
|
+
"function transferFrom(address sender, address recipient, uint256 amount) returns (bool)",
|
26
|
+
"function transferOwnership(address newOwner) returns ()",
|
27
|
+
]);
|
28
|
+
export class ERC20ContractView extends ContractView {
|
29
|
+
constructor(contract) {
|
30
|
+
super(contract);
|
31
|
+
this.callStatic.contract = contract;
|
32
|
+
}
|
33
|
+
async allowance(owner, spender, overrides, preparedData, ethCallContext) {
|
34
|
+
try {
|
35
|
+
return await this.contract.getFunction("allowance(address,address)")(owner, spender, overrides || {});
|
36
|
+
}
|
37
|
+
catch (e) {
|
38
|
+
const stack = new Error().stack;
|
39
|
+
throw transformEtherError(e, undefined, stack);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
async balanceOf(account, overrides, preparedData, ethCallContext) {
|
43
|
+
try {
|
44
|
+
return await this.contract.getFunction("balanceOf(address)")(account, overrides || {});
|
45
|
+
}
|
46
|
+
catch (e) {
|
47
|
+
const stack = new Error().stack;
|
48
|
+
throw transformEtherError(e, undefined, stack);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
async decimals(overrides, preparedData, ethCallContext) {
|
52
|
+
try {
|
53
|
+
return await this.contract.getFunction("decimals()")(overrides || {});
|
54
|
+
}
|
55
|
+
catch (e) {
|
56
|
+
const stack = new Error().stack;
|
57
|
+
throw transformEtherError(e, undefined, stack);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
async locker(overrides, preparedData, ethCallContext) {
|
61
|
+
try {
|
62
|
+
return await this.contract.getFunction("locker()")(overrides || {});
|
63
|
+
}
|
64
|
+
catch (e) {
|
65
|
+
const stack = new Error().stack;
|
66
|
+
throw transformEtherError(e, undefined, stack);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
async name(overrides, preparedData, ethCallContext) {
|
70
|
+
try {
|
71
|
+
return await this.contract.getFunction("name()")(overrides || {});
|
72
|
+
}
|
73
|
+
catch (e) {
|
74
|
+
const stack = new Error().stack;
|
75
|
+
throw transformEtherError(e, undefined, stack);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
async owner(overrides, preparedData, ethCallContext) {
|
79
|
+
try {
|
80
|
+
return await this.contract.getFunction("owner()")(overrides || {});
|
81
|
+
}
|
82
|
+
catch (e) {
|
83
|
+
const stack = new Error().stack;
|
84
|
+
throw transformEtherError(e, undefined, stack);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
async symbol(overrides, preparedData, ethCallContext) {
|
88
|
+
try {
|
89
|
+
return await this.contract.getFunction("symbol()")(overrides || {});
|
90
|
+
}
|
91
|
+
catch (e) {
|
92
|
+
const stack = new Error().stack;
|
93
|
+
throw transformEtherError(e, undefined, stack);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
async totalSupply(overrides, preparedData, ethCallContext) {
|
97
|
+
try {
|
98
|
+
return await this.contract.getFunction("totalSupply()")(overrides || {});
|
99
|
+
}
|
100
|
+
catch (e) {
|
101
|
+
const stack = new Error().stack;
|
102
|
+
throw transformEtherError(e, undefined, stack);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
callStatic = {
|
106
|
+
contract: this.contract,
|
107
|
+
async approve(spender, amount, overrides, preparedData, ethCallContext) {
|
108
|
+
try {
|
109
|
+
return await this.contract
|
110
|
+
.getFunction("approve(address,uint256)")
|
111
|
+
.staticCall(spender, amount, overrides || {});
|
112
|
+
}
|
113
|
+
catch (e) {
|
114
|
+
const stack = new Error().stack;
|
115
|
+
throw transformEtherError(e, undefined, stack);
|
116
|
+
}
|
117
|
+
},
|
118
|
+
async burn(amount, overrides, preparedData, ethCallContext) {
|
119
|
+
try {
|
120
|
+
return await this.contract
|
121
|
+
.getFunction("burn(uint256)")
|
122
|
+
.staticCall(amount, overrides || {});
|
123
|
+
}
|
124
|
+
catch (e) {
|
125
|
+
const stack = new Error().stack;
|
126
|
+
throw transformEtherError(e, undefined, stack);
|
127
|
+
}
|
128
|
+
},
|
129
|
+
async burnFrom(account, amount, overrides, preparedData, ethCallContext) {
|
130
|
+
try {
|
131
|
+
return await this.contract
|
132
|
+
.getFunction("burnFrom(address,uint256)")
|
133
|
+
.staticCall(account, amount, overrides || {});
|
134
|
+
}
|
135
|
+
catch (e) {
|
136
|
+
const stack = new Error().stack;
|
137
|
+
throw transformEtherError(e, undefined, stack);
|
138
|
+
}
|
139
|
+
},
|
140
|
+
async decreaseAllowance(spender, subtractedValue, overrides, preparedData, ethCallContext) {
|
141
|
+
try {
|
142
|
+
return await this.contract
|
143
|
+
.getFunction("decreaseAllowance(address,uint256)")
|
144
|
+
.staticCall(spender, subtractedValue, overrides || {});
|
145
|
+
}
|
146
|
+
catch (e) {
|
147
|
+
const stack = new Error().stack;
|
148
|
+
throw transformEtherError(e, undefined, stack);
|
149
|
+
}
|
150
|
+
},
|
151
|
+
async increaseAllowance(spender, addedValue, overrides, preparedData, ethCallContext) {
|
152
|
+
try {
|
153
|
+
return await this.contract
|
154
|
+
.getFunction("increaseAllowance(address,uint256)")
|
155
|
+
.staticCall(spender, addedValue, overrides || {});
|
156
|
+
}
|
157
|
+
catch (e) {
|
158
|
+
const stack = new Error().stack;
|
159
|
+
throw transformEtherError(e, undefined, stack);
|
160
|
+
}
|
161
|
+
},
|
162
|
+
async renounceOwnership(overrides, preparedData, ethCallContext) {
|
163
|
+
try {
|
164
|
+
return await this.contract
|
165
|
+
.getFunction("renounceOwnership()")
|
166
|
+
.staticCall(overrides || {});
|
167
|
+
}
|
168
|
+
catch (e) {
|
169
|
+
const stack = new Error().stack;
|
170
|
+
throw transformEtherError(e, undefined, stack);
|
171
|
+
}
|
172
|
+
},
|
173
|
+
async setLocker(_locker, overrides, preparedData, ethCallContext) {
|
174
|
+
try {
|
175
|
+
return await this.contract
|
176
|
+
.getFunction("setLocker(address)")
|
177
|
+
.staticCall(_locker, overrides || {});
|
178
|
+
}
|
179
|
+
catch (e) {
|
180
|
+
const stack = new Error().stack;
|
181
|
+
throw transformEtherError(e, undefined, stack);
|
182
|
+
}
|
183
|
+
},
|
184
|
+
async transfer(recipient, amount, overrides, preparedData, ethCallContext) {
|
185
|
+
try {
|
186
|
+
return await this.contract
|
187
|
+
.getFunction("transfer(address,uint256)")
|
188
|
+
.staticCall(recipient, amount, overrides || {});
|
189
|
+
}
|
190
|
+
catch (e) {
|
191
|
+
const stack = new Error().stack;
|
192
|
+
throw transformEtherError(e, undefined, stack);
|
193
|
+
}
|
194
|
+
},
|
195
|
+
async transferFrom(sender, recipient, amount, overrides, preparedData, ethCallContext) {
|
196
|
+
try {
|
197
|
+
return await this.contract
|
198
|
+
.getFunction("transferFrom(address,address,uint256)")
|
199
|
+
.staticCall(sender, recipient, amount, overrides || {});
|
200
|
+
}
|
201
|
+
catch (e) {
|
202
|
+
const stack = new Error().stack;
|
203
|
+
throw transformEtherError(e, undefined, stack);
|
204
|
+
}
|
205
|
+
},
|
206
|
+
async transferOwnership(newOwner, overrides, preparedData, ethCallContext) {
|
207
|
+
try {
|
208
|
+
return await this.contract
|
209
|
+
.getFunction("transferOwnership(address)")
|
210
|
+
.staticCall(newOwner, overrides || {});
|
211
|
+
}
|
212
|
+
catch (e) {
|
213
|
+
const stack = new Error().stack;
|
214
|
+
throw transformEtherError(e, undefined, stack);
|
215
|
+
}
|
216
|
+
},
|
217
|
+
};
|
218
|
+
encodeCall = {
|
219
|
+
allowance(owner, spender, ethCallContext) {
|
220
|
+
try {
|
221
|
+
const iface = new Interface(["function allowance(address,address)"]);
|
222
|
+
const calldata = iface.encodeFunctionData("allowance", [
|
223
|
+
owner,
|
224
|
+
spender,
|
225
|
+
]);
|
226
|
+
return {
|
227
|
+
context: ethCallContext,
|
228
|
+
calldata,
|
229
|
+
};
|
230
|
+
}
|
231
|
+
catch (e) {
|
232
|
+
const stack = new Error().stack;
|
233
|
+
throw transformEtherError(e, undefined, stack);
|
234
|
+
}
|
235
|
+
},
|
236
|
+
approve(spender, amount, ethCallContext) {
|
237
|
+
try {
|
238
|
+
const iface = new Interface(["function approve(address,uint256)"]);
|
239
|
+
const calldata = iface.encodeFunctionData("approve", [spender, amount]);
|
240
|
+
return {
|
241
|
+
context: ethCallContext,
|
242
|
+
calldata,
|
243
|
+
};
|
244
|
+
}
|
245
|
+
catch (e) {
|
246
|
+
const stack = new Error().stack;
|
247
|
+
throw transformEtherError(e, undefined, stack);
|
248
|
+
}
|
249
|
+
},
|
250
|
+
balanceOf(account, ethCallContext) {
|
251
|
+
try {
|
252
|
+
const iface = new Interface(["function balanceOf(address)"]);
|
253
|
+
const calldata = iface.encodeFunctionData("balanceOf", [account]);
|
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
|
+
burn(amount, ethCallContext) {
|
265
|
+
try {
|
266
|
+
const iface = new Interface(["function burn(uint256)"]);
|
267
|
+
const calldata = iface.encodeFunctionData("burn", [amount]);
|
268
|
+
return {
|
269
|
+
context: ethCallContext,
|
270
|
+
calldata,
|
271
|
+
};
|
272
|
+
}
|
273
|
+
catch (e) {
|
274
|
+
const stack = new Error().stack;
|
275
|
+
throw transformEtherError(e, undefined, stack);
|
276
|
+
}
|
277
|
+
},
|
278
|
+
burnFrom(account, amount, ethCallContext) {
|
279
|
+
try {
|
280
|
+
const iface = new Interface(["function burnFrom(address,uint256)"]);
|
281
|
+
const calldata = iface.encodeFunctionData("burnFrom", [
|
282
|
+
account,
|
283
|
+
amount,
|
284
|
+
]);
|
285
|
+
return {
|
286
|
+
context: ethCallContext,
|
287
|
+
calldata,
|
288
|
+
};
|
289
|
+
}
|
290
|
+
catch (e) {
|
291
|
+
const stack = new Error().stack;
|
292
|
+
throw transformEtherError(e, undefined, stack);
|
293
|
+
}
|
294
|
+
},
|
295
|
+
decimals(ethCallContext) {
|
296
|
+
try {
|
297
|
+
const iface = new Interface(["function decimals()"]);
|
298
|
+
const calldata = iface.encodeFunctionData("decimals", []);
|
299
|
+
return {
|
300
|
+
context: ethCallContext,
|
301
|
+
calldata,
|
302
|
+
};
|
303
|
+
}
|
304
|
+
catch (e) {
|
305
|
+
const stack = new Error().stack;
|
306
|
+
throw transformEtherError(e, undefined, stack);
|
307
|
+
}
|
308
|
+
},
|
309
|
+
decreaseAllowance(spender, subtractedValue, ethCallContext) {
|
310
|
+
try {
|
311
|
+
const iface = new Interface([
|
312
|
+
"function decreaseAllowance(address,uint256)",
|
313
|
+
]);
|
314
|
+
const calldata = iface.encodeFunctionData("decreaseAllowance", [
|
315
|
+
spender,
|
316
|
+
subtractedValue,
|
317
|
+
]);
|
318
|
+
return {
|
319
|
+
context: ethCallContext,
|
320
|
+
calldata,
|
321
|
+
};
|
322
|
+
}
|
323
|
+
catch (e) {
|
324
|
+
const stack = new Error().stack;
|
325
|
+
throw transformEtherError(e, undefined, stack);
|
326
|
+
}
|
327
|
+
},
|
328
|
+
increaseAllowance(spender, addedValue, ethCallContext) {
|
329
|
+
try {
|
330
|
+
const iface = new Interface([
|
331
|
+
"function increaseAllowance(address,uint256)",
|
332
|
+
]);
|
333
|
+
const calldata = iface.encodeFunctionData("increaseAllowance", [
|
334
|
+
spender,
|
335
|
+
addedValue,
|
336
|
+
]);
|
337
|
+
return {
|
338
|
+
context: ethCallContext,
|
339
|
+
calldata,
|
340
|
+
};
|
341
|
+
}
|
342
|
+
catch (e) {
|
343
|
+
const stack = new Error().stack;
|
344
|
+
throw transformEtherError(e, undefined, stack);
|
345
|
+
}
|
346
|
+
},
|
347
|
+
locker(ethCallContext) {
|
348
|
+
try {
|
349
|
+
const iface = new Interface(["function locker()"]);
|
350
|
+
const calldata = iface.encodeFunctionData("locker", []);
|
351
|
+
return {
|
352
|
+
context: ethCallContext,
|
353
|
+
calldata,
|
354
|
+
};
|
355
|
+
}
|
356
|
+
catch (e) {
|
357
|
+
const stack = new Error().stack;
|
358
|
+
throw transformEtherError(e, undefined, stack);
|
359
|
+
}
|
360
|
+
},
|
361
|
+
name(ethCallContext) {
|
362
|
+
try {
|
363
|
+
const iface = new Interface(["function name()"]);
|
364
|
+
const calldata = iface.encodeFunctionData("name", []);
|
365
|
+
return {
|
366
|
+
context: ethCallContext,
|
367
|
+
calldata,
|
368
|
+
};
|
369
|
+
}
|
370
|
+
catch (e) {
|
371
|
+
const stack = new Error().stack;
|
372
|
+
throw transformEtherError(e, undefined, stack);
|
373
|
+
}
|
374
|
+
},
|
375
|
+
owner(ethCallContext) {
|
376
|
+
try {
|
377
|
+
const iface = new Interface(["function owner()"]);
|
378
|
+
const calldata = iface.encodeFunctionData("owner", []);
|
379
|
+
return {
|
380
|
+
context: ethCallContext,
|
381
|
+
calldata,
|
382
|
+
};
|
383
|
+
}
|
384
|
+
catch (e) {
|
385
|
+
const stack = new Error().stack;
|
386
|
+
throw transformEtherError(e, undefined, stack);
|
387
|
+
}
|
388
|
+
},
|
389
|
+
renounceOwnership(ethCallContext) {
|
390
|
+
try {
|
391
|
+
const iface = new Interface(["function renounceOwnership()"]);
|
392
|
+
const calldata = iface.encodeFunctionData("renounceOwnership", []);
|
393
|
+
return {
|
394
|
+
context: ethCallContext,
|
395
|
+
calldata,
|
396
|
+
};
|
397
|
+
}
|
398
|
+
catch (e) {
|
399
|
+
const stack = new Error().stack;
|
400
|
+
throw transformEtherError(e, undefined, stack);
|
401
|
+
}
|
402
|
+
},
|
403
|
+
setLocker(_locker, ethCallContext) {
|
404
|
+
try {
|
405
|
+
const iface = new Interface(["function setLocker(address)"]);
|
406
|
+
const calldata = iface.encodeFunctionData("setLocker", [_locker]);
|
407
|
+
return {
|
408
|
+
context: ethCallContext,
|
409
|
+
calldata,
|
410
|
+
};
|
411
|
+
}
|
412
|
+
catch (e) {
|
413
|
+
const stack = new Error().stack;
|
414
|
+
throw transformEtherError(e, undefined, stack);
|
415
|
+
}
|
416
|
+
},
|
417
|
+
symbol(ethCallContext) {
|
418
|
+
try {
|
419
|
+
const iface = new Interface(["function symbol()"]);
|
420
|
+
const calldata = iface.encodeFunctionData("symbol", []);
|
421
|
+
return {
|
422
|
+
context: ethCallContext,
|
423
|
+
calldata,
|
424
|
+
};
|
425
|
+
}
|
426
|
+
catch (e) {
|
427
|
+
const stack = new Error().stack;
|
428
|
+
throw transformEtherError(e, undefined, stack);
|
429
|
+
}
|
430
|
+
},
|
431
|
+
totalSupply(ethCallContext) {
|
432
|
+
try {
|
433
|
+
const iface = new Interface(["function totalSupply()"]);
|
434
|
+
const calldata = iface.encodeFunctionData("totalSupply", []);
|
435
|
+
return {
|
436
|
+
context: ethCallContext,
|
437
|
+
calldata,
|
438
|
+
};
|
439
|
+
}
|
440
|
+
catch (e) {
|
441
|
+
const stack = new Error().stack;
|
442
|
+
throw transformEtherError(e, undefined, stack);
|
443
|
+
}
|
444
|
+
},
|
445
|
+
transfer(recipient, amount, ethCallContext) {
|
446
|
+
try {
|
447
|
+
const iface = new Interface(["function transfer(address,uint256)"]);
|
448
|
+
const calldata = iface.encodeFunctionData("transfer", [
|
449
|
+
recipient,
|
450
|
+
amount,
|
451
|
+
]);
|
452
|
+
return {
|
453
|
+
context: ethCallContext,
|
454
|
+
calldata,
|
455
|
+
};
|
456
|
+
}
|
457
|
+
catch (e) {
|
458
|
+
const stack = new Error().stack;
|
459
|
+
throw transformEtherError(e, undefined, stack);
|
460
|
+
}
|
461
|
+
},
|
462
|
+
transferFrom(sender, recipient, amount, ethCallContext) {
|
463
|
+
try {
|
464
|
+
const iface = new Interface([
|
465
|
+
"function transferFrom(address,address,uint256)",
|
466
|
+
]);
|
467
|
+
const calldata = iface.encodeFunctionData("transferFrom", [
|
468
|
+
sender,
|
469
|
+
recipient,
|
470
|
+
amount,
|
471
|
+
]);
|
472
|
+
return {
|
473
|
+
context: ethCallContext,
|
474
|
+
calldata,
|
475
|
+
};
|
476
|
+
}
|
477
|
+
catch (e) {
|
478
|
+
const stack = new Error().stack;
|
479
|
+
throw transformEtherError(e, undefined, stack);
|
480
|
+
}
|
481
|
+
},
|
482
|
+
transferOwnership(newOwner, ethCallContext) {
|
483
|
+
try {
|
484
|
+
const iface = new Interface(["function transferOwnership(address)"]);
|
485
|
+
const calldata = iface.encodeFunctionData("transferOwnership", [
|
486
|
+
newOwner,
|
487
|
+
]);
|
488
|
+
return {
|
489
|
+
context: ethCallContext,
|
490
|
+
calldata,
|
491
|
+
};
|
492
|
+
}
|
493
|
+
catch (e) {
|
494
|
+
const stack = new Error().stack;
|
495
|
+
throw transformEtherError(e, undefined, stack);
|
496
|
+
}
|
497
|
+
},
|
498
|
+
};
|
499
|
+
}
|
500
|
+
export class ERC20BoundContractView extends BoundContractView {
|
501
|
+
async allowance(owner, spender, overrides) {
|
502
|
+
const ethCallContext = {
|
503
|
+
chainId: this.context.chainId,
|
504
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
505
|
+
address: this.context.address,
|
506
|
+
};
|
507
|
+
return await this.view.allowance(owner, spender, {
|
508
|
+
blockTag: this.context.blockNumber,
|
509
|
+
...overrides,
|
510
|
+
}, this.context.preparedData, ethCallContext);
|
511
|
+
}
|
512
|
+
async balanceOf(account, overrides) {
|
513
|
+
const ethCallContext = {
|
514
|
+
chainId: this.context.chainId,
|
515
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
516
|
+
address: this.context.address,
|
517
|
+
};
|
518
|
+
return await this.view.balanceOf(account, {
|
519
|
+
blockTag: this.context.blockNumber,
|
520
|
+
...overrides,
|
521
|
+
}, this.context.preparedData, ethCallContext);
|
522
|
+
}
|
523
|
+
async decimals(overrides) {
|
524
|
+
const ethCallContext = {
|
525
|
+
chainId: this.context.chainId,
|
526
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
527
|
+
address: this.context.address,
|
528
|
+
};
|
529
|
+
return await this.view.decimals({
|
530
|
+
blockTag: this.context.blockNumber,
|
531
|
+
...overrides,
|
532
|
+
}, this.context.preparedData, ethCallContext);
|
533
|
+
}
|
534
|
+
async locker(overrides) {
|
535
|
+
const ethCallContext = {
|
536
|
+
chainId: this.context.chainId,
|
537
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
538
|
+
address: this.context.address,
|
539
|
+
};
|
540
|
+
return await this.view.locker({
|
541
|
+
blockTag: this.context.blockNumber,
|
542
|
+
...overrides,
|
543
|
+
}, this.context.preparedData, ethCallContext);
|
544
|
+
}
|
545
|
+
async name(overrides) {
|
546
|
+
const ethCallContext = {
|
547
|
+
chainId: this.context.chainId,
|
548
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
549
|
+
address: this.context.address,
|
550
|
+
};
|
551
|
+
return await this.view.name({
|
552
|
+
blockTag: this.context.blockNumber,
|
553
|
+
...overrides,
|
554
|
+
}, this.context.preparedData, ethCallContext);
|
555
|
+
}
|
556
|
+
async owner(overrides) {
|
557
|
+
const ethCallContext = {
|
558
|
+
chainId: this.context.chainId,
|
559
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
560
|
+
address: this.context.address,
|
561
|
+
};
|
562
|
+
return await this.view.owner({
|
563
|
+
blockTag: this.context.blockNumber,
|
564
|
+
...overrides,
|
565
|
+
}, this.context.preparedData, ethCallContext);
|
566
|
+
}
|
567
|
+
async symbol(overrides) {
|
568
|
+
const ethCallContext = {
|
569
|
+
chainId: this.context.chainId,
|
570
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
571
|
+
address: this.context.address,
|
572
|
+
};
|
573
|
+
return await this.view.symbol({
|
574
|
+
blockTag: this.context.blockNumber,
|
575
|
+
...overrides,
|
576
|
+
}, this.context.preparedData, ethCallContext);
|
577
|
+
}
|
578
|
+
async totalSupply(overrides) {
|
579
|
+
const ethCallContext = {
|
580
|
+
chainId: this.context.chainId,
|
581
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
582
|
+
address: this.context.address,
|
583
|
+
};
|
584
|
+
return await this.view.totalSupply({
|
585
|
+
blockTag: this.context.blockNumber,
|
586
|
+
...overrides,
|
587
|
+
}, this.context.preparedData, ethCallContext);
|
588
|
+
}
|
589
|
+
callStatic = {
|
590
|
+
view: this.view,
|
591
|
+
context: this.context,
|
592
|
+
async approve(spender, amount, overrides) {
|
593
|
+
const ethCallContext = {
|
594
|
+
chainId: this.context.chainId,
|
595
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
596
|
+
address: this.context.address,
|
597
|
+
};
|
598
|
+
return await this.view.callStatic.approve(spender, amount, {
|
599
|
+
blockTag: this.context.blockNumber,
|
600
|
+
...overrides,
|
601
|
+
}, this.context.preparedData, ethCallContext);
|
602
|
+
},
|
603
|
+
async burn(amount, overrides) {
|
604
|
+
const ethCallContext = {
|
605
|
+
chainId: this.context.chainId,
|
606
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
607
|
+
address: this.context.address,
|
608
|
+
};
|
609
|
+
return await this.view.callStatic.burn(amount, {
|
610
|
+
blockTag: this.context.blockNumber,
|
611
|
+
...overrides,
|
612
|
+
}, this.context.preparedData, ethCallContext);
|
613
|
+
},
|
614
|
+
async burnFrom(account, amount, overrides) {
|
615
|
+
const ethCallContext = {
|
616
|
+
chainId: this.context.chainId,
|
617
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
618
|
+
address: this.context.address,
|
619
|
+
};
|
620
|
+
return await this.view.callStatic.burnFrom(account, amount, {
|
621
|
+
blockTag: this.context.blockNumber,
|
622
|
+
...overrides,
|
623
|
+
}, this.context.preparedData, ethCallContext);
|
624
|
+
},
|
625
|
+
async decreaseAllowance(spender, subtractedValue, overrides) {
|
626
|
+
const ethCallContext = {
|
627
|
+
chainId: this.context.chainId,
|
628
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
629
|
+
address: this.context.address,
|
630
|
+
};
|
631
|
+
return await this.view.callStatic.decreaseAllowance(spender, subtractedValue, {
|
632
|
+
blockTag: this.context.blockNumber,
|
633
|
+
...overrides,
|
634
|
+
}, this.context.preparedData, ethCallContext);
|
635
|
+
},
|
636
|
+
async increaseAllowance(spender, addedValue, overrides) {
|
637
|
+
const ethCallContext = {
|
638
|
+
chainId: this.context.chainId,
|
639
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
640
|
+
address: this.context.address,
|
641
|
+
};
|
642
|
+
return await this.view.callStatic.increaseAllowance(spender, addedValue, {
|
643
|
+
blockTag: this.context.blockNumber,
|
644
|
+
...overrides,
|
645
|
+
}, this.context.preparedData, ethCallContext);
|
646
|
+
},
|
647
|
+
async renounceOwnership(overrides) {
|
648
|
+
const ethCallContext = {
|
649
|
+
chainId: this.context.chainId,
|
650
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
651
|
+
address: this.context.address,
|
652
|
+
};
|
653
|
+
return await this.view.callStatic.renounceOwnership({
|
654
|
+
blockTag: this.context.blockNumber,
|
655
|
+
...overrides,
|
656
|
+
}, this.context.preparedData, ethCallContext);
|
657
|
+
},
|
658
|
+
async setLocker(_locker, overrides) {
|
659
|
+
const ethCallContext = {
|
660
|
+
chainId: this.context.chainId,
|
661
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
662
|
+
address: this.context.address,
|
663
|
+
};
|
664
|
+
return await this.view.callStatic.setLocker(_locker, {
|
665
|
+
blockTag: this.context.blockNumber,
|
666
|
+
...overrides,
|
667
|
+
}, this.context.preparedData, ethCallContext);
|
668
|
+
},
|
669
|
+
async transfer(recipient, amount, overrides) {
|
670
|
+
const ethCallContext = {
|
671
|
+
chainId: this.context.chainId,
|
672
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
673
|
+
address: this.context.address,
|
674
|
+
};
|
675
|
+
return await this.view.callStatic.transfer(recipient, amount, {
|
676
|
+
blockTag: this.context.blockNumber,
|
677
|
+
...overrides,
|
678
|
+
}, this.context.preparedData, ethCallContext);
|
679
|
+
},
|
680
|
+
async transferFrom(sender, recipient, amount, overrides) {
|
681
|
+
const ethCallContext = {
|
682
|
+
chainId: this.context.chainId,
|
683
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
684
|
+
address: this.context.address,
|
685
|
+
};
|
686
|
+
return await this.view.callStatic.transferFrom(sender, recipient, amount, {
|
687
|
+
blockTag: this.context.blockNumber,
|
688
|
+
...overrides,
|
689
|
+
}, this.context.preparedData, ethCallContext);
|
690
|
+
},
|
691
|
+
async transferOwnership(newOwner, overrides) {
|
692
|
+
const ethCallContext = {
|
693
|
+
chainId: this.context.chainId,
|
694
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
695
|
+
address: this.context.address,
|
696
|
+
};
|
697
|
+
return await this.view.callStatic.transferOwnership(newOwner, {
|
698
|
+
blockTag: this.context.blockNumber,
|
699
|
+
...overrides,
|
700
|
+
}, this.context.preparedData, ethCallContext);
|
701
|
+
},
|
702
|
+
};
|
703
|
+
encodeCall = {
|
704
|
+
view: this.view,
|
705
|
+
context: this.context,
|
706
|
+
allowance(owner, spender, overrides) {
|
707
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
708
|
+
if (overrides?.blockTag) {
|
709
|
+
blockTagWithOverride =
|
710
|
+
typeof overrides.blockTag == "string"
|
711
|
+
? overrides.blockTag
|
712
|
+
: "0x" + overrides.blockTag.toString(16);
|
713
|
+
}
|
714
|
+
return this.view.encodeCall.allowance(owner, spender, {
|
715
|
+
chainId: this.context.chainId.toString(),
|
716
|
+
address: this.context.address,
|
717
|
+
blockTag: blockTagWithOverride,
|
718
|
+
});
|
719
|
+
},
|
720
|
+
approve(spender, amount, overrides) {
|
721
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
722
|
+
if (overrides?.blockTag) {
|
723
|
+
blockTagWithOverride =
|
724
|
+
typeof overrides.blockTag == "string"
|
725
|
+
? overrides.blockTag
|
726
|
+
: "0x" + overrides.blockTag.toString(16);
|
727
|
+
}
|
728
|
+
return this.view.encodeCall.approve(spender, amount, {
|
729
|
+
chainId: this.context.chainId.toString(),
|
730
|
+
address: this.context.address,
|
731
|
+
blockTag: blockTagWithOverride,
|
732
|
+
});
|
733
|
+
},
|
734
|
+
balanceOf(account, overrides) {
|
735
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
736
|
+
if (overrides?.blockTag) {
|
737
|
+
blockTagWithOverride =
|
738
|
+
typeof overrides.blockTag == "string"
|
739
|
+
? overrides.blockTag
|
740
|
+
: "0x" + overrides.blockTag.toString(16);
|
741
|
+
}
|
742
|
+
return this.view.encodeCall.balanceOf(account, {
|
743
|
+
chainId: this.context.chainId.toString(),
|
744
|
+
address: this.context.address,
|
745
|
+
blockTag: blockTagWithOverride,
|
746
|
+
});
|
747
|
+
},
|
748
|
+
burn(amount, overrides) {
|
749
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
750
|
+
if (overrides?.blockTag) {
|
751
|
+
blockTagWithOverride =
|
752
|
+
typeof overrides.blockTag == "string"
|
753
|
+
? overrides.blockTag
|
754
|
+
: "0x" + overrides.blockTag.toString(16);
|
755
|
+
}
|
756
|
+
return this.view.encodeCall.burn(amount, {
|
757
|
+
chainId: this.context.chainId.toString(),
|
758
|
+
address: this.context.address,
|
759
|
+
blockTag: blockTagWithOverride,
|
760
|
+
});
|
761
|
+
},
|
762
|
+
burnFrom(account, amount, overrides) {
|
763
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
764
|
+
if (overrides?.blockTag) {
|
765
|
+
blockTagWithOverride =
|
766
|
+
typeof overrides.blockTag == "string"
|
767
|
+
? overrides.blockTag
|
768
|
+
: "0x" + overrides.blockTag.toString(16);
|
769
|
+
}
|
770
|
+
return this.view.encodeCall.burnFrom(account, amount, {
|
771
|
+
chainId: this.context.chainId.toString(),
|
772
|
+
address: this.context.address,
|
773
|
+
blockTag: blockTagWithOverride,
|
774
|
+
});
|
775
|
+
},
|
776
|
+
decimals(overrides) {
|
777
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
778
|
+
if (overrides?.blockTag) {
|
779
|
+
blockTagWithOverride =
|
780
|
+
typeof overrides.blockTag == "string"
|
781
|
+
? overrides.blockTag
|
782
|
+
: "0x" + overrides.blockTag.toString(16);
|
783
|
+
}
|
784
|
+
return this.view.encodeCall.decimals({
|
785
|
+
chainId: this.context.chainId.toString(),
|
786
|
+
address: this.context.address,
|
787
|
+
blockTag: blockTagWithOverride,
|
788
|
+
});
|
789
|
+
},
|
790
|
+
decreaseAllowance(spender, subtractedValue, overrides) {
|
791
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
792
|
+
if (overrides?.blockTag) {
|
793
|
+
blockTagWithOverride =
|
794
|
+
typeof overrides.blockTag == "string"
|
795
|
+
? overrides.blockTag
|
796
|
+
: "0x" + overrides.blockTag.toString(16);
|
797
|
+
}
|
798
|
+
return this.view.encodeCall.decreaseAllowance(spender, subtractedValue, {
|
799
|
+
chainId: this.context.chainId.toString(),
|
800
|
+
address: this.context.address,
|
801
|
+
blockTag: blockTagWithOverride,
|
802
|
+
});
|
803
|
+
},
|
804
|
+
increaseAllowance(spender, addedValue, overrides) {
|
805
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
806
|
+
if (overrides?.blockTag) {
|
807
|
+
blockTagWithOverride =
|
808
|
+
typeof overrides.blockTag == "string"
|
809
|
+
? overrides.blockTag
|
810
|
+
: "0x" + overrides.blockTag.toString(16);
|
811
|
+
}
|
812
|
+
return this.view.encodeCall.increaseAllowance(spender, addedValue, {
|
813
|
+
chainId: this.context.chainId.toString(),
|
814
|
+
address: this.context.address,
|
815
|
+
blockTag: blockTagWithOverride,
|
816
|
+
});
|
817
|
+
},
|
818
|
+
locker(overrides) {
|
819
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
820
|
+
if (overrides?.blockTag) {
|
821
|
+
blockTagWithOverride =
|
822
|
+
typeof overrides.blockTag == "string"
|
823
|
+
? overrides.blockTag
|
824
|
+
: "0x" + overrides.blockTag.toString(16);
|
825
|
+
}
|
826
|
+
return this.view.encodeCall.locker({
|
827
|
+
chainId: this.context.chainId.toString(),
|
828
|
+
address: this.context.address,
|
829
|
+
blockTag: blockTagWithOverride,
|
830
|
+
});
|
831
|
+
},
|
832
|
+
name(overrides) {
|
833
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
834
|
+
if (overrides?.blockTag) {
|
835
|
+
blockTagWithOverride =
|
836
|
+
typeof overrides.blockTag == "string"
|
837
|
+
? overrides.blockTag
|
838
|
+
: "0x" + overrides.blockTag.toString(16);
|
839
|
+
}
|
840
|
+
return this.view.encodeCall.name({
|
841
|
+
chainId: this.context.chainId.toString(),
|
842
|
+
address: this.context.address,
|
843
|
+
blockTag: blockTagWithOverride,
|
844
|
+
});
|
845
|
+
},
|
846
|
+
owner(overrides) {
|
847
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
848
|
+
if (overrides?.blockTag) {
|
849
|
+
blockTagWithOverride =
|
850
|
+
typeof overrides.blockTag == "string"
|
851
|
+
? overrides.blockTag
|
852
|
+
: "0x" + overrides.blockTag.toString(16);
|
853
|
+
}
|
854
|
+
return this.view.encodeCall.owner({
|
855
|
+
chainId: this.context.chainId.toString(),
|
856
|
+
address: this.context.address,
|
857
|
+
blockTag: blockTagWithOverride,
|
858
|
+
});
|
859
|
+
},
|
860
|
+
renounceOwnership(overrides) {
|
861
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
862
|
+
if (overrides?.blockTag) {
|
863
|
+
blockTagWithOverride =
|
864
|
+
typeof overrides.blockTag == "string"
|
865
|
+
? overrides.blockTag
|
866
|
+
: "0x" + overrides.blockTag.toString(16);
|
867
|
+
}
|
868
|
+
return this.view.encodeCall.renounceOwnership({
|
869
|
+
chainId: this.context.chainId.toString(),
|
870
|
+
address: this.context.address,
|
871
|
+
blockTag: blockTagWithOverride,
|
872
|
+
});
|
873
|
+
},
|
874
|
+
setLocker(_locker, overrides) {
|
875
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
876
|
+
if (overrides?.blockTag) {
|
877
|
+
blockTagWithOverride =
|
878
|
+
typeof overrides.blockTag == "string"
|
879
|
+
? overrides.blockTag
|
880
|
+
: "0x" + overrides.blockTag.toString(16);
|
881
|
+
}
|
882
|
+
return this.view.encodeCall.setLocker(_locker, {
|
883
|
+
chainId: this.context.chainId.toString(),
|
884
|
+
address: this.context.address,
|
885
|
+
blockTag: blockTagWithOverride,
|
886
|
+
});
|
887
|
+
},
|
888
|
+
symbol(overrides) {
|
889
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
890
|
+
if (overrides?.blockTag) {
|
891
|
+
blockTagWithOverride =
|
892
|
+
typeof overrides.blockTag == "string"
|
893
|
+
? overrides.blockTag
|
894
|
+
: "0x" + overrides.blockTag.toString(16);
|
895
|
+
}
|
896
|
+
return this.view.encodeCall.symbol({
|
897
|
+
chainId: this.context.chainId.toString(),
|
898
|
+
address: this.context.address,
|
899
|
+
blockTag: blockTagWithOverride,
|
900
|
+
});
|
901
|
+
},
|
902
|
+
totalSupply(overrides) {
|
903
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
904
|
+
if (overrides?.blockTag) {
|
905
|
+
blockTagWithOverride =
|
906
|
+
typeof overrides.blockTag == "string"
|
907
|
+
? overrides.blockTag
|
908
|
+
: "0x" + overrides.blockTag.toString(16);
|
909
|
+
}
|
910
|
+
return this.view.encodeCall.totalSupply({
|
911
|
+
chainId: this.context.chainId.toString(),
|
912
|
+
address: this.context.address,
|
913
|
+
blockTag: blockTagWithOverride,
|
914
|
+
});
|
915
|
+
},
|
916
|
+
transfer(recipient, amount, overrides) {
|
917
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
918
|
+
if (overrides?.blockTag) {
|
919
|
+
blockTagWithOverride =
|
920
|
+
typeof overrides.blockTag == "string"
|
921
|
+
? overrides.blockTag
|
922
|
+
: "0x" + overrides.blockTag.toString(16);
|
923
|
+
}
|
924
|
+
return this.view.encodeCall.transfer(recipient, amount, {
|
925
|
+
chainId: this.context.chainId.toString(),
|
926
|
+
address: this.context.address,
|
927
|
+
blockTag: blockTagWithOverride,
|
928
|
+
});
|
929
|
+
},
|
930
|
+
transferFrom(sender, recipient, amount, overrides) {
|
931
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
932
|
+
if (overrides?.blockTag) {
|
933
|
+
blockTagWithOverride =
|
934
|
+
typeof overrides.blockTag == "string"
|
935
|
+
? overrides.blockTag
|
936
|
+
: "0x" + overrides.blockTag.toString(16);
|
937
|
+
}
|
938
|
+
return this.view.encodeCall.transferFrom(sender, recipient, amount, {
|
939
|
+
chainId: this.context.chainId.toString(),
|
940
|
+
address: this.context.address,
|
941
|
+
blockTag: blockTagWithOverride,
|
942
|
+
});
|
943
|
+
},
|
944
|
+
transferOwnership(newOwner, overrides) {
|
945
|
+
let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
|
946
|
+
if (overrides?.blockTag) {
|
947
|
+
blockTagWithOverride =
|
948
|
+
typeof overrides.blockTag == "string"
|
949
|
+
? overrides.blockTag
|
950
|
+
: "0x" + overrides.blockTag.toString(16);
|
951
|
+
}
|
952
|
+
return this.view.encodeCall.transferOwnership(newOwner, {
|
953
|
+
chainId: this.context.chainId.toString(),
|
954
|
+
address: this.context.address,
|
955
|
+
blockTag: blockTagWithOverride,
|
956
|
+
});
|
957
|
+
},
|
958
|
+
};
|
959
|
+
}
|
960
|
+
export class ERC20Processor extends BaseProcessor {
|
961
|
+
onEventApproval(handler, filter, fetchConfig, preprocessHandler) {
|
962
|
+
if (!filter) {
|
963
|
+
filter = templateContract.filters["Approval(address,address,uint256)"](null, null, null);
|
964
|
+
}
|
965
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
966
|
+
}
|
967
|
+
onEventOwnershipTransferred(handler, filter, fetchConfig, preprocessHandler) {
|
968
|
+
if (!filter) {
|
969
|
+
filter = templateContract.filters["OwnershipTransferred(address,address)"](null, null);
|
970
|
+
}
|
971
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
972
|
+
}
|
973
|
+
onEventTransfer(handler, filter, fetchConfig, preprocessHandler) {
|
974
|
+
if (!filter) {
|
975
|
+
filter = templateContract.filters["Transfer(address,address,uint256)"](null, null, null);
|
976
|
+
}
|
977
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
978
|
+
}
|
979
|
+
onCallAllowance(handler, fetchConfig, preprocessHandler) {
|
980
|
+
return super.onEthTrace("0xdd62ed3e", handler, fetchConfig, preprocessHandler);
|
981
|
+
}
|
982
|
+
onCallApprove(handler, fetchConfig, preprocessHandler) {
|
983
|
+
return super.onEthTrace("0x095ea7b3", handler, fetchConfig, preprocessHandler);
|
984
|
+
}
|
985
|
+
onCallBalanceOf(handler, fetchConfig, preprocessHandler) {
|
986
|
+
return super.onEthTrace("0x70a08231", handler, fetchConfig, preprocessHandler);
|
987
|
+
}
|
988
|
+
onCallBurn(handler, fetchConfig, preprocessHandler) {
|
989
|
+
return super.onEthTrace("0x42966c68", handler, fetchConfig, preprocessHandler);
|
990
|
+
}
|
991
|
+
onCallBurnFrom(handler, fetchConfig, preprocessHandler) {
|
992
|
+
return super.onEthTrace("0x79cc6790", handler, fetchConfig, preprocessHandler);
|
993
|
+
}
|
994
|
+
onCallDecimals(handler, fetchConfig, preprocessHandler) {
|
995
|
+
return super.onEthTrace("0x313ce567", handler, fetchConfig, preprocessHandler);
|
996
|
+
}
|
997
|
+
onCallDecreaseAllowance(handler, fetchConfig, preprocessHandler) {
|
998
|
+
return super.onEthTrace("0xa457c2d7", handler, fetchConfig, preprocessHandler);
|
999
|
+
}
|
1000
|
+
onCallIncreaseAllowance(handler, fetchConfig, preprocessHandler) {
|
1001
|
+
return super.onEthTrace("0x39509351", handler, fetchConfig, preprocessHandler);
|
1002
|
+
}
|
1003
|
+
onCallLocker(handler, fetchConfig, preprocessHandler) {
|
1004
|
+
return super.onEthTrace("0xd7b96d4e", handler, fetchConfig, preprocessHandler);
|
1005
|
+
}
|
1006
|
+
onCallName(handler, fetchConfig, preprocessHandler) {
|
1007
|
+
return super.onEthTrace("0x06fdde03", handler, fetchConfig, preprocessHandler);
|
1008
|
+
}
|
1009
|
+
onCallOwner(handler, fetchConfig, preprocessHandler) {
|
1010
|
+
return super.onEthTrace("0x8da5cb5b", handler, fetchConfig, preprocessHandler);
|
1011
|
+
}
|
1012
|
+
onCallRenounceOwnership(handler, fetchConfig, preprocessHandler) {
|
1013
|
+
return super.onEthTrace("0x715018a6", handler, fetchConfig, preprocessHandler);
|
1014
|
+
}
|
1015
|
+
onCallSetLocker(handler, fetchConfig, preprocessHandler) {
|
1016
|
+
return super.onEthTrace("0x171060ec", handler, fetchConfig, preprocessHandler);
|
1017
|
+
}
|
1018
|
+
onCallSymbol(handler, fetchConfig, preprocessHandler) {
|
1019
|
+
return super.onEthTrace("0x95d89b41", handler, fetchConfig, preprocessHandler);
|
1020
|
+
}
|
1021
|
+
onCallTotalSupply(handler, fetchConfig, preprocessHandler) {
|
1022
|
+
return super.onEthTrace("0x18160ddd", handler, fetchConfig, preprocessHandler);
|
1023
|
+
}
|
1024
|
+
onCallTransfer(handler, fetchConfig, preprocessHandler) {
|
1025
|
+
return super.onEthTrace("0xa9059cbb", handler, fetchConfig, preprocessHandler);
|
1026
|
+
}
|
1027
|
+
onCallTransferFrom(handler, fetchConfig, preprocessHandler) {
|
1028
|
+
return super.onEthTrace("0x23b872dd", handler, fetchConfig, preprocessHandler);
|
1029
|
+
}
|
1030
|
+
onCallTransferOwnership(handler, fetchConfig, preprocessHandler) {
|
1031
|
+
return super.onEthTrace("0xf2fde38b", handler, fetchConfig, preprocessHandler);
|
1032
|
+
}
|
1033
|
+
static filters = {
|
1034
|
+
Approval(owner, spender, value) {
|
1035
|
+
return templateContract.filters["Approval(address,address,uint256)"](owner, spender, value);
|
1036
|
+
},
|
1037
|
+
OwnershipTransferred(previousOwner, newOwner) {
|
1038
|
+
return templateContract.filters["OwnershipTransferred(address,address)"](previousOwner, newOwner);
|
1039
|
+
},
|
1040
|
+
Transfer(from, to, value) {
|
1041
|
+
return templateContract.filters["Transfer(address,address,uint256)"](from, to, value);
|
1042
|
+
},
|
1043
|
+
};
|
1044
|
+
CreateBoundContractView() {
|
1045
|
+
const view = getERC20Contract(this.config.network, this.config.address);
|
1046
|
+
return new ERC20BoundContractView(this.config.address, view);
|
1047
|
+
}
|
1048
|
+
static bind(options) {
|
1049
|
+
if (!options.name) {
|
1050
|
+
options.name = "ERC20";
|
1051
|
+
}
|
1052
|
+
let processor = getProcessor(options);
|
1053
|
+
if (!processor) {
|
1054
|
+
processor = new ERC20Processor(options);
|
1055
|
+
addProcessor(options, processor);
|
1056
|
+
}
|
1057
|
+
return processor;
|
1058
|
+
}
|
1059
|
+
}
|
1060
|
+
export class ERC20ProcessorTemplate extends BaseProcessorTemplate {
|
1061
|
+
bindInternal(options) {
|
1062
|
+
if (!options.name) {
|
1063
|
+
options.name = "ERC20";
|
1064
|
+
}
|
1065
|
+
let processor = getProcessor(options);
|
1066
|
+
if (!processor) {
|
1067
|
+
processor = new ERC20Processor(options);
|
1068
|
+
addProcessor(options, processor);
|
1069
|
+
}
|
1070
|
+
return processor;
|
1071
|
+
}
|
1072
|
+
onEventApproval(handler, filter, fetchConfig, preprocessHandler) {
|
1073
|
+
if (!filter) {
|
1074
|
+
filter = templateContract.filters["Approval(address,address,uint256)"](null, null, null);
|
1075
|
+
}
|
1076
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
1077
|
+
}
|
1078
|
+
onEventOwnershipTransferred(handler, filter, fetchConfig, preprocessHandler) {
|
1079
|
+
if (!filter) {
|
1080
|
+
filter = templateContract.filters["OwnershipTransferred(address,address)"](null, null);
|
1081
|
+
}
|
1082
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
1083
|
+
}
|
1084
|
+
onEventTransfer(handler, filter, fetchConfig, preprocessHandler) {
|
1085
|
+
if (!filter) {
|
1086
|
+
filter = templateContract.filters["Transfer(address,address,uint256)"](null, null, null);
|
1087
|
+
}
|
1088
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
1089
|
+
}
|
1090
|
+
}
|
1091
|
+
export function getERC20Contract(chainId, address) {
|
1092
|
+
let contract = getContractByABI("ERC20", address, chainId);
|
1093
|
+
if (!contract) {
|
1094
|
+
const rawContract = ERC20__factory.connect(address, getProvider(chainId));
|
1095
|
+
contract = new ERC20ContractView(rawContract);
|
1096
|
+
addContractByABI("ERC20", address, chainId, contract);
|
1097
|
+
}
|
1098
|
+
return contract;
|
1099
|
+
}
|
1100
|
+
export function getERC20ContractOnContext(context, address) {
|
1101
|
+
const view = getERC20Contract(context.getChainId(), address);
|
1102
|
+
const boundView = new ERC20BoundContractView(address, view);
|
1103
|
+
boundView.context = context;
|
1104
|
+
if (boundView.callStatic) {
|
1105
|
+
boundView.callStatic.context = context;
|
1106
|
+
}
|
1107
|
+
return boundView;
|
1108
|
+
}
|
1109
|
+
//# sourceMappingURL=erc20-processor.js.map
|