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

chore: remove wallet restriction on getCosmosWallet #531

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/wallets/wallet-core/src/broadcaster/MsgBroadcaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,9 @@ export class MsgBroadcaster {
}

const cosmosWallet = walletStrategy.getCosmosWallet(chainId)
const canDisableCosmosGasCheck = [Wallet.Keplr, Wallet.OWallet].includes(
walletStrategy.wallet,
)
const feePayerPubKey = await this.fetchFeePayerPubKey(
options.feePayerPubKey,
)
Expand Down Expand Up @@ -888,10 +891,7 @@ export class MsgBroadcaster {
})

// Temporary remove tx gas check because Keplr doesn't recognize feePayer
if (
walletStrategy.wallet === Wallet.Keplr &&
cosmosWallet.disableGasCheck
) {
if (canDisableCosmosGasCheck && cosmosWallet.disableGasCheck) {
cosmosWallet.disableGasCheck(chainId)
}

Expand All @@ -916,7 +916,7 @@ export class MsgBroadcaster {
})

// Re-enable tx gas check removed above
if (walletStrategy.wallet === Wallet.Keplr && cosmosWallet.enableGasCheck) {
if (canDisableCosmosGasCheck && cosmosWallet.enableGasCheck) {
cosmosWallet.enableGasCheck(chainId)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,6 @@ export default class BaseWalletStrategy implements WalletStrategyInterface {
}

public getCosmosWallet(chainId: ChainId): CosmosWalletAbstraction {
if (![Wallet.Keplr, Wallet.Leap].includes(this.getWallet())) {
throw new WalletException(
new Error(`You can't use this method outside of Keplr/Leap wallet`),
)
}

const strategy = this.getStrategy()

if (strategy.getCosmosWallet == undefined) {
Expand Down