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

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;
37
+ }
38
+ interface MoonChainConfig {
39
+ asset: Asset;
40
+ fee: MoonChainFeeConfig;
57
41
  }
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;
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;
85
75
  }
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;
76
+ interface MrlSourceConfig extends SourceConfig {
77
+ moonChainFee?: {
78
+ asset: Asset;
79
+ balance: BalanceConfigBuilder;
80
+ };
81
+ }
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[];
111
91
  }
112
- interface ChainTransferConfig {
113
- chain: AnyChain;
114
- 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[];
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,34 +168,53 @@ 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;
175
- declare const wbtc: Asset;
176
- declare const weth: Asset;
177
- declare const wftm: Asset;
200
+ declare const usdtwh: Asset;
201
+ declare const vastr: Asset;
178
202
  declare const vbnc: Asset;
179
203
  declare const vdot: Asset;
180
204
  declare const vfil: Asset;
181
205
  declare const vglmr: Asset;
182
206
  declare const vksm: Asset;
207
+ declare const vmanta: Asset;
183
208
  declare const vmovr: Asset;
209
+ declare const wbtc: Asset;
210
+ declare const weth: Asset;
211
+ declare const wftm: Asset;
212
+ declare const wifd: Asset;
184
213
  declare const xrt: Asset;
214
+ declare const ztg: Asset;
215
+ declare const wbtce: Asset;
216
+ declare const wstethe: Asset;
217
+ declare const wethe: Asset;
185
218
  declare const assetsList: Asset[];
186
219
  declare const assetsMap: Map<string, Asset>;
187
220
 
@@ -196,152 +229,53 @@ declare const centrifuge: Parachain;
196
229
  declare const crustShadow: Parachain;
197
230
  declare const darwinia: EvmParachain;
198
231
  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;
232
+ declare const fantomTestnet: EvmChain;
233
+ declare const hydration: Parachain;
234
+ declare const hydrationAlphanet: Parachain;
204
235
  declare const integritee: Parachain;
236
+ declare const interlay: Parachain;
205
237
  declare const karura: Parachain;
206
238
  declare const khala: Parachain;
207
239
  declare const kintsugi: Parachain;
208
240
  declare const kusama: Parachain;
209
241
  declare const kusamaAssetHub: Parachain;
210
- declare const litentryAlphanet: Parachain;
211
- declare const litmus: Parachain;
212
242
  declare const mangataKusama: Parachain;
243
+ declare const mantaParachain: Parachain;
213
244
  declare const moonbaseAlpha: EvmParachain;
214
245
  declare const moonbaseBeta: EvmParachain;
215
246
  declare const moonbeam: EvmParachain;
216
247
  declare const moonriver: EvmParachain;
217
- declare const nodle: Parachain;
218
- declare const nodleEden: Parachain;
248
+ declare const neuroweb: Parachain;
219
249
  declare const originTrailAlphanet: Parachain;
220
- declare const parallel: Parachain;
221
- declare const parallelHeiko: Parachain;
250
+ declare const peaqAlphanet: Parachain;
251
+ declare const peaqChain: Parachain;
252
+ declare const peaqEvm: EvmParachain;
253
+ declare const peaqEvmAlphanet: EvmParachain;
254
+ declare const pendulum: Parachain;
255
+ declare const pendulumAlphanet: Parachain;
222
256
  declare const phala: Parachain;
257
+ declare const picasso: Parachain;
258
+ declare const picassoAlphanet: Parachain;
223
259
  declare const polkadot: Parachain;
224
260
  declare const polkadotAssetHub: Parachain;
225
261
  declare const robonomics: Parachain;
226
262
  declare const shiden: Parachain;
263
+ declare const subsocial: Parachain;
264
+ declare const tinkernet: Parachain;
227
265
  declare const turing: Parachain;
228
266
  declare const turingAlphanet: Parachain;
229
- declare const subsocialAlphanet: Parachain;
230
267
  declare const uniqueAlpha: Parachain;
268
+ declare const zeitgeist: Parachain;
231
269
  declare const chainsList: AnyChain[];
232
270
  declare const chainsMap: Map<string, AnyChain>;
233
271
 
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
- };
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 };