cosmos / cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
https://cosmos.github.io/cosmjs/
Apache License 2.0
654 stars 344 forks source link

Error: Unsupported type: '/injective.types.v1beta1.EthAccount' #1459

Open zxl6866 opened 1 year ago

zxl6866 commented 1 year ago

I have a question to ask. I didn't encounter this error when creating a trading pair between JUNO and OSMO. However, when I tried creating a trading pair between OSMO and Injective, I encountered an error. image

import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate';
import { toUtf8 } from '@cosmjs/encoding';
import { Coin } from '@cosmjs/stargate';
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx';

type CreateExecuteMessageArgs = {
  senderAddress: string;
  message: any;
  contractAddress: string;
  funds?: Array<Coin>;
};

export const createExecuteMessage = ({
  senderAddress,
  contractAddress,
  message,
  funds,
}: CreateExecuteMessageArgs): MsgExecuteContractEncodeObject => ({
  typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
  value: MsgExecuteContract.fromPartial({
    sender: senderAddress,
    contract: contractAddress,
    msg: toUtf8(JSON.stringify(message)),
    funds: funds || [],
  }),
});
HS-Joe commented 1 year ago

I managed to get it working using https://docs.ts.injective.network/transactions/transactions-cosmos

Daniel1984 commented 10 months ago

@zxl6866 have you managed to solve this issue using cosmjs or you had to switch to injective sdk?