-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6053661
commit 2ba8d26
Showing
14 changed files
with
347 additions
and
7 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
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,81 @@ | ||
# Frame | ||
|
||
[Frame](https://frame.sh/) is a privacy focused EVM desktop wallet, enabling a secure system-wide interface to your chains and web3 accounts. | ||
|
||
### Install | ||
|
||
```sh copy | ||
yarn add @web3-onboard/core @web3-onboard/frame | ||
``` | ||
|
||
or | ||
|
||
```sh copy | ||
npm install @web3-onboard/core @web3-onboard/frame | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import Onboard from '@web3-onboard/core' | ||
import frameModule from '@web3-onboard/frame' | ||
|
||
// initialize the module | ||
const frame = frameModule() | ||
|
||
const onboard = Onboard({ | ||
// ... other Onboard options | ||
wallets: [ | ||
frame | ||
//... other wallets | ||
] | ||
}) | ||
|
||
const connectedWallets = await onboard.connectWallet() | ||
console.log(connectedWallets) | ||
``` | ||
|
||
### Filtering Platforms | ||
|
||
You may decide that on certain platforms you do not want to display this wallet as a selectable option. To do that you can use the `filter` init option which is an array of platforms that you would like this wallet to **not** be displayed to the end user: | ||
|
||
```typescript | ||
import Onboard from '@web3-onboard/core' | ||
import frameModule from '@web3-onboard/frame' | ||
|
||
const frame = frameModule({ filter: ['iOS', 'Android'] }) | ||
|
||
const onboard = Onboard({ | ||
// ... other Onboard options | ||
wallets: [ | ||
frame | ||
//... other wallets | ||
] | ||
}) | ||
|
||
const connectedWallets = await onboard.connectWallet() | ||
console.log(connectedWallets) | ||
``` | ||
|
||
The following is a list of the platforms that can be filtered: | ||
|
||
```typescript | ||
type Platform = | ||
| 'Windows Phone' | ||
| 'Windows' | ||
| 'macOS' | ||
| 'iOS' | ||
| 'Android' | ||
| 'Linux' | ||
| 'Chrome OS' | ||
| 'Android Browser' | ||
| 'Chrome' | ||
| 'Chromium' | ||
| 'Firefox' | ||
| 'Microsoft Edge' | ||
| 'Opera' | ||
| 'Safari' | ||
| 'desktop' | ||
| 'mobile' | ||
| 'tablet' | ||
``` |
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,74 @@ | ||
# @web3-onboard/frame | ||
|
||
## Wallet module for connecting Frame to web3-onboard | ||
|
||
[Frame](https://frame.sh/) is a privacy focused EVM desktop wallet, enabling a secure system-wide interface to your chains and web3 accounts. | ||
|
||
### Install | ||
|
||
`npm i @web3-onboard/core @web3-onboard/frame` | ||
|
||
### Usage | ||
|
||
```typescript | ||
import Onboard from '@web3-onboard/core' | ||
import frameModule from '@web3-onboard/frame' | ||
|
||
const frame = frameModule() | ||
|
||
const onboard = Onboard({ | ||
// ... other Onboard options | ||
wallets: [ | ||
frame | ||
//... other wallets | ||
] | ||
}) | ||
|
||
const connectedWallets = await onboard.connectWallet() | ||
console.log(connectedWallets) | ||
``` | ||
|
||
### Filtering Platforms | ||
|
||
You may decide that on certain platforms you do not want to display this wallet as a selectable option. To do that you can use the `filter` init option which is an array of platforms that you would like this wallet to **not** be displayed to the end user: | ||
|
||
```typescript | ||
import Onboard from '@web3-onboard/core' | ||
import frameModule from '@web3-onboard/frame' | ||
|
||
const frame = frameModule({ filter: ['iOS', 'Android'] }) | ||
|
||
const onboard = Onboard({ | ||
// ... other Onboard options | ||
wallets: [ | ||
frame | ||
//... other wallets | ||
] | ||
}) | ||
|
||
const connectedWallets = await onboard.connectWallet() | ||
console.log(connectedWallets) | ||
``` | ||
|
||
The following is a list of the platforms that can be filtered: | ||
|
||
```typescript | ||
type Platform = | ||
| 'Windows Phone' | ||
| 'Windows' | ||
| 'macOS' | ||
| 'iOS' | ||
| 'Android' | ||
| 'Linux' | ||
| 'Chrome OS' | ||
| 'Android Browser' | ||
| 'Chrome' | ||
| 'Chromium' | ||
| 'Firefox' | ||
| 'Microsoft Edge' | ||
| 'Opera' | ||
| 'Safari' | ||
| 'desktop' | ||
| 'mobile' | ||
| 'tablet' | ||
``` |
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,65 @@ | ||
{ | ||
"name": "@web3-onboard/frame", | ||
"version": "2.21.2-alpha.1", | ||
"description": "Frame 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", | ||
"Frame", | ||
"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/frame" | ||
}, | ||
"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" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"dev": "tsc -w", | ||
"type-check": "tsc --noEmit" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"typescript": "^4.5.5" | ||
}, | ||
"dependencies": { | ||
"@web3-onboard/common": "^2.3.1", | ||
"eth-provider": "^0.13.6" | ||
} | ||
} |
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,4 @@ | ||
export default ` | ||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 153.4 152.9" color="#00d2be"> | ||
<path fill="currentColor" d="M145.1,75.6v-58c0-5.1-4.2-9.3-9.3-9.3h0H77.7c-0.6,0-1.1-0.2-1.6-0.6l-7-7c-0.4-0.4-1-0.7-1.6-0.7H9.3 C4.2,0,0,4.1,0,9.3c0,0,0,0,0,0l0,0v58c0,0.6,0.2,1.1,0.6,1.6l7,7c0.4,0.4,0.7,1,0.7,1.6v58c0,5.1,4.2,9.3,9.3,9.3c0,0,0,0,0,0h58.2 c0.6,0,1.1,0.2,1.6,0.6l7,7c0.4,0.4,1,0.6,1.6,0.6h58.2c5.1,0,9.3-4.1,9.3-9.3c0,0,0,0,0,0l0,0v-58c0-0.6-0.2-1.1-0.6-1.6l-7-7 C145.4,76.7,145.1,76.2,145.1,75.6z M105.6,106.6H47.9c-0.7,0-1.3-0.6-1.3-1.3V47.7c0-0.7,0.6-1.3,1.3-1.3h57.7 c0.7,0,1.3,0.6,1.3,1.3v57.6C107,106,106.4,106.6,105.6,106.6z" /> | ||
</svg>` |
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,46 @@ | ||
import { WalletInit } from '@web3-onboard/common' | ||
|
||
async function getProvider() { | ||
const injected = (window as any).ethereum | ||
|
||
if (injected && injected.isFrame) { | ||
return injected | ||
} | ||
|
||
const { default: ethProvider } = await import('eth-provider') | ||
return ethProvider('frame') | ||
} | ||
|
||
function frame(): WalletInit { | ||
return () => { | ||
return { | ||
label: 'Frame', | ||
getIcon: async () => (await import('./icon.js')).default, | ||
getInterface: async () => { | ||
const provider = await getProvider() | ||
|
||
return { | ||
provider, | ||
interface: { | ||
connect: () => | ||
provider | ||
.request({ | ||
method: 'eth_requestAccounts' | ||
}) | ||
.catch((err: { message: string }) => { | ||
if (err.message.includes('Unexpected end of JSON input')) { | ||
throw new Error('Frame is not running') | ||
} | ||
|
||
throw err | ||
}), | ||
disconnect: provider.close | ||
} | ||
} | ||
}, | ||
platforms: ['desktop'] | ||
} | ||
} | ||
} | ||
|
||
export default frame |
Oops, something went wrong.