Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/live 15542 aptos send receive fix send funds simulation failed when amount to send is slightly above max spendable amount #8766

Open
wants to merge 3 commits into
base: feat/integrate-aptos
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ export const getFee = async (
const simulation = await aptosClient.simulateTransaction(publicKeyEd, tx);
const completedTx = simulation[0];

if (!completedTx.success) {
const expectedGas = BigNumber(gasLimit * gasPrice);
const isUnderMaxSpendable = !transaction.amount
.plus(expectedGas)
.isGreaterThan(account.spendableBalance);

if (isUnderMaxSpendable && !completedTx.success) {
switch (true) {
case completedTx.vm_status.includes("SEQUENCE_NUMBER"): {
res.errors.sequenceNumber = completedTx.vm_status;
Expand Down
Loading