From 5df49d96b2b9b3806e1997a61ef2c8494e2cc0cb Mon Sep 17 00:00:00 2001 From: coderipper Date: Sun, 23 Jun 2024 18:49:45 +0200 Subject: [PATCH] added hannaWallet and updated packages --- package.json | 23 +-- src/components/Modals/ConnectWalletModal.tsx | 26 +-- src/soroban/MySorobanReactProvider.tsx | 3 +- yarn.lock | 162 ++++++++----------- 4 files changed, 97 insertions(+), 117 deletions(-) diff --git a/package.json b/package.json index cc183687..47b9e1f4 100644 --- a/package.json +++ b/package.json @@ -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.8", + "@soroban-react/contracts": "9.1.8", + "@soroban-react/core": "9.1.8", + "@soroban-react/events": "9.1.8", + "@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.8", + "@soroban-react/xbull": "9.1.8", "@stellar/freighter-api": "1.7.1", "@stellar/stellar-sdk": "11.3.0", "@types/qs": "^6.9.7", diff --git a/src/components/Modals/ConnectWalletModal.tsx b/src/components/Modals/ConnectWalletModal.tsx index 1bc6895b..4a2166e7 100644 --- a/src/components/Modals/ConnectWalletModal.tsx +++ b/src/components/Modals/ConnectWalletModal.tsx @@ -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; @@ -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(); @@ -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(); @@ -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 }; }); @@ -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 ( handleClick(wallet, walletStatus)}> diff --git a/src/soroban/MySorobanReactProvider.tsx b/src/soroban/MySorobanReactProvider.tsx index a6bc68f8..23243d6d 100644 --- a/src/soroban/MySorobanReactProvider.tsx +++ b/src/soroban/MySorobanReactProvider.tsx @@ -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'; @@ -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, diff --git a/yarn.lock b/yarn.lock index 6a7bb85e..6103dc64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2165,81 +2165,71 @@ resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz#5981a8db18b56ba38ef0efb7d995b12aa7b51918" integrity sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ== -"@soroban-react/chains@9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@soroban-react/chains/-/chains-9.1.2.tgz#07098db3b4afdc845458450cb1fb07c3a669e545" - integrity sha512-13xza5j4wuyXHrjOdVT/rxO4e5qU/rlmm2buzY4MxoOJIkFyJeHOO9c31eOVgIXHLl/Lb4OEJEbbaCUXUCyLpg== +"@soroban-react/chains@9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/chains/-/chains-9.1.8.tgz#32f886bdb234696296939603762ec5fd9d6a1e48" + integrity sha512-CU8rVrQI/xdhIwlTvOp3FvipgOBnnNhFIpV+rARgmO6gXlf2GwdRGosSzA2HtJV3iq74Sj6HfuJlVMOme9ra8A== dependencies: - "@soroban-react/types" "^9.1.2" - "@stellar/stellar-sdk" "11.1.0" + "@soroban-react/types" "^9.1.8" + "@stellar/stellar-sdk" "11.3.0" -"@soroban-react/connect-button@9.1.4", "@soroban-react/connect-button@^9.1.4": - version "9.1.4" - resolved "https://registry.yarnpkg.com/@soroban-react/connect-button/-/connect-button-9.1.4.tgz#a8d55c08016d83b9701c9c5e3c5d8e0f3fee15b8" - integrity sha512-q6HuaA9NinMMqH6bNY15G2bfY8D0Z9nxSaFVSiPe6/iD4rXKE7htvOjqUEzo+jp3ynxjozNKdAXcQ451CSW4FA== +"@soroban-react/connect-button@9.1.8", "@soroban-react/connect-button@^9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/connect-button/-/connect-button-9.1.8.tgz#cd91bb91af6337edf8f290d9ac25fe4dacf39854" + integrity sha512-k7y14joL8WWQZkw5s5HABBpOdznp9V8kkFKOhY8DHlzZ+Pj6mFmr8GQgj/9qTckfZsCCvbSPcATXrZlWOd7iIQ== dependencies: - "@soroban-react/core" "^9.1.4" + "@soroban-react/core" "^9.1.8" -"@soroban-react/contracts@9.1.4": - version "9.1.4" - resolved "https://registry.yarnpkg.com/@soroban-react/contracts/-/contracts-9.1.4.tgz#67342a693ec416ec1d18398256b60e494ca7f1f8" - integrity sha512-UdiBTkpfpv7tLv20DNwcZCwGdNg0tUPadAUPbOfkrgrFD4mSmLpE89+WESCnRSaj4ppcHoxhiHI2xIddtKYIyw== +"@soroban-react/contracts@9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/contracts/-/contracts-9.1.8.tgz#fdfd0eb35bf6408d64cc32ad208e59541095049d" + integrity sha512-UthH2BT9ZAXjSugtbDHUruNCsgAnpKEOVG35y3Owxi3KYKfUSFcfPIS8Ak03qPk/4Q+hT+F/27/TQt7ODKNzxw== dependencies: - "@soroban-react/core" "^9.1.4" + "@soroban-react/core" "^9.1.8" "@stellar/stellar-sdk" "11.3.0" -"@soroban-react/core@9.1.4", "@soroban-react/core@^9.1.4": - version "9.1.4" - resolved "https://registry.yarnpkg.com/@soroban-react/core/-/core-9.1.4.tgz#b151ea64c0a5d9507387a60d2a7fd8949a1e74af" - integrity sha512-H/DjEB3pO5jgYVh4IvuRwm5ho704wuMxNy/KoVxmE4lk6ZV1b4lSEd32yGIIMOtXjr81hcbdenPrvd0SyVIlVw== +"@soroban-react/core@9.1.8", "@soroban-react/core@^9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/core/-/core-9.1.8.tgz#1676ee7735ca9a774ba5895ca673936c47586f9a" + integrity sha512-zZi3bZx6ooGIMqOdXZxXk4z2+ZqXhDy9ZrLJ5ApVqJyBKySt5gKpwQ9ST0dspNtP9fmPTaKhsnEXE5uzh52znA== dependencies: - "@soroban-react/freighter" "^9.1.3" - "@soroban-react/lobstr" "^9.1.3" - "@soroban-react/types" "^9.1.3" + "@soroban-react/freighter" "^9.1.8" + "@soroban-react/lobstr" "^9.1.8" + "@soroban-react/types" "^9.1.8" "@soroban-react/xbull" "^1.0.1" "@stellar/stellar-sdk" "11.3.0" -"@soroban-react/events@9.1.4": - version "9.1.4" - resolved "https://registry.yarnpkg.com/@soroban-react/events/-/events-9.1.4.tgz#d484f37cf9b405659ed1b14248033fd05073e734" - integrity sha512-WsIFH4aIBKGTemO+tGr+oXvU/9bXZLttWPsttWlV34pzUPdA5IPjO9uu+OAMUzMPf7+oBEet+pGhGv2L6KBwVg== +"@soroban-react/events@9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/events/-/events-9.1.8.tgz#7224abc95e5332f31cdc3b3f86c090de94b17373" + integrity sha512-GfCLe4HrY2a/5o1K2BuIujuaI/uITZ4ytmc2TwxAGuRxiAY6+LNWYH3PYr9/f6KzmYqzcFBAsfE2EJ/LS5Kn9Q== dependencies: - "@soroban-react/core" "^9.1.4" - "@soroban-react/types" "^9.1.3" + "@soroban-react/core" "^9.1.8" + "@soroban-react/types" "^9.1.8" soroban-client "1.0.0-beta.4" -"@soroban-react/freighter@9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@soroban-react/freighter/-/freighter-9.1.2.tgz#3ddb56abecdabec1558c6144f75750beea83ad57" - integrity sha512-6LfUU2RKsonb3xz/M/kcqsHqOX/QANE4O9yhTo46+CxCaHMc+lLKNESC5SBK0Jsnb+EvRqvyIXXe9+8X63Mqsg== +"@soroban-react/freighter@9.1.8", "@soroban-react/freighter@^9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/freighter/-/freighter-9.1.8.tgz#93d7ca1d529c0cb4228bd03b1f6d1a0aa616c337" + integrity sha512-UBJqglA2asJ/g4dFda7/2cbFxE7lYspp51iv34VsjfSPMMwW6+kiwMhKREEXpuxoYI9VEO3aAOxS/ZfCwjmGxg== dependencies: - "@soroban-react/types" "^9.1.2" + "@soroban-react/types" "^9.1.8" "@stellar/freighter-api" "1.7.1" -"@soroban-react/freighter@^9.1.3": - version "9.1.3" - resolved "https://registry.yarnpkg.com/@soroban-react/freighter/-/freighter-9.1.3.tgz#c0a910ff066433c5cacae43818010122339dae5b" - integrity sha512-Q5CKKVNrNG9fE3Ehe7PFjaCOPUTZKaE2U+hI7MsiL0rSzNTeF6x1Nb4PCCa3Cqc5+7WeutTczpl+kQ25TnXOkg== +"@soroban-react/hana@^9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/hana/-/hana-9.1.8.tgz#c013a65c2ad057170b0c7f397af6d5900626dece" + integrity sha512-rHvEn5hLax8e40UrPtFpPCDejurGdWbItoTJmKTDXP0IUGkWy4kQ39ChXxnuvHqQnHfgxr7EcVQuTOKYl4m6YA== dependencies: - "@soroban-react/types" "^9.1.3" - "@stellar/freighter-api" "1.7.1" + "@soroban-react/types" "^9.1.8" -"@soroban-react/lobstr@9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@soroban-react/lobstr/-/lobstr-9.1.2.tgz#7030451d791530b5db9826e6ae85fa4602f1a292" - integrity sha512-e3sfU24gg+1bf9EbeAFWTKRk6MPmZupw5xlMELNqprTuFdF41e6Fu7SYeWFWWkeWbXgBYN+y+rw56ayOgjsypw== +"@soroban-react/lobstr@9.1.8", "@soroban-react/lobstr@^9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/lobstr/-/lobstr-9.1.8.tgz#1e40144285c9c26386045a23aa221bb6f2fc61f4" + integrity sha512-OTZt1dmXJDGZAkcZlQkGmM9+SOc1g0qVfI/nwkZviEKhtyz2/L4IbYcKtdACmbh/aN9jIGGB0zeJAkNeVl9XWw== dependencies: "@lobstrco/signer-extension-api" "^1.0.0-beta.0" - "@soroban-react/types" "^9.1.2" - "@stellar/stellar-sdk" "11.1.0" - -"@soroban-react/lobstr@^9.1.3": - version "9.1.3" - resolved "https://registry.yarnpkg.com/@soroban-react/lobstr/-/lobstr-9.1.3.tgz#35e3b9c1fd8cc949830bcb686fd4116d01c0dbb3" - integrity sha512-7MrNcWzFOeG2+/uyxQHfTYOsXjGw2liIgjz77EWKv4GBBYgD4LyN0Yvdcl/o4QcSNs6MjKwrIXAgOKDS6ZtHiA== - dependencies: - "@lobstrco/signer-extension-api" "^1.0.0-beta.0" - "@soroban-react/types" "^9.1.3" + "@soroban-react/types" "^9.1.8" "@stellar/stellar-sdk" "11.3.0" "@soroban-react/types@8.0.0": @@ -2247,46 +2237,39 @@ resolved "https://registry.yarnpkg.com/@soroban-react/types/-/types-8.0.0.tgz#14cb25911d2d45e3448a0fc6c0b2a6ae16b4851e" integrity sha512-t8eohOlmb4LAD1e3bfI01KKK7oCcm468QKsKrD0fL67fnZYcx9K61tSCqwWEbFCWGMGPkwaOwI3sE/bYKKDMIQ== -"@soroban-react/types@9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@soroban-react/types/-/types-9.1.2.tgz#ee3c174ff5f583c1361d7f3ff0821c544e4ea15f" - integrity sha512-q1FjiSaWnKSeqNNewRtMoVinfH3tcshcjCH7gSg3iSch+DVyDWcxOP+rIjPSFJ5UH4I0CVKbw5Y/idXoFREk6A== - dependencies: - "@stellar/stellar-sdk" "11.1.0" - -"@soroban-react/types@^9.1.2", "@soroban-react/types@^9.1.3": - version "9.1.3" - resolved "https://registry.yarnpkg.com/@soroban-react/types/-/types-9.1.3.tgz#3ba366dac08f65f9f747e071d0cf156fde1c0ab2" - integrity sha512-frdYcnP9xihrvdU2HCyPJwRp2J1N4A0eqgP2lQFcm7Ww9O2U9piQ+S//U9lQxevKud0qvrBegK+fomIq/nqKwQ== +"@soroban-react/types@9.1.8", "@soroban-react/types@^9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/types/-/types-9.1.8.tgz#f8c8c3697e7a2008ea2060805b98fad29e923c7c" + integrity sha512-rjDqY2vgS7sr3EETwYMkvsDIIry3WgxKcmBCqTHFjDnTv5N/4B5vx/S4NJ/hDfnOLZrAk+p05Jt3hf6Wdl0Xvw== dependencies: "@stellar/stellar-sdk" "11.3.0" -"@soroban-react/utils@9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@soroban-react/utils/-/utils-9.1.2.tgz#90b3095f055060039e2625eba31f0bc6e87b4d85" - integrity sha512-aWunf4AIsJn3R7Ijba4q19v1PGgwIbazoWWqqHXemAAVVvPNCSfkq3ROjd+Wwl/4aWBjjibDWLX3CdCJp/ZYQg== +"@soroban-react/utils@9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/utils/-/utils-9.1.8.tgz#682d550fd6e6e69bf4ccc87bb4298511f43ce96b" + integrity sha512-49T5Hw2oLkmqPRkY3rS9fyLuUXcGkddP6U43afrjRL99tL7g8zZG9F4ZR94vw31KvUPdt23f3EGDZW6SqJfsng== dependencies: - "@stellar/stellar-sdk" "11.1.0" + "@stellar/stellar-sdk" "11.3.0" bignumber.js "^9.1.1" -"@soroban-react/wallet-data@9.1.4": - version "9.1.4" - resolved "https://registry.yarnpkg.com/@soroban-react/wallet-data/-/wallet-data-9.1.4.tgz#111d27f91afea60e6d22f294f1be862b93585739" - integrity sha512-YWhCHVpC0nBs92CtdHR6B/OgdN5s8KFQukcjddaZfs7xDhn2cMrz/B/J40f1wiSXiezHlHfqQZHJ3bwdpVndYQ== +"@soroban-react/wallet-data@9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/wallet-data/-/wallet-data-9.1.8.tgz#5aad4466e80e73a1a0c18042ed062b38aaaf1f92" + integrity sha512-8YRbA2E/4k0vIdSHrlr0mUOsIDM3uoQDT8R9Aj/PtMbm7fGpnAvOQwo5pGNROUAIHCzhPL1sIPSchVbV7vci/w== dependencies: - "@soroban-react/connect-button" "^9.1.4" - "@soroban-react/core" "^9.1.4" - "@soroban-react/types" "^9.1.3" + "@soroban-react/connect-button" "^9.1.8" + "@soroban-react/core" "^9.1.8" + "@soroban-react/types" "^9.1.8" "@stellar/stellar-sdk" "11.3.0" -"@soroban-react/xbull@9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@soroban-react/xbull/-/xbull-9.1.2.tgz#10e38683f5d44063a0d9ddbc7b40f8c537880341" - integrity sha512-+X4tDcFcygNGDwA3o95kyO8pgSYbPIdBo9OGhP/DccdZLuqY/kQSLG+XFA+HJ4rjBRJTRKReNREmeAJdjbCmfQ== +"@soroban-react/xbull@9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@soroban-react/xbull/-/xbull-9.1.8.tgz#24b8e2e2064cf59f822c31c99c285536607240a6" + integrity sha512-EbHynD2donOFSn5iYIUtTKg2ReOHzv2gc6iyrUU18V/5NY3Zx8NGyPeF4JQ5xFh1g08zpWGYhoMU91lyGLKKDQ== dependencies: "@creit-tech/xbull-wallet-connect" "github:Creit-Tech/xBull-Wallet-Connect" - "@soroban-react/types" "^9.1.2" - "@stellar/stellar-sdk" "11.1.0" + "@soroban-react/types" "^9.1.8" + "@stellar/stellar-sdk" "11.3.0" "@soroban-react/xbull@^1.0.1": version "1.0.1" @@ -2335,19 +2318,6 @@ optionalDependencies: sodium-native "^4.1.1" -"@stellar/stellar-sdk@11.1.0": - version "11.1.0" - resolved "https://registry.yarnpkg.com/@stellar/stellar-sdk/-/stellar-sdk-11.1.0.tgz#4a619fa645a7392204b6e80cb0a7f3ef94cdd077" - integrity sha512-Ufw+4udr7lqyzPIhqSAzBTgcl/YlgFZLgeBlDr5ZZy1v+g7AT4dOZFurcCrHt7Pz8DGtVcxNX7GLxYLdOC3GIg== - dependencies: - "@stellar/stellar-base" "10.0.1" - axios "^1.6.0" - bignumber.js "^9.1.2" - eventsource "^2.0.2" - randombytes "^2.1.0" - toml "^3.0.0" - urijs "^1.19.1" - "@stellar/stellar-sdk@11.3.0", "@stellar/stellar-sdk@^11.3.0": version "11.3.0" resolved "https://registry.yarnpkg.com/@stellar/stellar-sdk/-/stellar-sdk-11.3.0.tgz#7cb010651846a07e1853e0fe30e430ece4da340b"