mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
stargate: Add logs helper
This commit is contained in:
parent
879a733b5b
commit
4b35668981
@ -1,5 +1,6 @@
|
||||
export * as codec from "./codec";
|
||||
export { getMsgType, getMsgTypeUrl } from "./encoding";
|
||||
export { parseRawLog } from "./logs";
|
||||
export {
|
||||
AuthExtension,
|
||||
BankExtension,
|
||||
|
11
packages/stargate/src/logs.ts
Normal file
11
packages/stargate/src/logs.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { logs } from "@cosmjs/launchpad";
|
||||
|
||||
export function parseRawLog(input = "[]"): readonly logs.Log[] {
|
||||
const logsToParse = JSON.parse(input).map(({ events }: { events: readonly unknown[] }, i: number) => ({
|
||||
msg_index: i,
|
||||
events,
|
||||
log: "",
|
||||
}));
|
||||
return logs.parseLogs(logsToParse);
|
||||
}
|
1
packages/stargate/types/index.d.ts
vendored
1
packages/stargate/types/index.d.ts
vendored
@ -1,5 +1,6 @@
|
||||
export * as codec from "./codec";
|
||||
export { getMsgType, getMsgTypeUrl } from "./encoding";
|
||||
export { parseRawLog } from "./logs";
|
||||
export {
|
||||
AuthExtension,
|
||||
BankExtension,
|
||||
|
2
packages/stargate/types/logs.d.ts
vendored
Normal file
2
packages/stargate/types/logs.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import { logs } from "@cosmjs/launchpad";
|
||||
export declare function parseRawLog(input?: string): readonly logs.Log[];
|
Loading…
x
Reference in New Issue
Block a user