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 { 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 ) => { 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 {} 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 )