Skip to content

Commit c7b6400

Browse files
committed
fix user funds
1 parent 1145095 commit c7b6400

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/commands.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,15 +1327,10 @@ export class Commands {
13271327
try {
13281328
const balance = await escrow.getUserFunds(await this.signer.getAddress(), token);
13291329
const decimals = await getTokenDecimals(this.signer, token);
1330-
1331-
const sum = await balance.reduce(async (accPromise, curr) => {
1332-
const acc = await accPromise;
1333-
const amount = await unitsToAmount(this.signer, token, curr, decimals);
1334-
return acc + Number(amount);
1335-
}, Promise.resolve(0));
1336-
1337-
console.log(`Escrow user funds for token ${token}: ${sum}`);
1338-
return sum;
1330+
const available = balance.available;
1331+
const amount = await unitsToAmount(this.signer, token, available, decimals);
1332+
console.log(`Escrow user funds for token ${token}: ${amount}`);
1333+
return Number(amount);
13391334
} catch (error) {
13401335
console.error("Error getting escrow balance:", error);
13411336
}

0 commit comments

Comments
 (0)