Hi
Is it possible to query the tokens\neurons held within an II?
I know many apps require you to add a hotkey and then add your neurons manually but I wondered if there was a read only way to be able to query the contents of an II.
I’m thinking of writing a portfolio tracker that users could add their II’s to and it would be able to give them a breakdown of token\neuron balances, profit\loss over past Day\7 day’s\30 day’s etc.
I can’t seem to find the docs for what is currently possible.
Ideally a user could create a key within an II that they could provide that would allow read only permissions to a dapp to be able to query the tokens\neurons for an II.
TIA for any pointers on where to get info on what is currently possible.
Hi @antinutrino
Internet Identity gives a different principal per domain. Therefore, II identities do not hold neurons or tokens. Rather the principals in the dapps hold them.
For example, when you log in https://nns.ic0.app/ with Identity YYYY, you are given a principal xxxx-xxxx-xxx-xxx which holds the neurons. But if you log in Open Chat with identity YYYY your principal is different zzzz-zzz-zzz-zzz.
You can read about it in the Docs
A user has a separate user identity for each client application frontend (i.e., per hostname)
Moreover, finding the list of NNS neurons for a principal is only available for hotkeys and controllers. Tokens and SNS neurons are instead queryable by anyone.
I hope this helped. Don’t hesitat to ask any more questions, glad to help!
Hi @lmuntaner, thanks for the response and links to docs.
If I am understanding correctly, I would need the principal id for all II’s a user may have to query the tokens and SNS neurons, but I would have to provide the user a hotkey in order to be able to query the NNS neurons they have. Doesn’t seem too bad.
Can you point me to the api for these query’s please?
I want to see what data is available. I think the only thing that vpGeek doesn’t\can’t show is when you are not autostaking you don’t get to see the maturity pay out’s, is that information available via the queries?
Thanks
You can use our JS library to interact with the canisters: GitHub - dfinity/ic-js: Libraries for interfacing with the Internet Computer.
This library is used in GitHub - dfinity/ic-js: Libraries for interfacing with the Internet Computer. and https://oisy.com/
The maturity is a property of a neuron. There is no information of where it comes from or when it was increased. If you want to do something like that, you’d need to scrape the data. But for NNS neurons, this information is private and only available for controllers and hotkeys.
I hope this helps!
Brilliant, thanks, that should keep me busy for a while
Perhaps I should start a new thread but I’m struggling to get connected to the nns GovernanceCanister,
- how can I find the correct host when creating the agent
agent = await createAgent({
identity: identity
host: ???
});
- what canister id am I querying for the neuronInfo?
const {listNeurons } = GovernanceCanister.create({
agent,
canisterId: Principal.fromText(‘my-principal-id ???’)
});
TIA