From dd11f96555a6f4b1d9e01b7ab1acd06d431a5787 Mon Sep 17 00:00:00 2001 From: woodser <13068859+woodser@users.noreply.github.com> Date: Mon, 2 Jun 2025 10:21:39 -0400 Subject: [PATCH] randomize no deposit offers in bootstrap test --- src/HavenoClient.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/HavenoClient.test.ts b/src/HavenoClient.test.ts index 4e6daafe..e66e151b 100644 --- a/src/HavenoClient.test.ts +++ b/src/HavenoClient.test.ts @@ -2435,7 +2435,11 @@ test("Can bootstrap a network", async () => { if (ctxP.offerAmount === undefined) ctxP.offerAmount = getRandomBigIntWithinPercent(HavenoUtils.xmrToAtomicUnits(1), 0.15); if (isRangeOffer && ctxP.offerMinAmount === undefined) ctxP.offerMinAmount = getRandomBigIntWithinPercent(HavenoUtils.xmrToAtomicUnits(0.3), 0.15); if (ctxP.reserveExactAmount === undefined) ctxP.reserveExactAmount = getRandomOutcome(3/4); - if (ctxP.buyerAsTakerWithoutDeposit === undefined) ctxP.buyerAsTakerWithoutDeposit = getRandomOutcome(1/3); + if (ctxP.buyerAsTakerWithoutDeposit === undefined) ctxP.buyerAsTakerWithoutDeposit = ctxP.direction === OfferDirection.SELL && getRandomOutcome(2/3); + if (ctxP.buyerAsTakerWithoutDeposit) { + ctxP.isPrivateOffer = true; + ctxP.extraInfo = "Will get this done fast, no deposit required 😎"; + } // randomize payment method and asset code if (ctxP.assetCode && (!ctxP.makerPaymentAccountId || !ctxP.paymentMethodId)) throw new Error("Cannot specify asset code without payment account or method ID"); @@ -2443,7 +2447,7 @@ test("Can bootstrap a network", async () => { if (!ctxP.makerPaymentAccountId) ctxP.makerPaymentAccountId = (await createPaymentAccount2(ctxP.maker.havenod!, ctxP.paymentMethodId)).getId(); if (!ctxP.takerPaymentAccountId) ctxP.takerPaymentAccountId = (await createPaymentAccount2(ctxP.taker.havenod!, ctxP.paymentMethodId)).getId(); if (!ctxP.assetCode) ctxP.assetCode = getRandomAssetCodeForPaymentAccount(await ctxP.maker.havenod.getPaymentAccount(ctxP.makerPaymentAccountId)); - if (await isFixedPrice(ctxP)) ctxP.price = 142.23; + if (await isFixedPrice(ctxP)) ctxP.price = getRandomFloat(125, 155); // randomize trade config if (ctxP.takeOffer === undefined) ctxP.takeOffer = getRandomOutcome(3/5);