Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments for MRL redeeming function #405

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/mrl/src/getTransferData/getRedeemData.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { type ContractConfig, MrlBuilder } from '@moonbeam-network/xcm-builder';
import { EvmService, type EvmSigner } from '@moonbeam-network/xcm-sdk';
import type { EvmChain, EvmParachain } from '@moonbeam-network/xcm-types';
import type { RedeemData } from '../mrl.interfaces';
import { WormholeService } from '../services/wormhole';

export interface WormholeRedeemParams {
txId: string;
chain: EvmChain | EvmParachain;
}

export async function getRedeemData({ txId, chain }: WormholeRedeemParams) {
export async function getRedeemData({
txId,
chain,
}: WormholeRedeemParams): Promise<RedeemData> {
// TODO this is just for wormhole
const wh = WormholeService.create(chain);

Expand Down
6 changes: 3 additions & 3 deletions packages/mrl/src/mrl.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export interface ChainTransferData {
}

// TODO this is just for Wormhole
export type RedeemData = {
export interface RedeemData {
vaa: TokenTransfer.VAA;
tokenTransfer: TokenTransfer;
transfer(signer: EvmSigner): Promise<string[]>;
};
redeem(signer: EvmSigner): Promise<string>;
}
5 changes: 5 additions & 0 deletions packages/types/src/chain/parachain/EvmParachain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Address } from 'viem';
import type { Chain } from 'viem/chains';
import { getViemChain } from '../Chain.utils';
import { EvmChain } from '../EvmChain';
import { Parachain, type ParachainConstructorParams } from './Parachain';

export interface EvmParachainConstructorParams
Expand Down Expand Up @@ -34,6 +35,10 @@ export class EvmParachain extends Parachain {
return obj instanceof EvmParachain || obj instanceof Parachain;
}

static isAnyEvmChain(obj: unknown): obj is EvmParachain | EvmChain {
return obj instanceof EvmParachain || obj instanceof EvmChain;
}

constructor({
id,
rpc,
Expand Down
Loading