@unlink-xyz/multisig 0.1.5 → 0.1.6
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/dist/browser/index.js +226 -55
- package/dist/browser/index.js.map +1 -1
- package/dist/src/frost/account.d.ts +2 -0
- package/dist/src/frost/account.d.ts.map +1 -1
- package/dist/src/frost/account.js +10 -9
- package/dist/src/frost/coordinator.d.ts +8 -1
- package/dist/src/frost/coordinator.d.ts.map +1 -1
- package/dist/src/frost/coordinator.js +43 -19
- package/dist/src/frost/listener.d.ts.map +1 -1
- package/dist/src/frost/listener.js +1 -1
- package/dist/src/frost/serialization.d.ts +1 -0
- package/dist/src/frost/serialization.d.ts.map +1 -1
- package/dist/src/frost/serialization.js +6 -1
- package/dist/src/frost/types.d.ts +2 -0
- package/dist/src/frost/types.d.ts.map +1 -1
- package/dist/src/wallet/types.d.ts +1 -0
- package/dist/src/wallet/types.d.ts.map +1 -1
- package/dist/src/wallet/wallet.d.ts.map +1 -1
- package/dist/src/wallet/wallet.js +4 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -11320,9 +11320,9 @@ function genBech32(encoding) {
|
|
|
11320
11320
|
}
|
|
11321
11321
|
var bech32m = /* @__PURE__ */ genBech32("bech32m");
|
|
11322
11322
|
var VERSION = 1;
|
|
11323
|
-
var LIMIT =
|
|
11323
|
+
var LIMIT = 130;
|
|
11324
11324
|
var ALL_CHAINS = "ffffffffffffffff";
|
|
11325
|
-
var PREFIX = "
|
|
11325
|
+
var PREFIX = "unlink";
|
|
11326
11326
|
var SALT = new TextEncoder().encode("unlink");
|
|
11327
11327
|
function xorWithSalt(hex2) {
|
|
11328
11328
|
const bytes2 = Hex.toBytes(hex2);
|
|
@@ -27982,6 +27982,114 @@ var circuits_default = {
|
|
|
27982
27982
|
template: "JoinSplit",
|
|
27983
27983
|
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
27984
27984
|
params: [5, 2, 16]
|
|
27985
|
+
},
|
|
27986
|
+
joinsplit_1x3_16: {
|
|
27987
|
+
file: "joinsplit",
|
|
27988
|
+
template: "JoinSplit",
|
|
27989
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
27990
|
+
params: [1, 3, 16]
|
|
27991
|
+
},
|
|
27992
|
+
joinsplit_4x3_16: {
|
|
27993
|
+
file: "joinsplit",
|
|
27994
|
+
template: "JoinSplit",
|
|
27995
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
27996
|
+
params: [4, 3, 16]
|
|
27997
|
+
},
|
|
27998
|
+
joinsplit_5x3_16: {
|
|
27999
|
+
file: "joinsplit",
|
|
28000
|
+
template: "JoinSplit",
|
|
28001
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28002
|
+
params: [5, 3, 16]
|
|
28003
|
+
},
|
|
28004
|
+
joinsplit_6x1_16: {
|
|
28005
|
+
file: "joinsplit",
|
|
28006
|
+
template: "JoinSplit",
|
|
28007
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28008
|
+
params: [6, 1, 16]
|
|
28009
|
+
},
|
|
28010
|
+
joinsplit_6x2_16: {
|
|
28011
|
+
file: "joinsplit",
|
|
28012
|
+
template: "JoinSplit",
|
|
28013
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28014
|
+
params: [6, 2, 16]
|
|
28015
|
+
},
|
|
28016
|
+
joinsplit_6x3_16: {
|
|
28017
|
+
file: "joinsplit",
|
|
28018
|
+
template: "JoinSplit",
|
|
28019
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28020
|
+
params: [6, 3, 16]
|
|
28021
|
+
},
|
|
28022
|
+
joinsplit_7x1_16: {
|
|
28023
|
+
file: "joinsplit",
|
|
28024
|
+
template: "JoinSplit",
|
|
28025
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28026
|
+
params: [7, 1, 16]
|
|
28027
|
+
},
|
|
28028
|
+
joinsplit_7x2_16: {
|
|
28029
|
+
file: "joinsplit",
|
|
28030
|
+
template: "JoinSplit",
|
|
28031
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28032
|
+
params: [7, 2, 16]
|
|
28033
|
+
},
|
|
28034
|
+
joinsplit_7x3_16: {
|
|
28035
|
+
file: "joinsplit",
|
|
28036
|
+
template: "JoinSplit",
|
|
28037
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28038
|
+
params: [7, 3, 16]
|
|
28039
|
+
},
|
|
28040
|
+
joinsplit_8x1_16: {
|
|
28041
|
+
file: "joinsplit",
|
|
28042
|
+
template: "JoinSplit",
|
|
28043
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28044
|
+
params: [8, 1, 16]
|
|
28045
|
+
},
|
|
28046
|
+
joinsplit_8x2_16: {
|
|
28047
|
+
file: "joinsplit",
|
|
28048
|
+
template: "JoinSplit",
|
|
28049
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28050
|
+
params: [8, 2, 16]
|
|
28051
|
+
},
|
|
28052
|
+
joinsplit_8x3_16: {
|
|
28053
|
+
file: "joinsplit",
|
|
28054
|
+
template: "JoinSplit",
|
|
28055
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28056
|
+
params: [8, 3, 16]
|
|
28057
|
+
},
|
|
28058
|
+
joinsplit_9x1_16: {
|
|
28059
|
+
file: "joinsplit",
|
|
28060
|
+
template: "JoinSplit",
|
|
28061
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28062
|
+
params: [9, 1, 16]
|
|
28063
|
+
},
|
|
28064
|
+
joinsplit_9x2_16: {
|
|
28065
|
+
file: "joinsplit",
|
|
28066
|
+
template: "JoinSplit",
|
|
28067
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28068
|
+
params: [9, 2, 16]
|
|
28069
|
+
},
|
|
28070
|
+
joinsplit_9x3_16: {
|
|
28071
|
+
file: "joinsplit",
|
|
28072
|
+
template: "JoinSplit",
|
|
28073
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28074
|
+
params: [9, 3, 16]
|
|
28075
|
+
},
|
|
28076
|
+
joinsplit_10x1_16: {
|
|
28077
|
+
file: "joinsplit",
|
|
28078
|
+
template: "JoinSplit",
|
|
28079
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28080
|
+
params: [10, 1, 16]
|
|
28081
|
+
},
|
|
28082
|
+
joinsplit_10x2_16: {
|
|
28083
|
+
file: "joinsplit",
|
|
28084
|
+
template: "JoinSplit",
|
|
28085
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28086
|
+
params: [10, 2, 16]
|
|
28087
|
+
},
|
|
28088
|
+
joinsplit_10x3_16: {
|
|
28089
|
+
file: "joinsplit",
|
|
28090
|
+
template: "JoinSplit",
|
|
28091
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
28092
|
+
params: [10, 3, 16]
|
|
27985
28093
|
}
|
|
27986
28094
|
};
|
|
27987
28095
|
var registry = {};
|
|
@@ -28605,7 +28713,7 @@ function serializeMultisigAccount(account) {
|
|
|
28605
28713
|
for (const [idx, points] of account.coefficientCommitments) {
|
|
28606
28714
|
coeffEntries.push([idx, points.map(serializePoint)]);
|
|
28607
28715
|
}
|
|
28608
|
-
|
|
28716
|
+
const result = {
|
|
28609
28717
|
version: MULTISIG_ACCOUNT_VERSION,
|
|
28610
28718
|
groupId: account.groupId,
|
|
28611
28719
|
config: account.config,
|
|
@@ -28626,6 +28734,10 @@ function serializeMultisigAccount(account) {
|
|
|
28626
28734
|
gatewayUrl: account.gatewayUrl,
|
|
28627
28735
|
address: account.address
|
|
28628
28736
|
};
|
|
28737
|
+
if (account.name !== void 0) {
|
|
28738
|
+
result.name = account.name;
|
|
28739
|
+
}
|
|
28740
|
+
return result;
|
|
28629
28741
|
}
|
|
28630
28742
|
function deserializeMultisigAccount(data) {
|
|
28631
28743
|
if (data.version !== MULTISIG_ACCOUNT_VERSION) {
|
|
@@ -28636,6 +28748,7 @@ function deserializeMultisigAccount(data) {
|
|
|
28636
28748
|
coefficientCommitments.set(idx, serializedPoints.map(deserializePoint));
|
|
28637
28749
|
}
|
|
28638
28750
|
return {
|
|
28751
|
+
...data.name !== void 0 ? { name: data.name } : {},
|
|
28639
28752
|
groupId: data.groupId,
|
|
28640
28753
|
config: data.config,
|
|
28641
28754
|
participantIndex: data.participantIndex,
|
|
@@ -28662,14 +28775,18 @@ var FrostCoordinator = class {
|
|
|
28662
28775
|
baseUrl;
|
|
28663
28776
|
pollIntervalMs;
|
|
28664
28777
|
timeoutMs;
|
|
28778
|
+
maxRetries;
|
|
28779
|
+
retryDelayMs;
|
|
28665
28780
|
constructor(config3) {
|
|
28666
28781
|
this.baseUrl = config3.baseUrl.replace(/\/$/, "");
|
|
28667
|
-
this.pollIntervalMs = config3.pollIntervalMs ??
|
|
28782
|
+
this.pollIntervalMs = config3.pollIntervalMs ?? 3e3;
|
|
28668
28783
|
this.timeoutMs = config3.timeoutMs ?? 12e4;
|
|
28784
|
+
this.maxRetries = config3.maxRetries ?? 3;
|
|
28785
|
+
this.retryDelayMs = config3.retryDelayMs ?? 500;
|
|
28669
28786
|
}
|
|
28670
28787
|
// === DKG ===
|
|
28671
28788
|
async createDkgSession(threshold, totalParticipants) {
|
|
28672
|
-
const resp = await
|
|
28789
|
+
const resp = await this.fetchWithRetry(`${this.baseUrl}/dkg/groups`, {
|
|
28673
28790
|
method: "POST",
|
|
28674
28791
|
headers: { "Content-Type": "application/json" },
|
|
28675
28792
|
body: JSON.stringify({
|
|
@@ -28682,9 +28799,10 @@ var FrostCoordinator = class {
|
|
|
28682
28799
|
return { code: body.code };
|
|
28683
28800
|
}
|
|
28684
28801
|
async joinDkgSession(code) {
|
|
28685
|
-
const resp = await
|
|
28686
|
-
|
|
28687
|
-
|
|
28802
|
+
const resp = await this.fetchWithRetry(
|
|
28803
|
+
`${this.baseUrl}/dkg/groups/${code}/join`,
|
|
28804
|
+
{ method: "POST" }
|
|
28805
|
+
);
|
|
28688
28806
|
if (!resp.ok) throw await this.toError(resp);
|
|
28689
28807
|
const body = await resp.json();
|
|
28690
28808
|
return {
|
|
@@ -28694,14 +28812,17 @@ var FrostCoordinator = class {
|
|
|
28694
28812
|
};
|
|
28695
28813
|
}
|
|
28696
28814
|
async submitRound1(code, pkg) {
|
|
28697
|
-
const resp = await
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28701
|
-
|
|
28702
|
-
|
|
28703
|
-
|
|
28704
|
-
|
|
28815
|
+
const resp = await this.fetchWithRetry(
|
|
28816
|
+
`${this.baseUrl}/dkg/groups/${code}/round1`,
|
|
28817
|
+
{
|
|
28818
|
+
method: "POST",
|
|
28819
|
+
headers: { "Content-Type": "application/json" },
|
|
28820
|
+
body: JSON.stringify({
|
|
28821
|
+
participant_index: pkg.participantIndex,
|
|
28822
|
+
data: serializeDkgRound1Package(pkg)
|
|
28823
|
+
})
|
|
28824
|
+
}
|
|
28825
|
+
);
|
|
28705
28826
|
if (!resp.ok) throw await this.toError(resp);
|
|
28706
28827
|
}
|
|
28707
28828
|
async waitForRound1(code) {
|
|
@@ -28711,14 +28832,17 @@ var FrostCoordinator = class {
|
|
|
28711
28832
|
);
|
|
28712
28833
|
}
|
|
28713
28834
|
async submitRound2(code, pkg) {
|
|
28714
|
-
const resp = await
|
|
28715
|
-
|
|
28716
|
-
|
|
28717
|
-
|
|
28718
|
-
|
|
28719
|
-
|
|
28720
|
-
|
|
28721
|
-
|
|
28835
|
+
const resp = await this.fetchWithRetry(
|
|
28836
|
+
`${this.baseUrl}/dkg/groups/${code}/round2`,
|
|
28837
|
+
{
|
|
28838
|
+
method: "POST",
|
|
28839
|
+
headers: { "Content-Type": "application/json" },
|
|
28840
|
+
body: JSON.stringify({
|
|
28841
|
+
participant_index: pkg.participantIndex,
|
|
28842
|
+
data: serializeDkgRound2Package(pkg)
|
|
28843
|
+
})
|
|
28844
|
+
}
|
|
28845
|
+
);
|
|
28722
28846
|
if (!resp.ok) throw await this.toError(resp);
|
|
28723
28847
|
}
|
|
28724
28848
|
async waitForRound2(code) {
|
|
@@ -28739,7 +28863,7 @@ var FrostCoordinator = class {
|
|
|
28739
28863
|
if (metadata !== void 0) {
|
|
28740
28864
|
body.metadata = metadata;
|
|
28741
28865
|
}
|
|
28742
|
-
const resp = await
|
|
28866
|
+
const resp = await this.fetchWithRetry(`${this.baseUrl}/sign/sessions`, {
|
|
28743
28867
|
method: "POST",
|
|
28744
28868
|
headers: { "Content-Type": "application/json" },
|
|
28745
28869
|
body: JSON.stringify(body)
|
|
@@ -28749,7 +28873,7 @@ var FrostCoordinator = class {
|
|
|
28749
28873
|
return { code: result.code };
|
|
28750
28874
|
}
|
|
28751
28875
|
async submitCommitment(code, c) {
|
|
28752
|
-
const resp = await
|
|
28876
|
+
const resp = await this.fetchWithRetry(
|
|
28753
28877
|
`${this.baseUrl}/sign/sessions/${code}/commitments`,
|
|
28754
28878
|
{
|
|
28755
28879
|
method: "POST",
|
|
@@ -28769,14 +28893,17 @@ var FrostCoordinator = class {
|
|
|
28769
28893
|
);
|
|
28770
28894
|
}
|
|
28771
28895
|
async submitShare(code, share) {
|
|
28772
|
-
const resp = await
|
|
28773
|
-
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
|
|
28778
|
-
|
|
28779
|
-
|
|
28896
|
+
const resp = await this.fetchWithRetry(
|
|
28897
|
+
`${this.baseUrl}/sign/sessions/${code}/shares`,
|
|
28898
|
+
{
|
|
28899
|
+
method: "POST",
|
|
28900
|
+
headers: { "Content-Type": "application/json" },
|
|
28901
|
+
body: JSON.stringify({
|
|
28902
|
+
participant_index: share.participantIndex,
|
|
28903
|
+
data: serializeSignatureShare(share)
|
|
28904
|
+
})
|
|
28905
|
+
}
|
|
28906
|
+
);
|
|
28780
28907
|
if (!resp.ok) throw await this.toError(resp);
|
|
28781
28908
|
}
|
|
28782
28909
|
async waitForShares(code) {
|
|
@@ -28786,19 +28913,23 @@ var FrostCoordinator = class {
|
|
|
28786
28913
|
);
|
|
28787
28914
|
}
|
|
28788
28915
|
async getSigningSessionStatus(code) {
|
|
28789
|
-
const resp = await
|
|
28916
|
+
const resp = await this.fetchWithRetry(
|
|
28917
|
+
`${this.baseUrl}/sign/sessions/${code}/status`
|
|
28918
|
+
);
|
|
28790
28919
|
if (!resp.ok) throw await this.toError(resp);
|
|
28791
28920
|
const body = await resp.json();
|
|
28792
28921
|
return { ...body, message: deserializeBigint(body.message) };
|
|
28793
28922
|
}
|
|
28794
28923
|
async getSigningSession(code) {
|
|
28795
|
-
const resp = await
|
|
28924
|
+
const resp = await this.fetchWithRetry(
|
|
28925
|
+
`${this.baseUrl}/sign/sessions/${code}`
|
|
28926
|
+
);
|
|
28796
28927
|
if (!resp.ok) throw await this.toError(resp);
|
|
28797
28928
|
const body = await resp.json();
|
|
28798
28929
|
return deserializeSessionInfo(body);
|
|
28799
28930
|
}
|
|
28800
28931
|
async listSigningSessions(groupId) {
|
|
28801
|
-
const resp = await
|
|
28932
|
+
const resp = await this.fetchWithRetry(
|
|
28802
28933
|
`${this.baseUrl}/sign/sessions?group_id=${encodeURIComponent(groupId)}`
|
|
28803
28934
|
);
|
|
28804
28935
|
if (!resp.ok) throw await this.toError(resp);
|
|
@@ -28815,30 +28946,36 @@ var FrostCoordinator = class {
|
|
|
28815
28946
|
if (sessions.length > 0) {
|
|
28816
28947
|
return sessions[0];
|
|
28817
28948
|
}
|
|
28818
|
-
await sleep(this.pollIntervalMs);
|
|
28949
|
+
await sleep(this.pollIntervalMs * (0.8 + Math.random() * 0.4));
|
|
28819
28950
|
}
|
|
28820
28951
|
throw new Error("Coordinator polling timeout");
|
|
28821
28952
|
}
|
|
28822
28953
|
// === Internal ===
|
|
28823
28954
|
async pollRound1(code) {
|
|
28824
|
-
const resp = await
|
|
28955
|
+
const resp = await this.fetchWithRetry(
|
|
28956
|
+
`${this.baseUrl}/dkg/groups/${code}/round1`
|
|
28957
|
+
);
|
|
28825
28958
|
if (!resp.ok) throw await this.toError(resp);
|
|
28826
28959
|
return await resp.json();
|
|
28827
28960
|
}
|
|
28828
28961
|
async pollRound2(code) {
|
|
28829
|
-
const resp = await
|
|
28962
|
+
const resp = await this.fetchWithRetry(
|
|
28963
|
+
`${this.baseUrl}/dkg/groups/${code}/round2`
|
|
28964
|
+
);
|
|
28830
28965
|
if (!resp.ok) throw await this.toError(resp);
|
|
28831
28966
|
return await resp.json();
|
|
28832
28967
|
}
|
|
28833
28968
|
async pollCommitments(code) {
|
|
28834
|
-
const resp = await
|
|
28969
|
+
const resp = await this.fetchWithRetry(
|
|
28835
28970
|
`${this.baseUrl}/sign/sessions/${code}/commitments`
|
|
28836
28971
|
);
|
|
28837
28972
|
if (!resp.ok) throw await this.toError(resp);
|
|
28838
28973
|
return await resp.json();
|
|
28839
28974
|
}
|
|
28840
28975
|
async pollShares(code) {
|
|
28841
|
-
const resp = await
|
|
28976
|
+
const resp = await this.fetchWithRetry(
|
|
28977
|
+
`${this.baseUrl}/sign/sessions/${code}/shares`
|
|
28978
|
+
);
|
|
28842
28979
|
if (!resp.ok) throw await this.toError(resp);
|
|
28843
28980
|
return await resp.json();
|
|
28844
28981
|
}
|
|
@@ -28849,12 +28986,32 @@ var FrostCoordinator = class {
|
|
|
28849
28986
|
if (result.complete) {
|
|
28850
28987
|
return result.packages.map((p) => deserializeFn(p));
|
|
28851
28988
|
}
|
|
28852
|
-
await sleep(this.pollIntervalMs);
|
|
28989
|
+
await sleep(this.pollIntervalMs * (0.8 + Math.random() * 0.4));
|
|
28853
28990
|
}
|
|
28854
28991
|
throw new Error("Coordinator polling timeout");
|
|
28855
28992
|
}
|
|
28993
|
+
async fetchWithRetry(url, init4) {
|
|
28994
|
+
let lastError;
|
|
28995
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
28996
|
+
if (attempt > 0) {
|
|
28997
|
+
await sleep(this.retryDelayMs * 2 ** (attempt - 1));
|
|
28998
|
+
}
|
|
28999
|
+
const resp = await fetch(url, init4);
|
|
29000
|
+
if (resp.ok || !isTransientError(resp.status)) {
|
|
29001
|
+
return resp;
|
|
29002
|
+
}
|
|
29003
|
+
lastError = await this.toError(resp);
|
|
29004
|
+
}
|
|
29005
|
+
throw lastError;
|
|
29006
|
+
}
|
|
28856
29007
|
async toError(resp) {
|
|
28857
29008
|
const body = await resp.text();
|
|
29009
|
+
const isHtml = body.trimStart().startsWith("<") || resp.headers.get("content-type")?.includes("text/html");
|
|
29010
|
+
if (isHtml) {
|
|
29011
|
+
return new Error(
|
|
29012
|
+
`Coordinator unavailable (HTTP ${resp.status}). The service may be temporarily overloaded \u2014 try again shortly.`
|
|
29013
|
+
);
|
|
29014
|
+
}
|
|
28858
29015
|
return new Error(`Coordinator error ${resp.status}: ${body}`);
|
|
28859
29016
|
}
|
|
28860
29017
|
};
|
|
@@ -28868,13 +29025,16 @@ function deserializeSessionInfo(raw) {
|
|
|
28868
29025
|
metadata: raw.metadata
|
|
28869
29026
|
};
|
|
28870
29027
|
}
|
|
29028
|
+
function isTransientError(status) {
|
|
29029
|
+
return status === 502 || status === 503 || status === 504;
|
|
29030
|
+
}
|
|
28871
29031
|
function sleep(ms) {
|
|
28872
29032
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
28873
29033
|
}
|
|
28874
29034
|
|
|
28875
29035
|
// src/frost/account.ts
|
|
28876
|
-
function
|
|
28877
|
-
return `${gatewayUrl.replace(/\/$/, "")}/frost`;
|
|
29036
|
+
function resolveFrostUrl(gatewayUrl, explicitFrostUrl) {
|
|
29037
|
+
return explicitFrostUrl ?? `${gatewayUrl.replace(/\/$/, "")}/frost`;
|
|
28878
29038
|
}
|
|
28879
29039
|
function deriveVerificationShare(participantIndex, coefficientCommitments) {
|
|
28880
29040
|
const idx = BigInt(participantIndex);
|
|
@@ -28888,7 +29048,7 @@ function deriveVerificationShare(participantIndex, coefficientCommitments) {
|
|
|
28888
29048
|
}
|
|
28889
29049
|
return result;
|
|
28890
29050
|
}
|
|
28891
|
-
function buildMultisigAccount(result, viewingKeyPair, groupId, config3, participantIndex, gatewayUrl) {
|
|
29051
|
+
function buildMultisigAccount(result, viewingKeyPair, groupId, config3, participantIndex, gatewayUrl, frostUrl) {
|
|
28892
29052
|
const nullifyingKey = computeNullifyingKey(viewingKeyPair.privateKey);
|
|
28893
29053
|
const masterPublicKey = computeMasterPublicKey(
|
|
28894
29054
|
result.groupPublicKey,
|
|
@@ -28909,6 +29069,7 @@ function buildMultisigAccount(result, viewingKeyPair, groupId, config3, particip
|
|
|
28909
29069
|
nullifyingKey,
|
|
28910
29070
|
masterPublicKey,
|
|
28911
29071
|
gatewayUrl,
|
|
29072
|
+
...frostUrl !== void 0 ? { frostUrl } : {},
|
|
28912
29073
|
address
|
|
28913
29074
|
};
|
|
28914
29075
|
}
|
|
@@ -28929,7 +29090,7 @@ async function createMultisig(params) {
|
|
|
28929
29090
|
totalShares: params.totalShares
|
|
28930
29091
|
};
|
|
28931
29092
|
const coordinator = new FrostCoordinator({
|
|
28932
|
-
baseUrl:
|
|
29093
|
+
baseUrl: resolveFrostUrl(params.gatewayUrl, params.frostUrl)
|
|
28933
29094
|
});
|
|
28934
29095
|
const { code } = await coordinator.createDkgSession(
|
|
28935
29096
|
config3.threshold,
|
|
@@ -28963,14 +29124,15 @@ async function createMultisig(params) {
|
|
|
28963
29124
|
code,
|
|
28964
29125
|
config3,
|
|
28965
29126
|
1,
|
|
28966
|
-
params.gatewayUrl
|
|
29127
|
+
params.gatewayUrl,
|
|
29128
|
+
params.frostUrl
|
|
28967
29129
|
);
|
|
28968
29130
|
}
|
|
28969
29131
|
};
|
|
28970
29132
|
}
|
|
28971
29133
|
async function joinMultisig(params) {
|
|
28972
29134
|
const coordinator = new FrostCoordinator({
|
|
28973
|
-
baseUrl:
|
|
29135
|
+
baseUrl: resolveFrostUrl(params.gatewayUrl, params.frostUrl)
|
|
28974
29136
|
});
|
|
28975
29137
|
const { participantIndex, threshold, totalParticipants } = await coordinator.joinDkgSession(params.code);
|
|
28976
29138
|
const config3 = { threshold, totalShares: totalParticipants };
|
|
@@ -28999,12 +29161,16 @@ async function joinMultisig(params) {
|
|
|
28999
29161
|
params.code,
|
|
29000
29162
|
config3,
|
|
29001
29163
|
participantIndex,
|
|
29002
|
-
params.gatewayUrl
|
|
29164
|
+
params.gatewayUrl,
|
|
29165
|
+
params.frostUrl
|
|
29003
29166
|
);
|
|
29004
29167
|
}
|
|
29005
29168
|
async function signMultisig(params) {
|
|
29006
29169
|
const coordinator = new FrostCoordinator({
|
|
29007
|
-
baseUrl:
|
|
29170
|
+
baseUrl: resolveFrostUrl(
|
|
29171
|
+
params.account.gatewayUrl,
|
|
29172
|
+
params.account.frostUrl
|
|
29173
|
+
)
|
|
29008
29174
|
});
|
|
29009
29175
|
const { nonces, commitment } = generateCommitment(
|
|
29010
29176
|
params.account.participantIndex
|
|
@@ -29042,7 +29208,10 @@ function createFrostSigner(params) {
|
|
|
29042
29208
|
publicKey: params.account.groupPublicKey,
|
|
29043
29209
|
sign: async (message) => {
|
|
29044
29210
|
const coordinator = new FrostCoordinator({
|
|
29045
|
-
baseUrl:
|
|
29211
|
+
baseUrl: resolveFrostUrl(
|
|
29212
|
+
params.account.gatewayUrl,
|
|
29213
|
+
params.account.frostUrl
|
|
29214
|
+
)
|
|
29046
29215
|
});
|
|
29047
29216
|
const { code } = await coordinator.createSigningSession(
|
|
29048
29217
|
params.participants,
|
|
@@ -29065,7 +29234,7 @@ async function runSigningListener(params) {
|
|
|
29065
29234
|
const { account, signal, onSession, approve, onError } = params;
|
|
29066
29235
|
const pollIntervalMs = params.pollIntervalMs ?? 1e3;
|
|
29067
29236
|
const coordinator = new FrostCoordinator({
|
|
29068
|
-
baseUrl: `${account.gatewayUrl.replace(/\/$/, "")}/frost`,
|
|
29237
|
+
baseUrl: account.frostUrl ?? `${account.gatewayUrl.replace(/\/$/, "")}/frost`,
|
|
29069
29238
|
pollIntervalMs
|
|
29070
29239
|
});
|
|
29071
29240
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -29116,13 +29285,14 @@ async function runSigningListener(params) {
|
|
|
29116
29285
|
|
|
29117
29286
|
// src/wallet/wallet.ts
|
|
29118
29287
|
function createMultisigWallet(config3) {
|
|
29119
|
-
const { gatewayUrl } = config3;
|
|
29288
|
+
const { gatewayUrl, frostUrl } = config3;
|
|
29120
29289
|
return {
|
|
29121
29290
|
create(params) {
|
|
29122
29291
|
return createMultisig({
|
|
29123
29292
|
threshold: params.threshold,
|
|
29124
29293
|
totalShares: params.totalShares,
|
|
29125
29294
|
gatewayUrl,
|
|
29295
|
+
frostUrl,
|
|
29126
29296
|
viewingKeyPair: params.viewingKeyPair
|
|
29127
29297
|
});
|
|
29128
29298
|
},
|
|
@@ -29130,6 +29300,7 @@ function createMultisigWallet(config3) {
|
|
|
29130
29300
|
return joinMultisig({
|
|
29131
29301
|
code: params.code,
|
|
29132
29302
|
gatewayUrl,
|
|
29303
|
+
frostUrl,
|
|
29133
29304
|
viewingKeyPair: params.viewingKeyPair
|
|
29134
29305
|
});
|
|
29135
29306
|
},
|
|
@@ -29151,7 +29322,7 @@ function createMultisigWallet(config3) {
|
|
|
29151
29322
|
},
|
|
29152
29323
|
async createSigningSession(params) {
|
|
29153
29324
|
const coordinator = new FrostCoordinator({
|
|
29154
|
-
baseUrl: `${gatewayUrl.replace(/\/$/, "")}/frost`
|
|
29325
|
+
baseUrl: frostUrl ?? `${gatewayUrl.replace(/\/$/, "")}/frost`
|
|
29155
29326
|
});
|
|
29156
29327
|
return coordinator.createSigningSession(
|
|
29157
29328
|
params.participants,
|