@moonbeam-network/xcm-builder 3.0.9 → 3.1.1
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 +7 -0
- package/build/index.mjs +631 -97
- package/build/index.mjs.map +1 -1
- package/package.json +1 -1
package/build/index.mjs
CHANGED
|
@@ -135,6 +135,15 @@ function assetRegistry() {
|
|
|
135
135
|
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
136
136
|
transform: async (response) => response.unwrapOrDefault().minimalBalance.toBigInt()
|
|
137
137
|
})
|
|
138
|
+
}),
|
|
139
|
+
metadata: () => ({
|
|
140
|
+
build: ({ asset }) => new SubstrateQueryConfig({
|
|
141
|
+
module: pallet6,
|
|
142
|
+
func: "metadata",
|
|
143
|
+
args: [asset],
|
|
144
|
+
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
145
|
+
transform: async (response) => response.unwrapOrDefault().existentialDeposit.toBigInt()
|
|
146
|
+
})
|
|
138
147
|
})
|
|
139
148
|
};
|
|
140
149
|
}
|
|
@@ -164,76 +173,640 @@ function foreignAssets() {
|
|
|
164
173
|
interior: {
|
|
165
174
|
X2: [
|
|
166
175
|
{
|
|
167
|
-
globalconsensus: {
|
|
168
|
-
ethereum: {
|
|
169
|
-
chainId: 1
|
|
170
|
-
}
|
|
171
|
-
}
|
|
176
|
+
globalconsensus: {
|
|
177
|
+
ethereum: {
|
|
178
|
+
chainId: 1
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
getExtrinsicAccount(address)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return new SubstrateQueryConfig({
|
|
187
|
+
module: "foreignAssets",
|
|
188
|
+
func: "asset",
|
|
189
|
+
args: [multilocation],
|
|
190
|
+
transform: async (response) => response.unwrapOrDefault().minBalance.toBigInt()
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/balance/BalanceBuilder.ts
|
|
198
|
+
import { evmToAddress as evmToAddress2 } from "@polkadot/util-crypto";
|
|
199
|
+
|
|
200
|
+
// src/types/evm/ContractConfig.ts
|
|
201
|
+
import { encodeFunctionData } from "viem";
|
|
202
|
+
var ContractConfig = class _ContractConfig extends BaseConfig {
|
|
203
|
+
address;
|
|
204
|
+
abi;
|
|
205
|
+
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
206
|
+
args;
|
|
207
|
+
static is(obj) {
|
|
208
|
+
return obj instanceof _ContractConfig;
|
|
209
|
+
}
|
|
210
|
+
constructor({
|
|
211
|
+
address,
|
|
212
|
+
abi,
|
|
213
|
+
args,
|
|
214
|
+
...other
|
|
215
|
+
}) {
|
|
216
|
+
super({ ...other });
|
|
217
|
+
this.address = address;
|
|
218
|
+
this.abi = abi;
|
|
219
|
+
this.args = args;
|
|
220
|
+
}
|
|
221
|
+
encodeFunctionData() {
|
|
222
|
+
return encodeFunctionData({
|
|
223
|
+
abi: this.abi,
|
|
224
|
+
functionName: this.func,
|
|
225
|
+
args: this.args
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// src/contract/contracts/XcmPrecompile/XcmPrecompile.ts
|
|
231
|
+
import { u8aToHex as u8aToHex2 } from "@polkadot/util";
|
|
232
|
+
import { decodeAddress as decodeAddress2 } from "@polkadot/util-crypto";
|
|
233
|
+
|
|
234
|
+
// src/types/evm/EvmQueryConfig.ts
|
|
235
|
+
var EvmQueryConfig = class _EvmQueryConfig {
|
|
236
|
+
args;
|
|
237
|
+
func;
|
|
238
|
+
static is(obj) {
|
|
239
|
+
return obj instanceof _EvmQueryConfig;
|
|
240
|
+
}
|
|
241
|
+
constructor({ args, func }) {
|
|
242
|
+
this.args = args;
|
|
243
|
+
this.func = func;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// src/types/substrate/ExtrinsicConfig.ts
|
|
248
|
+
var ExtrinsicConfig = class _ExtrinsicConfig extends BaseConfig {
|
|
249
|
+
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
250
|
+
getArgs;
|
|
251
|
+
static is(obj) {
|
|
252
|
+
return obj instanceof _ExtrinsicConfig;
|
|
253
|
+
}
|
|
254
|
+
constructor({ getArgs, ...other }) {
|
|
255
|
+
super({ ...other });
|
|
256
|
+
this.getArgs = getArgs;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// src/types/substrate/SubstrateCallConfig.ts
|
|
261
|
+
var SubstrateCallConfig = class _SubstrateCallConfig {
|
|
262
|
+
api;
|
|
263
|
+
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
264
|
+
call;
|
|
265
|
+
static is(obj) {
|
|
266
|
+
return obj instanceof _SubstrateCallConfig;
|
|
267
|
+
}
|
|
268
|
+
constructor({ api, call }) {
|
|
269
|
+
this.api = api;
|
|
270
|
+
this.call = call;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
// src/contract/contracts/XcmPrecompile/XcmPrecompileAbi.ts
|
|
275
|
+
var XCM_ABI = [
|
|
276
|
+
{
|
|
277
|
+
inputs: [
|
|
278
|
+
{
|
|
279
|
+
components: [
|
|
280
|
+
{
|
|
281
|
+
internalType: "uint8",
|
|
282
|
+
name: "parents",
|
|
283
|
+
type: "uint8"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
internalType: "bytes[]",
|
|
287
|
+
name: "interior",
|
|
288
|
+
type: "bytes[]"
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
internalType: "struct XCM.Location",
|
|
292
|
+
name: "dest",
|
|
293
|
+
type: "tuple"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
components: [
|
|
297
|
+
{
|
|
298
|
+
internalType: "uint8",
|
|
299
|
+
name: "parents",
|
|
300
|
+
type: "uint8"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
internalType: "bytes[]",
|
|
304
|
+
name: "interior",
|
|
305
|
+
type: "bytes[]"
|
|
306
|
+
}
|
|
307
|
+
],
|
|
308
|
+
internalType: "struct XCM.Location",
|
|
309
|
+
name: "beneficiary",
|
|
310
|
+
type: "tuple"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
components: [
|
|
314
|
+
{
|
|
315
|
+
components: [
|
|
316
|
+
{
|
|
317
|
+
internalType: "uint8",
|
|
318
|
+
name: "parents",
|
|
319
|
+
type: "uint8"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
internalType: "bytes[]",
|
|
323
|
+
name: "interior",
|
|
324
|
+
type: "bytes[]"
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
internalType: "struct XCM.Location",
|
|
328
|
+
name: "location",
|
|
329
|
+
type: "tuple"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
internalType: "uint256",
|
|
333
|
+
name: "amount",
|
|
334
|
+
type: "uint256"
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
internalType: "struct XCM.AssetLocationInfo[]",
|
|
338
|
+
name: "assets",
|
|
339
|
+
type: "tuple[]"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
internalType: "uint32",
|
|
343
|
+
name: "feeAssetItem",
|
|
344
|
+
type: "uint32"
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
name: "transferAssetsLocation",
|
|
348
|
+
outputs: [],
|
|
349
|
+
stateMutability: "nonpayable",
|
|
350
|
+
type: "function"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
inputs: [
|
|
354
|
+
{
|
|
355
|
+
internalType: "uint32",
|
|
356
|
+
name: "paraId",
|
|
357
|
+
type: "uint32"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
internalType: "address",
|
|
361
|
+
name: "beneficiary",
|
|
362
|
+
type: "address"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
components: [
|
|
366
|
+
{
|
|
367
|
+
internalType: "address",
|
|
368
|
+
name: "asset",
|
|
369
|
+
type: "address"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
internalType: "uint256",
|
|
373
|
+
name: "amount",
|
|
374
|
+
type: "uint256"
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
internalType: "struct XCM.AssetAddressInfo[]",
|
|
378
|
+
name: "assets",
|
|
379
|
+
type: "tuple[]"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
internalType: "uint32",
|
|
383
|
+
name: "feeAssetItem",
|
|
384
|
+
type: "uint32"
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
name: "transferAssetsToPara20",
|
|
388
|
+
outputs: [],
|
|
389
|
+
stateMutability: "nonpayable",
|
|
390
|
+
type: "function"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
inputs: [
|
|
394
|
+
{
|
|
395
|
+
internalType: "uint32",
|
|
396
|
+
name: "paraId",
|
|
397
|
+
type: "uint32"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
internalType: "bytes32",
|
|
401
|
+
name: "beneficiary",
|
|
402
|
+
type: "bytes32"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
components: [
|
|
406
|
+
{
|
|
407
|
+
internalType: "address",
|
|
408
|
+
name: "asset",
|
|
409
|
+
type: "address"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
internalType: "uint256",
|
|
413
|
+
name: "amount",
|
|
414
|
+
type: "uint256"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
internalType: "struct XCM.AssetAddressInfo[]",
|
|
418
|
+
name: "assets",
|
|
419
|
+
type: "tuple[]"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
internalType: "uint32",
|
|
423
|
+
name: "feeAssetItem",
|
|
424
|
+
type: "uint32"
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
name: "transferAssetsToPara32",
|
|
428
|
+
outputs: [],
|
|
429
|
+
stateMutability: "nonpayable",
|
|
430
|
+
type: "function"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
inputs: [
|
|
434
|
+
{
|
|
435
|
+
internalType: "bytes32",
|
|
436
|
+
name: "beneficiary",
|
|
437
|
+
type: "bytes32"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
components: [
|
|
441
|
+
{
|
|
442
|
+
internalType: "address",
|
|
443
|
+
name: "asset",
|
|
444
|
+
type: "address"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
internalType: "uint256",
|
|
448
|
+
name: "amount",
|
|
449
|
+
type: "uint256"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
internalType: "struct XCM.AssetAddressInfo[]",
|
|
453
|
+
name: "assets",
|
|
454
|
+
type: "tuple[]"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
internalType: "uint32",
|
|
458
|
+
name: "feeAssetItem",
|
|
459
|
+
type: "uint32"
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
name: "transferAssetsToRelay",
|
|
463
|
+
outputs: [],
|
|
464
|
+
stateMutability: "nonpayable",
|
|
465
|
+
type: "function"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
inputs: [
|
|
469
|
+
{
|
|
470
|
+
components: [
|
|
471
|
+
{
|
|
472
|
+
internalType: "uint8",
|
|
473
|
+
name: "parents",
|
|
474
|
+
type: "uint8"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
internalType: "bytes[]",
|
|
478
|
+
name: "interior",
|
|
479
|
+
type: "bytes[]"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
internalType: "struct XCM.Location",
|
|
483
|
+
name: "dest",
|
|
484
|
+
type: "tuple"
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
components: [
|
|
488
|
+
{
|
|
489
|
+
internalType: "address",
|
|
490
|
+
name: "asset",
|
|
491
|
+
type: "address"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
internalType: "uint256",
|
|
495
|
+
name: "amount",
|
|
496
|
+
type: "uint256"
|
|
497
|
+
}
|
|
498
|
+
],
|
|
499
|
+
internalType: "struct XCM.AssetAddressInfo[]",
|
|
500
|
+
name: "assets",
|
|
501
|
+
type: "tuple[]"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
internalType: "enum XCM.TransferType",
|
|
505
|
+
name: "assetsTransferType",
|
|
506
|
+
type: "uint8"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
internalType: "uint8",
|
|
510
|
+
name: "remoteFeesIdIndex",
|
|
511
|
+
type: "uint8"
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
internalType: "enum XCM.TransferType",
|
|
515
|
+
name: "feesTransferType",
|
|
516
|
+
type: "uint8"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
internalType: "bytes",
|
|
520
|
+
name: "customXcmOnDest",
|
|
521
|
+
type: "bytes"
|
|
522
|
+
}
|
|
523
|
+
],
|
|
524
|
+
name: "transferAssetsUsingTypeAndThenAddress",
|
|
525
|
+
outputs: [],
|
|
526
|
+
stateMutability: "nonpayable",
|
|
527
|
+
type: "function"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
inputs: [
|
|
531
|
+
{
|
|
532
|
+
components: [
|
|
533
|
+
{
|
|
534
|
+
internalType: "uint8",
|
|
535
|
+
name: "parents",
|
|
536
|
+
type: "uint8"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
internalType: "bytes[]",
|
|
540
|
+
name: "interior",
|
|
541
|
+
type: "bytes[]"
|
|
542
|
+
}
|
|
543
|
+
],
|
|
544
|
+
internalType: "struct XCM.Location",
|
|
545
|
+
name: "dest",
|
|
546
|
+
type: "tuple"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
components: [
|
|
550
|
+
{
|
|
551
|
+
internalType: "address",
|
|
552
|
+
name: "asset",
|
|
553
|
+
type: "address"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
internalType: "uint256",
|
|
557
|
+
name: "amount",
|
|
558
|
+
type: "uint256"
|
|
559
|
+
}
|
|
560
|
+
],
|
|
561
|
+
internalType: "struct XCM.AssetAddressInfo[]",
|
|
562
|
+
name: "assets",
|
|
563
|
+
type: "tuple[]"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
internalType: "uint8",
|
|
567
|
+
name: "remoteFeesIdIndex",
|
|
568
|
+
type: "uint8"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
internalType: "bytes",
|
|
572
|
+
name: "customXcmOnDest",
|
|
573
|
+
type: "bytes"
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
components: [
|
|
577
|
+
{
|
|
578
|
+
internalType: "uint8",
|
|
579
|
+
name: "parents",
|
|
580
|
+
type: "uint8"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
internalType: "bytes[]",
|
|
584
|
+
name: "interior",
|
|
585
|
+
type: "bytes[]"
|
|
586
|
+
}
|
|
587
|
+
],
|
|
588
|
+
internalType: "struct XCM.Location",
|
|
589
|
+
name: "remoteReserve",
|
|
590
|
+
type: "tuple"
|
|
591
|
+
}
|
|
592
|
+
],
|
|
593
|
+
name: "transferAssetsUsingTypeAndThenAddress",
|
|
594
|
+
outputs: [],
|
|
595
|
+
stateMutability: "nonpayable",
|
|
596
|
+
type: "function"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
inputs: [
|
|
600
|
+
{
|
|
601
|
+
components: [
|
|
602
|
+
{
|
|
603
|
+
internalType: "uint8",
|
|
604
|
+
name: "parents",
|
|
605
|
+
type: "uint8"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
internalType: "bytes[]",
|
|
609
|
+
name: "interior",
|
|
610
|
+
type: "bytes[]"
|
|
611
|
+
}
|
|
612
|
+
],
|
|
613
|
+
internalType: "struct XCM.Location",
|
|
614
|
+
name: "dest",
|
|
615
|
+
type: "tuple"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
components: [
|
|
619
|
+
{
|
|
620
|
+
components: [
|
|
621
|
+
{
|
|
622
|
+
internalType: "uint8",
|
|
623
|
+
name: "parents",
|
|
624
|
+
type: "uint8"
|
|
172
625
|
},
|
|
173
|
-
|
|
174
|
-
|
|
626
|
+
{
|
|
627
|
+
internalType: "bytes[]",
|
|
628
|
+
name: "interior",
|
|
629
|
+
type: "bytes[]"
|
|
630
|
+
}
|
|
631
|
+
],
|
|
632
|
+
internalType: "struct XCM.Location",
|
|
633
|
+
name: "location",
|
|
634
|
+
type: "tuple"
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
internalType: "uint256",
|
|
638
|
+
name: "amount",
|
|
639
|
+
type: "uint256"
|
|
175
640
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
641
|
+
],
|
|
642
|
+
internalType: "struct XCM.AssetLocationInfo[]",
|
|
643
|
+
name: "assets",
|
|
644
|
+
type: "tuple[]"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
internalType: "enum XCM.TransferType",
|
|
648
|
+
name: "assetsTransferType",
|
|
649
|
+
type: "uint8"
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
internalType: "uint8",
|
|
653
|
+
name: "remoteFeesIdIndex",
|
|
654
|
+
type: "uint8"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
internalType: "enum XCM.TransferType",
|
|
658
|
+
name: "feesTransferType",
|
|
659
|
+
type: "uint8"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
internalType: "bytes",
|
|
663
|
+
name: "customXcmOnDest",
|
|
664
|
+
type: "bytes"
|
|
665
|
+
}
|
|
666
|
+
],
|
|
667
|
+
name: "transferAssetsUsingTypeAndThenLocation",
|
|
668
|
+
outputs: [],
|
|
669
|
+
stateMutability: "nonpayable",
|
|
670
|
+
type: "function"
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
inputs: [
|
|
674
|
+
{
|
|
675
|
+
components: [
|
|
676
|
+
{
|
|
677
|
+
internalType: "uint8",
|
|
678
|
+
name: "parents",
|
|
679
|
+
type: "uint8"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
internalType: "bytes[]",
|
|
683
|
+
name: "interior",
|
|
684
|
+
type: "bytes[]"
|
|
685
|
+
}
|
|
686
|
+
],
|
|
687
|
+
internalType: "struct XCM.Location",
|
|
688
|
+
name: "dest",
|
|
689
|
+
type: "tuple"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
components: [
|
|
693
|
+
{
|
|
694
|
+
components: [
|
|
695
|
+
{
|
|
696
|
+
internalType: "uint8",
|
|
697
|
+
name: "parents",
|
|
698
|
+
type: "uint8"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
internalType: "bytes[]",
|
|
702
|
+
name: "interior",
|
|
703
|
+
type: "bytes[]"
|
|
704
|
+
}
|
|
705
|
+
],
|
|
706
|
+
internalType: "struct XCM.Location",
|
|
707
|
+
name: "location",
|
|
708
|
+
type: "tuple"
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
internalType: "uint256",
|
|
712
|
+
name: "amount",
|
|
713
|
+
type: "uint256"
|
|
714
|
+
}
|
|
715
|
+
],
|
|
716
|
+
internalType: "struct XCM.AssetLocationInfo[]",
|
|
717
|
+
name: "assets",
|
|
718
|
+
type: "tuple[]"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
internalType: "uint8",
|
|
722
|
+
name: "remoteFeesIdIndex",
|
|
723
|
+
type: "uint8"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
internalType: "bytes",
|
|
727
|
+
name: "customXcmOnDest",
|
|
728
|
+
type: "bytes"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
components: [
|
|
732
|
+
{
|
|
733
|
+
internalType: "uint8",
|
|
734
|
+
name: "parents",
|
|
735
|
+
type: "uint8"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
internalType: "bytes[]",
|
|
739
|
+
name: "interior",
|
|
740
|
+
type: "bytes[]"
|
|
741
|
+
}
|
|
742
|
+
],
|
|
743
|
+
internalType: "struct XCM.Location",
|
|
744
|
+
name: "remoteReserve",
|
|
745
|
+
type: "tuple"
|
|
746
|
+
}
|
|
747
|
+
],
|
|
748
|
+
name: "transferAssetsUsingTypeAndThenLocation",
|
|
749
|
+
outputs: [],
|
|
750
|
+
stateMutability: "nonpayable",
|
|
751
|
+
type: "function"
|
|
752
|
+
}
|
|
753
|
+
];
|
|
754
|
+
|
|
755
|
+
// src/contract/contracts/XcmPrecompile/XcmPrecompile.ts
|
|
756
|
+
var XCM_PRECOMPILE_ADDRESS = "0x000000000000000000000000000000000000081A";
|
|
757
|
+
function XcmPrecompile() {
|
|
758
|
+
return {
|
|
759
|
+
transferAssetsToPara20: () => ({
|
|
760
|
+
build: ({ destinationAddress, asset, destination }) => {
|
|
761
|
+
return new ContractConfig({
|
|
762
|
+
address: XCM_PRECOMPILE_ADDRESS,
|
|
763
|
+
abi: XCM_ABI,
|
|
764
|
+
args: [
|
|
765
|
+
destination.parachainId,
|
|
766
|
+
destinationAddress,
|
|
767
|
+
[[asset.address, asset.amount]],
|
|
768
|
+
0
|
|
769
|
+
],
|
|
770
|
+
func: "transferAssetsToPara20",
|
|
771
|
+
module: "Xcm"
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
}),
|
|
775
|
+
transferAssetsToPara32: () => ({
|
|
776
|
+
build: ({ destinationAddress, asset, destination }) => {
|
|
777
|
+
return new ContractConfig({
|
|
778
|
+
address: XCM_PRECOMPILE_ADDRESS,
|
|
779
|
+
abi: XCM_ABI,
|
|
780
|
+
args: [
|
|
781
|
+
destination.parachainId,
|
|
782
|
+
u8aToHex2(decodeAddress2(destinationAddress)),
|
|
783
|
+
[[asset.address, asset.amount]],
|
|
784
|
+
0
|
|
785
|
+
],
|
|
786
|
+
func: "transferAssetsToPara32",
|
|
787
|
+
module: "Xcm"
|
|
182
788
|
});
|
|
183
789
|
}
|
|
184
790
|
})
|
|
185
791
|
};
|
|
186
792
|
}
|
|
187
793
|
|
|
188
|
-
// src/balance/BalanceBuilder.ts
|
|
189
|
-
import { evmToAddress as evmToAddress2 } from "@polkadot/util-crypto";
|
|
190
|
-
|
|
191
|
-
// src/types/evm/ContractConfig.ts
|
|
192
|
-
import { encodeFunctionData } from "viem";
|
|
193
|
-
var ContractConfig = class _ContractConfig extends BaseConfig {
|
|
194
|
-
address;
|
|
195
|
-
abi;
|
|
196
|
-
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
197
|
-
args;
|
|
198
|
-
static is(obj) {
|
|
199
|
-
return obj instanceof _ContractConfig;
|
|
200
|
-
}
|
|
201
|
-
constructor({
|
|
202
|
-
address,
|
|
203
|
-
abi,
|
|
204
|
-
args,
|
|
205
|
-
...other
|
|
206
|
-
}) {
|
|
207
|
-
super({ ...other });
|
|
208
|
-
this.address = address;
|
|
209
|
-
this.abi = abi;
|
|
210
|
-
this.args = args;
|
|
211
|
-
}
|
|
212
|
-
encodeFunctionData() {
|
|
213
|
-
return encodeFunctionData({
|
|
214
|
-
abi: this.abi,
|
|
215
|
-
functionName: this.func,
|
|
216
|
-
args: this.args
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
|
|
221
794
|
// src/contract/contracts/Xtokens/Xtokens.ts
|
|
222
795
|
import { formatAssetIdToERC20 } from "@moonbeam-network/xcm-utils";
|
|
223
|
-
import { u8aToHex as
|
|
224
|
-
import { decodeAddress as
|
|
796
|
+
import { u8aToHex as u8aToHex4 } from "@polkadot/util";
|
|
797
|
+
import { decodeAddress as decodeAddress4, evmToAddress } from "@polkadot/util-crypto";
|
|
225
798
|
|
|
226
799
|
// src/builder.utils.ts
|
|
227
800
|
import { EvmParachain } from "@moonbeam-network/xcm-types";
|
|
228
|
-
import { u8aToHex as
|
|
229
|
-
import { decodeAddress as
|
|
801
|
+
import { u8aToHex as u8aToHex3 } from "@polkadot/util";
|
|
802
|
+
import { decodeAddress as decodeAddress3 } from "@polkadot/util-crypto";
|
|
230
803
|
function getPrecompileDestinationInterior(destination, address) {
|
|
231
804
|
if (!address) {
|
|
232
805
|
return [`0x0000000${destination.parachainId.toString(16)}`];
|
|
233
806
|
}
|
|
234
807
|
const accountType = EvmParachain.is(destination) ? "03" : "01";
|
|
235
|
-
const acc = `0x${accountType}${
|
|
236
|
-
|
|
808
|
+
const acc = `0x${accountType}${u8aToHex3(
|
|
809
|
+
decodeAddress3(address),
|
|
237
810
|
-1,
|
|
238
811
|
false
|
|
239
812
|
)}00`;
|
|
@@ -406,8 +979,8 @@ function Xtokens() {
|
|
|
406
979
|
function getDestinationMultilocationForPrecompileDestination(address, destination) {
|
|
407
980
|
const accountType = "01";
|
|
408
981
|
const substrateAddress = evmToAddress(address);
|
|
409
|
-
const acc = `0x${accountType}${
|
|
410
|
-
|
|
982
|
+
const acc = `0x${accountType}${u8aToHex4(
|
|
983
|
+
decodeAddress4(substrateAddress),
|
|
411
984
|
-1,
|
|
412
985
|
false
|
|
413
986
|
)}00`;
|
|
@@ -424,23 +997,11 @@ function getDestinationMultilocation(address, destination) {
|
|
|
424
997
|
// src/contract/ContractBuilder.ts
|
|
425
998
|
function ContractBuilder() {
|
|
426
999
|
return {
|
|
427
|
-
Xtokens
|
|
1000
|
+
Xtokens,
|
|
1001
|
+
XcmPrecompile
|
|
428
1002
|
};
|
|
429
1003
|
}
|
|
430
1004
|
|
|
431
|
-
// src/types/evm/EvmQueryConfig.ts
|
|
432
|
-
var EvmQueryConfig = class _EvmQueryConfig {
|
|
433
|
-
args;
|
|
434
|
-
func;
|
|
435
|
-
static is(obj) {
|
|
436
|
-
return obj instanceof _EvmQueryConfig;
|
|
437
|
-
}
|
|
438
|
-
constructor({ args, func }) {
|
|
439
|
-
this.args = args;
|
|
440
|
-
this.func = func;
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
|
|
444
1005
|
// src/balance/Erc20Abi.ts
|
|
445
1006
|
var ERC20_ABI = [
|
|
446
1007
|
{
|
|
@@ -829,19 +1390,6 @@ async function calculateSystemAccountBalance(response) {
|
|
|
829
1390
|
return free - locked;
|
|
830
1391
|
}
|
|
831
1392
|
|
|
832
|
-
// src/types/substrate/ExtrinsicConfig.ts
|
|
833
|
-
var ExtrinsicConfig = class _ExtrinsicConfig extends BaseConfig {
|
|
834
|
-
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
835
|
-
getArgs;
|
|
836
|
-
static is(obj) {
|
|
837
|
-
return obj instanceof _ExtrinsicConfig;
|
|
838
|
-
}
|
|
839
|
-
constructor({ getArgs, ...other }) {
|
|
840
|
-
super({ ...other });
|
|
841
|
-
this.getArgs = getArgs;
|
|
842
|
-
}
|
|
843
|
-
};
|
|
844
|
-
|
|
845
1393
|
// src/extrinsic/pallets/eqBalances/eqBalances.ts
|
|
846
1394
|
var pallet = "eqBalances";
|
|
847
1395
|
function eqBalances() {
|
|
@@ -1691,20 +2239,6 @@ function ExtrinsicBuilder() {
|
|
|
1691
2239
|
};
|
|
1692
2240
|
}
|
|
1693
2241
|
|
|
1694
|
-
// src/types/substrate/SubstrateCallConfig.ts
|
|
1695
|
-
var SubstrateCallConfig = class _SubstrateCallConfig {
|
|
1696
|
-
api;
|
|
1697
|
-
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
1698
|
-
call;
|
|
1699
|
-
static is(obj) {
|
|
1700
|
-
return obj instanceof _SubstrateCallConfig;
|
|
1701
|
-
}
|
|
1702
|
-
constructor({ api, call }) {
|
|
1703
|
-
this.api = api;
|
|
1704
|
-
this.call = call;
|
|
1705
|
-
}
|
|
1706
|
-
};
|
|
1707
|
-
|
|
1708
2242
|
// src/fee/FeeBuilder.utils.ts
|
|
1709
2243
|
var DEFAULT_AMOUNT = 10 ** 6;
|
|
1710
2244
|
var DEFAULT_HEX_STRING = "0xabcdef1234567890fedcba0987654321abcdef1234567890fedcba0987654321";
|
|
@@ -2815,7 +3349,7 @@ function getCurrencies({ source, moonAsset, asset }) {
|
|
|
2815
3349
|
}
|
|
2816
3350
|
|
|
2817
3351
|
// src/mrl/providers/wormhole/contract/Gmp/Gmp.ts
|
|
2818
|
-
import { u8aToHex as
|
|
3352
|
+
import { u8aToHex as u8aToHex5 } from "@polkadot/util";
|
|
2819
3353
|
|
|
2820
3354
|
// src/mrl/providers/wormhole/contract/Gmp/GmpAbi.ts
|
|
2821
3355
|
var GMP_ABI = [
|
|
@@ -2841,7 +3375,7 @@ function Gmp() {
|
|
|
2841
3375
|
return {
|
|
2842
3376
|
wormholeTransferERC20: () => ({
|
|
2843
3377
|
build: ({ bytes }) => {
|
|
2844
|
-
const hex =
|
|
3378
|
+
const hex = u8aToHex5(bytes);
|
|
2845
3379
|
return new ContractConfig({
|
|
2846
3380
|
address: GMP_CONTRACT_ADDRESS,
|
|
2847
3381
|
abi: GMP_ABI,
|