@octaflowlabs/onchain-sdk 1.5.3 → 1.6.0
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/dist/ABIs/ERC20_TOKEN_CONTRACT_ABI.d.ts +17 -7
- package/dist/ABIs/ERC20_TOKEN_CONTRACT_ABI.js +148 -31
- package/dist/blockchain/getTokenMetadata.d.ts +12 -0
- package/dist/blockchain/getTokenMetadata.js +63 -0
- package/dist/blockchain/isTokenVerified.d.ts +1 -0
- package/dist/blockchain/isTokenVerified.js +6 -0
- package/dist/cjs/ABIs/ERC20_TOKEN_CONTRACT_ABI.d.ts +17 -7
- package/dist/cjs/ABIs/ERC20_TOKEN_CONTRACT_ABI.js +148 -31
- package/dist/cjs/blockchain/getTokenMetadata.d.ts +12 -0
- package/dist/cjs/blockchain/getTokenMetadata.js +70 -0
- package/dist/cjs/blockchain/isTokenVerified.d.ts +1 -0
- package/dist/cjs/blockchain/isTokenVerified.js +10 -0
- package/dist/cjs/constants/BASIC_TOKENS_REGISTRY.js +86 -86
- package/dist/cjs/constants/NETWORKS_REGISTRY.js +12 -12
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +5 -1
- package/dist/constants/BASIC_TOKENS_REGISTRY.js +86 -86
- package/dist/constants/NETWORKS_REGISTRY.js +12 -12
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
declare const _default: ({
|
|
2
|
+
constant: boolean;
|
|
2
3
|
inputs: {
|
|
3
|
-
internalType: string;
|
|
4
4
|
name: string;
|
|
5
5
|
type: string;
|
|
6
6
|
}[];
|
|
7
7
|
name: string;
|
|
8
8
|
outputs: {
|
|
9
|
-
internalType: string;
|
|
10
9
|
name: string;
|
|
11
10
|
type: string;
|
|
12
11
|
}[];
|
|
12
|
+
payable: boolean;
|
|
13
|
+
stateMutability: string;
|
|
14
|
+
type: string;
|
|
15
|
+
anonymous?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
payable: boolean;
|
|
13
18
|
stateMutability: string;
|
|
14
19
|
type: string;
|
|
15
20
|
constant?: undefined;
|
|
16
|
-
|
|
21
|
+
inputs?: undefined;
|
|
22
|
+
name?: undefined;
|
|
23
|
+
outputs?: undefined;
|
|
24
|
+
anonymous?: undefined;
|
|
17
25
|
} | {
|
|
18
|
-
|
|
26
|
+
anonymous: boolean;
|
|
19
27
|
inputs: {
|
|
28
|
+
indexed: boolean;
|
|
20
29
|
name: string;
|
|
21
30
|
type: string;
|
|
22
31
|
}[];
|
|
23
32
|
name: string;
|
|
24
|
-
outputs: never[];
|
|
25
|
-
payable: boolean;
|
|
26
|
-
stateMutability: string;
|
|
27
33
|
type: string;
|
|
34
|
+
constant?: undefined;
|
|
35
|
+
outputs?: undefined;
|
|
36
|
+
payable?: undefined;
|
|
37
|
+
stateMutability?: undefined;
|
|
28
38
|
})[];
|
|
29
39
|
export default _default;
|
|
@@ -1,105 +1,222 @@
|
|
|
1
1
|
export default [
|
|
2
2
|
{
|
|
3
|
+
constant: true,
|
|
4
|
+
inputs: [],
|
|
5
|
+
name: 'name',
|
|
6
|
+
outputs: [
|
|
7
|
+
{
|
|
8
|
+
name: '',
|
|
9
|
+
type: 'string',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
payable: false,
|
|
13
|
+
stateMutability: 'view',
|
|
14
|
+
type: 'function',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
constant: false,
|
|
3
18
|
inputs: [
|
|
4
19
|
{
|
|
5
|
-
|
|
6
|
-
name: 'account',
|
|
20
|
+
name: '_spender',
|
|
7
21
|
type: 'address',
|
|
8
22
|
},
|
|
23
|
+
{
|
|
24
|
+
name: '_value',
|
|
25
|
+
type: 'uint256',
|
|
26
|
+
},
|
|
9
27
|
],
|
|
10
|
-
name: '
|
|
28
|
+
name: 'approve',
|
|
29
|
+
outputs: [
|
|
30
|
+
{
|
|
31
|
+
name: '',
|
|
32
|
+
type: 'bool',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
payable: false,
|
|
36
|
+
stateMutability: 'nonpayable',
|
|
37
|
+
type: 'function',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
constant: true,
|
|
41
|
+
inputs: [],
|
|
42
|
+
name: 'totalSupply',
|
|
11
43
|
outputs: [
|
|
12
44
|
{
|
|
13
|
-
internalType: 'uint256',
|
|
14
45
|
name: '',
|
|
15
46
|
type: 'uint256',
|
|
16
47
|
},
|
|
17
48
|
],
|
|
49
|
+
payable: false,
|
|
18
50
|
stateMutability: 'view',
|
|
19
51
|
type: 'function',
|
|
20
52
|
},
|
|
21
53
|
{
|
|
54
|
+
constant: false,
|
|
22
55
|
inputs: [
|
|
23
56
|
{
|
|
24
|
-
|
|
25
|
-
name: 'spender',
|
|
57
|
+
name: '_from',
|
|
26
58
|
type: 'address',
|
|
27
59
|
},
|
|
28
60
|
{
|
|
29
|
-
|
|
30
|
-
|
|
61
|
+
name: '_to',
|
|
62
|
+
type: 'address',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: '_value',
|
|
31
66
|
type: 'uint256',
|
|
32
67
|
},
|
|
33
68
|
],
|
|
34
|
-
name: '
|
|
69
|
+
name: 'transferFrom',
|
|
35
70
|
outputs: [
|
|
36
71
|
{
|
|
37
|
-
internalType: 'bool',
|
|
38
72
|
name: '',
|
|
39
73
|
type: 'bool',
|
|
40
74
|
},
|
|
41
75
|
],
|
|
76
|
+
payable: false,
|
|
42
77
|
stateMutability: 'nonpayable',
|
|
43
78
|
type: 'function',
|
|
44
79
|
},
|
|
45
80
|
{
|
|
46
|
-
constant:
|
|
81
|
+
constant: true,
|
|
47
82
|
inputs: [],
|
|
48
|
-
name: '
|
|
49
|
-
outputs: [
|
|
50
|
-
|
|
51
|
-
|
|
83
|
+
name: 'decimals',
|
|
84
|
+
outputs: [
|
|
85
|
+
{
|
|
86
|
+
name: '',
|
|
87
|
+
type: 'uint8',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
payable: false,
|
|
91
|
+
stateMutability: 'view',
|
|
92
|
+
type: 'function',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
constant: true,
|
|
96
|
+
inputs: [
|
|
97
|
+
{
|
|
98
|
+
name: '_owner',
|
|
99
|
+
type: 'address',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
name: 'balanceOf',
|
|
103
|
+
outputs: [
|
|
104
|
+
{
|
|
105
|
+
name: 'balance',
|
|
106
|
+
type: 'uint256',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
payable: false,
|
|
110
|
+
stateMutability: 'view',
|
|
111
|
+
type: 'function',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
constant: true,
|
|
115
|
+
inputs: [],
|
|
116
|
+
name: 'symbol',
|
|
117
|
+
outputs: [
|
|
118
|
+
{
|
|
119
|
+
name: '',
|
|
120
|
+
type: 'string',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
payable: false,
|
|
124
|
+
stateMutability: 'view',
|
|
52
125
|
type: 'function',
|
|
53
126
|
},
|
|
54
127
|
{
|
|
55
128
|
constant: false,
|
|
56
129
|
inputs: [
|
|
57
130
|
{
|
|
58
|
-
name: '
|
|
131
|
+
name: '_to',
|
|
132
|
+
type: 'address',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: '_value',
|
|
59
136
|
type: 'uint256',
|
|
60
137
|
},
|
|
61
138
|
],
|
|
62
|
-
name: '
|
|
63
|
-
outputs: [
|
|
139
|
+
name: 'transfer',
|
|
140
|
+
outputs: [
|
|
141
|
+
{
|
|
142
|
+
name: '',
|
|
143
|
+
type: 'bool',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
64
146
|
payable: false,
|
|
65
147
|
stateMutability: 'nonpayable',
|
|
66
148
|
type: 'function',
|
|
67
149
|
},
|
|
68
150
|
{
|
|
151
|
+
constant: true,
|
|
69
152
|
inputs: [
|
|
70
153
|
{
|
|
71
|
-
|
|
72
|
-
name: 'owner',
|
|
154
|
+
name: '_owner',
|
|
73
155
|
type: 'address',
|
|
74
156
|
},
|
|
75
157
|
{
|
|
76
|
-
|
|
77
|
-
name: 'spender',
|
|
158
|
+
name: '_spender',
|
|
78
159
|
type: 'address',
|
|
79
160
|
},
|
|
80
161
|
],
|
|
81
162
|
name: 'allowance',
|
|
82
163
|
outputs: [
|
|
83
164
|
{
|
|
84
|
-
internalType: 'uint256',
|
|
85
165
|
name: '',
|
|
86
166
|
type: 'uint256',
|
|
87
167
|
},
|
|
88
168
|
],
|
|
169
|
+
payable: false,
|
|
89
170
|
stateMutability: 'view',
|
|
90
171
|
type: 'function',
|
|
91
172
|
},
|
|
92
173
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
174
|
+
payable: true,
|
|
175
|
+
stateMutability: 'payable',
|
|
176
|
+
type: 'fallback',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
anonymous: false,
|
|
180
|
+
inputs: [
|
|
96
181
|
{
|
|
97
|
-
|
|
98
|
-
name: '',
|
|
99
|
-
type: '
|
|
182
|
+
indexed: true,
|
|
183
|
+
name: 'owner',
|
|
184
|
+
type: 'address',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
indexed: true,
|
|
188
|
+
name: 'spender',
|
|
189
|
+
type: 'address',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
indexed: false,
|
|
193
|
+
name: 'value',
|
|
194
|
+
type: 'uint256',
|
|
100
195
|
},
|
|
101
196
|
],
|
|
102
|
-
|
|
103
|
-
type: '
|
|
197
|
+
name: 'Approval',
|
|
198
|
+
type: 'event',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
anonymous: false,
|
|
202
|
+
inputs: [
|
|
203
|
+
{
|
|
204
|
+
indexed: true,
|
|
205
|
+
name: 'from',
|
|
206
|
+
type: 'address',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
indexed: true,
|
|
210
|
+
name: 'to',
|
|
211
|
+
type: 'address',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
indexed: false,
|
|
215
|
+
name: 'value',
|
|
216
|
+
type: 'uint256',
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
name: 'Transfer',
|
|
220
|
+
type: 'event',
|
|
104
221
|
},
|
|
105
222
|
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface GetTokenMetadataParams {
|
|
2
|
+
rpcUrl: string;
|
|
3
|
+
chainId?: number;
|
|
4
|
+
tokenAddresses: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface TokenMetadata {
|
|
7
|
+
address: string;
|
|
8
|
+
decimals: number | null;
|
|
9
|
+
symbol: string | null;
|
|
10
|
+
name: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const getTokenMetadata: ({ rpcUrl, chainId, tokenAddresses, }: GetTokenMetadataParams) => Promise<TokenMetadata[]>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** npm imports */
|
|
2
|
+
import { Contract, Interface, decodeBytes32String } from 'ethers';
|
|
3
|
+
/** local imports */
|
|
4
|
+
import { getProvider } from './getProvider';
|
|
5
|
+
import ERC20_TOKEN_CONTRACT_ABI from '../ABIs/ERC20_TOKEN_CONTRACT_ABI';
|
|
6
|
+
import MULTICALL3_ABI from '../ABIs/MULTICALL3_ABI';
|
|
7
|
+
import { MULTICALL3_ADDRESS } from '../constants/constants';
|
|
8
|
+
const decodeUint8 = (iface, fn, res) => {
|
|
9
|
+
if (!res?.success || res.returnData === '0x')
|
|
10
|
+
return null;
|
|
11
|
+
try {
|
|
12
|
+
return Number(iface.decodeFunctionResult(fn, res.returnData)[0]);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const decodeStringOrBytes32 = (iface, fn, res) => {
|
|
19
|
+
if (!res?.success || res.returnData === '0x')
|
|
20
|
+
return null;
|
|
21
|
+
try {
|
|
22
|
+
const [val] = iface.decodeFunctionResult(fn, res.returnData);
|
|
23
|
+
return typeof val === 'string' && val.length ? val : null;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
try {
|
|
27
|
+
const s = decodeBytes32String(res.returnData);
|
|
28
|
+
return s.length ? s : null;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export const getTokenMetadata = async ({ rpcUrl, chainId, tokenAddresses, }) => {
|
|
36
|
+
if (!tokenAddresses.length)
|
|
37
|
+
return [];
|
|
38
|
+
const provider = getProvider(rpcUrl, chainId);
|
|
39
|
+
const empty = () => tokenAddresses.map((address) => ({ address, decimals: null, symbol: null, name: null }));
|
|
40
|
+
if (!provider)
|
|
41
|
+
return empty();
|
|
42
|
+
const erc20 = new Interface(ERC20_TOKEN_CONTRACT_ABI);
|
|
43
|
+
const multicall = new Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
|
|
44
|
+
const calls = tokenAddresses.flatMap((target) => [
|
|
45
|
+
{ target, allowFailure: true, callData: erc20.encodeFunctionData('decimals') },
|
|
46
|
+
{ target, allowFailure: true, callData: erc20.encodeFunctionData('symbol') },
|
|
47
|
+
{ target, allowFailure: true, callData: erc20.encodeFunctionData('name') },
|
|
48
|
+
]);
|
|
49
|
+
let results;
|
|
50
|
+
try {
|
|
51
|
+
results = await multicall.aggregate3.staticCall(calls);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error('Multicall metadata failed, returning nulls:', error);
|
|
55
|
+
return empty();
|
|
56
|
+
}
|
|
57
|
+
return tokenAddresses.map((address, i) => ({
|
|
58
|
+
address,
|
|
59
|
+
decimals: decodeUint8(erc20, 'decimals', results[i * 3]),
|
|
60
|
+
symbol: decodeStringOrBytes32(erc20, 'symbol', results[i * 3 + 1]),
|
|
61
|
+
name: decodeStringOrBytes32(erc20, 'name', results[i * 3 + 2]),
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isVerified: (chainId: number, tokenAddress: string) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** local imports */
|
|
2
|
+
import { BASIC_TOKENS_BY_CHAIN } from '../constants/BASIC_TOKENS_REGISTRY';
|
|
3
|
+
const VERIFIED_SET = new Set(Object.entries(BASIC_TOKENS_BY_CHAIN).flatMap(([chainId, tokens]) => tokens
|
|
4
|
+
.filter((t) => t.address !== null) //& native fuera: no se descubre, no se verifica por address
|
|
5
|
+
.map((t) => `${chainId}:${t.address.toLowerCase()}`)));
|
|
6
|
+
export const isVerified = (chainId, tokenAddress) => VERIFIED_SET.has(`${chainId}:${tokenAddress.toLowerCase()}`);
|
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
declare const _default: ({
|
|
2
|
+
constant: boolean;
|
|
2
3
|
inputs: {
|
|
3
|
-
internalType: string;
|
|
4
4
|
name: string;
|
|
5
5
|
type: string;
|
|
6
6
|
}[];
|
|
7
7
|
name: string;
|
|
8
8
|
outputs: {
|
|
9
|
-
internalType: string;
|
|
10
9
|
name: string;
|
|
11
10
|
type: string;
|
|
12
11
|
}[];
|
|
12
|
+
payable: boolean;
|
|
13
|
+
stateMutability: string;
|
|
14
|
+
type: string;
|
|
15
|
+
anonymous?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
payable: boolean;
|
|
13
18
|
stateMutability: string;
|
|
14
19
|
type: string;
|
|
15
20
|
constant?: undefined;
|
|
16
|
-
|
|
21
|
+
inputs?: undefined;
|
|
22
|
+
name?: undefined;
|
|
23
|
+
outputs?: undefined;
|
|
24
|
+
anonymous?: undefined;
|
|
17
25
|
} | {
|
|
18
|
-
|
|
26
|
+
anonymous: boolean;
|
|
19
27
|
inputs: {
|
|
28
|
+
indexed: boolean;
|
|
20
29
|
name: string;
|
|
21
30
|
type: string;
|
|
22
31
|
}[];
|
|
23
32
|
name: string;
|
|
24
|
-
outputs: never[];
|
|
25
|
-
payable: boolean;
|
|
26
|
-
stateMutability: string;
|
|
27
33
|
type: string;
|
|
34
|
+
constant?: undefined;
|
|
35
|
+
outputs?: undefined;
|
|
36
|
+
payable?: undefined;
|
|
37
|
+
stateMutability?: undefined;
|
|
28
38
|
})[];
|
|
29
39
|
export default _default;
|
|
@@ -2,106 +2,223 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = [
|
|
4
4
|
{
|
|
5
|
+
constant: true,
|
|
6
|
+
inputs: [],
|
|
7
|
+
name: 'name',
|
|
8
|
+
outputs: [
|
|
9
|
+
{
|
|
10
|
+
name: '',
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
payable: false,
|
|
15
|
+
stateMutability: 'view',
|
|
16
|
+
type: 'function',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
constant: false,
|
|
5
20
|
inputs: [
|
|
6
21
|
{
|
|
7
|
-
|
|
8
|
-
name: 'account',
|
|
22
|
+
name: '_spender',
|
|
9
23
|
type: 'address',
|
|
10
24
|
},
|
|
25
|
+
{
|
|
26
|
+
name: '_value',
|
|
27
|
+
type: 'uint256',
|
|
28
|
+
},
|
|
11
29
|
],
|
|
12
|
-
name: '
|
|
30
|
+
name: 'approve',
|
|
31
|
+
outputs: [
|
|
32
|
+
{
|
|
33
|
+
name: '',
|
|
34
|
+
type: 'bool',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
payable: false,
|
|
38
|
+
stateMutability: 'nonpayable',
|
|
39
|
+
type: 'function',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
constant: true,
|
|
43
|
+
inputs: [],
|
|
44
|
+
name: 'totalSupply',
|
|
13
45
|
outputs: [
|
|
14
46
|
{
|
|
15
|
-
internalType: 'uint256',
|
|
16
47
|
name: '',
|
|
17
48
|
type: 'uint256',
|
|
18
49
|
},
|
|
19
50
|
],
|
|
51
|
+
payable: false,
|
|
20
52
|
stateMutability: 'view',
|
|
21
53
|
type: 'function',
|
|
22
54
|
},
|
|
23
55
|
{
|
|
56
|
+
constant: false,
|
|
24
57
|
inputs: [
|
|
25
58
|
{
|
|
26
|
-
|
|
27
|
-
name: 'spender',
|
|
59
|
+
name: '_from',
|
|
28
60
|
type: 'address',
|
|
29
61
|
},
|
|
30
62
|
{
|
|
31
|
-
|
|
32
|
-
|
|
63
|
+
name: '_to',
|
|
64
|
+
type: 'address',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: '_value',
|
|
33
68
|
type: 'uint256',
|
|
34
69
|
},
|
|
35
70
|
],
|
|
36
|
-
name: '
|
|
71
|
+
name: 'transferFrom',
|
|
37
72
|
outputs: [
|
|
38
73
|
{
|
|
39
|
-
internalType: 'bool',
|
|
40
74
|
name: '',
|
|
41
75
|
type: 'bool',
|
|
42
76
|
},
|
|
43
77
|
],
|
|
78
|
+
payable: false,
|
|
44
79
|
stateMutability: 'nonpayable',
|
|
45
80
|
type: 'function',
|
|
46
81
|
},
|
|
47
82
|
{
|
|
48
|
-
constant:
|
|
83
|
+
constant: true,
|
|
49
84
|
inputs: [],
|
|
50
|
-
name: '
|
|
51
|
-
outputs: [
|
|
52
|
-
|
|
53
|
-
|
|
85
|
+
name: 'decimals',
|
|
86
|
+
outputs: [
|
|
87
|
+
{
|
|
88
|
+
name: '',
|
|
89
|
+
type: 'uint8',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
payable: false,
|
|
93
|
+
stateMutability: 'view',
|
|
94
|
+
type: 'function',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
constant: true,
|
|
98
|
+
inputs: [
|
|
99
|
+
{
|
|
100
|
+
name: '_owner',
|
|
101
|
+
type: 'address',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
name: 'balanceOf',
|
|
105
|
+
outputs: [
|
|
106
|
+
{
|
|
107
|
+
name: 'balance',
|
|
108
|
+
type: 'uint256',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
payable: false,
|
|
112
|
+
stateMutability: 'view',
|
|
113
|
+
type: 'function',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
constant: true,
|
|
117
|
+
inputs: [],
|
|
118
|
+
name: 'symbol',
|
|
119
|
+
outputs: [
|
|
120
|
+
{
|
|
121
|
+
name: '',
|
|
122
|
+
type: 'string',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
payable: false,
|
|
126
|
+
stateMutability: 'view',
|
|
54
127
|
type: 'function',
|
|
55
128
|
},
|
|
56
129
|
{
|
|
57
130
|
constant: false,
|
|
58
131
|
inputs: [
|
|
59
132
|
{
|
|
60
|
-
name: '
|
|
133
|
+
name: '_to',
|
|
134
|
+
type: 'address',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: '_value',
|
|
61
138
|
type: 'uint256',
|
|
62
139
|
},
|
|
63
140
|
],
|
|
64
|
-
name: '
|
|
65
|
-
outputs: [
|
|
141
|
+
name: 'transfer',
|
|
142
|
+
outputs: [
|
|
143
|
+
{
|
|
144
|
+
name: '',
|
|
145
|
+
type: 'bool',
|
|
146
|
+
},
|
|
147
|
+
],
|
|
66
148
|
payable: false,
|
|
67
149
|
stateMutability: 'nonpayable',
|
|
68
150
|
type: 'function',
|
|
69
151
|
},
|
|
70
152
|
{
|
|
153
|
+
constant: true,
|
|
71
154
|
inputs: [
|
|
72
155
|
{
|
|
73
|
-
|
|
74
|
-
name: 'owner',
|
|
156
|
+
name: '_owner',
|
|
75
157
|
type: 'address',
|
|
76
158
|
},
|
|
77
159
|
{
|
|
78
|
-
|
|
79
|
-
name: 'spender',
|
|
160
|
+
name: '_spender',
|
|
80
161
|
type: 'address',
|
|
81
162
|
},
|
|
82
163
|
],
|
|
83
164
|
name: 'allowance',
|
|
84
165
|
outputs: [
|
|
85
166
|
{
|
|
86
|
-
internalType: 'uint256',
|
|
87
167
|
name: '',
|
|
88
168
|
type: 'uint256',
|
|
89
169
|
},
|
|
90
170
|
],
|
|
171
|
+
payable: false,
|
|
91
172
|
stateMutability: 'view',
|
|
92
173
|
type: 'function',
|
|
93
174
|
},
|
|
94
175
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
176
|
+
payable: true,
|
|
177
|
+
stateMutability: 'payable',
|
|
178
|
+
type: 'fallback',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
anonymous: false,
|
|
182
|
+
inputs: [
|
|
98
183
|
{
|
|
99
|
-
|
|
100
|
-
name: '',
|
|
101
|
-
type: '
|
|
184
|
+
indexed: true,
|
|
185
|
+
name: 'owner',
|
|
186
|
+
type: 'address',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
indexed: true,
|
|
190
|
+
name: 'spender',
|
|
191
|
+
type: 'address',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
indexed: false,
|
|
195
|
+
name: 'value',
|
|
196
|
+
type: 'uint256',
|
|
102
197
|
},
|
|
103
198
|
],
|
|
104
|
-
|
|
105
|
-
type: '
|
|
199
|
+
name: 'Approval',
|
|
200
|
+
type: 'event',
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
anonymous: false,
|
|
204
|
+
inputs: [
|
|
205
|
+
{
|
|
206
|
+
indexed: true,
|
|
207
|
+
name: 'from',
|
|
208
|
+
type: 'address',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
indexed: true,
|
|
212
|
+
name: 'to',
|
|
213
|
+
type: 'address',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
indexed: false,
|
|
217
|
+
name: 'value',
|
|
218
|
+
type: 'uint256',
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
name: 'Transfer',
|
|
222
|
+
type: 'event',
|
|
106
223
|
},
|
|
107
224
|
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface GetTokenMetadataParams {
|
|
2
|
+
rpcUrl: string;
|
|
3
|
+
chainId?: number;
|
|
4
|
+
tokenAddresses: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface TokenMetadata {
|
|
7
|
+
address: string;
|
|
8
|
+
decimals: number | null;
|
|
9
|
+
symbol: string | null;
|
|
10
|
+
name: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const getTokenMetadata: ({ rpcUrl, chainId, tokenAddresses, }: GetTokenMetadataParams) => Promise<TokenMetadata[]>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getTokenMetadata = void 0;
|
|
7
|
+
/** npm imports */
|
|
8
|
+
const ethers_1 = require("ethers");
|
|
9
|
+
/** local imports */
|
|
10
|
+
const getProvider_1 = require("./getProvider");
|
|
11
|
+
const ERC20_TOKEN_CONTRACT_ABI_1 = __importDefault(require("../ABIs/ERC20_TOKEN_CONTRACT_ABI"));
|
|
12
|
+
const MULTICALL3_ABI_1 = __importDefault(require("../ABIs/MULTICALL3_ABI"));
|
|
13
|
+
const constants_1 = require("../constants/constants");
|
|
14
|
+
const decodeUint8 = (iface, fn, res) => {
|
|
15
|
+
if (!res?.success || res.returnData === '0x')
|
|
16
|
+
return null;
|
|
17
|
+
try {
|
|
18
|
+
return Number(iface.decodeFunctionResult(fn, res.returnData)[0]);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const decodeStringOrBytes32 = (iface, fn, res) => {
|
|
25
|
+
if (!res?.success || res.returnData === '0x')
|
|
26
|
+
return null;
|
|
27
|
+
try {
|
|
28
|
+
const [val] = iface.decodeFunctionResult(fn, res.returnData);
|
|
29
|
+
return typeof val === 'string' && val.length ? val : null;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
try {
|
|
33
|
+
const s = (0, ethers_1.decodeBytes32String)(res.returnData);
|
|
34
|
+
return s.length ? s : null;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const getTokenMetadata = async ({ rpcUrl, chainId, tokenAddresses, }) => {
|
|
42
|
+
if (!tokenAddresses.length)
|
|
43
|
+
return [];
|
|
44
|
+
const provider = (0, getProvider_1.getProvider)(rpcUrl, chainId);
|
|
45
|
+
const empty = () => tokenAddresses.map((address) => ({ address, decimals: null, symbol: null, name: null }));
|
|
46
|
+
if (!provider)
|
|
47
|
+
return empty();
|
|
48
|
+
const erc20 = new ethers_1.Interface(ERC20_TOKEN_CONTRACT_ABI_1.default);
|
|
49
|
+
const multicall = new ethers_1.Contract(constants_1.MULTICALL3_ADDRESS, MULTICALL3_ABI_1.default, provider);
|
|
50
|
+
const calls = tokenAddresses.flatMap((target) => [
|
|
51
|
+
{ target, allowFailure: true, callData: erc20.encodeFunctionData('decimals') },
|
|
52
|
+
{ target, allowFailure: true, callData: erc20.encodeFunctionData('symbol') },
|
|
53
|
+
{ target, allowFailure: true, callData: erc20.encodeFunctionData('name') },
|
|
54
|
+
]);
|
|
55
|
+
let results;
|
|
56
|
+
try {
|
|
57
|
+
results = await multicall.aggregate3.staticCall(calls);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error('Multicall metadata failed, returning nulls:', error);
|
|
61
|
+
return empty();
|
|
62
|
+
}
|
|
63
|
+
return tokenAddresses.map((address, i) => ({
|
|
64
|
+
address,
|
|
65
|
+
decimals: decodeUint8(erc20, 'decimals', results[i * 3]),
|
|
66
|
+
symbol: decodeStringOrBytes32(erc20, 'symbol', results[i * 3 + 1]),
|
|
67
|
+
name: decodeStringOrBytes32(erc20, 'name', results[i * 3 + 2]),
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
exports.getTokenMetadata = getTokenMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isVerified: (chainId: number, tokenAddress: string) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isVerified = void 0;
|
|
4
|
+
/** local imports */
|
|
5
|
+
const BASIC_TOKENS_REGISTRY_1 = require("../constants/BASIC_TOKENS_REGISTRY");
|
|
6
|
+
const VERIFIED_SET = new Set(Object.entries(BASIC_TOKENS_REGISTRY_1.BASIC_TOKENS_BY_CHAIN).flatMap(([chainId, tokens]) => tokens
|
|
7
|
+
.filter((t) => t.address !== null) //& native fuera: no se descubre, no se verifica por address
|
|
8
|
+
.map((t) => `${chainId}:${t.address.toLowerCase()}`)));
|
|
9
|
+
const isVerified = (chainId, tokenAddress) => VERIFIED_SET.has(`${chainId}:${tokenAddress.toLowerCase()}`);
|
|
10
|
+
exports.isVerified = isVerified;
|
|
@@ -757,92 +757,92 @@ exports.BASIC_TOKENS_BY_CHAIN = {
|
|
|
757
757
|
},
|
|
758
758
|
// No canonical WETH/USDC/DAI/WBTC/UNI deployment on Plasma in this mock set
|
|
759
759
|
],
|
|
760
|
-
42220: [
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
],
|
|
760
|
+
// 42220: [
|
|
761
|
+
// {
|
|
762
|
+
// id: 'celo',
|
|
763
|
+
// address: null, //! This is a dual token, so the address is null for the native token
|
|
764
|
+
// chainId: 42220,
|
|
765
|
+
// symbol: 'CELO',
|
|
766
|
+
// name: 'Celo',
|
|
767
|
+
// decimals: 18,
|
|
768
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg',
|
|
769
|
+
// amount: '38.80',
|
|
770
|
+
// usdValue: '150,000 USD',
|
|
771
|
+
// isNative: true,
|
|
772
|
+
// },
|
|
773
|
+
// {
|
|
774
|
+
// id: 'weth',
|
|
775
|
+
// address: '0xD221812de1BD094f35587EE8E174B07B6167D9Af',
|
|
776
|
+
// chainId: 42220,
|
|
777
|
+
// symbol: 'WETH',
|
|
778
|
+
// name: 'Wrapped Ether',
|
|
779
|
+
// decimals: 18,
|
|
780
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332',
|
|
781
|
+
// amount: '38.80',
|
|
782
|
+
// usdValue: '150,000 USD',
|
|
783
|
+
// isNative: false,
|
|
784
|
+
// },
|
|
785
|
+
// {
|
|
786
|
+
// id: 'usdc',
|
|
787
|
+
// address: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
|
|
788
|
+
// chainId: 42220,
|
|
789
|
+
// symbol: 'USDC',
|
|
790
|
+
// name: 'USD Coin',
|
|
791
|
+
// decimals: 6,
|
|
792
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
|
|
793
|
+
// amount: '150,000',
|
|
794
|
+
// usdValue: '150,000 USD',
|
|
795
|
+
// isNative: false,
|
|
796
|
+
// },
|
|
797
|
+
// {
|
|
798
|
+
// id: 'usdt',
|
|
799
|
+
// address: '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
|
|
800
|
+
// chainId: 42220,
|
|
801
|
+
// symbol: 'USD₮',
|
|
802
|
+
// name: 'Tether USD',
|
|
803
|
+
// decimals: 6,
|
|
804
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
|
|
805
|
+
// amount: '75,000',
|
|
806
|
+
// usdValue: '75,000 USD',
|
|
807
|
+
// isNative: false,
|
|
808
|
+
// },
|
|
809
|
+
// {
|
|
810
|
+
// id: 'dai',
|
|
811
|
+
// address: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
812
|
+
// chainId: 42220,
|
|
813
|
+
// symbol: 'DAI',
|
|
814
|
+
// name: 'Dai Stablecoin',
|
|
815
|
+
// decimals: 18,
|
|
816
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
|
|
817
|
+
// amount: '25,000',
|
|
818
|
+
// usdValue: '25,000 USD',
|
|
819
|
+
// isNative: false,
|
|
820
|
+
// },
|
|
821
|
+
// {
|
|
822
|
+
// id: 'wbtc',
|
|
823
|
+
// address: '0xD629eb00dEced2a080B7EC630eF6aC117e614f1b',
|
|
824
|
+
// chainId: 42220,
|
|
825
|
+
// symbol: 'WBTC',
|
|
826
|
+
// name: 'Wrapped BTC',
|
|
827
|
+
// decimals: 18,
|
|
828
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
|
|
829
|
+
// amount: '1.5',
|
|
830
|
+
// usdValue: '100,000 USD',
|
|
831
|
+
// isNative: false,
|
|
832
|
+
// },
|
|
833
|
+
// // {
|
|
834
|
+
// // id: 'uni',
|
|
835
|
+
// // address: '0x6fd9d7AD17242c41f7131d257212c54A0e816691',
|
|
836
|
+
// // chainId: 42220,
|
|
837
|
+
// // symbol: 'UNI',
|
|
838
|
+
// // name: 'Uniswap',
|
|
839
|
+
// // decimals: 18,
|
|
840
|
+
// // iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
|
|
841
|
+
// // amount: '5,000',
|
|
842
|
+
// // usdValue: '50,000 USD',
|
|
843
|
+
// // isNative: false,
|
|
844
|
+
// // },
|
|
845
|
+
// ],
|
|
846
846
|
42161: [
|
|
847
847
|
{
|
|
848
848
|
id: 'eth',
|
|
@@ -137,18 +137,18 @@ exports.NETWORKS_REGISTRY = [
|
|
|
137
137
|
failoverRpcUrl: 'https://mantle.llamarpc.com',
|
|
138
138
|
blockTime: 2,
|
|
139
139
|
},
|
|
140
|
-
{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
},
|
|
140
|
+
// {
|
|
141
|
+
// id: 'celo-mainnet',
|
|
142
|
+
// name: 'celo-mainnet',
|
|
143
|
+
// nameForDisplay: 'Celo Mainnet',
|
|
144
|
+
// chainId: 42220,
|
|
145
|
+
// rpcUrl: 'https://rpc.ankr.com/celo',
|
|
146
|
+
// explorerUrl: 'https://celoscan.io',
|
|
147
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg',
|
|
148
|
+
// symbol: 'CELO',
|
|
149
|
+
// failoverRpcUrl: 'https://celo.drpc.org',
|
|
150
|
+
// blockTime: 5,
|
|
151
|
+
// },
|
|
152
152
|
{
|
|
153
153
|
id: 'blast-mainnet',
|
|
154
154
|
name: 'blast-mainnet',
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { getBalance, getBalances } from './blockchain/getBalances';
|
|
|
16
16
|
export { estimateTransaction } from './blockchain/estimateTransaction';
|
|
17
17
|
export { prepareTransaction } from './blockchain/prepareTransaction';
|
|
18
18
|
export { fetchFeeSnapshot, type FetchFeeSnapshotOptions, type FeeSnapshotTxKind, } from './blockchain/fetchFeeSnapshot';
|
|
19
|
+
export { type GetTokenMetadataParams, type TokenMetadata, getTokenMetadata, } from './blockchain/getTokenMetadata';
|
|
20
|
+
export { isVerified } from './blockchain/isTokenVerified';
|
|
19
21
|
/** services exports */
|
|
20
22
|
export { EvmWalletService, EvmGeneratedWallet, EvmDerivedWallet, } from './services/evm-wallet-core/evmWalletService';
|
|
21
23
|
export { EntropySource } from './services/evm-wallet-core/entropy';
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractPoolInboundStablecoinEvents = exports.BLOCK_TIME_BY_CHAIN = exports.getBlockTime = exports.estimateSeconds = exports.calcReserve = exports.getFeePresets = exports.parseGasLimit = exports.tryParseGweiToWei = exports.toGwei = exports.normalizeEvmAddress = exports.normalizeAddress = exports.errorMessagesForGasLimitEstimation = exports.errorMessagesForBroadcast = exports.handleErrorMessages = exports.parsedAmount = exports.formattedAmountForDisplay = exports.NATIVE_TOKENS = exports.transformBigInt = exports.getShortenData = exports.getShortenTransactionHashOrAddress = exports.signTransaction = exports.signMessage = exports.createWallet = exports.EvmWalletService = exports.fetchFeeSnapshot = exports.prepareTransaction = exports.estimateTransaction = exports.getBalances = exports.getBalance = exports.txStatus = exports.getProvider = exports.estimateGasLimitFromProvider = exports.broadcastTransaction = exports.buildUnsignedTransferTx = exports.buildMaxNativeTransferTx = exports.buildBaseUnsignedTransferTx = exports.isAllowedStablecoinContract = exports.getStablecoinContractsByChainId = exports.getStablecoinContractBySymbolAndChainId = exports.STABLECOIN_CONTRACTS_BY_CHAIN_ID = exports.BASIC_TOKENS_BY_CHAIN = exports.NETWORKS_REGISTRY = exports.MULTICALL3_ADDRESS = exports.GAS_LIMIT_PER_TX_TYPE = exports.ERC20_TOKEN_CONTRACT_ABI = void 0;
|
|
6
|
+
exports.extractPoolInboundStablecoinEvents = exports.BLOCK_TIME_BY_CHAIN = exports.getBlockTime = exports.estimateSeconds = exports.calcReserve = exports.getFeePresets = exports.parseGasLimit = exports.tryParseGweiToWei = exports.toGwei = exports.normalizeEvmAddress = exports.normalizeAddress = exports.errorMessagesForGasLimitEstimation = exports.errorMessagesForBroadcast = exports.handleErrorMessages = exports.parsedAmount = exports.formattedAmountForDisplay = exports.NATIVE_TOKENS = exports.transformBigInt = exports.getShortenData = exports.getShortenTransactionHashOrAddress = exports.signTransaction = exports.signMessage = exports.createWallet = exports.EvmWalletService = exports.isVerified = exports.getTokenMetadata = exports.fetchFeeSnapshot = exports.prepareTransaction = exports.estimateTransaction = exports.getBalances = exports.getBalance = exports.txStatus = exports.getProvider = exports.estimateGasLimitFromProvider = exports.broadcastTransaction = exports.buildUnsignedTransferTx = exports.buildMaxNativeTransferTx = exports.buildBaseUnsignedTransferTx = exports.isAllowedStablecoinContract = exports.getStablecoinContractsByChainId = exports.getStablecoinContractBySymbolAndChainId = exports.STABLECOIN_CONTRACTS_BY_CHAIN_ID = exports.BASIC_TOKENS_BY_CHAIN = exports.NETWORKS_REGISTRY = exports.MULTICALL3_ADDRESS = exports.GAS_LIMIT_PER_TX_TYPE = exports.ERC20_TOKEN_CONTRACT_ABI = void 0;
|
|
7
7
|
/** ABIs exports */
|
|
8
8
|
const ERC20_TOKEN_CONTRACT_ABI_1 = __importDefault(require("./ABIs/ERC20_TOKEN_CONTRACT_ABI"));
|
|
9
9
|
exports.ERC20_TOKEN_CONTRACT_ABI = ERC20_TOKEN_CONTRACT_ABI_1.default;
|
|
@@ -42,6 +42,10 @@ var prepareTransaction_1 = require("./blockchain/prepareTransaction");
|
|
|
42
42
|
Object.defineProperty(exports, "prepareTransaction", { enumerable: true, get: function () { return prepareTransaction_1.prepareTransaction; } });
|
|
43
43
|
var fetchFeeSnapshot_1 = require("./blockchain/fetchFeeSnapshot");
|
|
44
44
|
Object.defineProperty(exports, "fetchFeeSnapshot", { enumerable: true, get: function () { return fetchFeeSnapshot_1.fetchFeeSnapshot; } });
|
|
45
|
+
var getTokenMetadata_1 = require("./blockchain/getTokenMetadata");
|
|
46
|
+
Object.defineProperty(exports, "getTokenMetadata", { enumerable: true, get: function () { return getTokenMetadata_1.getTokenMetadata; } });
|
|
47
|
+
var isTokenVerified_1 = require("./blockchain/isTokenVerified");
|
|
48
|
+
Object.defineProperty(exports, "isVerified", { enumerable: true, get: function () { return isTokenVerified_1.isVerified; } });
|
|
45
49
|
/** services exports */
|
|
46
50
|
var evmWalletService_1 = require("./services/evm-wallet-core/evmWalletService");
|
|
47
51
|
Object.defineProperty(exports, "EvmWalletService", { enumerable: true, get: function () { return evmWalletService_1.EvmWalletService; } });
|
|
@@ -754,92 +754,92 @@ export const BASIC_TOKENS_BY_CHAIN = {
|
|
|
754
754
|
},
|
|
755
755
|
// No canonical WETH/USDC/DAI/WBTC/UNI deployment on Plasma in this mock set
|
|
756
756
|
],
|
|
757
|
-
42220: [
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
],
|
|
757
|
+
// 42220: [
|
|
758
|
+
// {
|
|
759
|
+
// id: 'celo',
|
|
760
|
+
// address: null, //! This is a dual token, so the address is null for the native token
|
|
761
|
+
// chainId: 42220,
|
|
762
|
+
// symbol: 'CELO',
|
|
763
|
+
// name: 'Celo',
|
|
764
|
+
// decimals: 18,
|
|
765
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg',
|
|
766
|
+
// amount: '38.80',
|
|
767
|
+
// usdValue: '150,000 USD',
|
|
768
|
+
// isNative: true,
|
|
769
|
+
// },
|
|
770
|
+
// {
|
|
771
|
+
// id: 'weth',
|
|
772
|
+
// address: '0xD221812de1BD094f35587EE8E174B07B6167D9Af',
|
|
773
|
+
// chainId: 42220,
|
|
774
|
+
// symbol: 'WETH',
|
|
775
|
+
// name: 'Wrapped Ether',
|
|
776
|
+
// decimals: 18,
|
|
777
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332',
|
|
778
|
+
// amount: '38.80',
|
|
779
|
+
// usdValue: '150,000 USD',
|
|
780
|
+
// isNative: false,
|
|
781
|
+
// },
|
|
782
|
+
// {
|
|
783
|
+
// id: 'usdc',
|
|
784
|
+
// address: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
|
|
785
|
+
// chainId: 42220,
|
|
786
|
+
// symbol: 'USDC',
|
|
787
|
+
// name: 'USD Coin',
|
|
788
|
+
// decimals: 6,
|
|
789
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
|
|
790
|
+
// amount: '150,000',
|
|
791
|
+
// usdValue: '150,000 USD',
|
|
792
|
+
// isNative: false,
|
|
793
|
+
// },
|
|
794
|
+
// {
|
|
795
|
+
// id: 'usdt',
|
|
796
|
+
// address: '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
|
|
797
|
+
// chainId: 42220,
|
|
798
|
+
// symbol: 'USD₮',
|
|
799
|
+
// name: 'Tether USD',
|
|
800
|
+
// decimals: 6,
|
|
801
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
|
|
802
|
+
// amount: '75,000',
|
|
803
|
+
// usdValue: '75,000 USD',
|
|
804
|
+
// isNative: false,
|
|
805
|
+
// },
|
|
806
|
+
// {
|
|
807
|
+
// id: 'dai',
|
|
808
|
+
// address: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
809
|
+
// chainId: 42220,
|
|
810
|
+
// symbol: 'DAI',
|
|
811
|
+
// name: 'Dai Stablecoin',
|
|
812
|
+
// decimals: 18,
|
|
813
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
|
|
814
|
+
// amount: '25,000',
|
|
815
|
+
// usdValue: '25,000 USD',
|
|
816
|
+
// isNative: false,
|
|
817
|
+
// },
|
|
818
|
+
// {
|
|
819
|
+
// id: 'wbtc',
|
|
820
|
+
// address: '0xD629eb00dEced2a080B7EC630eF6aC117e614f1b',
|
|
821
|
+
// chainId: 42220,
|
|
822
|
+
// symbol: 'WBTC',
|
|
823
|
+
// name: 'Wrapped BTC',
|
|
824
|
+
// decimals: 18,
|
|
825
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
|
|
826
|
+
// amount: '1.5',
|
|
827
|
+
// usdValue: '100,000 USD',
|
|
828
|
+
// isNative: false,
|
|
829
|
+
// },
|
|
830
|
+
// // {
|
|
831
|
+
// // id: 'uni',
|
|
832
|
+
// // address: '0x6fd9d7AD17242c41f7131d257212c54A0e816691',
|
|
833
|
+
// // chainId: 42220,
|
|
834
|
+
// // symbol: 'UNI',
|
|
835
|
+
// // name: 'Uniswap',
|
|
836
|
+
// // decimals: 18,
|
|
837
|
+
// // iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
|
|
838
|
+
// // amount: '5,000',
|
|
839
|
+
// // usdValue: '50,000 USD',
|
|
840
|
+
// // isNative: false,
|
|
841
|
+
// // },
|
|
842
|
+
// ],
|
|
843
843
|
42161: [
|
|
844
844
|
{
|
|
845
845
|
id: 'eth',
|
|
@@ -134,18 +134,18 @@ export const NETWORKS_REGISTRY = [
|
|
|
134
134
|
failoverRpcUrl: 'https://mantle.llamarpc.com',
|
|
135
135
|
blockTime: 2,
|
|
136
136
|
},
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
137
|
+
// {
|
|
138
|
+
// id: 'celo-mainnet',
|
|
139
|
+
// name: 'celo-mainnet',
|
|
140
|
+
// nameForDisplay: 'Celo Mainnet',
|
|
141
|
+
// chainId: 42220,
|
|
142
|
+
// rpcUrl: 'https://rpc.ankr.com/celo',
|
|
143
|
+
// explorerUrl: 'https://celoscan.io',
|
|
144
|
+
// iconUrl: 'https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg',
|
|
145
|
+
// symbol: 'CELO',
|
|
146
|
+
// failoverRpcUrl: 'https://celo.drpc.org',
|
|
147
|
+
// blockTime: 5,
|
|
148
|
+
// },
|
|
149
149
|
{
|
|
150
150
|
id: 'blast-mainnet',
|
|
151
151
|
name: 'blast-mainnet',
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { getBalance, getBalances } from './blockchain/getBalances';
|
|
|
16
16
|
export { estimateTransaction } from './blockchain/estimateTransaction';
|
|
17
17
|
export { prepareTransaction } from './blockchain/prepareTransaction';
|
|
18
18
|
export { fetchFeeSnapshot, type FetchFeeSnapshotOptions, type FeeSnapshotTxKind, } from './blockchain/fetchFeeSnapshot';
|
|
19
|
+
export { type GetTokenMetadataParams, type TokenMetadata, getTokenMetadata, } from './blockchain/getTokenMetadata';
|
|
20
|
+
export { isVerified } from './blockchain/isTokenVerified';
|
|
19
21
|
/** services exports */
|
|
20
22
|
export { EvmWalletService, EvmGeneratedWallet, EvmDerivedWallet, } from './services/evm-wallet-core/evmWalletService';
|
|
21
23
|
export { EntropySource } from './services/evm-wallet-core/entropy';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export { getBalance, getBalances } from './blockchain/getBalances';
|
|
|
16
16
|
export { estimateTransaction } from './blockchain/estimateTransaction';
|
|
17
17
|
export { prepareTransaction } from './blockchain/prepareTransaction';
|
|
18
18
|
export { fetchFeeSnapshot, } from './blockchain/fetchFeeSnapshot';
|
|
19
|
+
export { getTokenMetadata, } from './blockchain/getTokenMetadata';
|
|
20
|
+
export { isVerified } from './blockchain/isTokenVerified';
|
|
19
21
|
/** services exports */
|
|
20
22
|
export { EvmWalletService, } from './services/evm-wallet-core/evmWalletService';
|
|
21
23
|
export { createWallet, signMessage, signTransaction } from './services/evm-wallet-core/signer';
|