Skip to content

Commit

Permalink
chore: progress
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Jun 4, 2024
1 parent c2cf893 commit 94ad661
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 253 deletions.
7 changes: 3 additions & 4 deletions app/app.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{ ... }: {
_: {
perSystem = { pkgs, unstablePkgs, lib, ensureAtRepositoryRoot, ... }:
let
pkgsDeps = with pkgs; [ pkg-config python3 ];
nodeDeps = with unstablePkgs; [ nodePackages_latest.nodejs ];
combinedDeps = pkgsDeps ++ nodeDeps;
packageJSON = lib.importJSON ./package.json;
in
{
in {
packages = {
app = unstablePkgs.buildNpmPackage {
npmDepsHash = "sha256-Sl8MTLx1DmaeQ9c37Gaybye+A991wVSxBsHp6FJ1ICA=";
npmDepsHash = "sha256-edSMD/1Lq+9yvLVUkhopHHTGDF3PFCQtgWGcyCeM82c=";
src = ./.;
sourceRoot = "app";
npmFlags = [ "--legacy-peer-deps" ];
Expand Down
32 changes: 16 additions & 16 deletions app/package-lock.json

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

8 changes: 4 additions & 4 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@tanstack/svelte-query-persist-client": "^5.40.0",
"@tanstack/svelte-table": "^8.17.3",
"@tanstack/svelte-virtual": "^3.5.0",
"@union/client": "npm:@jsr/union__client@^0.0.1-rc.16",
"@union/client": "npm:@jsr/union__client@^0.0.1-rc.17",
"@wagmi/connectors": "^5.0.7",
"@wagmi/core": "^2.10.5",
"bits-ui": "^0.21.10",
Expand All @@ -37,12 +37,12 @@
"svelte-legos": "^0.2.3",
"svelte-persisted-store": "^0.11.0",
"svelte-sonner": "^0.3.24",
"svelte-ux": "^0.66.3",
"svelte-ux": "^0.66.4",
"sveltekit-superforms": "^2.14.0",
"uint8array-extras": "^1.1.0",
"valibot": "^0.30.0",
"vaul-svelte": "^0.3.1",
"viem": "^2.13.3"
"viem": "^2.13.5"
},
"devDependencies": {
"@0no-co/graphqlsp": "^1.12.5",
Expand All @@ -66,7 +66,7 @@
"@tailwindcss/typography": "^0.5.13",
"@tanstack/svelte-query-devtools": "^5.40.0",
"@total-typescript/ts-reset": "^0.5.1",
"@types/node": "^20.14.0",
"@types/node": "^20.14.1",
"@types/postcss-import": "^14.0.3",
"autoprefixer": "^10.4.19",
"buffer": "^6.0.3",
Expand Down
24 changes: 11 additions & 13 deletions app/src/lib/components/online-status.svelte
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<script lang="ts">
import { onlineStatus } from "$lib/online-status.ts"
import { blockHeightQuery } from "$lib/queries/block.ts"
import { cn, flyAndScale } from "$lib/utilities/shadcn.ts"
import { Button } from "$lib/components/ui/button/index.ts"
import * as Tooltip from "$lib/components/ui/tooltip/index.ts"
import { blockHeightQuery } from '$lib/queries/block.ts'
import { cn, flyAndScale } from '$lib/utilities/shadcn.ts'
import { Button } from '$lib/components/ui/button/index.ts'
import * as Tooltip from '$lib/components/ui/tooltip/index.ts'
/**
* TODO:
* - Split checks into two: app status and block height status
*/
/**
* TODO:
* - Split checks into two: app status and block height status
*/
$: blockHeightStore = blockHeightQuery()
$: blockHeight = $blockHeightStore.data
$: appStatus = Number.isFinite(onlineStatus) ? "online" : "offline"
$: blockHeightStore = blockHeightQuery()
$: blockHeight = $blockHeightStore.data
$: appStatus = Number.isSafeInteger(Number(blockHeight)) ? 'online' : 'offline'
</script>

<Tooltip.Root>
Expand Down
19 changes: 19 additions & 0 deletions app/src/lib/constants/rpc-providers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { readable } from "svelte/store"

export interface CosmosSdkRpcProvider {
rpc: string
rest: string
grpc?: string
}

export const COSMOS_SDK_RPC_PROVIDERS = [
{
rpc: "https://union-testnet-rpc.polkachu.com",
rest: "https://union-testnet-api.polkachu.com"
},
{
rpc: "https://rpc.testnet.bonlulu.uno",
rest: "https://api.testnet.bonlulu.uno"
}
] as const satisfies Array<CosmosSdkRpcProvider>

4 changes: 2 additions & 2 deletions app/src/lib/queries/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ export const blockHeightQuery = () =>
createQuery({
queryKey: ["block-height", "union"],
queryFn: async () => {
const response = await fetch("https://rpc.testnet.bonlulu.uno/block")
// const response = await fetch("https://rpc.testnet.bonlulu.uno/block")
const response = await fetch("https://union-testnet-rpc.polkachu.com/block")
const data = (await response.json()) as {
jsonrpc: string
id: number
result: { block: { header: { height: string } } }
}
console.log(data)
return data.result.block.header.height
},
enabled: true,
Expand Down
18 changes: 16 additions & 2 deletions app/src/lib/wallet/evm/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ export const config = createConfig({
batch: { multicall: true },
transports: {
[sepolia.id]: fallback([
unstable_connector(injected),
unstable_connector(injected, {
key: "unstable_connector-injected",
retryCount: 3,
retryDelay: 100
}),
http(`https://special-summer-film.ethereum-sepolia.quiknode.pro/${KEY.RPC.QUICK_NODE}/`),
http(`https://ethereum-sepolia.core.chainstack.com/${KEY.RPC.CHAINSTACK}`),
http(`https://eth-sepolia.g.alchemy.com/v2/${KEY.RPC.ALCHEMY}`),
http(`https://ethereum-sepolia.core.chainstack.com/${KEY.RPC.CHAINSTACK}`)
])
},

syncConnectedChain: true,
multiInjectedProviderDiscovery: true,
storage: createWagmiStorage({
Expand Down Expand Up @@ -80,6 +85,15 @@ export const config = createConfig({
]
})

config.subscribe(
state => {
return state.chainId
},
chainId => {
console.info("[config] chainId", chainId)
}
)

export function createSepoliaStore(
previousState: ChainWalletStore<"evm"> = {
chain: "sepolia",
Expand Down
11 changes: 6 additions & 5 deletions app/src/lib/wallet/evm/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export const evmConnections = readable(getConnections(config), set =>
watchConnections(config, { onChange: set })
)

export const connectorClient = derived(evmConnectors, async $connectors => {
const connector = $connectors.find(async connector => await connector.isAuthorized())
const client = await getConnectorClient(config, { connector })
return client
})
// export const connectorClient = derived(evmConnectors, async $connectors => {
// const connector = $connectors.find(async connector => await connector?.isAuthorized())
// if (!connector) return undefined
// const client = await getConnectorClient(config, { connector })
// return client
// })

// export const provider = readable<() => Promise<undefined | unknown>>(
// async () =>
Expand Down
Loading

0 comments on commit 94ad661

Please sign in to comment.