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

Get "Unmatched chain id with the offline signer" with last updates #131

Open
zhmoly opened this issue Dec 23, 2022 · 4 comments
Open

Get "Unmatched chain id with the offline signer" with last updates #131

zhmoly opened this issue Dec 23, 2022 · 4 comments

Comments

@zhmoly
Copy link

zhmoly commented Dec 23, 2022

I used secretjs alpha version before.
And used keplr wallet for query & broadcast transactions.
It was works fine before I updated secretjs version.
But when I update with v1.5, get this error: "Unmatched chain id with the offline signer".
Of course, set chainid as "pulsar-2" for both client side and wallet setting.

this.scrtSecretJs = new SecretNetworkClient({ url: env.grpcurl, chainId: env.CHAIN_ID, wallet: keplrOfflineSigner, walletAddress: this.scrtUsrPubkey, encryptionUtils: this.scrtKeplr.getEnigmaUtils(env.CHAIN_ID), });

After my own research, I find this issue related with parameter names.
For old version, there is _ for parameters. (ex: chain_id => chainId, code_id => codeId).
But names updated and some wallet sdk (not sure that) is just working with chain_id.

This one is what I find that error part in CosmJSOfflineSigner. (from chrome console, not from github source).
e.CosmJSOfflineSigner = class extends i { constructor(t, e) { super(t, e), this.chainId = t, this.keplr = e } signDirect(t, e) { return n(this, void 0, void 0, (function*() { if (this.chainId !== e.chainId) throw new Error("Unmatched chain id with the offline signer"); if ((yield this.keplr.getKey(e.chainId)).bech32Address !== t) throw new Error("Unknown signer address"); return yield this.keplr.signDirect(this.chainId, t, e) } )) } }

And this is chainId compare part.
image

So chainId is same, but name is different.
Is there any way to resolve this issue?
Thanks

@Cashmaney
Copy link
Member

Hey @jwtradera! The interfaces for v1.5 have changed a bit as a result of the switch to grpc-gateway.
I suspect your issue may be incorrect initialization of SecretNetworkClient. The correct way to initialize the SecretNetworkClient is with a REST url, not the GRPC. You can find an example of how to initialize SecretJS & Keplr here:

https://github.com/scrtlabs/rps-ui/blob/main/store/index.js#L79

Let me know if this helps!

@zhmoly
Copy link
Author

zhmoly commented Dec 23, 2022

Hi
Thanks for reply.
Just if possible, can you share NUXT_ENV_REST_URL?
I'm using 'pulsar-2' for test, so if possible can you share that url?
Also I both tried grpc and lcd url for that.
And if I using grpc not lcd, then get http1.2 issue.
If you faced same issue, can you forward that solution too?
Many thanks

@zhmoly zhmoly changed the title Get "Unmatched chain id with the offline signer" with lsat updates Get "Unmatched chain id with the offline signer" with lastt updates Dec 23, 2022
@zhmoly zhmoly changed the title Get "Unmatched chain id with the offline signer" with lastt updates Get "Unmatched chain id with the offline signer" with last updates Dec 23, 2022
@Cashmaney
Copy link
Member

That endpoint is a mainnet one, and from your chain-id it seems like you're trying to connect to the pulsar-2 testnet. You can use any of the endpoints publicly available from here: https://docs.scrt.network/secret-network-documentation/development/connecting-to-the-network

@assafmo
Copy link
Member

assafmo commented Jan 25, 2023

This should be fixed in v1.6.10, can you confirm @jwtradera?

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

3 participants