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
Initially, I thought it would be a great idea, but after I wrote it down, I believe it is going to create more problems than it solves.
Looking at whitelist contract, I wish there are getters to the public methods of the struct. Implementing those manually might be routine, so I am thinking if some derive magic should be added, so all pub fields would have getters implemented automagically, and with proper pagination.
Just to illustrate, I feel this code:
#[near_bindgen]#[derive(BorshDeserialize,BorshSerialize)]pubstructWhitelistContract{/// The account ID of the NEAR Foundation. It allows to whitelist new staking pool accounts./// It also allows to whitelist new Staking Pool Factories, which can whitelist staking pools.pubfoundation_account_id:AccountId,/// The whitelisted account IDs of approved staking pool contracts.pubwhitelist:UnorderedSet<AccountId>,/// The whitelist of staking pool factories. Any account from this list can whitelist staking/// pools.pubfactory_whitelist:UnorderedSet<AccountId>,}
would be expanded to have the following implementations:
The downside is that it might be too magical. Explicit is better than implicit vs ergonomic balance needs to be adjusted. Also, different structs will need to be handled differently, potentially, re-collecting the lists, and introduce pagination, so it only makes things even more magical.
The text was updated successfully, but these errors were encountered:
@willemneal I cannot think of a way to make DevX predictable here given that collections require special handling, so I will only keep this issue open for visibility, but I don't expect anyone to take it before we come up with a better design for it (if at all).
Initially, I thought it would be a great idea, but after I wrote it down, I believe it is going to create more problems than it solves.
Looking at whitelist contract, I wish there are getters to the public methods of the struct. Implementing those manually might be routine, so I am thinking if some derive magic should be added, so all
pub
fields would have getters implemented automagically, and with proper pagination.Just to illustrate, I feel this code:
would be expanded to have the following implementations:
The downside is that it might be too magical. Explicit is better than implicit vs ergonomic balance needs to be adjusted. Also, different structs will need to be handled differently, potentially, re-collecting the lists, and introduce pagination, so it only makes things even more magical.
The text was updated successfully, but these errors were encountered: