Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add total supply function #17

Merged
merged 3 commits into from
Oct 1, 2024
Merged

Add total supply function #17

merged 3 commits into from
Oct 1, 2024

Conversation

stefan-mysten
Copy link
Collaborator

No description provided.

Comment on lines 213 to 338
/// Get total supply for the coin type.
pub async fn total_supply(&self, coin_type: &str) -> Result<Option<u64>, Error> {
let coin_metadata = self.coin_metadata(coin_type).await?;

coin_metadata
.map(|c| c.supply)
.flatten()
.map(|c| c.try_into())
.transpose()
}
Copy link
Collaborator

@bmwill bmwill Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we just have a single "get_coin_metadata" function that has all the metadata info vs one that just gets total supply?

Copy link
Collaborator Author

@stefan-mysten stefan-mysten Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have that, this was more of a convenience method replicating what we used to have in the old sdk + json rpc

@bmwill bmwill merged commit 74b91c1 into master Oct 1, 2024
4 checks passed
@bmwill bmwill deleted the add_total_supply branch October 1, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants