Channel
查看 MarkdownThis page lists the TypeScript SDK names for Channels. 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 a Channel | Channel | Channels |
| Define a ChannelMap | ChannelMap | ChannelMap |
| Declare it in the Flow | channels of the PersistenceSchema returned from getPersistenceSchema | Flow definition |
| Publish a message from a Step or RPC | publish | Commits |
| Wait for messages | forOne, forN, atLeast, atMost, and range | Wait conditions |
| Read the messages a wait consumed | results | Channel results |
| Load pending messages for a method | ChannelMap.loadMessages, with the load fields of StepOptions or RPCOptions | Selective state loading |
| Read loaded pending messages | pendingMessages and findPendingMessage | Pending messages |
| Delete a pending message | delete | Pending messages |
| Read the number of pending messages | size | Selective state loading |
| Count ChannelMap instances and list their keys | ChannelMap.getMapSize and ChannelMap.getAllInstanceKeys | ChannelMap |
| Complete the Flow only when Channels are empty | forceCompleteIfChannelsEmpty | ForceCompleteIfChannelsEmpty |
Example
Example: examples/typescript/src/primitives/channel/channel-flow.ts