fix(store): preserve CosmosWallet default signOptions in getOfflineSigner (#42 + test update) - #46
Merged
Merged
Conversation
…alletStore
Fix `ChainWalletStore.getOfflineSigner()` passing `{}` instead of `undefined` as `signOptions` to `cosmosWallet.signAmino()` and `cosmosWallet.signDirect()`.
Problem
CosmosWallet in core defines defaultSignOptions = { preferNoSetFee: true } and applies them via signOptions || this.defaultSignOptions. Since {} is truthy, the fallback never triggers and the defaults are silently dropped.
Without preferNoSetFee: true, Keplr overrides the application-provided fee with its own calculation using the chain's native denom. This breaks any app that pays fees in a non-native denomination.
Fix
Pass undefined instead of {} for both signAmino and signDirect so the defaults in core are respected.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mergeable version of #42 (@faneaatiku's commit kept as-is) plus the 2-line test update that PR still needs.
ChainWalletStore.getOfflineSigner()passed{}assignOptionstocosmosWallet.signAmino/signDirect.CosmosWalletfalls back withsignOptions || this.defaultSignOptions, so a truthy{}silently drops{ preferNoSetFee: true }and Keplr replaces the app's fee with its own native-denom fee — breaking fee payment in non-native denoms.Second commit updates
packages/store/__tests__/chain-wallet-store.test.tsto expectundefined(the two assertions that madepnpm testfail on #42). Full suite green on this branch merged with currentmain.If you'd rather merge #42 directly, just land its author-side test fix instead; this PR exists so there's a green branch ready to go.
Link to Devin session: https://app.devin.ai/sessions/a02c84f654b94cbcb50936e98373fba5
Open in Devin Desktop: https://app.devin.ai/desktop/session/a02c84f654b94cbcb50936e98373fba5?variant=devin
Requested by: @pyramation