首页 > 解决方案 > 通过API获取所有corda账号

问题描述

我正在尝试获取某个节点上可用的所有帐户。

我正在使用以下代码:

    @RequestMapping("/accounts/all", method = [RequestMethod.GET])
    fun allKnownAccounts(): List<AccountInfoView> {
      return getAllAccounts().map { it.toAccountView() }
    }

    private fun getAllAccounts() = rpc.proxy.startFlowDynamic(AllAccounts::class.java, false).returnValue.get()

但我收到以下错误

出现意外错误(类型=内部服务器错误,状态=500)。net.corda.core.flows.IllegalFlowLogicException:无法为 com.r3.corda.lib.accounts.workflows.flows.AllAccounts 类型的 FlowLogic 构造 FlowLogicRef:由于与构造函数的匹配不明确:[class java.lang.Boolean ]

我不确定是什么导致异常发生。谢谢大家的帮助。

标签: javakotlincorda

解决方案


该问题已通过将 getAllAccounts() 函数更新为以下内容得到解决:

    private fun getAllAccounts() = rpc.proxy.startFlowDynamic(AllAccounts::class.java).returnValue.get()

推荐阅读