git.delta.rocks / unique-network / refs/commits / 76541c4e15e0

difftreelog

source

tests/src/util/playgrounds/index.ts898 Bsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import {IKeyringPair} from '@polkadot/types/types';5import config from '../../config';6import '../../interfaces/augment-api-events';7import {DevUniqueHelper, SilentLogger, SilentConsole} from './unique.dev';8910export const usingPlaygrounds = async (code: (helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair) => Promise<void>) => {11  const silentConsole = new SilentConsole();12  silentConsole.enable();1314  const helper = new DevUniqueHelper(new SilentLogger());1516  try {17    await helper.connect(config.substrateUrl);18    const ss58Format = helper.chain.getChainProperties().ss58Format;19    const privateKey = (seed: string) => helper.util.fromSeed(seed, ss58Format);20    await code(helper, privateKey);21  }22  finally {23    await helper.disconnect();24    silentConsole.disable();25  }26};