Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
break
case "setScript":
res.script = t.setScript!.script == null ? null : base64Prefix(base64Encode(t.setScript!.script!.bytes!))
break
case "sponsorFee":
res.minSponsoredAssetFee = t.sponsorFee!.minFee!.amount!.toString()
res.assetId = base58Encode(t.sponsorFee!.minFee!.assetId!)
break
case "setAssetScript":
res.assetId = base58Encode(t.setAssetScript!.assetId!)
res.script = base64Prefix(base64Encode(t.setAssetScript!.script!.bytes!))
break
case "invokeScript":
res.dApp = recipientFromProto(t.invokeScript!.dApp!, t.chainId)
if (t.invokeScript!.functionCall! != null) {
res.call = binary.parserFromSchema(invokeScriptCallSchema)(t.invokeScript!.functionCall!).value //todo: export function call from marshall and use it directly
}
res.payment = t.invokeScript!.payments!.map(p => ({
amount: p.amount!.toString(),
assetId: p.assetId == null ? null : base58Encode(p.assetId)
}))
break
case 'updateAssetInfo':
res.assetId = base58Encode(t.updateAssetInfo!.assetId!)
res.name = t.updateAssetInfo!.name
res.description = t.updateAssetInfo!.description
break
default:
throw new Error(`Unsupported tx type ${t.data}`)
}
return res