Skip to content
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

feature: domain resolver #2866

Merged
merged 66 commits into from
Dec 19, 2023
Merged

feature: domain resolver #2866

merged 66 commits into from
Dec 19, 2023

Conversation

banklesss
Copy link
Contributor

@banklesss banklesss commented Nov 1, 2023

Working with unstoppable and $handle domains at the moment

Related to YOMO-898

TODO:

  • add test
  • add proper typing
  • refactor folder structure
  • add cns resolver
  • add $handle resolver
  • add unstoppable domains resolver
  • use fetcher instead of axios directly
  • improve error management
  • UI update
  • React Context Provider
  • Initial message storage API
  • preprod support

@banklesss banklesss requested a review from stackchain November 17, 2023 12:26
@@ -54,7 +54,7 @@ export const LINEAR_FEE = {
} as const
export const MINIMUM_UTXO_VAL = '1000000'

export const HISTORY_REFRESH_TIME = 25000
export const HISTORY_REFRESH_TIME = 35000
Copy link
Member

@stackchain stackchain Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avg block is ~20s, doing below 30s has a high chance to sync with no updates, ideal 30/worst 40/avg 35s. (suggesting to add as a config) for the user

@@ -742,7 +742,7 @@ export const useIsOnline = (
() => true,
() => false,
),
refetchInterval: 5000,
refetchInterval: 15000,
Copy link
Member

@stackchain stackchain Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too often, under a block is fine avg 20s

if (!receiver.includes('.')) throw new Resolver.Errors.InvalidDomain()
if (!isCnsDomain(receiver))
return Promise.reject(new Resolver.Errors.UnsupportedTld())
return Promise.reject(new Resolver.Errors.UnsupportedTld())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsupported for now, needs implementation.

// ultra_rare = 'ultra_rare', // - 2 characters
// legendary = 'legendary' // - 1 character
// }
rarity: string // translated to string only
Copy link
Member

@stackchain stackchain Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rarity on handle API is an enum, we translate it to string for now.

@@ -0,0 +1,8 @@
import {ResolverNameServer} from './service'

export type ResolverReceiver = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

receiver is no longer a string and becomes a new data structure,
resolve => domain/address/receiver to use/resolve aka URL
as => type, domain means supported domain
selectedNameServer defaults to the only response if === 1 aka NS
addressRecords the list of addresses per name server aka A record

@stackchain stackchain marked this pull request as ready for review December 18, 2023 14:06
@stackchain stackchain added feature and removed blocked Blocked labels Dec 18, 2023
@stackchain stackchain added this to the 4.25.0 milestone Dec 18, 2023
Copy link
Collaborator

@michaeljscript michaeljscript left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried and works well!

import {Api, Resolver} from '@yoroi/types'
import {fetchData, FetchData, handleApiError, isLeft} from '@yoroi/common'
import {z} from 'zod'
import {AxiosRequestConfig} from 'axios'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be wrapped in @yoroi/common?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yap, is a little bit leaky since is exposing the "fetcher" config directly, but also didn't want a 1:1, it's a @banklesss good call for an improvement, maybe we can expose only what we are actually using.

stackchain and others added 3 commits December 19, 2023 09:54
Co-authored-by: banklesss <105349292+banklesss@users.noreply.github.com>
Signed-off-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com>
@@ -18,7 +19,7 @@ export type TextInputProps = RNTextInputProps &
Omit<React.ComponentProps<typeof RNPTextInput>, 'theme'> & {
containerStyle?: ViewStyle
renderComponentStyle?: ViewStyle
helperText?: string
helper?: string | React.ReactNode
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
helper?: string | React.ReactNode
helper?: React.ReactNode

@stackchain stackchain merged commit 644f5c2 into develop Dec 19, 2023
2 checks passed
@stackchain stackchain deleted the feature/resolver branch December 19, 2023 10:04
SorinC6 pushed a commit that referenced this pull request Jan 9, 2024
Signed-off-by: banklesss <105349292+banklesss@users.noreply.github.com>
Signed-off-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com>
Co-authored-by: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants