Docs — API Reference
Summary
CONTRACT_API.md documents every public function's signature and parameters but gives no code examples. This issue adds a copy-paste-ready JavaScript snippet below each function entry so integrators can call Accord without needing to reverse-engineer the frontend source.
Background
The contract exposes twelve public functions: initialize, create_proposal, approve, revoke, execute, get_proposal, get_proposals_paged, get_owners, get_threshold, get_total_proposals, is_owner, and has_approved. The frontend already calls all of these using @stellar/stellar-sdk — the patterns live in frontend/src/lib/contract.ts. Read-only view functions use simulateTransaction; state-changing functions (initialize, create_proposal, approve, revoke, execute) need a signed transaction submitted via sendTransaction.
What Needs to Be Done
- Add a short preamble near the top of
docs/CONTRACT_API.md — after the opening two lines — explaining the two call patterns used throughout: simulateTransaction for read-only calls and sendTransaction for state-changing ones. Include the shared setup block (RPC server instantiation, Contract object, network passphrase) once in the preamble so it does not repeat in every snippet.
- For each of the five state-changing functions (
initialize, create_proposal, approve, revoke, execute), add a JavaScript code block immediately after the existing parameter table showing how to build, simulate-assemble, sign, and submit the transaction using @stellar/stellar-sdk.
- For each of the seven read-only functions (
get_proposal, get_proposals_paged, get_owners, get_threshold, get_total_proposals, is_owner, has_approved), add a JavaScript code block immediately after the existing description showing how to call the function via simulateTransaction and decode the return value with scValToNative.
- Make sure every snippet references the correct argument types that match the Rust signature — for example,
nativeToScVal for addresses and amounts, and xdr.ScVal.scvU64 for u64 proposal IDs.
Acceptance Criteria
Files to Look At
docs/CONTRACT_API.md — add all code examples here, one block per function
frontend/src/lib/contract.ts — existing JS call patterns for read-only and state-changing functions
Difficulty: Medium
Docs — API Reference
Summary
CONTRACT_API.mddocuments every public function's signature and parameters but gives no code examples. This issue adds a copy-paste-ready JavaScript snippet below each function entry so integrators can call Accord without needing to reverse-engineer the frontend source.Background
The contract exposes twelve public functions:
initialize,create_proposal,approve,revoke,execute,get_proposal,get_proposals_paged,get_owners,get_threshold,get_total_proposals,is_owner, andhas_approved. The frontend already calls all of these using@stellar/stellar-sdk— the patterns live infrontend/src/lib/contract.ts. Read-only view functions usesimulateTransaction; state-changing functions (initialize, create_proposal, approve, revoke, execute) need a signed transaction submitted viasendTransaction.What Needs to Be Done
docs/CONTRACT_API.md— after the opening two lines — explaining the two call patterns used throughout:simulateTransactionfor read-only calls andsendTransactionfor state-changing ones. Include the shared setup block (RPC server instantiation, Contract object, network passphrase) once in the preamble so it does not repeat in every snippet.initialize,create_proposal,approve,revoke,execute), add a JavaScript code block immediately after the existing parameter table showing how to build, simulate-assemble, sign, and submit the transaction using@stellar/stellar-sdk.get_proposal,get_proposals_paged,get_owners,get_threshold,get_total_proposals,is_owner,has_approved), add a JavaScript code block immediately after the existing description showing how to call the function viasimulateTransactionand decode the return value withscValToNative.nativeToScValfor addresses and amounts, andxdr.ScVal.scvU64foru64proposal IDs.Acceptance Criteria
CONTRACT_API.mdhas a JavaScript code block directly beneath it.scValToNativeand log or return the result.@stellar/stellar-sdkAPI used infrontend/src/lib/contract.ts(same import paths and helper functions).Files to Look At
docs/CONTRACT_API.md— add all code examples here, one block per functionfrontend/src/lib/contract.ts— existing JS call patterns for read-only and state-changing functionsDifficulty: Medium