@wgb5445/aptos-intent-npm 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/entry.js CHANGED
@@ -211,7 +211,14 @@ function makeMutClosure(arg0, arg1, dtor, f) {
211
211
  return real;
212
212
  }
213
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__h09acdaa8b02601d5(arg0, arg1, addHeapObject(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;
215
222
  }
216
223
 
217
224
  let cachedUint32Memory0 = null;
@@ -223,16 +230,6 @@ function getUint32Memory0() {
223
230
  return cachedUint32Memory0;
224
231
  }
225
232
 
226
- function passArrayJsValueToWasm0(array, malloc) {
227
- const ptr = malloc(array.length * 4, 4) >>> 0;
228
- const mem = getUint32Memory0();
229
- for (let i = 0; i < array.length; i++) {
230
- mem[ptr / 4 + i] = addHeapObject(array[i]);
231
- }
232
- WASM_VECTOR_LEN = array.length;
233
- return ptr;
234
- }
235
-
236
233
  function getArrayJsValueFromWasm0(ptr, len) {
237
234
  ptr = ptr >>> 0;
238
235
  const mem = getUint32Memory0();
@@ -243,19 +240,46 @@ function getArrayJsValueFromWasm0(ptr, len) {
243
240
  }
244
241
  return result;
245
242
  }
243
+ /**
244
+ * @param {Uint8Array} script
245
+ * @returns {(BatchedFunctionCall)[]}
246
+ */
247
+ function generate_intent_payload_wasm(script) {
248
+ try {
249
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
250
+ const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_malloc);
251
+ const len0 = WASM_VECTOR_LEN;
252
+ wasm.generate_intent_payload_wasm(retptr, ptr0, len0);
253
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
254
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
255
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
256
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
257
+ if (r3) {
258
+ throw takeObject(r2);
259
+ }
260
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
261
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
262
+ return v2;
263
+ } finally {
264
+ wasm.__wbindgen_add_to_stack_pointer(16);
265
+ }
266
+ }
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
+ }
246
277
 
247
278
  function getArrayU8FromWasm0(ptr, len) {
248
279
  ptr = ptr >>> 0;
249
280
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
250
281
  }
251
282
 
252
- function passArray8ToWasm0(arg, malloc) {
253
- const ptr = malloc(arg.length * 1, 1) >>> 0;
254
- getUint8Memory0().set(arg, ptr / 1);
255
- WASM_VECTOR_LEN = arg.length;
256
- return ptr;
257
- }
258
-
259
283
  function handleError(f, args) {
260
284
  try {
261
285
  return f.apply(this, args);
@@ -263,36 +287,33 @@ function handleError(f, args) {
263
287
  wasm.__wbindgen_exn_store(addHeapObject(e));
264
288
  }
265
289
  }
266
- function __wbg_adapter_87(arg0, arg1, arg2, arg3) {
267
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h4c0838795c3445c5(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
290
+ function __wbg_adapter_90(arg0, arg1, arg2, arg3) {
291
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h7a552e5a28352106(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
268
292
  }
269
293
 
270
- /**
271
- */
272
- const ArgumentOperation = Object.freeze({ Move:0,"0":"Move",Copy:1,"1":"Copy",Borrow:2,"2":"Borrow",BorrowMut:3,"3":"BorrowMut", });
273
294
  /**
274
295
  * Arguments for each function.
275
296
  */
276
297
  const BatchArgumentType = Object.freeze({ Raw:0,"0":"Raw",Signer:1,"1":"Signer",PreviousResult:2,"2":"PreviousResult", });
277
298
 
278
- const BatchArgumentFinalization = (typeof FinalizationRegistry === 'undefined')
299
+ const BatchArgumentWASMFinalization = (typeof FinalizationRegistry === 'undefined')
279
300
  ? { register: () => {}, unregister: () => {} }
280
- : new FinalizationRegistry(ptr => wasm.__wbg_batchargument_free(ptr >>> 0));
301
+ : new FinalizationRegistry(ptr => wasm.__wbg_batchargumentwasm_free(ptr >>> 0));
281
302
  /**
282
303
  * Arguments for each function. Wasm bindgen only support C-style enum so use option to work around.
283
304
  */
284
- class BatchArgument {
305
+ class BatchArgumentWASM {
285
306
 
286
307
  static __wrap(ptr) {
287
308
  ptr = ptr >>> 0;
288
- const obj = Object.create(BatchArgument.prototype);
309
+ const obj = Object.create(BatchArgumentWASM.prototype);
289
310
  obj.__wbg_ptr = ptr;
290
- BatchArgumentFinalization.register(obj, obj.__wbg_ptr, obj);
311
+ BatchArgumentWASMFinalization.register(obj, obj.__wbg_ptr, obj);
291
312
  return obj;
292
313
  }
293
314
 
294
315
  static __unwrap(jsValue) {
295
- if (!(jsValue instanceof BatchArgument)) {
316
+ if (!(jsValue instanceof BatchArgumentWASM)) {
296
317
  return 0;
297
318
  }
298
319
  return jsValue.__destroy_into_raw();
@@ -301,82 +322,82 @@ class BatchArgument {
301
322
  __destroy_into_raw() {
302
323
  const ptr = this.__wbg_ptr;
303
324
  this.__wbg_ptr = 0;
304
- BatchArgumentFinalization.unregister(this);
325
+ BatchArgumentWASMFinalization.unregister(this);
305
326
  return ptr;
306
327
  }
307
328
 
308
329
  free() {
309
330
  const ptr = this.__destroy_into_raw();
310
- wasm.__wbg_batchargument_free(ptr);
331
+ wasm.__wbg_batchargumentwasm_free(ptr);
311
332
  }
312
333
  /**
313
334
  * @param {Uint8Array} bytes
314
- * @returns {BatchArgument}
335
+ * @returns {BatchArgumentWASM}
315
336
  */
316
337
  static new_bytes(bytes) {
317
338
  const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
318
339
  const len0 = WASM_VECTOR_LEN;
319
- const ret = wasm.batchargument_new_bytes(ptr0, len0);
320
- return BatchArgument.__wrap(ret);
340
+ const ret = wasm.batchargumentwasm_new_bytes(ptr0, len0);
341
+ return BatchArgumentWASM.__wrap(ret);
321
342
  }
322
343
  /**
323
344
  * @param {number} signer_idx
324
- * @returns {BatchArgument}
345
+ * @returns {BatchArgumentWASM}
325
346
  */
326
347
  static new_signer(signer_idx) {
327
- const ret = wasm.batchargument_new_signer(signer_idx);
328
- return BatchArgument.__wrap(ret);
348
+ const ret = wasm.batchargumentwasm_new_signer(signer_idx);
349
+ return BatchArgumentWASM.__wrap(ret);
329
350
  }
330
351
  /**
331
- * @returns {BatchArgument}
352
+ * @returns {BatchArgumentWASM}
332
353
  */
333
354
  borrow() {
334
355
  try {
335
356
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
336
- wasm.batchargument_borrow(retptr, this.__wbg_ptr);
357
+ wasm.batchargumentwasm_borrow(retptr, this.__wbg_ptr);
337
358
  var r0 = getInt32Memory0()[retptr / 4 + 0];
338
359
  var r1 = getInt32Memory0()[retptr / 4 + 1];
339
360
  var r2 = getInt32Memory0()[retptr / 4 + 2];
340
361
  if (r2) {
341
362
  throw takeObject(r1);
342
363
  }
343
- return BatchArgument.__wrap(r0);
364
+ return BatchArgumentWASM.__wrap(r0);
344
365
  } finally {
345
366
  wasm.__wbindgen_add_to_stack_pointer(16);
346
367
  }
347
368
  }
348
369
  /**
349
- * @returns {BatchArgument}
370
+ * @returns {BatchArgumentWASM}
350
371
  */
351
372
  borrow_mut() {
352
373
  try {
353
374
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
354
- wasm.batchargument_borrow_mut(retptr, this.__wbg_ptr);
375
+ wasm.batchargumentwasm_borrow_mut(retptr, this.__wbg_ptr);
355
376
  var r0 = getInt32Memory0()[retptr / 4 + 0];
356
377
  var r1 = getInt32Memory0()[retptr / 4 + 1];
357
378
  var r2 = getInt32Memory0()[retptr / 4 + 2];
358
379
  if (r2) {
359
380
  throw takeObject(r1);
360
381
  }
361
- return BatchArgument.__wrap(r0);
382
+ return BatchArgumentWASM.__wrap(r0);
362
383
  } finally {
363
384
  wasm.__wbindgen_add_to_stack_pointer(16);
364
385
  }
365
386
  }
366
387
  /**
367
- * @returns {BatchArgument}
388
+ * @returns {BatchArgumentWASM}
368
389
  */
369
390
  copy() {
370
391
  try {
371
392
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
372
- wasm.batchargument_copy(retptr, this.__wbg_ptr);
393
+ wasm.batchargumentwasm_copy(retptr, this.__wbg_ptr);
373
394
  var r0 = getInt32Memory0()[retptr / 4 + 0];
374
395
  var r1 = getInt32Memory0()[retptr / 4 + 1];
375
396
  var r2 = getInt32Memory0()[retptr / 4 + 2];
376
397
  if (r2) {
377
398
  throw takeObject(r1);
378
399
  }
379
- return BatchArgument.__wrap(r0);
400
+ return BatchArgumentWASM.__wrap(r0);
380
401
  } finally {
381
402
  wasm.__wbindgen_add_to_stack_pointer(16);
382
403
  }
@@ -391,6 +412,14 @@ const BatchedFunctionCallFinalization = (typeof FinalizationRegistry === 'undefi
391
412
  */
392
413
  class BatchedFunctionCall {
393
414
 
415
+ static __wrap(ptr) {
416
+ ptr = ptr >>> 0;
417
+ const obj = Object.create(BatchedFunctionCall.prototype);
418
+ obj.__wbg_ptr = ptr;
419
+ BatchedFunctionCallFinalization.register(obj, obj.__wbg_ptr, obj);
420
+ return obj;
421
+ }
422
+
394
423
  __destroy_into_raw() {
395
424
  const ptr = this.__wbg_ptr;
396
425
  this.__wbg_ptr = 0;
@@ -449,8 +478,8 @@ class BatchedFunctionCallBuilder {
449
478
  * @param {string} module
450
479
  * @param {string} _function
451
480
  * @param {(string)[]} ty_args
452
- * @param {(BatchArgument)[]} args
453
- * @returns {(BatchArgument)[]}
481
+ * @param {(BatchArgumentWASM)[]} args
482
+ * @returns {(BatchArgumentWASM)[]}
454
483
  */
455
484
  add_batched_call(module, _function, ty_args, args) {
456
485
  try {
@@ -515,32 +544,33 @@ class BatchedFunctionCallBuilder {
515
544
  }
516
545
  }
517
546
 
518
- const PreviousResultFinalization = (typeof FinalizationRegistry === 'undefined')
519
- ? { register: () => {}, unregister: () => {} }
520
- : new FinalizationRegistry(ptr => wasm.__wbg_previousresult_free(ptr >>> 0));
521
- /**
522
- */
523
- class PreviousResult {
524
-
525
- __destroy_into_raw() {
526
- const ptr = this.__wbg_ptr;
527
- this.__wbg_ptr = 0;
528
- PreviousResultFinalization.unregister(this);
529
- return ptr;
530
- }
531
-
532
- free() {
533
- const ptr = this.__destroy_into_raw();
534
- wasm.__wbg_previousresult_free(ptr);
535
- }
536
- }
537
-
538
547
  function __wbg_get_imports() {
539
548
  const imports = {};
540
549
  imports.wbg = {};
550
+ imports.wbg.__wbg_batchargumentwasm_new = function(arg0) {
551
+ const ret = BatchArgumentWASM.__wrap(arg0);
552
+ return addHeapObject(ret);
553
+ };
554
+ imports.wbg.__wbg_batchedfunctioncall_new = function(arg0) {
555
+ const ret = BatchedFunctionCall.__wrap(arg0);
556
+ return addHeapObject(ret);
557
+ };
541
558
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
542
559
  takeObject(arg0);
543
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
+ };
570
+ imports.wbg.__wbg_batchargumentwasm_unwrap = function(arg0) {
571
+ const ret = BatchArgumentWASM.__unwrap(takeObject(arg0));
572
+ return ret;
573
+ };
544
574
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
545
575
  const ret = getStringFromWasm0(arg0, arg1);
546
576
  return addHeapObject(ret);
@@ -553,23 +583,6 @@ function __wbg_get_imports() {
553
583
  getInt32Memory0()[arg0 / 4 + 1] = len1;
554
584
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
555
585
  };
556
- imports.wbg.__wbg_batchargument_unwrap = function(arg0) {
557
- const ret = BatchArgument.__unwrap(takeObject(arg0));
558
- return ret;
559
- };
560
- imports.wbg.__wbg_batchargument_new = function(arg0) {
561
- const ret = BatchArgument.__wrap(arg0);
562
- return addHeapObject(ret);
563
- };
564
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
565
- const obj = takeObject(arg0).original;
566
- if (obj.cnt-- == 1) {
567
- obj.a = 0;
568
- return true;
569
- }
570
- const ret = false;
571
- return ret;
572
- };
573
586
  imports.wbg.__wbg_fetch_1e4e8ed1f64c7e28 = function(arg0) {
574
587
  const ret = fetch(getObject(arg0));
575
588
  return addHeapObject(ret);
@@ -578,9 +591,6 @@ function __wbg_get_imports() {
578
591
  const ret = getObject(arg0);
579
592
  return addHeapObject(ret);
580
593
  };
581
- imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
582
- queueMicrotask(getObject(arg0));
583
- };
584
594
  imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
585
595
  const ret = getObject(arg0).queueMicrotask;
586
596
  return addHeapObject(ret);
@@ -589,10 +599,20 @@ function __wbg_get_imports() {
589
599
  const ret = typeof(getObject(arg0)) === 'function';
590
600
  return ret;
591
601
  };
602
+ imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
603
+ queueMicrotask(getObject(arg0));
604
+ };
592
605
  imports.wbg.__wbg_fetch_693453ca3f88c055 = function(arg0, arg1) {
593
606
  const ret = getObject(arg0).fetch(getObject(arg1));
594
607
  return addHeapObject(ret);
595
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) };
596
616
  imports.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03 = function() { return handleError(function (arg0, arg1, arg2) {
597
617
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
598
618
  return addHeapObject(ret);
@@ -608,13 +628,6 @@ function __wbg_get_imports() {
608
628
  imports.wbg.__wbg_abort_2c4fb490d878d2b2 = function(arg0) {
609
629
  getObject(arg0).abort();
610
630
  };
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
631
  imports.wbg.__wbg_instanceof_Response_4c3b1446206114d1 = function(arg0) {
619
632
  let result;
620
633
  try {
@@ -716,7 +729,7 @@ function __wbg_get_imports() {
716
729
  const a = state0.a;
717
730
  state0.a = 0;
718
731
  try {
719
- return __wbg_adapter_87(a, state0.b, arg0, arg1);
732
+ return __wbg_adapter_90(a, state0.b, arg0, arg1);
720
733
  } finally {
721
734
  state0.a = a;
722
735
  }
@@ -751,10 +764,6 @@ function __wbg_get_imports() {
751
764
  const ret = new Uint8Array(getObject(arg0));
752
765
  return addHeapObject(ret);
753
766
  };
754
- imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
755
- const ret = JSON.stringify(getObject(arg0));
756
- return addHeapObject(ret);
757
- }, arguments) };
758
767
  imports.wbg.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
759
768
  const ret = Reflect.has(getObject(arg0), getObject(arg1));
760
769
  return ret;
@@ -763,6 +772,10 @@ function __wbg_get_imports() {
763
772
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
764
773
  return ret;
765
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) };
766
779
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
767
780
  const ret = debugString(getObject(arg1));
768
781
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -777,8 +790,8 @@ function __wbg_get_imports() {
777
790
  const ret = wasm.memory;
778
791
  return addHeapObject(ret);
779
792
  };
780
- imports.wbg.__wbindgen_closure_wrapper540 = function(arg0, arg1, arg2) {
781
- const ret = makeMutClosure(arg0, arg1, 264, __wbg_adapter_24);
793
+ imports.wbg.__wbindgen_closure_wrapper1042 = function(arg0, arg1, arg2) {
794
+ const ret = makeMutClosure(arg0, arg1, 297, __wbg_adapter_24);
782
795
  return addHeapObject(ret);
783
796
  };
784
797
 
@@ -810,7 +823,7 @@ function initSync(module) {
810
823
  }
811
824
 
812
825
  async function get_wasm (){
813
- return (await import('./aptos_intent_bg-Dr5TXbTf.js')).default()
826
+ return (await import('./aptos_intent_bg-B4vpJSlo.js')).default()
814
827
  }
815
828
 
816
- export { ArgumentOperation, BatchArgument, BatchArgumentType, BatchedFunctionCall, BatchedFunctionCallBuilder, PreviousResult, get_wasm, initSync };
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.8",
7
+ "version": "0.0.10",
8
8
  "type": "module",
9
9
  "license": "Apache-2.0",
10
10
  "repository": {