Skip to content

Signing an Uint8Array (etherjs v6 => viem) #495

Closed Answered by armand-git
armand-git asked this question in Question
Discussion options

You must be logged in to vote

Hi!
Yes!

Here an example I use for identification : My backend send a nonce to be signed.

First create yours types like this :

export const MyBackendDomain = {
    name: 'MyBackendDomain',
    version: '1'
} as const;

export const MyBackendTypes = {
    linkWallet: [
        { name: 'action', type: 'string' },
        { name: 'account', type: 'address' },
        { name: 'nonce', type: 'uint256' },
    ],
    otherType: [
        { name: 'params1', type: 'string' },
        { name: 'params2', type: 'address' },
        { name: 'params3', type: 'string' },
    ],
} as const;

On your front, use signTypedData :

  const { address: userAccount } = useAccount();
  const { data: walletClient } = 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by armand-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants