RPC
查看 MarkdownThis page lists the Python SDK names for RPCs. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Python SDK API reference.
API names
| Task | Python API | Dex behavior |
|---|---|---|
| Define an RPC handler | @rpc on a Flow method | Flow definition |
| Set the durable RPC name | name of @rpc. It defaults to the method name. | Flow definition |
| Set the RPC timeout | timeout of @rpc | RPC timeout |
| Lock Attributes for the whole call | lock_attributes of @rpc | Locks |
| Request transactional reads and writes without locks | is_transactional of @rpc | Transactional RPCs |
| Load AttributeMap values and Channel messages | load_attribute_maps, load_attribute_map_instances, load_channels, load_channel_maps, and load_channel_map_instances of @rpc | Selective state loading |
| Return the output and start next Steps | RPCResult | RPCs |
| Cancel running Steps | RPCResult.with_canceling_steps | Cancel running Steps |
| Let a person invoke the RPC from Dex Web | action of @rpc, with Action | Actions |
| Invoke the RPC from a Client | Client.invoke_rpc | Invoke an RPC |
| Lock or load map instances chosen at call time | RPCInvokeOptions | Runtime-selected map instances |
Example
Example: examples/python/dex_examples/primitives/rpc/rpc_flow.py