@alchemy/aa-ethers
Advanced tools
Comparing version 3.0.0-alpha.9 to 3.0.0-alpha.10
@@ -63,3 +63,3 @@ "use strict"; | ||
? message | ||
: { raw: message }, | ||
: { raw: (0, viem_1.isHex)(message) ? (0, viem_1.toBytes)(message) : message }, | ||
}); | ||
@@ -66,0 +66,0 @@ } |
@@ -9,3 +9,3 @@ "use strict"; | ||
getAddress: async () => Promise.resolve(wallet.address), | ||
signMessage: async (msg) => (await wallet.signMessage(msg)), | ||
signMessage: async (msg) => (await wallet.signMessage(typeof msg === "string" ? msg : msg.raw)), | ||
signTypedData: async (params) => { | ||
@@ -22,3 +22,3 @@ return (await wallet._signTypedData(params.domain ?? {}, params.types, params.message)); | ||
getAddress: async () => signer.getAddress(), | ||
signMessage: async (msg) => (await signer.signMessage(msg)), | ||
signMessage: async (msg) => (await signer.signMessage(typeof msg === "string" ? msg : msg.raw)), | ||
signTypedData: async (_params) => { | ||
@@ -25,0 +25,0 @@ throw new Error("signTypedData is not supported for ethers signers; use Wallet"); |
@@ -5,3 +5,3 @@ import { AccountNotFoundError, resolveProperties, } from "@alchemy/aa-core"; | ||
import {} from "@ethersproject/providers"; | ||
import { isHex } from "viem"; | ||
import { isHex, toBytes } from "viem"; | ||
import { EthersProviderAdapter } from "./provider-adapter.js"; | ||
@@ -63,3 +63,3 @@ const hexlifyOptional = (value) => { | ||
? message | ||
: { raw: message }, | ||
: { raw: isHex(message) ? toBytes(message) : message }, | ||
}); | ||
@@ -66,0 +66,0 @@ } |
@@ -7,3 +7,3 @@ import { Wallet } from "@ethersproject/wallet"; | ||
getAddress: async () => Promise.resolve(wallet.address), | ||
signMessage: async (msg) => (await wallet.signMessage(msg)), | ||
signMessage: async (msg) => (await wallet.signMessage(typeof msg === "string" ? msg : msg.raw)), | ||
signTypedData: async (params) => { | ||
@@ -19,3 +19,3 @@ return (await wallet._signTypedData(params.domain ?? {}, params.types, params.message)); | ||
getAddress: async () => signer.getAddress(), | ||
signMessage: async (msg) => (await signer.signMessage(msg)), | ||
signMessage: async (msg) => (await signer.signMessage(typeof msg === "string" ? msg : msg.raw)), | ||
signTypedData: async (_params) => { | ||
@@ -22,0 +22,0 @@ throw new Error("signTypedData is not supported for ethers signers; use Wallet"); |
{ | ||
"name": "@alchemy/aa-ethers", | ||
"license": "MIT", | ||
"version": "3.0.0-alpha.9", | ||
"version": "3.0.0-alpha.10", | ||
"description": "Ethers.js wrapper for @alchemy/aa-core", | ||
@@ -52,3 +52,3 @@ "author": "Alchemy", | ||
"dependencies": { | ||
"@alchemy/aa-core": "^3.0.0-alpha.9", | ||
"@alchemy/aa-core": "^3.0.0-alpha.10", | ||
"@ethersproject/abi": "^5.7.0", | ||
@@ -71,3 +71,3 @@ "@ethersproject/abstract-signer": "^5.7.0", | ||
}, | ||
"gitHead": "1ea467e0385f7cfb6815aa4b055d4976a41c940b" | ||
"gitHead": "d8417cd79c27f02686cbed3bd43a8aff5bec8fb2" | ||
} |
@@ -17,3 +17,3 @@ import { | ||
} from "@ethersproject/providers"; | ||
import { isHex } from "viem"; | ||
import { isHex, toBytes } from "viem"; | ||
import { EthersProviderAdapter } from "./provider-adapter.js"; | ||
@@ -74,3 +74,3 @@ | ||
? message | ||
: { raw: message }, | ||
: { raw: isHex(message) ? toBytes(message) : message }, | ||
}); | ||
@@ -77,0 +77,0 @@ } |
import type { Address, SmartAccountSigner } from "@alchemy/aa-core"; | ||
import type { Signer } from "@ethersproject/abstract-signer"; | ||
import { Wallet } from "@ethersproject/wallet"; | ||
import type { TypedData, TypedDataDefinition } from "viem"; | ||
import type { SignableMessage, TypedData, TypedDataDefinition } from "viem"; | ||
@@ -18,4 +18,6 @@ /** | ||
getAddress: async () => Promise.resolve(wallet.address as `0x${string}`), | ||
signMessage: async (msg: Uint8Array | string) => | ||
(await wallet.signMessage(msg)) as `0x${string}`, | ||
signMessage: async (msg: SignableMessage) => | ||
(await wallet.signMessage( | ||
typeof msg === "string" ? msg : msg.raw | ||
)) as `0x${string}`, | ||
signTypedData: async < | ||
@@ -49,4 +51,6 @@ const TTypedData extends TypedData | { [key: string]: unknown }, | ||
getAddress: async () => signer.getAddress() as Promise<Address>, | ||
signMessage: async (msg: Uint8Array | string) => | ||
(await signer.signMessage(msg)) as `0x${string}`, | ||
signMessage: async (msg: SignableMessage) => | ||
(await signer.signMessage( | ||
typeof msg === "string" ? msg : msg.raw | ||
)) as `0x${string}`, | ||
signTypedData: async < | ||
@@ -53,0 +57,0 @@ const TTypedData extends TypedData | { [key: string]: unknown }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
73002
800