@moonbeam-network/xcm-config 1.0.0-dev.156 → 1.0.0-dev.157

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 PureStake
1
+ Copyright 2024 Moonbeam Foundation
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/build/index.d.ts CHANGED
@@ -1,145 +1,148 @@
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
+ fee: MoonChainFeeConfig;
41
+ }
42
+ interface MoonChainFeeConfig extends FeeConfig {
43
+ amount: number | FeeConfigBuilder;
59
44
  }
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;
45
+ declare class AssetRoute {
46
+ readonly source: SourceConfig;
47
+ readonly destination: DestinationConfig;
48
+ readonly contract?: ContractConfigBuilder;
49
+ readonly extrinsic?: ExtrinsicConfigBuilder;
50
+ readonly mrl?: MrlConfig;
51
+ constructor({ source, destination, contract, extrinsic, mrl, }: AssetRouteConstructorParams);
52
+ getDestinationFeeAssetOnSource(): ChainAsset;
68
53
  }
69
54
 
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;
55
+ interface ChainRoutesConstructorParams {
56
+ chain: AnyChain;
57
+ routes: RoutesParam[];
58
+ }
59
+ interface RoutesParam extends Omit<AssetRouteConstructorParams, 'source'> {
60
+ source: Omit<SourceConfig, 'chain'>;
61
+ }
62
+ declare class ChainRoutes {
63
+ #private;
64
+ readonly chain: AnyChain;
65
+ constructor({ chain, routes }: ChainRoutesConstructorParams);
66
+ getRoutes(): AssetRoute[];
67
+ getAssetRoutes(keyOrAsset: string | AnyAsset): AssetRoute[];
68
+ getAssetDestinations(keyOrAsset: string | AnyAsset): AnyChain[];
69
+ getDestinationAssets(keyOrChain: string | AnyChain): Asset[];
70
+ getAssetRoute(asset: string | AnyAsset, destination: string | AnyChain): AssetRoute;
81
71
  }
82
72
 
83
- interface ConfigServiceOptions {
84
- assets?: Map<string, Asset>;
85
- chains?: Map<string, AnyChain>;
86
- chainsConfig?: Map<string, ChainConfig>;
73
+ interface MrlAssetRouteConstructorParams extends AssetRouteConstructorParams {
74
+ source: MrlSourceConfig;
75
+ }
76
+ interface MrlSourceConfig extends SourceConfig {
77
+ moonChainFee?: {
78
+ asset: Asset;
79
+ balance: BalanceConfigBuilder;
80
+ };
87
81
  }
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;
82
+ declare class MrlAssetRoute extends AssetRoute {
83
+ readonly source: MrlSourceConfig;
84
+ constructor({ source, destination, contract, extrinsic, mrl, }: MrlAssetRouteConstructorParams & {
85
+ source: MrlSourceConfig;
86
+ });
107
87
  }
108
88
 
109
- interface TransferConfig {
110
- asset: Asset;
111
- source: ChainTransferConfig;
112
- destination: ChainTransferConfig;
89
+ interface MrlChainRoutesConstructorParams extends ChainRoutesConstructorParams {
90
+ routes: MrlRoutesParam[];
113
91
  }
114
- interface ChainTransferConfig {
115
- chain: AnyChain;
116
- config: AssetConfig;
92
+ interface MrlRoutesParam extends Omit<MrlAssetRouteConstructorParams, 'source'> {
93
+ source: Omit<MrlSourceConfig, 'chain'>;
94
+ }
95
+ declare class MrlChainRoutes extends ChainRoutes {
96
+ #private;
97
+ constructor({ chain, routes }: MrlChainRoutesConstructorParams);
98
+ getRoutes(): MrlAssetRoute[];
117
99
  }
118
100
 
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
- };
101
+ interface ConfigServiceOptions {
102
+ assets?: Map<string, Asset>;
103
+ chains?: Map<string, AnyChain>;
104
+ routes: Map<string, ChainRoutes | MrlChainRoutes>;
105
+ }
106
+ declare class ConfigService {
107
+ protected assets: Map<string, Asset>;
108
+ protected chains: Map<string, AnyChain>;
109
+ protected routes: Map<string, ChainRoutes | MrlChainRoutes>;
110
+ constructor(options: ConfigServiceOptions);
111
+ getAsset(keyOrAsset: string | Asset): Asset;
112
+ getEcosystemAssets(ecosystem?: Ecosystem): Asset[];
113
+ getChain(keyOrChain: string | AnyChain): AnyChain;
114
+ getChainRoutes(keyOrChain: string | AnyChain): ChainRoutes | MrlChainRoutes;
115
+ getSourceChains({ asset, ecosystem, }: {
116
+ asset?: string | Asset;
117
+ ecosystem?: Ecosystem;
118
+ }): AnyChain[];
119
+ getDestinationChains({ asset, source, }: {
120
+ asset?: string | AnyAsset;
121
+ source: string | AnyChain;
122
+ }): AnyChain[];
123
+ getAssetRoute({ asset, source, destination, }: {
124
+ asset: string | AnyAsset;
125
+ source: string | AnyChain;
126
+ destination: string | AnyChain;
127
+ }): AssetRoute | MrlAssetRoute;
128
+ getRouteAssets({ source, destination, }: {
129
+ source: string | AnyChain;
130
+ destination: string | AnyChain;
131
+ }): Asset[];
132
+ updateAsset(asset: Asset): void;
133
+ updateChain(chain: AnyChain): void;
134
+ updateChainRoute(route: ChainRoutes): void;
135
+ }
133
136
 
134
137
  declare const aca: Asset;
135
138
  declare const agng: Asset;
136
139
  declare const alan: Asset;
137
140
  declare const ampe: Asset;
138
141
  declare const apillon: Asset;
142
+ declare const aseed: Asset;
139
143
  declare const astr: Asset;
140
144
  declare const atom: Asset;
141
145
  declare const auq: Asset;
142
- declare const aseed: Asset;
143
146
  declare const axlusdc: Asset;
144
147
  declare const betaDEV: Asset;
145
148
  declare const bnc: Asset;
@@ -147,13 +150,15 @@ declare const bncs: Asset;
147
150
  declare const cfg: Asset;
148
151
  declare const crab: Asset;
149
152
  declare const csm: Asset;
153
+ declare const dai: Asset;
154
+ declare const ded: Asset;
150
155
  declare const dev: Asset;
151
156
  declare const dot: Asset;
152
157
  declare const eq: Asset;
153
158
  declare const eqd: Asset;
154
- declare const dai: Asset;
155
- declare const ded: Asset;
156
159
  declare const fil: Asset;
160
+ declare const ftm: Asset;
161
+ declare const ftmwh: Asset;
157
162
  declare const glmr: Asset;
158
163
  declare const hdx: Asset;
159
164
  declare const ibtc: Asset;
@@ -168,8 +173,8 @@ declare const lit: Asset;
168
173
  declare const manta: Asset;
169
174
  declare const mgx: Asset;
170
175
  declare const movr: Asset;
171
- declare const nodl: Asset;
172
176
  declare const neuro: Asset;
177
+ declare const nodl: Asset;
173
178
  declare const otp: Asset;
174
179
  declare const para: Asset;
175
180
  declare const paring: Asset;
@@ -193,9 +198,6 @@ declare const usdc: Asset;
193
198
  declare const usdcwh: Asset;
194
199
  declare const usdt: Asset;
195
200
  declare const usdtwh: Asset;
196
- declare const wbtc: Asset;
197
- declare const weth: Asset;
198
- declare const wftm: Asset;
199
201
  declare const vastr: Asset;
200
202
  declare const vbnc: Asset;
201
203
  declare const vdot: Asset;
@@ -204,10 +206,12 @@ declare const vglmr: Asset;
204
206
  declare const vksm: Asset;
205
207
  declare const vmanta: Asset;
206
208
  declare const vmovr: Asset;
209
+ declare const wbtc: Asset;
210
+ declare const weth: Asset;
211
+ declare const wftm: Asset;
207
212
  declare const wifd: Asset;
208
213
  declare const xrt: Asset;
209
214
  declare const ztg: Asset;
210
- declare const ftmwh: Asset;
211
215
  declare const wbtce: Asset;
212
216
  declare const wstethe: Asset;
213
217
  declare const wethe: Asset;
@@ -225,10 +229,11 @@ declare const centrifuge: Parachain;
225
229
  declare const crustShadow: Parachain;
226
230
  declare const darwinia: EvmParachain;
227
231
  declare const darwiniaCrab: EvmParachain;
232
+ declare const fantomTestnet: EvmChain;
228
233
  declare const hydration: Parachain;
229
234
  declare const hydrationAlphanet: Parachain;
230
- declare const interlay: Parachain;
231
235
  declare const integritee: Parachain;
236
+ declare const interlay: Parachain;
232
237
  declare const karura: Parachain;
233
238
  declare const khala: Parachain;
234
239
  declare const kintsugi: Parachain;
@@ -241,12 +246,11 @@ declare const moonbaseBeta: EvmParachain;
241
246
  declare const moonbeam: EvmParachain;
242
247
  declare const moonriver: EvmParachain;
243
248
  declare const neuroweb: Parachain;
244
- declare const nodle: Parachain;
245
249
  declare const originTrailAlphanet: Parachain;
246
250
  declare const peaqAlphanet: Parachain;
247
251
  declare const peaqChain: Parachain;
248
- declare const peaqEvmAlphanet: EvmParachain;
249
252
  declare const peaqEvm: EvmParachain;
253
+ declare const peaqEvmAlphanet: EvmParachain;
250
254
  declare const pendulum: Parachain;
251
255
  declare const pendulumAlphanet: Parachain;
252
256
  declare const phala: Parachain;
@@ -265,149 +269,13 @@ declare const zeitgeist: Parachain;
265
269
  declare const chainsList: AnyChain[];
266
270
  declare const chainsMap: Map<string, AnyChain>;
267
271
 
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
- };
272
+ declare function getKey(keyOrModel: string | AnyAsset | AnyChain): string;
273
+ declare function getMoonChain(chain: AnyChain): EvmParachain;
274
+
275
+ declare const mrlRoutesList: MrlChainRoutes[];
276
+ declare const mrlRoutesMap: Map<string, MrlChainRoutes>;
277
+
278
+ declare const xcmRoutesList: ChainRoutes[];
279
+ declare const xcmRoutesMap: Map<string, ChainRoutes>;
280
+
281
+ 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, 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 };