Skip to content

Commit 5626431

Browse files
feat: add @web3-onboard/okx (#2229)
* feat: add @web3-onboard/okx * feat(okx sdk): use createDownloadMessage * Update packages/okx/src/types.ts * Prettier --------- Co-authored-by: Adam Carpenter <adamcarpenter86@gmail.com>
1 parent 9958cfe commit 5626431

File tree

15 files changed

+260
-5
lines changed

15 files changed

+260
-5
lines changed

.circleci/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ jobs:
255255
working_directory: ~/web3-onboard-monorepo/packages/trust
256256
steps:
257257
- node-build-steps
258+
build-okx:
259+
docker:
260+
- image: cimg/node:16.13.1
261+
working_directory: ~/web3-onboard-monorepo/packages/okx
262+
steps:
263+
- node-build-steps
258264
build-frontier:
259265
docker:
260266
- image: cimg/node:16.13.1
@@ -552,6 +558,12 @@ jobs:
552558
working_directory: ~/web3-onboard-monorepo/packages/trust
553559
steps:
554560
- node-staging-build-steps
561+
build-staging-okx:
562+
docker:
563+
- image: cimg/node:16.13.1
564+
working_directory: ~/web3-onboard-monorepo/packages/okx
565+
steps:
566+
- node-staging-build-steps
555567
build-staging-frontier:
556568
docker:
557569
- image: cimg/node:16.13.1
@@ -851,6 +863,12 @@ workflows:
851863
<<: *deploy_production_filters
852864
- build-staging-trust:
853865
<<: *deploy_staging_filters
866+
okx:
867+
jobs:
868+
- build-okx:
869+
<<: *deploy_production_filters
870+
- build-staging-okx:
871+
<<: *deploy_staging_filters
854872
frontier:
855873
jobs:
856874
- build-frontier:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ For full documentation, check out the README.md for each package or the [docs pa
108108
- [Arcana](packages/arcana-auth/README.md)
109109
- [Coinbase](packages/coinbase/README.md)
110110
- [Trust](packages/trust/README.md)
111+
- [OKX](packages/okx/README.md)
111112
- [WalletConnect](packages/walletconnect/README.md)
112113
- [Safe](packages/gnosis/README.md)
113114
- [Magic](packages/magic/README.md)

docs/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"format": "prettier --plugin-search-dir . --write .",
1313
"prepare": "svelte-kit sync",
1414
"test": "playwright test",
15-
"w3o-latest-prod": "yarn add '@web3-onboard/core' '@web3-onboard/coinbase' '@web3-onboard/transaction-preview' '@web3-onboard/dcent' '@web3-onboard/frontier' '@web3-onboard/fortmatic' '@web3-onboard/frame' '@web3-onboard/gas' '@web3-onboard/gnosis' '@web3-onboard/keepkey' '@web3-onboard/keystone' '@web3-onboard/ledger' '@web3-onboard/infinity-wallet' '@web3-onboard/injected-wallets' '@web3-onboard/magic' '@web3-onboard/phantom' '@web3-onboard/portis' '@web3-onboard/sequence' '@web3-onboard/trezor' '@web3-onboard/trust' '@web3-onboard/torus' '@web3-onboard/taho' '@web3-onboard/web3auth' '@web3-onboard/walletconnect' '@web3-onboard/enkrypt' '@web3-onboard/mew-wallet' '@web3-onboard/xdefi' '@web3-onboard/uauth' '@web3-onboard/zeal' '@web3-onboard/cede-store' '@web3-onboard/blocto' '@web3-onboard/capsule' '@web3-onboard/particle-network' '@web3-onboard/metamask' '@web3-onboard/bitget' '@web3-onboard/arcana-auth' '@web3-onboard/venly'",
16-
"w3o-latest-alpha": "yarn add '@web3-onboard/core@next' '@web3-onboard/coinbase@next' '@web3-onboard/transaction-preview@next' '@web3-onboard/dcent@next' '@web3-onboard/frontier@next' '@web3-onboard/fortmatic@next' '@web3-onboard/frame@next' '@web3-onboard/gas@next' '@web3-onboard/gnosis@next' '@web3-onboard/keepkey@next' '@web3-onboard/keystone@next' '@web3-onboard/ledger@next' '@web3-onboard/infinity-wallet@next' '@web3-onboard/injected-wallets@next' '@web3-onboard/magic@next' '@web3-onboard/phantom@next' '@web3-onboard/portis@next' '@web3-onboard/sequence@next' '@web3-onboard/trezor@next' '@web3-onboard/trust@next' '@web3-onboard/torus@next' '@web3-onboard/taho@next' '@web3-onboard/web3auth@next' '@web3-onboard/walletconnect@next' '@web3-onboard/enkrypt@next' '@web3-onboard/mew-wallet@next' '@web3-onboard/xdefi@next' '@web3-onboard/uauth@next' '@web3-onboard/zeal@next' '@web3-onboard/cede-store@next' '@web3-onboard/blocto@next' '@web3-onboard/capsule@next' '@web3-onboard/metamask@next' '@web3-onboard/bitget@next' '@web3-onboard/arcana-auth@next' '@web3-onboard/venly@next' '@web3-onboard/particle-network@next'"
15+
"w3o-latest-prod": "yarn add '@web3-onboard/core' '@web3-onboard/coinbase' '@web3-onboard/transaction-preview' '@web3-onboard/dcent' '@web3-onboard/frontier' '@web3-onboard/fortmatic' '@web3-onboard/frame' '@web3-onboard/gas' '@web3-onboard/gnosis' '@web3-onboard/keepkey' '@web3-onboard/keystone' '@web3-onboard/ledger' '@web3-onboard/infinity-wallet' '@web3-onboard/injected-wallets' '@web3-onboard/magic' '@web3-onboard/phantom' '@web3-onboard/portis' '@web3-onboard/sequence' '@web3-onboard/trezor' '@web3-onboard/trust' '@web3-onboard/okx' '@web3-onboard/torus' '@web3-onboard/taho' '@web3-onboard/web3auth' '@web3-onboard/walletconnect' '@web3-onboard/enkrypt' '@web3-onboard/mew-wallet' '@web3-onboard/xdefi' '@web3-onboard/uauth' '@web3-onboard/zeal' '@web3-onboard/cede-store' '@web3-onboard/blocto' '@web3-onboard/capsule' '@web3-onboard/particle-network' '@web3-onboard/metamask' '@web3-onboard/bitget' '@web3-onboard/arcana-auth' '@web3-onboard/venly'",
16+
"w3o-latest-alpha": "yarn add '@web3-onboard/core@next' '@web3-onboard/coinbase@next' '@web3-onboard/transaction-preview@next' '@web3-onboard/dcent@next' '@web3-onboard/frontier@next' '@web3-onboard/fortmatic@next' '@web3-onboard/frame@next' '@web3-onboard/gas@next' '@web3-onboard/gnosis@next' '@web3-onboard/keepkey@next' '@web3-onboard/keystone@next' '@web3-onboard/ledger@next' '@web3-onboard/infinity-wallet@next' '@web3-onboard/injected-wallets@next' '@web3-onboard/magic@next' '@web3-onboard/phantom@next' '@web3-onboard/portis@next' '@web3-onboard/sequence@next' '@web3-onboard/trezor@next' '@web3-onboard/trust@next' '@web3-onboard/okx@next' '@web3-onboard/torus@next' '@web3-onboard/taho@next' '@web3-onboard/web3auth@next' '@web3-onboard/walletconnect@next' '@web3-onboard/enkrypt@next' '@web3-onboard/mew-wallet@next' '@web3-onboard/xdefi@next' '@web3-onboard/uauth@next' '@web3-onboard/zeal@next' '@web3-onboard/cede-store@next' '@web3-onboard/blocto@next' '@web3-onboard/capsule@next' '@web3-onboard/metamask@next' '@web3-onboard/bitget@next' '@web3-onboard/arcana-auth@next' '@web3-onboard/venly@next' '@web3-onboard/particle-network@next'"
1717
},
1818
"devDependencies": {
1919
"@algolia/client-search": "^4.17.0",
@@ -72,6 +72,7 @@
7272
"@web3-onboard/magic": "^2.2.1",
7373
"@web3-onboard/metamask": "^2.1.1",
7474
"@web3-onboard/mew-wallet": "^2.1.1",
75+
"@web3-onboard/okx": "2.0.0-alpha.1",
7576
"@web3-onboard/particle-network": "^2.1.1",
7677
"@web3-onboard/phantom": "^2.1.1",
7778
"@web3-onboard/portis": "^2.2.1",

docs/src/lib/services/onboard.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const intiOnboard = async (theme) => {
5151
const { default: torusModule } = await import('@web3-onboard/torus')
5252
const { default: uauthModule } = await import('@web3-onboard/uauth')
5353
const { default: trustModule } = await import('@web3-onboard/trust')
54+
const { default: okxModule } = await import('@web3-onboard/okx')
5455
const { default: xdefiModule } = await import('@web3-onboard/xdefi')
5556
const { default: cedeModule } = await import('@web3-onboard/cede-store')
5657
const { default: frameModule } = await import('@web3-onboard/frame')
@@ -93,6 +94,7 @@ const intiOnboard = async (theme) => {
9394
const taho = tahoModule()
9495
const torus = torusModule()
9596
const trust = trustModule()
97+
const okx = okxModule()
9698
const xdefi = xdefiModule()
9799
const cede = cedeModule()
98100
const bitget = bitgetModule()
@@ -152,6 +154,7 @@ const intiOnboard = async (theme) => {
152154
ledger,
153155
trezor,
154156
trust,
157+
okx,
155158
gnosis,
156159
taho,
157160
bitget,

docs/src/routes/docs/[...1]overview/[...1]introduction/+page.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ We recommend you add the [Core Repo](../../modules/core.md#install) and consider
193193
- [Magic](../../wallets/magic.md#login-options)
194194
- [MetaMask](../../wallets/metamask.md#install)
195195
- [MEW](../../wallets/mewwallet.md#install)
196+
- [OKX](../../wallets/okx.md#install)
196197
- [Portis](../../wallets/portis.md#install)
197198
- [Web3Auth](../../wallets/web3auth.md#install)
198199
- [WalletConnect](../../wallets/walletconnect.md#install)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: OKX Wallet
3+
---
4+
5+
# {$frontmatter.title}
6+
7+
Wallet module for connecting OKX wallet through Web3 Onboard
8+
9+
### Install
10+
11+
<Tabs values={['yarn', 'npm']}>
12+
<TabPanel value="yarn">
13+
14+
```sh copy
15+
yarn add @web3-onboard/okx
16+
```
17+
18+
</TabPanel>
19+
<TabPanel value="npm">
20+
21+
```sh copy
22+
npm install @web3-onboard/okx
23+
```
24+
25+
</TabPanel>
26+
</Tabs>
27+
28+
## Usage
29+
30+
```typescript
31+
import Onboard from '@web3-onboard/core'
32+
import okxWallet from '@web3-onboard/okx'
33+
34+
const okx = okxWallet()
35+
36+
const onboard = Onboard({
37+
// ... other Onboard options
38+
wallets: [
39+
okx
40+
//... other wallets
41+
]
42+
})
43+
44+
const connectedWallets = await onboard.connectWallet()
45+
console.log(connectedWallets)
46+
```
47+
48+
## Build Environments
49+
50+
For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments)

docs/src/routes/examples/[...1]connect-wallet/+page.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Remember- if you used create-react-app, please follow the [additional setup inst
2525
<TabPanel value="yarn">
2626

2727
```sh copy
28-
yarn add @web3-onboard/react @web3-onboard/injected-wallets @web3-onboard/infinity-wallet @web3-onboard/fortmatic @web3-onboard/gnosis @web3-onboard/keepkey @web3-onboard/keystone @web3-onboard/ledger @web3-onboard/portis @web3-onboard/trezor @web3-onboard/walletconnect @web3-onboard/coinbase @web3-onboard/magic @web3-onboard/dcent @web3-onboard/sequence @web3-onboard/taho @web3-onboard/trust @web3-onboard/frontier
28+
yarn add @web3-onboard/react @web3-onboard/injected-wallets @web3-onboard/infinity-wallet @web3-onboard/fortmatic @web3-onboard/gnosis @web3-onboard/keepkey @web3-onboard/keystone @web3-onboard/ledger @web3-onboard/portis @web3-onboard/trezor @web3-onboard/walletconnect @web3-onboard/coinbase @web3-onboard/magic @web3-onboard/dcent @web3-onboard/sequence @web3-onboard/taho @web3-onboard/trust @web3-onboard/frontier @web3-onboard/okx
2929
```
3030

3131
</TabPanel>
3232
<TabPanel value="npm">
3333

3434
```sh copy
35-
npm install @web3-onboard/react @web3-onboard/injected-wallets @web3-onboard/infinity-wallet @web3-onboard/fortmatic @web3-onboard/gnosis @web3-onboard/keepkey @web3-onboard/keystone @web3-onboard/ledger @web3-onboard/portis @web3-onboard/trezor @web3-onboard/walletconnect @web3-onboard/coinbase @web3-onboard/magic @web3-onboard/dcent @web3-onboard/sequence @web3-onboard/taho @web3-onboard/trust @web3-onboard/frontier
35+
npm install @web3-onboard/react @web3-onboard/injected-wallets @web3-onboard/infinity-wallet @web3-onboard/fortmatic @web3-onboard/gnosis @web3-onboard/keepkey @web3-onboard/keystone @web3-onboard/ledger @web3-onboard/portis @web3-onboard/trezor @web3-onboard/walletconnect @web3-onboard/coinbase @web3-onboard/magic @web3-onboard/dcent @web3-onboard/sequence @web3-onboard/taho @web3-onboard/trust @web3-onboard/frontier @web3-onboard/okx
3636
```
3737

3838
</TabPanel>
@@ -60,6 +60,7 @@ import dcentModule from '@web3-onboard/dcent'
6060
import sequenceModule from '@web3-onboard/sequence'
6161
import tahoModule from '@web3-onboard/taho'
6262
import trustModule from '@web3-onboard/trust'
63+
import okxModule from '@web3-onboard/okx'
6364
import frontierModule from '@web3-onboard/frontier'
6465
import ConnectWallet from './ConnectWallet'
6566

@@ -86,6 +87,7 @@ const safe = safeModule()
8687
const sequence = sequenceModule()
8788
const taho = tahoModule() // Previously named Tally Ho wallet
8889
const trust = trustModule()
90+
const okx = okxModule()
8991
const frontier = frontierModule()
9092

9193
const trezorOptions = {
@@ -105,6 +107,7 @@ const wallets = [
105107
sequence,
106108
injected,
107109
trust,
110+
okx,
108111
frontier,
109112
taho,
110113
ledger,
@@ -324,6 +327,7 @@ import dcentModule from '@web3-onboard/dcent'
324327
import sequenceModule from '@web3-onboard/sequence'
325328
import tahoModule from '@web3-onboard/taho'
326329
import trustModule from '@web3-onboard/trust'
330+
import okxModule from '@web3-onboard/okx'
327331
import frontierModule from '@web3-onboard/frontier'
328332

329333
const INFURA_KEY = ''
@@ -349,6 +353,7 @@ const safe = safeModule()
349353
const sequence = sequenceModule()
350354
const taho = tahoModule() // Previously named Tally Ho wallet
351355
const trust = trustModule()
356+
const okx = okxModule()
352357
const frontier = frontierModule()
353358

354359
const trezorOptions = {
@@ -375,6 +380,7 @@ const wallets = [
375380
coinbase,
376381
dcent,
377382
trust,
383+
okx,
378384
frontier,
379385
trezor,
380386
walletConnect,

packages/demo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@web3-onboard/magic": "^2.2.1",
5151
"@web3-onboard/metamask": "^2.1.1",
5252
"@web3-onboard/mew-wallet": "^2.1.1",
53+
"@web3-onboard/okx": "2.0.0-alpha.1",
5354
"@web3-onboard/particle-network": "^2.1.1",
5455
"@web3-onboard/phantom": "^2.1.1",
5556
"@web3-onboard/portis": "^2.2.1",

packages/demo/src/App.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import uauthModule from '@web3-onboard/uauth'
3030
import phantomModule from '@web3-onboard/phantom'
3131
import trustModule from '@web3-onboard/trust'
32+
import okxModule from '@web3-onboard/okx'
3233
import frontierModule from '@web3-onboard/frontier'
3334
import bloctoModule from '@web3-onboard/blocto'
3435
import cedeStoreModule from '@web3-onboard/cede-store'
@@ -100,7 +101,8 @@
100101
displayUnavailable: [
101102
ProviderLabel.MetaMask,
102103
ProviderLabel.Trust,
103-
ProviderLabel.Phantom
104+
ProviderLabel.Phantom,
105+
ProviderLabel.OKXWallet
104106
]
105107
// but only show Binance and Bitski wallet if they are available
106108
// filter: {
@@ -182,6 +184,7 @@
182184
const zeal = zealModule()
183185
const phantom = phantomModule()
184186
const trust = trustModule()
187+
const okx = okxModule()
185188
const frontier = frontierModule()
186189
const cedeStore = cedeStoreModule()
187190
const blocto = bloctoModule()
@@ -267,6 +270,7 @@
267270
phantom,
268271
safe,
269272
trust,
273+
okx,
270274
tallyho,
271275
bitget,
272276
enkrypt,

packages/okx/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# @web3-onboard/okx
2+
3+
## Wallet module for connecting OKX Wallet through web3-onboard
4+
5+
OKX Wallet SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized 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.
6+
7+
### Install
8+
9+
**NPM**
10+
`npm i @web3-onboard/core @web3-onboard/okx`
11+
12+
**Yarn**
13+
`yarn add @web3-onboard/core @web3-onboard/okx`
14+
15+
## Usage
16+
17+
```typescript
18+
import Onboard from '@web3-onboard/core'
19+
import okxModule from '@web3-onboard/okx'
20+
21+
const okx = okxModule()
22+
23+
const onboard = Onboard({
24+
// ... other Onboard options
25+
wallets: [
26+
okx
27+
//... other wallets
28+
]
29+
})
30+
31+
const connectedWallets = await onboard.connectWallet()
32+
console.log(connectedWallets)
33+
```

packages/okx/package.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "@web3-onboard/okx",
3+
"version": "2.0.0-alpha.1",
4+
"description": "OKX Wallet SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized 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.",
5+
"keywords": [
6+
"Ethereum",
7+
"Web3",
8+
"EVM",
9+
"dapp",
10+
"Multichain",
11+
"Wallet",
12+
"Transaction",
13+
"Provider",
14+
"Hardware Wallet",
15+
"Notifications",
16+
"React",
17+
"Svelte",
18+
"Vue",
19+
"Next",
20+
"Nuxt",
21+
"MetaMask",
22+
"Coinbase",
23+
"WalletConnect",
24+
"Ledger",
25+
"Trezor",
26+
"Connect Wallet",
27+
"Ethereum Hooks",
28+
"Blocknative",
29+
"Mempool",
30+
"pending",
31+
"confirmed",
32+
"Injected Wallet",
33+
"Crypto",
34+
"Crypto Wallet",
35+
"Enkrypt",
36+
"OKX"
37+
],
38+
"repository": {
39+
"type": "git",
40+
"url": "https://github.com/blocknative/web3-onboard.git",
41+
"directory": "packages/okx"
42+
},
43+
"homepage": "https://www.blocknative.com/onboard",
44+
"bugs": "https://github.com/blocknative/web3-onboard/issues",
45+
"module": "dist/index.js",
46+
"browser": "dist/index.js",
47+
"main": "dist/index.js",
48+
"type": "module",
49+
"typings": "dist/index.d.ts",
50+
"files": [
51+
"dist"
52+
],
53+
"scripts": {
54+
"build": "tsc",
55+
"dev": "tsc -w",
56+
"type-check": "tsc --noEmit"
57+
},
58+
"license": "MIT",
59+
"devDependencies": {
60+
"@types/node": "^17.0.21",
61+
"typescript": "^5.4.5"
62+
},
63+
"dependencies": {
64+
"@web3-onboard/common": "^2.4.1"
65+
}
66+
}

packages/okx/src/icon.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default `<svg width="100%" height="100%" viewBox="0 0 1000 1000" fill="none" xmlns="http://www.w3.org/2000/svg">
2+
<rect width="1000" height="1000" fill="black"/>
3+
<path fill-rule="evenodd" clip-rule="evenodd" d="M393.949 218.518H231.049C224.129 218.518 218.519 224.128 218.519 231.048V393.948C218.519 400.869 224.129 406.479 231.049 406.479H393.949C400.87 406.479 406.48 400.869 406.48 393.948V231.048C406.48 224.128 400.87 218.518 393.949 218.518ZM581.992 406.479H419.092C412.172 406.479 406.561 412.09 406.561 419.01V581.91C406.561 588.831 412.172 594.441 419.092 594.441H581.992C588.913 594.441 594.523 588.831 594.523 581.91V419.01C594.523 412.09 588.913 406.479 581.992 406.479ZM606.974 218.518H769.874C776.794 218.518 782.405 224.128 782.405 231.048V393.948C782.405 400.869 776.794 406.479 769.874 406.479H606.974C600.053 406.479 594.443 400.869 594.443 393.948V231.048C594.443 224.128 600.053 218.518 606.974 218.518ZM393.95 594.442H231.049C224.129 594.442 218.519 600.052 218.519 606.973V769.873C218.519 776.793 224.129 782.404 231.049 782.404H393.95C400.87 782.404 406.48 776.793 406.48 769.873V606.973C406.48 600.052 400.87 594.442 393.95 594.442ZM606.974 594.442H769.874C776.794 594.442 782.405 600.052 782.405 606.973V769.873C782.405 776.793 776.794 782.404 769.874 782.404H606.974C600.053 782.404 594.443 776.793 594.443 769.873V606.973C594.443 600.052 600.053 594.442 606.974 594.442Z" fill="white"/>
4+
</svg>
5+
`

0 commit comments

Comments
 (0)