From 61c4dd2f86d9b3f667c04828d11709247a484470 Mon Sep 17 00:00:00 2001 From: Albert Cieplinski Date: Mon, 22 Apr 2024 13:17:50 +0200 Subject: [PATCH 1/2] Fix activate method by calling detectProvider first --- README.md | 12 ++++++++++++ src/index.ts | 2 ++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 19124d2..0c066b1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ # web3-react-trust-wallet Trust Wallet connector for [web3-react](https://www.npmjs.com/package/web3-react) + +# Usage + +``` +import { TrustWallet } from "@trustwallet/web3-react-trust-wallet"; + + const [trustWallet, hooks] = initializeConnector( + (actions) => new TrustWallet({ actions }) + ); + + trustWallet.activate(); +``` \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 153cb47..9b8eb67 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,6 +33,8 @@ export class TrustWallet extends Connector { } public activate(desiredChainIdOrChainParameters?: number | AddEthereumChainParameter): Promise | undefined { + this.detectProvider(); + if (!this.provider) { window.open('https://trustwallet.com/browser-extension/', '_blank') return From 268a3d6491eafd96b92cc20fcbbd6b41f1886129 Mon Sep 17 00:00:00 2001 From: Albert Cieplinski Date: Mon, 22 Apr 2024 13:19:03 +0200 Subject: [PATCH 2/2] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9c7f27f..c194a74 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "publishConfig": { "access": "public" }, - "version": "0.0.4", + "version": "0.0.5", "files": [ "dist/*" ],