cosmology-tech / cosmos-kit

Universal wallet connector for the Cosmos ⚛️
https://cosmology.zone/products/cosmos-kit
BSD 3-Clause Clear License
183 stars 132 forks source link

TypeError TS2322 'XDEFIExtensionWallet’ is not assignable to type ‘MainWalletBase' #248

Closed twhy closed 1 year ago

twhy commented 1 year ago

TS2322: Type ‘(KeplrExtensionWallet | KeplrMobileWallet | LeapExtensionWallet | LeapMobileWallet | CosmostationExtensionWallet | CosmostationMobileWallet | XDEFIExtensionWallet)[]' is not assignable to type ‘MainWalletBase[]’. Type ‘KeplrExtensionWallet | KeplrMobileWallet | LeapExtensionWallet | LeapMobileWallet | CosmostationExtensionWallet | CosmostationMobileWallet | XDEFIExtensionWallet’ is not assignable to type ‘MainWalletBase’. Type ‘XDEFIExtensionWallet’ is not assignable to type ‘MainWalletBase’. Property ‘_chainWalletMap’ is protected but type ‘MainWalletBase’ is not a class derived from ‘MainWalletBase’.

We’re currently trying to integrate xdefi through cosmoskit, but encountered a type error and have reached out to the cosmoskit team. If you go to their repository, you’ll see the xdefi related code is commented out. It seems like they’re working on something.

// ...xdefi is not related to this error, it's for other reasons or by accident.

2023-06-28_11 43 49_720

twhy commented 1 year ago

These TypeErrors are generally caused by using older versions of cosmos-kit relatated packages when creating projects with cca. So the solution is to upgrade related packages to lastest stable versions.

twhy commented 1 year ago

Upgrade packages with comment // upgrade to versions specified in the package.json below should solve the problem

{
  "name": "@cosmology/asset-list",
  "version": "0.2.1",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@chain-registry/assets": "1.11.0",
    "@chain-registry/osmosis": "1.11.0",
    "@chain-registry/types": "0.14.0",
    "@chakra-ui/icons": "2.0.12",
    "@chakra-ui/react": "2.5.1",
    "@cosmjs/amino": "0.30.1",
    "@cosmjs/cosmwasm-stargate": "0.29.5",
    "@cosmjs/stargate": "0.29.5",
    "@cosmology-ui/react": "0.1.8-beta.30",
    "@cosmos-kit/core": "1.7.0",           // upgrade
    "@cosmos-kit/cosmostation": "0.15.38", // upgrade
    "@cosmos-kit/keplr": "0.33.40",        // upgrade
    "@cosmos-kit/leap": "0.15.10",         // upgrade
    "@cosmos-kit/react": "1.3.33",         // upgrade
    "@cosmos-kit/xdefi-extension": "^0.16.1",  // upgrade 
    "@emotion/styled": "11.10.6",
    "bignumber.js": "9.1.1",
    "chain-registry": "1.14.0",
    "chakra-react-select": "4.4.3",
    "fast-fuzzy": "1.12.0",
    "framer-motion": "9.0.7",
    "long": "5.2.1",
    "next": "12.2.5",
    "osmojs": "15.2.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-icons": "4.6.0"
  },
  "devDependencies": {
    "@types/node": "18.11.9",
    "@types/react": "18.0.25",
    "@types/react-dom": "18.0.9",
    "eslint": "8.28.0",
    "eslint-config-next": "13.0.5",
    "typescript": "4.9.3"
  }
}
twhy commented 1 year ago

WX20230629-223234@2x