From 64e6cb2c597af0095e143e145ac53b6ec210fd14 Mon Sep 17 00:00:00 2001 From: KacperKoza343 Date: Mon, 13 Jan 2025 11:04:53 +0100 Subject: [PATCH] fix: update toAddress in ibc transfer --- packages/plugin-cosmos/README.md | 10 --------- .../services/ibc-transfer-action-service.ts | 22 +++++++++---------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/packages/plugin-cosmos/README.md b/packages/plugin-cosmos/README.md index 610489e8638..e457b0b1dee 100644 --- a/packages/plugin-cosmos/README.md +++ b/packages/plugin-cosmos/README.md @@ -106,16 +106,6 @@ Yes This plugin supports a token transfer action, which allows users to transfer tokens between addresses on Cosmos-compatible blockchains between different chains. -#### Requirements - -You need to set both chain that you want to transfer founds between in env file. For example: - -``` -COSMOS_AVAILABLE_CHAINS=osmosistestnet,neutrontestnet -``` - -If you want to transfer your tokens between Osmosis Testnet and Neutron Testnet - #### Example Prompts Below are examples of how the ibc transfer action can be initiated and confirmed: diff --git a/packages/plugin-cosmos/src/actions/ibc-transfer/services/ibc-transfer-action-service.ts b/packages/plugin-cosmos/src/actions/ibc-transfer/services/ibc-transfer-action-service.ts index 65c0ab72570..508b1cc29a9 100644 --- a/packages/plugin-cosmos/src/actions/ibc-transfer/services/ibc-transfer-action-service.ts +++ b/packages/plugin-cosmos/src/actions/ibc-transfer/services/ibc-transfer-action-service.ts @@ -1,7 +1,6 @@ import { convertDisplayUnitToBaseUnit, getAssetBySymbol, - getChainByChainId, getChainByChainName, } from "@chain-registry/utils"; import { assets, chains } from "chain-registry"; @@ -97,18 +96,17 @@ export class IBCTransferAction implements ICosmosActionService { ), cumulativeAffiliateFeeBPS: "0", }); + const fromAddress = { + chainID: sourceChain.chain_id, + address: await this.cosmosWalletChains.getWalletAddress(params.chainName) + }; - const userAddresses = await Promise.all( - route.requiredChainAddresses.map(async (chainID) => { - const chain = getChainByChainId(chains, chainID); - return { - chainID, - address: await this.cosmosWalletChains.getWalletAddress( - chain.chain_name - ), - }; - }) - ); + const toAddress = { + chainID: destChain.chain_id, + address: params.toAddress + }; + + const userAddresses = [fromAddress, toAddress]; let txHash: string | undefined;