@biconomy/abstractjs
Version:
SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.
34 lines • 1.11 kB
JavaScript
import { concatHex } from "viem";
const DEFAULT_PREFIX = "0x177eee00";
/**
* Signs a quote using the provided account's signer or the client's default account.
* The signature is required for executing the quote through the MEE service.
*
* @param client - The Mee client instance
* @param params - Parameters for signing the quote
* @param params.quote - The quote to sign
* @param [params.account] - Optional account to use for signing
*
* @returns Promise resolving to the quote payload with added signature
*
* @example
* ```typescript
* const signedQuote = await signQuote(meeClient, {
* quote: quotePayload,
* account: smartAccount // Optional
* });
* ```
*/
export const signQuote = async (client, params) => {
const { account: account_ = client.account, quote } = params;
const signer = account_.signer;
const signedMessage = await signer.signMessage({
message: { raw: quote.hash }
});
return {
...quote,
signature: concatHex([DEFAULT_PREFIX, signedMessage])
};
};
export default signQuote;
//# sourceMappingURL=signQuote.js.map