Skip to content

Commit 6efd361

Browse files
author
duxiaofeng
authored
[BUG] fix coinbase default entry (#1371)
* fix coinbase default entry * fix typing error and bump the package version
1 parent 8da1439 commit 6efd361

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/coinbase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/coinbase",
3-
"version": "2.1.3",
3+
"version": "2.1.4-alpha.1",
44
"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.",
55
"keywords": [
66
"Ethereum",

packages/coinbase/src/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,22 @@ function coinbaseWallet({
1313
const [chain] = chains
1414
const { name, icon } = appMetadata || {}
1515

16-
const { CoinbaseWalletSDK } = await import('@coinbase/wallet-sdk')
16+
// according to https://github.com/wagmi-dev/wagmi/issues/383
17+
// @coinbase/wallet-sdk export double default fields
18+
// so we need to detect it to get the real constructor
19+
const { default: CoinbaseWalletSDK } = await import(
20+
'@coinbase/wallet-sdk'
21+
)
22+
const CoinbaseWalletSDKConstructor = (
23+
(CoinbaseWalletSDK as any).default
24+
? (CoinbaseWalletSDK as any).default
25+
: CoinbaseWalletSDK
26+
) as typeof CoinbaseWalletSDK
1727

1828
const base64 = window.btoa(icon || '')
1929
const appLogoUrl = `data:image/svg+xml;base64,${base64}`
2030

21-
const instance = new CoinbaseWalletSDK({
31+
const instance = new CoinbaseWalletSDKConstructor({
2232
appName: name || '',
2333
appLogoUrl,
2434
darkMode

0 commit comments

Comments
 (0)