zilliqa-js icon indicating copy to clipboard operation
zilliqa-js copied to clipboard

Missing consistency between `fromBech32Address()` and ZRC-6 addresses

Open crimson-med opened this issue 3 years ago • 2 comments

Describe the bug

Missing consistency between fromBech32Address() and ZRC-6 addresses.

To Reproduce

  1. Deploy the basic ZRC-6 contract template
  2. Mint an NFT to an address
  3. Call fromBech32Address("zil1nn480ye58tppav7mp79v3e65g5lykvp4aeuj53")
  4. This will result in the string: 0x9Cea7793343AC21EB3DB0f8Ac8e754453e4b3035
  5. The Get State of balances on the ZRC-6 contract will return: 0x9cea7793343ac21eb3db0f8ac8e754453e4b3035
  6. The contract one is essentially all lower case.

Expected behavior

fromBech32Address() should return all in lower case and should be global around all of the API

Screenshots

Screenshot 2022-01-20 at 2 04 45 PM

Desktop (please complete the following information):

Mac OS

  • Browser Firefox
  • Version [96.0.1 (64-bit)

crimson-med avatar Jan 20 '22 06:01 crimson-med

The mixture of the upper and lower case are due to checksum and it will be better for the SDK to return a checksummed address for safety purposes.

bb111189 avatar Jan 24 '22 07:01 bb111189

Should we then use toChecksumAddress instead to verify and compare addresses?

crimson-med avatar Jan 24 '22 08:01 crimson-med