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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ ts-sdk-evm/docs
ts-sdk-cosmos/build
ts-sdk-cosmos/dist
ts-sdk-cosmos/docs
sentinel2/build
docs/src/content/docs/reference/@unionlabs/sdk
docs/src/content/docs/reference/@unionlabs/sdk-evm
docs/src/content/docs/reference/@unionlabs/sdk-cosmos
Expand Down
8 changes: 4 additions & 4 deletions .helix/languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ command = "biome"
args = ["--stdio"]
command = "emmet-language-server"

[language-server.vscode-solidity-server]
args = ["--stdio"]
command = "./evm/node_modules/vscode-solidity-server/dist/cli/server.js"
[language-server.solc]
args = ["--lsp"]
command = "solc"

[language-server.tailwindcss-ls]
args = ["--stdio"]
Expand All @@ -37,7 +37,7 @@ command = "vscode-html-language-server"

[[language]]
auto-format = true
language-servers = [{ name = "vscode-solidity-server" }]
language-servers = [{ name = "solc" }]
name = "solidity"

[[language]]
Expand Down
2 changes: 1 addition & 1 deletion app2/app2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ _: {
../ts-sdk-evm
../ts-sdk-cosmos
];
hash = "sha256-Wc+E99V1tj+tG7VVha9CBB1YVb+H83GgUJpxhvq1gzU=";
hash = "sha256-uRmTzZE9pbyW4AIkrViGPzUvLPYARBaDEb35A3TRe/k=";
buildInputs = deps;
nativeBuildInputs = buildInputs;
pnpmWorkspaces = [
Expand Down
23 changes: 17 additions & 6 deletions app2/src/lib/graphql/error.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import { Schema as S } from "effect"
import type { ClientError } from "graphql-request"
import { Match, pipe, Schema as S } from "effect"
import { ClientError } from "graphql-request"

export class GraphQLError extends S.TaggedError<GraphQLError>("GraphQLError")("GraphQLError", {
message: S.String,
status: S.Number,
errors: S.optional(S.Any),
cause: S.Any,
}) {
constructor(error: ClientError) {
const query = error.request.query
const variables = error.request.variables
super({
static fromUnknown(error: unknown) {
return pipe(
Match.value(error),
Match.when(Match.instanceOf(ClientError), this.fromClientError),
Match.orElse((error) =>
this.make({
cause: error,
message: String(error) ?? "Unknown error",
status: -1,
})
),
)
}
static fromClientError(error: ClientError) {
return this.make({
message: error.message,
status: error.response.status,
errors: error.response.errors,
Expand Down
3 changes: 1 addition & 2 deletions app2/src/lib/graphql/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class GraphQL extends Effect.Service<GraphQL>()("app/GraphQL", {
variables,
signal,
}),
catch: (error) => GraphQLError.make(error as ClientError),
catch: (error) => GraphQLError.fromUnknown(error),
}).pipe(
Effect.withLogSpan("fetch"),
)
Expand Down Expand Up @@ -260,7 +260,6 @@ export class GraphQL extends Effect.Service<GraphQL>()("app/GraphQL", {
}),
} as const
}),
accessors: true,
dependencies: [
GraphQLCache.Default,
Persistence.layerResultKeyValueStore.pipe(
Expand Down
4 changes: 2 additions & 2 deletions app2/src/lib/layers/live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SupabaseClient } from "$lib/dashboard/client"
import { GasPriceMap } from "$lib/gasprice"
import { GraphQL } from "$lib/graphql/service"
import * as Datadog from "$lib/logging/datadog"
import { PriceOracleExecutor } from "@unionlabs/sdk/PriceOracle"
import { PriceOracle } from "@unionlabs/sdk"
import { Layer, Logger, LogLevel, Match } from "effect"

const minimumLogLevel = Logger.minimumLogLevel(
Expand All @@ -18,7 +18,7 @@ const minimumLogLevel = Logger.minimumLogLevel(
export default Layer.mergeAll(
GraphQL.Default,
GasPriceMap.Default,
PriceOracleExecutor.Default,
PriceOracle.layerExecutor,
SupabaseClient.Default({ auth: { autoRefreshToken: true } }),
Logger.replace(
Logger.defaultLogger,
Expand Down
4 changes: 2 additions & 2 deletions app2/src/lib/layers/test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SupabaseClient } from "$lib/dashboard/client"
import { GasPriceMap } from "$lib/gasprice"
import { GraphQL } from "$lib/graphql/service"
import { PriceOracleExecutor } from "@unionlabs/sdk/PriceOracle"
import { PriceOracle } from "@unionlabs/sdk"
import { Layer } from "effect"

export default Layer.mergeAll(
GraphQL.Test,
PriceOracleExecutor.Test,
PriceOracle.layerTest,
SupabaseClient.Default(), // TODO: replace with mock
GasPriceMap.Default, // TODO: replace with mock
)
14 changes: 10 additions & 4 deletions app2/src/lib/stores/ui.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GraphQL } from "$lib/graphql/service"
import * as AppRuntime from "$lib/runtime"
import { themes } from "$lib/themes"
import type { Edition, Theme } from "$lib/themes"
import { Match, Option, pipe, Record as R, String as Str } from "effect"
import { Effect, Match, Option, pipe, Record as R, String as Str } from "effect"

const projectIds: Record<Edition, string> = {
app: "f544d5ee6eb61962408fd456c114e9ed",
Expand Down Expand Up @@ -79,15 +79,21 @@ class UiStore {
}

get graphqlEndpoint(): string {
return AppRuntime.runSync(GraphQL.getEndpoint)
return AppRuntime.runSync(GraphQL.pipe(
Effect.andThen((client) => client.getEndpoint),
))
}

set graphqlEndpoint(s: string) {
AppRuntime.runPromise(GraphQL.updateEndpoint(s))
AppRuntime.runPromise(GraphQL.pipe(
Effect.andThen((client) => client.updateEndpoint(s)),
))
}

clearGqlCache() {
AppRuntime.runSync(GraphQL.resetCache)
AppRuntime.runSync(GraphQL.pipe(
Effect.andThen((client) => client.resetCache),
))
}

openWalletModal() {
Expand Down
5 changes: 3 additions & 2 deletions app2/src/routes/explorer/orbital/charts/TerminalLog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@ $effect(() => {
const newTransfers = transfers.slice(processedCount)

newTransfers.forEach((transfer) => {
const sourceChain = transfer.sourceDisplayName || transfer.source_chain?.display_name
const sourceChain = transfer.sourceDisplayName || transfer.source_chain.universal_chain_id
|| "unknown"
const destChain = transfer.destinationDisplayName || transfer.destination_chain?.display_name
const destChain = transfer.destinationDisplayName
|| transfer.destination_chain.universal_chain_id
|| "unknown"

addLog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const suggestTokenToWallet = async (chain_id: string, denom: TokenRawDenom) => {
class="text-zinc-400"
/>
{:else}
<div>{transfer.source_chain.chain_id}</div>
<div>{transfer.source_chain.universal_chain_id}</div>
<div class="font-mono text-sm text-zinc-400">
{transfer.sender_canonical}
</div>
Expand Down Expand Up @@ -279,7 +279,7 @@ const suggestTokenToWallet = async (chain_id: string, denom: TokenRawDenom) => {
class="text-zinc-400"
/>
{:else}
<div>{transfer.destination_chain.chain_id}</div>
<div>{transfer.destination_chain.universal_chain_id}</div>
<div class="font-mono text-sm text-zinc-400">
{transfer.receiver_canonical}
</div>
Expand Down
36 changes: 21 additions & 15 deletions ceremony/ceremony.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,34 @@ _: {
python3
nodePackages_latest.nodejs
];
packageJSON = lib.importJSON ./package.json;
buildPnpmPackage = import ../tools/typescript/buildPnpmPackage.nix {
inherit lib pkgs;
};
in
{
packages = {
ceremony = pkgsUnstable.buildNpmPackage {
npmDepsHash = "sha256-2s556is4PJaGmxQhIUPZLINh6J6ngeTf32bwDtl+v6Q=";
src = ./.;
sourceRoot = "ceremony";
npmFlags = [ "--legacy-peer-deps" ];
pname = packageJSON.name;
inherit (packageJSON) version;
ceremony = buildPnpmPackage {
hash = "sha256-XNqBv47ijQ3geyjOedIdYWmGGE/1lmCd9YnOAypJzMg=";
packageJsonPath = ./package.json;
extraSrcs = [
../ceremony
];
nativeBuildInputs = deps;
buildInputs = deps;
buildPhase = ''
runHook preBuild
export NODE_OPTIONS="--no-warnings";
export VITE_BUCKET_ID="contributions";
export VITE_SUPABASE_URL="https://otfaamdxmgnkjqsosxye.supabase.co/";
export VITE_SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im90ZmFhbWR4bWdua2pxc29zeHllIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjEzMjA5NDMsImV4cCI6MjAzNjg5Njk0M30.q91NJPFFHKJXnbhbpUYwsB0NmimtD7pGPx6PkbB_A3w";
pnpm --filter=union-cermony build
runHook postBuild
'';
installPhase = ''
mkdir -p $out
cp -r ./build/* $out
cp -r ./ceremony/build/* $out
'';
doDist = false;
NODE_OPTIONS = "--no-warnings";
VITE_BUCKET_ID = "contributions";
VITE_SUPABASE_URL = "https://otfaamdxmgnkjqsosxye.supabase.co/";
VITE_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im90ZmFhbWR4bWdua2pxc29zeHllIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjEzMjA5NDMsImV4cCI6MjAzNjg5Njk0M30.q91NJPFFHKJXnbhbpUYwsB0NmimtD7pGPx6PkbB_A3w";
};
};

Expand All @@ -53,8 +59,8 @@ _: {
export VITE_SUPABASE_URL="https://otfaamdxmgnkjqsosxye.supabase.co/"
export VITE_SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im90ZmFhbWR4bWdua2pxc29zeHllIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjEzMjA5NDMsImV4cCI6MjAzNjg5Njk0M30.q91NJPFFHKJXnbhbpUYwsB0NmimtD7pGPx6PkbB_A3w"

npm install
npm run dev -- --host
pnpm install
pnpm run dev -- --host
'';
};
};
Expand Down
Loading