ethagent 2.0.1 → 2.1.0

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.
Files changed (40) hide show
  1. package/README.md +6 -6
  2. package/package.json +1 -1
  3. package/src/chat/ChatScreen.tsx +1 -3
  4. package/src/identity/hub/OperationalRoutes.tsx +3 -3
  5. package/src/identity/hub/components/IdentitySummary.tsx +1 -1
  6. package/src/identity/hub/components/MenuScreen.tsx +2 -2
  7. package/src/identity/hub/effects/index.ts +1 -1
  8. package/src/identity/hub/effects/profile/profileState.ts +32 -32
  9. package/src/identity/hub/effects/publicProfile/runPublicProfileSave.ts +8 -8
  10. package/src/identity/hub/effects/rebackup/runRebackup.ts +2 -2
  11. package/src/identity/hub/effects/rebackup/{operatorVault.ts → vault.ts} +8 -8
  12. package/src/identity/hub/effects/restore/apply.ts +2 -2
  13. package/src/identity/hub/effects/restore/recovery.ts +2 -2
  14. package/src/identity/hub/effects/shared/sync.ts +3 -3
  15. package/src/identity/hub/effects/vault/preflight.ts +8 -8
  16. package/src/identity/hub/flows/create/CreateFlow.tsx +2 -2
  17. package/src/identity/hub/flows/custody/CustodyEditFlow.tsx +11 -11
  18. package/src/identity/hub/flows/custody/custodyEffects.ts +20 -20
  19. package/src/identity/hub/flows/custody/custodyFlowActions.ts +10 -10
  20. package/src/identity/hub/flows/custody/custodyFlowEffects.ts +2 -2
  21. package/src/identity/hub/flows/custody/custodyFlowRoutes.tsx +14 -14
  22. package/src/identity/hub/flows/ens/EnsEditAdvancedScreens.tsx +2 -2
  23. package/src/identity/hub/flows/ens/EnsEditReviewScreens.tsx +2 -2
  24. package/src/identity/hub/model/copy.ts +1 -1
  25. package/src/identity/hub/model/errors.ts +6 -6
  26. package/src/identity/hub/reconciliation/agentReconciliation/ownership.ts +1 -1
  27. package/src/identity/hub/reconciliation/agentReconciliation/run.ts +4 -4
  28. package/src/identity/hub/useIdentityHubController.ts +3 -3
  29. package/src/identity/identityCompat.ts +3 -3
  30. package/src/identity/registry/erc8004/discovery.ts +1 -1
  31. package/src/identity/registry/erc8004/ownership.ts +4 -4
  32. package/src/identity/registry/{operatorVault → vault}/bytecode.ts +15 -15
  33. package/src/identity/registry/vault/constants.ts +38 -0
  34. package/src/identity/registry/{operatorVault → vault}/read.ts +14 -14
  35. package/src/identity/registry/{operatorVault → vault}/transactions.ts +5 -5
  36. package/src/identity/registry/vault.ts +44 -0
  37. package/src/identity/wallet/page/copy.ts +11 -11
  38. package/src/storage/config.ts +3 -3
  39. package/src/identity/registry/operatorVault/constants.ts +0 -38
  40. package/src/identity/registry/operatorVault.ts +0 -44
@@ -0,0 +1,38 @@
1
+ import { getAddress, keccak256, parseAbi, type Address, type Hex } from 'viem'
2
+
3
+ export const VAULT_ABI = parseAbi([
4
+ 'constructor(address registry, uint256 agentId)',
5
+ 'function agentOwner(address registry, uint256 agentId) view returns (address)',
6
+ 'function metadataOperators(address registry, uint256 agentId, address operator) view returns (bool)',
7
+ 'function heldAgent() view returns (address registry, uint256 agentId, address owner)',
8
+ 'function setMetadataOperator(address registry, uint256 agentId, address operator, bool approved)',
9
+ 'function unwrap(address registry, uint256 agentId, address recipient)',
10
+ 'function rotateAgentURI(address registry, uint256 agentId, string newURI)',
11
+ 'event AgentDeposited(address indexed registry, uint256 indexed agentId, address indexed owner)',
12
+ 'event AgentUnwrapped(address indexed registry, uint256 indexed agentId, address indexed recipient)',
13
+ 'event MetadataOperatorChanged(address indexed registry, uint256 indexed agentId, address indexed operator, bool approved)',
14
+ 'event AgentURIRotated(address indexed registry, uint256 indexed agentId, string newURI, address indexed signer)',
15
+ ])
16
+
17
+ export const VAULT_ADDRESSES: Record<number, Address> = {
18
+ }
19
+
20
+ export function vaultAddressForChain(chainId: number): Address | undefined {
21
+ const address = VAULT_ADDRESSES[chainId]
22
+ return address ? getAddress(address) : undefined
23
+ }
24
+
25
+ export function resolveConfiguredVaultAddress(
26
+ operatorVaults: Readonly<Record<string, string>> | undefined,
27
+ chainId: number,
28
+ ): Address | undefined {
29
+ const fromConfig = operatorVaults?.[String(chainId)]
30
+ if (fromConfig) return getAddress(fromConfig)
31
+ return vaultAddressForChain(chainId)
32
+ }
33
+
34
+ export const VAULT_DEPLOY_BYTECODE: Hex = '0x608060405234801561001057600080fd5b5060405161090538038061090583398101604081905261002f91610058565b600080546001600160a01b0319166001600160a01b039390931692909217909155600155610092565b6000806040838503121561006b57600080fd5b82516001600160a01b038116811461008257600080fd5b6020939093015192949293505050565b610864806100a16000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80631c3bb2851161005b5780631c3bb2851461011157806324a3e2a1146101265780639a61ce8114610149578063b68f43451461015c57600080fd5b8063029ae47e146100825780631400a7e2146100b2578063150b7a02146100e5575b600080fd5b610095610090366004610602565b61016f565b6040516001600160a01b0390911681526020015b60405180910390f35b600254600354600454604080516001600160a01b03948516815260208101939093529216918101919091526060016100a9565b6100f86100f3366004610675565b61019a565b6040516001600160e01b031990911681526020016100a9565b61012461011f3660046106e4565b610293565b005b61013961013436600461073e565b610397565b60405190151581526020016100a9565b61012461015736600461077a565b6103d0565b61012461016a36600461073e565b6104a2565b600061017b83836105ab565b610186576000610193565b6004546001600160a01b03165b9392505050565b600080546001600160a01b0316331415806101b757506001548414155b156101d557604051639667ffdf60e01b815260040160405180910390fd5b6004546001600160a01b0316156101ff5760405163d5a8211560e01b815260040160405180910390fd5b60028054336001600160a01b0319918216179091556003859055600480549091166001600160a01b0387161790556005805460018101909155600003600019016102495760016005555b6040516001600160a01b03861690859033907f7b19af5fe09a0be4ed70b569401ce6fa0de072757b228cc2088350eccc2f987390600090a450630a85bd0160e11b95945050505050565b600061029f858561016f565b9050336001600160a01b038216148015906102c257506102c0858533610397565b155b156102e05760405163ea8e4eb560e01b815260040160405180910390fd5b604051630af28bd360e01b81526001600160a01b03861690630af28bd390610310908790879087906004016107f7565b600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b50505050336001600160a01b031684866001600160a01b03167fa455a129bb4260e5274d34dd213bcd11399667f80a0615e6cb375728d2e75a90868660405161038892919061081a565b60405180910390a45050505050565b60006103a384846105ab565b80156103c857506005546001600160a01b038316600090815260066020526040902054145b949350505050565b6103da848461016f565b6001600160a01b0316336001600160a01b03161461040b576040516330cd747160e01b815260040160405180910390fd5b8015610432576005546001600160a01b03831660009081526006602052604090205561044c565b6001600160a01b0382166000908152600660205260408120555b816001600160a01b031683856001600160a01b03167fea7d7802a5cc5520abde4345007961a980fcb27dca3030ca6aede6bdc58bd79e84604051610494911515815260200190565b60405180910390a450505050565b60006104ae848461016f565b9050336001600160a01b038216146104d9576040516330cd747160e01b815260040160405180910390fd5b600280546001600160a01b03199081169091556000600355600480549091168155604051632142170760e11b815230918101919091526001600160a01b038381166024830152604482018590528516906342842e0e90606401600060405180830381600087803b15801561054c57600080fd5b505af1158015610560573d6000803e3d6000fd5b50505050816001600160a01b031683856001600160a01b03167fa433e9204e6763dff9274d8c1febdbc7c60aa7d7e85c106d5b978372658438b860405160405180910390a450505050565b6004546000906001600160a01b0316158015906105d557506002546001600160a01b038481169116145b801561019357505060035414919050565b80356001600160a01b03811681146105fd57600080fd5b919050565b6000806040838503121561061557600080fd5b61061e836105e6565b946020939093013593505050565b60008083601f84011261063e57600080fd5b50813567ffffffffffffffff81111561065657600080fd5b60208301915083602082850101111561066e57600080fd5b9250929050565b60008060008060006080868803121561068d57600080fd5b610696866105e6565b94506106a4602087016105e6565b935060408601359250606086013567ffffffffffffffff8111156106c757600080fd5b6106d38882890161062c565b969995985093965092949392505050565b600080600080606085870312156106fa57600080fd5b610703856105e6565b935060208501359250604085013567ffffffffffffffff81111561072657600080fd5b6107328782880161062c565b95989497509550505050565b60008060006060848603121561075357600080fd5b61075c846105e6565b925060208401359150610771604085016105e6565b90509250925092565b6000806000806080858703121561079057600080fd5b610799856105e6565b9350602085013592506107ae604086016105e6565b9150606085013580151581146107c357600080fd5b939692955090935050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108116040830184866107ce565b95945050505050565b6020815260006103c86020830184866107ce56fea26469706673582212203c514f6e69c0746959c89bfc363da3784bb4420aa12883ab98363b28e6cd904a64736f6c63430008180033'
35
+
36
+ export const VAULT_RUNTIME_BYTECODE: Hex = '0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80631c3bb2851161005b5780631c3bb2851461011157806324a3e2a1146101265780639a61ce8114610149578063b68f43451461015c57600080fd5b8063029ae47e146100825780631400a7e2146100b2578063150b7a02146100e5575b600080fd5b610095610090366004610602565b61016f565b6040516001600160a01b0390911681526020015b60405180910390f35b600254600354600454604080516001600160a01b03948516815260208101939093529216918101919091526060016100a9565b6100f86100f3366004610675565b61019a565b6040516001600160e01b031990911681526020016100a9565b61012461011f3660046106e4565b610293565b005b61013961013436600461073e565b610397565b60405190151581526020016100a9565b61012461015736600461077a565b6103d0565b61012461016a36600461073e565b6104a2565b600061017b83836105ab565b610186576000610193565b6004546001600160a01b03165b9392505050565b600080546001600160a01b0316331415806101b757506001548414155b156101d557604051639667ffdf60e01b815260040160405180910390fd5b6004546001600160a01b0316156101ff5760405163d5a8211560e01b815260040160405180910390fd5b60028054336001600160a01b0319918216179091556003859055600480549091166001600160a01b0387161790556005805460018101909155600003600019016102495760016005555b6040516001600160a01b03861690859033907f7b19af5fe09a0be4ed70b569401ce6fa0de072757b228cc2088350eccc2f987390600090a450630a85bd0160e11b95945050505050565b600061029f858561016f565b9050336001600160a01b038216148015906102c257506102c0858533610397565b155b156102e05760405163ea8e4eb560e01b815260040160405180910390fd5b604051630af28bd360e01b81526001600160a01b03861690630af28bd390610310908790879087906004016107f7565b600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b50505050336001600160a01b031684866001600160a01b03167fa455a129bb4260e5274d34dd213bcd11399667f80a0615e6cb375728d2e75a90868660405161038892919061081a565b60405180910390a45050505050565b60006103a384846105ab565b80156103c857506005546001600160a01b038316600090815260066020526040902054145b949350505050565b6103da848461016f565b6001600160a01b0316336001600160a01b03161461040b576040516330cd747160e01b815260040160405180910390fd5b8015610432576005546001600160a01b03831660009081526006602052604090205561044c565b6001600160a01b0382166000908152600660205260408120555b816001600160a01b031683856001600160a01b03167fea7d7802a5cc5520abde4345007961a980fcb27dca3030ca6aede6bdc58bd79e84604051610494911515815260200190565b60405180910390a450505050565b60006104ae848461016f565b9050336001600160a01b038216146104d9576040516330cd747160e01b815260040160405180910390fd5b600280546001600160a01b03199081169091556000600355600480549091168155604051632142170760e11b815230918101919091526001600160a01b038381166024830152604482018590528516906342842e0e90606401600060405180830381600087803b15801561054c57600080fd5b505af1158015610560573d6000803e3d6000fd5b50505050816001600160a01b031683856001600160a01b03167fa433e9204e6763dff9274d8c1febdbc7c60aa7d7e85c106d5b978372658438b860405160405180910390a450505050565b6004546000906001600160a01b0316158015906105d557506002546001600160a01b038481169116145b801561019357505060035414919050565b80356001600160a01b03811681146105fd57600080fd5b919050565b6000806040838503121561061557600080fd5b61061e836105e6565b946020939093013593505050565b60008083601f84011261063e57600080fd5b50813567ffffffffffffffff81111561065657600080fd5b60208301915083602082850101111561066e57600080fd5b9250929050565b60008060008060006080868803121561068d57600080fd5b610696866105e6565b94506106a4602087016105e6565b935060408601359250606086013567ffffffffffffffff8111156106c757600080fd5b6106d38882890161062c565b969995985093965092949392505050565b600080600080606085870312156106fa57600080fd5b610703856105e6565b935060208501359250604085013567ffffffffffffffff81111561072657600080fd5b6107328782880161062c565b95989497509550505050565b60008060006060848603121561075357600080fd5b61075c846105e6565b925060208401359150610771604085016105e6565b90509250925092565b6000806000806080858703121561079057600080fd5b610799856105e6565b9350602085013592506107ae604086016105e6565b9150606085013580151581146107c357600080fd5b939692955090935050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108116040830184866107ce565b95945050505050565b6020815260006103c86020830184866107ce56fea26469706673582212203c514f6e69c0746959c89bfc363da3784bb4420aa12883ab98363b28e6cd904a64736f6c63430008180033'
37
+
38
+ export const VAULT_RUNTIME_BYTECODE_HASH: Hex = keccak256(VAULT_RUNTIME_BYTECODE)
@@ -1,11 +1,11 @@
1
1
  import { getAddress, parseAbi, parseAbiItem, type Address, type PublicClient } from 'viem'
2
- import { OPERATOR_VAULT_ABI } from './constants.js'
3
- import { delayMs, OPERATOR_VAULT_POLL_DELAY_MS, OPERATOR_VAULT_POLL_MAX_ATTEMPTS } from './bytecode.js'
2
+ import { VAULT_ABI } from './constants.js'
3
+ import { delayMs, VAULT_POLL_DELAY_MS, VAULT_POLL_MAX_ATTEMPTS } from './bytecode.js'
4
4
 
5
5
  const DISCOVER_LOG_WINDOW_MAX_ATTEMPTS = 3
6
6
  const DISCOVER_LOG_WINDOW_DELAY_MS = 2000
7
7
 
8
- export type OperatorVaultReadClient = Pick<PublicClient, 'readContract'>
8
+ export type VaultReadClient = Pick<PublicClient, 'readContract'>
9
9
 
10
10
  const ERC721_OWNER_OF_ABI = parseAbi([
11
11
  'function ownerOf(uint256 tokenId) view returns (address)',
@@ -44,7 +44,7 @@ export async function discoverPriorVaultFromTokenOwner(
44
44
  try {
45
45
  vaultLevelOwner = await args.client.readContract({
46
46
  address: candidate,
47
- abi: OPERATOR_VAULT_ABI,
47
+ abi: VAULT_ABI,
48
48
  functionName: 'agentOwner',
49
49
  args: [registryAddr, args.agentId],
50
50
  }) as Address
@@ -58,7 +58,7 @@ export async function discoverPriorVaultFromTokenOwner(
58
58
  }
59
59
 
60
60
  export type IsAgentInVaultArgs = {
61
- client: OperatorVaultReadClient
61
+ client: VaultReadClient
62
62
  vaultAddress: Address
63
63
  registry: Address
64
64
  agentId: bigint
@@ -69,7 +69,7 @@ export async function isAgentInVault(
69
69
  ): Promise<{ inVault: boolean; ownerAddress?: Address }> {
70
70
  const owner = await args.client.readContract({
71
71
  address: getAddress(args.vaultAddress),
72
- abi: OPERATOR_VAULT_ABI,
72
+ abi: VAULT_ABI,
73
73
  functionName: 'agentOwner',
74
74
  args: [getAddress(args.registry), args.agentId],
75
75
  }) as Address
@@ -83,8 +83,8 @@ export async function confirmAgentInVault(
83
83
  args: IsAgentInVaultArgs,
84
84
  ): Promise<{ inVault: true; ownerAddress: Address }> {
85
85
  let lastErr: unknown
86
- for (let attempt = 0; attempt < OPERATOR_VAULT_POLL_MAX_ATTEMPTS; attempt++) {
87
- if (attempt > 0) await delayMs(OPERATOR_VAULT_POLL_DELAY_MS)
86
+ for (let attempt = 0; attempt < VAULT_POLL_MAX_ATTEMPTS; attempt++) {
87
+ if (attempt > 0) await delayMs(VAULT_POLL_DELAY_MS)
88
88
  try {
89
89
  const status = await isAgentInVault(args)
90
90
  lastErr = undefined
@@ -97,7 +97,7 @@ export async function confirmAgentInVault(
97
97
  }
98
98
  if (lastErr) throw lastErr
99
99
  throw new Error(
100
- `Operator delegation vault ${getAddress(args.vaultAddress)} does not hold agent token #${args.agentId.toString()} for registry ${getAddress(args.registry)} after the deposit-confirmation budget was exhausted. The deposit transaction may have been re-orged or applied to the wrong vault. Re-run the switch.`,
100
+ `Vault ${getAddress(args.vaultAddress)} does not hold agent token #${args.agentId.toString()} for registry ${getAddress(args.registry)} after the deposit-confirmation budget was exhausted. The deposit transaction may have been re-orged or applied to the wrong vault. Re-run the switch.`,
101
101
  )
102
102
  }
103
103
 
@@ -111,8 +111,8 @@ export async function confirmAgentWithdrawnFromVault(
111
111
  const recipient = getAddress(args.recipient)
112
112
  let lastErr: unknown
113
113
  let lastObserved: string | undefined
114
- for (let attempt = 0; attempt < OPERATOR_VAULT_POLL_MAX_ATTEMPTS; attempt++) {
115
- if (attempt > 0) await delayMs(OPERATOR_VAULT_POLL_DELAY_MS)
114
+ for (let attempt = 0; attempt < VAULT_POLL_MAX_ATTEMPTS; attempt++) {
115
+ if (attempt > 0) await delayMs(VAULT_POLL_DELAY_MS)
116
116
  try {
117
117
  const status = await isAgentInVault(args)
118
118
  const tokenOwner = await args.client.readContract({
@@ -135,7 +135,7 @@ export async function confirmAgentWithdrawnFromVault(
135
135
  }
136
136
  if (lastErr) throw lastErr
137
137
  throw new Error(
138
- `Operator delegation vault ${getAddress(args.vaultAddress)} did not release agent token #${args.agentId.toString()} to ${recipient} after the withdraw-confirmation budget was exhausted. Last observed: ${lastObserved ?? 'unknown'}.`,
138
+ `Vault ${getAddress(args.vaultAddress)} did not release agent token #${args.agentId.toString()} to ${recipient} after the withdraw-confirmation budget was exhausted. Last observed: ${lastObserved ?? 'unknown'}.`,
139
139
  )
140
140
  }
141
141
 
@@ -218,7 +218,7 @@ export async function discoverVaultedTokens(
218
218
  }
219
219
 
220
220
  export type ReadMetadataOperatorsArgs = {
221
- client: OperatorVaultReadClient
221
+ client: VaultReadClient
222
222
  vaultAddress: Address
223
223
  registry: Address
224
224
  agentId: bigint
@@ -233,7 +233,7 @@ export async function readMetadataOperators(
233
233
  try {
234
234
  const approved = await args.client.readContract({
235
235
  address: getAddress(args.vaultAddress),
236
- abi: OPERATOR_VAULT_ABI,
236
+ abi: VAULT_ABI,
237
237
  functionName: 'metadataOperators',
238
238
  args: [getAddress(args.registry), args.agentId, getAddress(candidate)],
239
239
  }) as boolean
@@ -1,5 +1,5 @@
1
1
  import { encodeFunctionData, getAddress, parseAbi, type Address, type Hex } from 'viem'
2
- import { OPERATOR_VAULT_ABI } from './constants.js'
2
+ import { VAULT_ABI } from './constants.js'
3
3
 
4
4
  const ERC721_SAFE_TRANSFER_ABI = parseAbi([
5
5
  'function safeTransferFrom(address from, address to, uint256 tokenId)',
@@ -35,7 +35,7 @@ export function encodeSetMetadataOperator(args: SetMetadataOperatorArgs): { to:
35
35
  return {
36
36
  to: getAddress(args.vaultAddress),
37
37
  data: encodeFunctionData({
38
- abi: OPERATOR_VAULT_ABI,
38
+ abi: VAULT_ABI,
39
39
  functionName: 'setMetadataOperator',
40
40
  args: [getAddress(args.registry), args.agentId, getAddress(args.operator), args.approved],
41
41
  }),
@@ -53,7 +53,7 @@ export function encodeRotateAgentURI(args: RotateAgentURIArgs): { to: Address; d
53
53
  return {
54
54
  to: getAddress(args.vaultAddress),
55
55
  data: encodeFunctionData({
56
- abi: OPERATOR_VAULT_ABI,
56
+ abi: VAULT_ABI,
57
57
  functionName: 'rotateAgentURI',
58
58
  args: [getAddress(args.registry), args.agentId, args.newURI],
59
59
  }),
@@ -73,9 +73,9 @@ export function encodeUnwrapAgent(
73
73
  return {
74
74
  to: getAddress(args.vaultAddress),
75
75
  data: encodeFunctionData({
76
- abi: OPERATOR_VAULT_ABI,
76
+ abi: VAULT_ABI,
77
77
  functionName: 'unwrap',
78
- args: [getAddress(args.registry), args.agentId, getAddress(args.recipient)],
78
+ args: [getAddress(args.registry), args.agentId, args.recipient],
79
79
  }),
80
80
  }
81
81
  }
@@ -0,0 +1,44 @@
1
+ export {
2
+ VAULT_ABI,
3
+ VAULT_ADDRESSES,
4
+ VAULT_DEPLOY_BYTECODE,
5
+ VAULT_RUNTIME_BYTECODE,
6
+ VAULT_RUNTIME_BYTECODE_HASH,
7
+ vaultAddressForChain,
8
+ resolveConfiguredVaultAddress,
9
+ } from './vault/constants.js'
10
+ export {
11
+ VaultBytecodeMismatchError,
12
+ assertVaultBytecode,
13
+ formatVaultBytecodeMismatchDetail,
14
+ } from './vault/bytecode.js'
15
+ export type { AssertVaultBytecodeClient } from './vault/bytecode.js'
16
+ export {
17
+ encodeDepositAgent,
18
+ encodeRotateAgentURI,
19
+ encodeSetMetadataOperator,
20
+ encodeUnwrapAgent,
21
+ } from './vault/transactions.js'
22
+ export type {
23
+ DepositAgentArgs,
24
+ RotateAgentURIArgs,
25
+ SetMetadataOperatorArgs,
26
+ UnwrapAgentArgs,
27
+ } from './vault/transactions.js'
28
+ export {
29
+ confirmAgentWithdrawnFromVault,
30
+ confirmAgentInVault,
31
+ discoverPriorVaultFromTokenOwner,
32
+ discoverVaultedTokens,
33
+ isAgentInVault,
34
+ readMetadataOperators,
35
+ } from './vault/read.js'
36
+ export type {
37
+ ConfirmAgentWithdrawnArgs,
38
+ DiscoverPriorVaultArgs,
39
+ DiscoverPriorVaultClient,
40
+ DiscoverVaultedTokensArgs,
41
+ IsAgentInVaultArgs,
42
+ VaultReadClient,
43
+ ReadMetadataOperatorsArgs,
44
+ } from './vault/read.js'
@@ -93,7 +93,7 @@ export const PURPOSE_COPY: Record<string, PurposeCopyEntry> = {
93
93
  flowTitle: "Operator Wallet Save",
94
94
  sign: { text: "Sign With Operator Wallet", hint: "Signs the encrypted snapshot for restore access." },
95
95
  prepare: { text: "Saving Snapshot...", hint: "Keep this page open." },
96
- transaction: { text: "Use Operator Wallet", hint: "Rotates the ERC-8004 token URI through the operator delegation vault." },
96
+ transaction: { text: "Use Operator Wallet", hint: "Rotates the ERC-8004 token URI through the Vault." },
97
97
  },
98
98
  "update-snapshot-connected": {
99
99
  flowTitle: "Save Snapshot",
@@ -196,7 +196,7 @@ export const PURPOSE_COPY: Record<string, PurposeCopyEntry> = {
196
196
  "sync-operator-vault": {
197
197
  flowTitle: "Owner Wallet Required",
198
198
  prepare: { text: "Preparing Vault Operator Update...", hint: "Keep this page open." },
199
- transaction: { text: "Use Owner Wallet", hint: "Updates the operator delegation vault's metadata-operator list so authorized operator wallets can rotate the agent URI." },
199
+ transaction: { text: "Use Owner Wallet", hint: "Updates the Vault metadata-operator list so authorized operator wallets can rotate the agent URI." },
200
200
  },
201
201
  "refetch-snapshot": {
202
202
  flowTitle: "Refetch Latest Snapshot",
@@ -219,39 +219,39 @@ export const PURPOSE_COPY: Record<string, PurposeCopyEntry> = {
219
219
  transaction: { text: "Use Sender Wallet", hint: "Submits one transaction to publish the transfer snapshot to the ERC-8004 token URI." },
220
220
  },
221
221
  "deploy-agent-vault": {
222
- flowTitle: "Deploy Operator Delegation Vault",
222
+ flowTitle: "Deploy Vault",
223
223
  prepare: { text: "Preparing Vault Deploy...", hint: "Keep this page open." },
224
- transaction: { text: "Use Owner Wallet", hint: "Deploys the operator delegation vault contract onchain. One-time setup per agent." },
225
- errorContext: "While submitting the operator delegation vault deploy",
224
+ transaction: { text: "Use Owner Wallet", hint: "Deploys the Vault contract onchain. One-time setup per agent." },
225
+ errorContext: "While submitting the Vault deploy",
226
226
  },
227
227
  "deposit-agent-vault": {
228
228
  flowTitle: "Deposit Token Into Vault",
229
229
  prepare: { text: "Preparing Vault Deposit...", hint: "Keep this page open." },
230
- transaction: { text: "Use Owner Wallet", hint: "Sends the agent token to the operator delegation vault so the vault can save updates on your behalf." },
231
- errorContext: "While submitting the operator delegation vault deposit",
230
+ transaction: { text: "Use Owner Wallet", hint: "Sends the agent token to the Vault so the vault can save updates on your behalf." },
231
+ errorContext: "While submitting the Vault deposit",
232
232
  },
233
233
  "unwrap-agent-vault": {
234
234
  flowTitle: "Unwrap Token From Vault",
235
235
  prepare: { text: "Preparing Vault Unwrap...", hint: "Keep this page open." },
236
- transaction: { text: "Use Owner Wallet", hint: "Returns the agent token from the operator delegation vault to your owner wallet." },
236
+ transaction: { text: "Use Owner Wallet", hint: "Returns the agent token from the Vault to your owner wallet." },
237
237
  },
238
238
  "rotate-agent-uri-vault-owner": {
239
239
  flowTitle: "Save Update Through Vault",
240
240
  sign: { text: "Sign With Owner Wallet", hint: "Approves the new snapshot before saving onchain. No token approval." },
241
241
  prepare: { text: "Preparing Update...", hint: "Keep this page open." },
242
- transaction: { text: "Use Owner Wallet", hint: "Saves your update onchain through the operator delegation vault. The vault holds your token, so updates go through it." },
242
+ transaction: { text: "Use Owner Wallet", hint: "Saves your update onchain through the Vault. The vault holds your token, so updates go through it." },
243
243
  },
244
244
  "rotate-agent-uri-vault-operator": {
245
245
  flowTitle: "Save Update Through Vault",
246
246
  sign: { text: "Sign With Operator Wallet", hint: "Approves the new snapshot before saving onchain. No token approval." },
247
247
  prepare: { text: "Preparing Update...", hint: "Keep this page open." },
248
- transaction: { text: "Use Operator Wallet", hint: "Rotates the ERC-8004 token URI through the operator delegation vault. The vault holds your token, so the operator wallet calls the vault to publish." },
248
+ transaction: { text: "Use Operator Wallet", hint: "Rotates the ERC-8004 token URI through the Vault. The vault holds your token, so the operator wallet calls the vault to publish." },
249
249
  },
250
250
  "withdraw-vault": {
251
251
  flowTitle: "Withdraw Token From Vault",
252
252
  prepare: { text: "Preparing Token Withdrawal...", hint: "Keep this page open." },
253
253
  transaction: { text: "Use Owner Wallet", hint: "Temporarily returns the agent token from the vault to your owner wallet. Vault stays configured so you can redeposit later." },
254
- errorContext: "While submitting the operator delegation vault withdraw",
254
+ errorContext: "While submitting the Vault withdraw",
255
255
  },
256
256
  "register-root-commit": {
257
257
  flowTitle: "Commit ENS Name",
@@ -196,7 +196,7 @@ export async function saveConfigWithMerge(
196
196
  throw lastErr ?? new ConfigVersionStaleError(undefined, undefined)
197
197
  }
198
198
 
199
- export function getConfiguredOperatorVaultAddress(
199
+ export function getConfiguredVaultAddress(
200
200
  config: EthagentConfig | null | undefined,
201
201
  chainId: number,
202
202
  ): string | undefined {
@@ -223,13 +223,13 @@ export function buildSeedConfigForIdentity(args: {
223
223
  }
224
224
  }
225
225
 
226
- export function setConfiguredOperatorVaultAddress(
226
+ export function setConfiguredVaultAddress(
227
227
  config: EthagentConfig,
228
228
  chainId: number,
229
229
  vaultAddress: string,
230
230
  ): EthagentConfig {
231
231
  if (!config.erc8004) {
232
- throw new Error('Cannot record operator delegation vault address: erc8004 registry config is not set')
232
+ throw new Error('Cannot record Vault address: erc8004 registry config is not set')
233
233
  }
234
234
  return {
235
235
  ...config,
@@ -1,38 +0,0 @@
1
- import { getAddress, keccak256, parseAbi, type Address, type Hex } from 'viem'
2
-
3
- export const OPERATOR_VAULT_ABI = parseAbi([
4
- 'constructor(address registry, uint256 agentId)',
5
- 'function agentOwner(address registry, uint256 agentId) view returns (address)',
6
- 'function metadataOperators(address registry, uint256 agentId, address operator) view returns (bool)',
7
- 'function heldAgent() view returns (address registry, uint256 agentId, address owner)',
8
- 'function setMetadataOperator(address registry, uint256 agentId, address operator, bool approved)',
9
- 'function unwrap(address registry, uint256 agentId, address recipient)',
10
- 'function rotateAgentURI(address registry, uint256 agentId, string newURI)',
11
- 'event AgentDeposited(address indexed registry, uint256 indexed agentId, address indexed owner)',
12
- 'event AgentUnwrapped(address indexed registry, uint256 indexed agentId, address indexed recipient)',
13
- 'event MetadataOperatorChanged(address indexed registry, uint256 indexed agentId, address indexed operator, bool approved)',
14
- 'event AgentURIRotated(address indexed registry, uint256 indexed agentId, string newURI, address indexed signer)',
15
- ])
16
-
17
- export const OPERATOR_VAULT_ADDRESSES: Record<number, Address> = {
18
- }
19
-
20
- export function operatorVaultAddressForChain(chainId: number): Address | undefined {
21
- const address = OPERATOR_VAULT_ADDRESSES[chainId]
22
- return address ? getAddress(address) : undefined
23
- }
24
-
25
- export function resolveConfiguredOperatorVaultAddress(
26
- operatorVaults: Readonly<Record<string, string>> | undefined,
27
- chainId: number,
28
- ): Address | undefined {
29
- const fromConfig = operatorVaults?.[String(chainId)]
30
- if (fromConfig) return getAddress(fromConfig)
31
- return operatorVaultAddressForChain(chainId)
32
- }
33
-
34
- export const OPERATOR_VAULT_DEPLOY_BYTECODE: Hex = '0x608060405234801561001057600080fd5b5060405161090538038061090583398101604081905261002f91610058565b600080546001600160a01b0319166001600160a01b039390931692909217909155600155610092565b6000806040838503121561006b57600080fd5b82516001600160a01b038116811461008257600080fd5b6020939093015192949293505050565b610864806100a16000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80631c3bb2851161005b5780631c3bb2851461011157806324a3e2a1146101265780639a61ce8114610149578063b68f43451461015c57600080fd5b8063029ae47e146100825780631400a7e2146100b2578063150b7a02146100e5575b600080fd5b610095610090366004610602565b61016f565b6040516001600160a01b0390911681526020015b60405180910390f35b600254600354600454604080516001600160a01b03948516815260208101939093529216918101919091526060016100a9565b6100f86100f3366004610675565b61019a565b6040516001600160e01b031990911681526020016100a9565b61012461011f3660046106e4565b610293565b005b61013961013436600461073e565b610397565b60405190151581526020016100a9565b61012461015736600461077a565b6103d0565b61012461016a36600461073e565b6104a2565b600061017b83836105ab565b610186576000610193565b6004546001600160a01b03165b9392505050565b600080546001600160a01b0316331415806101b757506001548414155b156101d557604051639667ffdf60e01b815260040160405180910390fd5b6004546001600160a01b0316156101ff5760405163d5a8211560e01b815260040160405180910390fd5b60028054336001600160a01b0319918216179091556003859055600480549091166001600160a01b0387161790556005805460018101909155600003600019016102495760016005555b6040516001600160a01b03861690859033907f7b19af5fe09a0be4ed70b569401ce6fa0de072757b228cc2088350eccc2f987390600090a450630a85bd0160e11b95945050505050565b600061029f858561016f565b9050336001600160a01b038216148015906102c257506102c0858533610397565b155b156102e05760405163ea8e4eb560e01b815260040160405180910390fd5b604051630af28bd360e01b81526001600160a01b03861690630af28bd390610310908790879087906004016107f7565b600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b50505050336001600160a01b031684866001600160a01b03167fa455a129bb4260e5274d34dd213bcd11399667f80a0615e6cb375728d2e75a90868660405161038892919061081a565b60405180910390a45050505050565b60006103a384846105ab565b80156103c857506005546001600160a01b038316600090815260066020526040902054145b949350505050565b6103da848461016f565b6001600160a01b0316336001600160a01b03161461040b576040516330cd747160e01b815260040160405180910390fd5b8015610432576005546001600160a01b03831660009081526006602052604090205561044c565b6001600160a01b0382166000908152600660205260408120555b816001600160a01b031683856001600160a01b03167fea7d7802a5cc5520abde4345007961a980fcb27dca3030ca6aede6bdc58bd79e84604051610494911515815260200190565b60405180910390a450505050565b60006104ae848461016f565b9050336001600160a01b038216146104d9576040516330cd747160e01b815260040160405180910390fd5b600280546001600160a01b03199081169091556000600355600480549091168155604051632142170760e11b815230918101919091526001600160a01b038381166024830152604482018590528516906342842e0e90606401600060405180830381600087803b15801561054c57600080fd5b505af1158015610560573d6000803e3d6000fd5b50505050816001600160a01b031683856001600160a01b03167fa433e9204e6763dff9274d8c1febdbc7c60aa7d7e85c106d5b978372658438b860405160405180910390a450505050565b6004546000906001600160a01b0316158015906105d557506002546001600160a01b038481169116145b801561019357505060035414919050565b80356001600160a01b03811681146105fd57600080fd5b919050565b6000806040838503121561061557600080fd5b61061e836105e6565b946020939093013593505050565b60008083601f84011261063e57600080fd5b50813567ffffffffffffffff81111561065657600080fd5b60208301915083602082850101111561066e57600080fd5b9250929050565b60008060008060006080868803121561068d57600080fd5b610696866105e6565b94506106a4602087016105e6565b935060408601359250606086013567ffffffffffffffff8111156106c757600080fd5b6106d38882890161062c565b969995985093965092949392505050565b600080600080606085870312156106fa57600080fd5b610703856105e6565b935060208501359250604085013567ffffffffffffffff81111561072657600080fd5b6107328782880161062c565b95989497509550505050565b60008060006060848603121561075357600080fd5b61075c846105e6565b925060208401359150610771604085016105e6565b90509250925092565b6000806000806080858703121561079057600080fd5b610799856105e6565b9350602085013592506107ae604086016105e6565b9150606085013580151581146107c357600080fd5b939692955090935050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108116040830184866107ce565b95945050505050565b6020815260006103c86020830184866107ce56fea2646970667358221220dd5405c74ca871baa3fc981f170a85015cbe31e79a0e1034acc7154f51ae011664736f6c63430008180033'
35
-
36
- export const OPERATOR_VAULT_RUNTIME_BYTECODE: Hex = '0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80631c3bb2851161005b5780631c3bb2851461011157806324a3e2a1146101265780639a61ce8114610149578063b68f43451461015c57600080fd5b8063029ae47e146100825780631400a7e2146100b2578063150b7a02146100e5575b600080fd5b610095610090366004610602565b61016f565b6040516001600160a01b0390911681526020015b60405180910390f35b600254600354600454604080516001600160a01b03948516815260208101939093529216918101919091526060016100a9565b6100f86100f3366004610675565b61019a565b6040516001600160e01b031990911681526020016100a9565b61012461011f3660046106e4565b610293565b005b61013961013436600461073e565b610397565b60405190151581526020016100a9565b61012461015736600461077a565b6103d0565b61012461016a36600461073e565b6104a2565b600061017b83836105ab565b610186576000610193565b6004546001600160a01b03165b9392505050565b600080546001600160a01b0316331415806101b757506001548414155b156101d557604051639667ffdf60e01b815260040160405180910390fd5b6004546001600160a01b0316156101ff5760405163d5a8211560e01b815260040160405180910390fd5b60028054336001600160a01b0319918216179091556003859055600480549091166001600160a01b0387161790556005805460018101909155600003600019016102495760016005555b6040516001600160a01b03861690859033907f7b19af5fe09a0be4ed70b569401ce6fa0de072757b228cc2088350eccc2f987390600090a450630a85bd0160e11b95945050505050565b600061029f858561016f565b9050336001600160a01b038216148015906102c257506102c0858533610397565b155b156102e05760405163ea8e4eb560e01b815260040160405180910390fd5b604051630af28bd360e01b81526001600160a01b03861690630af28bd390610310908790879087906004016107f7565b600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b50505050336001600160a01b031684866001600160a01b03167fa455a129bb4260e5274d34dd213bcd11399667f80a0615e6cb375728d2e75a90868660405161038892919061081a565b60405180910390a45050505050565b60006103a384846105ab565b80156103c857506005546001600160a01b038316600090815260066020526040902054145b949350505050565b6103da848461016f565b6001600160a01b0316336001600160a01b03161461040b576040516330cd747160e01b815260040160405180910390fd5b8015610432576005546001600160a01b03831660009081526006602052604090205561044c565b6001600160a01b0382166000908152600660205260408120555b816001600160a01b031683856001600160a01b03167fea7d7802a5cc5520abde4345007961a980fcb27dca3030ca6aede6bdc58bd79e84604051610494911515815260200190565b60405180910390a450505050565b60006104ae848461016f565b9050336001600160a01b038216146104d9576040516330cd747160e01b815260040160405180910390fd5b600280546001600160a01b03199081169091556000600355600480549091168155604051632142170760e11b815230918101919091526001600160a01b038381166024830152604482018590528516906342842e0e90606401600060405180830381600087803b15801561054c57600080fd5b505af1158015610560573d6000803e3d6000fd5b50505050816001600160a01b031683856001600160a01b03167fa433e9204e6763dff9274d8c1febdbc7c60aa7d7e85c106d5b978372658438b860405160405180910390a450505050565b6004546000906001600160a01b0316158015906105d557506002546001600160a01b038481169116145b801561019357505060035414919050565b80356001600160a01b03811681146105fd57600080fd5b919050565b6000806040838503121561061557600080fd5b61061e836105e6565b946020939093013593505050565b60008083601f84011261063e57600080fd5b50813567ffffffffffffffff81111561065657600080fd5b60208301915083602082850101111561066e57600080fd5b9250929050565b60008060008060006080868803121561068d57600080fd5b610696866105e6565b94506106a4602087016105e6565b935060408601359250606086013567ffffffffffffffff8111156106c757600080fd5b6106d38882890161062c565b969995985093965092949392505050565b600080600080606085870312156106fa57600080fd5b610703856105e6565b935060208501359250604085013567ffffffffffffffff81111561072657600080fd5b6107328782880161062c565b95989497509550505050565b60008060006060848603121561075357600080fd5b61075c846105e6565b925060208401359150610771604085016105e6565b90509250925092565b6000806000806080858703121561079057600080fd5b610799856105e6565b9350602085013592506107ae604086016105e6565b9150606085013580151581146107c357600080fd5b939692955090935050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108116040830184866107ce565b95945050505050565b6020815260006103c86020830184866107ce56fea2646970667358221220dd5405c74ca871baa3fc981f170a85015cbe31e79a0e1034acc7154f51ae011664736f6c63430008180033'
37
-
38
- export const OPERATOR_VAULT_RUNTIME_BYTECODE_HASH: Hex = keccak256(OPERATOR_VAULT_RUNTIME_BYTECODE)
@@ -1,44 +0,0 @@
1
- export {
2
- OPERATOR_VAULT_ABI,
3
- OPERATOR_VAULT_ADDRESSES,
4
- OPERATOR_VAULT_DEPLOY_BYTECODE,
5
- OPERATOR_VAULT_RUNTIME_BYTECODE,
6
- OPERATOR_VAULT_RUNTIME_BYTECODE_HASH,
7
- operatorVaultAddressForChain,
8
- resolveConfiguredOperatorVaultAddress,
9
- } from './operatorVault/constants.js'
10
- export {
11
- OperatorVaultBytecodeMismatchError,
12
- assertVaultBytecode,
13
- formatOperatorVaultBytecodeMismatchDetail,
14
- } from './operatorVault/bytecode.js'
15
- export type { AssertVaultBytecodeClient } from './operatorVault/bytecode.js'
16
- export {
17
- encodeDepositAgent,
18
- encodeRotateAgentURI,
19
- encodeSetMetadataOperator,
20
- encodeUnwrapAgent,
21
- } from './operatorVault/transactions.js'
22
- export type {
23
- DepositAgentArgs,
24
- RotateAgentURIArgs,
25
- SetMetadataOperatorArgs,
26
- UnwrapAgentArgs,
27
- } from './operatorVault/transactions.js'
28
- export {
29
- confirmAgentWithdrawnFromVault,
30
- confirmAgentInVault,
31
- discoverPriorVaultFromTokenOwner,
32
- discoverVaultedTokens,
33
- isAgentInVault,
34
- readMetadataOperators,
35
- } from './operatorVault/read.js'
36
- export type {
37
- ConfirmAgentWithdrawnArgs,
38
- DiscoverPriorVaultArgs,
39
- DiscoverPriorVaultClient,
40
- DiscoverVaultedTokensArgs,
41
- IsAgentInVaultArgs,
42
- OperatorVaultReadClient,
43
- ReadMetadataOperatorsArgs,
44
- } from './operatorVault/read.js'