From 40dd1d6909752b98a58e610ecae8f1db5476e8b5 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp <15185355+baktun14@users.noreply.github.com> Date: Sat, 13 Jun 2026 20:25:37 -0400 Subject: [PATCH 1/3] refactor(wallet): remove cosmos-kit integration and deps from deploy-web Delete the dead cosmos-kit wallet-connection stack (cosmos-kit-jotai abstraction, chain-registry configs, and the no-op CustomChainProvider bootstrap wrapper) now that deploy-web is managed-wallet only, and uninstall the cosmos-kit / chain-registry / interchain-ui packages. @cosmjs/* is intentionally retained: it is still required for tx-message building in customRegistry/TxHttpService. Removing it depends on moving transaction construction and signing into the API (tracked separately). Ref CON-259 --- apps/deploy-web/env/.env | 1 - apps/deploy-web/package.json | 8 - apps/deploy-web/src/chains/akash-sandbox.ts | 18 - apps/deploy-web/src/chains/akash-testnet.ts | 26 - apps/deploy-web/src/chains/akash.ts | 522 ------------------ apps/deploy-web/src/chains/index.ts | 9 - .../CustomChainProvider.spec.tsx | 86 --- .../CustomChainProvider.tsx | 78 --- .../ChainStoreInitializer.spec.tsx | 41 -- .../ChainStoreInitializer.tsx | 53 -- .../components/ModalWrapper/ModalWrapper.tsx | 22 - .../components/WalletModal/WalletListView.tsx | 76 --- .../WalletModal/WalletModal.spec.tsx | 291 ---------- .../components/WalletModal/WalletModal.tsx | 178 ------ .../context/ChainStoreProvider.tsx | 36 -- .../hooks/useChain/useChain.spec.tsx | 168 ------ .../hooks/useChain/useChain.ts | 77 --- .../hooks/useManager/useManager.ts | 13 - .../src/lib/cosmos-kit-jotai/index.ts | 8 - .../lib/cosmos-kit-jotai/store/ChainStore.ts | 186 ------- .../lib/cosmos-kit-jotai/store/constants.ts | 1 - .../src/lib/cosmos-kit-jotai/store/utils.ts | 79 --- .../store/walletManagerFactory.ts | 54 -- apps/deploy-web/src/pages/_app.tsx | 3 +- package-lock.json | 370 ------------- 25 files changed, 1 insertion(+), 2403 deletions(-) delete mode 100644 apps/deploy-web/src/chains/akash-sandbox.ts delete mode 100644 apps/deploy-web/src/chains/akash-testnet.ts delete mode 100644 apps/deploy-web/src/chains/akash.ts delete mode 100644 apps/deploy-web/src/chains/index.ts delete mode 100644 apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.spec.tsx delete mode 100644 apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.spec.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/components/ModalWrapper/ModalWrapper.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletListView.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.spec.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/context/ChainStoreProvider.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.spec.tsx delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.ts delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useManager/useManager.ts delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/index.ts delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/store/ChainStore.ts delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/store/constants.ts delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/store/utils.ts delete mode 100644 apps/deploy-web/src/lib/cosmos-kit-jotai/store/walletManagerFactory.ts diff --git a/apps/deploy-web/env/.env b/apps/deploy-web/env/.env index 62c314afb4..2625ced6ae 100644 --- a/apps/deploy-web/env/.env +++ b/apps/deploy-web/env/.env @@ -2,7 +2,6 @@ AUTH0_AUDIENCE=https://console-api.akash.network AUTH0_SCOPE=openid profile email offline_access NEXT_PUBLIC_SENTRY_DSN="https://2d6f725d1cd34086995df50a5d7192f0@o877251.ingest.sentry.io/4504656428204032" -NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID="2b2b3e1d953d33bd3b3e2c864edd2dea" NEXT_PUBLIC_SENTRY_APPLICATION_KEY="AKASH-CONSOLE-WEB" NEXT_PUBLIC_REDIRECT_URI='https://console.akash.network/new-deployment' diff --git a/apps/deploy-web/package.json b/apps/deploy-web/package.json index dc708a89c7..b324efc86c 100644 --- a/apps/deploy-web/package.json +++ b/apps/deploy-web/package.json @@ -42,18 +42,12 @@ "@cosmjs/math": "~0.38.0", "@cosmjs/proto-signing": "~0.38.0", "@cosmjs/stargate": "~0.38.0", - "@cosmos-kit/core": "^2.18.1", - "@cosmos-kit/cosmos-extension-metamask": "~0.15.1", - "@cosmos-kit/cosmostation-extension": "~2.18.1", - "@cosmos-kit/keplr": "~2.17.1", - "@cosmos-kit/react": "^2.24.1", "@emotion/cache": "^11.7.1", "@emotion/css": "^11.7.1", "@emotion/react": "^11.11.0", "@emotion/server": "^11.4.0", "@emotion/styled": "^11.8.1", "@hookform/resolvers": "^3.9.0", - "@interchain-ui/react": "^1.26.3", "@marsidev/react-turnstile": "^1.1.0", "@monaco-editor/react": "^4.6.0", "@mui/icons-material": "^5.11.11", @@ -74,7 +68,6 @@ "@xterm/addon-fit": "^0.11.0", "@xterm/xterm": "^6.0.0", "axios": "^1.7.2", - "chain-registry": "^1.69.31", "clsx": "^2.0.0", "cobe": "^2.0.1", "cockatiel": "^3.2.1", @@ -123,7 +116,6 @@ "@akashnetwork/docker": "*", "@akashnetwork/net": "*", "@akashnetwork/releaser": "*", - "@chain-registry/types": "^0.50.12", "@cosmjs/amino": "~0.38.0", "@faker-js/faker": "^9.4.0", "@next/bundle-analyzer": "^15.5.18", diff --git a/apps/deploy-web/src/chains/akash-sandbox.ts b/apps/deploy-web/src/chains/akash-sandbox.ts deleted file mode 100644 index abc1e37810..0000000000 --- a/apps/deploy-web/src/chains/akash-sandbox.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { netConfig } from "@akashnetwork/net"; -import type { AssetList, Chain } from "@chain-registry/types"; - -import { akash, akashAssetList } from "./akash"; - -export const akashSandbox: Chain = { - ...akash, - chain_id: netConfig.mapped("sandbox"), - network_type: "devnet", - chain_name: "akash-sandbox", - pretty_name: "Akash-Sandbox", - apis: { - rpc: [{ address: netConfig.getBaseRpcUrl("sandbox"), provider: "ovrclk" }], - rest: [{ address: netConfig.getBaseAPIUrl("sandbox"), provider: "ovrclk" }] - } -}; - -export const akashSandboxAssetList: AssetList = { ...akashAssetList, chain_name: "akash-sandbox", assets: [...akashAssetList.assets] }; diff --git a/apps/deploy-web/src/chains/akash-testnet.ts b/apps/deploy-web/src/chains/akash-testnet.ts deleted file mode 100644 index 390e2237fb..0000000000 --- a/apps/deploy-web/src/chains/akash-testnet.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { netConfig } from "@akashnetwork/net"; -import type { AssetList, Chain } from "@chain-registry/types"; - -import { akash, akashAssetList } from "./akash"; - -export const akashTestnet: Chain = { - ...akash, - chain_id: safe(() => netConfig.mapped("testnet")) ?? "testnet", - network_type: "testnet", - chain_name: "akash-testnet", - pretty_name: "Akash-Testnet", - apis: { - rpc: [{ address: safe(() => netConfig.getBaseRpcUrl("testnet")) ?? "", provider: "ovrclk" }], - rest: [{ address: safe(() => netConfig.getBaseAPIUrl("testnet")) ?? "", provider: "ovrclk" }] - } -}; - -export const akashTestnetAssetList: AssetList = { ...akashAssetList, chain_name: "akash-testnet", assets: [...akashAssetList.assets] }; - -function safe any>(fn: T): ReturnType | null { - try { - return fn(); - } catch { - return null; - } -} diff --git a/apps/deploy-web/src/chains/akash.ts b/apps/deploy-web/src/chains/akash.ts deleted file mode 100644 index 5b5cdd2f81..0000000000 --- a/apps/deploy-web/src/chains/akash.ts +++ /dev/null @@ -1,522 +0,0 @@ -import type { Chain } from "@chain-registry/types"; -export { default as akashAssetList } from "chain-registry/mainnet/akash/assets"; - -export const akash: Chain = { - $schema: "../chain.schema.json", - chain_name: "akash", - status: "live", - network_type: "mainnet", - website: "https://akash.network/", - pretty_name: "Akash", - chain_type: "cosmos", - chain_id: "akashnet-2", - bech32_prefix: "akash", - daemon_name: "akash", - node_home: "$HOME/.akash", - slip44: 118, - fees: { - fee_tokens: [ - { - denom: "uakt", - fixed_min_gas_price: 0.00025, - low_gas_price: 0.00025, - average_gas_price: 0.0025, - high_gas_price: 0.025 - } - ] - }, - staking: { - staking_tokens: [ - { - denom: "uakt" - } - ] - }, - codebase: { - git_repo: "https://github.com/akash-network/node/", - recommended_version: "v0.36.0", - compatible_versions: ["v0.36.0"], - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.36.0/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.36.0/akash_linux_arm64.zip" - }, - consensus: { - type: "cometbft", - version: "v0.34.27", - repo: "https://github.com/akash-network/cometbft", - tag: "v0.34.27-akash" - }, - genesis: { - genesis_url: "https://raw.githubusercontent.com/akash-network/net/master/mainnet/genesis.json" - }, - versions: [ - { - name: "v0.22.0", - recommended_version: "v0.22.7", - compatible_versions: ["v0.22.7"], - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.22.7/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.22.7/akash_linux_arm64.zip" - }, - next_version_name: "v0.24.0" - }, - { - name: "v0.24.0", - recommended_version: "v0.24.0", - compatible_versions: ["v0.24.0"], - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.24.0/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.24.0/akash_linux_arm64.zip" - }, - next_version_name: "v0.26.0" - }, - { - name: "v0.26.0", - recommended_version: "v0.26.2", - compatible_versions: ["v0.26.1", "v0.26.2"], - proposal: 231, - height: 12992204, - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.26.2/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.26.2/akash_linux_arm64.zip" - }, - next_version_name: "v0.28.0" - }, - { - name: "v0.28.0", - recommended_version: "v0.28.2", - compatible_versions: ["v0.28.2"], - proposal: 237, - height: 13759618, - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.28.2/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.28.2/akash_linux_arm64.zip" - }, - next_version_name: "v0.30.0" - }, - { - name: "v0.30.0", - recommended_version: "v0.30.0", - compatible_versions: ["v0.30.0"], - proposal: 238, - height: 1388074, - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.30.0/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.30.0/akash_linux_arm64.zip" - }, - next_version_name: "v0.32.0" - }, - { - name: "v0.32.0", - recommended_version: "v0.32.1", - compatible_versions: ["v0.32.1"], - proposal: 249, - height: 15414427, - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.32.1/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.32.1238/akash_linux_arm64.zip" - }, - consensus: { - type: "cometbft", - version: "v0.34.27", - repo: "https://github.com/akash-network/cometbft", - tag: "v0.34.27-akash" - }, - next_version_name: "v0.34.0", - sdk: { - type: "cosmos", - version: "v0.45.16" - }, - ibc: { - type: "go", - version: "v4.4.2" - } - }, - { - name: "v0.34.0", - recommended_version: "v0.34.1", - compatible_versions: ["v0.34.1"], - proposal: 256, - height: 16133283, - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.34.1/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.34.1/akash_linux_arm64.zip" - }, - consensus: { - type: "cometbft", - version: "v0.34.27", - repo: "https://github.com/akash-network/cometbft", - tag: "v0.34.27-akash" - }, - next_version_name: "v0.36.0", - sdk: { - type: "cosmos", - version: "v0.45.16" - }, - ibc: { - type: "go", - version: "v4.6.0" - } - }, - { - name: "v0.36.0", - recommended_version: "v0.36.0", - compatible_versions: ["v0.36.0"], - proposal: 257, - height: 16708237, - binaries: { - "linux/amd64": "https://github.com/akash-network/node/releases/download/v0.36.0/akash_linux_amd64.zip", - "linux/arm64": "https://github.com/akash-network/node/releases/download/v0.36.0/akash_linux_arm64.zip" - }, - consensus: { - type: "cometbft", - version: "v0.34.27", - repo: "https://github.com/akash-network/cometbft", - tag: "v0.34.27-akash" - }, - sdk: { - type: "cosmos", - version: "v0.45.16" - }, - ibc: { - type: "go", - version: "v4.6.0" - } - } - ], - sdk: { - type: "cosmos", - version: "v0.45.16" - }, - ibc: { - type: "go", - version: "v4.6.0" - } - }, - logo_URIs: { - png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/akash/images/akt.png", - svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/akash/images/akt.svg" - }, - description: "Akash is open-source Supercloud that lets users buy and sell computing resources securely and efficiently. Purpose-built for public utility.", - peers: { - seeds: [ - { - id: "4acf579e2744268f834c713e894850995bbf0ffa", - address: "50.18.31.225:26656" - }, - { - id: "86afe23f116ba4754a19819a55d153008eb74b48", - address: "15.164.87.75:26656" - }, - { - id: "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0", - address: "seeds.polkachu.com:12856", - provider: "Polkachu" - }, - { - id: "20e1000e88125698264454a884812746c2eb4807", - address: "seeds.lavenderfive.com:12856", - provider: "Lavender.Five Nodes 🐝" - }, - { - id: "ebc272824924ea1a27ea3183dd0b9ba713494f83", - address: "akash-mainnet-seed.autostake.com:26696", - provider: "AutoStake 🛡️ Slash Protected" - }, - { - id: "5e37aefd2a0b9d036b1609a45d6487606da0204b", - address: "rpc.ny.akash.farm:26656" - }, - { - id: "47f7b7a021497ad7a338ea041f19a1a11ae06795", - address: "rpc.la.akash.farm:26656" - }, - { - id: "8542cd7e6bf9d260fef543bc49e59be5a3fa9074", - address: "seed.publicnode.com:26656", - provider: "Allnodes ⚡️ Nodes & Staking" - }, - { - id: "9aa4c9097c818871e45aaca4118a9fe5e86c60e2", - address: "seed-akash-01.stakeflow.io:1506", - provider: "Stakeflow" - }, - { - id: "61686e588f0af938484579adbc2093adff06c7aa", - address: "europlots.com:26656" - }, - { - id: "c28827cb96c14c905b127b92065a3fb4cd77d7f6", - address: "seeds.whispernode.com:12856", - provider: "WhisperNode 🤐" - } - ], - persistent_peers: [ - { - id: "4acf579e2744268f834c713e894850995bbf0ffa", - address: "50.18.31.225:26656" - }, - { - id: "86afe23f116ba4754a19819a55d153008eb74b48", - address: "15.164.87.75:26656" - }, - { - id: "20180c45451739668f6e272e007818139dba31e7", - address: "88.198.62.198:2020" - }, - { - id: "1bfbbf77beeb2c1ace50443478035a255a7e510f", - address: "136.24.44.100:26656" - }, - { - id: "ebc272824924ea1a27ea3183dd0b9ba713494f83", - address: "akash-mainnet-peer.autostake.com:26696", - provider: "AutoStake 🛡️ Slash Protected" - }, - { - id: "9aa4c9097c818871e45aaca4118a9fe5e86c60e2", - address: "peer-akash-01.stakeflow.io:1506", - provider: "Stakeflow" - }, - { - id: "73ef1c0f9bc77fd925decf7fa41f22a35b5dc76d", - address: "akash.declab.pro:26603", - provider: "Decloud Nodes Lab" - } - ] - }, - apis: { - rpc: [ - { - address: "https://rpc.akash.forbole.com:443", - provider: "forbole" - }, - { - address: "https://rpc-akash.ecostake.com:443", - provider: "ecostake" - }, - { - address: "https://rpc.lavenderfive.com:443/akash", - provider: "Lavender.Five Nodes" - }, - { - address: "https://akash-rpc.polkachu.com", - provider: "Polkachu" - }, - { - address: "http://akash.c29r3.xyz:80/rpc", - provider: "c29r3" - }, - { - address: "https://akash-rpc.kleomedes.network", - provider: "Kleomedes" - }, - { - address: "https://akash-mainnet-rpc.cosmonautstakes.com:443", - provider: "Cosmonaut Stakes" - }, - { - address: "https://akash-rpc.w3coins.io", - provider: "w3coins" - }, - { - address: "https://akash-rpc.publicnode.com:443", - provider: "Allnodes ⚡️ Nodes & Staking" - }, - { - address: "https://akash.declab.pro:26601", - provider: "Decloud Nodes Lab" - }, - { - address: "https://rpc.akash.bronbro.io:443", - provider: "Bro_n_Bro" - } - ], - rest: [ - { - address: "https://api.akash.forbole.com:443", - provider: "forbole" - }, - { - address: "https://rest-akash.ecostake.com", - provider: "ecostake" - }, - { - address: "https://rest.lavenderfive.com:443/akash", - provider: "Lavender.Five Nodes" - }, - { - address: "https://akash-api.polkachu.com", - provider: "Polkachu" - }, - { - address: "https://api-akash.cosmos-spaces.cloud", - provider: "Cosmos Spaces" - }, - { - address: "https://api-akash-ia.cosmosia.notional.ventures", - provider: "Notional" - }, - { - address: "https://akash.c29r3.xyz:443/api", - provider: "c29r3" - }, - { - address: "https://akash-mainnet-lcd.autostake.com:443", - provider: "AutoStake 🛡️ Slash Protected" - }, - { - address: "https://akash-api.kleomedes.network", - provider: "Kleomedes" - }, - { - address: "https://api-akash-01.stakeflow.io", - provider: "Stakeflow" - }, - { - address: "https://akash-mainnet-rest.cosmonautstakes.com:443", - provider: "Cosmonaut Stakes" - }, - { - address: "https://akash-api.w3coins.io", - provider: "w3coins" - }, - { - address: "https://akash-rest.publicnode.com", - provider: "Allnodes ⚡️ Nodes & Staking" - }, - { - address: "https://akash-api.validatornode.com", - provider: "ValidatorNode" - }, - { - address: "https://api-akash.whispernode.com:443", - provider: "WhisperNode 🤐" - }, - { - address: "https://public.stakewolle.com/cosmos/akash/rest", - provider: "Stakewolle" - }, - { - address: "https://akash.declab.pro:443", - provider: "Decloud Nodes Lab" - }, - { - address: "https://lcd.akash.bronbro.io:443", - provider: "Bro_n_Bro" - } - ], - grpc: [ - { - address: "grpc-akash-ia.cosmosia.notional.ventures:443", - provider: "Notional" - }, - { - address: "akash.lavenderfive.com:443", - provider: "Lavender.Five Nodes 🐝" - }, - { - address: "akash-grpc.polkachu.com:12890", - provider: "Polkachu" - }, - { - address: "akash-mainnet-grpc.autostake.com:443", - provider: "AutoStake 🛡️ Slash Protected" - }, - { - address: "grpc-akash.cosmos-spaces.cloud:1110", - provider: "Cosmos Spaces" - }, - { - address: "grpc-akash-01.stakeflow.io:1502", - provider: "Stakeflow" - }, - { - address: "akash-grpc.w3coins.io:12890", - provider: "w3coins" - }, - { - address: "akash-grpc.publicnode.com:443", - provider: "Allnodes ⚡️ Nodes & Staking" - }, - { - address: "https://akash.declab.pro:9001", - provider: "Decloud Nodes Lab" - }, - { - address: "grpc-akash.whispernode.com:443", - provider: "WhisperNode 🤐" - }, - { - address: "https://grpc.akash.bronbro.io:443", - provider: "Bro_n_Bro" - } - ] - }, - explorers: [ - { - kind: "ezstaking", - url: "https://ezstaking.app/akash", - tx_page: "https://ezstaking.app/akash/txs/${txHash}", - account_page: "https://ezstaking.app/akash/account/${accountAddress}" - }, - { - kind: "mintscan", - url: "https://www.mintscan.io/akash", - tx_page: "https://www.mintscan.io/akash/transactions/${txHash}", - account_page: "https://www.mintscan.io/akash/accounts/${accountAddress}" - }, - { - kind: "ping.pub", - url: "https://ping.pub/akash-network", - tx_page: "https://ping.pub/akash-network/tx/${txHash}" - }, - { - kind: "staking-explorer.com", - url: "https://staking-explorer.com/explorer/akash", - tx_page: "https://staking-explorer.com/transaction.php?chain=akash&tx=${txHash}", - account_page: "https://staking-explorer.com/account.php?chain=akash&addr=${accountAddress}" - }, - { - kind: "atomscan", - url: "https://atomscan.com/akash", - tx_page: "https://atomscan.com/akash/transactions/${txHash}", - account_page: "https://atomscan.com/akash/accounts/${accountAddress}" - }, - { - kind: "akash-stats", - url: "https://stats.akash.network/blocks", - tx_page: "https://stats.akash.network/transactions/${txHash}" - }, - { - kind: "Stakeflow", - url: "https://stakeflow.io/akash", - account_page: "https://stakeflow.io/akash/accounts/${accountAddress}" - }, - { - kind: "ValidatorNode", - url: "https://explorer.validatornode.com/akash-network", - tx_page: "https://explorer.validatornode.com/akash-network/tx/${txHash}" - }, - { - kind: "Decloud Nodes Lab", - url: "https://explorer.declab.pro/Akash", - tx_page: "https://explorer.declab.pro/Akash/tx/${txHash}" - }, - { - kind: "WhisperNode 🤐", - url: "https://mainnet.whispernode.com/akash", - tx_page: "https://mainnet.whispernode.com/akash/tx/${txHash}", - account_page: "https://mainnet.whispernode.com/akash/account/${accountAddress}" - } - ], - images: [ - { - png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/akash/images/akt.png", - svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/akash/images/akt.svg", - theme: { - primary_color_hex: "#bc342c" - } - } - ] -}; diff --git a/apps/deploy-web/src/chains/index.ts b/apps/deploy-web/src/chains/index.ts deleted file mode 100644 index 53257e7e60..0000000000 --- a/apps/deploy-web/src/chains/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Chain } from "@chain-registry/types"; - -import { akash, akashAssetList } from "./akash"; -import { akashSandbox, akashSandboxAssetList } from "./akash-sandbox"; -import { akashTestnet, akashTestnetAssetList } from "./akash-testnet"; - -export { akash, akashSandbox, akashTestnet, akashAssetList, akashSandboxAssetList, akashTestnetAssetList }; -export const chains: Chain[] = [akash, akashSandbox, akashTestnet].filter((c): c is Chain => c !== null); -export const assetLists = [akashAssetList, akashSandboxAssetList, ...(akashTestnet ? [akashTestnetAssetList] : [])]; diff --git a/apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.spec.tsx b/apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.spec.tsx deleted file mode 100644 index b1136e7b63..0000000000 --- a/apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.spec.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { describe, expect, it, vi } from "vitest"; - -import { CustomChainProvider, DEPENDENCIES } from "./CustomChainProvider"; - -import { render, screen } from "@testing-library/react"; -import { MockComponents } from "@tests/unit/mocks"; - -describe(CustomChainProvider.name, () => { - it("renders children", () => { - setup(); - - expect(screen.getByTestId("child")).toBeInTheDocument(); - }); - - it("renders ModalWrapper", () => { - const { dependencies } = setup(); - - expect(dependencies.ModalWrapper).toHaveBeenCalled(); - }); - - it("passes walletsRegistry to ChainStoreProvider", () => { - const { dependencies } = setup(); - - const call = vi.mocked(dependencies.ChainStoreProvider).mock.calls[0][0]; - expect(call.walletsRegistry).toEqual([ - { names: ["keplr-extension", "keplr-mobile"], loader: expect.any(Function) }, - { names: ["cosmostation-extension"], loader: expect.any(Function) }, - { names: ["cosmos-extension-metamask"], loader: expect.any(Function) } - ]); - }); - - it("passes walletManagerOptions with chains and config to ChainStoreProvider", () => { - const { dependencies } = setup(); - - const call = vi.mocked(dependencies.ChainStoreProvider).mock.calls[0][0]; - expect(call.walletManagerOptions).toEqual( - expect.objectContaining({ - chains: expect.any(Array), - assetList: expect.any(Array), - sessionOptions: expect.objectContaining({ duration: 31_556_926_000 }), - walletConnectOptions: expect.objectContaining({ - signClient: expect.objectContaining({ projectId: expect.any(String) }) - }), - endpointOptions: expect.objectContaining({ isLazy: true }), - signerOptions: expect.objectContaining({ - preferredSignType: expect.any(Function) - }) - }) - ); - }); - - it("initializes ChainStoreInitializer with selected network chain name", () => { - const chainRegistryName = "akashnet-2"; - const { dependencies } = setup({ chainRegistryName }); - - expect(dependencies.ChainStoreInitializer).toHaveBeenCalledWith(expect.objectContaining({ chainName: chainRegistryName }), expect.anything()); - }); - - it("uses network from useServices to determine chain name", () => { - const chainRegistryName = "sandbox-chain"; - const { dependencies } = setup({ chainRegistryName }); - - expect(dependencies.useServices).toHaveBeenCalled(); - expect(dependencies.ChainStoreInitializer).toHaveBeenCalledWith(expect.objectContaining({ chainName: chainRegistryName }), expect.anything()); - }); - - function setup(input?: { chainRegistryName?: string }) { - const useSelectedNetwork = vi.fn(() => ({ - chainRegistryName: input?.chainRegistryName ?? "akashnet-2" - })); - - const dependencies = MockComponents(DEPENDENCIES, { - useServices: vi.fn(() => ({ - networkStore: { useSelectedNetwork } - })) as unknown as typeof DEPENDENCIES.useServices - }); - - render( - -
- - ); - - return { dependencies, useSelectedNetwork }; - } -}); diff --git a/apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.tsx b/apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.tsx deleted file mode 100644 index bd4a55ccc8..0000000000 --- a/apps/deploy-web/src/context/CustomChainProvider/CustomChainProvider.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { GasPrice } from "@cosmjs/stargate"; - -import { assetLists, chains } from "@src/chains"; -import type { ChainStoreProviderProps, WalletsRegistry } from "@src/lib/cosmos-kit-jotai"; -import { ChainStoreInitializer, ChainStoreProvider, CURRENT_WALLET_KEY, ModalWrapper } from "@src/lib/cosmos-kit-jotai"; -import { registry } from "@src/utils/customRegistry"; -import { useServices } from "../ServicesProvider"; - -type Props = { - children: React.ReactNode; - dependencies?: typeof DEPENDENCIES; -}; - -export const DEPENDENCIES = { - ChainStoreProvider, - ModalWrapper, - ChainStoreInitializer, - useServices -}; - -/** - * The order of entries is important here. - * Wallets are rendered in the order they are specified in this registry. - * Each entry maps wallet names to a shared loader so each package is imported only once. - */ -const WALLETS_PROVIDERS: WalletsRegistry = [ - { names: ["keplr-extension", "keplr-mobile"], loader: () => import("@cosmos-kit/keplr") }, - { names: ["cosmostation-extension"], loader: () => import("@cosmos-kit/cosmostation-extension") }, - { names: ["cosmos-extension-metamask"], loader: () => import("@cosmos-kit/cosmos-extension-metamask") } -]; - -const walletManagerOptions: ChainStoreProviderProps["walletManagerOptions"] = { - chains, - assetList: assetLists, - sessionOptions: { - duration: 31_556_926_000, // 1 year - callback: () => { - window.localStorage.removeItem(CURRENT_WALLET_KEY); - window.location.reload(); - } - }, - walletConnectOptions: { - signClient: { - projectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID as string - } - }, - endpointOptions: { - isLazy: true, - endpoints: { - ...Object.fromEntries(chains.map(c => [c.chain_name, { rest: [], rpc: [] }])) - } - }, - signerOptions: { - preferredSignType: () => "direct" as const, - // @ts-expect-error - Mixed @cosmjs/proto-signing library versions. Need to align them - signingStargate: () => ({ - registry: registry, - gasPrice: GasPrice.fromString("0.025uakt") - }) - } -}; - -export function CustomChainProvider({ children, dependencies: d = DEPENDENCIES }: Props) { - return ( - - - - {children} - - ); -} - -function InitializeChainStoreForSelectedNetwork({ dependencies: d = DEPENDENCIES }: Pick) { - const { networkStore } = d.useServices(); - const selectedNetwork = networkStore.useSelectedNetwork(); - - return ; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.spec.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.spec.tsx deleted file mode 100644 index 54e737f400..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.spec.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { SnackbarProvider } from "notistack"; -import { describe, expect, it, vi } from "vitest"; -import { mock } from "vitest-mock-extended"; - -import type { ChainStore } from "../../store/ChainStore"; -import type { DEPENDENCIES } from "./ChainStoreInitializer"; -import { ChainStoreInitializer } from "./ChainStoreInitializer"; - -import { render } from "@testing-library/react"; - -describe(ChainStoreInitializer.name, () => { - it("calls chainStore.initialize on mount", () => { - const { chainStore } = setup(); - - expect(chainStore.initialize).toHaveBeenCalledOnce(); - }); - - it("calls chainStore.cleanup on unmount", () => { - const { chainStore, unmount } = setup(); - - unmount(); - - expect(chainStore.cleanup).toHaveBeenCalledOnce(); - }); - - function setup() { - const chainStore = mock(); - const dependencies: typeof DEPENDENCIES = { - useChain: vi.fn(() => mock>({ message: undefined, isWalletError: false })), - useChainStore: () => chainStore - }; - - const { unmount } = render( - - - - ); - - return { chainStore, unmount }; - } -}); diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.tsx deleted file mode 100644 index 780da7f079..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ChainStoreInitializer/ChainStoreInitializer.tsx +++ /dev/null @@ -1,53 +0,0 @@ -"use client"; - -import "@interchain-ui/react/globalStyles"; -import "@interchain-ui/react/styles"; - -import { useEffect, useRef } from "react"; -import { Snackbar } from "@akashnetwork/ui/components"; -import { useSnackbar } from "notistack"; - -import { useChainStore } from "../../context/ChainStoreProvider"; -import { useChain } from "../../hooks/useChain/useChain"; - -type Props = { - chainName: string; - dependencies?: typeof DEPENDENCIES; -}; - -export const DEPENDENCIES = { - useChain, - useChainStore -}; - -export function ChainStoreInitializer({ chainName, dependencies = DEPENDENCIES }: Props) { - const { enqueueSnackbar } = useSnackbar(); - const { message, isWalletError } = dependencies.useChain(chainName); - const chainStore = dependencies.useChainStore(); - const lastShownErrorRef = useRef(undefined); - - useEffect(() => { - chainStore.initialize(); - return () => { - chainStore.cleanup(); - }; - }, []); - - useEffect(() => { - const isProposalExpired = isWalletError && message?.toLowerCase().includes("proposal expired"); - - if (isProposalExpired && lastShownErrorRef.current !== message) { - lastShownErrorRef.current = message; - enqueueSnackbar( - , - { variant: "warning", autoHideDuration: 6000 } - ); - } - - if (!isWalletError) { - lastShownErrorRef.current = undefined; - } - }, [isWalletError, message, enqueueSnackbar]); - - return null; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ModalWrapper/ModalWrapper.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ModalWrapper/ModalWrapper.tsx deleted file mode 100644 index df17685a22..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/ModalWrapper/ModalWrapper.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { useCallback } from "react"; -import { useAtomValue } from "jotai"; -import dynamic from "next/dynamic"; - -import { useChainStore } from "../../context/ChainStoreProvider"; - -const WalletModal = dynamic(() => import("../WalletModal/WalletModal").then(mod => mod.WalletModal), { ssr: false }); - -export function ModalWrapper() { - const chainStore = useChainStore(); - const isOpen = useAtomValue(chainStore.modalIsOpenAtom); - const walletRepo = useAtomValue(chainStore.modalWalletRepoAtom); - - const toggleOpen = useCallback( - (open: boolean) => { - chainStore.toggleModalOpen(open); - }, - [chainStore] - ); - - return ; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletListView.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletListView.tsx deleted file mode 100644 index 370315dc70..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletListView.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { useCallback, useEffect, useMemo, useState } from "react"; -import type { ChainWalletBase, Wallet } from "@cosmos-kit/core"; -import type { ConnectModalWalletListProps } from "@interchain-ui/react"; -import { ConnectModalHead, ConnectModalWalletList } from "@interchain-ui/react"; - -import { useChainStore } from "../../context/ChainStoreProvider"; - -function getWalletProp(wallet: Wallet) { - const { prettyName, mode, name, logo, mobileDisabled } = wallet; - return { - name, - prettyName, - logo: typeof logo === "object" ? logo.major : logo, - mobileDisabled: typeof mobileDisabled === "boolean" ? mobileDisabled : mobileDisabled(), - isMobile: mode === "wallet-connect" - }; -} - -function DynamicWalletList({ wallets, onClose }: { wallets: ChainWalletBase[]; onClose: () => void }) { - const chainStore = useChainStore(); - const [isLargeScreen, setIsLargeScreen] = useState(true); - - const onWalletClicked = useCallback( - async (wallet: ChainWalletBase) => { - chainStore.setSelectedWalletName(wallet.walletName); - await wallet.connect(wallet.walletStatus !== "NotExist"); - if (!["Rejected", "NotExist"].includes(wallet.walletStatus)) { - onClose(); - } - }, - [onClose, chainStore] - ); - - useEffect(() => { - const handleWindowResize = () => { - setIsLargeScreen(window.innerWidth >= 768); - }; - handleWindowResize(); - window.addEventListener("resize", handleWindowResize); - return () => { - window.removeEventListener("resize", handleWindowResize); - }; - }, []); - - const walletsData = useMemo( - () => - wallets - .sort((a, b) => { - if (a.walletInfo.mode !== "wallet-connect" && b.walletInfo.mode !== "wallet-connect") { - return 0; - } else if (a.walletInfo.mode !== "wallet-connect") { - return -1; - } else { - return 1; - } - }) - .map((wallet, i) => ({ - ...getWalletProp(wallet.walletInfo), - subLogo: wallet.walletInfo.mode === "wallet-connect" ? "walletConnect" : undefined, - btmLogo: typeof wallet.walletInfo.logo === "object" ? wallet.walletInfo.logo.minor : wallet.walletInfo.extends, - badge: ({ MetaMask: "SNAP" } as Record)[wallet.walletInfo.extends!], - shape: (i < 2 && isLargeScreen ? "square" : "list") as "square" | "list", - downloadUrl: "", - originalWallet: wallet - })), - [wallets, isLargeScreen] - ); - - return ; -} - -export function WalletListView({ onClose, wallets }: { onClose: () => void; wallets: ChainWalletBase[] }) { - const head = ; - const content = ; - return { head, content }; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.spec.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.spec.tsx deleted file mode 100644 index 8d5f9676dc..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.spec.tsx +++ /dev/null @@ -1,291 +0,0 @@ -/** - * We use vi.mock in these tests because this components are mostly copied from Cosmos Kit with some minor adjustments, - * and we don't want to change them too much. Hopefully, they eventually will be removed - */ - -import { type ReactNode, useEffect } from "react"; -import type { ChainWalletBase, WalletRepo } from "@cosmos-kit/core"; -import { WalletStatus } from "@cosmos-kit/core"; -import { createStore, Provider as JotaiProvider } from "jotai"; -import { beforeEach, describe, expect, it, vi } from "vitest"; - -import { ChainStoreProvider, useChainStore } from "../../context/ChainStoreProvider"; -import { ChainStore } from "../../store/ChainStore"; -import { WalletModal } from "./WalletModal"; - -import { fireEvent, render, screen } from "@testing-library/react"; - -vi.mock("@interchain-ui/react", () => ({ - ThemeProvider: ({ children }: { children: ReactNode }) => <>{children}, - ConnectModal: ({ isOpen, children, header, onClose }: { isOpen: boolean; children: ReactNode; header: ReactNode; onClose: () => void }) => - isOpen ? ( -
-
{header}
-
{children}
-
- ) : null, - ConnectModalHead: ({ title, onClose }: { title: string; onClose: () => void }) => ( -
- {title} -
- ), - ConnectModalWalletList: ({ - wallets, - onWalletItemClick - }: { - wallets: { originalWallet: ChainWalletBase; prettyName: string }[]; - onWalletItemClick: (w: ChainWalletBase) => void; - }) => ( -
    - {wallets.map(w => ( -
  • - -
  • - ))} -
- ) -})); - -vi.mock("@cosmos-kit/react", () => ({ - defaultModalViews: { - WalletList: vi.fn(() => ({ head: null, content: null })), - Connecting: vi.fn(() => ({ head: Connecting..., content: Please wait })), - Connected: vi.fn(() => ({ head: Connected, content: Success })), - Error: vi.fn(() => ({ head: Error, content: Failed })), - Rejected: vi.fn(() => ({ head: Rejected, content: User rejected })), - NotExist: vi.fn(() => ({ head: Not Found, content: Wallet not found })), - QRCode: vi.fn(() => ({ head: QR Code, content: Scan QR })) - } -})); - -describe(WalletModal.name, () => { - beforeEach(() => { - vi.clearAllMocks(); - }); - - it("does not render modal when closed", () => { - setup({ isOpen: false }); - - expect(screen.queryByTestId("connect-modal")).not.toBeInTheDocument(); - }); - - it("renders modal when open", () => { - setup({ isOpen: true }); - - expect(screen.getByTestId("connect-modal")).toBeInTheDocument(); - }); - - it("renders wallet list view by default", () => { - setup({ isOpen: true }); - - expect(screen.getByText("Select your wallet")).toBeInTheDocument(); - }); - - it("calls setOpen(false) when modal is closed", () => { - const setOpen = vi.fn(); - setup({ isOpen: true, setOpen }); - - fireEvent.click(screen.getByTestId("modal-close")); - - expect(setOpen).toHaveBeenCalledWith(false); - }); - - it("shows connected view when selected wallet is connected and modal opens", () => { - const wallet = createMockChainWallet("wallet-b", "Wallet B", WalletStatus.Connected); - const walletRepo = createMockWalletRepo([wallet]); - - setup({ - isOpen: true, - walletRepo, - selectedWalletName: "wallet-b" - }); - - expect(screen.getByText("Connected")).toBeInTheDocument(); - }); - - it("finds current wallet by matching selectedWalletNameAtom from Jotai store", () => { - const walletA = createMockChainWallet("wallet-a", "Wallet A", WalletStatus.Disconnected); - const walletB = createMockChainWallet("wallet-b", "Wallet B", WalletStatus.Connected); - const walletRepo = createMockWalletRepo([walletA, walletB]); - - setup({ - isOpen: true, - walletRepo, - selectedWalletName: "wallet-b" - }); - - expect(screen.getByText("Connected")).toBeInTheDocument(); - expect(screen.queryByText("Select your wallet")).not.toBeInTheDocument(); - }); - - it("disconnects wallet when closing during connection", () => { - const wallet = createMockChainWallet("keplr", "Keplr", WalletStatus.Connecting); - const walletRepo = createMockWalletRepo([wallet]); - - setup({ - isOpen: true, - walletRepo, - selectedWalletName: "keplr" - }); - - fireEvent.click(screen.getByTestId("modal-close")); - - expect(wallet.disconnect).toHaveBeenCalled(); - }); - - it("does not disconnect wallet when closing in connected state", () => { - const wallet = createMockChainWallet("keplr", "Keplr", WalletStatus.Connected); - const walletRepo = createMockWalletRepo([wallet]); - - setup({ - isOpen: true, - walletRepo, - selectedWalletName: "keplr" - }); - - fireEvent.click(screen.getByTestId("modal-close")); - - expect(wallet.disconnect).not.toHaveBeenCalled(); - }); - - describe("WalletListView", () => { - it("renders wallet names from walletRepo", () => { - const walletA = createMockChainWallet("wallet-a", "Wallet A", WalletStatus.Disconnected); - const walletB = createMockChainWallet("wallet-b", "Wallet B", WalletStatus.Disconnected); - const walletRepo = createMockWalletRepo([walletA, walletB]); - - setup({ isOpen: true, walletRepo }); - - expect(screen.getByText("Wallet A")).toBeInTheDocument(); - expect(screen.getByText("Wallet B")).toBeInTheDocument(); - }); - - it("sets selected wallet name in chain store when wallet is clicked", async () => { - const wallet = createMockChainWallet("keplr", "Keplr", WalletStatus.Disconnected); - const walletRepo = createMockWalletRepo([wallet]); - - let chainStore: ChainStore | null = null; - setup({ - isOpen: true, - walletRepo, - onRenderChainStore: store => { - chainStore = store; - } - }); - - fireEvent.click(screen.getByText("Keplr")); - await vi.waitFor(() => chainStore instanceof ChainStore); - - expect((chainStore as unknown as ChainStore).setSelectedWalletName).toHaveBeenCalledWith("keplr"); - }); - - it("calls wallet.connect when wallet is clicked", () => { - const wallet = createMockChainWallet("keplr", "Keplr", WalletStatus.Disconnected); - const walletRepo = createMockWalletRepo([wallet]); - - setup({ isOpen: true, walletRepo }); - - fireEvent.click(screen.getByText("Keplr")); - - expect(wallet.connect).toHaveBeenCalledWith(true); - }); - - it("passes false to connect when wallet status is NotExist", () => { - const wallet = createMockChainWallet("keplr", "Keplr", WalletStatus.NotExist); - const walletRepo = createMockWalletRepo([wallet]); - - setup({ isOpen: true, walletRepo }); - - fireEvent.click(screen.getByText("Keplr")); - - expect(wallet.connect).toHaveBeenCalledWith(false); - }); - - it("sorts non-wallet-connect wallets before wallet-connect wallets", () => { - const wcWallet = createMockChainWallet("wc-wallet", "WC Wallet", WalletStatus.Disconnected, "wallet-connect"); - const extensionWallet = createMockChainWallet("ext-wallet", "Extension Wallet", WalletStatus.Disconnected, "extension"); - const walletRepo = createMockWalletRepo([wcWallet, extensionWallet]); - - setup({ isOpen: true, walletRepo }); - - const buttons = screen.getAllByRole("button", { name: /Wallet/ }); - expect(buttons[0]).toHaveTextContent("Extension Wallet"); - expect(buttons[1]).toHaveTextContent("WC Wallet"); - }); - }); - - function setup(input: { - isOpen: boolean; - setOpen?: (open: boolean) => void; - walletRepo?: WalletRepo; - selectedWalletName?: string; - onRenderChainStore?: (chainStore: ChainStore) => void; - }) { - const jotaiStore = createStore(); - const walletRepo = input.walletRepo ?? createMockWalletRepo([]); - - render( - - - - - - - - ); - - return { jotaiStore }; - } -}); - -function MockChainStoreProvider({ - children, - selectedWalletName, - onRenderChainStore -}: { - children: ReactNode; - selectedWalletName?: string; - onRenderChainStore?: (chainStore: ChainStore) => void; -}) { - const chainStore = useChainStore(); - - if (selectedWalletName) { - chainStore.setSelectedWalletName(selectedWalletName); - } - - useEffect(() => { - if (onRenderChainStore) { - vi.spyOn(chainStore, "setSelectedWalletName"); - onRenderChainStore(chainStore); - } - }, [chainStore, onRenderChainStore]); - return <>{children}; -} - -function createMockChainWallet(name: string, prettyName: string, status: WalletStatus, mode: string = "extension"): ChainWalletBase { - return { - walletName: name, - walletStatus: status, - message: undefined, - client: undefined, - connect: vi.fn().mockResolvedValue(undefined), - disconnect: vi.fn().mockResolvedValue(undefined), - walletInfo: { - name, - prettyName, - mode, - logo: "https://example.com/logo.png", - mobileDisabled: false - } - } as unknown as ChainWalletBase; -} - -function createMockWalletRepo(wallets: ChainWalletBase[]): WalletRepo { - return { - wallets, - platformEnabledWallets: wallets, - setCallbackOptions: vi.fn() - } as unknown as WalletRepo; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.tsx deleted file mode 100644 index 248faab174..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/components/WalletModal/WalletModal.tsx +++ /dev/null @@ -1,178 +0,0 @@ -import type React from "react"; -import { useCallback, useEffect, useMemo, useState } from "react"; -import type { ChainWalletBase, ModalOptions, WalletModalProps, WalletViewProps } from "@cosmos-kit/core"; -import { ModalView, State, WalletStatus } from "@cosmos-kit/core"; -import { defaultModalViews } from "@cosmos-kit/react"; -import type { ThemeProviderProps } from "@interchain-ui/react"; -import { ConnectModal, ThemeProvider } from "@interchain-ui/react"; -import { useAtomValue } from "jotai"; - -import { useChainStore } from "../../context/ChainStoreProvider"; -import { WalletListView } from "./WalletListView"; - -const MODAL_VIEWS = { ...defaultModalViews, WalletList: WalletListView }; - -type ModalCustomizationProps = { - modalContainerClassName?: string; - modalContentClassName?: string; - modalChildrenClassName?: string; - modalContentStyles?: React.CSSProperties; -}; - -type ThemeCustomizationProps = ModalCustomizationProps & Pick; - -type WalletModalComponentProps = WalletModalProps & - ThemeCustomizationProps & { - modalOptions?: ModalOptions; - includeAllWalletsOnMobile?: boolean; - }; - -/** - * This can be removed when this issue is resolved: - * https://github.com/hyperweb-io/cosmos-kit/issues/599 - */ -export function WalletModal({ - isOpen, - setOpen, - walletRepo, - modalOptions, - includeAllWalletsOnMobile, - overrides, - themeDefs, - customTheme, - defaultTheme, - modalContainerClassName, - modalContentClassName, - modalChildrenClassName, - modalContentStyles -}: WalletModalComponentProps) { - const chainStore = useChainStore(); - const [currentView, setCurrentView] = useState(ModalView.WalletList); - const [qrState, setQRState] = useState(State.Init); - const [qrMsg, setQRMsg] = useState(""); - - const disconnectOptions = { - walletconnect: { - removeAllPairings: modalOptions?.mobile?.displayQRCodeEveryTime - } - }; - - walletRepo?.setCallbackOptions({ - beforeConnect: { disconnect: disconnectOptions } - }); - - const selectedWalletRepoName = useAtomValue(chainStore.selectedWalletNameAtom); - const current: ChainWalletBase | undefined = walletRepo?.wallets.find(w => w.walletName === selectedWalletRepoName); - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (current?.client as any)?.setActions?.({ - qrUrl: { - state: setQRState, - message: setQRMsg - } - }); - - const walletStatus = current?.walletStatus; - const message = current?.message; - - useEffect(() => { - if (isOpen) { - switch (walletStatus) { - case WalletStatus.Connecting: - if (qrState === State.Init) { - setCurrentView(ModalView.Connecting); - } else { - setCurrentView(ModalView.QRCode); - } - break; - case WalletStatus.Connected: - setCurrentView(ModalView.Connected); - break; - case WalletStatus.Error: - if (qrState === State.Init) { - setCurrentView(ModalView.Error); - } else { - setCurrentView(ModalView.QRCode); - } - break; - case WalletStatus.Rejected: - setCurrentView(ModalView.Rejected); - break; - case WalletStatus.NotExist: - setCurrentView(prev => (prev === ModalView.Connected ? ModalView.WalletList : ModalView.NotExist)); - break; - case WalletStatus.Disconnected: - setCurrentView(ModalView.WalletList); - break; - default: - setCurrentView(ModalView.WalletList); - break; - } - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [qrState, walletStatus, qrMsg, message]); - - useEffect(() => { - if (!isOpen) return; - if (walletStatus === "Connected") { - setCurrentView(ModalView.Connected); - } else { - setCurrentView(ModalView.WalletList); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [isOpen]); - - const onCloseModal = useCallback(() => { - setOpen(false); - if (walletStatus === "Connecting") { - current?.disconnect(false, disconnectOptions); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [setOpen, walletStatus, current]); - - const onReturn = useCallback(() => { - setCurrentView(ModalView.WalletList); - }, []); - - const wallets = useMemo( - () => (!includeAllWalletsOnMobile ? walletRepo?.platformEnabledWallets : walletRepo?.wallets), - [walletRepo, includeAllWalletsOnMobile] - ); - - const modalView = useMemo(() => { - if (currentView === ModalView.WalletList) { - return MODAL_VIEWS.WalletList({ - onClose: onCloseModal, - wallets: wallets || [] - }); - } - - const getImplementation = MODAL_VIEWS[currentView] as ((props: WalletViewProps) => { head: React.ReactNode; content: React.ReactNode }) | undefined; - if (!current || !getImplementation) { - return { head: null, content: null }; - } - return getImplementation({ - onClose: onCloseModal, - onReturn, - wallet: current, - options: modalOptions - }); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [currentView, onReturn, onCloseModal, current, qrState, walletStatus, walletRepo, wallets, message, qrMsg]); - - return ( - - - {modalView.content} - - - ); -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/context/ChainStoreProvider.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/context/ChainStoreProvider.tsx deleted file mode 100644 index f4eaab59b2..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/context/ChainStoreProvider.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { createContext, useContext, useMemo } from "react"; -import { useStore } from "jotai"; - -import type { ChainStoreOptions } from "../store/ChainStore"; -import { ChainStore } from "../store/ChainStore"; - -const StoreContext = createContext(null); - -export interface ChainStoreProviderProps { - children: React.ReactNode; - walletsRegistry: ChainStoreOptions["walletsRegistry"]; - walletManagerOptions: ChainStoreOptions["walletManagerOptions"]; -} - -export function ChainStoreProvider({ children, walletsRegistry, walletManagerOptions }: ChainStoreProviderProps) { - const store = useStore(); - const chainStore = useMemo( - () => - new ChainStore({ - store, - walletsRegistry, - walletManagerOptions, - localStorage: typeof window !== "undefined" ? window.localStorage : undefined - }), - [store, walletsRegistry, walletManagerOptions] - ); - return {children}; -} - -export function useChainStore(): ChainStore { - const store = useContext(StoreContext); - if (!store) { - throw new Error("useChainStore must be used within a ChainStoreProvider"); - } - return store; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.spec.tsx b/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.spec.tsx deleted file mode 100644 index 9b181c0f01..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.spec.tsx +++ /dev/null @@ -1,168 +0,0 @@ -import type { ReactNode } from "react"; -import { createStore, Provider as JotaiProvider } from "jotai"; -import { beforeEach, describe, expect, it } from "vitest"; - -import { akash, akashAssetList } from "@src/chains/akash"; -import { ChainStoreProvider } from "../../context/ChainStoreProvider"; -import type { WalletsRegistry } from "../../store/ChainStore"; -import { CURRENT_WALLET_KEY } from "../../store/constants"; -import { useChain } from "./useChain"; - -import { act, renderHook, waitFor } from "@testing-library/react"; - -describe(useChain.name, () => { - beforeEach(() => { - localStorage.clear(); - }); - - describe("when no manager is initialized", () => { - it("returns disconnected status", () => { - const { result } = setup(); - - expect(result.current.status).toBe("Disconnected"); - expect(result.current.isWalletDisconnected).toBe(true); - expect(result.current.isWalletConnected).toBe(false); - expect(result.current.isWalletConnecting).toBe(false); - expect(result.current.isWalletRejected).toBe(false); - expect(result.current.isWalletNotExist).toBe(false); - expect(result.current.isWalletError).toBe(false); - }); - - it("returns undefined address and username", () => { - const { result } = setup(); - - expect(result.current.address).toBeUndefined(); - expect(result.current.username).toBeUndefined(); - }); - - it("returns undefined walletRepo", () => { - const { result } = setup(); - - expect(result.current.walletRepo).toBeUndefined(); - }); - - it("returns undefined chain", () => { - const { result } = setup(); - - expect(result.current.chain).toBeUndefined(); - }); - - it("returns undefined assets", () => { - const { result } = setup(); - - expect(result.current.assets).toBeUndefined(); - }); - - it("does not throw when calling openView", () => { - const { result } = setup(); - - expect(() => result.current.openView()).not.toThrow(); - }); - - it("does not throw when calling closeView", () => { - const { result } = setup(); - - expect(() => result.current.closeView()).not.toThrow(); - }); - - it("does not throw when calling disconnect", () => { - const { result } = setup(); - - expect(() => result.current.disconnect()).not.toThrow(); - }); - - it("does not auto-connect even with stored wallet", () => { - localStorage.setItem(CURRENT_WALLET_KEY, "keplr-extension"); - - expect(() => setup()).not.toThrow(); - }); - }); - - describe("when walletsRegistry is provided", () => { - it("initializes manager and exposes walletRepo after connect", async () => { - const { result } = setup({ walletsRegistry: createKeplrRegistry() }); - - await act(() => result.current.connect()); - - await waitFor(() => { - expect(result.current.walletRepo).toBeDefined(); - }); - }); - - it("exposes chain info after connect", async () => { - const { result } = setup({ walletsRegistry: createKeplrRegistry() }); - - await act(() => result.current.connect()); - - await waitFor(() => { - expect(result.current.chain).toBeDefined(); - expect(result.current.chain?.chain_id).toBe("akashnet-2"); - }); - }); - - it("exposes asset list after connect", async () => { - const { result } = setup({ walletsRegistry: createKeplrRegistry() }); - - await act(() => result.current.connect()); - - await waitFor(() => { - expect(result.current.assets).toBeDefined(); - }); - }); - - it("returns undefined address after manager is initialized with no active wallet", async () => { - const { result } = setup({ walletsRegistry: createKeplrRegistry() }); - - await act(() => result.current.connect()); - - await waitFor(() => { - expect(result.current.walletRepo).toBeDefined(); - }); - - expect(result.current.address).toBeUndefined(); - }); - - it("provides getRpcEndpoint after manager is initialized", async () => { - const { result } = setup({ walletsRegistry: createKeplrRegistry() }); - - await act(() => result.current.connect()); - - await waitFor(() => { - expect(result.current.walletRepo).toBeDefined(); - }); - - expect(result.current.getRpcEndpoint).toBeDefined(); - }); - - it("provides getRestEndpoint after manager is initialized", async () => { - const { result } = setup({ walletsRegistry: createKeplrRegistry() }); - - await act(() => result.current.connect()); - - await waitFor(() => { - expect(result.current.walletRepo).toBeDefined(); - }); - - expect(result.current.getRestEndpoint).toBeDefined(); - }); - }); - - function setup(input?: { chainName?: string; walletsRegistry?: WalletsRegistry }) { - const chainName = input?.chainName ?? "akash"; - const store = createStore(); - - const wrapper = ({ children }: { children: ReactNode }) => ( - - - {children} - - - ); - - return renderHook(() => useChain(chainName), { wrapper }); - } -}); - -function createKeplrRegistry(): WalletsRegistry { - return [{ names: ["keplr-extension", "keplr-mobile"], loader: () => import("@cosmos-kit/keplr") }]; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.ts b/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.ts deleted file mode 100644 index ac1e8a19ee..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useChain/useChain.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { useEffect, useMemo } from "react"; -import type { ChainContext, ChainName, DisconnectOptions } from "@cosmos-kit/core"; -import { useAtomValue } from "jotai"; - -import { useChainStore } from "../../context/ChainStoreProvider"; -import { CURRENT_WALLET_KEY } from "../../store/constants"; -import { getChainWalletContext } from "../../store/utils"; - -export type { ChainContext }; - -export function useChain(chainName: ChainName): ChainContext { - const store = useChainStore(); - const manager = useAtomValue(store.walletManagerAtom); - const version = useAtomValue(store.stateVersionAtom); - const isInitializing = useAtomValue(store.isInitializingAtom); - - const context = useMemo(() => { - const walletRepo = manager?.getWalletRepo(chainName); - walletRepo?.activate(); - - const chainWalletContext = getChainWalletContext(walletRepo?.chainRecord.chain?.chain_id ?? chainName, walletRepo?.current, true); - - return { - ...chainWalletContext, - get walletRepo() { - return store.getManager()?.getWalletRepo(chainName); - }, - get chain() { - return store.getManager()?.getWalletRepo(chainName)?.chainRecord?.chain; - }, - get assets() { - return store.getManager()?.getWalletRepo(chainName)?.chainRecord?.assetList; - }, - openView: () => store.getManager()?.getWalletRepo(chainName)?.openView(), - closeView: () => store.getManager()?.getWalletRepo(chainName)?.closeView(), - async connect() { - await store.ensureAllWalletsLoaded(); - store.getManager()?.getWalletRepo(chainName)?.openView(); - }, - disconnect: (options?: DisconnectOptions) => - store - .getManager() - ?.getWalletRepo(chainName) - ?.disconnect(void 0, true, options), - getRpcEndpoint: (...args: any[]) => - store - .getManager() - ?.getWalletRepo(chainName) - ?.getRpcEndpoint?.(...args), - getRestEndpoint: (...args: any[]) => - store - .getManager() - ?.getWalletRepo(chainName) - ?.getRestEndpoint?.(...args), - getStargateClient: () => store.getManager()?.getWalletRepo(chainName)?.getStargateClient?.(), - getCosmWasmClient: () => store.getManager()?.getWalletRepo(chainName)?.getCosmWasmClient?.(), - getNameService: () => store.getManager()?.getWalletRepo(chainName)?.getNameService?.() - } as ChainContext; - }, [manager, version, chainName]); - - useEffect(() => { - if (!manager || !context.isWalletDisconnected) return; - - const storedWallet = typeof window !== "undefined" ? window.localStorage.getItem(CURRENT_WALLET_KEY) : null; - if (storedWallet) { - const walletRepo = manager.getWalletRepo(chainName); - walletRepo.connect(storedWallet); - } - }, [manager, chainName]); - - return useMemo(() => { - if (isInitializing) { - return Object.create(context, { isWalletConnecting: { value: true } }); - } - return context; - }, [context, isInitializing]); -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useManager/useManager.ts b/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useManager/useManager.ts deleted file mode 100644 index ab3448dd8c..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/hooks/useManager/useManager.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ManagerContext } from "@cosmos-kit/core"; -import { useAtomValue } from "jotai"; - -import { useChainStore } from "../../context/ChainStoreProvider"; - -export type { ManagerContext }; - -export function useManager(): ManagerContext | null { - const store = useChainStore(); - const manager = useAtomValue(store.walletManagerAtom); - - return manager; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/index.ts b/apps/deploy-web/src/lib/cosmos-kit-jotai/index.ts deleted file mode 100644 index d1244ad442..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { useChain, type ChainContext } from "./hooks/useChain/useChain"; -export { ChainStoreInitializer } from "./components/ChainStoreInitializer/ChainStoreInitializer"; -export { ModalWrapper } from "./components/ModalWrapper/ModalWrapper"; -export { WalletListView } from "./components/WalletModal/WalletListView"; -export { ChainStoreProvider, useChainStore, type ChainStoreProviderProps } from "./context/ChainStoreProvider"; -export { CURRENT_WALLET_KEY } from "./store/constants"; -export type { WalletsRegistry, WalletsRegistryEntry } from "./store/ChainStore"; -export { useManager, type ManagerContext } from "./hooks/useManager/useManager"; diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/ChainStore.ts b/apps/deploy-web/src/lib/cosmos-kit-jotai/store/ChainStore.ts deleted file mode 100644 index d961e26007..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/ChainStore.ts +++ /dev/null @@ -1,186 +0,0 @@ -import type { MainWalletBase, WalletManager, WalletRepo } from "@cosmos-kit/core"; -import type { getDefaultStore } from "jotai"; -import { atom } from "jotai"; - -import { CURRENT_WALLET_KEY } from "./constants"; -import type { WalletManagerOptions } from "./walletManagerFactory"; - -export interface ChainStoreOptions { - store: ReturnType; - localStorage?: Storage; - walletsRegistry: WalletsRegistry; - walletManagerOptions: Omit; -} - -export class ChainStore { - private readonly jotaiStore: ChainStoreOptions["store"]; - private readonly localStorage: ChainStoreOptions["localStorage"]; - private readonly walletsRegistry: ChainStoreOptions["walletsRegistry"]; - private readonly walletManagerOptions: ChainStoreOptions["walletManagerOptions"]; - - readonly walletManagerAtom = atom(null); - readonly stateVersionAtom = atom(0); - readonly modalIsOpenAtom = atom(false); - readonly modalWalletRepoAtom = atom(undefined); - readonly selectedWalletNameAtom = atom(""); - readonly isInitializingAtom = atom(!!this.getCurrentWalletName()); - - private walletsLoadingPromise: Promise | null = null; - private initializingPromise: Promise | null = null; - - constructor(options: ChainStoreOptions) { - this.jotaiStore = options.store; - this.localStorage = options.localStorage; - this.walletsRegistry = options.walletsRegistry; - this.walletManagerOptions = options.walletManagerOptions; - } - - initialize(): Promise { - this.initializingPromise ??= this.initializeStore().catch(error => { - this.initializingPromise = null; - return Promise.reject(error); - }); - return this.initializingPromise; - } - - private async initializeStore(): Promise { - const storedWallet = this.getCurrentWalletName(); - if (!storedWallet) return; - - this.jotaiStore.set(this.selectedWalletNameAtom, storedWallet); - - try { - this.jotaiStore.set(this.isInitializingAtom, true); - const wallets = await loadWalletByName(this.walletsRegistry, storedWallet); - await this.replaceManager(wallets); - } catch { - this.localStorage?.removeItem(CURRENT_WALLET_KEY); - this.jotaiStore.set(this.selectedWalletNameAtom, ""); - } finally { - this.jotaiStore.set(this.isInitializingAtom, false); - } - } - - ensureAllWalletsLoaded(): Promise { - if (this.walletsLoadingPromise) return this.walletsLoadingPromise; - - this.walletsLoadingPromise = loadAllWallets(this.walletsRegistry) - .then(wallets => this.replaceManager(wallets)) - .then(() => this.forceUpdate()) - .catch(error => { - this.walletsLoadingPromise = null; - return Promise.reject(error); - }); - return this.walletsLoadingPromise; - } - - private async replaceManager(wallets: MainWalletBase[]): Promise { - const currentManager = this.jotaiStore.get(this.walletManagerAtom); - if (currentManager) { - currentManager.onUnmounted(); - } - - const { createWalletManager } = await import("./walletManagerFactory"); - const manager = createWalletManager({ ...this.walletManagerOptions, wallets }); - this.linkManagerToStore(manager); - this.jotaiStore.set(this.walletManagerAtom, manager); - await manager.onMounted(); - } - - private linkManagerToStore(manager: WalletManager): void { - const forceUpdate = () => this.forceUpdate(); - const setModalOpen = (open: boolean) => { - this.jotaiStore.set(this.modalIsOpenAtom, open); - }; - const setModalWalletRepo = (repo: WalletRepo | undefined) => { - this.jotaiStore.set(this.modalWalletRepoAtom, repo); - }; - - manager.setActions({ - viewOpen: setModalOpen, - viewWalletRepo: setModalWalletRepo, - data: forceUpdate, - state: forceUpdate, - message: forceUpdate - }); - - manager.walletRepos.forEach(wr => { - wr.setActions({ - viewOpen: setModalOpen, - viewWalletRepo: setModalWalletRepo, - render: forceUpdate - }); - wr.wallets.forEach(w => { - w.setActions({ - data: forceUpdate, - state: forceUpdate, - message: forceUpdate - }); - }); - }); - - manager.mainWallets.forEach(w => { - w.setActions({ - data: forceUpdate, - state: forceUpdate, - message: forceUpdate, - clientState: forceUpdate, - clientMessage: forceUpdate - }); - }); - } - - private forceUpdate(): void { - this.jotaiStore.set(this.stateVersionAtom, v => v + 1); - } - - getManager(): WalletManager | null { - return this.jotaiStore.get(this.walletManagerAtom); - } - - cleanup(): void { - const manager = this.jotaiStore.get(this.walletManagerAtom); - if (manager) { - manager.onUnmounted(); - } - } - - addEndpoints(endpoints: Parameters[0]): void { - const manager = this.jotaiStore.get(this.walletManagerAtom); - if (manager) { - manager.addEndpoints(endpoints); - } - } - - toggleModalOpen(open: boolean): void { - this.jotaiStore.set(this.modalIsOpenAtom, open); - } - - setSelectedWalletName(name: string): void { - this.jotaiStore.set(this.selectedWalletNameAtom, name); - } - - private getCurrentWalletName() { - return this.localStorage?.getItem(CURRENT_WALLET_KEY); - } -} - -export type WalletsRegistryEntry = { - names: string[]; - loader: () => Promise<{ wallets: MainWalletBase[] }>; -}; -export type WalletsRegistry = WalletsRegistryEntry[]; - -async function loadWalletByName(registry: WalletsRegistry, name: string): Promise { - const entry = registry.find(e => e.names.includes(name)); - if (!entry) { - throw new Error(`Unknown wallet: ${name}`); - } - const { wallets } = await entry.loader(); - return wallets; -} - -async function loadAllWallets(registry: WalletsRegistry): Promise { - const wallets = await Promise.all(registry.map(entry => entry.loader())); - return wallets.flatMap(({ wallets }) => wallets); -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/constants.ts b/apps/deploy-web/src/lib/cosmos-kit-jotai/store/constants.ts deleted file mode 100644 index b7c81d5c89..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const CURRENT_WALLET_KEY = "cosmos-kit@2:core//current-wallet"; diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/utils.ts b/apps/deploy-web/src/lib/cosmos-kit-jotai/store/utils.ts deleted file mode 100644 index bce51acfa4..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/utils.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type { ChainWalletBase, ChainWalletContext } from "@cosmos-kit/core"; -import { WalletStatus } from "@cosmos-kit/core"; - -/** - * Builds a ChainWalletContext from a ChainWalletBase instance. - * Copied from @cosmos-kit/react-lite/esm/utils.js - */ -export function getChainWalletContext(chainId: string, wallet: ChainWalletBase | undefined, sync = true): ChainWalletContext { - const walletAssert = (func: ((...args: any[]) => any) | undefined, params: any[] = [], name: string) => { - if (!wallet) { - throw new Error("Wallet is undefined. Please choose a wallet to connect first."); - } - if (!func) { - throw new Error(`Function ${name} not implemented by ${wallet?.walletInfo.prettyName} yet.`); - } - return func(...params); - }; - - function clientMethodAssert(func: ((...args: any[]) => any) | undefined, params: any[] = [], name: string) { - if (!wallet) { - throw new Error("Wallet is undefined. Please choose a wallet to connect first."); - } - if (!wallet?.client) { - throw new Error("Wallet Client is undefined."); - } - if (!func) { - throw new Error(`Function ${name} not implemented by ${wallet?.walletInfo.prettyName} Client yet.`); - } - return func(...params); - } - - const status = wallet?.walletStatus || WalletStatus.Disconnected; - - return { - chainWallet: wallet, - chain: wallet?.chainRecord.chain, - assets: wallet?.chainRecord.assetList, - logoUrl: wallet?.chainLogoUrl, - wallet: wallet?.walletInfo, - address: wallet?.address, - username: wallet?.username, - message: wallet ? wallet.message : "No wallet is connected walletly.", - status, - isWalletDisconnected: status === "Disconnected", - isWalletConnecting: status === "Connecting", - isWalletConnected: status === "Connected", - isWalletRejected: status === "Rejected", - isWalletNotExist: status === "NotExist", - isWalletError: status === "Error", - connect: () => walletAssert(wallet?.connect, [void 0, sync], "connect"), - disconnect: (options?: any) => walletAssert(wallet?.disconnect, [void 0, sync, options], "disconnect"), - getRpcEndpoint: (isLazy?: boolean) => walletAssert(wallet?.getRpcEndpoint, [isLazy], "getRpcEndpoint"), - getRestEndpoint: (isLazy?: boolean) => walletAssert(wallet?.getRestEndpoint, [isLazy], "getRestEndpoint"), - getStargateClient: () => walletAssert(wallet?.getStargateClient, [], "getStargateClient"), - getCosmWasmClient: () => walletAssert(wallet?.getCosmWasmClient, [], "getCosmWasmClient"), - getSigningStargateClient: () => walletAssert(wallet?.getSigningStargateClient, [], "getSigningStargateClient"), - getSigningCosmWasmClient: () => walletAssert(wallet?.getSigningCosmWasmClient, [], "getSigningCosmWasmClient"), - getNameService: () => walletAssert(wallet?.getNameService, [], "getNameService"), - estimateFee: (...params: any[]) => walletAssert(wallet?.estimateFee, params, "estimateFee"), - sign: (...params: any[]) => walletAssert(wallet?.sign, params, "sign"), - broadcast: (...params: any[]) => walletAssert(wallet?.broadcast, params, "broadcast"), - signAndBroadcast: (...params: any[]) => walletAssert(wallet?.signAndBroadcast, params, "signAndBroadcast"), - qrUrl: wallet?.client?.qrUrl, - appUrl: wallet?.client?.appUrl, - defaultSignOptions: wallet?.client?.defaultSignOptions, - setDefaultSignOptions: (...params: any[]) => - clientMethodAssert(wallet?.client?.setDefaultSignOptions?.bind(wallet.client), [...params], "setDefaultSignOptions"), - enable: () => clientMethodAssert(wallet?.client?.enable?.bind(wallet.client), [chainId], "enable"), - suggestToken: (...params: any[]) => clientMethodAssert(wallet?.client?.suggestToken?.bind(wallet.client), [...params], "suggestToken"), - getAccount: () => clientMethodAssert(wallet?.client?.getAccount?.bind(wallet.client), [chainId], "getAccount"), - getOfflineSigner: () => clientMethodAssert(wallet?.client?.getOfflineSigner?.bind(wallet.client), [chainId, wallet?.preferredSignType], "getOfflineSigner"), - getOfflineSignerAmino: () => clientMethodAssert(wallet?.client?.getOfflineSignerAmino?.bind(wallet.client), [chainId], "getOfflineSignerAmino"), - getOfflineSignerDirect: () => clientMethodAssert(wallet?.client?.getOfflineSignerDirect?.bind(wallet.client), [chainId], "getOfflineSignerDirect"), - signAmino: (...params: any[]) => clientMethodAssert(wallet?.client?.signAmino?.bind(wallet.client), [chainId, ...params], "signAmino"), - signDirect: (...params: any[]) => clientMethodAssert(wallet?.client?.signDirect?.bind(wallet.client), [chainId, ...params], "signDirect"), - signArbitrary: (...params: any[]) => clientMethodAssert(wallet?.client?.signArbitrary?.bind(wallet.client), [chainId, ...params], "signArbitrary"), - sendTx: (...params: any[]) => clientMethodAssert(wallet?.client?.sendTx?.bind(wallet.client), [chainId, ...params], "sendTx") - } as ChainWalletContext; -} diff --git a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/walletManagerFactory.ts b/apps/deploy-web/src/lib/cosmos-kit-jotai/store/walletManagerFactory.ts deleted file mode 100644 index 4114f13200..0000000000 --- a/apps/deploy-web/src/lib/cosmos-kit-jotai/store/walletManagerFactory.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type { - ChainRecord, - EndpointOptions, - LogLevel, - MainWalletBase, - NameServiceName, - SessionOptions, - SignerOptions, - WalletConnectOptions -} from "@cosmos-kit/core"; -import { Logger, WalletManager } from "@cosmos-kit/core"; - -export interface WalletManagerOptions { - wallets: MainWalletBase[]; - chains: Array>; - assetList?: Exclude[]; - logLevel?: LogLevel; - throwErrors?: boolean; - subscribeConnectEvents?: boolean; - allowedCosmiframeParentOrigins?: string[]; - defaultNameService?: NameServiceName; - walletConnectOptions?: WalletConnectOptions; - signerOptions?: SignerOptions; - endpointOptions?: EndpointOptions; - sessionOptions?: SessionOptions; -} - -export function createWalletManager(options: WalletManagerOptions): WalletManager { - const logger = new Logger(options.logLevel ?? "WARN"); - - return new WalletManager( - options.chains, - options.wallets, - logger, - options.throwErrors ?? false, - options.subscribeConnectEvents ?? true, - options.allowedCosmiframeParentOrigins ?? [ - "http://localhost:*", - "https://localhost:*", - "https://app.osmosis.zone", - "https://daodao.zone", - "https://dao.daodao.zone", - "https://my.abstract.money", - "https://apps.abstract.money", - "https://console.abstract.money" - ], - options.assetList, - options.defaultNameService ?? "icns", - options.walletConnectOptions, - options.signerOptions, - options.endpointOptions, - options.sessionOptions - ); -} diff --git a/apps/deploy-web/src/pages/_app.tsx b/apps/deploy-web/src/pages/_app.tsx index 8c80309eb2..0c296d1b92 100644 --- a/apps/deploy-web/src/pages/_app.tsx +++ b/apps/deploy-web/src/pages/_app.tsx @@ -23,7 +23,6 @@ import { CustomIntlProvider } from "@src/components/layout/CustomIntlProvider"; import { PageHead } from "@src/components/layout/PageHead"; import { OnboardingRedirectEffect } from "@src/components/onboarding/OnboardingRedirectEffect/OnboardingRedirectEffect"; import { UserProviders } from "@src/components/user/UserProviders/UserProviders"; -import { CustomChainProvider } from "@src/context/CustomChainProvider/CustomChainProvider"; import { ColorModeProvider } from "@src/context/CustomThemeContext"; import { FlagProvider } from "@src/context/FlagProvider/FlagProvider"; import { PaymentPollingProvider } from "@src/context/PaymentPollingProvider"; @@ -97,7 +96,7 @@ function AppRoot(props: Props & { children: React.ReactNode }) { - {props.children} + {props.children} diff --git a/package-lock.json b/package-lock.json index bb34e565d5..4201b2de81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -543,18 +543,12 @@ "@cosmjs/math": "~0.38.0", "@cosmjs/proto-signing": "~0.38.0", "@cosmjs/stargate": "~0.38.0", - "@cosmos-kit/core": "^2.18.1", - "@cosmos-kit/cosmos-extension-metamask": "~0.15.1", - "@cosmos-kit/cosmostation-extension": "~2.18.1", - "@cosmos-kit/keplr": "~2.17.1", - "@cosmos-kit/react": "^2.24.1", "@emotion/cache": "^11.7.1", "@emotion/css": "^11.7.1", "@emotion/react": "^11.11.0", "@emotion/server": "^11.4.0", "@emotion/styled": "^11.8.1", "@hookform/resolvers": "^3.9.0", - "@interchain-ui/react": "^1.26.3", "@marsidev/react-turnstile": "^1.1.0", "@monaco-editor/react": "^4.6.0", "@mui/icons-material": "^5.11.11", @@ -575,7 +569,6 @@ "@xterm/addon-fit": "^0.11.0", "@xterm/xterm": "^6.0.0", "axios": "^1.7.2", - "chain-registry": "^1.69.31", "clsx": "^2.0.0", "cobe": "^2.0.1", "cockatiel": "^3.2.1", @@ -624,7 +617,6 @@ "@akashnetwork/docker": "*", "@akashnetwork/net": "*", "@akashnetwork/releaser": "*", - "@chain-registry/types": "^0.50.12", "@cosmjs/amino": "~0.38.0", "@faker-js/faker": "^9.4.0", "@next/bundle-analyzer": "^15.5.18", @@ -739,135 +731,6 @@ "dev": true, "license": "Apache-2.0" }, - "apps/deploy-web/node_modules/@cosmos-kit/react": { - "version": "2.24.1", - "resolved": "https://registry.npmjs.org/@cosmos-kit/react/-/react-2.24.1.tgz", - "integrity": "sha512-jNTye1dyw8QeVa2BCZccZPxTQBoqX8R9KchhNJFX74tWVgE4jjcz4bLlegjs/G1C8NLEqbDlUCRAiDTg9B92oA==", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "@chain-registry/types": "^0.46.11", - "@cosmos-kit/core": "^2.18.1", - "@cosmos-kit/react-lite": "^2.18.1", - "@react-icons/all-files": "^4.1.0" - }, - "peerDependencies": { - "@interchain-ui/react": "^1.26.3", - "@types/react": "latest", - "@types/react-dom": "latest", - "react": "^18.0.0 || ^19.0.0", - "react-dom": "^18.0.0 || ^19.0.0" - } - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@chain-registry/types": { - "version": "0.46.15", - "resolved": "https://registry.npmjs.org/@chain-registry/types/-/types-0.46.15.tgz", - "integrity": "sha512-gzf+pkAbEZ7fKuTuwmrEAEcx1K/BNrKuCnB9s+WwSo9Ad/3s+GV5LOXcOOxjjHh9Mrs9kvnxKvzKjOwWu8gDJw==", - "license": "SEE LICENSE IN LICENSE" - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@cosmjs/amino": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.32.4.tgz", - "integrity": "sha512-zKYOt6hPy8obIFtLie/xtygCkH9ZROiQ12UHfKsOkWaZfPQUvVbtgmu6R4Kn1tFLI/SRkw7eqhaogmW/3NYu/Q==", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "@cosmjs/crypto": "^0.32.4", - "@cosmjs/encoding": "^0.32.4", - "@cosmjs/math": "^0.32.4", - "@cosmjs/utils": "^0.32.4" - } - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@cosmjs/crypto": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.32.4.tgz", - "integrity": "sha512-zicjGU051LF1V9v7bp8p7ovq+VyC91xlaHdsFOTo2oVry3KQikp8L/81RkXmUIT8FxMwdx1T7DmFwVQikcSDIw==", - "deprecated": "This uses elliptic for cryptographic operations, which contains several security-relevant bugs. To what degree this affects your application is something you need to carefully investigate. See https://github.com/cosmos/cosmjs/issues/1708 for further pointers. Starting with version 0.34.0 the cryptographic library has been replaced. However, private keys might still be at risk.", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "@cosmjs/encoding": "^0.32.4", - "@cosmjs/math": "^0.32.4", - "@cosmjs/utils": "^0.32.4", - "@noble/hashes": "^1", - "bn.js": "^5.2.0", - "elliptic": "^6.5.4", - "libsodium-wrappers-sumo": "^0.7.11" - } - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@cosmjs/encoding": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.32.4.tgz", - "integrity": "sha512-tjvaEy6ZGxJchiizzTn7HVRiyTg1i4CObRRaTRPknm5EalE13SV+TCHq38gIDfyUeden4fCuaBVEdBR5+ti7Hw==", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "base64-js": "^1.3.0", - "bech32": "^1.1.4", - "readonly-date": "^1.0.0" - } - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@cosmjs/math": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.32.4.tgz", - "integrity": "sha512-++dqq2TJkoB8zsPVYCvrt88oJWsy1vMOuSOKcdlnXuOA/ASheTJuYy4+oZlTQ3Fr8eALDLGGPhJI02W2HyAQaw==", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "bn.js": "^5.2.0" - } - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@cosmjs/proto-signing": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.32.4.tgz", - "integrity": "sha512-QdyQDbezvdRI4xxSlyM1rSVBO2st5sqtbEIl3IX03uJ7YiZIQHyv6vaHVf1V4mapusCqguiHJzm4N4gsFdLBbQ==", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "@cosmjs/amino": "^0.32.4", - "@cosmjs/crypto": "^0.32.4", - "@cosmjs/encoding": "^0.32.4", - "@cosmjs/math": "^0.32.4", - "@cosmjs/utils": "^0.32.4", - "cosmjs-types": "^0.9.0" - } - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@cosmjs/utils": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.32.4.tgz", - "integrity": "sha512-D1Yc+Zy8oL/hkUkFUL/bwxvuDBzRGpc4cF7/SkdhxX4iHpSLgdOuTt1mhCh9+kl6NQREy9t7SYZ6xeW5gFe60w==", - "license": "Apache-2.0", - "peer": true - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@cosmos-kit/react-lite": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@cosmos-kit/react-lite/-/react-lite-2.18.1.tgz", - "integrity": "sha512-Us7gBZtb1eYxcwMu74ii+pIeR4TE5Q+JhSXkyKUJHh/wDQyTNhCYGpp9PJUMUAiuLuPsv1qToEoeuk6gcD7XaQ==", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "@chain-registry/types": "^0.46.11", - "@cosmos-kit/core": "^2.18.1", - "@dao-dao/cosmiframe": "^1.0.0" - }, - "peerDependencies": { - "@types/react": "latest", - "@types/react-dom": "latest", - "react": "^18.0.0 || ^19.0.0", - "react-dom": "^18.0.0 || ^19.0.0" - } - }, - "apps/deploy-web/node_modules/@cosmos-kit/react/node_modules/@dao-dao/cosmiframe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@dao-dao/cosmiframe/-/cosmiframe-1.0.0.tgz", - "integrity": "sha512-xPaD9MV1tUueYl+VIJD7CEi4+MCdcgo4E1R9w8XplKlM7pvmBaSBeTz88HwITpKxWKI+DWoJngeCWu5/8oqLJQ==", - "license": "BSD-3-Clause-Clear", - "dependencies": { - "uuid": "^9.0.1" - }, - "peerDependencies": { - "@cosmjs/amino": ">= ^0.32", - "@cosmjs/proto-signing": ">= ^0.32" - } - }, "apps/deploy-web/node_modules/@csstools/color-helpers": { "version": "6.0.1", "dev": true, @@ -988,44 +851,6 @@ "npm": ">=9.0.0" } }, - "apps/deploy-web/node_modules/@interchain-ui/react": { - "version": "1.26.3", - "resolved": "https://registry.npmjs.org/@interchain-ui/react/-/react-1.26.3.tgz", - "integrity": "sha512-kvGOZaSDJLNxtxieiyPMHOzxBGkpHR/BCpg/UEMDl2l7nLoPrygB/Oux1QEv/cwkw8GvepOBM7pzfJf8xk1IbQ==", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "@floating-ui/core": "^1.6.7", - "@floating-ui/dom": "^1.6.10", - "@floating-ui/react": "^0.26.23", - "@floating-ui/react-dom": "^2.1.1", - "@floating-ui/utils": "^0.2.7", - "@formkit/auto-animate": "^0.8.2", - "@react-aria/listbox": "^3.13.3", - "@react-aria/overlays": "^3.23.2", - "@react-aria/utils": "^3.25.2", - "@tanstack/react-virtual": "^3.10.5", - "@vanilla-extract/css": "^1.15.5", - "@vanilla-extract/css-utils": "^0.1.4", - "@vanilla-extract/dynamic": "^2.1.2", - "@vanilla-extract/private": "^1.0.6", - "@vanilla-extract/recipes": "^0.5.5", - "animejs": "^3.2.2", - "bignumber.js": "^9.1.2", - "client-only": "^0.0.1", - "clsx": "^2.1.1", - "copy-to-clipboard": "^3.3.3", - "immer": "^10.1.1", - "lodash": "^4.17.21", - "rainbow-sprinkles": "^0.17.3", - "react-aria": "^3.34.3", - "react-stately": "^3.32.2", - "zustand": "^4.5.5" - }, - "peerDependencies": { - "react": "^18.0.0 || ^19.0.0", - "react-dom": "^18.0.0 || ^19.0.0" - } - }, "apps/deploy-web/node_modules/@noble/ciphers": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", @@ -8876,47 +8701,6 @@ "node": ">= 10.13" } }, - "node_modules/@cosmos-kit/cosmos-extension-metamask": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/@cosmos-kit/cosmos-extension-metamask/-/cosmos-extension-metamask-0.15.1.tgz", - "integrity": "sha512-fJGo0n4Tkk8+AEdRepzy0g5fo28HM6zNW53bROdcK2WvertSgVmI4O5vLlE0m+B626FAxIyz6EVnXg46FADF/w==", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "@chain-registry/keplr": "^1.69.13", - "@cosmos-kit/core": "^2.18.1", - "@cosmsnap/snapper": "^0.2.5" - }, - "peerDependencies": { - "@cosmjs/amino": ">=0.32.3", - "@cosmjs/proto-signing": ">=0.32.3", - "cosmjs-types": ">=0.9.0" - } - }, - "node_modules/@cosmos-kit/cosmostation-extension": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@cosmos-kit/cosmostation-extension/-/cosmostation-extension-2.18.1.tgz", - "integrity": "sha512-GqHCH+wCRglB7ty+3Ib+v92S4T+Z9cUZ2Pm3SoEGZWVVwcXF23dXmm0k3dN6GjpLRUejG1fX3dkd7yjfppjpZA==", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "@chain-registry/cosmostation": "^1.67.13", - "@cosmos-kit/core": "^2.18.1" - }, - "peerDependencies": { - "@cosmjs/amino": ">=0.32.3", - "@cosmjs/proto-signing": ">=0.32.3", - "cosmjs-types": ">=0.9.0" - } - }, - "node_modules/@cosmos-kit/keplr": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/@cosmos-kit/keplr/-/keplr-2.17.1.tgz", - "integrity": "sha512-szVutDVDCWE4bCUWNo6M49OVd1ta4opuc896KXBGPOwndSuw1si95n488zpo+ang3lRZ0IyaqpLVkDHdQ9lqSg==", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "@cosmos-kit/keplr-extension": "^2.17.1", - "@cosmos-kit/keplr-mobile": "^2.17.1" - } - }, "node_modules/@cosmos-kit/keplr-extension": { "version": "2.17.1", "resolved": "https://registry.npmjs.org/@cosmos-kit/keplr-extension/-/keplr-extension-2.17.1.tgz", @@ -9033,76 +8817,6 @@ "version": "0.1.15", "license": "MIT" }, - "node_modules/@cosmsnap/snapper": { - "version": "0.2.7", - "license": "MIT", - "dependencies": { - "@cosmjs/amino": "^0.31.3", - "@keplr-wallet/proto-types": "0.12.12", - "@keplr-wallet/types": "0.12.12", - "appwrite": "^14.0.0", - "node-appwrite": "^14.0.0", - "ses": "^0.18.4" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@cosmsnap/snapper/node_modules/@cosmjs/amino": { - "version": "0.31.3", - "license": "Apache-2.0", - "dependencies": { - "@cosmjs/crypto": "^0.31.3", - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/utils": "^0.31.3" - } - }, - "node_modules/@cosmsnap/snapper/node_modules/@cosmjs/crypto": { - "version": "0.31.3", - "license": "Apache-2.0", - "dependencies": { - "@cosmjs/encoding": "^0.31.3", - "@cosmjs/math": "^0.31.3", - "@cosmjs/utils": "^0.31.3", - "@noble/hashes": "^1", - "bn.js": "^5.2.0", - "elliptic": "^6.5.4", - "libsodium-wrappers-sumo": "^0.7.11" - } - }, - "node_modules/@cosmsnap/snapper/node_modules/@cosmjs/encoding": { - "version": "0.31.3", - "license": "Apache-2.0", - "dependencies": { - "base64-js": "^1.3.0", - "bech32": "^1.1.4", - "readonly-date": "^1.0.0" - } - }, - "node_modules/@cosmsnap/snapper/node_modules/@cosmjs/math": { - "version": "0.31.3", - "license": "Apache-2.0", - "dependencies": { - "bn.js": "^5.2.0" - } - }, - "node_modules/@cosmsnap/snapper/node_modules/@cosmjs/utils": { - "version": "0.31.3", - "license": "Apache-2.0" - }, - "node_modules/@cosmsnap/snapper/node_modules/@keplr-wallet/proto-types": { - "version": "0.12.12", - "license": "Apache-2.0", - "dependencies": { - "long": "^4.0.0", - "protobufjs": "^6.11.2" - } - }, - "node_modules/@cosmsnap/snapper/node_modules/long": { - "version": "4.0.0", - "license": "Apache-2.0" - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "devOptional": true, @@ -12247,17 +11961,6 @@ "version": "0.12.28", "license": "Apache-2.0" }, - "node_modules/@keplr-wallet/types": { - "version": "0.12.12", - "license": "Apache-2.0", - "dependencies": { - "long": "^4.0.0" - } - }, - "node_modules/@keplr-wallet/types/node_modules/long": { - "version": "4.0.0", - "license": "Apache-2.0" - }, "node_modules/@keplr-wallet/unit": { "version": "0.12.28", "license": "Apache-2.0", @@ -22440,12 +22143,6 @@ "picocolors": "^1.0.0" } }, - "node_modules/@vanilla-extract/css-utils": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@vanilla-extract/css-utils/-/css-utils-0.1.6.tgz", - "integrity": "sha512-iICpaHma0s2EEnQDw/JRqudQJwYw1JERyWfIllNQplps226KVphjGb3jyGMiBK5Waw69RD3q4gulgRVQAQmKmA==", - "license": "MIT" - }, "node_modules/@vanilla-extract/css/node_modules/lru-cache": { "version": "10.4.3", "license": "ISC" @@ -23852,39 +23549,6 @@ "version": "1.0.0", "license": "MIT" }, - "node_modules/appwrite": { - "version": "14.0.1", - "license": "BSD-3-Clause", - "dependencies": { - "cross-fetch": "3.1.5", - "isomorphic-form-data": "2.0.0" - } - }, - "node_modules/appwrite/node_modules/cross-fetch": { - "version": "3.1.5", - "license": "MIT", - "dependencies": { - "node-fetch": "2.6.7" - } - }, - "node_modules/appwrite/node_modules/node-fetch": { - "version": "2.6.7", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/arg": { "version": "5.0.2", "license": "MIT" @@ -31104,25 +30768,6 @@ "version": "2.0.0", "license": "ISC" }, - "node_modules/isomorphic-form-data": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "form-data": "^2.3.2" - } - }, - "node_modules/isomorphic-form-data/node_modules/form-data": { - "version": "2.5.1", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, "node_modules/isomorphic-ws": { "version": "4.0.1", "license": "MIT", @@ -36114,13 +35759,6 @@ "node": ">=18.20.0 <20 || >=20.12.1" } }, - "node_modules/node-appwrite": { - "version": "14.1.0", - "license": "BSD-3-Clause", - "dependencies": { - "node-fetch-native-with-agent": "1.7.2" - } - }, "node_modules/node-exports-info": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.0.tgz", @@ -36170,10 +35808,6 @@ "version": "1.6.6", "license": "MIT" }, - "node_modules/node-fetch-native-with-agent": { - "version": "1.7.2", - "license": "MIT" - }, "node_modules/node-forge": { "version": "1.3.1", "license": "(BSD-3-Clause OR GPL-2.0)", @@ -39581,10 +39215,6 @@ "node": ">= 0.8.0" } }, - "node_modules/ses": { - "version": "0.18.4", - "license": "Apache-2.0" - }, "node_modules/set-blocking": { "version": "2.0.0", "license": "ISC" From a909857a7810ce5326d6fac39282e46eb803eab3 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp <15185355+baktun14@users.noreply.github.com> Date: Sat, 13 Jun 2026 20:36:32 -0400 Subject: [PATCH 2/3] fix(styling): apply Geist font at document root for portaled popups Modals/popups render in a portal at document.body, outside the app's
that carries GeistSans.variable, so --font-geist-sans was undefined there and they fell back to the browser serif default. This was previously masked by a global font injected by @interchain-ui, which was removed alongside cosmos-kit. Define the font variable on and set an explicit body font-family so portaled content inherits Geist. --- apps/deploy-web/src/pages/_document.tsx | 5 ++++- apps/deploy-web/src/styles/index.css | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/deploy-web/src/pages/_document.tsx b/apps/deploy-web/src/pages/_document.tsx index 4d65202a7e..8823a06b34 100644 --- a/apps/deploy-web/src/pages/_document.tsx +++ b/apps/deploy-web/src/pages/_document.tsx @@ -1,6 +1,7 @@ import React from "react"; import type { DocumentHeadTagsProps } from "@mui/material-nextjs/v14-pagesRouter"; import { documentGetInitialProps, DocumentHeadTags } from "@mui/material-nextjs/v14-pagesRouter"; +import { GeistSans } from "geist/font/sans"; import type { DocumentContext } from "next/document"; import { Head, Html, Main, NextScript } from "next/document"; @@ -8,7 +9,9 @@ import { customColors } from "@src/utils/colors"; export default function MyDocument(props: DocumentHeadTagsProps) { return ( - + // Apply the Geist font variable at the document root so portaled content + // (modals, popups) rendered outside the app's
still resolves --font-geist-sans. + {/* MUI */} diff --git a/apps/deploy-web/src/styles/index.css b/apps/deploy-web/src/styles/index.css index eb0de555d8..fd3f8b61fa 100644 --- a/apps/deploy-web/src/styles/index.css +++ b/apps/deploy-web/src/styles/index.css @@ -8,6 +8,7 @@ html { body { height: calc(100% - 57px) !important; padding: 0 !important; + font-family: var(--font-geist-sans), ui-sans-serif, system-ui, -apple-system, sans-serif; } header { From fcbab70bb6c40e9c35ae730a970a46e8b0d558c6 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp <15185355+baktun14@users.noreply.github.com> Date: Sat, 13 Jun 2026 20:44:42 -0400 Subject: [PATCH 3/3] refactor(wallet): drop unused @cosmjs/amino from deploy-web @cosmjs/amino was only pulled in by the removed cosmos-kit signing code; knip flags it as an unused devDependency. Remove it to keep the dependency set clean. --- apps/deploy-web/package.json | 1 - package-lock.json | 67 ------------------------------------ 2 files changed, 68 deletions(-) diff --git a/apps/deploy-web/package.json b/apps/deploy-web/package.json index b324efc86c..0aa7ad0bbb 100644 --- a/apps/deploy-web/package.json +++ b/apps/deploy-web/package.json @@ -116,7 +116,6 @@ "@akashnetwork/docker": "*", "@akashnetwork/net": "*", "@akashnetwork/releaser": "*", - "@cosmjs/amino": "~0.38.0", "@faker-js/faker": "^9.4.0", "@next/bundle-analyzer": "^15.5.18", "@octokit/openapi-types": "^22.2.0", diff --git a/package-lock.json b/package-lock.json index 4201b2de81..5528f4786b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -617,7 +617,6 @@ "@akashnetwork/docker": "*", "@akashnetwork/net": "*", "@akashnetwork/releaser": "*", - "@cosmjs/amino": "~0.38.0", "@faker-js/faker": "^9.4.0", "@next/bundle-analyzer": "^15.5.18", "@octokit/openapi-types": "^22.2.0", @@ -668,36 +667,6 @@ "lru-cache": "^11.2.5" } }, - "apps/deploy-web/node_modules/@cosmjs/amino": { - "version": "0.38.1", - "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.38.1.tgz", - "integrity": "sha512-WaThDpq2JwUyKuazq08Xa+FHzQ3jh1HcYnGL4xsyfqFwOlAvnl0EDvSSz9WSwz1oopIxFE9Qtf3OUKOlxBZbYA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@cosmjs/crypto": "^0.38.1", - "@cosmjs/encoding": "^0.38.1", - "@cosmjs/math": "^0.38.1", - "@cosmjs/utils": "^0.38.1" - } - }, - "apps/deploy-web/node_modules/@cosmjs/crypto": { - "version": "0.38.1", - "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.38.1.tgz", - "integrity": "sha512-r1KQCjKAdMga2aZ/nkgULRF4fisPZMF6ErucVsMmkASBgDl0k9/vD9K9fHUdGClMv0oOYEfwOT/UTBR7K2OuYA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@cosmjs/encoding": "^0.38.1", - "@cosmjs/math": "^0.38.1", - "@cosmjs/utils": "^0.38.1", - "@noble/ciphers": "^1.3.0", - "@noble/curves": "^1.9.2", - "@noble/hashes": "^1.8.0", - "@scure/bip39": "^1.6.0", - "hash-wasm": "^4.12.0" - } - }, "apps/deploy-web/node_modules/@cosmjs/encoding": { "version": "0.38.1", "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.38.1.tgz", @@ -724,13 +693,6 @@ "integrity": "sha512-MBk7p6kPNULi0TusD8O3xoBskFIkRzOtpmnea3sXbTVnguX7epNPVDITXM4tlsg8kAQrEOEIA0g5zAJxzH3Ikw==", "license": "Apache-2.0" }, - "apps/deploy-web/node_modules/@cosmjs/utils": { - "version": "0.38.1", - "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.38.1.tgz", - "integrity": "sha512-ccQ5in6IvsQ+o/SstUdQH1jCJ2+MkJPZK7A/EYwMAFcjV8vzOgJ97LVy6AT24nwdi0/iVa2nbAG+fitUEsgLcA==", - "dev": true, - "license": "Apache-2.0" - }, "apps/deploy-web/node_modules/@csstools/color-helpers": { "version": "6.0.1", "dev": true, @@ -851,35 +813,6 @@ "npm": ">=9.0.0" } }, - "apps/deploy-web/node_modules/@noble/ciphers": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", - "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "apps/deploy-web/node_modules/@noble/curves": { - "version": "1.9.7", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", - "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@noble/hashes": "1.8.0" - }, - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "apps/deploy-web/node_modules/@octokit/openapi-types": { "version": "22.2.0", "dev": true,