@dynamic-labs-wallet/core 0.0.45 → 0.0.47

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.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var axios = require('axios');
4
+ var viem = require('viem');
4
5
 
5
6
  const DYNAMIC_AUTH_PROD_BASE_API_URL = 'https://app.dynamicauth.com';
6
7
  const DYNAMIC_AUTH_PREPROD_BASE_API_URL = 'https://app.dynamic-preprod.xyz';
@@ -268,6 +269,13 @@ class BaseClient {
268
269
  }
269
270
  }
270
271
 
272
+ var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
273
+ SuccessEventType["KeygenComplete"] = "keygen_complete";
274
+ SuccessEventType["RoomCreated"] = "room_created";
275
+ SuccessEventType["CeremonyComplete"] = "ceremony_complete";
276
+ return SuccessEventType;
277
+ }({});
278
+
271
279
  /**
272
280
  * Creates a promise that resolves when a specific event is received from an event stream.
273
281
  * Adds a timeout to prevent hanging and races the two promises.
@@ -276,7 +284,7 @@ class BaseClient {
276
284
  * @param apiClient The axios instance to use for API calls
277
285
  * @param options The configuration options
278
286
  * @returns A promise that resolves with the event data or rejects on timeout
279
- */ const createEventStreamPromise = ({ apiClient, endpoint, body, successEventType, timeoutMs = 30000, timeoutMessage, onError })=>{
287
+ */ const createEventStreamPromise = ({ apiClient, endpoint, body, successEventType, timeoutMs = 30000, timeoutMessage, onError, onCeremonyComplete })=>{
280
288
  // Create a promise that will resolve when the success event is received
281
289
  const eventPromise = new Promise((resolve, reject)=>{
282
290
  apiClient.post(endpoint, body, {
@@ -291,7 +299,8 @@ class BaseClient {
291
299
  onError,
292
300
  reject,
293
301
  resolve,
294
- successEventType
302
+ successEventType,
303
+ onCeremonyComplete
295
304
  })).catch(reject);
296
305
  });
297
306
  // Add a timeout to prevent hanging
@@ -315,7 +324,7 @@ class BaseClient {
315
324
  * @param {string} successEventType - The event type string that indicates a successful operation
316
325
  * @param {function} [onError] - Optional callback for error handling, allowing custom error processing
317
326
  * @returns {function} A response handler function that processes the event stream
318
- */ const createSuccessErrorEventStreamHandler = ({ resolve, reject, successEventType, onError })=>{
327
+ */ const createSuccessErrorEventStreamHandler = ({ resolve, reject, successEventType, onError, onCeremonyComplete })=>{
319
328
  return (response)=>{
320
329
  const reader = response.data.getReader();
321
330
  const decoder = new TextDecoder();
@@ -332,6 +341,10 @@ class BaseClient {
332
341
  if (event.type === successEventType) {
333
342
  resolve(event.data);
334
343
  }
344
+ if (event.type === SuccessEventType.CeremonyComplete) {
345
+ const { accountAddress, walletId } = event.data;
346
+ onCeremonyComplete == null ? void 0 : onCeremonyComplete(viem.getAddress(accountAddress), walletId);
347
+ }
335
348
  if (event.type === 'error') {
336
349
  reject(createErrorFromEventData(event.data));
337
350
  onError == null ? void 0 : onError(createErrorFromEventData(event.data));
@@ -394,14 +407,8 @@ class BaseClient {
394
407
  return events;
395
408
  };
396
409
 
397
- var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
398
- SuccessEventType["KeygenComplete"] = "keygen_complete";
399
- SuccessEventType["RoomCreated"] = "room_created";
400
- return SuccessEventType;
401
- }({});
402
-
403
410
  class DynamicApiClient extends BaseClient {
404
- async createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError }) {
411
+ async createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
405
412
  return createEventStreamPromise({
406
413
  apiClient: this.apiClient,
407
414
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/create`,
@@ -412,7 +419,8 @@ class DynamicApiClient extends BaseClient {
412
419
  },
413
420
  successEventType: SuccessEventType.KeygenComplete,
414
421
  timeoutMessage: 'Wallet creation timed out',
415
- onError
422
+ onError,
423
+ onCeremonyComplete
416
424
  });
417
425
  }
418
426
  async signMessage({ walletId, message, onError }) {
@@ -487,7 +495,7 @@ class DynamicApiClient extends BaseClient {
487
495
  return data.accessToken;
488
496
  }
489
497
  // TODO: return array instead considering cases where server has multiple parties
490
- async importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError }) {
498
+ async importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
491
499
  return createEventStreamPromise({
492
500
  apiClient: this.apiClient,
493
501
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/privateKey/import`,
@@ -498,7 +506,8 @@ class DynamicApiClient extends BaseClient {
498
506
  },
499
507
  successEventType: SuccessEventType.KeygenComplete,
500
508
  timeoutMessage: 'Key import timed out',
501
- onError
509
+ onError,
510
+ onCeremonyComplete
502
511
  });
503
512
  }
504
513
  // TODO: consider removing the retry logics if we switch to server-sent events
package/index.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import axios from 'axios';
2
+ import { getAddress } from 'viem';
2
3
 
3
4
  const DYNAMIC_AUTH_PROD_BASE_API_URL = 'https://app.dynamicauth.com';
4
5
  const DYNAMIC_AUTH_PREPROD_BASE_API_URL = 'https://app.dynamic-preprod.xyz';
@@ -266,6 +267,13 @@ class BaseClient {
266
267
  }
267
268
  }
268
269
 
270
+ var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
271
+ SuccessEventType["KeygenComplete"] = "keygen_complete";
272
+ SuccessEventType["RoomCreated"] = "room_created";
273
+ SuccessEventType["CeremonyComplete"] = "ceremony_complete";
274
+ return SuccessEventType;
275
+ }({});
276
+
269
277
  /**
270
278
  * Creates a promise that resolves when a specific event is received from an event stream.
271
279
  * Adds a timeout to prevent hanging and races the two promises.
@@ -274,7 +282,7 @@ class BaseClient {
274
282
  * @param apiClient The axios instance to use for API calls
275
283
  * @param options The configuration options
276
284
  * @returns A promise that resolves with the event data or rejects on timeout
277
- */ const createEventStreamPromise = ({ apiClient, endpoint, body, successEventType, timeoutMs = 30000, timeoutMessage, onError })=>{
285
+ */ const createEventStreamPromise = ({ apiClient, endpoint, body, successEventType, timeoutMs = 30000, timeoutMessage, onError, onCeremonyComplete })=>{
278
286
  // Create a promise that will resolve when the success event is received
279
287
  const eventPromise = new Promise((resolve, reject)=>{
280
288
  apiClient.post(endpoint, body, {
@@ -289,7 +297,8 @@ class BaseClient {
289
297
  onError,
290
298
  reject,
291
299
  resolve,
292
- successEventType
300
+ successEventType,
301
+ onCeremonyComplete
293
302
  })).catch(reject);
294
303
  });
295
304
  // Add a timeout to prevent hanging
@@ -313,7 +322,7 @@ class BaseClient {
313
322
  * @param {string} successEventType - The event type string that indicates a successful operation
314
323
  * @param {function} [onError] - Optional callback for error handling, allowing custom error processing
315
324
  * @returns {function} A response handler function that processes the event stream
316
- */ const createSuccessErrorEventStreamHandler = ({ resolve, reject, successEventType, onError })=>{
325
+ */ const createSuccessErrorEventStreamHandler = ({ resolve, reject, successEventType, onError, onCeremonyComplete })=>{
317
326
  return (response)=>{
318
327
  const reader = response.data.getReader();
319
328
  const decoder = new TextDecoder();
@@ -330,6 +339,10 @@ class BaseClient {
330
339
  if (event.type === successEventType) {
331
340
  resolve(event.data);
332
341
  }
342
+ if (event.type === SuccessEventType.CeremonyComplete) {
343
+ const { accountAddress, walletId } = event.data;
344
+ onCeremonyComplete == null ? void 0 : onCeremonyComplete(getAddress(accountAddress), walletId);
345
+ }
333
346
  if (event.type === 'error') {
334
347
  reject(createErrorFromEventData(event.data));
335
348
  onError == null ? void 0 : onError(createErrorFromEventData(event.data));
@@ -392,14 +405,8 @@ class BaseClient {
392
405
  return events;
393
406
  };
394
407
 
395
- var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
396
- SuccessEventType["KeygenComplete"] = "keygen_complete";
397
- SuccessEventType["RoomCreated"] = "room_created";
398
- return SuccessEventType;
399
- }({});
400
-
401
408
  class DynamicApiClient extends BaseClient {
402
- async createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError }) {
409
+ async createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
403
410
  return createEventStreamPromise({
404
411
  apiClient: this.apiClient,
405
412
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/create`,
@@ -410,7 +417,8 @@ class DynamicApiClient extends BaseClient {
410
417
  },
411
418
  successEventType: SuccessEventType.KeygenComplete,
412
419
  timeoutMessage: 'Wallet creation timed out',
413
- onError
420
+ onError,
421
+ onCeremonyComplete
414
422
  });
415
423
  }
416
424
  async signMessage({ walletId, message, onError }) {
@@ -485,7 +493,7 @@ class DynamicApiClient extends BaseClient {
485
493
  return data.accessToken;
486
494
  }
487
495
  // TODO: return array instead considering cases where server has multiple parties
488
- async importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError }) {
496
+ async importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
489
497
  return createEventStreamPromise({
490
498
  apiClient: this.apiClient,
491
499
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/privateKey/import`,
@@ -496,7 +504,8 @@ class DynamicApiClient extends BaseClient {
496
504
  },
497
505
  successEventType: SuccessEventType.KeygenComplete,
498
506
  timeoutMessage: 'Key import timed out',
499
- onError
507
+ onError,
508
+ onCeremonyComplete
500
509
  });
501
510
  }
502
511
  // TODO: consider removing the retry logics if we switch to server-sent events
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/core",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "axios": "1.7.9"
6
+ "axios": "1.7.9",
7
+ "viem": "^2.22.1"
7
8
  },
8
9
  "files": [
9
10
  "*",
package/src/api/api.d.ts CHANGED
@@ -7,18 +7,19 @@ export declare class DynamicApiClient extends BaseClient {
7
7
  authToken: string;
8
8
  baseApiUrl?: string;
9
9
  });
10
- createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, }: {
10
+ createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
11
11
  chainName: string;
12
12
  clientKeygenIds: string[];
13
13
  thresholdSignatureScheme: ThresholdSignatureScheme;
14
14
  onError?: (error: Error) => void;
15
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
15
16
  }): Promise<KeygenCompleteResponse>;
16
17
  signMessage({ walletId, message, onError, }: {
17
18
  walletId: string;
18
19
  message: string;
19
20
  onError?: (error: Error) => void;
20
21
  }): Promise<OpenRoomResponse>;
21
- refreshWalletAccountShares({ walletId, onError }: {
22
+ refreshWalletAccountShares({ walletId, onError, }: {
22
23
  walletId: string;
23
24
  onError?: (error: Error) => void;
24
25
  }): Promise<{
@@ -52,11 +53,12 @@ export declare class DynamicApiClient extends BaseClient {
52
53
  getAccessToken({ oauthAccountId }: {
53
54
  oauthAccountId: string;
54
55
  }): Promise<any>;
55
- importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, }: {
56
+ importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
56
57
  chainName: string;
57
58
  clientKeygenIds: string[];
58
59
  thresholdSignatureScheme: ThresholdSignatureScheme;
59
60
  onError?: (error: Error) => void;
61
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
60
62
  }): Promise<KeygenCompleteResponse>;
61
63
  getUser(): Promise<any>;
62
64
  refreshUser(): Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAoB,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAGtH,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,EACV,aAAa,EACb,SAAS,EACT,UAAU,GACX,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,C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AK,EAAE,KAAK,KAAK,IAAI,CAAC;KAClC;IAaK,4BAA4B,CAAC,EACjC,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,GAClB,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE,MAAM,EAAE,CAAC;QAC7B,iBAAiB,EAAE,OAAO,CAAC;KAC5B;IAYK,kCAAkC,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE;IASrE,8BAA8B,CAAC,EACnC,QAAQ,EACR,WAAW,GACZ,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;IAQK,cAAc,CAAC,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;IAS7D,gBAAgB,CAAC,EACrB,SAAS,EACT,eAAe,EACf,wBAAwB,EACxB,OAAO,EACP,kBAAkB,GACnB,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;QACjC,kBAAkB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;KACzE;IAiBK,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAsBvB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;CAqBlC"}
@@ -1,5 +1,5 @@
1
1
  import type { AxiosInstance } from 'axios';
2
- import type { SuccessEventType } from '../types';
2
+ import { SuccessEventType } from '../types';
3
3
  /**
4
4
  * Creates a promise that resolves when a specific event is received from an event stream.
5
5
  * Adds a timeout to prevent hanging and races the two promises.
@@ -9,7 +9,7 @@ import type { SuccessEventType } from '../types';
9
9
  * @param options The configuration options
10
10
  * @returns A promise that resolves with the event data or rejects on timeout
11
11
  */
12
- export declare const createEventStreamPromise: <T>({ apiClient, endpoint, body, successEventType, timeoutMs, timeoutMessage, onError, }: {
12
+ export declare const createEventStreamPromise: <T>({ apiClient, endpoint, body, successEventType, timeoutMs, timeoutMessage, onError, onCeremonyComplete, }: {
13
13
  apiClient: AxiosInstance;
14
14
  endpoint: string;
15
15
  body: Record<string, unknown> | undefined;
@@ -17,6 +17,7 @@ export declare const createEventStreamPromise: <T>({ apiClient, endpoint, body,
17
17
  timeoutMs?: number;
18
18
  timeoutMessage: string;
19
19
  onError?: (error: Error) => void;
20
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
20
21
  }) => Promise<T>;
21
22
  /**
22
23
  * Creates a handler function for processing server-sent events (SSE) streams.
@@ -30,11 +31,12 @@ export declare const createEventStreamPromise: <T>({ apiClient, endpoint, body,
30
31
  * @param {function} [onError] - Optional callback for error handling, allowing custom error processing
31
32
  * @returns {function} A response handler function that processes the event stream
32
33
  */
33
- export declare const createSuccessErrorEventStreamHandler: <T>({ resolve, reject, successEventType, onError, }: {
34
+ export declare const createSuccessErrorEventStreamHandler: <T>({ resolve, reject, successEventType, onError, onCeremonyComplete, }: {
34
35
  resolve: (data: T) => void;
35
36
  reject: (error: Error) => void;
36
37
  successEventType: string;
37
38
  onError?: (error: Error) => void;
39
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
38
40
  }) => (response: {
39
41
  data: {
40
42
  getReader: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/eventStream/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,wFAQvC;IACD,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;I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M,gBAAgB,kEAG1B;IACD,2BAA2B,EAAE,wBAAwB,CAAC;IACtD,2BAA2B,EAAE,wBAAwB,CAAC;CACvD,KAAG;IACF,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;CAwG7B,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/mpc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,iBAAiB,cAAe,MAAM;;;CAMlD,CAAC;AAEF,eAAO,MAAM,YAAY,6BACG,wBAAwB;;;CAInD,CAAC;AAEF,eAAO,MAAM,kBAAkB,6BACH,wBAAwB,WAGnD,CAAC;AAEF,eAAO,MAAM,yBAAyB,6BACV,wBAAwB,WAGnD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,kEAG1B;IACD,2BAA2B,EAAE,wBAAwB,CAAC;IACtD,2BAA2B,EAAE,wBAAwB,CAAC;CACvD,KAAG;IACF,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;CA6G7B,CAAC"}
package/src/types.d.ts CHANGED
@@ -22,6 +22,7 @@ export type ReshareResponse = {
22
22
  };
23
23
  export declare enum SuccessEventType {
24
24
  KeygenComplete = "keygen_complete",
25
- RoomCreated = "room_created"
25
+ RoomCreated = "room_created",
26
+ CeremonyComplete = "ceremony_complete"
26
27
  }
27
28
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAA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