Skip to content

Commit

Permalink
fix(mobile): Invalidate unknown watch-only contracts properly (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
voloshinskii authored May 22, 2024
1 parent 19abf2f commit b240987
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/mobile/src/wallet/Tonkeeper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ export class Tonkeeper {
this.walletsStore.persist({
storage: this.storage,
key: 'walletsStore',
version: 1,
onUpdate: (_, prevData) => ({
...prevData,
wallets: prevData?.wallets.filter((wallet) => wallet.version) ?? [],
}),
});

this.migrationStore.persist({
Expand Down Expand Up @@ -427,6 +432,10 @@ export class Tonkeeper {

const version = versionByAddress[rawAddress] as WalletContractVersion;

if (!version) {
throw new Error('Unknown contract');
}

const config: WalletConfig = {
...DEFAULT_WALLET_STYLE_CONFIG,
name: name ?? this.getNewWalletName(),
Expand Down

0 comments on commit b240987

Please sign in to comment.