From ac9afe61320b4752d4eb20eabb57545fc43a360c Mon Sep 17 00:00:00 2001 From: cor Date: Thu, 23 Jan 2025 20:44:43 +0000 Subject: [PATCH 01/13] feat(app): fetch channel for transfer --- app/app.nix | 2 +- app/package-lock.json | 198 +++++++++++++++--- app/package.json | 2 +- .../components/Cube/faces/Intent.svelte | 10 + .../TransferFrom/transfer/intents.ts | 22 +- 5 files changed, 205 insertions(+), 29 deletions(-) diff --git a/app/app.nix b/app/app.nix index 0938d7d6f6..20d6377de0 100644 --- a/app/app.nix +++ b/app/app.nix @@ -19,7 +19,7 @@ _: { { packages = { app = jsPkgs.buildNpmPackage { - npmDepsHash = "sha256-0/ZhKkptxBVBWbOmN6izS/8hROPs27rk0nDK+5xtukw="; + npmDepsHash = "sha256-wv7rDDriwl2HnSk29N5xVIpM3i7YeJMsyNS/pptTfcA="; src = ./.; sourceRoot = "app"; npmFlags = [ diff --git a/app/package-lock.json b/app/package-lock.json index 35c2e5e2e6..7a829c0492 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -19,7 +19,7 @@ "@tanstack/svelte-query": "5.61.5", "@tanstack/svelte-table": "^8.20.5", "@tanstack/svelte-virtual": "3.10.9", - "@unionlabs/client": "0.0.45", + "@unionlabs/client": "0.0.51", "@wagmi/connectors": "5.5.2", "@wagmi/core": "2.15.1", "bits-ui": "^0.21.13", @@ -2613,9 +2613,9 @@ } }, "node_modules/@scure/base": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.1.tgz", - "integrity": "sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.4.tgz", + "integrity": "sha512-5Yy9czTO47mqz+/J8GM6GIId4umdCk1wc1q8rKERQulIoc8VP9pzDcghv10Tl2E7R96ZUx/PhND3ESYUQX8NuQ==", "license": "MIT", "funding": { "url": "https://paulmillr.com/funding/" @@ -3264,26 +3264,177 @@ "license": "MIT" }, "node_modules/@unionlabs/client": { - "version": "0.0.45", - "resolved": "https://registry.npmjs.org/@unionlabs/client/-/client-0.0.45.tgz", - "integrity": "sha512-STdG88uQRU2uQ2EBe6lGiEn9qkUFRdcJEZG64/H9elJHJUAXAZnoxOIaFs/OlIW7R7afNluOoJRe8JwpXOzLbw==", + "version": "0.0.51", + "resolved": "https://registry.npmjs.org/@unionlabs/client/-/client-0.0.51.tgz", + "integrity": "sha512-CRzfnvjE71EwPdbzpGMEudojPxJMKQN9f2Pyxebw9T16C3E6faFiL9HUF11nWASzchQ8FoxAiWWhFF2GQiiCTQ==", "hasInstallScript": true, "license": "MIT", "dependencies": { "@aptos-labs/ts-sdk": "^1.33.1", - "@cosmjs/amino": "^0.32.4", - "@cosmjs/cosmwasm-stargate": "0.32.4", - "@cosmjs/proto-signing": "^0.32.4", - "@cosmjs/stargate": "0.32.4", - "@cosmjs/tendermint-rpc": "^0.32.4", - "@scure/base": "^1.2.1", + "@cosmjs/amino": "^0.33.0", + "@cosmjs/cosmwasm-stargate": "0.33.0", + "@cosmjs/proto-signing": "^0.33.0", + "@cosmjs/stargate": "0.33.0", + "@cosmjs/tendermint-rpc": "^0.33.0", + "@scure/base": "^1.2.4", + "gql.tada": "^1.8.10", + "graphql-request": "^7.1.2", "neverthrow": "^8.1.1", "ofetch": "^1.4.1", - "ox": "^0.6.0", "patch-package": "^8.0.0", - "viem": "^2.22.3" + "viem": "^2.22.10" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/amino": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.33.0.tgz", + "integrity": "sha512-a4qnWGzuM2IrlkDTFQmU7bDd+wNIzyvfcRIZ43i00ZHvTEtrCcWopT94rIv/Zy6fdgkhQ3HWrsGVlIPDT/ibRw==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/crypto": "^0.33.0", + "@cosmjs/encoding": "^0.33.0", + "@cosmjs/math": "^0.33.0", + "@cosmjs/utils": "^0.33.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/cosmwasm-stargate": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.33.0.tgz", + "integrity": "sha512-YJahXTLrfZ0evtSFcy5Aa4oorEAAHwe0ss6JVteiiNNDT7jHliONz5WOlg2/N7KLxoWCkVWcOpWJR4xZ/N3YEQ==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/amino": "^0.33.0", + "@cosmjs/crypto": "^0.33.0", + "@cosmjs/encoding": "^0.33.0", + "@cosmjs/math": "^0.33.0", + "@cosmjs/proto-signing": "^0.33.0", + "@cosmjs/stargate": "^0.33.0", + "@cosmjs/tendermint-rpc": "^0.33.0", + "@cosmjs/utils": "^0.33.0", + "cosmjs-types": "^0.9.0", + "pako": "^2.0.2" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/crypto": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.33.0.tgz", + "integrity": "sha512-kkt06t+cFW2XRGDGUZ0cVf5yoQ2OhZnubwbYbz3QXdyhf1qOXYVPRThfFPsko7dssr+e8Yy4OJKlh5SLA8DXTQ==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/encoding": "^0.33.0", + "@cosmjs/math": "^0.33.0", + "@cosmjs/utils": "^0.33.0", + "@noble/hashes": "^1", + "bn.js": "^5.2.0", + "elliptic": "^6.5.4", + "libsodium-wrappers-sumo": "^0.7.11" } }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/encoding": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.33.0.tgz", + "integrity": "sha512-9z0g9mM7w5BISVVs8BK1Yp7KSQgNLGz2SBoWYOm4wODB/YcoitODgyRqECcuMZBXtd2sCyy2M1VLs9Z69BPZRQ==", + "license": "Apache-2.0", + "dependencies": { + "base64-js": "^1.3.0", + "bech32": "^1.1.4", + "readonly-date": "^1.0.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/json-rpc": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.33.0.tgz", + "integrity": "sha512-okXjxnT3zhhuYrA1aIDVD8VHt3syWyrJw3cAY6tMNM53bQcAtLGImueMrEoyv7DtLg5R5Tx5PMrQ7UYnpD8OwQ==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/stream": "^0.33.0", + "xstream": "^11.14.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/math": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.33.0.tgz", + "integrity": "sha512-B2uOgM12iuIhJWzGuAxGwO6zO+cI8Q4z7mVu7HgFrGJJTM1HtPTYgb55oMOuUN0OZ352MEEm5uAt8sA9jZQqbA==", + "license": "Apache-2.0", + "dependencies": { + "bn.js": "^5.2.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/proto-signing": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.33.0.tgz", + "integrity": "sha512-UHA92d/Siy3wnce/xhU4iagKrs6r8Ruacc0qeHj3mNrtuUH8f70cD7lzzClzI7wvRLcPprOY0YTeEzqGbPeBFw==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/amino": "^0.33.0", + "@cosmjs/crypto": "^0.33.0", + "@cosmjs/encoding": "^0.33.0", + "@cosmjs/math": "^0.33.0", + "@cosmjs/utils": "^0.33.0", + "cosmjs-types": "^0.9.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/socket": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.33.0.tgz", + "integrity": "sha512-a1eHsqVFmG6N5LR53tAB1Xo4XfsZaFlrYA34yC0GnX5m/cJVEe1wkZxMsWJIW2nfCgj7nAvFK6Gx4qj+ZLeqdw==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/stream": "^0.33.0", + "isomorphic-ws": "^4.0.1", + "ws": "^7", + "xstream": "^11.14.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/stargate": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.33.0.tgz", + "integrity": "sha512-Ti/2RRl+LKTNUrOqj6TpGnTRcbmQ5zD4Ujx/PDNPHEexyuwbz+tMcF8Y1kKPWQ1g4wWxLYO4tKY4Gm0J3c5hWA==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/amino": "^0.33.0", + "@cosmjs/encoding": "^0.33.0", + "@cosmjs/math": "^0.33.0", + "@cosmjs/proto-signing": "^0.33.0", + "@cosmjs/stream": "^0.33.0", + "@cosmjs/tendermint-rpc": "^0.33.0", + "@cosmjs/utils": "^0.33.0", + "cosmjs-types": "^0.9.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/stream": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.33.0.tgz", + "integrity": "sha512-SmsZW9Xzfk2T2MtWzVkit2WUclL7ZQHhiEhJz39EzKQRAdi4xY8nwefZF4VLQVJ0M33QfRCUzFzb+O/gddMQKA==", + "license": "Apache-2.0", + "dependencies": { + "xstream": "^11.14.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/tendermint-rpc": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.33.0.tgz", + "integrity": "sha512-A5h72fYesFKSjMjB+AMD5thcVVcdfbmWj4atJ1CYmKGyCTCPW8iEIz1ZKR0mUX+gkW6dM1h8flaRj/R14Oc0/A==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/crypto": "^0.33.0", + "@cosmjs/encoding": "^0.33.0", + "@cosmjs/json-rpc": "^0.33.0", + "@cosmjs/math": "^0.33.0", + "@cosmjs/socket": "^0.33.0", + "@cosmjs/stream": "^0.33.0", + "@cosmjs/utils": "^0.33.0", + "axios": "^1.6.0", + "readonly-date": "^1.0.0", + "xstream": "^11.14.0" + } + }, + "node_modules/@unionlabs/client/node_modules/@cosmjs/utils": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.33.0.tgz", + "integrity": "sha512-Y6glwHNlNjcOgwPg8YmNr1PSrNm307EhJVytFt8HmA/G7MRcIA+jIzCL0VlOrWGU4TrAOXvshM+oJZbTIldFRA==", + "license": "Apache-2.0" + }, "node_modules/@unionlabs/client/node_modules/abitype": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.7.tgz", @@ -3306,9 +3457,9 @@ } }, "node_modules/@unionlabs/client/node_modules/ox": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/ox/-/ox-0.6.0.tgz", - "integrity": "sha512-blUzTLidvUlshv0O02CnLFqBLidNzPoAZdIth894avUAotTuWziznv6IENv5idRuOSSP3dH8WzcYw84zVdu0Aw==", + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.6.5.tgz", + "integrity": "sha512-vmnH8KvMDwFZDbNY1mq2CBRBWIgSliZB/dFV0xKp+DfF/dJkTENt6nmA+DzHSSAgL/GO2ydjkXWvlndJgSY4KQ==", "funding": [ { "type": "github", @@ -3335,9 +3486,9 @@ } }, "node_modules/@unionlabs/client/node_modules/viem": { - "version": "2.22.4", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.22.4.tgz", - "integrity": "sha512-35/T2ySpUM0kUVEy2SkaWIAIabSRzF/IZxDdnLxuaI1pwURC92ZiHa9J9nL1rWGl0HTyAqUxcycgJEpOvHrcQA==", + "version": "2.22.12", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.22.12.tgz", + "integrity": "sha512-n3Oc3RO6SaFMOaF8/0YzZK5KtL3OJ9mPiJQgJIOI5Ab5FscdsFixjJdaYD2Tp3Sp/VMHYG9aRyqJ1KZaO7nu+A==", "funding": [ { "type": "github", @@ -3352,8 +3503,7 @@ "@scure/bip39": "1.5.0", "abitype": "1.0.7", "isows": "1.0.6", - "ox": "0.6.0", - "webauthn-p256": "0.0.10", + "ox": "0.6.5", "ws": "8.18.0" }, "peerDependencies": { @@ -3365,7 +3515,7 @@ } } }, - "node_modules/@unionlabs/client/node_modules/ws": { + "node_modules/@unionlabs/client/node_modules/viem/node_modules/ws": { "version": "8.18.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", diff --git a/app/package.json b/app/package.json index 278791a47d..4177b8cf66 100644 --- a/app/package.json +++ b/app/package.json @@ -28,7 +28,7 @@ "@tanstack/svelte-query": "5.61.5", "@tanstack/svelte-table": "^8.20.5", "@tanstack/svelte-virtual": "3.10.9", - "@unionlabs/client": "0.0.45", + "@unionlabs/client": "0.0.51", "@wagmi/connectors": "5.5.2", "@wagmi/core": "2.15.1", "bits-ui": "^0.21.13", diff --git a/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte b/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte index 9a53632991..01ededc3a1 100644 --- a/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte +++ b/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte @@ -8,6 +8,7 @@ import type { IntentsStore } from "$lib/components/TransferFrom/transfer/intents import type { CubeFaces } from "$lib/components/TransferFrom/components/Cube/types.ts" import type { RawIntentsStore } from "$lib/components/TransferFrom/transfer/raw-intents.ts" import { Input } from "$lib/components/ui/input" +import LoadingDots from "$lib/components/loading-dots.svelte" interface Props { stores: { @@ -79,6 +80,15 @@ let { rawIntents, intents, validation } = stores {#if $validation.errors.receiver} {$validation.errors.receiver} {/if} + {#await $intents.channel} + + {:then chan} +
+          {JSON.stringify(chan, null, 2)}
+        
+ + + {/await} {/await} - - diff --git a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte index aba6a20376..9b90467505 100644 --- a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte +++ b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte @@ -50,370 +50,7 @@ let transferState: Writable = writable({ kind: "PRE_TRANSFER" }) let confirmed = false -const transfer = async () => { - confirmed = true - if (!$validation.isValid) return - - let parsedAmount = parseUnits( - $validation.transfer.amount, - $validation.transfer.asset.metadata.decimals - ) - - /** --- APTOS START --- */ - if ($validation.transfer.sourceChain.rpc_type === "aptos") { - const { connectedWallet, connectionStatus } = get(aptosStore) - if ($userAddressAptos === null) return toast.error("No aptos user address found") - - if (connectionStatus !== "connected" || !connectedWallet) { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: new Error("No wallet connected") - }) - return - } - - const wallet = getAptosWallet(connectedWallet) - if (!wallet) { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: new Error(`${connectedWallet} wallet not found`) - }) - return - } - - // @ts-ignore - transferState.set({ kind: "SWITCHING_TO_CHAIN" }) - - const rpcUrl = $validation.transfer.sourceChain?.rpcs.find(rpc => rpc.type === "rpc")?.url - if (!rpcUrl) - return toast.error(`no rpc available for ${$validation.transfer.sourceChain?.display_name}`) - - if (stepBefore($transferState, "CONFIRMING_TRANSFER")) { - const chainInfo = await wallet.getNetwork() - - if (chainInfo?.chainId.toString() !== $validation.transfer.sourceChain.chain_id) { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: new Error("Failed to switch chain") - }) - return - } - - // @ts-ignore - transferState.set({ kind: "CONFIRMING_TRANSFER" }) - } - - if (stepBefore($transferState, "TRANSFERRING")) { - try { - const client = createUnionClient({ - chainId: "2", - account: await wallet?.getAccount(), - transport: wallet as AptosBrowserWallet - }) - - const transferPayload = { - simulate: true, - receiver: $validation.transfer.receiver, - amount: parsedAmount, - authAccess: "wallet", - denomAddress: $validation.transfer.asset?.balance, - destinationChainId: $validation.transfer.destinationChain.chain_id as ChainId - } satisfies TransferAssetsParameters<"2"> - - const transfer = await client.transferAsset(transferPayload) - - if (transfer.isErr()) throw transfer.error - transferState.set({ kind: "TRANSFERRING", transferHash: transfer.value }) - } catch (error) { - if (error instanceof Error) { - // @ts-ignore - transferState.set({ kind: "CONFIRMING_TRANSFER", error }) - } - return - } - } - - /** --- APTOS END --- */ - /** --- COSOS START --- */ - } else if ($validation.transfer.sourceChain.rpc_type === "cosmos") { - const { connectedWallet, connectionStatus } = get(cosmosStore) - if ($userAddrCosmos === null) return toast.error("No Cosmos user address found") - - if (connectionStatus !== "connected" || !connectedWallet) { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: new Error("No wallet connected") - }) - return - } - - const wallet = window[connectedWallet] - - if (!wallet) { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: new Error(`${connectedWallet} wallet not found`) - }) - return - } - - // @ts-ignore - transferState.set({ kind: "SWITCHING_TO_CHAIN" }) - - const rpcUrl = $validation.transfer.sourceChain.rpcs.find(rpc => rpc.type === "rpc")?.url - if (!rpcUrl) - return toast.error(`no rpc available for ${$validation.transfer.sourceChain.display_name}`) - - if (stepBefore($transferState, "CONFIRMING_TRANSFER")) { - const chainInfo = getCosmosChainInfo( - $validation.transfer.sourceChain.chain_id, - connectedWallet - ) - - if (chainInfo === null) { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: new Error("Failed to switch chain") - }) - return - } - - try { - await wallet.experimentalSuggestChain(chainInfo) - await wallet.enable([$validation.transfer.sourceChain.chain_id]) - } catch (error) { - if (error instanceof Error) { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: error - }) - } else { - transferState.set({ - kind: "SWITCHING_TO_CHAIN", - warning: new Error("invalid error") - }) - } - return - } - // @ts-ignore - transferState.set({ kind: "CONFIRMING_TRANSFER" }) - } - - if (stepBefore($transferState, "TRANSFERRING")) { - try { - const cosmosOfflineSigner = await getCosmosOfflineSigner({ - connectedWallet, - chainId: $validation.transfer.sourceChain.chain_id - }) - const unionClient = createUnionClient({ - account: cosmosOfflineSigner, - transport: http(`${rpcUrl}`), - chainId: $validation.transfer.sourceChain.chain_id as CosmosChainId, - gasPrice: { amount: "0.0025", denom: $validation.transfer.asset.metadata.denom } - }) - - const transfer = await unionClient.transferAsset({ - autoApprove: true, - receiver: $validation.transfer.receiver, - amount: parsedAmount, - denomAddress: $validation.transfer.asset.metadata.denom, - account: cosmosOfflineSigner, - // TODO: verify chain id is correct - destinationChainId: $validation.transfer.destinationChain.chain_id as ChainId, - gasPrice: { amount: "0.025", denom: $validation.transfer.asset.metadata.denom } - }) - if (transfer.isErr()) throw transfer.error - transferState.set({ kind: "TRANSFERRING", transferHash: transfer.value }) - } catch (error) { - if (error instanceof Error) { - // @ts-ignore - transferState.set({ kind: "CONFIRMING_TRANSFER", error }) - } - return - } - } - } else if ($validation.transfer.sourceChain.rpc_type === "evm") { - const connectorClient = await getConnectorClient(config) - const selectedChain = evmChainFromChainId($validation.transfer.sourceChain.chain_id) - - const unionClient = createUnionClient({ - account: connectorClient.account, - chainId: $validation.transfer.sourceChain.chain_id as EvmChainId, - transport: custom(window.ethereum) as unknown as HttpTransport - }) - - if (!selectedChain) { - toast.error("From chain not found or supported") - return - } - - if ($userAddrEvm === null) return toast.error("No Cosmos user address found") - - if (window.ethereum === undefined) raise("no ethereum browser extension") - - if (stepBefore($transferState, "SWITCHING_TO_CHAIN")) { - transferState.set({ kind: "SWITCHING_TO_CHAIN" }) - } - - if ($transferState.kind === "SWITCHING_TO_CHAIN") { - if ($transferState.warning) { - transferState.set({ kind: "APPROVING_ASSET" }) - transfer() - return - } - // ^ the user is continuing continuing after having seen the warning - - try { - await switchChain(config, { chainId: selectedChain.id }) - } catch (error) { - if (error instanceof Error) { - transferState.set({ kind: "SWITCHING_TO_CHAIN", warning: error }) - } - return - } - transferState.set({ kind: "APPROVING_ASSET" }) - } - - if ($transferState.kind === "APPROVING_ASSET") { - let hash: `0x${string}` | null = null - - try { - console.log({ - amount: parsedAmount, - receiver: $validation.transfer.receiver, - denomAddress: getAddress($validation.transfer.asset.metadata.denom), - // TODO: verify chain id is correct - destinationChainId: $validation.transfer.destinationChain.chain_id as ChainId - }) - - const approve = await unionClient.approveTransaction({ - amount: parsedAmount, - receiver: $validation.transfer.receiver, - denomAddress: getAddress($validation.transfer.asset.metadata.denom), - // TODO: verify chain id is correct - destinationChainId: $validation.transfer.destinationChain.chain_id as ChainId - }) - - if (approve.isErr()) throw approve.error - hash = approve.value - } catch (error) { - if (error instanceof Error) { - transferState.set({ kind: "APPROVING_ASSET", error }) - } - return - } - transferState.set({ kind: "AWAITING_APPROVAL_RECEIPT", hash }) - } - - if ($transferState.kind === "AWAITING_APPROVAL_RECEIPT") { - try { - await waitForTransactionReceipt(config, { hash: $transferState.hash }) - } catch (error) { - if (error instanceof Error) { - transferState.set({ - kind: "AWAITING_APPROVAL_RECEIPT", - hash: $transferState.hash, - error - }) - } - return - } - transferState.set({ kind: "SIMULATING_TRANSFER" }) - } - - if ($transferState.kind === "SIMULATING_TRANSFER") { - console.log("simulating transfer step") - - if ($transferState.warning) { - transferState.set({ kind: "CONFIRMING_TRANSFER", contractRequest: null }) - transfer() - return - } - - // ^ the user is continuing continuing after having seen the warning - - console.log("confirming transfers test") - - try { - transferState.set({ kind: "CONFIRMING_TRANSFER", contractRequest: null }) - } catch (error) { - if (error instanceof Error) { - transferState.set({ kind: "SIMULATING_TRANSFER", warning: error }) - } - return - } - } - - if ($transferState.kind === "CONFIRMING_TRANSFER") { - try { - const transfer = await unionClient.transferAsset({ - autoApprove: false, - amount: parsedAmount, - receiver: $validation.transfer.receiver, - denomAddress: getAddress($validation.transfer.asset.metadata.denom), - destinationChainId: $validation.transfer.destinationChain.chain_id as ChainId - }) - if (transfer.isErr()) throw transfer.error - transferState.set({ kind: "AWAITING_TRANSFER_RECEIPT", transferHash: transfer.value }) - } catch (error) { - if (error instanceof Error) { - transferState.set({ - kind: "CONFIRMING_TRANSFER", - contractRequest: $transferState.contractRequest, - error - }) - } - } - } - - if ($transferState.kind === "AWAITING_TRANSFER_RECEIPT") { - try { - await waitForTransactionReceipt(config, { - hash: $transferState.transferHash - }) - transferState.set({ kind: "TRANSFERRING", transferHash: $transferState.transferHash }) - } catch (error) { - if (error instanceof Error) { - transferState.set({ - kind: "AWAITING_TRANSFER_RECEIPT", - transferHash: $transferState.transferHash, - error - }) - } - } - } - } else { - console.error("invalid rpc type") - } - - if ($transferState.kind === "TRANSFERRING") { - await sleep(REDIRECT_DELAY_MS) - - const transfer = $validation.transfer - if (!transfer) { - console.error("submitted invalid transfer. this should never happen") - console.error("submitted invalid transfer. this should never happen. please contact the devs") - goto(`/explorer/transfers/${$transferState.transferHash}`) - return - } - - submittedTransfers.update(ts => { - ts[$transferState.transferHash] = { - _is_submitted_transfer: true, - source_chain_id: transfer.sourceChain.chain_id, - destination_chain_id: transfer.destinationChain.chain_id, - packet_send_transaction_hash: $transferState.transferHash, - sender: transfer.sender, - transfer_day: toIsoString(new Date(Date.now())).split("T")[0], - receiver: transfer.receiver, - base_token: transfer.asset.metadata.denom, - base_amount: parsedAmount - } - return ts - }) - goto(`/explorer/transfers/${$transferState.transferHash}`) - } -} +const transfer = async () => {} const stateToStatus = ( state: TransferState, @@ -674,3 +311,5 @@ let stepperSteps = derived( {/if} + + diff --git a/app/src/lib/components/TransferFrom/components/Direction.svelte b/app/src/lib/components/TransferFrom/components/Direction.svelte index 4646cb2aa3..949c62c655 100644 --- a/app/src/lib/components/TransferFrom/components/Direction.svelte +++ b/app/src/lib/components/TransferFrom/components/Direction.svelte @@ -20,7 +20,7 @@ export let getSourceChain: Props["getSourceChain"] export let getDestinationChain: Props["getDestinationChain"] -
+
- {/await} + {/if}
diff --git a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte index 9b90467505..7c575e09a8 100644 --- a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte +++ b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte @@ -31,285 +31,32 @@ import type { CubeFaces } from "$lib/components/TransferFrom/components/Cube/typ import Stepper from "$lib/components/stepper.svelte" import type { Step } from "$lib/stepper-types.ts" import Truncate from "$lib/components/truncate.svelte" - -interface Props { - stores: { - context: Readable - validation: Readable - } - rotateTo: (face: CubeFaces) => void +import type { Ucs03Channel } from "$lib/types" + +export let channel: Ucs03Channel +export let transferArgs: { + baseToken: string + baseAmount: bigint + quoteToken: string + quoteAmount: bigint + receiver: string + sourceChannelId: number + ucs03address: string } -export let stores: Props["stores"] -export let rotateTo: Props["rotateTo"] - -let { validation, context } = stores - const REDIRECT_DELAY_MS = 5000 let transferState: Writable = writable({ kind: "PRE_TRANSFER" }) - -let confirmed = false - -const transfer = async () => {} - -const stateToStatus = ( - state: TransferState, - kind: K, - pendingTitle: string, - completedTitle: string, - errorFormatter: (ts: Extract) => unknown, - warningFormatter: (ts: Extract) => unknown, - progressFormatter: (ts: Extract) => unknown -) => - stepBefore(state, kind) - ? { status: "PENDING", title: pendingTitle } - : stepAfter(state, kind) - ? { status: "COMPLETED", title: completedTitle } - : // @ts-ignore - state.warning !== undefined - ? warningFormatter(state as Extract) - : // @ts-ignore - state.error !== undefined - ? errorFormatter(state as Extract) - : progressFormatter(state as Extract) - -let stepperSteps = derived( - [context, transferState, validation], - ([$context, $transferState, $validation]) => { - if (!$validation.isValid) return [] - if ($transferState.kind === "PRE_TRANSFER") return [] // don"t generate steps before transfer is ready - if ($validation.transfer.sourceChain?.rpc_type === "evm") { - // TODO: Refactor this by implementing Ord for transferState - return [ - // Do not uncomment - stateToStatus( - $transferState, - "SWITCHING_TO_CHAIN", - `Switch to ${$validation.transfer.sourceChain.display_name}`, - `Switched to ${$validation.transfer.sourceChain.display_name}`, - ts => ({ - status: "ERROR", - title: `Error switching to ${$validation.transfer.sourceChain.display_name}`, - description: `There was an issue switching to ${$validation.transfer.sourceChain.display_name} to your wallet. ${ts.warning}` - }), - () => ({ - status: "WARNING", - title: `Could not automatically switch chain.`, - description: `Please make sure your wallet is connected to ${$validation.transfer.sourceChain.display_name}` - }), - () => ({ - status: "IN_PROGRESS", - title: `Switching to ${$validation.transfer.sourceChain.display_name}`, - description: `Click "Approve" in wallet.` - }) - ), - stateToStatus( - $transferState, - "APPROVING_ASSET", - "Approve ERC20", - "Approved ERC20", - ts => ({ - status: "ERROR", - title: `Error approving ERC20`, - description: `${ts.error}` - }), - () => ({}), - () => ({ - status: "IN_PROGRESS", - title: "Approving ERC20", - description: "Click 'Next' and 'Approve' in wallet." - }) - ), - stateToStatus( - $transferState, - "AWAITING_APPROVAL_RECEIPT", - "Wait for approval receipt", - "Received approval receipt", - ts => ({ - status: "ERROR", - title: `Error waiting for approval receipt`, - description: `${ts.error}` - }), - () => ({}), - () => ({ - status: "IN_PROGRESS", - title: "Awaiting approval receipt", - description: `Waiting on ${$validation.transfer.sourceChain.display_name}` - }) - ), - stateToStatus( - $transferState, - "SIMULATING_TRANSFER", - "Simulate transfer", - "Simulated transfer", - ts => ({ - status: "ERROR", - title: `Error simulating transfer on ${$validation.transfer.sourceChain.display_name}`, - // @ts-expect-error - description: `${ts.error}` - }), - () => ({ - status: "WARNING", - title: `Failed to simulate transfer`, - description: `You can still attempt to make this transfer in your wallet` - }), - () => ({ - status: "IN_PROGRESS", - title: "Simulating transfer", - description: `Waiting on ${$validation.transfer.sourceChain.display_name}` - }) - ), - stateToStatus( - $transferState, - "CONFIRMING_TRANSFER", - "Confirm transfer", - "Confirmed transfer", - ts => ({ - status: "ERROR", - title: "Error confirming transfer", - description: `${ts.error}` - }), - () => ({}), - () => ({ - status: "IN_PROGRESS", - title: "Confirming your transfer", - description: `Click "Confirm" in your wallet` - }) - ), - stateToStatus( - $transferState, - "AWAITING_TRANSFER_RECEIPT", - "Wait for transfer receipt", - "Confirmed transfer", - ts => ({ - status: "ERROR", - title: "Error while waiting on transfer receipt", - description: `tx hash: ${ts.transferHash}, error: ${ts.error}` - }), - () => ({}), - () => ({ - status: "IN_PROGRESS", - title: "Awaiting transfer receipt", - description: `Waiting on ${$validation.transfer.sourceChain.display_name}` - }) - ), - stateToStatus( - $transferState, - "TRANSFERRING", - "Transfer assets", - "Transferred assets", - () => ({}), - () => ({}), - () => ({ - status: "IN_PROGRESS", - title: "Transferring assets", - description: `Successfully initiated transfer` - }) - ) - ] as Array - } - if ( - $validation.transfer.sourceChain?.rpc_type === "cosmos" || - $validation.transfer.sourceChain?.rpc_type === "aptos" - ) { - return [ - stateToStatus( - $transferState, - "SWITCHING_TO_CHAIN", - `Switch to ${$validation.transfer.sourceChain.display_name}`, - `Switched to ${$validation.transfer.sourceChain.display_name}`, - ts => ({ - status: "ERROR", - title: `Error switching to ${$validation.transfer.sourceChain.display_name}`, - description: `There was an issue switching to ${$validation.transfer.sourceChain.display_name} to your wallet. ${ts.warning}` - }), - () => ({ - status: "WARNING", - title: `Could not automatically switch chain.`, - description: `Please make sure your wallet is connected to ${$validation.transfer.sourceChain.display_name}` - }), - () => ({ - status: "IN_PROGRESS", - title: `Switching to ${$validation.transfer.sourceChain.display_name}`, - description: `Click "Approve" in wallet.` - }) - ), - stateToStatus( - $transferState, - "CONFIRMING_TRANSFER", - "Confirm transfer", - "Confirmed transfer", - ts => ({ - status: "ERROR", - title: "Error confirming transfer", - description: `${ts.error}` - }), - () => ({}), - () => ({ - status: "IN_PROGRESS", - title: "Confirming your transfer", - description: `Click "Approve" in your wallet` - }) - ), - stateToStatus( - $transferState, - "TRANSFERRING", - "Transfer assets", - "Transferred assets", - () => ({}), - () => ({}), - () => ({ - status: "IN_PROGRESS", - title: "Transferring assets", - description: `Successfully initiated transfer` - }) - ) - ] as Array - } - raise("trying to make stepper for unsupported chain") - } -)
- {#if $validation.isValid && !confirmed} -
-
- {$validation.transfer.sourceChain.display_name} - -
-
- {$validation.transfer.destinationChain.display_name} - -
-
- {$validation.transfer.amount} - -
-
- {/if} + {JSON.stringify(channel)} + {JSON.stringify(transferArgs)} +
- {#if $validation.transfer?.sourceChain} - transferState.set({ kind: 'PRE_TRANSFER' })} - onRetry={() => { - transferState.update(ts => { - // @ts-ignore - ts.error = undefined - return ts - }) - transfer() - }} - /> - {/if} + - {#if !confirmed} -
- - -
- {/if} - diff --git a/app/src/lib/components/TransferFrom/index.svelte b/app/src/lib/components/TransferFrom/index.svelte index 4a28c17e97..75d1f8110e 100644 --- a/app/src/lib/components/TransferFrom/index.svelte +++ b/app/src/lib/components/TransferFrom/index.svelte @@ -11,9 +11,10 @@ import type { Chain, Ucs03Channel } from "$lib/types.ts" import { userBalancesQuery } from "$lib/queries/balance" import { userAddress, balanceStore } from "$lib/components/TransferFrom/transfer/balances.ts" import { createRawIntentsStore } from "./transfer/raw-intents" -import { derived } from "svelte/store" +import { derived, writable, type Writable } from "svelte/store" import { getChannelInfo, getQuoteToken } from "@unionlabs/client" import { fromHex, isHex, toHex } from "viem" +import { subscribe } from "graphql" export let chains: Array export let ucs03channels: Array @@ -27,7 +28,18 @@ let channel = derived(rawIntents, $rawIntents => { return getChannelInfo($rawIntents.source, $rawIntents.destination, ucs03channels) }) -let transferArgs = derived([rawIntents, channel], async ([$rawIntents, $channel]) => { +let transferArgs: Writable<{ + baseToken: string + baseAmount: bigint + quoteToken: string + quoteAmount: bigint + receiver: string + sourceChannelId: number + ucs03address: string +} | null> = writable(null) + +rawIntents.subscribe(async () => { + transferArgs.set(null) if ($channel === null || $rawIntents.asset === null) return null const chain = chains.find(c => c.chain_id === $rawIntents.source) if (!chain) return null @@ -51,7 +63,9 @@ let transferArgs = derived([rawIntents, channel], async ([$rawIntents, $channel] ? fromHex(`0x${$channel.source_port_id}`, "string") : `0x${$channel.source_port_id}` - return { + console.log("setting") + + transferArgs.set({ baseToken, baseAmount: BigInt($rawIntents.amount), quoteToken: quoteToken.value.quote_token, @@ -59,21 +73,17 @@ let transferArgs = derived([rawIntents, channel], async ([$rawIntents, $channel] receiver: $rawIntents.receiver, sourceChannelId: $channel.source_channel_id, ucs03address - } + }) })
{JSON.stringify($rawIntents)}
{JSON.stringify($channel)}
+
{JSON.stringify($transferArgs)}
-{#await $transferArgs} -loading.. -{:then quote} -
{JSON.stringify(quote, null, 2)}
-{/await}
- +
@@ -89,7 +99,9 @@ loading..
- yay + {#if $transferArgs && $channel} + + {/if}
From 075790815f09fe46a992495b3476e93bb1aad98b Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 24 Jan 2025 11:40:34 +0000 Subject: [PATCH 08/13] feat(app): push deps --- app/package-lock.json | 353 ++++-------------- app/package.json | 8 +- .../components/Cube/faces/Transfer.svelte | 39 +- typescript-sdk/package.json | 4 +- 4 files changed, 122 insertions(+), 282 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index 7a829c0492..6dd3b2d7f3 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -19,9 +19,9 @@ "@tanstack/svelte-query": "5.61.5", "@tanstack/svelte-table": "^8.20.5", "@tanstack/svelte-virtual": "3.10.9", - "@unionlabs/client": "0.0.51", - "@wagmi/connectors": "5.5.2", - "@wagmi/core": "2.15.1", + "@unionlabs/client": "0.0.52", + "@wagmi/connectors": "5.7.5", + "@wagmi/core": "2.16.3", "bits-ui": "^0.21.13", "cmdk-sv": "^0.0.18", "gql.tada": "1.8.10", @@ -34,7 +34,7 @@ "three": "0.170.0", "valibot": "0.42.1", "vaul-svelte": "^0.3.2", - "viem": "2.21.52" + "viem": "2.22.13" }, "devDependencies": { "@iconify-json/fa6-solid": "1.2.2", @@ -1495,15 +1495,15 @@ } }, "node_modules/@metamask/sdk": { - "version": "0.31.0", - "resolved": "https://registry.npmjs.org/@metamask/sdk/-/sdk-0.31.0.tgz", - "integrity": "sha512-L1TKg7NkgCJbjkJsDTC6ZEpjGdroxsFksm17eGWPmNqdPf561ujJkU3xWCUPxEvU0hI+Wz3y2GegJsNej9/jWw==", + "version": "0.31.5", + "resolved": "https://registry.npmjs.org/@metamask/sdk/-/sdk-0.31.5.tgz", + "integrity": "sha512-i7wteqO/fU2JWQrMZz+addHokYThHYznp4nYXviv+QysdxGVgAYvcW/PBA+wpeP3veX7QGfNqMPgSsZbBrASYw==", "dependencies": { "@babel/runtime": "^7.26.0", "@metamask/onboarding": "^1.0.1", "@metamask/providers": "16.1.0", "@metamask/sdk-communication-layer": "0.31.0", - "@metamask/sdk-install-modal-web": "0.31.0", + "@metamask/sdk-install-modal-web": "0.31.5", "@paulmillr/qr": "^0.2.1", "bowser": "^2.9.0", "cross-fetch": "^4.0.0", @@ -1540,9 +1540,9 @@ } }, "node_modules/@metamask/sdk-install-modal-web": { - "version": "0.31.0", - "resolved": "https://registry.npmjs.org/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.31.0.tgz", - "integrity": "sha512-nr8AZ+ccEfC3BmzTkT2wH16wOARqVrkhAFqsxYsnaozn+BAb+Hwo/GRhaIGzYgYFj/tTD3SM0UtXd6x2gzMDQw==", + "version": "0.31.5", + "resolved": "https://registry.npmjs.org/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.31.5.tgz", + "integrity": "sha512-ZfrVkPAabfH4AIxcTlxQN5oyyzzVXFTLZrm1/BJ+X632d9MiyAVHNtiqa9EZpZYkZGk2icmDVP+xCpvJmVOVpQ==", "dependencies": { "@paulmillr/qr": "^0.2.1" } @@ -1675,9 +1675,9 @@ } }, "node_modules/@noble/ciphers": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.1.2.tgz", - "integrity": "sha512-7eTr/DCRCW+V9QaVGsfujw0mk7UOeRARbEz+fRzESRBfiBR3wsBzxOrYWNvqKTQjUfBFeSxJsVSfl6NJhZuYwg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.2.1.tgz", + "integrity": "sha512-rONPWMC7PeExE077uLE4oqWrZ1IvAfz3oH9LibVAcVCopJiA9R62uavnbEzdkVmJYI6M6Zgkbeb07+tWjlq2XA==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -1687,12 +1687,12 @@ } }, "node_modules/@noble/curves": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz", - "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.1.tgz", + "integrity": "sha512-warwspo+UYUPep0Q+vtdVB4Ugn8GGQj8iyB3gnRWsztmUHTI3S1nhdiWNsPUGL0vud7JlRRk1XEu7Lq1KGTnMQ==", "license": "MIT", "dependencies": { - "@noble/hashes": "1.6.0" + "@noble/hashes": "1.7.1" }, "engines": { "node": "^14.21.3 || >=16" @@ -1701,22 +1701,10 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/@noble/curves/node_modules/@noble/hashes": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz", - "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==", - "license": "MIT", - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/@noble/hashes": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz", - "integrity": "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz", + "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -2584,9 +2572,9 @@ ] }, "node_modules/@safe-global/safe-apps-provider": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@safe-global/safe-apps-provider/-/safe-apps-provider-0.18.4.tgz", - "integrity": "sha512-SWYeG3gyTO6wGHMSokfHakZ9isByn2mHsM0VohIorYFFEyGGmJ89btnTm+DqDUSoQtvWAatZB7XNy6CaYMvqtg==", + "version": "0.18.5", + "resolved": "https://registry.npmjs.org/@safe-global/safe-apps-provider/-/safe-apps-provider-0.18.5.tgz", + "integrity": "sha512-9v9wjBi3TwLsEJ3C2ujYoexp3pFJ0omDLH/GX91e2QB+uwCKTBYyhxFSrTQ9qzoyQd+bfsk4gjOGW87QcJhf7g==", "license": "MIT", "dependencies": { "@safe-global/safe-apps-sdk": "^9.1.0", @@ -2604,9 +2592,9 @@ } }, "node_modules/@safe-global/safe-gateway-typescript-sdk": { - "version": "3.22.4", - "resolved": "https://registry.npmjs.org/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.22.4.tgz", - "integrity": "sha512-Z7Z8w3GEJdJ/paF+NK23VN4AwqWPadq0AeRYjYLjIBiPWpRB2UO/FKq7ONABEq0YFgNPklazIV4IExQU1gavXA==", + "version": "3.22.7", + "resolved": "https://registry.npmjs.org/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.22.7.tgz", + "integrity": "sha512-r1OML6y1oBL6E5ZADg9smzvVzOOgsTLfRXYuT/7fW1Eqg2nJKcALoLLfH6sJAcHvobHUZXcjxKPINDwNJq0N9g==", "license": "MIT", "engines": { "node": ">=16" @@ -2622,27 +2610,27 @@ } }, "node_modules/@scure/bip32": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.0.tgz", - "integrity": "sha512-82q1QfklrUUdXJzjuRU7iG7D7XiFx5PHYVS0+oeNKhyDLT7WPqs6pBcM2W5ZdwOwKCwoE1Vy1se+DHjcXwCYnA==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.2.tgz", + "integrity": "sha512-t96EPDMbtGgtb7onKKqxRLfE5g05k7uHnHRM2xdE6BP/ZmxaLtPek4J4KfVn/90IQNrU1IOAqMgiDtUdtbe3nw==", "license": "MIT", "dependencies": { - "@noble/curves": "~1.7.0", - "@noble/hashes": "~1.6.0", - "@scure/base": "~1.2.1" + "@noble/curves": "~1.8.1", + "@noble/hashes": "~1.7.1", + "@scure/base": "~1.2.2" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip39": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.5.0.tgz", - "integrity": "sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.5.4.tgz", + "integrity": "sha512-TFM4ni0vKvCfBpohoh+/lY05i9gRbSwXWngAsF4CABQxoaOHijxuaZ2R6cStDQ5CHtHO9aGJTr4ksVJASRRyMA==", "license": "MIT", "dependencies": { - "@noble/hashes": "~1.6.0", - "@scure/base": "~1.2.1" + "@noble/hashes": "~1.7.1", + "@scure/base": "~1.2.4" }, "funding": { "url": "https://paulmillr.com/funding/" @@ -3264,9 +3252,9 @@ "license": "MIT" }, "node_modules/@unionlabs/client": { - "version": "0.0.51", - "resolved": "https://registry.npmjs.org/@unionlabs/client/-/client-0.0.51.tgz", - "integrity": "sha512-CRzfnvjE71EwPdbzpGMEudojPxJMKQN9f2Pyxebw9T16C3E6faFiL9HUF11nWASzchQ8FoxAiWWhFF2GQiiCTQ==", + "version": "0.0.52", + "resolved": "https://registry.npmjs.org/@unionlabs/client/-/client-0.0.52.tgz", + "integrity": "sha512-/aSDltnog1pU6mGdbB1zq+aMoSmAjdxp8OeKWLqGXUHuCsrfvzTvPWxINi3nJM96lNsFSLSg0JQGzrB5T7YjJg==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -3282,7 +3270,7 @@ "neverthrow": "^8.1.1", "ofetch": "^1.4.1", "patch-package": "^8.0.0", - "viem": "^2.22.10" + "viem": "^2.22.13" } }, "node_modules/@unionlabs/client/node_modules/@cosmjs/amino": { @@ -3435,107 +3423,6 @@ "integrity": "sha512-Y6glwHNlNjcOgwPg8YmNr1PSrNm307EhJVytFt8HmA/G7MRcIA+jIzCL0VlOrWGU4TrAOXvshM+oJZbTIldFRA==", "license": "Apache-2.0" }, - "node_modules/@unionlabs/client/node_modules/abitype": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.7.tgz", - "integrity": "sha512-ZfYYSktDQUwc2eduYu8C4wOs+RDPmnRYMh7zNfzeMtGGgb0U+6tLGjixUic6mXf5xKKCcgT5Qp6cv39tOARVFw==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/wevm" - }, - "peerDependencies": { - "typescript": ">=5.0.4", - "zod": "^3 >=3.22.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - }, - "zod": { - "optional": true - } - } - }, - "node_modules/@unionlabs/client/node_modules/ox": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/ox/-/ox-0.6.5.tgz", - "integrity": "sha512-vmnH8KvMDwFZDbNY1mq2CBRBWIgSliZB/dFV0xKp+DfF/dJkTENt6nmA+DzHSSAgL/GO2ydjkXWvlndJgSY4KQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wevm" - } - ], - "license": "MIT", - "dependencies": { - "@adraffy/ens-normalize": "^1.10.1", - "@noble/curves": "^1.6.0", - "@noble/hashes": "^1.5.0", - "@scure/bip32": "^1.5.0", - "@scure/bip39": "^1.4.0", - "abitype": "^1.0.6", - "eventemitter3": "5.0.1" - }, - "peerDependencies": { - "typescript": ">=5.4.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@unionlabs/client/node_modules/viem": { - "version": "2.22.12", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.22.12.tgz", - "integrity": "sha512-n3Oc3RO6SaFMOaF8/0YzZK5KtL3OJ9mPiJQgJIOI5Ab5FscdsFixjJdaYD2Tp3Sp/VMHYG9aRyqJ1KZaO7nu+A==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wevm" - } - ], - "license": "MIT", - "dependencies": { - "@noble/curves": "1.7.0", - "@noble/hashes": "1.6.1", - "@scure/bip32": "1.6.0", - "@scure/bip39": "1.5.0", - "abitype": "1.0.7", - "isows": "1.0.6", - "ox": "0.6.5", - "ws": "8.18.0" - }, - "peerDependencies": { - "typescript": ">=5.0.4" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@unionlabs/client/node_modules/viem/node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/@vitest/expect": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.6.tgz", @@ -3650,14 +3537,14 @@ } }, "node_modules/@wagmi/connectors": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/@wagmi/connectors/-/connectors-5.5.2.tgz", - "integrity": "sha512-QYXDGu7ELr88R2ijkNMhVN402Vt9EXGrtHSMLq7u9pSu/N4mODZvXbvE9RWQ8PNrtCKGYLrHxI/oUGjCf1zxzQ==", + "version": "5.7.5", + "resolved": "https://registry.npmjs.org/@wagmi/connectors/-/connectors-5.7.5.tgz", + "integrity": "sha512-btqHHUSTzg4BZe9at/7SnRPv4cz8O3pisbeZBh0qxKz7PVm+9vRxY0bSala3xQPDcS0PRTB30Vn/+lM73GCjbw==", "license": "MIT", "dependencies": { "@coinbase/wallet-sdk": "4.2.3", - "@metamask/sdk": "0.31.0", - "@safe-global/safe-apps-provider": "0.18.4", + "@metamask/sdk": "0.31.5", + "@safe-global/safe-apps-provider": "0.18.5", "@safe-global/safe-apps-sdk": "9.1.0", "@walletconnect/ethereum-provider": "2.17.0", "cbw-sdk": "npm:@coinbase/wallet-sdk@3.9.3" @@ -3666,7 +3553,7 @@ "url": "https://github.com/sponsors/wevm" }, "peerDependencies": { - "@wagmi/core": "2.15.1", + "@wagmi/core": "2.16.3", "typescript": ">=5.0.4", "viem": "2.x" }, @@ -3677,9 +3564,9 @@ } }, "node_modules/@wagmi/core": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/@wagmi/core/-/core-2.15.1.tgz", - "integrity": "sha512-xeSdA9FOZs+H1NG51GekfgDQ5aG8KGYUphuh+aYhsvMYtaEy6DVKmpgS13nvAzxe4rjtw0cm6RR0SA4G+paVdg==", + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/@wagmi/core/-/core-2.16.3.tgz", + "integrity": "sha512-SVovoWHaQ2AIkmGf+ucNijT6AHXcTMffFcLmcFF6++y21x+ge7Gkh3UoJiU91SDDv8n08eTQ9jbyia3GEgU5jQ==", "license": "MIT", "dependencies": { "eventemitter3": "5.0.1", @@ -4097,9 +3984,9 @@ "license": "BSD-2-Clause" }, "node_modules/abitype": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.6.tgz", - "integrity": "sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.8.tgz", + "integrity": "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/wevm" @@ -4640,9 +4527,9 @@ "license": "MIT" }, "node_modules/bufferutil": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", - "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.9.tgz", + "integrity": "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -5135,12 +5022,12 @@ "license": "MIT" }, "node_modules/cross-fetch": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", - "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.1.0.tgz", + "integrity": "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==", "license": "MIT", "dependencies": { - "node-fetch": "^2.6.12" + "node-fetch": "^2.7.0" } }, "node_modules/cross-spawn": { @@ -5537,12 +5424,12 @@ "license": "MIT" }, "node_modules/eciesjs": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/eciesjs/-/eciesjs-0.4.12.tgz", - "integrity": "sha512-DGejvMCihsRAmKRFQiL6KZDE34vWVd0gvXlykFq1aEzJy/rD65AVyAIUZKZOvgvaP9ATQRcHGEZV5DfgrgjA4w==", + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/eciesjs/-/eciesjs-0.4.13.tgz", + "integrity": "sha512-zBdtR4K+wbj10bWPpIOF9DW+eFYQu8miU5ypunh0t4Bvt83ZPlEWgT5Dq/0G6uwEXumZKjfb5BZxYUZQ2Hzn/Q==", "license": "MIT", "dependencies": { - "@ecies/ciphers": "^0.2.1", + "@ecies/ciphers": "^0.2.2", "@noble/ciphers": "^1.0.0", "@noble/curves": "^1.6.0", "@noble/hashes": "^1.5.0" @@ -5603,9 +5490,9 @@ } }, "node_modules/engine.io-client": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.2.tgz", - "integrity": "sha512-TAr+NKeoVTjEVW8P3iHguO1LO6RlUz9O5Y8o7EY0fU+gY1NYqas7NN3slpFtbXEsLMHk0h90fJMfKjRkQ0qUIw==", + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.3.tgz", + "integrity": "sha512-T0iLjnyNWahNyv/lcjS2y4oE358tVS/SYQNxYXGAJ9/GLgH4VCvOQ/mhTjqU88mLZCQgiG8RIegFHYCdVC+j5w==", "license": "MIT", "dependencies": { "@socket.io/component-emitter": "~3.1.0", @@ -7856,9 +7743,9 @@ } }, "node_modules/ox": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ox/-/ox-0.1.2.tgz", - "integrity": "sha512-ak/8K0Rtphg9vnRJlbOdaX9R7cmxD2MiSthjWGaQdMk3D7hrAlDoM+6Lxn7hN52Za3vrXfZ7enfke/5WjolDww==", + "version": "0.6.7", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.6.7.tgz", + "integrity": "sha512-17Gk/eFsFRAZ80p5eKqv89a57uXjd3NgIf1CaXojATPBuujVc/fQSVhBeAU9JCRB+k7J50WQAyWTxK19T9GgbA==", "funding": [ { "type": "github", @@ -10453,9 +10340,9 @@ } }, "node_modules/viem": { - "version": "2.21.52", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.52.tgz", - "integrity": "sha512-O53JhgVhp9CB0T3afy79O5ixNr8XXRGYQtlGYerzttnP56Oh2NBx4+Otz8IFd9N5DVPywf6tmYxHP1RVA99xJA==", + "version": "2.22.13", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.22.13.tgz", + "integrity": "sha512-MaQKY5DUQ5SnZJPMytp5nTgvRu7N3wzvBhY31/9VT4lxDZAcQolqYEK3EqP+cdAD8jl0YmGuoJlfW9D1crqlGg==", "funding": [ { "type": "github", @@ -10464,14 +10351,13 @@ ], "license": "MIT", "dependencies": { - "@noble/curves": "1.6.0", - "@noble/hashes": "1.5.0", - "@scure/bip32": "1.5.0", - "@scure/bip39": "1.4.0", - "abitype": "1.0.6", + "@noble/curves": "1.8.1", + "@noble/hashes": "1.7.1", + "@scure/bip32": "1.6.2", + "@scure/bip39": "1.5.4", + "abitype": "1.0.8", "isows": "1.0.6", - "ox": "0.1.2", - "webauthn-p256": "0.0.10", + "ox": "0.6.7", "ws": "8.18.0" }, "peerDependencies": { @@ -10483,69 +10369,6 @@ } } }, - "node_modules/viem/node_modules/@noble/curves": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", - "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", - "license": "MIT", - "dependencies": { - "@noble/hashes": "1.5.0" - }, - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/viem/node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", - "license": "MIT", - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/viem/node_modules/@scure/base": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", - "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", - "license": "MIT", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/viem/node_modules/@scure/bip32": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.5.0.tgz", - "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==", - "license": "MIT", - "dependencies": { - "@noble/curves": "~1.6.0", - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.7" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/viem/node_modules/@scure/bip39": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.4.0.tgz", - "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==", - "license": "MIT", - "dependencies": { - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.8" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/viem/node_modules/ws": { "version": "8.18.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", @@ -11298,22 +11121,6 @@ "dev": true, "license": "MIT" }, - "node_modules/webauthn-p256": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/webauthn-p256/-/webauthn-p256-0.0.10.tgz", - "integrity": "sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wevm" - } - ], - "license": "MIT", - "dependencies": { - "@noble/curves": "^1.4.0", - "@noble/hashes": "^1.4.0" - } - }, "node_modules/webextension-polyfill": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz", diff --git a/app/package.json b/app/package.json index 4177b8cf66..c6a35760cd 100644 --- a/app/package.json +++ b/app/package.json @@ -28,9 +28,9 @@ "@tanstack/svelte-query": "5.61.5", "@tanstack/svelte-table": "^8.20.5", "@tanstack/svelte-virtual": "3.10.9", - "@unionlabs/client": "0.0.51", - "@wagmi/connectors": "5.5.2", - "@wagmi/core": "2.15.1", + "@unionlabs/client": "0.0.52", + "@wagmi/connectors": "5.7.5", + "@wagmi/core": "2.16.3", "bits-ui": "^0.21.13", "cmdk-sv": "^0.0.18", "gql.tada": "1.8.10", @@ -40,7 +40,7 @@ "three": "0.170.0", "valibot": "0.42.1", "vaul-svelte": "^0.3.2", - "viem": "2.21.52" + "viem": "2.22.13" }, "devDependencies": { "@iconify-json/fa6-solid": "1.2.2", diff --git a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte index 7c575e09a8..3244117b63 100644 --- a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte +++ b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte @@ -31,8 +31,9 @@ import type { CubeFaces } from "$lib/components/TransferFrom/components/Cube/typ import Stepper from "$lib/components/stepper.svelte" import type { Step } from "$lib/stepper-types.ts" import Truncate from "$lib/components/truncate.svelte" -import type { Ucs03Channel } from "$lib/types" +import type { Chain, Ucs03Channel } from "$lib/types" +export let chains: Array export let channel: Ucs03Channel export let transferArgs: { baseToken: string @@ -46,17 +47,49 @@ export let transferArgs: { const REDIRECT_DELAY_MS = 5000 let transferState: Writable = writable({ kind: "PRE_TRANSFER" }) + +function transfer() { + const sourceChain = chains.find(c => c.chain_id === sourceChain) + if (!sourceChain) { + toast.error("source chain not found") + return + } + + if (sourceChain.rpc_type === "evm") { + evmTransfer(sourceChain) + return + } + toast.error("cosmos currently unsupported") +} + +async function evmTransfer(sourceChain: Chain) { + const connectorClient = await getConnectorClient(config) + const selectedChain = evmChainFromChainId(sourceChain.chain_id) + + const evmClient = createUnionClient({ + account: connectorClient.account, + chainId: sourceChain.chain_id as EvmChainId, + transport: custom(window.ethereum) + }) + + const approveResponse = await evmClient.approveErc20(transferArgs) + + if (approveResponse.isErr()) { + toast.error(approveResponse.error) + process.exit(1) + } +}
{JSON.stringify(channel)} {JSON.stringify(transferArgs)} -
- + + diff --git a/typescript-sdk/package.json b/typescript-sdk/package.json index c79f4af264..4983deacce 100644 --- a/typescript-sdk/package.json +++ b/typescript-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@unionlabs/client", - "version": "0.0.51", + "version": "0.0.52", "homepage": "https://union.build", "description": "Union Labs cross-chain transfers client", "type": "module", @@ -41,7 +41,7 @@ "neverthrow": "^8.1.1", "ofetch": "^1.4.1", "patch-package": "^8.0.0", - "viem": "^2.22.10" + "viem": "^2.22.13" }, "devDependencies": { "@total-typescript/ts-reset": "^0.6.1", From d4f95a2cb080280e89da60fa5fd21f39275f36da Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 24 Jan 2025 12:15:02 +0000 Subject: [PATCH 09/13] fix(app): resillient against misisng pixelgraph dta --- app/src/routes/explorer/(components)/pixel-graph.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/routes/explorer/(components)/pixel-graph.svelte b/app/src/routes/explorer/(components)/pixel-graph.svelte index 251b12337b..2ccf144a2a 100644 --- a/app/src/routes/explorer/(components)/pixel-graph.svelte +++ b/app/src/routes/explorer/(components)/pixel-graph.svelte @@ -4,7 +4,7 @@ import * as Tooltip from "$lib/components/ui/tooltip" export let data: Array<{ count: number; day: string }> = [] $: minValue = 0 -$: maxValue = data.length > 0 ? Math.max(...data.map(d => d.count)) : 0 +$: maxValue = Array.isArray(data) && data.length > 0 ? Math.max(...data.map(d => d.count)) : 0 function normalize( value: number, @@ -18,7 +18,7 @@ function normalize( } $: normalizedData = - data.length > 0 + Array.isArray(data) && data.length > 0 ? data.map(d => ({ ...d, normalizedValue: Math.floor(normalize(d.count, minValue, maxValue, 0, 9)) @@ -28,6 +28,7 @@ $: normalizedData =
{#each normalizedData as data} + {#if Array.isArray(data.normalizedValue)}
@@ -45,6 +46,7 @@ $: normalizedData = {/if} + {/if} {/each}
From c25261c4cf4738637c1b97c97a1aefeecec6b4f9 Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 24 Jan 2025 12:23:13 +0000 Subject: [PATCH 10/13] feat(app): improve resilliency --- .../components/Cube/faces/Intent.svelte | 35 ++++++++++++------- .../components/Cube/faces/Transfer.svelte | 17 +++++++-- .../lib/components/TransferFrom/index.svelte | 2 +- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte b/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte index 6185350811..0af299af68 100644 --- a/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte +++ b/app/src/lib/components/TransferFrom/components/Cube/faces/Intent.svelte @@ -12,6 +12,7 @@ import LoadingDots from "$lib/components/loading-dots.svelte" import Token from "$lib/components/token.svelte" import type { Chain, Ucs03Channel } from "$lib/types" import ArrowRightIcon from "virtual:icons/lucide/arrow-right" +import { toDisplayName } from "$lib/utilities/chains" interface Props { stores: { @@ -94,19 +95,27 @@ let { rawIntents, intents, validation } = stores
-
- {#if !transferArgs} - + {#if !$channel} +
No recommended UCS03 channel to go from {toDisplayName($rawIntents.source, chains)} to {toDisplayName($rawIntents.destination, chains)}
+ {:else} + {#if !$rawIntents.asset} + Select an asset {:else} -
-
{$channel?.source_connection_id} | {$channel?.source_channel_id} {$channel?.destination_connection_id} | {$channel?.destination_channel_id}
- -
- - {/if} -
+
+ {#if !transferArgs} + + {:else} +
+
{$channel?.source_connection_id} | {$channel?.source_channel_id} {$channel?.destination_connection_id} | {$channel?.destination_channel_id}
+ +
+ + {/if} +
+ {/if} + {/if} diff --git a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte index 3244117b63..500ec5e0ab 100644 --- a/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte +++ b/app/src/lib/components/TransferFrom/components/Cube/faces/Transfer.svelte @@ -49,7 +49,7 @@ const REDIRECT_DELAY_MS = 5000 let transferState: Writable = writable({ kind: "PRE_TRANSFER" }) function transfer() { - const sourceChain = chains.find(c => c.chain_id === sourceChain) + const sourceChain = chains.find(c => c.chain_id === channel.source_chain_id) if (!sourceChain) { toast.error("source chain not found") return @@ -75,9 +75,20 @@ async function evmTransfer(sourceChain: Chain) { const approveResponse = await evmClient.approveErc20(transferArgs) if (approveResponse.isErr()) { - toast.error(approveResponse.error) - process.exit(1) + toast.error(approveResponse.error.name) + return } + + toast.info(`approval tx hash ${approveResponse.value}`) + + const transfer = await evmClient.transferAsset(transferArgs) + + if (transfer.isErr()) { + toast.error(`${transfer.error}`) + return + } + + toast.info(`approval tx hash ${transfer.value}`) } diff --git a/app/src/lib/components/TransferFrom/index.svelte b/app/src/lib/components/TransferFrom/index.svelte index 75d1f8110e..fe78064fab 100644 --- a/app/src/lib/components/TransferFrom/index.svelte +++ b/app/src/lib/components/TransferFrom/index.svelte @@ -100,7 +100,7 @@ rawIntents.subscribe(async () => {
{#if $transferArgs && $channel} - + {/if}
From 1d6e38a06f0f8364122a3f78dfe5b17bfda0eeb1 Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 24 Jan 2025 12:29:02 +0000 Subject: [PATCH 11/13] chore(app): update schema --- app/src/generated/graphql-env.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/generated/graphql-env.d.ts b/app/src/generated/graphql-env.d.ts index c515a5920a..3710a9d0e9 100644 --- a/app/src/generated/graphql-env.d.ts +++ b/app/src/generated/graphql-env.d.ts @@ -204,12 +204,12 @@ export type introspection_types = { 'v1_ibc_union_chains_select_column': { name: 'v1_ibc_union_chains_select_column'; enumValues: 'addr_prefix' | 'chain_id' | 'display_name' | 'enabled' | 'enabled_staging' | 'logo_uri' | 'rpc_type' | 'testnet'; }; 'v1_ibc_union_chains_stream_cursor_input': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_stream_cursor_input'; isOneOf: false; inputFields: [{ name: 'initial_value'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_stream_cursor_value_input'; ofType: null; }; }; defaultValue: null }, { name: 'ordering'; type: { kind: 'ENUM'; name: 'cursor_ordering'; ofType: null; }; defaultValue: null }]; }; 'v1_ibc_union_chains_stream_cursor_value_input': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_stream_cursor_value_input'; isOneOf: false; inputFields: [{ name: 'addr_prefix'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'display_name'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'enabled'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; }; defaultValue: null }, { name: 'enabled_staging'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; }; defaultValue: null }, { name: 'logo_uri'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'rpc_type'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'testnet'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; }; defaultValue: null }]; }; - 'v1_ibc_union_channel_recommendations': { kind: 'OBJECT'; name: 'v1_ibc_union_channel_recommendations'; fields: { 'destination_chain': { name: 'destination_chain'; type: { kind: 'OBJECT'; name: 'v1_ibc_union_chains'; ofType: null; } }; 'destination_chain_id': { name: 'destination_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'destination_channel_id': { name: 'destination_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_client_id': { name: 'destination_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_connection_id': { name: 'destination_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_port_id': { name: 'destination_port_id'; type: { kind: 'SCALAR'; name: 'bytea'; ofType: null; } }; 'source_chain': { name: 'source_chain'; type: { kind: 'OBJECT'; name: 'v1_ibc_union_chains'; ofType: null; } }; 'source_chain_id': { name: 'source_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'source_channel_id': { name: 'source_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_client_id': { name: 'source_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_connection_id': { name: 'source_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_port_id': { name: 'source_port_id'; type: { kind: 'SCALAR'; name: 'bytea'; ofType: null; } }; 'status': { name: 'status'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'version': { name: 'version'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; }; - 'v1_ibc_union_channel_recommendations_bool_exp': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; isOneOf: false; inputFields: [{ name: '_and'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; ofType: null; }; }; }; defaultValue: null }, { name: '_not'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; ofType: null; }; defaultValue: null }, { name: '_or'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; ofType: null; }; }; }; defaultValue: null }, { name: 'destination_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_bool_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_chain_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_channel_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_client_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_connection_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_port_id'; type: { kind: 'INPUT_OBJECT'; name: 'bytea_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_bool_exp'; ofType: null; }; defaultValue: null }, { name: 'source_chain_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_channel_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_client_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_connection_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_port_id'; type: { kind: 'INPUT_OBJECT'; name: 'bytea_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'status'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'version'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }]; }; + 'v1_ibc_union_channel_recommendations': { kind: 'OBJECT'; name: 'v1_ibc_union_channel_recommendations'; fields: { 'destination_chain': { name: 'destination_chain'; type: { kind: 'OBJECT'; name: 'v1_ibc_union_chains'; ofType: null; } }; 'destination_chain_id': { name: 'destination_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'destination_channel_id': { name: 'destination_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_client_id': { name: 'destination_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_connection_id': { name: 'destination_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_port_id': { name: 'destination_port_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'source_chain': { name: 'source_chain'; type: { kind: 'OBJECT'; name: 'v1_ibc_union_chains'; ofType: null; } }; 'source_chain_id': { name: 'source_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'source_channel_id': { name: 'source_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_client_id': { name: 'source_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_connection_id': { name: 'source_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_port_id': { name: 'source_port_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'status': { name: 'status'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'version': { name: 'version'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; }; + 'v1_ibc_union_channel_recommendations_bool_exp': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; isOneOf: false; inputFields: [{ name: '_and'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; ofType: null; }; }; }; defaultValue: null }, { name: '_not'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; ofType: null; }; defaultValue: null }, { name: '_or'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_bool_exp'; ofType: null; }; }; }; defaultValue: null }, { name: 'destination_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_bool_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_chain_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_channel_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_client_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_connection_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_port_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_bool_exp'; ofType: null; }; defaultValue: null }, { name: 'source_chain_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_channel_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_client_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_connection_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_port_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'status'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'version'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }]; }; 'v1_ibc_union_channel_recommendations_order_by': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_order_by'; isOneOf: false; inputFields: [{ name: 'destination_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_chain_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_channel_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_client_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_connection_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_port_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_order_by'; ofType: null; }; defaultValue: null }, { name: 'source_chain_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_channel_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_client_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_connection_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_port_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'status'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'version'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }]; }; 'v1_ibc_union_channel_recommendations_select_column': { name: 'v1_ibc_union_channel_recommendations_select_column'; enumValues: 'destination_chain_id' | 'destination_channel_id' | 'destination_client_id' | 'destination_connection_id' | 'destination_port_id' | 'source_chain_id' | 'source_channel_id' | 'source_client_id' | 'source_connection_id' | 'source_port_id' | 'status' | 'version'; }; 'v1_ibc_union_channel_recommendations_stream_cursor_input': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_stream_cursor_input'; isOneOf: false; inputFields: [{ name: 'initial_value'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_stream_cursor_value_input'; ofType: null; }; }; defaultValue: null }, { name: 'ordering'; type: { kind: 'ENUM'; name: 'cursor_ordering'; ofType: null; }; defaultValue: null }]; }; - 'v1_ibc_union_channel_recommendations_stream_cursor_value_input': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_stream_cursor_value_input'; isOneOf: false; inputFields: [{ name: 'destination_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'destination_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'destination_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'destination_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'destination_port_id'; type: { kind: 'SCALAR'; name: 'bytea'; ofType: null; }; defaultValue: null }, { name: 'source_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'source_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'source_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'source_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'source_port_id'; type: { kind: 'SCALAR'; name: 'bytea'; ofType: null; }; defaultValue: null }, { name: 'status'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'version'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }]; }; + 'v1_ibc_union_channel_recommendations_stream_cursor_value_input': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channel_recommendations_stream_cursor_value_input'; isOneOf: false; inputFields: [{ name: 'destination_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'destination_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'destination_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'destination_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'destination_port_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'source_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'source_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'source_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'source_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; }; defaultValue: null }, { name: 'source_port_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'status'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }, { name: 'version'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; }; defaultValue: null }]; }; 'v1_ibc_union_channels': { kind: 'OBJECT'; name: 'v1_ibc_union_channels'; fields: { 'connection': { name: 'connection'; type: { kind: 'OBJECT'; name: 'v1_ibc_union_connections'; ofType: null; } }; 'destination_chain': { name: 'destination_chain'; type: { kind: 'OBJECT'; name: 'v1_ibc_union_chains'; ofType: null; } }; 'destination_chain_id': { name: 'destination_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'destination_channel_id': { name: 'destination_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_client_id': { name: 'destination_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_connection_id': { name: 'destination_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'destination_port_id': { name: 'destination_port_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'internal_source_chain_id': { name: 'internal_source_chain_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_chain': { name: 'source_chain'; type: { kind: 'OBJECT'; name: 'v1_ibc_union_chains'; ofType: null; } }; 'source_chain_id': { name: 'source_chain_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'source_channel_id': { name: 'source_channel_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_client_id': { name: 'source_client_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_connection_id': { name: 'source_connection_id'; type: { kind: 'SCALAR'; name: 'Int'; ofType: null; } }; 'source_port_id': { name: 'source_port_id'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'status': { name: 'status'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'version': { name: 'version'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; }; 'v1_ibc_union_channels_bool_exp': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channels_bool_exp'; isOneOf: false; inputFields: [{ name: '_and'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channels_bool_exp'; ofType: null; }; }; }; defaultValue: null }, { name: '_not'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channels_bool_exp'; ofType: null; }; defaultValue: null }, { name: '_or'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channels_bool_exp'; ofType: null; }; }; }; defaultValue: null }, { name: 'connection'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_connections_bool_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_bool_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_chain_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_channel_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_client_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_connection_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'destination_port_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'internal_source_chain_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_bool_exp'; ofType: null; }; defaultValue: null }, { name: 'source_chain_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_channel_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_client_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_connection_id'; type: { kind: 'INPUT_OBJECT'; name: 'Int_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'source_port_id'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'status'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }, { name: 'version'; type: { kind: 'INPUT_OBJECT'; name: 'String_comparison_exp'; ofType: null; }; defaultValue: null }]; }; 'v1_ibc_union_channels_order_by': { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_channels_order_by'; isOneOf: false; inputFields: [{ name: 'connection'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_connections_order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_chain_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_channel_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_client_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_connection_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'destination_port_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'internal_source_chain_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_chain'; type: { kind: 'INPUT_OBJECT'; name: 'v1_ibc_union_chains_order_by'; ofType: null; }; defaultValue: null }, { name: 'source_chain_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_channel_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_client_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_connection_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'source_port_id'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'status'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }, { name: 'version'; type: { kind: 'ENUM'; name: 'order_by'; ofType: null; }; defaultValue: null }]; }; From 721f6ecd4994949c351998a948438033eebe59fc Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 24 Jan 2025 12:30:13 +0000 Subject: [PATCH 12/13] chore(app): fmt --- app/src/lib/components/TransferFrom/index.svelte | 2 +- app/src/lib/components/TransferFrom/transfer/validation.ts | 3 +-- site/src/components/Footer.astro | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/lib/components/TransferFrom/index.svelte b/app/src/lib/components/TransferFrom/index.svelte index fe78064fab..af250fc50d 100644 --- a/app/src/lib/components/TransferFrom/index.svelte +++ b/app/src/lib/components/TransferFrom/index.svelte @@ -10,7 +10,7 @@ import Cube from "$lib/components/TransferFrom/components/Cube/index.svelte" import type { Chain, Ucs03Channel } from "$lib/types.ts" import { userBalancesQuery } from "$lib/queries/balance" import { userAddress, balanceStore } from "$lib/components/TransferFrom/transfer/balances.ts" -import { createRawIntentsStore } from "./transfer/raw-intents" +import { createRawIntentsStore } from "./transfer/raw-intents.ts" import { derived, writable, type Writable } from "svelte/store" import { getChannelInfo, getQuoteToken } from "@unionlabs/client" import { fromHex, isHex, toHex } from "viem" diff --git a/app/src/lib/components/TransferFrom/transfer/validation.ts b/app/src/lib/components/TransferFrom/transfer/validation.ts index 62e0e51cc5..e23f24bbd1 100644 --- a/app/src/lib/components/TransferFrom/transfer/validation.ts +++ b/app/src/lib/components/TransferFrom/transfer/validation.ts @@ -3,7 +3,7 @@ import { derived } from "svelte/store" import type { IntentsStore } from "./intents.ts" import type { Chain } from "$lib/types" import type { ContextStore } from "$lib/components/TransferFrom/transfer/context" -import { isHex, parseUnits } from "viem" +import { isHex } from "viem" import { evmChainId, aptosChainId, @@ -13,7 +13,6 @@ import { } from "@unionlabs/client" import type { FormFields, RawIntentsStore } from "$lib/components/TransferFrom/transfer/raw-intents" import { userAddrOnChain } from "$lib/utilities/address.ts" -import type { BalanceData } from "$lib/queries/balance" export type FieldErrors = Partial> diff --git a/site/src/components/Footer.astro b/site/src/components/Footer.astro index 099001f22f..b6dab76eae 100644 --- a/site/src/components/Footer.astro +++ b/site/src/components/Footer.astro @@ -107,7 +107,7 @@ function isInternal(menuItem: { url: string }): boolean { )) } - +

From 88bca05ab6edde41e21f69538f3ade7ef66e26e1 Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 24 Jan 2025 12:33:36 +0000 Subject: [PATCH 13/13] chore(app): fix npmDepsHash --- app/app.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.nix b/app/app.nix index 20d6377de0..71e147d40f 100644 --- a/app/app.nix +++ b/app/app.nix @@ -19,7 +19,7 @@ _: { { packages = { app = jsPkgs.buildNpmPackage { - npmDepsHash = "sha256-wv7rDDriwl2HnSk29N5xVIpM3i7YeJMsyNS/pptTfcA="; + npmDepsHash = "sha256-z5AN/oqJSY2R2wAQx4RooCG/7P6AY41hyfmeW3ytEGc="; src = ./.; sourceRoot = "app"; npmFlags = [