Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/components/UI/Money/hooks/useMoneyAccount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ describe('useMoneyAccountWithdrawal', () => {
expect(mockAddTransactionBatch).toHaveBeenCalledWith(
expect.objectContaining({
isGasFeeSponsored: true,
skipInitialGasEstimate: true,
}),
);
});
Expand Down
21 changes: 13 additions & 8 deletions app/components/UI/Money/hooks/useMoneyAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function useMoneyAccountDeposit() {
}

const networkClientId = resolveNetworkClientId(chainIdHex);
const isGasFeeSponsored = isMonadMainnetChainId(chainIdHex);

const batchId = bytesToHex(new Uint8Array(uuidParse(uuidv4())));
depositIntentByBatchId.set(batchId.toLowerCase(), intent);
Expand Down Expand Up @@ -120,20 +121,22 @@ export function useMoneyAccountDeposit() {
// so `from` must be the money account and `networkClientId` its chain.
await addTransactionBatch({
batchId,
disableHook: true,
disableSequential: true,
from: primaryMoneyAccount.address as Hex,
isGasFeeSponsored,
isInternal: true,
networkClientId,
origin: ORIGIN_METAMASK,
isInternal: true,
disableHook: true,
disableSequential: true,
transactions: [approveTx, depositTx],
requiredAssets: [
{
address: getMoneyAccountDepositAssetAddress(chainIdHex),
amount: '0x0' as Hex,
standard: 'erc20',
},
],
skipInitialGasEstimate: isGasFeeSponsored,
transactions: [approveTx, depositTx],
});
} catch (error) {
depositIntentByBatchId.delete(batchId.toLowerCase());
Expand Down Expand Up @@ -178,6 +181,7 @@ export function useMoneyAccountWithdrawal() {
}

const networkClientId = resolveNetworkClientId(chainIdHex);
const isGasFeeSponsored = isMonadMainnetChainId(chainIdHex);

// Placeholder amount — MM Pay re-encodes both calls via
// `updateMoneyAccountWithdrawTokenAmount` once the user picks an amount.
Expand All @@ -199,13 +203,14 @@ export function useMoneyAccountWithdrawal() {

try {
await addTransactionBatch({
disableHook: true,
disableSequential: true,
from: primaryMoneyAccount.address as Hex,
isGasFeeSponsored,
isInternal: true,
networkClientId,
origin: ORIGIN_METAMASK,
isInternal: true,
disableHook: true,
disableSequential: true,
isGasFeeSponsored: isMonadMainnetChainId(chainIdHex),
skipInitialGasEstimate: isGasFeeSponsored,
transactions: [withdrawTx, transferTx],
});
} catch (error) {
Expand Down
Loading