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

Add Galaxy Station wallet #565

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi

readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi

exit $exitCode
fi
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}
readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."
if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi
if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi
readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"
if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi
if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi
exit $exitCode
fi
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16.1
22.1.0
8 changes: 8 additions & 0 deletions components/Icons/GalaxyStationExtensionIcon.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'

import { useChain } from '@cosmos-kit/react-lite'
import CosmostationWalletIcon from 'components/Icons/CosmostationWalletIcon'
import GalaxyStationExtensionIcon from 'components/Icons/GalaxyStationExtensionIcon';
import KeplrWalletIcon from 'components/Icons/KeplrWalletIcon'
import LeapSnapIcon from 'components/Icons/LeapSnapIcon'
import LeapWalletIcon from 'components/Icons/LeapWalletIcon'
Expand Down Expand Up @@ -30,6 +31,8 @@ export const ConnectedWalletIcon = () => {
return <NinjiWalletIcon />
case WalletType.okxwallet:
return <OKXWalletIcon />
case WalletType.galaxyStationExtension:
return <GalaxyStationExtensionIcon />
default:
return <></>
}
Expand Down
9 changes: 7 additions & 2 deletions components/Wallet/Modal/WalletConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useCallback } from 'react'

import { Button, HStack, Text, useToast } from '@chakra-ui/react'
import CosmostationWalletIcon from 'components/Icons/CosmostationWalletIcon'
import GalaxyStationExtensionIcon from 'components/Icons/GalaxyStationExtensionIcon';
import KeplrWalletIcon from 'components/Icons/KeplrWalletIcon'
import LeapSnapIcon from 'components/Icons/LeapSnapIcon'
import LeapWalletIcon from 'components/Icons/LeapWalletIcon'
Expand Down Expand Up @@ -54,8 +55,8 @@ export const WalletConnectButton = ({ onCloseModal, connect, walletType }: Props
}
}
}
if ((walletType === WalletType.terraExtension || walletType === WalletType.keplrExtension)) {
const windowConnection = walletType === WalletType.terraExtension ? (window.station?.keplr) : (window?.keplr)
if ((walletType === WalletType.terraExtension || walletType === WalletType.galaxyStationExtension || walletType === WalletType.keplrExtension)) {
const windowConnection = walletType === WalletType.terraExtension ? (window.station?.keplr) : walletType === WalletType.galaxyStationExtension ? (window.galaxyStation?.keplr) : (window?.keplr)
try {
await (windowConnection.getKey(chainId))
} catch (e) {
Expand Down Expand Up @@ -94,6 +95,8 @@ export const WalletConnectButton = ({ onCloseModal, connect, walletType }: Props
return 'Ninji Wallet'
case WalletType.okxwallet:
return 'OKX Wallet'
case WalletType.galaxyStationExtension:
return 'Galaxy Station'
default:
return null
}
Expand Down Expand Up @@ -123,6 +126,8 @@ export const WalletConnectButton = ({ onCloseModal, connect, walletType }: Props
return <NinjiWalletIcon />
case WalletType.okxwallet:
return <OKXWalletIcon />
case WalletType.galaxyStationExtension:
return <GalaxyStationExtensionIcon />
default:
return null
}
Expand Down
2 changes: 2 additions & 0 deletions components/Wallet/Modal/WalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum WalletType {
cosmoStationMobile = 'cosmostation-mobile',
ninjiExtension = 'ninji-extension',
okxwallet = 'okxwallet-extension',
galaxyStationExtension = 'galaxy-station-extension',
}

export const WalletModal = ({ isOpen, setOpen, walletRepo }) => {
Expand All @@ -50,6 +51,7 @@ export const WalletModal = ({ isOpen, setOpen, walletRepo }) => {
WalletType.leapExtension,
WalletType.ninjiExtension,
WalletType.okxwallet,
WalletType.galaxyStationExtension,
].includes(walletName);
if (walletName === WalletType.okxwallet && !okxchains.includes(chainId)) {
return false
Expand Down
4 changes: 2 additions & 2 deletions components/Wallet/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ const Wallet = () => {

setWalletChains(snapChainIds)
setCurrentConnectedChainIds(snapChainIds)
} else if (walletType === WalletType.terraExtension || walletType === WalletType.keplrExtension) {
const walletWindowConnection = walletType === WalletType.terraExtension ? (window.station?.keplr) : (window?.keplr)
} else if (walletType === WalletType.terraExtension || walletType === WalletType.keplrExtension || walletType === WalletType.galaxyStationExtension) {
const walletWindowConnection = walletType === WalletType.terraExtension ? (window.station?.keplr) : walletType === WalletType.galaxyStationExtension ? (window.galaxyStation?.keplr) : (window?.keplr)
const getAddedStationChainsIds = async () => {
const chainInfos = await walletWindowConnection?.getChainInfosWithoutEndpoints()
if (!chainInfos) {
Expand Down
9 changes: 5 additions & 4 deletions hooks/useClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export const useClients = (walletChainName: string) => {
isWalletConnected,
setDefaultSignOptions,
wallet, getOfflineSigner } = useChain(walletChainName)
if (isWalletConnected && wallet?.name !== 'station-extension') {

if (isWalletConnected && !wallet?.name.includes('station')) {
try {
setDefaultSignOptions({
preferNoSetFee: true,
Expand Down Expand Up @@ -56,9 +57,9 @@ export const useClients = (walletChainName: string) => {
const client = await InjectiveStargate.InjectiveSigningStargateClient.connectWithSigner(
'https://sentry.tm.injective.network:443',
offlineSigner, {
registry,
aminoTypes,
},
registry,
aminoTypes,
},
)
return client
} catch {
Expand Down
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,56 @@
"@cosmjs/encoding": "0.32.2",
"@cosmjs/launchpad": "0.27.1",
"@cosmjs/proto-signing": "0.32.2",
"@cosmos-kit/cosmostation": "^2.6.10",
"@cosmos-kit/keplr": "^2.6.9",
"@cosmos-kit/leap": "^2.6.11",
"@cosmos-kit/ninji": "^2.6.9",
"@cosmos-kit/okxwallet": "^2.4.9",
"@cosmos-kit/react-lite": "^2.6.9",
"@cosmos-kit/shell": "^2.6.9",
"@cosmos-kit/station": "^2.5.9",
"@cosmos-kit/cosmostation": "^2.8.0",
"@cosmos-kit/keplr": "^2.8.0",
"@cosmos-kit/galaxy-station": "^2.6.2",
"@cosmos-kit/leap": "^2.8.0",
"@cosmos-kit/ninji": "^2.8.0",
"@cosmos-kit/okxwallet": "^2.6.0",
"@cosmos-kit/react-lite": "^2.8.0",
"@cosmos-kit/shell": "^2.8.0",
"@cosmos-kit/station": "^2.7.0",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@injectivelabs/sdk-ts": "^1.14.6",
"@next/bundle-analyzer": "^14.1.0",
"@nick134-bit/nicks-injectivejs": "^0.0.2",
"@tanstack/react-table": "^8.12.0",
"@injectivelabs/sdk-ts": "^1.14.7",
"@next/bundle-analyzer": "^14.2.3",
"@nick134-bit/nicks-injectivejs": "^0.0.3",
"@tanstack/react-table": "^8.16.0",
"@terra-money/feather.js": "^2.0.4",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"bignumber.js": "^9.1.2",
"chain-registry": "^1.28.6",
"dayjs": "^1.11.10",
"chain-registry": "^1.47.2",
"dayjs": "^1.11.11",
"eslint-plugin-import-helpers": "^1.3.1",
"intercept-stdout": "^0.1.2",
"isomorphic-unfetch": "^4.0.2",
"jsoneditor": "^10.0.1",
"jsoneditor": "^10.0.3",
"junoblocks": "^0.2.93",
"lodash": "^4.17.21",
"next": "13.4.0",
"next": "14.2.3",
"numeral": "^2.0.6",
"react": "^18.2.0",
"react": "^18.3.1",
"react-device-detect": "^2.2.3",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.0",
"react-dom": "^18.3.1",
"react-hook-form": "^7.51.4",
"react-hot-toast": "^2.4.1",
"react-icons": "^5.0.1",
"react-icons": "^5.2.1",
"react-query": "^3.39.3",
"recharts": "^2.12.2",
"recharts": "^2.12.7",
"recoil": "^0.7.7"
},
"devDependencies": {
"@keplr-wallet/types": "^0.12.70",
"@keplr-wallet/types": "^0.12.88",
"@types/react": "18.2.57",
"autoprefixer": "^10.4.18",
"autoprefixer": "^10.4.19",
"eslint": "^8.56.0",
"eslint-config-next": "^14.1.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"postcss": "^8.4.35",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"typescript": "^5.3.3"
"typescript": "^5.4.5"
},
"lint-staged": {
"**/*.{ts,md,tsx}": "prettier --write"
Expand Down
5 changes: 5 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { QueryClientProvider } from 'react-query'

import { CSSReset, ChakraProvider } from '@chakra-ui/react'
import { wallets as cosmoStationWallets } from '@cosmos-kit/cosmostation'
import { wallets as galaxyStationWallets } from '@cosmos-kit/galaxy-station'
import { wallets as keplrWallets } from '@cosmos-kit/keplr'
import { wallets as leapWallets } from '@cosmos-kit/leap'
import { wallets as ninjiWallets } from '@cosmos-kit/ninji'
Expand Down Expand Up @@ -63,6 +64,10 @@ const MyApp: FC<AppProps> = ({
name: 'okxwallet',
wallet: okxwallet,
},
{
name: 'galaxystation',
wallet: galaxyStationWallets,
},
];

const reorderWallets = useMemo(() => {
Expand Down
Loading