@moonbeam-network/xcm-config 2.7.9 → 3.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/build/index.d.ts CHANGED
@@ -1,145 +1,149 @@
1
- import {
2
- Asset,
3
- AnyChain,
4
- Ecosystem,
5
- Parachain,
6
- EvmParachain,
7
- } from '@moonbeam-network/xcm-types';
8
- import {
9
- BalanceConfigBuilder,
10
- ContractConfigBuilder,
11
- ExtrinsicConfigBuilder,
12
- AssetMinConfigBuilder,
13
- FeeConfigBuilder,
14
- } from '@moonbeam-network/xcm-builder';
1
+ import { Asset, AnyChain, SetOptional, ChainAsset, AnyAsset, Ecosystem, Parachain, EvmParachain, EvmChain } from '@moonbeam-network/xcm-types';
2
+ import { ContractConfigBuilder, ExtrinsicConfigBuilder, BalanceConfigBuilder, AssetMinConfigBuilder, MrlConfigBuilder, FeeConfigBuilder } from '@moonbeam-network/xcm-builder';
15
3
 
16
- interface AssetConfigConstructorParams {
17
- asset: Asset;
18
- balance: BalanceConfigBuilder;
19
- contract?: ContractConfigBuilder;
20
- destination: AnyChain;
21
- destinationFee: DestinationFeeConfig;
22
- extrinsic?: ExtrinsicConfigBuilder;
23
- fee?: FeeAssetConfig;
24
- min?: AssetMinConfigBuilder;
4
+ interface AssetRouteConstructorParams {
5
+ source: SourceConfig;
6
+ destination: DestinationConfig;
7
+ contract?: ContractConfigBuilder;
8
+ extrinsic?: ExtrinsicConfigBuilder;
9
+ mrl?: MrlConfig;
25
10
  }
26
- interface DestinationFeeConfig extends FeeAssetConfig {
27
- amount: number | FeeConfigBuilder;
28
- destinationBalance?: BalanceConfigBuilder;
11
+ interface SourceConfig {
12
+ asset: Asset;
13
+ chain: AnyChain;
14
+ balance: BalanceConfigBuilder;
15
+ fee?: FeeConfig;
16
+ destinationFee?: {
17
+ asset?: Asset;
18
+ balance: BalanceConfigBuilder;
19
+ };
20
+ min?: AssetMinConfigBuilder;
29
21
  }
30
- interface FeeAssetConfig {
31
- asset: Asset;
32
- balance: BalanceConfigBuilder;
33
- xcmDeliveryFeeAmount?: number;
22
+ interface DestinationConfig extends Omit<SourceConfig, 'fee'> {
23
+ fee: DestinationFeeConfig;
34
24
  }
35
- declare class AssetConfig {
36
- readonly asset: Asset;
37
- readonly balance: BalanceConfigBuilder;
38
- readonly contract?: ContractConfigBuilder;
39
- readonly destination: AnyChain;
40
- readonly destinationFee: DestinationFeeConfig;
41
- readonly extrinsic?: ExtrinsicConfigBuilder;
42
- readonly fee?: FeeAssetConfig;
43
- readonly min?: AssetMinConfigBuilder;
44
- constructor({
45
- asset,
46
- balance,
47
- contract,
48
- destination,
49
- destinationFee,
50
- extrinsic,
51
- fee,
52
- min,
53
- }: AssetConfigConstructorParams);
25
+ interface FeeConfig {
26
+ asset: Asset;
27
+ balance: BalanceConfigBuilder;
28
+ extra?: number;
54
29
  }
55
-
56
- interface ChainConfigConstructorParams {
57
- assets: AssetConfig[];
58
- chain: AnyChain;
30
+ interface MrlConfig {
31
+ isAutomaticPossible: boolean;
32
+ transfer: MrlConfigBuilder;
33
+ moonChain: MoonChainConfig;
34
+ }
35
+ interface DestinationFeeConfig extends SetOptional<FeeConfig, 'balance'> {
36
+ amount: number | FeeConfigBuilder;
37
+ }
38
+ interface MoonChainConfig {
39
+ asset: Asset;
40
+ balance: BalanceConfigBuilder;
41
+ fee: MoonChainFeeConfig;
42
+ }
43
+ interface MoonChainFeeConfig extends FeeConfig {
44
+ amount: number | FeeConfigBuilder;
59
45
  }
60
- declare class ChainConfig {
61
- #private;
62
- readonly chain: AnyChain;
63
- constructor({ assets, chain }: ChainConfigConstructorParams);
64
- getAssetsConfigs(): AssetConfig[];
65
- getAssetConfigs(asset: Asset): AssetConfig[];
66
- getAssetDestinations(asset: Asset): AnyChain[];
67
- getAssetDestinationConfig(asset: Asset, destination: AnyChain): AssetConfig;
46
+ declare class AssetRoute {
47
+ readonly source: SourceConfig;
48
+ readonly destination: DestinationConfig;
49
+ readonly contract?: ContractConfigBuilder;
50
+ readonly extrinsic?: ExtrinsicConfigBuilder;
51
+ readonly mrl?: MrlConfig;
52
+ constructor({ source, destination, contract, extrinsic, mrl, }: AssetRouteConstructorParams);
53
+ getDestinationFeeAssetOnSource(): ChainAsset;
68
54
  }
69
55
 
70
- interface IConfigService {
71
- getEcosystemAssets(ecosystem?: Ecosystem): Asset[];
72
- getAsset(keyOrAsset: string | Asset): Asset;
73
- getChain(keyOrAsset: string | AnyChain): AnyChain;
74
- getSourceChains(asset: Asset, ecosystem: Ecosystem | undefined): AnyChain[];
75
- getDestinationChains(asset: Asset, source: AnyChain): AnyChain[];
76
- getAssetDestinationConfig(
77
- asset: Asset,
78
- source: AnyChain,
79
- destination: AnyChain,
80
- ): AssetConfig;
56
+ interface ChainRoutesConstructorParams {
57
+ chain: AnyChain;
58
+ routes: RoutesParam[];
59
+ }
60
+ interface RoutesParam extends Omit<AssetRouteConstructorParams, 'source'> {
61
+ source: Omit<SourceConfig, 'chain'>;
62
+ }
63
+ declare class ChainRoutes {
64
+ #private;
65
+ readonly chain: AnyChain;
66
+ constructor({ chain, routes }: ChainRoutesConstructorParams);
67
+ getRoutes(): AssetRoute[];
68
+ getAssetRoutes(keyOrAsset: string | AnyAsset): AssetRoute[];
69
+ getAssetDestinations(keyOrAsset: string | AnyAsset): AnyChain[];
70
+ getDestinationAssets(keyOrChain: string | AnyChain): Asset[];
71
+ getAssetRoute(asset: string | AnyAsset, destination: string | AnyChain): AssetRoute;
81
72
  }
82
73
 
83
- interface ConfigServiceOptions {
84
- assets?: Map<string, Asset>;
85
- chains?: Map<string, AnyChain>;
86
- chainsConfig?: Map<string, ChainConfig>;
74
+ interface MrlAssetRouteConstructorParams extends AssetRouteConstructorParams {
75
+ source: MrlSourceConfig;
76
+ }
77
+ interface MrlSourceConfig extends SourceConfig {
78
+ moonChainFee?: {
79
+ asset: Asset;
80
+ balance: BalanceConfigBuilder;
81
+ };
87
82
  }
88
- declare class ConfigService implements IConfigService {
89
- protected assets: Map<string, Asset>;
90
- protected chains: Map<string, AnyChain>;
91
- protected chainsConfig: Map<string, ChainConfig>;
92
- constructor(options?: ConfigServiceOptions);
93
- getEcosystemAssets(ecosystem?: Ecosystem): Asset[];
94
- getAsset(keyOrAsset: string | Asset): Asset;
95
- getChain(keyOrAsset: string | AnyChain): AnyChain;
96
- getChainConfig(keyOrAsset: string | AnyChain): ChainConfig;
97
- getSourceChains(asset: Asset, ecosystem: Ecosystem | undefined): AnyChain[];
98
- getDestinationChains(asset: Asset, source: AnyChain): AnyChain[];
99
- getAssetDestinationConfig(
100
- asset: Asset,
101
- source: AnyChain,
102
- destination: AnyChain,
103
- ): AssetConfig;
104
- updateAsset(asset: Asset): void;
105
- updateChain(chain: AnyChain): void;
106
- updateChainConfig(chainConfig: ChainConfig): void;
83
+ declare class MrlAssetRoute extends AssetRoute {
84
+ readonly source: MrlSourceConfig;
85
+ constructor({ source, destination, contract, extrinsic, mrl, }: MrlAssetRouteConstructorParams & {
86
+ source: MrlSourceConfig;
87
+ });
107
88
  }
108
89
 
109
- interface TransferConfig {
110
- asset: Asset;
111
- source: ChainTransferConfig;
112
- destination: ChainTransferConfig;
90
+ interface MrlChainRoutesConstructorParams extends ChainRoutesConstructorParams {
91
+ routes: MrlRoutesParam[];
113
92
  }
114
- interface ChainTransferConfig {
115
- chain: AnyChain;
116
- config: AssetConfig;
93
+ interface MrlRoutesParam extends Omit<MrlAssetRouteConstructorParams, 'source'> {
94
+ source: Omit<MrlSourceConfig, 'chain'>;
95
+ }
96
+ declare class MrlChainRoutes extends ChainRoutes {
97
+ #private;
98
+ constructor({ chain, routes }: MrlChainRoutesConstructorParams);
99
+ getRoutes(): MrlAssetRoute[];
117
100
  }
118
101
 
119
- declare function ConfigBuilder(service?: IConfigService): {
120
- assets: (ecosystem?: Ecosystem) => {
121
- assets: Asset[];
122
- asset: (keyOrAsset: string | Asset) => {
123
- sourceChains: AnyChain[];
124
- source: (keyOrChain: string | AnyChain) => {
125
- destinationChains: AnyChain[];
126
- destination: (keyOrChain: string | AnyChain) => {
127
- build: () => TransferConfig;
128
- };
129
- };
130
- };
131
- };
132
- };
102
+ interface ConfigServiceOptions {
103
+ assets?: Map<string, Asset>;
104
+ chains?: Map<string, AnyChain>;
105
+ routes: Map<string, ChainRoutes | MrlChainRoutes>;
106
+ }
107
+ declare class ConfigService {
108
+ protected assets: Map<string, Asset>;
109
+ protected chains: Map<string, AnyChain>;
110
+ protected routes: Map<string, ChainRoutes | MrlChainRoutes>;
111
+ constructor(options: ConfigServiceOptions);
112
+ getAsset(keyOrAsset: string | Asset): Asset;
113
+ getEcosystemAssets(ecosystem?: Ecosystem): Asset[];
114
+ getChain(keyOrChain: string | AnyChain): AnyChain;
115
+ getChainRoutes(keyOrChain: string | AnyChain): ChainRoutes | MrlChainRoutes;
116
+ getSourceChains({ asset, ecosystem, }: {
117
+ asset?: string | Asset;
118
+ ecosystem?: Ecosystem;
119
+ }): AnyChain[];
120
+ getDestinationChains({ asset, source, }: {
121
+ asset?: string | AnyAsset;
122
+ source: string | AnyChain;
123
+ }): AnyChain[];
124
+ getAssetRoute({ asset, source, destination, }: {
125
+ asset: string | AnyAsset;
126
+ source: string | AnyChain;
127
+ destination: string | AnyChain;
128
+ }): AssetRoute | MrlAssetRoute;
129
+ getRouteAssets({ source, destination, }: {
130
+ source: string | AnyChain;
131
+ destination: string | AnyChain;
132
+ }): Asset[];
133
+ updateAsset(asset: Asset): void;
134
+ updateChain(chain: AnyChain): void;
135
+ updateChainRoute(route: ChainRoutes): void;
136
+ }
133
137
 
134
138
  declare const aca: Asset;
135
139
  declare const agng: Asset;
136
140
  declare const alan: Asset;
137
141
  declare const ampe: Asset;
138
142
  declare const apillon: Asset;
143
+ declare const aseed: Asset;
139
144
  declare const astr: Asset;
140
145
  declare const atom: Asset;
141
146
  declare const auq: Asset;
142
- declare const aseed: Asset;
143
147
  declare const axlusdc: Asset;
144
148
  declare const betaDEV: Asset;
145
149
  declare const bnc: Asset;
@@ -147,13 +151,16 @@ declare const bncs: Asset;
147
151
  declare const cfg: Asset;
148
152
  declare const crab: Asset;
149
153
  declare const csm: Asset;
154
+ declare const dai: Asset;
155
+ declare const ded: Asset;
150
156
  declare const dev: Asset;
151
157
  declare const dot: Asset;
152
158
  declare const eq: Asset;
153
159
  declare const eqd: Asset;
154
- declare const dai: Asset;
155
- declare const ded: Asset;
160
+ declare const eth: Asset;
156
161
  declare const fil: Asset;
162
+ declare const ftm: Asset;
163
+ declare const ftmwh: Asset;
157
164
  declare const glmr: Asset;
158
165
  declare const hdx: Asset;
159
166
  declare const ibtc: Asset;
@@ -168,8 +175,8 @@ declare const lit: Asset;
168
175
  declare const manta: Asset;
169
176
  declare const mgx: Asset;
170
177
  declare const movr: Asset;
171
- declare const nodl: Asset;
172
178
  declare const neuro: Asset;
179
+ declare const nodl: Asset;
173
180
  declare const otp: Asset;
174
181
  declare const para: Asset;
175
182
  declare const paring: Asset;
@@ -193,9 +200,6 @@ declare const usdc: Asset;
193
200
  declare const usdcwh: Asset;
194
201
  declare const usdt: Asset;
195
202
  declare const usdtwh: Asset;
196
- declare const wbtc: Asset;
197
- declare const weth: Asset;
198
- declare const wftm: Asset;
199
203
  declare const vastr: Asset;
200
204
  declare const vbnc: Asset;
201
205
  declare const vdot: Asset;
@@ -204,10 +208,12 @@ declare const vglmr: Asset;
204
208
  declare const vksm: Asset;
205
209
  declare const vmanta: Asset;
206
210
  declare const vmovr: Asset;
211
+ declare const wbtc: Asset;
212
+ declare const weth: Asset;
213
+ declare const wftm: Asset;
207
214
  declare const wifd: Asset;
208
215
  declare const xrt: Asset;
209
216
  declare const ztg: Asset;
210
- declare const ftmwh: Asset;
211
217
  declare const wbtce: Asset;
212
218
  declare const wstethe: Asset;
213
219
  declare const wethe: Asset;
@@ -225,10 +231,12 @@ declare const centrifuge: Parachain;
225
231
  declare const crustShadow: Parachain;
226
232
  declare const darwinia: EvmParachain;
227
233
  declare const darwiniaCrab: EvmParachain;
234
+ declare const ethereum: EvmChain;
235
+ declare const fantomTestnet: EvmChain;
228
236
  declare const hydration: Parachain;
229
237
  declare const hydrationAlphanet: Parachain;
230
- declare const interlay: Parachain;
231
238
  declare const integritee: Parachain;
239
+ declare const interlay: Parachain;
232
240
  declare const karura: Parachain;
233
241
  declare const khala: Parachain;
234
242
  declare const kintsugi: Parachain;
@@ -241,12 +249,11 @@ declare const moonbaseBeta: EvmParachain;
241
249
  declare const moonbeam: EvmParachain;
242
250
  declare const moonriver: EvmParachain;
243
251
  declare const neuroweb: Parachain;
244
- declare const nodle: Parachain;
245
252
  declare const originTrailAlphanet: Parachain;
246
253
  declare const peaqAlphanet: Parachain;
247
254
  declare const peaqChain: Parachain;
248
- declare const peaqEvmAlphanet: EvmParachain;
249
255
  declare const peaqEvm: EvmParachain;
256
+ declare const peaqEvmAlphanet: EvmParachain;
250
257
  declare const pendulum: Parachain;
251
258
  declare const pendulumAlphanet: Parachain;
252
259
  declare const phala: Parachain;
@@ -265,149 +272,13 @@ declare const zeitgeist: Parachain;
265
272
  declare const chainsList: AnyChain[];
266
273
  declare const chainsMap: Map<string, AnyChain>;
267
274
 
268
- export {
269
- AssetConfig,
270
- type AssetConfigConstructorParams,
271
- ChainConfig,
272
- type ChainConfigConstructorParams,
273
- type ChainTransferConfig,
274
- ConfigBuilder,
275
- ConfigService,
276
- type ConfigServiceOptions,
277
- type DestinationFeeConfig,
278
- type FeeAssetConfig,
279
- type IConfigService,
280
- type TransferConfig,
281
- aca,
282
- acala,
283
- agng,
284
- alan,
285
- alphanetAssetHub,
286
- alphanetRelay,
287
- ampe,
288
- apillon,
289
- aseed,
290
- assetsList,
291
- assetsMap,
292
- astar,
293
- astr,
294
- atom,
295
- auq,
296
- axlusdc,
297
- betaDEV,
298
- bifrostKusama,
299
- bifrostPolkadot,
300
- bnc,
301
- bncs,
302
- calamari,
303
- centrifuge,
304
- cfg,
305
- chainsList,
306
- chainsMap,
307
- crab,
308
- crustShadow,
309
- csm,
310
- dai,
311
- darwinia,
312
- darwiniaCrab,
313
- ded,
314
- dev,
315
- dot,
316
- eq,
317
- eqd,
318
- fil,
319
- ftmwh,
320
- glmr,
321
- hdx,
322
- hydration,
323
- hydrationAlphanet,
324
- ibtc,
325
- integritee,
326
- interlay,
327
- intr,
328
- kar,
329
- karura,
330
- kbtc,
331
- khala,
332
- kint,
333
- kintsugi,
334
- kma,
335
- ksm,
336
- kusama,
337
- kusamaAssetHub,
338
- ldot,
339
- lit,
340
- mangataKusama,
341
- manta,
342
- mantaParachain,
343
- mgx,
344
- moonbaseAlpha,
345
- moonbaseBeta,
346
- moonbeam,
347
- moonriver,
348
- movr,
349
- neuro,
350
- neuroweb,
351
- nodl,
352
- nodle,
353
- originTrailAlphanet,
354
- otp,
355
- para,
356
- paring,
357
- peaq,
358
- peaqAlphanet,
359
- peaqChain,
360
- peaqEvm,
361
- peaqEvmAlphanet,
362
- pen,
363
- pendulum,
364
- pendulumAlphanet,
365
- pha,
366
- phala,
367
- pica,
368
- picasso,
369
- picassoAlphanet,
370
- pink,
371
- polkadot,
372
- polkadotAssetHub,
373
- ring,
374
- rmrk,
375
- robonomics,
376
- sdn,
377
- shiden,
378
- soon,
379
- stink,
380
- sub,
381
- subsocial,
382
- teer,
383
- tinkernet,
384
- tnkr,
385
- tt1,
386
- tur,
387
- turing,
388
- turingAlphanet,
389
- uniqueAlpha,
390
- unit,
391
- usdc,
392
- usdcwh,
393
- usdt,
394
- usdtwh,
395
- vastr,
396
- vbnc,
397
- vdot,
398
- vfil,
399
- vglmr,
400
- vksm,
401
- vmanta,
402
- vmovr,
403
- wbtc,
404
- wbtce,
405
- weth,
406
- wethe,
407
- wftm,
408
- wifd,
409
- wstethe,
410
- xrt,
411
- zeitgeist,
412
- ztg,
413
- };
275
+ declare function getKey(keyOrModel: string | AnyAsset | AnyChain): string;
276
+ declare function getMoonChain(chain: AnyChain): EvmParachain;
277
+
278
+ declare const mrlRoutesList: MrlChainRoutes[];
279
+ declare const mrlRoutesMap: Map<string, MrlChainRoutes>;
280
+
281
+ declare const xcmRoutesList: ChainRoutes[];
282
+ declare const xcmRoutesMap: Map<string, ChainRoutes>;
283
+
284
+ export { AssetRoute, type AssetRouteConstructorParams, ChainRoutes, type ChainRoutesConstructorParams, ConfigService, type ConfigServiceOptions, type DestinationConfig, type DestinationFeeConfig, type FeeConfig, type MoonChainConfig, type MoonChainFeeConfig, MrlAssetRoute, type MrlAssetRouteConstructorParams, MrlChainRoutes, type MrlChainRoutesConstructorParams, type MrlConfig, type MrlSourceConfig, type SourceConfig, aca, acala, agng, alan, alphanetAssetHub, alphanetRelay, ampe, apillon, aseed, assetsList, assetsMap, astar, astr, atom, auq, axlusdc, betaDEV, bifrostKusama, bifrostPolkadot, bnc, bncs, calamari, centrifuge, cfg, chainsList, chainsMap, crab, crustShadow, csm, dai, darwinia, darwiniaCrab, ded, dev, dot, eq, eqd, eth, ethereum, fantomTestnet, fil, ftm, ftmwh, getKey, getMoonChain, glmr, hdx, hydration, hydrationAlphanet, ibtc, integritee, interlay, intr, kar, karura, kbtc, khala, kint, kintsugi, kma, ksm, kusama, kusamaAssetHub, ldot, lit, mangataKusama, manta, mantaParachain, mgx, moonbaseAlpha, moonbaseBeta, moonbeam, moonriver, movr, mrlRoutesList, mrlRoutesMap, neuro, neuroweb, nodl, originTrailAlphanet, otp, para, paring, peaq, peaqAlphanet, peaqChain, peaqEvm, peaqEvmAlphanet, pen, pendulum, pendulumAlphanet, pha, phala, pica, picasso, picassoAlphanet, pink, polkadot, polkadotAssetHub, ring, rmrk, robonomics, sdn, shiden, soon, stink, sub, subsocial, teer, tinkernet, tnkr, tt1, tur, turing, turingAlphanet, uniqueAlpha, unit, usdc, usdcwh, usdt, usdtwh, vastr, vbnc, vdot, vfil, vglmr, vksm, vmanta, vmovr, wbtc, wbtce, weth, wethe, wftm, wifd, wstethe, xcmRoutesList, xcmRoutesMap, xrt, zeitgeist, ztg };