Skip to content

docs(examples): document the allocate_cbtc DvP example - #65

Draft
sosaucily wants to merge 1 commit into
mainfrom
docs/add-allocate-cbtc-example
Draft

docs(examples): document the allocate_cbtc DvP example#65
sosaucily wants to merge 1 commit into
mainfrom
docs/add-allocate-cbtc-example

Conversation

@sosaucily

Copy link
Copy Markdown
Contributor

Summary

examples/README.md documents every example except allocate_cbtc, which landed with the DvP allocation client in #59. Someone reading the README to find out what the library can do wouldn't learn that DvP settlement is supported at all.

Found while updating the public CBTC developer docs to cover DvP — the docs site had no mention of it either, and this README was the natural place to have discovered it.

What's added

An "Allocate CBTC (DvP)" section, placed with the other transfer-related examples (after Cancel Pending Transfers), covering:

  • How to run it and which env vars it needs
  • How an allocation differs from send_cbtc — an allocation is settled by a third party (the settlement executor) across all legs atomically, rather than accepted by the receiver
  • The allocateBefore / settleBefore ordering constraint
  • The unwind paths (withdraw, cancel) and the executor's execute_transfer
  • That no Minter credential is required, since allocations move existing CBTC rather than minting or burning it

Plus an "For the allocate_cbtc example" block in the Environment Variables section:

Var Default
LIB_TEST_RECEIVER_PARTY_ID required
EXECUTOR_PARTY_ID required
ALLOCATE_AMOUNT optional 0.1
SETTLEMENT_REF_ID optional cbtc-dvp-example

Verified against the env::var calls in examples/allocate_cbtc.rs rather than assumed.

Note: four other examples are also undocumented

While checking, these are in examples/ but absent from the README:

  • check_dars
  • check_withdraw_requests
  • list_deposit_addresses
  • list_withdraw_accounts

Left out to keep this PR to one thing. Happy to add them in a follow-up if useful — say the word.

Testing

Docs-only change, no code touched. Confirmed every *.rs in examples/ except the four listed above now has a matching cargo run --example <name> entry in the README.

🤖 Generated with Claude Code

examples/README.md documents every example except allocate_cbtc, which
landed with the DvP allocation client in #59. Anyone reading the README
to find out what the library can do would not learn that DvP settlement
is supported at all.

Adds an "Allocate CBTC (DvP)" section covering how to run it, how an
allocation differs from the free-of-payment send_cbtc flow (settled by a
third-party executor across all legs atomically, rather than accepted by
the receiver), the allocateBefore/settleBefore ordering, and the
withdraw/cancel/execute_transfer choices.

Also documents the example's environment variables: EXECUTOR_PARTY_ID and
LIB_TEST_RECEIVER_PARTY_ID as required, ALLOCATE_AMOUNT and
SETTLEMENT_REF_ID as optional with their defaults. These were verified
against the env::var calls in examples/allocate_cbtc.rs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant