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

"injective-ts error":Uncaught ( in promise ) Typeerror : Cannot read properties of undefined ( reading ' length' ) #220

Open
zxl6866 opened this issue Aug 12, 2023 · 0 comments

Comments

@zxl6866
Copy link

zxl6866 commented Aug 12, 2023

I referenced the documentation to write the code, and all the fields are there, but I've encountered an error. I've tried many methods to resolve it, but without success. Could you help me take a look? Thank you.

const msgs = MsgExecuteContractInjective.fromJSON({
    sender: accounts[0].address,
    contractAddress: getWasmChainIDContractAddress(
      remoteChain.chainID
    ) as string,
    // msg: toUtf8(JSON.stringify(takePoolMessages)),
    msg: takePoolMessages,
    funds,
  });

  // const msgs = MsgSend.fromJSON({
  //   amount,
  //   srcInjectiveAddress: accounts[0].address,
  //   dstInjectiveAddress: accounts[0].address,
  // });

  /** Get the PubKey of the Signer from the Wallet/Private Key */
  const pubKey = accounts[0].pubkey;

  console.log(remoteChain.chainID, 'remoteChain.chainID');
  console.log(msgs, 'msgs_____');
  console.log(pubKey, 'pubKey____');
  console.log(DEFAULT_STD_FEE, 'fee');
  console.log(accountDetails.sequence, 'accountDetails.sequence');
  console.log(accountDetails.accountNumber, 'accountDetails.accountNumber');

  /** Prepare the Transaction **/
  const { txRaw, signDoc } = createTransaction({
    chainId: remoteChain.chainID,
    message: msgs,
    memo: '',
    pubKey,
    fee: DEFAULT_STD_FEE,
    sequence: accountDetails.sequence,
    accountNumber: accountDetails.accountNumber,
    timeoutHeight: 100,
  });

  console.log(txRaw, 'txRaw______');

  const directSignResponse = await offlineSigner.signDirect(
    remoteAddress,
    signDoc
  );
  const txRawHx = getTxRawFromTxRawOrDirectSignResponse(directSignResponse);
  const txHash = await broadcastTx(remoteChain.chainID, txRawHx);
  const response = await new TxRestClient(remoteChain.rpcUrl).fetchTxPoll(
    txHash
  );

  console.log(response, 'response____');

image
image
image
image
image
Could not load content for http://127.0.0.1:5173/node_modules/@injectivelabs/sdk-ts/src/core/modules/tx/tx.ts (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant