File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
packages/thirdweb/src/wallets/injected Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ Add signAuthorization support to 1193 provider
Original file line number Diff line number Diff line change
1
+ import * as ox__Authorization from "ox/Authorization" ;
1
2
import type { EIP1193Provider } from "viem" ;
2
3
import {
3
4
getTypesForEIP712Domain ,
@@ -14,6 +15,7 @@ import {
14
15
import type { Chain } from "../../chains/types.js" ;
15
16
import { getCachedChain , getChainMetadata } from "../../chains/utils.js" ;
16
17
import type { ThirdwebClient } from "../../client/client.js" ;
18
+ import type { AuthorizationRequest } from "../../transaction/actions/eip7702/authorization.js" ;
17
19
import { getAddress } from "../../utils/address.js" ;
18
20
import {
19
21
type Hex ,
@@ -265,6 +267,13 @@ function createAccount({
265
267
params : [ messageToSign , getAddress ( account . address ) ] ,
266
268
} ) ;
267
269
} ,
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
+ } ,
268
277
async signTypedData ( typedData ) {
269
278
if ( ! provider || ! account . address ) {
270
279
throw new Error ( "Provider not setup" ) ;
You can’t perform that action at this time.
0 commit comments