@getpara/web-sdk 2.0.0-alpha.7 → 2.0.0-alpha.70

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.
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  __async
4
- } from "../chunk-M66XENHI.js";
4
+ } from "../chunk-YJOFEY2L.js";
5
5
  import { getBaseMPCNetworkUrl } from "@getpara/core-sdk";
6
+ import * as uuid from "uuid";
6
7
  const configCGGMPBase = (serverUrl, walletId, id) => `{"ServerUrl":"${serverUrl}", "WalletId": "${walletId}", "Id":"${id}", "Ids":["USER","CAPSULE"], "Threshold":1}`;
7
8
  const configDKLSBase = (walletId, id, disableWebSockets) => `{"walletId": "${walletId}", "id":"${id}", "otherId":"CAPSULE", "isReceiver": false, "disableWebSockets": ${disableWebSockets}}`;
8
9
  function keygenRequest(ctx, userId, walletId, protocolId) {
@@ -86,20 +87,30 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
86
87
  }
87
88
  function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
88
89
  return __async(this, null, function* () {
89
- const { protocolId } = yield ctx.client.preSignMessage(userId, walletId, base64Bytes, "ED25519");
90
- try {
91
- const base64Sig = yield new Promise(
92
- (resolve, reject) => globalThis.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
93
- if (err) {
94
- reject(err);
95
- }
96
- resolve(result);
97
- })
98
- );
99
- return { signature: base64Sig };
100
- } catch (e) {
101
- throw new Error(`error signing for account of type SOLANA with userId ${userId} and walletId ${walletId}`);
90
+ const protocolId = uuid.v4();
91
+ const preSignMessageRes = ctx.client.preSignMessage(userId, walletId, base64Bytes, "ED25519", void 0, protocolId);
92
+ const signRes = function() {
93
+ return __async(this, null, function* () {
94
+ try {
95
+ const base64Sig = yield new Promise(
96
+ (resolve, reject) => globalThis.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
97
+ if (err) {
98
+ reject(err);
99
+ }
100
+ resolve(result);
101
+ })
102
+ );
103
+ return { signature: base64Sig };
104
+ } catch (e) {
105
+ throw new Error(`error signing for account of type SOLANA with userId ${userId} and walletId ${walletId}`);
106
+ }
107
+ });
108
+ }();
109
+ const { pendingTransactionId } = yield preSignMessageRes;
110
+ if (pendingTransactionId) {
111
+ return { pendingTransactionId };
102
112
  }
113
+ return yield signRes;
103
114
  });
104
115
  }
105
116
  function keygen(ctx, userId, type, secretKey) {
@@ -179,16 +190,8 @@ function preKeygen(ctx, _partnerId, pregenIdentifier, pregenIdentifierType, type
179
190
  }
180
191
  function signMessage(ctx, share, walletId, userId, message, cosmosSignDoc) {
181
192
  return __async(this, null, function* () {
182
- const { protocolId, pendingTransactionId } = yield ctx.client.preSignMessage(
183
- userId,
184
- walletId,
185
- message,
186
- null,
187
- cosmosSignDoc
188
- );
189
- if (pendingTransactionId) {
190
- return { pendingTransactionId };
191
- }
193
+ const protocolId = uuid.v4();
194
+ const preSignMessageRes = ctx.client.preSignMessage(userId, walletId, message, null, cosmosSignDoc, protocolId);
192
195
  if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
193
196
  return signMessageRequest(ctx, userId, walletId, protocolId, message, share);
194
197
  }
@@ -199,28 +202,33 @@ function signMessage(ctx, share, walletId, userId, message, cosmosSignDoc) {
199
202
  parsedShare.disableWebSockets = ctx.disableWebSockets;
200
203
  }
201
204
  share = JSON.stringify(parsedShare);
202
- try {
203
- return yield new Promise(
204
- (resolve, reject) => signMessageFn(share, serverUrl, message, protocolId, (err, result) => {
205
- if (err) {
206
- reject(err);
207
- }
208
- resolve({ signature: result });
209
- })
210
- );
211
- } catch (e) {
212
- throw new Error(`error signing for account with userId ${userId} and walletId ${walletId}`);
205
+ const signMessageRes = function() {
206
+ return __async(this, null, function* () {
207
+ try {
208
+ return yield new Promise(
209
+ (resolve, reject) => signMessageFn(share, serverUrl, message, protocolId, (err, result) => {
210
+ if (err) {
211
+ reject(err);
212
+ }
213
+ resolve({ signature: result });
214
+ })
215
+ );
216
+ } catch (e) {
217
+ throw new Error(`error signing for account with userId ${userId} and walletId ${walletId}`);
218
+ }
219
+ });
220
+ }();
221
+ const { pendingTransactionId } = yield preSignMessageRes;
222
+ if (pendingTransactionId) {
223
+ return { pendingTransactionId };
213
224
  }
225
+ return yield signMessageRes;
214
226
  });
215
227
  }
216
228
  function signTransaction(ctx, share, walletId, userId, tx, chainId) {
217
229
  return __async(this, null, function* () {
218
- const {
219
- data: { protocolId, pendingTransactionId }
220
- } = yield ctx.client.signTransaction(userId, walletId, { transaction: tx, chainId });
221
- if (pendingTransactionId) {
222
- return { pendingTransactionId };
223
- }
230
+ const protocolId = uuid.v4();
231
+ const signTransactionRes = ctx.client.signTransaction(userId, walletId, { transaction: tx, chainId, protocolId });
224
232
  if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
225
233
  return sendTransactionRequest(ctx, userId, walletId, protocolId, tx, share, chainId);
226
234
  }
@@ -231,28 +239,35 @@ function signTransaction(ctx, share, walletId, userId, tx, chainId) {
231
239
  parsedShare.disableWebSockets = ctx.disableWebSockets;
232
240
  }
233
241
  share = JSON.stringify(parsedShare);
234
- try {
235
- return yield new Promise(
236
- (resolve, reject) => signTransactionFn(share, serverUrl, tx, chainId, protocolId, (err, result) => {
237
- if (err) {
238
- reject(err);
239
- }
240
- resolve({ signature: result });
241
- })
242
- );
243
- } catch (e) {
244
- throw new Error(`error signing transaction for account with userId ${userId} and walletId ${walletId}`);
242
+ const signTxRes = function() {
243
+ return __async(this, null, function* () {
244
+ try {
245
+ return yield new Promise(
246
+ (resolve, reject) => signTransactionFn(share, serverUrl, tx, chainId, protocolId, (err, result) => {
247
+ if (err) {
248
+ reject(err);
249
+ }
250
+ resolve({ signature: result });
251
+ })
252
+ );
253
+ } catch (e) {
254
+ throw new Error(`error signing transaction for account with userId ${userId} and walletId ${walletId}`);
255
+ }
256
+ });
257
+ }();
258
+ const {
259
+ data: { pendingTransactionId }
260
+ } = yield signTransactionRes;
261
+ if (pendingTransactionId) {
262
+ return { pendingTransactionId };
245
263
  }
264
+ return yield signTxRes;
246
265
  });
247
266
  }
248
267
  function sendTransaction(ctx, share, walletId, userId, tx, chainId) {
249
268
  return __async(this, null, function* () {
250
- const {
251
- data: { protocolId, pendingTransactionId }
252
- } = yield ctx.client.sendTransaction(userId, walletId, { transaction: tx, chainId });
253
- if (pendingTransactionId) {
254
- return { pendingTransactionId };
255
- }
269
+ const protocolId = uuid.v4();
270
+ const sendTransactionRes = ctx.client.sendTransaction(userId, walletId, { transaction: tx, chainId, protocolId });
256
271
  if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
257
272
  return sendTransactionRequest(ctx, userId, walletId, protocolId, tx, share, chainId);
258
273
  }
@@ -263,18 +278,29 @@ function sendTransaction(ctx, share, walletId, userId, tx, chainId) {
263
278
  parsedShare.disableWebSockets = ctx.disableWebSockets;
264
279
  }
265
280
  share = JSON.stringify(parsedShare);
266
- try {
267
- return yield new Promise(
268
- (resolve, reject) => sendTransactionFn(share, serverUrl, tx, chainId, protocolId, (err, result) => {
269
- if (err) {
270
- reject(err);
271
- }
272
- resolve({ signature: result });
273
- })
274
- );
275
- } catch (e) {
276
- throw new Error(`error signing transaction to send for account with userId ${userId} and walletId ${walletId}`);
281
+ const sendTxRes = function() {
282
+ return __async(this, null, function* () {
283
+ try {
284
+ return yield new Promise(
285
+ (resolve, reject) => sendTransactionFn(share, serverUrl, tx, chainId, protocolId, (err, result) => {
286
+ if (err) {
287
+ reject(err);
288
+ }
289
+ resolve({ signature: result });
290
+ })
291
+ );
292
+ } catch (e) {
293
+ throw new Error(`error signing transaction to send for account with userId ${userId} and walletId ${walletId}`);
294
+ }
295
+ });
296
+ }();
297
+ const {
298
+ data: { pendingTransactionId }
299
+ } = yield sendTransactionRes;
300
+ if (pendingTransactionId) {
301
+ return { pendingTransactionId };
277
302
  }
303
+ return yield sendTxRes;
278
304
  });
279
305
  }
280
306
  function refresh(ctx, share, walletId, userId, oldPartnerId, newPartnerId, keyShareProtocolId) {
@@ -1,4 +1,3 @@
1
- import '../wasm/wasm_exec.js';
2
1
  import { Environment } from '@getpara/core-sdk';
3
2
  export interface Message {
4
3
  env: Environment;
@@ -13,7 +12,16 @@ export interface Message {
13
12
  disableWebSockets?: boolean;
14
13
  wasmOverride?: ArrayBuffer;
15
14
  returnObject?: boolean;
15
+ workId?: string;
16
16
  }
17
+ /**
18
+ * Executes an operation with retry capabilities
19
+ * @param operation The function to execute
20
+ * @param maxRetries Maximum number of retries (default: 2)
21
+ * @param timeoutMs Timeout in milliseconds (default: 10000)
22
+ * @returns The result of the operation
23
+ */
24
+ export declare function withRetry<T>(operation: () => Promise<T>, maxRetries?: number, timeoutMs?: number): Promise<T>;
17
25
  export declare function handleMessage(e: {
18
26
  data: Message;
19
27
  }, postMessage: (message: any) => void, useFetchAdapter?: boolean): Promise<boolean>;
@@ -19,22 +19,40 @@ var __async = (__this, __arguments, generator) => {
19
19
  step((generator = generator.apply(__this, __arguments)).next());
20
20
  });
21
21
  };
22
- import "../wasm/wasm_exec.js";
23
22
  import * as walletUtils from "./walletUtils.js";
24
- import { getPortalBaseURL, initClient, mpcComputationClient, paraVersion } from "@getpara/core-sdk";
23
+ import {
24
+ getBaseMPCNetworkUrl,
25
+ getPortalBaseURL,
26
+ initClient,
27
+ mpcComputationClient,
28
+ paraVersion
29
+ } from "@getpara/core-sdk";
30
+ let wasmLoaded = false;
31
+ function tryFetchWasm(url) {
32
+ return __async(this, null, function* () {
33
+ const response = yield fetch(url, { mode: "cors" });
34
+ const buffer = yield response.arrayBuffer();
35
+ const view = new Uint8Array(buffer);
36
+ if (view.length >= 4 && view[0] === 0 && view[1] === 97 && view[2] === 115 && view[3] === 109) {
37
+ return buffer;
38
+ }
39
+ throw new Error("invalid WASM magic bytes - possibly compressed data without proper Content-Encoding");
40
+ });
41
+ }
25
42
  function loadWasm(ctx, wasmOverride) {
26
43
  return __async(this, null, function* () {
27
44
  if (typeof self === "undefined") {
28
45
  return;
29
46
  }
47
+ yield import("../wasm/wasm_exec.js");
30
48
  const goWasm = new self.Go();
31
49
  let wasmArrayBuffer = wasmOverride;
32
50
  if (!wasmArrayBuffer) {
33
51
  if (process.env.DISABLE_WASM_FETCH === "true") {
34
52
  throw new Error("fetching wasm file is disabled");
35
53
  }
36
- const fetchedWasm = yield fetch(`${getPortalBaseURL(ctx)}/static/js/main.wasm`, { mode: "cors" });
37
- wasmArrayBuffer = yield fetchedWasm.arrayBuffer();
54
+ const wasmUrl = `${getPortalBaseURL(ctx)}/static/js/main.wasm`;
55
+ wasmArrayBuffer = yield tryFetchWasm(`${wasmUrl}.br`).catch(() => tryFetchWasm(`${wasmUrl}.gz`)).catch(() => tryFetchWasm(wasmUrl));
38
56
  }
39
57
  const newRes = yield WebAssembly.instantiate(wasmArrayBuffer, goWasm.importObject);
40
58
  goWasm.run(newRes.instance);
@@ -44,6 +62,9 @@ function executeMessage(ctx, message) {
44
62
  return __async(this, null, function* () {
45
63
  const { functionType, params, returnObject } = message;
46
64
  switch (functionType) {
65
+ case "INIT": {
66
+ return {};
67
+ }
47
68
  case "KEYGEN": {
48
69
  const { userId, secretKey, type = "EVM" } = params;
49
70
  const keygenRes = yield walletUtils.keygen(ctx, userId, type, secretKey);
@@ -51,15 +72,15 @@ function executeMessage(ctx, message) {
51
72
  }
52
73
  case "SIGN_TRANSACTION": {
53
74
  const { share, walletId, userId, tx, chainId } = params;
54
- return walletUtils.signTransaction(ctx, share, walletId, userId, tx, chainId);
75
+ return withRetry(() => walletUtils.signTransaction(ctx, share, walletId, userId, tx, chainId));
55
76
  }
56
77
  case "SEND_TRANSACTION": {
57
78
  const { share, walletId, userId, tx, chainId } = params;
58
- return walletUtils.sendTransaction(ctx, share, walletId, userId, tx, chainId);
79
+ return withRetry(() => walletUtils.sendTransaction(ctx, share, walletId, userId, tx, chainId));
59
80
  }
60
81
  case "SIGN_MESSAGE": {
61
82
  const { share, walletId, userId, message: message2, cosmosSignDoc } = params;
62
- return walletUtils.signMessage(ctx, share, walletId, userId, message2, cosmosSignDoc);
83
+ return withRetry(() => walletUtils.signMessage(ctx, share, walletId, userId, message2, cosmosSignDoc));
63
84
  }
64
85
  case "REFRESH": {
65
86
  const { share, walletId, userId, oldPartnerId, newPartnerId, keyShareProtocolId } = params;
@@ -86,7 +107,8 @@ function executeMessage(ctx, message) {
86
107
  }
87
108
  case "GET_PRIVATE_KEY": {
88
109
  const { share, walletId, userId } = params;
89
- return yield walletUtils.getPrivateKey(ctx, share, walletId, userId);
110
+ const privateKey = yield walletUtils.getPrivateKey(ctx, share, walletId, userId);
111
+ return { privateKey };
90
112
  }
91
113
  case "ED25519_KEYGEN": {
92
114
  const { userId } = params;
@@ -94,7 +116,7 @@ function executeMessage(ctx, message) {
94
116
  }
95
117
  case "ED25519_SIGN": {
96
118
  const { share, walletId, userId, base64Bytes } = params;
97
- return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes);
119
+ return withRetry(() => walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes));
98
120
  }
99
121
  case "ED25519_PREKEYGEN": {
100
122
  const { email } = params;
@@ -111,6 +133,29 @@ function executeMessage(ctx, message) {
111
133
  }
112
134
  });
113
135
  }
136
+ function withRetry(operation, maxRetries = 2, timeoutMs = 1e4) {
137
+ return __async(this, null, function* () {
138
+ let retries = 0;
139
+ while (true) {
140
+ try {
141
+ const operationPromise = operation();
142
+ const timeoutPromise = new Promise((_, reject) => {
143
+ const timeoutId = setTimeout(() => {
144
+ reject(new Error(`Operation timed out after ${timeoutMs}ms`));
145
+ }, timeoutMs);
146
+ operationPromise.finally(() => clearTimeout(timeoutId));
147
+ });
148
+ return yield Promise.race([operationPromise, timeoutPromise]);
149
+ } catch (error) {
150
+ retries++;
151
+ if (retries > maxRetries) {
152
+ throw error;
153
+ }
154
+ console.warn(`Operation failed (attempt ${retries}/${maxRetries}), retrying...`, error);
155
+ }
156
+ }
157
+ });
158
+ }
114
159
  function handleMessage(e, postMessage, useFetchAdapter) {
115
160
  return __async(this, null, function* () {
116
161
  const {
@@ -122,7 +167,8 @@ function handleMessage(e, postMessage, useFetchAdapter) {
122
167
  sessionCookie,
123
168
  useDKLS,
124
169
  disableWebSockets,
125
- wasmOverride
170
+ wasmOverride,
171
+ workId
126
172
  } = e.data;
127
173
  if (!env) {
128
174
  return true;
@@ -144,14 +190,33 @@ function handleMessage(e, postMessage, useFetchAdapter) {
144
190
  disableWebSockets: !!disableWebSockets,
145
191
  wasmOverride
146
192
  };
147
- if (!ctx.offloadMPCComputationURL || ctx.useDKLS) {
193
+ if (!wasmLoaded && (!ctx.offloadMPCComputationURL || ctx.useDKLS)) {
148
194
  yield loadWasm(ctx, wasmOverride);
195
+ const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
196
+ if (globalThis.initWasm) {
197
+ yield new Promise(
198
+ (resolve, reject) => {
199
+ var _a;
200
+ return (_a = globalThis.initWasm) == null ? void 0 : _a.call(globalThis, (err, result2) => {
201
+ if (err) {
202
+ reject(err);
203
+ }
204
+ resolve(result2);
205
+ }, serverUrl);
206
+ }
207
+ );
208
+ }
209
+ wasmLoaded = true;
149
210
  }
150
211
  const result = yield executeMessage(ctx, e.data);
212
+ if (workId) {
213
+ result.workId = workId;
214
+ }
151
215
  postMessage(result);
152
- return false;
216
+ return !!workId;
153
217
  });
154
218
  }
155
219
  export {
156
- handleMessage
220
+ handleMessage,
221
+ withRetry
157
222
  };
@@ -3,4 +3,4 @@ export interface SyncWorker {
3
3
  postMessage: (message: any) => void;
4
4
  terminate: () => void;
5
5
  }
6
- export declare function setupWorker(ctx: Ctx, resFunction: (arg: any) => void): Promise<Worker | SyncWorker>;
6
+ export declare function setupWorker(ctx: Ctx, resFunction: (arg: any) => Promise<void>, errorFunction: (err: Error) => void, workId: string, errorContext?: object): Promise<Worker | SyncWorker>;
@@ -1,23 +1,35 @@
1
1
  "use client";
2
2
  import {
3
3
  __async
4
- } from "../chunk-M66XENHI.js";
4
+ } from "../chunk-YJOFEY2L.js";
5
5
  import { getPortalBaseURL } from "@getpara/core-sdk";
6
6
  import { handleMessage } from "./worker.js";
7
- function setupWorker(ctx, resFunction) {
7
+ const CLEAR_WORKER_TIMEOUT_MS = 1e3 * 90;
8
+ let workerInstance;
9
+ const resFunctionMap = {};
10
+ function removeWorkId(workId, skipClearTimeout) {
11
+ const { timeoutId } = resFunctionMap[workId];
12
+ delete resFunctionMap[workId];
13
+ if (skipClearTimeout) {
14
+ return;
15
+ }
16
+ clearTimeout(timeoutId);
17
+ }
18
+ function setupWorker(ctx, resFunction, errorFunction, workId, errorContext) {
8
19
  return __async(this, null, function* () {
9
- const onmessage = (event) => {
10
- if (event.data.functionType === "CUSTOM") {
11
- return;
12
- }
13
- resFunction(event.data);
14
- };
15
20
  if (ctx.disableWorkers) {
16
21
  const syncWorker = {
17
22
  postMessage: function(message) {
18
23
  (function() {
19
24
  return __async(this, null, function* () {
20
- yield handleMessage({ data: message }, (data) => onmessage({ data }), ctx.disableWorkers);
25
+ try {
26
+ const onmessage = (event) => {
27
+ resFunction(event.data);
28
+ };
29
+ yield handleMessage({ data: message }, (data) => onmessage({ data }), ctx.disableWorkers);
30
+ } catch (error) {
31
+ errorFunction(error);
32
+ }
21
33
  });
22
34
  })();
23
35
  },
@@ -27,17 +39,45 @@ function setupWorker(ctx, resFunction) {
27
39
  };
28
40
  return syncWorker;
29
41
  }
30
- let worker;
42
+ const timeoutId = setTimeout(() => {
43
+ removeWorkId(workId, true);
44
+ }, CLEAR_WORKER_TIMEOUT_MS);
45
+ resFunctionMap[workId] = {
46
+ fn: resFunction,
47
+ timeoutId,
48
+ errorFn: errorFunction,
49
+ errorContext: errorContext || {}
50
+ };
31
51
  if (ctx.useLocalFiles) {
32
52
  throw new Error("useLocalFiles only supported locally");
33
- } else {
53
+ } else if (!workerInstance) {
34
54
  const workerRes = yield fetch(`${getPortalBaseURL(ctx)}/static/js/mpcWorker-bundle.js`);
35
55
  const workerBlob = new Blob([yield workerRes.text()], { type: "application/javascript" });
36
56
  const workerScriptURL = URL.createObjectURL(workerBlob);
37
- worker = new Worker(workerScriptURL);
57
+ workerInstance = new Worker(workerScriptURL);
58
+ const onmessage = (event) => __async(this, null, function* () {
59
+ const { workId: messageWorkId } = event.data;
60
+ delete event.data.workId;
61
+ if (messageWorkId && resFunctionMap[messageWorkId]) {
62
+ yield resFunctionMap[messageWorkId].fn(event.data);
63
+ removeWorkId(messageWorkId);
64
+ }
65
+ });
66
+ workerInstance.onmessage = onmessage;
67
+ workerInstance.onerror = (err) => {
68
+ console.error("worker error:", err);
69
+ Object.keys(resFunctionMap).forEach((id) => {
70
+ if (resFunctionMap[id]) {
71
+ const errorMsg = `worker error with workId ${id} and opts ${JSON.stringify(resFunctionMap[id].errorContext)}: ${err.message}`;
72
+ resFunctionMap[id].errorFn(new Error(errorMsg));
73
+ removeWorkId(id);
74
+ }
75
+ });
76
+ workerInstance == null ? void 0 : workerInstance.terminate();
77
+ workerInstance = void 0;
78
+ };
38
79
  }
39
- worker.onmessage = onmessage;
40
- return worker;
80
+ return workerInstance;
41
81
  });
42
82
  }
43
83
  export {
package/package.json CHANGED
@@ -1,40 +1,45 @@
1
1
  {
2
2
  "name": "@getpara/web-sdk",
3
- "version": "2.0.0-alpha.7",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "sideEffects": [
8
- "wasm_exec.js"
9
- ],
3
+ "version": "2.0.0-alpha.70",
10
4
  "dependencies": {
11
- "@getpara/core-sdk": "2.0.0-alpha.7",
12
- "@getpara/user-management-client": "2.0.0-alpha.7",
13
- "@sentry/browser": "^9.1.0",
14
- "base64url": "3.0.1",
5
+ "@getpara/core-sdk": "2.0.0-alpha.70",
6
+ "@getpara/user-management-client": "2.0.0-alpha.70",
7
+ "base64url": "^3.0.1",
15
8
  "buffer": "6.0.3",
16
- "cbor-web": "8.1.0",
9
+ "cbor-web": "^9.0.2",
17
10
  "node-forge": "1.3.1",
18
11
  "ua-parser-js": "^2.0.2"
19
12
  },
20
- "scripts": {
21
- "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs && yarn post-build",
22
- "typegen": "tsc --emitDeclarationOnly",
23
- "old-build": "rm -rf dist && tsc && yarn post-build",
24
- "post-build": "./scripts/post-build.sh",
25
- "test": "vitest run --coverage"
26
- },
27
13
  "devDependencies": {
28
14
  "@types/node-forge": "1.3.1",
29
- "crypto-browserify": "3.12.0",
30
- "stream-browserify": "3.0.0",
31
- "typescript": "5.1.6",
32
- "webpack": "5.76.3",
33
- "webpack-cli": "5.0.1"
15
+ "crypto-browserify": "^3.12.0",
16
+ "stream-browserify": "^3.0.0",
17
+ "typescript": "^5.8.3"
18
+ },
19
+ "peerDependencies": {
20
+ "@farcaster/miniapp-sdk": "^0.1.2"
21
+ },
22
+ "peerDependenciesMeta": {
23
+ "@farcaster/miniapp-sdk": {
24
+ "optional": true
25
+ }
34
26
  },
35
27
  "files": [
36
28
  "dist",
37
29
  "package.json"
38
30
  ],
39
- "gitHead": "0a6b297b70c7f9b7b93381944e3f5314252ad6a5"
31
+ "gitHead": "99d44cff3c68c07dc1cd8c2709b6ca4cd57dca61",
32
+ "main": "dist/index.js",
33
+ "scripts": {
34
+ "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs && yarn post-build",
35
+ "old-build": "rm -rf dist && tsc && yarn post-build",
36
+ "post-build": "./scripts/post-build.sh",
37
+ "test": "vitest run --coverage",
38
+ "typegen": "tsc --emitDeclarationOnly"
39
+ },
40
+ "sideEffects": [
41
+ "wasm_exec.js"
42
+ ],
43
+ "type": "module",
44
+ "types": "dist/index.d.ts"
40
45
  }
@@ -1,25 +0,0 @@
1
- "use client";
2
- var __async = (__this, __arguments, generator) => {
3
- return new Promise((resolve, reject) => {
4
- var fulfilled = (value) => {
5
- try {
6
- step(generator.next(value));
7
- } catch (e) {
8
- reject(e);
9
- }
10
- };
11
- var rejected = (value) => {
12
- try {
13
- step(generator.throw(value));
14
- } catch (e) {
15
- reject(e);
16
- }
17
- };
18
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
19
- step((generator = generator.apply(__this, __arguments)).next());
20
- });
21
- };
22
-
23
- export {
24
- __async
25
- };