Skip to content

Commit

Permalink
Merge pull request #477 from soroswap/feat/hanawallet
Browse files Browse the repository at this point in the history
feat: Hana Wallet
  • Loading branch information
joaquinsoza authored Jun 25, 2024
2 parents 6ee6410 + bbc9bfa commit 6d21620
Show file tree
Hide file tree
Showing 4 changed files with 1,096 additions and 1,132 deletions.
13 changes: 7 additions & 6 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/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.2",
"@soroban-react/lobstr": "9.1.2",
"@soroban-react/types": "9.1.2",
"@soroban-react/utils": "9.1.2",
"@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.2",
"@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

0 comments on commit 6d21620

Please sign in to comment.