diff --git a/.changeset/eighty-taxis-own.md b/.changeset/eighty-taxis-own.md new file mode 100644 index 00000000000..afa820e2c45 --- /dev/null +++ b/.changeset/eighty-taxis-own.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Add signAuthorization support to 1193 provider diff --git a/packages/thirdweb/src/wallets/injected/index.ts b/packages/thirdweb/src/wallets/injected/index.ts index 7ac61953255..03620be9206 100644 --- a/packages/thirdweb/src/wallets/injected/index.ts +++ b/packages/thirdweb/src/wallets/injected/index.ts @@ -1,3 +1,4 @@ +import * as ox__Authorization from "ox/Authorization"; import type { EIP1193Provider } from "viem"; import { getTypesForEIP712Domain, @@ -14,6 +15,7 @@ import { import type { Chain } from "../../chains/types.js"; import { getCachedChain, getChainMetadata } from "../../chains/utils.js"; import type { ThirdwebClient } from "../../client/client.js"; +import type { AuthorizationRequest } from "../../transaction/actions/eip7702/authorization.js"; import { getAddress } from "../../utils/address.js"; import { type Hex, @@ -265,6 +267,13 @@ function createAccount({ params: [messageToSign, getAddress(account.address)], }); }, + async signAuthorization(authorization: AuthorizationRequest) { + const payload = ox__Authorization.getSignPayload(authorization); + return await provider.request({ + method: "eth_sign", + params: [getAddress(account.address), payload], + }); + }, async signTypedData(typedData) { if (!provider || !account.address) { throw new Error("Provider not setup");