Hi all,
it is probably a stupid question, but I can’t figure out a way how to get the address of actor that committed an entry (presuming the entry address is known).
Thank you for your help,
best,
M
Hi all,
it is probably a stupid question, but I can’t figure out a way how to get the address of actor that committed an entry (presuming the entry address is known).
Thank you for your help,
best,
M
Hi @comcmipi !
So first a clarification: the same entry can be committed by multiple agents, no problem. This can be a feature in some applications (deduplication), and in other cases you have to correct for it by including the agent address in your entry.
If you go the second route, you would have the agent_address inside the entry. If you don’t, you will need the get the agent addresses from the headers of the entry, using the get_entry_result
function (https://docs.rs/hdk/0.0.48-alpha1/hdk/api/fn.get_entry_result.html), passing the “headers=true” option. From there, you have a list of headers, from which you can get the agent_address like this: “let agent_address = headers.provenances()[0].source();”. But like this you always have the list of agents that have committed the entry.
Thanks @guillemcordoba !
I thought there was a more straightforward way than via provenances, but it actually make sense since the entry can be committed by multiple agents …
Thank you again for your fast and exhaustive response!
M