mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
Merge pull request #201 from CosmWasm/implement-and-test-data-field
Add data field to PostTxsResponse
This commit is contained in:
commit
56961f1bb2
@ -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);
|
||||
|
4
packages/cosmwasm/src/testdata/contract.json
vendored
4
packages/cosmwasm/src/testdata/contract.json
vendored
File diff suppressed because one or more lines are too long
@ -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;
|
||||
|
6
packages/sdk38/types/restclient.d.ts
vendored
6
packages/sdk38/types/restclient.d.ts
vendored
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user