Skip to content

Commit

Permalink
ix: not saving account data in machine context
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurgeron committed Jan 27, 2025
1 parent ce2710f commit 3cc18f7
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -135,7 +138,7 @@ export const transactionRequestMachine = createMachine(
target: 'failed',
},
{
actions: ['assignGasLimitAndDefaultTips'],
actions: ['assignPreflightData'],
target: 'simulatingTransaction',
},
],
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -354,7 +358,7 @@ export const transactionRequestMachine = createMachine(
prepareInputForSimulateTransaction: FetchMachine.create<
{ address?: string; account?: AccountWithBalance },
{
estimated: PrepareInputForSimulateTransactionReturn;
estimated: PrepareInputForSimulateTransactionReturn['estimated'];
account: AccountWithBalance;
}
>({
Expand Down

0 comments on commit 3cc18f7

Please sign in to comment.