Add custom NEP-17 token by contract hash#64
Open
Jim8y wants to merge 2 commits into
Open
Conversation
Tokens were a static embedded list, so any NEP-17 not in tokens.json was invisible and unaddable. Add an Add-token popup (wallet toolbar) that resolves a pasted contract hash via the existing GetTokenInfo and persists it; TokenManager merges user tokens with the embedded list. Builds for net10.0-android (0 errors).
There was a problem hiding this comment.
Pull request overview
Adds a user-facing “Add token” flow so wallets can track NEP-17 tokens not present in the embedded tokens.json, by resolving token metadata from chain via RpcClient.GetTokenInfo and persisting the contract hash in settings.
Changes:
- Merge persisted user-added token hashes into the embedded token list during token loading.
- Add an “Add token” toolbar action on
WalletPagethat opens a newAddTokenPopup. - Add new localized strings for the popup UI (EN + zh-Hans/zh-Hant) and update the generated designer.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| OneGateApp/Services/TokenManager.cs | Loads and persists custom token hashes; merges custom tokens into the embedded token list. |
| OneGateApp/Pages/WalletPage.xaml.cs | Adds popup invocation plumbing for the new toolbar action. |
| OneGateApp/Pages/WalletPage.xaml | Adds a new toolbar button to trigger “Add token”. |
| OneGateApp/Controls/Popups/AddTokenPopup.xaml.cs | Implements contract-hash parsing, token resolution, persistence, and error display. |
| OneGateApp/Controls/Popups/AddTokenPopup.xaml | New popup UI for entering a contract hash and submitting/canceling. |
| OneGateApp/Properties/Strings.resx | Adds EN strings for the new popup and action. |
| OneGateApp/Properties/Strings.zh-Hans.resx | Adds Simplified Chinese strings for the new popup and action. |
| OneGateApp/Properties/Strings.zh-Hant.resx | Adds Traditional Chinese strings for the new popup and action. |
| OneGateApp/Properties/Strings.Designer.cs | Regenerates strongly-typed accessors for newly added strings. |
Files not reviewed (1)
- OneGateApp/Properties/Strings.Designer.cs: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Latest review follow-up: addressed both Copilot comments in Changes:
Validation:
Screenshots: Screenshots are GitHub release assets only and are not committed to the repository. Ready for re-review. |
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.
What
The token universe was a static embedded
tokens.json— a NEP-17 not in that file was invisible and unaddable. This adds an Add token action (a new toolbar button on WalletPage) that opens a popup where the user pastes a contract hash; it resolves the token via the existingRpcClient.GetTokenInfo(validating it's a real NEP-17) and persists it.TokenManager.LoadTokensAsyncnow merges user-added tokens with the embedded list.Notes
TokenManager.cs,WalletPage.xaml(.cs), and a newAddTokenPopup— none of these are touched by any open PR. Uses a popup (not a routed page) specifically to avoid touchingAppShell.xaml.cs/MauiProgram.cs(which several PRs edit).