Skip to content

chore: bump the SDK to 31.0.0 - #43

Open
prashantasdeveloper wants to merge 16 commits into
mainfrom
feat/v31-sdk-bump
Open

chore: bump the SDK to 31.0.0#43
prashantasdeveloper wants to merge 16 commits into
mainfrom
feat/v31-sdk-bump

Conversation

@prashantasdeveloper

Copy link
Copy Markdown
Collaborator

Description

Bumps @polymeshassociation/polymesh-sdk from 30.1.0 to 31.0.0d and updates
the integration suite for every breaking and behavioral change in between, with new
coverage for each feature the SDK gained along the way.

SDK v31 drops chain v7 support (SUPPORTED_SPEC_VERSION_RANGE narrowed to 8.x,
throws on connect otherwise), so this suite is now v8-only. isChainV7 and every branch
it fed are removed, along with the ChildIdentity entity/example (removed from the SDK).
envs/7.2 can no longer be used with this suite — noted in the README.

New coverage, one commit per area, matching each SDK release note between 30.1.0 and
31.0.0:

  • ticker registration config + chain-enforced ticker length validation
  • BaseAsset.getIssuedInFundingRound
  • the v8 POLYX balance breakdown (free/locked/reserved/frozen)
  • corrected v8 protocol fees
  • the transaction groups rebuilt from the chain's own permission model
    (InstructionMediation, DidRegistration added; RelayerManagement gone;
    MultiSigManagement reduced)
  • portfolio-level asset pre-approval, alongside the existing Identity-level one
  • registrar-gated DID registration (registerDid, isDidRegistrar)
  • the realigned TransferError enum and canTransfer reporting failures instead of
    throwing
  • Assets.transferFunds's new Instruction | undefined return type across all four
    settlement paths (same-Identity, auto-affirm, pending affirmation, NFT)
  • the mediator lock/unlock/relock cycle, getLegStatus, Venue.getSignerCount
  • Checkpoints.Schedules.getNextCheckpoint
  • CorporateActionBase.getDocuments

Fixed along the way: two SDK defects were caught by this new coverage and pinned as
known-broken while the suite was on beta.7 — getNextCheckpoint throwing instead of
returning null once every Schedule is removed, and STO off-chain funding receipts being
rejected as sto.ReceiptExpired because expiresAt was never encoded. Both shipped fixed
in 31.0.0-beta.8 (which also makes expiresAt required, not optional, on both receipt
generators); the pins are flipped to assert the correct behavior in the final commit.

Also un-gates two suites that were v7-only and now pass on v8: the off-chain leg of
tradeAssets (receipt encoding fixed in 30.1.1-beta.3) and createSto's off-chain
funding path.

Breaking Changes

None for this repo's own consumers — internal to the test suite. Note for anyone bumping
alongside this: SDK v31 requires chain v8+, and expiresAt is now a required argument to
generateOffChainAffirmationReceipt/generateOffChainFundingReceipt.

JIRA Link

Checklist

  • Updated the Readme.md (if required) ?

The SDK narrowed SUPPORTED_SPEC_VERSION_RANGE to 8.x in 31.0.0-beta.1 and
throws when connecting to a v7 node, so the suite is now v8 only and every
v7 branch in it is unreachable. These changes have to land together: the
bump does not compile until the removed APIs are gone, and the v7 gates
cannot be dropped before the bump makes them dead.

context.isV7 no longer exists, so isChainV7 silently returned undefined and
quietly disabled the code it guarded. Remove it along with the branches it
fed. withPendingInstructionBlock now shares getPendingInstructionEndBlock
rather than keeping a v7 escape hatch, and that helper always resolves a
block, so its return type loses the undefined.

The ChildIdentity entity and every child identity API were removed from the
SDK, so their example and (already skipped) suite go with them.

Two suites were gated to v7 only and now run on v8:

- The off chain settlement leg of tradeAssets. 30.1.1-beta.3 corrected the
  v8 receipt expiry and encoding, which is what kept it on v7.
- createSto. The on chain funded parts pass on v8. Its off chain funding
  section is extracted into enableOffChainFunding and
  investWithOffChainFunding, and the invest is pinned as a known SDK defect:
  the chain's FundraiserReceiptDetails carries an expiresAt that
  offChainFundingReceiptDetailsToMeshReceiptDetails never sets, so it
  encodes as 0 and every off chain funded investment is rejected with
  sto.ReceiptExpired. generateOffChainFundingReceipt has no parameter to
  supply one either. The equivalent fix landed for settlement receipts in
  30.1.1-beta.3 but not for STO funding receipts.

relayer.removePayingKey was the v7 spelling of relayer.removeSubsidy, so the
subsidy suite asserts the v8 tag directly.
BondPolyxParams.controller and SetStakingControllerParams were removed in
31.0.0-beta.1, and Staking.setController is now a no args procedure: a stash
can only make itself its own controller.

A stash is already bonded as its own controller on v8, so setController
rejects with staking.AlreadyPaired. Assert that rather than a success, since
the call only has an effect for legacy stashes that still have a separate
controller. The separate controller account the suite used to bond through
is gone; the stash signs bondExtra, unbond and withdraw itself.

The remaining tests were gated to v7 and never ran on v8. They pass once
they sign as the stash, so drop the gates.

Also cover two behaviours the bump changed:

- staking.getPayee returns null for an Account that has never bonded rather
  than throwing (31.0.0-beta.1).
- Bonded POLYX shows up in the new reserved field on the Account balance
  (30.1.1-beta.2).
Covers Assets.getTickerRegistrationConfig and the ticker length validation
it backs, both added in 30.2.0-beta.1. A ticker over the chain's
maxTickerLength is now rejected by reserveTicker and createAsset before
submission, and one exactly at the limit is accepted.
Covers BaseAsset.getIssuedInFundingRound, added in 30.2.0-beta.1. Asserts
the initial supply lands against the round the Asset was created with, that
further issuance accumulates into the current round, that each round is
tracked separately across a modify, and that an unknown round reports zero.
30.1.1-beta.2 corrected how a POLYX balance is derived and exposed the raw
chain values. free is now what the Account can actually spend, and reserved
and frozen are surfaced alongside it.

Pins the shape and the invariants that relate the components, and checks
accountManagement.getAccountBalance agrees with Account.getBalance.
31.0.0-beta.1 corrected the protocol fee mapping against the v8 runtime,
where fees for priced operations were silently reported as zero.

Asserts a fee comes back for every requested tag, that priced operations
report a non zero fee, and that the quoted fee matches what a prepared
transaction reports through getTotalFees.
31.0.0-beta.1 and beta.2 rebuilt the transaction groups from the chain's own
permission model, which changes what a permission UI built from
TX_GROUP_TO_TAGS_MAP produces.

Pins the mapping so a regression in the constants is caught without a chain
round trip: RelayerManagement is gone, DidRegistration and
InstructionMediation are new, MultiSigManagement is down to the one
permission checked call, tags for extrinsics no longer on chain are absent,
and nft.CreateNftCollection is reachable through an agent grantable group.

Then grants the two new groups to a secondary key end to end, since they are
newly grantable rather than relocated and no existing grant covers them.
30.2.0-beta.4 added pre-approval at the Portfolio level alongside the
existing Identity level one, alongside Portfolio.preApprovedAssets.

Covers preApproveAsset, isAssetPreApproved, preApprovedAssets and
removeAssetPreApproval, and asserts the two levels stay independent:
removing the Identity approval leaves the Portfolio one in place.
30.2.0-beta.5 added the registerDid procedure and 31.0.0-beta.1 renamed
Identity.isCddProvider to isDidRegistrar, deprecated registerIdentity and
reduced issuing a CDD claim to the DID Registrar role.

Covers the happy path signed by a registrar, the rejections for an Account
that already has an Identity and for a signer without the role, and both
sides of the CDD claim role check.
31.0.0-beta.1 aligned TransferError with the errors the chain actually
reports, removed the TransferStatus enum, dropped the CDD and investor
uniqueness members, and added InvalidReceiverIdentity. canTransfer reports
failures in its breakdown rather than throwing.

Pins the enum membership and covers the breakdown for a valid transfer, an
insufficient balance and frozen transfers.

Two cases are asserted as they actually behave rather than as the names
suggest. A transfer within one Identity is not a SelfTransfer on v8, since
an Identity may move funds between its own holders. And a decimal amount for
an indivisible Asset never reaches the chain to produce InvalidGranularity,
because the SDK rejects it while encoding the call.
31.0.0-beta.5 changed Assets.transferFunds from void to
Instruction | undefined and allowed transfers between asset holders on
different Identities.

Covers all three outcomes the return type encodes: undefined when the
transfer settles immediately within one Identity, undefined when it settles
immediately because the receiver auto affirms or has pre-approved the asset,
and a resolved pending Instruction when the receiver has opted in to
mandatory affirmation and has yet to affirm.

Also covers the NFT leg, reworked in beta.5 and beta.7.
30.2.0-beta.2 added unlockInstruction, completing the lock/relock cycle for
a SettleAfterLock instruction, and 30.2.0-beta.3 added getters for leg status
and venue signer count.

Walks the cycle as a mediator: lock for execution, read the lock info, read
each leg's status, unlock back to pending, and read the relock cooldown the
unlock starts. Then asserts a relock inside that cooldown is refused, which
happens while the transaction is prepared rather than on submission.

A receiver that has not opted in to mandatory affirmation is affirmed when
the instruction is created, so the helper only affirms the receiving side
when it is still pending.

Venue.getSignerCount is asserted against getAllowedSigners in createVenue,
where the off chain suites already exercise a venue with signers.
Covers Checkpoints.Schedules.getNextCheckpoint, added in 31.0.0-beta.3. With
one active Schedule the aggregate should agree with that Schedule's own
details, so the example asserts the date, the pending total and the Schedule
attribution against it.

The documented null case is split in two because only one half holds. An
Asset that never had a Schedule reports null. An Asset whose Schedules have
all been removed throws, and is pinned as a known SDK defect: the chain keeps
cachedNextCheckpoints populated with a nextAt sentinel of u64::MAX, which
momentToDate cannot convert.
Covers CorporateActionBase.getDocuments, added in 31.0.0-beta.4. Asserts a
new Corporate Action starts with no linked documents, then links one through
the Asset it was registered against and reads it back with its on-chain ID.
31.0.0-beta.8 fixes both SDK defects that were pinned as known-broken while
the suite was on beta.7:

- getNextCheckpoint now returns null once every Schedule has been removed,
  instead of throwing on the chain's u64::MAX nextAt sentinel. The
  checkpoint test asserts the documented null behaviour directly.
- offChainFundingReceiptDetailsToMeshReceiptDetails now encodes expiresAt,
  so an off chain funded STO investment settles instead of being rejected
  as sto.ReceiptExpired. createSto asserts the investment succeeds instead
  of asserting it fails.

This release also makes expiresAt required (previously optional) on
generateOffChainAffirmationReceipt/generateOffChainFundingReceipt and their
receipt types, part of the same fix. Both call sites in this suite already
passed it, so no other change was needed.
31.0.0 is now published to the latest dist-tag with the same content as
31.0.0-beta.8 (its changelog is the squashed history of every 31.0.0-beta.*
commit plus the beta.8 fix), so no other change is needed.
@prashantasdeveloper
prashantasdeveloper requested review from a team as code owners August 17, 2026 09:22
@prashantasdeveloper prashantasdeveloper changed the title Feat/v31 sdk bump chore: bump the SDK to 31.0.0 Aug 17, 2026
@prashantasdeveloper

Copy link
Copy Markdown
Collaborator Author

I ran test against this branch - https://github.com/PolymeshAssociation/polymesh-dev-env/actions/runs/32014958375. All green ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant