Repository navigation
Conversation
`Account.getCollections({ collections })` queried `nft.nftHolder`
with each collection's id as a UUID string, where the storage key is a
16-byte Asset ID, so polkadot.js refused it before any request was
made. A controller transfer from an Account, and redeeming an NFT held
by an Account, both check the holder's NFTs this way, so both threw
before signing. The id is now converted as Portfolio already does.
The same read reported `total` as the free NFTs only, and threw a
`TypeError` for a collection whose every NFT is locked, since an NFT is
either `Owner` or `OwnerLocked` and never both. `total` now counts
both, matching Portfolio, and a collection named twice is read once.
`TransferRestrictions.getExemptions()` derived the exemption keys to read from the Asset's active restrictions, so an exemption that no current restriction uses was never returned: one granted before its restriction, one left after a restriction was removed, or one on a statistic no restriction uses. `addExemptions` still refused to add it again, since it reads storage directly. The chain only consults an exemption keyed by `Count` or `Balance`, with no claim or with one of the claims a statistic can be scoped by, so the read now queries those eight keys in parallel, whatever restrictions are set. It no longer reads the restrictions at all.
The `modifyBallot` procedure existed, but no method ran it, so a Ballot's metadata, end date and RCV setting could not be changed through the SDK. `CorporateBallot.modify()` now exposes it. Two faults in the procedure are fixed with it. It read the Ballot's details while preparing, so it resolved to the Ballot as it was before the change; it now reads them once the batch has run. It compared the new end date with the current one by reference, so an unchanged end date was never refused; it now compares the times.
F-OBrien
force-pushed
the
fix-account-collections-asset-id
branch
from
October 1, 2026 09:54
7fb205a to
34c0e1c
Compare
Several reads awaited one chain request per item in a loop, though no item depended on another: resolving each leg's Asset and building each Instruction in `addInstruction`, resolving each movement's Asset in `moveFunds` (once per balance and movement pair in the balance check), converting each compliance condition's claims, resolving each NFT metadata key, and reading each secondary Account's permissions. They now run together, and results keep their order. `addInstruction` now builds no Instruction once any fails validation. It previously built those before the first failure, and the caller threw them away. SonarCloud's new S9382 rule flagged these. The other loops it flags page by cursor, poll, or cap concurrency, so they stay sequential.
F-OBrien
force-pushed
the
fix-account-collections-asset-id
branch
from
October 1, 2026 11:11
71768ad to
ebed848
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes and one small feature from the Polymesh Portal v2 team's request register. These are the open items that can land without a major. Each commit is one change:
fix: 馃悰 read an Account's NFTs by collection(G-SDK-32, P1).Account.getCollections({ collections })passed each collection's UUID string as thenft.nftHolderkey, where the key is a 16-byteAssetId. polkadot.js refuses that withExpected input with 16 bytes (128 bits), found 36 bytes. Two callers hit it, and both threw before signing:nftControllerTransfer, when the origin is an AccountredeemNft, when the NFT is held by an AccountThe id now goes through
stringToAssetId, which is whatPortfolioalready does. Two more faults in the same method are fixed:totalcounted only the free NFTs. An NFT's status is eitherOwnerorOwnerLocked, never both, sototalnow counts both lists. This matchesPortfolio.TypeError(heldwasundefined).Collections named twice are now deduplicated, as in
Portfolio. The unit test had been stubbingentrieswith the string id, so it passed while asserting the bug.fix: 馃悰 list every transfer restriction exemption the chain applies(G-SDK-33).getExemptions()worked out which keys to read from the active restrictions, so it never returned an exemption that no current restriction uses.addExemptionsreads storage directly, so it still refused to add that exemption again as a duplicate. The chain only ever consults keys fromTransferCondition::get_exempt_key:CountorBalance, with no claim or withAccredited,AffiliateorJurisdiction. The read now queries those eight keys in parallel and no longer reads the restrictions at all. Three private helpers go with it.feat: 馃幐 modify a Ballot before it starts(G-SDK-34). ThemodifyBallotprocedure existed but nothing exposed it. This addsCorporateBallot.modify({ meta?, endDate?, rcv? }), plus two fixes to the procedure:prepare, so the method returned the ballot's details from before the change. It now runs after the batch.Dates by reference, so it never fired. It now comparesgetTime().Left out on purpose:
satisfies TxTag[].Verification:
yarn lintandyarn build:tspass.yarn testpasses 213 suites and 2869 tests. The four changed source files have 100% line and branch coverage.api-snapshot:compareagainstdevelopreports no breaking changes.@polkadot/typesfrom this repo: the UUID is rejected and the hex form is accepted. None of this has been run against a dev node.Breaking Changes
None to the type surface. Two behaviour changes, recorded in
changelogs/v31.0.0-next.md:account.getCollections()counts locked NFTs intotal.asset.transferRestrictions.getExemptions()returns exemptions that no active restriction uses.JIRA Link
Checklist