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
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.9/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"files": {
"includes": ["**", "!**/dist", "!**/graypaper-archive", "!**/public", "!**/tools/matrix-bot/messages.json"]
},
Expand Down
41 changes: 37 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@biomejs/biome": "^2.3.11",
"@fluffylabs/shared-ui": "^0.4.5",
"@tailwindcss/vite": "^4.1.17",
"@typeberry/lib": "^0.5.1-1dda9d6",
"@typeberry/lib": "^0.5.1-1534485f",
"lucide-react": "^0.562.0",
"react": "^19.0.0",
"react-dom": "^19.2.3",
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppsSidebar, Button, Header } from "@fluffylabs/shared-ui";
import { utils } from "@typeberry/lib";
import * as utils from "@typeberry/lib/utils";
import { Settings } from "lucide-react";
import { useState } from "react";
import logo from "./assets/logo.svg";
Expand Down
5 changes: 0 additions & 5 deletions src/components/CodecInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ vi.mock("@fluffylabs/shared-ui", () => ({
cn: (...classes: unknown[]) => classes.filter(Boolean).join(" "),
}));

vi.mock("@typeberry/lib", async () => {
const actual = await vi.importActual<typeof import("@typeberry/lib")>("@typeberry/lib");
return actual;
});

// Mock child components
vi.mock("./ChainSpecSelect", () => ({
ChainSpecSelect: ({ chainSpec }: { setChainSpec: (spec: string) => void; chainSpec: string }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Controls.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from "@fluffylabs/shared-ui";
import { bytes } from "@typeberry/lib";
import * as bytes from "@typeberry/lib/bytes";
import { UploadIcon } from "lucide-react";
import { useCallback } from "react";
import { ChainSpecSelect } from "./ChainSpecSelect";
Expand Down
5 changes: 0 additions & 5 deletions src/components/KindFinder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ vi.mock("@fluffylabs/shared-ui", () => ({
),
}));

vi.mock("@typeberry/lib", async () => {
const actual = await vi.importActual<typeof import("@typeberry/lib")>("@typeberry/lib");
return actual;
});

describe("KindFinder", () => {
const mockSetKind = vi.fn();

Expand Down
2 changes: 1 addition & 1 deletion src/components/KindFinder.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from "@fluffylabs/shared-ui";
import { bytes } from "@typeberry/lib";
import * as bytes from "@typeberry/lib/bytes";
import { InfoIcon } from "lucide-react";
import { useMemo } from "react";
import { ALL_CHAIN_SPECS, kinds, tinyChainSpec } from "./constants";
Expand Down
29 changes: 13 additions & 16 deletions src/components/SettingsDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,22 @@ vi.mock("@fluffylabs/shared-ui", () => ({
),
}));

vi.mock("@typeberry/lib", async () => {
const actual = await vi.importActual<typeof import("@typeberry/lib")>("@typeberry/lib");
vi.mock("@typeberry/lib/utils", async () => {
const actual = await vi.importActual<typeof import("@typeberry/lib/utils")>("@typeberry/lib/utils");
return {
...actual,
utils: {
...actual.utils,
GpVersion: {
...actual.utils.GpVersion,
V1: "V1",
V2: "V2",
},
TestSuite: {
...actual.utils.TestSuite,
Suite1: "Suite1",
Suite2: "Suite2",
},
CURRENT_VERSION: "V1",
CURRENT_SUITE: "Suite1",
GpVersion: {
...actual.GpVersion,
V1: "V1",
V2: "V2",
},
TestSuite: {
...actual.TestSuite,
Suite1: "Suite1",
Suite2: "Suite2",
},
CURRENT_VERSION: "V1",
CURRENT_SUITE: "Suite1",
};
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/SettingsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from "@fluffylabs/shared-ui";
import { utils } from "@typeberry/lib";
import * as utils from "@typeberry/lib/utils";
import { X } from "lucide-react";
import { useEffect, useMemo, useState } from "react";

Expand Down
22 changes: 10 additions & 12 deletions src/components/constants.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {
block,
type bytes,
codec,
config,
jam_host_calls as jam,
state,
state_vectors,
state_merkleization as stateSer,
} from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import type * as bytes from "@typeberry/lib/bytes";
import * as codec from "@typeberry/lib/codec";
import * as config from "@typeberry/lib/config";
import * as jam from "@typeberry/lib/jam-host-calls";
import * as state from "@typeberry/lib/state";
import * as stateSer from "@typeberry/lib/state-merkleization";
import * as stateVectors from "@typeberry/lib/state-vectors";
import { hostCallInfoAccountExample } from "./examples/host/infoAccount";
import { assurancesExtrinsicExample } from "./examples/objects/assurancesExtrinsic";
import { availabilityAssuranceExample } from "./examples/objects/availabilityAssurance";
Expand Down Expand Up @@ -214,8 +212,8 @@ const clKind = newKind(
"Lookup History Item",
);
const hostInfoAccountKind = newKind("Host Call - Info: Account", jam.hostCallInfoAccount, hostCallInfoAccountExample);
const stfGenesisKind = newKind("STF Genesis", state_vectors.StateTransitionGenesis.Codec, stfGenesisExample);
const stfVectorKind = newKind("STF Vector", state_vectors.StateTransition.Codec, stfVectorExample);
const stfGenesisKind = newKind("STF Genesis", stateVectors.StateTransitionGenesis.Codec, stfGenesisExample);
const stfVectorKind = newKind("STF Vector", stateVectors.StateTransition.Codec, stfVectorExample);

export const kinds = [
headerKind,
Expand Down
5 changes: 4 additions & 1 deletion src/components/examples/host/infoAccount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { type codec, type config, type jam_host_calls as jam, state } from "@typeberry/lib";
import type * as codec from "@typeberry/lib/codec";
import type * as config from "@typeberry/lib/config";
import type * as jam from "@typeberry/lib/jam-host-calls";
import * as state from "@typeberry/lib/state";

import { filledHash, serviceGas, serviceId, timeSlot, u32, u64 } from "../objects/helpers";

Expand Down
2 changes: 1 addition & 1 deletion src/components/examples/objects/assurancesExtrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { config } from "@typeberry/lib";
import * as config from "@typeberry/lib/config";

import { availabilityAssuranceExample } from "./availabilityAssurance";
import { asKnownSize } from "./helpers";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/availabilityAssurance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { bitVecFrom, ed25519Signature, resolveExampleSpec, validatorIndex, zeroHash } from "./helpers";
Expand Down
15 changes: 6 additions & 9 deletions src/components/examples/objects/block.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { block, config } from "@typeberry/lib";

import { Block } from "@typeberry/lib/block";
import type { ChainSpec } from "@typeberry/lib/config";
import { tinyChainSpec } from "@typeberry/lib/config";
import { extrinsicExample } from "./extrinsic";
import { headerExample } from "./header";
import { encodeWithExampleSpec } from "./helpers";

export const blockExample = (spec: config.ChainSpec = config.tinyChainSpec): block.Block =>
block.Block.create({
export const blockExample = (spec: ChainSpec = tinyChainSpec): Block =>
Block.create({
header: headerExample(spec),
extrinsic: extrinsicExample(spec),
});

export const TEST_BLOCK = encodeWithExampleSpec(
block.Block.Codec,
blockExample(config.tinyChainSpec),
config.tinyChainSpec,
).toString();
export const TEST_BLOCK = encodeWithExampleSpec(Block.Codec, blockExample(tinyChainSpec), tinyChainSpec).toString();
3 changes: 2 additions & 1 deletion src/components/examples/objects/credential.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { ed25519Signature, validatorIndex } from "./helpers";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/culprit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { ed25519Key, ed25519Signature, filledHash } from "./helpers";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/disputesExtrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { culpritExample } from "./culprit";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/epochMarker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import { getStateDimensions } from "../state/common";
import type { ClassInstance } from "../types";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/extrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import { availabilityAssuranceExample } from "./availabilityAssurance";
import { disputesExtrinsicExample } from "./disputesExtrinsic";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/fault.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { ed25519Key, ed25519Signature, filledHash } from "./helpers";
Expand Down
2 changes: 1 addition & 1 deletion src/components/examples/objects/guaranteesExtrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { config } from "@typeberry/lib";
import * as config from "@typeberry/lib/config";
import { asKnownSize } from "./helpers";
import { reportGuaranteeExample } from "./reportGuarantee";

Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/header.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import { bandersnatchSignature, encodeWithExampleSpec, zeroHash } from "./helpers";

Expand Down
8 changes: 7 additions & 1 deletion src/components/examples/objects/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { block, bytes, codec, collections, config, type crypto, numbers } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as bytes from "@typeberry/lib/bytes";
import * as codec from "@typeberry/lib/codec";
import * as collections from "@typeberry/lib/collections";
import * as config from "@typeberry/lib/config";
import type * as crypto from "@typeberry/lib/crypto";
import * as numbers from "@typeberry/lib/numbers";

export const asKnownSize = collections.asKnownSize;
export const FixedSizeArray = collections.FixedSizeArray;
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/importSpec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { filledHash } from "./helpers";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/judgement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { ed25519Signature, validatorIndex } from "./helpers";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/preimage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { bytesBlobFrom, serviceId } from "./helpers";
Expand Down
2 changes: 1 addition & 1 deletion src/components/examples/objects/preimageExtrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { config } from "@typeberry/lib";
import * as config from "@typeberry/lib/config";
import { preimageExample } from "./preimage";

export const preimageExtrinsicExample = (
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/refineContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { filledHash, timeSlot } from "./helpers";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/reportGuarantee.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { credentialExample } from "./credential";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/signedTicket.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { bandersnatchProof } from "./helpers";
Expand Down
4 changes: 3 additions & 1 deletion src/components/examples/objects/ticket.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { block, bytes, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as bytes from "@typeberry/lib/bytes";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";

Expand Down
2 changes: 1 addition & 1 deletion src/components/examples/objects/ticketExtrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { config } from "@typeberry/lib";
import * as config from "@typeberry/lib/config";

import { asKnownSize } from "./helpers";
import { signedTicketExample } from "./signedTicket";
Expand Down
3 changes: 2 additions & 1 deletion src/components/examples/objects/validatorKeys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { block, config } from "@typeberry/lib";
import * as block from "@typeberry/lib/block";
import * as config from "@typeberry/lib/config";

import type { ClassInstance } from "../types";
import { bandersnatchKey, ed25519Key } from "./helpers";
Expand Down
Loading