@moonbeam-network/xcm-config 1.0.0-dev.2 → 1.0.0-dev.200

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/README.md CHANGED
@@ -1,14 +1,20 @@
1
- ![Moonbeam](https://docs.moonbeam.network/images/builders/interoperability/xcm/sdk/xcm-sdk-banner.png)
1
+ The Config package contains the chains and assets configuration for the Moonbeam XCM SDK and MRL SDK.
2
2
 
3
- The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem. With the SDK, you don't need to worry about determining the multilocation of the origin or destination assets or which extrinsics are used on which networks to send XCM transfers. To deposit or withdraw assets, you simply define the asset and origin chain you want to deposit from or withdraw back to, along with the sending account's signer, and the amount to send.
3
+ # Documentation for the Moonbeam XCM SDK
4
4
 
5
- # Documentation
5
+ ## v3 (current)
6
6
 
7
- ## v1 (current)
7
+ ### Usage
8
8
 
9
- - TODO: (coming soon)
9
+ - [XCM SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/example-usage/xcm)
10
+ - [MRL SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/example-usage/mrl)
10
11
 
11
- ## v0 (previous)
12
+ ### References
12
13
 
13
- - [usage](https://docs.moonbeam.network/builders/xcm/xcm-sdk/xcm-sdk/)
14
- - [references](https://docs.moonbeam.network/builders/xcm/xcm-sdk/reference/)
14
+ - [XCM SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/reference/xcm)
15
+ - [MRL SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/reference/mrl)
16
+
17
+ ## v2 (previous)
18
+
19
+ - [usage](https://moonbeam-foundation.github.io/xcm-sdk/v2/example-usage)
20
+ - [references](https://moonbeam-foundation.github.io/xcm-sdk/v2/reference/interfaces)
package/build/index.d.ts CHANGED
@@ -1,123 +1,225 @@
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 { BalanceConfigBuilder, AssetMinConfigBuilder, FeeConfigBuilder, ContractConfigBuilder, ExtrinsicConfigBuilder, MrlConfigBuilder } 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;
25
9
  }
26
- interface DestinationFeeConfig {
27
- asset: Asset;
28
- amount: number | FeeConfigBuilder;
10
+ interface SourceConfig {
11
+ asset: Asset;
12
+ chain: AnyChain;
13
+ balance: BalanceConfigBuilder;
14
+ fee: FeeConfig;
15
+ destinationFee?: {
16
+ asset?: Asset;
17
+ balance: BalanceConfigBuilder;
18
+ };
19
+ min?: AssetMinConfigBuilder;
20
+ }
21
+ interface DestinationConfig extends Omit<SourceConfig, 'fee'> {
22
+ fee: DestinationFeeConfig;
23
+ }
24
+ interface FeeConfig {
25
+ asset: Asset;
26
+ balance: BalanceConfigBuilder;
27
+ extra?: number;
29
28
  }
30
- interface FeeAssetConfig {
31
- asset: Asset;
32
- balance: BalanceConfigBuilder;
29
+ interface DestinationFeeConfig extends SetOptional<FeeConfig, 'balance'> {
30
+ amount: number | FeeConfigBuilder;
33
31
  }
34
- declare class AssetConfig {
35
- readonly asset: Asset;
36
- readonly balance: BalanceConfigBuilder;
37
- readonly contract?: ContractConfigBuilder;
38
- readonly destination: AnyChain;
39
- readonly destinationFee: DestinationFeeConfig;
40
- readonly extrinsic?: ExtrinsicConfigBuilder;
41
- readonly fee?: FeeAssetConfig;
42
- readonly min?: AssetMinConfigBuilder;
43
- constructor({
44
- asset,
45
- balance,
46
- contract,
47
- destination,
48
- destinationFee,
49
- extrinsic,
50
- fee,
51
- min,
52
- }: AssetConfigConstructorParams);
32
+ declare class AssetRoute {
33
+ readonly source: SourceConfig;
34
+ readonly destination: DestinationConfig;
35
+ readonly contract?: ContractConfigBuilder;
36
+ readonly extrinsic?: ExtrinsicConfigBuilder;
37
+ constructor({ source, destination, contract, extrinsic, }: AssetRouteConstructorParams);
38
+ getDestinationFeeAssetOnSource(): ChainAsset;
53
39
  }
54
40
 
55
- interface TransferConfig {
56
- asset: Asset;
57
- source: ChainTransferConfig;
58
- destination: ChainTransferConfig;
41
+ interface ChainRoutesConstructorParams {
42
+ chain: AnyChain;
43
+ routes: RoutesParam[];
59
44
  }
60
- interface ChainTransferConfig {
61
- chain: AnyChain;
62
- config: AssetConfig;
45
+ interface RoutesParam extends Omit<AssetRouteConstructorParams, 'source'> {
46
+ source: Omit<SourceConfig, 'chain'>;
47
+ }
48
+ declare class ChainRoutes {
49
+ readonly chain: AnyChain;
50
+ protected routes: Map<string, AssetRoute>;
51
+ constructor({ chain, routes }: ChainRoutesConstructorParams);
52
+ getRoutes(): AssetRoute[];
53
+ getAssetRoutes(keyOrAsset: string | AnyAsset): AssetRoute[];
54
+ getAssetDestinations(keyOrAsset: string | AnyAsset): AnyChain[];
55
+ getDestinationAssets(keyOrChain: string | AnyChain): Asset[];
56
+ getAssetRoute(asset: string | AnyAsset, destination: string | AnyChain): AssetRoute;
63
57
  }
64
58
 
65
- declare function ConfigBuilder(): {
66
- assets: (ecosystem?: Ecosystem) => {
67
- assets: Asset[];
68
- asset: (keyOrAsset: string | Asset) => {
69
- sourceChains: AnyChain[];
70
- source: (keyOrChain: string | AnyChain) => {
71
- destinationChains: AnyChain[];
72
- destination: (keyOrChain: string | AnyChain) => {
73
- build: () => TransferConfig;
74
- };
75
- };
59
+ interface MrlAssetRouteConstructorParams extends AssetRouteConstructorParams {
60
+ source: MrlSourceConfig;
61
+ mrl: MrlConfig;
62
+ }
63
+ interface MrlConfig {
64
+ isAutomaticPossible: boolean;
65
+ transfer: MrlConfigBuilder;
66
+ moonChain: MoonChainConfig;
67
+ }
68
+ interface MrlSourceConfig extends SourceConfig {
69
+ moonChainFee?: {
70
+ asset: Asset;
71
+ balance: BalanceConfigBuilder;
76
72
  };
77
- };
78
- };
73
+ }
74
+ interface MoonChainConfig {
75
+ asset: Asset;
76
+ balance: BalanceConfigBuilder;
77
+ fee: MoonChainFeeConfig;
78
+ }
79
+ interface MoonChainFeeConfig extends FeeConfig {
80
+ amount: number | FeeConfigBuilder;
81
+ }
82
+ declare class MrlAssetRoute extends AssetRoute {
83
+ readonly mrl: MrlConfig;
84
+ readonly source: MrlSourceConfig;
85
+ constructor({ source, destination, contract, extrinsic, mrl, }: MrlAssetRouteConstructorParams & {
86
+ source: MrlSourceConfig;
87
+ });
88
+ }
89
+
90
+ interface MrlChainRoutesConstructorParams extends ChainRoutesConstructorParams {
91
+ routes: MrlRoutesParam[];
92
+ }
93
+ interface MrlRoutesParam extends Omit<MrlAssetRouteConstructorParams, 'source'> {
94
+ source: Omit<MrlSourceConfig, 'chain'>;
95
+ }
96
+ declare class MrlChainRoutes extends ChainRoutes {
97
+ protected routes: Map<string, MrlAssetRoute>;
98
+ constructor({ chain, routes }: MrlChainRoutesConstructorParams);
99
+ getRoutes(): MrlAssetRoute[];
100
+ getAssetRoute(asset: string | AnyAsset, destination: string | AnyChain): MrlAssetRoute;
101
+ }
102
+
103
+ interface ConfigServiceOptions {
104
+ assets?: Map<string, Asset>;
105
+ chains?: Map<string, AnyChain>;
106
+ routes: Map<string, ChainRoutes | MrlChainRoutes>;
107
+ }
108
+ declare class ConfigService {
109
+ protected assets: Map<string, Asset>;
110
+ protected chains: Map<string, AnyChain>;
111
+ protected routes: Map<string, ChainRoutes | MrlChainRoutes>;
112
+ constructor(options: ConfigServiceOptions);
113
+ getAsset(keyOrAsset: string | Asset): Asset;
114
+ getEcosystemAssets(ecosystem?: Ecosystem): Asset[];
115
+ getChain(keyOrChain: string | AnyChain): AnyChain;
116
+ getChainRoutes(keyOrChain: string | AnyChain): ChainRoutes | MrlChainRoutes;
117
+ getSourceChains({ asset, ecosystem, }: {
118
+ asset?: string | Asset;
119
+ ecosystem?: Ecosystem;
120
+ }): AnyChain[];
121
+ getDestinationChains({ asset, source, }: {
122
+ asset?: string | AnyAsset;
123
+ source: string | AnyChain;
124
+ }): AnyChain[];
125
+ getAssetRoute({ asset, source, destination, }: {
126
+ asset: string | AnyAsset;
127
+ source: string | AnyChain;
128
+ destination: string | AnyChain;
129
+ }): AssetRoute | MrlAssetRoute;
130
+ getRouteAssets({ source, destination, }: {
131
+ source: string | AnyChain;
132
+ destination: string | AnyChain;
133
+ }): Asset[];
134
+ updateAsset(asset: Asset): void;
135
+ updateChain(chain: AnyChain): void;
136
+ updateChainRoute(route: ChainRoutes): void;
137
+ }
79
138
 
80
139
  declare const aca: Asset;
140
+ declare const agng: Asset;
81
141
  declare const alan: Asset;
142
+ declare const ampe: Asset;
143
+ declare const apillon: Asset;
144
+ declare const aseed: Asset;
82
145
  declare const astr: Asset;
83
146
  declare const auq: Asset;
84
- declare const ausd: Asset;
85
- declare const betaDEV: Asset;
147
+ declare const axlusdc: Asset;
86
148
  declare const bnc: Asset;
149
+ declare const bncs: Asset;
87
150
  declare const cfg: Asset;
88
151
  declare const crab: Asset;
89
152
  declare const csm: Asset;
153
+ declare const dai: Asset;
154
+ declare const ded: Asset;
90
155
  declare const dev: Asset;
156
+ declare const devBeta: Asset;
157
+ declare const devStage: Asset;
91
158
  declare const dot: Asset;
92
159
  declare const eq: Asset;
93
160
  declare const eqd: Asset;
161
+ declare const eth: Asset;
162
+ declare const eurc: Asset;
163
+ declare const fil: Asset;
164
+ declare const ftm: Asset;
165
+ declare const ftmwh: Asset;
94
166
  declare const glmr: Asset;
95
167
  declare const hdx: Asset;
96
- declare const hko: Asset;
97
168
  declare const ibtc: Asset;
98
169
  declare const intr: Asset;
99
170
  declare const kar: Asset;
100
171
  declare const kbtc: Asset;
101
172
  declare const kint: Asset;
102
- declare const kma: Asset;
103
173
  declare const ksm: Asset;
174
+ declare const ldot: Asset;
104
175
  declare const lit: Asset;
176
+ declare const manta: Asset;
177
+ declare const maos: Asset;
105
178
  declare const mgx: Asset;
106
179
  declare const movr: Asset;
180
+ declare const neuro: Asset;
107
181
  declare const nodl: Asset;
182
+ declare const otp: Asset;
108
183
  declare const para: Asset;
109
184
  declare const paring: Asset;
185
+ declare const peaq: Asset;
186
+ declare const pen: Asset;
110
187
  declare const pha: Asset;
188
+ declare const pica: Asset;
189
+ declare const pink: Asset;
111
190
  declare const ring: Asset;
112
191
  declare const rmrk: Asset;
113
192
  declare const sdn: Asset;
114
193
  declare const soon: Asset;
194
+ declare const stink: Asset;
195
+ declare const sub: Asset;
115
196
  declare const teer: Asset;
197
+ declare const tnkr: Asset;
116
198
  declare const tt1: Asset;
117
199
  declare const tur: Asset;
118
200
  declare const unit: Asset;
201
+ declare const usdc: Asset;
202
+ declare const usdcwh: Asset;
119
203
  declare const usdt: Asset;
204
+ declare const usdtwh: Asset;
205
+ declare const vastr: Asset;
206
+ declare const vbnc: Asset;
207
+ declare const vdot: Asset;
208
+ declare const vfil: Asset;
209
+ declare const vglmr: Asset;
210
+ declare const vksm: Asset;
211
+ declare const vmanta: Asset;
212
+ declare const vmovr: Asset;
213
+ declare const wbtc: Asset;
214
+ declare const weth: Asset;
215
+ declare const wftm: Asset;
216
+ declare const wifd: Asset;
120
217
  declare const xrt: Asset;
218
+ declare const ztg: Asset;
219
+ declare const wbtce: Asset;
220
+ declare const wstethe: Asset;
221
+ declare const wethe: Asset;
222
+ declare const laos: Asset;
121
223
  declare const assetsList: Asset[];
122
224
  declare const assetsMap: Map<string, Asset>;
123
225
 
@@ -127,152 +229,58 @@ declare const alphanetRelay: Parachain;
127
229
  declare const astar: Parachain;
128
230
  declare const bifrostKusama: Parachain;
129
231
  declare const bifrostPolkadot: Parachain;
130
- declare const calamari: Parachain;
131
232
  declare const centrifuge: Parachain;
132
233
  declare const crustShadow: Parachain;
133
234
  declare const darwinia: EvmParachain;
134
235
  declare const darwiniaCrab: EvmParachain;
135
- declare const darwiniaPangoro: EvmParachain;
136
- declare const equilibrium: Parachain;
137
- declare const equilibriumAlphanet: Parachain;
138
- declare const hydraDX: Parachain;
139
- declare const interlay: Parachain;
236
+ declare const ethereum: EvmChain;
237
+ declare const fantomTestnet: EvmChain;
238
+ declare const hydration: Parachain;
239
+ declare const hydrationAlphanet: Parachain;
140
240
  declare const integritee: Parachain;
241
+ declare const interlay: Parachain;
141
242
  declare const karura: Parachain;
142
- declare const khala: Parachain;
143
243
  declare const kintsugi: Parachain;
144
244
  declare const kusama: Parachain;
145
245
  declare const kusamaAssetHub: Parachain;
146
- declare const litentryAlphanet: Parachain;
147
- declare const litmus: Parachain;
148
246
  declare const mangataKusama: Parachain;
247
+ declare const mantaParachain: Parachain;
248
+ declare const laosAlphanet: EvmParachain;
249
+ declare const laosMainnet: EvmParachain;
149
250
  declare const moonbaseAlpha: EvmParachain;
150
251
  declare const moonbaseBeta: EvmParachain;
252
+ declare const moonbaseStage: EvmParachain;
151
253
  declare const moonbeam: EvmParachain;
152
254
  declare const moonriver: EvmParachain;
153
- declare const nodleEden: Parachain;
154
- declare const parallel: Parachain;
155
- declare const parallelHeiko: Parachain;
255
+ declare const neuroweb: Parachain;
256
+ declare const originTrailAlphanet: Parachain;
257
+ declare const peaqAlphanet: Parachain;
258
+ declare const peaqChain: Parachain;
259
+ declare const peaqEvm: EvmParachain;
260
+ declare const peaqEvmAlphanet: EvmParachain;
261
+ declare const pendulum: Parachain;
262
+ declare const pendulumAlphanet: Parachain;
156
263
  declare const phala: Parachain;
157
264
  declare const polkadot: Parachain;
158
265
  declare const polkadotAssetHub: Parachain;
159
266
  declare const robonomics: Parachain;
160
267
  declare const shiden: Parachain;
161
- declare const turing: Parachain;
162
268
  declare const turingAlphanet: Parachain;
163
- declare const subsocialAlphanet: Parachain;
164
269
  declare const uniqueAlpha: Parachain;
270
+ declare const zeitgeist: Parachain;
165
271
  declare const chainsList: AnyChain[];
166
272
  declare const chainsMap: Map<string, AnyChain>;
167
273
 
168
- interface ChainConfigConstructorParams {
169
- assets: AssetConfig[];
170
- chain: AnyChain;
171
- }
172
- declare class ChainConfig {
173
- #private;
174
- readonly chain: AnyChain;
175
- constructor({ assets, chain }: ChainConfigConstructorParams);
176
- getAssetsConfigs(): AssetConfig[];
177
- getAssetConfigs(asset: Asset): AssetConfig[];
178
- getAssetDestinations(asset: Asset): AnyChain[];
179
- getAssetDestinationConfig(asset: Asset, destination: AnyChain): AssetConfig;
180
- }
274
+ declare function getKey(keyOrModel: string | AnyAsset | AnyChain): string;
275
+ declare function getMoonChain(chain: AnyChain): EvmParachain;
276
+
277
+ declare const mrlRoutesList: MrlChainRoutes[];
278
+ declare const mrlRoutesMap: Map<string, MrlChainRoutes>;
279
+
280
+ declare const xcmRoutesList: ChainRoutes[];
281
+ declare const xcmRoutesMap: Map<string, ChainRoutes>;
282
+
283
+ declare const crossEcosystemsRoutesList: ChainRoutes[];
284
+ declare const crossEcosystemsRoutesMap: Map<string, ChainRoutes>;
181
285
 
182
- export {
183
- AssetConfig,
184
- AssetConfigConstructorParams,
185
- ChainConfig,
186
- ChainConfigConstructorParams,
187
- ChainTransferConfig,
188
- ConfigBuilder,
189
- DestinationFeeConfig,
190
- FeeAssetConfig,
191
- TransferConfig,
192
- aca,
193
- acala,
194
- alan,
195
- alphanetAssetHub,
196
- alphanetRelay,
197
- assetsList,
198
- assetsMap,
199
- astar,
200
- astr,
201
- auq,
202
- ausd,
203
- betaDEV,
204
- bifrostKusama,
205
- bifrostPolkadot,
206
- bnc,
207
- calamari,
208
- centrifuge,
209
- cfg,
210
- chainsList,
211
- chainsMap,
212
- crab,
213
- crustShadow,
214
- csm,
215
- darwinia,
216
- darwiniaCrab,
217
- darwiniaPangoro,
218
- dev,
219
- dot,
220
- eq,
221
- eqd,
222
- equilibrium,
223
- equilibriumAlphanet,
224
- glmr,
225
- hdx,
226
- hko,
227
- hydraDX,
228
- ibtc,
229
- integritee,
230
- interlay,
231
- intr,
232
- kar,
233
- karura,
234
- kbtc,
235
- khala,
236
- kint,
237
- kintsugi,
238
- kma,
239
- ksm,
240
- kusama,
241
- kusamaAssetHub,
242
- lit,
243
- litentryAlphanet,
244
- litmus,
245
- mangataKusama,
246
- mgx,
247
- moonbaseAlpha,
248
- moonbaseBeta,
249
- moonbeam,
250
- moonriver,
251
- movr,
252
- nodl,
253
- nodleEden,
254
- para,
255
- parallel,
256
- parallelHeiko,
257
- paring,
258
- pha,
259
- phala,
260
- polkadot,
261
- polkadotAssetHub,
262
- ring,
263
- rmrk,
264
- robonomics,
265
- sdn,
266
- shiden,
267
- soon,
268
- subsocialAlphanet,
269
- teer,
270
- tt1,
271
- tur,
272
- turing,
273
- turingAlphanet,
274
- uniqueAlpha,
275
- unit,
276
- usdt,
277
- xrt,
278
- };
286
+ 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, auq, axlusdc, bifrostKusama, bifrostPolkadot, bnc, bncs, centrifuge, cfg, chainsList, chainsMap, crab, crossEcosystemsRoutesList, crossEcosystemsRoutesMap, crustShadow, csm, dai, darwinia, darwiniaCrab, ded, dev, devBeta, devStage, dot, eq, eqd, eth, ethereum, eurc, fantomTestnet, fil, ftm, ftmwh, getKey, getMoonChain, glmr, hdx, hydration, hydrationAlphanet, ibtc, integritee, interlay, intr, kar, karura, kbtc, kint, kintsugi, ksm, kusama, kusamaAssetHub, laos, laosAlphanet, laosMainnet, ldot, lit, mangataKusama, manta, mantaParachain, maos, mgx, moonbaseAlpha, moonbaseBeta, moonbaseStage, moonbeam, moonriver, movr, mrlRoutesList, mrlRoutesMap, neuro, neuroweb, nodl, originTrailAlphanet, otp, para, paring, peaq, peaqAlphanet, peaqChain, peaqEvm, peaqEvmAlphanet, pen, pendulum, pendulumAlphanet, pha, phala, pica, pink, polkadot, polkadotAssetHub, ring, rmrk, robonomics, sdn, shiden, soon, stink, sub, teer, tnkr, tt1, tur, 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 };