-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create external modules for wasm (#37)
* feat: separated wasm into its own package * feat: added wasm-web package * fix: test config with external wasm * fix: prettier
- Loading branch information
1 parent
a091101
commit ec6f0c2
Showing
21 changed files
with
1,721 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@fedimint/fedimint-client-wasm-bundler': patch | ||
'@fedimint/core-web': patch | ||
'@fedimint/fedimint-client-wasm-web': patch | ||
--- | ||
|
||
Separated wasm dependecies into their own packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
CHANGELOG.md | ||
pnpm-lock.yaml | ||
tsconfig.base.json | ||
packages/core-web/wasm/** | ||
packages/wasm-web/** | ||
packages/wasm-bundler/** | ||
tmp/** | ||
*.html |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @fedimint/fedimint-client-wasm-bundler | ||
|
||
This package contains the WebAssembly (Wasm) output of `fedimint-client-wasm` targeting bundler environments. It is generated using `wasm-pack` and is not intended to be used directly. | ||
|
||
## Usage | ||
|
||
This package is not intended to be used directly. It serves as a build artifact for `fedimint-client-wasm` targeting bundler environments. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
packages/core-web/wasm/package.json → packages/wasm-bundler/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @fedimint/fedimint-client-wasm-web | ||
|
||
This package contains the WebAssembly (Wasm) output of `fedimint-client-wasm` targeting web environments. It is generated using `wasm-pack` and is not intended to be used directly. | ||
|
||
## Usage | ||
|
||
This package is not intended to be used directly. It serves as a build artifact for `fedimint-client-wasm` targeting web environments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
*/ | ||
export class RpcHandle { | ||
free(): void | ||
/** | ||
*/ | ||
cancel(): void | ||
} | ||
/** | ||
*/ | ||
export class WasmClient { | ||
free(): void | ||
/** | ||
* Open fedimint client with already joined federation. | ||
* | ||
* After you have joined a federation, you can reopen the fedimint client | ||
* with same client_name. Opening client with same name at same time is | ||
* not supported. You can close the current client by calling | ||
* `client.free()`. NOTE: The client will remain active until all the | ||
* running rpc calls have finished. | ||
* @param {string} client_name | ||
* @returns {Promise<WasmClient | undefined>} | ||
*/ | ||
static open(client_name: string): Promise<WasmClient | undefined> | ||
/** | ||
* Open a fedimint client by join a federation. | ||
* @param {string} client_name | ||
* @param {string} invite_code | ||
* @returns {Promise<WasmClient>} | ||
*/ | ||
static join_federation( | ||
client_name: string, | ||
invite_code: string, | ||
): Promise<WasmClient> | ||
/** | ||
* Call a fedimint client rpc the responses are returned using `cb` | ||
* callback. Each rpc call *can* return multiple responses by calling | ||
* `cb` multiple times. The returned RpcHandle can be used to cancel the | ||
* operation. | ||
* @param {string} module | ||
* @param {string} method | ||
* @param {string} payload | ||
* @param {Function} cb | ||
* @returns {RpcHandle} | ||
*/ | ||
rpc(module: string, method: string, payload: string, cb: Function): RpcHandle | ||
} | ||
|
||
export type InitInput = | ||
| RequestInfo | ||
| URL | ||
| Response | ||
| BufferSource | ||
| WebAssembly.Module | ||
|
||
export interface InitOutput { | ||
readonly memory: WebAssembly.Memory | ||
readonly __wbg_wasmclient_free: (a: number) => void | ||
readonly __wbg_rpchandle_free: (a: number) => void | ||
readonly rpchandle_cancel: (a: number) => void | ||
readonly wasmclient_open: (a: number, b: number) => number | ||
readonly wasmclient_join_federation: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
d: number, | ||
) => number | ||
readonly wasmclient_rpc: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
d: number, | ||
e: number, | ||
f: number, | ||
g: number, | ||
h: number, | ||
) => number | ||
readonly ring_core_0_17_8_bn_mul_mont: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
d: number, | ||
e: number, | ||
f: number, | ||
) => void | ||
readonly rustsecp256k1zkp_v0_8_0_default_illegal_callback_fn: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly rustsecp256k1zkp_v0_8_0_default_error_callback_fn: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly rustsecp256k1_v0_6_1_context_create: (a: number) => number | ||
readonly rustsecp256k1_v0_6_1_context_destroy: (a: number) => void | ||
readonly rustsecp256k1_v0_6_1_default_illegal_callback_fn: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly rustsecp256k1_v0_6_1_default_error_callback_fn: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly rustsecp256k1_v0_8_1_context_create: (a: number) => number | ||
readonly rustsecp256k1_v0_8_1_context_destroy: (a: number) => void | ||
readonly rustsecp256k1_v0_8_1_default_illegal_callback_fn: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly rustsecp256k1_v0_8_1_default_error_callback_fn: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly __wbindgen_malloc: (a: number, b: number) => number | ||
readonly __wbindgen_realloc: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
d: number, | ||
) => number | ||
readonly __wbindgen_export_2: WebAssembly.Table | ||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8697e16cd1c64495: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
d: number, | ||
) => void | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h31a94cc9a05d5ca0: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
) => void | ||
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4d11ec113460b95d: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__he7056307c6986185: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
d: number, | ||
) => void | ||
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h5b16159cdfa166b0: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hebf1bd391d12b3cb: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
) => void | ||
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h09ee3e3abd173580: ( | ||
a: number, | ||
b: number, | ||
) => void | ||
readonly __wbindgen_free: (a: number, b: number, c: number) => void | ||
readonly __wbindgen_exn_store: (a: number) => void | ||
readonly wasm_bindgen__convert__closures__invoke2_mut__h8bdaa9faeb7d5075: ( | ||
a: number, | ||
b: number, | ||
c: number, | ||
d: number, | ||
) => void | ||
} | ||
|
||
export type SyncInitInput = BufferSource | WebAssembly.Module | ||
/** | ||
* Instantiates the given `module`, which can either be bytes or | ||
* a precompiled `WebAssembly.Module`. | ||
* | ||
* @param {SyncInitInput} module | ||
* | ||
* @returns {InitOutput} | ||
*/ | ||
export function initSync(module: SyncInitInput): InitOutput | ||
|
||
/** | ||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | ||
* for everything else, calls `WebAssembly.instantiate` directly. | ||
* | ||
* @param {InitInput | Promise<InitInput>} module_or_path | ||
* | ||
* @returns {Promise<InitOutput>} | ||
*/ | ||
export default function __wbg_init( | ||
module_or_path?: InitInput | Promise<InitInput>, | ||
): Promise<InitOutput> |
Oops, something went wrong.