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

28 standarize decimal responses #42

Merged

Conversation

phoenix-web3
Copy link
Collaborator

@phoenix-web3 phoenix-web3 commented Dec 7, 2021

Description

To standardize all responses that return a decimal number it is proposed to return all such responses in JSON number type.

Due to the poor implementation of the standard number type in languages like Javascript it may cause some problems in the future to return data as Number instead of String.

BTC

  • getAddressBalance
  • getAddressesBalance
  • getAddressUnspent
  • getBlockByNumber
  • getFeePerByte
  • getTransactionCount
  • syncing

BCH

  • getAddressBalance
  • getAddressUnspent
  • getBlockByNumber
  • getFeePerByte
  • getTransactionCount
  • syncing

ETH

  • estimateGas
  • getAddressBalance
  • getAddressesBalance
  • getBlockByNumber
  • getGasPrice
  • getHeight
  • getTransaction
  • getTransactionCount
  • syncing

Fixes #28 (issue)

Dependencies (if any)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Test has been passed for ETH and BTC:
imagen

Syncing method tested separately

curl -X POST --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"syncing","params":{}, "id":1}' http://localhost:60001/rpc

{"id": 1, "jsonrpc": "2.0", "result": {"syncing": true, "syncPercentage": "0.038334007004731815%", "currentBlockIndex": 13160, "latestBlockIndex": 2133529}}

Test Configuration:

  • Operating system (output of cat /etc/os-release):
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
  • Kernel version (output of uname -sr): Linux 4.15.0-143-generic
  • Architecture (output of uname -m): x86_64

Related PR or Docs PR

Docs PR related #
Other PR related swapper-org/swapper-core#25

Good practices to consider

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@phoenix-web3 phoenix-web3 marked this pull request as ready for review December 28, 2021 23:54
@hippocampusSwapper
Copy link

hippocampusSwapper commented Dec 31, 2021

It would be nice if you could put a PR to reflect these changes also in the client side package.

Package: https://github.com/swapper-org/swapper-core/tree/develop/packages/swapper-nodechain-client
Docs: https://hippocampus.gitbook.io/swapper-1/repositorio-monorepo/packages/swapper-nodechain-client

@phoenix-web3
Copy link
Collaborator Author

It would be nice if you could put a PR to reflect these changes also in the client side package.

Package: https://github.com/swapper-org/swapper-core/tree/develop/packages/swapper-nodechain-client Docs: https://hippocampus.gitbook.io/swapper-1/repositorio-monorepo/packages/swapper-nodechain-client

Perfect, i could do that tomorrow

Copy link
Collaborator

@0xp3gasus 0xp3gasus left a comment

Choose a reason for hiding this comment

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

Please, review comments. Thanks for your contribution 💪🏽

Copy link
Collaborator

@0xp3gasus 0xp3gasus left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

@0xp3gasus 0xp3gasus merged commit c78a674 into swapper-org:staging Jan 4, 2022
@phoenix-web3 phoenix-web3 mentioned this pull request Jan 10, 2022
12 tasks
@phoenix-web3 phoenix-web3 deleted the 28-standarize-decimal-responses branch June 13, 2022 22:10
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.

Standarize decimal responses
3 participants