@wgb5445/aptos-intent-npm 0.0.9 → 0.0.10

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/esm/entry.js CHANGED
@@ -115,6 +115,112 @@ function getInt32Memory0() {
115
115
  return cachedInt32Memory0;
116
116
  }
117
117
 
118
+ function debugString(val) {
119
+ // primitive types
120
+ const type = typeof val;
121
+ if (type == 'number' || type == 'boolean' || val == null) {
122
+ return `${val}`;
123
+ }
124
+ if (type == 'string') {
125
+ return `"${val}"`;
126
+ }
127
+ if (type == 'symbol') {
128
+ const description = val.description;
129
+ if (description == null) {
130
+ return 'Symbol';
131
+ } else {
132
+ return `Symbol(${description})`;
133
+ }
134
+ }
135
+ if (type == 'function') {
136
+ const name = val.name;
137
+ if (typeof name == 'string' && name.length > 0) {
138
+ return `Function(${name})`;
139
+ } else {
140
+ return 'Function';
141
+ }
142
+ }
143
+ // objects
144
+ if (Array.isArray(val)) {
145
+ const length = val.length;
146
+ let debug = '[';
147
+ if (length > 0) {
148
+ debug += debugString(val[0]);
149
+ }
150
+ for(let i = 1; i < length; i++) {
151
+ debug += ', ' + debugString(val[i]);
152
+ }
153
+ debug += ']';
154
+ return debug;
155
+ }
156
+ // Test for built-in
157
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
158
+ let className;
159
+ if (builtInMatches.length > 1) {
160
+ className = builtInMatches[1];
161
+ } else {
162
+ // Failed to match the standard '[object ClassName]'
163
+ return toString.call(val);
164
+ }
165
+ if (className == 'Object') {
166
+ // we're a user defined class or Object
167
+ // JSON.stringify avoids problems with cycles, and is generally much
168
+ // easier than looping through ownProperties of `val`.
169
+ try {
170
+ return 'Object(' + JSON.stringify(val) + ')';
171
+ } catch (_) {
172
+ return 'Object';
173
+ }
174
+ }
175
+ // errors
176
+ if (val instanceof Error) {
177
+ return `${val.name}: ${val.message}\n${val.stack}`;
178
+ }
179
+ // TODO we could test for more things here, like `Set`s and `Map`s.
180
+ return className;
181
+ }
182
+
183
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
184
+ ? { register: () => {}, unregister: () => {} }
185
+ : new FinalizationRegistry(state => {
186
+ wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
187
+ });
188
+
189
+ function makeMutClosure(arg0, arg1, dtor, f) {
190
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
191
+ const real = (...args) => {
192
+ // First up with a closure we increment the internal reference
193
+ // count. This ensures that the Rust closure environment won't
194
+ // be deallocated while we're invoking it.
195
+ state.cnt++;
196
+ const a = state.a;
197
+ state.a = 0;
198
+ try {
199
+ return f(a, state.b, ...args);
200
+ } finally {
201
+ if (--state.cnt === 0) {
202
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
203
+ CLOSURE_DTORS.unregister(state);
204
+ } else {
205
+ state.a = a;
206
+ }
207
+ }
208
+ };
209
+ real.original = state;
210
+ CLOSURE_DTORS.register(real, state, state);
211
+ return real;
212
+ }
213
+ function __wbg_adapter_24(arg0, arg1, arg2) {
214
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8273ed02fd8578ca(arg0, arg1, addHeapObject(arg2));
215
+ }
216
+
217
+ function passArray8ToWasm0(arg, malloc) {
218
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
219
+ getUint8Memory0().set(arg, ptr / 1);
220
+ WASM_VECTOR_LEN = arg.length;
221
+ return ptr;
222
+ }
223
+
118
224
  let cachedUint32Memory0 = null;
119
225
 
120
226
  function getUint32Memory0() {
@@ -124,16 +230,6 @@ function getUint32Memory0() {
124
230
  return cachedUint32Memory0;
125
231
  }
126
232
 
127
- function passArrayJsValueToWasm0(array, malloc) {
128
- const ptr = malloc(array.length * 4, 4) >>> 0;
129
- const mem = getUint32Memory0();
130
- for (let i = 0; i < array.length; i++) {
131
- mem[ptr / 4 + i] = addHeapObject(array[i]);
132
- }
133
- WASM_VECTOR_LEN = array.length;
134
- return ptr;
135
- }
136
-
137
233
  function getArrayJsValueFromWasm0(ptr, len) {
138
234
  ptr = ptr >>> 0;
139
235
  const mem = getUint32Memory0();
@@ -144,18 +240,6 @@ function getArrayJsValueFromWasm0(ptr, len) {
144
240
  }
145
241
  return result;
146
242
  }
147
-
148
- function getArrayU8FromWasm0(ptr, len) {
149
- ptr = ptr >>> 0;
150
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
151
- }
152
-
153
- function passArray8ToWasm0(arg, malloc) {
154
- const ptr = malloc(arg.length * 1, 1) >>> 0;
155
- getUint8Memory0().set(arg, ptr / 1);
156
- WASM_VECTOR_LEN = arg.length;
157
- return ptr;
158
- }
159
243
  /**
160
244
  * @param {Uint8Array} script
161
245
  * @returns {(BatchedFunctionCall)[]}
@@ -181,6 +265,32 @@ function generate_intent_payload_wasm(script) {
181
265
  }
182
266
  }
183
267
 
268
+ function passArrayJsValueToWasm0(array, malloc) {
269
+ const ptr = malloc(array.length * 4, 4) >>> 0;
270
+ const mem = getUint32Memory0();
271
+ for (let i = 0; i < array.length; i++) {
272
+ mem[ptr / 4 + i] = addHeapObject(array[i]);
273
+ }
274
+ WASM_VECTOR_LEN = array.length;
275
+ return ptr;
276
+ }
277
+
278
+ function getArrayU8FromWasm0(ptr, len) {
279
+ ptr = ptr >>> 0;
280
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
281
+ }
282
+
283
+ function handleError(f, args) {
284
+ try {
285
+ return f.apply(this, args);
286
+ } catch (e) {
287
+ wasm.__wbindgen_exn_store(addHeapObject(e));
288
+ }
289
+ }
290
+ function __wbg_adapter_90(arg0, arg1, arg2, arg3) {
291
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h7a552e5a28352106(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
292
+ }
293
+
184
294
  /**
185
295
  * Arguments for each function.
186
296
  */
@@ -419,6 +529,19 @@ class BatchedFunctionCallBuilder {
419
529
  wasm.__wbindgen_add_to_stack_pointer(16);
420
530
  }
421
531
  }
532
+ /**
533
+ * @param {string} api_url
534
+ * @param {string} module_name
535
+ * @returns {Promise<void>}
536
+ */
537
+ load_module(api_url, module_name) {
538
+ const ptr0 = passStringToWasm0(api_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
539
+ const len0 = WASM_VECTOR_LEN;
540
+ const ptr1 = passStringToWasm0(module_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
541
+ const len1 = WASM_VECTOR_LEN;
542
+ const ret = wasm.batchedfunctioncallbuilder_load_module(this.__wbg_ptr, ptr0, len0, ptr1, len1);
543
+ return takeObject(ret);
544
+ }
422
545
  }
423
546
 
424
547
  function __wbg_get_imports() {
@@ -435,6 +558,15 @@ function __wbg_get_imports() {
435
558
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
436
559
  takeObject(arg0);
437
560
  };
561
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
562
+ const obj = takeObject(arg0).original;
563
+ if (obj.cnt-- == 1) {
564
+ obj.a = 0;
565
+ return true;
566
+ }
567
+ const ret = false;
568
+ return ret;
569
+ };
438
570
  imports.wbg.__wbg_batchargumentwasm_unwrap = function(arg0) {
439
571
  const ret = BatchArgumentWASM.__unwrap(takeObject(arg0));
440
572
  return ret;
@@ -451,9 +583,217 @@ function __wbg_get_imports() {
451
583
  getInt32Memory0()[arg0 / 4 + 1] = len1;
452
584
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
453
585
  };
586
+ imports.wbg.__wbg_fetch_1e4e8ed1f64c7e28 = function(arg0) {
587
+ const ret = fetch(getObject(arg0));
588
+ return addHeapObject(ret);
589
+ };
590
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
591
+ const ret = getObject(arg0);
592
+ return addHeapObject(ret);
593
+ };
594
+ imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
595
+ const ret = getObject(arg0).queueMicrotask;
596
+ return addHeapObject(ret);
597
+ };
598
+ imports.wbg.__wbindgen_is_function = function(arg0) {
599
+ const ret = typeof(getObject(arg0)) === 'function';
600
+ return ret;
601
+ };
602
+ imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
603
+ queueMicrotask(getObject(arg0));
604
+ };
605
+ imports.wbg.__wbg_fetch_693453ca3f88c055 = function(arg0, arg1) {
606
+ const ret = getObject(arg0).fetch(getObject(arg1));
607
+ return addHeapObject(ret);
608
+ };
609
+ imports.wbg.__wbg_new_7a20246daa6eec7e = function() { return handleError(function () {
610
+ const ret = new Headers();
611
+ return addHeapObject(ret);
612
+ }, arguments) };
613
+ imports.wbg.__wbg_append_aa3f462f9e2b5ff2 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
614
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
615
+ }, arguments) };
616
+ imports.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03 = function() { return handleError(function (arg0, arg1, arg2) {
617
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
618
+ return addHeapObject(ret);
619
+ }, arguments) };
620
+ imports.wbg.__wbg_signal_3c701f5f40a5f08d = function(arg0) {
621
+ const ret = getObject(arg0).signal;
622
+ return addHeapObject(ret);
623
+ };
624
+ imports.wbg.__wbg_new_0ae46f44b7485bb2 = function() { return handleError(function () {
625
+ const ret = new AbortController();
626
+ return addHeapObject(ret);
627
+ }, arguments) };
628
+ imports.wbg.__wbg_abort_2c4fb490d878d2b2 = function(arg0) {
629
+ getObject(arg0).abort();
630
+ };
631
+ imports.wbg.__wbg_instanceof_Response_4c3b1446206114d1 = function(arg0) {
632
+ let result;
633
+ try {
634
+ result = getObject(arg0) instanceof Response;
635
+ } catch (_) {
636
+ result = false;
637
+ }
638
+ const ret = result;
639
+ return ret;
640
+ };
641
+ imports.wbg.__wbg_url_83a6a4f65f7a2b38 = function(arg0, arg1) {
642
+ const ret = getObject(arg1).url;
643
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
644
+ const len1 = WASM_VECTOR_LEN;
645
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
646
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
647
+ };
648
+ imports.wbg.__wbg_status_d6d47ad2837621eb = function(arg0) {
649
+ const ret = getObject(arg0).status;
650
+ return ret;
651
+ };
652
+ imports.wbg.__wbg_headers_24def508a7518df9 = function(arg0) {
653
+ const ret = getObject(arg0).headers;
654
+ return addHeapObject(ret);
655
+ };
656
+ imports.wbg.__wbg_text_668782292b0bc561 = function() { return handleError(function (arg0) {
657
+ const ret = getObject(arg0).text();
658
+ return addHeapObject(ret);
659
+ }, arguments) };
660
+ imports.wbg.__wbindgen_is_object = function(arg0) {
661
+ const val = getObject(arg0);
662
+ const ret = typeof(val) === 'object' && val !== null;
663
+ return ret;
664
+ };
665
+ imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
666
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
667
+ return addHeapObject(ret);
668
+ };
669
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
670
+ const ret = getObject(arg0).next;
671
+ return addHeapObject(ret);
672
+ };
673
+ imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
674
+ const ret = getObject(arg0).next();
675
+ return addHeapObject(ret);
676
+ }, arguments) };
677
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
678
+ const ret = getObject(arg0).done;
679
+ return ret;
680
+ };
681
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
682
+ const ret = getObject(arg0).value;
683
+ return addHeapObject(ret);
684
+ };
685
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
686
+ const ret = Symbol.iterator;
687
+ return addHeapObject(ret);
688
+ };
689
+ imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
690
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
691
+ return addHeapObject(ret);
692
+ }, arguments) };
693
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
694
+ const ret = getObject(arg0).call(getObject(arg1));
695
+ return addHeapObject(ret);
696
+ }, arguments) };
697
+ imports.wbg.__wbg_new_72fb9a18b5ae2624 = function() {
698
+ const ret = new Object();
699
+ return addHeapObject(ret);
700
+ };
701
+ imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
702
+ const ret = self.self;
703
+ return addHeapObject(ret);
704
+ }, arguments) };
705
+ imports.wbg.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
706
+ const ret = window.window;
707
+ return addHeapObject(ret);
708
+ }, arguments) };
709
+ imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
710
+ const ret = globalThis.globalThis;
711
+ return addHeapObject(ret);
712
+ }, arguments) };
713
+ imports.wbg.__wbg_global_207b558942527489 = function() { return handleError(function () {
714
+ const ret = global.global;
715
+ return addHeapObject(ret);
716
+ }, arguments) };
717
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
718
+ const ret = getObject(arg0) === undefined;
719
+ return ret;
720
+ };
721
+ imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
722
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
723
+ return addHeapObject(ret);
724
+ }, arguments) };
725
+ imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
726
+ try {
727
+ var state0 = {a: arg0, b: arg1};
728
+ var cb0 = (arg0, arg1) => {
729
+ const a = state0.a;
730
+ state0.a = 0;
731
+ try {
732
+ return __wbg_adapter_90(a, state0.b, arg0, arg1);
733
+ } finally {
734
+ state0.a = a;
735
+ }
736
+ };
737
+ const ret = new Promise(cb0);
738
+ return addHeapObject(ret);
739
+ } finally {
740
+ state0.a = state0.b = 0;
741
+ }
742
+ };
743
+ imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
744
+ const ret = Promise.resolve(getObject(arg0));
745
+ return addHeapObject(ret);
746
+ };
747
+ imports.wbg.__wbg_then_0c86a60e8fcfe9f6 = function(arg0, arg1) {
748
+ const ret = getObject(arg0).then(getObject(arg1));
749
+ return addHeapObject(ret);
750
+ };
751
+ imports.wbg.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
752
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
753
+ return addHeapObject(ret);
754
+ };
755
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
756
+ const ret = getObject(arg0).buffer;
757
+ return addHeapObject(ret);
758
+ };
759
+ imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
760
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
761
+ return addHeapObject(ret);
762
+ };
763
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
764
+ const ret = new Uint8Array(getObject(arg0));
765
+ return addHeapObject(ret);
766
+ };
767
+ imports.wbg.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
768
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
769
+ return ret;
770
+ }, arguments) };
771
+ imports.wbg.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
772
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
773
+ return ret;
774
+ }, arguments) };
775
+ imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
776
+ const ret = JSON.stringify(getObject(arg0));
777
+ return addHeapObject(ret);
778
+ }, arguments) };
779
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
780
+ const ret = debugString(getObject(arg1));
781
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
782
+ const len1 = WASM_VECTOR_LEN;
783
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
784
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
785
+ };
454
786
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
455
787
  throw new Error(getStringFromWasm0(arg0, arg1));
456
788
  };
789
+ imports.wbg.__wbindgen_memory = function() {
790
+ const ret = wasm.memory;
791
+ return addHeapObject(ret);
792
+ };
793
+ imports.wbg.__wbindgen_closure_wrapper1042 = function(arg0, arg1, arg2) {
794
+ const ret = makeMutClosure(arg0, arg1, 297, __wbg_adapter_24);
795
+ return addHeapObject(ret);
796
+ };
457
797
 
458
798
  return imports;
459
799
  }
@@ -483,7 +823,7 @@ function initSync(module) {
483
823
  }
484
824
 
485
825
  async function get_wasm (){
486
- return (await import('./aptos_intent_bg-DEdT9YzH.js')).default()
826
+ return (await import('./aptos_intent_bg-B4vpJSlo.js')).default()
487
827
  }
488
828
 
489
829
  export { BatchArgumentType, BatchArgumentWASM, BatchedFunctionCall, BatchedFunctionCallBuilder, generate_intent_payload_wasm, get_wasm, initSync };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Aptos Labs <opensource@aptoslabs.com>"
5
5
  ],
6
6
  "description": "Generating Move Script from intent",
7
- "version": "0.0.9",
7
+ "version": "0.0.10",
8
8
  "type": "module",
9
9
  "license": "Apache-2.0",
10
10
  "repository": {