@moonbeam-network/xcm-builder 1.0.0-dev.26 → 1.0.0-dev.261

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/build/index.d.ts CHANGED
@@ -1,277 +1,767 @@
1
- import { ChainAssetId, AnyChain } from '@moonbeam-network/xcm-types';
2
- import { SetOptional } from 'type-fest';
3
- import { Struct, u128 } from '@polkadot/types';
4
- import { SubmittableExtrinsicFunction } from '@polkadot/api/types';
1
+ import { Chain, AnyParachain, AssetAmount, ChainAssetId, ChainAsset, AnyChain, EvmParachain } from '@moonbeam-network/xcm-types';
5
2
  import { ApiPromise } from '@polkadot/api';
3
+ import { FrameSystemAccountInfo, StagingXcmV3MultiLocation } from '@polkadot/types/lookup';
4
+ import { Struct, u128, Enum } from '@polkadot/types';
5
+ import { Abi, PublicClient, HttpTransport } from 'viem';
6
+ import { SubmittableExtrinsicFunction } from '@polkadot/api/types';
7
+ import { EventRecord } from '@polkadot/types/interfaces';
8
+ import { HexString } from '@polkadot/util/types';
9
+ import { TokenId, ChainAddress, TokenTransfer, Wormhole } from '@wormhole-foundation/sdk-connect';
6
10
 
7
- declare enum CallType {
8
- Evm = 'Evm',
9
- Substrate = 'Substrate',
11
+ interface ConfigBuilder<Config, Params = BuilderParams> {
12
+ build: (params: Params) => Config;
13
+ }
14
+ interface BuilderParams<IChain extends Chain = AnyParachain> {
15
+ asset: AssetAmount;
16
+ destination: IChain;
17
+ destinationAddress: string;
18
+ destinationApi?: ApiPromise;
19
+ fee: AssetAmount;
20
+ source: IChain;
21
+ sourceAddress: string;
22
+ sourceApi?: ApiPromise;
10
23
  }
11
24
 
12
25
  interface BaseConfigConstructorParams {
13
- module: string;
14
- func: string;
15
- type: CallType;
26
+ module: string;
27
+ func: string;
16
28
  }
17
29
  declare class BaseConfig {
18
- readonly module: string;
19
- readonly func: string;
20
- readonly type: CallType;
21
- constructor({ module, func, type }: BaseConfigConstructorParams);
30
+ readonly module: string;
31
+ readonly func: string;
32
+ constructor({ module, func }: BaseConfigConstructorParams);
22
33
  }
23
34
 
24
- interface QueryConfigConstructorParams
25
- extends SetOptional<BaseConfigConstructorParams, 'type'> {
26
- args?: any[];
27
- transform: (data: any) => Promise<bigint>;
35
+ interface QueryConfigConstructorParams extends BaseConfigConstructorParams {
36
+ args?: unknown[];
37
+ transform: (data: any) => Promise<bigint>;
28
38
  }
29
39
  declare class SubstrateQueryConfig extends BaseConfig {
30
- readonly args: any[];
31
- readonly transform: (data: any) => Promise<bigint>;
32
- constructor({
33
- args,
34
- transform,
35
- type,
36
- ...other
37
- }: QueryConfigConstructorParams);
40
+ readonly args: unknown[];
41
+ readonly transform: (data: unknown) => Promise<bigint>;
42
+ static is(obj: unknown): obj is SubstrateQueryConfig;
43
+ constructor({ args, transform, ...other }: QueryConfigConstructorParams);
38
44
  }
39
45
 
40
- interface AssetMinConfigBuilder {
41
- build: (params: AssetMinConfigBuilderPrams) => SubstrateQueryConfig;
42
- }
43
- interface AssetMinConfigBuilderPrams {
44
- asset: ChainAssetId;
46
+ type AssetMinConfigBuilder = ConfigBuilder<SubstrateQueryConfig, AssetMinConfigBuilderParams>;
47
+ interface AssetMinConfigBuilderParams {
48
+ address?: string;
49
+ asset: ChainAssetId;
45
50
  }
46
51
 
47
52
  declare function AssetMinBuilder(): {
48
- assetRegistry: typeof assetRegistry;
49
- assets: typeof assets$1;
53
+ assetRegistry: typeof assetRegistry;
54
+ assets: typeof assets$1;
55
+ foreignAssets: typeof foreignAssets$1;
50
56
  };
51
57
  declare function assetRegistry(): {
52
- assetMetadatas: () => AssetMinConfigBuilder;
53
- currencyMetadatas: () => AssetMinConfigBuilder;
58
+ assetMetadatas: () => AssetMinConfigBuilder;
59
+ currencyMetadatas: () => AssetMinConfigBuilder;
60
+ metadata: () => AssetMinConfigBuilder;
54
61
  };
55
62
  declare function assets$1(): {
56
- asset: () => AssetMinConfigBuilder;
63
+ asset: () => AssetMinConfigBuilder;
64
+ };
65
+ declare function foreignAssets$1(): {
66
+ asset: () => AssetMinConfigBuilder;
57
67
  };
58
68
 
59
- interface ContractConfigConstructorParams
60
- extends Omit<BaseConfigConstructorParams, 'type'> {
61
- args: any[];
62
- address?: string;
69
+ interface ContractConfigConstructorParams extends BaseConfigConstructorParams {
70
+ address: string;
71
+ abi: Abi;
72
+ args: any[];
63
73
  }
64
74
  declare class ContractConfig extends BaseConfig {
65
- readonly args: any[];
66
- readonly address?: string;
67
- constructor({ args, address, ...other }: ContractConfigConstructorParams);
75
+ readonly address: string;
76
+ readonly abi: Abi;
77
+ readonly args: any[];
78
+ static is(obj: unknown): obj is ContractConfig;
79
+ constructor({ address, abi, args, ...other }: ContractConfigConstructorParams);
80
+ encodeFunctionData(): `0x${string}`;
68
81
  }
69
82
 
70
- interface ContractConfigBuilder {
71
- build: (params: ContractConfigBuilderPrams) => ContractConfig;
72
- }
73
- interface ContractConfigBuilderPrams {
74
- address: string;
75
- amount: bigint;
76
- asset: ChainAssetId;
77
- destination: AnyChain;
78
- fee: bigint;
79
- feeAsset: ChainAssetId;
83
+ type ContractConfigBuilder = ConfigBuilder<ContractConfig>;
84
+ type DestinationMultilocation = [
85
+ /**
86
+ * 0 - if destination is referring to a location in the same chain
87
+ * 1 - if transaction is going through or to a relay chain
88
+ * 2 - if transaction is going to a parachain in another ecosystem
89
+ */
90
+ 0 | 1 | 2,
91
+ ([
92
+ /**
93
+ * example '0x00000007DC'
94
+ * 7DC - parachain id in hex
95
+ * can be found here:
96
+ * - https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama-rpc.polkadot.io#/parachains
97
+ * - https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/parachains
98
+ */
99
+ string,
100
+ /**
101
+ * example '0x01%account%00',
102
+ * enum = 01 (AccountId32)
103
+ * networkId = 00 (any)
104
+ */
105
+ string
106
+ ] | [
107
+ /**
108
+ * example '0x01%account%00',
109
+ * enum = 01 (AccountId32)
110
+ * networkId = 00 (any)
111
+ */
112
+ string
113
+ ]
114
+ /**
115
+ * example 'Here',
116
+ */
117
+ | [])
118
+ ];
119
+ type AssetAddressFormat = (string | bigint | undefined)[];
120
+ declare enum TransferType {
121
+ Teleport = 0,
122
+ LocalReserve = 1,
123
+ DestinationReserve = 2
80
124
  }
125
+ type AssetMultilocation = [[number, string[]], bigint];
126
+
127
+ declare function XcmPrecompile(): {
128
+ transferAssetsToPara20: (shouldTransferAssetPrecedeFeeAsset?: boolean) => ContractConfigBuilder;
129
+ transferAssetsToPara32: (shouldTransferAssetPrecedeFeeAsset?: boolean) => ContractConfigBuilder;
130
+ transferAssetsToRelay: () => ContractConfigBuilder;
131
+ transferAssetsLocation: () => {
132
+ nativeAsset: () => ContractConfigBuilder;
133
+ localErc20: () => ContractConfigBuilder;
134
+ foreignAsset: () => ContractConfigBuilder;
135
+ foreignErc20: () => ContractConfigBuilder;
136
+ };
137
+ transferAssetsUsingTypeAndThenAddress: (shouldTransferAssetPrecedeFeeAsset?: boolean) => ContractConfigBuilder;
138
+ };
81
139
 
82
140
  declare function Xtokens(): {
83
- transfer: (weight?: number) => ContractConfigBuilder;
84
- transferMultiCurrencies: (weight?: number) => ContractConfigBuilder;
141
+ transfer: (weight?: bigint) => ContractConfigBuilder;
142
+ transferMultiCurrencies: (shouldTransferAssetPrecedeFeeAsset?: boolean, weight?: bigint) => ContractConfigBuilder;
143
+ transferWithEvmTo32: (weight?: bigint) => ContractConfigBuilder;
85
144
  };
86
145
 
87
146
  declare function ContractBuilder(): {
88
- Xtokens: typeof Xtokens;
147
+ Xtokens: typeof Xtokens;
148
+ XcmPrecompile: typeof XcmPrecompile;
89
149
  };
90
150
 
91
- interface BalanceConfigBuilder {
92
- build: (
93
- params: BalanceConfigBuilderPrams,
94
- ) => SubstrateQueryConfig | ContractConfig;
151
+ type EvmQueryFunctions = 'getBalance';
152
+ type EvmFunctionArgs = Parameters<PublicClient<HttpTransport>[EvmQueryFunctions]>;
153
+ interface EvmQueryConfigParams {
154
+ readonly args: EvmFunctionArgs;
155
+ readonly func: EvmQueryFunctions;
95
156
  }
96
- interface BalanceConfigBuilderPrams {
97
- address: string;
98
- asset: ChainAssetId;
157
+ declare class EvmQueryConfig {
158
+ readonly args: EvmFunctionArgs;
159
+ readonly func: EvmQueryFunctions;
160
+ static is(obj: unknown): obj is EvmQueryConfig;
161
+ constructor({ args, func }: EvmQueryConfigParams);
162
+ }
163
+
164
+ type BalanceConfigBuilder = ConfigBuilder<ContractConfig | SubstrateQueryConfig | EvmQueryConfig, BalanceBuilderParams>;
165
+ interface BalanceBuilderParams {
166
+ address: string;
167
+ asset: ChainAsset;
99
168
  }
100
169
  interface PalletBalancesAccountDataOld extends Struct {
101
- readonly free: u128;
102
- readonly reserved: u128;
103
- readonly miscFrozen: u128;
104
- readonly feeFrozen: u128;
170
+ readonly free: u128;
171
+ readonly reserved: u128;
172
+ readonly miscFrozen: u128;
173
+ readonly feeFrozen: u128;
105
174
  }
106
175
  interface TokensPalletAccountData {
107
- free: u128;
108
- reserved: u128;
109
- frozen: u128;
176
+ free: u128;
177
+ reserved: u128;
178
+ frozen: u128;
110
179
  }
111
- type EquilibriumSystemBalanceData = Array<
112
- [
180
+ type EquilibriumSystemBalanceData = Array<[
113
181
  number,
114
182
  {
115
- positive: number;
116
- },
117
- ]
118
- >;
183
+ positive: number;
184
+ }
185
+ ]>;
119
186
 
120
187
  declare function BalanceBuilder(): {
121
- evm: typeof evm;
122
- substrate: typeof substrate;
188
+ evm: typeof evm;
189
+ substrate: typeof substrate;
123
190
  };
124
191
  declare function evm(): {
125
- erc20: typeof erc20;
192
+ erc20: typeof erc20;
193
+ native: typeof native;
126
194
  };
195
+ declare function erc20(): BalanceConfigBuilder;
196
+ declare function native(): BalanceConfigBuilder;
127
197
  declare function substrate(): {
128
- assets: typeof assets;
129
- system: typeof system;
130
- tokens: typeof tokens;
198
+ assets: typeof assets;
199
+ foreignAssets: typeof foreignAssets;
200
+ system: typeof system;
201
+ tokens: typeof tokens;
131
202
  };
132
- declare function erc20(): BalanceConfigBuilder;
133
203
  declare function assets(): {
134
- account: () => BalanceConfigBuilder;
204
+ account: () => BalanceConfigBuilder;
205
+ };
206
+ declare function foreignAssets(): {
207
+ account: () => {
208
+ globalConsensus: () => BalanceConfigBuilder;
209
+ id: () => BalanceConfigBuilder;
210
+ };
135
211
  };
136
212
  declare function system(): {
137
- account: () => BalanceConfigBuilder;
138
- accountEquilibrium: () => BalanceConfigBuilder;
213
+ account: () => BalanceConfigBuilder;
214
+ accountEquilibrium: () => BalanceConfigBuilder;
215
+ accountEvmTo32: () => BalanceConfigBuilder;
139
216
  };
140
217
  declare function tokens(): {
141
- accounts: () => BalanceConfigBuilder;
218
+ accounts: () => BalanceConfigBuilder;
142
219
  };
220
+ declare function calculateSystemAccountBalance(response: FrameSystemAccountInfo): Promise<bigint>;
143
221
 
144
- interface ExtrinsicConfigConstructorParams
145
- extends Omit<BaseConfigConstructorParams, 'type'> {
146
- getArgs: (func?: SubmittableExtrinsicFunction<'promise'>) => any[];
222
+ declare const ERC20_ABI: readonly [{
223
+ readonly constant: true;
224
+ readonly inputs: readonly [];
225
+ readonly name: "name";
226
+ readonly outputs: readonly [{
227
+ readonly name: "";
228
+ readonly type: "string";
229
+ }];
230
+ readonly payable: false;
231
+ readonly stateMutability: "view";
232
+ readonly type: "function";
233
+ }, {
234
+ readonly constant: false;
235
+ readonly inputs: readonly [{
236
+ readonly name: "_spender";
237
+ readonly type: "address";
238
+ }, {
239
+ readonly name: "_value";
240
+ readonly type: "uint256";
241
+ }];
242
+ readonly name: "approve";
243
+ readonly outputs: readonly [{
244
+ readonly name: "";
245
+ readonly type: "bool";
246
+ }];
247
+ readonly payable: false;
248
+ readonly stateMutability: "nonpayable";
249
+ readonly type: "function";
250
+ }, {
251
+ readonly constant: true;
252
+ readonly inputs: readonly [];
253
+ readonly name: "totalSupply";
254
+ readonly outputs: readonly [{
255
+ readonly name: "";
256
+ readonly type: "uint256";
257
+ }];
258
+ readonly payable: false;
259
+ readonly stateMutability: "view";
260
+ readonly type: "function";
261
+ }, {
262
+ readonly constant: false;
263
+ readonly inputs: readonly [{
264
+ readonly name: "_from";
265
+ readonly type: "address";
266
+ }, {
267
+ readonly name: "_to";
268
+ readonly type: "address";
269
+ }, {
270
+ readonly name: "_value";
271
+ readonly type: "uint256";
272
+ }];
273
+ readonly name: "transferFrom";
274
+ readonly outputs: readonly [{
275
+ readonly name: "";
276
+ readonly type: "bool";
277
+ }];
278
+ readonly payable: false;
279
+ readonly stateMutability: "nonpayable";
280
+ readonly type: "function";
281
+ }, {
282
+ readonly constant: true;
283
+ readonly inputs: readonly [];
284
+ readonly name: "decimals";
285
+ readonly outputs: readonly [{
286
+ readonly name: "";
287
+ readonly type: "uint8";
288
+ }];
289
+ readonly payable: false;
290
+ readonly stateMutability: "view";
291
+ readonly type: "function";
292
+ }, {
293
+ readonly constant: true;
294
+ readonly inputs: readonly [{
295
+ readonly name: "_owner";
296
+ readonly type: "address";
297
+ }];
298
+ readonly name: "balanceOf";
299
+ readonly outputs: readonly [{
300
+ readonly name: "balance";
301
+ readonly type: "uint256";
302
+ }];
303
+ readonly payable: false;
304
+ readonly stateMutability: "view";
305
+ readonly type: "function";
306
+ }, {
307
+ readonly constant: true;
308
+ readonly inputs: readonly [];
309
+ readonly name: "symbol";
310
+ readonly outputs: readonly [{
311
+ readonly name: "";
312
+ readonly type: "string";
313
+ }];
314
+ readonly payable: false;
315
+ readonly stateMutability: "view";
316
+ readonly type: "function";
317
+ }, {
318
+ readonly constant: false;
319
+ readonly inputs: readonly [{
320
+ readonly name: "_to";
321
+ readonly type: "address";
322
+ }, {
323
+ readonly name: "_value";
324
+ readonly type: "uint256";
325
+ }];
326
+ readonly name: "transfer";
327
+ readonly outputs: readonly [{
328
+ readonly name: "";
329
+ readonly type: "bool";
330
+ }];
331
+ readonly payable: false;
332
+ readonly stateMutability: "nonpayable";
333
+ readonly type: "function";
334
+ }, {
335
+ readonly constant: true;
336
+ readonly inputs: readonly [{
337
+ readonly name: "_owner";
338
+ readonly type: "address";
339
+ }, {
340
+ readonly name: "_spender";
341
+ readonly type: "address";
342
+ }];
343
+ readonly name: "allowance";
344
+ readonly outputs: readonly [{
345
+ readonly name: "";
346
+ readonly type: "uint256";
347
+ }];
348
+ readonly payable: false;
349
+ readonly stateMutability: "view";
350
+ readonly type: "function";
351
+ }, {
352
+ readonly payable: true;
353
+ readonly stateMutability: "payable";
354
+ readonly type: "fallback";
355
+ }, {
356
+ readonly anonymous: false;
357
+ readonly inputs: readonly [{
358
+ readonly indexed: true;
359
+ readonly name: "owner";
360
+ readonly type: "address";
361
+ }, {
362
+ readonly indexed: true;
363
+ readonly name: "spender";
364
+ readonly type: "address";
365
+ }, {
366
+ readonly indexed: false;
367
+ readonly name: "value";
368
+ readonly type: "uint256";
369
+ }];
370
+ readonly name: "Approval";
371
+ readonly type: "event";
372
+ }, {
373
+ readonly anonymous: false;
374
+ readonly inputs: readonly [{
375
+ readonly indexed: true;
376
+ readonly name: "from";
377
+ readonly type: "address";
378
+ }, {
379
+ readonly indexed: true;
380
+ readonly name: "to";
381
+ readonly type: "address";
382
+ }, {
383
+ readonly indexed: false;
384
+ readonly name: "value";
385
+ readonly type: "uint256";
386
+ }];
387
+ readonly name: "Transfer";
388
+ readonly type: "event";
389
+ }];
390
+
391
+ interface ExtrinsicConfigConstructorParams extends Omit<BaseConfigConstructorParams, 'type'> {
392
+ getArgs: (func?: SubmittableExtrinsicFunction<'promise'>) => any[];
147
393
  }
148
394
  declare class ExtrinsicConfig extends BaseConfig {
149
- getArgs: (func?: SubmittableExtrinsicFunction<'promise'>) => any[];
150
- constructor({ getArgs, ...other }: ExtrinsicConfigConstructorParams);
395
+ getArgs: (func?: SubmittableExtrinsicFunction<'promise'>) => any[];
396
+ static is(obj: unknown): obj is ExtrinsicConfig;
397
+ constructor({ getArgs, ...other }: ExtrinsicConfigConstructorParams);
151
398
  }
152
399
 
153
- interface ExtrinsicConfigBuilder {
154
- build: (params: ExtrinsicConfigBuilderPrams) => ExtrinsicConfig;
155
- }
156
- interface ExtrinsicConfigBuilderPrams {
157
- address: string;
158
- amount: bigint;
159
- asset: ChainAssetId;
160
- destination: AnyChain;
161
- fee: bigint;
162
- feeAsset: ChainAssetId;
163
- palletInstance?: number;
164
- source: AnyChain;
165
- }
400
+ type ExtrinsicConfigBuilder = ConfigBuilder<ExtrinsicConfig>;
166
401
  declare enum XcmVersion {
167
- v1 = 'V1',
168
- v2 = 'V2',
169
- v3 = 'V3',
402
+ v1 = "V1",
403
+ v2 = "V2",
404
+ v3 = "V3",
405
+ v4 = "V4",
406
+ v5 = "V5"
170
407
  }
171
408
  type Parents = 0 | 1;
172
409
 
173
410
  declare function eqBalances(): {
174
- xcmTransfer: () => ExtrinsicConfigBuilder;
175
- transferXcm: () => ExtrinsicConfigBuilder;
411
+ xcmTransfer: () => ExtrinsicConfigBuilder;
412
+ transferXcm: () => ExtrinsicConfigBuilder;
176
413
  };
177
414
 
178
- declare function polkadotXcm(): {
179
- limitedReserveTransferAssets: () => {
180
- here: () => ExtrinsicConfigBuilder;
181
- X1: () => ExtrinsicConfigBuilder;
182
- X2: () => ExtrinsicConfigBuilder;
183
- };
184
- limitedReserveWithdrawAssets: () => {
185
- X2: () => ExtrinsicConfigBuilder;
186
- };
415
+ declare function polkadotXcm$1(): {
416
+ limitedReserveTransferAssets: () => {
417
+ here: () => ExtrinsicConfigBuilder;
418
+ X1: () => ExtrinsicConfigBuilder;
419
+ X2: () => ExtrinsicConfigBuilder;
420
+ X2PalletInstance: () => ExtrinsicConfigBuilder;
421
+ };
422
+ limitedReserveWithdrawAssets: () => {
423
+ X2: () => ExtrinsicConfigBuilder;
424
+ };
425
+ transferAssets: () => {
426
+ here: (parents?: number) => ExtrinsicConfigBuilder;
427
+ X1: () => ExtrinsicConfigBuilder;
428
+ X1GeneralKey: () => ExtrinsicConfigBuilder;
429
+ X2: () => ExtrinsicConfigBuilder;
430
+ X3: () => ExtrinsicConfigBuilder;
431
+ X2AndFeeHere: () => ExtrinsicConfigBuilder;
432
+ };
433
+ transferAssetsUsingTypeAndThen: () => {
434
+ here: (parents?: number) => ExtrinsicConfigBuilder;
435
+ X2: (parents?: number) => ExtrinsicConfigBuilder;
436
+ globalConsensusEthereum: () => ExtrinsicConfigBuilder;
437
+ };
438
+ transferAssetsToEcosystem: () => {
439
+ X1: () => ExtrinsicConfigBuilder;
440
+ X2: () => ExtrinsicConfigBuilder;
441
+ X3: () => ExtrinsicConfigBuilder;
442
+ X4: () => ExtrinsicConfigBuilder;
443
+ };
187
444
  };
188
445
 
189
- declare function xTokens(): {
190
- transfer: () => ExtrinsicConfigBuilder;
191
- transferMultiAsset: (originParachainId: number) => {
192
- X1: () => ExtrinsicConfigBuilder;
193
- X2: () => ExtrinsicConfigBuilder;
194
- };
195
- transferMultiCurrencies: () => ExtrinsicConfigBuilder;
446
+ declare function xcmPallet(): {
447
+ limitedReserveTransferAssets: (parents?: Parents) => {
448
+ here: () => ExtrinsicConfigBuilder;
449
+ };
450
+ transferAssetsUsingTypeAndThen: () => {
451
+ here: () => ExtrinsicConfigBuilder;
452
+ };
196
453
  };
197
454
 
198
- declare function xTransfer(): {
199
- transfer: () => {
200
- here: () => ExtrinsicConfigBuilder;
201
- X2: () => ExtrinsicConfigBuilder;
202
- };
455
+ declare function xTokens(): {
456
+ transfer: () => ExtrinsicConfigBuilder;
457
+ transferMultiAsset: (originParachainId: number) => {
458
+ here: () => ExtrinsicConfigBuilder;
459
+ X1: () => ExtrinsicConfigBuilder;
460
+ X2: () => ExtrinsicConfigBuilder;
461
+ };
462
+ transferMultiCurrencies: () => ExtrinsicConfigBuilder;
203
463
  };
204
464
 
205
- declare function xcmPallet(): {
206
- limitedReserveTransferAssets: (parents?: Parents) => {
207
- here: () => ExtrinsicConfigBuilder;
208
- };
465
+ declare function xTransfer(): {
466
+ transfer: () => {
467
+ here: () => ExtrinsicConfigBuilder;
468
+ X2: () => ExtrinsicConfigBuilder;
469
+ };
209
470
  };
210
471
 
211
472
  declare function ExtrinsicBuilder(): {
212
- eqBalances: typeof eqBalances;
213
- xTokens: typeof xTokens;
214
- xTransfer: typeof xTransfer;
215
- polkadotXcm: typeof polkadotXcm;
216
- xcmPallet: typeof xcmPallet;
473
+ eqBalances: typeof eqBalances;
474
+ xTokens: typeof xTokens;
475
+ xTransfer: typeof xTransfer;
476
+ polkadotXcm: typeof polkadotXcm$1;
477
+ xcmPallet: typeof xcmPallet;
217
478
  };
218
479
 
219
480
  interface SubstrateCallConfigConstructorParams {
220
- api: ApiPromise;
221
- call: () => Promise<bigint>;
481
+ api: ApiPromise;
482
+ call: () => Promise<bigint>;
222
483
  }
223
484
  declare class SubstrateCallConfig {
224
- readonly api: ApiPromise;
225
- readonly call: () => Promise<any>;
226
- readonly type = CallType.Substrate;
227
- constructor({ api, call }: SubstrateCallConfigConstructorParams);
485
+ readonly api: ApiPromise;
486
+ readonly call: () => Promise<any>;
487
+ static is(obj: unknown): obj is SubstrateCallConfig;
488
+ constructor({ api, call }: SubstrateCallConfigConstructorParams);
228
489
  }
229
490
 
230
- interface FeeConfigBuilder {
231
- build: (params: FeeConfigBuilderPrams) => SubstrateCallConfig;
491
+ type FeeConfigBuilder = ConfigBuilder<SubstrateCallConfig, FeeConfigBuilderParams>;
492
+ interface FeeConfigBuilderParams {
493
+ address: string;
494
+ api: ApiPromise;
495
+ asset: ChainAsset;
496
+ destination: AnyParachain;
497
+ feeAsset: ChainAsset;
498
+ source: AnyChain;
499
+ }
500
+ interface XcmPaymentFeeProps {
501
+ isAssetReserveChain: boolean;
502
+ shouldTransferAssetPrecedeFeeAsset?: boolean;
503
+ isEcosystemBridge?: boolean;
504
+ parents?: number;
232
505
  }
233
- interface FeeConfigBuilderPrams {
234
- asset: ChainAssetId;
235
- api: ApiPromise;
506
+ interface MoonbeamRuntimeXcmConfigAssetType extends Enum {
507
+ readonly isXcm: boolean;
508
+ readonly asXcm: StagingXcmV3MultiLocation;
509
+ readonly type: 'Xcm';
236
510
  }
511
+ type GetVersionedAssetId = (params: FeeConfigBuilderParams) => Promise<object> | object;
512
+
513
+ declare function xcmPaymentApi(): {
514
+ fromCurrencyIdToLocations: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
515
+ fromAssetIdQuery: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
516
+ fromSourceAccountKey20: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
517
+ fromSourcePalletInstance: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
518
+ fromHere: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
519
+ fromHereAndGeneralIndex: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
520
+ fromPalletInstanceAndGeneralIndex: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
521
+ fromHereAndSourceGeneralIndex: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
522
+ fromGeneralIndex: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
523
+ fromPalletInstance: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
524
+ fromPalletInstanceAndAccountKey20: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
525
+ fromGlobalConsensus: (options: XcmPaymentFeeProps) => FeeConfigBuilder;
526
+ };
237
527
 
238
528
  declare function FeeBuilder(): {
239
- assetManager: typeof assetManager;
240
- };
241
- declare function assetManager(): {
242
- assetTypeUnitsPerSecond: (weight?: number) => FeeConfigBuilder;
243
- };
244
-
245
- export {
246
- AssetMinBuilder,
247
- AssetMinConfigBuilder,
248
- AssetMinConfigBuilderPrams,
249
- BalanceBuilder,
250
- BalanceConfigBuilder,
251
- BalanceConfigBuilderPrams,
252
- BaseConfig,
253
- BaseConfigConstructorParams,
254
- CallType,
255
- ContractBuilder,
256
- ContractConfig,
257
- ContractConfigBuilder,
258
- ContractConfigBuilderPrams,
259
- ContractConfigConstructorParams,
260
- EquilibriumSystemBalanceData,
261
- ExtrinsicBuilder,
262
- ExtrinsicConfig,
263
- ExtrinsicConfigBuilder,
264
- ExtrinsicConfigBuilderPrams,
265
- ExtrinsicConfigConstructorParams,
266
- FeeBuilder,
267
- FeeConfigBuilder,
268
- FeeConfigBuilderPrams,
269
- PalletBalancesAccountDataOld,
270
- Parents,
271
- QueryConfigConstructorParams,
272
- SubstrateQueryConfig,
273
- TokensPalletAccountData,
274
- XcmVersion,
275
- evm,
276
- substrate,
529
+ xcmPaymentApi: typeof xcmPaymentApi;
530
+ };
531
+
532
+ type SourceChecker = (events: EventRecord[], sourceAddress: string) => {
533
+ matched: boolean;
534
+ messageId?: string;
535
+ event?: EventRecord;
277
536
  };
537
+ type DestinationChecker = (events: EventRecord[], messageId?: string) => {
538
+ matched: boolean;
539
+ success: boolean;
540
+ event?: EventRecord;
541
+ };
542
+ interface MonitorEventReturn {
543
+ xcmPallet: () => {
544
+ messageQueue: () => EventMonitoringConfig$1;
545
+ };
546
+ polkadotXcm: () => {
547
+ messageQueue: () => EventMonitoringConfig$1;
548
+ mixedQueue: () => EventMonitoringConfig$1;
549
+ xcmpQueue: () => EventMonitoringConfig$1;
550
+ };
551
+ xTokens: () => {
552
+ messageQueue: () => EventMonitoringConfig$1;
553
+ ethereumXcm: () => EventMonitoringConfig$1;
554
+ };
555
+ bridgeMessages: () => {
556
+ bridgeMessages: () => EventMonitoringConfig$1;
557
+ };
558
+ }
559
+ interface EventMonitoringConfig$1 {
560
+ checkSource: SourceChecker;
561
+ checkDestination: DestinationChecker;
562
+ }
563
+
564
+ declare function monitorEvent(): MonitorEventReturn;
565
+
566
+ declare function MonitoringBuilder(): {
567
+ monitorEvent: typeof monitorEvent;
568
+ };
569
+
570
+ interface MonitoringBuilderConfig {
571
+ eventMonitoring: EventMonitoringConfig;
572
+ }
573
+ interface EventMonitoringConfig {
574
+ checkSource: SourceChecker;
575
+ checkDestination: DestinationChecker;
576
+ }
577
+
578
+ declare enum Protocols {
579
+ TokenBridge = "TokenBridge",
580
+ AutomaticTokenBridge = "AutomaticTokenBridge",
581
+ ExecutorTokenBridge = "ExecutorTokenBridge"
582
+ }
583
+ type WormholeTransferFunctions = 'tokenTransfer';
584
+ interface WormholeFunctionArgs {
585
+ token: TokenId;
586
+ amount: bigint;
587
+ from: ChainAddress;
588
+ to: ChainAddress;
589
+ protocol: TokenTransfer.Protocol;
590
+ payload?: Uint8Array;
591
+ }
592
+ interface WormholeConfigConstructorParams {
593
+ args: WormholeFunctionArgs;
594
+ func: WormholeTransferFunctions;
595
+ }
596
+ declare class WormholeConfig {
597
+ readonly args: WormholeFunctionArgs;
598
+ readonly func: WormholeTransferFunctions;
599
+ static is(obj: unknown): obj is WormholeConfig;
600
+ constructor({ args, func }: WormholeConfigConstructorParams);
601
+ }
602
+
603
+ declare function wormhole$1(): {
604
+ tokenTransfer: () => MrlConfigBuilder;
605
+ };
606
+
607
+ declare function wormholeFactory(chain: AnyChain): Wormhole<"Testnet" | "Mainnet">;
608
+
609
+ type MrlConfigBuilder = ConfigBuilder<ContractConfig | ExtrinsicConfig | WormholeConfig, MrlBuilderParams>;
610
+ type MrlExecuteConfigBuilder = ConfigBuilder<ContractConfig, MrlExecuteBuilderParams>;
611
+ interface MrlBuilderParams extends BuilderParams<AnyChain> {
612
+ isAutomatic: boolean;
613
+ moonApi: ApiPromise;
614
+ moonAsset: ChainAsset;
615
+ moonChain: EvmParachain;
616
+ moonGasLimit?: bigint;
617
+ sendOnlyRemoteExecution?: boolean;
618
+ transact?: Transact;
619
+ }
620
+ interface MrlExecuteBuilderParams {
621
+ bytes?: Uint8Array;
622
+ }
623
+ interface Transact {
624
+ call: HexString;
625
+ txWeight: {
626
+ refTime: bigint;
627
+ proofSize: bigint;
628
+ };
629
+ }
630
+
631
+ declare function Batch(): {
632
+ transferAssetsAndMessage: () => MrlConfigBuilder;
633
+ };
634
+
635
+ declare function Gmp(): {
636
+ wormholeTransferERC20: () => MrlExecuteConfigBuilder;
637
+ };
638
+
639
+ declare function TokenBridge(): {
640
+ transferTokens: () => MrlConfigBuilder;
641
+ };
642
+
643
+ declare function TokenBridgeRelayer(): {
644
+ transferTokensWithRelay: () => MrlConfigBuilder;
645
+ };
646
+
647
+ declare function contract(): {
648
+ Batch: typeof Batch;
649
+ Gmp: typeof Gmp;
650
+ TokenBridge: typeof TokenBridge;
651
+ TokenBridgeRelayer: typeof TokenBridgeRelayer;
652
+ };
653
+
654
+ declare function ethereumXcm(): {
655
+ transact: () => MrlConfigBuilder;
656
+ };
657
+
658
+ declare function polkadotXcm(): {
659
+ send: () => MrlConfigBuilder;
660
+ };
661
+
662
+ declare function extrinsic(): {
663
+ ethereumXcm: typeof ethereumXcm;
664
+ polkadotXcm: typeof polkadotXcm;
665
+ };
666
+
667
+ declare const BATCH_CONTRACT_ABI: readonly [{
668
+ readonly anonymous: false;
669
+ readonly inputs: readonly [{
670
+ readonly indexed: false;
671
+ readonly internalType: "uint256";
672
+ readonly name: "index";
673
+ readonly type: "uint256";
674
+ }];
675
+ readonly name: "SubcallFailed";
676
+ readonly type: "event";
677
+ }, {
678
+ readonly anonymous: false;
679
+ readonly inputs: readonly [{
680
+ readonly indexed: false;
681
+ readonly internalType: "uint256";
682
+ readonly name: "index";
683
+ readonly type: "uint256";
684
+ }];
685
+ readonly name: "SubcallSucceeded";
686
+ readonly type: "event";
687
+ }, {
688
+ readonly inputs: readonly [{
689
+ readonly internalType: "address[]";
690
+ readonly name: "to";
691
+ readonly type: "address[]";
692
+ }, {
693
+ readonly internalType: "uint256[]";
694
+ readonly name: "value";
695
+ readonly type: "uint256[]";
696
+ }, {
697
+ readonly internalType: "bytes[]";
698
+ readonly name: "callData";
699
+ readonly type: "bytes[]";
700
+ }, {
701
+ readonly internalType: "uint64[]";
702
+ readonly name: "gasLimit";
703
+ readonly type: "uint64[]";
704
+ }];
705
+ readonly name: "batchAll";
706
+ readonly outputs: readonly [];
707
+ readonly stateMutability: "nonpayable";
708
+ readonly type: "function";
709
+ }, {
710
+ readonly inputs: readonly [{
711
+ readonly internalType: "address[]";
712
+ readonly name: "to";
713
+ readonly type: "address[]";
714
+ }, {
715
+ readonly internalType: "uint256[]";
716
+ readonly name: "value";
717
+ readonly type: "uint256[]";
718
+ }, {
719
+ readonly internalType: "bytes[]";
720
+ readonly name: "callData";
721
+ readonly type: "bytes[]";
722
+ }, {
723
+ readonly internalType: "uint64[]";
724
+ readonly name: "gasLimit";
725
+ readonly type: "uint64[]";
726
+ }];
727
+ readonly name: "batchSome";
728
+ readonly outputs: readonly [];
729
+ readonly stateMutability: "nonpayable";
730
+ readonly type: "function";
731
+ }, {
732
+ readonly inputs: readonly [{
733
+ readonly internalType: "address[]";
734
+ readonly name: "to";
735
+ readonly type: "address[]";
736
+ }, {
737
+ readonly internalType: "uint256[]";
738
+ readonly name: "value";
739
+ readonly type: "uint256[]";
740
+ }, {
741
+ readonly internalType: "bytes[]";
742
+ readonly name: "callData";
743
+ readonly type: "bytes[]";
744
+ }, {
745
+ readonly internalType: "uint64[]";
746
+ readonly name: "gasLimit";
747
+ readonly type: "uint64[]";
748
+ }];
749
+ readonly name: "batchSomeUntilFailure";
750
+ readonly outputs: readonly [];
751
+ readonly stateMutability: "nonpayable";
752
+ readonly type: "function";
753
+ }];
754
+
755
+ declare function wormhole(): {
756
+ contract: typeof contract;
757
+ extrinsic: typeof extrinsic;
758
+ wormhole: typeof wormhole$1;
759
+ };
760
+
761
+ declare function MrlBuilder(): {
762
+ wormhole: typeof wormhole;
763
+ };
764
+
765
+ declare const BATCH_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000000808";
766
+
767
+ export { type AssetAddressFormat, AssetMinBuilder, type AssetMinConfigBuilder, type AssetMinConfigBuilderParams, type AssetMultilocation, BATCH_CONTRACT_ABI, BATCH_CONTRACT_ADDRESS, BalanceBuilder, type BalanceBuilderParams, type BalanceConfigBuilder, type BuilderParams, type ConfigBuilder, ContractBuilder, ContractConfig, type ContractConfigBuilder, type ContractConfigConstructorParams, type DestinationMultilocation, ERC20_ABI, type EquilibriumSystemBalanceData, type EventMonitoringConfig, type EvmFunctionArgs, EvmQueryConfig, type EvmQueryConfigParams, type EvmQueryFunctions, ExtrinsicBuilder, ExtrinsicConfig, type ExtrinsicConfigBuilder, type ExtrinsicConfigConstructorParams, FeeBuilder, type FeeConfigBuilder, type FeeConfigBuilderParams, type GetVersionedAssetId, MonitoringBuilder, type MonitoringBuilderConfig, type MoonbeamRuntimeXcmConfigAssetType, MrlBuilder, type MrlBuilderParams, type MrlConfigBuilder, type MrlExecuteBuilderParams, type MrlExecuteConfigBuilder, type PalletBalancesAccountDataOld, type Parents, Protocols, type QueryConfigConstructorParams, SubstrateCallConfig, type SubstrateCallConfigConstructorParams, SubstrateQueryConfig, type TokensPalletAccountData, type Transact, TransferType, WormholeConfig, type WormholeConfigConstructorParams, type WormholeFunctionArgs, type WormholeTransferFunctions, type XcmPaymentFeeProps, XcmVersion, calculateSystemAccountBalance, evm, substrate, wormhole, wormholeFactory };