Skip to content

chore: deal collateral lineage update#77

Merged
MSevey merged 2 commits into
mainfrom
cursor/ARDGBL-994-deal-collateral-lineage-update-90f9
Dec 18, 2025
Merged

chore: deal collateral lineage update#77
MSevey merged 2 commits into
mainfrom
cursor/ARDGBL-994-deal-collateral-lineage-update-90f9

Conversation

@MSevey

@MSevey MSevey commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Refactor Deal and Collateral audit trail endpoints to use the new /api/v1/state/transactions endpoint.

The previous /api/v1/deal/{deal_id}/audit-trail and /api/v1/collateral/{id}/audit-trail endpoints have been removed. This PR updates the getDealAuditTrail and getCollateralAuditTrail methods to fetch data from the /api/v1/state/transactions endpoint with the relevant deal_id or collateral_id query parameters, ensuring continued functionality for lineage views.


Linear Issue: ARDGBL-994

Open in Cursor Open in Web

@cursor

cursor Bot commented Dec 18, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@linear

linear Bot commented Dec 18, 2025

Copy link
Copy Markdown
ARDGBL-994 Update Deal and Collateral Lineage views

The following endpoints have been removed
/api/v1/deal/{deal_id}/audit-trail

/api/v1/deal/{deal_id}/audit-trail-with-proofs

/api/v1/collateral/{id}/audit-trail

The /state API endpoints on the credit server have been updated to handle these requests via the /transactions endpoint with the necessary query params.
{"openapi":"3.1.0","info":{"title":"Arda API","description":"\nArda API - Comprehensive credit deal management platform.\n\n## 🚀 Quick Access to Individual API Categories (Lightweight):\n\n• **[Auth](./auth.json)** - Authentication & authorization\n\n• **[Users](./users.json)** - User management & KYC\n\n• **[Companies](./companies.json)** - Company management & teams \n\n• **[Deals](./deals.json)** - Deal lifecycle & marketplace ⭐\n\n• **[Collateral](./collateral.json)** - Collateral assets & duplicate detection ⭐\n\n• **[Loan Tape](./loan_tape.json)** - Portfolio upload & management\n\n• **[Admin](./admin.json)** - Administrative operations\n\n• **[Payments](./payments.json)** - Financial transactions\n\n• **[State](./state.json)** - Blockchain integration\n\n• **[Taxonomy](./taxonomy.json)** - Document management\n\n• **[Internal](./internal.json)** - Service-to-service communication\n\n• **[Dev](./dev.json)** - Development utilities\n\n","contact":{"name":"Arda Global","url":"https://arda.xyz","email":"support@arda.xyz"},"license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"version":"v1"},"servers":\[{"url":"http://localhost:8080","description":"Development server"},{"url":"https://api.arda.credit","description":"Production server"}],"paths":{"/api/v1/contract/config":{"get":{"tags":["State"],"summary":"Get Arda contract configuration","description":"Returns the current Arda contract address, network information, and other\nconfiguration details needed for frontend wallet integration.","operationId":"get_contract_config","parameters":[{"name":"network","in":"query","description":"Optional network parameter (defaults to configured network)","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Contract configuration retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractConfigResponse"}}}},"500":{"description":"Internal server error"}}}},"/api/v1/state/batches":{"get":{"tags":["State"],"summary":"Get all batches","operationId":"get_batches_endpoint","responses":{"200":{"description":"Batches retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchListResponse"}}}},"500":{"description":"Internal server error"}}}},"/api/v1/state/batches/{batch_id}":{"get":{"tags":["State"],"summary":"Get batch details by ID","operationId":"get_batch_details_endpoint","parameters":[{"name":"batch_id","in":"path","description":"Batch ID","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Batch details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchInfo"}}}},"404":{"description":"Batch not found"},"500":{"description":"Internal server error"}}}},"/api/v1/state/transactions":{"get":{"tags":["State"],"summary":"List state transactions with flexible filtering","operationId":"list_state_transactions_endpoint","parameters":[{"name":"limit","in":"query","description":"Maximum number of transactions to return (default: 50, max: 500)","required":false,"schema":{"type":"integer","format":"int32"},"example":50},{"name":"offset","in":"query","description":"Number of transactions to skip for pagination (default: 0)","required":false,"schema":{"type":"integer","format":"int32"},"example":0},{"name":"pending","in":"query","description":"Filter by pending status (true = unbatched, false = batched, omit = all)","required":false,"schema":{"type":"boolean"},"example":true},{"name":"batch_id","in":"query","description":"Filter by batch ID (transactions included in this batch)","required":false,"schema":{"type":"integer","format":"int32"},"example":42},{"name":"transaction_type","in":"query","description":"Filter by transaction types (comma-separated, e.g., \"deal_payment,collateral_update\")","required":false,"schema":{"type":"string"},"example":"deal_origination,deal_payment"},{"name":"user_id","in":"query","description":"Filter by user ID (UUID)","required":false,"schema":{"type":"string","format":"uuid"},"example":"550e8400-e29b-41d4-a716-446655440000"},{"name":"deal_id","in":"query","description":"Filter by deal ID (UUID)","required":false,"schema":{"type":"string","format":"uuid"},"example":"550e8400-e29b-41d4-a716-446655440001"},{"name":"originator_company_id","in":"query","description":"Filter by originator company ID (UUID)","required":false,"schema":{"type":"string","format":"uuid"},"example":"550e8400-e29b-41d4-a716-446655440002"},{"name":"investor_company_id","in":"query","description":"Filter by investor company ID (UUID)","required":false,"schema":{"type":"string","format":"uuid"},"example":"550e8400-e29b-41d4-a716-446655440003"},{"name":"company_id","in":"query","description":"Filter by company ID - matches originator OR investor (UUID)","required":false,"schema":{"type":"string","format":"uuid"},"example":"550e8400-e29b-41d4-a716-446655440004"},{"name":"collateral_id","in":"query","description":"Filter by collateral ID (UUID)","required":false,"schema":{"type":"string","format":"uuid"},"example":"550e8400-e29b-41d4-a716-446655440005"},{"name":"order","in":"query","description":"Sort order: \"asc\" or \"desc\" (default: \"desc\")","required":false,"schema":{"type":"string"},"example":"desc"},{"name":"include_decoded","in":"query","description":"Include decoded amount and metadata from transaction_data (default: false)","required":false,"schema":{"type":"boolean"},"example":false}],"responses":{"200":{"description":"State transactions retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateTransactionsResponse"}}}},"400":{"description":"Invalid query parameters"},"500":{"description":"Internal server error"}}}}},"components":{"schemas":{"BatchInfo":{"type":"object","description":"Batch info for API responses (includes embedded contract data)","required":["id","transaction_count","proof_status","created_at","posted_to_contract"],"properties":{"contract_new_merkle_root":{"type":["string","null"]},"contract_prev_merkle_root":{"type":["string","null"]},"contract_ready":{"type":["boolean","null"]},"contract_tx_hash":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"final_state_root":{"type":["string","null"]},"id":{"type":"integer","format":"int32"},"posted_to_contract":{"type":"boolean"},"posted_to_contract_at":{"type":["string","null"],"format":"date-time"},"previous_state_root":{"type":["string","null"]},"proof_status":{"type":"string"},"proven_at":{"type":["string","null"],"format":"date-time"},"sindri_proof_id":{"type":["string","null"]},"transaction_count":{"type":"integer","minimum":0}}},"BatchListResponse":{"type":"object","description":"Response for batch listing","required":["batches","total_count"],"properties":{"batches":{"type":"array","items":{"$ref":"#/components/schemas/BatchInfo"}},"total_count":{"type":"integer","minimum":0}}},"ContractConfigResponse":{"type":"object","description":"Arda contract configuration response","required":["contractAddress","chainId","rpcUrl","blockExplorerUrl","deploymentBlock","apiVersion"],"properties":{"apiVersion":{"type":"string","description":"Current API version"},"blockExplorerUrl":{"type":"string","description":"Block explorer base URL for transaction viewing"},"chainId":{"type":"integer","format":"int64","description":"The Ethereum network/chain ID (1 for mainnet, 11155111 for sepolia, etc.)","minimum":0},"contractAddress":{"type":"string","description":"The Ethereum address of the Arda contract"},"deploymentBlock":{"type":"integer","format":"int64","description":"Contract deployment block number (for filtering events)","minimum":0},"rpcUrl":{"type":"string","description":"RPC URL for the Ethereum network"}}},"StateTransactionItem":{"type":"object","description":"State transaction item in API response","required":["id","transaction_type","created_at","updated_at","pending"],"properties":{"amount":{"type":["string","null"]},"collateral_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"deal_id":{"type":["string","null"]},"id":{"type":"string"},"included_in_batch_id":{"type":["integer","null"],"format":"int32"},"investor_company_id":{"type":["string","null"]},"metadata":{},"originator_company_id":{"type":["string","null"]},"pending":{"type":"boolean"},"transaction_type":{"type":"string"},"updated_at":{"type":"string","format":"date-time"},"user_id":{"type":["string","null"]}}},"StateTransactionsPagination":{"type":"object","description":"Pagination info for state transactions","required":["limit","offset","has_more"],"properties":{"has_more":{"type":"boolean"},"limit":{"type":"integer","format":"int32"},"offset":{"type":"integer","format":"int32"}}},"StateTransactionsResponse":{"type":"object","description":"State transactions list response","required":["transactions","total_count","pagination"],"properties":{"pagination":{"$ref":"#/components/schemas/StateTransactionsPagination"},"total_count":{"type":"integer","minimum":0},"transactions":{"type":"array","items":{"$ref":"#/components/schemas/StateTransactionItem"}}}}},"securitySchemes":{"session_cookie":{"type":"apiKey","in":"cookie","name":"session_token"}}},"tags":[{"name":"State","description":"\nBlockchain state management, batch processing, ZK proof generation, transaction history, and contract integration\n\n📄 **Focused API Spec**: [/api-docs/state.json](./state.json)\n"}]}


Please update where we are getting deal and collateral audit trail / lineage information to use the new state endpoints.

@coderabbitai

coderabbitai Bot commented Dec 18, 2025

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@openhands-ai

openhands-ai Bot commented Dec 18, 2025

Copy link
Copy Markdown

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Semantic Pull Request

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #77 at branch `cursor/ARDGBL-994-deal-collateral-lineage-update-90f9`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@MSevey MSevey changed the title Deal collateral lineage update chore: deal collateral lineage update Dec 18, 2025
@MSevey MSevey marked this pull request as ready for review December 18, 2025 17:42
@MSevey MSevey merged commit 2bdd50a into main Dec 18, 2025
2 of 4 checks passed
@MSevey MSevey deleted the cursor/ARDGBL-994-deal-collateral-lineage-update-90f9 branch December 18, 2025 17:42
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.

2 participants