diff --git a/CHANGELOG.md b/CHANGELOG.md index 15a65711..90cf46dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,12 +16,16 @@ and this project adheres to query strings and key/value pairs are now supported. ([#1411]) - @cosmjs/cosmwasm-stargate: Let `searchTx` return non-readonly array. The caller owns this array and can mutate it as they want. ([#1411]) +- @cosmjs/cosmwasm-stargate: In `UploadResult` (result from + `SigningCosmWasmClient.upload`), rename `originalChecksum` to `checksum` and + remove `compressedChecksum` ([#1409]). - @cosmjs/stargate: Implement auto-detection for Tendermint 0.34/37 ([#1411]). - @cosmjs/stargate: Remove structured `searchTx` queries. Only raw query strings and key/value pairs are now supported. ([#1411]) - @cosmjs/stargate: Let `searchTx` return non-readonly array. The caller owns this array and can mutate it as they want. ([#1411]) +[#1409]: https://github.com/cosmos/cosmjs/issues/1409 [#1411]: https://github.com/cosmos/cosmjs/pull/1411 ## [0.30.1] - 2023-03-22 diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts index fac91980..22ae12b0 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts @@ -104,11 +104,13 @@ describe("SigningCosmWasmClient", () => { const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix }; const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options); const wasm = getHackatom().data; - const { codeId, originalChecksum, originalSize, compressedChecksum, compressedSize } = - await client.upload(alice.address0, wasm, defaultUploadFee); - expect(originalChecksum).toEqual(toHex(sha256(wasm))); + const { codeId, checksum, originalSize, compressedSize } = await client.upload( + alice.address0, + wasm, + defaultUploadFee, + ); + expect(checksum).toEqual(toHex(sha256(wasm))); expect(originalSize).toEqual(wasm.length); - expect(compressedChecksum).toMatch(/^[0-9a-f]{64}$/); expect(compressedSize).toBeLessThan(wasm.length * 0.5); expect(codeId).toBeGreaterThanOrEqual(1); client.disconnect(); diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts index 031107e2..0373ac3a 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts @@ -67,14 +67,12 @@ import { } from "./modules"; export interface UploadResult { + /** A hex encoded sha256 checksum of the original Wasm code (that is stored on chain) */ + readonly checksum: string; /** Size of the original wasm code in bytes */ readonly originalSize: number; - /** A hex encoded sha256 checksum of the original wasm code (that is stored on chain) */ - readonly originalChecksum: string; /** Size of the compressed wasm code in bytes */ readonly compressedSize: number; - /** A hex encoded sha256 checksum of the compressed wasm code (that stored in the transaction) */ - readonly compressedChecksum: string; /** The ID of the code asigned by the chain */ readonly codeId: number; readonly logs: readonly logs.Log[]; @@ -301,10 +299,9 @@ export class SigningCosmWasmClient extends CosmWasmClient { const parsedLogs = logs.parseRawLog(result.rawLog); const codeIdAttr = logs.findAttribute(parsedLogs, "store_code", "code_id"); return { + checksum: toHex(sha256(wasmCode)), originalSize: wasmCode.length, - originalChecksum: toHex(sha256(wasmCode)), compressedSize: compressed.length, - compressedChecksum: toHex(sha256(compressed)), codeId: Number.parseInt(codeIdAttr.value, 10), logs: parsedLogs, height: result.height,