通过API获取所有Corda帐户

时间:2020-01-14 11:38:12

标签: java kotlin 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 ]

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

1 个答案:

答案 0 :(得分:1)

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

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