Skip to content

Commit 1759112

Browse files
[SDK] Add signAuthorization support to 1193 provider (#8029)
1 parent 85d6074 commit 1759112

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/eighty-taxis-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Add signAuthorization support to 1193 provider

packages/thirdweb/src/wallets/injected/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as ox__Authorization from "ox/Authorization";
12
import type { EIP1193Provider } from "viem";
23
import {
34
getTypesForEIP712Domain,
@@ -14,6 +15,7 @@ import {
1415
import type { Chain } from "../../chains/types.js";
1516
import { getCachedChain, getChainMetadata } from "../../chains/utils.js";
1617
import type { ThirdwebClient } from "../../client/client.js";
18+
import type { AuthorizationRequest } from "../../transaction/actions/eip7702/authorization.js";
1719
import { getAddress } from "../../utils/address.js";
1820
import {
1921
type Hex,
@@ -265,6 +267,13 @@ function createAccount({
265267
params: [messageToSign, getAddress(account.address)],
266268
});
267269
},
270+
async signAuthorization(authorization: AuthorizationRequest) {
271+
const payload = ox__Authorization.getSignPayload(authorization);
272+
return await provider.request({
273+
method: "eth_sign",
274+
params: [getAddress(account.address), payload],
275+
});
276+
},
268277
async signTypedData(typedData) {
269278
if (!provider || !account.address) {
270279
throw new Error("Provider not setup");

0 commit comments

Comments
 (0)