From 6b1a335a66b44b7ab2f8d7601d23ba1399d67be2 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Thu, 2 May 2024 11:10:47 +0200 Subject: [PATCH 1/4] small typing fix --- extension/src/browser/Drawer/RolePermissionCheck.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extension/src/browser/Drawer/RolePermissionCheck.tsx b/extension/src/browser/Drawer/RolePermissionCheck.tsx index 9680c590..b8df9ffa 100644 --- a/extension/src/browser/Drawer/RolePermissionCheck.tsx +++ b/extension/src/browser/Drawer/RolePermissionCheck.tsx @@ -1,11 +1,15 @@ import React, { useMemo } from 'react' import { useEffect, useState } from 'react' import { RiGroupLine } from 'react-icons/ri' -import { encodeSingle, TransactionInput } from 'react-multisend' +import { + encodeSingle, + MetaTransaction, + TransactionInput, +} from 'react-multisend' import { Flex, Tag } from '../../components' import { useApplicableTranslation } from '../../transactionTranslations' -import { Connection, JsonRpcError, TransactionData } from '../../types' +import { Connection, JsonRpcError } from '../../types' import { decodeRolesV1Error } from '../../utils' import { decodeGenericError, @@ -23,7 +27,7 @@ import { useTenderlyProvider } from '../../providers' import { TenderlyProvider } from '../../providers/ProvideTenderly' const simulateRolesTransaction = async ( - encodedTransaction: TransactionData, + encodedTransaction: MetaTransaction, connection: Connection, tenderlyProvider: TenderlyProvider ) => { From a0015388bafad1563ea7dddb9c9c4055d6a9984f Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Thu, 2 May 2024 11:11:12 +0200 Subject: [PATCH 2/4] allow connecting to spark via safe apps bridge --- extension/src/bridge/SafeAppBridge.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/extension/src/bridge/SafeAppBridge.ts b/extension/src/bridge/SafeAppBridge.ts index a35d7228..c7f3d125 100644 --- a/extension/src/bridge/SafeAppBridge.ts +++ b/extension/src/bridge/SafeAppBridge.ts @@ -46,6 +46,7 @@ export const SAFE_APP_WHITELIST = [ 'https://app.balancer.fi', 'https://stake.lido.fi', 'https://curve.fi', + 'https://app.spark.fi', ] export default class SafeAppBridge { From 97e3b28a66a3e73cd157d7664710c9fa780dda57 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Thu, 2 May 2024 11:13:14 +0200 Subject: [PATCH 3/4] override EIP-6963 provider announcement for MetaMask --- extension/src/injection.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/extension/src/injection.ts b/extension/src/injection.ts index 77749394..1e845c94 100644 --- a/extension/src/injection.ts +++ b/extension/src/injection.ts @@ -63,6 +63,23 @@ window.addEventListener('eip6963:requestProvider', () => { announceEip6963Provider(injectedProvider) +// override EIP-6963 provider announcement for MetaMask +window.addEventListener('eip6963:announceProvider', (event) => { + const ev = event as CustomEvent + if (ev.detail.info.rdns === 'io.metamask' && !ev.detail.metamaskOverride) { + window.dispatchEvent( + new CustomEvent('eip6963:announceProvider', { + detail: Object.freeze({ + info: ev.detail.info, + provider: injectedProvider, + metamaskOverride: true, + }), + }) + ) + event.stopImmediatePropagation() + } +}) + window.dispatchEvent(new Event('ethereum#initialized')) export {} From 0463cec489f61cae315c1835de791a9d98d5c20e Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Thu, 2 May 2024 12:30:42 +0200 Subject: [PATCH 4/4] cowordersigner: don't hardcode validDuration to support limit orders --- extension/src/transactionTranslations/cowswapSetPreSignature.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/src/transactionTranslations/cowswapSetPreSignature.ts b/extension/src/transactionTranslations/cowswapSetPreSignature.ts index 0c4ab192..2f3c0a1e 100644 --- a/extension/src/transactionTranslations/cowswapSetPreSignature.ts +++ b/extension/src/transactionTranslations/cowswapSetPreSignature.ts @@ -68,7 +68,7 @@ export default { (response) => response.json() ) - const validDuration = 60 * 30 // 30 minutes + const validDuration = order.validTo - Math.floor(Date.now() / 1000) const feeAmountBP = Math.ceil( (parseInt(order.feeAmount) / parseInt(order.sellAmount)) * 10000 )