@@ -3,26 +3,24 @@ import {
33 SpvMaintainer ,
44 ElectrumClient ,
55 EthereumBridge ,
6- } from "@keep-network/tbtc-v2.ts"
7- import {
8- computeHash160 ,
9- TransactionHash ,
10- } from "@keep-network/tbtc-v2.ts/dist/bitcoin"
6+ BitcoinTransactionHash ,
7+ } from "@keep-network/tbtc-v2.ts/dist/src"
8+ import { computeHash160 } from "@keep-network/tbtc-v2.ts/dist/src/bitcoin"
119import { BigNumber , constants , Contract } from "ethers"
1210import chai , { expect } from "chai"
13- import { submitDepositTransaction } from "@keep-network/tbtc-v2.ts/dist/deposit"
14- import { submitDepositSweepTransaction } from "@keep-network/tbtc-v2.ts/dist/deposit-sweep"
15- import { submitRedemptionTransaction } from "@keep-network/tbtc-v2.ts/dist/redemption"
11+ import { submitDepositTransaction } from "@keep-network/tbtc-v2.ts/dist/src/ deposit"
12+ import { submitDepositSweepTransaction } from "@keep-network/tbtc-v2.ts/dist/src/ deposit-sweep"
13+ import { submitRedemptionTransaction } from "@keep-network/tbtc-v2.ts/dist/src/ redemption"
1614import chaiAsPromised from "chai-as-promised"
1715
1816import { setupSystemTestsContext } from "./utils/context"
1917import { generateDeposit } from "./utils/deposit"
2018import { fakeRelayDifficulty , waitTransactionConfirmed } from "./utils/bitcoin"
2119
22- import type { UnspentTransactionOutput } from "@keep-network/tbtc-v2.ts/dist/bitcoin"
20+ import type { UnspentTransactionOutput } from "@keep-network/tbtc-v2.ts/dist/src/ bitcoin"
2321import type { SystemTestsContext } from "./utils/context"
24- import type { RedemptionRequest } from "@keep-network/tbtc-v2.ts/dist/redemption"
25- import type { Deposit } from "@keep-network/tbtc-v2.ts/dist/deposit"
22+ import type { RedemptionRequest } from "@keep-network/tbtc-v2.ts/dist/src/ redemption"
23+ import type { Deposit } from "@keep-network/tbtc-v2.ts/dist/src/ deposit"
2624
2725chai . use ( chaiAsPromised )
2826
@@ -72,12 +70,12 @@ describe("System Test - Deposit and redemption", () => {
7270
7371 maintainerBridgeHandle = new EthereumBridge ( {
7472 address : bridgeAddress ,
75- signer : maintainer ,
73+ signerOrProvider : maintainer ,
7674 } )
7775
7876 depositorBridgeHandle = new EthereumBridge ( {
7977 address : bridgeAddress ,
80- signer : depositor ,
78+ signerOrProvider : depositor ,
8179 } )
8280
8381 const bankDeploymentInfo = deployedContracts . Bank
@@ -188,7 +186,7 @@ describe("System Test - Deposit and redemption", () => {
188186 // This is the first sweep of the given wallet so there is no main UTXO.
189187 {
190188 // The function expects an unprefixed hash.
191- transactionHash : TransactionHash . from ( constants . HashZero ) ,
189+ transactionHash : BitcoinTransactionHash . from ( constants . HashZero ) ,
192190 outputIndex : 0 ,
193191 value : BigNumber . from ( 0 ) ,
194192 } ,
@@ -274,6 +272,16 @@ describe("System Test - Deposit and redemption", () => {
274272 )
275273 } )
276274
275+ it ( "should transfer depositor's bank balance to the Bridge" , async ( ) => {
276+ expect (
277+ await bank . balanceOf ( systemTestsContext . depositor . address )
278+ ) . to . be . equal ( 0 )
279+
280+ expect ( await bank . balanceOf ( bridgeAddress ) ) . to . be . equal (
281+ requestedAmount
282+ )
283+ } )
284+
277285 it ( "should register the redemption request on the bridge" , async ( ) => {
278286 expect ( redemptionRequest . requestedAt ) . to . be . greaterThan ( 0 )
279287 expect ( redemptionRequest . requestedAmount ) . to . be . equal ( requestedAmount )
@@ -285,7 +293,7 @@ describe("System Test - Deposit and redemption", () => {
285293 context (
286294 "when redemption is made and redemption proof submitted" ,
287295 ( ) => {
288- let redemptionTxHash : TransactionHash
296+ let redemptionTxHash : BitcoinTransactionHash
289297
290298 before (
291299 "make the redemption and submit redemption proof" ,
@@ -345,10 +353,8 @@ describe("System Test - Deposit and redemption", () => {
345353 )
346354 } )
347355
348- it ( "should decrease depositor's balance in the bank" , async ( ) => {
349- const actualBalance = await bank . balanceOf (
350- systemTestsContext . depositor . address
351- )
356+ it ( "should decrease Bridge's balance in the bank" , async ( ) => {
357+ const actualBalance = await bank . balanceOf ( bridgeAddress )
352358
353359 expect ( actualBalance ) . to . be . equal ( 0 )
354360 } )
0 commit comments