Skip to content

Commit

Permalink
test(e2e): feed drep wallet based on drepDeposit
Browse files Browse the repository at this point in the history
Test was failing due to insufficient funds, because the test
was feeding the wallet with hardcoded drepDeposit value.
  • Loading branch information
mirceahasegan committed May 9, 2024
1 parent 7248a12 commit 0e0e6c6
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ describe('PersonalWallet/conwayTransactions', () => {
};
};

const feedDRepWallet = async () => {
const feedDRepWallet = async (amount: bigint) => {
const balance = await firstValueFrom(dRepWallet.balance.utxo.total$);

if (balance.coins > 10_000_000n) return;
if (balance.coins > amount) return;

const address = await firstValueFrom(dRepWallet.addresses$.pipe(map((addresses) => addresses[0].address)));

const signedTx = await wallet
.createTxBuilder()
.addOutput({ address, value: { coins: 20_000_000n } })
.addOutput({ address, value: { coins: amount } })
.build()
.sign();

Expand Down Expand Up @@ -167,8 +167,10 @@ describe('PersonalWallet/conwayTransactions', () => {
getTestWallet(1, 'Conway DRep Wallet', 0n)
]);

[, dRepCredential, [dRepDeposit, governanceActionDeposit, stakeKeyDeposit], poolId, stakeCredential] =
await Promise.all([feedDRepWallet(), getDRepCredential(), getDeposits(), getPoolId(), getStakeCredential()]);
[dRepCredential, [dRepDeposit, governanceActionDeposit, stakeKeyDeposit], poolId, stakeCredential] =
await Promise.all([getDRepCredential(), getDeposits(), getPoolId(), getStakeCredential()]);

await feedDRepWallet(dRepDeposit * 2n);

if (!(await isRegisteredDRep())) await sendDRepRegCert(true);
});
Expand Down

0 comments on commit 0e0e6c6

Please sign in to comment.