From 3cc18f733356736b26b2cbbb9dbb92f313e2cb6e Mon Sep 17 00:00:00 2001 From: Arthur Geron <3487334+arthurgeron@users.noreply.github.com> Date: Mon, 27 Jan 2025 20:21:46 -0300 Subject: [PATCH] ix: not saving account data in machine context --- .../machines/transactionRequestMachine.tsx | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx b/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx index 0dec1c04b4..01fcabf10e 100644 --- a/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx +++ b/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx @@ -51,9 +51,12 @@ type MachineContext = { }; type PrepareInputForSimulateTransactionReturn = { - regularTip: BN; - fastTip: BN; - maxGasLimit: BN; + estimated: { + regularTip: BN; + fastTip: BN; + maxGasLimit: BN; + }; + account: AccountWithBalance; }; type SimulateTransactionReturn = { @@ -135,7 +138,7 @@ export const transactionRequestMachine = createMachine( target: 'failed', }, { - actions: ['assignGasLimitAndDefaultTips'], + actions: ['assignPreflightData'], target: 'simulatingTransaction', }, ], @@ -243,12 +246,13 @@ export const transactionRequestMachine = createMachine( { actions: { reset: assign(() => ({})), - assignGasLimitAndDefaultTips: assign((ctx, ev) => ({ + assignPreflightData: assign((ctx, ev) => ({ + account: ev.data.account, fees: { ...ctx.fees, - regularTip: ev.data.regularTip, - fastTip: ev.data.fastTip, - maxGasLimit: ev.data.maxGasLimit, + regularTip: ev.data.estimated.regularTip, + fastTip: ev.data.estimated.fastTip, + maxGasLimit: ev.data.estimated.maxGasLimit, }, })), assignTxRequestData: assign({ @@ -354,7 +358,7 @@ export const transactionRequestMachine = createMachine( prepareInputForSimulateTransaction: FetchMachine.create< { address?: string; account?: AccountWithBalance }, { - estimated: PrepareInputForSimulateTransactionReturn; + estimated: PrepareInputForSimulateTransactionReturn['estimated']; account: AccountWithBalance; } >({