-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Overview
Implement the saveShards method in Python SDK to store key shards securely on Lighthouse distributed nodes. This method backs up shards on the network and allows access delegation by sharing shards to multiple addresses.
The API contract must match exactly with the JS SDK implementation.
Function Signature
async def saveShards(
address: str,
cid: str,
auth_token: str,
keyShards: List[Dict[str, str]],
shareTo: Optional[List[str]] = None
) -> Dict[str, Any]:
passExpected Response Format
{
"isSuccess": true,
"error": null
}Reference (JS SDK)
- File:
/src/methods/saveShards/index.ts - Method:
saveShards()
Key Requirements
- Perform HTTP request to Lighthouse Node’s save API endpoint.
- Include
auth_tokenfor authentication (received viagetAuthMessage+ signature). - Prepare request body following same structure as JS SDK payload.
- Handle optional
shareToparameter for sharing shards during save operation. - Fully mirror the Lighthouse API behavior.
- Handle and parse errors from Lighthouse API into SDK-consistent response.
Suggested Python Libraries
- Use
httpxorrequestsfor asynchronous HTTP calls. - Use
pydanticor standarddataclassesfor request/response schema validation. - Use standard Python
loggingfor debugging API requests.
Deliverables
-
Fully functional
saveShards()method. -
Unit tests for:
- Valid shard save with and without
shareTo. - Error cases from Lighthouse API.
- Valid shard save with and without
-
Maintain full consistency in payload and response with JS SDK behavior.
Metadata
Metadata
Assignees
Labels
No labels