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

Adds missing jsdoc for Operation.isValidAmount. #609

Merged
merged 1 commit into from
May 16, 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
15 changes: 15 additions & 0 deletions src/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,21 @@ export class Operation {
return result;
}

/**
* Validates that a given amount is possible for a Stellar asset.
*
* Specifically, this means that the amount is well, a valid number, but also
* that it is within the int64 range and has no more than 7 decimal levels of
* precision.
*
* Note that while smart contracts allow larger amounts, this is oriented
* towards validating the standard Stellar operations.
*
* @param {string} value the amount to validate
* @param {[boolean]} allowZero whether or not zero is valid (default: no)
*
* @returns {boolean}
*/
static isValidAmount(value, allowZero = false) {
if (!isString(value)) {
return false;
Expand Down