Skip to content

Commit e935511

Browse files
committed
Merge commit 'b54e107d445a7dc40ed3f204dc6a6bdaaa9d31ff' into feat/acp
2 parents 8e2d5d9 + b54e107 commit e935511

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

plugins/acp/acp_plugin_gamesdk/acp_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,5 @@ def reset_state(self, wallet_address: str ) -> None:
169169
headers={"x-api-key": self.api_key}
170170
)
171171

172-
if response.status_code != 200:
172+
if response.status_code not in [200, 204]:
173173
raise Exception(f"Failed to reset state: {response.status_code} {response.text}")

plugins/acp/acp_plugin_gamesdk/acp_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def add_produce_item(self, item: IInventory) -> None:
5050
self.produced_inventory.append(item)
5151

5252
def reset_state(self) -> None:
53-
self.acp_client.reset_state()
53+
self.acp_client.reset_state(self.acp_client.wallet_address)
5454

5555
def get_acp_state(self) -> Dict:
5656
server_state = self.acp_client.get_state()

plugins/acp/tools/reset_states.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
from acp_plugin_gamesdk.acp_plugin import AcpToken, AcpPlugin, AdNetworkPluginOptions
3+
4+
5+
def reset_acp_states() -> None:
6+
"""Reset plugin state for all configured ACP tokens."""
7+
acp_tokens = [
8+
os.environ.get("ACP_TOKEN_BUYER"),
9+
os.environ.get("ACP_TOKEN_SELLER")
10+
]
11+
12+
for token in acp_tokens:
13+
try:
14+
acp_plugin = AcpPlugin(
15+
options=AdNetworkPluginOptions(
16+
api_key=os.environ.get("GAME_DEV_API_KEY"),
17+
acp_token_client=AcpToken(
18+
token,
19+
"https://base-sepolia-rpc.publicnode.com/"
20+
)
21+
)
22+
)
23+
acp_plugin.reset_state()
24+
print(f"Successfully reset state for token: {token}")
25+
except Exception as e:
26+
print(f"Failed to reset state for token {token}: {e}")
27+
28+
29+
if __name__ == "__main__":
30+
reset_acp_states()

0 commit comments

Comments
 (0)