Adjust blockNumber extract (w & w/o Compact) (#5066)
* Adjust blockNumber extract (w & w/o Compact) * Adjust unused test file
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user