How to use the @liskhq/lisk-validator.isGreaterThanMaxTransactionAmount function in @liskhq/lisk-validator

To help you get started, we’ve selected a few @liskhq/lisk-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-sdk / elements / lisk-transactions / src / utils / format.ts View on Github external
export const convertLSKToBeddows = (lskAmount?: string): string => {
	if (typeof lskAmount !== 'string') {
		throw new Error('Cannot convert non-string amount');
	}
	if (getDecimalPlaces(lskAmount) > LISK_MAX_DECIMAL_POINTS) {
		throw new Error('LSK amount has too many decimal points');
	}
	const lskAmountBigNum = new BigNum(lskAmount);
	const beddowsAmountBigNum = lskAmountBigNum.mul(FIXED_POINT);
	if (isGreaterThanMaxTransactionAmount(beddowsAmountBigNum)) {
		throw new Error('LSK amount out of range');
	}

	return beddowsAmountBigNum.toString();
};
github LiskHQ / lisk-sdk / elements / lisk-transactions / src / utils / format.ts View on Github external
export const convertBeddowsToLSK = (beddowsAmount?: string): string => {
	if (typeof beddowsAmount !== 'string') {
		throw new Error('Cannot convert non-string amount');
	}
	if (getDecimalPlaces(beddowsAmount)) {
		throw new Error('Beddows amount should not have decimal points');
	}
	const beddowsAmountBigNum = new BigNum(beddowsAmount);
	if (isGreaterThanMaxTransactionAmount(beddowsAmountBigNum)) {
		throw new Error('Beddows amount out of range');
	}
	const lskAmountBigNum = beddowsAmountBigNum.div(FIXED_POINT);

	return lskAmountBigNum.toString(BASE_10);
};