@galacticcouncil/descriptors 1.0.0 → 1.1.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.
@@ -0,0 +1,27 @@
1
+ // .papi/descriptors/src/descriptors.ts
2
+ var [minified, commonTrees, tokens] = JSON.parse(`[{"hydration":{"storage":{"0":{"Account":0,"Number":1},"2":{"1":6,"AssetLocations":7},"3":{"1":8,"HubAssetTradability":1},"4":0,"5":{"AssetFee":16},"6":{"Pools":18,"AssetTradability":19},"7":{"7":21},"8":{"PoolData":22},"9":{"PoolAssets":24},"10":{"TotalIssuance":26,"Accounts":27},"11":0,"12":{"ValidationData":29}},"tx":{"0":0,"2":0,"3":{"13":10,"14":11},"4":{"13":12,"14":13,"sell_all":14},"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"events":{"0":0,"2":0,"3":0,"4":{"Executed":15},"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":{"Log":28},"12":0},"constants":{"0":{"BlockWeights":2,"BlockLength":3,"BlockHashCount":1,"DbWeight":4,"Version":5,"SS58Prefix":1},"2":0,"3":{"15":9,"16":9,"HdxAssetId":1,"HubAssetId":1,"MinWithdrawalFee":1,"MinimumTradingLimit":9,"MinimumPoolLiquidity":9,"NFTCollectionId":9,"BurnProtocolFee":1},"4":0,"5":{"AssetFeeParameters":17,"ProtocolFeeParameters":17},"6":{"17":9,"18":9,"AmplificationRange":20},"7":0,"8":{"15":9,"16":9,"17":9,"18":9,"repay_fee":23},"9":{"15":9,"16":9,"17":9,"18":9,"NativeAssetId":1,"GetExchangeFee":23,"OracleSource":25},"10":0,"11":0,"12":0},"viewFns":{"0":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"apis":{"CurrenciesApi":{"account":30,"accounts":31,"free_balance":32},"AaveTradeExecutor":{"pairs":33,"liquidity_depth":34,"pool":35,"pools":36}}}},[{}],["System","Assets","AssetRegistry","Omnipool","Router","DynamicFees","Stableswap","Bonds","LBP","XYK","Tokens","EVM","ParachainSystem","sell","buy","MaxInRatio","MaxOutRatio","MinPoolLiquidity","MinTradingLimit"]]`);
3
+ var replaceTokens = (obj) => Object.fromEntries(
4
+ Object.entries(obj).map(([key, value]) => {
5
+ const unwrappedValue = typeof value === "object" ? replaceTokens(value) : value;
6
+ const numericKey = Number(key);
7
+ if (Number.isNaN(numericKey)) {
8
+ return [key, unwrappedValue];
9
+ }
10
+ return [tokens[numericKey], unwrappedValue];
11
+ })
12
+ );
13
+ var tokenizedCommonTrees = commonTrees.map(replaceTokens);
14
+ var unwrap = (obj, depth) => depth === 0 ? obj : Object.fromEntries(
15
+ Object.entries(obj).map(([key, value]) => [
16
+ key,
17
+ unwrap(
18
+ typeof value === "object" ? value : tokenizedCommonTrees[value],
19
+ depth - 1
20
+ )
21
+ ])
22
+ );
23
+ var getChainDescriptors = (key) => unwrap(replaceTokens(minified[key]), 2);
24
+ var Hydration = getChainDescriptors("hydration");
25
+ export {
26
+ Hydration
27
+ };
@@ -1,5 +1,5 @@
1
- import { StorageDescriptor, PlainDescriptor, TxDescriptor, RuntimeDescriptor, Enum, QueryFromPalletsDef, TxFromPalletsDef, EventsFromPalletsDef, ErrorsFromPalletsDef, ConstFromPalletsDef, SS58String, FixedSizeBinary, Binary, FixedSizeArray } from "polkadot-api";
2
- import { I5sesotjlssv2d, Ifj0li5nn5unet, I4c0s5cioidn76, I8ikpj86u2na1q, Ibn3i0ad6beo5l, I1p5pqg6bllgtl, I9jd27rnpm8ttv, I4ojmnsk1dchql, Iesq88051ch8ht, Ic02kut0350gb0, I6ouflveob4eli, Ifn6q3equiq9qi, In7a38730s6qs, If15el53dd76v9, I9s0ave7t0vnrk, Ic6nglu2db2c36, Ie5fbn0f5capo3, Ia9ai1mp1viqjd, Ievca65alkkho9, I2qkf9i0e8mf1f, Iet9su1uri0qgo, I242odhgbhik24, Ifmc9boeeia623, I4g15ko4u63fja, I426moodfs3rr2 } from "./common-types";
1
+ import { StorageDescriptor, PlainDescriptor, TxDescriptor, RuntimeDescriptor, Enum, ApisFromDef, QueryFromPalletsDef, TxFromPalletsDef, EventsFromPalletsDef, ErrorsFromPalletsDef, ConstFromPalletsDef, ViewFnsFromPalletsDef, SS58String, FixedSizeBinary, Binary, FixedSizeArray } from "polkadot-api";
2
+ import { I5sesotjlssv2d, Ifj0li5nn5unet, I4c0s5cioidn76, I8ikpj86u2na1q, Ibn3i0ad6beo5l, I1p5pqg6bllgtl, I9jd27rnpm8ttv, I4ojmnsk1dchql, Iesq88051ch8ht, Ic02kut0350gb0, I6ouflveob4eli, Ifn6q3equiq9qi, In7a38730s6qs, If15el53dd76v9, I9s0ave7t0vnrk, Ic6nglu2db2c36, Ie5fbn0f5capo3, Ia9ai1mp1viqjd, Ievca65alkkho9, I2qkf9i0e8mf1f, Ib0voua2mn0e9p, I2lu1qfhumniu5, Ii64qoo6q5lth, If1007933akv96, Ifmc9boeeia623, I4g15ko4u63fja, I95g6i7ilua7lq, I35p85j063s0il, Id5qsstfl1fkb3, I3ii6nera7pkr8, Idje2mkckfs5v1 } from "./common-types";
3
3
  type AnonymousEnum<T extends {}> = T & {
4
4
  __anonymous: true;
5
5
  };
@@ -104,85 +104,108 @@ type IStorage = {
104
104
  type ICalls = {
105
105
  Omnipool: {
106
106
  /**
107
- *Execute a swap of `asset_in` for `asset_out`.
107
+ * Execute a swap of `asset_in` for `asset_out`.
108
108
  *
109
- *Price is determined by the Omnipool.
109
+ * Price is determined by the Omnipool.
110
110
  *
111
- *Hub asset is traded separately.
111
+ * Hub asset is traded separately.
112
112
  *
113
- *Asset's tradable states must contain SELL flag for asset_in and BUY flag for asset_out, otherwise `NotAllowed` error is returned.
113
+ * Asset's tradable states must contain SELL flag for asset_in and BUY flag for asset_out, otherwise `NotAllowed` error is returned.
114
114
  *
115
- *Parameters:
116
- *- `asset_in`: ID of asset sold to the pool
117
- *- `asset_out`: ID of asset bought from the pool
118
- *- `amount`: Amount of asset sold
119
- *- `min_buy_amount`: Minimum amount required to receive
115
+ * Parameters:
116
+ * - `asset_in`: ID of asset sold to the pool
117
+ * - `asset_out`: ID of asset bought from the pool
118
+ * - `amount`: Amount of asset sold
119
+ * - `min_buy_amount`: Minimum amount required to receive
120
120
  *
121
- *Emits `SellExecuted` event when successful. Deprecated.
122
- *Emits `pallet_broadcast::Swapped` event when successful.
121
+ * Emits `SellExecuted` event when successful. Deprecated.
122
+ * Emits `pallet_broadcast::Swapped` event when successful.
123
123
  *
124
124
  */
125
125
  sell: TxDescriptor<Anonymize<Ievca65alkkho9>>;
126
126
  /**
127
- *Execute a swap of `asset_out` for `asset_in`.
127
+ * Execute a swap of `asset_out` for `asset_in`.
128
128
  *
129
- *Price is determined by the Omnipool.
129
+ * Price is determined by the Omnipool.
130
130
  *
131
- *Hub asset is traded separately.
131
+ * Hub asset is traded separately.
132
132
  *
133
- *Asset's tradable states must contain SELL flag for asset_in and BUY flag for asset_out, otherwise `NotAllowed` error is returned.
133
+ * Asset's tradable states must contain SELL flag for asset_in and BUY flag for asset_out, otherwise `NotAllowed` error is returned.
134
134
  *
135
- *Parameters:
136
- *- `asset_in`: ID of asset sold to the pool
137
- *- `asset_out`: ID of asset bought from the pool
138
- *- `amount`: Amount of asset sold
139
- *- `max_sell_amount`: Maximum amount to be sold.
135
+ * Parameters:
136
+ * - `asset_in`: ID of asset sold to the pool
137
+ * - `asset_out`: ID of asset bought from the pool
138
+ * - `amount`: Amount of asset sold
139
+ * - `max_sell_amount`: Maximum amount to be sold.
140
140
  *
141
- *Emits `BuyExecuted` event when successful. Deprecated.
142
- *Emits `pallet_broadcast::Swapped` event when successful.
141
+ * Emits `BuyExecuted` event when successful. Deprecated.
142
+ * Emits `pallet_broadcast::Swapped` event when successful.
143
143
  *
144
144
  */
145
145
  buy: TxDescriptor<Anonymize<I2qkf9i0e8mf1f>>;
146
146
  };
147
147
  Router: {
148
148
  /**
149
- *Executes a sell with a series of trades specified in the route.
150
- *The price for each trade is determined by the corresponding AMM.
149
+ * Executes a sell with a series of trades specified in the route.
150
+ * The price for each trade is determined by the corresponding AMM.
151
151
  *
152
- *- `origin`: The executor of the trade
153
- *- `asset_in`: The identifier of the asset to sell
154
- *- `asset_out`: The identifier of the asset to receive
155
- *- `amount_in`: The amount of `asset_in` to sell
156
- *- `min_amount_out`: The minimum amount of `asset_out` to receive.
157
- *- `route`: Series of [`Trade<AssetId>`] to be executed. A [`Trade<AssetId>`] specifies the asset pair (`asset_in`, `asset_out`) and the AMM (`pool`) in which the trade is executed.
158
- * If not specified, than the on-chain route is used.
159
- * If no on-chain is present, then omnipool route is used as default
152
+ * - `origin`: The executor of the trade
153
+ * - `asset_in`: The identifier of the asset to sell
154
+ * - `asset_out`: The identifier of the asset to receive
155
+ * - `amount_in`: The amount of `asset_in` to sell
156
+ * - `min_amount_out`: The minimum amount of `asset_out` to receive.
157
+ * - `route`: Series of [`Trade<AssetId>`] to be executed. A [`Trade<AssetId>`] specifies the asset pair (`asset_in`, `asset_out`) and the AMM (`pool`) in which the trade is executed.
158
+ * If not specified, than the on-chain route is used.
159
+ * If no on-chain is present, then omnipool route is used as default
160
160
  *
161
- *Emits `RouteExecuted` when successful.
161
+ * Emits `RouteExecuted` when successful.
162
162
  */
163
- sell: TxDescriptor<Anonymize<Iet9su1uri0qgo>>;
163
+ sell: TxDescriptor<Anonymize<Ib0voua2mn0e9p>>;
164
164
  /**
165
- *Executes a buy with a series of trades specified in the route.
166
- *The price for each trade is determined by the corresponding AMM.
165
+ * Executes a buy with a series of trades specified in the route.
166
+ * The price for each trade is determined by the corresponding AMM.
167
167
  *
168
- *- `origin`: The executor of the trade
169
- *- `asset_in`: The identifier of the asset to be swapped to buy `asset_out`
170
- *- `asset_out`: The identifier of the asset to buy
171
- *- `amount_out`: The amount of `asset_out` to buy
172
- *- `max_amount_in`: The max amount of `asset_in` to spend on the buy.
173
- *- `route`: Series of [`Trade<AssetId>`] to be executed. A [`Trade<AssetId>`] specifies the asset pair (`asset_in`, `asset_out`) and the AMM (`pool`) in which the trade is executed.
174
- * If not specified, than the on-chain route is used.
175
- * If no on-chain is present, then omnipool route is used as default
168
+ * - `origin`: The executor of the trade
169
+ * - `asset_in`: The identifier of the asset to be swapped to buy `asset_out`
170
+ * - `asset_out`: The identifier of the asset to buy
171
+ * - `amount_out`: The amount of `asset_out` to buy
172
+ * - `max_amount_in`: The max amount of `asset_in` to spend on the buy.
173
+ * - `route`: Series of [`Trade<AssetId>`] to be executed. A [`Trade<AssetId>`] specifies the asset pair (`asset_in`, `asset_out`) and the AMM (`pool`) in which the trade is executed.
174
+ * If not specified, than the on-chain route is used.
175
+ * If no on-chain is present, then omnipool route is used as default
176
176
  *
177
- *Emits `RouteExecuted` when successful.
177
+ * Emits `RouteExecuted` when successful.
178
178
  */
179
- buy: TxDescriptor<Anonymize<I242odhgbhik24>>;
179
+ buy: TxDescriptor<Anonymize<I2lu1qfhumniu5>>;
180
+ /**
181
+ * Executes a sell with a series of trades specified in the route.
182
+ * It sells all reducible user balance of `asset_in`
183
+ * The price for each trade is determined by the corresponding AMM.
184
+ *
185
+ * - `origin`: The executor of the trade
186
+ * - `asset_in`: The identifier of the asset to sell
187
+ * - `asset_out`: The identifier of the asset to receive
188
+ * - `min_amount_out`: The minimum amount of `asset_out` to receive.
189
+ * - `route`: Series of [`Trade<AssetId>`] to be executed. A [`Trade<AssetId>`] specifies the asset pair (`asset_in`, `asset_out`) and the AMM (`pool`) in which the trade is executed.
190
+ * If not specified, than the on-chain route is used.
191
+ * If no on-chain is present, then omnipool route is used as default
192
+ *
193
+ * Emits `RouteExecuted` when successful.
194
+ *
195
+ */
196
+ sell_all: TxDescriptor<Anonymize<Ii64qoo6q5lth>>;
180
197
  };
181
198
  };
182
199
  type IEvent = {
200
+ Router: {
201
+ /**
202
+ * The route with trades has been successfully executed
203
+ */
204
+ Executed: PlainDescriptor<Anonymize<If1007933akv96>>;
205
+ };
183
206
  EVM: {
184
207
  /**
185
- *Ethereum events from contracts.
208
+ * Ethereum events from contracts.
186
209
  */
187
210
  Log: PlainDescriptor<Anonymize<Ifmc9boeeia623>>;
188
211
  };
@@ -334,6 +357,7 @@ type IConstants = {
334
357
  OracleSource: PlainDescriptor<FixedSizeBinary<8>>;
335
358
  };
336
359
  };
360
+ type IViewFns = {};
337
361
  type IRuntimeCalls = {
338
362
  /**
339
363
 
@@ -352,6 +376,27 @@ type IRuntimeCalls = {
352
376
  */
353
377
  free_balance: RuntimeDescriptor<[asset_id: number, who: SS58String], bigint>;
354
378
  };
379
+ /**
380
+
381
+ */
382
+ AaveTradeExecutor: {
383
+ /**
384
+
385
+ */
386
+ pairs: RuntimeDescriptor<[], Anonymize<I95g6i7ilua7lq>>;
387
+ /**
388
+
389
+ */
390
+ liquidity_depth: RuntimeDescriptor<[asset_in: number, asset_out: number], Anonymize<I35p85j063s0il>>;
391
+ /**
392
+
393
+ */
394
+ pool: RuntimeDescriptor<[reserve: number, atoken: number], Anonymize<Id5qsstfl1fkb3>>;
395
+ /**
396
+
397
+ */
398
+ pools: RuntimeDescriptor<[], Anonymize<I3ii6nera7pkr8>>;
399
+ };
355
400
  };
356
401
  type IAsset = PlainDescriptor<void>;
357
402
  export type HydrationDispatchError = unknown;
@@ -361,6 +406,7 @@ type PalletsTypedef = {
361
406
  __event: IEvent;
362
407
  __error: IError;
363
408
  __const: IConstants;
409
+ __view: IViewFns;
364
410
  };
365
411
  type IDescriptors = {
366
412
  descriptors: {
@@ -374,18 +420,20 @@ type IDescriptors = {
374
420
  };
375
421
  declare const _allDescriptors: IDescriptors;
376
422
  export default _allDescriptors;
423
+ export type HydrationApis = ApisFromDef<IRuntimeCalls>;
377
424
  export type HydrationQueries = QueryFromPalletsDef<PalletsTypedef>;
378
425
  export type HydrationCalls = TxFromPalletsDef<PalletsTypedef>;
379
426
  export type HydrationEvents = EventsFromPalletsDef<PalletsTypedef>;
380
427
  export type HydrationErrors = ErrorsFromPalletsDef<PalletsTypedef>;
381
428
  export type HydrationConstants = ConstFromPalletsDef<PalletsTypedef>;
382
- export type HydrationCallData = Anonymize<I426moodfs3rr2> & {
429
+ export type HydrationViewFns = ViewFnsFromPalletsDef<PalletsTypedef>;
430
+ export type HydrationCallData = Anonymize<Idje2mkckfs5v1> & {
383
431
  value: {
384
432
  type: string;
385
433
  };
386
434
  };
387
- export type HydrationWhitelistEntry = PalletKey | ApiKey<IRuntimeCalls> | `query.${NestedKey<PalletsTypedef['__storage']>}` | `tx.${NestedKey<PalletsTypedef['__tx']>}` | `event.${NestedKey<PalletsTypedef['__event']>}` | `error.${NestedKey<PalletsTypedef['__error']>}` | `const.${NestedKey<PalletsTypedef['__const']>}`;
388
- type PalletKey = `*.${keyof (IStorage & ICalls & IEvent & IError & IConstants & IRuntimeCalls)}`;
435
+ export type HydrationWhitelistEntry = PalletKey | ApiKey<IRuntimeCalls> | `query.${NestedKey<PalletsTypedef['__storage']>}` | `tx.${NestedKey<PalletsTypedef['__tx']>}` | `event.${NestedKey<PalletsTypedef['__event']>}` | `error.${NestedKey<PalletsTypedef['__error']>}` | `const.${NestedKey<PalletsTypedef['__const']>}` | `view.${NestedKey<PalletsTypedef['__view']>}`;
436
+ type PalletKey = `*.${keyof (IStorage & ICalls & IEvent & IError & IConstants & IRuntimeCalls & IViewFns)}`;
389
437
  type NestedKey<D extends Record<string, Record<string, any>>> = "*" | {
390
438
  [P in keyof D & string]: `${P}.*` | {
391
439
  [N in keyof D[P] & string]: `${P}.${N}`;