-
Notifications
You must be signed in to change notification settings - Fork 5
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
BNS domains that resolve to addresses now searchable #57
Conversation
async fetchBNSDomain(domain_name: string, tld: string): Promise<any> { | ||
await this._hasPingedApi(); | ||
return this._http | ||
.post<any>(`${this.httpApi}/v1/account/bns`, { |
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.
Could we get some stronger typings here? The api is versioned so we should know what schema to expect.
Specifically looking to remove the any
here.
if (!address.startsWith('ban_')) { | ||
const parts = address.split('.'); | ||
if (parts.length === 2) { | ||
//search in api | ||
try { | ||
const domain = await this.apiService.fetchBNSDomain(parts[0], parts[1]); | ||
if (domain.domain?.resolved_address) { | ||
return this._redirectToAccountPage(domain.domain?.resolved_address); | ||
} | ||
} catch (_) {} | ||
} |
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.
Could we get a quick comment here explaining what this does? If not a ban address, assume it's BNS?
isValidBNSDomain(bns: string): boolean { | ||
const parts = bns.split('.'); | ||
//later, can also check for illegal characters once that is more settled | ||
return parts.length === 2 && parts[0].length <= 32; | ||
} |
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.
Could this be placed in the UtilService & then used here & in the AccountComponent?
if (!address) { | ||
return; | ||
} | ||
|
||
if (!address.startsWith('ban_')) { | ||
const parts = address.split('.'); | ||
if (parts.length === 2) { |
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.
Use isValidBNSDomain
utility function here?
@dev-ptera Hopefully that should address the review. I did add |
tested and working locally