Skip to content

Commit

Permalink
Merge pull request #3 from LedgerHQ/fix/rebase-sidecar
Browse files Browse the repository at this point in the history
Fix/rebase sidecar
  • Loading branch information
henri-ly authored Sep 21, 2022
2 parents 6de662c + 91f1dc6 commit aaffffb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 31 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"devDependencies": {
"@substrate/dev": "^0.6.4",
"@types/argparse": "2.0.10",
"@types/cors": "^2.8.12",
"@types/express": "4.17.13",
"@types/express-serve-static-core": "4.17.30",
"@types/http-errors": "1.8.2",
Expand Down
10 changes: 2 additions & 8 deletions src/services/accounts/AccountsNominationsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ export class AccountsNominationsService extends AbstractService {
): Promise<INominations | null> {
const { api } = this;

const [
activeEraOption,
nominationsOpt,
{ number },
] = await Promise.all([
const [activeEraOption, nominationsOpt, { number }] = await Promise.all([
api.query.staking.activeEra.at(hash),
api.query.staking.nominators.at(hash, address),
api.rpc.chain.getHeader(hash),
Expand Down Expand Up @@ -68,9 +64,7 @@ export class AccountsNominationsService extends AbstractService {
const individualExposure = exposure?.others.find(
(o) => o.who.toString() === address
);
const value = individualExposure
? individualExposure.value
: null;
const value = individualExposure ? individualExposure.value : null;

const status = exposure.others.length
? individualExposure
Expand Down
25 changes: 5 additions & 20 deletions src/services/identities/IdentitiesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ export class IdentitiesService extends AbstractService {
unwrappedSuperOf,
]);

return this.extractIdentity(
identity,
unwrappedSuperOf,
parentIdentities
);
return this.extractIdentity(identity, unwrappedSuperOf, parentIdentities);
}

/**
Expand All @@ -57,9 +53,7 @@ export class IdentitiesService extends AbstractService {
const { api } = this;

const [identities, superOfOpts] = await Promise.all([
api.query.identity.identityOf.multi<Option<Registration>>(
addresses
),
api.query.identity.identityOf.multi<Option<Registration>>(addresses),
api.query.identity.superOf.multi<Option<ITuple<[AccountId, Data]>>>(
addresses
),
Expand All @@ -74,11 +68,7 @@ export class IdentitiesService extends AbstractService {
);

return identities.map((identity, index) =>
this.extractIdentity(
identity,
unwrappedSuperOfs[index],
parentIdentities
)
this.extractIdentity(identity, unwrappedSuperOfs[index], parentIdentities)
);
}

Expand All @@ -101,10 +91,7 @@ export class IdentitiesService extends AbstractService {
>(uniqAddresses);

const map = new Map<String, Option<Registration>>(
addresses.map((addr, index) => [
addr.toString(),
parentIdentities[index],
])
addresses.map((addr, index) => [addr.toString(), parentIdentities[index]])
);

return map;
Expand Down Expand Up @@ -138,9 +125,7 @@ export class IdentitiesService extends AbstractService {
const topDisplay = dataAsString(info.display);

return {
display: superOf
? dataAsString(superOf[1]) || topDisplay
: topDisplay,
display: superOf ? dataAsString(superOf[1]) || topDisplay : topDisplay,
displayParent: superOf ? topDisplay : undefined,
email: dataAsString(info.email),
image: dataAsString(info.image),
Expand Down
2 changes: 1 addition & 1 deletion src/services/runtime/RuntimeConstantsService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//import { Option, Raw } from '@polkadot/types';
import { decorateConstants } from '@polkadot/types/metadata';
import { BlockHash } from '@polkadot/types/interfaces';
import { decorateConstants } from '@polkadot/types/metadata';
import { IConstants } from 'src/types/responses';

import { AbstractService } from '../AbstractService';
Expand Down
4 changes: 2 additions & 2 deletions src/services/validators/ValidatorsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const QUERY_OPTS = {

const validatorsCache = new LRU<string, Promise<IValidator[]>>({
max: 10,
maxAge: 1000 * 60 * 60,
ttl: 1000 * 60 * 60,
});

export class ValidatorsService extends AbstractService {
Expand Down Expand Up @@ -61,7 +61,7 @@ export class ValidatorsService extends AbstractService {
validatorsCache.set(cacheKey, newValue);

// Clear failed promise from cache
newValue.catch(() => validatorsCache.del(cacheKey));
newValue.catch(() => validatorsCache.delete(cacheKey));

return newValue;
}
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,7 @@ __metadata:
"@substrate/calc": ^0.3.0
"@substrate/dev": ^0.6.4
"@types/argparse": 2.0.10
"@types/cors": ^2.8.12
"@types/express": 4.17.13
"@types/express-serve-static-core": 4.17.30
"@types/http-errors": 1.8.2
Expand Down Expand Up @@ -1417,6 +1418,13 @@ __metadata:
languageName: node
linkType: hard

"@types/cors@npm:^2.8.12":
version: 2.8.12
resolution: "@types/cors@npm:2.8.12"
checksum: 8c45f112c7d1d2d831b4b266f2e6ed33a1887a35dcbfe2a18b28370751fababb7cd045e745ef84a523c33a25932678097bf79afaa367c6cb3fa0daa7a6438257
languageName: node
linkType: hard

"@types/express-serve-static-core@npm:4.17.30, @types/express-serve-static-core@npm:^4.17.18":
version: 4.17.30
resolution: "@types/express-serve-static-core@npm:4.17.30"
Expand Down

0 comments on commit aaffffb

Please sign in to comment.