From 7163ee9e955eaac34ae029fb8c5ffe00f8a97121 Mon Sep 17 00:00:00 2001 From: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com> Date: Thu, 27 Aug 2026 14:28:18 +0530 Subject: [PATCH] test: restore the dividend distribution self-claim step Blocked on PolymeshAssociation/polymesh-sdk#1663, which fixes the actual bug: prepareClaimDividends checked participation against whatever Identity distribution.context's signingAddress last pointed to instead of the Identity actually signing the claim, since the DividendDistribution entity is fetched off a Context that isn't necessarily this Procedure's own per-call one. Confirmed live against a real chain v8 node with a temporary patch of a running polymesh-rest-api container's SDK copy: 13/13 passing, including this step, once the fix is applied. This will fail in CI until polymesh-rest-api bumps its SDK dependency to a release containing that fix. --- .../dividend-distributions.ts | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/tests/src/__tests__/rest/corporate-actions/dividend-distributions.ts b/tests/src/__tests__/rest/corporate-actions/dividend-distributions.ts index 6034f97..dd5ab76 100644 --- a/tests/src/__tests__/rest/corporate-actions/dividend-distributions.ts +++ b/tests/src/__tests__/rest/corporate-actions/dividend-distributions.ts @@ -4,6 +4,7 @@ import { createAssetParams } from '~/rest/assets/params'; import { createCheckpointParams } from '~/rest/checkpoints/params'; import { ProcessMode } from '~/rest/common'; import { + claimDividendDistributionParams, createDividendDistributionParams, modifyDistributionCheckpointParams, payDividendDistributionParams, @@ -213,18 +214,26 @@ describe('Dividend Distributions', () => { expect(distributions.results[0].id).toBe(distributionId); }); - // NOTE: a "claimant self-claims via `capitalDistribution.claim`" step was removed here. - // It consistently rejects with "The signing Identity is not included in this Distribution" - // (the SDK's DividendDistribution.getParticipant() returns null), even though: - // - claimant's checkpoint-time balance is confirmed correct (see the diagnostic assertion - // in "should create a dividend distribution", which checks the same checkpoint directly) - // - targets uses the default Exclude:[] (everyone included), so target-list membership - // isn't the issue - // - the equivalent push-based payment (to the holder, above) succeeds against the same - // distribution/checkpoint - // This looks like a genuine discrepancy between getParticipant()'s internal checkpoint-balance - // resolution and the identical query made directly through the checkpoint-balances endpoint, - // rather than anything wrong with these params. Needs SDK-level investigation to pin down. + it('claimant should be able to claim the distribution', async () => { + const params = claimDividendDistributionParams({ + options: { processMode: ProcessMode.Submit, signer: claimant.signer }, + }); + + const result = await restClient.corporateActions.claimDividendDistribution( + assetId, + distributionId, + params + ); + expect(result).toMatchObject({ + transactions: expect.arrayContaining([ + { + transactionTag: 'capitalDistribution.claim', + type: 'single', + ...expectBasicTxInfo, + }, + ]), + }); + }); it('should reclaim the distribution', async () => { const remainingMs = expiryDate.getTime() - Date.now(); @@ -252,7 +261,7 @@ describe('Dividend Distributions', () => { }); it('should be able to get payment history', async () => { - // only the holder was actually paid (pushed); the claimant's claim step above is skipped + // the holder was paid via a push; the claimant claimed their own share above const result = await restClient.corporateActions.paymentHistory(assetId, distributionId); expect(result).toMatchObject({ results: expect.arrayContaining([