agent0-sdk 0.31__py3-none-any.whl → 1.0.0__py3-none-any.whl
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.
- agent0_sdk/__init__.py +1 -1
- agent0_sdk/core/agent.py +172 -30
- agent0_sdk/core/contracts.py +93 -58
- agent0_sdk/core/feedback_manager.py +90 -161
- agent0_sdk/core/indexer.py +54 -26
- agent0_sdk/core/models.py +6 -19
- agent0_sdk/core/oasf_validator.py +1 -1
- agent0_sdk/core/sdk.py +31 -16
- agent0_sdk/core/subgraph_client.py +34 -15
- agent0_sdk/core/web3_client.py +184 -17
- {agent0_sdk-0.31.dist-info → agent0_sdk-1.0.0.dist-info}/METADATA +21 -7
- agent0_sdk-1.0.0.dist-info/RECORD +19 -0
- {agent0_sdk-0.31.dist-info → agent0_sdk-1.0.0.dist-info}/top_level.txt +0 -1
- agent0_sdk-0.31.dist-info/RECORD +0 -33
- tests/__init__.py +0 -1
- tests/config.py +0 -46
- tests/conftest.py +0 -22
- tests/discover_test_data.py +0 -445
- tests/test_feedback.py +0 -417
- tests/test_models.py +0 -224
- tests/test_multi_chain.py +0 -588
- tests/test_oasf_management.py +0 -404
- tests/test_real_public_servers.py +0 -103
- tests/test_registration.py +0 -267
- tests/test_registrationIpfs.py +0 -227
- tests/test_sdk.py +0 -240
- tests/test_search.py +0 -415
- tests/test_transfer.py +0 -255
- {agent0_sdk-0.31.dist-info → agent0_sdk-1.0.0.dist-info}/WHEEL +0 -0
- {agent0_sdk-0.31.dist-info → agent0_sdk-1.0.0.dist-info}/licenses/LICENSE +0 -0
agent0_sdk/__init__.py
CHANGED
agent0_sdk/core/agent.py
CHANGED
|
@@ -176,16 +176,14 @@ class Agent:
|
|
|
176
176
|
return self.registration_file
|
|
177
177
|
|
|
178
178
|
def _collectMetadataForRegistration(self) -> List[Dict[str, Any]]:
|
|
179
|
-
"""Collect all metadata entries for registration.
|
|
179
|
+
"""Collect all metadata entries for registration.
|
|
180
|
+
|
|
181
|
+
Note: agentWallet is now a reserved metadata key and cannot be set via setMetadata().
|
|
182
|
+
It must be set separately using setAgentWallet() with EIP-712 signature verification.
|
|
183
|
+
"""
|
|
180
184
|
metadata_entries = []
|
|
181
185
|
|
|
182
|
-
#
|
|
183
|
-
if self.walletAddress:
|
|
184
|
-
addr_bytes = bytes.fromhex(self.walletAddress[2:]) # Remove '0x' prefix
|
|
185
|
-
metadata_entries.append({
|
|
186
|
-
"key": "agentWallet",
|
|
187
|
-
"value": addr_bytes
|
|
188
|
-
})
|
|
186
|
+
# Note: agentWallet is no longer set via metadata - it's now reserved and managed via setAgentWallet()
|
|
189
187
|
|
|
190
188
|
# Add ENS name metadata
|
|
191
189
|
if self.ensEndpoint:
|
|
@@ -339,7 +337,7 @@ class Agent:
|
|
|
339
337
|
Add a skill to the OASF endpoint.
|
|
340
338
|
|
|
341
339
|
Args:
|
|
342
|
-
slug: The skill slug to add (e.g., "natural_language_processing/summarization")
|
|
340
|
+
slug: The skill slug to add (e.g., "natural_language_processing/natural_language_generation/summarization")
|
|
343
341
|
validate_oasf: If True, validate the slug against the OASF taxonomy (default: False)
|
|
344
342
|
|
|
345
343
|
Returns:
|
|
@@ -492,20 +490,55 @@ class Agent:
|
|
|
492
490
|
self.registration_file.updatedAt = int(time.time())
|
|
493
491
|
return self
|
|
494
492
|
|
|
495
|
-
def setAgentWallet(
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
493
|
+
def setAgentWallet(
|
|
494
|
+
self,
|
|
495
|
+
new_wallet: Address,
|
|
496
|
+
chainId: Optional[int] = None,
|
|
497
|
+
*,
|
|
498
|
+
new_wallet_signer: Optional[Union[str, Any]] = None,
|
|
499
|
+
deadline: Optional[int] = None,
|
|
500
|
+
signature: Optional[bytes] = None,
|
|
501
|
+
) -> 'Agent':
|
|
502
|
+
"""Set agent wallet address on-chain (ERC-8004 agentWallet).
|
|
503
|
+
|
|
504
|
+
This method is **on-chain only**. The `agentWallet` is a verified attribute and must be set via
|
|
505
|
+
the IdentityRegistry `setAgentWallet` function.
|
|
506
|
+
|
|
507
|
+
EOAs: provide `new_wallet_signer` (private key string or eth-account account) OR ensure the SDK
|
|
508
|
+
signer address matches `new_wallet` so the SDK can auto-sign.\n
|
|
509
|
+
Contract wallets (ERC-1271): provide `signature` bytes produced by the wallet’s signing mechanism.
|
|
510
|
+
The SDK will build the correct EIP-712 typed data internally, but cannot produce the wallet signature.
|
|
511
|
+
|
|
512
|
+
Args:
|
|
513
|
+
new_wallet: New wallet address (must be controlled by the signer that produces the signature)
|
|
514
|
+
chainId: Optional local bookkeeping for registration file (walletChainId). Defaults to agent chain.
|
|
515
|
+
new_wallet_signer: EOA signer used to sign the EIP-712 message (private key string or eth-account account)
|
|
516
|
+
deadline: Signature deadline timestamp. Defaults to now+60s (must be <= now+5min per contract).
|
|
517
|
+
signature: Raw signature bytes (intended for ERC-1271 / external signing only)
|
|
518
|
+
"""
|
|
519
|
+
# Breaking/clean: this API is only meaningful for already-registered agents.
|
|
520
|
+
if not self.agentId:
|
|
521
|
+
raise ValueError(
|
|
522
|
+
"Cannot set agent wallet before the agent is registered on-chain. "
|
|
523
|
+
"Call agent.register(...) / agent.registerIPFS() first to obtain agentId."
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
addr = new_wallet
|
|
527
|
+
|
|
528
|
+
if not addr:
|
|
529
|
+
raise ValueError("Wallet address cannot be empty. Use a non-zero address.")
|
|
507
530
|
|
|
508
|
-
#
|
|
531
|
+
# Validate address format
|
|
532
|
+
if not addr.startswith("0x") or len(addr) != 42:
|
|
533
|
+
raise ValueError(f"Invalid Ethereum address format: {addr}. Must be 42 characters starting with '0x'")
|
|
534
|
+
|
|
535
|
+
# Validate hexadecimal characters
|
|
536
|
+
try:
|
|
537
|
+
int(addr[2:], 16)
|
|
538
|
+
except ValueError:
|
|
539
|
+
raise ValueError(f"Invalid hexadecimal characters in address: {addr}")
|
|
540
|
+
|
|
541
|
+
# Determine chain ID to use (local bookkeeping)
|
|
509
542
|
if chainId is None:
|
|
510
543
|
# Extract chain ID from agentId if available, otherwise use SDK's chain ID
|
|
511
544
|
if self.agentId and ":" in self.agentId:
|
|
@@ -516,14 +549,104 @@ class Agent:
|
|
|
516
549
|
else:
|
|
517
550
|
chainId = self.sdk.chainId # Use SDK's chain ID as fallback
|
|
518
551
|
|
|
519
|
-
#
|
|
520
|
-
if
|
|
521
|
-
|
|
552
|
+
# Parse agent ID
|
|
553
|
+
agent_id_int = int(self.agentId.split(":")[-1]) if ":" in self.agentId else int(self.agentId)
|
|
554
|
+
|
|
555
|
+
# Check if wallet is already set to this address (skip if same)
|
|
556
|
+
try:
|
|
557
|
+
current_wallet = self.sdk.web3_client.call_contract(
|
|
558
|
+
self.sdk.identity_registry,
|
|
559
|
+
"getAgentWallet",
|
|
560
|
+
agent_id_int
|
|
561
|
+
)
|
|
562
|
+
if current_wallet and current_wallet.lower() == addr.lower():
|
|
563
|
+
logger.debug(f"Agent wallet is already set to {addr}, skipping on-chain update")
|
|
564
|
+
# Still update local registration file
|
|
565
|
+
self.registration_file.walletAddress = addr
|
|
566
|
+
self.registration_file.walletChainId = chainId
|
|
567
|
+
self.registration_file.updatedAt = int(time.time())
|
|
568
|
+
return self
|
|
569
|
+
except Exception as e:
|
|
570
|
+
logger.debug(f"Could not check current agent wallet: {e}, proceeding with update")
|
|
571
|
+
|
|
572
|
+
# Set deadline (default to 60 seconds from now; contract max is now+5min)
|
|
573
|
+
if deadline is None:
|
|
574
|
+
deadline = int(time.time()) + 60
|
|
575
|
+
|
|
576
|
+
# Resolve typed data + signature
|
|
577
|
+
identity_registry_address = self.sdk.identity_registry.address
|
|
578
|
+
owner_address = self.sdk.web3_client.call_contract(self.sdk.identity_registry, "ownerOf", agent_id_int)
|
|
579
|
+
|
|
580
|
+
full_message = self.sdk.web3_client.build_agent_wallet_set_typed_data(
|
|
581
|
+
agent_id=agent_id_int,
|
|
582
|
+
new_wallet=addr,
|
|
583
|
+
owner=owner_address,
|
|
584
|
+
deadline=deadline,
|
|
585
|
+
verifying_contract=identity_registry_address,
|
|
586
|
+
chain_id=self.sdk.web3_client.chain_id,
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
if signature is None:
|
|
590
|
+
# EOA signing paths
|
|
591
|
+
if new_wallet_signer is not None:
|
|
592
|
+
# Validate signer address matches addr (fail fast)
|
|
593
|
+
try:
|
|
594
|
+
from eth_account import Account as _Account
|
|
595
|
+
if isinstance(new_wallet_signer, str):
|
|
596
|
+
signer_addr = _Account.from_key(new_wallet_signer).address
|
|
597
|
+
else:
|
|
598
|
+
signer_addr = getattr(new_wallet_signer, "address", None)
|
|
599
|
+
except Exception:
|
|
600
|
+
signer_addr = getattr(new_wallet_signer, "address", None)
|
|
601
|
+
|
|
602
|
+
if not signer_addr or signer_addr.lower() != addr.lower():
|
|
603
|
+
raise ValueError(
|
|
604
|
+
f"new_wallet_signer address ({signer_addr}) does not match new_wallet ({addr})."
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
signature = self.sdk.web3_client.sign_typed_data(full_message, new_wallet_signer) # type: ignore[arg-type]
|
|
608
|
+
else:
|
|
609
|
+
# Auto-sign only if SDK signer == new wallet
|
|
610
|
+
current_address = self.sdk.web3_client.account.address if self.sdk.web3_client.account else None
|
|
611
|
+
if current_address and current_address.lower() == addr.lower():
|
|
612
|
+
signature = self.sdk.web3_client.sign_typed_data(full_message, self.sdk.web3_client.account)
|
|
613
|
+
else:
|
|
614
|
+
raise ValueError(
|
|
615
|
+
f"New wallet must sign. Provide new_wallet_signer (EOA) or signature (ERC-1271/external). "
|
|
616
|
+
f"SDK signer is {current_address}, new_wallet is {addr}."
|
|
617
|
+
)
|
|
618
|
+
|
|
619
|
+
# Optional: verify recover matches addr for EOA signatures
|
|
620
|
+
recovered = self.sdk.web3_client.w3.eth.account.recover_message(
|
|
621
|
+
__import__("eth_account.messages").messages.encode_typed_data(full_message=full_message),
|
|
622
|
+
signature=signature,
|
|
623
|
+
)
|
|
624
|
+
if recovered.lower() != addr.lower():
|
|
625
|
+
raise ValueError(f"Signature verification failed: recovered {recovered} but expected {addr}")
|
|
626
|
+
|
|
627
|
+
# Call setAgentWallet on the contract
|
|
628
|
+
try:
|
|
629
|
+
txHash = self.sdk.web3_client.transact_contract(
|
|
630
|
+
self.sdk.identity_registry,
|
|
631
|
+
"setAgentWallet",
|
|
632
|
+
agent_id_int,
|
|
633
|
+
addr,
|
|
634
|
+
deadline,
|
|
635
|
+
signature
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
# Wait for transaction
|
|
639
|
+
receipt = self.sdk.web3_client.wait_for_transaction(txHash)
|
|
640
|
+
logger.debug(f"Agent wallet set on-chain: {txHash}")
|
|
641
|
+
|
|
642
|
+
except Exception as e:
|
|
643
|
+
raise ValueError(f"Failed to set agent wallet on-chain: {e}")
|
|
522
644
|
|
|
523
645
|
# Update local registration file
|
|
524
646
|
self.registration_file.walletAddress = addr
|
|
525
647
|
self.registration_file.walletChainId = chainId
|
|
526
648
|
self.registration_file.updatedAt = int(time.time())
|
|
649
|
+
self._last_registered_wallet = addr
|
|
527
650
|
|
|
528
651
|
return self
|
|
529
652
|
|
|
@@ -636,7 +759,7 @@ class Agent:
|
|
|
636
759
|
agentId = int(self.agentId.split(":")[-1])
|
|
637
760
|
txHash = self.sdk.web3_client.transact_contract(
|
|
638
761
|
self.sdk.identity_registry,
|
|
639
|
-
"
|
|
762
|
+
"setAgentURI",
|
|
640
763
|
agentId,
|
|
641
764
|
f"ipfs://{ipfsCid}"
|
|
642
765
|
)
|
|
@@ -673,7 +796,7 @@ class Agent:
|
|
|
673
796
|
agentId = int(self.agentId.split(":")[-1])
|
|
674
797
|
txHash = self.sdk.web3_client.transact_contract(
|
|
675
798
|
self.sdk.identity_registry,
|
|
676
|
-
"
|
|
799
|
+
"setAgentURI",
|
|
677
800
|
agentId,
|
|
678
801
|
f"ipfs://{ipfsCid}"
|
|
679
802
|
)
|
|
@@ -715,7 +838,7 @@ class Agent:
|
|
|
715
838
|
txHash = self.sdk.web3_client.transact_contract(
|
|
716
839
|
self.sdk.identity_registry,
|
|
717
840
|
"register",
|
|
718
|
-
"", # Empty
|
|
841
|
+
"", # Empty agentURI for now
|
|
719
842
|
metadata_entries
|
|
720
843
|
)
|
|
721
844
|
|
|
@@ -820,7 +943,7 @@ class Agent:
|
|
|
820
943
|
agentId = int(self.registration_file.agentId.split(":")[-1])
|
|
821
944
|
txHash = self.sdk.web3_client.transact_contract(
|
|
822
945
|
self.sdk.identity_registry,
|
|
823
|
-
"
|
|
946
|
+
"setAgentURI",
|
|
824
947
|
agentId,
|
|
825
948
|
agentURI
|
|
826
949
|
)
|
|
@@ -846,7 +969,12 @@ class Agent:
|
|
|
846
969
|
approve_operator: bool = False,
|
|
847
970
|
idem: Optional[IdemKey] = None,
|
|
848
971
|
) -> Dict[str, Any]:
|
|
849
|
-
"""Transfer agent ownership.
|
|
972
|
+
"""Transfer agent ownership.
|
|
973
|
+
|
|
974
|
+
Note: When an agent is transferred, the agentWallet is automatically reset
|
|
975
|
+
to the zero address on-chain. The new owner must call setAgentWallet() to
|
|
976
|
+
set a new wallet address with EIP-712 signature verification.
|
|
977
|
+
"""
|
|
850
978
|
if not self.registration_file.agentId:
|
|
851
979
|
raise ValueError("Agent must be registered before transferring")
|
|
852
980
|
|
|
@@ -863,6 +991,11 @@ class Agent:
|
|
|
863
991
|
|
|
864
992
|
receipt = self.sdk.web3_client.wait_for_transaction(txHash)
|
|
865
993
|
|
|
994
|
+
# Note: agentWallet will be reset to zero address by the contract
|
|
995
|
+
# Update local state to reflect this
|
|
996
|
+
self.registration_file.walletAddress = None
|
|
997
|
+
self._last_registered_wallet = None
|
|
998
|
+
|
|
866
999
|
return {
|
|
867
1000
|
"txHash": txHash,
|
|
868
1001
|
"agentId": self.registration_file.agentId,
|
|
@@ -907,6 +1040,10 @@ class Agent:
|
|
|
907
1040
|
|
|
908
1041
|
Only the current owner can transfer the agent.
|
|
909
1042
|
|
|
1043
|
+
Note: When an agent is transferred, the agentWallet is automatically reset
|
|
1044
|
+
to the zero address on-chain. The new owner must call setAgentWallet() to
|
|
1045
|
+
set a new wallet address with EIP-712 signature verification.
|
|
1046
|
+
|
|
910
1047
|
Args:
|
|
911
1048
|
newOwnerAddress: Ethereum address of the new owner
|
|
912
1049
|
|
|
@@ -964,6 +1101,11 @@ class Agent:
|
|
|
964
1101
|
|
|
965
1102
|
logger.debug(f"Agent {self.registration_file.agentId} successfully transferred to {checksum_address}")
|
|
966
1103
|
|
|
1104
|
+
# Note: agentWallet will be reset to zero address by the contract
|
|
1105
|
+
# Update local state to reflect this
|
|
1106
|
+
self.registration_file.walletAddress = None
|
|
1107
|
+
self._last_registered_wallet = None
|
|
1108
|
+
|
|
967
1109
|
return {"txHash": txHash, "from": currentOwner, "to": checksum_address, "agentId": self.registration_file.agentId}
|
|
968
1110
|
|
|
969
1111
|
def activate(self, idem: Optional[IdemKey] = None) -> RegistrationFile:
|
agent0_sdk/core/contracts.py
CHANGED
|
@@ -99,7 +99,7 @@ IDENTITY_REGISTRY_ABI = [
|
|
|
99
99
|
"type": "function"
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
|
-
"inputs": [{"internalType": "string", "name": "
|
|
102
|
+
"inputs": [{"internalType": "string", "name": "agentURI", "type": "string"}],
|
|
103
103
|
"name": "register",
|
|
104
104
|
"outputs": [{"internalType": "uint256", "name": "agentId", "type": "uint256"}],
|
|
105
105
|
"stateMutability": "nonpayable",
|
|
@@ -107,7 +107,7 @@ IDENTITY_REGISTRY_ABI = [
|
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
"inputs": [
|
|
110
|
-
{"internalType": "string", "name": "
|
|
110
|
+
{"internalType": "string", "name": "agentURI", "type": "string"},
|
|
111
111
|
{
|
|
112
112
|
"components": [
|
|
113
113
|
{"internalType": "string", "name": "key", "type": "string"},
|
|
@@ -147,9 +147,30 @@ IDENTITY_REGISTRY_ABI = [
|
|
|
147
147
|
{
|
|
148
148
|
"inputs": [
|
|
149
149
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
150
|
-
{"internalType": "string", "name": "
|
|
150
|
+
{"internalType": "string", "name": "newURI", "type": "string"}
|
|
151
151
|
],
|
|
152
|
-
"name": "
|
|
152
|
+
"name": "setAgentURI",
|
|
153
|
+
"outputs": [],
|
|
154
|
+
"stateMutability": "nonpayable",
|
|
155
|
+
"type": "function"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"inputs": [
|
|
159
|
+
{"internalType": "uint256", "name": "agentId", "type": "uint256"}
|
|
160
|
+
],
|
|
161
|
+
"name": "getAgentWallet",
|
|
162
|
+
"outputs": [{"internalType": "address", "name": "", "type": "address"}],
|
|
163
|
+
"stateMutability": "view",
|
|
164
|
+
"type": "function"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"inputs": [
|
|
168
|
+
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
169
|
+
{"internalType": "address", "name": "newWallet", "type": "address"},
|
|
170
|
+
{"internalType": "uint256", "name": "deadline", "type": "uint256"},
|
|
171
|
+
{"internalType": "bytes", "name": "signature", "type": "bytes"}
|
|
172
|
+
],
|
|
173
|
+
"name": "setAgentWallet",
|
|
153
174
|
"outputs": [],
|
|
154
175
|
"stateMutability": "nonpayable",
|
|
155
176
|
"type": "function"
|
|
@@ -160,12 +181,22 @@ IDENTITY_REGISTRY_ABI = [
|
|
|
160
181
|
"anonymous": False,
|
|
161
182
|
"inputs": [
|
|
162
183
|
{"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
163
|
-
{"indexed": False, "internalType": "string", "name": "
|
|
184
|
+
{"indexed": False, "internalType": "string", "name": "agentURI", "type": "string"},
|
|
164
185
|
{"indexed": True, "internalType": "address", "name": "owner", "type": "address"}
|
|
165
186
|
],
|
|
166
187
|
"name": "Registered",
|
|
167
188
|
"type": "event"
|
|
168
189
|
},
|
|
190
|
+
{
|
|
191
|
+
"anonymous": False,
|
|
192
|
+
"inputs": [
|
|
193
|
+
{"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
194
|
+
{"indexed": False, "internalType": "string", "name": "newURI", "type": "string"},
|
|
195
|
+
{"indexed": True, "internalType": "address", "name": "updatedBy", "type": "address"}
|
|
196
|
+
],
|
|
197
|
+
"name": "URIUpdated",
|
|
198
|
+
"type": "event"
|
|
199
|
+
},
|
|
169
200
|
{
|
|
170
201
|
"anonymous": False,
|
|
171
202
|
"inputs": [
|
|
@@ -192,11 +223,11 @@ REPUTATION_REGISTRY_ABI = [
|
|
|
192
223
|
"inputs": [
|
|
193
224
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
194
225
|
{"internalType": "uint8", "name": "score", "type": "uint8"},
|
|
195
|
-
{"internalType": "
|
|
196
|
-
{"internalType": "
|
|
197
|
-
{"internalType": "string", "name": "
|
|
198
|
-
{"internalType": "
|
|
199
|
-
{"internalType": "
|
|
226
|
+
{"internalType": "string", "name": "tag1", "type": "string"},
|
|
227
|
+
{"internalType": "string", "name": "tag2", "type": "string"},
|
|
228
|
+
{"internalType": "string", "name": "endpoint", "type": "string"},
|
|
229
|
+
{"internalType": "string", "name": "feedbackURI", "type": "string"},
|
|
230
|
+
{"internalType": "bytes32", "name": "feedbackHash", "type": "bytes32"}
|
|
200
231
|
],
|
|
201
232
|
"name": "giveFeedback",
|
|
202
233
|
"outputs": [],
|
|
@@ -218,7 +249,7 @@ REPUTATION_REGISTRY_ABI = [
|
|
|
218
249
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
219
250
|
{"internalType": "address", "name": "clientAddress", "type": "address"},
|
|
220
251
|
{"internalType": "uint64", "name": "feedbackIndex", "type": "uint64"},
|
|
221
|
-
{"internalType": "string", "name": "
|
|
252
|
+
{"internalType": "string", "name": "responseURI", "type": "string"},
|
|
222
253
|
{"internalType": "bytes32", "name": "responseHash", "type": "bytes32"}
|
|
223
254
|
],
|
|
224
255
|
"name": "appendResponse",
|
|
@@ -240,13 +271,13 @@ REPUTATION_REGISTRY_ABI = [
|
|
|
240
271
|
"inputs": [
|
|
241
272
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
242
273
|
{"internalType": "address", "name": "clientAddress", "type": "address"},
|
|
243
|
-
{"internalType": "uint64", "name": "
|
|
274
|
+
{"internalType": "uint64", "name": "feedbackIndex", "type": "uint64"}
|
|
244
275
|
],
|
|
245
276
|
"name": "readFeedback",
|
|
246
277
|
"outputs": [
|
|
247
278
|
{"internalType": "uint8", "name": "score", "type": "uint8"},
|
|
248
|
-
{"internalType": "
|
|
249
|
-
{"internalType": "
|
|
279
|
+
{"internalType": "string", "name": "tag1", "type": "string"},
|
|
280
|
+
{"internalType": "string", "name": "tag2", "type": "string"},
|
|
250
281
|
{"internalType": "bool", "name": "isRevoked", "type": "bool"}
|
|
251
282
|
],
|
|
252
283
|
"stateMutability": "view",
|
|
@@ -256,8 +287,8 @@ REPUTATION_REGISTRY_ABI = [
|
|
|
256
287
|
"inputs": [
|
|
257
288
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
258
289
|
{"internalType": "address[]", "name": "clientAddresses", "type": "address[]"},
|
|
259
|
-
{"internalType": "
|
|
260
|
-
{"internalType": "
|
|
290
|
+
{"internalType": "string", "name": "tag1", "type": "string"},
|
|
291
|
+
{"internalType": "string", "name": "tag2", "type": "string"}
|
|
261
292
|
],
|
|
262
293
|
"name": "getSummary",
|
|
263
294
|
"outputs": [
|
|
@@ -271,16 +302,17 @@ REPUTATION_REGISTRY_ABI = [
|
|
|
271
302
|
"inputs": [
|
|
272
303
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
273
304
|
{"internalType": "address[]", "name": "clientAddresses", "type": "address[]"},
|
|
274
|
-
{"internalType": "
|
|
275
|
-
{"internalType": "
|
|
305
|
+
{"internalType": "string", "name": "tag1", "type": "string"},
|
|
306
|
+
{"internalType": "string", "name": "tag2", "type": "string"},
|
|
276
307
|
{"internalType": "bool", "name": "includeRevoked", "type": "bool"}
|
|
277
308
|
],
|
|
278
309
|
"name": "readAllFeedback",
|
|
279
310
|
"outputs": [
|
|
280
|
-
{"internalType": "address[]", "name": "
|
|
311
|
+
{"internalType": "address[]", "name": "clientAddresses", "type": "address[]"},
|
|
312
|
+
{"internalType": "uint64[]", "name": "feedbackIndexes", "type": "uint64[]"},
|
|
281
313
|
{"internalType": "uint8[]", "name": "scores", "type": "uint8[]"},
|
|
282
|
-
{"internalType": "
|
|
283
|
-
{"internalType": "
|
|
314
|
+
{"internalType": "string[]", "name": "tag1s", "type": "string[]"},
|
|
315
|
+
{"internalType": "string[]", "name": "tag2s", "type": "string[]"},
|
|
284
316
|
{"internalType": "bool[]", "name": "revokedStatuses", "type": "bool[]"}
|
|
285
317
|
],
|
|
286
318
|
"stateMutability": "view",
|
|
@@ -312,10 +344,12 @@ REPUTATION_REGISTRY_ABI = [
|
|
|
312
344
|
"inputs": [
|
|
313
345
|
{"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
314
346
|
{"indexed": True, "internalType": "address", "name": "clientAddress", "type": "address"},
|
|
347
|
+
{"indexed": False, "internalType": "uint64", "name": "feedbackIndex", "type": "uint64"},
|
|
315
348
|
{"indexed": False, "internalType": "uint8", "name": "score", "type": "uint8"},
|
|
316
|
-
{"indexed": True, "internalType": "
|
|
317
|
-
{"indexed": False, "internalType": "
|
|
318
|
-
{"indexed": False, "internalType": "string", "name": "
|
|
349
|
+
{"indexed": True, "internalType": "string", "name": "tag1", "type": "string"},
|
|
350
|
+
{"indexed": False, "internalType": "string", "name": "tag2", "type": "string"},
|
|
351
|
+
{"indexed": False, "internalType": "string", "name": "endpoint", "type": "string"},
|
|
352
|
+
{"indexed": False, "internalType": "string", "name": "feedbackURI", "type": "string"},
|
|
319
353
|
{"indexed": False, "internalType": "bytes32", "name": "feedbackHash", "type": "bytes32"}
|
|
320
354
|
],
|
|
321
355
|
"name": "NewFeedback",
|
|
@@ -336,10 +370,9 @@ REPUTATION_REGISTRY_ABI = [
|
|
|
336
370
|
"inputs": [
|
|
337
371
|
{"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
338
372
|
{"indexed": True, "internalType": "address", "name": "clientAddress", "type": "address"},
|
|
339
|
-
{"indexed":
|
|
373
|
+
{"indexed": True, "internalType": "uint64", "name": "feedbackIndex", "type": "uint64"},
|
|
340
374
|
{"indexed": True, "internalType": "address", "name": "responder", "type": "address"},
|
|
341
|
-
{"indexed": False, "internalType": "string", "name": "
|
|
342
|
-
{"indexed": False, "internalType": "bytes32", "name": "responseHash", "type": "bytes32"}
|
|
375
|
+
{"indexed": False, "internalType": "string", "name": "responseURI", "type": "string"}
|
|
343
376
|
],
|
|
344
377
|
"name": "ResponseAppended",
|
|
345
378
|
"type": "event"
|
|
@@ -371,9 +404,9 @@ VALIDATION_REGISTRY_ABI = [
|
|
|
371
404
|
"inputs": [
|
|
372
405
|
{"internalType": "bytes32", "name": "requestHash", "type": "bytes32"},
|
|
373
406
|
{"internalType": "uint8", "name": "response", "type": "uint8"},
|
|
374
|
-
{"internalType": "string", "name": "
|
|
407
|
+
{"internalType": "string", "name": "responseURI", "type": "string"},
|
|
375
408
|
{"internalType": "bytes32", "name": "responseHash", "type": "bytes32"},
|
|
376
|
-
{"internalType": "
|
|
409
|
+
{"internalType": "string", "name": "tag", "type": "string"}
|
|
377
410
|
],
|
|
378
411
|
"name": "validationResponse",
|
|
379
412
|
"outputs": [],
|
|
@@ -387,8 +420,7 @@ VALIDATION_REGISTRY_ABI = [
|
|
|
387
420
|
{"internalType": "address", "name": "validatorAddress", "type": "address"},
|
|
388
421
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
389
422
|
{"internalType": "uint8", "name": "response", "type": "uint8"},
|
|
390
|
-
{"internalType": "
|
|
391
|
-
{"internalType": "bytes32", "name": "tag", "type": "bytes32"},
|
|
423
|
+
{"internalType": "string", "name": "tag", "type": "string"},
|
|
392
424
|
{"internalType": "uint256", "name": "lastUpdate", "type": "uint256"}
|
|
393
425
|
],
|
|
394
426
|
"stateMutability": "view",
|
|
@@ -398,12 +430,12 @@ VALIDATION_REGISTRY_ABI = [
|
|
|
398
430
|
"inputs": [
|
|
399
431
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
400
432
|
{"internalType": "address[]", "name": "validatorAddresses", "type": "address[]"},
|
|
401
|
-
{"internalType": "
|
|
433
|
+
{"internalType": "string", "name": "tag", "type": "string"}
|
|
402
434
|
],
|
|
403
435
|
"name": "getSummary",
|
|
404
436
|
"outputs": [
|
|
405
437
|
{"internalType": "uint64", "name": "count", "type": "uint64"},
|
|
406
|
-
{"internalType": "uint8", "name": "
|
|
438
|
+
{"internalType": "uint8", "name": "averageResponse", "type": "uint8"}
|
|
407
439
|
],
|
|
408
440
|
"stateMutability": "view",
|
|
409
441
|
"type": "function"
|
|
@@ -429,8 +461,7 @@ VALIDATION_REGISTRY_ABI = [
|
|
|
429
461
|
{"internalType": "address", "name": "validatorAddress", "type": "address"},
|
|
430
462
|
{"internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
431
463
|
{"internalType": "uint8", "name": "response", "type": "uint8"},
|
|
432
|
-
{"internalType": "
|
|
433
|
-
{"internalType": "bytes32", "name": "tag", "type": "bytes32"},
|
|
464
|
+
{"internalType": "string", "name": "tag", "type": "string"},
|
|
434
465
|
{"internalType": "uint256", "name": "lastUpdate", "type": "uint256"}
|
|
435
466
|
],
|
|
436
467
|
"stateMutability": "view",
|
|
@@ -456,9 +487,9 @@ VALIDATION_REGISTRY_ABI = [
|
|
|
456
487
|
{"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
|
|
457
488
|
{"indexed": True, "internalType": "bytes32", "name": "requestHash", "type": "bytes32"},
|
|
458
489
|
{"indexed": False, "internalType": "uint8", "name": "response", "type": "uint8"},
|
|
459
|
-
{"indexed": False, "internalType": "string", "name": "
|
|
490
|
+
{"indexed": False, "internalType": "string", "name": "responseURI", "type": "string"},
|
|
460
491
|
{"indexed": False, "internalType": "bytes32", "name": "responseHash", "type": "bytes32"},
|
|
461
|
-
{"indexed": False, "internalType": "
|
|
492
|
+
{"indexed": False, "internalType": "string", "name": "tag", "type": "string"}
|
|
462
493
|
],
|
|
463
494
|
"name": "ValidationResponse",
|
|
464
495
|
"type": "event"
|
|
@@ -466,32 +497,36 @@ VALIDATION_REGISTRY_ABI = [
|
|
|
466
497
|
]
|
|
467
498
|
|
|
468
499
|
# Contract registry for different chains
|
|
500
|
+
# Updated addresses from: https://github.com/erc-8004/erc-8004-contracts
|
|
469
501
|
DEFAULT_REGISTRIES: Dict[int, Dict[str, str]] = {
|
|
470
502
|
11155111: { # Ethereum Sepolia
|
|
471
|
-
"IDENTITY": "
|
|
472
|
-
"REPUTATION": "
|
|
473
|
-
"VALIDATION": "
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
503
|
+
"IDENTITY": "0x8004A818BFB912233c491871b3d84c89A494BD9e",
|
|
504
|
+
"REPUTATION": "0x8004B663056A597Dffe9eCcC1965A193B7388713",
|
|
505
|
+
# "VALIDATION": "0x...", # To be deployed
|
|
506
|
+
},
|
|
507
|
+
# Other chains temporarily disabled - addresses to be deployed
|
|
508
|
+
# 84532: { # Base Sepolia
|
|
509
|
+
# "IDENTITY": "0x...", # To be deployed
|
|
510
|
+
# "REPUTATION": "0x...", # To be deployed
|
|
511
|
+
# "VALIDATION": "0x...", # To be deployed
|
|
512
|
+
# },
|
|
513
|
+
# 80002: { # Polygon Amoy
|
|
514
|
+
# "IDENTITY": "0x...", # To be deployed
|
|
515
|
+
# "REPUTATION": "0x...", # To be deployed
|
|
516
|
+
# "VALIDATION": "0x...", # To be deployed
|
|
517
|
+
# },
|
|
518
|
+
# 59141: { # Linea Sepolia
|
|
519
|
+
# "IDENTITY": "0x...", # To be deployed
|
|
520
|
+
# "REPUTATION": "0x...", # To be deployed
|
|
521
|
+
# "VALIDATION": "0x...", # To be deployed
|
|
522
|
+
# },
|
|
490
523
|
}
|
|
491
524
|
|
|
492
525
|
# Default subgraph URLs for different chains
|
|
526
|
+
# Note: Subgraph URLs may need to be updated when new contracts are deployed
|
|
493
527
|
DEFAULT_SUBGRAPH_URLS: Dict[int, str] = {
|
|
494
528
|
11155111: "https://gateway.thegraph.com/api/00a452ad3cd1900273ea62c1bf283f93/subgraphs/id/6wQRC7geo9XYAhckfmfo8kbMRLeWU8KQd3XsJqFKmZLT", # Ethereum Sepolia
|
|
495
|
-
|
|
496
|
-
|
|
529
|
+
# Other chains temporarily disabled - subgraphs to be updated
|
|
530
|
+
# 84532: "https://gateway.thegraph.com/api/...", # Base Sepolia - To be updated
|
|
531
|
+
# 80002: "https://gateway.thegraph.com/api/...", # Polygon Amoy - To be updated
|
|
497
532
|
}
|