Polkadot-Blockchain-Academy / Academy-PoW

PoW blockchain node to gain hands-on experience starting a real network together
The Unlicense
21 stars 42 forks source link

fix: set system_properties to provide prefix/symbol/decimals config to dapps & wallets #62

Closed alecdwm closed 5 months ago

alecdwm commented 5 months ago

Yo!

The system_properties RPC call is the standard way for dapps & wallets to find out what these values are set to for each substrate chain.

By chance, the setting of 12 for decimals and 42 for the account prefix are the defaults shown in the metadata section of the polkadot.js apps UI.
As such, when using that UI it looks like it has successfully picked up the TOKEN_DECIMALS value from the config for this chain.

In reality, if a dev were to change the decimals to e.g. 18 or 10, they might be confused to find that pjs-apps still considers it to be 12!

Also in Talisman, when a user-provided chain RPC doesn't tell us otherwise, we use 0 as a default for decimals because we don't want our users to accidentally transfer significantly more tokens than they intended to, on account of a missing piece of chain configuration.

By merging this PR, both scenarios will be accounted for 🙂 Pjs-apps and Talisman will both use the correct token decimals, as configured in lib.rs.

JoshOrndorff commented 5 months ago

we use 0 as a default for decimals because we don't want our users to accidentally transfer significantly more tokens than they intended to, on account of a missing piece of chain configuration.

Good idea!

Thanks for the PR!