Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected validateAsset(): ReadonlyArray {
const asset = this.assetToJSON();
const schemaErrors = validator.validate(transferAssetFormatSchema, asset);
const errors = convertToAssetError(
this.id,
schemaErrors,
) as TransactionError[];
if (!isValidTransferAmount(this.asset.amount.toString())) {
errors.push(
new TransactionError(
'Amount must be a valid number in string format.',
this.id,
'.asset.amount',
this.asset.amount.toString(),
),
);
}
if (!this.asset.recipientId) {
errors.push(
new TransactionError(
'`recipientId` must be provided.',
this.id,
'.asset.recipientId',