Circles Transfers
Builder for Circles transfer transactions (port of TS @aboutcircles/sdk-transfers). Produces the ordered tx list; execution is up to your runner.
Status
- Builds approval → unwraps →
operateFlowMatrix→ inflationary re-wrap leftovers. - Handles demurraged and inflationary wrappers. Inflationary unwrap uses static amounts; leftover re-wrap uses
staticAttoCirclesfromcircles_getTokenBalances. - Self-transfer fast-path resolves wrapper type via LiftERC20; approval inclusion is configurable.
- Includes an aggregate-capable entrypoint that mirrors the TS recipient self-transfer behavior when
to_tokensselects exactly one token. - Includes the TS-style replenish planner: use existing unwrapped balance first, then local unwraps, then deficit pathfinding with temporary trust when needed.
- Includes the TS-style automatic group-token redeem planner: inspect treasury collateral, filter by trusted ERC-1155 tokens, validate max redeemable flow, then build the redeem flow matrix.
- Fixtures cover demurraged-only, mixed wrappers (with rewrap), and a no-leftover inflationary case (static balance forced to zero for now).
Usage
use TransferBuilder;
use ;
use U256;
# async
Notes / TODO
- Approval skip-check is configurable but still defaults to including
setApprovalForAll. - Inflationary no-leftover fixture can be made more realistic once timestamp/static balance data is available.
- Requires a Circles RPC endpoint for pathfinding, token info, and balances; WS not required here.
- Does not submit transactions; pair with a
ContractRunnerin the SDK to send them.