@aptos-labs/script-composer-pack 0.0.8 → 0.0.10-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.mts CHANGED
@@ -2,85 +2,28 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * Wrapper to decompile script in its serialized form and wrap it with wasm errors.
5
- * @param {Uint8Array} script
6
- * @returns {(MoveFunctionCall)[]}
7
5
  */
8
- declare function generate_batched_call_payload_wasm(script: Uint8Array): (MoveFunctionCall)[];
6
+ declare function generate_batched_call_payload_wasm(script: Uint8Array): MoveFunctionCall[];
9
7
  declare class AllocatedLocal {
8
+ private constructor();
10
9
  free(): void;
11
10
  }
12
11
  declare class BuilderCall {
12
+ private constructor();
13
13
  free(): void;
14
14
  }
15
15
  /**
16
16
  * WASM Representation of CallArgument. This is because wasm_bindgen can only support c-style enum.
17
17
  */
18
18
  declare class CallArgument {
19
+ private constructor();
19
20
  free(): void;
20
- /**
21
- * @param {Uint8Array} bytes
22
- * @returns {CallArgument}
23
- */
24
- static new_bytes(bytes: Uint8Array): CallArgument;
25
- /**
26
- * @param {number} signer_idx
27
- * @returns {CallArgument}
28
- */
29
- static new_signer(signer_idx: number): CallArgument;
30
- /**
31
- * @returns {CallArgument}
32
- */
21
+ static newBytes(bytes: Uint8Array): CallArgument;
22
+ static newSigner(signer_idx: number): CallArgument;
33
23
  borrow(): CallArgument;
34
- /**
35
- * @returns {CallArgument}
36
- */
37
- borrow_mut(): CallArgument;
38
- /**
39
- * @returns {CallArgument}
40
- */
24
+ borrowMut(): CallArgument;
41
25
  copy(): CallArgument;
42
26
  }
43
- declare class IntoUnderlyingByteSource {
44
- free(): void;
45
- /**
46
- * @param {any} controller
47
- */
48
- start(controller: any): void;
49
- /**
50
- * @param {any} controller
51
- * @returns {Promise<any>}
52
- */
53
- pull(controller: any): Promise<any>;
54
- cancel(): void;
55
- readonly autoAllocateChunkSize: number;
56
- readonly type: string;
57
- }
58
- declare class IntoUnderlyingSink {
59
- free(): void;
60
- /**
61
- * @param {any} chunk
62
- * @returns {Promise<any>}
63
- */
64
- write(chunk: any): Promise<any>;
65
- /**
66
- * @returns {Promise<any>}
67
- */
68
- close(): Promise<any>;
69
- /**
70
- * @param {any} reason
71
- * @returns {Promise<any>}
72
- */
73
- abort(reason: any): Promise<any>;
74
- }
75
- declare class IntoUnderlyingSource {
76
- free(): void;
77
- /**
78
- * @param {any} controller
79
- * @returns {Promise<any>}
80
- */
81
- pull(controller: any): Promise<any>;
82
- cancel(): void;
83
- }
84
27
  /**
85
28
  * Calling a Move function.
86
29
  *
@@ -88,70 +31,33 @@ declare class IntoUnderlyingSource {
88
31
  * which can be a return value of a previous `MoveFunctionCall`.
89
32
  */
90
33
  declare class MoveFunctionCall {
34
+ private constructor();
91
35
  free(): void;
92
36
  }
93
- /**
94
- * Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
95
- */
96
- declare class PipeOptions {
97
- free(): void;
98
- readonly preventAbort: boolean;
99
- readonly preventCancel: boolean;
100
- readonly preventClose: boolean;
101
- readonly signal: AbortSignal | undefined;
102
- }
103
37
  /**
104
38
  * Representing a returned value from a previous list of `MoveFunctionCall`s.
105
39
  */
106
40
  declare class PreviousResult {
41
+ private constructor();
107
42
  free(): void;
108
43
  }
109
- declare class QueuingStrategy {
110
- free(): void;
111
- readonly highWaterMark: number;
112
- }
113
- /**
114
- * Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
115
- */
116
- declare class ReadableStreamGetReaderOptions {
117
- free(): void;
118
- readonly mode: any;
119
- }
120
44
  declare class TransactionComposer {
45
+ private constructor();
121
46
  free(): void;
122
47
  /**
123
48
  * Create a builder with one distinct signer available. This should be the default configuration.
124
- * @returns {TransactionComposer}
125
49
  */
126
50
  static single_signer(): TransactionComposer;
127
51
  /**
128
52
  * Create a builder with one signer needed for script. This would be needed for multi-agent
129
53
  * transaction where multiple signers are present.
130
- * @param {number} signer_count
131
- * @returns {TransactionComposer}
132
54
  */
133
55
  static multi_signer(signer_count: number): TransactionComposer;
134
56
  /**
135
57
  * Consume the builder and generate a serialized script with calls in the builder.
136
- * @param {boolean} with_metadata
137
- * @returns {Uint8Array}
138
58
  */
139
59
  generate_batched_calls(with_metadata: boolean): Uint8Array;
140
- /**
141
- * Load up a module from a remote endpoint. Will need to invoke this function prior to the
142
- * call.
143
- * @param {string} api_url
144
- * @param {string} module_name
145
- * @returns {Promise<void>}
146
- */
147
- load_module(api_url: string, module_name: string): Promise<void>;
148
- /**
149
- * Load up the dependency modules of a TypeTag from a remote endpoint.
150
- * @param {string} api_url
151
- * @param {string} type_tag
152
- * @returns {Promise<void>}
153
- */
154
- load_type_tag(api_url: string, type_tag: string): Promise<void>;
60
+ store_module(module_bytes: Uint8Array): string;
155
61
  /**
156
62
  * This would be the core api for the `TransactionComposer`. The function would:
157
63
  * - add the function call to the builder
@@ -161,13 +67,8 @@ declare class TransactionComposer {
161
67
  *
162
68
  * This function would also check for the ability and type safety when passing values
163
69
  * into the function call, and will abort if there's a violation.
164
- * @param {string} module
165
- * @param {string} _function
166
- * @param {(string)[]} ty_args
167
- * @param {(CallArgument)[]} args
168
- * @returns {(CallArgument)[]}
169
70
  */
170
- add_batched_call(module: string, _function: string, ty_args: (string)[], args: (CallArgument)[]): (CallArgument)[];
71
+ add_batched_call(module: string, _function: string, ty_args: string[], args: CallArgument[]): CallArgument[];
171
72
  }
172
73
 
173
74
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -179,49 +80,26 @@ interface InitOutput {
179
80
  readonly __wbg_transactioncomposer_free: (a: number, b: number) => void;
180
81
  readonly transactioncomposer_single_signer: () => number;
181
82
  readonly transactioncomposer_multi_signer: (a: number) => number;
182
- readonly transactioncomposer_generate_batched_calls: (a: number, b: number, c: number) => void;
183
- readonly transactioncomposer_load_module: (a: number, b: number, c: number, d: number, e: number) => number;
184
- readonly transactioncomposer_load_type_tag: (a: number, b: number, c: number, d: number, e: number) => number;
185
- readonly transactioncomposer_add_batched_call: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
83
+ readonly transactioncomposer_generate_batched_calls: (a: number, b: number) => [number, number, number, number];
84
+ readonly transactioncomposer_store_module: (a: number, b: number, c: number) => [number, number, number, number];
85
+ readonly transactioncomposer_add_batched_call: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
186
86
  readonly __wbg_callargument_free: (a: number, b: number) => void;
187
- readonly callargument_new_bytes: (a: number, b: number) => number;
188
- readonly callargument_new_signer: (a: number) => number;
189
- readonly callargument_borrow: (a: number, b: number) => void;
190
- readonly callargument_borrow_mut: (a: number, b: number) => void;
191
- readonly callargument_copy: (a: number, b: number) => void;
87
+ readonly callargument_newBytes: (a: number, b: number) => number;
88
+ readonly callargument_newSigner: (a: number) => number;
89
+ readonly callargument_borrow: (a: number) => [number, number, number];
90
+ readonly callargument_borrowMut: (a: number) => [number, number, number];
91
+ readonly callargument_copy: (a: number) => [number, number, number];
92
+ readonly generate_batched_call_payload_wasm: (a: number, b: number) => [number, number, number, number];
192
93
  readonly __wbg_previousresult_free: (a: number, b: number) => void;
193
94
  readonly __wbg_movefunctioncall_free: (a: number, b: number) => void;
194
- readonly generate_batched_call_payload_wasm: (a: number, b: number, c: number) => void;
195
- readonly __wbg_readablestreamgetreaderoptions_free: (a: number, b: number) => void;
196
- readonly readablestreamgetreaderoptions_mode: (a: number) => number;
197
- readonly __wbg_pipeoptions_free: (a: number, b: number) => void;
198
- readonly pipeoptions_preventClose: (a: number) => number;
199
- readonly pipeoptions_preventCancel: (a: number) => number;
200
- readonly pipeoptions_preventAbort: (a: number) => number;
201
- readonly pipeoptions_signal: (a: number) => number;
202
- readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
203
- readonly intounderlyingsource_pull: (a: number, b: number) => number;
204
- readonly intounderlyingsource_cancel: (a: number) => void;
205
- readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
206
- readonly intounderlyingbytesource_type: (a: number, b: number) => void;
207
- readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
208
- readonly intounderlyingbytesource_start: (a: number, b: number) => void;
209
- readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
210
- readonly intounderlyingbytesource_cancel: (a: number) => void;
211
- readonly __wbg_queuingstrategy_free: (a: number, b: number) => void;
212
- readonly queuingstrategy_highWaterMark: (a: number) => number;
213
- readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
214
- readonly intounderlyingsink_write: (a: number, b: number) => number;
215
- readonly intounderlyingsink_close: (a: number) => number;
216
- readonly intounderlyingsink_abort: (a: number, b: number) => number;
95
+ readonly __wbindgen_export_0: WebAssembly.Table;
217
96
  readonly __wbindgen_malloc: (a: number, b: number) => number;
218
97
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
219
- readonly __wbindgen_export_2: WebAssembly.Table;
220
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h05d404cb64162693: (a: number, b: number, c: number) => void;
221
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
98
+ readonly __externref_table_dealloc: (a: number) => void;
222
99
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
223
- readonly __wbindgen_exn_store: (a: number) => void;
224
- readonly wasm_bindgen__convert__closures__invoke2_mut__hbdef1ea83a9567de: (a: number, b: number, c: number, d: number) => void;
100
+ readonly __externref_table_alloc: () => number;
101
+ readonly __externref_drop_slice: (a: number, b: number) => void;
102
+ readonly __wbindgen_start: () => void;
225
103
  }
226
104
 
227
105
  type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -235,10 +113,6 @@ type SyncInitInput = BufferSource | WebAssembly.Module;
235
113
  */
236
114
  declare function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
237
115
 
238
- declare class ScriptComposerWasm {
239
- static wasm?: WebAssembly.Module;
240
- static isInitialized: boolean;
241
- static init(): void;
242
- }
116
+ declare const wasmModule: WebAssembly.Module;
243
117
 
244
- export { AllocatedLocal, BuilderCall, CallArgument, type InitInput, type InitOutput, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, MoveFunctionCall, PipeOptions, PreviousResult, QueuingStrategy, ReadableStreamGetReaderOptions, ScriptComposerWasm, type SyncInitInput, TransactionComposer, generate_batched_call_payload_wasm, initSync };
118
+ export { AllocatedLocal, BuilderCall, CallArgument, type InitInput, type InitOutput, MoveFunctionCall, PreviousResult, type SyncInitInput, TransactionComposer, generate_batched_call_payload_wasm, initSync, wasmModule };
package/dist/main.d.ts CHANGED
@@ -2,85 +2,28 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * Wrapper to decompile script in its serialized form and wrap it with wasm errors.
5
- * @param {Uint8Array} script
6
- * @returns {(MoveFunctionCall)[]}
7
5
  */
8
- declare function generate_batched_call_payload_wasm(script: Uint8Array): (MoveFunctionCall)[];
6
+ declare function generate_batched_call_payload_wasm(script: Uint8Array): MoveFunctionCall[];
9
7
  declare class AllocatedLocal {
8
+ private constructor();
10
9
  free(): void;
11
10
  }
12
11
  declare class BuilderCall {
12
+ private constructor();
13
13
  free(): void;
14
14
  }
15
15
  /**
16
16
  * WASM Representation of CallArgument. This is because wasm_bindgen can only support c-style enum.
17
17
  */
18
18
  declare class CallArgument {
19
+ private constructor();
19
20
  free(): void;
20
- /**
21
- * @param {Uint8Array} bytes
22
- * @returns {CallArgument}
23
- */
24
- static new_bytes(bytes: Uint8Array): CallArgument;
25
- /**
26
- * @param {number} signer_idx
27
- * @returns {CallArgument}
28
- */
29
- static new_signer(signer_idx: number): CallArgument;
30
- /**
31
- * @returns {CallArgument}
32
- */
21
+ static newBytes(bytes: Uint8Array): CallArgument;
22
+ static newSigner(signer_idx: number): CallArgument;
33
23
  borrow(): CallArgument;
34
- /**
35
- * @returns {CallArgument}
36
- */
37
- borrow_mut(): CallArgument;
38
- /**
39
- * @returns {CallArgument}
40
- */
24
+ borrowMut(): CallArgument;
41
25
  copy(): CallArgument;
42
26
  }
43
- declare class IntoUnderlyingByteSource {
44
- free(): void;
45
- /**
46
- * @param {any} controller
47
- */
48
- start(controller: any): void;
49
- /**
50
- * @param {any} controller
51
- * @returns {Promise<any>}
52
- */
53
- pull(controller: any): Promise<any>;
54
- cancel(): void;
55
- readonly autoAllocateChunkSize: number;
56
- readonly type: string;
57
- }
58
- declare class IntoUnderlyingSink {
59
- free(): void;
60
- /**
61
- * @param {any} chunk
62
- * @returns {Promise<any>}
63
- */
64
- write(chunk: any): Promise<any>;
65
- /**
66
- * @returns {Promise<any>}
67
- */
68
- close(): Promise<any>;
69
- /**
70
- * @param {any} reason
71
- * @returns {Promise<any>}
72
- */
73
- abort(reason: any): Promise<any>;
74
- }
75
- declare class IntoUnderlyingSource {
76
- free(): void;
77
- /**
78
- * @param {any} controller
79
- * @returns {Promise<any>}
80
- */
81
- pull(controller: any): Promise<any>;
82
- cancel(): void;
83
- }
84
27
  /**
85
28
  * Calling a Move function.
86
29
  *
@@ -88,70 +31,33 @@ declare class IntoUnderlyingSource {
88
31
  * which can be a return value of a previous `MoveFunctionCall`.
89
32
  */
90
33
  declare class MoveFunctionCall {
34
+ private constructor();
91
35
  free(): void;
92
36
  }
93
- /**
94
- * Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
95
- */
96
- declare class PipeOptions {
97
- free(): void;
98
- readonly preventAbort: boolean;
99
- readonly preventCancel: boolean;
100
- readonly preventClose: boolean;
101
- readonly signal: AbortSignal | undefined;
102
- }
103
37
  /**
104
38
  * Representing a returned value from a previous list of `MoveFunctionCall`s.
105
39
  */
106
40
  declare class PreviousResult {
41
+ private constructor();
107
42
  free(): void;
108
43
  }
109
- declare class QueuingStrategy {
110
- free(): void;
111
- readonly highWaterMark: number;
112
- }
113
- /**
114
- * Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
115
- */
116
- declare class ReadableStreamGetReaderOptions {
117
- free(): void;
118
- readonly mode: any;
119
- }
120
44
  declare class TransactionComposer {
45
+ private constructor();
121
46
  free(): void;
122
47
  /**
123
48
  * Create a builder with one distinct signer available. This should be the default configuration.
124
- * @returns {TransactionComposer}
125
49
  */
126
50
  static single_signer(): TransactionComposer;
127
51
  /**
128
52
  * Create a builder with one signer needed for script. This would be needed for multi-agent
129
53
  * transaction where multiple signers are present.
130
- * @param {number} signer_count
131
- * @returns {TransactionComposer}
132
54
  */
133
55
  static multi_signer(signer_count: number): TransactionComposer;
134
56
  /**
135
57
  * Consume the builder and generate a serialized script with calls in the builder.
136
- * @param {boolean} with_metadata
137
- * @returns {Uint8Array}
138
58
  */
139
59
  generate_batched_calls(with_metadata: boolean): Uint8Array;
140
- /**
141
- * Load up a module from a remote endpoint. Will need to invoke this function prior to the
142
- * call.
143
- * @param {string} api_url
144
- * @param {string} module_name
145
- * @returns {Promise<void>}
146
- */
147
- load_module(api_url: string, module_name: string): Promise<void>;
148
- /**
149
- * Load up the dependency modules of a TypeTag from a remote endpoint.
150
- * @param {string} api_url
151
- * @param {string} type_tag
152
- * @returns {Promise<void>}
153
- */
154
- load_type_tag(api_url: string, type_tag: string): Promise<void>;
60
+ store_module(module_bytes: Uint8Array): string;
155
61
  /**
156
62
  * This would be the core api for the `TransactionComposer`. The function would:
157
63
  * - add the function call to the builder
@@ -161,13 +67,8 @@ declare class TransactionComposer {
161
67
  *
162
68
  * This function would also check for the ability and type safety when passing values
163
69
  * into the function call, and will abort if there's a violation.
164
- * @param {string} module
165
- * @param {string} _function
166
- * @param {(string)[]} ty_args
167
- * @param {(CallArgument)[]} args
168
- * @returns {(CallArgument)[]}
169
70
  */
170
- add_batched_call(module: string, _function: string, ty_args: (string)[], args: (CallArgument)[]): (CallArgument)[];
71
+ add_batched_call(module: string, _function: string, ty_args: string[], args: CallArgument[]): CallArgument[];
171
72
  }
172
73
 
173
74
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -179,49 +80,26 @@ interface InitOutput {
179
80
  readonly __wbg_transactioncomposer_free: (a: number, b: number) => void;
180
81
  readonly transactioncomposer_single_signer: () => number;
181
82
  readonly transactioncomposer_multi_signer: (a: number) => number;
182
- readonly transactioncomposer_generate_batched_calls: (a: number, b: number, c: number) => void;
183
- readonly transactioncomposer_load_module: (a: number, b: number, c: number, d: number, e: number) => number;
184
- readonly transactioncomposer_load_type_tag: (a: number, b: number, c: number, d: number, e: number) => number;
185
- readonly transactioncomposer_add_batched_call: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
83
+ readonly transactioncomposer_generate_batched_calls: (a: number, b: number) => [number, number, number, number];
84
+ readonly transactioncomposer_store_module: (a: number, b: number, c: number) => [number, number, number, number];
85
+ readonly transactioncomposer_add_batched_call: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
186
86
  readonly __wbg_callargument_free: (a: number, b: number) => void;
187
- readonly callargument_new_bytes: (a: number, b: number) => number;
188
- readonly callargument_new_signer: (a: number) => number;
189
- readonly callargument_borrow: (a: number, b: number) => void;
190
- readonly callargument_borrow_mut: (a: number, b: number) => void;
191
- readonly callargument_copy: (a: number, b: number) => void;
87
+ readonly callargument_newBytes: (a: number, b: number) => number;
88
+ readonly callargument_newSigner: (a: number) => number;
89
+ readonly callargument_borrow: (a: number) => [number, number, number];
90
+ readonly callargument_borrowMut: (a: number) => [number, number, number];
91
+ readonly callargument_copy: (a: number) => [number, number, number];
92
+ readonly generate_batched_call_payload_wasm: (a: number, b: number) => [number, number, number, number];
192
93
  readonly __wbg_previousresult_free: (a: number, b: number) => void;
193
94
  readonly __wbg_movefunctioncall_free: (a: number, b: number) => void;
194
- readonly generate_batched_call_payload_wasm: (a: number, b: number, c: number) => void;
195
- readonly __wbg_readablestreamgetreaderoptions_free: (a: number, b: number) => void;
196
- readonly readablestreamgetreaderoptions_mode: (a: number) => number;
197
- readonly __wbg_pipeoptions_free: (a: number, b: number) => void;
198
- readonly pipeoptions_preventClose: (a: number) => number;
199
- readonly pipeoptions_preventCancel: (a: number) => number;
200
- readonly pipeoptions_preventAbort: (a: number) => number;
201
- readonly pipeoptions_signal: (a: number) => number;
202
- readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
203
- readonly intounderlyingsource_pull: (a: number, b: number) => number;
204
- readonly intounderlyingsource_cancel: (a: number) => void;
205
- readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
206
- readonly intounderlyingbytesource_type: (a: number, b: number) => void;
207
- readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
208
- readonly intounderlyingbytesource_start: (a: number, b: number) => void;
209
- readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
210
- readonly intounderlyingbytesource_cancel: (a: number) => void;
211
- readonly __wbg_queuingstrategy_free: (a: number, b: number) => void;
212
- readonly queuingstrategy_highWaterMark: (a: number) => number;
213
- readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
214
- readonly intounderlyingsink_write: (a: number, b: number) => number;
215
- readonly intounderlyingsink_close: (a: number) => number;
216
- readonly intounderlyingsink_abort: (a: number, b: number) => number;
95
+ readonly __wbindgen_export_0: WebAssembly.Table;
217
96
  readonly __wbindgen_malloc: (a: number, b: number) => number;
218
97
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
219
- readonly __wbindgen_export_2: WebAssembly.Table;
220
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h05d404cb64162693: (a: number, b: number, c: number) => void;
221
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
98
+ readonly __externref_table_dealloc: (a: number) => void;
222
99
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
223
- readonly __wbindgen_exn_store: (a: number) => void;
224
- readonly wasm_bindgen__convert__closures__invoke2_mut__hbdef1ea83a9567de: (a: number, b: number, c: number, d: number) => void;
100
+ readonly __externref_table_alloc: () => number;
101
+ readonly __externref_drop_slice: (a: number, b: number) => void;
102
+ readonly __wbindgen_start: () => void;
225
103
  }
226
104
 
227
105
  type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -235,10 +113,6 @@ type SyncInitInput = BufferSource | WebAssembly.Module;
235
113
  */
236
114
  declare function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
237
115
 
238
- declare class ScriptComposerWasm {
239
- static wasm?: WebAssembly.Module;
240
- static isInitialized: boolean;
241
- static init(): void;
242
- }
116
+ declare const wasmModule: WebAssembly.Module;
243
117
 
244
- export { AllocatedLocal, BuilderCall, CallArgument, type InitInput, type InitOutput, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, MoveFunctionCall, PipeOptions, PreviousResult, QueuingStrategy, ReadableStreamGetReaderOptions, ScriptComposerWasm, type SyncInitInput, TransactionComposer, generate_batched_call_payload_wasm, initSync };
118
+ export { AllocatedLocal, BuilderCall, CallArgument, type InitInput, type InitOutput, MoveFunctionCall, PreviousResult, type SyncInitInput, TransactionComposer, generate_batched_call_payload_wasm, initSync, wasmModule };
package/main.mts CHANGED
@@ -1,15 +1,7 @@
1
1
  // @ts-ignore
2
- import * as wasmModule from './node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer_bg.wasm';
2
+ import * as wasm from './node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer_bg.wasm';
3
3
  export * from "./node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer.js";
4
- export class ScriptComposerWasm {
5
- static wasm?: WebAssembly.Module;
6
-
7
- static isInitialized = false;
8
-
9
- static init() {
10
- if (!this.isInitialized) {
11
- this.wasm = new WebAssembly.Module(new Uint8Array(wasmModule.default));
12
- this.isInitialized = true;
13
- }
14
- }
15
- }
4
+ import { unzlibSync } from "fflate/browser"
5
+ import { Buffer } from "buffer"
6
+ const wasmModule = new WebAssembly.Module(unzlibSync(Buffer.from(wasm.default, 'base64')));
7
+ export { wasmModule };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Aptos Labs <opensource@aptoslabs.com>"
5
5
  ],
6
6
  "description": "Generating Move Script from composer",
7
- "version": "0.0.8",
7
+ "version": "0.0.10-0",
8
8
  "license": "Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
@@ -24,17 +24,20 @@
24
24
  "./snippets/*"
25
25
  ],
26
26
  "devDependencies": {
27
- "@rollup/plugin-wasm": "^6.2.2",
28
- "esbuild": "^0.24.0",
29
- "tsc": "^2.0.4",
30
- "tsup": "^8.3.5",
31
- "typescript": "^5.6.3"
27
+ "@rollup/plugin-wasm": "6.2.2",
28
+ "@types/node": "^22.15.17",
29
+ "buffer": "6.0.3",
30
+ "esbuild": "0.25.4",
31
+ "fflate": "0.8.2",
32
+ "tsc": "2.0.4",
33
+ "tsup": "8.4.0",
34
+ "typescript": "5.8.3"
32
35
  },
33
36
  "exports": {
34
37
  ".": {
35
38
  "types": "./dist/main.d.ts",
36
39
  "import": {
37
- "types": "./dist/main.d.ts",
40
+ "types": "./dist/main.d.mts",
38
41
  "default": "./dist/esm/main.mjs"
39
42
  },
40
43
  "default": {
@@ -43,10 +46,12 @@
43
46
  }
44
47
  }
45
48
  },
46
- "dependencies": {
47
- "@aptos-labs/aptos-dynamic-transaction-composer": "^0.1.2"
49
+ "peerDependencies": {
50
+ "@aptos-labs/ts-sdk": "^2.0.1",
51
+ "@aptos-labs/aptos-dynamic-transaction-composer": "0.1.4-0"
48
52
  },
49
53
  "scripts": {
50
- "build": "npx tsup"
54
+ "build": "npx tsup",
55
+ "prepublish": "pnpm build"
51
56
  }
52
57
  }
package/tsup.config.ts CHANGED
@@ -2,7 +2,8 @@ import { defineConfig } from 'tsup'
2
2
  import { Plugin } from 'esbuild'
3
3
  import fs from 'fs'
4
4
  import path from 'path'
5
-
5
+ import * as fflate from 'fflate' ;
6
+ import { Buffer } from "buffer";
6
7
  export function wasmLoader():Plugin {
7
8
  return {
8
9
  name: 'wasm-loader',
@@ -10,9 +11,9 @@ export function wasmLoader():Plugin {
10
11
  build.onLoad({ filter: /\.wasm$/ }, async (args) => {
11
12
  const wasmPath = path.resolve(args.path);
12
13
  const wasmBuffer = await fs.promises.readFile(wasmPath);
14
+ const wasm = Buffer.from(fflate.zlibSync(wasmBuffer, { level: 9 }));
13
15
  const contents = `
14
- const wasm = [${new Uint8Array(wasmBuffer).toString()}];
15
- export default wasm;
16
+ export default "${wasm.toString('base64')}";
16
17
  `;
17
18
  return {
18
19
  contents,
@@ -52,6 +53,8 @@ export default defineConfig({
52
53
  resolve: true,
53
54
  },
54
55
  format: ['cjs', 'esm'],
56
+ treeshake: true,
57
+ // minify: true,
55
58
  esbuildPlugins: [wasmLoader(), removeURLCodePlugin()],
56
59
  esbuildOptions(options, context) {
57
60
  if (context.format === 'cjs') {