mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-05-03 07:05:20 -04:00
set balance context if undefined
This commit is contained in:
parent
265f268c50
commit
6dcb4df09b
1 changed files with 2 additions and 2 deletions
|
@ -2683,7 +2683,7 @@ async function takeOffer(ctxP: Partial<TradeContext>): Promise<TradeInfo> {
|
||||||
await ctx.taker.havenod!.addNotificationListener(notification => { takerNotifications.push(notification); });
|
await ctx.taker.havenod!.addNotificationListener(notification => { takerNotifications.push(notification); });
|
||||||
|
|
||||||
// record balances before offer taken, once
|
// record balances before offer taken, once
|
||||||
if (!ctx.taker.balancesBeforeTake) {
|
if (ctx.taker.balancesBeforeTake === undefined) {
|
||||||
ctx.maker.balancesBeforeTake = await ctx.maker.havenod?.getBalances();
|
ctx.maker.balancesBeforeTake = await ctx.maker.havenod?.getBalances();
|
||||||
ctx.taker.balancesBeforeTake = await ctx.taker.havenod?.getBalances();
|
ctx.taker.balancesBeforeTake = await ctx.taker.havenod?.getBalances();
|
||||||
}
|
}
|
||||||
|
@ -2704,7 +2704,7 @@ async function takeOffer(ctxP: Partial<TradeContext>): Promise<TradeInfo> {
|
||||||
expect(tradeNotifications[0].getMessage()).toEqual("Your offer " + ctx.offerId + " has been accepted");
|
expect(tradeNotifications[0].getMessage()).toEqual("Your offer " + ctx.offerId + " has been accepted");
|
||||||
|
|
||||||
// record context after offer taken, once
|
// record context after offer taken, once
|
||||||
if (!ctx.getBuyer().balancesAfterTake) {
|
if (ctx.getBuyer().balancesAfterTake === undefined) {
|
||||||
ctx.tradeAmount = BigInt(trade.getAmount()); // re-assign trade amount which could be adjusted
|
ctx.tradeAmount = BigInt(trade.getAmount()); // re-assign trade amount which could be adjusted
|
||||||
ctx.arbitrator.trade = await ctx.arbitrator.havenod!.getTrade(ctx.offerId!);
|
ctx.arbitrator.trade = await ctx.arbitrator.havenod!.getTrade(ctx.offerId!);
|
||||||
ctx.maker.trade = await ctx.maker.havenod!.getTrade(ctx.offerId!);
|
ctx.maker.trade = await ctx.maker.havenod!.getTrade(ctx.offerId!);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue