Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Ledger connector with support for WalletConnect v2 #1549

Merged
55 changes: 50 additions & 5 deletions docs/src/routes/docs/[...4]wallets/[...13]ledger/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,45 @@ npm install @web3-onboard/core @web3-onboard/ledger

```typescript
interface LedgerOptions {
chainId?: number
bridge?: string
infuraId?: string
rpc?: { [chainId: number]: string }
/**
* Enable Ledger Connect Kit logs
*/
enableDebugLogs?: boolean
/**
* Defaults to walletConnectVersion: 1 - this behavior will be deprecated after the WalletConnect v1 sunset
*/
walletConnectVersion: 2
/**
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
*/
projectId: string
/**
* List of Required Chain IDs for Ledger Live to support in number format (integer or hex)
* Defaults to [1] - Ethereum
* The chains defined within the web3-onboard config will define the
* optional chains for the WalletConnect module
*/
requiredChains?: string[] | number[]
/**
* List of Required Methods for wallets to support
*/
requiredMethods?: string[]
/**
* List of Optional Methods for wallets to support
*/
optionalMethods?: string[]
/**
* List of Required Events for wallets to support
*/
requiredEvents?: string[]
/**
* List of Optional Events for wallets to support
*/
optionalEvents?: string[]
/**
* List of Chain ID to URL mapping
*/
rpcMap?: { [chainId: number]: string }
}
```

Expand All @@ -42,7 +77,17 @@ interface LedgerOptions {
import Onboard from '@web3-onboard/core'
import ledgerModule from '@web3-onboard/ledger'

const ledger = ledgerModule()
const ledger = ledgerModule({
walletConnectVersion: 2,
/**
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
*/
projectId: 'abc123...',
/**
* Chains required to be supported by all wallets connecting to your DApp
*/
requiredChains: [1, 137]
})

const onboard = Onboard({
// ... other Onboard options
Expand Down
55 changes: 50 additions & 5 deletions packages/ledger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,45 @@

```typescript
interface LedgerOptions {
chainId?: number
bridge?: string
infuraId?: string
rpc?: { [chainId: number]: string }
/**
* Enable Ledger Connect Kit logs
*/
enableDebugLogs?: boolean
/**
* Defaults to walletConnectVersion: 1 - this behavior will be deprecated after the WalletConnect v1 sunset
*/
walletConnectVersion: 2
/**
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
*/
projectId: string
/**
* List of Required Chain IDs for Ledger Live to support in number format (integer or hex)
* Defaults to [1] - Ethereum
* The chains defined within the web3-onboard config will define the
* optional chains for the WalletConnect module
*/
requiredChains?: string[] | number[]
/**
* List of Required Methods for wallets to support
*/
requiredMethods?: string[]
/**
* List of Optional Methods for wallets to support
*/
optionalMethods?: string[]
/**
* List of Required Events for wallets to support
*/
requiredEvents?: string[]
/**
* List of Optional Events for wallets to support
*/
optionalEvents?: string[]
/**
* List of Chain ID to URL mapping
*/
rpcMap?: { [chainId: number]: string }
}
```

Expand All @@ -23,7 +58,17 @@ interface LedgerOptions {
import Onboard from '@web3-onboard/core'
import ledgerModule from '@web3-onboard/ledger'

const ledger = ledgerModule()
const ledger = ledgerModule({
walletConnectVersion: 2,
/**
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
*/
projectId: 'abc123...',
/**
* Chains required to be supported by all wallets connecting to your DApp
*/
requiredChains: [1, 137]
})

const onboard = Onboard({
// ... other Onboard options
Expand Down
8 changes: 4 additions & 4 deletions packages/ledger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/ledger",
"version": "2.4.6",
"version": "2.5.0-alpha.1",
"description": "Ledger hardare 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 Expand Up @@ -55,12 +55,12 @@
},
"license": "MIT",
"devDependencies": {
"@walletconnect/types": "^2.7.0",
"typescript": "^4.5.5"
},
"dependencies": {
"@ethersproject/providers": "^5.5.0",
"@ledgerhq/connect-kit-loader": "^1.0.2",
"@walletconnect/client": "^1.7.1",
"@ledgerhq/connect-kit-loader": "^1.1.0",
"@walletconnect/client": "^1.8.0",
"@web3-onboard/common": "^2.3.3",
"rxjs": "^7.5.2"
}
Expand Down
Loading