Skip to content
Merged
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
17 changes: 11 additions & 6 deletions services/control-plane/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,17 @@ function devnetRootfields(state: LoadedControlPlaneState): Record<string, JsonVa

function devnetMap(state: LoadedControlPlaneState, key: string): Record<string, JsonValue> {
const controlPlaneObjects = asJsonObject(state.devnetControlPlaneHandoff?.objects);
const value = state.devnet?.[key]
?? controlPlaneObjects?.[key]
?? state.devnetControlPlaneHandoff?.[key]
?? state.devnetVerifierHandoff?.[key]
?? state.devnetIndexerHandoff?.[key];
return value !== null && typeof value === "object" && !Array.isArray(value) ? value as Record<string, JsonValue> : {};
const candidates = [
state.devnet?.[key],
controlPlaneObjects?.[key],
state.devnetControlPlaneHandoff?.[key],
state.devnetVerifierHandoff?.[key],
state.devnetIndexerHandoff?.[key],
];
const maps = candidates
.map((value) => asJsonObject(value))
.filter((value): value is Record<string, JsonValue> => value !== null);
return maps.find((value) => Object.keys(value).length > 0) ?? maps[0] ?? {};
}

function firstDevnetMap(state: LoadedControlPlaneState, keys: string[]): Record<string, JsonValue> {
Expand Down
7 changes: 7 additions & 0 deletions services/control-plane/test/control-plane.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,12 @@ test("smoke client ignores stale local devnet blocks without transactions", () =
txIds: [],
receipts: [],
}],
tokenDefinitions: {},
tokenBalances: {},
dexPools: {},
lpPositions: {},
swapReceipts: {},
bridgeCredits: {},
}));

const smoke = runControlPlaneSmoke({
Expand All @@ -444,6 +450,7 @@ test("smoke client ignores stale local devnet blocks without transactions", () =
assert.equal(smoke.schema, "flowmemory.control_plane.smoke.v0");
assert.equal(smoke.ok, true);
assert.equal(typeof (smoke.queried as Record<string, unknown>).txId, "string");
assert.equal(typeof (smoke.queried as Record<string, unknown>).tokenId, "string");
} finally {
rmSync(dir, { recursive: true, force: true });
}
Expand Down
Loading