@galacticcouncil/sdk-next 0.0.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/README.md +223 -0
- package/build/index.cjs +1 -0
- package/build/index.mjs +1 -0
- package/build/types/api/Papi.d.ts +385 -0
- package/build/types/api/client.d.ts +2 -0
- package/build/types/api/index.d.ts +2 -0
- package/build/types/client/AssetClient.d.ts +24 -0
- package/build/types/client/BalanceClient.d.ts +17 -0
- package/build/types/client/index.d.ts +2 -0
- package/build/types/consts.d.ts +8 -0
- package/build/types/errors.d.ts +10 -0
- package/build/types/index.d.ts +8 -0
- package/build/types/pool/PoolClient.d.ts +25 -0
- package/build/types/pool/PoolContextProvider.d.ts +30 -0
- package/build/types/pool/PoolFactory.d.ts +4 -0
- package/build/types/pool/aave/AaveAbi.d.ts +126 -0
- package/build/types/pool/aave/AavePool.d.ts +24 -0
- package/build/types/pool/aave/AavePoolClient.d.ts +14 -0
- package/build/types/pool/aave/index.d.ts +2 -0
- package/build/types/pool/index.d.ts +8 -0
- package/build/types/pool/lbp/LbpMath.d.ts +7 -0
- package/build/types/pool/lbp/LbpPool.d.ts +49 -0
- package/build/types/pool/lbp/LbpPoolClient.d.ts +18 -0
- package/build/types/pool/lbp/index.d.ts +3 -0
- package/build/types/pool/omni/OmniMath.d.ts +19 -0
- package/build/types/pool/omni/OmniPool.d.ts +45 -0
- package/build/types/pool/omni/OmniPoolClient.d.ts +13 -0
- package/build/types/pool/omni/index.d.ts +3 -0
- package/build/types/pool/stable/StableMath.d.ts +14 -0
- package/build/types/pool/stable/StableSwap.d.ts +46 -0
- package/build/types/pool/stable/StableSwapClient.d.ts +16 -0
- package/build/types/pool/stable/index.d.ts +3 -0
- package/build/types/pool/types.d.ts +84 -0
- package/build/types/pool/xyk/XykMath.d.ts +12 -0
- package/build/types/pool/xyk/XykPool.d.ts +23 -0
- package/build/types/pool/xyk/XykPoolClient.d.ts +12 -0
- package/build/types/pool/xyk/index.d.ts +3 -0
- package/build/types/sor/Router.d.ts +66 -0
- package/build/types/sor/TradeRouter.d.ts +155 -0
- package/build/types/sor/TradeUtils.d.ts +12 -0
- package/build/types/sor/index.d.ts +4 -0
- package/build/types/sor/route/bfs.d.ts +37 -0
- package/build/types/sor/route/graph.d.ts +12 -0
- package/build/types/sor/route/index.d.ts +3 -0
- package/build/types/sor/route/suggester.d.ts +24 -0
- package/build/types/sor/types.d.ts +31 -0
- package/build/types/types.d.ts +40 -0
- package/build/types/utils/Queue.d.ts +13 -0
- package/build/types/utils/Stack.d.ts +15 -0
- package/build/types/utils/big.d.ts +3 -0
- package/build/types/utils/erc20.d.ts +5 -0
- package/build/types/utils/evm.d.ts +3 -0
- package/build/types/utils/format.d.ts +4 -0
- package/build/types/utils/index.d.ts +7 -0
- package/build/types/utils/json.d.ts +3 -0
- package/build/types/utils/math.d.ts +62 -0
- package/build/types/utils/traversal/bfs.d.ts +27 -0
- package/build/types/utils/xc.d.ts +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
export declare abstract class Papi {
|
|
3
|
+
readonly client: PolkadotClient;
|
|
4
|
+
constructor(client: PolkadotClient);
|
|
5
|
+
get api(): import("polkadot-api").TypedApi<{
|
|
6
|
+
descriptors: {
|
|
7
|
+
pallets: {
|
|
8
|
+
__storage: {
|
|
9
|
+
System: {
|
|
10
|
+
Account: import("polkadot-api").StorageDescriptor<[Key: import("polkadot-api").SS58String], {
|
|
11
|
+
nonce: number;
|
|
12
|
+
consumers: number;
|
|
13
|
+
providers: number;
|
|
14
|
+
sufficients: number;
|
|
15
|
+
data: {
|
|
16
|
+
free: bigint;
|
|
17
|
+
reserved: bigint;
|
|
18
|
+
frozen: bigint;
|
|
19
|
+
flags: bigint;
|
|
20
|
+
};
|
|
21
|
+
}, false, never>;
|
|
22
|
+
Number: import("polkadot-api").StorageDescriptor<[], number, false, never>;
|
|
23
|
+
};
|
|
24
|
+
AssetRegistry: {
|
|
25
|
+
Assets: import("polkadot-api").StorageDescriptor<[Key: number], {
|
|
26
|
+
symbol: import("polkadot-api").Binary | undefined;
|
|
27
|
+
decimals: number | undefined;
|
|
28
|
+
name: import("polkadot-api").Binary | undefined;
|
|
29
|
+
asset_type: import("polkadot-api").Enum<{
|
|
30
|
+
Token: undefined;
|
|
31
|
+
XYK: undefined;
|
|
32
|
+
StableSwap: undefined;
|
|
33
|
+
Bond: undefined;
|
|
34
|
+
External: undefined;
|
|
35
|
+
Erc20: undefined;
|
|
36
|
+
}>;
|
|
37
|
+
existential_deposit: bigint;
|
|
38
|
+
xcm_rate_limit: bigint | undefined;
|
|
39
|
+
is_sufficient: boolean;
|
|
40
|
+
}, true, never>;
|
|
41
|
+
AssetLocations: import("polkadot-api").StorageDescriptor<[Key: number], {
|
|
42
|
+
parents: number;
|
|
43
|
+
interior: import("@galacticcouncil/descriptors").XcmV3Junctions;
|
|
44
|
+
}, true, never>;
|
|
45
|
+
};
|
|
46
|
+
Omnipool: {
|
|
47
|
+
Assets: import("polkadot-api").StorageDescriptor<[Key: number], {
|
|
48
|
+
shares: bigint;
|
|
49
|
+
hub_reserve: bigint;
|
|
50
|
+
protocol_shares: bigint;
|
|
51
|
+
cap: bigint;
|
|
52
|
+
tradable: number;
|
|
53
|
+
}, true, never>;
|
|
54
|
+
HubAssetTradability: import("polkadot-api").StorageDescriptor<[], number, false, never>;
|
|
55
|
+
};
|
|
56
|
+
DynamicFees: {
|
|
57
|
+
AssetFee: import("polkadot-api").StorageDescriptor<[Key: number], {
|
|
58
|
+
asset_fee: number;
|
|
59
|
+
protocol_fee: number;
|
|
60
|
+
timestamp: number;
|
|
61
|
+
}, true, never>;
|
|
62
|
+
};
|
|
63
|
+
Stableswap: {
|
|
64
|
+
Pools: import("polkadot-api").StorageDescriptor<[Key: number], {
|
|
65
|
+
assets: number[];
|
|
66
|
+
initial_amplification: number;
|
|
67
|
+
final_amplification: number;
|
|
68
|
+
initial_block: number;
|
|
69
|
+
final_block: number;
|
|
70
|
+
fee: number;
|
|
71
|
+
}, true, never>;
|
|
72
|
+
AssetTradability: import("polkadot-api").StorageDescriptor<import("polkadot-api").FixedSizeArray<2, number>, number, false, never>;
|
|
73
|
+
};
|
|
74
|
+
Bonds: {
|
|
75
|
+
Bonds: import("polkadot-api").StorageDescriptor<[Key: number], [number, bigint], true, never>;
|
|
76
|
+
};
|
|
77
|
+
LBP: {
|
|
78
|
+
PoolData: import("polkadot-api").StorageDescriptor<[Key: import("polkadot-api").SS58String], {
|
|
79
|
+
assets: import("polkadot-api").FixedSizeArray<2, number>;
|
|
80
|
+
fee: import("polkadot-api").FixedSizeArray<2, number>;
|
|
81
|
+
owner: import("polkadot-api").SS58String;
|
|
82
|
+
start: number | undefined;
|
|
83
|
+
end: number | undefined;
|
|
84
|
+
initial_weight: number;
|
|
85
|
+
final_weight: number;
|
|
86
|
+
weight_curve: {
|
|
87
|
+
type: "Linear";
|
|
88
|
+
value: undefined;
|
|
89
|
+
};
|
|
90
|
+
fee_collector: import("polkadot-api").SS58String;
|
|
91
|
+
repay_target: bigint;
|
|
92
|
+
}, true, never>;
|
|
93
|
+
};
|
|
94
|
+
XYK: {
|
|
95
|
+
PoolAssets: import("polkadot-api").StorageDescriptor<[Key: import("polkadot-api").SS58String], import("polkadot-api").FixedSizeArray<2, number>, true, never>;
|
|
96
|
+
};
|
|
97
|
+
Tokens: {
|
|
98
|
+
TotalIssuance: import("polkadot-api").StorageDescriptor<[Key: number], bigint, false, never>;
|
|
99
|
+
Accounts: import("polkadot-api").StorageDescriptor<[import("polkadot-api").SS58String, number], {
|
|
100
|
+
free: bigint;
|
|
101
|
+
frozen: bigint;
|
|
102
|
+
reserved: bigint;
|
|
103
|
+
}, false, never>;
|
|
104
|
+
};
|
|
105
|
+
ParachainSystem: {
|
|
106
|
+
ValidationData: import("polkadot-api").StorageDescriptor<[], {
|
|
107
|
+
parent_head: import("polkadot-api").Binary;
|
|
108
|
+
relay_parent_number: number;
|
|
109
|
+
relay_parent_storage_root: import("polkadot-api").FixedSizeBinary<32>;
|
|
110
|
+
max_pov_size: number;
|
|
111
|
+
}, true, never>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
__tx: {
|
|
115
|
+
Omnipool: {
|
|
116
|
+
sell: import("polkadot-api").TxDescriptor<{
|
|
117
|
+
amount: bigint;
|
|
118
|
+
asset_in: number;
|
|
119
|
+
asset_out: number;
|
|
120
|
+
min_buy_amount: bigint;
|
|
121
|
+
}>;
|
|
122
|
+
buy: import("polkadot-api").TxDescriptor<{
|
|
123
|
+
amount: bigint;
|
|
124
|
+
asset_in: number;
|
|
125
|
+
asset_out: number;
|
|
126
|
+
max_sell_amount: bigint;
|
|
127
|
+
}>;
|
|
128
|
+
};
|
|
129
|
+
Router: {
|
|
130
|
+
sell: import("polkadot-api").TxDescriptor<{
|
|
131
|
+
asset_in: number;
|
|
132
|
+
asset_out: number;
|
|
133
|
+
amount_in: bigint;
|
|
134
|
+
route: {
|
|
135
|
+
pool: import("polkadot-api").Enum<{
|
|
136
|
+
"XYK": undefined;
|
|
137
|
+
"LBP": undefined;
|
|
138
|
+
"Stableswap": number;
|
|
139
|
+
"Omnipool": undefined;
|
|
140
|
+
"Aave": undefined;
|
|
141
|
+
}>;
|
|
142
|
+
asset_in: number;
|
|
143
|
+
asset_out: number;
|
|
144
|
+
}[];
|
|
145
|
+
min_amount_out: bigint;
|
|
146
|
+
}>;
|
|
147
|
+
buy: import("polkadot-api").TxDescriptor<{
|
|
148
|
+
asset_in: number;
|
|
149
|
+
asset_out: number;
|
|
150
|
+
amount_out: bigint;
|
|
151
|
+
max_amount_in: bigint;
|
|
152
|
+
route: {
|
|
153
|
+
pool: import("polkadot-api").Enum<{
|
|
154
|
+
"XYK": undefined;
|
|
155
|
+
"LBP": undefined;
|
|
156
|
+
"Stableswap": number;
|
|
157
|
+
"Omnipool": undefined;
|
|
158
|
+
"Aave": undefined;
|
|
159
|
+
}>;
|
|
160
|
+
asset_in: number;
|
|
161
|
+
asset_out: number;
|
|
162
|
+
}[];
|
|
163
|
+
}>;
|
|
164
|
+
sell_all: import("polkadot-api").TxDescriptor<{
|
|
165
|
+
asset_in: number;
|
|
166
|
+
asset_out: number;
|
|
167
|
+
route: {
|
|
168
|
+
pool: import("polkadot-api").Enum<{
|
|
169
|
+
"XYK": undefined;
|
|
170
|
+
"LBP": undefined;
|
|
171
|
+
"Stableswap": number;
|
|
172
|
+
"Omnipool": undefined;
|
|
173
|
+
"Aave": undefined;
|
|
174
|
+
}>;
|
|
175
|
+
asset_in: number;
|
|
176
|
+
asset_out: number;
|
|
177
|
+
}[];
|
|
178
|
+
min_amount_out: bigint;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
__event: {
|
|
183
|
+
Router: {
|
|
184
|
+
Executed: import("polkadot-api").PlainDescriptor<{
|
|
185
|
+
asset_in: number;
|
|
186
|
+
asset_out: number;
|
|
187
|
+
amount_in: bigint;
|
|
188
|
+
amount_out: bigint;
|
|
189
|
+
event_id: number;
|
|
190
|
+
}>;
|
|
191
|
+
};
|
|
192
|
+
EVM: {
|
|
193
|
+
Log: import("polkadot-api").PlainDescriptor<{
|
|
194
|
+
log: {
|
|
195
|
+
address: import("polkadot-api").FixedSizeBinary<20>;
|
|
196
|
+
topics: import("polkadot-api").FixedSizeBinary<32>[];
|
|
197
|
+
data: import("polkadot-api").Binary;
|
|
198
|
+
};
|
|
199
|
+
}>;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
__error: {};
|
|
203
|
+
__const: {
|
|
204
|
+
System: {
|
|
205
|
+
BlockWeights: import("polkadot-api").PlainDescriptor<{
|
|
206
|
+
base_block: {
|
|
207
|
+
ref_time: bigint;
|
|
208
|
+
proof_size: bigint;
|
|
209
|
+
};
|
|
210
|
+
max_block: {
|
|
211
|
+
ref_time: bigint;
|
|
212
|
+
proof_size: bigint;
|
|
213
|
+
};
|
|
214
|
+
per_class: {
|
|
215
|
+
normal: {
|
|
216
|
+
"base_extrinsic": {
|
|
217
|
+
ref_time: bigint;
|
|
218
|
+
proof_size: bigint;
|
|
219
|
+
};
|
|
220
|
+
"max_extrinsic"?: ({
|
|
221
|
+
ref_time: bigint;
|
|
222
|
+
proof_size: bigint;
|
|
223
|
+
}) | undefined;
|
|
224
|
+
"max_total"?: ({
|
|
225
|
+
ref_time: bigint;
|
|
226
|
+
proof_size: bigint;
|
|
227
|
+
}) | undefined;
|
|
228
|
+
"reserved"?: ({
|
|
229
|
+
ref_time: bigint;
|
|
230
|
+
proof_size: bigint;
|
|
231
|
+
}) | undefined;
|
|
232
|
+
};
|
|
233
|
+
operational: {
|
|
234
|
+
"base_extrinsic": {
|
|
235
|
+
ref_time: bigint;
|
|
236
|
+
proof_size: bigint;
|
|
237
|
+
};
|
|
238
|
+
"max_extrinsic"?: ({
|
|
239
|
+
ref_time: bigint;
|
|
240
|
+
proof_size: bigint;
|
|
241
|
+
}) | undefined;
|
|
242
|
+
"max_total"?: ({
|
|
243
|
+
ref_time: bigint;
|
|
244
|
+
proof_size: bigint;
|
|
245
|
+
}) | undefined;
|
|
246
|
+
"reserved"?: ({
|
|
247
|
+
ref_time: bigint;
|
|
248
|
+
proof_size: bigint;
|
|
249
|
+
}) | undefined;
|
|
250
|
+
};
|
|
251
|
+
mandatory: {
|
|
252
|
+
"base_extrinsic": {
|
|
253
|
+
ref_time: bigint;
|
|
254
|
+
proof_size: bigint;
|
|
255
|
+
};
|
|
256
|
+
"max_extrinsic"?: ({
|
|
257
|
+
ref_time: bigint;
|
|
258
|
+
proof_size: bigint;
|
|
259
|
+
}) | undefined;
|
|
260
|
+
"max_total"?: ({
|
|
261
|
+
ref_time: bigint;
|
|
262
|
+
proof_size: bigint;
|
|
263
|
+
}) | undefined;
|
|
264
|
+
"reserved"?: ({
|
|
265
|
+
ref_time: bigint;
|
|
266
|
+
proof_size: bigint;
|
|
267
|
+
}) | undefined;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
}>;
|
|
271
|
+
BlockLength: import("polkadot-api").PlainDescriptor<{
|
|
272
|
+
normal: number;
|
|
273
|
+
operational: number;
|
|
274
|
+
mandatory: number;
|
|
275
|
+
}>;
|
|
276
|
+
BlockHashCount: import("polkadot-api").PlainDescriptor<number>;
|
|
277
|
+
DbWeight: import("polkadot-api").PlainDescriptor<{
|
|
278
|
+
read: bigint;
|
|
279
|
+
write: bigint;
|
|
280
|
+
}>;
|
|
281
|
+
Version: import("polkadot-api").PlainDescriptor<{
|
|
282
|
+
apis: [import("polkadot-api").FixedSizeBinary<8>, number][];
|
|
283
|
+
spec_name: string;
|
|
284
|
+
impl_name: string;
|
|
285
|
+
authoring_version: number;
|
|
286
|
+
spec_version: number;
|
|
287
|
+
impl_version: number;
|
|
288
|
+
transaction_version: number;
|
|
289
|
+
state_version: number;
|
|
290
|
+
}>;
|
|
291
|
+
SS58Prefix: import("polkadot-api").PlainDescriptor<number>;
|
|
292
|
+
};
|
|
293
|
+
Omnipool: {
|
|
294
|
+
HdxAssetId: import("polkadot-api").PlainDescriptor<number>;
|
|
295
|
+
HubAssetId: import("polkadot-api").PlainDescriptor<number>;
|
|
296
|
+
MinWithdrawalFee: import("polkadot-api").PlainDescriptor<number>;
|
|
297
|
+
MinimumTradingLimit: import("polkadot-api").PlainDescriptor<bigint>;
|
|
298
|
+
MinimumPoolLiquidity: import("polkadot-api").PlainDescriptor<bigint>;
|
|
299
|
+
MaxInRatio: import("polkadot-api").PlainDescriptor<bigint>;
|
|
300
|
+
MaxOutRatio: import("polkadot-api").PlainDescriptor<bigint>;
|
|
301
|
+
NFTCollectionId: import("polkadot-api").PlainDescriptor<bigint>;
|
|
302
|
+
BurnProtocolFee: import("polkadot-api").PlainDescriptor<number>;
|
|
303
|
+
};
|
|
304
|
+
DynamicFees: {
|
|
305
|
+
AssetFeeParameters: import("polkadot-api").PlainDescriptor<{
|
|
306
|
+
min_fee: number;
|
|
307
|
+
max_fee: number;
|
|
308
|
+
decay: bigint;
|
|
309
|
+
amplification: bigint;
|
|
310
|
+
}>;
|
|
311
|
+
ProtocolFeeParameters: import("polkadot-api").PlainDescriptor<{
|
|
312
|
+
min_fee: number;
|
|
313
|
+
max_fee: number;
|
|
314
|
+
decay: bigint;
|
|
315
|
+
amplification: bigint;
|
|
316
|
+
}>;
|
|
317
|
+
};
|
|
318
|
+
Stableswap: {
|
|
319
|
+
MinPoolLiquidity: import("polkadot-api").PlainDescriptor<bigint>;
|
|
320
|
+
MinTradingLimit: import("polkadot-api").PlainDescriptor<bigint>;
|
|
321
|
+
AmplificationRange: import("polkadot-api").PlainDescriptor<{
|
|
322
|
+
start: number;
|
|
323
|
+
end: number;
|
|
324
|
+
}>;
|
|
325
|
+
};
|
|
326
|
+
LBP: {
|
|
327
|
+
MinTradingLimit: import("polkadot-api").PlainDescriptor<bigint>;
|
|
328
|
+
MinPoolLiquidity: import("polkadot-api").PlainDescriptor<bigint>;
|
|
329
|
+
MaxInRatio: import("polkadot-api").PlainDescriptor<bigint>;
|
|
330
|
+
MaxOutRatio: import("polkadot-api").PlainDescriptor<bigint>;
|
|
331
|
+
repay_fee: import("polkadot-api").PlainDescriptor<import("polkadot-api").FixedSizeArray<2, number>>;
|
|
332
|
+
};
|
|
333
|
+
XYK: {
|
|
334
|
+
NativeAssetId: import("polkadot-api").PlainDescriptor<number>;
|
|
335
|
+
GetExchangeFee: import("polkadot-api").PlainDescriptor<import("polkadot-api").FixedSizeArray<2, number>>;
|
|
336
|
+
MinTradingLimit: import("polkadot-api").PlainDescriptor<bigint>;
|
|
337
|
+
MinPoolLiquidity: import("polkadot-api").PlainDescriptor<bigint>;
|
|
338
|
+
MaxInRatio: import("polkadot-api").PlainDescriptor<bigint>;
|
|
339
|
+
MaxOutRatio: import("polkadot-api").PlainDescriptor<bigint>;
|
|
340
|
+
OracleSource: import("polkadot-api").PlainDescriptor<import("polkadot-api").FixedSizeBinary<8>>;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
__view: {};
|
|
344
|
+
};
|
|
345
|
+
apis: {
|
|
346
|
+
CurrenciesApi: {
|
|
347
|
+
account: import("polkadot-api").RuntimeDescriptor<[asset_id: number, who: import("polkadot-api").SS58String], {
|
|
348
|
+
free: bigint;
|
|
349
|
+
frozen: bigint;
|
|
350
|
+
reserved: bigint;
|
|
351
|
+
}>;
|
|
352
|
+
accounts: import("polkadot-api").RuntimeDescriptor<[who: import("polkadot-api").SS58String], [number, {
|
|
353
|
+
free: bigint;
|
|
354
|
+
frozen: bigint;
|
|
355
|
+
reserved: bigint;
|
|
356
|
+
}][]>;
|
|
357
|
+
free_balance: import("polkadot-api").RuntimeDescriptor<[asset_id: number, who: import("polkadot-api").SS58String], bigint>;
|
|
358
|
+
};
|
|
359
|
+
AaveTradeExecutor: {
|
|
360
|
+
pairs: import("polkadot-api").RuntimeDescriptor<[], import("polkadot-api").FixedSizeArray<2, number>[]>;
|
|
361
|
+
liquidity_depth: import("polkadot-api").RuntimeDescriptor<[asset_in: number, asset_out: number], bigint | undefined>;
|
|
362
|
+
pool: import("polkadot-api").RuntimeDescriptor<[reserve: number, atoken: number], {
|
|
363
|
+
reserve: number;
|
|
364
|
+
atoken: number;
|
|
365
|
+
liqudity_in: bigint;
|
|
366
|
+
liqudity_out: bigint;
|
|
367
|
+
}>;
|
|
368
|
+
pools: import("polkadot-api").RuntimeDescriptor<[], {
|
|
369
|
+
reserve: number;
|
|
370
|
+
atoken: number;
|
|
371
|
+
liqudity_in: bigint;
|
|
372
|
+
liqudity_out: bigint;
|
|
373
|
+
}[]>;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
} & Promise<any>;
|
|
377
|
+
metadataTypes: Promise<Uint8Array>;
|
|
378
|
+
asset: {
|
|
379
|
+
_type?: void | undefined;
|
|
380
|
+
};
|
|
381
|
+
getMetadata: () => Promise<Uint8Array>;
|
|
382
|
+
genesis: string | undefined;
|
|
383
|
+
}>;
|
|
384
|
+
logSync(who: string, action: string, payload: any): void;
|
|
385
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { HydrationQueries } from '@galacticcouncil/descriptors';
|
|
3
|
+
import { Papi } from '../api';
|
|
4
|
+
import { Asset, ExternalAsset } from '../types';
|
|
5
|
+
type TStableswapPool = HydrationQueries['Stableswap']['Pools']['Value'];
|
|
6
|
+
type TBond = HydrationQueries['Bonds']['Bonds']['Value'];
|
|
7
|
+
type TAssetDetails = HydrationQueries['AssetRegistry']['Assets']['Value'];
|
|
8
|
+
type TAssetLocation = HydrationQueries['AssetRegistry']['AssetLocations']['Value'];
|
|
9
|
+
export declare class AssetClient extends Papi {
|
|
10
|
+
private SUPPORTED_TYPES;
|
|
11
|
+
constructor(client: PolkadotClient);
|
|
12
|
+
queryShares(): Promise<Map<number, TStableswapPool>>;
|
|
13
|
+
queryBonds(): Promise<Map<number, TBond>>;
|
|
14
|
+
queryAssets(): Promise<Map<number, TAssetDetails>>;
|
|
15
|
+
queryAssetLocations(): Promise<Map<number, TAssetLocation>>;
|
|
16
|
+
private mapToken;
|
|
17
|
+
private mapBond;
|
|
18
|
+
private mapShares;
|
|
19
|
+
private mapExternal;
|
|
20
|
+
private parseMetadata;
|
|
21
|
+
getOnChainAssets(includeInvalid?: boolean, external?: ExternalAsset[]): Promise<Asset[]>;
|
|
22
|
+
private isValidAsset;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { type Observable } from 'rxjs';
|
|
3
|
+
import { Papi } from '../api';
|
|
4
|
+
import { AssetAmount } from '../types';
|
|
5
|
+
export declare class BalanceClient extends Papi {
|
|
6
|
+
constructor(client: PolkadotClient);
|
|
7
|
+
getBalance(account: string, assetId: number): Promise<bigint>;
|
|
8
|
+
getSystemBalance(account: string): Promise<bigint>;
|
|
9
|
+
getTokenBalance(account: string, assetId: number): Promise<bigint>;
|
|
10
|
+
getErc20Balance(account: string, assetId: number): Promise<bigint>;
|
|
11
|
+
subscribeBalance(address: string): Observable<AssetAmount[]>;
|
|
12
|
+
subscribeSystemBalance(address: string): Observable<AssetAmount>;
|
|
13
|
+
subscribeTokenBalance(address: string, assetId: number): Observable<AssetAmount>;
|
|
14
|
+
subscribeTokensBalance(address: string): Observable<AssetAmount[]>;
|
|
15
|
+
subscribeErc20Balance(address: string, includeOnly?: number[]): Observable<AssetAmount[]>;
|
|
16
|
+
private getTokenBalanceData;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const RUNTIME_DECIMALS = 18;
|
|
2
|
+
export declare const SYSTEM_ASSET_ID = 0;
|
|
3
|
+
export declare const SYSTEM_ASSET_DECIMALS = 12;
|
|
4
|
+
export declare const HYDRATION_PARACHAIN_ID = 2034;
|
|
5
|
+
export declare const HYDRATION_SS58_PREFIX = 63;
|
|
6
|
+
export declare const HYDRATION_OMNIPOOL_ADDRESS = "7L53bUTBbfuj14UpdCNPwmgzzHSsrsTWBHX5pys32mVWM3C1";
|
|
7
|
+
export declare const HUB_ASSET_ID = 1;
|
|
8
|
+
export declare const TRADEABLE_DEFAULT = 15;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PoolType } from './pool';
|
|
2
|
+
export declare class AssetNotFound extends Error {
|
|
3
|
+
constructor(asset: number);
|
|
4
|
+
}
|
|
5
|
+
export declare class PoolNotFound extends Error {
|
|
6
|
+
constructor(poolType: PoolType);
|
|
7
|
+
}
|
|
8
|
+
export declare class RouteNotFound extends Error {
|
|
9
|
+
constructor(assetIn: number, assetOut: number);
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { type Observable } from 'rxjs';
|
|
3
|
+
import { BalanceClient } from '../client';
|
|
4
|
+
import { PoolBase, PoolFees, PoolTokenOverride, PoolType } from './types';
|
|
5
|
+
export declare abstract class PoolClient<T extends PoolBase> extends BalanceClient {
|
|
6
|
+
private override;
|
|
7
|
+
private mem;
|
|
8
|
+
private memPools;
|
|
9
|
+
constructor(client: PolkadotClient);
|
|
10
|
+
protected abstract loadPools(): Promise<T[]>;
|
|
11
|
+
abstract getPoolFees(pool: T, feeAsset: number): Promise<PoolFees>;
|
|
12
|
+
abstract getPoolType(): PoolType;
|
|
13
|
+
abstract isSupported(): Promise<boolean>;
|
|
14
|
+
abstract subscribePoolChange(pool: T): Observable<T>;
|
|
15
|
+
withOverride(override?: PoolTokenOverride[]): Promise<void>;
|
|
16
|
+
getPoolsMem(): Promise<T[]>;
|
|
17
|
+
getPools(): Promise<T[]>;
|
|
18
|
+
getSubscriber(): Observable<T>;
|
|
19
|
+
private subscribe;
|
|
20
|
+
private subscribePoolBalance;
|
|
21
|
+
private hasSystemAsset;
|
|
22
|
+
private hasErc20Asset;
|
|
23
|
+
private hasValidAssets;
|
|
24
|
+
private updatePool;
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { Papi } from '../api';
|
|
3
|
+
import { IPoolCtxProvider, PoolBase, PoolFees, PoolTokenOverride } from './types';
|
|
4
|
+
export declare class PoolContextProvider extends Papi implements IPoolCtxProvider {
|
|
5
|
+
private readonly lbpClient;
|
|
6
|
+
private readonly omniClient;
|
|
7
|
+
private readonly stableClient;
|
|
8
|
+
private readonly xykClient;
|
|
9
|
+
private readonly aaveClient;
|
|
10
|
+
private readonly active;
|
|
11
|
+
private readonly clients;
|
|
12
|
+
private readonly pools;
|
|
13
|
+
private lbpSub;
|
|
14
|
+
private omniSub;
|
|
15
|
+
private stableSub;
|
|
16
|
+
private xykSub;
|
|
17
|
+
private aaveSub;
|
|
18
|
+
private isReady;
|
|
19
|
+
private isDestroyed;
|
|
20
|
+
constructor(client: PolkadotClient);
|
|
21
|
+
private subscribe;
|
|
22
|
+
withOmnipool(): this;
|
|
23
|
+
withStableswap(): this;
|
|
24
|
+
withLbp(): this;
|
|
25
|
+
withAave(): this;
|
|
26
|
+
withXyk(override?: PoolTokenOverride[]): this;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
getPools(): Promise<PoolBase[]>;
|
|
29
|
+
getPoolFees(pool: PoolBase, feeAsset: number): Promise<PoolFees>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export declare const AAVE_ABI: readonly [{
|
|
2
|
+
readonly anonymous: false;
|
|
3
|
+
readonly inputs: readonly [{
|
|
4
|
+
readonly indexed: true;
|
|
5
|
+
readonly internalType: "address";
|
|
6
|
+
readonly name: "reserve";
|
|
7
|
+
readonly type: "address";
|
|
8
|
+
}, {
|
|
9
|
+
readonly indexed: false;
|
|
10
|
+
readonly internalType: "address";
|
|
11
|
+
readonly name: "user";
|
|
12
|
+
readonly type: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly indexed: true;
|
|
15
|
+
readonly internalType: "address";
|
|
16
|
+
readonly name: "onBehalfOf";
|
|
17
|
+
readonly type: "address";
|
|
18
|
+
}, {
|
|
19
|
+
readonly indexed: false;
|
|
20
|
+
readonly internalType: "uint256";
|
|
21
|
+
readonly name: "amount";
|
|
22
|
+
readonly type: "uint256";
|
|
23
|
+
}, {
|
|
24
|
+
readonly indexed: true;
|
|
25
|
+
readonly internalType: "uint16";
|
|
26
|
+
readonly name: "referralCode";
|
|
27
|
+
readonly type: "uint16";
|
|
28
|
+
}];
|
|
29
|
+
readonly name: "Supply";
|
|
30
|
+
readonly type: "event";
|
|
31
|
+
}, {
|
|
32
|
+
readonly anonymous: false;
|
|
33
|
+
readonly inputs: readonly [{
|
|
34
|
+
readonly indexed: true;
|
|
35
|
+
readonly internalType: "address";
|
|
36
|
+
readonly name: "reserve";
|
|
37
|
+
readonly type: "address";
|
|
38
|
+
}, {
|
|
39
|
+
readonly indexed: true;
|
|
40
|
+
readonly internalType: "address";
|
|
41
|
+
readonly name: "user";
|
|
42
|
+
readonly type: "address";
|
|
43
|
+
}, {
|
|
44
|
+
readonly indexed: true;
|
|
45
|
+
readonly internalType: "address";
|
|
46
|
+
readonly name: "to";
|
|
47
|
+
readonly type: "address";
|
|
48
|
+
}, {
|
|
49
|
+
readonly indexed: false;
|
|
50
|
+
readonly internalType: "uint256";
|
|
51
|
+
readonly name: "amount";
|
|
52
|
+
readonly type: "uint256";
|
|
53
|
+
}];
|
|
54
|
+
readonly name: "Withdraw";
|
|
55
|
+
readonly type: "event";
|
|
56
|
+
}, {
|
|
57
|
+
readonly anonymous: false;
|
|
58
|
+
readonly inputs: readonly [{
|
|
59
|
+
readonly indexed: true;
|
|
60
|
+
readonly internalType: "address";
|
|
61
|
+
readonly name: "reserve";
|
|
62
|
+
readonly type: "address";
|
|
63
|
+
}, {
|
|
64
|
+
readonly indexed: false;
|
|
65
|
+
readonly internalType: "address";
|
|
66
|
+
readonly name: "user";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}, {
|
|
69
|
+
readonly indexed: true;
|
|
70
|
+
readonly internalType: "address";
|
|
71
|
+
readonly name: "onBehalfOf";
|
|
72
|
+
readonly type: "address";
|
|
73
|
+
}, {
|
|
74
|
+
readonly indexed: false;
|
|
75
|
+
readonly internalType: "uint256";
|
|
76
|
+
readonly name: "amount";
|
|
77
|
+
readonly type: "uint256";
|
|
78
|
+
}, {
|
|
79
|
+
readonly indexed: false;
|
|
80
|
+
readonly internalType: "enum DataTypes.InterestRateMode";
|
|
81
|
+
readonly name: "interestRateMode";
|
|
82
|
+
readonly type: "uint8";
|
|
83
|
+
}, {
|
|
84
|
+
readonly indexed: false;
|
|
85
|
+
readonly internalType: "uint256";
|
|
86
|
+
readonly name: "borrowRate";
|
|
87
|
+
readonly type: "uint256";
|
|
88
|
+
}, {
|
|
89
|
+
readonly indexed: true;
|
|
90
|
+
readonly internalType: "uint16";
|
|
91
|
+
readonly name: "referralCode";
|
|
92
|
+
readonly type: "uint16";
|
|
93
|
+
}];
|
|
94
|
+
readonly name: "Borrow";
|
|
95
|
+
readonly type: "event";
|
|
96
|
+
}, {
|
|
97
|
+
readonly anonymous: false;
|
|
98
|
+
readonly inputs: readonly [{
|
|
99
|
+
readonly indexed: true;
|
|
100
|
+
readonly internalType: "address";
|
|
101
|
+
readonly name: "reserve";
|
|
102
|
+
readonly type: "address";
|
|
103
|
+
}, {
|
|
104
|
+
readonly indexed: true;
|
|
105
|
+
readonly internalType: "address";
|
|
106
|
+
readonly name: "user";
|
|
107
|
+
readonly type: "address";
|
|
108
|
+
}, {
|
|
109
|
+
readonly indexed: true;
|
|
110
|
+
readonly internalType: "address";
|
|
111
|
+
readonly name: "repayer";
|
|
112
|
+
readonly type: "address";
|
|
113
|
+
}, {
|
|
114
|
+
readonly indexed: false;
|
|
115
|
+
readonly internalType: "uint256";
|
|
116
|
+
readonly name: "amount";
|
|
117
|
+
readonly type: "uint256";
|
|
118
|
+
}, {
|
|
119
|
+
readonly indexed: false;
|
|
120
|
+
readonly internalType: "bool";
|
|
121
|
+
readonly name: "useATokens";
|
|
122
|
+
readonly type: "bool";
|
|
123
|
+
}];
|
|
124
|
+
readonly name: "Repay";
|
|
125
|
+
readonly type: "event";
|
|
126
|
+
}];
|