@galacticcouncil/descriptors 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.
@@ -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":14},"6":{"Pools":16,"AssetTradability":17},"7":{"7":19},"8":{"PoolData":20},"9":{"PoolAssets":22},"10":{"TotalIssuance":24,"Accounts":25},"11":0,"12":{"ValidationData":27}},"tx":{"0":0,"2":0,"3":{"13":10,"14":11},"4":{"13":12,"14":13},"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"events":{"0":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":{"Log":26},"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":15,"ProtocolFeeParameters":15},"6":{"17":9,"18":9,"AmplificationRange":18},"7":0,"8":{"15":9,"16":9,"17":9,"18":9,"repay_fee":21},"9":{"15":9,"16":9,"17":9,"18":9,"NativeAssetId":1,"GetExchangeFee":21,"OracleSource":23},"10":0,"11":0,"12":0},"apis":{"CurrenciesApi":{"account":28,"accounts":29,"free_balance":30}}}},[{}],["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
+ };
@@ -0,0 +1 @@
1
+ export declare const Hydration: Record<string, object>;
@@ -0,0 +1,398 @@
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";
3
+ type AnonymousEnum<T extends {}> = T & {
4
+ __anonymous: true;
5
+ };
6
+ type MyTuple<T> = [T, ...T[]];
7
+ type SeparateUndefined<T> = undefined extends T ? undefined | Exclude<T, undefined> : T;
8
+ type Anonymize<T> = SeparateUndefined<T extends FixedSizeBinary<infer L> ? number extends L ? Binary : FixedSizeBinary<L> : T extends string | number | bigint | boolean | void | undefined | null | symbol | Uint8Array | Enum<any> ? T : T extends AnonymousEnum<infer V> ? Enum<V> : T extends MyTuple<any> ? {
9
+ [K in keyof T]: T[K];
10
+ } : T extends [] ? [] : T extends FixedSizeArray<infer L, infer T> ? number extends L ? Array<T> : FixedSizeArray<L, T> : {
11
+ [K in keyof T & string]: T[K];
12
+ }>;
13
+ type IStorage = {
14
+ System: {
15
+ /**
16
+ * The full account information for a particular account ID.
17
+ */
18
+ Account: StorageDescriptor<[Key: SS58String], Anonymize<I5sesotjlssv2d>, false, never>;
19
+ /**
20
+ * The current block number being processed. Set by `execute_block`.
21
+ */
22
+ Number: StorageDescriptor<[], number, false, never>;
23
+ };
24
+ AssetRegistry: {
25
+ /**
26
+ * Details of an asset.
27
+ */
28
+ Assets: StorageDescriptor<[Key: number], Anonymize<Ifj0li5nn5unet>, true, never>;
29
+ /**
30
+ * Native location of an asset.
31
+ */
32
+ AssetLocations: StorageDescriptor<[Key: number], Anonymize<I4c0s5cioidn76>, true, never>;
33
+ };
34
+ Omnipool: {
35
+ /**
36
+ * State of an asset in the omnipool
37
+ */
38
+ Assets: StorageDescriptor<[Key: number], Anonymize<I8ikpj86u2na1q>, true, never>;
39
+ /**
40
+ * Tradable state of hub asset.
41
+ */
42
+ HubAssetTradability: StorageDescriptor<[], number, false, never>;
43
+ };
44
+ DynamicFees: {
45
+ /**
46
+ * Stores last calculated fee of an asset and block number in which it was changed..
47
+ * Stored as (Asset fee, Protocol fee, Block number)
48
+ */
49
+ AssetFee: StorageDescriptor<[Key: number], Anonymize<Ibn3i0ad6beo5l>, true, never>;
50
+ };
51
+ Stableswap: {
52
+ /**
53
+ * Existing pools
54
+ */
55
+ Pools: StorageDescriptor<[Key: number], Anonymize<I1p5pqg6bllgtl>, true, never>;
56
+ /**
57
+ * Tradability state of pool assets.
58
+ */
59
+ AssetTradability: StorageDescriptor<Anonymize<I9jd27rnpm8ttv>, number, false, never>;
60
+ };
61
+ Bonds: {
62
+ /**
63
+ * Registered bonds.
64
+ * Maps bond ID -> (underlying asset ID, maturity)
65
+ */
66
+ Bonds: StorageDescriptor<[Key: number], Anonymize<I4ojmnsk1dchql>, true, never>;
67
+ };
68
+ LBP: {
69
+ /**
70
+ * Details of a pool.
71
+ */
72
+ PoolData: StorageDescriptor<[Key: SS58String], Anonymize<Iesq88051ch8ht>, true, never>;
73
+ };
74
+ XYK: {
75
+ /**
76
+ * Asset pair in a pool.
77
+ */
78
+ PoolAssets: StorageDescriptor<[Key: SS58String], Anonymize<I9jd27rnpm8ttv>, true, never>;
79
+ };
80
+ Tokens: {
81
+ /**
82
+ * The total issuance of a token type.
83
+ */
84
+ TotalIssuance: StorageDescriptor<[Key: number], bigint, false, never>;
85
+ /**
86
+ * The balance of a token type under an account.
87
+ *
88
+ * NOTE: If the total is ever zero, decrease account ref account.
89
+ *
90
+ * NOTE: This is only used in the case that this module is used to store
91
+ * balances.
92
+ */
93
+ Accounts: StorageDescriptor<Anonymize<I6ouflveob4eli>, Anonymize<Ic02kut0350gb0>, false, never>;
94
+ };
95
+ ParachainSystem: {
96
+ /**
97
+ * The [`PersistedValidationData`] set for this block.
98
+ * This value is expected to be set only once per block and it's never stored
99
+ * in the trie.
100
+ */
101
+ ValidationData: StorageDescriptor<[], Anonymize<Ifn6q3equiq9qi>, true, never>;
102
+ };
103
+ };
104
+ type ICalls = {
105
+ Omnipool: {
106
+ /**
107
+ *Execute a swap of `asset_in` for `asset_out`.
108
+ *
109
+ *Price is determined by the Omnipool.
110
+ *
111
+ *Hub asset is traded separately.
112
+ *
113
+ *Asset's tradable states must contain SELL flag for asset_in and BUY flag for asset_out, otherwise `NotAllowed` error is returned.
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
120
+ *
121
+ *Emits `SellExecuted` event when successful. Deprecated.
122
+ *Emits `pallet_broadcast::Swapped` event when successful.
123
+ *
124
+ */
125
+ sell: TxDescriptor<Anonymize<Ievca65alkkho9>>;
126
+ /**
127
+ *Execute a swap of `asset_out` for `asset_in`.
128
+ *
129
+ *Price is determined by the Omnipool.
130
+ *
131
+ *Hub asset is traded separately.
132
+ *
133
+ *Asset's tradable states must contain SELL flag for asset_in and BUY flag for asset_out, otherwise `NotAllowed` error is returned.
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.
140
+ *
141
+ *Emits `BuyExecuted` event when successful. Deprecated.
142
+ *Emits `pallet_broadcast::Swapped` event when successful.
143
+ *
144
+ */
145
+ buy: TxDescriptor<Anonymize<I2qkf9i0e8mf1f>>;
146
+ };
147
+ Router: {
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.
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
160
+ *
161
+ *Emits `RouteExecuted` when successful.
162
+ */
163
+ sell: TxDescriptor<Anonymize<Iet9su1uri0qgo>>;
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.
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
176
+ *
177
+ *Emits `RouteExecuted` when successful.
178
+ */
179
+ buy: TxDescriptor<Anonymize<I242odhgbhik24>>;
180
+ };
181
+ };
182
+ type IEvent = {
183
+ EVM: {
184
+ /**
185
+ *Ethereum events from contracts.
186
+ */
187
+ Log: PlainDescriptor<Anonymize<Ifmc9boeeia623>>;
188
+ };
189
+ };
190
+ type IError = {};
191
+ type IConstants = {
192
+ System: {
193
+ /**
194
+ * Block & extrinsics weights: base values and limits.
195
+ */
196
+ BlockWeights: PlainDescriptor<Anonymize<In7a38730s6qs>>;
197
+ /**
198
+ * The maximum length of a block (in bytes).
199
+ */
200
+ BlockLength: PlainDescriptor<Anonymize<If15el53dd76v9>>;
201
+ /**
202
+ * Maximum number of block number to block hash mappings to keep (oldest pruned first).
203
+ */
204
+ BlockHashCount: PlainDescriptor<number>;
205
+ /**
206
+ * The weight of runtime database operations the runtime can invoke.
207
+ */
208
+ DbWeight: PlainDescriptor<Anonymize<I9s0ave7t0vnrk>>;
209
+ /**
210
+ * Get the chain's in-code version.
211
+ */
212
+ Version: PlainDescriptor<Anonymize<Ic6nglu2db2c36>>;
213
+ /**
214
+ * The designated SS58 prefix of this chain.
215
+ *
216
+ * This replaces the "ss58Format" property declared in the chain spec. Reason is
217
+ * that the runtime should know about the prefix in order to make use of it as
218
+ * an identifier of the chain.
219
+ */
220
+ SS58Prefix: PlainDescriptor<number>;
221
+ };
222
+ Omnipool: {
223
+ /**
224
+ * Native Asset ID
225
+ */
226
+ HdxAssetId: PlainDescriptor<number>;
227
+ /**
228
+ * Hub Asset ID
229
+ */
230
+ HubAssetId: PlainDescriptor<number>;
231
+ /**
232
+ * Minimum withdrawal fee
233
+ */
234
+ MinWithdrawalFee: PlainDescriptor<number>;
235
+ /**
236
+ * Minimum trading limit
237
+ */
238
+ MinimumTradingLimit: PlainDescriptor<bigint>;
239
+ /**
240
+ * Minimum pool liquidity which can be added
241
+ */
242
+ MinimumPoolLiquidity: PlainDescriptor<bigint>;
243
+ /**
244
+ * Max fraction of asset reserve to sell in single transaction
245
+ */
246
+ MaxInRatio: PlainDescriptor<bigint>;
247
+ /**
248
+ * Max fraction of asset reserve to buy in single transaction
249
+ */
250
+ MaxOutRatio: PlainDescriptor<bigint>;
251
+ /**
252
+ * Non fungible class id
253
+ */
254
+ NFTCollectionId: PlainDescriptor<bigint>;
255
+ /**
256
+
257
+ */
258
+ BurnProtocolFee: PlainDescriptor<number>;
259
+ };
260
+ DynamicFees: {
261
+ /**
262
+
263
+ */
264
+ AssetFeeParameters: PlainDescriptor<Anonymize<Ie5fbn0f5capo3>>;
265
+ /**
266
+
267
+ */
268
+ ProtocolFeeParameters: PlainDescriptor<Anonymize<Ie5fbn0f5capo3>>;
269
+ };
270
+ Stableswap: {
271
+ /**
272
+ * Minimum pool liquidity
273
+ */
274
+ MinPoolLiquidity: PlainDescriptor<bigint>;
275
+ /**
276
+ * Minimum trading amount
277
+ */
278
+ MinTradingLimit: PlainDescriptor<bigint>;
279
+ /**
280
+ * Amplification inclusive range. Pool's amp can be selected from the range only.
281
+ */
282
+ AmplificationRange: PlainDescriptor<Anonymize<Ia9ai1mp1viqjd>>;
283
+ };
284
+ LBP: {
285
+ /**
286
+ * Minimum trading limit, sole purpose of this is to keep the math working
287
+ */
288
+ MinTradingLimit: PlainDescriptor<bigint>;
289
+ /**
290
+ * Minimum pool liquidity, sole purpose of this is to keep the math working
291
+ */
292
+ MinPoolLiquidity: PlainDescriptor<bigint>;
293
+ /**
294
+ * Max fraction of pool to sell in single transaction
295
+ */
296
+ MaxInRatio: PlainDescriptor<bigint>;
297
+ /**
298
+ * Max fraction of pool to buy in single transaction
299
+ */
300
+ MaxOutRatio: PlainDescriptor<bigint>;
301
+ /**
302
+
303
+ */
304
+ repay_fee: PlainDescriptor<Anonymize<I9jd27rnpm8ttv>>;
305
+ };
306
+ XYK: {
307
+ /**
308
+ * Native Asset Id
309
+ */
310
+ NativeAssetId: PlainDescriptor<number>;
311
+ /**
312
+ * Trading fee rate
313
+ */
314
+ GetExchangeFee: PlainDescriptor<Anonymize<I9jd27rnpm8ttv>>;
315
+ /**
316
+ * Minimum trading limit
317
+ */
318
+ MinTradingLimit: PlainDescriptor<bigint>;
319
+ /**
320
+ * Minimum pool liquidity
321
+ */
322
+ MinPoolLiquidity: PlainDescriptor<bigint>;
323
+ /**
324
+ * Max fraction of pool to sell in single transaction
325
+ */
326
+ MaxInRatio: PlainDescriptor<bigint>;
327
+ /**
328
+ * Max fraction of pool to buy in single transaction
329
+ */
330
+ MaxOutRatio: PlainDescriptor<bigint>;
331
+ /**
332
+ * Oracle source identifier for this pallet.
333
+ */
334
+ OracleSource: PlainDescriptor<FixedSizeBinary<8>>;
335
+ };
336
+ };
337
+ type IRuntimeCalls = {
338
+ /**
339
+
340
+ */
341
+ CurrenciesApi: {
342
+ /**
343
+
344
+ */
345
+ account: RuntimeDescriptor<[asset_id: number, who: SS58String], Anonymize<Ic02kut0350gb0>>;
346
+ /**
347
+
348
+ */
349
+ accounts: RuntimeDescriptor<[who: SS58String], Anonymize<I4g15ko4u63fja>>;
350
+ /**
351
+
352
+ */
353
+ free_balance: RuntimeDescriptor<[asset_id: number, who: SS58String], bigint>;
354
+ };
355
+ };
356
+ type IAsset = PlainDescriptor<void>;
357
+ export type HydrationDispatchError = unknown;
358
+ type PalletsTypedef = {
359
+ __storage: IStorage;
360
+ __tx: ICalls;
361
+ __event: IEvent;
362
+ __error: IError;
363
+ __const: IConstants;
364
+ };
365
+ type IDescriptors = {
366
+ descriptors: {
367
+ pallets: PalletsTypedef;
368
+ apis: IRuntimeCalls;
369
+ } & Promise<any>;
370
+ metadataTypes: Promise<Uint8Array>;
371
+ asset: IAsset;
372
+ getMetadata: () => Promise<Uint8Array>;
373
+ genesis: string | undefined;
374
+ };
375
+ declare const _allDescriptors: IDescriptors;
376
+ export default _allDescriptors;
377
+ export type HydrationQueries = QueryFromPalletsDef<PalletsTypedef>;
378
+ export type HydrationCalls = TxFromPalletsDef<PalletsTypedef>;
379
+ export type HydrationEvents = EventsFromPalletsDef<PalletsTypedef>;
380
+ export type HydrationErrors = ErrorsFromPalletsDef<PalletsTypedef>;
381
+ export type HydrationConstants = ConstFromPalletsDef<PalletsTypedef>;
382
+ export type HydrationCallData = Anonymize<I426moodfs3rr2> & {
383
+ value: {
384
+ type: string;
385
+ };
386
+ };
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)}`;
389
+ type NestedKey<D extends Record<string, Record<string, any>>> = "*" | {
390
+ [P in keyof D & string]: `${P}.*` | {
391
+ [N in keyof D[P] & string]: `${P}.${N}`;
392
+ }[keyof D[P] & string];
393
+ }[keyof D & string];
394
+ type ApiKey<D extends Record<string, Record<string, any>>> = "api.*" | {
395
+ [P in keyof D & string]: `api.${P}.*` | {
396
+ [N in keyof D[P] & string]: `api.${P}.${N}`;
397
+ }[keyof D[P] & string];
398
+ }[keyof D & string];