-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64ba728
commit 7ad40fb
Showing
8 changed files
with
184 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<template> | ||
<svg | ||
id="Layer_1" | ||
xmlns:xodm="http://www.corel.com/coreldraw/odm/2003" | ||
xmlns="http://www.w3.org/2000/svg" | ||
xmlns:xlink="http://www.w3.org/1999/xlink" | ||
version="1.1" | ||
x="0px" | ||
y="0px" | ||
viewBox="0 0 2500 2500" | ||
style="enable-background: new 0 0 2500 2500" | ||
xml:space="preserve" | ||
> | ||
<g id="Layer_x0020_1"> | ||
<g id="_2187289728928"> | ||
<rect y="0" class="okx-st0" width="2500" height="2500" /> | ||
<g> | ||
<path | ||
d="M1464.3,1015.3h-405.2c-17.2,0-31.3,14.1-31.3,31.3v405.2c0,17.2,14.1,31.3,31.3,31.3h405.2c17.2,0,31.3-14.1,31.3-31.3 v-405.2C1495.6,1029.4,1481.5,1015.3,1464.3,1015.3z" | ||
/> | ||
<path | ||
d="M996.6,549.1H591.4c-17.2,0-31.3,14.1-31.3,31.3v405.2c0,17.2,14.1,31.3,31.3,31.3h405.2c17.2,0,31.3-14.1,31.3-31.3 V580.4C1027.8,563.2,1013.8,549.1,996.6,549.1z" | ||
/> | ||
<path | ||
d="M1930.5,549.1h-405.2c-17.2,0-31.3,14.1-31.3,31.3v405.2c0,17.2,14.1,31.3,31.3,31.3h405.2c17.2,0,31.3-14.1,31.3-31.3 V580.4C1961.8,563.2,1947.7,549.1,1930.5,549.1z" | ||
/> | ||
<path | ||
d="M996.6,1481.5H591.4c-17.2,0-31.3,14.1-31.3,31.3V1918c0,17.2,14.1,31.3,31.3,31.3h405.2c17.2,0,31.3-14.1,31.3-31.3 v-405.2C1027.8,1495.6,1013.8,1481.5,996.6,1481.5z" | ||
/> | ||
<path | ||
d="M1930.5,1481.5h-405.2c-17.2,0-31.3,14.1-31.3,31.3V1918c0,17.2,14.1,31.3,31.3,31.3h405.2c17.2,0,31.3-14.1,31.3-31.3 v-405.2C1961.8,1495.6,1947.7,1481.5,1930.5,1481.5z" | ||
/> | ||
</g> | ||
</g> | ||
</g> | ||
</svg> | ||
</template> | ||
<style scoped> | ||
.okx-st0 { | ||
fill: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { EthereumChainId, AccountAddress } from '@injectivelabs/ts-types' | ||
import { | ||
ErrorType, | ||
GeneralException, | ||
OkxWalletException, | ||
UnspecifiedErrorCode | ||
} from '@injectivelabs/exceptions' | ||
import { UtilsWallets } from '@injectivelabs/wallet-ts' | ||
import { walletStrategy } from './wallet-strategy' | ||
import { ETHEREUM_CHAIN_ID } from './../utils/constant' | ||
|
||
export const isOkxWalletInstalled = async (): Promise<boolean> => { | ||
const provider = await UtilsWallets.getOkxWalletProvider() | ||
|
||
return !!provider | ||
} | ||
|
||
export const validateOkxWallet = async ( | ||
address: AccountAddress, | ||
chainId: EthereumChainId = ETHEREUM_CHAIN_ID | ||
) => { | ||
const addresses = await walletStrategy.getAddresses() | ||
const okxWalletIsLocked = addresses.length === 0 | ||
|
||
if (okxWalletIsLocked) { | ||
throw new OkxWalletException( | ||
new Error( | ||
'Your OkxWallet is currently locked. Please unlock your OkxWallet.' | ||
), | ||
{ | ||
code: UnspecifiedErrorCode, | ||
type: ErrorType.WalletError | ||
} | ||
) | ||
} | ||
|
||
const [okxWalletActiveAddress] = addresses | ||
const okxWalletActiveAddressDoesntMatchTheActiveAddress = | ||
address && okxWalletActiveAddress.toLowerCase() !== address.toLowerCase() | ||
|
||
if (okxWalletActiveAddressDoesntMatchTheActiveAddress) { | ||
throw new OkxWalletException( | ||
new Error( | ||
'You are connected to the wrong address. Please logout and connect to OkxWallet again' | ||
), | ||
{ | ||
code: UnspecifiedErrorCode, | ||
type: ErrorType.WalletError | ||
} | ||
) | ||
} | ||
|
||
const okxWalletChainId = parseInt( | ||
await walletStrategy.getEthereumChainId(), | ||
16 | ||
) | ||
const okxWalletChainIdDoesntMatchTheActiveChainId = | ||
chainId !== okxWalletChainId | ||
|
||
if (okxWalletChainIdDoesntMatchTheActiveChainId) { | ||
return await UtilsWallets.updateOkxWalletNetwork(chainId) | ||
} | ||
|
||
const okxProvider = await UtilsWallets.getOkxWalletProvider() | ||
|
||
if (!okxProvider) { | ||
throw new GeneralException( | ||
new Error('You are connected to the wrong wallet. Please use Metamask.'), | ||
{ | ||
code: UnspecifiedErrorCode, | ||
type: ErrorType.WalletError | ||
} | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1434,10 +1434,10 @@ | |
protobufjs "^7.0.0" | ||
rxjs "^7.4.0" | ||
|
||
"@injectivelabs/[email protected].59": | ||
version "1.0.59" | ||
resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.59.tgz#7e842dd0893c04afad5984640347d9f6641e0ed5" | ||
integrity sha512-eQZ9unwCci6/OlL78k8WSAB8DWPjQJwLFAWr452UwenOYo1antqXuhdXrsRu09OMYy4Du2NXR7NpUZt0pF1mvg== | ||
"@injectivelabs/[email protected].62": | ||
version "1.0.62" | ||
resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.62.tgz#45fc0746af7d1b283625816caeb9fff9887e050f" | ||
integrity sha512-WtoO80Y597nZiAuE4H+L208I0i3ByWytR+HqABdCaA26uJ7F1LhXw8YXxh3pP9z0LAeW31T+N7bwtOMlVR4riA== | ||
dependencies: | ||
"@injectivelabs/grpc-web" "^0.0.1" | ||
google-protobuf "^3.14.0" | ||
|
@@ -1465,10 +1465,10 @@ | |
"@bugsnag/source-maps" "^2.3.1" | ||
"@nuxt/kit" "^3.0.0-rc.13" | ||
|
||
"@injectivelabs/[email protected].53", "@injectivelabs/sdk-ts@^1.14.6-beta.53": | ||
version "1.14.6-beta.53" | ||
resolved "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.6-beta.53.tgz#d80c600ca8fcd5154721ef9b7ad0768938abb6f8" | ||
integrity sha512-j08Z2BQzdTCqdNYpk0pPS3k/iJ0o9ADtrjYsXUYbqcEEe+c4sKEunkK51Qn+5mFjuNdpaoXP+F/aaRR8M2XsEQ== | ||
"@injectivelabs/[email protected].58", "@injectivelabs/sdk-ts@^1.14.6-beta.58": | ||
version "1.14.6-beta.58" | ||
resolved "https://registry.yarnpkg.com/@injectivelabs/sdk-ts/-/sdk-ts-1.14.6-beta.58.tgz#0700a705a467347d2cd5fd5f94c1a9aa716215d7" | ||
integrity sha512-g1fu/OB3r63b+6uRthR3ekcuBK6E9CF3uJ7Qpl5k6UZkZ9NvhJGkbveEPs1hMCYHsbDGWl3iXZuEM7McTkMrdw== | ||
dependencies: | ||
"@apollo/client" "^3.5.8" | ||
"@cosmjs/amino" "^0.32.2" | ||
|
@@ -1484,7 +1484,7 @@ | |
"@injectivelabs/grpc-web-node-http-transport" "^0.0.2" | ||
"@injectivelabs/grpc-web-react-native-transport" "^0.0.2" | ||
"@injectivelabs/indexer-proto-ts" "1.11.36" | ||
"@injectivelabs/mito-proto-ts" "1.0.59" | ||
"@injectivelabs/mito-proto-ts" "1.0.62" | ||
"@injectivelabs/networks" "^1.14.6-beta.13" | ||
"@injectivelabs/test-utils" "^1.14.3" | ||
"@injectivelabs/token-metadata" "^1.14.6-beta.45" | ||
|
@@ -1508,15 +1508,15 @@ | |
shx "^0.3.2" | ||
snakecase-keys "^5.4.1" | ||
|
||
"@injectivelabs/[email protected].60": | ||
version "1.14.6-beta.60" | ||
resolved "https://registry.npmjs.org/@injectivelabs/sdk-ui-ts/-/sdk-ui-ts-1.14.6-beta.60.tgz#9d57267412519ff7f8bae4f2edfcb7d83a9fcb29" | ||
integrity sha512-fJ7/yToFpNK0T/oDWUDm4jK6xH6c5xSU7EwMtC1y2P58xS1XmIfjKYaiiQXm+Is0QvdzzUWkYuNHbwFcmdraVg== | ||
"@injectivelabs/[email protected].65": | ||
version "1.14.6-beta.65" | ||
resolved "https://registry.yarnpkg.com/@injectivelabs/sdk-ui-ts/-/sdk-ui-ts-1.14.6-beta.65.tgz#52b8a200896033ddcb4ed7779f8a44580fb05724" | ||
integrity sha512-SByLhhaz62FgFHfbzJqzPOYnUOn1536Vailci6G7s42Sb0mROlxmW14BDQ9UaST75vDS1AnnYWDwWkKKmip7Gw== | ||
dependencies: | ||
"@injectivelabs/contracts" "^1.14.6-beta.13" | ||
"@injectivelabs/exceptions" "^1.14.6-beta.9" | ||
"@injectivelabs/networks" "^1.14.6-beta.13" | ||
"@injectivelabs/sdk-ts" "^1.14.6-beta.53" | ||
"@injectivelabs/sdk-ts" "^1.14.6-beta.58" | ||
"@injectivelabs/token-metadata" "^1.14.6-beta.45" | ||
"@injectivelabs/token-utils" "^1.14.6-beta.10" | ||
"@injectivelabs/ts-types" "^1.14.6-beta.5" | ||
|
@@ -1588,10 +1588,10 @@ | |
snakecase-keys "^5.1.2" | ||
store2 "^2.12.0" | ||
|
||
"@injectivelabs/[email protected].60": | ||
version "1.14.6-beta.60" | ||
resolved "https://registry.npmjs.org/@injectivelabs/wallet-ts/-/wallet-ts-1.14.6-beta.60.tgz#37c9b72c58d482cb4a463188db2b22ae1c224152" | ||
integrity sha512-mlsuLaB6vhhAoANu+AhJuAS5zSFfoSVRZSGOpBpjZaOMlNsreQLTQPqBLzeKHXP59Yt/VpwZe/x6rNgWLHGe9g== | ||
"@injectivelabs/[email protected].65": | ||
version "1.14.6-beta.65" | ||
resolved "https://registry.yarnpkg.com/@injectivelabs/wallet-ts/-/wallet-ts-1.14.6-beta.65.tgz#78fb34bf40a159fda4bee20f3ab276db21f82e84" | ||
integrity sha512-Sbds9TVXjD2EAxYDsaLpW5O7zyYhqHljz2gI67yv4i07WHuPUoVl/fOioNkbYmTuaAwgQN+8LV/FAbD7ErePXw== | ||
dependencies: | ||
"@cosmjs/launchpad" "0.27.1" | ||
"@cosmjs/proto-signing" "0.32.2" | ||
|
@@ -1601,7 +1601,7 @@ | |
"@ethereumjs/tx" "^4.1.1" | ||
"@injectivelabs/exceptions" "^1.14.6-beta.9" | ||
"@injectivelabs/networks" "^1.14.6-beta.13" | ||
"@injectivelabs/sdk-ts" "^1.14.6-beta.53" | ||
"@injectivelabs/sdk-ts" "^1.14.6-beta.58" | ||
"@injectivelabs/ts-types" "^1.14.6-beta.5" | ||
"@injectivelabs/utils" "^1.14.6-beta.10" | ||
"@keplr-wallet/cosmos" "^0.11.58" | ||
|