-
Notifications
You must be signed in to change notification settings - Fork 51
currencyCode -> tokenId followup fixes #1008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ad750ee
e67a9cc
363a70a
0790fb1
7cd28e3
da13f12
0ab8caa
6b5b582
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,11 +77,11 @@ export const builtinTokens: EdgeTokenMap = { | |
| } | ||
| }, | ||
| 'USD-rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq': { | ||
| currencyCode: 'USD.gh', | ||
| currencyCode: 'USD', | ||
| displayName: 'Gatehub USD', | ||
| denominations: [ | ||
| { | ||
| name: 'USD.gh', | ||
| name: 'USD', | ||
| multiplier: '1000000000000000000' | ||
| } | ||
| ], | ||
|
|
@@ -91,11 +91,11 @@ export const builtinTokens: EdgeTokenMap = { | |
| } | ||
| }, | ||
| 'EUR-rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq': { | ||
| currencyCode: 'EUR.gh', | ||
| currencyCode: 'EUR', | ||
| displayName: 'Gatehub EUR', | ||
| denominations: [ | ||
| { | ||
| name: 'EUR.gh', | ||
| name: 'EUR', | ||
| multiplier: '1000000000000000000' | ||
| } | ||
| ], | ||
|
|
@@ -105,11 +105,11 @@ export const builtinTokens: EdgeTokenMap = { | |
| } | ||
| }, | ||
| 'USD-rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B': { | ||
| currencyCode: 'USD.bs', | ||
| currencyCode: 'USD', | ||
| displayName: 'Bitstamp USD', | ||
| denominations: [ | ||
| { | ||
| name: 'USD.bs', | ||
| name: 'USD', | ||
| multiplier: '1000000000000000000' | ||
| } | ||
| ], | ||
|
|
@@ -119,11 +119,11 @@ export const builtinTokens: EdgeTokenMap = { | |
| } | ||
| }, | ||
| 'EUR-rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B': { | ||
| currencyCode: 'EUR.bs', | ||
| currencyCode: 'EUR', | ||
| displayName: 'Bitstamp EUR', | ||
| denominations: [ | ||
| { | ||
| name: 'EUR.bs', | ||
| name: 'EUR', | ||
| multiplier: '1000000000000000000' | ||
| } | ||
| ], | ||
|
|
@@ -133,11 +133,11 @@ export const builtinTokens: EdgeTokenMap = { | |
| } | ||
| }, | ||
| 'USD-rEn9eRkX25wfGPLysUMAvZ84jAzFNpT5fL': { | ||
| currencyCode: 'USD.st', | ||
| currencyCode: 'USD', | ||
| displayName: 'Stably USD', | ||
| denominations: [ | ||
| { | ||
| name: 'USD.st', | ||
| name: 'USD', | ||
| multiplier: '1000000000000000000' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Ripple migration loses data due to renamed currency codesThe Ripple token currency codes were changed from unique values ( Additional Locations (1) |
||
| } | ||
| ], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,12 +218,11 @@ export class ZcashEngine extends CurrencyEngine< | |
| updateBalance(tokenId: EdgeTokenId, balance: string): void { | ||
| const currentBalance = this.getBalance({ tokenId }) | ||
| if (currentBalance == null || !eq(balance, currentBalance)) { | ||
| this.updateBalance(tokenId, balance) | ||
| this.walletLocalData.totalBalances[''] = balance | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: ZcashEngine ignores tokenId when storing balanceThe |
||
| this.walletLocalDataDirty = true | ||
| this.warn(`${tokenId}: token Address balance: ${balance}`) | ||
| this.currencyEngineCallbacks.onTokenBalanceChanged(tokenId, balance) | ||
| } | ||
| this.tokenCheckBalanceStatus.set(tokenId, 1) | ||
| } | ||
|
|
||
| isSynced(): boolean { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Re-migration destroys already-migrated token-only wallet data
The
needsMigrationheuristic usesdata[''] == nullto detect unmigrated data, assuming migrated data always has an empty string key for native currency. However, wallets with only token transactions (no native currency transactions) won't have this key after migration. On subsequent loads, the heuristic incorrectly triggers re-migration on already-migrated data. WhenmigrateCurrencyCodeToTokenIdprocesses tokenId keys (like contract addresses), they don't match any token'scurrencyCode, causing all entries to be silently dropped via thecontinuestatement, resulting in complete transaction history loss.Additional Locations (1)
src/common/CurrencyEngine.ts#L336-L339Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor makes a fair point. Would it be possible to set
txIdList[''] ?= []and so forth to ensure we never double-migrate? Otherwise, perhaps adding aotherData.tokenIdMigratedflag could prevent double migrations.