corda / net.corda.core.messaging / CordaRPCOps

CordaRPCOps

interface CordaRPCOps : RPCOps

RPC operations that the node exposes to clients.

Properties

networkParameters

Returns the network parameters the node is operating under.

abstract val networkParameters: NetworkParameters

Functions

acceptNewNetworkParameters

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.

abstract fun acceptNewNetworkParameters(parametersHash: SecureHash): Unit

addVaultTransactionNote

Add note(s) to an existing Vault transaction.

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

attachmentExists

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

abstract fun attachmentExists(id: SecureHash): Boolean

clearNetworkMapCache

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.

abstract fun clearNetworkMapCache(): Unit

currentNodeTime

Returns the node's current time.

abstract fun currentNodeTime(): Instant

finishedFlowsWithClientIds

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.

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

finishedFlowsWithClientIdsAsAdmin

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.

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

getVaultTransactionNotes

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

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

isFlowsDrainingModeEnabled

Returns whether the flows draining mode is enabled.

abstract fun isFlowsDrainingModeEnabled(): Boolean

isWaitingForShutdown

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

abstract fun isWaitingForShutdown(): Boolean

killFlow

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

abstract fun killFlow(id: StateMachineRunId): Boolean

networkMapFeed

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

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

networkMapSnapshot

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

abstract fun networkMapSnapshot(): List<NodeInfo>

networkParametersFeed

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.

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

nodeDiagnosticInfo

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

abstract fun nodeDiagnosticInfo(): NodeDiagnosticInfo

nodeInfo

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

abstract fun nodeInfo(): NodeInfo

nodeInfoFromParty

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.

abstract fun nodeInfoFromParty(party: AbstractParty): NodeInfo?

notaryIdentities

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

abstract fun notaryIdentities(): List<Party>

notaryPartyFromX500Name

Get a notary identity by name.

abstract fun notaryPartyFromX500Name(x500Name: CordaX500Name): Party?

openAttachment

Download an attachment JAR by ID.

abstract fun openAttachment(id: SecureHash): InputStream

partiesFromName

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.

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

partyFromKey

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

abstract fun partyFromKey(key: PublicKey): Party?

queryAttachments

Queries attachments metadata

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

reattachFlowWithClientId

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

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

refreshNetworkMapCache

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.

abstract fun refreshNetworkMapCache(): Unit

registeredFlows

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

abstract fun registeredFlows(): List<String>

removeClientId

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.

abstract fun removeClientId(clientId: String): Boolean

removeClientIdAsAdmin

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.

abstract fun removeClientIdAsAdmin(clientId: String): Boolean

setFlowsDrainingModeEnabled

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.

abstract fun setFlowsDrainingModeEnabled(enabled: Boolean): Unit

shutdown

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

abstract fun shutdown(): Unit

startFlowDynamic

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

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

startFlowDynamicWithClientId

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

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

startTrackedFlowDynamic

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.

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

stateMachineRecordedTransactionMappingFeed

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

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

stateMachineRecordedTransactionMappingSnapshot

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

abstract fun stateMachineRecordedTransactionMappingSnapshot(): List<StateMachineTransactionMapping>

stateMachinesFeed

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

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

stateMachinesSnapshot

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

abstract fun stateMachinesSnapshot(): List<StateMachineInfo>

terminate

Shuts the node down. Returns immediately.

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

uploadAttachment

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

abstract fun uploadAttachment(jar: InputStream): SecureHash

uploadAttachmentWithMetadata

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

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

vaultQuery

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

vaultQueryBy

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

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

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

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

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

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

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.

abstract fun waitUntilNetworkReady(): CordaFuture<Void?>

wellKnownPartyFromAnonymous

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.

abstract fun wellKnownPartyFromAnonymous(party: AbstractParty): Party?

wellKnownPartyFromX500Name

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

abstract fun wellKnownPartyFromX500Name(x500Name: CordaX500Name): Party?

Extension Functions

getCashBalance

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

getCashBalances

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

pendingFlowsCount

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

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

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>

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

fun <T, A, B, R : FlowLogic<T>> CordaRPCOps.startFlow(flowConstructor: (A, B) -> R, arg0: A, arg1: B): FlowHandle<T>

startFlowWithClientId

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

fun <T, R : FlowLogic<T>> CordaRPCOps.startFlowWithClientId(clientId: String, flowConstructor: () -> R): FlowHandleWithClientId<T>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

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

fun <T, R : FlowLogic<T>> CordaRPCOps.startTrackedFlow(flowConstructor: () -> R): FlowProgressHandle<T>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>>