@moonbeam-network/xcm-builder 1.0.0-dev.163 → 1.0.0-dev.165
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/README.md +14 -8
- package/build/index.d.ts +6 -5
- package/build/index.mjs +68 -23
- package/build/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
The Builder package contains the builders for the queries, extrinsics, functions, and contract calls used in the Moonbeam XCM SDK and MRL SDK.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Documentation for the Moonbeam XCM SDK
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## v3 (current)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Usage
|
|
8
8
|
|
|
9
|
-
-
|
|
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
|
-
|
|
12
|
+
### References
|
|
12
13
|
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
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
|
@@ -82,7 +82,7 @@ type ContractConfigBuilder = ConfigBuilder<ContractConfig>;
|
|
|
82
82
|
|
|
83
83
|
declare function Xtokens(): {
|
|
84
84
|
transfer: (weight?: bigint) => ContractConfigBuilder;
|
|
85
|
-
transferMultiCurrencies: (weight?: bigint) => ContractConfigBuilder;
|
|
85
|
+
transferMultiCurrencies: (shouldTransferAssetPrecedeFeeAsset?: boolean, weight?: bigint) => ContractConfigBuilder;
|
|
86
86
|
transferWithEvmTo32: (weight?: bigint) => ContractConfigBuilder;
|
|
87
87
|
};
|
|
88
88
|
|
|
@@ -362,6 +362,7 @@ declare function polkadotXcm$1(): {
|
|
|
362
362
|
};
|
|
363
363
|
transferAssets: () => {
|
|
364
364
|
here: () => ExtrinsicConfigBuilder;
|
|
365
|
+
X2AndFeeHere: () => ExtrinsicConfigBuilder;
|
|
365
366
|
};
|
|
366
367
|
transferAssetsUsingTypeAndThen: () => {
|
|
367
368
|
globalConsensusEthereum: () => ExtrinsicConfigBuilder;
|
|
@@ -458,7 +459,7 @@ declare class WormholeConfig {
|
|
|
458
459
|
declare function wormholeFactory(chain: AnyChain): Wormhole<"Mainnet" | "Testnet">;
|
|
459
460
|
|
|
460
461
|
type MrlConfigBuilder = ConfigBuilder<ContractConfig | ExtrinsicConfig | WormholeConfig, MrlBuilderParams>;
|
|
461
|
-
type
|
|
462
|
+
type MrlExecuteConfigBuilder = ConfigBuilder<ContractConfig, MrlExecuteBuilderParams>;
|
|
462
463
|
interface MrlBuilderParams extends BuilderParams<AnyChain> {
|
|
463
464
|
isAutomatic: boolean;
|
|
464
465
|
moonApi: ApiPromise;
|
|
@@ -468,7 +469,7 @@ interface MrlBuilderParams extends BuilderParams<AnyChain> {
|
|
|
468
469
|
sendOnlyRemoteExecution?: boolean;
|
|
469
470
|
transact?: Transact;
|
|
470
471
|
}
|
|
471
|
-
interface
|
|
472
|
+
interface MrlExecuteBuilderParams {
|
|
472
473
|
bytes?: Uint8Array;
|
|
473
474
|
}
|
|
474
475
|
interface Transact {
|
|
@@ -484,7 +485,7 @@ declare function Batch(): {
|
|
|
484
485
|
};
|
|
485
486
|
|
|
486
487
|
declare function Gmp(): {
|
|
487
|
-
wormholeTransferERC20: () =>
|
|
488
|
+
wormholeTransferERC20: () => MrlExecuteConfigBuilder;
|
|
488
489
|
};
|
|
489
490
|
|
|
490
491
|
declare function TokenBridge(): {
|
|
@@ -615,4 +616,4 @@ declare function MrlBuilder(): {
|
|
|
615
616
|
|
|
616
617
|
declare const BATCH_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000000808";
|
|
617
618
|
|
|
618
|
-
export { AssetMinBuilder, type AssetMinConfigBuilder, type AssetMinConfigBuilderParams, BATCH_CONTRACT_ABI, BATCH_CONTRACT_ADDRESS, BalanceBuilder, type BalanceBuilderParams, type BalanceConfigBuilder, type BuilderParams, type ConfigBuilder, ContractBuilder, ContractConfig, type ContractConfigBuilder, type ContractConfigConstructorParams, ERC20_ABI, type EquilibriumSystemBalanceData, type EvmFunctionArgs, EvmQueryConfig, type EvmQueryConfigParams, type EvmQueryFunctions, ExtrinsicBuilder, ExtrinsicConfig, type ExtrinsicConfigBuilder, type ExtrinsicConfigConstructorParams, FeeBuilder, type FeeConfigBuilder, type FeeConfigBuilderParams, type MoonbeamRuntimeXcmConfigAssetType, MrlBuilder, type MrlBuilderParams, type MrlConfigBuilder, type
|
|
619
|
+
export { AssetMinBuilder, type AssetMinConfigBuilder, type AssetMinConfigBuilderParams, BATCH_CONTRACT_ABI, BATCH_CONTRACT_ADDRESS, BalanceBuilder, type BalanceBuilderParams, type BalanceConfigBuilder, type BuilderParams, type ConfigBuilder, ContractBuilder, ContractConfig, type ContractConfigBuilder, type ContractConfigConstructorParams, ERC20_ABI, type EquilibriumSystemBalanceData, type EvmFunctionArgs, EvmQueryConfig, type EvmQueryConfigParams, type EvmQueryFunctions, ExtrinsicBuilder, ExtrinsicConfig, type ExtrinsicConfigBuilder, type ExtrinsicConfigConstructorParams, FeeBuilder, type FeeConfigBuilder, type FeeConfigBuilderParams, type MoonbeamRuntimeXcmConfigAssetType, MrlBuilder, type MrlBuilderParams, type MrlConfigBuilder, type MrlExecuteBuilderParams, type MrlExecuteConfigBuilder, type PalletBalancesAccountDataOld, type Parents, type QueryConfigConstructorParams, SubstrateCallConfig, type SubstrateCallConfigConstructorParams, SubstrateQueryConfig, type TokensPalletAccountData, type Transact, WormholeConfig, type WormholeConfigConstructorParams, type WormholeFunctionArgs, type WormholeTransferFunctions, type XcmPaymentFeeProps, XcmVersion, calculateSystemAccountBalance, evm, substrate, wormhole, wormholeFactory };
|
package/build/index.mjs
CHANGED
|
@@ -355,29 +355,31 @@ function Xtokens() {
|
|
|
355
355
|
module: "Xtokens"
|
|
356
356
|
})
|
|
357
357
|
}),
|
|
358
|
-
transferMultiCurrencies: (weight = U_64_MAX) => ({
|
|
359
|
-
build: ({ asset, destination, destinationAddress, fee }) =>
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
358
|
+
transferMultiCurrencies: (shouldTransferAssetPrecedeFeeAsset = true, weight = U_64_MAX) => ({
|
|
359
|
+
build: ({ asset, destination, destinationAddress, fee }) => {
|
|
360
|
+
const transferAsset = [
|
|
361
|
+
asset.address ? formatAssetIdToERC20(asset.address) : asset.getAssetId(),
|
|
362
|
+
asset.amount
|
|
363
|
+
];
|
|
364
|
+
const feeAsset = [
|
|
365
|
+
fee.address ? formatAssetIdToERC20(fee.address) : fee.getAssetId(),
|
|
366
|
+
fee.amount
|
|
367
|
+
];
|
|
368
|
+
const assets3 = shouldTransferAssetPrecedeFeeAsset ? [transferAsset, feeAsset] : [feeAsset, transferAsset];
|
|
369
|
+
const feeAssetIndex = shouldTransferAssetPrecedeFeeAsset ? 1 : 0;
|
|
370
|
+
return new ContractConfig({
|
|
371
|
+
address: XTOKENS_CONTRACT_ADDRESS,
|
|
372
|
+
abi: XTOKENS_ABI,
|
|
373
|
+
args: [
|
|
374
|
+
assets3,
|
|
375
|
+
feeAssetIndex,
|
|
376
|
+
getDestinationMultilocation(destinationAddress, destination),
|
|
377
|
+
weight
|
|
372
378
|
],
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
],
|
|
378
|
-
func: "transferMultiCurrencies",
|
|
379
|
-
module: "Xtokens"
|
|
380
|
-
})
|
|
379
|
+
func: "transferMultiCurrencies",
|
|
380
|
+
module: "Xtokens"
|
|
381
|
+
});
|
|
382
|
+
}
|
|
381
383
|
}),
|
|
382
384
|
transferWithEvmTo32: (weight = U_64_MAX) => ({
|
|
383
385
|
build: ({ destinationAddress, asset, destination }) => {
|
|
@@ -904,7 +906,6 @@ function getPolkadotXcmExtrinsicArgs({
|
|
|
904
906
|
func,
|
|
905
907
|
parents = 1,
|
|
906
908
|
feeIndex = 0
|
|
907
|
-
// biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
|
|
908
909
|
}) {
|
|
909
910
|
const version = getExtrinsicArgumentVersion(func);
|
|
910
911
|
return [
|
|
@@ -1135,6 +1136,50 @@ function polkadotXcm() {
|
|
|
1135
1136
|
});
|
|
1136
1137
|
}
|
|
1137
1138
|
})
|
|
1139
|
+
}),
|
|
1140
|
+
X2AndFeeHere: () => ({
|
|
1141
|
+
build: (params) => new ExtrinsicConfig({
|
|
1142
|
+
module: pallet2,
|
|
1143
|
+
func,
|
|
1144
|
+
getArgs: (extrinsicFunction) => {
|
|
1145
|
+
const version = getExtrinsicArgumentVersion(extrinsicFunction);
|
|
1146
|
+
return getPolkadotXcmExtrinsicArgs({
|
|
1147
|
+
...params,
|
|
1148
|
+
func: extrinsicFunction,
|
|
1149
|
+
asset: [
|
|
1150
|
+
{
|
|
1151
|
+
id: normalizeConcrete(version, {
|
|
1152
|
+
parents: 0,
|
|
1153
|
+
interior: {
|
|
1154
|
+
X2: [
|
|
1155
|
+
{
|
|
1156
|
+
PalletInstance: params.asset.getAssetPalletInstance()
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
GeneralIndex: params.asset.getAssetId()
|
|
1160
|
+
}
|
|
1161
|
+
]
|
|
1162
|
+
}
|
|
1163
|
+
}),
|
|
1164
|
+
fun: {
|
|
1165
|
+
Fungible: params.asset.amount
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
// Fee Asset
|
|
1169
|
+
{
|
|
1170
|
+
id: normalizeConcrete(version, {
|
|
1171
|
+
parents: 1,
|
|
1172
|
+
interior: "Here"
|
|
1173
|
+
}),
|
|
1174
|
+
fun: {
|
|
1175
|
+
Fungible: params.fee.amount
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
],
|
|
1179
|
+
feeIndex: 1
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
})
|
|
1138
1183
|
})
|
|
1139
1184
|
};
|
|
1140
1185
|
},
|