Skip to content

Commit 16bfc2d

Browse files
authored
Merge pull request #531 from InjectiveLabs/chore/remove-wallet-restriction-on-getCosmosWallet
chore: remove wallet restriction on getCosmosWallet
2 parents 21427a5 + 76a155f commit 16bfc2d

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

packages/wallets/wallet-core/src/broadcaster/MsgBroadcaster.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,9 @@ export class MsgBroadcaster {
838838
}
839839

840840
const cosmosWallet = walletStrategy.getCosmosWallet(chainId)
841+
const canDisableCosmosGasCheck = [Wallet.Keplr, Wallet.OWallet].includes(
842+
walletStrategy.wallet,
843+
)
841844
const feePayerPubKey = await this.fetchFeePayerPubKey(
842845
options.feePayerPubKey,
843846
)
@@ -888,10 +891,7 @@ export class MsgBroadcaster {
888891
})
889892

890893
// Temporary remove tx gas check because Keplr doesn't recognize feePayer
891-
if (
892-
walletStrategy.wallet === Wallet.Keplr &&
893-
cosmosWallet.disableGasCheck
894-
) {
894+
if (canDisableCosmosGasCheck && cosmosWallet.disableGasCheck) {
895895
cosmosWallet.disableGasCheck(chainId)
896896
}
897897

@@ -916,7 +916,7 @@ export class MsgBroadcaster {
916916
})
917917

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

packages/wallets/wallet-core/src/strategy/BaseWalletStrategy.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,6 @@ export default class BaseWalletStrategy implements WalletStrategyInterface {
207207
}
208208

209209
public getCosmosWallet(chainId: ChainId): CosmosWalletAbstraction {
210-
if (![Wallet.Keplr, Wallet.Leap].includes(this.getWallet())) {
211-
throw new WalletException(
212-
new Error(`You can't use this method outside of Keplr/Leap wallet`),
213-
)
214-
}
215-
216210
const strategy = this.getStrategy()
217211

218212
if (strategy.getCosmosWallet == undefined) {

0 commit comments

Comments
 (0)