Skip to content

Commit

Permalink
Improved printing deposit receipt
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed Nov 8, 2023
1 parent ace3cfd commit 664b448
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
12 changes: 3 additions & 9 deletions system-tests/test/deposit-redemption.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 2 additions & 5 deletions system-tests/test/minting-unminting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions system-tests/test/utils/deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
`)
}

0 comments on commit 664b448

Please sign in to comment.