Skip to content

Commit

Permalink
fix: rerender + spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Nov 20, 2023
1 parent 5acef7a commit 7244e2e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ReactElement } from 'react'

import LightbulbIcon from '@/public/images/common/lightbulb.svg'

import infoWidgetCss from 'src/components/new-safe/create/InfoWidget/styles.module.css'
import infoWidgetCss from '@/components/new-safe/create/InfoWidget/styles.module.css'

export function EnableRecoveryFlowEmailHint(): ReactElement {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { EnableRecoveryFlowProps } from '.'

export function EnableRecoveryFlowReview({ params }: { params: EnableRecoveryFlowProps }): ReactElement {
const web3 = useWeb3()
const { safe } = useSafeInfo()
const { safe, safeAddress } = useSafeInfo()
const { setSafeTx, safeTxError, setSafeTxError } = useContext(SafeTxContext)

const guardian = params[EnableRecoveryFlowFields.guardians]
Expand All @@ -35,12 +35,13 @@ export function EnableRecoveryFlowReview({ params }: { params: EnableRecoveryFlo
const { transactions } = getRecoverySetup({
...params,
guardians: [guardian],
safe,
chainId: safe.chainId,
safeAddress,
provider: web3,
})

createMultiSendCallOnlyTx(transactions).then(setSafeTx).catch(setSafeTxError)
}, [guardian, params, safe, setSafeTx, setSafeTxError, web3])
}, [guardian, params, safe.chainId, safeAddress, setSafeTx, setSafeTxError, web3])

useEffect(() => {
if (safeTxError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,15 @@ export function EnableRecoveryFlowSettings({
<Typography variant="caption">Recommended</Typography>
</div>

<Typography variant="h5">Receive email updates</Typography>
<div>
<Typography variant="h5" gutterBottom>
Receive email updates
</Typography>

<Typography variant="body2" mb={1}>
Get notified about any recovery initiations and their statuses.
</Typography>
<Typography variant="body2" mb={1}>
Get notified about any recovery initiations and their statuses.
</Typography>
</div>

<Controller
control={formMethods.control}
Expand Down
12 changes: 3 additions & 9 deletions src/services/recovery/__tests__/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { getModuleInstance, KnownContracts, deployAndSetUpModule } from '@gnosis
import { faker } from '@faker-js/faker'
import { BigNumber } from 'ethers'
import type { Web3Provider } from '@ethersproject/providers'
import type { SafeInfo } from '@safe-global/safe-gateway-typescript-sdk'

import { getRecoverySetup } from '@/services/recovery/setup'

Expand All @@ -26,12 +25,6 @@ describe('getRecoverySetup', () => {
const guardians = [faker.finance.ethereumAddress()]
const safeAddress = faker.finance.ethereumAddress()
const chainId = faker.string.numeric()
const safe = {
address: {
value: safeAddress,
},
chainId,
} as SafeInfo
const provider = {} as Web3Provider

const expectedModuleAddress = faker.finance.ethereumAddress()
Expand All @@ -54,7 +47,8 @@ describe('getRecoverySetup', () => {
txCooldown,
txExpiration,
guardians,
safe,
chainId,
safeAddress,
provider,
})

Expand All @@ -72,7 +66,7 @@ describe('getRecoverySetup', () => {
],
},
provider,
Number(safe.chainId),
Number(chainId),
expect.any(String),
)

Expand Down
11 changes: 5 additions & 6 deletions src/services/recovery/setup.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import { getModuleInstance, KnownContracts, deployAndSetUpModule } from '@gnosis.pm/zodiac'
import { Interface } from 'ethers/lib/utils'
import type { Web3Provider } from '@ethersproject/providers'
import type { SafeInfo } from '@safe-global/safe-gateway-typescript-sdk'
import type { MetaTransactionData } from '@safe-global/safe-core-sdk-types'

export function getRecoverySetup({
txCooldown,
txExpiration,
guardians,
safe,
chainId,
safeAddress,
provider,
}: {
txCooldown: string
txExpiration: string
guardians: Array<string>
safe: SafeInfo
chainId: string
safeAddress: string
provider: Web3Provider
}): {
expectedModuleAddress: string
transactions: Array<MetaTransactionData>
} {
const safeAddress = safe.address.value

const setupArgs: Parameters<typeof deployAndSetUpModule>[1] = {
types: ['address', 'address', 'address', 'uint256', 'uint256'],
values: [
Expand All @@ -39,7 +38,7 @@ export function getRecoverySetup({
KnownContracts.DELAY,
setupArgs,
provider,
Number(safe.chainId),
Number(chainId),
saltNonce,
)

Expand Down

0 comments on commit 7244e2e

Please sign in to comment.