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

Fix Stake rounding errors + improve Send GUI check #185

Merged
merged 1 commit into from
Aug 24, 2023
Merged
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
19 changes: 3 additions & 16 deletions scripts/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,10 @@ export async function createTxGUI() {
);

// Sanity check the amount
let nValue = Math.round(
const nValue = Math.round(
Number(doms.domSendAmountCoins.value.trim()) * COIN
);
if (nValue <= 0 || isNaN(nValue))
return createAlert(
'warning',
ALERTS.INVALID_AMOUNT + ALERTS.SENT_NOTHING,
[],
2500
);
if (!Number.isSafeInteger(nValue))
return createAlert(
'warning',
ALERTS.INVALID_AMOUNT + ALERTS.MORE_THEN_8_DECIMALS,
[],
2500
);
if (!validateAmount(nValue)) return;

// Create and send the TX
const cRes = await createAndSendTransaction({
Expand Down Expand Up @@ -143,7 +130,7 @@ export async function delegateGUI() {
return;

// Verify the amount; Delegations must be a minimum of 1 PIV, enforced by the network
const nAmount = Number(doms.domStakeAmount.value.trim()) * COIN;
const nAmount = Math.round(Number(doms.domStakeAmount.value.trim()) * COIN);
if (!validateAmount(nAmount, COIN)) return;

// Ensure the user has an address set - if not, request one!
Expand Down