Files
api/packages/api-derive/test/helpers.ts
T
Jaco 32f704459f api.at(blockHash).{consts, errors, events, query} (#3710)
* api.at(blockHash).{consts, errors, events, query}

* Manual tests for apiAt

* Adjust helpers... not perfect, but best for now

* Expand decorated return

* Re-add compable injectMetadata

* CHANGELOG

* Bump jest global timeout
2021-07-02 09:30:25 +02:00

21 lines
646 B
TypeScript

// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiPromise, WsProvider } from '@polkadot/api';
import { Metadata } from '@polkadot/metadata';
import metaStatic from '@polkadot/metadata/static';
import { TypeRegistry } from '@polkadot/types';
export function createApiWithAugmentations (): ApiPromise {
const registry = new TypeRegistry();
const metadata = new Metadata(registry, metaStatic);
registry.setMetadata(metadata);
const api = new ApiPromise({ provider: new WsProvider('ws://', false), registry });
api.injectMetadata(metadata, true, registry);
return api;
}