From 17ee373d1d27dba95384a4689d6f48c1fc6cf9e6 Mon Sep 17 00:00:00 2001 From: Filipp Makarov Date: Mon, 16 Feb 2026 13:48:04 +0300 Subject: [PATCH 1/3] chore: add p256 simple mode sig type --- src/modules/quotes/constants.ts | 1 + src/modules/quotes/quotes.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/quotes/constants.ts b/src/modules/quotes/constants.ts index d14981fa..ed86c272 100644 --- a/src/modules/quotes/constants.ts +++ b/src/modules/quotes/constants.ts @@ -4,6 +4,7 @@ export enum MeeSignatureType { ERC20_PERMIT = "0x177eee02", MM_DTK = "0x177eee03", SAFE_SA = "0x177eee04", + OFF_CHAIN_P256 = "0x177eee10" } export const MEE_SIGNATURE_TYPE_OFFSET = 4; diff --git a/src/modules/quotes/quotes.service.ts b/src/modules/quotes/quotes.service.ts index 6ac62e3b..a88f060c 100644 --- a/src/modules/quotes/quotes.service.ts +++ b/src/modules/quotes/quotes.service.ts @@ -725,7 +725,7 @@ export class QuotesService { let quoteType: QuoteType; // Detect quote type if (!options.quoteType) { - if (signatureType === MeeSignatureType.OFF_CHAIN) { + if (signatureType === MeeSignatureType.OFF_CHAIN || signatureType === MeeSignatureType.OFF_CHAIN_P256) { quoteType = "simple"; } else if (signatureType === MeeSignatureType.ON_CHAIN) { quoteType = "onchain"; @@ -761,7 +761,7 @@ export class QuotesService { const merkleTree = await withTrace( "exec.createMerkleTree", async () => - await this.merkleTreeService.createMerkleTree( + this.merkleTreeService.createMerkleTree( packedMeeUserOps, quoteType === "simple", isEIP712SupportedMeeVersion, From b82a2f345b5876ff2dae4359ab2ffedddf3639e7 Mon Sep 17 00:00:00 2001 From: Filipp Makarov Date: Mon, 16 Feb 2026 13:52:01 +0300 Subject: [PATCH 2/3] chore: support both eoa and p256 for simple mode + refactor --- src/modules/quotes/quotes.service.ts | 42 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/modules/quotes/quotes.service.ts b/src/modules/quotes/quotes.service.ts index a88f060c..66a4dbe4 100644 --- a/src/modules/quotes/quotes.service.ts +++ b/src/modules/quotes/quotes.service.ts @@ -794,14 +794,14 @@ export class QuotesService { let transaction: GetTransactionReturnType; - switch (signatureType) { - case MeeSignatureType.OFF_CHAIN: - case MeeSignatureType.ERC20_PERMIT: - case MeeSignatureType.MM_DTK: - case MeeSignatureType.SAFE_SA: + switch (quoteType) { + case "simple": + case "permit": + case "mm-dtk": + case "safe-sa": break; - case MeeSignatureType.ON_CHAIN: { + case "onchain": { const [hash, chainId] = decodeAbiParameters( [ { type: "bytes32" }, // @@ -849,7 +849,7 @@ export class QuotesService { default: { throw new BadRequestException( - `Unsupported signature type (${signatureType})`, + `Unsupported quote type (${quoteType})`, ); } } @@ -890,8 +890,8 @@ export class QuotesService { let signature: Hex; - switch (signatureType) { - case MeeSignatureType.OFF_CHAIN: { + switch (quoteType) { + case "simple": { if (isSessionExists) { if (isEIP712SupportedMeeVersion) { signature = concatHex([ @@ -993,7 +993,7 @@ export class QuotesService { break; } - case MeeSignatureType.ON_CHAIN: { + case "onchain": { const { r, s, v, ...tx } = transaction; const serializableTx = { ...tx, data: tx.input, input: undefined }; @@ -1009,7 +1009,7 @@ export class QuotesService { break; } - case MeeSignatureType.ERC20_PERMIT: { + case "permit": { if (isStxValidatorSupportedMeeVersion) { // Stx validator permit signature decoding and re-packing // owner is added as an extra parameter to the signature data @@ -1163,7 +1163,7 @@ export class QuotesService { break; } - case MeeSignatureType.MM_DTK: { + case "mm-dtk": { const delegateManagerAbi = { name: "delegationManager", type: "address", @@ -1241,7 +1241,7 @@ export class QuotesService { break; } - case MeeSignatureType.SAFE_SA: { + case "safe-sa": { // SafeTxnData struct definition from stx-contracts const safeTxnDataAbi = { name: "safeTxnData", @@ -1313,7 +1313,7 @@ export class QuotesService { default: { throw new BadRequestException( - `Unsupported signature type (${signatureType})`, + `Unsupported quote type (${quoteType})`, ); } } @@ -1425,7 +1425,7 @@ export class QuotesService { return await this.entryPointService.simulateHandleOps( paymentMeeUserOp, { - retries: signatureType === MeeSignatureType.ON_CHAIN ? 20 : 0, + retries: quoteType === "onchain" ? 20 : 0, useStorage: false, }, ); @@ -1443,24 +1443,24 @@ export class QuotesService { ); if (sigFailed) { - switch (signatureType) { - case MeeSignatureType.OFF_CHAIN: + switch (quoteType) { + case "simple": throw new BadRequestException( "Failed to verify your supertransaction signature. Please check your signature.", ); - case MeeSignatureType.ERC20_PERMIT: + case "permit": throw new BadRequestException( "Failed to verify your supertransaction signature. Please check your permit signature and permit token compatibility.", ); - case MeeSignatureType.ON_CHAIN: + case "onchain": throw new BadRequestException( "Failed to verify your supertransaction signature. Please check your onchain transaction signature.", ); - case MeeSignatureType.MM_DTK: + case "mm-dtk": throw new BadRequestException( "Failed to verify your supertransaction signature. Please check your metamask delegator signature.", ); - case MeeSignatureType.SAFE_SA: + case "safe-sa": throw new BadRequestException( "Failed to verify your supertransaction signature. Please check your Safe smart account signature.", ); From ee3d50d6f81e858d7399e1fa5952c14c5e5f7950 Mon Sep 17 00:00:00 2001 From: Filipp Makarov Date: Mon, 16 Feb 2026 13:52:38 +0300 Subject: [PATCH 3/3] chore: format --- src/modules/quotes/constants.ts | 2 +- src/modules/quotes/quotes.service.ts | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/modules/quotes/constants.ts b/src/modules/quotes/constants.ts index ed86c272..e36481c5 100644 --- a/src/modules/quotes/constants.ts +++ b/src/modules/quotes/constants.ts @@ -4,7 +4,7 @@ export enum MeeSignatureType { ERC20_PERMIT = "0x177eee02", MM_DTK = "0x177eee03", SAFE_SA = "0x177eee04", - OFF_CHAIN_P256 = "0x177eee10" + OFF_CHAIN_P256 = "0x177eee10", } export const MEE_SIGNATURE_TYPE_OFFSET = 4; diff --git a/src/modules/quotes/quotes.service.ts b/src/modules/quotes/quotes.service.ts index 66a4dbe4..43cb8c8a 100644 --- a/src/modules/quotes/quotes.service.ts +++ b/src/modules/quotes/quotes.service.ts @@ -725,7 +725,10 @@ export class QuotesService { let quoteType: QuoteType; // Detect quote type if (!options.quoteType) { - if (signatureType === MeeSignatureType.OFF_CHAIN || signatureType === MeeSignatureType.OFF_CHAIN_P256) { + if ( + signatureType === MeeSignatureType.OFF_CHAIN || + signatureType === MeeSignatureType.OFF_CHAIN_P256 + ) { quoteType = "simple"; } else if (signatureType === MeeSignatureType.ON_CHAIN) { quoteType = "onchain"; @@ -758,15 +761,13 @@ export class QuotesService { TRUSTED_GAS_TANK_ADDRESS.toLowerCase()) || false; - const merkleTree = await withTrace( - "exec.createMerkleTree", - async () => - this.merkleTreeService.createMerkleTree( - packedMeeUserOps, - quoteType === "simple", - isEIP712SupportedMeeVersion, - isTrustedSponsorship, - ), + const merkleTree = await withTrace("exec.createMerkleTree", async () => + this.merkleTreeService.createMerkleTree( + packedMeeUserOps, + quoteType === "simple", + isEIP712SupportedMeeVersion, + isTrustedSponsorship, + ), )(); if (merkleTree.root !== hash) { @@ -848,9 +849,7 @@ export class QuotesService { } default: { - throw new BadRequestException( - `Unsupported quote type (${quoteType})`, - ); + throw new BadRequestException(`Unsupported quote type (${quoteType})`); } }