-
Notifications
You must be signed in to change notification settings - Fork 290
Resolve ZcashNames (.zec) in Zcash send and tx history #6000
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
base: develop
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { useEffect, useState } from 'react' | ||
|
|
||
| import { reverseResolveZnsAddress } from '../util/zns' | ||
|
|
||
| const cache = new Map<string, string | null>() | ||
| const inflight = new Map<string, Promise<string | null>>() | ||
|
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. Module-level ZNS caches never cleared on logoutLow Severity The module-level Additional Locations (1)Triggered by project rule: Bugbot Review Rules Reviewed by Cursor Bugbot for commit 0ccd68b. Configure here. |
||
|
|
||
| const lookupZnsName = async (address: string): Promise<string | null> => { | ||
| if (cache.has(address)) return cache.get(address) ?? null | ||
| let promise = inflight.get(address) | ||
| if (promise == null) { | ||
| promise = reverseResolveZnsAddress(address).catch((_err: unknown) => null) | ||
| inflight.set(address, promise) | ||
| } | ||
| const result = await promise | ||
| cache.set(address, result) | ||
| inflight.delete(address) | ||
| return result | ||
| } | ||
|
|
||
| export const useZnsName = ( | ||
| pluginId: string, | ||
| address: string | undefined | ||
| ): string | null => { | ||
| const enabled = pluginId === 'zcash' && address != null && address !== '' | ||
| const [name, setName] = useState<string | null>( | ||
| enabled ? cache.get(address) ?? null : null | ||
| ) | ||
|
|
||
| useEffect(() => { | ||
| if (!enabled) return | ||
| let cancelled = false | ||
| lookupZnsName(address) | ||
| .then(result => { | ||
| if (!cancelled) setName(result) | ||
| }) | ||
| .catch((_err: unknown) => null) | ||
| return () => { | ||
| cancelled = true | ||
| } | ||
| }, [enabled, address]) | ||
|
|
||
| return name | ||
| } | ||


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.
AddressModal drops ZNS name on submit
High Severity
When resolving
.zecnames,AddressModalreturns the resolved Zcash address instead of the original.zecinput. This differs from Zano alias handling, causing the original.zecname to be lost and not propagated tospendTarget.otherParamsormetadata.namefor transaction metadata.Reviewed by Cursor Bugbot for commit b48db4d. Configure here.