feat: move isDevnet check to wallet-sdk - #2200
Merged
Merged
Conversation
fayi-da
requested review from
a team,
Copilot,
mateuszpiatkowski-da and
rukmini-basu-da
and removed request for
Copilot
July 24, 2026 16:13
There was a problem hiding this comment.
Pull request overview
This PR continues the #1795 “wallet-sdk replacement” work by shifting DevNet detection and DevNet tap behavior to use @canton-network/wallet-sdk, while removing the now-unneeded Portfolio service abstraction and related dependencies in the example app.
Changes:
- Add
AmuletNamespace.isDevNet()to the wallet SDK and cover it with a unit test. - Make DevNet tap in the Portfolio example an “Amulet-only” operation (no instrument selection), wiring taps through wallet-sdk +
submitViaProvider. - Remove unused Portfolio service/context modules and drop
@canton-network/core-splice-clientfrom the Portfolio example’s dependencies.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Removes an unused workspace dependency entry related to the Portfolio example’s dependency cleanup. |
| sdk/wallet-sdk/src/wallet/namespace/amulet/namespace.ts | Adds isDevNet() to the Amulet namespace, delegating to amuletService. |
| sdk/wallet-sdk/src/wallet/namespace/amulet/amulet.test.ts | Adds a unit test for the new isDevNet() wrapper. |
| sdk/wallet-sdk/src/wallet/init/initializedSDK.ts | Documents/retains the validator-proxy behavior when validatorUrl is configured. |
| examples/portfolio/tests/utils.ts | Updates tap test helper to assert fixed “Amulet” instrument rather than selecting an instrument. |
| examples/portfolio/tests/settings-next.spec.ts | Updates tap amount expectation to include fractional precision. |
| examples/portfolio/tests/next-utils.ts | Updates Next UI tap helper to assert fixed “Amulet” instrument rather than selecting an instrument. |
| examples/portfolio/src/services/resolve.ts | Removes Amulet service resolver plumbing; keeps only token-standard service resolution (but leaves some dead code as noted). |
| examples/portfolio/src/services/portfolio-service.ts | Deletes the PortfolioService interface (no longer used). |
| examples/portfolio/src/services/portfolio-service-implementation.ts | Deletes the Portfolio service implementation (tap/isDevNet now handled via wallet-sdk). |
| examples/portfolio/src/main.tsx | Removes PortfolioProvider from the app tree. |
| examples/portfolio/src/hooks/useIsDevNet.ts | Simplifies hook to use wallet-sdk-based query options. |
| examples/portfolio/src/hooks/query-options.ts | Moves isDevNet query to wallet-sdk (but currently keys off the wrong validatorUrl as noted). |
| examples/portfolio/src/hooks/query-keys.ts | Replaces the global isDevNet key with a validator-specific key. |
| examples/portfolio/src/contexts/PortfolioProvider.tsx | Deletes the provider (no longer needed). |
| examples/portfolio/src/contexts/PortfolioContext.tsx | Deletes the context and usePortfolio hook (no longer needed). |
| examples/portfolio/src/components/tap-settings.tsx | Makes Settings-page tap an Amulet-only operation executed via wallet-sdk. |
| examples/portfolio/src/components/settings/devnet-tap-dialog.tsx | Makes dialog tap Amulet-only and executes via wallet-sdk; updates the UI accordingly. |
| examples/portfolio/package.json | Drops @canton-network/core-splice-client from the Portfolio example’s dependencies. |
Comments suppressed due to low confidence (1)
examples/portfolio/src/services/resolve.ts:51
- ledgerClient singleton is now dead code: it is never assigned/returned anywhere and is only cleared. Keeping this around makes the resolver harder to understand and can trip unused-code checks.
// Global, but so is the dApp SDK.
const ledgerClient: { singleton: LedgerClient | undefined } = {
singleton: undefined,
}
const tokenStandardService: { singleton: TokenStandardService | undefined } = {
singleton: undefined,
}
// Can be called to reset clients on disconnects.
export const clear = () => {
ledgerClient.singleton = undefined
tokenStandardService.singleton = undefined
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fayi-da
force-pushed
the
fayi/1795-sdk-migrate-portfolio-scanproxy
branch
from
July 24, 2026 16:56
6aa6a2a to
b5175d3
Compare
Part of #1795 - move isDevNet check to wallet-sdk - make Tap amulet only operation - delete unused services and dependencies Signed-off-by: Fayi Femi-Balogun <fayimora.femibalogun@digitalasset.com>
Signed-off-by: Fayi Femi-Balogun <fayimora.femibalogun@digitalasset.com>
fayi-da
force-pushed
the
fayi/1795-sdk-migrate-portfolio-scanproxy
branch
from
July 24, 2026 18:54
b5175d3 to
d866128
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
examples/portfolio/src/hooks/query-options.ts:167
- The non-TLS
validatorUrlwarning is now emitted only inside theisDevNetquery. Other flows (e.g. tapping viasdk.amulet.tap(...)) can still use anhttp:validator endpoint without ever triggering this warning ifuseIsDevNetisn't queried. Consider moving this check to a central place that always runs when the SDK is configured (e.g.useWalletSdkduringwalletSdk.SDK.create, or config validation) so it consistently covers all validator interactions.
const url = new URL(validatorUrl)
if (url.protocol === 'http:') {
logger.warn(
{ validatorUrl: url.toString() },
'Using a non-TLS validator endpoint. This is acceptable only in trusted environments. Set validatorUrl in portfolio config to an HTTPS endpoint if the validator API is reachable over an untrusted network.'
mateuszpiatkowski-da
pushed a commit
that referenced
this pull request
Aug 10, 2026
Signed-off-by: Fayi Femi-Balogun <fayimora.femibalogun@digitalasset.com>
mateuszpiatkowski-da
pushed a commit
that referenced
this pull request
Aug 13, 2026
Signed-off-by: Fayi Femi-Balogun <fayimora.femibalogun@digitalasset.com> Signed-off-by: Mateusz Piątkowski <mateusz.piatkowski@digitalasset.com>
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.
Part of #2149