Merge pull request #201 from CosmWasm/implement-and-test-data-field

Add data field to PostTxsResponse
This commit is contained in:
Simon Warta 2020-06-09 11:19:10 +02:00 committed by GitHub
commit 56961f1bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View File

@ -15,7 +15,7 @@ import {
StdTx,
} from "@cosmjs/sdk38";
import { Sha256 } from "@iov/crypto";
import { fromAscii, fromBase64, fromHex, toAscii, toBase64, toHex } from "@iov/encoding";
import { Bech32, fromAscii, fromBase64, fromHex, toAscii, toBase64, toHex } from "@iov/encoding";
import { assert, sleep } from "@iov/utils";
import { ReadonlyDate } from "readonly-date";
@ -1148,6 +1148,7 @@ describe("RestClient", () => {
codeId = Number.parseInt(codeIdAttr.value, 10);
expect(codeId).toBeGreaterThanOrEqual(1);
expect(codeId).toBeLessThanOrEqual(200);
expect(result.data).toEqual(toHex(toAscii(`${codeId}`)).toUpperCase());
}
let contractAddress: string;
@ -1162,6 +1163,7 @@ describe("RestClient", () => {
contractAddress = contractAddressAttr.value;
const amountAttr = findAttribute(logs, "transfer", "amount");
expect(amountAttr.value).toEqual("1234ucosm,321ustake");
expect(result.data).toEqual(toHex(Bech32.decode(contractAddress).data).toUpperCase());
const balance = (await client.authAccounts(contractAddress)).result.value.coins;
expect(balance).toEqual(transferAmount);

File diff suppressed because one or more lines are too long

View File

@ -145,6 +145,12 @@ export interface PostTxsResponse {
readonly height: string;
readonly txhash: string;
readonly code?: number;
/**
* The result data of the execution (hex encoded).
*
* @see https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/types/result.go#L101
*/
readonly data?: string;
readonly raw_log?: string;
/** The same as `raw_log` but deserialized? */
readonly logs?: object;

View File

@ -111,6 +111,12 @@ export interface PostTxsResponse {
readonly height: string;
readonly txhash: string;
readonly code?: number;
/**
* The result data of the execution (hex encoded).
*
* @see https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/types/result.go#L101
*/
readonly data?: string;
readonly raw_log?: string;
/** The same as `raw_log` but deserialized? */
readonly logs?: object;