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: Hana Wallet #477

Merged
merged 3 commits into from
Jun 25, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
"@polkadot/types": "^10.12.6",
"@reduxjs/toolkit": "^2.2.1",
"@scio-labs/use-inkathon": "^0.8.1",
"@soroban-react/chains": "9.1.2",
"@soroban-react/connect-button": "9.1.4",
"@soroban-react/contracts": "9.1.4",
"@soroban-react/core": "9.1.4",
"@soroban-react/events": "9.1.4",
"@soroban-react/freighter": "9.1.2",
"@soroban-react/lobstr": "9.1.2",
"@soroban-react/types": "9.1.2",
"@soroban-react/utils": "9.1.2",
"@soroban-react/wallet-data": "9.1.4",
"@soroban-react/xbull": "9.1.2",
"@soroban-react/chains": "9.1.8",
"@soroban-react/connect-button": "9.1.9",
"@soroban-react/contracts": "9.1.9",
"@soroban-react/core": "9.1.9",
"@soroban-react/events": "9.1.9",
"@soroban-react/freighter": "9.1.8",
"@soroban-react/hana": "^9.1.8",
"@soroban-react/lobstr": "9.1.8",
"@soroban-react/types": "9.1.8",
"@soroban-react/utils": "9.1.8",
"@soroban-react/wallet-data": "9.1.9",
"@soroban-react/xbull": "9.1.8",
"@stellar/freighter-api": "1.7.1",
"@stellar/stellar-sdk": "11.3.0",
"@types/qs": "^6.9.7",
Expand Down
26 changes: 17 additions & 9 deletions src/components/Modals/ConnectWalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { isConnected } from '@stellar/freighter-api';
import { isConnected as isConnectedLobstr } from '@lobstrco/signer-extension-api';

import { Connector } from '@soroban-react/types';
import { hana } from '@soroban-react/hana';

const Title = styled('div')`
font-size: 24px;
Expand Down Expand Up @@ -108,6 +109,7 @@ const ConnectWalletContent = ({
{ name: 'freighter', isInstalled: false, isLoading: true },
{ name: 'xbull', isInstalled: false, isLoading: true },
{ name: 'lobstr', isInstalled: false, isLoading: true },
{ name: 'hana', isInstalled: false, isLoading: true },
]);
const browser = Bowser.getParser(window.navigator.userAgent).getBrowserName();

Expand Down Expand Up @@ -145,6 +147,15 @@ const ConnectWalletContent = ({
);
break;
}
} else if (wallet.id === 'hana') {
switch (browser) {
default:
window.open(
'https://chromewebstore.google.com/detail/hana-wallet/jfdlamikmbghhapbgfoogdffldioobgl',
'_blank',
);
break;
}
}
setTimeout(() => {
window.location.reload();
Expand Down Expand Up @@ -197,6 +208,11 @@ const ConnectWalletContent = ({

return { name: walletStatus.name, isInstalled: connected, isLoading: false };
}
if (walletStatus.name === 'hana') {
const connected = hana().isConnected();

return { name: walletStatus.name, isInstalled: connected, isLoading: false };
}
return { ...walletStatus, isLoading: false };
});

Expand All @@ -218,15 +234,7 @@ const ConnectWalletContent = ({
const walletStatus = walletsStatus.find(
(walletStatus) => walletStatus.name === wallet.id,
);
let walletIconUrl =
theme.palette.mode == 'dark' ? freighterLogoWhite.src : freighterLogoBlack.src;
if (wallet.id == 'lobstr') {
walletIconUrl = 'https://stellar.creit.tech/wallet-icons/lobstr.svg';
} else if (wallet.id == 'freighter') {
walletIconUrl = 'https://stellar.creit.tech/wallet-icons/freighter.svg';
} else if (wallet.id == 'xbull') {
walletIconUrl = 'https://stellar.creit.tech/wallet-icons/xbull.svg';
}
let walletIconUrl = wallet.iconUrl as string;

return (
<WalletBox key={index} onClick={() => handleClick(wallet, walletStatus)}>
Expand Down
3 changes: 2 additions & 1 deletion src/soroban/MySorobanReactProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SorobanReactProvider } from '@soroban-react/core';
import { freighter } from '@soroban-react/freighter';
import { lobstr } from '@soroban-react/lobstr';
import { xbull } from '@soroban-react/xbull';
import { hana } from '@soroban-react/hana';
import { ChainMetadata, Connector, WalletChain } from '@soroban-react/types';
import useMounted from 'hooks/useMounted';

Expand All @@ -21,7 +22,7 @@ const activeChainName = process.env.NEXT_PUBLIC_DEFAULT_NETWORK || 'testnet';
const activeChain: WalletChain = findWalletChainByName(activeChainName) || testnet;

// Set allowed connectors
const connectors: Connector[] = [freighter(), xbull(), lobstr()];
const connectors: Connector[] = [freighter(), xbull(), lobstr(), hana()];

export default function MySorobanReactProvider({
children,
Expand Down
Loading