Ask the extension to add a new connection to the chain with the given specification.

interface ToExtensionAddChain {
    chainId: string;
    chainSpec: string;
    potentialRelayChainIds: string[];
    type: "add-chain";
}

Properties

chainId: string

Identifier for this chain used in all future messages concerning this chain. Allocated by the sender of this message. It is recommended to generate this ID randomly, with at least 48 bits of entropy.

chainSpec: string

JSON document containing the specification of the chain.

See the Substrate documentation for more information about the fields.

Note that this specification is fully trusted. If an attacker can somehow alter this specification, they can redirect the connection to a fake chain controlled by this attacker. In other words, the role of the substrate-connect extension is to connect to the chain whose specification is provided here, but not to have an opinion on whether this specification is legitimate.

potentialRelayChainIds: string[]

List of chainIds of all chains that are part of the same trusted sandbox as the provided chain specification.

Set this to the list of all chains that are currently alive.

If one of the chains isn't known by the extension, it gets silently removed from the array. This is necessary in order to avoid race conditions, as the extension might have sent a ToApplicationError message at the same time as this message has been sent.

type
MMNEPVFCICPMFPCPTTAAATR