Skip to content

Commit

Permalink
adjustments for redeeming function (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello authored Dec 16, 2024
1 parent d8fcaa4 commit 991cdeb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
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

0 comments on commit 991cdeb

Please sign in to comment.