Skip to content

Commit

Permalink
Make Cosmos REST client more uniform
Browse files Browse the repository at this point in the history
  • Loading branch information
willclarktech committed Oct 30, 2019
1 parent 6d6c83e commit a2d1e01
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/iov-cosmos/src/restclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ export class RestClient {

public async txsById(id: TransactionId): Promise<TxsResponse> {
const responseData = await this.get(`/txs/${id}`);
if (!(responseData as any).tx) {
throw new Error("Unexpected response data format");
}
return responseData as TxsResponse;
}

Expand All @@ -160,6 +163,9 @@ export class RestClient {
mode: this.mode,
};
const responseData = await this.post("/txs", params);
if (!(responseData as any).txhash) {
throw new Error("Unexpected response data format");
}
return responseData as PostTxsResponse;
}
}

0 comments on commit a2d1e01

Please sign in to comment.