-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Milestone
Description
The Stacks RPC client is an abstraction layer that provides a Go-specific interface to interact with the Stacks API. It enables us to check account balances, send transactions, and listen for events on the Stacks blockchain.
Core client functionality
Create an IClient interface that defines all relevant methods for interacting with the Stacks blockchain.
Create a Client struct that implements the IClient interface.
The core functionalities are:
- Checking account status (balance/nonce)
- Sending and verifying transactions
- Retrieving block information
- Interacting with smart contracts
- Monitoring network status
- Listening for relevant events
API Endpoints to Cover
The following are the main Stacks API endpoints we need to interact with:
Accounts
- GET /v2/accounts/{principal}: Check account balances and retrieve nonces for transaction creation
Transactions
- POST /v2/transactions: Broadcast a transaction
- GET /v2/transactions/{tx_id}: Get transaction details
Blocks
- GET /v2/blocks/{height}: Get block by height
Contracts
- POST /v2/contracts/call-read/{contract_address}/{contract_name}/{function_name}: Call read-only function
- GET /v2/contracts/interface/{contract_address}/{contract_name}: Get contract interface
Network info
- GET /v2/info: Get Stacks node info
- GET /v2/fees/transfer: Get estimated fee
Events
- GET /v2/events: Get recent events
Acceptance Criteria
- All Stacks blockchain interactions required for the relay system are implemented
- The client works with mainnet, testnet, and devnet
- Unit tests cover all methods with >80% code coverage
- Integration tests confirm functionality against Stacks devnet
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels