Skip to content

feat: add @web3-onboard/okx #2208

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/trust
steps:
- node-build-steps
build-okx:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/okx
steps:
- node-build-steps
build-frontier:
docker:
- image: cimg/node:16.13.1
Expand Down Expand Up @@ -552,6 +558,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/trust
steps:
- node-staging-build-steps
build-staging-okx:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/okx
steps:
- node-staging-build-steps
build-staging-frontier:
docker:
- image: cimg/node:16.13.1
Expand Down Expand Up @@ -851,6 +863,12 @@ workflows:
<<: *deploy_production_filters
- build-staging-trust:
<<: *deploy_staging_filters
okx:
jobs:
- build-okx:
<<: *deploy_production_filters
- build-staging-okx:
<<: *deploy_staging_filters
frontier:
jobs:
- build-frontier:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ For full documentation, check out the README.md for each package or the [docs pa
- [Arcana](packages/arcana-auth/README.md)
- [Coinbase](packages/coinbase/README.md)
- [Trust](packages/trust/README.md)
- [OKX](packages/okx/README.md)
- [WalletConnect](packages/walletconnect/README.md)
- [Safe](packages/gnosis/README.md)
- [Magic](packages/magic/README.md)
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"@web3-onboard/magic": "^2.2.0",
"@web3-onboard/metamask": "^2.1.0",
"@web3-onboard/mew-wallet": "^2.1.0",
"@web3-onboard/okx": "^2.0.0-alpha.1",
"@web3-onboard/particle-network": "^2.1.0",
"@web3-onboard/phantom": "^2.1.0",
"@web3-onboard/portis": "^2.2.0",
Expand Down
3 changes: 3 additions & 0 deletions docs/src/lib/services/onboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const intiOnboard = async (theme) => {
const { default: torusModule } = await import('@web3-onboard/torus')
const { default: uauthModule } = await import('@web3-onboard/uauth')
const { default: trustModule } = await import('@web3-onboard/trust')
const { default: okxModule } = await import('@web3-onboard/okx')
const { default: xdefiModule } = await import('@web3-onboard/xdefi')
const { default: cedeModule } = await import('@web3-onboard/cede-store')
const { default: frameModule } = await import('@web3-onboard/frame')
Expand Down Expand Up @@ -93,6 +94,7 @@ const intiOnboard = async (theme) => {
const taho = tahoModule()
const torus = torusModule()
const trust = trustModule()
const okx = okxModule()
const xdefi = xdefiModule()
const cede = cedeModule()
const bitget = bitgetModule()
Expand Down Expand Up @@ -152,6 +154,7 @@ const intiOnboard = async (theme) => {
ledger,
trezor,
trust,
okx,
gnosis,
taho,
bitget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ We recommend you add the [Core Repo](../../modules/core.md#install) and consider
- [Blocto](../../wallets/blocto.md#install)
- [Capsule](../../wallets/capsule.md#install)
- [Coinbase](../../wallets/coinbase.md#install)
- [OKX](../../wallets/okx.md#install)
- [Fortmatic](../../wallets/fortmatic.md#install)
- [Frame](../../wallets/frame.md#install)
- [Safe](../../wallets/gnosis.md#install)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ const injected = injectedModule({
- Trust - _Desktop & Mobile_
- SafePal - _Desktop & Mobile_
- Zerion - _Desktop & Mobile_
- OKX Wallet - _Desktop & Mobile_
- Taho (Previously named Tally Ho wallet) - _Desktop_
- Opera - _Desktop & Mobile_
- Status - _Mobile_
Expand Down
50 changes: 50 additions & 0 deletions docs/src/routes/docs/[...4]wallets/[...37]okx/+page.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: OKX Wallet
---

# {$frontmatter.title}

Wallet module for connecting OKX wallet through Web3 Onboard

### Install

<Tabs values={['yarn', 'npm']}>
<TabPanel value="yarn">

```sh copy
yarn add @web3-onboard/okx
```

</TabPanel>
<TabPanel value="npm">

```sh copy
npm install @web3-onboard/okx
```

</TabPanel>
</Tabs>

## Usage

```typescript
import Onboard from '@web3-onboard/core'
import okxWallet from '@web3-onboard/okx'

const okx = okxWallet()

const onboard = Onboard({
// ... other Onboard options
wallets: [
okx
//... other wallets
]
})

const connectedWallets = await onboard.connectWallet()
console.log(connectedWallets)
```

## Build Environments

For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments)
10 changes: 8 additions & 2 deletions docs/src/routes/examples/[...1]connect-wallet/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ Remember- if you used create-react-app, please follow the [additional setup inst
<TabPanel value="yarn">

```sh copy
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
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/okx @web3-onboard/frontier
```

</TabPanel>
<TabPanel value="npm">

```sh copy
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
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/okx @web3-onboard/frontier
```

</TabPanel>
Expand Down Expand Up @@ -60,6 +60,7 @@ import dcentModule from '@web3-onboard/dcent'
import sequenceModule from '@web3-onboard/sequence'
import tahoModule from '@web3-onboard/taho'
import trustModule from '@web3-onboard/trust'
import okxModule from '@web3-onboard/okx'
import frontierModule from '@web3-onboard/frontier'
import ConnectWallet from './ConnectWallet'

Expand All @@ -86,6 +87,7 @@ const safe = safeModule()
const sequence = sequenceModule()
const taho = tahoModule() // Previously named Tally Ho wallet
const trust = trustModule()
const okx = okxModule()
const frontier = frontierModule()

const trezorOptions = {
Expand All @@ -105,6 +107,7 @@ const wallets = [
sequence,
injected,
trust,
okx,
frontier,
taho,
ledger,
Expand Down Expand Up @@ -324,6 +327,7 @@ import dcentModule from '@web3-onboard/dcent'
import sequenceModule from '@web3-onboard/sequence'
import tahoModule from '@web3-onboard/taho'
import trustModule from '@web3-onboard/trust'
import okxModule from '@web3-onboard/okx'
import frontierModule from '@web3-onboard/frontier'

const INFURA_KEY = ''
Expand All @@ -349,6 +353,7 @@ const safe = safeModule()
const sequence = sequenceModule()
const taho = tahoModule() // Previously named Tally Ho wallet
const trust = trustModule()
const okx = okxModule()
const frontier = frontierModule()

const trezorOptions = {
Expand All @@ -375,6 +380,7 @@ const wallets = [
coinbase,
dcent,
trust,
okx,
frontier,
trezor,
walletConnect,
Expand Down
1 change: 1 addition & 0 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@web3-onboard/magic": "^2.2.0",
"@web3-onboard/metamask": "^2.1.0",
"@web3-onboard/mew-wallet": "^2.1.0",
"@web3-onboard/okx": "^2.0.0-alpha.1",
"@web3-onboard/particle-network": "^2.1.0",
"@web3-onboard/phantom": "^2.1.0",
"@web3-onboard/portis": "^2.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import arcanaAuthModule from '@web3-onboard/arcana-auth'
import venlyModule from '@web3-onboard/venly'
import bitgetModule from '@web3-onboard/bitget'
import okxModule from '@web3-onboard/okx'
import particleAuthModule from '@web3-onboard/particle-network'
// import capsuleModule, {
// Environment,
Expand Down Expand Up @@ -233,6 +234,7 @@

const dcent = dcentModule()
const bitget = bitgetModule()
const okx = okxModule()
const frameWallet = frameModule()
const sequence = sequenceModule()
const enkrypt = enkryptModule()
Expand Down Expand Up @@ -271,6 +273,7 @@
trust,
tallyho,
bitget,
okx,
enkrypt,
infinityWallet,
mewWallet,
Expand Down
1 change: 0 additions & 1 deletion packages/injected/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const onboard = Onboard({
- Phantom - _Desktop & Mobile_
- SafePal - _Desktop & Mobile_
- Zerion - _Desktop & Mobile_
- OKX Wallet - _Desktop & Mobile_
Copy link
Contributor

@Adamj1232 Adamj1232 Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont believe you would want to remove support from the injected module. This would force dapps that only use injected(a fair majority) to lose support for OKX wallets completely after update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, we will revert this related change 👌

- Taho (Previously named Tally Ho wallet) - _Desktop_
- Trust - _Mobile_
- Opera - _Desktop & Mobile_
Expand Down
5 changes: 0 additions & 5 deletions packages/injected/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export enum ProviderIdentityFlag {
Bitski = 'isBitski',
Enkrypt = 'isEnkrypt',
Phantom = 'isPhantom',
OKXWallet = 'isOkxWallet',
Zeal = 'isZeal',
Zerion = 'isZerion',
Rainbow = 'isRainbow',
Expand Down Expand Up @@ -87,7 +86,6 @@ export enum ProviderExternalUrl {
Bitget = 'https://web3.bitget.com/en/wallet-download',
Coinbase = 'https://www.coinbase.com/wallet/downloads',
MetaMask = 'https://metamask.io/download/',
OKXWallet = 'https://okx.com/download',
Phantom = 'https://phantom.app/ul/v1/connect',
Talisman = 'https://www.talisman.xyz/',
Trust = 'https://link.trustwallet.com',
Expand Down Expand Up @@ -147,7 +145,6 @@ export enum ProviderLabel {
Enkrypt = 'Enkrypt',
Zeal = 'Zeal',
Phantom = 'Phantom',
OKXWallet = 'OKX Wallet',
Zerion = 'Zerion',
Rainbow = 'Rainbow',
SafePal = 'SafePal',
Expand Down Expand Up @@ -190,7 +187,6 @@ export enum InjectedNameSpace {
Enkrypt = 'enkrypt',
Zeal = 'zeal',
Phantom = 'phantom',
OKXWallet = 'okxwallet',
Trust = 'trustwallet',
Frontier = 'frontier',
DeFiConnectProvider = 'deficonnectProvider',
Expand Down Expand Up @@ -233,7 +229,6 @@ export interface CustomWindow extends Window {
phantom: {
ethereum: InjectedProvider
}
okxwallet: InjectedProvider
trustwallet: InjectedProvider
deficonnectProvider: InjectedProvider
safeheron: InjectedProvider
Expand Down
14 changes: 0 additions & 14 deletions packages/injected/src/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,19 +715,6 @@ const rainbow: InjectedWalletModule = {
platforms: ['all']
}

const okxwallet: InjectedWalletModule = {
label: ProviderLabel.OKXWallet,
injectedNamespace: InjectedNameSpace.OKXWallet,
checkProviderIdentity: ({ provider }) =>
!!provider && !!provider[ProviderIdentityFlag.OKXWallet],
getIcon: async () => (await import('./icons/okxwallet.js')).default,
getInterface: async () => ({
provider: createEIP1193Provider(window.okxwallet)
}),
platforms: ['all'],
externalUrl: ProviderExternalUrl.OKXWallet
}

const defiwallet: InjectedWalletModule = {
label: ProviderLabel.DeFiWallet,
injectedNamespace: InjectedNameSpace.DeFiConnectProvider,
Expand Down Expand Up @@ -960,7 +947,6 @@ const wallets = [
bitski,
enkrypt,
phantom,
okxwallet,
zerion,
rainbow,
safepal,
Expand Down
33 changes: 33 additions & 0 deletions packages/okx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# @web3-onboard/okx

## Wallet module for connecting OKX Wallet through web3-onboard

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.

### Install

**NPM**
`npm i @web3-onboard/core @web3-onboard/okx`

**Yarn**
`yarn add @web3-onboard/core @web3-onboard/okx`

## Usage

```typescript
import Onboard from '@web3-onboard/core'
import okxModule from '@web3-onboard/okx'

const okx = okxModule()

const onboard = Onboard({
// ... other Onboard options
wallets: [
okx
//... other wallets
]
})

const connectedWallets = await onboard.connectWallet()
console.log(connectedWallets)
```
Loading
Loading