@wgb5445/aptos-intent-npm 0.0.9 → 0.0.10

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