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

Signing Stargate Client crashing while message signing #78

Open
francisblakewood opened this issue Oct 26, 2024 · 0 comments
Open

Signing Stargate Client crashing while message signing #78

francisblakewood opened this issue Oct 26, 2024 · 0 comments

Comments

@francisblakewood
Copy link

Signing Stargate Client crashing while message signing

Summary:

Following docs for setting up leap to be able to sign message crashes Leap wallet extension (version: "0.15.6").

** Aditionally - same code works with window.keplr

Screenshot 2024-10-26 at 12 40 03

Reference imports:

import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import {
  Registry,
} from "@cosmjs/proto-signing";
import {
  AminoTypes,
  createDefaultAminoConverters,
  defaultRegistryTypes,
  SigningStargateClient,
} from "@cosmjs/stargate";
import {
  createWasmAminoConverters,
  wasmTypes,
} from "@cosmjs/cosmwasm-stargate";

versions:

"@cosmjs/amino": "^0.32.4",
"@cosmjs/cosmwasm-stargate": "^0.32.4",
"@cosmjs/proto-signing": "^0.32.4",
"@cosmjs/stargate": "0.32.4",

Reference code:

const leap = window.leap;

if (!leap) {
  console.log("leap wallet not installed");
} else {
 
  await leap.enable(chainId);

  const signOptions = {
    preferNoSetFee: true,
    preferNoSetMemo: true,
    disableBalanceCheck: true,
  };

  const offlineSigner = leap.getOfflineSigner(
    destinationChain.chainExternalId,
    signOptions
  );
  const stargateClient =
    await SigningStargateClient.connectWithSigner(
      "rpc-url",
      offlineSigner,
      {
        registry: new Registry([
          ...defaultRegistryTypes,
          ...wasmTypes,
        ]),
        aminoTypes: new AminoTypes(aminoConverters),
      }
    );
  const account = await stargateClient.getAccount(account_address);
  const signerData = {
    accountNumber: account.accountNumber,
    chainId: destinationChain.chainExternalId,
    sequence: account.sequence,
  };
  const messages = {
      typeUrl: messageData.typeUrl,
      value: {
        sender: messageData.value.sender,
        contract: messageData.value.contract,
        msg: encoding.encode(messageData.value.msg),
        funds: messageData.value.funds,
      },
    };

  const respoonse: TxRaw = await stargateClient.sign(
   account_address,
    messages,
    {
      amount: [],
      gas: "1000000",
    },
    "",
    signerData
  );
}
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