fix: TypeScript build errors in metamask/leap-metamask/mock wallets and vue - #48
Merged
Merged
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Package build scripts run
tsc ... || true, so these packages have been shipping with type errors that never failpnpm run build/CI. After this PR, the fullpnpm run buildlog has 0error TSlines (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 oldBaseWallet/WalletManagerAPI.Wallets
cosmos-extension-metamask:addSuggestChain(chainId)used an undefinedchain, so it threw at runtime. It now doesconst chain = this.getChainById(chainId)and usesgetAssetListByChainId(chainId)(before:assetLists[0], which could be the wrong chain). Imports now come from@interchainjs/cosmosand@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 nonexistenterrorMessage; it throws, so the store marks the walletNotExistwhen MetaMask is missing, the same way the other extensions behave.mock-wallet: brought in line withBaseWallet(connect(chainId: string),addSuggestChain(chainId),getProvider, narrowed thealgotype).MockEthereumWallet.getProvider()now returns the current chain'sJsonRpcProvider(it used to read an undeclaredthis.provider). Dropped the unused@keplr-wallet/typesdep.Vue (
@interchain-kit/vue): it was still written against the old coreWalletManager(getCurrentWallet(),wallet.walletState, one-argconnect(walletName)), none of which exist anymore. Ported it toWalletManagerStore, the same store React uses:useWalletManager()now returnsShallowRef<WalletManagerStore>.useConfig()now exposesaddChains(...)in place of theupdate*setters, which only reassigned fields and did nothing at runtime.useChain().walletis aChainWalletStore.walletState,accountand the WC QR URI from the store.tsconfig:moduleResolution: bundler, so theexportstypes in@interchain-ui/vueresolve (itstypesfield is an absolute/dist/...path).@interchain-kit/storeis added as a dep and kept external in vite, like core.examples/vueand the README are updated to the new calls. The other example errors were already there (missing deps and staleinterchainjsimports) and are left alone.Verified locally:
pnpm install --frozen-lockfile,pnpm run build(0error TS),vue-tsc --noEmiton packages/vue,pnpm run testall 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