@getpara/server-sdk 1.4.4 → 1.5.1

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.
Binary file
Binary file
package/dist/esm/index.js CHANGED
@@ -399,7 +399,7 @@ var ServerUtils = class {
399
399
  return keygen(ctx, userId, type, secretKey, true, sessionCookie, emailProps);
400
400
  }
401
401
  refresh(_ctx, _sessionCookie, _userId, _walletId, _share, _oldPartnerId, _newPartnerId) {
402
- throw new Error("not implemented");
402
+ throw new Error("Refresh function is not implemented in the ServerUtils class.");
403
403
  }
404
404
  preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type, secretKey, sessionCookie) {
405
405
  return preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey, false, partnerId, sessionCookie);
@@ -414,7 +414,7 @@ var ServerUtils = class {
414
414
  return sendTransaction(ctx, userId, walletId, share, tx, chainId, sessionCookie, isDKLS);
415
415
  }
416
416
  signHash(_address, _hash) {
417
- throw new Error("not implemented");
417
+ throw new Error("SignHash is not implemented in the ServerUtils class.");
418
418
  }
419
419
  ed25519Keygen(ctx, userId, sessionCookie, emailProps) {
420
420
  return ed25519Keygen(ctx, userId, sessionCookie, emailProps);
@@ -426,7 +426,7 @@ var ServerUtils = class {
426
426
  return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie);
427
427
  }
428
428
  openPopup(_popupUrl) {
429
- throw new Error("not implemented");
429
+ throw new Error("OpenPopup is not implemented in the ServerUtils class.");
430
430
  }
431
431
  };
432
432
 
@@ -444,6 +444,22 @@ var Para = class extends ParaCore {
444
444
  getPlatformUtils() {
445
445
  return new ServerUtils();
446
446
  }
447
+ /**
448
+ * Claims a pregenerated wallet.
449
+ *
450
+ * NOTE: This function is only available on the client side.
451
+ * When called from the server SDK, it throws an error.
452
+ *
453
+ * @param {Object} opts the options object.
454
+ * @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet.
455
+ * @param {TPregenIdentifierType} opts.pregenIdentifierType - the type of the identifier.
456
+ * @returns {Promise<string | undefined>} A promise that rejects with an error.
457
+ */
458
+ async claimPregenWallets({} = {}) {
459
+ throw new Error(
460
+ "claimPregenWallets is not available in the server SDK. This function is only supported on the client side. Please ensure you are using the client SDK to call this method."
461
+ );
462
+ }
447
463
  };
448
464
 
449
465
  // src/index.ts
Binary file
Binary file
@@ -8,8 +8,29 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
8
8
  var __commonJS = (cb, mod) => function __require2() {
9
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
10
  };
11
+ var __async = (__this, __arguments, generator) => {
12
+ return new Promise((resolve, reject) => {
13
+ var fulfilled = (value) => {
14
+ try {
15
+ step(generator.next(value));
16
+ } catch (e) {
17
+ reject(e);
18
+ }
19
+ };
20
+ var rejected = (value) => {
21
+ try {
22
+ step(generator.throw(value));
23
+ } catch (e) {
24
+ reject(e);
25
+ }
26
+ };
27
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
28
+ step((generator = generator.apply(__this, __arguments)).next());
29
+ });
30
+ };
11
31
 
12
32
  export {
13
33
  __require,
14
- __commonJS
34
+ __commonJS,
35
+ __async
15
36
  };
@@ -1,7 +1,8 @@
1
1
  import {
2
+ __async,
2
3
  __commonJS,
3
4
  __require
4
- } from "./chunk-MCKGQKYU.js";
5
+ } from "./chunk-ILICZWQV.js";
5
6
 
6
7
  // src/wasm/wasm_exec.js
7
8
  var require_wasm_exec = __commonJS({
@@ -483,71 +484,73 @@ var require_wasm_exec = __commonJS({
483
484
  }
484
485
  };
485
486
  }
486
- async run(instance) {
487
- if (!(instance instanceof WebAssembly.Instance)) {
488
- throw new Error("Go.run: WebAssembly.Instance expected");
489
- }
490
- this._inst = instance;
491
- this.mem = new DataView(this._inst.exports.mem.buffer);
492
- this._values = [
493
- // JS values that Go currently has references to, indexed by reference id
494
- NaN,
495
- 0,
496
- null,
497
- true,
498
- false,
499
- globalThis,
500
- this
501
- ];
502
- this._goRefCounts = new Array(this._values.length).fill(Infinity);
503
- this._ids = /* @__PURE__ */ new Map([
504
- // mapping from JS values to reference ids
505
- [0, 1],
506
- [null, 2],
507
- [true, 3],
508
- [false, 4],
509
- [globalThis, 5],
510
- [this, 6]
511
- ]);
512
- this._idPool = [];
513
- this.exited = false;
514
- let offset = 4096;
515
- const strPtr = (str) => {
516
- const ptr = offset;
517
- const bytes = encoder.encode(str + "\0");
518
- new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);
519
- offset += bytes.length;
520
- if (offset % 8 !== 0) {
521
- offset += 8 - offset % 8;
487
+ run(instance) {
488
+ return __async(this, null, function* () {
489
+ if (!(instance instanceof WebAssembly.Instance)) {
490
+ throw new Error("Go.run: WebAssembly.Instance expected");
522
491
  }
523
- return ptr;
524
- };
525
- const argc = this.argv.length;
526
- const argvPtrs = [];
527
- this.argv.forEach((arg) => {
528
- argvPtrs.push(strPtr(arg));
529
- });
530
- argvPtrs.push(0);
531
- const keys = Object.keys(this.env).sort();
532
- keys.forEach((key) => {
533
- argvPtrs.push(strPtr(`${key}=${this.env[key]}`));
534
- });
535
- argvPtrs.push(0);
536
- const argv = offset;
537
- argvPtrs.forEach((ptr) => {
538
- this.mem.setUint32(offset, ptr, true);
539
- this.mem.setUint32(offset + 4, 0, true);
540
- offset += 8;
492
+ this._inst = instance;
493
+ this.mem = new DataView(this._inst.exports.mem.buffer);
494
+ this._values = [
495
+ // JS values that Go currently has references to, indexed by reference id
496
+ NaN,
497
+ 0,
498
+ null,
499
+ true,
500
+ false,
501
+ globalThis,
502
+ this
503
+ ];
504
+ this._goRefCounts = new Array(this._values.length).fill(Infinity);
505
+ this._ids = /* @__PURE__ */ new Map([
506
+ // mapping from JS values to reference ids
507
+ [0, 1],
508
+ [null, 2],
509
+ [true, 3],
510
+ [false, 4],
511
+ [globalThis, 5],
512
+ [this, 6]
513
+ ]);
514
+ this._idPool = [];
515
+ this.exited = false;
516
+ let offset = 4096;
517
+ const strPtr = (str) => {
518
+ const ptr = offset;
519
+ const bytes = encoder.encode(str + "\0");
520
+ new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);
521
+ offset += bytes.length;
522
+ if (offset % 8 !== 0) {
523
+ offset += 8 - offset % 8;
524
+ }
525
+ return ptr;
526
+ };
527
+ const argc = this.argv.length;
528
+ const argvPtrs = [];
529
+ this.argv.forEach((arg) => {
530
+ argvPtrs.push(strPtr(arg));
531
+ });
532
+ argvPtrs.push(0);
533
+ const keys = Object.keys(this.env).sort();
534
+ keys.forEach((key) => {
535
+ argvPtrs.push(strPtr(`${key}=${this.env[key]}`));
536
+ });
537
+ argvPtrs.push(0);
538
+ const argv = offset;
539
+ argvPtrs.forEach((ptr) => {
540
+ this.mem.setUint32(offset, ptr, true);
541
+ this.mem.setUint32(offset + 4, 0, true);
542
+ offset += 8;
543
+ });
544
+ const wasmMinDataAddr = 4096 + 8192;
545
+ if (offset >= wasmMinDataAddr) {
546
+ throw new Error("total length of command line and environment variables exceeds limit");
547
+ }
548
+ this._inst.exports.run(argc, argv);
549
+ if (this.exited) {
550
+ this._resolveExitPromise();
551
+ }
552
+ yield this._exitPromise;
541
553
  });
542
- const wasmMinDataAddr = 4096 + 8192;
543
- if (offset >= wasmMinDataAddr) {
544
- throw new Error("total length of command line and environment variables exceeds limit");
545
- }
546
- this._inst.exports.run(argc, argv);
547
- if (this.exited) {
548
- this._resolveExitPromise();
549
- }
550
- await this._exitPromise;
551
554
  }
552
555
  _resume() {
553
556
  if (this.exited) {