Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,6 @@ coverage/

# cairo
.snfoundry_cache/

# docs
docs/src/content/docs/architecture/voyager/*
5 changes: 5 additions & 0 deletions .helix/languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ name = "nix"
scope = "source.nix"
shebangs = []

[[language]]
formatter = { command = "deno", args = ["fmt", "-", "--ext", "md"] }
name = "markdown"
# auto-format = true

[[grammar]]
name = "astro"
source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "4be180759ec13651f72bacee65fa477c64222a1a" }
Expand Down
2 changes: 1 addition & 1 deletion app2/app2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _: {
packages = {
app2 = buildPnpmPackage rec {
packageJsonPath = ./package.json;
extraSrcs = [
extraSrcs = pkgs.lib.fileset.unions [
../app2
../effect-svelte
../ts-sdk
Expand Down
5 changes: 2 additions & 3 deletions app2/src/routes/explorer/dust/[packet_hash]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { redirect } from "@sveltejs/kit"
import { PacketHash } from "@unionlabs/sdk/schema"
import { PacketHashFromLenient } from "@unionlabs/sdk/schema"
import * as E from "effect/Either"
import * as S from "effect/Schema"
import type { PageLoad } from "./$types"

export const prerender = false

export const load: PageLoad = ({ params }) => {
const packetHash = S.decodeEither(PacketHash)(params.packet_hash)
const packetHash = S.decodeEither(PacketHashFromLenient)(params.packet_hash)

return E.match(packetHash, {
onLeft: () => {
Expand All @@ -18,4 +18,3 @@ export const load: PageLoad = ({ params }) => {
}),
})
}

4 changes: 2 additions & 2 deletions app2/src/routes/explorer/packets/[packet_hash]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { redirect } from "@sveltejs/kit"
import { PacketHash } from "@unionlabs/sdk/schema"
import { PacketHashFromLenient } from "@unionlabs/sdk/schema"
import * as E from "effect/Either"
import * as S from "effect/Schema"
import type { PageLoad } from "./$types"

export const load: PageLoad = ({ params }) => {
const packetHash = S.decodeEither(PacketHash)(params.packet_hash)
const packetHash = S.decodeEither(PacketHashFromLenient)(params.packet_hash)

return E.match(packetHash, {
onLeft: () => {
Expand Down
4 changes: 2 additions & 2 deletions app2/src/routes/explorer/stakes/[packet_hash]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { redirect } from "@sveltejs/kit"
import { PacketHash } from "@unionlabs/sdk/schema"
import { PacketHashFromLenient } from "@unionlabs/sdk/schema"
import * as E from "effect/Either"
import * as S from "effect/Schema"
import type { PageLoad } from "./$types"

export const prerender = false

export const load: PageLoad = ({ params }) => {
const packetHash = S.decodeEither(PacketHash)(params.packet_hash)
const packetHash = S.decodeEither(PacketHashFromLenient)(params.packet_hash)

return E.match(packetHash, {
onLeft: () => {
Expand Down
4 changes: 2 additions & 2 deletions app2/src/routes/explorer/transfers/[packet_hash]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { redirect } from "@sveltejs/kit"
import { PacketHash } from "@unionlabs/sdk/schema"
import { PacketHashFromLenient } from "@unionlabs/sdk/schema"
import * as E from "effect/Either"
import * as S from "effect/Schema"
import type { PageLoad } from "./$types"

export const load: PageLoad = ({ params }) => {
const packetHash = S.decodeEither(PacketHash)(params.packet_hash)
const packetHash = S.decodeEither(PacketHashFromLenient)(params.packet_hash)

return E.match(packetHash, {
onLeft: () => {
Expand Down
4 changes: 2 additions & 2 deletions app2/src/routes/explorer/unstakes/[packet_hash]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { redirect } from "@sveltejs/kit"
import { PacketHash } from "@unionlabs/sdk/schema"
import { PacketHashFromLenient } from "@unionlabs/sdk/schema"
import * as E from "effect/Either"
import * as S from "effect/Schema"
import type { PageLoad } from "./$types"

export const prerender = false

export const load: PageLoad = ({ params }) => {
const packetHash = S.decodeEither(PacketHash)(params.packet_hash)
const packetHash = S.decodeEither(PacketHashFromLenient)(params.packet_hash)

return E.match(packetHash, {
onLeft: () => {
Expand Down
5 changes: 2 additions & 3 deletions app2/src/routes/explorer/withdrawals/[packet_hash]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { redirect } from "@sveltejs/kit"
import { PacketHash } from "@unionlabs/sdk/schema"
import { PacketHashFromLenient } from "@unionlabs/sdk/schema"
import * as E from "effect/Either"
import * as S from "effect/Schema"
import type { PageLoad } from "./$types"

export const prerender = false

export const load: PageLoad = ({ params }) => {
const packetHash = S.decodeEither(PacketHash)(params.packet_hash)
const packetHash = S.decodeEither(PacketHashFromLenient)(params.packet_hash)

return E.match(packetHash, {
onLeft: () => {
Expand All @@ -18,4 +18,3 @@ export const load: PageLoad = ({ params }) => {
}),
})
}

2 changes: 1 addition & 1 deletion ceremony/ceremony.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _: {
ceremony = buildPnpmPackage {
hash = "sha256-1R/7+vIllXY+KmNgxxH2fEHM4UzVmHDiDA3XqmODuJI=";
packageJsonPath = ./package.json;
extraSrcs = [
extraSrcs = pkgs.lib.fileset.unions [
../ceremony
];
pnpmWorkspaces = [
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/lightclient/attested/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Note that all attestations contain a height and a timestamp. Rather than having

An existing attestor service for EVM-compatible chains is provided via a [Voyager plugin][attestor-evm]. See the plugin's documentation for how to run the attestor service. Alternative implementations are welcome, both for EVM-compatible chains and other execution environments.

## Light Client Flow
## Light Client

This contract fully supports the union IBC light client specification, as follows:

Expand Down
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ pnpm-debug.log*
.wrangler
.stackbit
.eslintcache

./src/content/docs/architecture/voyager/*
157 changes: 155 additions & 2 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import svelte from "@astrojs/svelte"
import starlightUtils from "@lorenzo_lewis/starlight-utils"
import tailwindcss from "@tailwindcss/vite"
import { defineConfig, passthroughImageService } from "astro/config"
import ecTwoSlash from "expressive-code-twoslash"
import * as Fs from "node:fs/promises"
import path from "node:path"
import * as Toml from "smol-toml"
import starlightHeadingBadges from "starlight-heading-badges"
import starlightLinksValidator from "starlight-links-validator"
import starlightThemeRapide from "starlight-theme-rapide"
import Icons from "unplugin-icons/vite"
import { loadEnv } from "vite"
import { loadEnv, type ViteDevServer } from "vite"
import examplesToPages from "./integrations/examples-to-pages.js"
import { markdownConfiguration } from "./markdown.config.ts"

Expand All @@ -24,6 +26,133 @@ const { PORT = 4321, ENABLE_DEV_TOOLBAR = "false" } = loadEnv(
"",
)

const copyExternalDocs = () => {
async function* walk(dir: string): AsyncGenerator<string> {
for await (const d of await Fs.opendir(dir)) {
const entry = path.join(dir, d.name)
if (d.isDirectory()) {
yield* walk(entry)
} else if (d.isFile()) {
yield entry
}
}
}

async function copyVoyagerDir(dir: string) {
const voyagerDir = `../voyager/${dir}/`

for await (const rawPath of walk(voyagerDir)) {
const voyagerDirPath = rawPath.replace("../voyager/", "")
await copyVoyagerFile(voyagerDirPath)
}
}

async function copyVoyagerFile(voyagerDirPath: string) {
// ignore rust files
if (voyagerDirPath.endsWith(".rs") || voyagerDirPath.endsWith(".toml")) {
return
}

console.log({ voyagerDirPath })

const ext = path.extname(voyagerDirPath)
if (path.basename(voyagerDirPath) === "README.md") {
// stfu typescript
const packageName = (Toml.parse(
await Fs.readFile(
path.join("../voyager", `${voyagerDirPath.replace("README.md", "Cargo.toml")}`),
"utf8",
),
).package as Toml.TomlTable)["name"]

const readme = await Fs.readFile(path.join("../voyager", voyagerDirPath))

const finalPath = path.dirname(
path.join("./src/content/docs/architecture/voyager", voyagerDirPath),
)

await Fs.mkdir(path.normalize(finalPath + "/.."), { recursive: true })

await Fs.writeFile(
finalPath + ".md",
`---\ntitle: "${packageName}"\n---\n${readme}`,
)
} else if ((ext === ".json") || (ext === ".jsonc")) {
let finalPath = path.join("./src/content/docs/architecture/voyager/", voyagerDirPath)

console.log({ finalPath })

await Fs.mkdir(path.dirname(finalPath), { recursive: true })

let json = await Fs.readFile(path.join("../voyager", voyagerDirPath), "utf8")

await Fs.writeFile(
finalPath.replace(ext, ".mdx"),
`
---
title: "${path.basename(finalPath)}"
---

\`\`\`${ext.replace(".", "")}
${json}
\`\`\`

`,
)
}
}

return {
name: "copy-external-docs",
hooks: {
"astro:server:setup": (options: {
server: ViteDevServer
}) => {
options.server.watcher
.add("voyager/")

options.server.watcher
.on("add", (path) => console.log(`File ${path} has been added`))
.on("addDir", (path) => console.log(`Dir ${path} has been added`))
.prependListener("change", async (path) => {
console.log(`change: ${path}`)
if (path.startsWith("voyager/")) {
await copyVoyagerFile(path.replace("voyager/", ""))
.catch(e => {
console.log("hmr error:", e)
})
}
})
},
"astro:config:setup": async () => {
console.log("running copy external docs setup hook")

await Fs.rm("./src/content/docs/architecture/voyager/", { recursive: true, force: true })

await Fs.mkdir("./src/content/docs/architecture/voyager/doc/", { recursive: true })

await Fs.writeFile(
"./src/content/docs/architecture/voyager/concepts.md",
"---\ntitle: Concepts\n---\n" + await Fs.readFile("../voyager/CONCEPTS.md", "utf8"),
)

await Fs.cp(
"../voyager/doc/ibc-architecture.svg",
"./src/content/docs/architecture/voyager/doc/ibc-architecture.svg",
)

await Fs.writeFile(
"./src/content/docs/architecture/voyager/overview.md",
"---\ntitle: Overview\n---\n" + await Fs.readFile("../voyager/README.md", "utf8"),
)

await copyVoyagerDir("plugins")
await copyVoyagerDir("modules")
},
},
}
}

// @ts-ignore
export default defineConfig({
site: SITE_URL,
Expand All @@ -45,6 +174,11 @@ export default defineConfig({
{ find: "path", replacement: "rollup-plugin-node-polyfills/polyfills/path" },
],
},
server: {
watch: {
cwd: "../.",
},
},
plugins: [
Icons({
compiler: "svelte",
Expand All @@ -55,6 +189,10 @@ export default defineConfig({
autoInstall: true,
}),
tailwindcss(),
// viteStaticCopy({
// targets: [
// ],
// }),
],
ssr: {
noExternal: ["monaco-editor"],
Expand All @@ -79,6 +217,7 @@ export default defineConfig({
devToolbar: { enabled: ENABLE_DEV_TOOLBAR === "true" },
prefetch: { prefetchAll: true, defaultStrategy: "viewport" },
integrations: [
copyExternalDocs(),
starlight({
title: "Union",
lastUpdated: true,
Expand Down Expand Up @@ -200,6 +339,20 @@ export default defineConfig({
items: [
{ label: "Overview", link: "/architecture/voyager/overview" },
{ label: "Concepts", link: "/architecture/voyager/concepts" },
{
label: "Plugins",
collapsed: true,
autogenerate: {
directory: "/architecture/voyager/plugins",
},
},
{
label: "Modules",
collapsed: true,
autogenerate: {
directory: "/architecture/voyager/modules",
},
},
],
},
],
Expand Down
12 changes: 10 additions & 2 deletions docs/docs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,27 @@ _: {
vips
pkg-config
];
fs = pkgsUnstable.lib.fileset;
in
{
packages = {
docs = mkCi false (buildPnpmPackage {
extraSrcs = [
../docs
extraSrcs = fs.unions [
./.
../ts-sdk
../ts-sdk-evm
../ts-sdk-cosmos
../scripts
../versions
../deployments
../lib/ucs04/well-known.json
(fs.fileFilter (
file:
(builtins.any file.hasExt [
"md"
"svg"
])
) ../voyager)
];
hash = "sha256-HAFB0pu/MhHd4MbIeIzoWV7sDeZfYCp5ZF4rVPzppG4=";
packageJsonPath = ./package.json;
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"patch-package": "^8.0.0",
"postcss": "^8.4.49",
"postcss-import": "^16.1.0",
"smol-toml": "catalog:",
"starlight-links-validator": "^0.17.0",
"tailwind-merge": "^3.3.1",
"tailwind-variants": "^1.0.0",
Expand Down
Loading
Loading