Skip to content

feat: 🎸 Add 8.x events and extrinsics#331

Open
prashantasdeveloper wants to merge 19 commits into
alphafrom
feat/8.x-integration
Open

feat: 🎸 Add 8.x events and extrinsics#331
prashantasdeveloper wants to merge 19 commits into
alphafrom
feat/8.x-integration

Conversation

@prashantasdeveloper
Copy link
Copy Markdown
Contributor

Description

  • Adds new pallets - revive, beefy
  • Adds new events and extrinsics for 8.x chain
  • Add support for asset holders in settlements

Breaking Changes

JIRA Link

Checklist

  • Updated the Readme.md (if required) ?

- Adds new pallets - revive, beefy
- Adds new events and extrinsics for 8.x chain
- Add support for asset holders in settlements
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 6, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​subql/​cli@​6.6.0 ⏵ 6.6.381 -210010094 -370
Updated@​subql/​node@​5.11.2 ⏵ 6.4.6791009498 +870
Updated@​polymeshassociation/​polymesh-types@​7.2.0 ⏵ 7.4.098 +1100100 +191 +1100

View full report

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 6, 2026

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
Recently published: npm @nestjs/common published yesterday

Location: Package overview

From: ?npm/@subql/node@6.4.6npm/@nestjs/common@11.1.21

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@nestjs/common@11.1.21. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Recently published: npm @polymeshassociation/polymesh-types published 3 days ago

Location: Package overview

From: package.jsonnpm/@polymeshassociation/polymesh-types@7.4.0

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@polymeshassociation/polymesh-types@7.4.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@prashantasdeveloper prashantasdeveloper marked this pull request as ready for review May 13, 2026 09:28
@prashantasdeveloper prashantasdeveloper requested a review from a team as a code owner May 13, 2026 09:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SubQuery indexer to support Polymesh 8.x runtime changes by expanding the schema/enums, adding new event handlers, and updating portfolio/account (asset holder) extraction so settlements/assets/NFTs can handle account-based holders.

Changes:

  • Extend GraphQL schema + DB migrations for new 8.x pallets, events, and call IDs (incl. revive/beefy/confidentialassets, etc.).
  • Add/adjust mappings to support 8.x settlement legs and a new FundsTransferred settlement event, plus account-based asset holders in transfers/NFT updates.
  • Bump dependencies/tooling and tweak local dev runtime configuration.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
yarn.lock Dependency lockfile updates (SubQL CLI + transitive deps).
package.json Version bump and add run:dev; update polymesh-types and subql cli versions.
docker-compose.yml Adjust local env defaults and increase batch size.
project.ts Add new filters/handlers for 8.x events (e.g., FundsTransferred, NFTHoldingsUpdated) and new pallets.
schema.graphql Add 8.x modules/events/calls; adjust nullability for identity-based relations and add identity fields on asset transactions.
db/schemaMigrations.ts Sort/apply migrations deterministically and improve error typing.
db/migrations/12_add_new_8_chain_events.sql Add 8.x enum values for modules/calls/events.
db/migrations/13_add_identity_to_asset_transactions.sql Add/backfill from/to_identity_id columns and indexes.
db/migrations/14_confidential_assets_events_8_chain.sql Add further 8.x enum values for modules/calls/events.
db/migrations/15_add_missing_transfer_nft.sql Add missing transfer_nft call enum value.
src/utils/accounts.ts Add getOrCreateAccount for resolving account→identity and bootstrapping entities.
src/utils/portfolios.ts Add 8.x asset-holder extraction and new account/portfolio union types.
src/utils/settlements.ts Update settlement leg parsing to support 8.x account/portfolio holders.
src/utils/assets.ts Add extractAssetHolder to support 8.x asset holders and include identity IDs in asset txs.
src/utils/stos.ts Update portfolio/account discriminator field name (account vs accountId).
src/utils/distributions.ts Update portfolio/account discriminator field name (account vs accountId).
src/mappings/serializeLikeHarvester.ts Support newer ElectionScore struct shape serialization.
src/mappings/entities/settlements/mapSettlement.ts Update settlement flow to use new leg parsing; add FundsTransferred handler; adjust affirmation/party ID logic.
src/mappings/entities/identities/mapPortfolio.ts Refactor portfolio movement mapping into reusable mapAssetMovement and update account discriminator usage.
src/mappings/entities/identities/mapIdentities.ts Update permissions mapping to new account field; minor promise cleanup.
src/mappings/entities/block/mapChainUpgrade.ts Simplify tx version change branch logic.
src/mappings/entities/assets/mapStatistics.ts Fix bigint null/undefined coercion logic.
src/mappings/entities/assets/mapNfts.ts Rename handler and switch to asset-holder extraction for NFT holdings updates.
src/mappings/entities/assets/mapAsset.ts Add identity IDs to asset txs and refactor AssetBalanceUpdated reason processing.
Comments suppressed due to low confidence (1)

src/mappings/entities/identities/mapPortfolio.ts:261

  • mapAssetMovement can leave fromPortfolioId/toPortfolioId unset when fromData/toData is an account holder, but PortfolioMovement.from/to are non-nullable in the schema. This will create invalid entities (undefined fromId/toId) and likely crash indexing for account-based movements (e.g., FundsTransferred). Either (a) early-return/skip when an account holder is present, or (b) update the schema + entity model to allow account-only movements and write consistent IDs.
  let fromPortfolioId: string, toPortfolioId: string, fromAccount: string, toAccount: string;

  if ('account' in fromData) {
    ({ account: fromAccount } = fromData);
  } else {
    fromPortfolioId = `${fromData.identityId}/${fromData.number}`;
  }

  if ('account' in toData) {
    ({ account: toAccount } = toData);
  } else {
    toPortfolioId = `${toData.identityId}/${toData.number}`;
  }

  let assetId: string, amount: bigint, nftIds: bigint[];
  let type: PortfolioMovementTypeEnum;

  if (assetType === 'fungible') {
    const description = fundDescription as {
      ticker?: string;
      assetId?: string;
      amount: number;
    };
    assetId = await getAssetId(description.ticker ?? description.assetId, block);
    amount = BigInt(description.amount);
    type = PortfolioMovementTypeEnum.Fungible;
  } else if (assetType === 'nonFungible') {
    const description = fundDescription as {
      ticker?: string;
      assetId?: string;
      ids: number[];
    };
    nftIds = description.ids.map(BigInt);
    assetId = await getAssetId(description.ticker ?? description.assetId, block);
    type = PortfolioMovementTypeEnum.NonFungible;
  }

  await PortfolioMovement.create({
    id: blockEventId,
    fromId: fromPortfolioId,
    fromAccount,
    toId: toPortfolioId,
    toAccount,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/accounts.ts Outdated
Comment thread src/mappings/entities/assets/mapAsset.ts
Comment thread src/utils/settlements.ts
Comment thread db/migrations/12_add_new_8_chain_events.sql
Comment thread schema.graphql
Comment thread src/mappings/entities/assets/mapNfts.ts
Comment thread project.ts Outdated
Comment thread docker-compose.yml Outdated
Comment thread docker-compose.yml Outdated
Comment thread src/mappings/entities/settlements/mapSettlement.ts Outdated
Comment thread docker-compose.yml Outdated
F-OBrien
F-OBrien previously approved these changes May 15, 2026
@sonarqubecloud
Copy link
Copy Markdown

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.

3 participants