MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / lookup_id

Method lookup_id

fendermint/eth/api/src/cache.rs:107–136  ·  view source on GitHub ↗
(&self, addr: &Address)

Source from the content-addressed store, hash-verified

105 }
106
107 pub async fn lookup_id(&self, addr: &Address) -> anyhow::Result<Option<ActorID>> {
108 if let Ok(id) = addr.id() {
109 return Ok(Some(id));
110 }
111
112 if let Some(id) = self.get_id(addr) {
113 return Ok(Some(id));
114 }
115
116 // Using committed height because pending could change.
117 let res = self
118 .client
119 .actor_state(addr, FvmQueryHeight::Committed)
120 .await
121 .context("failed to lookup actor state")?;
122
123 if let Some((id, _)) = res.value {
124 self.set_id(*addr, id);
125 if let Payload::Delegated(_) = addr.payload() {
126 self.set_addr(id, *addr)
127 }
128 return Ok(Some(id));
129 }
130 tracing::info!(
131 addr = addr.to_string(),
132 height = res.height.value(),
133 "actor not found"
134 );
135 Ok(None)
136 }
137
138 /// Look up the delegated address of an ID, if any.
139 pub async fn lookup_addr(&self, id: &ActorID) -> anyhow::Result<Option<Address>> {

Callers 4

lookup_actorMethod · 0.80
callMethod · 0.80
get_actor_stateFunction · 0.80
get_actor_balanceFunction · 0.80

Calls 6

get_idMethod · 0.80
contextMethod · 0.80
set_idMethod · 0.80
set_addrMethod · 0.80
idMethod · 0.45
actor_stateMethod · 0.45

Tested by 1

get_actor_balanceFunction · 0.64