diff --git a/packages/transaction-request-intent/src/lib/__test__/unit/decoders.spec.ts b/packages/transaction-request-intent/src/lib/__test__/unit/decoders.spec.ts index e48b08e46..d2c5e48b8 100644 --- a/packages/transaction-request-intent/src/lib/__test__/unit/decoders.spec.ts +++ b/packages/transaction-request-intent/src/lib/__test__/unit/decoders.spec.ts @@ -5,7 +5,6 @@ import { ContractRegistry, InputType, Intents, - MessageInput, PERMIT2_ADDRESS, TransactionStatus, WalletType @@ -269,20 +268,6 @@ describe('decode', () => { }) }) describe('message and typed data input', () => { - it('decodes message', () => { - const message = 'Hello, world!' - const prefixedMessage = `\x19Ethereum Signed Message:\n${message.length}${message}` - const input: MessageInput = { - type: InputType.MESSAGE, - payload: prefixedMessage - } - - const decoded = decode({ input }) - expect(decoded).toEqual({ - type: Intents.SIGN_MESSAGE, - message - }) - }) it('decodes typed data', () => { const decoded = decode({ input: { diff --git a/packages/transaction-request-intent/src/lib/decoders/decode.ts b/packages/transaction-request-intent/src/lib/decoders/decode.ts index aa75b9163..b2f37e952 100644 --- a/packages/transaction-request-intent/src/lib/decoders/decode.ts +++ b/packages/transaction-request-intent/src/lib/decoders/decode.ts @@ -18,7 +18,6 @@ import { Intent, TypedDataIntent } from '../intent.types' import { MethodsMapping, SUPPORTED_METHODS } from '../supported-methods' import { isSupportedMethodId } from '../typeguards' import { - decodeMessage, decodePermit, decodePermit2, decodeTypedData, @@ -143,8 +142,6 @@ const decode = ({ input, config = defaultConfig }: { input: DecodeInput; config? } case InputType.TYPED_DATA: return decodeTypedDataInput(input) - case InputType.MESSAGE: - return decodeMessage(input) case InputType.RAW: return { type: Intents.SIGN_RAW, diff --git a/packages/transaction-request-intent/src/lib/domain.ts b/packages/transaction-request-intent/src/lib/domain.ts index beaa5b9f7..4afdac9f9 100644 --- a/packages/transaction-request-intent/src/lib/domain.ts +++ b/packages/transaction-request-intent/src/lib/domain.ts @@ -15,11 +15,6 @@ export type Raw = { algorithm: Alg } -export type MessageInput = { - type: InputType.MESSAGE - payload: string -} - export type RawInput = { type: InputType.RAW raw: Raw @@ -83,7 +78,7 @@ export type Config = { transactionRegistry?: TransactionRegistry supportedMethods?: MethodsMapping } -export type DecodeInput = TransactionInput | MessageInput | RawInput | TypedDataInput +export type DecodeInput = TransactionInput | RawInput | TypedDataInput type DecodeSuccess = { success: true @@ -103,7 +98,6 @@ export type SafeDecodeOutput = DecodeSuccess | DecodeError export enum InputType { TRANSACTION_REQUEST = 'transactionRequest', - MESSAGE = 'message', TYPED_DATA = 'typedData', RAW = 'raw' } diff --git a/packages/transaction-request-intent/src/lib/utils.ts b/packages/transaction-request-intent/src/lib/utils.ts index dd8a804e5..72a177408 100644 --- a/packages/transaction-request-intent/src/lib/utils.ts +++ b/packages/transaction-request-intent/src/lib/utils.ts @@ -24,7 +24,6 @@ import { ContractRegistry, ContractRegistryInput, Intents, - MessageInput, Misc, NULL_METHOD_ID, NativeTransferInput, @@ -184,16 +183,6 @@ export const decodeTypedData = (typedData: Eip712TypedData): SignTypedData => ({ }) }) -export const decodeMessage = (message: MessageInput): SignMessage => { - if (!message.payload.startsWith(presignMessagePrefix)) { - throw new DecoderError({ message: 'Invalid message prefix', status: 400 }) - } - return { - type: Intents.SIGN_MESSAGE, - message: message.payload.slice(presignMessagePrefix.length + 2) - } -} - export const decodePermit = (typedData: Eip712TypedData): Permit | null => { const { chainId, verifyingContract } = typedData.domain if (!isPermit(typedData.message) || !chainId || !verifyingContract) {