Skip to content

Commit

Permalink
Merge pull request #6 from trustwallet/fix/activate
Browse files Browse the repository at this point in the history
Fix activate method by calling detectProvider first
  • Loading branch information
ampcasd authored Apr 22, 2024
2 parents 7226b40 + 268a3d6 commit b6b6b5c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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<TrustWallet>(
(actions) => new TrustWallet({ actions })
);
trustWallet.activate();
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.0.4",
"version": "0.0.5",
"files": [
"dist/*"
],
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class TrustWallet extends Connector {
}

public activate(desiredChainIdOrChainParameters?: number | AddEthereumChainParameter): Promise<void> | undefined {
this.detectProvider();

if (!this.provider) {
window.open('https://trustwallet.com/browser-extension/', '_blank')
return
Expand Down

0 comments on commit b6b6b5c

Please sign in to comment.