@galacticcouncil/sdk-next 1.0.0-beta.0 → 1.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.
Files changed (151) hide show
  1. package/README.md +131 -78
  2. package/build/aave/AaveClient.d.ts +77 -0
  3. package/build/aave/AaveUtils.d.ts +78 -0
  4. package/build/aave/abi/AavePool.d.ts +208 -0
  5. package/build/aave/abi/AavePoolDataProvider.d.ts +384 -0
  6. package/build/aave/abi/index.d.ts +2 -0
  7. package/build/aave/const.d.ts +6 -0
  8. package/build/aave/index.cjs +1 -0
  9. package/build/aave/index.d.ts +4 -0
  10. package/build/aave/index.mjs +1 -0
  11. package/build/aave/types.d.ts +17 -0
  12. package/build/api/Papi.d.ts +10 -0
  13. package/build/api/Watcher.d.ts +11 -0
  14. package/build/api/index.d.ts +3 -0
  15. package/build/api/probe.d.ts +26 -0
  16. package/build/api/provider/index.d.ts +2 -0
  17. package/build/api/provider/smoldot.d.ts +1 -0
  18. package/build/api/provider/websocket.d.ts +4 -0
  19. package/build/{types/client → client}/AssetClient.d.ts +1 -1
  20. package/build/client/BalanceClient.d.ts +20 -0
  21. package/build/client/ChainParams.d.ts +9 -0
  22. package/build/client/index.cjs +1 -0
  23. package/build/{types/client → client}/index.d.ts +1 -0
  24. package/build/client/index.mjs +1 -0
  25. package/build/{types/consts.d.ts → consts.d.ts} +2 -2
  26. package/build/evm/adapter.d.ts +11 -0
  27. package/build/evm/chain.d.ts +2 -0
  28. package/build/evm/client.d.ts +15 -0
  29. package/build/evm/index.cjs +1 -0
  30. package/build/evm/index.d.ts +4 -0
  31. package/build/evm/index.mjs +1 -0
  32. package/build/evm/types.d.ts +7 -0
  33. package/build/factory.d.ts +29 -0
  34. package/build/farm/LiquidityMiningApi.d.ts +29 -0
  35. package/build/farm/LiquidityMiningClient.d.ts +146 -0
  36. package/build/farm/MultiCurrencyContainer.d.ts +8 -0
  37. package/build/farm/RewardClaimSimulator.d.ts +16 -0
  38. package/build/farm/const.d.ts +4 -0
  39. package/build/farm/index.cjs +1 -0
  40. package/build/farm/index.d.ts +3 -0
  41. package/build/farm/index.mjs +1 -0
  42. package/build/farm/types.d.ts +46 -0
  43. package/build/gho/GhoTokenClient.d.ts +6 -0
  44. package/build/gho/abi.d.ts +124 -0
  45. package/build/gho/index.d.ts +2 -0
  46. package/build/index.cjs +1 -1
  47. package/build/{types/index.d.ts → index.d.ts} +6 -0
  48. package/build/index.mjs +1 -1
  49. package/build/oracle/MmOracleClient.d.ts +7 -0
  50. package/build/oracle/abi.d.ts +196 -0
  51. package/build/oracle/index.d.ts +3 -0
  52. package/build/oracle/types.d.ts +5 -0
  53. package/build/pool/PoolClient.d.ts +75 -0
  54. package/build/pool/PoolContextProvider.d.ts +41 -0
  55. package/build/pool/PoolLog.d.ts +11 -0
  56. package/build/pool/PoolStore.d.ts +20 -0
  57. package/build/pool/aave/AaveAbi.d.ts +126 -0
  58. package/build/pool/aave/AavePool.d.ts +24 -0
  59. package/build/pool/aave/AavePoolClient.d.ts +19 -0
  60. package/build/pool/aave/index.d.ts +2 -0
  61. package/build/pool/aave/types.d.ts +13 -0
  62. package/build/pool/hsm/HsmMath.d.ts +21 -0
  63. package/build/pool/hsm/HsmPool.d.ts +63 -0
  64. package/build/pool/hsm/HsmPoolClient.d.ts +26 -0
  65. package/build/pool/hsm/index.d.ts +3 -0
  66. package/build/pool/hsm/types.d.ts +7 -0
  67. package/build/pool/index.cjs +1 -0
  68. package/build/{types/pool → pool}/index.d.ts +4 -2
  69. package/build/pool/index.mjs +1 -0
  70. package/build/{types/pool → pool}/lbp/LbpPool.d.ts +1 -1
  71. package/build/{types/pool → pool}/lbp/LbpPoolClient.d.ts +9 -7
  72. package/build/{types/pool → pool}/omni/OmniMath.d.ts +7 -6
  73. package/build/{types/pool → pool}/omni/OmniPool.d.ts +14 -1
  74. package/build/pool/omni/OmniPoolClient.d.ts +29 -0
  75. package/build/pool/omni/types.d.ts +11 -0
  76. package/build/{types/pool → pool}/stable/StableMath.d.ts +1 -2
  77. package/build/{types/pool → pool}/stable/StableSwap.d.ts +21 -4
  78. package/build/pool/stable/StableSwapClient.d.ts +23 -0
  79. package/build/pool/stable/types.d.ts +15 -0
  80. package/build/{types/pool → pool}/types.d.ts +14 -3
  81. package/build/{types/pool → pool}/xyk/XykPool.d.ts +13 -1
  82. package/build/pool/xyk/XykPoolClient.d.ts +14 -0
  83. package/build/{types/sor → sor}/Router.d.ts +26 -8
  84. package/build/sor/TradeRouteBuilder.d.ts +4 -0
  85. package/build/sor/TradeRouter.d.ts +207 -0
  86. package/build/sor/TradeScheduler.d.ts +111 -0
  87. package/build/sor/const.d.ts +8 -0
  88. package/build/sor/index.cjs +1 -0
  89. package/build/sor/index.d.ts +6 -0
  90. package/build/sor/index.mjs +1 -0
  91. package/build/{types/sor → sor}/route/bfs.d.ts +11 -2
  92. package/build/{types/sor → sor}/route/index.d.ts +1 -1
  93. package/build/sor/route/suggester.d.ts +33 -0
  94. package/build/sor/types.d.ts +68 -0
  95. package/build/staking/StakingApi.d.ts +66 -0
  96. package/build/staking/StakingClient.d.ts +132 -0
  97. package/build/staking/index.cjs +1 -0
  98. package/build/staking/index.d.ts +2 -0
  99. package/build/staking/index.mjs +1 -0
  100. package/build/staking/types.d.ts +16 -0
  101. package/build/staking/utils.d.ts +1 -0
  102. package/build/tx/OrderTxBuilder.d.ts +21 -0
  103. package/build/tx/TradeTxBuilder.d.ts +18 -0
  104. package/build/tx/TxBuilder.d.ts +19 -0
  105. package/build/tx/TxBuilderFactory.d.ts +12 -0
  106. package/build/tx/index.cjs +1 -0
  107. package/build/tx/index.d.ts +2 -0
  108. package/build/tx/index.mjs +1 -0
  109. package/build/tx/types.d.ts +10 -0
  110. package/build/tx/utils.d.ts +5 -0
  111. package/build/{types/types.d.ts → types.d.ts} +9 -2
  112. package/build/utils/QueryBus.d.ts +10 -0
  113. package/build/utils/async.d.ts +1 -0
  114. package/build/utils/calc.d.ts +52 -0
  115. package/build/utils/format.d.ts +11 -0
  116. package/build/utils/index.cjs +1 -0
  117. package/build/{types/utils → utils}/index.d.ts +3 -3
  118. package/build/utils/index.mjs +1 -0
  119. package/build/{types/utils → utils}/math.d.ts +0 -9
  120. package/package.json +70 -15
  121. package/build/types/api/Papi.d.ts +0 -375
  122. package/build/types/api/client.d.ts +0 -2
  123. package/build/types/api/index.d.ts +0 -2
  124. package/build/types/client/BalanceClient.d.ts +0 -17
  125. package/build/types/pool/PoolClient.d.ts +0 -25
  126. package/build/types/pool/PoolContextProvider.d.ts +0 -26
  127. package/build/types/pool/omni/OmniPoolClient.d.ts +0 -13
  128. package/build/types/pool/stable/StableSwapClient.d.ts +0 -16
  129. package/build/types/pool/xyk/XykPoolClient.d.ts +0 -12
  130. package/build/types/sor/TradeRouter.d.ts +0 -155
  131. package/build/types/sor/TradeUtils.d.ts +0 -12
  132. package/build/types/sor/index.d.ts +0 -4
  133. package/build/types/sor/route/suggester.d.ts +0 -24
  134. package/build/types/sor/types.d.ts +0 -31
  135. package/build/types/utils/big.d.ts +0 -3
  136. package/build/types/utils/evm.d.ts +0 -3
  137. package/build/types/utils/format.d.ts +0 -4
  138. package/build/types/utils/xc.d.ts +0 -1
  139. /package/build/{types/errors.d.ts → errors.d.ts} +0 -0
  140. /package/build/{types/pool → pool}/PoolFactory.d.ts +0 -0
  141. /package/build/{types/pool → pool}/lbp/LbpMath.d.ts +0 -0
  142. /package/build/{types/pool → pool}/lbp/index.d.ts +0 -0
  143. /package/build/{types/pool → pool}/omni/index.d.ts +0 -0
  144. /package/build/{types/pool → pool}/stable/index.d.ts +0 -0
  145. /package/build/{types/pool → pool}/xyk/XykMath.d.ts +0 -0
  146. /package/build/{types/pool → pool}/xyk/index.d.ts +0 -0
  147. /package/build/{types/sor → sor}/route/graph.d.ts +0 -0
  148. /package/build/{types/utils → utils}/Queue.d.ts +0 -0
  149. /package/build/{types/utils → utils}/Stack.d.ts +0 -0
  150. /package/build/{types/utils → utils}/json.d.ts +0 -0
  151. /package/build/{types/utils → utils}/traversal/bfs.d.ts +0 -0
@@ -1,375 +0,0 @@
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_out: number;
119
- asset_in: number;
120
- min_buy_amount: bigint;
121
- }>;
122
- buy: import("polkadot-api").TxDescriptor<{
123
- amount: bigint;
124
- asset_out: number;
125
- asset_in: number;
126
- max_sell_amount: bigint;
127
- }>;
128
- };
129
- Router: {
130
- sell: import("polkadot-api").TxDescriptor<{
131
- asset_out: number;
132
- asset_in: number;
133
- route: {
134
- pool: import("polkadot-api").Enum<{
135
- "XYK": undefined;
136
- "LBP": undefined;
137
- "Stableswap": number;
138
- "Omnipool": undefined;
139
- "Aave": undefined;
140
- }>;
141
- asset_in: number;
142
- asset_out: number;
143
- }[];
144
- amount_in: bigint;
145
- min_amount_out: bigint;
146
- }>;
147
- buy: import("polkadot-api").TxDescriptor<{
148
- asset_out: number;
149
- asset_in: 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_out: number;
166
- asset_in: 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
- EVM: {
184
- Log: import("polkadot-api").PlainDescriptor<{
185
- log: {
186
- address: import("polkadot-api").FixedSizeBinary<20>;
187
- topics: import("polkadot-api").FixedSizeBinary<32>[];
188
- data: import("polkadot-api").Binary;
189
- };
190
- }>;
191
- };
192
- };
193
- __error: {};
194
- __const: {
195
- System: {
196
- BlockWeights: import("polkadot-api").PlainDescriptor<{
197
- base_block: {
198
- ref_time: bigint;
199
- proof_size: bigint;
200
- };
201
- max_block: {
202
- ref_time: bigint;
203
- proof_size: bigint;
204
- };
205
- per_class: {
206
- normal: {
207
- "base_extrinsic": {
208
- ref_time: bigint;
209
- proof_size: bigint;
210
- };
211
- "max_extrinsic"?: ({
212
- ref_time: bigint;
213
- proof_size: bigint;
214
- }) | undefined;
215
- "max_total"?: ({
216
- ref_time: bigint;
217
- proof_size: bigint;
218
- }) | undefined;
219
- "reserved"?: ({
220
- ref_time: bigint;
221
- proof_size: bigint;
222
- }) | undefined;
223
- };
224
- operational: {
225
- "base_extrinsic": {
226
- ref_time: bigint;
227
- proof_size: bigint;
228
- };
229
- "max_extrinsic"?: ({
230
- ref_time: bigint;
231
- proof_size: bigint;
232
- }) | undefined;
233
- "max_total"?: ({
234
- ref_time: bigint;
235
- proof_size: bigint;
236
- }) | undefined;
237
- "reserved"?: ({
238
- ref_time: bigint;
239
- proof_size: bigint;
240
- }) | undefined;
241
- };
242
- mandatory: {
243
- "base_extrinsic": {
244
- ref_time: bigint;
245
- proof_size: bigint;
246
- };
247
- "max_extrinsic"?: ({
248
- ref_time: bigint;
249
- proof_size: bigint;
250
- }) | undefined;
251
- "max_total"?: ({
252
- ref_time: bigint;
253
- proof_size: bigint;
254
- }) | undefined;
255
- "reserved"?: ({
256
- ref_time: bigint;
257
- proof_size: bigint;
258
- }) | undefined;
259
- };
260
- };
261
- }>;
262
- BlockLength: import("polkadot-api").PlainDescriptor<{
263
- normal: number;
264
- operational: number;
265
- mandatory: number;
266
- }>;
267
- BlockHashCount: import("polkadot-api").PlainDescriptor<number>;
268
- DbWeight: import("polkadot-api").PlainDescriptor<{
269
- read: bigint;
270
- write: bigint;
271
- }>;
272
- Version: import("polkadot-api").PlainDescriptor<{
273
- apis: [import("polkadot-api").FixedSizeBinary<8>, number][];
274
- spec_name: string;
275
- impl_name: string;
276
- authoring_version: number;
277
- spec_version: number;
278
- impl_version: number;
279
- transaction_version: number;
280
- state_version: number;
281
- }>;
282
- SS58Prefix: import("polkadot-api").PlainDescriptor<number>;
283
- };
284
- Omnipool: {
285
- HdxAssetId: import("polkadot-api").PlainDescriptor<number>;
286
- HubAssetId: import("polkadot-api").PlainDescriptor<number>;
287
- MinWithdrawalFee: import("polkadot-api").PlainDescriptor<number>;
288
- MinimumTradingLimit: import("polkadot-api").PlainDescriptor<bigint>;
289
- MinimumPoolLiquidity: import("polkadot-api").PlainDescriptor<bigint>;
290
- MaxInRatio: import("polkadot-api").PlainDescriptor<bigint>;
291
- MaxOutRatio: import("polkadot-api").PlainDescriptor<bigint>;
292
- NFTCollectionId: import("polkadot-api").PlainDescriptor<bigint>;
293
- BurnProtocolFee: import("polkadot-api").PlainDescriptor<number>;
294
- };
295
- DynamicFees: {
296
- AssetFeeParameters: import("polkadot-api").PlainDescriptor<{
297
- min_fee: number;
298
- max_fee: number;
299
- decay: bigint;
300
- amplification: bigint;
301
- }>;
302
- ProtocolFeeParameters: import("polkadot-api").PlainDescriptor<{
303
- min_fee: number;
304
- max_fee: number;
305
- decay: bigint;
306
- amplification: bigint;
307
- }>;
308
- };
309
- Stableswap: {
310
- MinPoolLiquidity: import("polkadot-api").PlainDescriptor<bigint>;
311
- MinTradingLimit: import("polkadot-api").PlainDescriptor<bigint>;
312
- AmplificationRange: import("polkadot-api").PlainDescriptor<{
313
- start: number;
314
- end: number;
315
- }>;
316
- };
317
- LBP: {
318
- MinTradingLimit: import("polkadot-api").PlainDescriptor<bigint>;
319
- MinPoolLiquidity: import("polkadot-api").PlainDescriptor<bigint>;
320
- MaxInRatio: import("polkadot-api").PlainDescriptor<bigint>;
321
- MaxOutRatio: import("polkadot-api").PlainDescriptor<bigint>;
322
- repay_fee: import("polkadot-api").PlainDescriptor<import("polkadot-api").FixedSizeArray<2, number>>;
323
- };
324
- XYK: {
325
- NativeAssetId: import("polkadot-api").PlainDescriptor<number>;
326
- GetExchangeFee: import("polkadot-api").PlainDescriptor<import("polkadot-api").FixedSizeArray<2, number>>;
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
- OracleSource: import("polkadot-api").PlainDescriptor<import("polkadot-api").FixedSizeBinary<8>>;
332
- };
333
- };
334
- };
335
- apis: {
336
- CurrenciesApi: {
337
- account: import("polkadot-api").RuntimeDescriptor<[asset_id: number, who: import("polkadot-api").SS58String], {
338
- free: bigint;
339
- frozen: bigint;
340
- reserved: bigint;
341
- }>;
342
- accounts: import("polkadot-api").RuntimeDescriptor<[who: import("polkadot-api").SS58String], [number, {
343
- free: bigint;
344
- frozen: bigint;
345
- reserved: bigint;
346
- }][]>;
347
- free_balance: import("polkadot-api").RuntimeDescriptor<[asset_id: number, who: import("polkadot-api").SS58String], bigint>;
348
- };
349
- AaveTradeExecutor: {
350
- pairs: import("polkadot-api").RuntimeDescriptor<[], import("polkadot-api").FixedSizeArray<2, number>[]>;
351
- liquidity_depth: import("polkadot-api").RuntimeDescriptor<[asset_in: number, asset_out: number], bigint | undefined>;
352
- pool: import("polkadot-api").RuntimeDescriptor<[reserve: number, atoken: number], {
353
- reserve: number;
354
- atoken: number;
355
- liqudity_in: bigint;
356
- liqudity_out: bigint;
357
- }>;
358
- pools: import("polkadot-api").RuntimeDescriptor<[], {
359
- reserve: number;
360
- atoken: number;
361
- liqudity_in: bigint;
362
- liqudity_out: bigint;
363
- }[]>;
364
- };
365
- };
366
- } & Promise<any>;
367
- metadataTypes: Promise<Uint8Array>;
368
- asset: {
369
- _type?: void | undefined;
370
- };
371
- getMetadata: () => Promise<Uint8Array>;
372
- genesis: string | undefined;
373
- }>;
374
- logSync(who: string, action: string, payload: any): void;
375
- }
@@ -1,2 +0,0 @@
1
- import { PolkadotClient } from 'polkadot-api';
2
- export declare const getWs: (wsUrl: string | string[]) => Promise<PolkadotClient>;
@@ -1,2 +0,0 @@
1
- export * from './client';
2
- export * from './Papi';
@@ -1,17 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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 active;
10
- private readonly clients;
11
- private readonly pools;
12
- private lbpSub;
13
- private omniSub;
14
- private stableSub;
15
- private xykSub;
16
- private isReady;
17
- private isDestroyed;
18
- constructor(client: PolkadotClient);
19
- withOmnipool(): this;
20
- withStableswap(): this;
21
- withLbp(): this;
22
- withXyk(override?: PoolTokenOverride[]): this;
23
- destroy(): void;
24
- getPools(): Promise<PoolBase[]>;
25
- getPoolFees(pool: PoolBase, feeAsset: number): Promise<PoolFees>;
26
- }
@@ -1,13 +0,0 @@
1
- import { type Observable } from 'rxjs';
2
- import { PoolType, PoolFees } from '../types';
3
- import { PoolClient } from '../PoolClient';
4
- import { OmniPoolBase } from './OmniPool';
5
- export declare class OmniPoolClient extends PoolClient<OmniPoolBase> {
6
- protected loadPools(): Promise<OmniPoolBase[]>;
7
- private getPoolAddress;
8
- private getPoolLimits;
9
- getPoolFees(_pool: OmniPoolBase, feeAsset: number): Promise<PoolFees>;
10
- getPoolType(): PoolType;
11
- isSupported(): Promise<boolean>;
12
- subscribePoolChange(pool: OmniPoolBase): Observable<OmniPoolBase>;
13
- }
@@ -1,16 +0,0 @@
1
- import { type Observable } from 'rxjs';
2
- import { PoolType, PoolFees } from '../types';
3
- import { PoolClient } from '../PoolClient';
4
- import { StableSwapBase } from './StableSwap';
5
- export declare class StableSwapClient extends PoolClient<StableSwapBase> {
6
- private poolsData;
7
- protected loadPools(): Promise<StableSwapBase[]>;
8
- private getPoolDelta;
9
- private getPoolTokens;
10
- private getPoolAddress;
11
- private getPoolLimits;
12
- getPoolFees(pool: StableSwapBase): Promise<PoolFees>;
13
- getPoolType(): PoolType;
14
- isSupported(): Promise<boolean>;
15
- subscribePoolChange(pool: StableSwapBase): Observable<StableSwapBase>;
16
- }
@@ -1,12 +0,0 @@
1
- import { type Observable } from 'rxjs';
2
- import { PoolBase, PoolType, PoolFees } from '../types';
3
- import { PoolClient } from '../PoolClient';
4
- export declare class XykPoolClient extends PoolClient<PoolBase> {
5
- protected loadPools(): Promise<PoolBase[]>;
6
- private getExchangeFee;
7
- private getPoolLimits;
8
- getPoolFees(): Promise<PoolFees>;
9
- getPoolType(): PoolType;
10
- isSupported(): Promise<boolean>;
11
- subscribePoolChange(pool: PoolBase): Observable<PoolBase>;
12
- }
@@ -1,155 +0,0 @@
1
- import { Router } from './Router';
2
- import { Trade } from './types';
3
- import { Hop } from '../pool';
4
- import { Amount } from '../types';
5
- export declare class TradeRouter extends Router {
6
- /**
7
- * Check whether trade is direct or not
8
- *
9
- * @param {Swap[]} swaps - trade route swaps
10
- * @returns true if direct trade, otherwise false
11
- */
12
- private isDirectTrade;
13
- /**
14
- * Find the best sell swap without errors
15
- *
16
- * @param {SellSwap[]} swaps - all possible sell routes
17
- * @returns best sell swap if exist, otherwise first one found
18
- */
19
- private findBestSellRoute;
20
- /**
21
- * Route fee range [min,max] in case pool is using dynamic fees
22
- *
23
- * @param {Swap[]} swaps - trade routes
24
- * @returns min & max fee range if swapping through the pool with
25
- * dynamic fees support
26
- */
27
- private getRouteFeeRange;
28
- /**
29
- * Pool fee range [min,max] in case pool is using dynamic fees
30
- *
31
- * @param {PoolFees} fees - pool fees
32
- * @returns min & max fee range if swapping through the pool with
33
- * dynamic fees support
34
- */
35
- private getPoolFeeRange;
36
- /**
37
- * Calculate and return best possible sell trade for assetIn>assetOut
38
- *
39
- * @param {string} assetIn - assetIn id
40
- * @param {string} assetOut - assetOut id
41
- * @param {bigint} amountIn - amount of assetIn to sell for assetOut
42
- * @returns best possible sell trade of given token pair
43
- */
44
- getBestSell(assetIn: number, assetOut: number, amountIn: bigint | string): Promise<Trade>;
45
- /**
46
- * Calculate and return sell spot price for assetIn>assetOut
47
- *
48
- * @param route - best possible trade route (sell)
49
- * @returns sell spot price
50
- */
51
- private getSellSpot;
52
- /**
53
- * Calculate and return sell trade for assetIn>assetOut
54
- *
55
- * @param {string} assetIn - assetIn id
56
- * @param {string} assetOut - assetOut id
57
- * @param {bigint} amountIn - amount of assetIn to sell for assetOut
58
- * @param {Hop[]} route - explicit route to use for trade
59
- * @returns sell trade of given token pair
60
- */
61
- getSell(assetIn: number, assetOut: number, amountIn: bigint | string, route?: Hop[]): Promise<Trade>;
62
- /**
63
- * Calculate the amount out for best possible trade if fees are zero
64
- *
65
- * @param amountIn - amount of assetIn to sell for assetOut
66
- * @param route - best possible trade route (sell)
67
- * @param poolsMap - pools map
68
- * @returns the amount out for best possible trade if fees are zero
69
- */
70
- private calculateDelta0Y;
71
- /**
72
- * Calculate and return sell swaps for given path
73
- * - final amount of previous swap is entry to next one
74
- *
75
- * @param amountIn - amount of assetIn to sell for assetOut
76
- * @param path - current path
77
- * @param poolsMap - pools map
78
- * @returns sell swaps for given path
79
- */
80
- private toSellSwaps;
81
- /**
82
- * Calculate and return most liquid route for tokenIn>tokenOut
83
- *
84
- * To avoid routing through the pools with low liquidity, 0.1% from the
85
- * most liquid pool asset is used as reference value to determine the
86
- * sweet spot.
87
- *
88
- * @param {number} assetIn - assetIn id
89
- * @param {number} assetOut - assetout id
90
- * @return Most liquid route of given token pair
91
- */
92
- getMostLiquidRoute(assetIn: number, assetOut: number): Promise<Hop[]>;
93
- /**
94
- * Calculate and return best spot price for tokenIn>tokenOut
95
- *
96
- * @param {number} assetIn - assetIn id
97
- * @param {number} assetOut - assetOut id
98
- * @return best possible spot price of given asset pair, or undefined
99
- * if given pair swap is not supported
100
- */
101
- getSpotPrice(assetIn: number, assetOut: number): Promise<Amount>;
102
- /**
103
- * Find the best buy swap without errors, if there is none return first one found
104
- *
105
- * @param {BuySwap[]} swaps - all possible buy routes
106
- * @returns best buy swap if exist, otherwise first one found
107
- */
108
- private findBestBuyRoute;
109
- /**
110
- * Calculate and return best possible buy trade for assetIn>assetOut
111
- *
112
- * @param {number} assetIn - assetIn id
113
- * @param {number} assetOut - assetOut id
114
- * @param {bigint} amountOut - amount of tokenOut to buy for tokenIn
115
- * @returns best possible buy trade of given token pair
116
- */
117
- getBestBuy(assetIn: number, assetOut: number, amountOut: bigint | string): Promise<Trade>;
118
- /**
119
- * Calculate and return buy spot price for assetIn>assetOut
120
- *
121
- * @param route - best possible trade route (buy)
122
- * @returns buy spot price
123
- */
124
- private getBuySpot;
125
- /**
126
- * Calculate and return buy trade for assetIn>assetOut
127
- *
128
- * @param {number} assetIn - assetIn id
129
- * @param {number} assetOut - assetOut id
130
- * @param {bigint} amountOut - amount of tokenOut to buy for tokenIn
131
- * @param {Hop[]} route - explicit route to use for trade
132
- * @returns buy trade of given token pair
133
- */
134
- getBuy(assetIn: number, assetOut: number, amountOut: bigint | string, route?: Hop[]): Promise<Trade>;
135
- /**
136
- * Calculate the amount in for best possible trade if fees are zero
137
- *
138
- * @param amountOut - amount of assetOut to buy for assetIn
139
- * @param bestRoute - best possible trade route (buy)
140
- * @param poolsMap - pools map
141
- * @returns the amount in for best possible trade if fees are zero
142
- */
143
- private calculateDelta0X;
144
- /**
145
- * Calculate and return buy swaps for given path
146
- * - final amount of previous swap is entry to next one
147
- * - calculation is done backwards (swaps in reversed order)
148
- *
149
- * @param amountOut - amount of assetOut to buy for assetIn
150
- * @param path - current path
151
- * @param poolsMap - pools map
152
- * @returns buy swaps for given path
153
- */
154
- private toBuySwaps;
155
- }
@@ -1,12 +0,0 @@
1
- import { Binary, PolkadotClient } from 'polkadot-api';
2
- import { Papi } from '../api';
3
- import { Trade } from './types';
4
- export declare class TradeUtils extends Papi {
5
- constructor(client: PolkadotClient);
6
- private isDirectOmnipoolTrade;
7
- private tradeCheck;
8
- buildBuyTx(trade: Trade, slippagePct?: number): Promise<Binary>;
9
- buildSellTx(trade: Trade, slippagePct?: number): Promise<Binary>;
10
- buildSellAllTx(trade: Trade, slippagePct?: number): Promise<Binary>;
11
- private buildRoute;
12
- }