File tree 10 files changed +175
-2
lines changed
10 files changed +175
-2
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,12 @@ jobs:
191
191
working_directory : ~/web3-onboard-monorepo/packages/magic
192
192
steps :
193
193
- node-build-steps
194
+ build-coinbase :
195
+ docker :
196
+ - image : cimg/node:16.13.1
197
+ working_directory : ~/web3-onboard-monorepo/packages/coinbase
198
+ steps :
199
+ - node-build-steps
194
200
195
201
workflows :
196
202
version : 2
@@ -259,3 +265,7 @@ workflows:
259
265
jobs :
260
266
- build-magic :
261
267
<< : *deploy_production_filters
268
+ coinbase :
269
+ jobs :
270
+ - build-coinbase :
271
+ << : *deploy_production_filters
Original file line number Diff line number Diff line change
1
+ # @web3-onboard/coinbase
2
+
3
+ ## Wallet module for connecting Coinbase Wallet SDK to web3-onboard
4
+ See [ Coinbase Wallet Developer Docs] ( https://docs.cloud.coinbase.com/wallet-sdk/docs )
5
+
6
+ ### Install
7
+
8
+ ` npm i @web3-onboard/coinbase `
9
+
10
+ ## Options
11
+
12
+ ``` typescript
13
+ type CoinbaseWalletOptions = {
14
+ darkMode: boolean // default = false
15
+ }
16
+ ` ` `
17
+
18
+ ## Usage
19
+
20
+ ` ` ` typescript
21
+ import Onboard from ' @web3-onboard/core'
22
+ import coinbaseWalletModule from ' @web3-onboard/coinbase'
23
+
24
+ // initialize the module with options
25
+ const coinbaseWalletSdk = coinbaseWalletModule ({ darkMode: true })
26
+
27
+ // can also initialize with no options...
28
+ // const coinbaseWalletSdk = coinbaseWalletSdk()
29
+
30
+ const onboard = Onboard ({
31
+ // ... other Onboard options
32
+ wallets: [
33
+ coinbaseWalletSdk
34
+ // ... other wallets
35
+ ]
36
+ })
37
+
38
+ const connectedWallets = await onboard .connectWallet ()
39
+ console .log (connectedWallets )
40
+ ```
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " @web3-onboard/coinbase" ,
3
+ "version" : " 2.0.0" ,
4
+ "description" : " Coinbase Wallet module for web3-onboard" ,
5
+ "module" : " dist/index.js" ,
6
+ "browser" : " dist/index.js" ,
7
+ "main" : " dist/index.js" ,
8
+ "type" : " module" ,
9
+ "typings" : " dist/index.d.ts" ,
10
+ "files" : [
11
+ " dist"
12
+ ],
13
+ "scripts" : {
14
+ "build" : " tsc" ,
15
+ "dev" : " tsc -w" ,
16
+ "type-check" : " tsc --noEmit"
17
+ },
18
+ "license" : " MIT" ,
19
+ "devDependencies" : {
20
+ "typescript" : " ^4.5.5"
21
+ },
22
+ "dependencies" : {
23
+ "@web3-onboard/common" : " ^2.0.0" ,
24
+ "@coinbase/wallet-sdk" : " ^3.0.5"
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ export default `
2
+ <svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M20 40C31.0457 40 40 31.0457 40 20C40 8.9543 31.0457 0 20 0C8.9543 0 0 8.9543 0 20C0 31.0457 8.9543 40 20 40Z" fill="#1652F0"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.45508 20.0006C5.45508 28.0338 11.9673 34.546 20.0006 34.546C28.0338 34.546 34.546 28.0338 34.546 20.0006C34.546 11.9673 28.0338 5.45508 20.0006 5.45508C11.9673 5.45508 5.45508 11.9673 5.45508 20.0006ZM17.3137 15.3145C16.2091 15.3145 15.3137 16.2099 15.3137 17.3145V22.6882C15.3137 23.7928 16.2091 24.6882 17.3137 24.6882H22.6874C23.792 24.6882 24.6874 23.7928 24.6874 22.6882V17.3145C24.6874 16.2099 23.792 15.3145 22.6874 15.3145H17.3137Z" fill="white"/>
5
+ </svg>
6
+ `
Original file line number Diff line number Diff line change
1
+ import { WalletInit } from '@web3-onboard/common'
2
+
3
+ function coinbaseWallet ( options ?: { darkMode ?: boolean } ) : WalletInit {
4
+ const { darkMode = false } = options || { }
5
+
6
+ return ( ) => {
7
+ return {
8
+ label : 'Coinbase' ,
9
+ getIcon : async ( ) => ( await import ( './icon.js' ) ) . default ,
10
+ getInterface : async ( { chains, appMetadata } ) => {
11
+ const [ chain ] = chains
12
+ const { name, icon } = appMetadata || { }
13
+
14
+ const { CoinbaseWalletSDK } = await import ( '@coinbase/wallet-sdk' )
15
+
16
+ const base64 = window . btoa ( icon || '' )
17
+ const appLogoUrl = `data:image/svg+xml;base64,${ base64 } `
18
+
19
+ const instance = new CoinbaseWalletSDK ( {
20
+ appName : name || '' ,
21
+ appLogoUrl,
22
+ darkMode
23
+ } )
24
+
25
+ const coinbaseWalletProvider = instance . makeWeb3Provider (
26
+ chain . rpcUrl ,
27
+ parseInt ( chain . id )
28
+ )
29
+
30
+ // patch the chainChanged event
31
+ const on = coinbaseWalletProvider . on . bind ( coinbaseWalletProvider )
32
+ coinbaseWalletProvider . on = ( event , listener ) => {
33
+ on ( event , val => {
34
+ if ( event === 'chainChanged' ) {
35
+ listener ( `0x${ ( val as number ) . toString ( 16 ) } ` )
36
+ return
37
+ }
38
+
39
+ listener ( val )
40
+ } )
41
+
42
+ return coinbaseWalletProvider
43
+ }
44
+
45
+ return {
46
+ provider : coinbaseWalletProvider ,
47
+ instance
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ export default coinbaseWallet
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " ../../tsconfig.json" ,
3
+ "include" : [" src/**/*" ],
4
+
5
+ "compilerOptions" : {
6
+ "outDir" : " dist" ,
7
+ "rootDir" : " src" ,
8
+ "declarationDir" : " dist" ,
9
+ "paths" : {
10
+ "*" : [" ./src/*" , " ./node_modules/*" ]
11
+ },
12
+ "typeRoots" : [" node_modules/@types" ],
13
+ }
14
+ }
Original file line number Diff line number Diff line change 1
1
# @web3-onboard/walletlink
2
2
3
- ## Wallet module for connecting WalletLink to web3-onboard
3
+ ## (Deprecated) Wallet module for connecting WalletLink to web3-onboard
4
+ _ Use [ @web3-onboard/coinbase-wallet-sdk ] ( ../coinbase/README.md ) _
4
5
5
6
### Install
6
7
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @web3-onboard/walletlink" ,
3
- "version" : " 2.0.0 " ,
3
+ "version" : " 2.0.1 " ,
4
4
"description" : " WalletLink module for web3-onboard" ,
5
5
"module" : " dist/index.js" ,
6
6
"browser" : " dist/index.js" ,
Original file line number Diff line number Diff line change @@ -51,4 +51,7 @@ function walletLink(options?: { darkMode?: boolean }): WalletInit {
51
51
}
52
52
}
53
53
54
+ /**
55
+ * @deprecated Use @web3-onboard/coinbase
56
+ */
54
57
export default walletLink
Original file line number Diff line number Diff line change 191
191
" @babel/helper-validator-identifier" " ^7.16.7"
192
192
to-fast-properties "^2.0.0"
193
193
194
+ " @coinbase/wallet-sdk@^3.0.5 " :
195
+ version "3.0.5"
196
+ resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.0.5.tgz#d9eb49b482570e93ef9fd0bfe15c5582e28b3063"
197
+ integrity sha512-MsPhgS9b9DpNQdbuYEFDZToPVhh8OQZFkLH59LpYHXRxRIjQDsGGjXcLC50jfW06ElBbtB9adl5RlJTmXb9KbA==
198
+ dependencies :
199
+ " @metamask/safe-event-emitter" " 2.0.0"
200
+ bind-decorator "^1.0.11"
201
+ bn.js "^5.1.1"
202
+ clsx "^1.1.0"
203
+ eth-block-tracker "4.4.3"
204
+ eth-json-rpc-filters "4.2.2"
205
+ eth-rpc-errors "4.0.2"
206
+ js-sha256 "0.9.0"
207
+ json-rpc-engine "6.1.0"
208
+ keccak "^3.0.1"
209
+ preact "^10.5.9"
210
+ rxjs "^6.6.3"
211
+ stream-browserify "^3.0.0"
212
+
194
213
" @cspotcode/source-map-consumer@0.8.0 " :
195
214
version "0.8.0"
196
215
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b"
You can’t perform that action at this time.
0 commit comments