Skip to content

Commit

Permalink
docs: Update
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Nov 22, 2023
1 parent 6df1eba commit c9f31c2
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 18 deletions.
22 changes: 16 additions & 6 deletions packages/walletkit/src/wallets/okxWallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PartialCustomProps, WalletProps } from '..';
import { CustomConnector } from '../custom/connector';
import { getInjectedProvider, hasInjectedProvider } from '../utils';
import { OkxWalletIcon, OkxWalletTransparentIcon } from './icon';
import { isMobile } from '@/index';

export const OKX_WALLET_ID = 'okxWallet';

Expand All @@ -29,12 +30,7 @@ export function okxWallet(props: PartialCustomProps = {}): WalletProps {
options: {
name: 'OKX Wallet',
shimDisconnect: true,
getProvider() {
if (typeof window === 'undefined') return;

const provider = getInjectedProvider('isOkxWallet') ?? window.okexchain;
return provider;
},
getProvider,
...connectorOptions,
},
});
Expand All @@ -49,8 +45,22 @@ export function okxWallet(props: PartialCustomProps = {}): WalletProps {
};
}

function getProvider() {
if (typeof window === 'undefined') return;

if (isMobile()) {
return window.ethereum || window.okexchain;
}

return getInjectedProvider('isOkxWallet') ?? window.okexchain;
}

export function isOkxWallet() {
if (typeof window === 'undefined') return false;

if (isMobile()) {
return !!(window.ethereum || window.okexchain);
}

return !!(hasInjectedProvider('isOkxWallet') || window.okexchain?.isOkxWallet);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="true" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@400;500;600&display=swap" rel="stylesheet" />
<title>WalletKit</title>
<script type="module" crossorigin src="./assets/index-824a121f.js"></script>
<script type="module" crossorigin src="./assets/index-ee99e461.js"></script>
<link rel="stylesheet" href="./assets/index-305b37e1.css">
</head>

Expand Down

0 comments on commit c9f31c2

Please sign in to comment.