Skip to content

Commit 00bb596

Browse files
authored
fix: remove doubled context providers (#518)
1 parent 0332509 commit 00bb596

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

apps/next/src/popup/app.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ export function App() {
139139
OnboardingScreen={Onboarding}
140140
/>,
141141
<AccountsContextProvider />,
142-
<LedgerContextProvider />,
143-
<KeystoneContextProvider />,
144142
<WalletContextProvider
145143
LockedComponent={LockScreen}
146144
LoadingComponent={LoadingScreen}

packages/service-worker/src/connections/middlewares/ExtensionRequestHandlerMiddleware.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ const handleRequest = async (
9595
method: context.request.params.request.method,
9696
params: context.request.params.request.params,
9797
context: {
98-
currentAddress: context.currentAddress,
99-
xpubXP: context.xpubXP,
10098
...context.request.context,
99+
account: context.account,
101100
},
102101
},
103102
context.network as Network, // TODO: Remove this cast after SVM network type appears in vm-module-types,

packages/service-worker/src/services/wallet/WalletService.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -793,11 +793,15 @@ export class WalletService implements OnUnlock {
793793

794794
// Handle Avalanche transaction requests coming from the Avalanche Module
795795
if (isAvalancheModuleTransactionRequest(tx)) {
796+
const isLedgerSigner =
797+
wallet instanceof Avalanche.SimpleLedgerSigner ||
798+
wallet instanceof Avalanche.LedgerSigner ||
799+
wallet instanceof Avalanche.LedgerLiveSigner;
800+
796801
if (
802+
!isLedgerSigner &&
797803
!(wallet instanceof Avalanche.SimpleSigner) &&
798804
!(wallet instanceof Avalanche.StaticSigner) &&
799-
!(wallet instanceof Avalanche.SimpleLedgerSigner) &&
800-
!(wallet instanceof Avalanche.LedgerSigner) &&
801805
!(wallet instanceof KeystoneWallet) &&
802806
!(wallet instanceof WalletConnectSigner) &&
803807
!(wallet instanceof SeedlessWallet)
@@ -832,8 +836,7 @@ export class WalletService implements OnUnlock {
832836

833837
const signRequest = {
834838
tx: unsignedTx,
835-
...((wallet instanceof Avalanche.SimpleLedgerSigner ||
836-
wallet instanceof Avalanche.LedgerSigner) && {
839+
...(isLedgerSigner && {
837840
transport: this.ledgerService.recentTransport,
838841
}),
839842
externalIndices,
@@ -870,12 +873,15 @@ export class WalletService implements OnUnlock {
870873

871874
// Handle Avalanche signing, X/P/CoreEth
872875
if ('tx' in tx) {
876+
const isLedgerSigner =
877+
wallet instanceof Avalanche.LedgerSigner ||
878+
wallet instanceof Avalanche.LedgerLiveSigner ||
879+
wallet instanceof Avalanche.SimpleLedgerSigner;
880+
873881
if (
882+
!isLedgerSigner &&
874883
!(wallet instanceof Avalanche.SimpleSigner) &&
875884
!(wallet instanceof Avalanche.StaticSigner) &&
876-
!(wallet instanceof Avalanche.SimpleLedgerSigner) &&
877-
!(wallet instanceof Avalanche.LedgerSigner) &&
878-
!(wallet instanceof Avalanche.LedgerLiveSigner) &&
879885
!(wallet instanceof KeystoneWallet) &&
880886
!(wallet instanceof WalletConnectSigner) &&
881887
!(wallet instanceof SeedlessWallet)
@@ -885,9 +891,7 @@ export class WalletService implements OnUnlock {
885891

886892
const txToSign = {
887893
tx: tx.tx,
888-
...((wallet instanceof Avalanche.SimpleLedgerSigner ||
889-
wallet instanceof Avalanche.LedgerSigner ||
890-
wallet instanceof Avalanche.LedgerLiveSigner) && {
894+
...(isLedgerSigner && {
891895
transport: this.ledgerService.recentTransport,
892896
}),
893897
externalIndices: tx.externalIndices,

0 commit comments

Comments
 (0)