Class: AgentIdentity
Defined in: identity/AgentIdentity.ts:113
Manages ERC-8004 identity lifecycle and keeps the on-chain tokenURI aligned with the latest uploaded agent card.
Methods
getAgentCard()
getAgentCard():
Readonly<AgentCard>
Defined in: identity/AgentIdentity.ts:250
Returns the current in-memory agent card.
Returns
Readonly<AgentCard>
getLatestPieceCid()
getLatestPieceCid():
string
Defined in: identity/AgentIdentity.ts:236
Returns the latest checkpoint pieceCid as recorded on the agent card.
Equivalent to the old OnchainRegistry.lookup().
Returns
string
getTokenId()
getTokenId():
bigint
Defined in: identity/AgentIdentity.ts:243
Returns the ERC-721 token ID assigned during registration.
Returns
bigint
updateLatestPieceCid()
updateLatestPieceCid(
pieceCid):Promise<void>
Defined in: identity/AgentIdentity.ts:261
Update the agent card's latestPieceCid, re-upload to Filecoin, and
update the on-chain tokenURI so recovery works after restart.
Called after every successful checkpoint save. This replaces the old
OnchainRegistry.update() call.
Parameters
pieceCid
string
Returns
Promise<void>
create()
staticcreate(privateKey,filecoinClient,config,network?,existingTokenId?):Promise<AgentIdentity>
Defined in: identity/AgentIdentity.ts:148
Create and initialise an AgentIdentity instance.
On first run (no existing tokenId supplied) the method will:
- Build the agent card JSON
- Upload it to Filecoin via Synapse
- Register the agent on the ERC-8004 Identity Registry for the selected network
On subsequent runs supply the existingTokenId returned from a previous
run so the module skips re-registration.
Parameters
privateKey
string
filecoinClient
Synapse
config
network?
NetworkName = "calibnet"
existingTokenId?
bigint
Returns
Promise<AgentIdentity>