Skip to content

Commit 9c693b6

Browse files
okxwalletAdamj1232
andauthored
Feat/add okx wallet (#1469)
* feature: add okx wallet to injected * feature: add okx wallet to injected * feature: add okx wallet to injected * feature: add okx wallet to injected * feature: add okx wallet to injected * Update okx wallet usage * Add debugging code for okx team * Update svg for wallet * Clean up logs --------- Co-authored-by: Adam Carpenter <adamcarpenter86@gmail.com>
1 parent 17ce3cd commit 9c693b6

File tree

8 files changed

+33
-5
lines changed

8 files changed

+33
-5
lines changed

docs/src/routes/docs/[...4]wallets/injected.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ const injected = injectedModule({
271271
- Binance - _Desktop_
272272
- Coinbase - _Desktop & Mobile_
273273
- Phantom - _Desktop & Mobile_
274+
- SafePal - _Desktop & Mobile_
274275
- Zerion - _Desktop & Mobile_
276+
- OKX Wallet - _Desktop_
275277
- Tally - _Desktop_
276278
- Trust - _Mobile_
277279
- Opera - _Desktop & Mobile_
@@ -307,6 +309,7 @@ const injected = injectedModule({
307309
- Zeal - _Desktop_
308310
- Exodus - _Desktop & Mobile_
309311
- Frontier - _Desktop & Mobile_
312+
- Rainbow - _Desktop & Mobile_
310313

311314
## Build Environments
312315

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@web3-onboard/keepkey": "^2.3.3",
3535
"@web3-onboard/keystone": "^2.3.3",
3636
"@web3-onboard/ledger": "^2.4.2",
37-
"@web3-onboard/injected-wallets": "^2.6.2-alpha.2",
37+
"@web3-onboard/injected-wallets": "^2.6.2-alpha.3",
3838
"@web3-onboard/magic": "^2.1.3",
3939
"@web3-onboard/phantom": "^2.0.0-alpha.1",
4040
"@web3-onboard/portis": "^2.1.3",

packages/injected/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ console.log(connectedWallets)
3939
- Binance - _Desktop_
4040
- Coinbase - _Desktop & Mobile_
4141
- Phantom - _Desktop & Mobile_
42+
- SafePal - _Desktop & Mobile_
4243
- Zerion - _Desktop & Mobile_
44+
- OKX Wallet - _Desktop_
4345
- Tally - _Desktop_
4446
- Trust - _Mobile_
4547
- Opera - _Desktop & Mobile_
@@ -75,6 +77,7 @@ console.log(connectedWallets)
7577
- Zeal - _Desktop_
7678
- Exodus - _Desktop & Mobile_
7779
- Frontier - _Desktop & Mobile_
80+
- Rainbow - _Desktop & Mobile_
7881

7982
## Filtering Wallets
8083

packages/injected/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/injected-wallets",
3-
"version": "2.6.2-alpha.2",
3+
"version": "2.6.2-alpha.3",
44
"description": "Injected wallet module for connecting browser extension and mobile wallets 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/injected/src/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export const isWalletAvailable = (
3232
return true
3333
}
3434

35-
// For multiple injected providers, check providers array
36-
// example coinbase inj wallet pushes over-ridden wallets
35+
// For multiple injected providers, check providers array
36+
// example coinbase inj wallet pushes over-ridden wallets
3737
// into a providers array at window.ethereum
3838
return !!provider.providers?.some(provider =>
3939
checkProviderIdentity({ provider, device })
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+
`

packages/injected/src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export enum ProviderIdentityFlag {
5252
Bitski = 'isBitski',
5353
Enkrypt = 'isEnkrypt',
5454
Phantom = 'isPhantom',
55+
OKXWallet = 'isOkxWallet',
5556
Zeal = 'isZeal',
5657
Zerion = 'isZerion',
5758
Rainbow = 'isRainbow',
@@ -99,6 +100,7 @@ export enum ProviderLabel {
99100
Enkrypt = 'Enkrypt',
100101
Zeal = 'Zeal',
101102
Phantom = 'Phantom',
103+
OKXWallet = 'OKX Wallet',
102104
Zerion = 'Zerion',
103105
Rainbow = 'Rainbow',
104106
SafePal = 'SafePal'
@@ -128,6 +130,7 @@ export enum InjectedNameSpace {
128130
Enkrypt = 'enkrypt',
129131
Zeal = 'zeal',
130132
Phantom = 'phantom',
133+
OKXWallet = 'okxwallet',
131134
Trust = 'trustwallet',
132135
Frontier = 'frontier'
133136
}
@@ -161,6 +164,7 @@ export interface CustomWindow extends Window {
161164
phantom: {
162165
ethereum: InjectedProvider
163166
}
167+
okxwallet: InjectedProvider
164168
trustwallet: InjectedProvider
165169
}
166170

packages/injected/src/wallets.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ const phantom: InjectedWalletModule = {
668668
}),
669669
platforms: ['all']
670670
}
671-
671+
672672
const safepal: InjectedWalletModule = {
673673
label: ProviderLabel.SafePal,
674674
injectedNamespace: InjectedNameSpace.Ethereum,
@@ -691,6 +691,18 @@ const rainbow: InjectedWalletModule = {
691691
platforms: ['all']
692692
}
693693

694+
const okxwallet: InjectedWalletModule = {
695+
label: ProviderLabel.OKXWallet,
696+
injectedNamespace: InjectedNameSpace.OKXWallet,
697+
checkProviderIdentity: ({ provider }) =>
698+
!!provider && !!provider[ProviderIdentityFlag.OKXWallet],
699+
getIcon: async () => (await import('./icons/okxwallet.js')).default,
700+
getInterface: async () => ({
701+
provider: createEIP1193Provider(window.okxwallet)
702+
}),
703+
platforms: ['desktop']
704+
}
705+
694706
const wallets = [
695707
zeal,
696708
exodus,
@@ -730,6 +742,7 @@ const wallets = [
730742
bitski,
731743
enkrypt,
732744
phantom,
745+
okxwallet,
733746
zerion,
734747
rainbow,
735748
safepal

0 commit comments

Comments
 (0)