git.delta.rocks / unique-network / refs/commits / 25c961748e58

difftreelog

remove: getTotalStakingLocked from RPC.

Trubnikov Sergey2022-09-07parent: #d79c091.patch.diff
in: master

5 files changed

modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
270 at: Option<BlockHash>,270 at: Option<BlockHash>,
271 ) -> Result<Vec<(BlockNumber, String)>>;271 ) -> Result<Vec<(BlockNumber, String)>>;
272
273 /// Returns the total amount locked by staking tokens.
274 #[method(name = "appPromotion_totalStakingLocked")]
275 fn total_staking_locked(
276 &self,
277 staker: CrossAccountId,
278 at: Option<BlockHash>,
279 ) -> Result<String>;
280272
281 /// Returns the total amount of tokens pending withdrawal from staking.273 /// Returns the total amount of tokens pending withdrawal from staking.
282 #[method(name = "appPromotion_pendingUnstake")]274 #[method(name = "appPromotion_pendingUnstake")]
594 .into_iter()586 .into_iter()
595 .map(|(b, a)| (b, a.to_string()))587 .map(|(b, a)| (b, a.to_string()))
596 .collect::<Vec<_>>(), app_promotion_api);588 .collect::<Vec<_>>(), app_promotion_api);
597 pass_method!(total_staking_locked(staker: CrossAccountId) -> String => |v| v.to_string(), app_promotion_api);
598 pass_method!(pending_unstake(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);589 pass_method!(pending_unstake(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);
599 pass_method!(pending_unstake_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>590 pass_method!(pending_unstake_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>
600 |v| v591 |v| v
modifiedprimitives/app_promotion_rpc/src/lib.rsdiffbeforeafterboth
35 {35 {
36 fn total_staked(staker: Option<CrossAccountId>) -> Result<u128>;36 fn total_staked(staker: Option<CrossAccountId>) -> Result<u128>;
37 fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;37 fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
38 fn total_staking_locked(staker: CrossAccountId) -> Result<u128>;
39 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128>;38 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128>;
40 fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;39 fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
41 }40 }
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
206 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker));206 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker));
207 }207 }
208
209 fn total_staking_locked(staker: CrossAccountId) -> Result<u128, DispatchError> {
210 #[cfg(not(feature = "app-promotion"))]
211 return unsupported!();
212
213 #[cfg(feature = "app-promotion")]
214 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_locked_balance(staker));
215 }
216208
217 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {209 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {
218 #[cfg(not(feature = "app-promotion"))]210 #[cfg(not(feature = "app-promotion"))]
modifiedtests/src/interfaces/appPromotion/definitions.tsdiffbeforeafterboth
2222
23const CROSS_ACCOUNT_ID_TYPE = 'PalletEvmAccountBasicCrossAccountIdRepr';23const CROSS_ACCOUNT_ID_TYPE = 'PalletEvmAccountBasicCrossAccountIdRepr';
2424
25const collectionParam = {name: 'collection', type: 'u32'};
26const tokenParam = {name: 'tokenId', type: 'u32'};
27const propertyKeysParam = {name: 'propertyKeys', type: 'Vec<String>', isOptional: true};
28const crossAccountParam = (name = 'account') => ({name, type: CROSS_ACCOUNT_ID_TYPE});25const crossAccountParam = (name = 'account') => ({name, type: CROSS_ACCOUNT_ID_TYPE});
29const atParam = {name: 'at', type: 'Hash', isOptional: true};26const atParam = {name: 'at', type: 'Hash', isOptional: true};
3027
47 [crossAccountParam('staker')],44 [crossAccountParam('staker')],
48 'Vec<(u32, u128)>',45 'Vec<(u32, u128)>',
49 ),46 ),
50 totalStakingLocked: fun(
51 'Return the total amount locked by staking tokens',
52 [crossAccountParam('staker')],
53 'u128',
54 ),
55 pendingUnstake: fun(47 pendingUnstake: fun(
56 'Returns the total amount of unstaked tokens',48 'Returns the total amount of unstaked tokens',
57 [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],49 [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],
modifiedtests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth
52 * Returns the total amount of staked tokens per block when staked52 * Returns the total amount of staked tokens per block when staked
53 **/53 **/
54 totalStakedPerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;54 totalStakedPerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
55 /**
56 * Return the total amount locked by staking tokens
57 **/
58 totalStakingLocked: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
59 };55 };
60 author: {56 author: {
61 /**57 /**