Skip to content

Commit 404d6f2

Browse files
committed
linter
1 parent 742d0f1 commit 404d6f2

File tree

2 files changed

+21
-37
lines changed

2 files changed

+21
-37
lines changed

src/services/accounts/AccountsVestingInfoService.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ export class AccountsVestingInfoService extends AbstractService {
5757
* @param address address of the account to get the vesting info of
5858
* @param includeVested whether to calculate and include vested amounts (default: false)
5959
*/
60-
async fetchAccountVestingInfo(
61-
hash: BlockHash,
62-
address: string,
63-
includeVested = false,
64-
): Promise<IAccountVestingInfo> {
60+
async fetchAccountVestingInfo(hash: BlockHash, address: string, includeVested = false): Promise<IAccountVestingInfo> {
6561
const { api } = this;
6662

6763
const historicApi = await api.at(hash);
@@ -132,10 +128,7 @@ export class AccountsVestingInfoService extends AbstractService {
132128
* Get the vesting lock amount from balances.locks.
133129
* Returns 0 if no vesting lock exists.
134130
*/
135-
private async getVestingLocked(
136-
historicApi: Awaited<ReturnType<typeof this.api.at>>,
137-
address: string,
138-
): Promise<BN> {
131+
private async getVestingLocked(historicApi: Awaited<ReturnType<typeof this.api.at>>, address: string): Promise<BN> {
139132
if (!historicApi.query.balances?.locks) {
140133
return new BN(0);
141134
}
@@ -225,8 +218,6 @@ export class AccountsVestingInfoService extends AbstractService {
225218
}
226219

227220
const rcApi = relayApis[0].api;
228-
229-
// Get the relay chain inclusion block number for this Asset Hub block
230221
const inclusionResult = await getInclusionBlockNumber(this.api, rcApi, hash, ASSET_HUB_PARA_ID);
231222

232223
if (!inclusionResult.found || inclusionResult.inclusionBlockNumber === null) {

src/util/relay/getRelayParentNumber.spec.ts

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import { ApiPromise } from '@polkadot/api';
18-
import { BlockHash } from '@polkadot/types/interfaces';
1918
import BN from 'bn.js';
2019

2120
import { polkadotRegistry } from '../../test-helpers/registries';
@@ -24,7 +23,7 @@ import { getRelayParentNumber, hasRelayParentData } from './getRelayParentNumber
2423
const mockBlockHash = polkadotRegistry.createType(
2524
'BlockHash',
2625
'0x7b713de604a99857f6c25eacc115a4f28d2611a23d9ddff99ab0e4f1c17a8578',
27-
) as BlockHash;
26+
);
2827

2928
const mockRelayParentNumber = 28500000;
3029

@@ -76,19 +75,22 @@ describe('getRelayParentNumber', () => {
7675
},
7776
};
7877

78+
const mockAt = jest.fn().mockResolvedValue(mockApiAt);
79+
const mockGetBlock = jest.fn().mockResolvedValue({
80+
block: {
81+
extrinsics: [
82+
createMockOtherExtrinsic('timestamp'),
83+
createMockSetValidationDataExtrinsic(),
84+
createMockOtherExtrinsic('transfer'),
85+
],
86+
},
87+
});
88+
7989
const mockApi = {
80-
at: jest.fn().mockResolvedValue(mockApiAt),
90+
at: mockAt,
8191
rpc: {
8292
chain: {
83-
getBlock: jest.fn().mockResolvedValue({
84-
block: {
85-
extrinsics: [
86-
createMockOtherExtrinsic('timestamp'),
87-
createMockSetValidationDataExtrinsic(),
88-
createMockOtherExtrinsic('transfer'),
89-
],
90-
},
91-
}),
93+
getBlock: mockGetBlock,
9294
},
9395
},
9496
} as unknown as ApiPromise;
@@ -97,8 +99,8 @@ describe('getRelayParentNumber', () => {
9799

98100
expect(result).toBeInstanceOf(BN);
99101
expect(result.toNumber()).toBe(mockRelayParentNumber);
100-
expect(mockApi.at).toHaveBeenCalledWith(mockBlockHash);
101-
expect(mockApi.rpc.chain.getBlock).toHaveBeenCalledWith(mockBlockHash);
102+
expect(mockAt).toHaveBeenCalledWith(mockBlockHash);
103+
expect(mockGetBlock).toHaveBeenCalledWith(mockBlockHash);
102104
});
103105

104106
it('should throw error when setValidationData extrinsic is not found', async () => {
@@ -108,10 +110,7 @@ describe('getRelayParentNumber', () => {
108110
chain: {
109111
getBlock: jest.fn().mockResolvedValue({
110112
block: {
111-
extrinsics: [
112-
createMockOtherExtrinsic('timestamp'),
113-
createMockOtherExtrinsic('transfer'),
114-
],
113+
extrinsics: [createMockOtherExtrinsic('timestamp'), createMockOtherExtrinsic('transfer')],
115114
},
116115
}),
117116
},
@@ -182,10 +181,7 @@ describe('getRelayParentNumber', () => {
182181
chain: {
183182
getBlock: jest.fn().mockResolvedValue({
184183
block: {
185-
extrinsics: [
186-
createMockOtherExtrinsic('timestamp'),
187-
createMockSetValidationDataExtrinsic(),
188-
],
184+
extrinsics: [createMockOtherExtrinsic('timestamp'), createMockSetValidationDataExtrinsic()],
189185
},
190186
}),
191187
},
@@ -203,10 +199,7 @@ describe('getRelayParentNumber', () => {
203199
chain: {
204200
getBlock: jest.fn().mockResolvedValue({
205201
block: {
206-
extrinsics: [
207-
createMockOtherExtrinsic('timestamp'),
208-
createMockOtherExtrinsic('transfer'),
209-
],
202+
extrinsics: [createMockOtherExtrinsic('timestamp'), createMockOtherExtrinsic('transfer')],
210203
},
211204
}),
212205
},

0 commit comments

Comments
 (0)