diff --git a/.changeset/smooth-seas-act.md b/.changeset/smooth-seas-act.md new file mode 100644 index 0000000..ba90c0f --- /dev/null +++ b/.changeset/smooth-seas-act.md @@ -0,0 +1,5 @@ +--- +"burner-connector": patch +--- + +Adds possibility to sign typed data diff --git a/packages/burner-connector/src/burnerConnector/burner.ts b/packages/burner-connector/src/burnerConnector/burner.ts index 8055e4d..fc17f23 100644 --- a/packages/burner-connector/src/burnerConnector/burner.ts +++ b/packages/burner-connector/src/burnerConnector/burner.ts @@ -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, @@ -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]; }