@moonbeam-network/xcm-config 1.0.0-dev.16 → 1.0.0-dev.161

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