Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return transport.lockDuring(async () => {
const signTx = new CosmosSignTx()
signTx.setAddressNList(msg.addressNList)
signTx.setAccountNumber(msg.account_number)
signTx.setChainId(msg.chain_id)
signTx.setFeeAmount(parseInt(msg.tx.value.fee.amount[0].amount))
signTx.setGas(parseInt(msg.tx.value.fee.gas))
signTx.setSequence(msg.sequence)
if (msg.tx.value.memo !== undefined) signTx.setMemo(msg.tx.value.memo)
signTx.setMsgCount(msg.tx.value.msg.length)
let resp = await transport.call(MessageType.MESSAGETYPE_COSMOSSIGNTX, signTx, Core.LONG_TIMEOUT, /*omitLock=*/true)
if (resp.message_type === Core.Events.FAILURE) throw resp
for (let m of msg.tx.value.msg) {
if (resp.message_enum !== MessageType.MESSAGETYPE_COSMOSMSGREQUEST) {
throw new Error(`cosmos: unexpected response ${resp.message_type}`)