Skip to content

Given a key, how do I read the value from a table via the API? #35

Answered by banool
banool asked this question in Questions
Discussion options

You must be logged in to vote

You're right that you can use the API for this! First let's get some information about your table.

Let's look at the resource you've deployed to your account from the above Move module. First let's construct the struct tag (aka resource ID / handle), it looks like this:

<account_address>::<module>::<struct_name>

In your case:

0x81e2e2499407693c81fe65c86405ca70df529438339d9da7a6fc2520142b591e::nicknames::Nicknames

Because there can only be one of each resource in an account in the Aptos blockchain, we can use this to uniquely identify the resource in your account. Using this we can then get the table handle. A table handle is a globally unique ID (so, not just within the bounds of your a…

Replies: 1 comment

Comment options

banool
Mar 7, 2024
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by banool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ts-sdk Questions related to the TypeScript SDK move Questions related to the Move Language
1 participant