Control wasm initialization via initWasm: false flag (#2076)

This commit is contained in:
Jaco Greeff
2020-03-22 07:45:22 +01:00
committed by GitHub
parent b3c6a5acc5
commit 39f22ca403
2 changed files with 7 additions and 1 deletions
+3 -1
View File
@@ -217,7 +217,9 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
try {
const [hasMeta, cryptoReady] = await Promise.all([
this.loadMeta(),
cryptoWaitReady()
this._options.initWasm === false
? Promise.resolve(true)
: cryptoWaitReady()
]);
if (hasMeta && !this._isReady && cryptoReady) {
+4
View File
@@ -33,6 +33,10 @@ export interface ApiOptions extends RegisteredTypes {
* @description Add custom derives to be injected
*/
derives?: DeriveCustom;
/**
* @description Control the initialization of the wasm libraries. When not specified, it defaults to `true`, initializing the wasm libraries, set to `false` to not initialize wasm. (No sr25519 support)
*/
initWasm?: boolean;
/**
* @description pre-bundles is a map of 'genesis hash and runtime spec version' as key to a metadata hex string
* if genesis hash and runtime spec version matches, then use metadata, else fetch it from chain