* 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
21 lines
646 B
TypeScript
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;
|
|
}
|