-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up verification functions in server package (#1132)
* Fix up verification functions in server package * TODO question / comment * Make blockNumber mandatory and store storage under single key * Update comments * Tests for storage * Shorten setter * add jsdom to test environment * Add some common block functions and default block time for when we're running in instant seal mode * dont require block number when sending dev events * Move test configs to individual packages * build:typechain * package-lock.json && ignore next-env.d.ts when adding licenses * Add licenses * Copy test env file to root of repo for GHA * change expected dir for .env file * Fix some more package directory stuff * add missing env files * Add missing env file * Use zod to parse local storage! * remove --if-present so that we error on missing test command * add some more missing test commands * add some more missing test commands * Remove error from message * add two more missing test commands * Add test command for procaptcha * remove duplicate command * Package lock * fix type * fix storage * Fix test config * remove old test command
- Loading branch information
Showing
24 changed files
with
296 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2021-2024 Prosopo (UK) Ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
import { ApiPromise } from '@polkadot/api/promise/Api' | ||
import { BN } from '@polkadot/util/bn' | ||
|
||
/** | ||
* Get the current block time in milliseconds | ||
*/ | ||
export const getBlockTimeMs = (api: ApiPromise): number => { | ||
const babe = api.consts.babe | ||
const blockTime = babe ? babe.expectedBlockTime : new BN(6000) | ||
return blockTime.toNumber() | ||
} | ||
|
||
/** | ||
* Get the current block number | ||
*/ | ||
export const getCurrentBlockNumber = async (api: ApiPromise): Promise<number> => { | ||
return (await api.rpc.chain.getBlock()).block.header.number.toNumber() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.