From f06cd1f05bfe9693f766bea6b062a9365f26a31e Mon Sep 17 00:00:00 2001 From: wenty22 Date: Wed, 27 Nov 2024 10:20:07 +0800 Subject: [PATCH] fix: Fix binance web3 wallet successfully detected trustwallet on mobile --- .changeset/chilled-pots-chew.md | 5 +++++ packages/walletkit/src/evm/wallets/trustWallet/index.tsx | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .changeset/chilled-pots-chew.md diff --git a/.changeset/chilled-pots-chew.md b/.changeset/chilled-pots-chew.md new file mode 100644 index 00000000..45137b2b --- /dev/null +++ b/.changeset/chilled-pots-chew.md @@ -0,0 +1,5 @@ +--- +'@node-real/walletkit': patch +--- + +Fix binance web3 wallet successfully detected trustwallet on mobile diff --git a/packages/walletkit/src/evm/wallets/trustWallet/index.tsx b/packages/walletkit/src/evm/wallets/trustWallet/index.tsx index 9141cce1..67c7dacb 100644 --- a/packages/walletkit/src/evm/wallets/trustWallet/index.tsx +++ b/packages/walletkit/src/evm/wallets/trustWallet/index.tsx @@ -51,5 +51,9 @@ export function trustWallet(props: InjectedEvmWalletOptions = {}): EvmWallet { function getProvider() { if (typeof window === 'undefined') return; + + // binance web3 wallet will inject a trustwallet object with no request on mobile + if (!window?.trustwallet?.request) return; + return window.trustwallet ?? window.trustWallet ?? getEvmInjectedProvider('isTrust'); }