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

Support subunits_per_unit returned by /v3/currency #2034

Open
davidyuk opened this issue Dec 7, 2024 · 0 comments
Open

Support subunits_per_unit returned by /v3/currency #2034

davidyuk opened this issue Dec 7, 2024 · 0 comments
Labels
Milestone

Comments

@davidyuk
Copy link
Member

davidyuk commented Dec 7, 2024

Ideally, coin amounts returned by Node should be wrapped with an object with methods to convert it to different formats (fancy toString, coins, subunits). Also, it should be aware of subunits_per_unit to format properly.

To accept coin amounts, sdk should provide a class/utility function accepting amounts in units/subunits without knowing subunits_per_unit. The actual value of subunits_per_unit should be resolved internally using Node.

aeSdk.spend(new Coin(10), ...) // send 10 ae or coins with custom subunits_per_unit
aeSdk.spend(coin`10`, ...) // the same as above, alternative syntax
aeSdk.spend(10, ...) // send 10 aettos or custom subunits

But better to accept units by default instead subunits 🤔

related issue #1290

@davidyuk davidyuk added this to the Hyperchains milestone Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant