Skip to content

Commit

Permalink
enable sending only remote execution in MRL
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Dec 16, 2024
1 parent d8fcaa4 commit 0984def
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/builder/src/mrl/MrlBuilder.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface MrlBuilderParams extends BuilderParams<AnyChain> {
moonAsset: ChainAsset;
moonChain: EvmParachain;
moonGasLimit?: bigint;
sendOnlyRemoteExecution?: boolean;
transact?: Transact;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function polkadotXcm() {
moonAsset,
moonChain,
moonApi,
sendOnlyRemoteExecution,
source,
sourceAddress,
sourceApi,
Expand Down Expand Up @@ -85,11 +86,14 @@ export function polkadotXcm() {
transact,
});

// TODO add here ability to only send the remote execution (only `send`)
const transactionsToSend = sendOnlyRemoteExecution
? [send]
: [...assetTransferTxs, send];

return new ExtrinsicConfig({
module: 'utility',
func: 'batchAll',
getArgs: () => [[...assetTransferTxs, send]],
getArgs: () => [transactionsToSend],
});
},
}),
Expand Down
2 changes: 2 additions & 0 deletions packages/mrl/src/getTransferData/getTransferData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export async function getTransferData({
isAutomatic,
{ evmSigner, polkadotSigner }: Partial<Signers>,
statusCallback,
sendOnlyRemoteExecution,
): Promise<string[]> {
const source = route.source.chain;

Expand All @@ -130,6 +131,7 @@ export async function getTransferData({
feeAsset,
isAutomatic,
route,
sendOnlyRemoteExecution,
sourceAddress,
});

Expand Down
3 changes: 3 additions & 0 deletions packages/mrl/src/getTransferData/getTransferData.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface BuildTransferParams {
feeAsset: AssetAmount;
isAutomatic: boolean;
route: AssetRoute;
sendOnlyRemoteExecution?: boolean;
sourceAddress: string;
}

Expand Down Expand Up @@ -133,6 +134,7 @@ export async function getMrlBuilderParams({
feeAsset,
isAutomatic,
route,
sendOnlyRemoteExecution,
sourceAddress,
}: BuildTransferParams): Promise<MrlBuilderParams> {
if (!route.mrl) {
Expand Down Expand Up @@ -162,6 +164,7 @@ export async function getMrlBuilderParams({
moonApi,
moonAsset: moonChain.nativeAsset,
moonChain,
sendOnlyRemoteExecution,
source,
sourceAddress,
sourceApi,
Expand Down
1 change: 1 addition & 0 deletions packages/mrl/src/mrl.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface TransferData {
isAutomatic: boolean,
signers: Signers,
statusCallback?: (params: ISubmittableResult) => void,
sendOnlyRemoteExecution?: boolean,
): Promise<string[]>;
}

Expand Down

0 comments on commit 0984def

Please sign in to comment.