Skip to content

Commit

Permalink
feat: added OKX wallet (#1270)
Browse files Browse the repository at this point in the history
* feat: added okx wallet

* fix: clean up
  • Loading branch information
impelcrypto authored Apr 30, 2024
1 parent b66387d commit 350fcdb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Binary file added src/assets/img/icon_okx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/config/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export enum SupportWallet {
WalletConnect = 'wallet-connect',
Dcent = 'DcentWallet',
DcentEvm = 'DcentWalletEvm',
Okx = 'okxwallet',
}

export enum SupportMultisig {
Expand Down Expand Up @@ -64,6 +65,7 @@ export const WalletModalOption = {
EnkryptNative: SupportWallet.EnkryptNative,
Dcent: SupportWallet.Dcent,
DcentEvm: SupportWallet.DcentEvm,
Okx: SupportWallet.Okx,
};

export const SubstrateWallets = [
Expand Down Expand Up @@ -327,6 +329,16 @@ export const supportEvmWalletObj = {
isSupportMobileApp: true,
ethExtension: 'ethereum',
},
[SupportWallet.Okx]: {
img: require('/src/assets/img/icon_okx.png'),
name: 'OKX Wallet',
source: SupportWallet.Okx,
walletUrl: 'https://www.okx.com/web3',
guideUrl: 'https://www.okx.com/web3',
isSupportBrowserExtension: true,
isSupportMobileApp: false,
ethExtension: 'okxwallet',
},
};

export const supportAllWalletsObj = {
Expand Down
7 changes: 0 additions & 7 deletions src/hooks/useConnectWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,11 @@ export const useConnectWallet = () => {
const accounts = await requestAccounts();
accounts?.length && setCurrentEcdsaAccount(accounts[0]);

const chainId = getChainId(currentNetworkIdx.value);

const provider = getEvmProvider(currentWallet);
if (!provider) {
return false;
}

// Memo: Do not change the network for the Bridge page
if (currentRouter.value.name !== 'Bridge') {
isSetupNetwork && (await setupNetwork({ network: chainId, provider }));
}

// If SubWallet return empty evm accounts, it required to switch to evm network and will request accounts again.
// This setup will not require from version 0.4.8
if (accounts?.length === 0 && currentWallet === SupportWallet.SubWalletEvm) {
Expand Down

0 comments on commit 350fcdb

Please sign in to comment.