From 255018ddc3742c88ba22a47eabb30c110c72602d Mon Sep 17 00:00:00 2001 From: gyorgybalazsi Date: Thu, 26 Feb 2026 16:44:47 +0100 Subject: [PATCH] Fix README and .env.example accuracy README: - Fix incorrect API function names in ledger API reference (get -> get_by_party, stream -> subscribe, submit -> wait_for_transaction_tree) - Add missing ledgrpc crate to crates table - Add cryptography and canton-proto-rs to installation snippet - Fix "Deafult" typo in breaking changes section .env.example: - Remove 8 phantom variables not used in any code (ATTESTOR_URL, CANTON_NETWORK, DESTINATION_BTC_ADDRESS, TRANSFER_AMOUNT, RECIPIENTS_CSV, RECEIVER_PARTY, TRANSFER_COUNT, LIB_TEST_TRANSFER_OFFER_CID) - Add 6 missing variables used by delete_executed_transfers example (KEYCLOAK_CLIENT_SECRET, CHOICE_CONTRACT_TEMPLATE_ID, CHOICE_CONTRACT_ID, DISCLOSED_CONTRACT_TEMPLATE_ID, DISCLOSED_CONTRACT_BLOB, plus optional ones) Co-Authored-By: Claude Opus 4.6 --- .env.example | 63 ++++++++++++++++++++++------------------------------ README.md | 11 +++++---- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/.env.example b/.env.example index 5317b07..2238800 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ # Copy this file to .env and fill in your values # ============================================================================= -# CORE CONFIGURATION (Required for all operations) +# CORE CONFIGURATION (Required for most operations) # ============================================================================= # KEYCLOAK / OIDC AUTHENTICATION @@ -23,30 +23,6 @@ LEDGER_HOST=https://participant.example.com # Your party ID on the Canton network PARTY_ID=your-party::1220abcdef... -# ============================================================================= -# MINT & REDEEM OPERATIONS (Required for BTC ↔ CBTC bridging) -# ============================================================================= - -# BITSAFE ATTESTOR NETWORK -# Attestor URL for BTC/CBTC bridging operations -# Devnet: https://devnet.dlc.link/attestor-1 -# Testnet: https://testnet.dlc.link/attestor-1 -# Mainnet: https://mainnet.dlc.link/attestor-1 -ATTESTOR_URL=https://devnet.dlc.link/attestor-1 - -# Canton network identifier for attestor API calls -# Devnet: canton-devnet -# Testnet: canton-testnet -# Mainnet: canton-mainnet -CANTON_NETWORK=canton-devnet - -# Destination Bitcoin address for withdrawals (for testing withdraw account creation) -# This should be a valid Bitcoin address for your target network -# Devnet/Regtest: bcrt1q... (regtest bech32) -# Testnet: tb1q... (testnet bech32) -# Mainnet: bc1q... (mainnet bech32) -DESTINATION_BTC_ADDRESS= - # ============================================================================= # SEND & TRANSFER OPERATIONS (Required for sending CBTC to other parties) # ============================================================================= @@ -64,27 +40,36 @@ DECENTRALIZED_PARTY_ID=cbtc-network::12202a83c6f4082217c175e29bc53da5f2703ba2675 # Mainnet: https://api.utilities.digitalasset.com REGISTRY_URL=https://api.utilities.digitalasset-dev.com -# Optional: Transfer amount for send examples (default: 0.1) -TRANSFER_AMOUNT=0.1 - -# Optional: CSV file path for batch distribution (default: recipients.csv) -RECIPIENTS_CSV=recipients.csv - # ============================================================================= -# STREAM EXAMPLE (for stream_cbtc example) +# DELETE EXECUTED TRANSFERS EXAMPLE (cargo run -p examples --bin delete_executed_transfers) # ============================================================================= -# RECEIVER_PARTY=receiver-party::1220... -# TRANSFER_COUNT=10 + +# Client secret for client credentials authentication (used instead of username/password) +KEYCLOAK_CLIENT_SECRET=your-client-secret + +# Template ID of the CBTCGovernanceRules contract +CHOICE_CONTRACT_TEMPLATE_ID=package:Module:CBTCGovernanceRules +# Contract ID of the CBTCGovernanceRules contract +CHOICE_CONTRACT_ID=00abcdef... +# Template ID for the disclosed contract +DISCLOSED_CONTRACT_TEMPLATE_ID=package:Module:CBTCGovernanceRules +# Base64 blob for the disclosed contract +DISCLOSED_CONTRACT_BLOB= + +# Optional: Maximum number of contracts to delete (default: unlimited) +# MAX_CONTRACTS=100 +# Optional: Number of parallel threads (default: 8) +# NUM_THREADS=8 +# Optional: Path to CSV file containing contract IDs (skips chain fetch if set) +# CONTRACT_IDS_CSV=contract_ids.csv # ============================================================================= # TESTING (for running integration tests) # ============================================================================= + # Test receiver party ID (for transfer tests) LIB_TEST_RECEIVER_PARTY_ID=example-receiver::1220... -# Transfer offer contract ID (for accept transfer test - optional, test will skip if not set) -LIB_TEST_TRANSFER_OFFER_CID= - # Client secret for ledger end tests (client credentials flow) LIB_TEST_LEDGER_END_CLIENT_SECRET=your-client-secret-here @@ -94,4 +79,8 @@ LIB_TEST_AMULET_CLIENT_SECRET=your-amulet-client-secret-here # Wallet API host for amulet rules tests WALLET_API_HOST=https://wallet.example.com +# ============================================================================= +# LOGGING +# ============================================================================= + RUST_LOG=trace,tungstenite=error,tokio_tungstenite=error,reqwest=error diff --git a/README.md b/README.md index 0458dd7..3eb289d 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ This library provides a Rust interface for interacting with Canton blockchain pa | `common` | Common types for transfers and contract operations | | `wallet` | Wallet operations (amulet rules, mining rounds) | | `cryptography` | Cryptographic utilities (AES-256-GCM) | +| `ledgrpc` | Canton Ledger gRPC protobuf bindings (canton-proto-rs) | ### Prerequisites @@ -52,6 +53,8 @@ keycloak = { git = "ssh://git@github.com/DLC-link/canton-lib", branch = "main" } registry = { git = "ssh://git@github.com/DLC-link/canton-lib", branch = "main" } common = { git = "ssh://git@github.com/DLC-link/canton-lib", branch = "main" } wallet = { git = "ssh://git@github.com/DLC-link/canton-lib", branch = "main" } +cryptography = { git = "ssh://git@github.com/DLC-link/canton-lib", branch = "main" } +canton-proto-rs = { git = "ssh://git@github.com/DLC-link/canton-lib", branch = "main" } ``` --- @@ -160,10 +163,10 @@ cargo run -p examples --bin delete_executed_transfers ### `ledger` - `ledger_end::get(Params)` - Get current ledger offset -- `active_contracts::get(Params)` - Query active contracts (REST) +- `active_contracts::get_by_party(Params)` - Query active contracts (REST) - `websocket::active_contracts::get(Params)` - Query active contracts (WebSocket) -- `websocket::update::stream(Params)` - Stream ledger updates -- `submit::submit(Params)` - Submit commands to the ledger +- `websocket::update::subscribe(Params, message_handler)` - Stream ledger updates +- `submit::wait_for_transaction_tree(Params)` - Submit commands and wait for transaction tree ### `registry` @@ -247,7 +250,7 @@ curl -X POST $LEDGER_HOST/v2/commands/submit-and-wait-for-transaction-tree \ ### v0.1.0 -> v0.2.0 -The common crate's `common::submission::Submission` has a few extra fields, you can simple add `..Deafult::default()`, to fulfill that need. +The common crate's `common::submission::Submission` has a few extra fields, you can simple add `..Default::default()`, to fulfill that need. ```rust let submission_request = common::submission::Submission {