Skip to content

Use GetParachainInfo to get para id #944

@xlc

Description

@xlc

export const getParaId = async (chain: Blockchain) => {
const meta = await chain.head.meta
const id = await chain.head.read('u32', meta.query.parachainInfo.parachainId)
if (!id) {
throw new Error('Cannot find parachain id')
}
return id
}

this code should fallback to GetParachainInfo runtime API if storage did not exists

paritytech/polkadot-sdk#8651

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions