From 664b4484e75c731d4f97f5c821c4d2eea693f1e9 Mon Sep 17 00:00:00 2001 From: Tomasz Slabon Date: Wed, 8 Nov 2023 11:08:14 +0100 Subject: [PATCH] Improved printing deposit receipt --- system-tests/test/deposit-redemption.test.ts | 12 +++--------- system-tests/test/minting-unminting.test.ts | 7 ++----- system-tests/test/utils/deposit.ts | 11 +++++++++++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/system-tests/test/deposit-redemption.test.ts b/system-tests/test/deposit-redemption.test.ts index 9f5c9efef..3c5fff97a 100644 --- a/system-tests/test/deposit-redemption.test.ts +++ b/system-tests/test/deposit-redemption.test.ts @@ -21,7 +21,7 @@ import chai, { expect } from "chai" import chaiAsPromised from "chai-as-promised" import { setupSystemTestsContext } from "./utils/context" -import { createDepositReceipt } from "./utils/deposit" +import { createDepositReceipt, printDepositReceipt } from "./utils/deposit" import { fakeRelayDifficulty, waitTransactionConfirmed } from "./utils/bitcoin" import type { @@ -170,10 +170,7 @@ describe("System Test - Deposit and redemption", () => { systemTestsContext.walletBitcoinKeyPair.publicKey.compressed ) - console.log(` - Generated deposit data: - ${JSON.stringify(depositReceipt)} - `) + printDepositReceipt(depositReceipt) const depositorBitcoinAddress = BitcoinAddressConverter.publicKeyToAddress( @@ -453,10 +450,7 @@ describe("System Test - Deposit and redemption", () => { systemTestsContext.walletBitcoinKeyPair.publicKey.compressed ) - console.log(` - Generated deposit data: - ${JSON.stringify(depositReceipt)} - `) + printDepositReceipt(depositReceipt) const depositorBitcoinAddress = BitcoinAddressConverter.publicKeyToAddress( diff --git a/system-tests/test/minting-unminting.test.ts b/system-tests/test/minting-unminting.test.ts index 8d45ee147..b62b767d6 100644 --- a/system-tests/test/minting-unminting.test.ts +++ b/system-tests/test/minting-unminting.test.ts @@ -22,7 +22,7 @@ import chaiAsPromised from "chai-as-promised" import { setupSystemTestsContext } from "./utils/context" import { fakeRelayDifficulty, waitTransactionConfirmed } from "./utils/bitcoin" -import { createDepositReceipt } from "./utils/deposit" +import { createDepositReceipt, printDepositReceipt } from "./utils/deposit" import type { SystemTestsContext } from "./utils/context" import type { @@ -181,10 +181,7 @@ describe("System Test - Minting and unminting", () => { systemTestsContext.walletBitcoinKeyPair.publicKey.compressed ) - console.log(` - Generated deposit data: - ${JSON.stringify(depositReceipt)} - `) + printDepositReceipt(depositReceipt) const depositorBitcoinAddress = BitcoinAddressConverter.publicKeyToAddress( diff --git a/system-tests/test/utils/deposit.ts b/system-tests/test/utils/deposit.ts index 0d2f78a88..f11e7593f 100644 --- a/system-tests/test/utils/deposit.ts +++ b/system-tests/test/utils/deposit.ts @@ -52,3 +52,14 @@ export function createDepositReceipt( refundLocktime, } } + +export function printDepositReceipt(receipt: DepositReceipt): void { + console.log(` + Deposit receipt: + - depositor: ${receipt.depositor.identifierHex} + - walletPublicKeyHash: ${receipt.walletPublicKeyHash} + - refundPublicKeyHash: ${receipt.refundPublicKeyHash} + - blindingFactor: ${receipt.blindingFactor} + - refundLocktime: ${receipt.refundLocktime} + `) +}