@unlink-xyz/react 0.1.3-canary.d8d7aa3 → 0.1.3-canary.fa60920
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/index.d.ts +4 -4
- package/dist/index.js +38 -20
- package/dist/index.js.map +1 -1
- package/dist/multisig/index.js +22 -13
- package/dist/multisig/index.js.map +1 -1
- package/package.json +2 -2
package/dist/multisig/index.js
CHANGED
|
@@ -30453,7 +30453,7 @@ var FrostCoordinator = class {
|
|
|
30453
30453
|
retryDelayMs;
|
|
30454
30454
|
constructor(config3) {
|
|
30455
30455
|
this.baseUrl = config3.baseUrl.replace(/\/$/, "");
|
|
30456
|
-
this.pollIntervalMs = config3.pollIntervalMs ??
|
|
30456
|
+
this.pollIntervalMs = config3.pollIntervalMs ?? 3e3;
|
|
30457
30457
|
this.timeoutMs = config3.timeoutMs ?? 12e4;
|
|
30458
30458
|
this.maxRetries = config3.maxRetries ?? 3;
|
|
30459
30459
|
this.retryDelayMs = config3.retryDelayMs ?? 500;
|
|
@@ -30620,7 +30620,7 @@ var FrostCoordinator = class {
|
|
|
30620
30620
|
if (sessions.length > 0) {
|
|
30621
30621
|
return sessions[0];
|
|
30622
30622
|
}
|
|
30623
|
-
await sleep(this.pollIntervalMs);
|
|
30623
|
+
await sleep(this.pollIntervalMs * (0.8 + Math.random() * 0.4));
|
|
30624
30624
|
}
|
|
30625
30625
|
throw new Error("Coordinator polling timeout");
|
|
30626
30626
|
}
|
|
@@ -30660,7 +30660,7 @@ var FrostCoordinator = class {
|
|
|
30660
30660
|
if (result.complete) {
|
|
30661
30661
|
return result.packages.map((p) => deserializeFn(p));
|
|
30662
30662
|
}
|
|
30663
|
-
await sleep(this.pollIntervalMs);
|
|
30663
|
+
await sleep(this.pollIntervalMs * (0.8 + Math.random() * 0.4));
|
|
30664
30664
|
}
|
|
30665
30665
|
throw new Error("Coordinator polling timeout");
|
|
30666
30666
|
}
|
|
@@ -30705,8 +30705,8 @@ function isTransientError(status) {
|
|
|
30705
30705
|
function sleep(ms) {
|
|
30706
30706
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
30707
30707
|
}
|
|
30708
|
-
function
|
|
30709
|
-
return `${gatewayUrl.replace(/\/$/, "")}/frost`;
|
|
30708
|
+
function resolveFrostUrl(gatewayUrl, explicitFrostUrl) {
|
|
30709
|
+
return explicitFrostUrl ?? `${gatewayUrl.replace(/\/$/, "")}/frost`;
|
|
30710
30710
|
}
|
|
30711
30711
|
function deriveVerificationShare(participantIndex, coefficientCommitments) {
|
|
30712
30712
|
const idx = BigInt(participantIndex);
|
|
@@ -30720,7 +30720,7 @@ function deriveVerificationShare(participantIndex, coefficientCommitments) {
|
|
|
30720
30720
|
}
|
|
30721
30721
|
return result;
|
|
30722
30722
|
}
|
|
30723
|
-
function buildMultisigAccount(result, viewingKeyPair, groupId, config3, participantIndex, gatewayUrl) {
|
|
30723
|
+
function buildMultisigAccount(result, viewingKeyPair, groupId, config3, participantIndex, gatewayUrl, frostUrl) {
|
|
30724
30724
|
const nullifyingKey = computeNullifyingKey(viewingKeyPair.privateKey);
|
|
30725
30725
|
const masterPublicKey = computeMasterPublicKey(
|
|
30726
30726
|
result.groupPublicKey,
|
|
@@ -30741,6 +30741,7 @@ function buildMultisigAccount(result, viewingKeyPair, groupId, config3, particip
|
|
|
30741
30741
|
nullifyingKey,
|
|
30742
30742
|
masterPublicKey,
|
|
30743
30743
|
gatewayUrl,
|
|
30744
|
+
...frostUrl !== void 0 ? { frostUrl } : {},
|
|
30744
30745
|
address
|
|
30745
30746
|
};
|
|
30746
30747
|
}
|
|
@@ -30761,7 +30762,7 @@ async function createMultisig(params) {
|
|
|
30761
30762
|
totalShares: params.totalShares
|
|
30762
30763
|
};
|
|
30763
30764
|
const coordinator = new FrostCoordinator({
|
|
30764
|
-
baseUrl:
|
|
30765
|
+
baseUrl: resolveFrostUrl(params.gatewayUrl, params.frostUrl)
|
|
30765
30766
|
});
|
|
30766
30767
|
const { code } = await coordinator.createDkgSession(
|
|
30767
30768
|
config3.threshold,
|
|
@@ -30795,14 +30796,15 @@ async function createMultisig(params) {
|
|
|
30795
30796
|
code,
|
|
30796
30797
|
config3,
|
|
30797
30798
|
1,
|
|
30798
|
-
params.gatewayUrl
|
|
30799
|
+
params.gatewayUrl,
|
|
30800
|
+
params.frostUrl
|
|
30799
30801
|
);
|
|
30800
30802
|
}
|
|
30801
30803
|
};
|
|
30802
30804
|
}
|
|
30803
30805
|
async function joinMultisig(params) {
|
|
30804
30806
|
const coordinator = new FrostCoordinator({
|
|
30805
|
-
baseUrl:
|
|
30807
|
+
baseUrl: resolveFrostUrl(params.gatewayUrl, params.frostUrl)
|
|
30806
30808
|
});
|
|
30807
30809
|
const { participantIndex, threshold, totalParticipants } = await coordinator.joinDkgSession(params.code);
|
|
30808
30810
|
const config3 = { threshold, totalShares: totalParticipants };
|
|
@@ -30831,12 +30833,16 @@ async function joinMultisig(params) {
|
|
|
30831
30833
|
params.code,
|
|
30832
30834
|
config3,
|
|
30833
30835
|
participantIndex,
|
|
30834
|
-
params.gatewayUrl
|
|
30836
|
+
params.gatewayUrl,
|
|
30837
|
+
params.frostUrl
|
|
30835
30838
|
);
|
|
30836
30839
|
}
|
|
30837
30840
|
async function signMultisig(params) {
|
|
30838
30841
|
const coordinator = new FrostCoordinator({
|
|
30839
|
-
baseUrl:
|
|
30842
|
+
baseUrl: resolveFrostUrl(
|
|
30843
|
+
params.account.gatewayUrl,
|
|
30844
|
+
params.account.frostUrl
|
|
30845
|
+
)
|
|
30840
30846
|
});
|
|
30841
30847
|
const { nonces, commitment } = generateCommitment(
|
|
30842
30848
|
params.account.participantIndex
|
|
@@ -30874,7 +30880,10 @@ function createFrostSigner(params) {
|
|
|
30874
30880
|
publicKey: params.account.groupPublicKey,
|
|
30875
30881
|
sign: async (message) => {
|
|
30876
30882
|
const coordinator = new FrostCoordinator({
|
|
30877
|
-
baseUrl:
|
|
30883
|
+
baseUrl: resolveFrostUrl(
|
|
30884
|
+
params.account.gatewayUrl,
|
|
30885
|
+
params.account.frostUrl
|
|
30886
|
+
)
|
|
30878
30887
|
});
|
|
30879
30888
|
const { code } = await coordinator.createSigningSession(
|
|
30880
30889
|
params.participants,
|
|
@@ -30895,7 +30904,7 @@ async function runSigningListener(params) {
|
|
|
30895
30904
|
const { account, signal, onSession, approve, onError } = params;
|
|
30896
30905
|
const pollIntervalMs = params.pollIntervalMs ?? 1e3;
|
|
30897
30906
|
const coordinator = new FrostCoordinator({
|
|
30898
|
-
baseUrl: `${account.gatewayUrl.replace(/\/$/, "")}/frost`,
|
|
30907
|
+
baseUrl: account.frostUrl ?? `${account.gatewayUrl.replace(/\/$/, "")}/frost`,
|
|
30899
30908
|
pollIntervalMs
|
|
30900
30909
|
});
|
|
30901
30910
|
const seen = /* @__PURE__ */ new Set();
|