-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: metamask sdk integration (#1908)
* feat: initial commit - sdk integration * feat: metamask sdk working integration * feat: update metamask sdk 0.6.2 * feat: update example * feat: cleanup imports * feat: remove unused code * feat: cleanup for PR * Update packages/core/src/disconnect.ts * Update packages/core/src/disconnect.ts * Update packages/metamask/package.json * Add MetaMask sdk to demo package for testing * Remove yarn.lock from MM package * Update MetaMask provider to import modules dynamically on select of MM in client, remove SDK from wallet name as that is customer facing * Return docs yarn lock * Reorder MM wallet to be first along with injected wallets so the SDK instance takes precidence * Get upstream docs yarn.lock * feat: upgrade sdk to 0.10. * Add MetaMask to wallet docs * Update docs pages * Refine docs and README * Add metamask package to docs * Revert changes to docs yarn.lock --------- Co-authored-by: Adam Carpenter <adamcarpenter86@gmail.com>
- Loading branch information
1 parent
2436a4d
commit 0c83bdf
Showing
29 changed files
with
934 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 18.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
docs/src/routes/docs/[...4]wallets/[...18]metamask/+page.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: MetaMask | ||
--- | ||
|
||
# {$frontmatter.title} | ||
|
||
## Wallet module for connecting MetaMask Wallet SDK to web3-onboard | ||
|
||
The MetaMask Web3-Onboard module provides a reliable, secure, and seamless connection from your dapp to the MetaMask browser extension and MetaMask Mobile. | ||
See [MetaMask SDK Developer Docs](https://github.com/MetaMask/metamask-sdk) | ||
|
||
::: | ||
|
||
## Install | ||
|
||
<Tabs values={['yarn', 'npm']}> | ||
<TabPanel value="yarn"> | ||
|
||
```sh copy | ||
yarn add @web3-onboard/metamask | ||
``` | ||
|
||
</TabPanel> | ||
<TabPanel value="npm"> | ||
|
||
```sh copy | ||
npm install @web3-onboard/metamask | ||
``` | ||
|
||
</TabPanel> | ||
</Tabs> | ||
|
||
## Options | ||
|
||
```typescript | ||
// For a complete list of options check https://github.com/MetaMask/metamask-sdk | ||
interface MetaMaskSDKOptions { | ||
dappMetadata: { | ||
url?: string; | ||
name?: string; | ||
base64Icon?: string; | ||
}, | ||
/** | ||
* If MetaMask browser extension is detected, directly use it without prompting the user. | ||
*/ | ||
extensionOnly?: boolean; | ||
} | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import Onboard from '@web3-onboard/core' | ||
import metamaskSDK from '@web3-onboard/metamask' | ||
|
||
// initialize the module with options | ||
const metamaskSDKWallet = metamaskSDK({options: { | ||
extensionOnly: false, | ||
dappMetadata: { | ||
name: 'Demo Web3Onboard' | ||
} | ||
}}) | ||
|
||
const onboard = Onboard({ | ||
// ... other Onboard options | ||
wallets: [ | ||
metamaskSDKWallet | ||
//... other wallets | ||
] | ||
}) | ||
|
||
const connectedWallets = await onboard.connectWallet() | ||
console.log(connectedWallets) | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# @web3-onboard/metamask | ||
|
||
## Wallet module for connecting MetaMask Wallet SDK to web3-onboard | ||
The MetaMask Web3-Onboard module provides a reliable, secure, and seamless connection from your dapp to the MetaMask browser extension and MetaMask Mobile. | ||
See [MetaMask SDK Developer Docs](https://github.com/MetaMask/metamask-sdk) | ||
|
||
### Install | ||
|
||
`npm i @web3-onboard/metamask` | ||
|
||
## Options | ||
|
||
```typescript | ||
// For a complete list of options check https://github.com/MetaMask/metamask-sdk | ||
interface MetaMaskSDKOptions { | ||
dappMetadata: { | ||
url?: string; | ||
name?: string; | ||
base64Icon?: string; | ||
}, | ||
/** | ||
* If MetaMask browser extension is detected, directly use it without prompting the user. | ||
*/ | ||
extensionOnly?: boolean; | ||
} | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import Onboard from '@web3-onboard/core' | ||
import metamaskSDK from '@web3-onboard/metamask' | ||
|
||
// initialize the module with options | ||
const metamaskSDKWallet = metamaskSDK({options: { | ||
extensionOnly: false, | ||
dappMetadata: { | ||
name: 'Demo Web3Onboard' | ||
} | ||
}}) | ||
|
||
const onboard = Onboard({ | ||
// ... other Onboard options | ||
wallets: [ | ||
metamaskSDKWallet | ||
//... other wallets | ||
] | ||
}) | ||
|
||
const connectedWallets = await onboard.connectWallet() | ||
console.log(connectedWallets) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"name": "@web3-onboard/metamask", | ||
"version": "2.0.0-alpha.1", | ||
"description": "MetaMask SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.", | ||
"keywords": [ | ||
"Ethereum", | ||
"Web3", | ||
"EVM", | ||
"dapp", | ||
"Multichain", | ||
"Wallet", | ||
"Transaction", | ||
"Provider", | ||
"Hardware Wallet", | ||
"Notifications", | ||
"React", | ||
"Svelte", | ||
"Vue", | ||
"Next", | ||
"Nuxt", | ||
"MetaMask", | ||
"Coinbase", | ||
"WalletConnect", | ||
"Ledger", | ||
"Trezor", | ||
"Connect Wallet", | ||
"Ethereum Hooks", | ||
"Blocknative", | ||
"Mempool", | ||
"pending", | ||
"confirmed", | ||
"Injected Wallet", | ||
"Crypto", | ||
"Crypto Wallet" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/blocknative/web3-onboard.git", | ||
"directory": "packages/metamask" | ||
}, | ||
"homepage": "https://onboard.blocknative.com", | ||
"bugs": "https://github.com/blocknative/web3-onboard/issues", | ||
"module": "dist/index.js", | ||
"browser": "dist/index.js", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"typings": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "tsc", | ||
"dev": "tsc -w", | ||
"type-check": "tsc --noEmit" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.5.7", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.2.2" | ||
}, | ||
"dependencies": { | ||
"@metamask/sdk": "^0.10.0", | ||
"@web3-onboard/common": "^2.3.3" | ||
} | ||
} |
Oops, something went wrong.