@web3-onboard/coinbase
Advanced tools
Comparing version 2.3.0 to 2.4.0-alpha.1
@@ -1,10 +0,12 @@ | ||
import { WalletInit } from '@web3-onboard/common'; | ||
declare function coinbaseWallet({ darkMode, enableMobileWalletLink, reloadOnDisconnect }?: { | ||
/** @optional Use dark theme */ | ||
import type { WalletInit } from '@web3-onboard/common'; | ||
declare function coinbaseWallet({ supportedWalletType, darkMode, enableMobileWalletLink, reloadOnDisconnect }?: { | ||
/** @deprecated Deprecated after version 2.2.7 of @web3-onboard/coinbase Use dark theme */ | ||
darkMode?: boolean; | ||
/** @optional whether to connect mobile web app via WalletLink, defaults to false */ | ||
/** @deprecated Deprecated after version 2.2.7 of @web3-onboard/coinbase whether to connect mobile web app via WalletLink, defaults to false */ | ||
enableMobileWalletLink?: boolean; | ||
/** @optional whether or not to reload dapp automatically after disconnect, defaults to true */ | ||
/** @deprecated Deprecated after version 2.2.7 of @web3-onboard/coinbase whether or not to reload dapp automatically after disconnect, defaults to true */ | ||
reloadOnDisconnect?: boolean; | ||
/** Type of Coinbase wallets to support - options : 'all' | 'smartWalletOnly' | 'eoaOnly' - Default to `all` */ | ||
supportedWalletType?: 'all' | 'smartWalletOnly' | 'eoaOnly'; | ||
}): WalletInit; | ||
export default coinbaseWallet; |
@@ -1,2 +0,2 @@ | ||
function coinbaseWallet({ darkMode = false, enableMobileWalletLink = false, reloadOnDisconnect = true } = {}) { | ||
function coinbaseWallet({ supportedWalletType = 'all', darkMode = false, enableMobileWalletLink = false, reloadOnDisconnect = true } = {}) { | ||
return () => { | ||
@@ -7,3 +7,5 @@ return { | ||
getInterface: async ({ chains, appMetadata }) => { | ||
const [chain] = chains; | ||
if (enableMobileWalletLink || reloadOnDisconnect || darkMode) { | ||
console.warn('darkMode, enableMobileWalletLink and reloadOnDisconnect init props are deprecated after version 2.2.7 of @web3-onboard/coinbase'); | ||
} | ||
const { name, icon } = appMetadata || {}; | ||
@@ -17,18 +19,29 @@ // according to https://github.com/wagmi-dev/wagmi/issues/383 | ||
: CoinbaseWalletSDK); | ||
const { isHex, toHex, createEIP1193Provider, fromHex } = await import('@web3-onboard/common'); | ||
const base64 = window.btoa(icon || ''); | ||
const appLogoUrl = `data:image/svg+xml;base64,${base64}`; | ||
const appChainIds = chains.map(({ id }) => fromHex(id, 'number')); | ||
const instance = new CoinbaseWalletSDKConstructor({ | ||
appName: name || '', | ||
appLogoUrl, | ||
darkMode, | ||
enableMobileWalletLink, | ||
reloadOnDisconnect | ||
appChainIds | ||
}); | ||
const coinbaseWalletProvider = instance.makeWeb3Provider(chain.rpcUrl, parseInt(chain.id)); | ||
const coinbaseWalletProvider = instance.makeWeb3Provider({ | ||
options: supportedWalletType | ||
}); | ||
// patch the chainChanged event | ||
const on = coinbaseWalletProvider.on.bind(coinbaseWalletProvider); | ||
coinbaseWalletProvider.on = (event, listener) => { | ||
// @ts-ignore | ||
on(event, val => { | ||
if (event === 'chainChanged') { | ||
listener(`0x${val.toString(16)}`); | ||
let hexVal; | ||
if (isHex(val)) { | ||
hexVal = val; | ||
} | ||
else { | ||
hexVal = toHex(val); | ||
} | ||
// @ts-ignore | ||
listener(hexVal); | ||
return; | ||
@@ -40,4 +53,6 @@ } | ||
}; | ||
const provider = createEIP1193Provider(coinbaseWalletProvider); | ||
provider.removeListener = (event, func) => { }; | ||
return { | ||
provider: coinbaseWalletProvider, | ||
provider, | ||
instance | ||
@@ -44,0 +59,0 @@ }; |
{ | ||
"name": "@web3-onboard/coinbase", | ||
"version": "2.3.0", | ||
"version": "2.4.0-alpha.1", | ||
"description": "Coinbase 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.", | ||
@@ -34,3 +34,4 @@ "keywords": [ | ||
"Crypto", | ||
"Crypto Wallet" | ||
"Crypto Wallet", | ||
"Smart Wallet" | ||
], | ||
@@ -62,5 +63,5 @@ "repository": { | ||
"dependencies": { | ||
"@coinbase/wallet-sdk": "3.9.2", | ||
"@web3-onboard/common": "^2.4.0" | ||
"@coinbase/wallet-sdk": "4.0.3", | ||
"@web3-onboard/common": "^2.4.1-alpha.1" | ||
} | ||
} |
# @web3-onboard/coinbase | ||
## Wallet module for connecting Coinbase Wallet SDK to web3-onboard | ||
See [Coinbase Wallet Developer Docs](https://docs.cloud.coinbase.com/wallet-sdk/docs) | ||
@@ -14,11 +15,17 @@ | ||
type CoinbaseWalletOptions = { | ||
/** @optional Use dark theme */ | ||
/** @deprecated Deprecated after version 2.2.7 of @web3-onboard/coinbase Use dark theme */ | ||
darkMode?: boolean | ||
/** @optional whether to connect mobile web app via WalletLink, defaults to false */ | ||
/** @deprecated Deprecated after version 2.2.7 of @web3-onboard/coinbase whether to connect mobile web app via WalletLink, defaults to false */ | ||
enableMobileWalletLink?: boolean | ||
/** @optional whether or not to reload dapp automatically after disconnect, defaults to true */ | ||
/** @deprecated Deprecated after version 2.2.7 of @web3-onboard/coinbase whether or not to reload dapp automatically after disconnect, defaults to true */ | ||
reloadOnDisconnect?: boolean | ||
/** Type of Coinbase wallets to support - options : 'all' | 'smartWalletOnly' | 'eoaOnly' - Default to `all` */ | ||
supportedWalletType?: 'all' | 'smartWalletOnly' | 'eoaOnly' | ||
} | ||
``` | ||
## Smart Wallet | ||
Starting at `@web3-onboard/coinbase` version 2.3.0 smart wallet support has been added. A smart wallet lives in your browser, no extensions or app installs needed. Use passkeys for signing, with enterprise-grade security without complex seed phrases. One wallet, one address, works universally across major L2s and onchain apps. [More info on Coinbase smart wallets](https://www.coinbase.com/wallet/smart-wallet). | ||
## Usage | ||
@@ -31,3 +38,3 @@ | ||
// initialize the module with options | ||
const coinbaseWalletSdk = coinbaseWalletModule({ darkMode: true }) | ||
const coinbaseWalletSdk = coinbaseWalletModule() | ||
@@ -34,0 +41,0 @@ // can also initialize with no options... |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9179
84
53
1
+ Added@coinbase/wallet-sdk@4.0.3(transitive)
- Removed@coinbase/wallet-sdk@3.9.2(transitive)
- Removed@ethereumjs/common@3.2.0(transitive)
- Removed@ethereumjs/rlp@4.0.1(transitive)
- Removed@ethereumjs/tx@4.2.0(transitive)
- Removed@ethereumjs/util@8.1.0(transitive)
- Removed@metamask/eth-json-rpc-provider@1.0.1(transitive)
- Removed@metamask/json-rpc-engine@7.3.3(transitive)
- Removed@metamask/rpc-errors@6.3.1(transitive)
- Removed@metamask/safe-event-emitter@2.0.03.1.1(transitive)
- Removed@metamask/superstruct@3.1.0(transitive)
- Removed@metamask/utils@5.0.28.5.09.2.1(transitive)
- Removed@noble/curves@1.4.2(transitive)
- Removed@noble/hashes@1.4.01.5.0(transitive)
- Removed@scure/bip32@1.4.0(transitive)
- Removed@scure/bip39@1.3.0(transitive)
- Removed@types/debug@4.1.12(transitive)
- Removed@types/ms@0.7.34(transitive)
- Removedasync-mutex@0.2.6(transitive)
- Removedbn.js@5.2.1(transitive)
- Removedcrc-32@1.2.2(transitive)
- Removeddebug@4.3.7(transitive)
- Removedeth-block-tracker@7.1.0(transitive)
- Removedeth-json-rpc-filters@6.0.1(transitive)
- Removedeth-query@2.1.2(transitive)
- Removedeth-rpc-errors@4.0.3(transitive)
- Removedethereum-cryptography@2.2.1(transitive)
- Removedfast-safe-stringify@2.1.1(transitive)
- Removedjson-rpc-engine@6.1.0(transitive)
- Removedjson-rpc-random-id@1.0.1(transitive)
- Removedmicro-ftch@0.3.1(transitive)
- Removedms@2.1.3(transitive)
- Removedpify@3.0.05.0.0(transitive)
- Removedpony-cause@2.1.11(transitive)
- Removedsemver@7.6.3(transitive)
- Removedsuperstruct@1.0.4(transitive)
- Removedtslib@2.7.0(transitive)
- Removeduuid@9.0.1(transitive)
- Removedxtend@4.0.2(transitive)
Updated@coinbase/wallet-sdk@4.0.3