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

Get Gas for Address #54

Closed
FrankC01 opened this issue Dec 31, 2022 Discussed in #50 · 0 comments
Closed

Get Gas for Address #54

FrankC01 opened this issue Dec 31, 2022 Discussed in #50 · 0 comments
Assignees
Labels
enhancement New feature or request performance
Milestone

Comments

@FrankC01
Copy link
Owner

FrankC01 commented Dec 31, 2022

Discussed in #50

Originally posted by FrankC01 December 28, 2022
On synch or asynch client to get all the gas coins... note GetCoins this is a more terse result SuiCoinObject vs. ObjectRead

def get_gas(self, address: SuiAddress) -> list[SuiCoinObject]:
    """."""
    coin_type = SuiString("0x2::sui::SUI")
    result = self.execute(GetCoinTypeBalance(owner=address, coin_type=coin_type))
    if result.is_ok():
        limit = SuiInteger(result.result_data.items[0].coin_object_count)
        result = self.execute(GetCoins(owner=address, coin_type=coin_type, limit=limit))
        if result.is_ok():
            return result.result_data.data
    return []

Using getting descriptors to identify gas and then getting the object:

Addresses: 4
Total Sui Coin Objects: 25
real	0m2.210s
user	0m0.627s
sys	0m0.079s

Using new API:

Addresses: 4
Total Sui Coin Objects: 25
real	0m0.966s
user	0m0.399s
sys	0m0.065s
@FrankC01 FrankC01 added the enhancement New feature or request label Dec 31, 2022
@FrankC01 FrankC01 added this to the SizzaLena milestone Dec 31, 2022
@FrankC01 FrankC01 self-assigned this Dec 31, 2022
@FrankC01 FrankC01 added this to pysui Jan 3, 2023
@FrankC01 FrankC01 moved this to In Progress in pysui Jan 3, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in pysui Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
Status: Done
Development

No branches or pull requests

1 participant