diff --git a/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContract.ts b/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContract.ts index 205537d0f..81e5010c7 100644 --- a/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContract.ts +++ b/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContract.ts @@ -8,10 +8,15 @@ import { GeneralException } from '@injectivelabs/exceptions' export declare namespace MsgExecuteContract { export interface Params { - funds?: { - denom: string - amount: string - } + funds?: + | { + denom: string + amount: string + } + | { + denom: string + amount: string + }[] sender: string contractAddress: string /* Used to provide type safety for execution messages */ @@ -74,12 +79,20 @@ export default class MsgExecuteContract extends MsgBase< message.setContract(params.contractAddress) if (params.funds) { - const funds = new Coin() + const fundsToArray = Array.isArray(params.funds) + ? params.funds + : [params.funds] + + const funds = fundsToArray.map((coin) => { + const funds = new Coin() + + funds.setAmount(coin.amount) + funds.setDenom(coin.denom) - funds.setAmount(params.funds.amount) - funds.setDenom(params.funds.denom) + return funds + }) - message.setFundsList([funds]) + message.setFundsList(funds) } return message