Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9409b81
feat: create trust wallet SDK
karim-yassine Jan 13, 2023
4fa907b
docs: add Trust wallet SDK docs link
karim-yassine Jan 13, 2023
015afca
docs: add trust SDK option
karim-yassine Jan 13, 2023
a75d45d
docs: add trust SDK option
karim-yassine Jan 13, 2023
32ddd63
chore: add trust SDK jobs
karim-yassine Jan 13, 2023
50c392b
feat: add trust as part of the default wallets
karim-yassine Jan 13, 2023
cb476fa
feat: add trust type
karim-yassine Jan 13, 2023
594f5a4
fix: not identifying injected trust wallet
karim-yassine Jan 13, 2023
894c968
Merge branch 'blocknative:v2-web3-onboard-develop' into fix/trust-wal…
karim-yassine Jan 13, 2023
2b36311
fix: building error
karim-yassine Jan 13, 2023
5982c56
fix: only verify if trustwallet exists
karim-yassine Jan 13, 2023
171627c
fix: wallets conflicting with each other
karim-yassine Jan 13, 2023
4f2abb6
chore: increment version
karim-yassine Jan 13, 2023
023d2f8
chore: revert version
karim-yassine Jan 13, 2023
bbfc201
docs: update documentation with Trust example
karim-yassine Jan 13, 2023
785b9d5
docs: update description
karim-yassine Jan 13, 2023
eece2f8
chore: update version
karim-yassine Jan 13, 2023
f6ec3ec
docs: resolve typo
karim-yassine Jan 13, 2023
a2d11cc
Merge branch 'blocknative:v2-web3-onboard-develop' into fix/trust-wal…
karim-yassine Jan 13, 2023
595cdd4
Merge branch 'v2-web3-onboard-develop' into fix/trust-wallet-integrat…
karim-yassine Jan 24, 2023
b177dab
Merge branch 'v2-web3-onboard-develop' into fix/trust-wallet-integrat…
karim-yassine Jan 25, 2023
8dba7cd
Merge branch 'v2-web3-onboard-develop' into fix/trust-wallet-integrat…
karim-yassine Jan 26, 2023
deb72ef
fix: incorrectly checking providers
karim-yassine Jan 27, 2023
bbc7446
Merge branch 'blocknative:v2-web3-onboard-develop' into fix/trust-wal…
karim-yassine Jan 27, 2023
7985905
Add trust to docs site
Adamj1232 Jan 27, 2023
56fc9bb
Add docs and bump version
Adamj1232 Jan 27, 2023
495961e
Fix deploy config
Adamj1232 Jan 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/trezor
steps:
- node-build-steps
build-trust:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/trust
steps:
- node-build-steps
build-frontier:
docker:
- image: cimg/node:16.13.1
Expand Down Expand Up @@ -431,6 +437,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/trezor
steps:
- node-staging-build-steps
build-staging-trust:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/trust
steps:
- node-staging-build-steps
build-staging-frontier:
docker:
- image: cimg/node:16.13.1
Expand Down Expand Up @@ -621,6 +633,12 @@ workflows:
<<: *deploy_production_filters
- build-staging-trezor:
<<: *deploy_staging_filters
trust:
jobs:
- build-trust:
<<: *deploy_production_filters
- build-staging-trust:
<<: *deploy_staging_filters
frontier:
jobs:
- build-frontier:
Expand Down
45 changes: 23 additions & 22 deletions .github/ISSUE_TEMPLATE/BUG.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
title: '[Bug]: '
labels: [bug]
assignees:
- taylorjdawson
Expand Down Expand Up @@ -40,27 +40,28 @@ body:
attributes:
label: What package is effected by this issue?
options:
- "@web3-onboard/core"
- "@web3-onboard/common"
- "@web3-onboard/coinbase"
- "@web3-onboard/decent"
- "@web3-onboard/formatic"
- "@web3-onboard/gnosis"
- "@web3-onboard/injected"
- "@web3-onboard/keepkey"
- "@web3-onboard/keystone"
- "@web3-onboard/ledger"
- "@web3-onboard/magic"
- "@web3-onboard/mew"
- "@web3-onboard/portis"
- "@web3-onboard/react"
- "@web3-onboard/torus"
- "@web3-onboard/trezor"
- "@web3-onboard/frontier"
- "@web3-onboard/vue"
- "@web3-onboard/walletconnect"
- "@web3-onboard/walletlink"
- "@web3-onboard/web3auth"
- '@web3-onboard/core'
- '@web3-onboard/common'
- '@web3-onboard/coinbase'
- '@web3-onboard/decent'
- '@web3-onboard/formatic'
- '@web3-onboard/gnosis'
- '@web3-onboard/injected'
- '@web3-onboard/keepkey'
- '@web3-onboard/keystone'
- '@web3-onboard/ledger'
- '@web3-onboard/magic'
- '@web3-onboard/mew'
- '@web3-onboard/portis'
- '@web3-onboard/react'
- '@web3-onboard/torus'
- '@web3-onboard/trezor'
- '@web3-onboard/trust'
- '@web3-onboard/frontier'
- '@web3-onboard/vue'
- '@web3-onboard/walletconnect'
- '@web3-onboard/walletlink'
- '@web3-onboard/web3auth'
- bnc-onboard (v1)
validations:
required: true
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ For full documentation, check out the README.md for each package or the [docs pa
**SDK Wallets**

- [Coinbase](packages/coinbase/README.md)
- [Trust](packages/trust/README.md)
- [WalletConnect](packages/walletconnect/README.md)
- [Gnosis](packages/gnosis/README.md)
- [Magic](packages/magic/README.md)
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"@web3-onboard/tallyho": "^2.0.1",
"@web3-onboard/torus": "^2.2.0",
"@web3-onboard/trezor": "^2.3.3",
"@web3-onboard/trust": "^2.0.0-alpha.1",
"@web3-onboard/uauth": "^2.0.1",
"@web3-onboard/walletconnect": "^2.2.1",
"@web3-onboard/web3auth": "^2.1.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## Step 1: Import + Configure

Import the libraries and any wallets you would like to use. For this example, we are going to use the injected wallets module. You can easily add more wallet support to your dapp via our other wallet modules. Additionally, we'll setup web3-onboard to support 2 chains: Ethereum mainnet and Polygon mainnet.
Expand All @@ -22,6 +21,7 @@ import web3authModule from '@web3-onboard/web3auth'
import dcentModule from '@web3-onboard/dcent'
import sequenceModule from '@web3-onboard/sequence'
import tallyHoModule from '@web3-onboard/tallyho'
import trustModule from '@web3-onboard/trust'
import frontierModule from '@web3-onboard/frontier'

const INFURA_KEY = ''
Expand All @@ -45,6 +45,7 @@ const keepkey = keepkeyModule()
const gnosis = gnosisModule()
const sequence = sequenceModule()
const tally = tallyModule()
const trust = trustModule()
const frontier = frontierModule()

const trezorOptions = {
Expand All @@ -65,6 +66,7 @@ const wallets = [
keepkey,
sequence,
injected,
trust,
frontier,
tally,
ledger,
Expand Down Expand Up @@ -233,4 +235,3 @@ export default function ConnectWallet() {
)
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import web3authModule from '@web3-onboard/web3auth'
import dcentModule from '@web3-onboard/dcent'
import sequenceModule from '@web3-onboard/sequence'
import tallyHoModule from '@web3-onboard/tallyho'
import trustModule from '@web3-onboard/trust'
import frontierModule from '@web3-onboard/frontier'

const INFURA_KEY = ''
Expand All @@ -44,6 +45,7 @@ const keepkey = keepkeyModule()
const gnosis = gnosisModule()
const sequence = sequenceModule()
const tally = tallyModule()
const trust = trustModule()
const frontier = frontierModule()

const trezorOptions = {
Expand All @@ -68,6 +70,7 @@ const wallets = [
ledger,
coinbase,
dcent,
trust,
frontier,
trezor,
walletConnect,
Expand Down
4 changes: 4 additions & 0 deletions docs/src/lib/services/onboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const intiOnboard = async (theme) => {
const { default: torusModule } = await import('@web3-onboard/torus')
const { default: web3authModule } = await import('@web3-onboard/web3auth')
const { default: uauthModule } = await import('@web3-onboard/uauth')
const { default: trustModule } = await import('@web3-onboard/trust')
const INFURA_ID = '8b60d52405694345a99bcb82e722e0af'

const injected = injectedModule()
Expand All @@ -65,6 +66,7 @@ const intiOnboard = async (theme) => {
const mewWallet = mewWalletModule()
const tally = tallyModule()
const torus = torusModule()
const trust = trustModule()

const portis = portisModule({
apiKey: 'b2b7586f-2b1e-4c30-a7fb-c2d1533b153b'
Expand All @@ -91,6 +93,7 @@ const intiOnboard = async (theme) => {
scope: 'openid wallet email:optional humanity_check:optional profile:optional social:optional'
}
const uauth = uauthModule(uauthOptions)

const magic = magicModule({
apiKey: 'pk_live_02207D744E81C2BA'
})
Expand All @@ -102,6 +105,7 @@ const intiOnboard = async (theme) => {
coinbase,
ledger,
trezor,
trust,
gnosis,
uauth,
tally,
Expand Down
20 changes: 11 additions & 9 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
This is the core package that contains all of the UI and logic to be able to seamlessly connect user's wallets to your app and track the state of those wallets. Onboard no longer contains any wallet specific code, so wallets need to be passed in upon initialization.

## Quick start

Checkout our full library of quick start examples for connecting and interacting with EVM based wallets

- **[React](https://github.com/blocknative/react-demo)**
Expand All @@ -26,12 +27,12 @@ Install the core module:

If you would like to support all wallets, then you can install all of the wallet modules:

```bash
npm i @web3-onboard/coinbase @web3-onboard/fortmatic @web3-onboard/gnosis
@web3-onboard/injected-wallets @web3-onboard/keepkey @web3-onboard/keystone
@web3-onboard/ledger @web3-onboard/magic @web3-onboard/portis @web3-onboard/torus
@web3-onboard/trezor @web3-onboard/walletconnect @web3-onboard/web3auth
@web3-onboard/dcent @web3-onboard/sequence @web3-onboard/enkrypt
```bash
npm i @web3-onboard/coinbase @web3-onboard/fortmatic @web3-onboard/gnosis @web3-onboard/trust
@web3-onboard/injected-wallets @web3-onboard/keepkey @web3-onboard/keystone
@web3-onboard/ledger @web3-onboard/magic @web3-onboard/portis @web3-onboard/torus
@web3-onboard/trezor @web3-onboard/walletconnect @web3-onboard/web3auth
@web3-onboard/dcent @web3-onboard/sequence @web3-onboard/enkrypt
@web3-onboard/mew-wallet @web3-onboard/uauth @web3-onboard/zeal @web3-onboard/frontier
```

Expand Down Expand Up @@ -139,9 +140,10 @@ type ConnectModalOptions = {

**`theme`**
A string or an object that defines the color theme web3-onboard will render the components.
Define a custom or predefined theme for Web3Onboard using either:
* BuiltInThemes: ['default', 'dark', 'light', 'system']
* ThemingMap object to create a totally custom theme
Define a custom or predefined theme for Web3Onboard using either:

- BuiltInThemes: ['default', 'dark', 'light', 'system']
- ThemingMap object to create a totally custom theme

Note: `system` will default to the theme set by the users system.

Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@web3-onboard/keepkey": "^2.3.3",
"@web3-onboard/keystone": "^2.3.3",
"@web3-onboard/ledger": "^2.4.2",
"@web3-onboard/injected-wallets": "^2.6.2-alpha.1",
"@web3-onboard/injected-wallets": "^2.6.2-alpha.2",
"@web3-onboard/magic": "^2.1.3",
"@web3-onboard/phantom": "^2.0.0-alpha.1",
"@web3-onboard/portis": "^2.1.3",
Expand Down
3 changes: 3 additions & 0 deletions packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import mewWalletModule from '@web3-onboard/mew-wallet'
import uauthModule from '@web3-onboard/uauth'
import phantomModule from '@web3-onboard/phantom'
import trustModule from '@web3-onboard/trust'
import frontierModule from '@web3-onboard/frontier'
import {
recoverAddress,
Expand Down Expand Up @@ -125,6 +126,7 @@
const tallyho = tallyHoModule()
const zeal = zealModule()
const phantom = phantomModule()
const trust = trustModule()
const frontier = frontierModule()

const trezorOptions = {
Expand Down Expand Up @@ -163,6 +165,7 @@
ledger,
trezor,
walletConnect,
trust,
enkrypt,
mewWallet,
keepkey,
Expand Down
2 changes: 1 addition & 1 deletion packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/injected-wallets",
"version": "2.6.2-alpha.1",
"version": "2.6.2-alpha.2",
"description": "Injected wallet module for connecting browser extension and mobile wallets 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",
Expand Down
1 change: 1 addition & 0 deletions packages/injected/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const WALLET_NAMES: { [key: string]: string } = {
sequence: 'Sequence',
core: 'Core',
enkrypt: 'Enkrypt',
trust: 'Trust Wallet',
frontier: 'Frontier',
zerion: 'Zerion',
rainbow: 'Rainbow'
Expand Down
21 changes: 15 additions & 6 deletions packages/injected/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ export const isWalletAvailable = (
checkProviderIdentity: InjectedWalletModule['checkProviderIdentity'],
device: Device
): boolean => {
if (provider && provider.providers && Array.isArray(provider.providers)) {
return !!provider.providers.filter(provider =>
checkProviderIdentity({ provider, device })
).length
} else {
return checkProviderIdentity({ provider, device })
// No injected providers exist.
if (!provider) {
return false
}

// Many injected providers add their own object into window.
if (checkProviderIdentity({ provider, device })) {
return true
}

// For multiple injected providers, check providers array
// example coinbase inj wallet pushes over-ridden wallets
// into a providers array at window.ethereum
return !!provider.providers?.some(provider =>
checkProviderIdentity({ provider, device })
)
}
6 changes: 4 additions & 2 deletions packages/injected/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ export enum InjectedNameSpace {
Bitski = 'Bitski',
Enkrypt = 'enkrypt',
Zeal = 'zeal',
Frontier = 'frontier',
Phantom = 'phantom'
Phantom = 'phantom',
Trust = 'trustwallet',
Frontier = 'frontier'
}

export interface CustomWindow extends Window {
Expand Down Expand Up @@ -160,6 +161,7 @@ export interface CustomWindow extends Window {
phantom: {
ethereum: InjectedProvider
}
trustwallet: InjectedProvider
}

export type InjectedProvider = ExternalProvider &
Expand Down
35 changes: 22 additions & 13 deletions packages/injected/src/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,30 @@ const detected: InjectedWalletModule = {

const trust: InjectedWalletModule = {
label: ProviderLabel.Trust,
injectedNamespace: InjectedNameSpace.Ethereum,
injectedNamespace: InjectedNameSpace.Trust,
checkProviderIdentity: ({ provider }) =>
!!provider &&
!!provider[ProviderIdentityFlag.Trust] &&
!!provider &&
!provider[ProviderIdentityFlag.TokenPocket],

!!provider && !!provider[ProviderIdentityFlag.Trust],
getIcon: async () => (await import('./icons/trust.js')).default,
getInterface: async () => ({
provider: createEIP1193Provider(window.ethereum, {
wallet_switchEthereumChain: UNSUPPORTED_METHOD,
eth_selectAccounts: UNSUPPORTED_METHOD
})
}),
platforms: ['mobile']
getInterface: async () => {
const ethereumInjectionExists = window.hasOwnProperty(
InjectedNameSpace.Ethereum
)

let provider: EIP1193Provider

// check if trust is injected into window.ethereum
if (ethereumInjectionExists && window[InjectedNameSpace.Ethereum].isTrust) {
provider = window[InjectedNameSpace.Ethereum]
} else {
// directly use the window.trustwallet injection
provider = window[InjectedNameSpace.Trust]
}

return {
provider
}
},
platforms: ['all']
}

const opera: InjectedWalletModule = {
Expand Down
Loading