Skip to content

Commit

Permalink
Merge pull request #103 from gnosisguild/fix-spark-connect
Browse files Browse the repository at this point in the history
Fix spark connect
  • Loading branch information
jfschwarz authored May 2, 2024
2 parents a90891f + 0463cec commit e681314
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions extension/src/bridge/SafeAppBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 7 additions & 3 deletions extension/src/browser/Drawer/RolePermissionCheck.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -23,7 +27,7 @@ import { useTenderlyProvider } from '../../providers'
import { TenderlyProvider } from '../../providers/ProvideTenderly'

const simulateRolesTransaction = async (
encodedTransaction: TransactionData,
encodedTransaction: MetaTransaction,
connection: Connection,
tenderlyProvider: TenderlyProvider
) => {
Expand Down
17 changes: 17 additions & 0 deletions extension/src/injection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit e681314

Please sign in to comment.