Let parseRawLog gracefully handle empty strings
This commit is contained in:
parent
188bb1ff3f
commit
874612b0df
@ -19,6 +19,11 @@ and this project adheres to
|
||||
import { parseCoins } from "@cosmjs/amino";
|
||||
```
|
||||
|
||||
- @cosmjs/stargate: Let `parseRawLog` gracefully handle empty strings to better
|
||||
support Cosmos SDK 0.50 inputs. ([#1564])
|
||||
|
||||
[#1564]: https://github.com/cosmos/cosmjs/pull/1564
|
||||
|
||||
### Fixed
|
||||
|
||||
- @cosmjs/encoding: Avoid using replacement character in doc comment to make
|
||||
|
||||
@ -54,7 +54,10 @@ export function parseLogs(input: unknown): readonly Log[] {
|
||||
return input.map(parseLog);
|
||||
}
|
||||
|
||||
export function parseRawLog(input = "[]"): readonly Log[] {
|
||||
export function parseRawLog(input: string | undefined): readonly Log[] {
|
||||
// Cosmos SDK >= 0.50 gives us an empty string here. This should be handled like undefined.
|
||||
if (!input) return [];
|
||||
|
||||
const logsToParse = JSON.parse(input).map(({ events }: { events: readonly unknown[] }, i: number) => ({
|
||||
msg_index: i,
|
||||
events,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user