Adjust blockNumber extract (w & w/o Compact) (#5066)

* Adjust blockNumber extract (w & w/o Compact)

* Adjust unused test file
This commit is contained in:
Jaco
2022-07-13 16:59:39 +03:00
committed by GitHub
parent 998f88be05
commit 60384ad850
7 changed files with 31 additions and 13 deletions
@@ -0,0 +1,15 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Compact } from '@polkadot/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import { isCompact } from '@polkadot/util';
type CompatHeader = { number: Compact<BlockNumber> | BlockNumber };
export function unwrapBlockNumber (hdr: CompatHeader): BlockNumber {
return isCompact<BlockNumber>(hdr.number)
? hdr.number.unwrap()
: hdr.number;
}
+1
View File
@@ -4,6 +4,7 @@
export { drr, memo } from '@polkadot/rpc-core';
export * from './approvalFlagsToBools';
export * from './blockNumber';
export * from './cache';
export * from './cacheImpl';
export * from './first';