RPC
View as MarkdownThis page lists the TypeScript SDK names for RPCs. The doc comment of each API gives its parameters, defaults, and errors. Read them in the TypeScript SDK API reference.
API names
| Task | TypeScript API | Dex behavior |
|---|---|---|
| Define an RPC handler | @rpc on a Flow method, or declareRPCMethod | Flow definition |
| Set the durable RPC name | name of RPCOptions. It defaults to the method name. | Flow definition |
| Set the RPC timeout | timeoutMs of RPCOptions | RPC timeout |
| Lock Attributes for the whole call | lockAttributes of RPCOptions | Locks |
| Request transactional reads and writes without locks | isTransactional of RPCOptions | Transactional RPCs |
| Load AttributeMap values and Channel messages | loadAttributeMaps, loadAttributeMapInstances, loadChannels, loadChannelMaps, and loadChannelMapInstances of RPCOptions | Selective state loading |
| Return the output and start next Steps | RPCResult, with output and nextSteps | RPCs |
| Cancel running Steps | cancelingSteps of RPCResult | Cancel running Steps |
| Let a person invoke the RPC from Dex Web | action of RPCOptions, with Action | Actions |
| Invoke the RPC from a Client | Client.invokeRPC | Invoke an RPC |
| Lock or load map instances chosen at call time | RPCInvokeOptions, with Client.invokeRPCWithOptions | Runtime-selected map instances |
@rpc and declareRPCMethod take the same RPCOptions.
RPC codecs
TypeScript uses JSON when inputCodec or outputCodec is omitted. Provide a codec when the input or output is not JSON, including scalar values such as strings, numbers, booleans, and bigints.