40 lines
955 B
TypeScript
40 lines
955 B
TypeScript
|
import {
|
||
|
AddressComponents,
|
||
|
AddressTypeConstants,
|
||
|
UpEndWasmExtensions,
|
||
|
} from ".";
|
||
|
import {
|
||
|
addr_to_components,
|
||
|
components_to_addr,
|
||
|
AddressComponents as WasmAddresComponents,
|
||
|
AddressTypeConstants as WasmAddresTypeConstants,
|
||
|
InitInput,
|
||
|
} from "@upnd/wasm-web";
|
||
|
import init_wasm from "@upnd/wasm-web";
|
||
|
|
||
|
export class UpEndWasmExtensionsWeb extends UpEndWasmExtensions {
|
||
|
private initInput: InitInput;
|
||
|
|
||
|
constructor(init: InitInput) {
|
||
|
super();
|
||
|
this.initInput = init;
|
||
|
}
|
||
|
|
||
|
protected async _init(): Promise<void> {
|
||
|
await init_wasm(this.initInput);
|
||
|
}
|
||
|
|
||
|
addr_to_components(address: string): AddressComponents {
|
||
|
return addr_to_components(address);
|
||
|
}
|
||
|
|
||
|
components_to_addr(components: AddressComponents): string {
|
||
|
const wc = new WasmAddresComponents(components.t, components.c);
|
||
|
return components_to_addr(wc);
|
||
|
}
|
||
|
|
||
|
get AddressTypeConstants(): AddressTypeConstants {
|
||
|
return new WasmAddresTypeConstants();
|
||
|
}
|
||
|
}
|