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

Getting error Unsupported type: '/eth.types.v1.EthAccount' with brand new keplr wallet #371

Open
Vishwas1 opened this issue Sep 24, 2024 · 7 comments
Assignees
Labels
prio: p1 (high) high priority

Comments

@Vishwas1
Copy link

We are getting this error when trying to execute a contract function deployed on testnet-1

Error: Unsupported type: '/eth.types.v1.EthAccount'
at accountFromAny (accounts.js:76:13)
    at SigningCosmWasmClient.getAccount (cosmwasmclient.js:82:54)
    at async SigningCosmWasmClient.getSequence (cosmwasmclient.js:91:21)
    at async SigningCosmWasmClient.sign (signingcosmwasmclient.js:406:11)
    at async SigningCosmWasmClient.signAndBroadcast (signingcosmwasmclient.js:365:19)
    at async SigningCosmWasmClient.executeMultiple (signingcosmwasmclient.js:290:20)
    at async smartContractExecuteRPC (execute.js:25:1)
    at async VueComponent.mint (index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/e-kyc/OnChainId.vue?vue&type=script&lang=js:161:24)

Code snippet we are trying:

import {
    NibiruTxClient,
    NibiruQuerier
} from "@nibiruchain/nibijs"

export async function createClient(rpcUrl, offlineSigner) {
   

    const txClient = await NibiruTxClient.connectWithSigner(
        rpcUrl,
        offlineSigner
    )
    console.log({
        txClient: txClient.wasmClient
    })
    return txClient.wasmClient
}

export async function createNonSigningClient(rpcUrl) {
    const client = await NibiruQuerier.connect(rpcUrl)
    return client
}

version: "@nibiruchain/nibijs": "^4.5.1"

How to recreate?

try calling this particular contract nibi1ag6a26rvt9duue8wh8rsp94z9lx7c5pdjf8mlkals6f2uqr0aj0s4ltp6q function mint() with the following param:

{"hypersign_proof": {"credential_id": "", "data": "","description": "Proves that user has finished his/her KYC", "proof_type_image": "something", "sbt_code": "T1" , "proof_type" : "proof_of_personhood" }}

Make sure to generate a brand new wallet in Keplr and try.

Note; we have notice that when we use validator's account then it works. but when creating a brand new account in keplr wallet or even in cli, it does not work through JS sdk.

@cgilbe27
Copy link
Contributor

Please see here: cosmos/relayer#1493

@Unique-Divine
Copy link
Member

Context From Telegram [2024-09-24]

"Yeah, I am almost positive it's related to protobuf registration on the signing client. We will need to extend the wasm client and publish a version of nibijs that plays nicely with Nibiru accounts" - Nibiru

"yes or else need to give PR to cosmjs .. best is to update nibijs sdk" - Hypersign

Would note that I don't think this one is blocked. We do need to extend the default Wasm signing client to register the other account type.

@Unique-Divine Unique-Divine added the prio: p1 (high) high priority label Sep 24, 2024
@cgilbe27
Copy link
Contributor

@CalicoNino CalicoNino self-assigned this Sep 25, 2024
@CalicoNino
Copy link
Contributor

CalicoNino commented Oct 2, 2024

Outline of a similar issue with ethermint
cosmos/cosmjs#1351

Since the fix requires a change to the Account parser in cosmjs, and seems that isn't going to be worked on. We could potentially append their existing account parser to accept our eth account, outlined here https://github.com/cosmos/cosmjs/blob/main/packages/stargate/src/accounts.ts#L44-L89. But this can be a second solution since, we don't want to be dependant on their PR approval.

A possible solution is that we can either extend or create a wrapper for the NibiruTxClient to accept ethaccounts. Found this script that allows signing and simulating Cosmos-EVM transactions using Keplr:

  • signEvmWithKeplr: It fetches account details, constructs a transaction, and signs it using Keplr for Cosmos-EVM chains like Evmos. The signed transaction is returned ready for broadcast.
  • simulateEvmWithKeplr: It simulates a transaction to estimate gas usage by creating and sending a mock transaction without broadcasting it.

@CalicoNino
Copy link
Contributor

CalicoNino commented Oct 2, 2024

Reproducing on Testnet, created a new keplr wallet and deployed a counter contract. Was able to reproduce. NOTE: Must ensure that Wallet is newly generated with Keplr only.

Regardless knowing that the error is sided from https://github.com/cosmos/cosmjs/blob/main/packages/stargate/src/accounts.ts#L44-L89, we would need to make a Account parser for our Eth accounts.

@Unique-Divine
Copy link
Member

Reproducing on Testnet, created a new keplr wallet and deployed a counter contract. Was able to reproduce. NOTE: Must ensure that Wallet is newly generated with Keplr only...

Great find on reproducing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: p1 (high) high priority
Projects
Status: ⚡ Building 🧱
Development

No branches or pull requests

4 participants