Skip to content

Commit

Permalink
Issue #124
Browse files Browse the repository at this point in the history
  • Loading branch information
DVitaliy committed Dec 9, 2024
1 parent f0d02db commit d525377
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hooks/useTheSiwe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ interface ISiwe {
IssuedAt: string
ExpirationAt: string
}
type TProps = () => Partial<ISiwe>
type TProps = () => Promise<Partial<ISiwe>>

export const useTheSiwe = (props: TProps) => {
const thePoolz = useThePoolz()
const { web3, account } = thePoolz

const templateEip4361message = useCallback(() => {
const { Domain, URI, Statement, Version, ChainId, Nonce, IssuedAt, ExpirationAt } = props()
const templateEip4361message = useCallback(async () => {
const { Domain, URI, Statement, Version, ChainId, Nonce, IssuedAt, ExpirationAt } = await props()
const { host: domain, href: uri } = window.location
return `${Domain ?? domain} wants you to sign in with your Ethereum account:
${account}
Expand All @@ -36,7 +36,7 @@ Expiration Time: ${ExpirationAt ?? new Date(new Date().getTime() + 1000 * 60 * 6
return useMemo(() => {
const signInWithEthereum = async () => {
if (!web3.currentProvider || !account) throw new Error("No web3 provider or account")
const eip4361message = templateEip4361message()
const eip4361message = await templateEip4361message()
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const signature = (await web3.currentProvider.request({
Expand Down

0 comments on commit d525377

Please sign in to comment.