Capitalisk / ldpos-commander

CLI client for LDPoS blockchains
MIT License
3 stars 2 forks source link

Consistent units with `account get` and when posting transactions #46

Closed jondubois closed 3 years ago

jondubois commented 3 years ago

Now account get and wallet get and all the commands to list account data return objects like this:

{
  "address": "clskbde48efe4fb34f91f3bfad4e4e8feb081b302b0f",
  "type": "sig",
  "balance": "9996990739000000",
  "forgingPublicKey": "c8966a60b62cc07c657874370a94aa1fea20d06cab88a7ccec70c64e99b0d9fc",
  "nextForgingKeyIndex": 88257,
  "multisigPublicKey": "35e8dd3f95ea5b7f71cc8fb585c55112a052c05d1aca6246cad863d804ddcaee",
  "nextMultisigKeyIndex": 2,
  "sigPublicKey": "14c1ff96cc74a66982e230379d23929ca0d037992f0689e3f0a42d7ea26741d8",
  "nextSigKeyIndex": 1476,
  "requiredSignatureCount": null,
  "updateHeight": 2888,
  "lastTransactionTimestamp": 1616025238415,
  "nextForgingPublicKey": "7d1e686788c5ac076571643a963bb7914a7c0f601159b57a5815390ce43e606b",
  "nextMultisigPublicKey": "f27797440e3ec95431e3fde2e64d2f73cb28504b4f8135920461a57a47dc4a55",
  "nextSigPublicKey": "6590d87bf00ea5a1c8f034de63570489b3cd4f5d5a9eca8e5441b84fb99eb809"
}

The balance is not in CLSK. There is no way for the user to see their balance in CLSK. When making transactions with transaction post, the units are in CLSK but it may be difficult for the user to reconcile the two (they might make a mistake).

It would be better if the units were consistent when showing balances and when making transactions so that the user does not get confused and accidentally send too many tokens.

Either we should show the balance field everywhere with CLSK units or change the transaction units to be in the smallest units instead of CLSK.

The downside of using the smallest units that it requires a lot of typing and is harder to read but the benefit is that it's more consistent with how the number is represented on-chain.