mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 13:47:12 +00:00
Fix key/value types in RpcAbciQueryResponse
This commit is contained in:
parent
92ee134a12
commit
a78a5dfdc5
@ -25,6 +25,8 @@ and this project adheres to
|
||||
- @cosmjs/tendermint-rpc: Fix decoding validator updates due to slashing
|
||||
([#1177]).
|
||||
- @cosmjs/math: Check for negative values in `Decimal.fromAtomics` ([#1188]).
|
||||
- @cosmjs/tendermint-rpc: Fix `key` and `value` type in `RpcAbciQueryResponse`
|
||||
to also include the `null` option.
|
||||
|
||||
[#1170]: https://github.com/cosmos/cosmjs/issues/1170
|
||||
[#1177]: https://github.com/cosmos/cosmjs/issues/1177
|
||||
|
@ -68,10 +68,20 @@ function decodeQueryProof(data: RpcQueryProof): responses.QueryProof {
|
||||
}
|
||||
|
||||
interface RpcAbciQueryResponse {
|
||||
/** base64 encoded */
|
||||
readonly key: string;
|
||||
/** base64 encoded */
|
||||
readonly value?: string;
|
||||
/**
|
||||
* Base64 encoded
|
||||
*
|
||||
* This can be null since this iy a byte slice and due to
|
||||
* https://github.com/tendermint/tendermint/blob/v0.34.19/abci/types/result.go#L50
|
||||
*/
|
||||
readonly key?: string | null;
|
||||
/**
|
||||
* Base64 encoded
|
||||
*
|
||||
* This can be null since this is a byte slice and due to
|
||||
* https://github.com/tendermint/tendermint/blob/v0.34.19/abci/types/result.go#L50
|
||||
*/
|
||||
readonly value?: string | null;
|
||||
readonly proofOps?: RpcQueryProof | null;
|
||||
readonly height?: string;
|
||||
/** An integer; can be negative */
|
||||
@ -84,8 +94,8 @@ interface RpcAbciQueryResponse {
|
||||
|
||||
function decodeAbciQuery(data: RpcAbciQueryResponse): responses.AbciQueryResponse {
|
||||
return {
|
||||
key: fromBase64(optional(data.key, "")),
|
||||
value: fromBase64(optional(data.value, "")),
|
||||
key: fromBase64(assertString(data.key ?? "")),
|
||||
value: fromBase64(assertString(data.value ?? "")),
|
||||
proof: may(decodeQueryProof, data.proofOps),
|
||||
height: may(Integer.parse, data.height),
|
||||
code: may(Integer.parse, data.code),
|
||||
|
@ -68,10 +68,20 @@ function decodeQueryProof(data: RpcQueryProof): responses.QueryProof {
|
||||
}
|
||||
|
||||
interface RpcAbciQueryResponse {
|
||||
/** base64 encoded */
|
||||
readonly key: string;
|
||||
/** base64 encoded */
|
||||
readonly value?: string;
|
||||
/**
|
||||
* Base64 encoded
|
||||
*
|
||||
* This can be null since this is a byte slice and due to
|
||||
* https://github.com/tendermint/tendermint/blob/v0.35.7/abci/types/result.go#L53
|
||||
*/
|
||||
readonly key?: string | null;
|
||||
/**
|
||||
* Base64 encoded
|
||||
*
|
||||
* This can be null since this is a byte slice and due to
|
||||
* https://github.com/tendermint/tendermint/blob/v0.35.7/abci/types/result.go#L53
|
||||
*/
|
||||
readonly value?: string | null;
|
||||
readonly proofOps?: RpcQueryProof | null;
|
||||
readonly height?: string;
|
||||
readonly index?: string;
|
||||
@ -83,8 +93,8 @@ interface RpcAbciQueryResponse {
|
||||
|
||||
function decodeAbciQuery(data: RpcAbciQueryResponse): responses.AbciQueryResponse {
|
||||
return {
|
||||
key: fromBase64(optional(data.key, "")),
|
||||
value: fromBase64(optional(data.value, "")),
|
||||
key: fromBase64(assertString(data.key ?? "")),
|
||||
value: fromBase64(assertString(data.value ?? "")),
|
||||
proof: may(decodeQueryProof, data.proofOps),
|
||||
height: may(Integer.parse, data.height),
|
||||
code: may(Integer.parse, data.code),
|
||||
|
Loading…
x
Reference in New Issue
Block a user