* Add @polkadot/types-support * jest config fix * typegen lookups * Build fixes * Explicit kusama naming * testMeta for v14 (local) * CI test failure * CI test failure v14 * Update with corrected data after test * types-support json imports
20 lines
633 B
TypeScript
20 lines
633 B
TypeScript
// Copyright 2017-2021 @polkadot/api authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import { ApiPromise, WsProvider } from '@polkadot/api';
|
|
import { Metadata, TypeRegistry } from '@polkadot/types';
|
|
import metaStatic from '@polkadot/types-support/metadata/static-substrate';
|
|
|
|
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;
|
|
}
|