From 7aba3cf1f15c8d29d2a6668deafe9259a3b4f352 Mon Sep 17 00:00:00 2001 From: Tomasz Slabon Date: Fri, 14 Jul 2023 15:55:06 +0200 Subject: [PATCH] Request redemption via tBTC token --- system-tests/test/deposit-redemption.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/system-tests/test/deposit-redemption.test.ts b/system-tests/test/deposit-redemption.test.ts index f2e5310e0..5d25820d5 100644 --- a/system-tests/test/deposit-redemption.test.ts +++ b/system-tests/test/deposit-redemption.test.ts @@ -21,6 +21,7 @@ import type { UnspentTransactionOutput } from "@keep-network/tbtc-v2.ts/dist/src import type { SystemTestsContext } from "./utils/context" import type { RedemptionRequest } from "@keep-network/tbtc-v2.ts/dist/src/redemption" import type { Deposit } from "@keep-network/tbtc-v2.ts/dist/src/deposit" +import { TBTCToken } from "@keep-network/tbtc-v2.ts/dist/src/ethereum" chai.use(chaiAsPromised) @@ -46,8 +47,10 @@ chai.use(chaiAsPromised) describe("System Test - Deposit and redemption", () => { let systemTestsContext: SystemTestsContext let electrumClient: ElectrumClient + let tbtcTokenAddress: string let bridgeAddress: string let vaultAddress: string + let tbtcTokenHandle: TBTCToken let maintainerBridgeHandle: EthereumBridge let depositorBridgeHandle: EthereumBridge let bank: Contract @@ -77,9 +80,15 @@ describe("System Test - Deposit and redemption", () => { ELECTRUM_RETRY_BACKOFF_STEP_MS ) + tbtcTokenAddress = deployedContracts.TBTC.address bridgeAddress = deployedContracts.Bridge.address vaultAddress = deployedContracts.TBTCVault.address + tbtcTokenHandle = new TBTCToken({ + address: tbtcTokenAddress, + signerOrProvider: depositor, + }) + maintainerBridgeHandle = new EthereumBridge({ address: bridgeAddress, signerOrProvider: maintainer, @@ -536,11 +545,12 @@ describe("System Test - Deposit and redemption", () => { systemTestsContext.depositorBitcoinKeyPair.publicKey.compressed )}` - await depositorBridgeHandle.requestRedemption( + await TBTC.requestRedemption( systemTestsContext.walletBitcoinKeyPair.publicKey.compressed, sweepUtxo, redeemerOutputScript, requestedAmount, + tbtcTokenHandle, ) console.log(