From 1a014796df9839d29124ca24557fb192e7dc1db7 Mon Sep 17 00:00:00 2001 From: Thomas van Dam Date: Thu, 29 Aug 2024 11:20:27 +0200 Subject: [PATCH] chore(dev-tools): update wasm CLI to match new proto messages --- libs/dev-tools/src/cli/wasm/list.ts | 6 +++--- libs/dev-tools/src/cli/wasm/show.ts | 1 - libs/dev-tools/src/lib/services/signer.ts | 13 +++++++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/dev-tools/src/cli/wasm/list.ts b/libs/dev-tools/src/cli/wasm/list.ts index 69e849b..9aec9c2 100644 --- a/libs/dev-tools/src/cli/wasm/list.ts +++ b/libs/dev-tools/src/cli/wasm/list.ts @@ -20,9 +20,9 @@ list.action(async () => { const queryResult = await wasmQueryClient.DataRequestWasms({}); - const result = queryResult.hashTypePairs.map((hashTypePair) => { - const [hash, type] = hashTypePair.split(','); - return { hash, type }; + const result = queryResult.list.map((hashTypePair) => { + const [hash, expirationHeight] = hashTypePair.split(','); + return { hash, expirationHeight }; }); spinnerSuccess(); diff --git a/libs/dev-tools/src/cli/wasm/show.ts b/libs/dev-tools/src/cli/wasm/show.ts index 20fa420..680dbb2 100644 --- a/libs/dev-tools/src/cli/wasm/show.ts +++ b/libs/dev-tools/src/cli/wasm/show.ts @@ -40,7 +40,6 @@ show.action(async () => { hash, addedAt: wasm.addedAt, expirationHeight: wasm.expirationHeight, - wasmType: wasm.wasmType, }); }, Nothing() { diff --git a/libs/dev-tools/src/lib/services/signer.ts b/libs/dev-tools/src/lib/services/signer.ts index de2058b..c88fb0a 100644 --- a/libs/dev-tools/src/lib/services/signer.ts +++ b/libs/dev-tools/src/lib/services/signer.ts @@ -5,6 +5,7 @@ import { buildSigningConfig, } from './config'; import { createWasmQueryClient } from '@dev-tools/services/wasm/query-client'; +import { tryAsync } from '@dev-tools/utils/try-async'; const BECH32_ADDRESS_PREFIX = 'seda'; @@ -72,7 +73,15 @@ async function resolveCoreContractAddress(config: SigningConfig) { const queryClient = await createWasmQueryClient(config); - const response = await queryClient.CoreContractRegistry({}); + const response = await tryAsync(async () => + queryClient.CoreContractRegistry({}) + ); - return response.address; + if (response.isErr) { + throw Error( + 'No core contract set on chain. Please provide a SEDA_CORE_CONTRACT address manually.' + ); + } + + return response.value.address; }