diff --git a/docs/developer-docs/docs/learn/warden-protocol-modules/external-modules.md b/docs/developer-docs/docs/learn/warden-protocol-modules/external-modules.md index f0e9bf028..41edab177 100644 --- a/docs/developer-docs/docs/learn/warden-protocol-modules/external-modules.md +++ b/docs/developer-docs/docs/learn/warden-protocol-modules/external-modules.md @@ -33,11 +33,11 @@ To learn more, see the following: ## x/oracle -The `x/oracle` module is a Cosmos SDK module by **Skip Protocol** that enables storing prices on-chain in **Slinky** (an oracle service). +The `x/oracle` module is a Cosmos SDK module by **Skip Protocol** that enables storing prices on-chain in **Skip:Connect** (an oracle service). To learn more, see the following: -- [Slinky documentation](https://docs.skip.money/slinky/overview) +- [Connect documentation](https://docs.skip.build/connect/introduction) - [`x/oracle` on GitHub](https://github.com/skip-mev/slinky/tree/main/x/oracle) - [Warden docs: Oracle services](/learn/oracle-services) diff --git a/docs/developer-docs/docs/operate-a-node/run-a-local-chain.md b/docs/developer-docs/docs/operate-a-node/run-a-local-chain.md index 3b642e268..83a6b0dbb 100644 --- a/docs/developer-docs/docs/operate-a-node/run-a-local-chain.md +++ b/docs/developer-docs/docs/operate-a-node/run-a-local-chain.md @@ -244,7 +244,7 @@ In the previous steps, you configured your node with the minimum settings requir #### Create a Keychain -1. While the node is running, execute the command below in a separate terminal window. Specify a custom keychain description, your key name, and the chain ID: +1. While the node is running, execute the command below in a separate terminal window. Specify a custom keychain description, your key name and the chain ID: ```bash wardend tx warden new-keychain \ @@ -279,7 +279,7 @@ In the previous steps, you configured your node with the minimum settings requir #### Create a Space -1. To create a Space, run the following command. Specify your key name, and the chain ID: +1. To create a Space, run the following command. Specify your key name and the chain ID: ```bash wardend tx warden new-space \ @@ -295,7 +295,7 @@ In the previous steps, you configured your node with the minimum settings requir wardend query warden spaces ``` - The output should look like this:: + The output should look like this: ```bash pagination: diff --git a/spaceward/src/features/actions/StatusSidebar.tsx b/spaceward/src/features/actions/StatusSidebar.tsx index 43d660923..5bbdde3c7 100644 --- a/spaceward/src/features/actions/StatusSidebar.tsx +++ b/spaceward/src/features/actions/StatusSidebar.tsx @@ -1,6 +1,6 @@ import clsx from "clsx"; import { useContext, useEffect, useRef, useState } from "react"; -import { isDeliverTxSuccess } from "@cosmjs/stargate"; +import { DeliverTxResponse, isDeliverTxSuccess } from "@cosmjs/stargate"; import { useChain, walletContext } from "@cosmos-kit/react-lite"; import { cosmos, warden } from "@wardenprotocol/wardenjs"; import { Action, ActionStatus } from "@wardenprotocol/wardenjs/codegen/warden/act/v1beta1/action"; @@ -45,6 +45,21 @@ const waitForVisibility = () => { }); }; +class DetailedError extends Error { + constructor(message: string, public detail: T) { + super(message); + } +} + +function isDetailedError(e?: unknown): e is DetailedError { + if (!e) { + return false; + } + + return "detail" in (e as {}); +} + + function ActionItem({ single, ...item }: ItemProps) { const queryClient = useQueryClient(); const { walletManager } = useContext(walletContext); @@ -88,32 +103,51 @@ function ActionItem({ single, ...item }: ItemProps) { const signer = getOfflineSigner(); const client = await getSigningClient(signer); const txRaw = cosmos.tx.v1beta1.TxRaw.encode(item.txRaw); - const res = await client.broadcastTx(Uint8Array.from(txRaw.finish())); + try { + const res = await client.broadcastTx(Uint8Array.from(txRaw.finish())); - if (isDeliverTxSuccess(res)) { - setData({ - [item.id]: { - ...item, - status: QueuedActionStatus.Broadcast, - response: res, - }, - }); - } else { - console.error("Failed to broadcast", res); + if (isDeliverTxSuccess(res)) { + setData({ + [item.id]: { + ...item, + status: QueuedActionStatus.Broadcast, + response: res, + }, + }); + } else { + console.error("Failed to broadcast", res); + throw new DetailedError("Could not broadcast transaction", res); - toast({ - title: "Failed", - description: "Could not broadcast transaction", - duration: 10000, - }); + } + } catch (e) { + if (isDetailedError(e)) { + toast({ + title: "Failed", + description: "Could not broadcast transaction", + duration: 10000, + }); - setData({ - [item.id]: { - ...item, - status: QueuedActionStatus.Failed, - response: res, - }, - }); + setData({ + [item.id]: { + ...item, + status: QueuedActionStatus.Failed, + response: e.detail, + }, + }); + } else { + toast({ + title: "Failed", + description: (e as Error)?.message ?? "Unexpected error", + duration: 10000, + }); + + setData({ + [item.id]: { + ...item, + status: QueuedActionStatus.Failed, + }, + }); + } } break; diff --git a/spaceward/src/lib/datetime.ts b/spaceward/src/lib/datetime.ts index 8933657db..f530aeacc 100644 --- a/spaceward/src/lib/datetime.ts +++ b/spaceward/src/lib/datetime.ts @@ -1,10 +1,13 @@ -import { Timestamp } from '@wardenprotocol/wardenjs/codegen/google/protobuf/timestamp'; -import dayjs from 'dayjs'; +import { Timestamp } from "@wardenprotocol/wardenjs/codegen/google/protobuf/timestamp"; +import dayjs from "dayjs"; export const formatDateTime = (date: Timestamp) => { - return dayjs(timestampToDate(date)).format('DD/MM/YYYY HH:mm:ss'); -} + return dayjs(timestampToDate(date)).format("DD/MM/YYYY HH:mm:ss"); +}; export function timestampToDate(timestamp: Timestamp): Date { - return new Date(Number(timestamp.seconds) * 1000 + Number(timestamp.nanos) / 1000); + return new Date( + Number(timestamp.seconds) * 1000 + + Math.floor(Number(timestamp.nanos) / 1e6), + ); }