feat: 🎸 Add 8.x events and extrinsics#331
Conversation
- Adds new pallets - revive, beefy - Adds new events and extrinsics for 8.x chain - Add support for asset holders in settlements
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
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.
|
6fcc383 to
9a0f4b1
Compare
9a0f4b1 to
97de260
Compare
There was a problem hiding this comment.
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
FundsTransferredsettlement 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
mapAssetMovementcan leavefromPortfolioId/toPortfolioIdunset whenfromData/toDatais an account holder, butPortfolioMovement.from/toare non-nullable in the schema. This will create invalid entities (undefinedfromId/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.
2bd6feb to
ab3d5d8
Compare
|



Description
Breaking Changes
JIRA Link
Checklist