@unlink-xyz/multisig 0.1.0 → 0.1.3-canary.04befc5
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 +35 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/src/frost/account.d.ts +6 -0
- package/dist/src/frost/account.d.ts.map +1 -1
- package/dist/src/frost/account.js +6 -1
- package/dist/src/frost/coordinator.d.ts +2 -1
- package/dist/src/frost/coordinator.d.ts.map +1 -1
- package/dist/src/frost/coordinator.js +5 -1
- package/dist/src/frost/listener.d.ts +13 -8
- package/dist/src/frost/listener.d.ts.map +1 -1
- package/dist/src/frost/listener.js +19 -3
- package/dist/src/frost/mock-coordinator.d.ts.map +1 -1
- package/dist/src/frost/mock-coordinator.js +4 -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 +1 -0
- package/dist/src/frost/types.d.ts.map +1 -1
- package/dist/src/wallet/types.d.ts +3 -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 +3 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -8
package/dist/browser/index.js
CHANGED
|
@@ -28605,7 +28605,7 @@ function serializeMultisigAccount(account) {
|
|
|
28605
28605
|
for (const [idx, points] of account.coefficientCommitments) {
|
|
28606
28606
|
coeffEntries.push([idx, points.map(serializePoint)]);
|
|
28607
28607
|
}
|
|
28608
|
-
|
|
28608
|
+
const result = {
|
|
28609
28609
|
version: MULTISIG_ACCOUNT_VERSION,
|
|
28610
28610
|
groupId: account.groupId,
|
|
28611
28611
|
config: account.config,
|
|
@@ -28626,6 +28626,10 @@ function serializeMultisigAccount(account) {
|
|
|
28626
28626
|
gatewayUrl: account.gatewayUrl,
|
|
28627
28627
|
address: account.address
|
|
28628
28628
|
};
|
|
28629
|
+
if (account.name !== void 0) {
|
|
28630
|
+
result.name = account.name;
|
|
28631
|
+
}
|
|
28632
|
+
return result;
|
|
28629
28633
|
}
|
|
28630
28634
|
function deserializeMultisigAccount(data) {
|
|
28631
28635
|
if (data.version !== MULTISIG_ACCOUNT_VERSION) {
|
|
@@ -28636,6 +28640,7 @@ function deserializeMultisigAccount(data) {
|
|
|
28636
28640
|
coefficientCommitments.set(idx, serializedPoints.map(deserializePoint));
|
|
28637
28641
|
}
|
|
28638
28642
|
return {
|
|
28643
|
+
...data.name !== void 0 ? { name: data.name } : {},
|
|
28639
28644
|
groupId: data.groupId,
|
|
28640
28645
|
config: data.config,
|
|
28641
28646
|
participantIndex: data.participantIndex,
|
|
@@ -28728,7 +28733,7 @@ var FrostCoordinator = class {
|
|
|
28728
28733
|
);
|
|
28729
28734
|
}
|
|
28730
28735
|
// === Signing ===
|
|
28731
|
-
async createSigningSession(participants, message, groupId) {
|
|
28736
|
+
async createSigningSession(participants, message, groupId, metadata) {
|
|
28732
28737
|
const body = {
|
|
28733
28738
|
participants,
|
|
28734
28739
|
message: serializeBigint(message)
|
|
@@ -28736,6 +28741,9 @@ var FrostCoordinator = class {
|
|
|
28736
28741
|
if (groupId !== void 0) {
|
|
28737
28742
|
body.group_id = groupId;
|
|
28738
28743
|
}
|
|
28744
|
+
if (metadata !== void 0) {
|
|
28745
|
+
body.metadata = metadata;
|
|
28746
|
+
}
|
|
28739
28747
|
const resp = await fetch(`${this.baseUrl}/sign/sessions`, {
|
|
28740
28748
|
method: "POST",
|
|
28741
28749
|
headers: { "Content-Type": "application/json" },
|
|
@@ -28861,7 +28869,8 @@ function deserializeSessionInfo(raw) {
|
|
|
28861
28869
|
message: deserializeBigint(raw.message),
|
|
28862
28870
|
participants: raw.participants,
|
|
28863
28871
|
status: raw.status,
|
|
28864
|
-
groupId: raw.group_id ?? void 0
|
|
28872
|
+
groupId: raw.group_id ?? void 0,
|
|
28873
|
+
metadata: raw.metadata
|
|
28865
28874
|
};
|
|
28866
28875
|
}
|
|
28867
28876
|
function sleep(ms) {
|
|
@@ -29043,8 +29052,10 @@ function createFrostSigner(params) {
|
|
|
29043
29052
|
const { code } = await coordinator.createSigningSession(
|
|
29044
29053
|
params.participants,
|
|
29045
29054
|
message,
|
|
29046
|
-
params.account.groupId
|
|
29055
|
+
params.account.groupId,
|
|
29056
|
+
params.metadata
|
|
29047
29057
|
);
|
|
29058
|
+
params.onSessionCreated?.(code);
|
|
29048
29059
|
return signMultisig({
|
|
29049
29060
|
account: params.account,
|
|
29050
29061
|
message,
|
|
@@ -29056,7 +29067,7 @@ function createFrostSigner(params) {
|
|
|
29056
29067
|
|
|
29057
29068
|
// src/frost/listener.ts
|
|
29058
29069
|
async function runSigningListener(params) {
|
|
29059
|
-
const { account, signal, onSession, onError } = params;
|
|
29070
|
+
const { account, signal, onSession, approve, onError } = params;
|
|
29060
29071
|
const pollIntervalMs = params.pollIntervalMs ?? 1e3;
|
|
29061
29072
|
const coordinator = new FrostCoordinator({
|
|
29062
29073
|
baseUrl: `${account.gatewayUrl.replace(/\/$/, "")}/frost`,
|
|
@@ -29074,9 +29085,21 @@ async function runSigningListener(params) {
|
|
|
29074
29085
|
seen.add(session.code);
|
|
29075
29086
|
continue;
|
|
29076
29087
|
}
|
|
29088
|
+
const info = {
|
|
29089
|
+
code: session.code,
|
|
29090
|
+
message: session.message,
|
|
29091
|
+
metadata: session.metadata
|
|
29092
|
+
};
|
|
29093
|
+
try {
|
|
29094
|
+
onSession?.(info);
|
|
29095
|
+
} catch (err) {
|
|
29096
|
+
seen.add(session.code);
|
|
29097
|
+
const shouldContinue = onError?.(err, info) ?? true;
|
|
29098
|
+
if (!shouldContinue) return;
|
|
29099
|
+
continue;
|
|
29100
|
+
}
|
|
29101
|
+
if (approve && !await approve(info)) continue;
|
|
29077
29102
|
seen.add(session.code);
|
|
29078
|
-
const info = { code: session.code, message: session.message };
|
|
29079
|
-
onSession?.(info);
|
|
29080
29103
|
try {
|
|
29081
29104
|
await signMultisig({
|
|
29082
29105
|
account,
|
|
@@ -29126,7 +29149,9 @@ function createMultisigWallet(config3) {
|
|
|
29126
29149
|
createSigner(params) {
|
|
29127
29150
|
return createFrostSigner({
|
|
29128
29151
|
account: params.account,
|
|
29129
|
-
participants: params.participants
|
|
29152
|
+
participants: params.participants,
|
|
29153
|
+
metadata: params.metadata,
|
|
29154
|
+
onSessionCreated: params.onSessionCreated
|
|
29130
29155
|
});
|
|
29131
29156
|
},
|
|
29132
29157
|
async createSigningSession(params) {
|
|
@@ -29136,7 +29161,8 @@ function createMultisigWallet(config3) {
|
|
|
29136
29161
|
return coordinator.createSigningSession(
|
|
29137
29162
|
params.participants,
|
|
29138
29163
|
params.message,
|
|
29139
|
-
params.groupId
|
|
29164
|
+
params.groupId,
|
|
29165
|
+
params.metadata
|
|
29140
29166
|
);
|
|
29141
29167
|
}
|
|
29142
29168
|
};
|