@synonymdev/pubky 0.4.0-rc1 → 0.4.0-rc2

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/index.cjs CHANGED
@@ -228,6 +228,24 @@ function debugString(val) {
228
228
  // TODO we could test for more things here, like `Set`s and `Map`s.
229
229
  return className;
230
230
  }
231
+ /**
232
+ * @param {string} level
233
+ */
234
+ module.exports.setLogLevel = function(level) {
235
+ try {
236
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
237
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
238
+ const len0 = WASM_VECTOR_LEN;
239
+ wasm.setLogLevel(retptr, ptr0, len0);
240
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
241
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
242
+ if (r1) {
243
+ throw takeObject(r0);
244
+ }
245
+ } finally {
246
+ wasm.__wbindgen_add_to_stack_pointer(16);
247
+ }
248
+ };
231
249
 
232
250
  function _assertClass(instance, klass) {
233
251
  if (!(instance instanceof klass)) {
@@ -293,25 +311,6 @@ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
293
311
  }
294
312
  };
295
313
 
296
- /**
297
- * @param {string} level
298
- */
299
- module.exports.setLogLevel = function(level) {
300
- try {
301
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
302
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
303
- const len0 = WASM_VECTOR_LEN;
304
- wasm.setLogLevel(retptr, ptr0, len0);
305
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
306
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
307
- if (r1) {
308
- throw takeObject(r0);
309
- }
310
- } finally {
311
- wasm.__wbindgen_add_to_stack_pointer(16);
312
- }
313
- };
314
-
315
314
  function getArrayJsValueFromWasm0(ptr, len) {
316
315
  ptr = ptr >>> 0;
317
316
  const mem = getDataViewMemory0();
@@ -360,6 +359,26 @@ class Client {
360
359
  const ptr = this.__destroy_into_raw();
361
360
  wasm.__wbg_client_free(ptr, 0);
362
361
  }
362
+ /**
363
+ * Create Client with default Settings including default relays
364
+ */
365
+ constructor() {
366
+ const ret = wasm.client_new();
367
+ this.__wbg_ptr = ret >>> 0;
368
+ ClientFinalization.register(this, this.__wbg_ptr, this);
369
+ return this;
370
+ }
371
+ /**
372
+ * Create a client with with configurations appropriate for local testing:
373
+ * - set Pkarr relays to `["http://localhost:15411"]` instead of default relay.
374
+ * - transform `pubky://<pkarr public key>` to `http://<pkarr public key` instead of `https:`
375
+ * and read the homeserver HTTP port from the [reserved service parameter key](pubky_common::constants::reserved_param_keys::HTTP_PORT)
376
+ * @returns {Client}
377
+ */
378
+ static testnet() {
379
+ const ret = wasm.client_testnet();
380
+ return Client.__wrap(ret);
381
+ }
363
382
  /**
364
383
  * Signup to a homeserver and update Pkarr accordingly.
365
384
  *
@@ -486,24 +505,6 @@ class Client {
486
505
  const ret = wasm.client_fetch(this.__wbg_ptr, ptr0, len0, isLikeNone(request_init) ? 0 : addHeapObject(request_init));
487
506
  return takeObject(ret);
488
507
  }
489
- /**
490
- * Create Client with default Settings including default relays
491
- */
492
- constructor() {
493
- const ret = wasm.client_new();
494
- this.__wbg_ptr = ret >>> 0;
495
- ClientFinalization.register(this, this.__wbg_ptr, this);
496
- return this;
497
- }
498
- /**
499
- * Create a client with with configurations appropriate for local testing:
500
- * - set Pkarr relays to `["http://localhost:15411"]` instead of default relay.
501
- * @returns {Client}
502
- */
503
- static testnet() {
504
- const ret = wasm.client_testnet();
505
- return Client.__wrap(ret);
506
- }
507
508
  }
508
509
  module.exports.Client = Client;
509
510
 
@@ -1085,8 +1086,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
1085
1086
  return ret;
1086
1087
  };
1087
1088
 
1088
- module.exports.__wbindgen_closure_wrapper2630 = function(arg0, arg1, arg2) {
1089
- const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_28);
1089
+ module.exports.__wbindgen_closure_wrapper2714 = function(arg0, arg1, arg2) {
1090
+ const ret = makeMutClosure(arg0, arg1, 539, __wbg_adapter_28);
1090
1091
  return addHeapObject(ret);
1091
1092
  };
1092
1093