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

fix(wallet): limit WalletConnect backup to Defly and Pera #292

Merged
merged 1 commit into from
Oct 10, 2024
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: 3 additions & 7 deletions packages/use-wallet/src/wallets/defly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ import algosdk from 'algosdk'
import { WalletState, addWallet, setAccounts, setActiveWallet, type State } from 'src/store'
import { compareAccounts, flattenTxnGroup, isSignedTxn, isTransactionArray } from 'src/utils'
import { BaseWallet } from 'src/wallets/base'
import { WalletId } from 'src/wallets/types'
import type { DeflyWalletConnect } from '@blockshake/defly-connect'
import type { Store } from '@tanstack/store'
import type {
SignerTransaction,
WalletAccount,
WalletConstructor,
WalletId
} from 'src/wallets/types'
import type { SignerTransaction, WalletAccount, WalletConstructor } from 'src/wallets/types'

export interface DeflyWalletConnectOptions {
bridge?: string
Expand Down Expand Up @@ -123,7 +119,7 @@ export class DeflyWallet extends BaseWallet {
public setActive = (): void => {
this.logger.info(`Set active wallet: ${this.id}`)
const currentActiveWallet = this.store.state.activeWallet
if (currentActiveWallet && currentActiveWallet !== this.id) {
if (currentActiveWallet && currentActiveWallet === WalletId.PERA) {
this.manageWalletConnectSession('backup', currentActiveWallet)
}
this.manageWalletConnectSession('restore')
Expand Down
10 changes: 3 additions & 7 deletions packages/use-wallet/src/wallets/pera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ import algosdk from 'algosdk'
import { WalletState, addWallet, setAccounts, setActiveWallet, type State } from 'src/store'
import { compareAccounts, flattenTxnGroup, isSignedTxn, isTransactionArray } from 'src/utils'
import { BaseWallet } from 'src/wallets/base'
import { WalletId } from 'src/wallets/types'
import type { PeraWalletConnect } from '@perawallet/connect'
import type { Store } from '@tanstack/store'
import type {
SignerTransaction,
WalletAccount,
WalletConstructor,
WalletId
} from 'src/wallets/types'
import type { SignerTransaction, WalletAccount, WalletConstructor } from 'src/wallets/types'

export interface PeraWalletConnectOptions {
bridge?: string
Expand Down Expand Up @@ -128,7 +124,7 @@ export class PeraWallet extends BaseWallet {
public setActive = (): void => {
this.logger.info(`Set active wallet: ${this.id}`)
const currentActiveWallet = this.store.state.activeWallet
if (currentActiveWallet && currentActiveWallet !== this.id) {
if (currentActiveWallet && currentActiveWallet === WalletId.DEFLY) {
this.manageWalletConnectSession('backup', currentActiveWallet)
}
this.manageWalletConnectSession('restore')
Expand Down