-
Notifications
You must be signed in to change notification settings - Fork 15
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
CSUB-578: Properly parse floating point amounts #1150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple enough, LGTM!
For full LLVM coverage report click here! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bond
still fails:
$ node dist/index.js bond -u ws://127.0.0.1:9946 -s "<mnemonic>" -c <controller-address> -a 1000001.11 -r Staked
2023-06-21 14:43:24 API/INIT: RPC methods not decorated: creditcoin_hashrate, task_getOffchainNonceKey
2023-06-21 14:43:24 API/INIT: creditcoin-node/222: Not decorating unknown runtime apis: TaskApi/1
Creating bond transaction...
Controller address: 5EEoJZYPpTYGX1t3shaQbqhRmqvdvoaTycY1gJ4TB8spDgPp
Reward destination: Staked
Amount: 1000001.11
✔ Continue? … yes
Extra: undefined
/home/gluwa/creditcoin-2.0/creditcoin-substrate/scripts/cc-cli/dist/utils/bond.js:19
const amountInMicroUnits = BigInt(amount) * BigInt(1000000000000000000); // Multiply by to convert to micro units
^
RangeError: The number 1000001.11 cannot be converted to a BigInt because it is not an integer
at BigInt (<anonymous>)
at /home/gluwa/creditcoin-2.0/creditcoin-substrate/scripts/cc-cli/dist/utils/bond.js:19:36
at Generator.next (<anonymous>)
at /home/gluwa/creditcoin-2.0/creditcoin-substrate/scripts/cc-cli/dist/utils/bond.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/gluwa/creditcoin-2.0/creditcoin-substrate/scripts/cc-cli/dist/utils/bond.js:4:12)
at bond (/home/gluwa/creditcoin-2.0/creditcoin-substrate/scripts/cc-cli/dist/utils/bond.js:15:12)
at Command.<anonymous> (/home/gluwa/creditcoin-2.0/creditcoin-substrate/scripts/cc-cli/dist/commands/bond.js:58:50)
at Generator.next (<anonymous>)
at fulfilled (/home/gluwa/creditcoin-2.0/creditcoin-substrate/scripts/cc-cli/dist/commands/bond.js:5:58)
Node.js v18.1.0
Codecov Report
@@ Coverage Diff @@
## dev #1150 +/- ##
=======================================
Coverage 74.62% 74.62%
=======================================
Files 74 74
Lines 10686 10686
=======================================
Hits 7974 7974
Misses 2712 2712 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
39a79d3
to
e179b91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs rebase, too many conflicts
Co-authored-by: Alexander Todorov <alex.todorov@gluwa.com>
additional utilities from Ethers via creditcoin-js
e179b91
to
c8f0bc4
Compare
Description of proposed changes
parseCTCString
and implemented in commands which receive amounts as inputPractical tips for PR review & merge: