@substrate/api-sidecar 20.5.0 → 20.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/package.json +1 -1
- package/build/src/chains-config/assetHubKusamaControllers.js +3 -0
- package/build/src/chains-config/assetHubKusamaControllers.js.map +1 -1
- package/build/src/chains-config/assetHubNextWestendControllers.js +3 -0
- package/build/src/chains-config/assetHubNextWestendControllers.js.map +1 -1
- package/build/src/chains-config/assetHubPolkadotControllers.js +3 -0
- package/build/src/chains-config/assetHubPolkadotControllers.js.map +1 -1
- package/build/src/chains-config/assetHubWestendControllers.js +5 -1
- package/build/src/chains-config/assetHubWestendControllers.js.map +1 -1
- package/build/src/chains-config/index.js +1 -1
- package/build/src/chains-config/index.js.map +1 -1
- package/build/src/chains-config/kusamaControllers.js +1 -0
- package/build/src/chains-config/kusamaControllers.js.map +1 -1
- package/build/src/chains-config/polkadotControllers.js +1 -0
- package/build/src/chains-config/polkadotControllers.js.map +1 -1
- package/build/src/chains-config/westendControllers.js +1 -0
- package/build/src/chains-config/westendControllers.js.map +1 -1
- package/build/src/controllers/ahm/AhmInfoController.d.ts +32 -0
- package/build/src/controllers/ahm/AhmInfoController.js +62 -0
- package/build/src/controllers/ahm/AhmInfoController.js.map +1 -0
- package/build/src/controllers/ahm/index.d.ts +1 -0
- package/build/src/controllers/ahm/index.js +24 -0
- package/build/src/controllers/ahm/index.js.map +1 -0
- package/build/src/controllers/blocks/BlocksController.js +10 -5
- package/build/src/controllers/blocks/BlocksController.js.map +1 -1
- package/build/src/controllers/blocks/BlocksExtrinsicsController.js +7 -3
- package/build/src/controllers/blocks/BlocksExtrinsicsController.js.map +1 -1
- package/build/src/controllers/controllerInjection.spec.js +2 -2
- package/build/src/controllers/controllerInjection.spec.js.map +1 -1
- package/build/src/controllers/index.d.ts +5 -1
- package/build/src/controllers/index.js +4 -0
- package/build/src/controllers/index.js.map +1 -1
- package/build/src/controllers/rc/pallets/RcPalletsStakingProgressController.d.ts +75 -0
- package/build/src/controllers/rc/pallets/RcPalletsStakingProgressController.js +123 -0
- package/build/src/controllers/rc/pallets/RcPalletsStakingProgressController.js.map +1 -0
- package/build/src/controllers/rc/pallets/RcPalletsStakingValidatorsController.d.ts +15 -0
- package/build/src/controllers/rc/pallets/RcPalletsStakingValidatorsController.js +60 -0
- package/build/src/controllers/rc/pallets/RcPalletsStakingValidatorsController.js.map +1 -0
- package/build/src/controllers/rc/pallets/index.d.ts +2 -0
- package/build/src/controllers/rc/pallets/index.js +5 -1
- package/build/src/controllers/rc/pallets/index.js.map +1 -1
- package/build/src/services/accounts/AccountsBalanceInfoService.d.ts +2 -0
- package/build/src/services/accounts/AccountsBalanceInfoService.js +41 -8
- package/build/src/services/accounts/AccountsBalanceInfoService.js.map +1 -1
- package/build/src/services/accounts/AccountsStakingPayoutsService.js +42 -13
- package/build/src/services/accounts/AccountsStakingPayoutsService.js.map +1 -1
- package/build/src/services/ahm/AhmInfoService.d.ts +20 -0
- package/build/src/services/ahm/AhmInfoService.js +180 -0
- package/build/src/services/ahm/AhmInfoService.js.map +1 -0
- package/build/src/services/ahm/AhmInfoService.spec.d.ts +1 -0
- package/build/src/services/ahm/AhmInfoService.spec.js +146 -0
- package/build/src/services/ahm/AhmInfoService.spec.js.map +1 -0
- package/build/src/services/ahm/index.d.ts +1 -0
- package/build/src/services/ahm/index.js +33 -0
- package/build/src/services/ahm/index.js.map +1 -0
- package/build/src/services/blocks/BlocksService.d.ts +3 -1
- package/build/src/services/blocks/BlocksService.js +39 -1
- package/build/src/services/blocks/BlocksService.js.map +1 -1
- package/build/src/services/consts.d.ts +14 -0
- package/build/src/services/consts.js +43 -0
- package/build/src/services/consts.js.map +1 -0
- package/build/src/services/index.d.ts +1 -0
- package/build/src/services/index.js +1 -0
- package/build/src/services/index.js.map +1 -1
- package/build/src/services/pallets/PalletsStakingProgressService.js +5 -3
- package/build/src/services/pallets/PalletsStakingProgressService.js.map +1 -1
- package/build/src/services/pallets/PalletsStakingProgressService.spec.js +25 -0
- package/build/src/services/pallets/PalletsStakingProgressService.spec.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AccountsAssets, AccountsBalanceInfo, AccountsCompare, AccountsConvert, AccountsPoolAssets, AccountsProxyInfo, AccountsStakingInfo, AccountsStakingPayouts, AccountsValidate, AccountsVestingInfo } from './accounts';
|
|
2
|
+
import { AhmInfo } from './ahm';
|
|
2
3
|
import { Blocks, BlocksExtrinsics, BlocksRawExtrinsics, BlocksTrace } from './blocks';
|
|
3
4
|
import { ContractsInk } from './contracts';
|
|
4
5
|
import { CoretimeChain, CoretimeGeneric } from './coretime';
|
|
@@ -8,7 +9,7 @@ import { Paras } from './paras';
|
|
|
8
9
|
import { RcAccountsBalanceInfo, RcAccountsProxyInfo } from './rc/accounts';
|
|
9
10
|
import { RcBlocks, RcBlocksExtrinsics, RcBlocksRawExtrinsics, RcBlocksTrace } from './rc/blocks';
|
|
10
11
|
import { RcNodeNetwork, RcNodeTransactionPool, RcNodeVersion } from './rc/node';
|
|
11
|
-
import { RcPalletsConsts, RcPalletsDispatchables, RcPalletsErrors, RcPalletsEvents, RcPalletsOnGoingReferenda, RcPalletsStorage } from './rc/pallets';
|
|
12
|
+
import { RcPalletsConsts, RcPalletsDispatchables, RcPalletsErrors, RcPalletsEvents, RcPalletsOnGoingReferenda, RcPalletsStakingProgress, RcPalletsStakingValidators, RcPalletsStorage } from './rc/pallets';
|
|
12
13
|
import { RcRuntimeCode, RcRuntimeMetadata, RcRuntimeSpec } from './rc/runtime';
|
|
13
14
|
import { RuntimeCode, RuntimeMetadata, RuntimeSpec } from './runtime';
|
|
14
15
|
import { TransactionDryRun, TransactionFeeEstimate, TransactionMaterial, TransactionSubmit } from './transaction';
|
|
@@ -16,6 +17,7 @@ import { TransactionDryRun, TransactionFeeEstimate, TransactionMaterial, Transac
|
|
|
16
17
|
* Object containing every controller class definition.
|
|
17
18
|
*/
|
|
18
19
|
export declare const controllers: {
|
|
20
|
+
AhmInfo: typeof AhmInfo;
|
|
19
21
|
Blocks: typeof Blocks;
|
|
20
22
|
BlocksExtrinsics: typeof BlocksExtrinsics;
|
|
21
23
|
BlocksTrace: typeof BlocksTrace;
|
|
@@ -58,6 +60,8 @@ export declare const controllers: {
|
|
|
58
60
|
RcPalletsErrors: typeof RcPalletsErrors;
|
|
59
61
|
RcPalletsEvents: typeof RcPalletsEvents;
|
|
60
62
|
RcPalletsOnGoingReferenda: typeof RcPalletsOnGoingReferenda;
|
|
63
|
+
RcPalletsStakingProgress: typeof RcPalletsStakingProgress;
|
|
64
|
+
RcPalletsStakingValidators: typeof RcPalletsStakingValidators;
|
|
61
65
|
RcPalletsStorage: typeof RcPalletsStorage;
|
|
62
66
|
RcRuntimeCode: typeof RcRuntimeCode;
|
|
63
67
|
RcRuntimeMetadata: typeof RcRuntimeMetadata;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.controllers = void 0;
|
|
19
19
|
const accounts_1 = require("./accounts");
|
|
20
|
+
const ahm_1 = require("./ahm");
|
|
20
21
|
const blocks_1 = require("./blocks");
|
|
21
22
|
const contracts_1 = require("./contracts");
|
|
22
23
|
const coretime_1 = require("./coretime");
|
|
@@ -34,6 +35,7 @@ const transaction_1 = require("./transaction");
|
|
|
34
35
|
* Object containing every controller class definition.
|
|
35
36
|
*/
|
|
36
37
|
exports.controllers = {
|
|
38
|
+
AhmInfo: ahm_1.AhmInfo,
|
|
37
39
|
Blocks: blocks_1.Blocks,
|
|
38
40
|
BlocksExtrinsics: blocks_1.BlocksExtrinsics,
|
|
39
41
|
BlocksTrace: blocks_1.BlocksTrace,
|
|
@@ -76,6 +78,8 @@ exports.controllers = {
|
|
|
76
78
|
RcPalletsErrors: pallets_2.RcPalletsErrors,
|
|
77
79
|
RcPalletsEvents: pallets_2.RcPalletsEvents,
|
|
78
80
|
RcPalletsOnGoingReferenda: pallets_2.RcPalletsOnGoingReferenda,
|
|
81
|
+
RcPalletsStakingProgress: pallets_2.RcPalletsStakingProgress,
|
|
82
|
+
RcPalletsStakingValidators: pallets_2.RcPalletsStakingValidators,
|
|
79
83
|
RcPalletsStorage: pallets_2.RcPalletsStorage,
|
|
80
84
|
RcRuntimeCode: runtime_1.RcRuntimeCode,
|
|
81
85
|
RcRuntimeMetadata: runtime_1.RcRuntimeMetadata,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;AAExE,yCAWoB;AACpB,qCAAsF;AACtF,2CAA2C;AAC3C,yCAA4D;AAC5D,iCAAuE;AACvE,uCAcmB;AACnB,mCAAgC;AAChC,4CAA2E;AAC3E,wCAAiG;AACjG,oCAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;AAExE,yCAWoB;AACpB,+BAAgC;AAChC,qCAAsF;AACtF,2CAA2C;AAC3C,yCAA4D;AAC5D,iCAAuE;AACvE,uCAcmB;AACnB,mCAAgC;AAChC,4CAA2E;AAC3E,wCAAiG;AACjG,oCAAgF;AAChF,0CASsB;AACtB,0CAA+E;AAC/E,uCAAsE;AACtE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AAwB,EAAxB,kCAAwB;IACxB,0BAA0B,EAA1B,oCAA0B;IAC1B,gBAAgB,EAAhB,0BAAgB;IAChB,aAAa,EAAb,uBAAa;IACb,iBAAiB,EAAjB,2BAAiB;IACjB,aAAa,EAAb,uBAAa;IACb,aAAa,EAAb,oBAAa;IACb,qBAAqB,EAArB,4BAAqB;IACrB,aAAa,EAAb,oBAAa;IACb,WAAW,EAAX,qBAAW;IACX,eAAe,EAAf,yBAAe;IACf,WAAW,EAAX,qBAAW;IACX,iBAAiB,EAAjB,+BAAiB;IACjB,sBAAsB,EAAtB,oCAAsB;IACtB,mBAAmB,EAAnB,iCAAmB;IACnB,iBAAiB,EAAjB,+BAAiB;IACjB,KAAK,EAAL,aAAK;IACL,eAAe,EAAf,0BAAe;IACf,aAAa,EAAb,wBAAa;CACb,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { PalletsStakingProgressService } from '../../../services';
|
|
2
|
+
import AbstractController from '../../AbstractController';
|
|
3
|
+
/**
|
|
4
|
+
* GET progress on the general Staking pallet system.
|
|
5
|
+
*
|
|
6
|
+
* Query params:
|
|
7
|
+
* - (Optional)`at`: Block at which to retrieve runtime version information at. Block
|
|
8
|
+
* identifier, as the block height or block hash. Defaults to most recent block.
|
|
9
|
+
*
|
|
10
|
+
* Returns:
|
|
11
|
+
* - `at`: Block number and hash at which the call was made.
|
|
12
|
+
* - `activeEra`: `EraIndex` of the era being rewarded.
|
|
13
|
+
* - `forceEra`: Current status of era forcing.
|
|
14
|
+
* - `nextActiveEraEstimate`: **Upper bound estimate** of the block height at which the next
|
|
15
|
+
* active era will start. Not included in response when `forceEra.isForceNone`.
|
|
16
|
+
* - `nextSessionEstimate`: **Upper bound estimate** of the block height at which the next
|
|
17
|
+
* session will start.
|
|
18
|
+
* - `unappliedSlashes`: Array of upcoming `UnappliedSlash` indexed by era. Each `UnappliedSlash`
|
|
19
|
+
* contains:
|
|
20
|
+
* - `validator`: Stash account ID of the offending validator.
|
|
21
|
+
* - `own`: The amount the validator will be slashed.
|
|
22
|
+
* - `others`: Array of tuples of (accountId, amount) representing all the stashes of other
|
|
23
|
+
* slashed stakers and the amount they will be slashed.
|
|
24
|
+
* - `reporters`: Array of account IDs of the reporters of the offense.
|
|
25
|
+
* - `payout`: Amount of bounty payout to reporters.
|
|
26
|
+
* - `electionStatus`: Information about the off-chain election. Not included in response when
|
|
27
|
+
* `forceEra.isForceNone`. Response includes:
|
|
28
|
+
* - `status`: Era election status; either `Close: null` or `Open: <BlockNumber>`. A status of
|
|
29
|
+
* `Close` indicates that the submission window for solutions from off-chain Phragmen is not
|
|
30
|
+
* open. A status of `Open` indicates the submission window for off-chain Phragmen solutions
|
|
31
|
+
* has been open since BlockNumber. N.B. when the submission window is open, certain
|
|
32
|
+
* extrinsics are not allowed because they would mutate the state that the off-chain Phragmen
|
|
33
|
+
* calculation relies on for calculating results.
|
|
34
|
+
* - `toggleEstimate`: **Upper bound estimate** of the block height at which the `status` will
|
|
35
|
+
* switch.
|
|
36
|
+
* - `idealValidatorCount`: Upper bound of validator set size; considered the ideal size. Not
|
|
37
|
+
* included in response when `forceEra.isForceNone`.
|
|
38
|
+
* - `validatorSet`: Stash account IDs of the validators for the current session. Not included in
|
|
39
|
+
* response when `forceEra.isForceNone`.
|
|
40
|
+
*
|
|
41
|
+
* Note about 'active' vs. 'current' era: The _active_ era is the era currently being rewarded.
|
|
42
|
+
* That is, an elected validator set will be in place for an entire active era, as long as none
|
|
43
|
+
* are kicked out due to slashing. Elections take place at the end of each _current_ era, which
|
|
44
|
+
* is the latest planned era, and may not equal the active era. Normally, the current era index
|
|
45
|
+
* increments one session before the active era, in order to perform the election and queue the
|
|
46
|
+
* validator set for the next active era. For example:
|
|
47
|
+
*
|
|
48
|
+
* ```
|
|
49
|
+
* Time: --------->
|
|
50
|
+
* CurrentEra: 1 | 2 |
|
|
51
|
+
* ActiveEra: | 1 | 2 |
|
|
52
|
+
* SessionIdx: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
|
|
53
|
+
* Elections: ^ ^
|
|
54
|
+
* Set Changes: ^ ^
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* Substrate Reference:
|
|
58
|
+
* - Staking Pallet: https://crates.parity.io/pallet_staking/index.html
|
|
59
|
+
* - Session Pallet: https://crates.parity.io/pallet_session/index.html
|
|
60
|
+
* - `Forcing`: https://crates.parity.io/pallet_staking/enum.Forcing.html
|
|
61
|
+
* - `ElectionStatus`: https://crates.parity.io/pallet_staking/enum.ElectionStatus.html
|
|
62
|
+
*/
|
|
63
|
+
export default class RcPalletsStakingProgressController extends AbstractController<PalletsStakingProgressService> {
|
|
64
|
+
static controllerName: string;
|
|
65
|
+
static requiredPallets: string[][];
|
|
66
|
+
constructor(_api: string);
|
|
67
|
+
protected initRoutes(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get the progress of the staking pallet system.
|
|
70
|
+
*
|
|
71
|
+
* @param _req Express Request
|
|
72
|
+
* @param res Express Response
|
|
73
|
+
*/
|
|
74
|
+
private getPalletStakingProgress;
|
|
75
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2025 Parity Technologies (UK) Ltd.
|
|
3
|
+
// This file is part of Substrate API Sidecar.
|
|
4
|
+
//
|
|
5
|
+
// Substrate API Sidecar is free software: you can redistribute it and/or modify
|
|
6
|
+
// it under the terms of the GNU General Public License as published by
|
|
7
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
// (at your option) any later version.
|
|
9
|
+
//
|
|
10
|
+
// This program is distributed in the hope that it will be useful,
|
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
// GNU General Public License for more details.
|
|
14
|
+
//
|
|
15
|
+
// You should have received a copy of the GNU General Public License
|
|
16
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const apiRegistry_1 = require("../../../apiRegistry");
|
|
22
|
+
const middleware_1 = require("../../../middleware");
|
|
23
|
+
const services_1 = require("../../../services");
|
|
24
|
+
const AbstractController_1 = __importDefault(require("../../AbstractController"));
|
|
25
|
+
/**
|
|
26
|
+
* GET progress on the general Staking pallet system.
|
|
27
|
+
*
|
|
28
|
+
* Query params:
|
|
29
|
+
* - (Optional)`at`: Block at which to retrieve runtime version information at. Block
|
|
30
|
+
* identifier, as the block height or block hash. Defaults to most recent block.
|
|
31
|
+
*
|
|
32
|
+
* Returns:
|
|
33
|
+
* - `at`: Block number and hash at which the call was made.
|
|
34
|
+
* - `activeEra`: `EraIndex` of the era being rewarded.
|
|
35
|
+
* - `forceEra`: Current status of era forcing.
|
|
36
|
+
* - `nextActiveEraEstimate`: **Upper bound estimate** of the block height at which the next
|
|
37
|
+
* active era will start. Not included in response when `forceEra.isForceNone`.
|
|
38
|
+
* - `nextSessionEstimate`: **Upper bound estimate** of the block height at which the next
|
|
39
|
+
* session will start.
|
|
40
|
+
* - `unappliedSlashes`: Array of upcoming `UnappliedSlash` indexed by era. Each `UnappliedSlash`
|
|
41
|
+
* contains:
|
|
42
|
+
* - `validator`: Stash account ID of the offending validator.
|
|
43
|
+
* - `own`: The amount the validator will be slashed.
|
|
44
|
+
* - `others`: Array of tuples of (accountId, amount) representing all the stashes of other
|
|
45
|
+
* slashed stakers and the amount they will be slashed.
|
|
46
|
+
* - `reporters`: Array of account IDs of the reporters of the offense.
|
|
47
|
+
* - `payout`: Amount of bounty payout to reporters.
|
|
48
|
+
* - `electionStatus`: Information about the off-chain election. Not included in response when
|
|
49
|
+
* `forceEra.isForceNone`. Response includes:
|
|
50
|
+
* - `status`: Era election status; either `Close: null` or `Open: <BlockNumber>`. A status of
|
|
51
|
+
* `Close` indicates that the submission window for solutions from off-chain Phragmen is not
|
|
52
|
+
* open. A status of `Open` indicates the submission window for off-chain Phragmen solutions
|
|
53
|
+
* has been open since BlockNumber. N.B. when the submission window is open, certain
|
|
54
|
+
* extrinsics are not allowed because they would mutate the state that the off-chain Phragmen
|
|
55
|
+
* calculation relies on for calculating results.
|
|
56
|
+
* - `toggleEstimate`: **Upper bound estimate** of the block height at which the `status` will
|
|
57
|
+
* switch.
|
|
58
|
+
* - `idealValidatorCount`: Upper bound of validator set size; considered the ideal size. Not
|
|
59
|
+
* included in response when `forceEra.isForceNone`.
|
|
60
|
+
* - `validatorSet`: Stash account IDs of the validators for the current session. Not included in
|
|
61
|
+
* response when `forceEra.isForceNone`.
|
|
62
|
+
*
|
|
63
|
+
* Note about 'active' vs. 'current' era: The _active_ era is the era currently being rewarded.
|
|
64
|
+
* That is, an elected validator set will be in place for an entire active era, as long as none
|
|
65
|
+
* are kicked out due to slashing. Elections take place at the end of each _current_ era, which
|
|
66
|
+
* is the latest planned era, and may not equal the active era. Normally, the current era index
|
|
67
|
+
* increments one session before the active era, in order to perform the election and queue the
|
|
68
|
+
* validator set for the next active era. For example:
|
|
69
|
+
*
|
|
70
|
+
* ```
|
|
71
|
+
* Time: --------->
|
|
72
|
+
* CurrentEra: 1 | 2 |
|
|
73
|
+
* ActiveEra: | 1 | 2 |
|
|
74
|
+
* SessionIdx: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
|
|
75
|
+
* Elections: ^ ^
|
|
76
|
+
* Set Changes: ^ ^
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* Substrate Reference:
|
|
80
|
+
* - Staking Pallet: https://crates.parity.io/pallet_staking/index.html
|
|
81
|
+
* - Session Pallet: https://crates.parity.io/pallet_session/index.html
|
|
82
|
+
* - `Forcing`: https://crates.parity.io/pallet_staking/enum.Forcing.html
|
|
83
|
+
* - `ElectionStatus`: https://crates.parity.io/pallet_staking/enum.ElectionStatus.html
|
|
84
|
+
*/
|
|
85
|
+
class RcPalletsStakingProgressController extends AbstractController_1.default {
|
|
86
|
+
constructor(_api) {
|
|
87
|
+
var _a;
|
|
88
|
+
const rcApiSpecName = (_a = apiRegistry_1.ApiPromiseRegistry.getSpecNameByType('relay')) === null || _a === void 0 ? void 0 : _a.values();
|
|
89
|
+
const rcSpecName = rcApiSpecName ? Array.from(rcApiSpecName)[0] : undefined;
|
|
90
|
+
if (!rcSpecName) {
|
|
91
|
+
throw new Error('Relay chain API spec name is not defined.');
|
|
92
|
+
}
|
|
93
|
+
super(rcSpecName, '/rc/pallets/staking/progress', new services_1.PalletsStakingProgressService(rcSpecName));
|
|
94
|
+
/**
|
|
95
|
+
* Get the progress of the staking pallet system.
|
|
96
|
+
*
|
|
97
|
+
* @param _req Express Request
|
|
98
|
+
* @param res Express Response
|
|
99
|
+
*/
|
|
100
|
+
this.getPalletStakingProgress = async ({ query: { at } }, res) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const rcApi = (_a = apiRegistry_1.ApiPromiseRegistry.getApiByType('relay')[0]) === null || _a === void 0 ? void 0 : _a.api;
|
|
103
|
+
if (!rcApi) {
|
|
104
|
+
throw new Error('Relay chain API not found, please use SAS_SUBSTRATE_MULTI_CHAIN_URL env variable');
|
|
105
|
+
}
|
|
106
|
+
const hash = await this.getHashFromAt(at);
|
|
107
|
+
const result = await this.service.derivePalletStakingProgress(hash);
|
|
108
|
+
RcPalletsStakingProgressController.sanitizedSend(res, result);
|
|
109
|
+
};
|
|
110
|
+
this.initRoutes();
|
|
111
|
+
}
|
|
112
|
+
initRoutes() {
|
|
113
|
+
this.router.use(this.path, middleware_1.validateUseRcBlock);
|
|
114
|
+
this.safeMountAsyncGetHandlers([['', this.getPalletStakingProgress]]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
RcPalletsStakingProgressController.controllerName = 'RcPalletsStakingProgress';
|
|
118
|
+
RcPalletsStakingProgressController.requiredPallets = [
|
|
119
|
+
['Babe', 'Staking', 'Session'],
|
|
120
|
+
['ParachainStaking', 'Session'],
|
|
121
|
+
];
|
|
122
|
+
exports.default = RcPalletsStakingProgressController;
|
|
123
|
+
//# sourceMappingURL=RcPalletsStakingProgressController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RcPalletsStakingProgressController.js","sourceRoot":"","sources":["../../../../../src/controllers/rc/pallets/RcPalletsStakingProgressController.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;;;AAIxE,sDAA0D;AAC1D,oDAAyD;AACzD,gDAAkE;AAClE,kFAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAqB,kCAAmC,SAAQ,4BAAiD;IAMhH,YAAY,IAAY;;QACvB,MAAM,aAAa,GAAG,MAAA,gCAAkB,CAAC,iBAAiB,CAAC,OAAO,CAAC,0CAAE,MAAM,EAAE,CAAC;QAC9E,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,IAAI,CAAC,UAAU,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC9D,CAAC;QACD,KAAK,CAAC,UAAU,EAAE,8BAA8B,EAAE,IAAI,wCAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;QASlG;;;;;WAKG;QACK,6BAAwB,GAAmB,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAiB,EAAE;;YAClG,MAAM,KAAK,GAAG,MAAA,gCAAkB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,0CAAE,GAAG,CAAC;YAE/D,IAAI,CAAC,KAAK,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;YACrG,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;YACpE,kCAAkC,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC/D,CAAC,CAAC;QAvBD,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAES,UAAU;QACnB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,+BAAkB,CAAC,CAAC;QAC/C,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;;AAlBM,iDAAc,GAAG,0BAA0B,AAA7B,CAA8B;AAC5C,kDAAe,GAAG;IACxB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC;IAC9B,CAAC,kBAAkB,EAAE,SAAS,CAAC;CAC/B,AAHqB,CAGpB;kBALkB,kCAAkC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PalletsStakingValidatorsService } from '../../../services';
|
|
2
|
+
import AbstractController from '../../AbstractController';
|
|
3
|
+
export default class RcPalletsStakingValidatorsController extends AbstractController<PalletsStakingValidatorsService> {
|
|
4
|
+
static controllerName: string;
|
|
5
|
+
static requiredPallets: string[][];
|
|
6
|
+
constructor(_api: string);
|
|
7
|
+
protected initRoutes(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Get the progress of the staking pallet system.
|
|
10
|
+
*
|
|
11
|
+
* @param _req Express Request
|
|
12
|
+
* @param res Express Response
|
|
13
|
+
*/
|
|
14
|
+
private getPalletStakingValidators;
|
|
15
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2025 Parity Technologies (UK) Ltd.
|
|
3
|
+
// This file is part of Substrate API Sidecar.
|
|
4
|
+
//
|
|
5
|
+
// Substrate API Sidecar is free software: you can redistribute it and/or modify
|
|
6
|
+
// it under the terms of the GNU General Public License as published by
|
|
7
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
// (at your option) any later version.
|
|
9
|
+
//
|
|
10
|
+
// This program is distributed in the hope that it will be useful,
|
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
// GNU General Public License for more details.
|
|
14
|
+
//
|
|
15
|
+
// You should have received a copy of the GNU General Public License
|
|
16
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const apiRegistry_1 = require("../../../apiRegistry");
|
|
22
|
+
const middleware_1 = require("../../../middleware");
|
|
23
|
+
const services_1 = require("../../../services");
|
|
24
|
+
const AbstractController_1 = __importDefault(require("../../AbstractController"));
|
|
25
|
+
class RcPalletsStakingValidatorsController extends AbstractController_1.default {
|
|
26
|
+
constructor(_api) {
|
|
27
|
+
var _a;
|
|
28
|
+
const rcApiSpecName = (_a = apiRegistry_1.ApiPromiseRegistry.getSpecNameByType('relay')) === null || _a === void 0 ? void 0 : _a.values();
|
|
29
|
+
const rcSpecName = rcApiSpecName ? Array.from(rcApiSpecName)[0] : undefined;
|
|
30
|
+
if (!rcSpecName) {
|
|
31
|
+
throw new Error('Relay chain API spec name is not defined.');
|
|
32
|
+
}
|
|
33
|
+
super(rcSpecName, '/rc/pallets/staking/validators', new services_1.PalletsStakingValidatorsService(rcSpecName));
|
|
34
|
+
/**
|
|
35
|
+
* Get the progress of the staking pallet system.
|
|
36
|
+
*
|
|
37
|
+
* @param _req Express Request
|
|
38
|
+
* @param res Express Response
|
|
39
|
+
*/
|
|
40
|
+
this.getPalletStakingValidators = async ({ query: { at } }, res) => {
|
|
41
|
+
var _a;
|
|
42
|
+
const rcApi = (_a = apiRegistry_1.ApiPromiseRegistry.getApiByType('relay')[0]) === null || _a === void 0 ? void 0 : _a.api;
|
|
43
|
+
if (!rcApi) {
|
|
44
|
+
throw new Error('Relay chain API not found, please use SAS_SUBSTRATE_MULTI_CHAIN_URL env variable');
|
|
45
|
+
}
|
|
46
|
+
const hash = await this.getHashFromAt(at);
|
|
47
|
+
const result = await this.service.derivePalletStakingValidators(hash);
|
|
48
|
+
RcPalletsStakingValidatorsController.sanitizedSend(res, result);
|
|
49
|
+
};
|
|
50
|
+
this.initRoutes();
|
|
51
|
+
}
|
|
52
|
+
initRoutes() {
|
|
53
|
+
this.router.use(this.path, middleware_1.validateUseRcBlock);
|
|
54
|
+
this.safeMountAsyncGetHandlers([['', this.getPalletStakingValidators]]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
RcPalletsStakingValidatorsController.controllerName = 'RcPalletsStakingValidators';
|
|
58
|
+
RcPalletsStakingValidatorsController.requiredPallets = [['Session', 'Staking']];
|
|
59
|
+
exports.default = RcPalletsStakingValidatorsController;
|
|
60
|
+
//# sourceMappingURL=RcPalletsStakingValidatorsController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RcPalletsStakingValidatorsController.js","sourceRoot":"","sources":["../../../../../src/controllers/rc/pallets/RcPalletsStak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AA6B,CAAC,IAAI,CAAC,CAAC;YACtE,oCAAoC,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACjE,CAAC,CAAC;QAvBD,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAES,UAAU;QACnB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,+BAAkB,CAAC,CAAC;QAC/C,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC;;AAfM,mDAAc,GAAG,4BAA4B,AAA/B,CAAgC;AAC9C,oDAAe,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,AAA3B,CAA4B;kBAF9B,oCAAoC"}
|
|
@@ -3,4 +3,6 @@ export { default as RcPalletsDispatchables } from './RcPalletsDispatchablesContr
|
|
|
3
3
|
export { default as RcPalletsErrors } from './RcPalletsErrorsController';
|
|
4
4
|
export { default as RcPalletsEvents } from './RcPalletsEventsController';
|
|
5
5
|
export { default as RcPalletsOnGoingReferenda } from './RcPalletsOnGoingReferendaController';
|
|
6
|
+
export { default as RcPalletsStakingProgress } from './RcPalletsStakingProgressController';
|
|
7
|
+
export { default as RcPalletsStakingValidators } from './RcPalletsStakingValidatorsController';
|
|
6
8
|
export { default as RcPalletsStorage } from './RcPalletsStorageController';
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.RcPalletsStorage = exports.RcPalletsOnGoingReferenda = exports.RcPalletsEvents = exports.RcPalletsErrors = exports.RcPalletsDispatchables = exports.RcPalletsConsts = void 0;
|
|
21
|
+
exports.RcPalletsStorage = exports.RcPalletsStakingValidators = exports.RcPalletsStakingProgress = exports.RcPalletsOnGoingReferenda = exports.RcPalletsEvents = exports.RcPalletsErrors = exports.RcPalletsDispatchables = exports.RcPalletsConsts = void 0;
|
|
22
22
|
var RcPalletsConstsController_1 = require("./RcPalletsConstsController");
|
|
23
23
|
Object.defineProperty(exports, "RcPalletsConsts", { enumerable: true, get: function () { return __importDefault(RcPalletsConstsController_1).default; } });
|
|
24
24
|
var RcPalletsDispatchablesController_1 = require("./RcPalletsDispatchablesController");
|
|
@@ -29,6 +29,10 @@ var RcPalletsEventsController_1 = require("./RcPalletsEventsController");
|
|
|
29
29
|
Object.defineProperty(exports, "RcPalletsEvents", { enumerable: true, get: function () { return __importDefault(RcPalletsEventsController_1).default; } });
|
|
30
30
|
var RcPalletsOnGoingReferendaController_1 = require("./RcPalletsOnGoingReferendaController");
|
|
31
31
|
Object.defineProperty(exports, "RcPalletsOnGoingReferenda", { enumerable: true, get: function () { return __importDefault(RcPalletsOnGoingReferendaController_1).default; } });
|
|
32
|
+
var RcPalletsStakingProgressController_1 = require("./RcPalletsStakingProgressController");
|
|
33
|
+
Object.defineProperty(exports, "RcPalletsStakingProgress", { enumerable: true, get: function () { return __importDefault(RcPalletsStakingProgressController_1).default; } });
|
|
34
|
+
var RcPalletsStakingValidatorsController_1 = require("./RcPalletsStakingValidatorsController");
|
|
35
|
+
Object.defineProperty(exports, "RcPalletsStakingValidators", { enumerable: true, get: function () { return __importDefault(RcPalletsStakingValidatorsController_1).default; } });
|
|
32
36
|
var RcPalletsStorageController_1 = require("./RcPalletsStorageController");
|
|
33
37
|
Object.defineProperty(exports, "RcPalletsStorage", { enumerable: true, get: function () { return __importDefault(RcPalletsStorageController_1).default; } });
|
|
34
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/controllers/rc/pallets/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;;;;AAExE,yEAAyE;AAAhE,6IAAA,OAAO,OAAmB;AACnC,uFAAuF;AAA9E,2JAAA,OAAO,OAA0B;AAC1C,yEAAyE;AAAhE,6IAAA,OAAO,OAAmB;AACnC,yEAAyE;AAAhE,6IAAA,OAAO,OAAmB;AACnC,6FAA6F;AAApF,iKAAA,OAAO,OAA6B;AAC7C,2EAA2E;AAAlE,+IAAA,OAAO,OAAoB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/controllers/rc/pallets/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;;;;AAExE,yEAAyE;AAAhE,6IAAA,OAAO,OAAmB;AACnC,uFAAuF;AAA9E,2JAAA,OAAO,OAA0B;AAC1C,yEAAyE;AAAhE,6IAAA,OAAO,OAAmB;AACnC,yEAAyE;AAAhE,6IAAA,OAAO,OAAmB;AACnC,6FAA6F;AAApF,iKAAA,OAAO,OAA6B;AAC7C,2FAA2F;AAAlF,+JAAA,OAAO,OAA4B;AAC5C,+FAA+F;AAAtF,mKAAA,OAAO,OAA8B;AAC9C,2EAA2E;AAAlE,+IAAA,OAAO,OAAoB"}
|
|
@@ -12,6 +12,8 @@ export declare class AccountsBalanceInfoService extends AbstractService {
|
|
|
12
12
|
* @param token Token to get the balance info of.
|
|
13
13
|
*/
|
|
14
14
|
fetchAccountBalanceInfo(hash: BlockHash, historicApi: ApiDecoration<'promise'>, address: string, token: string, denominate: boolean): Promise<IAccountBalanceInfo>;
|
|
15
|
+
private calculateTransferable;
|
|
16
|
+
private isAllLocked;
|
|
15
17
|
/**
|
|
16
18
|
* Apply a denomination to a balance depending on the chains decimal value.
|
|
17
19
|
*
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.AccountsBalanceInfoService = void 0;
|
|
19
|
+
const util_1 = require("@polkadot/util");
|
|
19
20
|
const http_errors_1 = require("http-errors");
|
|
20
21
|
const AbstractService_1 = require("../AbstractService");
|
|
21
22
|
class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
@@ -93,13 +94,11 @@ class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
|
93
94
|
const { data, nonce } = accountInfo;
|
|
94
95
|
let free, reserved, feeFrozen, miscFrozen, frozen, transferable;
|
|
95
96
|
if ((_a = accountInfo.data) === null || _a === void 0 ? void 0 : _a.frozen) {
|
|
96
|
-
const
|
|
97
|
+
const maybeTransferable = await this.calculateTransferable(data, hash, address);
|
|
97
98
|
free = data.free;
|
|
98
99
|
reserved = data.reserved;
|
|
99
100
|
frozen = data.frozen;
|
|
100
|
-
transferable =
|
|
101
|
-
? deriveData.transferable
|
|
102
|
-
: 'transferable formula not supported for this runtime';
|
|
101
|
+
transferable = maybeTransferable ? maybeTransferable : 'transferable formula not supported for this runtime';
|
|
103
102
|
miscFrozen = 'miscFrozen does not exist for this runtime';
|
|
104
103
|
feeFrozen = 'feeFrozen does not exist for this runtime';
|
|
105
104
|
}
|
|
@@ -184,14 +183,12 @@ class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
|
184
183
|
transferable = 'transferable formula not supported for this runtime';
|
|
185
184
|
}
|
|
186
185
|
else {
|
|
187
|
-
const deriveData = await this.api.derive.balances.all(address);
|
|
188
186
|
const tmpData = accountData;
|
|
187
|
+
const maybeTransferable = await this.calculateTransferable(tmpData, hash, address);
|
|
189
188
|
free = tmpData.free;
|
|
190
189
|
reserved = tmpData.reserved;
|
|
191
190
|
frozen = tmpData.frozen;
|
|
192
|
-
transferable =
|
|
193
|
-
? deriveData.transferable
|
|
194
|
-
: 'transferable formula not supported for this runtime';
|
|
191
|
+
transferable = maybeTransferable ? maybeTransferable : 'transferable formula not supported for this runtime';
|
|
195
192
|
feeFrozen = 'feeFrozen does not exist for this runtime';
|
|
196
193
|
miscFrozen = 'miscFrozen does not exist for this runtime';
|
|
197
194
|
}
|
|
@@ -212,6 +209,42 @@ class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
|
212
209
|
throw new http_errors_1.BadRequest('Account not found');
|
|
213
210
|
}
|
|
214
211
|
}
|
|
212
|
+
async calculateTransferable(data, hash, addr) {
|
|
213
|
+
const apiAt = await this.api.at(hash);
|
|
214
|
+
const allLocked = await this.isAllLocked(addr, hash);
|
|
215
|
+
let transferable;
|
|
216
|
+
if (data === null || data === void 0 ? void 0 : data.frozen) {
|
|
217
|
+
const { frozen, free, reserved } = data;
|
|
218
|
+
const noFrozenReserved = frozen.isZero() && reserved.isZero();
|
|
219
|
+
const ED = apiAt.consts.balances.existentialDeposit;
|
|
220
|
+
const maybeED = noFrozenReserved ? new util_1.BN(0) : ED;
|
|
221
|
+
const frozenReserveDif = frozen.sub(reserved);
|
|
222
|
+
transferable = apiAt.registry.createType('Balance', allLocked ? 0 : (0, util_1.bnMax)(new util_1.BN(0), free.sub((0, util_1.bnMax)(maybeED, frozenReserveDif))));
|
|
223
|
+
}
|
|
224
|
+
return transferable;
|
|
225
|
+
}
|
|
226
|
+
async isAllLocked(addr, hash) {
|
|
227
|
+
const apiAt = await this.api.at(hash);
|
|
228
|
+
try {
|
|
229
|
+
// Get current block header (contains block number) and locks in parallel
|
|
230
|
+
const [header, locks] = await Promise.all([
|
|
231
|
+
this.api.rpc.chain.getHeader(), // Current best block
|
|
232
|
+
apiAt.query.balances.locks(addr),
|
|
233
|
+
]);
|
|
234
|
+
const bestNumber = header.number.unwrap();
|
|
235
|
+
if (!Array.isArray(locks) || locks.length === 0) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
// Filter locks that haven't expired yet
|
|
239
|
+
const validLocks = locks.filter(({ until }) => !until || until.gt(bestNumber));
|
|
240
|
+
// Check if any valid lock has maximum amount (all funds locked)
|
|
241
|
+
return validLocks.some((lock) => lock.amount.isMax());
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
console.error('Error checking if all funds are locked:', error);
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
215
248
|
/**
|
|
216
249
|
* Apply a denomination to a balance depending on the chains decimal value.
|
|
217
250
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountsBalanceInfoService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsBalanceInfoService.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;AAMxE,6CAAyC;AAGzC,wDAAqD;AAErD,MAAa,0BAA2B,SAAQ,iCAAe;IAC9D;;;;;;;OAOG;IACH,KAAK,CAAC,uBAAuB,CAC5B,IAAe,EACf,WAAqC,EACrC,OAAe,EACf,KAAa,EACb,UAAmB;;QAEnB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAErB,IAAI,UAAU,IAAI,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,wBAAU,CACnB,wHAAwH,CACxH,CAAC;QACH,CAAC;QAED,MAAM,gBAAgB,GAAG,WAAW,CAAC,QAAQ,CAAC,WAAW,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AG,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAClG,CAAC;IAED;;;;;OAKG;IACK,sBAAsB,CAAC,KAAuB,EAAE,GAAW;QAClE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACzB,OAAO;gBACN,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;gBACvD,OAAO,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACK,iBAAiB,CAAC,UAAmB,EAAE,GAAY,EAAE,GAAW;QACvE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACnE,CAAC;IAED;;;;;;OAMG;IACK,mBAAmB,CAC1B,UAAmB,EACnB,KAAuB,EACvB,GAAW;QAEX,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACrE,CAAC;CACD;AAvRD,gEAuRC"}
|
|
1
|
+
{"version":3,"file":"AccountsBalanceInfoService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsBalanceInfoService.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;AAMxE,yCAA2C;AAC3C,6CAAyC;AAGzC,wDAAqD;AAErD,MAAa,0BAA2B,SAAQ,iCAAe;I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O,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAClG,CAAC;IAED;;;;;OAKG;IACK,sBAAsB,CAAC,KAAuB,EAAE,GAAW;QAClE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACzB,OAAO;gBACN,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;gBACvD,OAAO,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACK,iBAAiB,CAAC,UAAmB,EAAE,GAAY,EAAE,GAAW;QACvE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACnE,CAAC;IAED;;;;;;OAMG;IACK,mBAAmB,CAC1B,UAAmB,EACnB,KAAuB,EACvB,GAAW;QAEX,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACrE,CAAC;CACD;AAlUD,gEAkUC"}
|
|
@@ -23,17 +23,8 @@ const calc_1 = require("@substrate/calc");
|
|
|
23
23
|
const http_errors_1 = require("http-errors");
|
|
24
24
|
const apiRegistry_1 = require("../../apiRegistry");
|
|
25
25
|
const AbstractService_1 = require("../AbstractService");
|
|
26
|
+
const consts_1 = require("../consts");
|
|
26
27
|
const kusamaEarlyErasBlockInfo_json_1 = __importDefault(require("./kusamaEarlyErasBlockInfo.json"));
|
|
27
|
-
const MIGRATION_BOUNDARIES = {
|
|
28
|
-
westmint: {
|
|
29
|
-
relayChainLastEra: 9297,
|
|
30
|
-
assetHubFirstEra: 9297,
|
|
31
|
-
assetHubMigrationStartedAt: 11716733,
|
|
32
|
-
assetHubMigrationEndedAt: 11736597,
|
|
33
|
-
relayMigrationStartedAt: 26041702,
|
|
34
|
-
relayMigrationEndedAt: 26071771,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
28
|
class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
|
|
38
29
|
/**
|
|
39
30
|
* Fetch and derive payouts for `address`.
|
|
@@ -151,13 +142,51 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
|
|
|
151
142
|
* @param historicApi Historic api for querying past blocks
|
|
152
143
|
*/
|
|
153
144
|
async fetchAccountStakingPayoutAssetHub(hash, address, depth, era, unclaimedOnly, currentEra, historicApi) {
|
|
145
|
+
var _a, _b, _c, _d, _e, _f;
|
|
154
146
|
const { api } = this;
|
|
155
147
|
const specName = this.getSpecName().toLowerCase();
|
|
156
148
|
// Get migration boundaries for this chain
|
|
157
|
-
|
|
149
|
+
let migrationBoundaries = consts_1.MIGRATION_BOUNDARIES[specName];
|
|
158
150
|
if (!migrationBoundaries) {
|
|
159
|
-
//
|
|
160
|
-
|
|
151
|
+
// Check storage first then fallback to fetchStakingAccount;
|
|
152
|
+
if (((_a = api.query.ahMigrator) === null || _a === void 0 ? void 0 : _a.migrationStartBlock) && ((_b = api.query.ahMigrator) === null || _b === void 0 ? void 0 : _b.migrationEndBlock)) {
|
|
153
|
+
const rcApi = apiRegistry_1.ApiPromiseRegistry.getApiByType('relay')[0].api;
|
|
154
|
+
// Get start and end blocks
|
|
155
|
+
const [ahStart, ahEnd, rcStart, rcEnd] = await Promise.all([
|
|
156
|
+
(_c = this.api.query.ahMigrator) === null || _c === void 0 ? void 0 : _c.migrationStartBlock(),
|
|
157
|
+
(_d = this.api.query.ahMigrator) === null || _d === void 0 ? void 0 : _d.migrationEndBlock(),
|
|
158
|
+
(_e = rcApi.query.rcMigrator) === null || _e === void 0 ? void 0 : _e.migrationStartBlock(),
|
|
159
|
+
(_f = rcApi.query.rcMigrator) === null || _f === void 0 ? void 0 : _f.migrationEndBlock(),
|
|
160
|
+
]);
|
|
161
|
+
if (ahStart.isNone || ahEnd.isNone || rcStart.isNone || rcEnd.isNone) {
|
|
162
|
+
return this.fetchAccountStakingPayout(hash, address, depth, era, unclaimedOnly, currentEra, historicApi);
|
|
163
|
+
}
|
|
164
|
+
const [ahEndBlockHash, rcStartBlockHash] = await Promise.all([
|
|
165
|
+
this.api.rpc.chain.getBlockHash(ahEnd.unwrap()),
|
|
166
|
+
rcApi.rpc.chain.getBlockHash(rcStart.unwrap()),
|
|
167
|
+
]);
|
|
168
|
+
const [ahApiAt, rcApiAt] = await Promise.all([this.api.at(ahEndBlockHash), rcApi.at(rcStartBlockHash)]);
|
|
169
|
+
const [ahCurrentEra, rcCurrentEra] = await Promise.all([
|
|
170
|
+
ahApiAt.query.staking.currentEra(),
|
|
171
|
+
rcApiAt.query.staking.currentEra(),
|
|
172
|
+
]);
|
|
173
|
+
// We should never hit this, but its here for safety and clarity
|
|
174
|
+
if (ahCurrentEra.isNone || rcCurrentEra.isNone) {
|
|
175
|
+
throw new Error('No era found in staking payouts');
|
|
176
|
+
}
|
|
177
|
+
migrationBoundaries = {
|
|
178
|
+
relayChainLastEra: rcCurrentEra.unwrap().toNumber(),
|
|
179
|
+
assetHubFirstEra: ahCurrentEra.unwrap().toNumber(),
|
|
180
|
+
assetHubMigrationStartedAt: ahStart.unwrap().toNumber(),
|
|
181
|
+
assetHubMigrationEndedAt: ahEnd.unwrap().toNumber(),
|
|
182
|
+
relayMigrationStartedAt: rcStart.unwrap().toNumber(),
|
|
183
|
+
relayMigrationEndedAt: rcEnd.unwrap().toNumber(),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
// Fallback to regular method if no migration boundaries defined
|
|
188
|
+
return this.fetchAccountStakingPayout(hash, address, depth, era, unclaimedOnly, currentEra, historicApi);
|
|
189
|
+
}
|
|
161
190
|
}
|
|
162
191
|
const sanitizedEra = era < 0 ? 0 : era;
|
|
163
192
|
const startEra = Math.max(0, sanitizedEra - (depth - 1));
|