@dynamic-labs-wallet/core 0.0.17 → 0.0.19

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
@@ -91,13 +91,6 @@ const MPC_CHAIN_CONFIG = {
91
91
  signingAlgorithm: "ED25519"
92
92
  }
93
93
  };
94
- const getMPCChainConfig = (chainName)=>{
95
- const chainConfig = MPC_CHAIN_CONFIG[chainName];
96
- if (!chainConfig) {
97
- throw new Error(`Chain ${chainName} not supported`);
98
- }
99
- return chainConfig;
100
- };
101
94
  var ThresholdSignatureScheme = /*#__PURE__*/ function(ThresholdSignatureScheme) {
102
95
  ThresholdSignatureScheme["TWO_OF_TWO"] = "TWO_OF_TWO";
103
96
  ThresholdSignatureScheme["TWO_OF_THREE"] = "TWO_OF_THREE";
@@ -129,6 +122,14 @@ var CreateRoomPartiesOptions = /*#__PURE__*/ function(CreateRoomPartiesOptions)
129
122
  CreateRoomPartiesOptions["FULL"] = "full";
130
123
  return CreateRoomPartiesOptions;
131
124
  }({});
125
+
126
+ const getMPCChainConfig = (chainName)=>{
127
+ const chainConfig = MPC_CHAIN_CONFIG[chainName];
128
+ if (!chainConfig) {
129
+ throw new Error(`Chain ${chainName} not supported`);
130
+ }
131
+ return chainConfig;
132
+ };
132
133
  const getTSSConfig = (thresholdSignatureScheme)=>{
133
134
  const { threshold, numberOfParties } = MPC_CONFIG[thresholdSignatureScheme];
134
135
  return {
@@ -142,6 +143,82 @@ const getClientThreshold = (thresholdSignatureScheme)=>{
142
143
  const getDynamicServerThreshold = (thresholdSignatureScheme)=>{
143
144
  return MPC_CONFIG[thresholdSignatureScheme].dynamicServerThreshold;
144
145
  };
146
+ /**
147
+ * Helper function to get the reshare config for client and server shares
148
+ * @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
149
+ * @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
150
+ * @returns {{
151
+ * existingClientShareCount: number,
152
+ * newClientShareCount: number,
153
+ * existingServerShareCount: number,
154
+ * newServerShareCount: number
155
+ * }} The number of existing and new client and server shares needed
156
+ */ const getReshareConfig = ({ oldThresholdSignatureScheme, newThresholdSignatureScheme })=>{
157
+ switch(true){
158
+ // 2-of-2 -> 2-of-2:
159
+ // -- server shares: 1 existing, 0 new
160
+ // -- client shares: 1 existing, 1 new
161
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO && newThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO:
162
+ return {
163
+ existingClientShareCount: 1,
164
+ newClientShareCount: 1,
165
+ existingServerShareCount: 1,
166
+ newServerShareCount: 0
167
+ };
168
+ // 2-of-3 -> 2-of-3:
169
+ // -- server shares: 1 existing, 0 new
170
+ // -- client shares: 1 existing, 1 new
171
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE && newThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE:
172
+ return {
173
+ existingClientShareCount: 1,
174
+ newClientShareCount: 1,
175
+ existingServerShareCount: 1,
176
+ newServerShareCount: 0
177
+ };
178
+ // 3-of-5 -> 3-of-5:
179
+ // -- server shares: 2 existing, 0 new
180
+ // -- client shares: 1 existing, 2 new
181
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE && newThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE:
182
+ return {
183
+ existingClientShareCount: 1,
184
+ newClientShareCount: 2,
185
+ existingServerShareCount: 2,
186
+ newServerShareCount: 0
187
+ };
188
+ // 2-of-2 -> 2-of-3:
189
+ // -- server shares: 1 existing, 0 new
190
+ // -- client shares: 1 existing, 1 new
191
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO && newThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE:
192
+ return {
193
+ existingClientShareCount: 1,
194
+ newClientShareCount: 1,
195
+ existingServerShareCount: 1,
196
+ newServerShareCount: 0
197
+ };
198
+ // 2-of-2 -> 3-of-5:
199
+ // -- server shares: 1 existing, 1 new
200
+ // -- client shares: 1 existing, 2 new
201
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO && newThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE:
202
+ return {
203
+ existingClientShareCount: 1,
204
+ newClientShareCount: 2,
205
+ existingServerShareCount: 1,
206
+ newServerShareCount: 1
207
+ };
208
+ // 2-of-3 -> 3-of-5:
209
+ // -- server shares: 1 existing, 1 new
210
+ // -- client shares: 1 existing, 2 new
211
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE && newThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE:
212
+ return {
213
+ existingClientShareCount: 1,
214
+ newClientShareCount: 2,
215
+ existingServerShareCount: 1,
216
+ newServerShareCount: 1
217
+ };
218
+ default:
219
+ throw new Error(`Unsupported reshare from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
220
+ }
221
+ };
145
222
 
146
223
  class BaseClient {
147
224
  constructor({ environmentId, baseApiUrl, authToken, baseClientRelayApiUrl }){
@@ -165,7 +242,7 @@ class BaseClient {
165
242
 
166
243
  class DynamicApiClient extends BaseClient {
167
244
  async createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme }) {
168
- // Initilize keygen, create room, and create the wallet account on the server
245
+ // Initialize keygen, create room, and create the wallet account on the server
169
246
  const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/create`, {
170
247
  chain: chainName,
171
248
  clientKeygenIds,
@@ -183,9 +260,11 @@ class DynamicApiClient extends BaseClient {
183
260
  const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/refresh`);
184
261
  return data;
185
262
  }
186
- async reshareRemainingParty({ walletId, clientKeygenIds }) {
263
+ async reshare({ walletId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme }) {
187
264
  const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/reshare`, {
188
- clientKeygenIds
265
+ clientKeygenIds,
266
+ oldThresholdSignatureScheme,
267
+ newThresholdSignatureScheme
189
268
  });
190
269
  return data;
191
270
  }
@@ -256,4 +335,5 @@ exports.ThresholdSignatureScheme = ThresholdSignatureScheme;
256
335
  exports.getClientThreshold = getClientThreshold;
257
336
  exports.getDynamicServerThreshold = getDynamicServerThreshold;
258
337
  exports.getMPCChainConfig = getMPCChainConfig;
338
+ exports.getReshareConfig = getReshareConfig;
259
339
  exports.getTSSConfig = getTSSConfig;
package/index.esm.js CHANGED
@@ -89,13 +89,6 @@ const MPC_CHAIN_CONFIG = {
89
89
  signingAlgorithm: "ED25519"
90
90
  }
91
91
  };
92
- const getMPCChainConfig = (chainName)=>{
93
- const chainConfig = MPC_CHAIN_CONFIG[chainName];
94
- if (!chainConfig) {
95
- throw new Error(`Chain ${chainName} not supported`);
96
- }
97
- return chainConfig;
98
- };
99
92
  var ThresholdSignatureScheme = /*#__PURE__*/ function(ThresholdSignatureScheme) {
100
93
  ThresholdSignatureScheme["TWO_OF_TWO"] = "TWO_OF_TWO";
101
94
  ThresholdSignatureScheme["TWO_OF_THREE"] = "TWO_OF_THREE";
@@ -127,6 +120,14 @@ var CreateRoomPartiesOptions = /*#__PURE__*/ function(CreateRoomPartiesOptions)
127
120
  CreateRoomPartiesOptions["FULL"] = "full";
128
121
  return CreateRoomPartiesOptions;
129
122
  }({});
123
+
124
+ const getMPCChainConfig = (chainName)=>{
125
+ const chainConfig = MPC_CHAIN_CONFIG[chainName];
126
+ if (!chainConfig) {
127
+ throw new Error(`Chain ${chainName} not supported`);
128
+ }
129
+ return chainConfig;
130
+ };
130
131
  const getTSSConfig = (thresholdSignatureScheme)=>{
131
132
  const { threshold, numberOfParties } = MPC_CONFIG[thresholdSignatureScheme];
132
133
  return {
@@ -140,6 +141,82 @@ const getClientThreshold = (thresholdSignatureScheme)=>{
140
141
  const getDynamicServerThreshold = (thresholdSignatureScheme)=>{
141
142
  return MPC_CONFIG[thresholdSignatureScheme].dynamicServerThreshold;
142
143
  };
144
+ /**
145
+ * Helper function to get the reshare config for client and server shares
146
+ * @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
147
+ * @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
148
+ * @returns {{
149
+ * existingClientShareCount: number,
150
+ * newClientShareCount: number,
151
+ * existingServerShareCount: number,
152
+ * newServerShareCount: number
153
+ * }} The number of existing and new client and server shares needed
154
+ */ const getReshareConfig = ({ oldThresholdSignatureScheme, newThresholdSignatureScheme })=>{
155
+ switch(true){
156
+ // 2-of-2 -> 2-of-2:
157
+ // -- server shares: 1 existing, 0 new
158
+ // -- client shares: 1 existing, 1 new
159
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO && newThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO:
160
+ return {
161
+ existingClientShareCount: 1,
162
+ newClientShareCount: 1,
163
+ existingServerShareCount: 1,
164
+ newServerShareCount: 0
165
+ };
166
+ // 2-of-3 -> 2-of-3:
167
+ // -- server shares: 1 existing, 0 new
168
+ // -- client shares: 1 existing, 1 new
169
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE && newThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE:
170
+ return {
171
+ existingClientShareCount: 1,
172
+ newClientShareCount: 1,
173
+ existingServerShareCount: 1,
174
+ newServerShareCount: 0
175
+ };
176
+ // 3-of-5 -> 3-of-5:
177
+ // -- server shares: 2 existing, 0 new
178
+ // -- client shares: 1 existing, 2 new
179
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE && newThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE:
180
+ return {
181
+ existingClientShareCount: 1,
182
+ newClientShareCount: 2,
183
+ existingServerShareCount: 2,
184
+ newServerShareCount: 0
185
+ };
186
+ // 2-of-2 -> 2-of-3:
187
+ // -- server shares: 1 existing, 0 new
188
+ // -- client shares: 1 existing, 1 new
189
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO && newThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE:
190
+ return {
191
+ existingClientShareCount: 1,
192
+ newClientShareCount: 1,
193
+ existingServerShareCount: 1,
194
+ newServerShareCount: 0
195
+ };
196
+ // 2-of-2 -> 3-of-5:
197
+ // -- server shares: 1 existing, 1 new
198
+ // -- client shares: 1 existing, 2 new
199
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_TWO && newThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE:
200
+ return {
201
+ existingClientShareCount: 1,
202
+ newClientShareCount: 2,
203
+ existingServerShareCount: 1,
204
+ newServerShareCount: 1
205
+ };
206
+ // 2-of-3 -> 3-of-5:
207
+ // -- server shares: 1 existing, 1 new
208
+ // -- client shares: 1 existing, 2 new
209
+ case oldThresholdSignatureScheme === ThresholdSignatureScheme.TWO_OF_THREE && newThresholdSignatureScheme === ThresholdSignatureScheme.THREE_OF_FIVE:
210
+ return {
211
+ existingClientShareCount: 1,
212
+ newClientShareCount: 2,
213
+ existingServerShareCount: 1,
214
+ newServerShareCount: 1
215
+ };
216
+ default:
217
+ throw new Error(`Unsupported reshare from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
218
+ }
219
+ };
143
220
 
144
221
  class BaseClient {
145
222
  constructor({ environmentId, baseApiUrl, authToken, baseClientRelayApiUrl }){
@@ -163,7 +240,7 @@ class BaseClient {
163
240
 
164
241
  class DynamicApiClient extends BaseClient {
165
242
  async createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme }) {
166
- // Initilize keygen, create room, and create the wallet account on the server
243
+ // Initialize keygen, create room, and create the wallet account on the server
167
244
  const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/create`, {
168
245
  chain: chainName,
169
246
  clientKeygenIds,
@@ -181,9 +258,11 @@ class DynamicApiClient extends BaseClient {
181
258
  const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/refresh`);
182
259
  return data;
183
260
  }
184
- async reshareRemainingParty({ walletId, clientKeygenIds }) {
261
+ async reshare({ walletId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme }) {
185
262
  const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/reshare`, {
186
- clientKeygenIds
263
+ clientKeygenIds,
264
+ oldThresholdSignatureScheme,
265
+ newThresholdSignatureScheme
187
266
  });
188
267
  return data;
189
268
  }
@@ -238,4 +317,4 @@ class DynamicApiClient extends BaseClient {
238
317
  }
239
318
  }
240
319
 
241
- export { BITCOIN_DERIVATION_PATHS, CreateRoomPartiesOptions, DYNAMIC_AUTH_PREPROD_BASE_API_URL, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL, DynamicApiClient, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, SigningAlgorithm, ThresholdSignatureScheme, getClientThreshold, getDynamicServerThreshold, getMPCChainConfig, getTSSConfig };
320
+ export { BITCOIN_DERIVATION_PATHS, CreateRoomPartiesOptions, DYNAMIC_AUTH_PREPROD_BASE_API_URL, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL, DynamicApiClient, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, SigningAlgorithm, ThresholdSignatureScheme, getClientThreshold, getDynamicServerThreshold, getMPCChainConfig, getReshareConfig, getTSSConfig };
package/package.json CHANGED
@@ -1,13 +1,20 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/core",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "dependencies": {
5
5
  "axios": "1.7.9"
6
6
  },
7
+ "files": [
8
+ "*",
9
+ "node_modules/**/*"
10
+ ],
7
11
  "nx": {
8
12
  "sourceRoot": "packages/core/src",
9
13
  "projectType": "library",
10
- "name": "core"
14
+ "name": "core",
15
+ "targets": {
16
+ "build": {}
17
+ }
11
18
  },
12
19
  "type": "module",
13
20
  "main": "./index.cjs.js",
package/src/api/api.d.ts CHANGED
@@ -18,9 +18,11 @@ export declare class DynamicApiClient extends BaseClient {
18
18
  refreshWalletAccountShares({ walletId }: {
19
19
  walletId: string;
20
20
  }): Promise<any>;
21
- reshareRemainingParty({ walletId, clientKeygenIds, }: {
21
+ reshare({ walletId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
22
22
  walletId: string;
23
23
  clientKeygenIds: string[];
24
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
25
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
24
26
  }): Promise<any>;
25
27
  exportKey({ walletId, exportId, }: {
26
28
  walletId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,EACV,aAAa,EACb,SAAS,EACT,UAAU,GACX,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAIK,mBAAmB,CAAC,EACxB,SAAS,EACT,eAAe,EACf,wBAAwB,GACzB,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,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MAAM,EAAE,CAAC;QAC7B,iBAAiB,EAAE,OAAO,CAAC;KAC5B;IAYK,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,GACzB,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAYpD,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAOvB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;CAOlC"}
@@ -12,10 +12,6 @@ export declare const MPC_CHAIN_CONFIG: Record<string, {
12
12
  derivationPath: number[];
13
13
  signingAlgorithm: SigningAlgorithm;
14
14
  }>;
15
- export declare const getMPCChainConfig: (chainName: string) => {
16
- derivationPath: number[];
17
- signingAlgorithm: SigningAlgorithm;
18
- };
19
15
  export declare enum ThresholdSignatureScheme {
20
16
  TWO_OF_TWO = "TWO_OF_TWO",
21
17
  TWO_OF_THREE = "TWO_OF_THREE",
@@ -45,10 +41,4 @@ export declare enum CreateRoomPartiesOptions {
45
41
  THRESHOLD = "threshold",
46
42
  FULL = "full"
47
43
  }
48
- export declare const getTSSConfig: (thresholdSignatureScheme: ThresholdSignatureScheme) => {
49
- threshold: number;
50
- numberOfParties: number;
51
- };
52
- export declare const getClientThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
53
- export declare const getDynamicServerThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
54
44
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/mpc/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,MAAM,EACN;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CA2BjE,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAe,MAAM;oBA7B/B,MAAM,EAAE;sBAAoB,gBAAgB;CAmC/D,CAAC;AAEF,oBAAY,wBAAwB;IAClC,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmBtB,CAAC;AAEF,oBAAY,wBAAwB;IAClC,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,YAAY,6BACG,wBAAwB;;;CAInD,CAAC;AAEF,eAAO,MAAM,kBAAkB,6BACH,wBAAwB,WAGnD,CAAC;AAEF,eAAO,MAAM,yBAAyB,6BACV,wBAAwB,WAGnD,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/mpc/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,MAAM,EACN;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CA2BjE,CAAC;AAEF,oBAAY,wBAAwB;IAClC,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmBtB,CAAC;AAEF,oBAAY,wBAAwB;IAClC,SAAS,cAAc;IACvB,IAAI,SAAS;CACd"}
@@ -1,2 +1,3 @@
1
1
  export * from './constants';
2
+ export * from './utils';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpc/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpc/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { ThresholdSignatureScheme } from './constants';
2
+ export declare const getMPCChainConfig: (chainName: string) => {
3
+ derivationPath: number[];
4
+ signingAlgorithm: import("./constants").SigningAlgorithm;
5
+ };
6
+ export declare const getTSSConfig: (thresholdSignatureScheme: ThresholdSignatureScheme) => {
7
+ threshold: number;
8
+ numberOfParties: number;
9
+ };
10
+ export declare const getClientThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
11
+ export declare const getDynamicServerThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
12
+ /**
13
+ * Helper function to get the reshare config for client and server shares
14
+ * @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
15
+ * @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
16
+ * @returns {{
17
+ * existingClientShareCount: number,
18
+ * newClientShareCount: number,
19
+ * existingServerShareCount: number,
20
+ * newServerShareCount: number
21
+ * }} The number of existing and new client and server shares needed
22
+ */
23
+ export declare const getReshareConfig: ({ oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
24
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
25
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
26
+ }) => {
27
+ existingClientShareCount: number;
28
+ newClientShareCount: number;
29
+ existingServerShareCount: number;
30
+ newServerShareCount: number;
31
+ };
32
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
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;CAgF7B,CAAC"}