UNPKG

@kubiklabs/wasmkit

Version:

Wasmkit is a development environment to compile, deploy, test, run cosmwasm contracts on different networks.

30 lines (29 loc) 905 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLogs = void 0; // Parses the response from contract query, init, deploy or execute // and returns logs as a {key: value} object function getLogs(response // eslint-disable-line @typescript-eslint/no-explicit-any ) { const logs = {}; for (const log of response.logs[0].events[1].attributes) { if (log.key in logs) { const presentVal = logs[log.key]; let newVal = []; if (Array.isArray(presentVal)) { newVal = presentVal; newVal.push(log.value); } else { newVal.push(presentVal); newVal.push(log.val); } logs[log.key] = newVal; } else { logs[log.key] = log.value; } } return logs; } exports.getLogs = getLogs;