From 6ec6994a792d3f5e4a78ab9b64dec9ec62d9a9c4 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Thu, 22 Jul 2021 11:23:11 +0200 Subject: [PATCH] Copy Code and CodeDetails --- .../cosmwasm-launchpad/src/cosmwasmclient.ts | 2 +- .../src/cosmwasmclient.spec.ts | 3 +- .../cosmwasm-stargate/src/cosmwasmclient.ts | 36 ++++++++++++++----- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/cosmwasm-launchpad/src/cosmwasmclient.ts b/packages/cosmwasm-launchpad/src/cosmwasmclient.ts index 1f7324e1a8..3915971bd2 100644 --- a/packages/cosmwasm-launchpad/src/cosmwasmclient.ts +++ b/packages/cosmwasm-launchpad/src/cosmwasmclient.ts @@ -95,7 +95,7 @@ export interface Code { } export interface CodeDetails extends Code { - /** The original wasm bytes */ + /** The original Wasm bytes */ readonly data: Uint8Array; } diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts index 3092ded539..8364770576 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts @@ -1,5 +1,4 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { Code } from "@cosmjs/cosmwasm-launchpad"; import { sha256 } from "@cosmjs/crypto"; import { fromAscii, fromBase64, fromHex, toAscii } from "@cosmjs/encoding"; import { Int53 } from "@cosmjs/math"; @@ -16,7 +15,7 @@ import { assert, sleep } from "@cosmjs/utils"; import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx"; import { ReadonlyDate } from "readonly-date"; -import { CosmWasmClient, PrivateCosmWasmClient } from "./cosmwasmclient"; +import { Code, CosmWasmClient, PrivateCosmWasmClient } from "./cosmwasmclient"; import { SigningCosmWasmClient } from "./signingcosmwasmclient"; import { alice, diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index 147ead52af..5e04ba051d 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -1,11 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { - Code, - CodeDetails, - Contract, - ContractCodeHistoryEntry, - JsonObject, -} from "@cosmjs/cosmwasm-launchpad"; +import { Contract, ContractCodeHistoryEntry, JsonObject } from "@cosmjs/cosmwasm-launchpad"; import { fromAscii, toHex } from "@cosmjs/encoding"; import { Uint53 } from "@cosmjs/math"; import { @@ -38,13 +32,37 @@ import { setupWasmExtension, WasmExtension } from "./queries"; // Those types can be copied over to allow them to evolve independently of @cosmjs/cosmwasm-launchpad. // For now just re-export them such that they can be imported via @cosmjs/cosmwasm-stargate. export { - Code, // returned by CosmWasmClient.getCode - CodeDetails, // returned by CosmWasmClient.getCodeDetails Contract, // returned by CosmWasmClient.getContract ContractCodeHistoryEntry, // returned by CosmWasmClient.getContractCodeHistory JsonObject, // returned by CosmWasmClient.queryContractSmart }; +export interface Code { + readonly id: number; + /** Bech32 account address */ + readonly creator: string; + /** Hex-encoded sha256 hash of the code stored here */ + readonly checksum: string; + /** + * An URL to a .tar.gz archive of the source code of the contract, which can be used to reproducibly build the Wasm bytecode. + * + * @see https://github.com/CosmWasm/cosmwasm-verify + */ + readonly source?: string; + /** + * A docker image (including version) to reproducibly build the Wasm bytecode from the source code. + * + * @example ```cosmwasm/rust-optimizer:0.8.0``` + * @see https://github.com/CosmWasm/cosmwasm-verify + */ + readonly builder?: string; +} + +export interface CodeDetails extends Code { + /** The original Wasm bytes */ + readonly data: Uint8Array; +} + /** Use for testing only */ export interface PrivateCosmWasmClient { readonly tmClient: Tendermint34Client | undefined;