corda / net.corda.core.messaging / CordaRPCOps

CordaRPCOps

interface CordaRPCOps : RPCOps

RPC operations that the node exposes to clients.

Properties

networkParameters

abstract val networkParameters: NetworkParameters

Returns the network parameters the node is operating under.

Inherited Properties

protocolVersion

abstract val protocolVersion: Int

Returns the RPC protocol version. Exists since version 0 so guaranteed to be present.

Functions

acceptNewNetworkParameters

abstract fun acceptNewNetworkParameters(parametersHash: SecureHash): Unit

Accept network parameters with given hash, hash is obtained through networkParametersFeed method. Information is sent back to the zone operator that the node accepted the parameters update - this process cannot be undone. Only parameters that are scheduled for update can be accepted, if different hash is provided this method will fail. Note: This operation may be restricted only to node administrators.

addVaultTransactionNote

abstract fun addVaultTransactionNote(txnId: SecureHash, txnNote: String): Unit

Add note(s) to an existing Vault transaction.

attachmentExists

abstract fun attachmentExists(id: SecureHash): Boolean

Checks whether an attachment with the given hash is stored on the node.

clearNetworkMapCache

abstract fun clearNetworkMapCache(): Unit

Clear all network map data from local node cache. Notice that after invoking this method your node will lose network map data and effectively won't be able to start any flow with the peers until network map is downloaded again on next poll - from additional-node-infos directory or from network map server. It depends on the polling interval when it happens. You can also use refreshNetworkMapCache to force next fetch from network map server (not from directory - it will happen automatically). If you run local test deployment and want clear view of the network, you may want to clear also additional-node-infos directory, because cache can be repopulated from there.

currentNodeTime

abstract fun currentNodeTime(): Instant

Returns the node's current time.

finishedFlowsWithClientIds

abstract fun finishedFlowsWithClientIds(): Map<String, Boolean>

Returns all finished flows that were started with a client ID for which the client ID mapping has not been removed. This version only returns the client ids for flows started by the same user currently calling finishedFlowsWithClientIds.

finishedFlowsWithClientIdsAsAdmin

abstract fun finishedFlowsWithClientIdsAsAdmin(): Map<String, Boolean>

Returns all finished flows that were started with a client id by all RPC users for which the client ID mapping has not been removed.

getVaultTransactionNotes

abstract fun getVaultTransactionNotes(txnId: SecureHash): Iterable<String>

Retrieve existing note(s) for a given Vault transaction.

isFlowsDrainingModeEnabled

abstract fun isFlowsDrainingModeEnabled(): Boolean

Returns whether the flows draining mode is enabled.

isWaitingForShutdown

abstract fun isWaitingForShutdown(): Boolean

Returns whether the node is waiting for pending flows to complete before shutting down. Disabling draining mode cancels this state.

killFlow

abstract fun killFlow(id: StateMachineRunId): Boolean

Attempts to kill a flow. This is not a clean termination and should be reserved for exceptional cases such as stuck fibers.

networkMapFeed

abstract fun networkMapFeed(): DataFeed<List<NodeInfo>, MapChange>

Returns all parties currently visible on the network with their advertised services and an observable of future updates to the network.

networkMapSnapshot

abstract fun networkMapSnapshot(): List<NodeInfo>

Returns all parties currently visible on the network with their advertised services.

networkParametersFeed

abstract fun networkParametersFeed(): DataFeed<ParametersUpdateInfo?, ParametersUpdateInfo>

Returns DataFeed object containing information on currently scheduled parameters update (null if none are currently scheduled) and observable with future update events. Any update that occurs before the deadline automatically cancels the current one. Only the latest update can be accepted. Note: This operation may be restricted only to node administrators.

nodeDiagnosticInfo

abstract fun nodeDiagnosticInfo(): NodeDiagnosticInfo

Returns Node's NodeDiagnosticInfo, including the version details as well as the information about installed CorDapps.

nodeInfo

abstract fun nodeInfo(): NodeInfo

Returns Node's NodeInfo, assuming this will not change while the node is running.

nodeInfoFromParty

abstract fun nodeInfoFromParty(party: AbstractParty): NodeInfo?

Returns a node's info from the network map cache, where known. Notice that when there are more than one node for a given name (in case of distributed services) first service node found will be returned.

notaryIdentities

abstract fun notaryIdentities(): List<Party>

Returns network's notary identities, assuming this will not change while the node is running.

notaryPartyFromX500Name

abstract fun notaryPartyFromX500Name(x500Name: CordaX500Name): Party?

Get a notary identity by name.

openAttachment

abstract fun openAttachment(id: SecureHash): InputStream

Download an attachment JAR by ID.

partiesFromName

abstract fun partiesFromName(query: String, exactMatch: Boolean): Set<Party>

Returns a list of candidate matches for a given string, with optional fuzzy(ish) matching. Fuzzy matching may get smarter with time e.g. to correct spelling errors, so you should not hard-code indexes into the results but rather show them via a user interface and let the user pick the one they wanted.

partyFromKey

abstract fun partyFromKey(key: PublicKey): Party?

Returns the Party corresponding to the given key, if found.

queryAttachments

abstract fun queryAttachments(query: AttachmentQueryCriteria, sorting: AttachmentSort?): List<AttachmentId>

Queries attachments metadata

reattachFlowWithClientId

abstract fun <T> reattachFlowWithClientId(clientId: String): FlowHandleWithClientId<T>?

Reattach to an existing flow that was started with startFlowDynamicWithClientId and has a clientId.

refreshNetworkMapCache

abstract fun refreshNetworkMapCache(): Unit

Poll network map server if available for the network map. Notice that you need to have compatibilityZone or networkServices configured. This is normally done automatically on the regular time interval, but you may wish to have the fresh view of network earlier.

registeredFlows

abstract fun registeredFlows(): List<String>

Enumerates the class names of the flows that this node knows about.

removeClientId

abstract fun removeClientId(clientId: String): Boolean

Removes a flow's clientId to result/ exception mapping. If the mapping is of a running flow, then the mapping will not get removed. This version will only remove flow's that were started by the same user currently calling removeClientId.

removeClientIdAsAdmin

abstract fun removeClientIdAsAdmin(clientId: String): Boolean

Removes a flow's clientId to result/ exception mapping. If the mapping is of a running flow, then the mapping will not get removed. This version can be called for all client ids, ignoring which user originally started a flow with clientId.

setFlowsDrainingModeEnabled

abstract fun setFlowsDrainingModeEnabled(enabled: Boolean): Unit

Sets the value of the node's flows draining mode. If this mode is enabled, the node will reject new flows through RPC, ignore scheduled flows, and do not process initial session messages, meaning that P2P counterparties will not be able to initiate new flows involving the node.

shutdown

abstract fun shutdown(): Unit

Shuts the node down. Returns immediately. This does not wait for flows to be completed.

startFlowDynamic

abstract fun <T> startFlowDynamic(logicType: Class<out FlowLogic<T>>, vararg args: Any?): FlowHandle<T>

Start the given flow with the given arguments. logicType must be annotated with net.corda.core.flows.StartableByRPC.

startFlowDynamicWithClientId

abstract fun <T> startFlowDynamicWithClientId(clientId: String, logicType: Class<out FlowLogic<T>>, vararg args: Any?): FlowHandleWithClientId<T>

Start the given flow with the given arguments and a clientId.

startTrackedFlowDynamic

abstract fun <T> startTrackedFlowDynamic(logicType: Class<out FlowLogic<T>>, vararg args: Any?): FlowProgressHandle<T>

Start the given flow with the given arguments, returning an Observable with a single observation of the result of running the flow. logicType must be annotated with net.corda.core.flows.StartableByRPC.

stateMachineRecordedTransactionMappingFeed

abstract fun stateMachineRecordedTransactionMappingFeed(): DataFeed<List<StateMachineTransactionMapping>, StateMachineTransactionMapping>

Returns a snapshot list of existing state machine id - recorded transaction hash mappings, and a stream of future such mappings as well.

stateMachineRecordedTransactionMappingSnapshot

abstract fun stateMachineRecordedTransactionMappingSnapshot(): List<StateMachineTransactionMapping>

Returns a snapshot list of existing state machine id - recorded transaction hash mappings.

stateMachinesFeed

abstract fun stateMachinesFeed(): DataFeed<List<StateMachineInfo>, StateMachineUpdate>

Returns a data feed of currently in-progress state machine infos and an observable of future state machine adds/removes.

stateMachinesSnapshot

abstract fun stateMachinesSnapshot(): List<StateMachineInfo>

Returns a list of currently in-progress state machine infos.

terminate

abstract fun terminate(drainPendingFlows: Boolean = false): Unit

Shuts the node down. Returns immediately.

uploadAttachment

abstract fun uploadAttachment(jar: InputStream): SecureHash

Uploads a jar to the node, returns it's hash.

uploadAttachmentWithMetadata

abstract fun uploadAttachmentWithMetadata(jar: InputStream, uploader: String, filename: String): SecureHash

Uploads a jar including metadata to the node, returns it's hash.

vaultQuery

abstract fun <T : ContractState> vaultQuery(contractStateType: Class<out T>): Page<T>

vaultQueryBy

abstract fun <T : ContractState> vaultQueryBy(criteria: QueryCriteria, paging: PageSpecification, sorting: Sort, contractStateType: Class<out T>): Page<T>

Returns a snapshot of vault states for a given query criteria (and optional order and paging specification)

vaultQueryByCriteria

abstract fun <T : ContractState> vaultQueryByCriteria(criteria: QueryCriteria, contractStateType: Class<out T>): Page<T>

vaultQueryByWithPagingSpec

abstract fun <T : ContractState> vaultQueryByWithPagingSpec(contractStateType: Class<out T>, criteria: QueryCriteria, paging: PageSpecification): Page<T>

vaultQueryByWithSorting

abstract fun <T : ContractState> vaultQueryByWithSorting(contractStateType: Class<out T>, criteria: QueryCriteria, sorting: Sort): Page<T>

vaultTrack

abstract fun <T : ContractState> vaultTrack(contractStateType: Class<out T>): DataFeed<Page<T>, Update<T>>

vaultTrackBy

abstract fun <T : ContractState> vaultTrackBy(criteria: QueryCriteria, paging: PageSpecification, sorting: Sort, contractStateType: Class<out T>): DataFeed<Page<T>, Update<T>>

Returns a snapshot (as per queryBy) and an observable of future updates to the vault for the given query criteria.

vaultTrackByCriteria

abstract fun <T : ContractState> vaultTrackByCriteria(contractStateType: Class<out T>, criteria: QueryCriteria): DataFeed<Page<T>, Update<T>>

vaultTrackByWithPagingSpec

abstract fun <T : ContractState> vaultTrackByWithPagingSpec(contractStateType: Class<out T>, criteria: QueryCriteria, paging: PageSpecification): DataFeed<Page<T>, Update<T>>

vaultTrackByWithSorting

abstract fun <T : ContractState> vaultTrackByWithSorting(contractStateType: Class<out T>, criteria: QueryCriteria, sorting: Sort): DataFeed<Page<T>, Update<T>>

waitUntilNetworkReady

abstract fun waitUntilNetworkReady(): CordaFuture<Void?>

Returns a CordaFuture which completes when the node has registered wih the network map service. It can also complete with an exception if it is unable to.

wellKnownPartyFromAnonymous

abstract fun wellKnownPartyFromAnonymous(party: AbstractParty): Party?

Returns the well known identity from an abstract party. This is intended to resolve the well known identity from a confidential identity, however it transparently handles returning the well known identity back if a well known identity is passed in.

wellKnownPartyFromX500Name

abstract fun wellKnownPartyFromX500Name(x500Name: CordaX500Name): Party?

Returns the Party with the X.500 principal as it's Party.name.

Extension Functions

contextLogger

fun Any.contextLogger(): <ERROR CLASS>

When called from a companion object, returns the logger for the enclosing class.

getCashBalance

fun CordaRPCOps.getCashBalance(currency: Currency): Amount<Currency>

getCashBalances

fun CordaRPCOps.getCashBalances(): Map<Currency, Amount<Currency>>

pendingFlowsCount

fun CordaRPCOps.pendingFlowsCount(): DataFeed<Int, <ERROR CLASS><Int, Int>>

Returns a DataFeed of the number of pending flows. The Observable for the updates will complete the moment all pending flows will have terminated.

startFlow

fun <T, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: () -> R): FlowHandle<T>
fun <T, A, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: (A) -> R, arg0: A): FlowHandle<T>
fun <T, A, B, C, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: (A, B, C) -> R, arg0: A, arg1: B, arg2: C): FlowHandle<T>
fun <T, A, B, C, D, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: (A, B, C, D) -> R, arg0: A, arg1: B, arg2: C, arg3: D): FlowHandle<T>
fun <T, A, B, C, D, E, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: (A, B, C, D, E) -> R, arg0: A, arg1: B, arg2: C, arg3: D, arg4: E): FlowHandle<T>
fun <T, A, B, C, D, E, F, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: (A, B, C, D, E, F) -> R, arg0: A, arg1: B, arg2: C, arg3: D, arg4: E, arg5: F): FlowHandle<T>fun <T, A, B, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: (A, B) -> R, arg0: A, arg1: B): FlowHandle<T>

Extension function for type safe invocation of flows from Kotlin, for example:

startFlowWithClientId

fun <T, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: () -> R): FlowHandleWithClientId<T>

Extension function for type safe invocation of flows from Kotlin, with clientId.

fun <T, A, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: (A) -> R, arg0: A): FlowHandleWithClientId<T>
fun <T, A, B, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: (A, B) -> R, arg0: A, arg1: B): FlowHandleWithClientId<T>
fun <T, A, B, C, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: (A, B, C) -> R, arg0: A, arg1: B, arg2: C): FlowHandleWithClientId<T>
fun <T, A, B, C, D, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: (A, B, C, D) -> R, arg0: A, arg1: B, arg2: C, arg3: D): FlowHandleWithClientId<T>
fun <T, A, B, C, D, E, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: (A, B, C, D, E) -> R, arg0: A, arg1: B, arg2: C, arg3: D, arg4: E): FlowHandleWithClientId<T>
fun <T, A, B, C, D, E, F, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: (A, B, C, D, E, F) -> R, arg0: A, arg1: B, arg2: C, arg3: D, arg4: E, arg5: F): FlowHandleWithClientId<T>

startTrackedFlow

fun <T, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: () -> R): FlowProgressHandle<T>

Extension function for type safe invocation of flows from Kotlin, with progress tracking enabled.

fun <T, A, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: (A) -> R, arg0: A): FlowProgressHandle<T>
fun <T, A, B, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: (A, B) -> R, arg0: A, arg1: B): FlowProgressHandle<T>
fun <T, A, B, C, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: (A, B, C) -> R, arg0: A, arg1: B, arg2: C): FlowProgressHandle<T>
fun <T, A, B, C, D, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: (A, B, C, D) -> R, arg0: A, arg1: B, arg2: C, arg3: D): FlowProgressHandle<T>
fun <T, A, B, C, D, E, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: (A, B, C, D, E) -> R, arg0: A, arg1: B, arg2: C, arg3: D, arg4: E): FlowProgressHandle<T>
fun <T, A, B, C, D, E, F, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: (A, B, C, D, E, F) -> R, arg0: A, arg1: B, arg2: C, arg3: D, arg4: E, arg5: F): FlowProgressHandle<T>

vaultQueryBy

fun <T : ContractState> CordaRPCOps.vaultQueryBy(criteria: QueryCriteria = QueryCriteria.VaultQueryCriteria(), paging: PageSpecification = PageSpecification(), sorting: Sort = Sort(emptySet())): Page<T>

vaultTrackBy

fun <T : ContractState> CordaRPCOps.vaultTrackBy(criteria: QueryCriteria = QueryCriteria.VaultQueryCriteria(), paging: PageSpecification = PageSpecification(), sorting: Sort = Sort(emptySet())): DataFeed<Page<T>, Update<T>>