acp-plugin-gamesdk 0.1.18__tar.gz → 0.1.19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/PKG-INFO +1 -1
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/acp_plugin_gamesdk/acp_client.py +36 -0
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/acp_plugin_gamesdk/acp_plugin.py +4 -2
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/acp_plugin_gamesdk/interface.py +5 -1
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/pyproject.toml +1 -1
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/README.md +0 -0
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/acp_plugin_gamesdk/acp_token.py +0 -0
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/acp_plugin_gamesdk/acp_token_abi.py +0 -0
- {acp_plugin_gamesdk-0.1.18 → acp_plugin_gamesdk-0.1.19}/acp_plugin_gamesdk/configs.py +0 -0
@@ -264,3 +264,39 @@ class AcpClient:
|
|
264
264
|
f"Response status code: {response.status_code}\n"
|
265
265
|
f"Response description: {response.text}\n"
|
266
266
|
)
|
267
|
+
|
268
|
+
def get_agent_by_wallet_address(self, wallet_address: str) -> AcpAgent:
|
269
|
+
url = f"{self.acp_base_url}/agents?filters[walletAddress]={wallet_address}"
|
270
|
+
|
271
|
+
response = requests.get(
|
272
|
+
url,
|
273
|
+
)
|
274
|
+
|
275
|
+
if response.status_code != 200:
|
276
|
+
raise Exception(
|
277
|
+
f"Failed to get agent: {response.status_code} {response.text}"
|
278
|
+
)
|
279
|
+
|
280
|
+
response_json = response.json()
|
281
|
+
|
282
|
+
result = []
|
283
|
+
|
284
|
+
for agent in response_json.get("data", []):
|
285
|
+
if agent["offerings"]:
|
286
|
+
offerings = [AcpOffering(name=offering["name"], price=offering["price"]) for offering in agent["offerings"]]
|
287
|
+
else:
|
288
|
+
offerings = None
|
289
|
+
|
290
|
+
result.append(
|
291
|
+
AcpAgent(
|
292
|
+
id=agent["id"],
|
293
|
+
name=agent["name"],
|
294
|
+
twitter_handle=agent["twitterHandle"],
|
295
|
+
description=agent["description"],
|
296
|
+
wallet_address=agent["walletAddress"],
|
297
|
+
offerings=offerings,
|
298
|
+
score=0,
|
299
|
+
explanation=""
|
300
|
+
)
|
301
|
+
)
|
302
|
+
return result[0]
|
@@ -74,7 +74,10 @@ class AcpPlugin:
|
|
74
74
|
if options.on_evaluate is not None:
|
75
75
|
self.on_evaluate = options.on_evaluate
|
76
76
|
if options.on_phase_change is not None:
|
77
|
-
|
77
|
+
def phase_change_wrapper(job : AcpJob):
|
78
|
+
job["getAgentByWalletAddress"] = self.acp_client.get_agent_by_wallet_address
|
79
|
+
return options.on_phase_change(job)
|
80
|
+
self.on_phase_change = phase_change_wrapper
|
78
81
|
self.initialize_socket()
|
79
82
|
self.job_expiry_duration_mins = options.job_expiry_duration_mins if options.job_expiry_duration_mins is not None else 1440
|
80
83
|
|
@@ -115,7 +118,6 @@ class AcpPlugin:
|
|
115
118
|
@self.socket.on(SocketEvents["ON_PHASE_CHANGE"])
|
116
119
|
def on_phase_change(data):
|
117
120
|
if hasattr(self, 'on_phase_change') and self.on_phase_change:
|
118
|
-
print(f"on_phase_change: {data}")
|
119
121
|
self.on_phase_change(data)
|
120
122
|
|
121
123
|
# Set up cleanup function for graceful shutdown
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
2
|
from enum import IntEnum, Enum
|
3
|
-
from typing import List, Literal, Optional
|
3
|
+
from typing import List, Literal, Optional, Callable
|
4
4
|
|
5
5
|
@dataclass
|
6
6
|
class AcpOffering:
|
@@ -79,10 +79,13 @@ class AcpJob:
|
|
79
79
|
desc: str
|
80
80
|
price: str
|
81
81
|
providerAddress: Optional[str]
|
82
|
+
clientAddress: Optional[str]
|
82
83
|
phase: AcpJobPhasesDesc
|
83
84
|
memo: List[AcpRequestMemo]
|
84
85
|
tweetHistory : ITweet | List
|
85
86
|
lastUpdated: int
|
87
|
+
getAgentByWalletAddress: Optional[Callable[[str], AcpAgent]]
|
88
|
+
|
86
89
|
|
87
90
|
def __repr__(self) -> str:
|
88
91
|
output =(
|
@@ -92,6 +95,7 @@ class AcpJob:
|
|
92
95
|
f"Description: {self.desc}, "
|
93
96
|
f"Price: {self.price}, "
|
94
97
|
f"Provider Address: {self.providerAddress}, "
|
98
|
+
f"Client Address: {self.clientAddress}, "
|
95
99
|
f"Phase: {self.phase.value}, "
|
96
100
|
f"Memo: {self.memo}, "
|
97
101
|
f"Tweet History: {self.tweetHistory}, "
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|