Skip to content

Commit b8c1e95

Browse files
fixup! fix(core): withdrawal calculation in computeImplicitCoin
1 parent e305e80 commit b8c1e95

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/test/Cardano/util/computeImplicitCoin.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as Crypto from '@cardano-sdk/crypto';
22
import { Cardano } from '../../../src';
3+
import { Ed25519KeyHashHex } from '@cardano-sdk/crypto';
34

45
describe('Cardano.util.computeImplicitCoin', () => {
56
let rewardAccount: Cardano.RewardAccount;
@@ -61,18 +62,19 @@ describe('Cardano.util.computeImplicitCoin', () => {
6162

6263
it('sums registrations for deposit, withdrawals and deregistrations for input', () => {
6364
const protocolParameters = { dRepDeposit: 5, poolDeposit: 3, stakeKeyDeposit: 2 } as Cardano.ProtocolParameters;
65+
const poolId = Cardano.PoolId.fromKeyHash(Ed25519KeyHashHex(Cardano.RewardAccount.toHash(rewardAccount)));
6466
const certificates: Cardano.Certificate[] = [
6567
{ __typename: Cardano.CertificateType.StakeRegistration, stakeCredential },
6668
{ __typename: Cardano.CertificateType.StakeDeregistration, stakeCredential },
6769
{ __typename: Cardano.CertificateType.StakeRegistration, stakeCredential },
6870
{
6971
__typename: Cardano.CertificateType.PoolRetirement,
7072
epoch: Cardano.EpochNo(500),
71-
poolId: Cardano.PoolId('pool1zuevzm3xlrhmwjw87ec38mzs02tlkwec9wxpgafcaykmwg7efhh')
73+
poolId
7274
},
7375
{
7476
__typename: Cardano.CertificateType.StakeDelegation,
75-
poolId: Cardano.PoolId('pool1zuevzm3xlrhmwjw87ec38mzs02tlkwec9wxpgafcaykmwg7efhh'),
77+
poolId,
7678
stakeCredential
7779
},
7880
{
@@ -88,7 +90,7 @@ describe('Cardano.util.computeImplicitCoin', () => {
8890
}
8991
];
9092
const withdrawals: Cardano.Withdrawal[] = [{ quantity: 5n, stakeAddress: rewardAccount }];
91-
const coin = Cardano.util.computeImplicitCoin(protocolParameters, { certificates, withdrawals });
93+
const coin = Cardano.util.computeImplicitCoin(protocolParameters, { certificates, withdrawals }, [rewardAccount]);
9294
expect(coin.deposit).toBe(2n + 2n + 7n);
9395
expect(coin.input).toBe(2n + 3n + 5n + 7n);
9496
expect(coin.withdrawals).toBe(5n);

0 commit comments

Comments
 (0)