@talismn/balances 0.6.0 → 0.6.1
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/CHANGELOG.md +41 -0
- package/README.md +126 -0
- package/dist/declarations/src/BalanceModule.d.ts +4 -6
- package/dist/declarations/src/MiniMetadataUpdater.d.ts +44 -0
- package/dist/declarations/src/TalismanBalancesDatabase.d.ts +2 -1
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/declarations/src/modules/EvmErc20Module.d.ts +43 -0
- package/dist/declarations/src/modules/EvmNativeModule.d.ts +37 -0
- package/dist/declarations/src/modules/SubstrateAssetsModule.d.ts +51 -0
- package/dist/declarations/src/modules/SubstrateEquilibriumModule.d.ts +50 -0
- package/dist/declarations/src/modules/SubstrateNativeModule.d.ts +65 -0
- package/dist/declarations/src/modules/SubstratePsp22Module.d.ts +50 -0
- package/dist/declarations/src/modules/SubstrateTokensModule.d.ts +54 -0
- package/dist/declarations/src/modules/abis/erc20.d.ts +227 -0
- package/dist/declarations/src/modules/abis/multicall.d.ts +276 -0
- package/dist/declarations/src/modules/index.d.ts +10 -0
- package/dist/declarations/src/{helpers.d.ts → modules/util/index.d.ts} +33 -6
- package/dist/declarations/src/modules/util/substrate-native.d.ts +33 -0
- package/dist/declarations/src/types/balances.d.ts +3 -2
- package/dist/declarations/src/types/balancetypes.d.ts +3 -3
- package/dist/declarations/src/types/index.d.ts +1 -0
- package/dist/declarations/src/types/minimetadatas.d.ts +33 -0
- package/dist/talismn-balances.cjs.dev.js +4899 -332
- package/dist/talismn-balances.cjs.prod.js +4899 -332
- package/dist/talismn-balances.esm.js +4853 -334
- package/package.json +28 -14
@@ -0,0 +1,227 @@
|
|
1
|
+
export declare const erc20Abi: readonly [{
|
2
|
+
readonly constant: true;
|
3
|
+
readonly inputs: readonly [];
|
4
|
+
readonly name: "name";
|
5
|
+
readonly outputs: readonly [{
|
6
|
+
readonly name: "";
|
7
|
+
readonly type: "string";
|
8
|
+
}];
|
9
|
+
readonly payable: false;
|
10
|
+
readonly stateMutability: "view";
|
11
|
+
readonly type: "function";
|
12
|
+
}, {
|
13
|
+
readonly constant: false;
|
14
|
+
readonly inputs: readonly [{
|
15
|
+
readonly name: "_spender";
|
16
|
+
readonly type: "address";
|
17
|
+
}, {
|
18
|
+
readonly name: "_value";
|
19
|
+
readonly type: "uint256";
|
20
|
+
}];
|
21
|
+
readonly name: "approve";
|
22
|
+
readonly outputs: readonly [{
|
23
|
+
readonly name: "";
|
24
|
+
readonly type: "bool";
|
25
|
+
}];
|
26
|
+
readonly payable: false;
|
27
|
+
readonly stateMutability: "nonpayable";
|
28
|
+
readonly type: "function";
|
29
|
+
}, {
|
30
|
+
readonly constant: true;
|
31
|
+
readonly inputs: readonly [];
|
32
|
+
readonly name: "totalSupply";
|
33
|
+
readonly outputs: readonly [{
|
34
|
+
readonly name: "";
|
35
|
+
readonly type: "uint256";
|
36
|
+
}];
|
37
|
+
readonly payable: false;
|
38
|
+
readonly stateMutability: "view";
|
39
|
+
readonly type: "function";
|
40
|
+
}, {
|
41
|
+
readonly constant: false;
|
42
|
+
readonly inputs: readonly [{
|
43
|
+
readonly name: "_from";
|
44
|
+
readonly type: "address";
|
45
|
+
}, {
|
46
|
+
readonly name: "_to";
|
47
|
+
readonly type: "address";
|
48
|
+
}, {
|
49
|
+
readonly name: "_value";
|
50
|
+
readonly type: "uint256";
|
51
|
+
}];
|
52
|
+
readonly name: "transferFrom";
|
53
|
+
readonly outputs: readonly [{
|
54
|
+
readonly name: "";
|
55
|
+
readonly type: "bool";
|
56
|
+
}];
|
57
|
+
readonly payable: false;
|
58
|
+
readonly stateMutability: "nonpayable";
|
59
|
+
readonly type: "function";
|
60
|
+
}, {
|
61
|
+
readonly constant: true;
|
62
|
+
readonly inputs: readonly [];
|
63
|
+
readonly name: "decimals";
|
64
|
+
readonly outputs: readonly [{
|
65
|
+
readonly name: "";
|
66
|
+
readonly type: "uint8";
|
67
|
+
}];
|
68
|
+
readonly payable: false;
|
69
|
+
readonly stateMutability: "view";
|
70
|
+
readonly type: "function";
|
71
|
+
}, {
|
72
|
+
readonly constant: false;
|
73
|
+
readonly inputs: readonly [{
|
74
|
+
readonly name: "_to";
|
75
|
+
readonly type: "address";
|
76
|
+
}, {
|
77
|
+
readonly name: "_value";
|
78
|
+
readonly type: "uint256";
|
79
|
+
}, {
|
80
|
+
readonly name: "_data";
|
81
|
+
readonly type: "bytes";
|
82
|
+
}];
|
83
|
+
readonly name: "transferAndCall";
|
84
|
+
readonly outputs: readonly [{
|
85
|
+
readonly name: "success";
|
86
|
+
readonly type: "bool";
|
87
|
+
}];
|
88
|
+
readonly payable: false;
|
89
|
+
readonly stateMutability: "nonpayable";
|
90
|
+
readonly type: "function";
|
91
|
+
}, {
|
92
|
+
readonly constant: false;
|
93
|
+
readonly inputs: readonly [{
|
94
|
+
readonly name: "_spender";
|
95
|
+
readonly type: "address";
|
96
|
+
}, {
|
97
|
+
readonly name: "_subtractedValue";
|
98
|
+
readonly type: "uint256";
|
99
|
+
}];
|
100
|
+
readonly name: "decreaseApproval";
|
101
|
+
readonly outputs: readonly [{
|
102
|
+
readonly name: "success";
|
103
|
+
readonly type: "bool";
|
104
|
+
}];
|
105
|
+
readonly payable: false;
|
106
|
+
readonly stateMutability: "nonpayable";
|
107
|
+
readonly type: "function";
|
108
|
+
}, {
|
109
|
+
readonly constant: true;
|
110
|
+
readonly inputs: readonly [{
|
111
|
+
readonly name: "_owner";
|
112
|
+
readonly type: "address";
|
113
|
+
}];
|
114
|
+
readonly name: "balanceOf";
|
115
|
+
readonly outputs: readonly [{
|
116
|
+
readonly name: "balance";
|
117
|
+
readonly type: "uint256";
|
118
|
+
}];
|
119
|
+
readonly payable: false;
|
120
|
+
readonly stateMutability: "view";
|
121
|
+
readonly type: "function";
|
122
|
+
}, {
|
123
|
+
readonly constant: true;
|
124
|
+
readonly inputs: readonly [];
|
125
|
+
readonly name: "symbol";
|
126
|
+
readonly outputs: readonly [{
|
127
|
+
readonly name: "";
|
128
|
+
readonly type: "string";
|
129
|
+
}];
|
130
|
+
readonly payable: false;
|
131
|
+
readonly stateMutability: "view";
|
132
|
+
readonly type: "function";
|
133
|
+
}, {
|
134
|
+
readonly constant: false;
|
135
|
+
readonly inputs: readonly [{
|
136
|
+
readonly name: "_to";
|
137
|
+
readonly type: "address";
|
138
|
+
}, {
|
139
|
+
readonly name: "_value";
|
140
|
+
readonly type: "uint256";
|
141
|
+
}];
|
142
|
+
readonly name: "transfer";
|
143
|
+
readonly outputs: readonly [{
|
144
|
+
readonly name: "success";
|
145
|
+
readonly type: "bool";
|
146
|
+
}];
|
147
|
+
readonly payable: false;
|
148
|
+
readonly stateMutability: "nonpayable";
|
149
|
+
readonly type: "function";
|
150
|
+
}, {
|
151
|
+
readonly constant: false;
|
152
|
+
readonly inputs: readonly [{
|
153
|
+
readonly name: "_spender";
|
154
|
+
readonly type: "address";
|
155
|
+
}, {
|
156
|
+
readonly name: "_addedValue";
|
157
|
+
readonly type: "uint256";
|
158
|
+
}];
|
159
|
+
readonly name: "increaseApproval";
|
160
|
+
readonly outputs: readonly [{
|
161
|
+
readonly name: "success";
|
162
|
+
readonly type: "bool";
|
163
|
+
}];
|
164
|
+
readonly payable: false;
|
165
|
+
readonly stateMutability: "nonpayable";
|
166
|
+
readonly type: "function";
|
167
|
+
}, {
|
168
|
+
readonly constant: true;
|
169
|
+
readonly inputs: readonly [{
|
170
|
+
readonly name: "_owner";
|
171
|
+
readonly type: "address";
|
172
|
+
}, {
|
173
|
+
readonly name: "_spender";
|
174
|
+
readonly type: "address";
|
175
|
+
}];
|
176
|
+
readonly name: "allowance";
|
177
|
+
readonly outputs: readonly [{
|
178
|
+
readonly name: "remaining";
|
179
|
+
readonly type: "uint256";
|
180
|
+
}];
|
181
|
+
readonly payable: false;
|
182
|
+
readonly stateMutability: "view";
|
183
|
+
readonly type: "function";
|
184
|
+
}, {
|
185
|
+
readonly inputs: readonly [];
|
186
|
+
readonly payable: false;
|
187
|
+
readonly stateMutability: "nonpayable";
|
188
|
+
readonly type: "constructor";
|
189
|
+
}, {
|
190
|
+
readonly anonymous: false;
|
191
|
+
readonly inputs: readonly [{
|
192
|
+
readonly indexed: true;
|
193
|
+
readonly name: "from";
|
194
|
+
readonly type: "address";
|
195
|
+
}, {
|
196
|
+
readonly indexed: true;
|
197
|
+
readonly name: "to";
|
198
|
+
readonly type: "address";
|
199
|
+
}, {
|
200
|
+
readonly indexed: false;
|
201
|
+
readonly name: "value";
|
202
|
+
readonly type: "uint256";
|
203
|
+
}, {
|
204
|
+
readonly indexed: false;
|
205
|
+
readonly name: "data";
|
206
|
+
readonly type: "bytes";
|
207
|
+
}];
|
208
|
+
readonly name: "Transfer";
|
209
|
+
readonly type: "event";
|
210
|
+
}, {
|
211
|
+
readonly anonymous: false;
|
212
|
+
readonly inputs: readonly [{
|
213
|
+
readonly indexed: true;
|
214
|
+
readonly name: "owner";
|
215
|
+
readonly type: "address";
|
216
|
+
}, {
|
217
|
+
readonly indexed: true;
|
218
|
+
readonly name: "spender";
|
219
|
+
readonly type: "address";
|
220
|
+
}, {
|
221
|
+
readonly indexed: false;
|
222
|
+
readonly name: "value";
|
223
|
+
readonly type: "uint256";
|
224
|
+
}];
|
225
|
+
readonly name: "Approval";
|
226
|
+
readonly type: "event";
|
227
|
+
}];
|
@@ -0,0 +1,276 @@
|
|
1
|
+
export declare const abiMulticall: readonly [{
|
2
|
+
readonly name: "aggregate";
|
3
|
+
readonly type: "function";
|
4
|
+
readonly stateMutability: "payable";
|
5
|
+
readonly inputs: readonly [{
|
6
|
+
readonly type: "tuple[]";
|
7
|
+
readonly components: readonly [{
|
8
|
+
readonly type: "address";
|
9
|
+
readonly name: "target";
|
10
|
+
}, {
|
11
|
+
readonly type: "bytes";
|
12
|
+
readonly name: "callData";
|
13
|
+
}];
|
14
|
+
readonly name: "calls";
|
15
|
+
}];
|
16
|
+
readonly outputs: readonly [{
|
17
|
+
readonly type: "uint256";
|
18
|
+
readonly name: "blockNumber";
|
19
|
+
}, {
|
20
|
+
readonly type: "bytes[]";
|
21
|
+
readonly name: "returnData";
|
22
|
+
}];
|
23
|
+
}, {
|
24
|
+
readonly name: "aggregate3";
|
25
|
+
readonly type: "function";
|
26
|
+
readonly stateMutability: "payable";
|
27
|
+
readonly inputs: readonly [{
|
28
|
+
readonly type: "tuple[]";
|
29
|
+
readonly components: readonly [{
|
30
|
+
readonly type: "address";
|
31
|
+
readonly name: "target";
|
32
|
+
}, {
|
33
|
+
readonly type: "bool";
|
34
|
+
readonly name: "allowFailure";
|
35
|
+
}, {
|
36
|
+
readonly type: "bytes";
|
37
|
+
readonly name: "callData";
|
38
|
+
}];
|
39
|
+
readonly name: "calls";
|
40
|
+
}];
|
41
|
+
readonly outputs: readonly [{
|
42
|
+
readonly type: "tuple[]";
|
43
|
+
readonly components: readonly [{
|
44
|
+
readonly type: "bool";
|
45
|
+
readonly name: "success";
|
46
|
+
}, {
|
47
|
+
readonly type: "bytes";
|
48
|
+
readonly name: "returnData";
|
49
|
+
}];
|
50
|
+
readonly name: "returnData";
|
51
|
+
}];
|
52
|
+
}, {
|
53
|
+
readonly name: "aggregate3Value";
|
54
|
+
readonly type: "function";
|
55
|
+
readonly stateMutability: "payable";
|
56
|
+
readonly inputs: readonly [{
|
57
|
+
readonly type: "tuple[]";
|
58
|
+
readonly components: readonly [{
|
59
|
+
readonly type: "address";
|
60
|
+
readonly name: "target";
|
61
|
+
}, {
|
62
|
+
readonly type: "bool";
|
63
|
+
readonly name: "allowFailure";
|
64
|
+
}, {
|
65
|
+
readonly type: "uint256";
|
66
|
+
readonly name: "value";
|
67
|
+
}, {
|
68
|
+
readonly type: "bytes";
|
69
|
+
readonly name: "callData";
|
70
|
+
}];
|
71
|
+
readonly name: "calls";
|
72
|
+
}];
|
73
|
+
readonly outputs: readonly [{
|
74
|
+
readonly type: "tuple[]";
|
75
|
+
readonly components: readonly [{
|
76
|
+
readonly type: "bool";
|
77
|
+
readonly name: "success";
|
78
|
+
}, {
|
79
|
+
readonly type: "bytes";
|
80
|
+
readonly name: "returnData";
|
81
|
+
}];
|
82
|
+
readonly name: "returnData";
|
83
|
+
}];
|
84
|
+
}, {
|
85
|
+
readonly name: "blockAndAggregate";
|
86
|
+
readonly type: "function";
|
87
|
+
readonly stateMutability: "payable";
|
88
|
+
readonly inputs: readonly [{
|
89
|
+
readonly type: "tuple[]";
|
90
|
+
readonly components: readonly [{
|
91
|
+
readonly type: "address";
|
92
|
+
readonly name: "target";
|
93
|
+
}, {
|
94
|
+
readonly type: "bytes";
|
95
|
+
readonly name: "callData";
|
96
|
+
}];
|
97
|
+
readonly name: "calls";
|
98
|
+
}];
|
99
|
+
readonly outputs: readonly [{
|
100
|
+
readonly type: "uint256";
|
101
|
+
readonly name: "blockNumber";
|
102
|
+
}, {
|
103
|
+
readonly type: "bytes32";
|
104
|
+
readonly name: "blockHash";
|
105
|
+
}, {
|
106
|
+
readonly type: "tuple[]";
|
107
|
+
readonly components: readonly [{
|
108
|
+
readonly type: "bool";
|
109
|
+
readonly name: "success";
|
110
|
+
}, {
|
111
|
+
readonly type: "bytes";
|
112
|
+
readonly name: "returnData";
|
113
|
+
}];
|
114
|
+
readonly name: "returnData";
|
115
|
+
}];
|
116
|
+
}, {
|
117
|
+
readonly name: "getBasefee";
|
118
|
+
readonly type: "function";
|
119
|
+
readonly stateMutability: "view";
|
120
|
+
readonly inputs: readonly [];
|
121
|
+
readonly outputs: readonly [{
|
122
|
+
readonly type: "uint256";
|
123
|
+
readonly name: "basefee";
|
124
|
+
}];
|
125
|
+
}, {
|
126
|
+
readonly name: "getBlockHash";
|
127
|
+
readonly type: "function";
|
128
|
+
readonly stateMutability: "view";
|
129
|
+
readonly inputs: readonly [{
|
130
|
+
readonly type: "uint256";
|
131
|
+
readonly name: "blockNumber";
|
132
|
+
}];
|
133
|
+
readonly outputs: readonly [{
|
134
|
+
readonly type: "bytes32";
|
135
|
+
readonly name: "blockHash";
|
136
|
+
}];
|
137
|
+
}, {
|
138
|
+
readonly name: "getBlockNumber";
|
139
|
+
readonly type: "function";
|
140
|
+
readonly stateMutability: "view";
|
141
|
+
readonly inputs: readonly [];
|
142
|
+
readonly outputs: readonly [{
|
143
|
+
readonly type: "uint256";
|
144
|
+
readonly name: "blockNumber";
|
145
|
+
}];
|
146
|
+
}, {
|
147
|
+
readonly name: "getChainId";
|
148
|
+
readonly type: "function";
|
149
|
+
readonly stateMutability: "view";
|
150
|
+
readonly inputs: readonly [];
|
151
|
+
readonly outputs: readonly [{
|
152
|
+
readonly type: "uint256";
|
153
|
+
readonly name: "chainid";
|
154
|
+
}];
|
155
|
+
}, {
|
156
|
+
readonly name: "getCurrentBlockCoinbase";
|
157
|
+
readonly type: "function";
|
158
|
+
readonly stateMutability: "view";
|
159
|
+
readonly inputs: readonly [];
|
160
|
+
readonly outputs: readonly [{
|
161
|
+
readonly type: "address";
|
162
|
+
readonly name: "coinbase";
|
163
|
+
}];
|
164
|
+
}, {
|
165
|
+
readonly name: "getCurrentBlockDifficulty";
|
166
|
+
readonly type: "function";
|
167
|
+
readonly stateMutability: "view";
|
168
|
+
readonly inputs: readonly [];
|
169
|
+
readonly outputs: readonly [{
|
170
|
+
readonly type: "uint256";
|
171
|
+
readonly name: "difficulty";
|
172
|
+
}];
|
173
|
+
}, {
|
174
|
+
readonly name: "getCurrentBlockGasLimit";
|
175
|
+
readonly type: "function";
|
176
|
+
readonly stateMutability: "view";
|
177
|
+
readonly inputs: readonly [];
|
178
|
+
readonly outputs: readonly [{
|
179
|
+
readonly type: "uint256";
|
180
|
+
readonly name: "gaslimit";
|
181
|
+
}];
|
182
|
+
}, {
|
183
|
+
readonly name: "getCurrentBlockTimestamp";
|
184
|
+
readonly type: "function";
|
185
|
+
readonly stateMutability: "view";
|
186
|
+
readonly inputs: readonly [];
|
187
|
+
readonly outputs: readonly [{
|
188
|
+
readonly type: "uint256";
|
189
|
+
readonly name: "timestamp";
|
190
|
+
}];
|
191
|
+
}, {
|
192
|
+
readonly name: "getEthBalance";
|
193
|
+
readonly type: "function";
|
194
|
+
readonly stateMutability: "view";
|
195
|
+
readonly inputs: readonly [{
|
196
|
+
readonly type: "address";
|
197
|
+
readonly name: "addr";
|
198
|
+
}];
|
199
|
+
readonly outputs: readonly [{
|
200
|
+
readonly type: "uint256";
|
201
|
+
readonly name: "balance";
|
202
|
+
}];
|
203
|
+
}, {
|
204
|
+
readonly name: "getLastBlockHash";
|
205
|
+
readonly type: "function";
|
206
|
+
readonly stateMutability: "view";
|
207
|
+
readonly inputs: readonly [];
|
208
|
+
readonly outputs: readonly [{
|
209
|
+
readonly type: "bytes32";
|
210
|
+
readonly name: "blockHash";
|
211
|
+
}];
|
212
|
+
}, {
|
213
|
+
readonly name: "tryAggregate";
|
214
|
+
readonly type: "function";
|
215
|
+
readonly stateMutability: "payable";
|
216
|
+
readonly inputs: readonly [{
|
217
|
+
readonly type: "bool";
|
218
|
+
readonly name: "requireSuccess";
|
219
|
+
}, {
|
220
|
+
readonly type: "tuple[]";
|
221
|
+
readonly components: readonly [{
|
222
|
+
readonly type: "address";
|
223
|
+
readonly name: "target";
|
224
|
+
}, {
|
225
|
+
readonly type: "bytes";
|
226
|
+
readonly name: "callData";
|
227
|
+
}];
|
228
|
+
readonly name: "calls";
|
229
|
+
}];
|
230
|
+
readonly outputs: readonly [{
|
231
|
+
readonly type: "tuple[]";
|
232
|
+
readonly components: readonly [{
|
233
|
+
readonly type: "bool";
|
234
|
+
readonly name: "success";
|
235
|
+
}, {
|
236
|
+
readonly type: "bytes";
|
237
|
+
readonly name: "returnData";
|
238
|
+
}];
|
239
|
+
readonly name: "returnData";
|
240
|
+
}];
|
241
|
+
}, {
|
242
|
+
readonly name: "tryBlockAndAggregate";
|
243
|
+
readonly type: "function";
|
244
|
+
readonly stateMutability: "payable";
|
245
|
+
readonly inputs: readonly [{
|
246
|
+
readonly type: "bool";
|
247
|
+
readonly name: "requireSuccess";
|
248
|
+
}, {
|
249
|
+
readonly type: "tuple[]";
|
250
|
+
readonly components: readonly [{
|
251
|
+
readonly type: "address";
|
252
|
+
readonly name: "target";
|
253
|
+
}, {
|
254
|
+
readonly type: "bytes";
|
255
|
+
readonly name: "callData";
|
256
|
+
}];
|
257
|
+
readonly name: "calls";
|
258
|
+
}];
|
259
|
+
readonly outputs: readonly [{
|
260
|
+
readonly type: "uint256";
|
261
|
+
readonly name: "blockNumber";
|
262
|
+
}, {
|
263
|
+
readonly type: "bytes32";
|
264
|
+
readonly name: "blockHash";
|
265
|
+
}, {
|
266
|
+
readonly type: "tuple[]";
|
267
|
+
readonly components: readonly [{
|
268
|
+
readonly type: "bool";
|
269
|
+
readonly name: "success";
|
270
|
+
}, {
|
271
|
+
readonly type: "bytes";
|
272
|
+
readonly name: "returnData";
|
273
|
+
}];
|
274
|
+
readonly name: "returnData";
|
275
|
+
}];
|
276
|
+
}];
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-erc20", import("./EvmErc20Module").EvmErc20Token | import("./EvmErc20Module").CustomEvmErc20Token, import("./EvmErc20Module").EvmErc20ChainMeta, import("./EvmErc20Module").EvmErc20ModuleConfig> | import("..").NewBalanceModule<"evm-native", import("./EvmNativeModule").EvmNativeToken | import("./EvmNativeModule").CustomEvmNativeToken, import("./EvmNativeModule").EvmNativeChainMeta, import("./EvmNativeModule").EvmNativeModuleConfig> | import("..").NewBalanceModule<"substrate-assets", import("./SubstrateAssetsModule").SubAssetsToken, import("./SubstrateAssetsModule").SubAssetsChainMeta, import("./SubstrateAssetsModule").SubAssetsModuleConfig, import("./SubstrateAssetsModule").SubAssetsTransferParams> | import("..").NewBalanceModule<"substrate-equilibrium", import("./SubstrateEquilibriumModule").SubEquilibriumToken, import("./SubstrateEquilibriumModule").SubEquilibriumChainMeta, import("./SubstrateEquilibriumModule").SubEquilibriumModuleConfig, import("./SubstrateEquilibriumModule").SubEquilibriumTransferParams> | import("..").NewBalanceModule<"substrate-native", import("./SubstrateNativeModule").SubNativeToken | import("./SubstrateNativeModule").CustomSubNativeToken, import("./SubstrateNativeModule").SubNativeChainMeta, import("./SubstrateNativeModule").SubNativeModuleConfig, import("./SubstrateNativeModule").SubNativeTransferParams> | import("..").NewBalanceModule<"substrate-psp22", import("./SubstratePsp22Module").SubPsp22Token, import("./SubstratePsp22Module").SubPsp22ChainMeta, import("./SubstratePsp22Module").SubPsp22ModuleConfig, import("./SubstratePsp22Module").SubPsp22TransferParams> | import("..").NewBalanceModule<"substrate-tokens", import("./SubstrateTokensModule").SubTokensToken, import("./SubstrateTokensModule").SubTokensChainMeta, import("./SubstrateTokensModule").SubTokensModuleConfig, import("./SubstrateTokensModule").SubTokensTransferParams>)[];
|
2
|
+
export * from "./EvmErc20Module";
|
3
|
+
export * from "./EvmNativeModule";
|
4
|
+
export * from "./SubstrateAssetsModule";
|
5
|
+
export * from "./SubstrateEquilibriumModule";
|
6
|
+
export * from "./SubstrateNativeModule";
|
7
|
+
export * from "./SubstratePsp22Module";
|
8
|
+
export * from "./SubstrateTokensModule";
|
9
|
+
export * from "./util";
|
10
|
+
export * from "./util/substrate-native";
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import type { Registry } from "@polkadot/types-codec/types";
|
2
2
|
import { ChainConnector } from "@talismn/chain-connector";
|
3
|
-
import { Chain, ChainId } from "@talismn/chaindata-provider";
|
4
|
-
import
|
5
|
-
import {
|
3
|
+
import { Chain, ChainId, ChainList, TokenList } from "@talismn/chaindata-provider";
|
4
|
+
import * as $ from "@talismn/subshape-fork";
|
5
|
+
import { BalanceModule, DefaultChainMeta, DefaultModuleConfig, DefaultTransferParams, ExtendableChainMeta, ExtendableModuleConfig, ExtendableTokenType, ExtendableTransferParams, NewBalanceModule } from "../../BalanceModule";
|
6
|
+
import { AddressesByToken, BalanceJson, Balances, MiniMetadata, SubscriptionCallback, UnsubscribeFn } from "../../types";
|
6
7
|
/**
|
7
8
|
* Wraps a BalanceModule's fetch/subscribe methods with a single `balances` method.
|
8
9
|
* This `balances` method will subscribe if a callback parameter is provided, or otherwise fetch.
|
@@ -43,15 +44,17 @@ export type InferTransferParams<T extends AnyNewBalanceModule> = InferBalanceMod
|
|
43
44
|
* Given a `moduleType` and a `chain` from a chaindataProvider, this function will find the chainMeta
|
44
45
|
* associated with the given balanceModule for the given chain.
|
45
46
|
*/
|
46
|
-
export declare const findChainMeta: <TBalanceModule extends AnyNewBalanceModule>(moduleType: InferModuleType<TBalanceModule>, chain?: Chain) => InferChainMeta<TBalanceModule> | undefined;
|
47
|
-
export declare const filterMirrorTokens: (balance: Balance, i: number, balances: Balance[]) => boolean;
|
47
|
+
export declare const findChainMeta: <TBalanceModule extends AnyNewBalanceModule>(miniMetadatas: Map<string, MiniMetadata>, moduleType: InferModuleType<TBalanceModule>, chain?: Chain) => [InferChainMeta<TBalanceModule> | undefined, MiniMetadata | undefined];
|
48
48
|
export declare const getValidSubscriptionIds: () => Set<string>;
|
49
49
|
export declare const createSubscriptionId: () => string;
|
50
50
|
export declare const deleteSubscriptionId: () => void;
|
51
51
|
/**
|
52
52
|
* Sets all balance statuses from `live-${string}` to either `live` or `cached`
|
53
|
+
*
|
54
|
+
* You should make sure that the input collection `balances` is mutable, because the statuses
|
55
|
+
* will be changed in-place as a performance consideration.
|
53
56
|
*/
|
54
|
-
export declare const deriveStatuses: (validSubscriptionIds: string
|
57
|
+
export declare const deriveStatuses: (validSubscriptionIds: Set<string>, balances: BalanceJson[]) => BalanceJson[];
|
55
58
|
/**
|
56
59
|
* Used by a variety of balance modules to help encode and decode substrate state calls.
|
57
60
|
*/
|
@@ -83,4 +86,28 @@ export declare class RpcStateQueryHelper<T> {
|
|
83
86
|
subscribe(callback: SubscriptionCallback<T[]>, timeout?: number | false, subscribeMethod?: string, responseMethod?: string, unsubscribeMethod?: string): Promise<UnsubscribeFn>;
|
84
87
|
fetch(method?: string): Promise<T[]>;
|
85
88
|
}
|
89
|
+
export declare const subshapeStorageDecoder: (miniMetadata: MiniMetadata, module: string, method: string) => $.AnyShape | undefined;
|
90
|
+
export declare const getUniqueChainIds: (addressesByToken: AddressesByToken<{
|
91
|
+
id: string;
|
92
|
+
}>, tokens: TokenList) => ChainId[];
|
93
|
+
export declare const buildStorageDecoders: <TBalanceModule extends AnyNewBalanceModule, TDecoders extends {
|
94
|
+
[key: string]: [string, string];
|
95
|
+
}>({ chainIds, chains, miniMetadatas, moduleType, decoders, }: {
|
96
|
+
chainIds: ChainId[];
|
97
|
+
chains: ChainList;
|
98
|
+
miniMetadatas: Map<string, MiniMetadata>;
|
99
|
+
moduleType: InferModuleType<TBalanceModule>;
|
100
|
+
decoders: TDecoders;
|
101
|
+
}) => Map<string, { [Property in keyof TDecoders]: $.AnyShape | undefined; }>;
|
102
|
+
/**
|
103
|
+
*
|
104
|
+
* Detect Balances::transfer -> Balances::transfer_allow_death migration
|
105
|
+
* https://github.com/paritytech/substrate/pull/12951
|
106
|
+
*
|
107
|
+
* `transfer_allow_death` is the preferred method,
|
108
|
+
* so if something goes wrong during detection, we should assume the chain has migrated
|
109
|
+
* @param metadataRpc string containing the hashed RPC metadata for the chain
|
110
|
+
* @returns
|
111
|
+
*/
|
112
|
+
export declare const detectTransferMethod: (metadataRpc: `0x${string}`) => "transfer" | "transferAllowDeath";
|
86
113
|
export {};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import type { Registry } from "@polkadot/types-codec/types";
|
2
|
+
import { Observable } from "rxjs";
|
3
|
+
import { Balance, BalanceFormatter, LockedAmount, SubscriptionCallback, UnsubscribeFn } from "../../types";
|
4
|
+
/**
|
5
|
+
* Converts a subscription function into an Observable
|
6
|
+
*
|
7
|
+
* The type of a subscription function which can be converted into an observable:
|
8
|
+
*
|
9
|
+
* <TArgs, TResult>(...arguments: TArgs, callback: SubscriptionCallback<TResult>) => UnsubscribeFn
|
10
|
+
*/
|
11
|
+
export declare const asObservable: <T extends unknown[], R>(handler: (...args: [...T, SubscriptionCallback<R>]) => UnsubscribeFn) => (...args: T) => Observable<R>;
|
12
|
+
/** The stash account for the nomination pool */
|
13
|
+
export declare const nompoolStashAccountId: (registry: Registry, palletId: string, poolId: string) => string;
|
14
|
+
/** The rewards account for the nomination pool */
|
15
|
+
export declare const nompoolRewardAccountId: (registry: Registry, palletId: string, poolId: string) => string;
|
16
|
+
/**
|
17
|
+
* Crowdloan contributions are stored in the `childstate` key returned by this function.
|
18
|
+
*/
|
19
|
+
export declare const crowdloanFundContributionsChildKey: (registry: Registry, fundIndex: number) => `0x${string}`;
|
20
|
+
export type BalanceLockType = "reserved" | "democracy" | "crowdloan" | "staking" | "nompools-staking" | "nompools-unbonding" | "vesting" | "dapp-staking" | "other";
|
21
|
+
/**
|
22
|
+
* For converting the value of `lock?.id?.toUtf8?.()` which is retrieved from
|
23
|
+
* the Balances.Locks storage key into a useful classification for our UI
|
24
|
+
*/
|
25
|
+
export declare const getLockedType: (input?: string) => BalanceLockType;
|
26
|
+
export declare const filterBaseLocks: (locks: Array<Omit<LockedAmount<string>, "amount"> & {
|
27
|
+
amount: BalanceFormatter;
|
28
|
+
}>) => (Omit<LockedAmount<string>, "amount"> & {
|
29
|
+
amount: BalanceFormatter;
|
30
|
+
})[];
|
31
|
+
export declare const getLockTitle: (lock: Pick<LockedAmount<string>, "label" | "meta">, { balance }?: {
|
32
|
+
balance?: Balance | undefined;
|
33
|
+
}) => string;
|
@@ -126,7 +126,7 @@ export declare class Balance {
|
|
126
126
|
isSource: (source: BalanceSource) => boolean;
|
127
127
|
hydrate: (hydrate?: HydrateDb) => void;
|
128
128
|
get id(): string;
|
129
|
-
get source():
|
129
|
+
get source(): "evm-erc20" | "evm-native" | "substrate-assets" | "substrate-equilibrium" | "substrate-native" | "substrate-psp22" | "substrate-tokens";
|
130
130
|
get status(): import("./balancetypes").BalanceStatus;
|
131
131
|
get address(): string;
|
132
132
|
get chainId(): string | undefined;
|
@@ -134,7 +134,7 @@ export declare class Balance {
|
|
134
134
|
get evmNetworkId(): string | undefined;
|
135
135
|
get evmNetwork(): import("@talismn/chaindata-provider").EvmNetwork | null;
|
136
136
|
get tokenId(): string;
|
137
|
-
get token(): import("
|
137
|
+
get token(): import("..").EvmErc20Token | import("..").EvmNativeToken | import("..").SubAssetsToken | import("..").SubEquilibriumToken | import("..").SubNativeToken | import("..").SubPsp22Token | import("..").SubTokensToken | null;
|
138
138
|
get decimals(): number | null;
|
139
139
|
get rates(): TokenRates | null;
|
140
140
|
/**
|
@@ -222,3 +222,4 @@ export declare class SumBalancesFormatter {
|
|
222
222
|
get planck(): PlanckSumBalancesFormatter;
|
223
223
|
fiat(currency: TokenRateCurrency): FiatSumBalancesFormatter;
|
224
224
|
}
|
225
|
+
export declare const filterMirrorTokens: (balance: Balance, i: number, balances: Balance[]) => boolean;
|
@@ -14,9 +14,9 @@ export type BalanceTypes = {
|
|
14
14
|
*
|
15
15
|
* Each variant comes from a plugin in use by the consuming app.
|
16
16
|
*
|
17
|
-
* For example, in an app with the `substrate-native`, `evm-native`, `substrate-
|
17
|
+
* For example, in an app with the `substrate-native`, `evm-native`, `substrate-tokens` and `evm-erc20` plugins:
|
18
18
|
*
|
19
|
-
* type BalanceJson = SubNativeBalance | EvmNativeBalance |
|
19
|
+
* type BalanceJson = SubNativeBalance | EvmNativeBalance | SubTokensBalance | EvmErc20Balance
|
20
20
|
*
|
21
21
|
* If `BalanceTypes` is empty then `BalanceJson` will fall back to the common `IBalance` interface, which every balance must implement.
|
22
22
|
*/
|
@@ -25,7 +25,7 @@ export type BalanceJson = BalanceTypes[keyof BalanceTypes] extends never ? IBala
|
|
25
25
|
export type BalanceJsonList = Record<string, BalanceJson>;
|
26
26
|
export type BalanceStatusLive = `live-${string}`;
|
27
27
|
export declare const BalanceStatusLive: (subscriptionId: string) => BalanceStatusLive;
|
28
|
-
export type BalanceStatus = BalanceStatusLive | "live" | "cache" | "stale";
|
28
|
+
export type BalanceStatus = BalanceStatusLive | "live" | "cache" | "stale" | "initializing";
|
29
29
|
/** `IBalance` is a common interface which all balance types must implement. */
|
30
30
|
export type IBalance = {
|
31
31
|
/** The module that this balance was retrieved by */
|