Skip to content
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

feat: added OKX wallet #1270

Merged
merged 2 commits into from Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added src/assets/img/icon_okx.png
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
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
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