Skip to content

Commit

Permalink
Merge pull request #1179 from DarkFlorist/make-micah-poor-again
Browse files Browse the repository at this point in the history
make micah poor again
  • Loading branch information
KillariDev authored Nov 8, 2024
2 parents 06ad6e2 + 9a3b669 commit 2708e60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/ts/background/windows/confirmTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export const formEthSendTransaction = async(ethereumClientService: EthereumClien
const transactionDetails = sendTransactionParams.params[0]
if (activeAddress === undefined) throw new Error('Access to active address is denied')
const from = simulationMode && transactionDetails.from !== undefined ? transactionDetails.from : activeAddress
const transactionCount = getSimulatedTransactionCount(ethereumClientService, requestAbortController, simulationState, from)
const transactionCountPromise = getSimulatedTransactionCount(ethereumClientService, requestAbortController, simulationState, from)
const parentBlock = await parentBlockPromise
if (parentBlock === null) throw new Error('The latest block is null')
if (parentBlock.baseFeePerGas === undefined) throw new Error(CANNOT_SIMULATE_OFF_LEGACY_BLOCK)
Expand All @@ -206,7 +206,7 @@ export const formEthSendTransaction = async(ethereumClientService: EthereumClien
type: '1559' as const,
from,
chainId: ethereumClientService.getChainId(),
nonce: await transactionCount,
nonce: await transactionCountPromise,
maxFeePerGas: transactionDetails.maxFeePerGas !== undefined && transactionDetails.maxFeePerGas !== null ? transactionDetails.maxFeePerGas : parentBlock.baseFeePerGas * 2n + maxPriorityFeePerGas,
maxPriorityFeePerGas,
to: transactionDetails.to === undefined ? null : transactionDetails.to,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,19 @@ export const appendTransaction = async (ethereumClientService: EthereumClientSer
const signed = mockSignTransaction(transaction.transaction)
return simulationState === undefined ? [signed] : simulationState.simulatedTransactions.map((x) => x.preSimulationTransaction.signedTransaction).concat([signed])
}
const getMakeMeRichAddress = async () => {
if (simulationState === undefined) return undefined // we are not simulation, don't make anyone rich
if (typeof browser === 'undefined') return simulationState.addressToMakeRich // if we are not running in browser (tests)
return await getAddressToMakeRich()
}

const parentBlock = await ethereumClientService.getBlock(requestAbortController)
if (parentBlock === null) throw new Error('The latest block is null')
const parentBaseFeePerGas = parentBlock.baseFeePerGas
if (parentBaseFeePerGas === undefined) throw new Error(CANNOT_SIMULATE_OFF_LEGACY_BLOCK)
const signedMessages = getSignedMessagesWithFakeSigner(simulationState)
const signedTxs = getSignedTransactions()
const addressToMakeRich = typeof browser === 'undefined' ? simulationState?.addressToMakeRich : await getAddressToMakeRich()
const addressToMakeRich = await getMakeMeRichAddress()
const makeMeRich = getMakeMeRichStateOverride(addressToMakeRich)
const ethSimulateV1CallResult = await ethereumClientService.simulateTransactionsAndSignatures(signedTxs, signedMessages, parentBlock.number, requestAbortController, makeMeRich)
const transactionWebsiteData = { website: transaction.website, created: transaction.created, originalRequestParameters: transaction.originalRequestParameters, transactionIdentifier: transaction.transactionIdentifier }
Expand Down

0 comments on commit 2708e60

Please sign in to comment.