mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2024-10-01 01:35:42 -04:00
fix ts errors in tests
This commit is contained in:
parent
4f99d1893d
commit
9508cce2a4
@ -23,7 +23,7 @@ module.exports = {
|
|||||||
"^.+\\.tsx?$": [
|
"^.+\\.tsx?$": [
|
||||||
"ts-jest",
|
"ts-jest",
|
||||||
{
|
{
|
||||||
useESM: true,
|
tsconfig: "tsconfig.json"
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// @ts-nocheck
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright Haveno
|
* Copyright Haveno
|
||||||
*
|
*
|
||||||
@ -34,9 +32,10 @@ import {
|
|||||||
Attachment,
|
Attachment,
|
||||||
DisputeResult,
|
DisputeResult,
|
||||||
PaymentMethod,
|
PaymentMethod,
|
||||||
|
PaymentAccount,
|
||||||
PaymentAccountForm,
|
PaymentAccountForm,
|
||||||
PaymentAccountFormField,
|
PaymentAccountFormField,
|
||||||
PaymentAccount,
|
PaymentAccountPayload,
|
||||||
XmrDestination,
|
XmrDestination,
|
||||||
XmrNodeSettings,
|
XmrNodeSettings,
|
||||||
XmrTx,
|
XmrTx,
|
||||||
@ -93,23 +92,23 @@ enum DisputeContext {
|
|||||||
* Test context for a single peer in a trade.
|
* Test context for a single peer in a trade.
|
||||||
*/
|
*/
|
||||||
class PeerContext {
|
class PeerContext {
|
||||||
havenod: HavenoClient;
|
havenod?: HavenoClient;
|
||||||
wallet: moneroTs.MoneroWallet;
|
wallet?: moneroTs.MoneroWallet;
|
||||||
trade: TradeInfo;
|
trade?: TradeInfo;
|
||||||
|
|
||||||
// context to test balances after trade
|
// context to test balances after trade
|
||||||
balancesBeforeOffer: XmrBalanceInfo;
|
balancesBeforeOffer?: XmrBalanceInfo;
|
||||||
splitOutputTxFee: bigint;
|
splitOutputTxFee?: bigint;
|
||||||
balancesBeforeTake: XmrBalanceInfo;
|
balancesBeforeTake?: XmrBalanceInfo;
|
||||||
balancesAfterTake: XmrBalanceInfo;
|
balancesAfterTake?: XmrBalanceInfo;
|
||||||
balancesBeforePayout: XmrBalanceInfo;
|
balancesBeforePayout?: XmrBalanceInfo;
|
||||||
balancesAfterPayout: XmrBalanceInfo;
|
balancesAfterPayout?: XmrBalanceInfo;
|
||||||
tradeFee: bigint;
|
tradeFee?: bigint;
|
||||||
depositTx: moneroTs.MoneroTx;
|
depositTx?: moneroTs.MoneroTx;
|
||||||
depositTxFee: bigint;
|
depositTxFee?: bigint;
|
||||||
securityDepositActual: bigint;
|
securityDepositActual?: bigint;
|
||||||
payoutTxFee: bigint;
|
payoutTxFee?: bigint;
|
||||||
payoutAmount: bigint;
|
payoutAmount?: bigint;
|
||||||
|
|
||||||
constructor(ctx?: Partial<PeerContext>) {
|
constructor(ctx?: Partial<PeerContext>) {
|
||||||
Object.assign(this, ctx);
|
Object.assign(this, ctx);
|
||||||
@ -158,9 +157,9 @@ const defaultTradeConfig: Partial<TradeContext> = {
|
|||||||
class TradeContext {
|
class TradeContext {
|
||||||
|
|
||||||
// trade peers
|
// trade peers
|
||||||
arbitrator: Partial<PeerContext>;
|
arbitrator!: Partial<PeerContext>;
|
||||||
maker: Partial<PeerContext>;
|
maker!: Partial<PeerContext>;
|
||||||
taker: Partial<PeerContext>;
|
taker!: Partial<PeerContext>;
|
||||||
|
|
||||||
// trade flow
|
// trade flow
|
||||||
concurrentTrades?: boolean; // testing trades at same time
|
concurrentTrades?: boolean; // testing trades at same time
|
||||||
@ -219,9 +218,9 @@ class TradeContext {
|
|||||||
isPayoutUnlocked?: boolean
|
isPayoutUnlocked?: boolean
|
||||||
buyerOpenedDispute?: boolean;
|
buyerOpenedDispute?: boolean;
|
||||||
sellerOpenedDispute?: boolean;
|
sellerOpenedDispute?: boolean;
|
||||||
walletSyncPeriodMs: number;
|
walletSyncPeriodMs!: number;
|
||||||
maxTimePeerNoticeMs: number;
|
maxTimePeerNoticeMs!: number;
|
||||||
testChatMessages: boolean;
|
testChatMessages!: boolean;
|
||||||
stopOnFailure?: boolean;
|
stopOnFailure?: boolean;
|
||||||
buyerAppName?: string;
|
buyerAppName?: string;
|
||||||
sellerAppName?: string;
|
sellerAppName?: string;
|
||||||
@ -230,8 +229,8 @@ class TradeContext {
|
|||||||
testPayoutUnlocked?: boolean;
|
testPayoutUnlocked?: boolean;
|
||||||
payoutTxId?: string
|
payoutTxId?: string
|
||||||
testBalanceChangeEndToEnd?: boolean;
|
testBalanceChangeEndToEnd?: boolean;
|
||||||
isStopped: boolean;
|
isStopped!: boolean;
|
||||||
maxConcurrency: number;
|
maxConcurrency!: number;
|
||||||
|
|
||||||
constructor(ctx?: Partial<TradeContext>) {
|
constructor(ctx?: Partial<TradeContext>) {
|
||||||
Object.assign(this, ctx);
|
Object.assign(this, ctx);
|
||||||
@ -518,7 +517,7 @@ beforeAll(async () => {
|
|||||||
try {
|
try {
|
||||||
monerod = await moneroTs.connectToDaemonRpc(TestConfig.monerod.url, TestConfig.monerod.username, TestConfig.monerod.password);
|
monerod = await moneroTs.connectToDaemonRpc(TestConfig.monerod.url, TestConfig.monerod.username, TestConfig.monerod.password);
|
||||||
await mineToHeight(160); // initialize blockchain to latest block type
|
await mineToHeight(160); // initialize blockchain to latest block type
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
HavenoUtils.log(0, "Error initializing internal monerod: " + err.message); // allowed in order to test starting and stopping local node
|
HavenoUtils.log(0, "Error initializing internal monerod: " + err.message); // allowed in order to test starting and stopping local node
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1625,7 +1624,7 @@ test("Cannot post offer exceeding trade limit (CI, sanity check)", async () => {
|
|||||||
takeOffer: false
|
takeOffer: false
|
||||||
});
|
});
|
||||||
throw new Error("Should have rejected posting offer above trade limit")
|
throw new Error("Should have rejected posting offer above trade limit")
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
assert(err.message.indexOf("amount is larger than") === 0);
|
assert(err.message.indexOf("amount is larger than") === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1639,7 +1638,7 @@ test("Cannot post offer exceeding trade limit (CI, sanity check)", async () => {
|
|||||||
takeOffer: false
|
takeOffer: false
|
||||||
});
|
});
|
||||||
throw new Error("Should have rejected posting offer above trade limit")
|
throw new Error("Should have rejected posting offer above trade limit")
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
assert(err.message.indexOf("amount is larger than") === 0);
|
assert(err.message.indexOf("amount is larger than") === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2014,7 +2013,7 @@ test("Invalidates offers when reserved funds are spent (CI)", async () => {
|
|||||||
if (!reservedKeyImages.length) throw new Error("No reserved key images detected");
|
if (!reservedKeyImages.length) throw new Error("No reserved key images detected");
|
||||||
await user1Wallet.thawOutput(reservedKeyImages[0]);
|
await user1Wallet.thawOutput(reservedKeyImages[0]);
|
||||||
tx = await user1Wallet.sweepOutput({keyImage: reservedKeyImages[0], address: await user1Wallet.getPrimaryAddress(), relay: false});
|
tx = await user1Wallet.sweepOutput({keyImage: reservedKeyImages[0], address: await user1Wallet.getPrimaryAddress(), relay: false});
|
||||||
await monerod.submitTxHex(tx.getFullHex(), true);
|
await monerod.submitTxHex(tx.getFullHex()!, true);
|
||||||
|
|
||||||
// mine block so spend is confirmed
|
// mine block so spend is confirmed
|
||||||
await mineBlocks(1);
|
await mineBlocks(1);
|
||||||
@ -2216,7 +2215,7 @@ test("Selects arbitrators which are online, registered, and least used", async (
|
|||||||
try {
|
try {
|
||||||
await executeTrade({maker: {havenod: user1}, taker: {havenod: user2}, offerId: offer2.getId()});
|
await executeTrade({maker: {havenod: user1}, taker: {havenod: user2}, offerId: offer2.getId()});
|
||||||
throw new Error("Should have failed taking offer signed by unregistered arbitrator");
|
throw new Error("Should have failed taking offer signed by unregistered arbitrator");
|
||||||
} catch (e2) {
|
} catch (e2: any) {
|
||||||
assert (e2.message.indexOf("not found") > 0);
|
assert (e2.message.indexOf("not found") > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2321,7 +2320,7 @@ async function executeTrades(ctxs: Partial<TradeContext>[], executionCtx?: Parti
|
|||||||
if (executionCtx.stopOnFailure) for (const ctx of ctxs) ctx.isStopped = true; // stop trades on failure
|
if (executionCtx.stopOnFailure) for (const ctx of ctxs) ctx.isStopped = true; // stop trades on failure
|
||||||
try {
|
try {
|
||||||
await Promise.allSettled(tradePromises); // wait for other trades to complete
|
await Promise.allSettled(tradePromises); // wait for other trades to complete
|
||||||
} catch (e3) {
|
} catch (e3: any) {
|
||||||
HavenoUtils.log(0, "Error awaiting other trades to stop after error: " + e3.message);
|
HavenoUtils.log(0, "Error awaiting other trades to stop after error: " + e3.message);
|
||||||
HavenoUtils.log(0, e3.stack);
|
HavenoUtils.log(0, e3.stack);
|
||||||
}
|
}
|
||||||
@ -2479,7 +2478,7 @@ async function executeTrade(ctxP: Partial<TradeContext>): Promise<string> {
|
|||||||
|
|
||||||
// buyer has seller's payment account payload after first confirmation
|
// buyer has seller's payment account payload after first confirmation
|
||||||
if (ctx.isStopped) return ctx.offerId!;
|
if (ctx.isStopped) return ctx.offerId!;
|
||||||
let sellerPaymentAccountPayload;
|
let sellerPaymentAccountPayload: PaymentAccountPayload | undefined;
|
||||||
let form;
|
let form;
|
||||||
let expectedForm;
|
let expectedForm;
|
||||||
if (ctx.getBuyer().havenod) {
|
if (ctx.getBuyer().havenod) {
|
||||||
@ -2651,7 +2650,7 @@ async function executeTrade(ctxP: Partial<TradeContext>): Promise<string> {
|
|||||||
await testTradePayoutUnlock(ctx);
|
await testTradePayoutUnlock(ctx);
|
||||||
if (ctx.offer!.getId() !== ctx.offerId) throw new Error("Expected offer ids to match");
|
if (ctx.offer!.getId() !== ctx.offerId) throw new Error("Expected offer ids to match");
|
||||||
return ctx.offer!.getId();
|
return ctx.offer!.getId();
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
HavenoUtils.log(0, "Error executing trade " + ctx!.offerId + (ctx!.index === undefined ? "" : " at index " + ctx!.index) + ": " + err.message);
|
HavenoUtils.log(0, "Error executing trade " + ctx!.offerId + (ctx!.index === undefined ? "" : " at index " + ctx!.index) + ": " + err.message);
|
||||||
HavenoUtils.log(0, await ctx.toSummary());
|
HavenoUtils.log(0, await ctx.toSummary());
|
||||||
throw err;
|
throw err;
|
||||||
@ -2869,13 +2868,13 @@ async function takeOffer(ctxP: Partial<TradeContext>): Promise<TradeInfo> {
|
|||||||
const buyerBalanceDiffReservedTrade = BigInt(ctx.getBuyer().balancesAfterTake!.getReservedTradeBalance()) - BigInt(ctx.getBuyer().balancesBeforeTake!.getReservedTradeBalance());
|
const buyerBalanceDiffReservedTrade = BigInt(ctx.getBuyer().balancesAfterTake!.getReservedTradeBalance()) - BigInt(ctx.getBuyer().balancesBeforeTake!.getReservedTradeBalance());
|
||||||
const buyerBalanceDiffReservedOffer = BigInt(ctx.getBuyer().balancesAfterTake!.getReservedOfferBalance()) - BigInt(ctx.getBuyer().balancesBeforeTake!.getReservedOfferBalance());
|
const buyerBalanceDiffReservedOffer = BigInt(ctx.getBuyer().balancesAfterTake!.getReservedOfferBalance()) - BigInt(ctx.getBuyer().balancesBeforeTake!.getReservedOfferBalance());
|
||||||
expect(buyerBalanceDiffReservedTrade).toEqual(BigInt(trade.getBuyerSecurityDeposit()!));
|
expect(buyerBalanceDiffReservedTrade).toEqual(BigInt(trade.getBuyerSecurityDeposit()!));
|
||||||
expect(buyerBalanceDiff).toEqual(-1n * buyerBalanceDiffReservedOffer - buyerBalanceDiffReservedTrade - ctx.getBuyer().depositTxFee - ctx.getBuyer().tradeFee);
|
expect(buyerBalanceDiff).toEqual(-1n * buyerBalanceDiffReservedOffer - buyerBalanceDiffReservedTrade - ctx.getBuyer().depositTxFee! - ctx.getBuyer().tradeFee!);
|
||||||
|
|
||||||
// test seller balances after offer taken
|
// test seller balances after offer taken
|
||||||
const sellerBalanceDiff = BigInt(ctx.getSeller().balancesAfterTake!.getBalance()) - BigInt(ctx.getSeller().balancesBeforeTake!.getBalance());
|
const sellerBalanceDiff = BigInt(ctx.getSeller().balancesAfterTake!.getBalance()) - BigInt(ctx.getSeller().balancesBeforeTake!.getBalance());
|
||||||
const sellerBalanceDiffReservedTrade = BigInt(ctx.getSeller().balancesAfterTake!.getReservedTradeBalance()) - BigInt(ctx.getSeller().balancesBeforeTake!.getReservedTradeBalance());
|
const sellerBalanceDiffReservedTrade = BigInt(ctx.getSeller().balancesAfterTake!.getReservedTradeBalance()) - BigInt(ctx.getSeller().balancesBeforeTake!.getReservedTradeBalance());
|
||||||
expect(sellerBalanceDiffReservedTrade).toEqual(BigInt(trade.getAmount()) + BigInt(trade.getSellerSecurityDeposit()!));
|
expect(sellerBalanceDiffReservedTrade).toEqual(BigInt(trade.getAmount()) + BigInt(trade.getSellerSecurityDeposit()!));
|
||||||
expect(sellerBalanceDiff).toEqual(0n - ctx.getSeller().depositTxFee - ctx.getSeller().tradeFee! - ctx.getSeller().securityDepositActual - ctx.tradeAmount!);
|
expect(sellerBalanceDiff).toEqual(0n - ctx.getSeller().depositTxFee! - ctx.getSeller().tradeFee! - ctx.getSeller().securityDepositActual! - ctx.tradeAmount!);
|
||||||
|
|
||||||
// test maker balances after offer taken
|
// test maker balances after offer taken
|
||||||
const makerBalanceDiffReservedOffer = BigInt(ctx.getMaker().balancesAfterTake!.getReservedOfferBalance()) - BigInt(ctx.getMaker().balancesBeforeTake!.getReservedOfferBalance());
|
const makerBalanceDiffReservedOffer = BigInt(ctx.getMaker().balancesAfterTake!.getReservedOfferBalance()) - BigInt(ctx.getMaker().balancesBeforeTake!.getReservedOfferBalance());
|
||||||
@ -2909,8 +2908,8 @@ async function testTrade(trade: TradeInfo, ctx: TradeContext, havenod?: HavenoCl
|
|||||||
|
|
||||||
// test security deposit = max(.1, trade amount * security deposit pct)
|
// test security deposit = max(.1, trade amount * security deposit pct)
|
||||||
const expectedSecurityDeposit = HavenoUtils.max(HavenoUtils.xmrToAtomicUnits(.1), HavenoUtils.multiply(ctx.tradeAmount!, ctx.securityDepositPct!));
|
const expectedSecurityDeposit = HavenoUtils.max(HavenoUtils.xmrToAtomicUnits(.1), HavenoUtils.multiply(ctx.tradeAmount!, ctx.securityDepositPct!));
|
||||||
expect(BigInt(trade.getBuyerSecurityDeposit())).toEqual(expectedSecurityDeposit - ctx.getBuyer().depositTxFee);
|
expect(BigInt(trade.getBuyerSecurityDeposit())).toEqual(expectedSecurityDeposit - ctx.getBuyer().depositTxFee!);
|
||||||
expect(BigInt(trade.getSellerSecurityDeposit())).toEqual(expectedSecurityDeposit - ctx.getSeller().depositTxFee);
|
expect(BigInt(trade.getSellerSecurityDeposit())).toEqual(expectedSecurityDeposit - ctx.getSeller().depositTxFee!);
|
||||||
|
|
||||||
// test phase
|
// test phase
|
||||||
if (!ctx.isPaymentSent) {
|
if (!ctx.isPaymentSent) {
|
||||||
@ -3194,23 +3193,23 @@ async function testAmountsAfterComplete(tradeCtx: TradeContext) {
|
|||||||
const isDisputedTrade = tradeCtx.getDisputeOpener() !== undefined;
|
const isDisputedTrade = tradeCtx.getDisputeOpener() !== undefined;
|
||||||
if (!isDisputedTrade) {
|
if (!isDisputedTrade) {
|
||||||
tradeCtx.getBuyer().payoutTxFee = payoutTxFee / 2n;
|
tradeCtx.getBuyer().payoutTxFee = payoutTxFee / 2n;
|
||||||
tradeCtx.getBuyer().payoutAmount = tradeCtx.getBuyer().securityDepositActual + tradeCtx.tradeAmount! - tradeCtx.getBuyer().payoutTxFee;
|
tradeCtx.getBuyer().payoutAmount = tradeCtx.getBuyer().securityDepositActual! + tradeCtx.tradeAmount! - tradeCtx.getBuyer().payoutTxFee!;
|
||||||
tradeCtx.getSeller().payoutTxFee = payoutTxFee / 2n;
|
tradeCtx.getSeller().payoutTxFee = payoutTxFee / 2n;
|
||||||
tradeCtx.getSeller().payoutAmount = tradeCtx.getSeller().securityDepositActual - tradeCtx.getSeller().payoutTxFee;
|
tradeCtx.getSeller().payoutAmount = tradeCtx.getSeller().securityDepositActual! - tradeCtx.getSeller().payoutTxFee!;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// get expected payouts for disputed trade
|
// get expected payouts for disputed trade
|
||||||
const winnerGetsAll = tradeCtx.disputeWinnerAmount === tradeCtx.maker.securityDepositActual! + tradeCtx.taker.securityDepositActual! + tradeCtx.tradeAmount!;
|
const winnerGetsAll = tradeCtx.disputeWinnerAmount === tradeCtx.maker.securityDepositActual! + tradeCtx.taker.securityDepositActual! + tradeCtx.tradeAmount!;
|
||||||
if (tradeCtx.disputeWinnerAmount) {
|
if (tradeCtx.disputeWinnerAmount) {
|
||||||
tradeCtx.getDisputeWinner()!.payoutTxFee = winnerGetsAll ? payoutTxFee : 0n;
|
tradeCtx.getDisputeWinner()!.payoutTxFee = winnerGetsAll ? payoutTxFee : 0n;
|
||||||
tradeCtx.getDisputeWinner()!.payoutAmount = tradeCtx.disputeWinnerAmount - tradeCtx.getDisputeWinner()!.payoutTxFee;
|
tradeCtx.getDisputeWinner()!.payoutAmount = tradeCtx.disputeWinnerAmount - tradeCtx.getDisputeWinner()!.payoutTxFee!;
|
||||||
tradeCtx.getDisputeLoser()!.payoutTxFee = winnerGetsAll ? 0n : payoutTxFee;
|
tradeCtx.getDisputeLoser()!.payoutTxFee = winnerGetsAll ? 0n : payoutTxFee;
|
||||||
tradeCtx.getDisputeLoser()!.payoutAmount = tradeCtx.maker.securityDepositActual! + tradeCtx.taker.securityDepositActual! + tradeCtx.tradeAmount! - tradeCtx.disputeWinnerAmount - tradeCtx.getDisputeLoser()!.payoutTxFee;
|
tradeCtx.getDisputeLoser()!.payoutAmount = tradeCtx.maker.securityDepositActual! + tradeCtx.taker.securityDepositActual! + tradeCtx.tradeAmount! - tradeCtx.disputeWinnerAmount - tradeCtx.getDisputeLoser()!.payoutTxFee!;
|
||||||
} else {
|
} else {
|
||||||
tradeCtx.getDisputeWinner()!.payoutTxFee = payoutTxFee / 2n;
|
tradeCtx.getDisputeWinner()!.payoutTxFee = payoutTxFee / 2n;
|
||||||
tradeCtx.getDisputeWinner()!.payoutAmount = tradeCtx.tradeAmount! + tradeCtx.getDisputeWinner()!.securityDepositActual - tradeCtx.getDisputeWinner()!.payoutTxFee;
|
tradeCtx.getDisputeWinner()!.payoutAmount = tradeCtx.tradeAmount! + tradeCtx.getDisputeWinner()!.securityDepositActual! - tradeCtx.getDisputeWinner()!.payoutTxFee!;
|
||||||
tradeCtx.getDisputeLoser()!.payoutTxFee = payoutTxFee / 2n;
|
tradeCtx.getDisputeLoser()!.payoutTxFee = payoutTxFee / 2n;
|
||||||
tradeCtx.getDisputeLoser()!.payoutAmount = tradeCtx.getDisputeLoser()!.securityDepositActual - tradeCtx.getDisputeLoser()!.payoutTxFee;
|
tradeCtx.getDisputeLoser()!.payoutAmount = tradeCtx.getDisputeLoser()!.securityDepositActual! - tradeCtx.getDisputeLoser()!.payoutTxFee!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3228,7 +3227,7 @@ async function testAmountsAfterComplete(tradeCtx: TradeContext) {
|
|||||||
async function testPeerAmountsAfterComplete(tradeCtx: TradeContext, peerCtx: PeerContext) {
|
async function testPeerAmountsAfterComplete(tradeCtx: TradeContext, peerCtx: PeerContext) {
|
||||||
|
|
||||||
// get trade
|
// get trade
|
||||||
const trade = await peerCtx.havenod.getTrade(tradeCtx.offerId!);
|
const trade = await peerCtx.havenod!.getTrade(tradeCtx.offerId!);
|
||||||
|
|
||||||
// test trade amounts
|
// test trade amounts
|
||||||
const isBuyer = tradeCtx.getBuyer() === peerCtx;
|
const isBuyer = tradeCtx.getBuyer() === peerCtx;
|
||||||
@ -3248,7 +3247,7 @@ async function testPeerAmountsAfterComplete(tradeCtx: TradeContext, peerCtx: Pee
|
|||||||
|
|
||||||
// calculate expected balance from before offer
|
// calculate expected balance from before offer
|
||||||
const sendTradeAmount = tradeCtx.getBuyer() === peerCtx ? 0n : BigInt(trade.getAmount());
|
const sendTradeAmount = tradeCtx.getBuyer() === peerCtx ? 0n : BigInt(trade.getAmount());
|
||||||
const expectedBalanceAfterComplete = BigInt(peerCtx.balancesBeforeOffer?.getBalance()!) - peerCtx.splitOutputTxFee - peerCtx.tradeFee! - sendTradeAmount - peerCtx.depositTxFee - peerCtx.securityDepositActual + peerCtx.payoutAmount;
|
const expectedBalanceAfterComplete = BigInt(peerCtx.balancesBeforeOffer?.getBalance()!) - peerCtx.splitOutputTxFee! - peerCtx.tradeFee! - sendTradeAmount - peerCtx.depositTxFee! - peerCtx.securityDepositActual! + peerCtx.payoutAmount!;
|
||||||
|
|
||||||
// log the math
|
// log the math
|
||||||
HavenoUtils.log(1, "Testing end-to-end balance change:");
|
HavenoUtils.log(1, "Testing end-to-end balance change:");
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// @ts-nocheck
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright Haveno
|
* Copyright Haveno
|
||||||
*
|
*
|
||||||
|
@ -22,5 +22,5 @@
|
|||||||
"isolatedModules": true
|
"isolatedModules": true
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user