Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit f21cd2b

Browse files
committed
Fix bridge whitelisting inside the test
1 parent 8ebafc3 commit f21cd2b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/integration/dataunion/withdraw.test.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function testWithdraw(
3636
memberWallet: Wallet,
3737
adminClient: StreamrClient
3838
) => Promise<ContractReceipt | AmbMessageHash | null>,
39-
recipientAddress: EthereumAddress | null, // null means memberClient itself
39+
recipientAddress: EthereumAddress | null, // null means memberWallet.address
4040
requiresMainnetETH: boolean,
4141
options: DataUnionWithdrawOptions,
4242
) {
@@ -59,6 +59,7 @@ async function testWithdraw(
5959

6060
testWalletId += 1
6161
const memberWallet = new Wallet(`0x100000000000000000000000000000000000000012300000000000001${testWalletId}`, providerSidechain)
62+
const recipient = recipientAddress || memberWallet.address
6263
const sendTx = await adminWalletSidechain.sendTransaction({ to: memberWallet.address, value: parseEther('0.1') })
6364
await sendTx.wait()
6465
log(`Sent 0.1 sidechain-ETH to ${memberWallet.address}`)
@@ -138,18 +139,19 @@ async function testWithdraw(
138139
const stats = await memberClient.getDataUnion(dataUnion.getAddress()).getMemberStats(memberWallet.address)
139140
log(`Stats: ${JSON.stringify(stats)}`)
140141

141-
const getRecipientBalance = async () => {
142-
const a = recipientAddress || await memberClient.getAddress()
143-
return options.sendToMainnet ? memberClient.getTokenBalance(a) : memberClient.getSidechainTokenBalance(a)
144-
}
142+
const getRecipientBalance = async () => (
143+
options.sendToMainnet
144+
? memberClient.getTokenBalance(recipient)
145+
: memberClient.getSidechainTokenBalance(recipient)
146+
)
145147

146148
const balanceBefore = await getRecipientBalance()
147149
log(`Balance before: ${balanceBefore}. Withdrawing tokens...`)
148150

149151
// "bridge-sponsored mainnet withdraw" case
150152
if (!options.payForTransport && options.waitUntilTransportIsComplete) {
151-
log(`Adding ${memberWallet.address} to bridge-sponsored withdraw whitelist`)
152-
bridgeWhitelist.push(memberWallet.address)
153+
log(`Adding ${recipient} to bridge-sponsored withdraw whitelist`)
154+
bridgeWhitelist.push(recipient)
153155
}
154156

155157
// test setup done, do the withdraw

0 commit comments

Comments
 (0)