Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Commit d82fe6a

Browse files
committed
chore(sdk): formatted file
1 parent 1400f8f commit d82fe6a

7 files changed

Lines changed: 104 additions & 64 deletions

File tree

packages/sdk/src/tests/tokenGateway.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ describe("encode ISMP Message", () => {
141141
})
142142
})
143143

144-
it("should ensure wasm function loads", () => {
145-
expect(__test()).resolves.toMatchInlineSnapshot(`"{"root":"0x85835c4d5287fe023073eb733f4e4103935d61b4397f0f9d0fe627d434757fa5","proof":["0x894376e04f932deadc9ab212ac514f37b41e670be2f8002babde1faf20935461","0xf3ace1896f86f91627cc1c09eeaba2cd76d82a75be6f09b94c861524fa5e5289","0x0ffa0900c838d17341df2d00fa4832755de619e646137844700668ad544c8aae","0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","0x9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5","0xfadbd3c7f79fa2bdc4f24857709cd4a4e870623dc9e9abcdfd6e448033e35212"],"mmr_size":236,"leaf_positions":[232],"keccak_hash_calldata":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"}"`)
144+
it("should ensure wasm function loads", async () => {
145+
await expect(__test()).resolves.toMatchInlineSnapshot(
146+
`"{"root":"0x85835c4d5287fe023073eb733f4e4103935d61b4397f0f9d0fe627d434757fa5","proof":["0x894376e04f932deadc9ab212ac514f37b41e670be2f8002babde1faf20935461","0xf3ace1896f86f91627cc1c09eeaba2cd76d82a75be6f09b94c861524fa5e5289","0x0ffa0900c838d17341df2d00fa4832755de619e646137844700668ad544c8aae","0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","0x9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5","0xfadbd3c7f79fa2bdc4f24857709cd4a4e870623dc9e9abcdfd6e448033e35212"],"mmr_size":236,"leaf_positions":[232],"keccak_hash_calldata":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"}"`,
147+
)
146148
})
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
/* tslint:disable */
22
/* eslint-disable */
3-
export function generate_root_with_proof(calldata_bytes: Uint8Array, tree_size: bigint): string;
4-
export function verify_proof(root_hex: string, proof_hex: string[], mmr_size: bigint, leaf_position: bigint, calldata_bytes: Uint8Array): boolean;
3+
export function generate_root_with_proof(calldata_bytes: Uint8Array, tree_size: bigint): string
4+
export function verify_proof(
5+
root_hex: string,
6+
proof_hex: string[],
7+
mmr_size: bigint,
8+
leaf_position: bigint,
9+
calldata_bytes: Uint8Array,
10+
): boolean
511
export class KeccakMerge {
6-
private constructor();
7-
free(): void;
12+
private constructor()
13+
free(): void
814
}
Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
/* tslint:disable */
22
/* eslint-disable */
3-
export const memory: WebAssembly.Memory;
4-
export const __wbg_keccakmerge_free: (a: number, b: number) => void;
5-
export const generate_root_with_proof: (a: number, b: number, c: bigint) => [number, number, number, number];
6-
export const verify_proof: (a: number, b: number, c: number, d: number, e: bigint, f: bigint, g: number, h: number) => [number, number, number];
7-
export const __wbindgen_export_0: WebAssembly.Table;
8-
export const __wbindgen_malloc: (a: number, b: number) => number;
9-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10-
export const __externref_table_dealloc: (a: number) => void;
11-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
12-
export const __externref_table_alloc: () => number;
13-
export const __wbindgen_start: () => void;
3+
export const memory: WebAssembly.Memory
4+
export const __wbg_keccakmerge_free: (a: number, b: number) => void
5+
export const generate_root_with_proof: (a: number, b: number, c: bigint) => [number, number, number, number]
6+
export const verify_proof: (
7+
a: number,
8+
b: number,
9+
c: number,
10+
d: number,
11+
e: bigint,
12+
f: bigint,
13+
g: number,
14+
h: number,
15+
) => [number, number, number]
16+
export const __wbindgen_export_0: WebAssembly.Table
17+
export const __wbindgen_malloc: (a: number, b: number) => number
18+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number
19+
export const __externref_table_dealloc: (a: number) => void
20+
export const __wbindgen_free: (a: number, b: number, c: number) => void
21+
export const __externref_table_alloc: () => number
22+
export const __wbindgen_start: () => void
Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,62 @@
11
/* tslint:disable */
22
/* eslint-disable */
3-
export function generate_root_with_proof(calldata_bytes: Uint8Array, tree_size: bigint): string;
4-
export function verify_proof(root_hex: string, proof_hex: string[], mmr_size: bigint, leaf_position: bigint, calldata_bytes: Uint8Array): boolean;
3+
export function generate_root_with_proof(calldata_bytes: Uint8Array, tree_size: bigint): string
4+
export function verify_proof(
5+
root_hex: string,
6+
proof_hex: string[],
7+
mmr_size: bigint,
8+
leaf_position: bigint,
9+
calldata_bytes: Uint8Array,
10+
): boolean
511
export class KeccakMerge {
6-
private constructor();
7-
free(): void;
12+
private constructor()
13+
free(): void
814
}
915

10-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
16+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module
1117

1218
export interface InitOutput {
13-
readonly memory: WebAssembly.Memory;
14-
readonly __wbg_keccakmerge_free: (a: number, b: number) => void;
15-
readonly generate_root_with_proof: (a: number, b: number, c: bigint) => [number, number, number, number];
16-
readonly verify_proof: (a: number, b: number, c: number, d: number, e: bigint, f: bigint, g: number, h: number) => [number, number, number];
17-
readonly __wbindgen_export_0: WebAssembly.Table;
18-
readonly __wbindgen_malloc: (a: number, b: number) => number;
19-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
20-
readonly __externref_table_dealloc: (a: number) => void;
21-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
22-
readonly __externref_table_alloc: () => number;
23-
readonly __wbindgen_start: () => void;
19+
readonly memory: WebAssembly.Memory
20+
readonly __wbg_keccakmerge_free: (a: number, b: number) => void
21+
readonly generate_root_with_proof: (a: number, b: number, c: bigint) => [number, number, number, number]
22+
readonly verify_proof: (
23+
a: number,
24+
b: number,
25+
c: number,
26+
d: number,
27+
e: bigint,
28+
f: bigint,
29+
g: number,
30+
h: number,
31+
) => [number, number, number]
32+
readonly __wbindgen_export_0: WebAssembly.Table
33+
readonly __wbindgen_malloc: (a: number, b: number) => number
34+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number
35+
readonly __externref_table_dealloc: (a: number) => void
36+
readonly __wbindgen_free: (a: number, b: number, c: number) => void
37+
readonly __externref_table_alloc: () => number
38+
readonly __wbindgen_start: () => void
2439
}
2540

26-
export type SyncInitInput = BufferSource | WebAssembly.Module;
41+
export type SyncInitInput = BufferSource | WebAssembly.Module
2742
/**
28-
* Instantiates the given `module`, which can either be bytes or
29-
* a precompiled `WebAssembly.Module`.
30-
*
31-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
32-
*
33-
* @returns {InitOutput}
34-
*/
35-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
43+
* Instantiates the given `module`, which can either be bytes or
44+
* a precompiled `WebAssembly.Module`.
45+
*
46+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
47+
*
48+
* @returns {InitOutput}
49+
*/
50+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput
3651

3752
/**
38-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
39-
* for everything else, calls `WebAssembly.instantiate` directly.
40-
*
41-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
42-
*
43-
* @returns {Promise<InitOutput>}
44-
*/
45-
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
53+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
54+
* for everything else, calls `WebAssembly.instantiate` directly.
55+
*
56+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
57+
*
58+
* @returns {Promise<InitOutput>}
59+
*/
60+
export default function __wbg_init(
61+
module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>,
62+
): Promise<InitOutput>

packages/sdk/src/utils/ckb-mmr-wasm/dist/web/web.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@ async function __wbg_init(module_or_path) {
313313
}
314314

315315
if (typeof module_or_path === "undefined") {
316-
console.log(">>> using default module path", import.meta.url)
317-
318316
module_or_path = new URL("web_bg.wasm", import.meta.url)
319317
}
320318
const imports = __wbg_get_imports()
Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
/* tslint:disable */
22
/* eslint-disable */
3-
export const memory: WebAssembly.Memory;
4-
export const __wbg_keccakmerge_free: (a: number, b: number) => void;
5-
export const generate_root_with_proof: (a: number, b: number, c: bigint) => [number, number, number, number];
6-
export const verify_proof: (a: number, b: number, c: number, d: number, e: bigint, f: bigint, g: number, h: number) => [number, number, number];
7-
export const __wbindgen_export_0: WebAssembly.Table;
8-
export const __wbindgen_malloc: (a: number, b: number) => number;
9-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10-
export const __externref_table_dealloc: (a: number) => void;
11-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
12-
export const __externref_table_alloc: () => number;
13-
export const __wbindgen_start: () => void;
3+
export const memory: WebAssembly.Memory
4+
export const __wbg_keccakmerge_free: (a: number, b: number) => void
5+
export const generate_root_with_proof: (a: number, b: number, c: bigint) => [number, number, number, number]
6+
export const verify_proof: (
7+
a: number,
8+
b: number,
9+
c: number,
10+
d: number,
11+
e: bigint,
12+
f: bigint,
13+
g: number,
14+
h: number,
15+
) => [number, number, number]
16+
export const __wbindgen_export_0: WebAssembly.Table
17+
export const __wbindgen_malloc: (a: number, b: number) => number
18+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number
19+
export const __externref_table_dealloc: (a: number) => void
20+
export const __wbindgen_free: (a: number, b: number, c: number) => void
21+
export const __externref_table_alloc: () => number
22+
export const __wbindgen_start: () => void

packages/sdk/src/utils/mmr.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ async function ckb_mmr() {
234234
return wasm
235235
}
236236

237-
// console.log({ isTest, isNode, runtime, platform })
238237
if (isNode) {
239238
const wasm = await import("@/ckb-utils/node")
240239
return wasm

0 commit comments

Comments
 (0)