Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/ui/src/runtime-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@ function getPlatformType(userAgent: string = navigator.userAgent): string {
return "Unknown";
}

// `assetHub` drives the host's dotNS username resolution. Typed as an
// intersection so this compiles against @parity/truapi-host releases from
// before the field existed; once the dependency floor includes it, fold the
// field into the plain ProductRuntimeConfig literal.
type RuntimeConfigWithAssetHub = ProductRuntimeConfig & {
assetHub?: { genesisHash: string | Uint8Array };
};

// The window origin deliberately plays no part here: `productId` comes
// solely from the label (or the explicit override).
export function createTruapiRuntimeConfig(
label: string,
productId: string = labelToProductId(label),
): ProductRuntimeConfig {
return {
const config: RuntimeConfigWithAssetHub = {
productId,
host: {
name: "Polkadot Web",
Expand All @@ -44,8 +52,12 @@ export function createTruapiRuntimeConfig(
bulletin: {
genesisHash: getActiveServicesConfig().bulletin.genesis,
},
assetHub: {
genesisHash: getActiveServicesConfig().assethub.genesis,
},
pairing: {
deeplinkScheme: "polkadotapp",
},
};
return config;
}
3 changes: 3 additions & 0 deletions packages/ui/tests/runtime-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ describe("createTruapiRuntimeConfig", () => {
bulletin: {
genesisHash: getActiveServicesConfig().bulletin.genesis,
},
assetHub: {
genesisHash: getActiveServicesConfig().assethub.genesis,
},
pairing: {
deeplinkScheme: "polkadotapp",
},
Expand Down
Loading