Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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 app2/app2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ _: {
text = ''
${ensureAtRepositoryRoot}
cd app2/
pnpm dlx gql.tada generate-schema --tsconfig ./tsconfig.json --output "./src/generated/schema.graphql" "https://orion.james.union.build/v1/graphql"
pnpm dlx gql.tada generate-schema --tsconfig ./tsconfig.json --output "./src/generated/schema.graphql" "https://development.graphql.union.build/v1/graphql"
pnpm dlx gql.tada generate-output --disable-preprocessing --tsconfig ./tsconfig.json --output ./src/generated/graphql-env.d.ts
'';
};
Expand Down
2 changes: 2 additions & 0 deletions app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"@eslint/js": "^9.24.0",
"@keplr-wallet/types": "^0.12.220",
"@leapwallet/types": "^0.0.5",
"@mysten/sui": "^1.38.0",
"@mysten/wallet-standard": "^0.19.3",
"@number-flow/svelte": "^0.3.7",
"@safe-global/safe-apps-sdk": "^9.1.0",
"@safe-global/safe-gateway-typescript-sdk": "^3.23.1",
Expand Down
15 changes: 10 additions & 5 deletions app2/src/generated/graphql-env.d.ts

Large diffs are not rendered by default.

123 changes: 123 additions & 0 deletions app2/src/generated/schema.graphql

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

5 changes: 5 additions & 0 deletions app2/src/lib/components/ui/ConnectWalletButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ import Button from "./Button.svelte"
title="Cosmos"
>
</div>
<div
class="{Option.isSome(wallets.suiAddress) ? 'pulse-3 bg-green-500 shadow-[0_0_2px_1px_rgba(34,197,94,0.6)]' : 'bg-zinc-800'} w-2 h-2 rounded-full transition-colors duration-200"
title="Sui"
>
</div>
</div>
</Button>

Expand Down
2 changes: 2 additions & 0 deletions app2/src/lib/components/ui/Wallet/connect/connection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import SharpPowerIcon from "$lib/components/icons/SharpPowerIcon.svelte"
import { type CosmosWalletId } from "$lib/wallet/cosmos"
import { type EvmWalletId } from "$lib/wallet/evm"
import { type SuiWalletId } from "$lib/wallet/sui"
import { RpcType } from "@unionlabs/sdk/schema"
import type { State } from "@wagmi/core"
import { Schema } from "effect"
Expand All @@ -27,6 +28,7 @@ interface Props {
connectedWalletId?:
| (T extends "cosmos" ? CosmosWalletId
: T extends "evm" ? EvmWalletId
: T extends "sui" ? SuiWalletId
: never)
| undefined
| null
Expand Down
2 changes: 2 additions & 0 deletions app2/src/lib/components/ui/Wallet/connect/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { CosmosWalletId } from "$lib/wallet/cosmos"
import type { EvmWalletId } from "$lib/wallet/evm"
import type { SuiWalletId } from "$lib/wallet/sui"
import type { RpcType } from "@unionlabs/sdk/schema"
import type { State } from "@wagmi/core"
import type { Schema } from "effect"
Expand All @@ -21,6 +22,7 @@ type Props<TChain extends Chain = Chain> = {
connectedWalletId?:
| (TChain extends "cosmos" ? CosmosWalletId
: TChain extends "evm" ? EvmWalletId
: TChain extends "sui" ? SuiWalletId
: never)
| undefined
onConnectClick: (walletIdentifier: string) => void | Promise<void>
Expand Down
55 changes: 51 additions & 4 deletions app2/src/lib/components/ui/Wallet/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ import { dashboard } from "$lib/dashboard/stores/user.svelte"
import { uiStore } from "$lib/stores/ui.svelte"
import { cosmosStore, cosmosWalletsInformation } from "$lib/wallet/cosmos/index.js"
import { evmWalletsInformation, sepoliaStore } from "$lib/wallet/evm/index.js"
import { suiStore, suiWalletsInformation } from "$lib/wallet/sui"
import { Option } from "effect"
import Modal from "../Modal.svelte"

let currentWalletType = $state("all")

let evmConnected = $state(false)
let cosmosConnected = $state(false)
let suiConnected = $state(false)

$effect(() => {
evmConnected = sepoliaStore.connectionStatus === "connected"
cosmosConnected = cosmosStore.connectionStatus === "connected"
suiConnected = suiStore.connectionStatus === "connected"
})
</script>

Expand Down Expand Up @@ -43,10 +46,12 @@ $effect(() => {
style:left={currentWalletType === "all"
? "0"
: currentWalletType === "evm"
? "33.333%"
: "66.666%"}
style:width="33.333%"
style:height="100%"
? "25%"
: currentWalletType === "cosmos"
? "50%"
: "75%"}
style:width="25%"
style:height="75%"
>
</div>
<button
Expand Down Expand Up @@ -102,6 +107,27 @@ $effect(() => {
</span>
</div>
</button>
<button
onclick={() => currentWalletType = "sui"}
class="
flex-1 px-4 py-2 text-sm font-medium rounded-md transition-colors relative cursor-pointer
{currentWalletType === 'sui'
? 'text-zinc-900 dark:text-white'
: 'text-zinc-500 hover:text-zinc-900 dark:hover:text-white'}
"
>
<div class="flex items-center justify-center gap-2">
<span>Sui</span>
<span
class="
w-1.5 h-1.5 rounded-full transition-all duration-300 ring-1 ring-opacity-20 {suiConnected
? 'bg-green-500 animate-pulse ring-green-500 shadow-[0_0_6px_0px_rgba(34,197,94,0.6)]'
: 'bg-white/10 dark:bg-white/5 backdrop-blur-sm ring-white/20'}
"
>
</span>
</div>
</button>
</nav>
</section>

Expand All @@ -128,6 +154,17 @@ $effect(() => {
onDisconnectClick={cosmosStore.disconnect}
showDivider={false}
/>
{:else if currentWalletType === "sui"}
<Connection
chain="sui"
address={suiStore.address}
chainWalletsInformation={suiWalletsInformation}
connectStatus={suiStore.connectionStatus}
connectedWalletId={suiStore.connectedWallet}
onConnectClick={(id: string) => suiStore.connect(id as any)}
onDisconnectClick={suiStore.disconnect}
showDivider={false}
/>
{:else if currentWalletType === "all"}
<Connection
chain="evm"
Expand All @@ -149,6 +186,16 @@ $effect(() => {
onDisconnectClick={cosmosStore.disconnect}
showDivider={true}
/>
<Connection
chain="sui"
address={suiStore.address}
chainWalletsInformation={suiWalletsInformation}
connectStatus={suiStore.connectionStatus}
connectedWalletId={suiStore.connectedWallet}
onConnectClick={(id: string) => suiStore.connect(id as any)}
onDisconnectClick={suiStore.disconnect}
showDivider={false}
/>
{/if}
</section>
</Modal>
29 changes: 29 additions & 0 deletions app2/src/lib/gasprice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,35 @@ export class GasPriceMap extends LayerMap.Service<GasPriceMap>()("GasPriceByChai
}),
),
),
Match.when(
{ rpc_type: "sui" },
(chain) =>
Layer.effect(
GasPrice.GasPrice,
Effect.gen(function*() {
// ── MOCKED SUI GAS PRICE ─────────────────────────────────────────────
// TODO: Change it later.
const of = Effect.gen(function*() {
const atomic = BigDecimal.unsafeFromNumber(1_000)
const value = GasPrice.AtomicGasPrice(atomic)

yield* Effect.logDebug(
`${chain.display_name} gas price (mock MIST): ${JSON.stringify(atomic)}`,
)

return {
value,
minimalDenom: "MIST",
denom: "SUI",
additiveFee: O.none(),
decimals: 9,
}
}).pipe(Effect.tapError((cause) => Effect.logError("GasPrice.of (sui)", cause)))

return GasPrice.GasPrice.of({ of })
}),
),
),
Match.orElseAbsurd,
),
idleTimeToLive: "30 seconds",
Expand Down
Loading
Loading