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

[NayNay] Updating Units within Entropy #306

Merged
merged 10 commits into from
Dec 3, 2024
Merged

[NayNay] Updating Units within Entropy #306

merged 10 commits into from
Dec 3, 2024

Conversation

rh0delta
Copy link
Contributor

Related Issue(s)

Proposed Changes

  • it had come to our attn that we were using the wrong units for the tokens display
  • we were under the impression that bits were the smallest unit of the entropy token, that was a mistake
  • updated all mentions of tokens and bits to match their respective definition
  • updated return of balance to the human readable format, using BITS
  • added new method to grab token details from chain

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Screenshots (if applicable)

Additional Context

  • needs changelog
  • needs documentation update

Checklist

  • I have performed a self-review of my code.
  • I have added tests.
  • I have commented my code.
  • I have included a CHANGELOG.md entry.
  • I have updated documentation in github.com:entropyxyz/entropy-docs, where necessary.

- it had come to our attn that we were using the wrong units for the tokens display
- we were under the impression that bits were the smallest unit of the entropy token, that was a mistake
- updated all mentions of tokens and bits to match their respective definition
- updated return of balance to the human readable format, using BITS
- added new method to grab token details from chain
@rh0delta rh0delta added the documentation Improvements or additions to documentation label Nov 13, 2024
@rh0delta rh0delta requested a review from mixmix November 13, 2024 01:57
@rh0delta rh0delta added this to the Usability milestone Nov 13, 2024
@rh0delta rh0delta linked an issue Nov 13, 2024 that may be closed by this pull request
Copy link
Contributor

@mixmix mixmix left a comment

Choose a reason for hiding this comment

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

Few things to address.

Also needs

  • CHANGELOG entry
  • README entry - saying all Inputs/ Outputs are in BITS (are they?)
  • another PR/ Issue about supporting flags like --tokens which sees output come out in raw tokens?

cliWrite(`${balance.toLocaleString('en-US')} BITS`)
const tokensBalance = await balanceService.getBalance(address)
const balance = tokensToBits(tokensBalance, decimals)
cliWrite(`${balance} ${symbol}`)
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥 I want to see output that i can easily consume in another command.
This output would force people to parse the string (see #221 (comment))

You can make it another issue/ PR which fixes that, but this is something I think it really important

Copy link
Contributor Author

@rh0delta rh0delta Nov 13, 2024

Choose a reason for hiding this comment

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

the output is the same as it was before the change, this change is mainly to display the human readable amount as well as pull the symbol from the chain. not sure what your 🔥 is referring too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if BITS needs to be removed, that's fine, but wouldn't that cause confusion if users don't know what the number represents?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah the 🔥 was because "1.234 BITS" is kinda a pain to use in other scripts. e.g. if I write a script which moves all my balance to another account I cannot take the results of balance and put them into transfer ... because balance is not giving numbers, it's giving numbers and letters and a space. So it forces me to write some awk or something.

I think if you want the unit, you should have --show-units in the command? CLI commands are meant to be easy to chain IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it feels like a different issue I'm raising (and it might well be), please open a new issue, put it in a milestone and mark this resolved.

src/common/utils.ts Outdated Show resolved Hide resolved
src/common/utils.ts Outdated Show resolved Hide resolved
// there are limits in place to ensure user's are leftover with a certain balance in their accounts
// increasing amount send here, will allow user's to register right away

// 2 BITS
Copy link
Contributor

Choose a reason for hiding this comment

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

you should change this to use the definition of BITS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what are you referring too? the 2 BITS comment?

Copy link
Contributor

@mixmix mixmix Nov 20, 2024

Choose a reason for hiding this comment

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

Probably the comment and amount below it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unable to change the value sent to transfer as it requires we send the bigint nanoBITS otherwise it doesn't send the value you expect.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think what I shoulda said is "you have hard coded how many nanoBits you are sending. This is fine, but if you really want to guarentee it's 2 bits you should getTokenDetails and use the results of that in how much you send".

What I'm wrinkling my nose at is that we've shifted to use a chain-definition of how many nanoBits in a BITS... except here? It's fine, let's just resolve this, it's just the faucet

src/common/utils.ts Outdated Show resolved Hide resolved
src/transfer/main.ts Outdated Show resolved Hide resolved
src/transfer/main.ts Outdated Show resolved Hide resolved
@rh0delta
Copy link
Contributor Author

@mixmix here is the issue for tracking the readme/docs update entropyxyz/entropy-docs#261

@rh0delta rh0delta mentioned this pull request Nov 14, 2024
8 tasks
@johnnymatthews
Copy link
Contributor

johnnymatthews commented Nov 18, 2024

Related docs issue: entropyxyz/entropy-docs#265

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
src/transfer/command.ts Outdated Show resolved Hide resolved
@frankiebee frankiebee requested a review from mixmix December 2, 2024 23:50
Copy link
Contributor

@mixmix mixmix left a comment

Choose a reason for hiding this comment

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

NICE!

@mixmix mixmix merged commit 6d36cb3 into dev Dec 3, 2024
2 checks passed
@mixmix mixmix deleted the naynay/units branch December 3, 2024 03:06
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entropy Balance/Transfer have different units
3 participants