Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update pjs deps, and fixing types #1416

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"test:test-release": "yarn build:scripts && node scripts/build/runYarnPack.js"
},
"dependencies": {
"@polkadot/api": "^10.11.3",
"@polkadot/api-contract": "^10.11.3",
"@polkadot/api": "^10.12.4",
"@polkadot/api-contract": "^10.12.4",
"@polkadot/util-crypto": "^12.6.2",
"@substrate/calc": "^0.3.1",
"argparse": "^2.0.1",
Expand Down
8 changes: 4 additions & 4 deletions src/services/accounts/AccountsStakingPayoutsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import type {
} from '@polkadot/types/interfaces';
import type {
PalletStakingEraRewardPoints,
PalletStakingExposure,
PalletStakingStakingLedger,
PalletStakingValidatorPrefs,
SpStakingExposure,
} from '@polkadot/types/lookup';
import { CalcPayout } from '@substrate/calc';
import { BadRequest } from 'http-errors';
Expand All @@ -51,7 +51,7 @@ import kusamaEarlyErasBlockInfo from './kusamaEarlyErasBlockInfo.json';
* Copyright 2024 via polkadot-js/api
* The following code was adopted by https://github.com/polkadot-js/api/blob/3bdf49b0428a62f16b3222b9a31bfefa43c1ca55/packages/api-derive/src/staking/erasExposure.ts.
*/
type KeysAndExposures = [StorageKey<[EraIndex, AccountId]>, PalletStakingExposure][];
type KeysAndExposures = [StorageKey<[EraIndex, AccountId]>, SpStakingExposure][];

/**
* General information about an era, in tuple form because we initially get it
Expand Down Expand Up @@ -571,13 +571,13 @@ export class AccountsStakingPayoutsService extends AbstractService {
validatorId.push(validator);
});

let eraExposure: PalletStakingExposure = {} as PalletStakingExposure;
let eraExposure: SpStakingExposure = {} as SpStakingExposure;

for (const validator of validatorId) {
const storageKey = {
args: [eraIndex, validator],
} as unknown as StorageKey<[EraIndex, AccountId]>;
eraExposure = (await historicApi.query.staking.stakers(validator)) as unknown as PalletStakingExposure;
eraExposure = (await historicApi.query.staking.stakers(validator)) as unknown as SpStakingExposure;
storageKeys.push([storageKey, eraExposure]);
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/services/pallets/PalletsAssetConversionService.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand All @@ -20,7 +20,7 @@ import { StorageEntryBase } from '@polkadot/api/types';
import { StorageKey } from '@polkadot/types';
import { Option } from '@polkadot/types/codec';
import type { Hash } from '@polkadot/types/interfaces';
import { XcmV3MultiLocation } from '@polkadot/types/lookup';
import type { StagingXcmV3MultiLocation } from '@polkadot/types/lookup';
import { Codec } from '@polkadot/types/types';
import type { ITuple } from '@polkadot/types-codec/types';
import { Observable } from 'rxjs';
Expand All @@ -35,16 +35,16 @@ import { PalletsAssetConversionService } from './PalletsAssetConversionService';

const assetHubWestendApi = createApiWithAugmentations(assetHubWestendMetadataRpcV9435);

type StorageEntryFunction = (arg1: [XcmV3MultiLocation, XcmV3MultiLocation]) => Observable<Codec>;
type StorageEntryFunction = (arg1: [StagingXcmV3MultiLocation, StagingXcmV3MultiLocation]) => Observable<Codec>;

function key(
multilocation: [XcmV3MultiLocation, XcmV3MultiLocation],
multilocation: [StagingXcmV3MultiLocation, StagingXcmV3MultiLocation],
storageEntry: StorageEntryBase<'promise', StorageEntryFunction>,
): StorageKey<[ITuple<[XcmV3MultiLocation, XcmV3MultiLocation]>]> {
): StorageKey<[ITuple<[StagingXcmV3MultiLocation, StagingXcmV3MultiLocation]>]> {
const native = multilocation[0];
const asset = multilocation[1];
const id: [XcmV3MultiLocation, XcmV3MultiLocation] = [native, asset];
const key: StorageKey<[ITuple<[XcmV3MultiLocation, XcmV3MultiLocation]>]> = new StorageKey(
const id: [StagingXcmV3MultiLocation, StagingXcmV3MultiLocation] = [native, asset];
const key: StorageKey<[ITuple<[StagingXcmV3MultiLocation, StagingXcmV3MultiLocation]>]> = new StorageKey(
assetHubWestendRegistryV9435,
storageEntry.key(id),
);
Expand Down
6 changes: 3 additions & 3 deletions src/services/paras/ParasService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -28,7 +28,7 @@ import {
ParaLifecycle,
WinningData,
} from '@polkadot/types/interfaces';
import { PolkadotPrimitivesV5CandidateReceipt } from '@polkadot/types/lookup';
import { PolkadotPrimitivesV6CandidateReceipt } from '@polkadot/types/lookup';
import { ITuple } from '@polkadot/types/types';
import { BN_ZERO } from '@polkadot/util';
import BN from 'bn.js';
Expand Down Expand Up @@ -410,7 +410,7 @@ export class ParasService extends AbstractService {
const paraHeaders: IParasHeaders = {};
paraInclusion.forEach(({ event }) => {
const { data } = event;
const paraData = data[0] as PolkadotPrimitivesV5CandidateReceipt;
const paraData = data[0] as PolkadotPrimitivesV6CandidateReceipt;
const headerData = data[1] as Bytes;
const { paraHead, paraId } = paraData.descriptor;
const header = api.createType('Header', headerData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand All @@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { XcmV3MultiLocation } from '@polkadot/types/lookup';
import type { StagingXcmV3MultiLocation } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types-codec/types';

import { assetHubWestendRegistryV9435 } from '../../../../test-helpers/registries/assetHubWestendRegistry';

export const reserves: ITuple<[XcmV3MultiLocation, XcmV3MultiLocation]>[] = [];
export const reserves: ITuple<[StagingXcmV3MultiLocation, StagingXcmV3MultiLocation]>[] = [];

const native = assetHubWestendRegistryV9435.createType('XcmV3MultiLocation', {
parents: '0',
Expand Down Expand Up @@ -192,5 +192,5 @@ export const assets = [

for (let i = 0; i < assets.length; i++) {
const reserve = assetHubWestendRegistryV9435.createType('XcmV3MultiLocation', assets[i]);
reserves.push([native, reserve] as unknown as ITuple<[XcmV3MultiLocation, XcmV3MultiLocation]>);
reserves.push([native, reserve] as unknown as ITuple<[StagingXcmV3MultiLocation, StagingXcmV3MultiLocation]>);
}
8 changes: 4 additions & 4 deletions src/types/responses/AccountStakingInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand All @@ -14,16 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import type { RewardDestination } from '@polkadot/types/interfaces';
import type { Option } from '@polkadot/types/codec';
import type { AccountId } from '@polkadot/types/interfaces/runtime';
import type { PalletStakingStakingLedger } from '@polkadot/types/lookup';
import type { PalletStakingRewardDestination, PalletStakingStakingLedger } from '@polkadot/types/lookup';

import { IAt } from '.';

export interface IAccountStakingInfo {
at: IAt;
controller: AccountId;
rewardDestination: RewardDestination;
rewardDestination: Option<PalletStakingRewardDestination>;
numSlashingSpans: number;
staking: PalletStakingStakingLedger;
}
12 changes: 6 additions & 6 deletions src/types/responses/PalletAssetConversion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand All @@ -15,10 +15,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { Option } from '@polkadot/types/codec';
import {
PalletAssetConversionNativeOrAssetId,
import type {
FrameSupportTokensFungibleUnionOfNativeOrWithId,
PalletAssetConversionPoolInfo,
XcmV3MultiLocation,
StagingXcmV3MultiLocation,
} from '@polkadot/types/lookup';
import { Codec } from '@polkadot/types/types';
import type { ITuple } from '@polkadot/types-codec/types';
Expand All @@ -33,8 +33,8 @@ export interface ILiquidityId {
export interface ILiquidityPoolsInfo {
reserves: ITuple<
[
PalletAssetConversionNativeOrAssetId | XcmV3MultiLocation,
PalletAssetConversionNativeOrAssetId | XcmV3MultiLocation,
FrameSupportTokensFungibleUnionOfNativeOrWithId | StagingXcmV3MultiLocation,
FrameSupportTokensFungibleUnionOfNativeOrWithId | StagingXcmV3MultiLocation,
]
>;
lpToken: Option<PalletAssetConversionPoolInfo>;
Expand Down