You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2022. It is now read-only.
Due to historic reasons the notion of 'free balance' in GA is a misnomer for the staking currency.
We should alter this API / naming to ensure it is fool-proof
Background
expectation:
"free balance": the freely spendable balance of an account reality:
"free balance": the maybe spendable balance, need to check locks also
This is extremely misleading for dapps which have to be aware of this difference and internal modules
when dealing with the staked currency must be aware of this also.
The currency locks API is made especially for staking, so this misnomer is only true for the staked asset.
No other asset can have locks, so the 'free balance' really is the freely spendable balance.
Goals
Make the generic asset balance API clear and fool-proof
Maintain backwards compatibility with the current API
Proposal
internal module API changes: free_balance
StakingAssetCurrency and MultiCurrency when asset is the staking asset must return the truely free balance (free balance - locked amount)
cennznet/api.js
Provide a new freeBalance rpc which will always return the truely free balance e.g.: api.rpc.genericAsset.freeBalance and encourage dapps to swtich.
Maybe place warnings in cennznet/api.js code against using api.query.genericAsset.freeBalance directly
The text was updated successfully, but these errors were encountered:
Due to historic reasons the notion of 'free balance' in GA is a misnomer for the staking currency.
We should alter this API / naming to ensure it is fool-proof
Background
expectation:
"free balance": the freely spendable balance of an account
reality:
"free balance": the maybe spendable balance, need to check locks also
This is extremely misleading for dapps which have to be aware of this difference and internal modules
when dealing with the staked currency must be aware of this also.
The currency locks API is made especially for staking, so this misnomer is only true for the staked asset.
No other asset can have locks, so the 'free balance' really is the freely spendable balance.
Goals
Make the generic asset balance API clear and fool-proof
Maintain backwards compatibility with the current API
Proposal
internal module API changes:
free_balance
StakingAssetCurrency
andMultiCurrency
when asset is the staking asset must return the truely free balance (free balance - locked amount)cennznet/api.js
Provide a new freeBalance rpc which will always return the truely free balance e.g.:
api.rpc.genericAsset.freeBalance
and encourage dapps to swtich.Maybe place warnings in cennznet/api.js code against using
api.query.genericAsset.freeBalance
directlyThe text was updated successfully, but these errors were encountered: