@moonbeam-network/xcm-builder 1.0.0-dev.214 → 1.0.0-dev.215
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 +6 -23
- package/build/index.mjs +121 -15
- package/build/index.mjs.map +1 -1
- package/package.json +5 -5
package/build/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Struct, u128, Enum } from '@polkadot/types';
|
|
|
5
5
|
import { Abi, PublicClient, HttpTransport } from 'viem';
|
|
6
6
|
import { SubmittableExtrinsicFunction } from '@polkadot/api/types';
|
|
7
7
|
import { HexString } from '@polkadot/util/types';
|
|
8
|
-
import {
|
|
8
|
+
import { Wormhole, Network } from '@wormhole-foundation/sdk-connect';
|
|
9
9
|
|
|
10
10
|
interface ConfigBuilder<Config, Params = BuilderParams> {
|
|
11
11
|
build: (params: Params) => Config;
|
|
@@ -364,12 +364,15 @@ declare function polkadotXcm$1(): {
|
|
|
364
364
|
here: () => ExtrinsicConfigBuilder;
|
|
365
365
|
X1: () => ExtrinsicConfigBuilder;
|
|
366
366
|
X2: () => ExtrinsicConfigBuilder;
|
|
367
|
+
X2PalletInstance: () => ExtrinsicConfigBuilder;
|
|
367
368
|
};
|
|
368
369
|
limitedReserveWithdrawAssets: () => {
|
|
369
370
|
X2: () => ExtrinsicConfigBuilder;
|
|
370
371
|
};
|
|
371
372
|
transferAssets: () => {
|
|
372
373
|
here: (parents?: number) => ExtrinsicConfigBuilder;
|
|
374
|
+
X1: () => ExtrinsicConfigBuilder;
|
|
375
|
+
X1GeneralKey: () => ExtrinsicConfigBuilder;
|
|
373
376
|
X2: () => ExtrinsicConfigBuilder;
|
|
374
377
|
X3: () => ExtrinsicConfigBuilder;
|
|
375
378
|
X2AndFeeHere: () => ExtrinsicConfigBuilder;
|
|
@@ -470,27 +473,7 @@ declare function FeeBuilder(): {
|
|
|
470
473
|
};
|
|
471
474
|
|
|
472
475
|
type WormholeTransferFunctions = 'tokenTransfer';
|
|
473
|
-
type WormholeFunctionArgs = [
|
|
474
|
-
token: TokenId,
|
|
475
|
-
amount: bigint,
|
|
476
|
-
from: ChainAddress,
|
|
477
|
-
to: ChainAddress,
|
|
478
|
-
protocol: 'TokenBridge',
|
|
479
|
-
payload?: Uint8Array
|
|
480
|
-
] | [
|
|
481
|
-
token: TokenId,
|
|
482
|
-
amount: bigint,
|
|
483
|
-
from: ChainAddress,
|
|
484
|
-
to: ChainAddress,
|
|
485
|
-
protocol: 'AutomaticTokenBridge',
|
|
486
|
-
nativeGas?: bigint
|
|
487
|
-
] | [
|
|
488
|
-
token: TokenId,
|
|
489
|
-
amount: bigint,
|
|
490
|
-
from: ChainAddress,
|
|
491
|
-
to: ChainAddress,
|
|
492
|
-
protocol: 'ExecutorTokenBridge'
|
|
493
|
-
];
|
|
476
|
+
type WormholeFunctionArgs = Parameters<Wormhole<Network>[WormholeTransferFunctions]>;
|
|
494
477
|
interface WormholeConfigConstructorParams {
|
|
495
478
|
args: WormholeFunctionArgs;
|
|
496
479
|
func: WormholeTransferFunctions;
|
|
@@ -506,7 +489,7 @@ declare function wormhole$1(): {
|
|
|
506
489
|
tokenTransfer: () => MrlConfigBuilder;
|
|
507
490
|
};
|
|
508
491
|
|
|
509
|
-
declare function wormholeFactory(chain: AnyChain): Wormhole<"
|
|
492
|
+
declare function wormholeFactory(chain: AnyChain): Wormhole<"Mainnet" | "Testnet">;
|
|
510
493
|
|
|
511
494
|
type MrlConfigBuilder = ConfigBuilder<ContractConfig | ExtrinsicConfig | WormholeConfig, MrlBuilderParams>;
|
|
512
495
|
type MrlExecuteConfigBuilder = ConfigBuilder<ContractConfig, MrlExecuteBuilderParams>;
|
package/build/index.mjs
CHANGED
|
@@ -1654,6 +1654,42 @@ function polkadotXcm() {
|
|
|
1654
1654
|
});
|
|
1655
1655
|
}
|
|
1656
1656
|
})
|
|
1657
|
+
}),
|
|
1658
|
+
X2PalletInstance: () => ({
|
|
1659
|
+
build: (params) => new ExtrinsicConfig({
|
|
1660
|
+
module: pallet2,
|
|
1661
|
+
func,
|
|
1662
|
+
getArgs: (extrinsicFunction) => {
|
|
1663
|
+
const version = getExtrinsicArgumentVersion(extrinsicFunction);
|
|
1664
|
+
const assetInDestination = params.destination.getChainAsset(
|
|
1665
|
+
params.asset
|
|
1666
|
+
);
|
|
1667
|
+
return getPolkadotXcmExtrinsicArgs({
|
|
1668
|
+
...params,
|
|
1669
|
+
func: extrinsicFunction,
|
|
1670
|
+
asset: [
|
|
1671
|
+
{
|
|
1672
|
+
id: normalizeConcrete(version, {
|
|
1673
|
+
parents: 1,
|
|
1674
|
+
interior: {
|
|
1675
|
+
X2: [
|
|
1676
|
+
{
|
|
1677
|
+
Parachain: params.destination.parachainId
|
|
1678
|
+
},
|
|
1679
|
+
{
|
|
1680
|
+
PalletInstance: assetInDestination.getAssetPalletInstance()
|
|
1681
|
+
}
|
|
1682
|
+
]
|
|
1683
|
+
}
|
|
1684
|
+
}),
|
|
1685
|
+
fun: {
|
|
1686
|
+
Fungible: params.asset.amount
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
]
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
})
|
|
1657
1693
|
})
|
|
1658
1694
|
};
|
|
1659
1695
|
},
|
|
@@ -1722,6 +1758,88 @@ function polkadotXcm() {
|
|
|
1722
1758
|
}
|
|
1723
1759
|
})
|
|
1724
1760
|
}),
|
|
1761
|
+
X1: () => ({
|
|
1762
|
+
build: (params) => new ExtrinsicConfig({
|
|
1763
|
+
module: pallet2,
|
|
1764
|
+
func,
|
|
1765
|
+
getArgs: (extrinsicFunction) => {
|
|
1766
|
+
const version = getExtrinsicArgumentVersion(extrinsicFunction);
|
|
1767
|
+
return getPolkadotXcmExtrinsicArgs({
|
|
1768
|
+
...params,
|
|
1769
|
+
func: extrinsicFunction,
|
|
1770
|
+
asset: [
|
|
1771
|
+
{
|
|
1772
|
+
id: normalizeConcrete(version, {
|
|
1773
|
+
parents: 0,
|
|
1774
|
+
interior: {
|
|
1775
|
+
X1: [
|
|
1776
|
+
{
|
|
1777
|
+
GeneralIndex: params.asset.getAssetId()
|
|
1778
|
+
}
|
|
1779
|
+
]
|
|
1780
|
+
}
|
|
1781
|
+
}),
|
|
1782
|
+
fun: {
|
|
1783
|
+
Fungible: params.asset.amount
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
]
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
})
|
|
1790
|
+
}),
|
|
1791
|
+
X1GeneralKey: () => ({
|
|
1792
|
+
build: (params) => new ExtrinsicConfig({
|
|
1793
|
+
module: pallet2,
|
|
1794
|
+
func,
|
|
1795
|
+
getArgs: (extrinsicFunction) => {
|
|
1796
|
+
const version = getExtrinsicArgumentVersion(extrinsicFunction);
|
|
1797
|
+
const isAssetDifferent = !params.asset.isSame(params.fee);
|
|
1798
|
+
const assets3 = [
|
|
1799
|
+
{
|
|
1800
|
+
id: normalizeConcrete(
|
|
1801
|
+
version,
|
|
1802
|
+
normalizeX1(version, {
|
|
1803
|
+
parents: 0,
|
|
1804
|
+
interior: {
|
|
1805
|
+
X1: {
|
|
1806
|
+
GeneralKey: params.asset.getGeneralKey()
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
})
|
|
1810
|
+
),
|
|
1811
|
+
fun: {
|
|
1812
|
+
Fungible: params.asset.amount
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
];
|
|
1816
|
+
if (isAssetDifferent) {
|
|
1817
|
+
const feeAsset = {
|
|
1818
|
+
id: normalizeConcrete(
|
|
1819
|
+
version,
|
|
1820
|
+
normalizeX1(version, {
|
|
1821
|
+
parents: 0,
|
|
1822
|
+
interior: {
|
|
1823
|
+
X1: {
|
|
1824
|
+
GeneralKey: params.fee.getGeneralKey()
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
})
|
|
1828
|
+
),
|
|
1829
|
+
fun: {
|
|
1830
|
+
Fungible: params.fee.amount
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
assets3.unshift(feeAsset);
|
|
1834
|
+
}
|
|
1835
|
+
return getPolkadotXcmExtrinsicArgs({
|
|
1836
|
+
...params,
|
|
1837
|
+
func: extrinsicFunction,
|
|
1838
|
+
asset: assets3
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
})
|
|
1842
|
+
}),
|
|
1725
1843
|
X2: () => ({
|
|
1726
1844
|
build: (params) => new ExtrinsicConfig({
|
|
1727
1845
|
module: pallet2,
|
|
@@ -3959,25 +4077,13 @@ function wormhole() {
|
|
|
3959
4077
|
isDestinationMoonChain || isDestinationEvmChain ? destinationAddress : GMP_CONTRACT_ADDRESS
|
|
3960
4078
|
);
|
|
3961
4079
|
return new WormholeConfig({
|
|
3962
|
-
args:
|
|
3963
|
-
whAsset,
|
|
3964
|
-
asset.amount,
|
|
3965
|
-
whSourceAddress,
|
|
3966
|
-
whDestinationAddress,
|
|
3967
|
-
"AutomaticTokenBridge"
|
|
3968
|
-
] : isDestinationMoonChain || isDestinationEvmChain ? [
|
|
3969
|
-
whAsset,
|
|
3970
|
-
asset.amount,
|
|
3971
|
-
whSourceAddress,
|
|
3972
|
-
whDestinationAddress,
|
|
3973
|
-
"ExecutorTokenBridge"
|
|
3974
|
-
] : [
|
|
4080
|
+
args: [
|
|
3975
4081
|
whAsset,
|
|
3976
4082
|
asset.amount,
|
|
3977
4083
|
whSourceAddress,
|
|
3978
4084
|
whDestinationAddress,
|
|
3979
|
-
|
|
3980
|
-
getPayload({ destination, destinationAddress, moonApi })
|
|
4085
|
+
isAutomatic,
|
|
4086
|
+
isDestinationMoonChain || isDestinationEvmChain ? void 0 : getPayload({ destination, destinationAddress, moonApi })
|
|
3981
4087
|
],
|
|
3982
4088
|
func: "tokenTransfer"
|
|
3983
4089
|
});
|