-
Notifications
You must be signed in to change notification settings - Fork 7
/
init.ts
25 lines (21 loc) · 996 Bytes
/
init.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn } from 'https://deno.land/x/polkadot@0.2.25/wasm-bridge/types.ts';
import type { WasmCryptoInstance } from 'https://deno.land/x/polkadot@0.2.25/wasm-crypto-init/types.ts';
import { Bridge } from 'https://deno.land/x/polkadot@0.2.25/wasm-bridge/mod.ts';
import { createWasm } from 'https://deno.land/x/polkadot@0.2.25/wasm-crypto-init/mod.ts';
/**
* @name bridge
* @description
* The JS <-> WASM bridge that is in operation. For the specific package
* it is a global, i.e. all operations happens on this specific bridge
*/
export const bridge = new Bridge<WasmCryptoInstance>(createWasm);
/**
* @name initBridge
* @description
* Creates a new bridge interface with the (optional) initialization function
*/
export async function initBridge (createWasm?: InitFn<WasmCryptoInstance>): Promise<WasmCryptoInstance | null> {
return bridge.init(createWasm);
}