Update dapp skill to Stellar Wallets Kit v2#74
Merged
Conversation
The skill taught the legacy npm dotted scope and the v1 API. v2 lives on JSR as @creit-tech/stellar-wallets-kit and the kit is now a static singleton: StellarWalletsKit.init once, defaultModules() instead of allowAllModules(), and authModal() replacing the openModal callback dance (it picks the wallet, sets it active, and returns the address). The hook now also wires the real disconnect(). The new snippet type-checks verbatim against the published JSR package (v2.5.0), and a negative control confirms the old idioms are really gone: allowAllModules and WalletNetwork are not exported, the constructor takes no arguments, and openModal does not exist. A dated migration note covers the v1 -> v2 differences, and the defaultModules() comment explains which modules need explicit setup. Closes #56.
|
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.
Closes #56.
Rewrites the Wallets Kit integration for v2, grounded in the published package rather than the docs alone: installed
@creit-tech/stellar-wallets-kitv2.5.0 from JSR into a sandbox and worked from its type definitions.npx jsr add @creit-tech/stellar-wallets-kitwith a note that v2 is distributed on JSR.StellarWalletsKit.init({ modules: defaultModules(), network: Networks.TESTNET })once, then static calls.authModal()replaces the v1openModal({ onWalletSelected })callback dance (it opens the picker, sets the module, and returns the address in one call), and the hook now wires the realdisconnect().defaultModules()is explained per the issue's ask: it loads every wallet needing no extra setup, and modules with prerequisites (WalletConnect, Ledger, Trezor) must be added explicitly.allowAllModules()→defaultModules(), where the wallet ID constants moved, and the maintainers' note that npm parity will eventually stop.Verification (the issue asked for a compile test of the embedded snippet): the new hook type-checks verbatim against the real package, and a negative control proves the types are strict — the v1 idioms the old skill taught all fail (
allowAllModulesandWalletNetworknot exported,new StellarWalletsKit({...})rejected with expected-0-arguments,openModaldoes not exist).