Compare commits
2 Commits
main
...
okx-wallet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e0319767f | ||
|
|
1bd65739c8 |
BIN
public/wallets/okx-wallet.png
Normal file
BIN
public/wallets/okx-wallet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
@ -16,6 +16,7 @@ import {
|
||||
KeplrIcon,
|
||||
MathWalletIcon,
|
||||
MetaMaskIcon,
|
||||
OkxWalletIcon,
|
||||
RainbowIcon,
|
||||
TokenPocketIcon,
|
||||
TrustWalletIcon,
|
||||
@ -89,6 +90,7 @@ export enum WalletType {
|
||||
// Ledger = 'LEDGER',
|
||||
MathWallet = 'MATH_WALLET',
|
||||
MetaMask = 'METAMASK',
|
||||
OkxWallet = 'OKX_WALLET',
|
||||
Rainbow = 'RAINBOW_WALLET',
|
||||
TokenPocket = 'TOKEN_POCKET',
|
||||
TrustWallet = 'TRUST_WALLET',
|
||||
@ -102,6 +104,7 @@ const WALLET_CONNECT_EXPLORER_RECOMMENDED_WALLETS = {
|
||||
imToken: 'ef333840daf915aafdc4a004525502d6d49d77bd9c65e0642dbaefb3c2893bef',
|
||||
TokenPocket: '20459438007b75f4f4acb98bf29aa3b800550309646d375da5fd4aac6c2a2c66',
|
||||
Trust: '4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0',
|
||||
OkxWallet: '971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709',
|
||||
Rainbow: '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369',
|
||||
Zerion: 'ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18',
|
||||
Ledger: '19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927',
|
||||
@ -212,6 +215,14 @@ export const wallets: Record<WalletType, WalletConfig> = {
|
||||
matchesInjectedEip1193: isMetaMask,
|
||||
walletconnect2Id: WALLET_CONNECT_EXPLORER_RECOMMENDED_WALLETS.Metamask,
|
||||
},
|
||||
[WalletType.OkxWallet]: {
|
||||
type: WalletType.OkxWallet,
|
||||
stringKey: STRING_KEYS.OKX_WALLET,
|
||||
icon: OkxWalletIcon,
|
||||
connectionTypes: [WalletConnectionType.InjectedEip1193, WalletConnectionType.WalletConnect2],
|
||||
matchesInjectedEip1193: (provider) => provider.isOkxWallet,
|
||||
walletconnect2Id: WALLET_CONNECT_EXPLORER_RECOMMENDED_WALLETS.OkxWallet,
|
||||
},
|
||||
[WalletType.Rainbow]: {
|
||||
type: WalletType.Rainbow,
|
||||
stringKey: STRING_KEYS.RAINBOW_WALLET,
|
||||
@ -278,6 +289,10 @@ export type WithInjectedWeb3Provider = {
|
||||
};
|
||||
};
|
||||
|
||||
export type WithInjectedOkxWalletProvider = {
|
||||
okxwallet: InjectedWeb3Provider;
|
||||
};
|
||||
|
||||
// Wallet connections
|
||||
|
||||
export type WalletConnection = {
|
||||
|
||||
@ -10,9 +10,10 @@ export const useDisplayedWallets = () => {
|
||||
isDev && WalletType.Keplr,
|
||||
|
||||
WalletType.WalletConnect2,
|
||||
|
||||
|
||||
WalletType.CoinbaseWallet,
|
||||
|
||||
|
||||
WalletType.OkxWallet,
|
||||
// Hide these wallet options until they can be properly tested on mainnet
|
||||
// WalletType.ImToken,
|
||||
// WalletType.Rainbow,
|
||||
|
||||
@ -83,6 +83,7 @@ export { default as LedgerIcon } from './wallets/ledger.svg';
|
||||
export { default as MagicIcon } from './wallets/magic.svg';
|
||||
export { default as MathWalletIcon } from './wallets/mathwallet.svg';
|
||||
export { default as MetaMaskIcon } from './wallets/metamask.svg';
|
||||
export { default as OkxWalletIcon } from './wallets/okx-wallet.svg';
|
||||
export { default as RainbowIcon } from './wallets/rainbow-wallet.svg';
|
||||
export { default as TestWalletIcon } from './wallets/test-wallet.svg';
|
||||
export { default as TokenPocketIcon } from './wallets/tokenpocket.svg';
|
||||
|
||||
1
src/icons/wallets/okx-wallet.svg
Normal file
1
src/icons/wallets/okx-wallet.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="400" viewBox="0, 0, 400,400"><g id="svgg"><path id="path0" d="M85.200 76.394 C 80.665 76.883,78.308 78.483,76.929 82.006 C 76.085 84.161,75.592 142.346,76.360 149.217 C 76.910 154.145,78.020 156.078,81.141 157.541 L 83.400 158.600 117.600 158.600 C 154.653 158.600,154.238 158.623,156.431 156.431 C 158.623 154.238,158.600 154.653,158.600 117.600 L 158.600 83.400 157.541 81.141 C 156.025 77.909,154.089 76.841,148.902 76.377 C 144.325 75.968,89.012 75.983,85.200 76.394 M249.890 76.409 C 245.967 76.882,243.812 78.255,242.459 81.141 L 241.400 83.400 241.400 117.600 C 241.400 154.653,241.377 154.238,243.569 156.431 C 245.762 158.623,245.347 158.600,282.400 158.600 L 316.600 158.600 318.859 157.541 C 324.048 155.108,324.091 154.742,323.907 114.679 C 323.739 78.113,323.917 79.248,317.999 76.930 C 316.018 76.154,255.815 75.693,249.890 76.409 M163.813 159.382 C 158.668 160.777,158.800 159.708,158.800 200.000 C 158.800 240.779,158.632 239.561,164.419 240.762 C 168.838 241.680,235.468 241.166,237.395 240.200 C 241.459 238.161,241.400 238.753,241.400 200.000 C 241.400 161.247,241.459 161.839,237.395 159.800 C 235.329 158.764,167.515 158.378,163.813 159.382 M84.192 241.586 C 75.955 242.833,75.887 243.209,76.093 286.273 C 76.252 319.496,76.167 318.455,78.918 321.120 C 81.744 323.860,80.445 323.758,114.679 323.911 C 154.743 324.090,155.109 324.047,157.541 318.859 L 158.600 316.600 158.600 282.400 C 158.600 242.256,158.762 243.612,153.768 241.955 C 151.993 241.366,87.894 241.026,84.192 241.586 M248.251 241.633 C 241.106 242.699,241.228 241.990,241.215 282.600 C 241.202 321.601,241.152 321.289,247.760 323.301 C 250.708 324.198,315.213 324.005,317.830 323.091 C 323.901 320.971,323.748 321.925,323.911 285.321 C 324.090 245.267,324.075 245.137,319.000 242.600 L 316.600 241.400 283.600 241.341 C 265.450 241.309,249.543 241.440,248.251 241.633 " stroke="none" fill="#fafafa" fill-rule="evenodd"></path><path id="path1" d="M0.000 200.000 L 0.000 400.000 200.000 400.000 L 400.000 400.000 400.000 200.000 L 400.000 0.000 200.000 0.000 L 0.000 0.000 0.000 200.000 M148.902 76.377 C 154.089 76.841,156.025 77.909,157.541 81.141 L 158.600 83.400 158.600 117.600 C 158.600 154.653,158.623 154.238,156.431 156.431 C 154.238 158.623,154.653 158.600,117.600 158.600 L 83.400 158.600 81.141 157.541 C 75.953 155.109,75.910 154.743,76.089 114.679 C 76.250 78.643,76.131 79.509,81.200 77.288 C 83.883 76.112,137.816 75.387,148.902 76.377 M317.999 76.930 C 323.917 79.248,323.739 78.113,323.907 114.679 C 324.091 154.742,324.048 155.108,318.859 157.541 L 316.600 158.600 282.400 158.600 C 245.347 158.600,245.762 158.623,243.569 156.431 C 241.377 154.238,241.400 154.653,241.400 117.600 L 241.400 83.400 242.459 81.141 C 243.812 78.255,245.967 76.882,249.890 76.409 C 255.815 75.693,316.018 76.154,317.999 76.930 M237.395 159.800 C 241.459 161.839,241.400 161.247,241.400 200.000 C 241.400 238.753,241.459 238.161,237.395 240.200 C 235.468 241.166,168.838 241.680,164.419 240.762 C 158.632 239.561,158.800 240.779,158.800 200.000 C 158.800 159.708,158.668 160.777,163.813 159.382 C 167.515 158.378,235.329 158.764,237.395 159.800 M153.768 241.955 C 158.762 243.612,158.600 242.256,158.600 282.400 L 158.600 316.600 157.541 318.859 C 155.109 324.047,154.743 324.090,114.679 323.911 C 80.445 323.758,81.744 323.860,78.918 321.120 C 76.167 318.455,76.252 319.496,76.093 286.273 C 75.887 243.209,75.955 242.833,84.192 241.586 C 87.894 241.026,151.993 241.366,153.768 241.955 M319.000 242.600 C 324.075 245.137,324.090 245.267,323.911 285.321 C 323.748 321.925,323.901 320.971,317.830 323.091 C 315.213 324.005,250.708 324.198,247.760 323.301 C 244.032 322.166,242.292 320.037,241.590 315.751 C 241.084 312.662,241.101 252.756,241.608 248.844 C 242.629 240.980,241.034 241.265,283.600 241.341 L 316.600 241.400 319.000 242.600 " stroke="none" fill="#040404" fill-rule="evenodd"></path></g></svg>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@ -5,6 +5,7 @@ import {
|
||||
type InjectedCoinbaseWalletExtensionProvider,
|
||||
type WithInjectedEthereumProvider,
|
||||
type WithInjectedWeb3Provider,
|
||||
type WithInjectedOkxWalletProvider,
|
||||
} from '@/constants/wallets';
|
||||
|
||||
import { isTruthy } from '../isTruthy';
|
||||
@ -18,15 +19,6 @@ export const isMetaMask = (provider: ExternalProvider) => (
|
||||
&& (
|
||||
!(provider as InjectedCoinbaseWalletExtensionProvider).overrideIsMetaMask
|
||||
)
|
||||
|
||||
/* not a MetaMask wannabe! */
|
||||
&& (
|
||||
Reflect.ownKeys(provider).filter((key) =>
|
||||
typeof key === 'string'
|
||||
&& key.match(/^is/)
|
||||
&& !['isConnected', 'isMetaMask'].includes(key)
|
||||
).length === 0
|
||||
)
|
||||
)
|
||||
|
||||
/*
|
||||
@ -54,5 +46,10 @@ export const detectInjectedEip1193Providers = (): ExternalProvider[] => {
|
||||
? ethereumProvider.providers
|
||||
: [];
|
||||
|
||||
return [...displacedProviders, ethereumProvider, web3Provider].filter(isTruthy);
|
||||
const okxWalletProvider = (globalThis as typeof globalThis & WithInjectedOkxWalletProvider)
|
||||
?.okxwallet;
|
||||
|
||||
return [...displacedProviders, ethereumProvider, web3Provider, okxWalletProvider].filter(
|
||||
isTruthy
|
||||
);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user