Skip to content

Commit 9bd7baa

Browse files
authored
Merge pull request #60 from moonpyt/feature/autonomys
feat: Implement Autonomys Auto Drive storage integration with comprehensive API supportFeature/autonomys
2 parents 5a4fd4e + 92d7548 commit 9bd7baa

File tree

10 files changed

+16829
-38
lines changed

10 files changed

+16829
-38
lines changed

spoon_toolkits/storage/__init__.py

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,5 @@
1-
"""DEX tools module for SpoonAI"""
1+
"""Storage tools module for SpoonAI"""
22

3-
from .base import (
4-
DexBaseTool,
5-
DefiBaseTool,
6-
BitqueryTool
7-
)
8-
9-
from .price_data import (
10-
GetTokenPriceTool,
11-
Get24hStatsTool,
12-
GetKlineDataTool,
13-
)
14-
15-
from .price_alerts import (
16-
PriceThresholdAlertTool,
17-
LpRangeCheckTool,
18-
SuddenPriceIncreaseTool,
19-
)
20-
21-
from .lending_rates import (
22-
LendingRateMonitorTool,
23-
)
24-
25-
# from .lst_arbitrage import LstArbitrageTool
26-
27-
__all__ = [
28-
"GetTokenPriceTool",
29-
"Get24hStatsTool",
30-
"GetKlineDataTool",
31-
"PriceThresholdAlertTool",
32-
"LpRangeCheckTool",
33-
"SuddenPriceIncreaseTool",
34-
"LendingRateMonitorTool",
35-
"DexBaseTool",
36-
"DefiBaseTool",
37-
"BitqueryTool",
38-
# "LstArbitrageTool",
39-
]
3+
# This file is intentionally minimal to avoid circular dependencies
4+
# and incorrect imports. Specific storage tools are imported from their
5+
# respective submodules.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
"""Autonomys Auto Drive tools module"""
2+
3+
# Account tools (renamed from Subscription)
4+
from .subscriptions_tools import (
5+
GetAccountInfoTool,
6+
)
7+
8+
# Upload tools
9+
from .uploads_tools import (
10+
UploadFileTool,
11+
UploadFileSmallTool,
12+
UploadFileLargeTool,
13+
GetUploadStatusTool,
14+
)
15+
16+
# Object tools
17+
from .objects_tools import (
18+
GetRootObjectsTool,
19+
SearchObjectsTool,
20+
PublishObjectTool,
21+
UnpublishObjectTool,
22+
DeleteObjectTool,
23+
RestoreObjectTool,
24+
GetSharedRootObjectsTool,
25+
GetDeletedRootObjectsTool,
26+
GetObjectSummaryTool,
27+
ShareObjectTool,
28+
GetObjectStatusTool,
29+
GetObjectMetadataTool,
30+
)
31+
32+
# Download tools
33+
from .downloads_tools import (
34+
DownloadObjectTool,
35+
StreamDownloadTool,
36+
DownloadPublicObjectTool,
37+
StreamDownloadPublicObjectTool,
38+
CreateAsyncDownloadTool,
39+
GetAsyncDownloadStatusTool,
40+
ListAsyncDownloadsTool,
41+
DismissAsyncDownloadTool,
42+
)
43+
44+
# Provider
45+
from .provider import AutoDriveProvider
46+
from .base import get_provider
47+
48+
__all__ = [
49+
# Account tools (1) - renamed from Subscription
50+
"GetAccountInfoTool",
51+
52+
# Upload tools (4)
53+
"UploadFileTool",
54+
"UploadFileSmallTool",
55+
"UploadFileLargeTool",
56+
"GetUploadStatusTool",
57+
58+
# Object tools (12)
59+
"GetRootObjectsTool",
60+
"SearchObjectsTool",
61+
"PublishObjectTool",
62+
"UnpublishObjectTool",
63+
"DeleteObjectTool",
64+
"RestoreObjectTool",
65+
"GetSharedRootObjectsTool",
66+
"GetDeletedRootObjectsTool",
67+
"GetObjectSummaryTool",
68+
"ShareObjectTool",
69+
"GetObjectStatusTool",
70+
"GetObjectMetadataTool",
71+
72+
# Download tools (8)
73+
"DownloadObjectTool",
74+
"StreamDownloadTool",
75+
"DownloadPublicObjectTool",
76+
"StreamDownloadPublicObjectTool",
77+
"CreateAsyncDownloadTool",
78+
"GetAsyncDownloadStatusTool",
79+
"ListAsyncDownloadsTool",
80+
"DismissAsyncDownloadTool",
81+
82+
# Provider
83+
"AutoDriveProvider",
84+
"get_provider",
85+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Base module for Autonomys Auto Drive tools"""
2+
3+
import os
4+
from .provider import AutoDriveProvider
5+
6+
def get_provider() -> AutoDriveProvider:
7+
"""
8+
Get Auto Drive provider instance.
9+
Validates that the API key is configured before initialization.
10+
"""
11+
api_key = os.environ.get('AUTONOMYS_AUTO_DRIVE_API_KEY', 'apikey')
12+
auth_provider = os.environ.get('AUTONOMYS_AUTO_DRIVE_AUTH_PROVIDER', 'apikey')
13+
14+
if not api_key:
15+
raise RuntimeError(
16+
"AUTONOMYS_AUTO_DRIVE_API_KEY is not set in environment variables. "
17+
"Please configure it to use Autonomys Auto Drive tools."
18+
)
19+
20+
return AutoDriveProvider(
21+
api_key=api_key,
22+
auth_provider=auth_provider
23+
)

0 commit comments

Comments
 (0)