Skip to content

fix: TypeScript build errors in metamask/leap-metamask/mock wallets and vue - #48

Merged
pyramation merged 3 commits into
mainfrom
fix/ts-build-errors
Oct 2, 2026
Merged

pyramation merged 3 commits into
mainfrom
fix/ts-build-errors

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

Package build scripts run tsc ... || true, so these packages have been shipping with type errors that never fail pnpm run build/CI. After this PR, the full pnpm run build log has 0 error TS lines (was ~60 across 4 packages). Root causes: imports from @interchainjs/cosmos/types/wallet (that path no longer exists in 1.21.0), and code still written against the old BaseWallet/WalletManager API.

Wallets

  • cosmos-extension-metamask: addSuggestChain(chainId) used an undefined chain, so it threw at runtime. It now does const chain = this.getChainById(chainId) and uses getAssetListByChainId(chainId) (before: assetLists[0], which could be the wrong chain). Imports now come from @interchainjs/cosmos and @interchainjs/amino (added as a dep, same version as core).
  • leap-cosmos-extension-metamask: addSuggestChain(chainId: string) now matches the base signature. init() no longer catches its own error and writes it to a nonexistent errorMessage; it throws, so the store marks the wallet NotExist when MetaMask is missing, the same way the other extensions behave.
  • mock-wallet: brought in line with BaseWallet (connect(chainId: string), addSuggestChain(chainId), getProvider, narrowed the algo type). MockEthereumWallet.getProvider() now returns the current chain's JsonRpcProvider (it used to read an undeclared this.provider). Dropped the unused @keplr-wallet/types dep.

Vue (@interchain-kit/vue): it was still written against the old core WalletManager (getCurrentWallet(), wallet.walletState, one-arg connect(walletName)), none of which exist anymore. Ported it to WalletManagerStore, the same store React uses:

// ChainProvider.vue
const walletManager = shallowRef(new WalletManagerStore(chains, assetLists, wallets, signerOptions, endpointOptions))
walletManager.value.subscribe(() => triggerRef(walletManager))
provide(WALLET_MANAGER_KEY, walletManager)

// composables read state from the store
useAccount(chain, wallet) => computed(() => wm.value.getChainWalletState(wallet, chain)?.account)
connect/disconnect       => wm.value.connect(walletName, chainName)
  • Public API changes (pre-launch, so no compatibility aliases): useWalletManager() now returns ShallowRef<WalletManagerStore>. useConfig() now exposes addChains(...) in place of the update* setters, which only reassigned fields and did nothing at runtime. useChain().wallet is a ChainWalletStore.
  • The modal now reads walletState, account and the WC QR URI from the store.
  • tsconfig: moduleResolution: bundler, so the exports types in @interchain-ui/vue resolve (its types field is an absolute /dist/... path).
  • @interchain-kit/store is added as a dep and kept external in vite, like core.
  • examples/vue and the README are updated to the new calls. The other example errors were already there (missing deps and stale interchainjs imports) and are left alone.

Verified locally: pnpm install --frozen-lockfile, pnpm run build (0 error TS), vue-tsc --noEmit on packages/vue, pnpm run test all green. The lockfile diff is just the two dep changes.

Link to Devin session: https://app.devin.ai/sessions/a02c84f654b94cbcb50936e98373fba5
Open in Devin Desktop: https://app.devin.ai/desktop/session/a02c84f654b94cbcb50936e98373fba5?variant=devin
Requested by: @pyramation

@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit 8e7a01d into main Oct 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant