-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce useEnsExpiry & useEnsRecordsWrite
- Loading branch information
Showing
5 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useQuery, type UseQueryResult } from '@tanstack/react-query' | ||
import { | ||
getExpiry, | ||
type GetExpiryParameters, | ||
type GetExpiryReturnType, | ||
} from '@ensdomains/ensjs/public' | ||
import type { ParamWithClients } from '../client.js' | ||
import { fallbackQueryClient } from '../query.js' | ||
|
||
export type UseEnsExpiryParams = ParamWithClients<GetExpiryParameters> | ||
|
||
export type UseEnsExpiryReturnType = GetExpiryReturnType | ||
|
||
/** | ||
* Returns expiry of a name | ||
* | ||
* Keep in mind that this function is limited to second-level .eth names (luc.eth, nick.eth, etc) | ||
* | ||
* @param params - {@link UseEnsExpiryParams} | ||
* @returns - {@link UseEnsExpiryReturnType} | ||
*/ | ||
export const useEnsExpiry = ( | ||
params: UseEnsExpiryParams, | ||
): UseQueryResult<UseEnsExpiryReturnType> => { | ||
const { client, queryClient = fallbackQueryClient } = params | ||
|
||
return useQuery( | ||
{ | ||
queryKey: ['ensjs', 'ens-expiry', params.name], | ||
queryFn: async () => { | ||
const result = await getExpiry(client, params) | ||
|
||
return result | ||
}, | ||
}, | ||
queryClient, | ||
) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useAccount } from 'wagmi' | ||
import type { ParamWithClients } from '../client.js' | ||
|
||
export type UseEnsRecordsWriteParams = ParamWithClients<{}> | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export const useEnsRecordsWrite = ( | ||
_params: UseEnsRecordsWriteParams, | ||
config?: any, | ||
) => { | ||
const { address } = useAccount({ config }) | ||
// const client = useWalletClient() | ||
|
||
console.log('Hello ', address) | ||
|
||
return { data: undefined } | ||
// return setRecords(client as any, params) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.