From c9de021116d3872222029675d3e400a43910075b Mon Sep 17 00:00:00 2001 From: Dmitryii Osipov Date: Wed, 5 Jun 2024 00:38:18 +0400 Subject: [PATCH] fix: create a failed transfer_all transaction (#164) --- server/src/helpers/transaction.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/helpers/transaction.ts b/server/src/helpers/transaction.ts index 4be17a5..6441d43 100644 --- a/server/src/helpers/transaction.ts +++ b/server/src/helpers/transaction.ts @@ -50,7 +50,7 @@ export async function getOperations( type: OpType.TRANSFER, status: opStatus, account: new AccountIdentifier(dest), - amount: new Amount(amount.toString(), currency), + amount: new Amount(amount === null ? '0' : amount.toString(), currency), }), ); operations.push( @@ -59,7 +59,7 @@ export async function getOperations( type: OpType.TRANSFER, status: opStatus, account: new AccountIdentifier(src), - amount: new Amount(amount.clone().neg().toString(), currency), + amount: new Amount(amount === null ? '0' : amount.clone().neg().toString(), currency), related_operations: [new OperationIdentifier(operations.length - 1)], }), );