@moonbeam-network/xcm-config 1.0.0-dev.15 → 1.0.0-dev.150

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,152 +1,166 @@
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;
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;
28
21
  }
29
- interface FeeAssetConfig {
30
- asset: Asset;
31
- balance: BalanceConfigBuilder;
22
+ interface DestinationConfig extends Omit<SourceConfig, 'fee'> {
23
+ fee: DestinationFeeConfig;
32
24
  }
33
- declare class AssetConfig {
34
- readonly asset: Asset;
35
- readonly balance: BalanceConfigBuilder;
36
- readonly contract?: ContractConfigBuilder;
37
- readonly destination: AnyChain;
38
- readonly destinationFee: DestinationFeeConfig;
39
- readonly extrinsic?: ExtrinsicConfigBuilder;
40
- readonly fee?: FeeAssetConfig;
41
- readonly min?: AssetMinConfigBuilder;
42
- constructor({
43
- asset,
44
- balance,
45
- contract,
46
- destination,
47
- destinationFee,
48
- extrinsic,
49
- fee,
50
- min,
51
- }: AssetConfigConstructorParams);
25
+ interface FeeConfig {
26
+ asset: Asset;
27
+ balance: BalanceConfigBuilder;
28
+ extra?: number;
52
29
  }
53
-
54
- interface ChainConfigConstructorParams {
55
- assets: AssetConfig[];
56
- 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;
57
37
  }
58
- declare class ChainConfig {
59
- #private;
60
- readonly chain: AnyChain;
61
- constructor({ assets, chain }: ChainConfigConstructorParams);
62
- getAssetsConfigs(): AssetConfig[];
63
- getAssetConfigs(asset: Asset): AssetConfig[];
64
- getAssetDestinations(asset: Asset): AnyChain[];
65
- getAssetDestinationConfig(asset: Asset, destination: AnyChain): AssetConfig;
38
+ interface MoonChainConfig {
39
+ asset: Asset;
40
+ fee: MoonChainFeeConfig;
41
+ }
42
+ interface MoonChainFeeConfig extends FeeConfig {
43
+ amount: number | FeeConfigBuilder;
44
+ }
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;
66
53
  }
67
54
 
68
- interface IConfigService {
69
- getEcosystemAssets(ecosystem?: Ecosystem): Asset[];
70
- getAsset(keyOrAsset: string | Asset): Asset;
71
- getChain(keyOrAsset: string | AnyChain): AnyChain;
72
- getSourceChains(asset: Asset, ecosystem: Ecosystem | undefined): AnyChain[];
73
- getDestinationChains(asset: Asset, source: AnyChain): AnyChain[];
74
- getAssetDestinationConfig(
75
- asset: Asset,
76
- source: AnyChain,
77
- destination: AnyChain,
78
- ): 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;
79
71
  }
80
72
 
81
- interface ConfigServiceOptions {
82
- assets?: Map<string, Asset>;
83
- chains?: Map<string, AnyChain>;
84
- 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
+ };
85
81
  }
86
- declare class ConfigService implements IConfigService {
87
- protected assets: Map<string, Asset>;
88
- protected chains: Map<string, AnyChain>;
89
- protected chainsConfig: Map<string, ChainConfig>;
90
- constructor(options?: ConfigServiceOptions);
91
- getEcosystemAssets(ecosystem?: Ecosystem): Asset[];
92
- getAsset(keyOrAsset: string | Asset): Asset;
93
- getChain(keyOrAsset: string | AnyChain): AnyChain;
94
- getChainConfig(keyOrAsset: string | AnyChain): ChainConfig;
95
- getSourceChains(asset: Asset, ecosystem: Ecosystem | undefined): AnyChain[];
96
- getDestinationChains(asset: Asset, source: AnyChain): AnyChain[];
97
- getAssetDestinationConfig(
98
- asset: Asset,
99
- source: AnyChain,
100
- destination: AnyChain,
101
- ): AssetConfig;
102
- updateAsset(asset: Asset): void;
103
- updateChain(chain: AnyChain): void;
104
- 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
+ });
105
87
  }
106
88
 
107
- interface TransferConfig {
108
- asset: Asset;
109
- source: ChainTransferConfig;
110
- destination: ChainTransferConfig;
89
+ interface MrlChainRoutesConstructorParams extends ChainRoutesConstructorParams {
90
+ routes: MrlRoutesParam[];
91
+ }
92
+ interface MrlRoutesParam extends Omit<MrlAssetRouteConstructorParams, 'source'> {
93
+ source: Omit<MrlSourceConfig, 'chain'>;
111
94
  }
112
- interface ChainTransferConfig {
113
- chain: AnyChain;
114
- config: AssetConfig;
95
+ declare class MrlChainRoutes extends ChainRoutes {
96
+ #private;
97
+ constructor({ chain, routes }: MrlChainRoutesConstructorParams);
98
+ getRoutes(): MrlAssetRoute[];
115
99
  }
116
100
 
117
- declare function ConfigBuilder(service?: IConfigService): {
118
- assets: (ecosystem?: Ecosystem) => {
119
- assets: Asset[];
120
- asset: (keyOrAsset: string | Asset) => {
121
- sourceChains: AnyChain[];
122
- source: (keyOrChain: string | AnyChain) => {
123
- destinationChains: AnyChain[];
124
- destination: (keyOrChain: string | AnyChain) => {
125
- build: () => TransferConfig;
126
- };
127
- };
128
- };
129
- };
130
- };
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
+ }
131
136
 
132
137
  declare const aca: Asset;
138
+ declare const agng: Asset;
133
139
  declare const alan: Asset;
140
+ declare const ampe: Asset;
141
+ declare const apillon: Asset;
142
+ declare const aseed: Asset;
134
143
  declare const astr: Asset;
144
+ declare const atom: Asset;
135
145
  declare const auq: Asset;
136
- declare const aseed: Asset;
146
+ declare const axlusdc: Asset;
137
147
  declare const betaDEV: Asset;
138
148
  declare const bnc: Asset;
149
+ declare const bncs: Asset;
139
150
  declare const cfg: Asset;
140
151
  declare const crab: Asset;
141
152
  declare const csm: Asset;
153
+ declare const dai: Asset;
154
+ declare const ded: Asset;
142
155
  declare const dev: Asset;
143
156
  declare const dot: Asset;
144
157
  declare const eq: Asset;
145
158
  declare const eqd: Asset;
146
- declare const dai: Asset;
159
+ declare const fil: Asset;
160
+ declare const ftm: Asset;
161
+ declare const ftmwh: Asset;
147
162
  declare const glmr: Asset;
148
163
  declare const hdx: Asset;
149
- declare const hko: Asset;
150
164
  declare const ibtc: Asset;
151
165
  declare const intr: Asset;
152
166
  declare const kar: Asset;
@@ -154,28 +168,50 @@ declare const kbtc: Asset;
154
168
  declare const kint: Asset;
155
169
  declare const kma: Asset;
156
170
  declare const ksm: Asset;
171
+ declare const ldot: Asset;
157
172
  declare const lit: Asset;
173
+ declare const manta: Asset;
158
174
  declare const mgx: Asset;
159
175
  declare const movr: Asset;
176
+ declare const neuro: Asset;
160
177
  declare const nodl: Asset;
161
178
  declare const otp: Asset;
162
179
  declare const para: Asset;
163
180
  declare const paring: Asset;
181
+ declare const peaq: Asset;
182
+ declare const pen: Asset;
164
183
  declare const pha: Asset;
184
+ declare const pica: Asset;
185
+ declare const pink: Asset;
165
186
  declare const ring: Asset;
166
187
  declare const rmrk: Asset;
167
188
  declare const sdn: Asset;
168
189
  declare const soon: Asset;
190
+ declare const stink: Asset;
191
+ declare const sub: Asset;
169
192
  declare const teer: Asset;
193
+ declare const tnkr: Asset;
170
194
  declare const tt1: Asset;
171
195
  declare const tur: Asset;
172
196
  declare const unit: Asset;
173
197
  declare const usdc: Asset;
198
+ declare const usdcwh: Asset;
174
199
  declare const usdt: Asset;
200
+ declare const usdtwh: Asset;
201
+ declare const vastr: Asset;
202
+ declare const vbnc: Asset;
203
+ declare const vdot: Asset;
204
+ declare const vfil: Asset;
205
+ declare const vglmr: Asset;
206
+ declare const vksm: Asset;
207
+ declare const vmanta: Asset;
208
+ declare const vmovr: Asset;
175
209
  declare const wbtc: Asset;
176
210
  declare const weth: Asset;
177
211
  declare const wftm: Asset;
212
+ declare const wifd: Asset;
178
213
  declare const xrt: Asset;
214
+ declare const ztg: Asset;
179
215
  declare const assetsList: Asset[];
180
216
  declare const assetsMap: Map<string, Asset>;
181
217
 
@@ -190,146 +226,53 @@ declare const centrifuge: Parachain;
190
226
  declare const crustShadow: Parachain;
191
227
  declare const darwinia: EvmParachain;
192
228
  declare const darwiniaCrab: EvmParachain;
193
- declare const darwiniaPangoro: EvmParachain;
194
- declare const equilibrium: Parachain;
195
- declare const equilibriumAlphanet: Parachain;
196
- declare const hydraDX: Parachain;
197
- declare const interlay: Parachain;
229
+ declare const fantomTestnet: EvmChain;
230
+ declare const hydration: Parachain;
231
+ declare const hydrationAlphanet: Parachain;
198
232
  declare const integritee: Parachain;
233
+ declare const interlay: Parachain;
199
234
  declare const karura: Parachain;
200
235
  declare const khala: Parachain;
201
236
  declare const kintsugi: Parachain;
202
237
  declare const kusama: Parachain;
203
238
  declare const kusamaAssetHub: Parachain;
204
- declare const litentryAlphanet: Parachain;
205
- declare const litmus: Parachain;
206
239
  declare const mangataKusama: Parachain;
240
+ declare const mantaParachain: Parachain;
207
241
  declare const moonbaseAlpha: EvmParachain;
208
242
  declare const moonbaseBeta: EvmParachain;
209
243
  declare const moonbeam: EvmParachain;
210
244
  declare const moonriver: EvmParachain;
211
- declare const nodle: Parachain;
212
- declare const nodleEden: Parachain;
245
+ declare const neuroweb: Parachain;
213
246
  declare const originTrailAlphanet: Parachain;
214
- declare const parallel: Parachain;
215
- declare const parallelHeiko: Parachain;
247
+ declare const peaqAlphanet: Parachain;
248
+ declare const peaqChain: Parachain;
249
+ declare const peaqEvm: EvmParachain;
250
+ declare const peaqEvmAlphanet: EvmParachain;
251
+ declare const pendulum: Parachain;
252
+ declare const pendulumAlphanet: Parachain;
216
253
  declare const phala: Parachain;
254
+ declare const picasso: Parachain;
255
+ declare const picassoAlphanet: Parachain;
217
256
  declare const polkadot: Parachain;
218
257
  declare const polkadotAssetHub: Parachain;
219
258
  declare const robonomics: Parachain;
220
259
  declare const shiden: Parachain;
260
+ declare const subsocial: Parachain;
261
+ declare const tinkernet: Parachain;
221
262
  declare const turing: Parachain;
222
263
  declare const turingAlphanet: Parachain;
223
- declare const subsocialAlphanet: Parachain;
224
264
  declare const uniqueAlpha: Parachain;
265
+ declare const zeitgeist: Parachain;
225
266
  declare const chainsList: AnyChain[];
226
267
  declare const chainsMap: Map<string, AnyChain>;
227
268
 
228
- export {
229
- AssetConfig,
230
- AssetConfigConstructorParams,
231
- ChainConfig,
232
- ChainConfigConstructorParams,
233
- ChainTransferConfig,
234
- ConfigBuilder,
235
- ConfigService,
236
- ConfigServiceOptions,
237
- DestinationFeeConfig,
238
- FeeAssetConfig,
239
- IConfigService,
240
- TransferConfig,
241
- aca,
242
- acala,
243
- alan,
244
- alphanetAssetHub,
245
- alphanetRelay,
246
- aseed,
247
- assetsList,
248
- assetsMap,
249
- astar,
250
- astr,
251
- auq,
252
- betaDEV,
253
- bifrostKusama,
254
- bifrostPolkadot,
255
- bnc,
256
- calamari,
257
- centrifuge,
258
- cfg,
259
- chainsList,
260
- chainsMap,
261
- crab,
262
- crustShadow,
263
- csm,
264
- dai,
265
- darwinia,
266
- darwiniaCrab,
267
- darwiniaPangoro,
268
- dev,
269
- dot,
270
- eq,
271
- eqd,
272
- equilibrium,
273
- equilibriumAlphanet,
274
- glmr,
275
- hdx,
276
- hko,
277
- hydraDX,
278
- ibtc,
279
- integritee,
280
- interlay,
281
- intr,
282
- kar,
283
- karura,
284
- kbtc,
285
- khala,
286
- kint,
287
- kintsugi,
288
- kma,
289
- ksm,
290
- kusama,
291
- kusamaAssetHub,
292
- lit,
293
- litentryAlphanet,
294
- litmus,
295
- mangataKusama,
296
- mgx,
297
- moonbaseAlpha,
298
- moonbaseBeta,
299
- moonbeam,
300
- moonriver,
301
- movr,
302
- nodl,
303
- nodle,
304
- nodleEden,
305
- originTrailAlphanet,
306
- otp,
307
- para,
308
- parallel,
309
- parallelHeiko,
310
- paring,
311
- pha,
312
- phala,
313
- polkadot,
314
- polkadotAssetHub,
315
- ring,
316
- rmrk,
317
- robonomics,
318
- sdn,
319
- shiden,
320
- soon,
321
- subsocialAlphanet,
322
- teer,
323
- tt1,
324
- tur,
325
- turing,
326
- turingAlphanet,
327
- uniqueAlpha,
328
- unit,
329
- usdc,
330
- usdt,
331
- wbtc,
332
- weth,
333
- wftm,
334
- xrt,
335
- };
269
+ declare function getKey(keyOrModel: string | AnyAsset | AnyChain): string;
270
+ declare function getMoonChain(chain: AnyChain): EvmParachain;
271
+
272
+ declare const mrlRoutesList: MrlChainRoutes[];
273
+ declare const mrlRoutesMap: Map<string, MrlChainRoutes>;
274
+
275
+ declare const xcmRoutesList: ChainRoutes[];
276
+ declare const xcmRoutesMap: Map<string, ChainRoutes>;
277
+
278
+ 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, weth, wftm, wifd, xcmRoutesList, xcmRoutesMap, xrt, zeitgeist, ztg };