@substrate/api-sidecar 11.3.0 → 11.3.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.
Files changed (41) hide show
  1. package/README.md +8 -8
  2. package/build/package.json +14 -14
  3. package/build/src/chains-config/index.js +2 -0
  4. package/build/src/chains-config/index.js.map +1 -1
  5. package/build/src/chains-config/mantaControllers.d.ts +5 -0
  6. package/build/src/chains-config/mantaControllers.js +39 -0
  7. package/build/src/chains-config/mantaControllers.js.map +1 -0
  8. package/build/src/chains-config/metadata-consts/index.js +3 -0
  9. package/build/src/chains-config/metadata-consts/index.js.map +1 -1
  10. package/build/src/chains-config/metadata-consts/mantaConsts.d.ts +2 -0
  11. package/build/src/chains-config/metadata-consts/mantaConsts.js +11 -0
  12. package/build/src/chains-config/metadata-consts/mantaConsts.js.map +1 -0
  13. package/build/src/services/accounts/AccountsStakingPayoutsService.d.ts +11 -5
  14. package/build/src/services/accounts/AccountsStakingPayoutsService.js +16 -15
  15. package/build/src/services/accounts/AccountsStakingPayoutsService.js.map +1 -1
  16. package/build/src/services/accounts/AccountsStakingPayoutsService.spec.d.ts +1 -0
  17. package/build/src/services/accounts/AccountsStakingPayoutsService.spec.js +152 -0
  18. package/build/src/services/accounts/AccountsStakingPayoutsService.spec.js.map +1 -0
  19. package/build/src/services/test-helpers/mock/accounts/deriveNominators.d.ts +10 -0
  20. package/build/src/services/test-helpers/mock/accounts/deriveNominators.js +70 -0
  21. package/build/src/services/test-helpers/mock/accounts/deriveNominators.js.map +1 -0
  22. package/build/src/services/test-helpers/mock/accounts/deriveValidators.d.ts +18 -0
  23. package/build/src/services/test-helpers/mock/accounts/deriveValidators.js +28 -0
  24. package/build/src/services/test-helpers/mock/accounts/deriveValidators.js.map +1 -0
  25. package/build/src/services/test-helpers/mock/accounts/eraRewardPoints.d.ts +6 -0
  26. package/build/src/services/test-helpers/mock/accounts/eraRewardPoints.js +17 -0
  27. package/build/src/services/test-helpers/mock/accounts/eraRewardPoints.js.map +1 -0
  28. package/build/src/services/test-helpers/mock/accounts/index.d.ts +4 -0
  29. package/build/src/services/test-helpers/mock/accounts/index.js +17 -0
  30. package/build/src/services/test-helpers/mock/accounts/index.js.map +1 -0
  31. package/build/src/services/test-helpers/mock/accounts/ledger.d.ts +8 -0
  32. package/build/src/services/test-helpers/mock/accounts/ledger.js +19 -0
  33. package/build/src/services/test-helpers/mock/accounts/ledger.js.map +1 -0
  34. package/build/src/services/test-helpers/responses/accounts/stakingPayout.json +33 -0
  35. package/build/src/test-helpers/metadata/polkadotV9122Metadata.d.ts +1 -0
  36. package/build/src/test-helpers/metadata/polkadotV9122Metadata.js +5 -0
  37. package/build/src/test-helpers/metadata/polkadotV9122Metadata.js.map +1 -0
  38. package/build/src/test-helpers/registries/polkadotRegistry.d.ts +4 -0
  39. package/build/src/test-helpers/registries/polkadotRegistry.js +6 -1
  40. package/build/src/test-helpers/registries/polkadotRegistry.js.map +1 -1
  41. package/package.json +14 -14
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  <div align="center">
5
5
  <h1 align="center">@substrate/api-sidecar</h1>
6
- <h4 align="center"> REST service that makes it easy to interact with blockchain nodes built using Substrate's
7
- <a href="https://substrate.dev/docs/en/knowledgebase/runtime/frame">FRAME</a>
6
+ <h4 align="center"> REST service that makes it easy to interact with blockchain nodes built using Substrate's
7
+ <a href="https://substrate.dev/docs/en/knowledgebase/runtime/frame">FRAME</a>
8
8
  framework.</h4>
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/@substrate/api-sidecar">
@@ -131,14 +131,14 @@ For more information on our configuration manager visit its readme [here](https:
131
131
 
132
132
  ### Express server
133
133
 
134
- - `SAS_EXPRESS_BIND_HOST`: address on which the server will be listening, defaults to `127.0.0.1`.
135
- - `SAS_EXPRESS_PORT`: port on which the server will be listening, defaults to `8080`.
136
- - `SAS_EXPRESS_LOG_MODE`: enable console logging of "all" HTTP requests, only "errors", or nothing by
134
+ - `SAS_EXPRESS_BIND_HOST`: address on which the server will be listening, defaults to `127.0.0.1`.
135
+ - `SAS_EXPRESS_PORT`: port on which the server will be listening, defaults to `8080`.
136
+ - `SAS_EXPRESS_LOG_MODE`: enable console logging of "all" HTTP requests, only "errors", or nothing by
137
137
  setting it to anything else. LOG_MODE defaults to only "errors".
138
138
 
139
139
  ### Substrate node
140
140
 
141
- - `SAS_SUBSTRATE_WS_URL`: WebSocket URL to which the RPC proxy will attempt to connect to, defaults to
141
+ - `SAS_SUBSTRATE_WS_URL`: WebSocket URL to which the RPC proxy will attempt to connect to, defaults to
142
142
  `ws://127.0.0.1:9944`.
143
143
 
144
144
  #### Custom substrate types
@@ -295,7 +295,7 @@ All the commits in this repo follow the [Conventional Commits spec](https://www.
295
295
  - @polkadot/util-crypto [release notes](https://github.com/polkadot-js/common/releases)
296
296
  - @substrate/calc [npm release page](https://www.npmjs.com/package/@substrate/calc)
297
297
 
298
- 1. Next make sure the resolutions are up to date inside of the `package.json` for all `@polkadot/*` packages, please refer to the releases of each polkadot package we update as a dependency, and reach out to the maintainers for any questions.
298
+ 1. Next make sure the resolutions are up to date inside of the `package.json` for all `@polkadot/*` packages, please refer to the releases of each polkadot package we update as a dependency, and reach out to the maintainers for any questions.
299
299
 
300
300
  1. After updating the dependencies and resolutions (if applicable), the next step is making sure the release will work against all relevant runtimes for Polkadot, Kusama, and Westend. This can be handled by running `yarn test:init-e2e-tests`. If you would like to test on an individual chain, you may run the same command followed by its chain, ex: `yarn test:init-e2e-tests:polkadot`. Before moving forward ensure all tests pass, and if it warns of any missing types feel free to make an issue [here](https://github.com/paritytech/substrate-api-sidecar/issues).
301
301
 
@@ -303,7 +303,7 @@ All the commits in this repo follow the [Conventional Commits spec](https://www.
303
303
 
304
304
  1. Update the version in the package.json (this is very important for releasing on NPM).
305
305
 
306
- 1. Update the substrate-api-sidecar version in the docs by going into `docs/src/openapi-v1.yaml`, and changing the `version` field under `info` to the releases respected version. Then run `yarn build:docs`.
306
+ 1. Update the substrate-api-sidecar version in the docs by going into `docs/src/openapi-v1.yaml`, and changing the `version` field under `info` to the releases respected version. Then run `yarn build:docs`.
307
307
 
308
308
  1. Update `CHANGELOG.md` by looking at merged PRs since the last release. Follow the format of previous releases. Only record dep updates if they reflect type definition updates as those affect the users API.
309
309
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "11.3.0",
2
+ "version": "11.3.1",
3
3
  "name": "@substrate/api-sidecar",
4
4
  "description": "REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.",
5
5
  "homepage": "https://github.com/paritytech/substrate-api-sidecar#readme",
@@ -52,11 +52,11 @@
52
52
  "test:test-release": "yarn start:test-release"
53
53
  },
54
54
  "dependencies": {
55
- "@polkadot/api": "^6.8.1",
56
- "@polkadot/apps-config": "0.98.2-70",
57
- "@polkadot/util-crypto": "^7.8.2",
55
+ "@polkadot/api": "^6.9.2",
56
+ "@polkadot/apps-config": "0.98.2-94",
57
+ "@polkadot/util-crypto": "^7.9.2",
58
58
  "@polkadot/x-rxjs": "^6.11.1",
59
- "@substrate/calc": "^0.2.5",
59
+ "@substrate/calc": "^0.2.6",
60
60
  "argparse": "^2.0.1",
61
61
  "confmgr": "1.0.7",
62
62
  "express": "^4.17.1",
@@ -78,14 +78,14 @@
78
78
  "tsc-watch": "^4.4.0"
79
79
  },
80
80
  "resolutions": {
81
- "@polkadot/api": "6.8.1",
82
- "@polkadot/keyring": "7.8.2",
83
- "@polkadot/networks": "7.8.2",
84
- "@polkadot/types": "6.8.1",
85
- "@polkadot/types-known": "6.8.1",
86
- "@polkadot/util": "7.8.2",
87
- "@polkadot/util-crypto": "7.8.2",
88
- "@polkadot/wasm-crypto": "4.2.1",
81
+ "@polkadot/api": "6.9.2",
82
+ "@polkadot/keyring": "7.9.2",
83
+ "@polkadot/networks": "7.9.2",
84
+ "@polkadot/types": "6.9.2",
85
+ "@polkadot/types-known": "6.9.2",
86
+ "@polkadot/util": "7.9.2",
87
+ "@polkadot/util-crypto": "7.9.2",
88
+ "@polkadot/wasm-crypto": "4.4.1",
89
89
  "node-forge": ">=0.10.0",
90
90
  "node-fetch": ">=2.6.1",
91
91
  "prismjs": ">=1.23.0"
@@ -97,5 +97,5 @@
97
97
  "polkadot",
98
98
  "kusama"
99
99
  ],
100
- "packageManager": "yarn@3.0.0"
100
+ "packageManager": "yarn@3.1.0"
101
101
  }
@@ -13,6 +13,7 @@ const kiltControllers_1 = require("./kiltControllers");
13
13
  const kulupuControllers_1 = require("./kulupuControllers");
14
14
  const kusamaControllers_1 = require("./kusamaControllers");
15
15
  const mandalaControllers_1 = require("./mandalaControllers");
16
+ const mantaControllers_1 = require("./mantaControllers");
16
17
  const polkadotControllers_1 = require("./polkadotControllers");
17
18
  const polymeshControllers_1 = require("./polymeshControllers");
18
19
  const shidenControllers_1 = require("./shidenControllers");
@@ -40,6 +41,7 @@ const specToControllerMap = {
40
41
  calamari: calamariControllers_1.calamariControllers,
41
42
  karura: karuraControllers_1.karuraControllers,
42
43
  acala: acalaControllers_1.acalaControllers,
44
+ manta: mantaControllers_1.mantaControllers,
43
45
  };
44
46
  /**
45
47
  * Return an array of instantiated controller instances based off of a `specName`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chains-config/index.ts"],"names":[],"mappings":";;;AAIA,gDAA6C;AAE7C,yDAAsD;AACtD,+DAA4D;AAC5D,6DAA0D;AAC1D,qEAAkE;AAClE,2EAAwE;AACxE,2EAAqE;AACrE,2DAAwD;AACxD,uDAAoD;AACpD,2DAAwD;AACxD,2DAAwD;AACxD,6DAA0D;AAC1D,+DAA4D;AAC5D,+DAA4D;AAC5D,2DAAwD;AACxD,uDAAoD;AACpD,iEAA8D;AAC9D,iEAA8D;AAC9D,6DAA0D;AAE1D,MAAM,mBAAmB,GAAG;IAC3B,OAAO,EAAE,uCAAkB;IAC3B,QAAQ,EAAE,yCAAmB;IAC7B,QAAQ,EAAE,yCAAmB;IAC7B,MAAM,EAAE,qCAAiB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BAAoB,GAAG,MAAM,CAAC,WAAW,CAAC;IAEhD,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE;QACtD,GAAG,CAAC,IAAI,CAAC,IAAI,yBAAW,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QAE3D,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,EAA2C,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ControllerConfig } from '../types/chains-config';
2
+ /**
3
+ * Controllers for manta collator
4
+ */
5
+ export declare const mantaControllers: ControllerConfig;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mantaControllers = void 0;
4
+ const lruCache_1 = require("./cache/lruCache");
5
+ const metadata_consts_1 = require("./metadata-consts");
6
+ /**
7
+ * Controllers for manta collator
8
+ */
9
+ exports.mantaControllers = {
10
+ controllers: [
11
+ 'AccountsBalanceInfo',
12
+ 'AccountsStakingInfo',
13
+ 'AccountsStakingPayouts',
14
+ 'AccountsValidate',
15
+ 'AccountsVestingInfo',
16
+ 'Blocks',
17
+ 'BlocksExtrinsics',
18
+ 'NodeNetwork',
19
+ 'NodeTransactionPool',
20
+ 'NodeVersion',
21
+ 'PalletsStakingProgress',
22
+ 'PalletsStorage',
23
+ 'Paras',
24
+ 'RuntimeCode',
25
+ 'RuntimeMetadata',
26
+ 'RuntimeSpec',
27
+ 'TransactionDryRun',
28
+ 'TransactionFeeEstimate',
29
+ 'TransactionMaterial',
30
+ 'TransactionSubmit',
31
+ ],
32
+ options: {
33
+ finalizes: true,
34
+ minCalcFeeRuntime: 1,
35
+ blockWeightStore: (0, metadata_consts_1.getBlockWeight)('manta'),
36
+ blockStore: (0, lruCache_1.initLRUCache)(),
37
+ },
38
+ };
39
+ //# sourceMappingURL=mantaControllers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mantaControllers.js","sourceRoot":"","sources":["../../../src/chains-config/mantaControllers.ts"],"names":[],"mappings":";;;AACA,+CAAgD;AAChD,uDAAmD;AAEnD;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IACjD,WAAW,EAAE;QACZ,qBAAqB;QACrB,qBAAqB;QACrB,wBAAwB;QACxB,kBAAkB;QAClB,qBAAqB;QACrB,QAAQ;QACR,kBAAkB;QAClB,aAAa;QACb,qBAAqB;QACrB,aAAa;QACb,wBAAwB;QACxB,gBAAgB;QAChB,OAAO;QACP,aAAa;QACb,iBAAiB;QACjB,aAAa;QACb,mBAAmB;QACnB,wBAAwB;QACxB,qBAAqB;QACrB,mBAAmB;KACnB;IACD,OAAO,EAAE;QACR,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,IAAA,gCAAc,EAAC,OAAO,CAAC;QACzC,UAAU,EAAE,IAAA,uBAAY,GAAE;KAC1B;CACD,CAAC"}
@@ -7,6 +7,7 @@ const calamariConsts_1 = require("./calamariConsts");
7
7
  const dockConsts_1 = require("./dockConsts");
8
8
  const karuraConsts_1 = require("./karuraConsts");
9
9
  const kusamaConsts_1 = require("./kusamaConsts");
10
+ const mantaConsts_1 = require("./mantaConsts");
10
11
  const polkadotConsts_1 = require("./polkadotConsts");
11
12
  const polymeshConsts_1 = require("./polymeshConsts");
12
13
  const shidenConsts_1 = require("./shidenConsts");
@@ -83,6 +84,8 @@ function getBlockWeight(specName) {
83
84
  return generateBlockWeightStore(karuraConsts_1.karuraDefinitions);
84
85
  case 'acala':
85
86
  return generateBlockWeightStore(acalaConsts_1.acalaDefinitions);
87
+ case 'manta':
88
+ return generateBlockWeightStore(mantaConsts_1.mantaDefinitions);
86
89
  default:
87
90
  return {};
88
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/index.ts"],"names":[],"mappings":";;;AAAA,6DAOmC;AACnC,+CAAiD;A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GAAG,CAAC,QAAQ,CAAC;aACrE;iBAAM;gBACN,MAAM,IAAI,KAAK,CACd,gEAAgE,CAChE,CAAC;aACF;SACD;KACD;IAED,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAxBD,4DAwBC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,QAAgB;IAC9C,QAAQ,QAAQ,EAAE;QACjB,KAAK,UAAU;YACd,OAAO,wBAAwB,CAAC,oCAAmB,CAAC,CAAC;QACtD,KAAK,UAAU;YACd,OAAO,wBAAwB,CAAC,oCAAmB,CAAC,CAAC;QACtD,KAAK,QAAQ;YACZ,OAAO,wBAAwB,CAAC,gCAAiB,CAAC,CAAC;QACpD,KAAK,SAAS;YACb,OAAO,wBAAwB,CAAC,kCAAkB,CAAC,CAAC;QACrD,KAAK,mBAAmB;YACvB,OAAO,wBAAwB,CAAC,mCAAsB,CAAC,CAAC;QACzD,KAAK,uBAAuB;YAC3B,OAAO,wBAAwB,CAAC,sCAAyB,CAAC,CAAC;QAC5D,KAAK,uBAAuB;YAC3B,OAAO,wBAAwB,CAAC,sCAAyB,CAAC,CAAC;QAC5D,KAAK,QAAQ;YACZ,OAAO,wBAAwB,CAAC,gCAAiB,CAAC,CAAC;QACpD,KAAK,UAAU;YACd,OAAO,wBAAwB,CAAC,oCAAmB,CAAC,CAAC;QACtD,KAAK,QAAQ;YACZ,OAAO,wBAAwB,CAAC,gCAAiB,CAAC,CAAC;QACpD,KAAK,OAAO;YACX,OAAO,wBAAwB,CAAC,8BAAgB,CAAC,CAAC;QACnD,KAAK,OAAO;YACX,OAAO,wBAAwB,CAAC,8BAAgB,CAAC,CAAC;QACnD;YACC,OAAO,EAAE,CAAC;KACX;AACF,CAAC;AA7BD,wCA6BC"}
@@ -0,0 +1,2 @@
1
+ import { MetadataConsts } from '../../types/chains-config';
2
+ export declare const mantaDefinitions: MetadataConsts[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mantaDefinitions = void 0;
4
+ const substrateConsts_1 = require("./substrateConsts");
5
+ exports.mantaDefinitions = [
6
+ {
7
+ runtimeVersions: [3090],
8
+ extrinsicBaseWeight: substrateConsts_1.extrinsicBaseWeight,
9
+ },
10
+ ];
11
+ //# sourceMappingURL=mantaConsts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mantaConsts.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/mantaConsts.ts"],"names":[],"mappings":";;;AACA,uDAAwD;AAE3C,QAAA,gBAAgB,GAAqB;IACjD;QACC,eAAe,EAAE,CAAC,IAAI,CAAC;QACvB,mBAAmB,EAAnB,qCAAmB;KACnB;CACD,CAAC"}
@@ -1,14 +1,20 @@
1
1
  import { ApiPromise } from '@polkadot/api';
2
+ import { ApiDecoration } from '@polkadot/api/types';
2
3
  import { DeriveEraExposure, DeriveEraExposureNominating } from '@polkadot/api-derive/staking/types';
3
4
  import { Option } from '@polkadot/types';
4
- import { BalanceOf, BlockHash, EraIndex, EraRewardPoints, Perbill, StakingLedger } from '@polkadot/types/interfaces';
5
+ import { BalanceOf, BlockHash, EraIndex, Perbill, StakingLedger } from '@polkadot/types/interfaces';
6
+ import { PalletStakingEraRewardPoints } from '@polkadot/types/lookup';
5
7
  import { IAccountStakingPayouts, IEraPayouts } from '../../types/responses';
6
8
  import { AbstractService } from '../AbstractService';
7
9
  /**
8
10
  * General information about an era, in tuple form because we initially get it
9
11
  * by destructuring a Promise.all(...)
10
12
  */
11
- declare type IErasGeneral = [DeriveEraExposure, EraRewardPoints, Option<BalanceOf>];
13
+ declare type IErasGeneral = [
14
+ DeriveEraExposure,
15
+ PalletStakingEraRewardPoints,
16
+ Option<BalanceOf>
17
+ ];
12
18
  /**
13
19
  * Commission and staking ledger of a validator
14
20
  */
@@ -21,7 +27,7 @@ interface ICommissionAndLedger {
21
27
  */
22
28
  interface IEraData {
23
29
  deriveEraExposure: DeriveEraExposure;
24
- eraRewardPoints: EraRewardPoints;
30
+ eraRewardPoints: PalletStakingEraRewardPoints;
25
31
  erasValidatorRewardOption: Option<BalanceOf>;
26
32
  exposuresWithCommission?: (ICommissionAndLedger & {
27
33
  validatorId: string;
@@ -47,7 +53,7 @@ export declare class AccountsStakingPayoutsService extends AbstractService {
47
53
  * @param startEra first era to get data for
48
54
  * @param era the last era to get data for
49
55
  */
50
- fetchAllErasGeneral(api: ApiPromise, hash: BlockHash, startEra: number, era: number): Promise<IErasGeneral[]>;
56
+ fetchAllErasGeneral(api: ApiPromise, historicApi: ApiDecoration<'promise'>, startEra: number, era: number): Promise<IErasGeneral[]>;
51
57
  /**
52
58
  * Fetch the commission & staking ledger for each `validatorId` in `deriveErasExposures`.
53
59
  *
@@ -57,7 +63,7 @@ export declare class AccountsStakingPayoutsService extends AbstractService {
57
63
  * @param startEra first era to get data for
58
64
  * @param deriveErasExposures exposures per era for `address`
59
65
  */
60
- fetchAllErasCommissions(api: ApiPromise, hash: BlockHash, address: string, startEra: number, deriveErasExposures: DeriveEraExposure[]): Promise<ICommissionAndLedger[][]>;
66
+ fetchAllErasCommissions(historicApi: ApiDecoration<'promise'>, address: string, startEra: number, deriveErasExposures: DeriveEraExposure[]): Promise<ICommissionAndLedger[][]>;
61
67
  /**
62
68
  * Derive all the payouts for `address` at `era`.
63
69
  *
@@ -16,9 +16,10 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
16
16
  */
17
17
  async fetchAccountStakingPayout(hash, address, depth, era, unclaimedOnly, currentEra) {
18
18
  const { api } = this;
19
+ const historicApi = await api.at(hash);
19
20
  const [{ number }, historyDepth] = await Promise.all([
20
21
  api.rpc.chain.getHeader(hash),
21
- api.query.staking.historyDepth.at(hash),
22
+ historicApi.query.staking.historyDepth(),
22
23
  ]);
23
24
  // Information is kept for eras in `[current_era - history_depth; current_era]`
24
25
  if (depth > historyDepth.toNumber()) {
@@ -37,9 +38,9 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
37
38
  // User friendly - we don't error if the user specified era & depth combo <= 0, instead just start at 0
38
39
  const startEra = Math.max(0, era - (depth - 1));
39
40
  // Fetch general data about the era
40
- const allErasGeneral = await this.fetchAllErasGeneral(api, hash, startEra, era);
41
+ const allErasGeneral = await this.fetchAllErasGeneral(api, historicApi, startEra, era);
41
42
  // With the general data, we can now fetch the commission of each validator `address` nominates
42
- const allErasCommissions = await this.fetchAllErasCommissions(api, hash, address, startEra,
43
+ const allErasCommissions = await this.fetchAllErasCommissions(historicApi, address, startEra,
43
44
  // Create an array of `DeriveEraExposure`
44
45
  allErasGeneral.map((eraGeneral) => eraGeneral[0]));
45
46
  // Group together data by Era so we can easily associate parts that are used congruently downstream
@@ -59,7 +60,7 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
59
60
  eraRewardPoints,
60
61
  erasValidatorRewardOption,
61
62
  exposuresWithCommission,
62
- eraIndex: api.createType('EraIndex', idx + startEra),
63
+ eraIndex: historicApi.registry.createType('EraIndex', idx + startEra),
63
64
  };
64
65
  });
65
66
  return {
@@ -75,14 +76,14 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
75
76
  * @param startEra first era to get data for
76
77
  * @param era the last era to get data for
77
78
  */
78
- async fetchAllErasGeneral(api, hash, startEra, era) {
79
+ async fetchAllErasGeneral(api, historicApi, startEra, era) {
79
80
  const allDeriveQuerys = [];
80
81
  for (let e = startEra; e <= era; e += 1) {
81
- const eraIndex = api.createType('EraIndex', e);
82
+ const eraIndex = historicApi.registry.createType('EraIndex', e);
82
83
  const eraGeneralTuple = Promise.all([
83
84
  api.derive.staking.eraExposure(eraIndex),
84
- api.query.staking.erasRewardPoints.at(hash, eraIndex),
85
- api.query.staking.erasValidatorReward.at(hash, eraIndex),
85
+ historicApi.query.staking.erasRewardPoints(eraIndex),
86
+ historicApi.query.staking.erasValidatorReward(eraIndex),
86
87
  ]);
87
88
  allDeriveQuerys.push(eraGeneralTuple);
88
89
  }
@@ -97,7 +98,7 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
97
98
  * @param startEra first era to get data for
98
99
  * @param deriveErasExposures exposures per era for `address`
99
100
  */
100
- fetchAllErasCommissions(api, hash, address, startEra, deriveErasExposures) {
101
+ fetchAllErasCommissions(historicApi, address, startEra, deriveErasExposures) {
101
102
  // Cache StakingLedger to reduce redundant queries to node
102
103
  const validatorLedgerCache = {};
103
104
  const allErasCommissions = deriveErasExposures.map((deriveEraExposure, idx) => {
@@ -106,7 +107,7 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
106
107
  if (!nominatedExposures) {
107
108
  return [];
108
109
  }
109
- const singleEraCommissions = nominatedExposures.map(({ validatorId }) => this.fetchCommissionAndLedger(api, validatorId, currEra, hash, validatorLedgerCache));
110
+ const singleEraCommissions = nominatedExposures.map(({ validatorId }) => this.fetchCommissionAndLedger(historicApi, validatorId, currEra, validatorLedgerCache));
110
111
  return Promise.all(singleEraCommissions);
111
112
  });
112
113
  return Promise.all(allErasCommissions);
@@ -181,18 +182,18 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
181
182
  * @param hash `BlockHash` to make call at
182
183
  * @param validatorLedgerCache object mapping validatorId => StakingLedger to limit redundant queries
183
184
  */
184
- async fetchCommissionAndLedger(api, validatorId, era, hash, validatorLedgerCache) {
185
+ async fetchCommissionAndLedger(historicApi, validatorId, era, validatorLedgerCache) {
185
186
  let commission;
186
187
  let validatorLedger;
187
188
  if (validatorId in validatorLedgerCache) {
188
189
  validatorLedger = validatorLedgerCache[validatorId];
189
- const prefs = await api.query.staking.erasValidatorPrefs(era, validatorId);
190
+ const prefs = await historicApi.query.staking.erasValidatorPrefs(era, validatorId);
190
191
  commission = prefs.commission.unwrap();
191
192
  }
192
193
  else {
193
194
  const [prefs, validatorControllerOption] = await Promise.all([
194
- api.query.staking.erasValidatorPrefs.at(hash, era, validatorId),
195
- api.query.staking.bonded.at(hash, validatorId),
195
+ historicApi.query.staking.erasValidatorPrefs(era, validatorId),
196
+ historicApi.query.staking.bonded(validatorId),
196
197
  ]);
197
198
  commission = prefs.commission.unwrap();
198
199
  if (validatorControllerOption.isNone) {
@@ -200,7 +201,7 @@ class AccountsStakingPayoutsService extends AbstractService_1.AbstractService {
200
201
  commission,
201
202
  };
202
203
  }
203
- const validatorLedgerOption = await api.query.staking.ledger.at(hash, validatorControllerOption.unwrap());
204
+ const validatorLedgerOption = await historicApi.query.staking.ledger(validatorControllerOption.unwrap());
204
205
  if (validatorLedgerOption.isNone) {
205
206
  return {
206
207
  commission,
@@ -1 +1 @@
1
- {"version":3,"file":"AccountsStakingPayoutsService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsStakingPayoutsService.ts"],"names":[],"mappings":";;;AAcA,0CAA6C;AAC7C,6CAAyC;AAOzC,wDAAqD;AA6BrD,MAAa,6BAA8B,SAAQ,iCAAe;IACjE;;;;;;;;OAQG;IACH,KAAK,CAAC,yBAAyB,CAC9B,IAAe,EACf,OAAe,EACf,KAAa,EACb,GAAW,EACX,aAAsB,EACtB,UAAkB;QAElB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAErB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACpD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;YAC7B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC;SACvC,CAAC,CAAC;QAEH,+EAA+E;QAC/E,IAAI,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE;YACpC,MAAM,IAAI,wBAAU,CAAC,8CAA8C,CAAC,CAAC;SACrE;QACD,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,UAAU,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE;YAC7D,gFAAgF;YAChF,mFAAmF;YACnF,MAAM,IAAI,wBAAU,CACnB,iEAA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E;YAC1C,iEAAiE;YACjE,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAAC;gBAC9C,WAAW,EAAE,OAAO;gBACpB,gEAAgE;gBAChE,cAAc,EAAE,IAAI;aACpB,CAAC,CAAC;SACH;QAED,OAAO,kBAAkB,CAAC;IAC3B,CAAC;CACD;AA5aD,sEA4aC"}
1
+ {"version":3,"file":"AccountsStakingPayoutsService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsStakingPayoutsService.ts"],"names":[],"mappings":";;;AAeA,0CAA6C;AAC7C,6CAAyC;AAOzC,wDAAqD;AAiCrD,MAAa,6BAA8B,SAAQ,iCAAe;IACjE;;;;;;;;OAQG;IACH,KAAK,CAAC,yBAAyB,CAC9B,IAAe,EACf,OAAe,EACf,KAAa,EACb,GAAW,EACX,aAAsB,EACtB,UAAkB;QAElB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACrB,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEvC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACpD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;YAC7B,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE;SACxC,CAAC,CAAC;QAEH,+EAA+E;QAC/E,IAAI,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE;YACpC,MAAM,IAAI,wBAAU,CAAC,8CAA8C,CAAC,CAAC;SACrE;QACD,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,UAAU,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE;YAC7D,gFAAgF;YAChF,mFAAmF;YACnF,MAAM,IAAI,wBAAU,CACnB,iEAAiE;gBAChE,+CAA+C,CAChD,CAAC;SACF;QAED,MAAM,EAAE,GAAG;YACV,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D;AAxaD,sEAwaC"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const http_errors_1 = require("http-errors");
7
+ const sanitizeNumbers_1 = require("../../sanitize/sanitizeNumbers");
8
+ const registries_1 = require("../../test-helpers/registries");
9
+ const mock_1 = require("../test-helpers/mock");
10
+ const accounts_1 = require("../test-helpers/mock/accounts");
11
+ const stakingPayout_json_1 = __importDefault(require("../test-helpers/responses/accounts/stakingPayout.json"));
12
+ const AccountsStakingPayoutsService_1 = require("./AccountsStakingPayoutsService");
13
+ /**
14
+ * Addresses and data below were taken from era 533 around block ~7,760,000,
15
+ * on runtime v9122 Polkadot.
16
+ *
17
+ * The real world data has been reduced to fit the unit tests and act as mock data.
18
+ * This test suite also uses polkadotRegistryV9122
19
+ */
20
+ /**
21
+ * Acts as a placeholder variable for some tests where the era isn't an instrumental
22
+ * factor to the test logic.
23
+ */
24
+ const era = registries_1.polkadotRegistryV9122.createType('EraIndex', 532);
25
+ const historyDepthAt = () => Promise.resolve().then(() => {
26
+ return registries_1.polkadotRegistryV9122.createType('u32', 84);
27
+ });
28
+ const erasRewardPointsAt = (_eraIndex) => Promise.resolve().then(() => {
29
+ return registries_1.polkadotRegistryV9122.createType('PalletStakingEraRewardPoints', accounts_1.mockEraRewardPoints);
30
+ });
31
+ const erasValidatorRewardAt = (_eraIndex) => Promise.resolve().then(() => {
32
+ return registries_1.polkadotRegistryV9122.createType('Option<BalanceOf>', 2426740332127971);
33
+ });
34
+ const erasValidatorPrefsAt = (_era, _validatorId) => Promise.resolve().then(() => {
35
+ return registries_1.polkadotRegistryV9122.createType('PalletStakingValidatorPrefs', {
36
+ commission: 10000000,
37
+ blocked: false,
38
+ });
39
+ });
40
+ const bondedAt = (_validatorId) => Promise.resolve().then(() => {
41
+ return registries_1.polkadotRegistryV9122.createType('Option<AccountId32>', '1ZMbuCR3QiatxRsQdNnJYgydn3CWV4PELcTzpH4TNoNjxno');
42
+ });
43
+ const ledgerAt = (_validatorId) => Promise.resolve().then(() => {
44
+ return registries_1.polkadotRegistryV9122.createType('Option<PalletStakingStakingLedger>', accounts_1.mockLedger);
45
+ });
46
+ const deriveEraExposure = (_eraIndex) => Promise.resolve().then(() => {
47
+ return {
48
+ era,
49
+ nominators: accounts_1.mockDeriveNominatedExposure,
50
+ validators: accounts_1.mockDeriveValidatorExposure,
51
+ };
52
+ });
53
+ const mockHistoricApi = {
54
+ registry: registries_1.polkadotRegistryV9122,
55
+ query: {
56
+ staking: {
57
+ ledger: ledgerAt,
58
+ erasRewardPoints: erasRewardPointsAt,
59
+ erasValidatorReward: erasValidatorRewardAt,
60
+ historyDepth: historyDepthAt,
61
+ erasValidatorPrefs: erasValidatorPrefsAt,
62
+ bonded: bondedAt,
63
+ },
64
+ },
65
+ };
66
+ const mockApi = {
67
+ ...mock_1.defaultMockApi,
68
+ derive: {
69
+ staking: {
70
+ eraExposure: deriveEraExposure,
71
+ },
72
+ },
73
+ at: (_hash) => mockHistoricApi,
74
+ };
75
+ const stakingPayoutsService = new AccountsStakingPayoutsService_1.AccountsStakingPayoutsService(mockApi);
76
+ describe('AccountsStakingPayoutsService', () => {
77
+ /**
78
+ * These are the two addresses we test the validator and nominator cases on.
79
+ */
80
+ const nominator = '15j4dg5GzsL1bw2U2AWgeyAk6QTxq43V7ZPbXdAmbVLjvDCK';
81
+ const validator = '12JZr1HgK8w6zsbBj6oAEVRkvisn8j3MrkXugqtvc4E8uwLo';
82
+ const blockHash = registries_1.polkadotRegistryV9122.createType('BlockHash', '0x7b713de604a99857f6c25eacc115a4f28d2611a23d9ddff99ab0e4f1c17a8578');
83
+ let derivedExposure;
84
+ beforeAll(async () => {
85
+ derivedExposure = await deriveEraExposure(era);
86
+ });
87
+ describe('Correct succesfull responses', () => {
88
+ it('Should work when ApiPromise works', async () => {
89
+ const res = await stakingPayoutsService.fetchAccountStakingPayout(blockHash, nominator, 1, 533, true, 534);
90
+ expect((0, sanitizeNumbers_1.sanitizeNumbers)(res)).toStrictEqual(stakingPayout_json_1.default);
91
+ });
92
+ it('Should work when unclaimed is false', async () => {
93
+ const res = await stakingPayoutsService.fetchAccountStakingPayout(blockHash, nominator, 1, 533, false, 534);
94
+ expect((0, sanitizeNumbers_1.sanitizeNumbers)(res)).toStrictEqual(stakingPayout_json_1.default);
95
+ });
96
+ it('Should return the correct era rewards for `extractTotalValidatorRewardPoints`', async () => {
97
+ const rewards = await erasRewardPointsAt(era);
98
+ const res = stakingPayoutsService['extractTotalValidatorRewardPoints'](rewards, validator);
99
+ expect((0, sanitizeNumbers_1.sanitizeNumbers)(res)).toBe('3360');
100
+ });
101
+ it('`extractExposure` should return the correct value when the address is a nominator', () => {
102
+ const res = stakingPayoutsService['extractExposure'](nominator, validator, derivedExposure);
103
+ expect((0, sanitizeNumbers_1.sanitizeNumbers)(res)).toStrictEqual({
104
+ nominatorExposure: '33223051661066608',
105
+ totalExposure: '33223251661066608',
106
+ });
107
+ });
108
+ it('`extractExposure` should return the correct value when the address is a validator', () => {
109
+ const res = stakingPayoutsService['extractExposure'](validator, validator, derivedExposure);
110
+ expect((0, sanitizeNumbers_1.sanitizeNumbers)(res)).toStrictEqual({
111
+ nominatorExposure: '200000000000',
112
+ totalExposure: '33223251661066608',
113
+ });
114
+ });
115
+ it('`deriveNominatedExposures` should return the correct value when address is a validator', () => {
116
+ const res = stakingPayoutsService['deriveNominatedExposures']('12JZr1HgK8w6zsbBj6oAEVRkvisn8j3MrkXugqtvc4E8uwLo', derivedExposure);
117
+ const expectedResult = [
118
+ {
119
+ validatorId: '1HDgY7vpDjafR5NM8dbwm1b3Rrs4zATuSCHHbe7YgpKUKFw',
120
+ validatorIndex: '0',
121
+ },
122
+ {
123
+ validatorId: '12JZr1HgK8w6zsbBj6oAEVRkvisn8j3MrkXugqtvc4E8uwLo',
124
+ validatorIndex: '9999',
125
+ },
126
+ ];
127
+ expect((0, sanitizeNumbers_1.sanitizeNumbers)(res)).toStrictEqual(expectedResult);
128
+ });
129
+ it('`deriveNominatedExposures` should return the correct value when the address is a nominator', () => {
130
+ const res = stakingPayoutsService['deriveNominatedExposures'](nominator, derivedExposure);
131
+ expect((0, sanitizeNumbers_1.sanitizeNumbers)(res)).toStrictEqual(accounts_1.mockDeriveNominatedExposure[nominator]);
132
+ });
133
+ });
134
+ describe('Correct errors', () => {
135
+ it('Should throw an error when the depth is greater than the historyDepth', () => {
136
+ const serviceCall = async () => {
137
+ await stakingPayoutsService.fetchAccountStakingPayout(blockHash, nominator, 85, 533, true, 534);
138
+ };
139
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
140
+ expect(serviceCall()).rejects.toThrow(new http_errors_1.BadRequest('Must specify a depth less than history_depth'));
141
+ });
142
+ it('Should throw an error inputted era and historydepth is invalid', () => {
143
+ const serviceCall = async () => {
144
+ await stakingPayoutsService.fetchAccountStakingPayout(blockHash, nominator, 1, 400, true, 534);
145
+ };
146
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
147
+ expect(serviceCall()).rejects.toThrow(new http_errors_1.BadRequest('Must specify era and depth such that era - (depth - 1) is less ' +
148
+ 'than or equal to current_era - history_depth.'));
149
+ });
150
+ });
151
+ });
152
+ //# sourceMappingURL=AccountsStakingPayoutsService.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountsStakingPayoutsService.spec.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsStakingPayoutsService.spec.ts"],"names":[],"mappings":";;;;;AAgBA,6CAAyC;AAEzC,oEAAiE;AACjE,8DAAsE;AACtE,+CAAsD;AACtD,4DAKuC;AACvC,+GAA2F;AAC3F,mFAAgF;AAEhF;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,GAAG,GAAG,kCAAqB,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAE9D,MAAM,cAAc,GAAG,GAAiB,EA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;YACH,CAAC,CAAC;YAEF,mEAAmE;YACnE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CACpC,IAAI,wBAAU,CAAC,8CAA8C,CAAC,CAC9D,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;YACzE,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;gBAC9B,MAAM,qBAAqB,CAAC,yBAAyB,CACpD,SAAS,EACT,SAAS,EACT,CAAC,EACD,GAAG,EACH,IAAI,EACJ,GAAG,CACH,CAAC;YACH,CAAC,CAAC;YAEF,mEAAmE;YACnE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CACpC,IAAI,wBAAU,CACb,iEAAiE;gBAChE,+CAA+C,CAChD,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const mockDeriveNominatedExposure: {
2
+ '15j4dg5GzsL1bw2U2AWgeyAk6QTxq43V7ZPbXdAmbVLjvDCK': {
3
+ validatorId: string;
4
+ validatorIndex: string;
5
+ }[];
6
+ '12JZr1HgK8w6zsbBj6oAEVRkvisn8j3MrkXugqtvc4E8uwLo': {
7
+ validatorId: string;
8
+ validatorIndex: string;
9
+ }[];
10
+ };