Skip to content

Commit

Permalink
Sign typed data (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-st authored Jun 1, 2024
1 parent 2745fbb commit 4150e8c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/smooth-seas-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"burner-connector": patch
---

Adds possibility to sign typed data
11 changes: 10 additions & 1 deletion packages/burner-connector/src/burnerConnector/burner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createConnector, normalizeChainId } from "@wagmi/core";
import { createConnector, normalizeChainId, type SignTypedDataParameters } from "@wagmi/core";
import type { EIP1193RequestFn, Hex, SendTransactionParameters, Transport, WalletRpcSchema } from "viem";
import {
http,
Expand Down Expand Up @@ -96,6 +96,15 @@ export const burner = () => {
return signature;
}

if (method === "eth_signTypedData_v4") {
// first param is address of the signer
// second param is stringified typed data
const stringifiedData = (params as [`0x${string}`, string])[1];
const signature = await client.signTypedData(JSON.parse(stringifiedData) as SignTypedDataParameters);

return signature;
}

if (method === "eth_accounts") {
return [burnerAccount.address];
}
Expand Down

0 comments on commit 4150e8c

Please sign in to comment.