From 0031d6860d7cf8f8ee032ad683ad072f642c4750 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 3 Feb 2020 21:31:46 +0100 Subject: [PATCH] Fix encodeTx implementation, Connection.identifier now works --- packages/sdk/src/restclient.ts | 3 ++- packages/sdk/types/restclient.d.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/sdk/src/restclient.ts b/packages/sdk/src/restclient.ts index e3794ee1..b89e7fcb 100644 --- a/packages/sdk/src/restclient.ts +++ b/packages/sdk/src/restclient.ts @@ -140,7 +140,8 @@ export class RestClient { } // encodeTx returns the amino-encoding of the transaction - public async encodeTx(tx: StdTx): Promise { + public async encodeTx(stdTx: StdTx): Promise { + const tx = {"type": "cosmos-sdk/StdTx", "value": stdTx}; const responseData = await this.post("/txs/encode", tx); if (!(responseData as any).tx) { throw new Error("Unexpected response data format"); diff --git a/packages/sdk/types/restclient.d.ts b/packages/sdk/types/restclient.d.ts index 02c0fa53..b818be1e 100644 --- a/packages/sdk/types/restclient.d.ts +++ b/packages/sdk/types/restclient.d.ts @@ -71,7 +71,7 @@ export declare class RestClient { nodeInfo(): Promise; blocksLatest(): Promise; blocks(height: number): Promise; - encodeTx(tx: StdTx): Promise; + encodeTx(stdTx: StdTx): Promise; authAccounts(address: string, height?: string): Promise; txs(query: string): Promise; txsById(id: string): Promise;