Circles-Pathfinder
Pathfinding and flow matrix calculation for the Circles protocol.
Features
- Path Discovery: Find optimal paths between addresses in the Circles network
- Flow Matrix Calculation: Generate flow matrices for smart contract interactions
- Contract Integration: Ready-to-use types for smart contract calls
- High Performance: Efficient coordinate packing and vertex transformation
- Type Safety: Compile-time guarantees with alloy primitives
Quick Start
Basic Usage
use ;
use ;
let params = FindPathParams ;
// One function call does everything!
let matrix = prepare_flow_for_contract.await?;
// Ready for smart contract calls
contract.some_function.send.await?;
### Advanced Usage
```rust
// For composable workflows
let transfers = find_path.await?;
let matrix = create_flow_matrix?;
let contract_matrix = matrix.into; // Convert to contract types
Contract ABI Compatibility
This crate provides types compatible with smart contracts that expect:
struct FlowEdge {
uint16 streamSinkId;
uint192 amount;
}
struct Stream {
uint16 sourceCoordinate;
uint16[] flowEdgeIds;
bytes data;
}
function redeemPayment(
address[] memory flowVertices,
FlowEdge[] memory flowEdges,
Stream[] memory streams,
bytes memory packedCoordinates
) external;