@aptos-labs/script-composer-pack 0.0.10-beta.4 → 0.1.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/cjs/main.js +472 -854
- package/dist/esm/main.mjs +454 -805
- package/dist/main.d.mts +7 -93
- package/dist/main.d.ts +7 -93
- package/main.mts +7 -15
- package/package.json +15 -10
- package/tsconfig.json +11 -11
- package/tsup.config.ts +65 -62
package/dist/main.d.mts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Wrapper to decompile script in its serialized form and wrap it with wasm errors.
|
|
5
5
|
*/
|
|
6
6
|
declare function generate_batched_call_payload_wasm(script: Uint8Array): MoveFunctionCall[];
|
|
7
|
-
type ReadableStreamReaderMode = "byob";
|
|
8
7
|
declare class AllocatedLocal {
|
|
9
8
|
private constructor();
|
|
10
9
|
free(): void;
|
|
@@ -25,28 +24,6 @@ declare class CallArgument {
|
|
|
25
24
|
borrowMut(): CallArgument;
|
|
26
25
|
copy(): CallArgument;
|
|
27
26
|
}
|
|
28
|
-
declare class IntoUnderlyingByteSource {
|
|
29
|
-
private constructor();
|
|
30
|
-
free(): void;
|
|
31
|
-
start(controller: any): void;
|
|
32
|
-
pull(controller: any): Promise<any>;
|
|
33
|
-
cancel(): void;
|
|
34
|
-
readonly type: string;
|
|
35
|
-
readonly autoAllocateChunkSize: number;
|
|
36
|
-
}
|
|
37
|
-
declare class IntoUnderlyingSink {
|
|
38
|
-
private constructor();
|
|
39
|
-
free(): void;
|
|
40
|
-
write(chunk: any): Promise<any>;
|
|
41
|
-
close(): Promise<any>;
|
|
42
|
-
abort(reason: any): Promise<any>;
|
|
43
|
-
}
|
|
44
|
-
declare class IntoUnderlyingSource {
|
|
45
|
-
private constructor();
|
|
46
|
-
free(): void;
|
|
47
|
-
pull(controller: any): Promise<any>;
|
|
48
|
-
cancel(): void;
|
|
49
|
-
}
|
|
50
27
|
/**
|
|
51
28
|
* Calling a Move function.
|
|
52
29
|
*
|
|
@@ -57,17 +34,6 @@ declare class MoveFunctionCall {
|
|
|
57
34
|
private constructor();
|
|
58
35
|
free(): void;
|
|
59
36
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
|
|
62
|
-
*/
|
|
63
|
-
declare class PipeOptions {
|
|
64
|
-
private constructor();
|
|
65
|
-
free(): void;
|
|
66
|
-
readonly preventClose: boolean;
|
|
67
|
-
readonly preventCancel: boolean;
|
|
68
|
-
readonly preventAbort: boolean;
|
|
69
|
-
readonly signal: AbortSignal | undefined;
|
|
70
|
-
}
|
|
71
37
|
/**
|
|
72
38
|
* Representing a returned value from a previous list of `MoveFunctionCall`s.
|
|
73
39
|
*/
|
|
@@ -75,19 +41,6 @@ declare class PreviousResult {
|
|
|
75
41
|
private constructor();
|
|
76
42
|
free(): void;
|
|
77
43
|
}
|
|
78
|
-
declare class QueuingStrategy {
|
|
79
|
-
private constructor();
|
|
80
|
-
free(): void;
|
|
81
|
-
readonly highWaterMark: number;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
|
|
85
|
-
*/
|
|
86
|
-
declare class ReadableStreamGetReaderOptions {
|
|
87
|
-
private constructor();
|
|
88
|
-
free(): void;
|
|
89
|
-
readonly mode: ReadableStreamReaderMode;
|
|
90
|
-
}
|
|
91
44
|
declare class TransactionComposer {
|
|
92
45
|
private constructor();
|
|
93
46
|
free(): void;
|
|
@@ -104,15 +57,7 @@ declare class TransactionComposer {
|
|
|
104
57
|
* Consume the builder and generate a serialized script with calls in the builder.
|
|
105
58
|
*/
|
|
106
59
|
generate_batched_calls(with_metadata: boolean): Uint8Array;
|
|
107
|
-
|
|
108
|
-
* Load up a module from a remote endpoint. Will need to invoke this function prior to the
|
|
109
|
-
* call.
|
|
110
|
-
*/
|
|
111
|
-
load_module(api_url: string, api_key: string, module_name: string): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* Load up the dependency modules of a TypeTag from a remote endpoint.
|
|
114
|
-
*/
|
|
115
|
-
load_type_tag(api_url: string, api_key: string, type_tag: string): Promise<void>;
|
|
60
|
+
store_module(module_bytes: Uint8Array): string;
|
|
116
61
|
/**
|
|
117
62
|
* This would be the core api for the `TransactionComposer`. The function would:
|
|
118
63
|
* - add the function call to the builder
|
|
@@ -136,8 +81,7 @@ interface InitOutput {
|
|
|
136
81
|
readonly transactioncomposer_single_signer: () => number;
|
|
137
82
|
readonly transactioncomposer_multi_signer: (a: number) => number;
|
|
138
83
|
readonly transactioncomposer_generate_batched_calls: (a: number, b: number) => [number, number, number, number];
|
|
139
|
-
readonly
|
|
140
|
-
readonly transactioncomposer_load_type_tag: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
84
|
+
readonly transactioncomposer_store_module: (a: number, b: number, c: number) => [number, number, number, number];
|
|
141
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];
|
|
142
86
|
readonly __wbg_callargument_free: (a: number, b: number) => void;
|
|
143
87
|
readonly callargument_newBytes: (a: number, b: number) => number;
|
|
@@ -145,42 +89,16 @@ interface InitOutput {
|
|
|
145
89
|
readonly callargument_borrow: (a: number) => [number, number, number];
|
|
146
90
|
readonly callargument_borrowMut: (a: number) => [number, number, number];
|
|
147
91
|
readonly callargument_copy: (a: number) => [number, number, number];
|
|
92
|
+
readonly generate_batched_call_payload_wasm: (a: number, b: number) => [number, number, number, number];
|
|
148
93
|
readonly __wbg_previousresult_free: (a: number, b: number) => void;
|
|
149
94
|
readonly __wbg_movefunctioncall_free: (a: number, b: number) => void;
|
|
150
|
-
readonly
|
|
151
|
-
readonly __wbg_queuingstrategy_free: (a: number, b: number) => void;
|
|
152
|
-
readonly queuingstrategy_highWaterMark: (a: number) => number;
|
|
153
|
-
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
154
|
-
readonly intounderlyingsink_write: (a: number, b: any) => any;
|
|
155
|
-
readonly intounderlyingsink_close: (a: number) => any;
|
|
156
|
-
readonly intounderlyingsink_abort: (a: number, b: any) => any;
|
|
157
|
-
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
158
|
-
readonly intounderlyingbytesource_type: (a: number) => [number, number];
|
|
159
|
-
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
160
|
-
readonly intounderlyingbytesource_start: (a: number, b: any) => void;
|
|
161
|
-
readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
|
|
162
|
-
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
163
|
-
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
164
|
-
readonly intounderlyingsource_pull: (a: number, b: any) => any;
|
|
165
|
-
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
166
|
-
readonly __wbg_readablestreamgetreaderoptions_free: (a: number, b: number) => void;
|
|
167
|
-
readonly readablestreamgetreaderoptions_mode: (a: number) => number;
|
|
168
|
-
readonly __wbg_pipeoptions_free: (a: number, b: number) => void;
|
|
169
|
-
readonly pipeoptions_preventClose: (a: number) => number;
|
|
170
|
-
readonly pipeoptions_preventCancel: (a: number) => number;
|
|
171
|
-
readonly pipeoptions_preventAbort: (a: number) => number;
|
|
172
|
-
readonly pipeoptions_signal: (a: number) => any;
|
|
173
|
-
readonly __wbindgen_exn_store: (a: number) => void;
|
|
174
|
-
readonly __externref_table_alloc: () => number;
|
|
175
|
-
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
95
|
+
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
176
96
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
177
97
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
178
|
-
readonly __wbindgen_export_5: WebAssembly.Table;
|
|
179
98
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
180
99
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
100
|
+
readonly __externref_table_alloc: () => number;
|
|
181
101
|
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
182
|
-
readonly closure296_externref_shim: (a: number, b: number, c: any) => void;
|
|
183
|
-
readonly closure591_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
184
102
|
readonly __wbindgen_start: () => void;
|
|
185
103
|
}
|
|
186
104
|
|
|
@@ -195,10 +113,6 @@ type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
|
195
113
|
*/
|
|
196
114
|
declare function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
197
115
|
|
|
198
|
-
declare
|
|
199
|
-
static wasm?: WebAssembly.Module;
|
|
200
|
-
static isInitialized: boolean;
|
|
201
|
-
static init(): void;
|
|
202
|
-
}
|
|
116
|
+
declare const wasmModule: WebAssembly.Module;
|
|
203
117
|
|
|
204
|
-
export { AllocatedLocal, BuilderCall, CallArgument, type InitInput, type InitOutput,
|
|
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
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Wrapper to decompile script in its serialized form and wrap it with wasm errors.
|
|
5
5
|
*/
|
|
6
6
|
declare function generate_batched_call_payload_wasm(script: Uint8Array): MoveFunctionCall[];
|
|
7
|
-
type ReadableStreamReaderMode = "byob";
|
|
8
7
|
declare class AllocatedLocal {
|
|
9
8
|
private constructor();
|
|
10
9
|
free(): void;
|
|
@@ -25,28 +24,6 @@ declare class CallArgument {
|
|
|
25
24
|
borrowMut(): CallArgument;
|
|
26
25
|
copy(): CallArgument;
|
|
27
26
|
}
|
|
28
|
-
declare class IntoUnderlyingByteSource {
|
|
29
|
-
private constructor();
|
|
30
|
-
free(): void;
|
|
31
|
-
start(controller: any): void;
|
|
32
|
-
pull(controller: any): Promise<any>;
|
|
33
|
-
cancel(): void;
|
|
34
|
-
readonly type: string;
|
|
35
|
-
readonly autoAllocateChunkSize: number;
|
|
36
|
-
}
|
|
37
|
-
declare class IntoUnderlyingSink {
|
|
38
|
-
private constructor();
|
|
39
|
-
free(): void;
|
|
40
|
-
write(chunk: any): Promise<any>;
|
|
41
|
-
close(): Promise<any>;
|
|
42
|
-
abort(reason: any): Promise<any>;
|
|
43
|
-
}
|
|
44
|
-
declare class IntoUnderlyingSource {
|
|
45
|
-
private constructor();
|
|
46
|
-
free(): void;
|
|
47
|
-
pull(controller: any): Promise<any>;
|
|
48
|
-
cancel(): void;
|
|
49
|
-
}
|
|
50
27
|
/**
|
|
51
28
|
* Calling a Move function.
|
|
52
29
|
*
|
|
@@ -57,17 +34,6 @@ declare class MoveFunctionCall {
|
|
|
57
34
|
private constructor();
|
|
58
35
|
free(): void;
|
|
59
36
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
|
|
62
|
-
*/
|
|
63
|
-
declare class PipeOptions {
|
|
64
|
-
private constructor();
|
|
65
|
-
free(): void;
|
|
66
|
-
readonly preventClose: boolean;
|
|
67
|
-
readonly preventCancel: boolean;
|
|
68
|
-
readonly preventAbort: boolean;
|
|
69
|
-
readonly signal: AbortSignal | undefined;
|
|
70
|
-
}
|
|
71
37
|
/**
|
|
72
38
|
* Representing a returned value from a previous list of `MoveFunctionCall`s.
|
|
73
39
|
*/
|
|
@@ -75,19 +41,6 @@ declare class PreviousResult {
|
|
|
75
41
|
private constructor();
|
|
76
42
|
free(): void;
|
|
77
43
|
}
|
|
78
|
-
declare class QueuingStrategy {
|
|
79
|
-
private constructor();
|
|
80
|
-
free(): void;
|
|
81
|
-
readonly highWaterMark: number;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
|
|
85
|
-
*/
|
|
86
|
-
declare class ReadableStreamGetReaderOptions {
|
|
87
|
-
private constructor();
|
|
88
|
-
free(): void;
|
|
89
|
-
readonly mode: ReadableStreamReaderMode;
|
|
90
|
-
}
|
|
91
44
|
declare class TransactionComposer {
|
|
92
45
|
private constructor();
|
|
93
46
|
free(): void;
|
|
@@ -104,15 +57,7 @@ declare class TransactionComposer {
|
|
|
104
57
|
* Consume the builder and generate a serialized script with calls in the builder.
|
|
105
58
|
*/
|
|
106
59
|
generate_batched_calls(with_metadata: boolean): Uint8Array;
|
|
107
|
-
|
|
108
|
-
* Load up a module from a remote endpoint. Will need to invoke this function prior to the
|
|
109
|
-
* call.
|
|
110
|
-
*/
|
|
111
|
-
load_module(api_url: string, api_key: string, module_name: string): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* Load up the dependency modules of a TypeTag from a remote endpoint.
|
|
114
|
-
*/
|
|
115
|
-
load_type_tag(api_url: string, api_key: string, type_tag: string): Promise<void>;
|
|
60
|
+
store_module(module_bytes: Uint8Array): string;
|
|
116
61
|
/**
|
|
117
62
|
* This would be the core api for the `TransactionComposer`. The function would:
|
|
118
63
|
* - add the function call to the builder
|
|
@@ -136,8 +81,7 @@ interface InitOutput {
|
|
|
136
81
|
readonly transactioncomposer_single_signer: () => number;
|
|
137
82
|
readonly transactioncomposer_multi_signer: (a: number) => number;
|
|
138
83
|
readonly transactioncomposer_generate_batched_calls: (a: number, b: number) => [number, number, number, number];
|
|
139
|
-
readonly
|
|
140
|
-
readonly transactioncomposer_load_type_tag: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
84
|
+
readonly transactioncomposer_store_module: (a: number, b: number, c: number) => [number, number, number, number];
|
|
141
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];
|
|
142
86
|
readonly __wbg_callargument_free: (a: number, b: number) => void;
|
|
143
87
|
readonly callargument_newBytes: (a: number, b: number) => number;
|
|
@@ -145,42 +89,16 @@ interface InitOutput {
|
|
|
145
89
|
readonly callargument_borrow: (a: number) => [number, number, number];
|
|
146
90
|
readonly callargument_borrowMut: (a: number) => [number, number, number];
|
|
147
91
|
readonly callargument_copy: (a: number) => [number, number, number];
|
|
92
|
+
readonly generate_batched_call_payload_wasm: (a: number, b: number) => [number, number, number, number];
|
|
148
93
|
readonly __wbg_previousresult_free: (a: number, b: number) => void;
|
|
149
94
|
readonly __wbg_movefunctioncall_free: (a: number, b: number) => void;
|
|
150
|
-
readonly
|
|
151
|
-
readonly __wbg_queuingstrategy_free: (a: number, b: number) => void;
|
|
152
|
-
readonly queuingstrategy_highWaterMark: (a: number) => number;
|
|
153
|
-
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
154
|
-
readonly intounderlyingsink_write: (a: number, b: any) => any;
|
|
155
|
-
readonly intounderlyingsink_close: (a: number) => any;
|
|
156
|
-
readonly intounderlyingsink_abort: (a: number, b: any) => any;
|
|
157
|
-
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
158
|
-
readonly intounderlyingbytesource_type: (a: number) => [number, number];
|
|
159
|
-
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
160
|
-
readonly intounderlyingbytesource_start: (a: number, b: any) => void;
|
|
161
|
-
readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
|
|
162
|
-
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
163
|
-
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
164
|
-
readonly intounderlyingsource_pull: (a: number, b: any) => any;
|
|
165
|
-
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
166
|
-
readonly __wbg_readablestreamgetreaderoptions_free: (a: number, b: number) => void;
|
|
167
|
-
readonly readablestreamgetreaderoptions_mode: (a: number) => number;
|
|
168
|
-
readonly __wbg_pipeoptions_free: (a: number, b: number) => void;
|
|
169
|
-
readonly pipeoptions_preventClose: (a: number) => number;
|
|
170
|
-
readonly pipeoptions_preventCancel: (a: number) => number;
|
|
171
|
-
readonly pipeoptions_preventAbort: (a: number) => number;
|
|
172
|
-
readonly pipeoptions_signal: (a: number) => any;
|
|
173
|
-
readonly __wbindgen_exn_store: (a: number) => void;
|
|
174
|
-
readonly __externref_table_alloc: () => number;
|
|
175
|
-
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
95
|
+
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
176
96
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
177
97
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
178
|
-
readonly __wbindgen_export_5: WebAssembly.Table;
|
|
179
98
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
180
99
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
100
|
+
readonly __externref_table_alloc: () => number;
|
|
181
101
|
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
182
|
-
readonly closure296_externref_shim: (a: number, b: number, c: any) => void;
|
|
183
|
-
readonly closure591_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
184
102
|
readonly __wbindgen_start: () => void;
|
|
185
103
|
}
|
|
186
104
|
|
|
@@ -195,10 +113,6 @@ type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
|
195
113
|
*/
|
|
196
114
|
declare function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
197
115
|
|
|
198
|
-
declare
|
|
199
|
-
static wasm?: WebAssembly.Module;
|
|
200
|
-
static isInitialized: boolean;
|
|
201
|
-
static init(): void;
|
|
202
|
-
}
|
|
116
|
+
declare const wasmModule: WebAssembly.Module;
|
|
203
117
|
|
|
204
|
-
export { AllocatedLocal, BuilderCall, CallArgument, type InitInput, type InitOutput,
|
|
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
|
-
// @ts-ignore
|
|
2
|
-
import * as
|
|
3
|
-
export * from "./node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
}
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as wasm from './node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer_bg.wasm';
|
|
3
|
+
export * from "./node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer.js";
|
|
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
|
|
7
|
+
"version": "0.1.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": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
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.
|
|
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
|
-
"
|
|
47
|
-
"@aptos-labs/
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@aptos-labs/ts-sdk": "<4.0.0",
|
|
51
|
+
"@aptos-labs/aptos-dynamic-transaction-composer": "0.1.4-0"
|
|
48
52
|
},
|
|
49
53
|
"scripts": {
|
|
50
|
-
"build": "
|
|
54
|
+
"build": "npx tsup",
|
|
55
|
+
"prepublish": "pnpm build"
|
|
51
56
|
}
|
|
52
57
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2020",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "nodenext",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"forceConsistentCasingInFileNames": true,
|
|
8
|
-
"strict": true,
|
|
9
|
-
"skipLibCheck": true
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2020",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true
|
|
10
|
+
}
|
|
11
|
+
}
|
package/tsup.config.ts
CHANGED
|
@@ -1,63 +1,66 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup'
|
|
2
|
-
import { Plugin } from 'esbuild'
|
|
3
|
-
import fs from 'fs'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
import { Plugin } from 'esbuild'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import * as fflate from 'fflate' ;
|
|
6
|
+
import { Buffer } from "buffer";
|
|
7
|
+
export function wasmLoader():Plugin {
|
|
8
|
+
return {
|
|
9
|
+
name: 'wasm-loader',
|
|
10
|
+
setup(build) {
|
|
11
|
+
build.onLoad({ filter: /\.wasm$/ }, async (args) => {
|
|
12
|
+
const wasmPath = path.resolve(args.path);
|
|
13
|
+
const wasmBuffer = await fs.promises.readFile(wasmPath);
|
|
14
|
+
const wasm = Buffer.from(fflate.zlibSync(wasmBuffer, { level: 9 }));
|
|
15
|
+
const contents = `
|
|
16
|
+
export default "${wasm.toString('base64')}";
|
|
17
|
+
`;
|
|
18
|
+
return {
|
|
19
|
+
contents,
|
|
20
|
+
loader: 'js',
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function removeURLCodePlugin():Plugin {
|
|
27
|
+
return {
|
|
28
|
+
name: 'remove-specific-code',
|
|
29
|
+
setup(build) {
|
|
30
|
+
build.onLoad({ filter: /\.js$/ }, async (args) => {
|
|
31
|
+
|
|
32
|
+
const source = await fs.promises.readFile(args.path, 'utf8');
|
|
33
|
+
|
|
34
|
+
const regex = /if \(typeof module_or_path === 'undefined'\) {\s*module_or_path = new URL\('aptos_dynamic_transaction_composer_bg\.wasm', import\.meta\.url\);\s*}/g;
|
|
35
|
+
|
|
36
|
+
const newSource = source.replace(regex, '');
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
contents: newSource,
|
|
40
|
+
loader: 'js',
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
entry: ['main.mts'],
|
|
49
|
+
splitting: false,
|
|
50
|
+
clean: true,
|
|
51
|
+
dts: {
|
|
52
|
+
entry: 'main.mts',
|
|
53
|
+
resolve: true,
|
|
54
|
+
},
|
|
55
|
+
format: ['cjs', 'esm'],
|
|
56
|
+
treeshake: true,
|
|
57
|
+
// minify: true,
|
|
58
|
+
esbuildPlugins: [wasmLoader(), removeURLCodePlugin()],
|
|
59
|
+
esbuildOptions(options, context) {
|
|
60
|
+
if (context.format === 'cjs') {
|
|
61
|
+
options.outdir = 'dist/cjs'
|
|
62
|
+
} else if (context.format === 'esm') {
|
|
63
|
+
options.outdir = 'dist/esm'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
63
66
|
})
|