Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
"@web3-onboard/taho": "^2.0.5",
"@web3-onboard/torus": "^2.2.5",
"@web3-onboard/transaction-preview": "^2.0.8",
"@web3-onboard/trezor": "^2.4.2",
"@web3-onboard/trezor": "^2.4.3",
"@web3-onboard/trust": "^2.0.4",
"@web3-onboard/uauth": "^2.1.1",
"@web3-onboard/venly": "^2.0.0",
"@web3-onboard/walletconnect": "^2.4.6-alpha.1",
"@web3-onboard/walletconnect": "^2.4.6",
"@web3-onboard/web3auth": "^2.2.3",
"@web3-onboard/xdefi": "^2.0.4",
"@web3-onboard/zeal": "^2.0.4",
Expand Down
63 changes: 26 additions & 37 deletions docs/src/routes/docs/[...4]wallets/[...26]walletconnect/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ npm install @web3-onboard/walletconnect
</TabPanel>
</Tabs>

## Options

```typescript
type WalletConnectOptions = {
Expand All @@ -38,26 +37,6 @@ type WalletConnectOptions = {
*/
handleUri?: (uri: string) => Promise<unknown>
} & (
| {
/**
* @deprecated
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
* To use version 1 a custom bridge url will need to be provided.
* Support will be completely remove from Web3-Onboard in the future
*/
version: 1
/**
* Custom URL Bridge must be defined for V1 usage.
* WalletConnect no longer supports a v1 bridge.
* Upgrading to use WalletConnect v2 is recommended.
* A potential bridge can be found here: 'https://derelay.rabby.io'
*/
bridge: string
connectFirstChainId?: boolean
qrcodeModalOptions?: {
mobileLinks: string[]
}
}
| {
/**
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
Expand Down Expand Up @@ -98,6 +77,26 @@ type WalletConnectOptions = {
*/
additionalOptionalMethods?: string[] | undefined
}
| {
/**
* @deprecated
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
* To use version 1 a custom bridge url will need to be provided.
* Support will be completely remove from Web3-Onboard in the future
*/
version: 1
/**
* Custom URL Bridge must be defined for V1 usage.
* WalletConnect no longer supports a v1 bridge.
* Upgrading to use WalletConnect v2 is recommended.
* A potential bridge can be found here: 'https://derelay.rabby.io'
*/
bridge: string
connectFirstChainId?: boolean
qrcodeModalOptions?: {
mobileLinks: string[]
}
}
)
```

Expand Down Expand Up @@ -137,26 +136,16 @@ const onboard = Onboard({
wallets: [
walletConnect
//... other wallets
],
chains: [
// chains that are passed as optional chains to WC wallet after cleaning and parsing as number[]
{
id: '0x2105',
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
},
{
id: '0x89',
token: 'MATIC',
label: 'Polygon',
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
}
// ...
]
})

const connectedWallets = await onboard.connectWallet()

// Assuming only wallet connect is connected, index 0
// `instance` will give insight into the WalletConnect info
// such as namespaces, methods, chains, etc per wallet connected
const { instance } = connectedWallets[0]

console.log(connectedWallets)
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web3-onboard-monorepo",
"version": "2.24.8",
"version": "2.24.9",
"private": true,
"workspaces": {
"packages": [
Expand Down
6 changes: 3 additions & 3 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
"@web3-onboard/taho": "^2.0.5",
"@web3-onboard/torus": "^2.2.4",
"@web3-onboard/transaction-preview": "^2.0.7",
"@web3-onboard/trezor": "^2.4.2",
"@web3-onboard/trezor": "^2.4.3",
"@web3-onboard/trust": "^2.0.3",
"@web3-onboard/uauth": "^2.1.2",
"@web3-onboard/venly": "^2.0.0",
"@web3-onboard/walletconnect": "^2.4.6-alpha.1",
"@web3-onboard/walletconnect": "^2.4.6",
"@web3-onboard/web3auth": "^2.2.2",
"@web3-onboard/xdefi": "^2.0.5-alpha.1",
"@web3-onboard/xdefi": "^2.0.5",
"@web3-onboard/zeal": "^2.0.3",
"vconsole": "^3.15.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
const walletConnect = walletConnectModule({
handleUri: uri => console.log(uri),
projectId: 'f6bd6e2911b56f5ac3bc8b2d0e2d7ad5',
additionalOptionalMethods: ['someSillyShit']
dappUrl: 'https://www.onboard.blocknative.com'
})
const portis = portisModule({
apiKey: 'b2b7586f-2b1e-4c30-a7fb-c2d1533b153b'
Expand Down
2 changes: 1 addition & 1 deletion packages/trezor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/trezor",
"version": "2.4.3-alpha.1",
"version": "2.4.3",
"description": "Trezor hardware 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",
Expand Down
46 changes: 26 additions & 20 deletions packages/walletconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,6 @@ type WalletConnectOptions = {
*/
handleUri?: (uri: string) => Promise<unknown>
} & (
| {
/**
* @deprecated
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
* To use version 1 a custom bridge url will need to be provided.
* Support will be completely remove from Web3-Onboard in the future
*/
version: 1
/**
* Custom URL Bridge must be defined for V1 usage.
* WalletConnect no longer supports a v1 bridge.
* Upgrading to use WalletConnect v2 is recommended.
* A potential bridge can be found here: 'https://derelay.rabby.io'
*/
bridge: string
connectFirstChainId?: boolean
qrcodeModalOptions?: {
mobileLinks: string[]
}
}
| {
/**
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
Expand Down Expand Up @@ -79,6 +59,26 @@ type WalletConnectOptions = {
*/
additionalOptionalMethods?: string[] | undefined
}
| {
/**
* @deprecated
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
* To use version 1 a custom bridge url will need to be provided.
* Support will be completely remove from Web3-Onboard in the future
*/
version: 1
/**
* Custom URL Bridge must be defined for V1 usage.
* WalletConnect no longer supports a v1 bridge.
* Upgrading to use WalletConnect v2 is recommended.
* A potential bridge can be found here: 'https://derelay.rabby.io'
*/
bridge: string
connectFirstChainId?: boolean
qrcodeModalOptions?: {
mobileLinks: string[]
}
}
)
```

Expand Down Expand Up @@ -122,5 +122,11 @@ const onboard = Onboard({
})

const connectedWallets = await onboard.connectWallet()

// Assuming only wallet connect is connected, index 0
// `instance` will give insight into the WalletConnect info
// such as namespaces, methods, chains, etc per wallet connected
const { instance } = connectedWallets[0]

console.log(connectedWallets)
```
2 changes: 1 addition & 1 deletion packages/walletconnect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/walletconnect",
"version": "2.4.6-alpha.1",
"version": "2.4.6",
"description": "WalletConnect SDK 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",
Expand Down
12 changes: 10 additions & 2 deletions packages/walletconnect/src/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
dappUrl
} = options

let instance: unknown

return () => {
return {
label: 'WalletConnect',
Expand Down Expand Up @@ -209,7 +211,10 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
})

this.disconnect = () => {
if (this.connector.session) this.connector.disconnect()
if (this.connector.session) {
this.connector.disconnect()
instance = null
}
}

if (options && handleUri) {
Expand All @@ -231,6 +236,7 @@ function walletConnect(options: WalletConnectOptions): WalletInit {

const checkForSession = () => {
const session = this.connector.session
instance = session
if (session) {
this.emit('accountsChanged', this.connector.accounts)
this.emit('chainChanged', this.connector.chainId)
Expand Down Expand Up @@ -286,6 +292,7 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
// update ethereum provider to load accounts & chainId
const accounts = this.connector.accounts
const chainId = this.connector.chainId
instance = this.connector.session
const hexChainId = `0x${chainId.toString(16)}`
this.emit('chainChanged', hexChainId)
return resolve(accounts)
Expand Down Expand Up @@ -337,7 +344,8 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
}

return {
provider: new EthProvider({ chains, connector })
provider: new EthProvider({ chains, connector }),
instance
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/xdefi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/xdefi",
"version": "2.0.5-alpha.1",
"version": "2.0.5",
"description": "XDEFI 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",
Expand Down
Loading