multisigns-sdk 1.0.0

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.
@@ -0,0 +1,418 @@
1
+ import "./chunk-L45R2ICF.js";
2
+ import "./chunk-DGUM43GV.js";
3
+
4
+ // src/api/order-helpers.ts
5
+ import { ethers } from "ethers";
6
+
7
+ // src/api/gnosis-abi.ts
8
+ var GNOSIS_SAFE_ABI = [
9
+ {
10
+ inputs: [
11
+ { internalType: "address", name: "owner", type: "address" },
12
+ { internalType: "uint256", name: "_threshold", type: "uint256" }
13
+ ],
14
+ name: "addOwnerWithThreshold",
15
+ outputs: [],
16
+ stateMutability: "nonpayable",
17
+ type: "function"
18
+ },
19
+ {
20
+ inputs: [
21
+ { internalType: "address", name: "prevOwner", type: "address" },
22
+ { internalType: "address", name: "owner", type: "address" },
23
+ { internalType: "uint256", name: "_threshold", type: "uint256" }
24
+ ],
25
+ name: "removeOwner",
26
+ outputs: [],
27
+ stateMutability: "nonpayable",
28
+ type: "function"
29
+ },
30
+ {
31
+ inputs: [
32
+ { internalType: "address", name: "prevOwner", type: "address" },
33
+ { internalType: "address", name: "oldOwner", type: "address" },
34
+ { internalType: "address", name: "newOwner", type: "address" }
35
+ ],
36
+ name: "swapOwner",
37
+ outputs: [],
38
+ stateMutability: "nonpayable",
39
+ type: "function"
40
+ },
41
+ {
42
+ inputs: [{ internalType: "uint256", name: "_threshold", type: "uint256" }],
43
+ name: "changeThreshold",
44
+ outputs: [],
45
+ stateMutability: "nonpayable",
46
+ type: "function"
47
+ },
48
+ {
49
+ inputs: [],
50
+ name: "getOwners",
51
+ outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
52
+ stateMutability: "view",
53
+ type: "function"
54
+ }
55
+ ];
56
+ var ERC20_ABI = [
57
+ {
58
+ inputs: [
59
+ { internalType: "address", name: "to", type: "address" },
60
+ { internalType: "uint256", name: "amount", type: "uint256" }
61
+ ],
62
+ name: "transfer",
63
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
64
+ stateMutability: "nonpayable",
65
+ type: "function"
66
+ }
67
+ ];
68
+ var SENTINEL_OWNERS = "0x0000000000000000000000000000000000000001";
69
+
70
+ // src/api/order-helpers.ts
71
+ var gnosisSafeInterface = new ethers.Interface(GNOSIS_SAFE_ABI);
72
+ var erc20Interface = new ethers.Interface(ERC20_ABI);
73
+ function isSendOrder(method) {
74
+ const sendMethods = [
75
+ "native",
76
+ "erc20",
77
+ "spl",
78
+ "trc20",
79
+ "trc",
80
+ "native" /* native */,
81
+ "spl" /* spl */,
82
+ "native" /* native */,
83
+ "trc20" /* trc20 */,
84
+ "trc" /* trc */
85
+ ];
86
+ return sendMethods.includes(method);
87
+ }
88
+ function isSettingsOrder(method) {
89
+ return !isSendOrder(method);
90
+ }
91
+ function getChangeMethod(chainType, ownersAddedCount, ownersRemovedCount, thresholdChanged) {
92
+ const hasMultipleOwnerChanges = ownersAddedCount > 1 || ownersRemovedCount > 1;
93
+ const hasMixedChanges = ownersAddedCount > 0 && thresholdChanged || ownersRemovedCount > 0 && thresholdChanged || ownersRemovedCount > 0 && ownersAddedCount > 0;
94
+ const isMultiSendCase = hasMultipleOwnerChanges || hasMixedChanges;
95
+ if (isMultiSendCase) {
96
+ if (chainType === "EVM" /* EVM */) {
97
+ return "MultiSend";
98
+ } else if (chainType === "SOL" /* SOL */) {
99
+ return "MultiSend" /* MultiSend */;
100
+ } else if (chainType === "TRON" /* TRON */) {
101
+ return "updateOwnerThreshold" /* updateOwnerThreshold */;
102
+ }
103
+ }
104
+ if (ownersAddedCount === 1) {
105
+ if (chainType === "EVM" /* EVM */) {
106
+ return "AddOwner";
107
+ } else if (chainType === "SOL" /* SOL */) {
108
+ return "addOwner" /* addOwner */;
109
+ } else if (chainType === "TRON" /* TRON */) {
110
+ return "updateOwners" /* updateOwners */;
111
+ }
112
+ } else if (ownersRemovedCount === 1) {
113
+ if (chainType === "EVM" /* EVM */) {
114
+ return "RemoveOwner";
115
+ } else if (chainType === "SOL" /* SOL */) {
116
+ return "removeOwner" /* removeOwner */;
117
+ } else if (chainType === "TRON" /* TRON */) {
118
+ return "updateOwners" /* updateOwners */;
119
+ }
120
+ } else if (thresholdChanged) {
121
+ if (chainType === "EVM" /* EVM */) {
122
+ return "ChangeThreshold";
123
+ } else if (chainType === "SOL" /* SOL */) {
124
+ return "changeThreshold" /* changeThreshold */;
125
+ } else if (chainType === "TRON" /* TRON */) {
126
+ return "changeThreshold" /* changeThreshold */;
127
+ }
128
+ }
129
+ return null;
130
+ }
131
+ async function createEvmActions(params) {
132
+ const {
133
+ method,
134
+ multisigAddress,
135
+ threshold,
136
+ newThreshold = null,
137
+ owners,
138
+ ownersAdded,
139
+ ownersRemoved,
140
+ provider
141
+ } = params;
142
+ const actions = [];
143
+ const currentOwners = [...owners];
144
+ let onChainOwners = currentOwners;
145
+ if (provider && multisigAddress) {
146
+ try {
147
+ const safe = new ethers.Contract(
148
+ multisigAddress,
149
+ GNOSIS_SAFE_ABI,
150
+ provider
151
+ );
152
+ onChainOwners = (await safe.getOwners()).toArray();
153
+ } catch (error) {
154
+ console.warn("Failed to fetch on-chain owners, using provided owners");
155
+ }
156
+ }
157
+ switch (method) {
158
+ case "AddOwner":
159
+ case "addOwnerWithThreshold":
160
+ if (!ownersAdded || ownersAdded.length === 0) {
161
+ throw new Error("Missing parameters for addOwner");
162
+ }
163
+ actions.push({
164
+ to: multisigAddress,
165
+ data: gnosisSafeInterface.encodeFunctionData("addOwnerWithThreshold", [
166
+ ownersAdded[0],
167
+ newThreshold || threshold
168
+ ]),
169
+ value: "0"
170
+ });
171
+ break;
172
+ case "RemoveOwner":
173
+ case "removeOwner":
174
+ if (!ownersRemoved || ownersRemoved.length === 0) {
175
+ throw new Error("Missing parameters for removeOwner");
176
+ }
177
+ const ownerToRemove = ownersRemoved[0];
178
+ const ownerToRemoveLower = ownerToRemove.toLowerCase();
179
+ const index = onChainOwners.findIndex(
180
+ (owner) => owner.toLowerCase() === ownerToRemoveLower
181
+ );
182
+ if (index === -1) throw new Error("Owner not found");
183
+ if (onChainOwners.length === 2)
184
+ throw new Error("Multisig should have at least 2 owners");
185
+ const prevOwner = index === 0 ? SENTINEL_OWNERS : onChainOwners[index - 1];
186
+ actions.push({
187
+ to: multisigAddress,
188
+ data: gnosisSafeInterface.encodeFunctionData("removeOwner", [
189
+ prevOwner,
190
+ ownerToRemove,
191
+ newThreshold || threshold
192
+ ]),
193
+ value: "0"
194
+ });
195
+ break;
196
+ case "ChangeThreshold":
197
+ case "changeThreshold":
198
+ if (newThreshold == null) {
199
+ throw new Error("Missing parameters for changeThreshold");
200
+ }
201
+ actions.push({
202
+ to: multisigAddress,
203
+ data: gnosisSafeInterface.encodeFunctionData("changeThreshold", [
204
+ newThreshold
205
+ ]),
206
+ value: "0"
207
+ });
208
+ break;
209
+ case "MultiSend":
210
+ case "multiSend": {
211
+ const ownersToProcessAdd = [...ownersAdded ?? []];
212
+ const ownersToProcessRemove = [...ownersRemoved ?? []];
213
+ if (ownersToProcessAdd.length > 0 && ownersToProcessRemove.length > 0) {
214
+ const swapCount = Math.min(
215
+ ownersToProcessAdd.length,
216
+ ownersToProcessRemove.length
217
+ );
218
+ for (let i = 0; i < swapCount; i++) {
219
+ const oldOwner = ownersToProcessRemove.shift();
220
+ const newOwner = ownersToProcessAdd.shift();
221
+ const oldOwnerLower = oldOwner.toLowerCase();
222
+ const ownerIndex = onChainOwners.findIndex(
223
+ (o) => o.toLowerCase() === oldOwnerLower
224
+ );
225
+ if (ownerIndex === -1) {
226
+ throw new Error(
227
+ `Owner to remove (${oldOwner}) not found on-chain for swap.`
228
+ );
229
+ }
230
+ const prevOwnerForSwap = ownerIndex === 0 ? SENTINEL_OWNERS : onChainOwners[ownerIndex - 1];
231
+ actions.push({
232
+ to: multisigAddress,
233
+ data: gnosisSafeInterface.encodeFunctionData("swapOwner", [
234
+ prevOwnerForSwap,
235
+ oldOwner,
236
+ newOwner
237
+ ]),
238
+ value: "0"
239
+ });
240
+ onChainOwners.splice(ownerIndex, 1, newOwner);
241
+ }
242
+ }
243
+ if (ownersToProcessAdd.length > 0) {
244
+ ownersToProcessAdd.forEach((owner) => {
245
+ actions.push({
246
+ to: multisigAddress,
247
+ data: gnosisSafeInterface.encodeFunctionData(
248
+ "addOwnerWithThreshold",
249
+ [owner, newThreshold ?? threshold]
250
+ ),
251
+ value: "0"
252
+ });
253
+ onChainOwners.push(owner);
254
+ });
255
+ }
256
+ if (ownersToProcessRemove.length > 0) {
257
+ ownersToProcessRemove.forEach((ownerToRemove2) => {
258
+ const ownerToRemoveLower2 = ownerToRemove2.toLowerCase();
259
+ const index2 = onChainOwners.findIndex(
260
+ (owner) => owner.toLowerCase() === ownerToRemoveLower2
261
+ );
262
+ if (index2 === -1) {
263
+ throw new Error(`Owner to remove (${ownerToRemove2}) not found.`);
264
+ }
265
+ const prevOwner2 = index2 === 0 ? SENTINEL_OWNERS : onChainOwners[index2 - 1];
266
+ actions.push({
267
+ to: multisigAddress,
268
+ data: gnosisSafeInterface.encodeFunctionData("removeOwner", [
269
+ prevOwner2,
270
+ ownerToRemove2,
271
+ newThreshold ?? threshold
272
+ ]),
273
+ value: "0"
274
+ });
275
+ onChainOwners.splice(index2, 1);
276
+ });
277
+ }
278
+ if (newThreshold != null && ownersToProcessAdd.length === 0 && ownersToProcessRemove.length === 0) {
279
+ actions.push({
280
+ to: multisigAddress,
281
+ data: gnosisSafeInterface.encodeFunctionData("changeThreshold", [
282
+ newThreshold
283
+ ]),
284
+ value: "0"
285
+ });
286
+ }
287
+ if (actions.length === 0) {
288
+ throw new Error("MultiSend method called with no actions to create.");
289
+ }
290
+ break;
291
+ }
292
+ default:
293
+ throw new Error(`Unsupported EVM method: ${method}`);
294
+ }
295
+ return actions;
296
+ }
297
+ function createEvmSendAction(to, amount, isNative, tokenAddress, decimals) {
298
+ if (isNative) {
299
+ const valueInWei = ethers.parseUnits(amount, 18).toString();
300
+ return {
301
+ to,
302
+ data: "0x",
303
+ value: valueInWei
304
+ };
305
+ } else {
306
+ if (!tokenAddress || decimals === void 0) {
307
+ throw new Error("Token address and decimals required for ERC20 transfer");
308
+ }
309
+ const valueInUnits = ethers.parseUnits(amount, decimals);
310
+ const data = erc20Interface.encodeFunctionData("transfer", [
311
+ to,
312
+ valueInUnits
313
+ ]);
314
+ return {
315
+ to: tokenAddress,
316
+ data,
317
+ value: "0"
318
+ };
319
+ }
320
+ }
321
+ function createSolanaInstructions(method, ownersAdded, ownersRemoved, newThreshold) {
322
+ const instructions = [];
323
+ switch (method) {
324
+ case "addOwner" /* addOwner */:
325
+ case "addOwner":
326
+ if (!ownersAdded || ownersAdded.length === 0)
327
+ throw new Error("Missing parameters for Solana addOwner instruction.");
328
+ return [{ type: method, newOwner: ownersAdded[0] }];
329
+ case "removeOwner" /* removeOwner */:
330
+ case "removeOwner":
331
+ if (!ownersRemoved || ownersRemoved.length === 0)
332
+ throw new Error(
333
+ "Missing parameters for Solana removeOwner instruction."
334
+ );
335
+ return [{ type: method, removeOwner: ownersRemoved[0] }];
336
+ case "changeThreshold" /* changeThreshold */:
337
+ case "changeThreshold":
338
+ if (newThreshold === void 0)
339
+ throw new Error(
340
+ "Missing parameters for Solana changeThreshold instruction."
341
+ );
342
+ return [{ type: method, newThreshold }];
343
+ case "MultiSend" /* MultiSend */:
344
+ case "MultiSend":
345
+ if (ownersAdded && ownersAdded.length > 0) {
346
+ ownersAdded.forEach((owner) => {
347
+ instructions.push({
348
+ type: "addOwner" /* addOwner */,
349
+ newOwner: owner
350
+ });
351
+ });
352
+ }
353
+ if (ownersRemoved && ownersRemoved.length > 0) {
354
+ ownersRemoved.forEach((owner) => {
355
+ instructions.push({
356
+ type: "removeOwner" /* removeOwner */,
357
+ removeOwner: owner
358
+ });
359
+ });
360
+ }
361
+ if (newThreshold !== void 0) {
362
+ instructions.push({
363
+ type: "changeThreshold" /* changeThreshold */,
364
+ newThreshold
365
+ });
366
+ }
367
+ if (instructions.length === 0) {
368
+ throw new Error("MultiSend method called with no actions to create.");
369
+ }
370
+ return instructions;
371
+ default:
372
+ throw new Error(`Unsupported Solana instruction method: ${method}`);
373
+ }
374
+ }
375
+ function createTronInstruction(method, owners, newThreshold) {
376
+ switch (method) {
377
+ case "updateOwners" /* updateOwners */:
378
+ case "updateOwners":
379
+ if (!owners) {
380
+ throw new Error(
381
+ "Owners are required for Tron updateOwners instruction."
382
+ );
383
+ }
384
+ return { type: method, owners };
385
+ case "changeThreshold" /* changeThreshold */:
386
+ case "changeThreshold":
387
+ if (newThreshold === void 0) {
388
+ throw new Error(
389
+ "New threshold is required for Tron changeThreshold instruction."
390
+ );
391
+ }
392
+ return { type: method, newThreshold };
393
+ case "updateOwnerThreshold" /* updateOwnerThreshold */:
394
+ case "updateOwnerThreshold":
395
+ if (!owners || newThreshold === void 0) {
396
+ throw new Error(
397
+ "Both owners and newThreshold are required for Tron updateOwnerThreshold instruction."
398
+ );
399
+ }
400
+ return {
401
+ type: method,
402
+ owners,
403
+ newThreshold
404
+ };
405
+ default:
406
+ throw new Error("Unsupported Tron instruction method.");
407
+ }
408
+ }
409
+ export {
410
+ createEvmActions,
411
+ createEvmSendAction,
412
+ createSolanaInstructions,
413
+ createTronInstruction,
414
+ getChangeMethod,
415
+ isSendOrder,
416
+ isSettingsOrder
417
+ };
418
+ //# sourceMappingURL=order-helpers-4TZ72BRJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/api/order-helpers.ts","../src/api/gnosis-abi.ts"],"sourcesContent":["import { ethers } from \"ethers\";\nimport { GNOSIS_SAFE_ABI, ERC20_ABI, SENTINEL_OWNERS } from \"./gnosis-abi\";\nimport {\n EChainType,\n EvmMethodType,\n ESolanaInstructionType,\n ETronOrderType,\n OrderInstruction,\n} from \"../core/types\";\n\nconst gnosisSafeInterface = new ethers.Interface(GNOSIS_SAFE_ABI);\nconst erc20Interface = new ethers.Interface(ERC20_ABI);\n\n/**\n * Determines if an order is a send order (token transfer)\n */\nexport function isSendOrder(method: string): boolean {\n const sendMethods = [\n \"native\",\n \"erc20\",\n \"spl\",\n \"trc20\",\n \"trc\",\n ESolanaInstructionType.native,\n ESolanaInstructionType.spl,\n ETronOrderType.native,\n ETronOrderType.trc20,\n ETronOrderType.trc,\n ];\n return sendMethods.includes(method);\n}\n\n/**\n * Determines if an order is a settings order (multisig configuration change)\n */\nexport function isSettingsOrder(method: string): boolean {\n return !isSendOrder(method);\n}\n\n/**\n * Determines the correct method based on changes to multisig\n * Based on frontend getChangeMethod logic\n */\nexport function getChangeMethod(\n chainType: EChainType,\n ownersAddedCount: number,\n ownersRemovedCount: number,\n thresholdChanged: boolean\n): string | null {\n\n const hasMultipleOwnerChanges =\n ownersAddedCount > 1 || ownersRemovedCount > 1;\n const hasMixedChanges =\n (ownersAddedCount > 0 && thresholdChanged) ||\n (ownersRemovedCount > 0 && thresholdChanged) ||\n (ownersRemovedCount > 0 && ownersAddedCount > 0);\n const isMultiSendCase = hasMultipleOwnerChanges || hasMixedChanges;\n\n if (isMultiSendCase) {\n if (chainType === EChainType.EVM) {\n return \"MultiSend\";\n } else if (chainType === EChainType.SOL) {\n return ESolanaInstructionType.MultiSend;\n } else if (chainType === EChainType.TRON) {\n return ETronOrderType.updateOwnerThreshold;\n }\n }\n\n if (ownersAddedCount === 1) {\n if (chainType === EChainType.EVM) {\n return \"AddOwner\";\n } else if (chainType === EChainType.SOL) {\n return ESolanaInstructionType.addOwner;\n } else if (chainType === EChainType.TRON) {\n return ETronOrderType.updateOwners;\n }\n } else if (ownersRemovedCount === 1) {\n if (chainType === EChainType.EVM) {\n return \"RemoveOwner\";\n } else if (chainType === EChainType.SOL) {\n return ESolanaInstructionType.removeOwner;\n } else if (chainType === EChainType.TRON) {\n return ETronOrderType.updateOwners;\n }\n } else if (thresholdChanged) {\n if (chainType === EChainType.EVM) {\n return \"ChangeThreshold\";\n } else if (chainType === EChainType.SOL) {\n return ESolanaInstructionType.changeThreshold;\n } else if (chainType === EChainType.TRON) {\n return ETronOrderType.changeThreshold;\n }\n }\n\n return null;\n}\n\nexport interface CreateEvmActionsParams {\n chainId: string;\n method: string;\n multisigAddress: string;\n threshold: number;\n newThreshold?: number | null;\n owners: string[];\n ownersAdded?: string[];\n ownersRemoved?: string[];\n provider?: ethers.JsonRpcProvider;\n}\n\n/**\n * Creates EVM actions (Gnosis Safe encoded function calls)\n * Based on frontend createEvmActions logic\n */\nexport async function createEvmActions(\n params: CreateEvmActionsParams\n): Promise<Array<{ to: string; data: string; value: string }>> {\n const {\n method,\n multisigAddress,\n threshold,\n newThreshold = null,\n owners,\n ownersAdded,\n ownersRemoved,\n provider,\n } = params;\n\n const actions: Array<{ to: string; data: string; value: string }> = [];\n const currentOwners = [...owners];\n\n let onChainOwners = currentOwners;\n if (provider && multisigAddress) {\n try {\n const safe = new ethers.Contract(\n multisigAddress,\n GNOSIS_SAFE_ABI,\n provider\n );\n onChainOwners = (await safe.getOwners()).toArray() as string[];\n } catch (error) {\n console.warn(\"Failed to fetch on-chain owners, using provided owners\");\n }\n }\n\n switch (method) {\n case \"AddOwner\":\n case \"addOwnerWithThreshold\":\n if (!ownersAdded || ownersAdded.length === 0) {\n throw new Error(\"Missing parameters for addOwner\");\n }\n actions.push({\n to: multisigAddress,\n data: gnosisSafeInterface.encodeFunctionData(\"addOwnerWithThreshold\", [\n ownersAdded[0],\n newThreshold || threshold,\n ]),\n value: \"0\",\n });\n break;\n\n case \"RemoveOwner\":\n case \"removeOwner\":\n if (!ownersRemoved || ownersRemoved.length === 0) {\n throw new Error(\"Missing parameters for removeOwner\");\n }\n const ownerToRemove = ownersRemoved[0];\n const ownerToRemoveLower = ownerToRemove.toLowerCase();\n\n const index = onChainOwners.findIndex(\n (owner) => owner.toLowerCase() === ownerToRemoveLower\n );\n if (index === -1) throw new Error(\"Owner not found\");\n if (onChainOwners.length === 2)\n throw new Error(\"Multisig should have at least 2 owners\");\n\n const prevOwner =\n index === 0 ? SENTINEL_OWNERS : onChainOwners[index - 1];\n\n actions.push({\n to: multisigAddress,\n data: gnosisSafeInterface.encodeFunctionData(\"removeOwner\", [\n prevOwner,\n ownerToRemove,\n newThreshold || threshold,\n ]),\n value: \"0\",\n });\n break;\n\n case \"ChangeThreshold\":\n case \"changeThreshold\":\n if (newThreshold == null) {\n throw new Error(\"Missing parameters for changeThreshold\");\n }\n actions.push({\n to: multisigAddress,\n data: gnosisSafeInterface.encodeFunctionData(\"changeThreshold\", [\n newThreshold,\n ]),\n value: \"0\",\n });\n break;\n\n case \"MultiSend\":\n case \"multiSend\": {\n const ownersToProcessAdd = [...(ownersAdded ?? [])];\n const ownersToProcessRemove = [...(ownersRemoved ?? [])];\n\n // Optimize: swap owners where possible\n if (ownersToProcessAdd.length > 0 && ownersToProcessRemove.length > 0) {\n const swapCount = Math.min(\n ownersToProcessAdd.length,\n ownersToProcessRemove.length\n );\n\n for (let i = 0; i < swapCount; i++) {\n const oldOwner = ownersToProcessRemove.shift()!;\n const newOwner = ownersToProcessAdd.shift()!;\n\n const oldOwnerLower = oldOwner.toLowerCase();\n const ownerIndex = onChainOwners.findIndex(\n (o) => o.toLowerCase() === oldOwnerLower\n );\n\n if (ownerIndex === -1) {\n throw new Error(\n `Owner to remove (${oldOwner}) not found on-chain for swap.`\n );\n }\n\n const prevOwnerForSwap =\n ownerIndex === 0 ? SENTINEL_OWNERS : onChainOwners[ownerIndex - 1];\n\n actions.push({\n to: multisigAddress,\n data: gnosisSafeInterface.encodeFunctionData(\"swapOwner\", [\n prevOwnerForSwap,\n oldOwner,\n newOwner,\n ]),\n value: \"0\",\n });\n\n onChainOwners.splice(ownerIndex, 1, newOwner);\n }\n }\n\n // Add remaining owners\n if (ownersToProcessAdd.length > 0) {\n ownersToProcessAdd.forEach((owner) => {\n actions.push({\n to: multisigAddress,\n data: gnosisSafeInterface.encodeFunctionData(\n \"addOwnerWithThreshold\",\n [owner, newThreshold ?? threshold]\n ),\n value: \"0\",\n });\n onChainOwners.push(owner);\n });\n }\n\n if (ownersToProcessRemove.length > 0) {\n ownersToProcessRemove.forEach((ownerToRemove) => {\n const ownerToRemoveLower = ownerToRemove.toLowerCase();\n const index = onChainOwners.findIndex(\n (owner) => owner.toLowerCase() === ownerToRemoveLower\n );\n\n if (index === -1) {\n throw new Error(`Owner to remove (${ownerToRemove}) not found.`);\n }\n\n const prevOwner =\n index === 0 ? SENTINEL_OWNERS : onChainOwners[index - 1];\n\n actions.push({\n to: multisigAddress,\n data: gnosisSafeInterface.encodeFunctionData(\"removeOwner\", [\n prevOwner,\n ownerToRemove,\n newThreshold ?? threshold,\n ]),\n value: \"0\",\n });\n\n onChainOwners.splice(index, 1);\n });\n }\n\n if (\n newThreshold != null &&\n ownersToProcessAdd.length === 0 &&\n ownersToProcessRemove.length === 0\n ) {\n actions.push({\n to: multisigAddress,\n data: gnosisSafeInterface.encodeFunctionData(\"changeThreshold\", [\n newThreshold,\n ]),\n value: \"0\",\n });\n }\n\n if (actions.length === 0) {\n throw new Error(\"MultiSend method called with no actions to create.\");\n }\n break;\n }\n\n default:\n throw new Error(`Unsupported EVM method: ${method}`);\n }\n\n return actions;\n}\n\n/**\n * Creates EVM send action (native or ERC20 token transfer)\n */\nexport function createEvmSendAction(\n to: string,\n amount: string,\n isNative: boolean,\n tokenAddress?: string,\n decimals?: number\n): { to: string; data: string; value: string } {\n if (isNative) {\n const valueInWei = ethers.parseUnits(amount, 18).toString();\n return {\n to,\n data: \"0x\",\n value: valueInWei,\n };\n } else {\n // ERC20 token transfer\n if (!tokenAddress || decimals === undefined) {\n throw new Error(\"Token address and decimals required for ERC20 transfer\");\n }\n const valueInUnits = ethers.parseUnits(amount, decimals);\n const data = erc20Interface.encodeFunctionData(\"transfer\", [\n to,\n valueInUnits,\n ]);\n return {\n to: tokenAddress,\n data,\n value: \"0\",\n };\n }\n}\n\n/**\n * Creates Solana instructions for settings orders\n * Based on frontend createSolanaInstructions logic\n */\nexport function createSolanaInstructions(\n method: string,\n ownersAdded?: string[],\n ownersRemoved?: string[],\n newThreshold?: number\n): OrderInstruction[] {\n const instructions: OrderInstruction[] = [];\n\n switch (method) {\n case ESolanaInstructionType.addOwner:\n case \"addOwner\":\n if (!ownersAdded || ownersAdded.length === 0)\n throw new Error(\"Missing parameters for Solana addOwner instruction.\");\n return [{ type: method, newOwner: ownersAdded[0] }];\n\n case ESolanaInstructionType.removeOwner:\n case \"removeOwner\":\n if (!ownersRemoved || ownersRemoved.length === 0)\n throw new Error(\n \"Missing parameters for Solana removeOwner instruction.\"\n );\n return [{ type: method, removeOwner: ownersRemoved[0] }];\n\n case ESolanaInstructionType.changeThreshold:\n case \"changeThreshold\":\n if (newThreshold === undefined)\n throw new Error(\n \"Missing parameters for Solana changeThreshold instruction.\"\n );\n return [{ type: method, newThreshold: newThreshold }];\n\n case ESolanaInstructionType.MultiSend:\n case \"MultiSend\":\n if (ownersAdded && ownersAdded.length > 0) {\n ownersAdded.forEach((owner) => {\n instructions.push({\n type: ESolanaInstructionType.addOwner,\n newOwner: owner,\n });\n });\n }\n\n if (ownersRemoved && ownersRemoved.length > 0) {\n ownersRemoved.forEach((owner) => {\n instructions.push({\n type: ESolanaInstructionType.removeOwner,\n removeOwner: owner,\n });\n });\n }\n\n if (newThreshold !== undefined) {\n instructions.push({\n type: ESolanaInstructionType.changeThreshold,\n newThreshold: newThreshold,\n });\n }\n\n if (instructions.length === 0) {\n throw new Error(\"MultiSend method called with no actions to create.\");\n }\n return instructions;\n\n default:\n throw new Error(`Unsupported Solana instruction method: ${method}`);\n }\n}\n\n/**\n * Creates Tron instruction for settings orders\n * Based on frontend createTronInstructions logic\n */\nexport function createTronInstruction(\n method: string,\n owners?: string[],\n newThreshold?: number\n): OrderInstruction {\n switch (method) {\n case ETronOrderType.updateOwners:\n case \"updateOwners\":\n if (!owners) {\n throw new Error(\n \"Owners are required for Tron updateOwners instruction.\"\n );\n }\n return { type: method, owners: owners };\n\n case ETronOrderType.changeThreshold:\n case \"changeThreshold\":\n if (newThreshold === undefined) {\n throw new Error(\n \"New threshold is required for Tron changeThreshold instruction.\"\n );\n }\n return { type: method, newThreshold: newThreshold };\n\n case ETronOrderType.updateOwnerThreshold:\n case \"updateOwnerThreshold\":\n if (!owners || newThreshold === undefined) {\n throw new Error(\n \"Both owners and newThreshold are required for Tron updateOwnerThreshold instruction.\"\n );\n }\n return {\n type: method,\n owners: owners,\n newThreshold: newThreshold,\n };\n\n default:\n throw new Error(\"Unsupported Tron instruction method.\");\n }\n}\n","/**\n * Gnosis Safe ABI for multisig settings operations\n */\n\nexport const GNOSIS_SAFE_ABI = [\n {\n inputs: [\n { internalType: \"address\", name: \"owner\", type: \"address\" },\n { internalType: \"uint256\", name: \"_threshold\", type: \"uint256\" },\n ],\n name: \"addOwnerWithThreshold\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"prevOwner\", type: \"address\" },\n { internalType: \"address\", name: \"owner\", type: \"address\" },\n { internalType: \"uint256\", name: \"_threshold\", type: \"uint256\" },\n ],\n name: \"removeOwner\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"prevOwner\", type: \"address\" },\n { internalType: \"address\", name: \"oldOwner\", type: \"address\" },\n { internalType: \"address\", name: \"newOwner\", type: \"address\" },\n ],\n name: \"swapOwner\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"_threshold\", type: \"uint256\" }],\n name: \"changeThreshold\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getOwners\",\n outputs: [{ internalType: \"address[]\", name: \"\", type: \"address[]\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n];\n\n/**\n * ERC20 ABI for token transfers\n */\nexport const ERC20_ABI = [\n {\n inputs: [\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"transfer\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\n\n/**\n * Sentinel address used in Gnosis Safe for linked list operations\n */\nexport const SENTINEL_OWNERS = \"0x0000000000000000000000000000000000000001\";\n"],"mappings":";;;;AAAA,SAAS,cAAc;;;ACIhB,IAAM,kBAAkB;AAAA,EAC3B;AAAA,IACI,QAAQ;AAAA,MACJ,EAAE,cAAc,WAAW,MAAM,SAAS,MAAM,UAAU;AAAA,MAC1D,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,IACnE;AAAA,IACA,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACV;AAAA,EACA;AAAA,IACI,QAAQ;AAAA,MACJ,EAAE,cAAc,WAAW,MAAM,aAAa,MAAM,UAAU;AAAA,MAC9D,EAAE,cAAc,WAAW,MAAM,SAAS,MAAM,UAAU;AAAA,MAC1D,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU;AAAA,IACnE;AAAA,IACA,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACV;AAAA,EACA;AAAA,IACI,QAAQ;AAAA,MACJ,EAAE,cAAc,WAAW,MAAM,aAAa,MAAM,UAAU;AAAA,MAC9D,EAAE,cAAc,WAAW,MAAM,YAAY,MAAM,UAAU;AAAA,MAC7D,EAAE,cAAc,WAAW,MAAM,YAAY,MAAM,UAAU;AAAA,IACjE;AAAA,IACA,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACV;AAAA,EACA;AAAA,IACI,QAAQ,CAAC,EAAE,cAAc,WAAW,MAAM,cAAc,MAAM,UAAU,CAAC;AAAA,IACzE,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,iBAAiB;AAAA,IACjB,MAAM;AAAA,EACV;AAAA,EACA;AAAA,IACI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,aAAO,EAAE,MAAM,QAAQ,aAA2B;AAAA,IAEtD;AAAA,IACA,KAAK;AACD,UAAI,CAAC,UAAU,iBAAiB,QAAW;AACvC,cAAM,IAAI;AAAA,UACN;AAAA,QACJ;AAAA,MACJ;AACA,aAAO;AAAA,QACH,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACJ;AAAA,IAEJ;AACI,YAAM,IAAI,MAAM,sCAAsC;AAAA,EAC9D;AACJ;","names":["ownerToRemove","ownerToRemoveLower","index","prevOwner"]}
@@ -0,0 +1,32 @@
1
+ import {
2
+ SHAMIR_SHARES_NUM,
3
+ SHAMIR_THRESHOLD,
4
+ bytesToHex,
5
+ combineShares,
6
+ createShares,
7
+ fetchRecoveryShare,
8
+ fetchServerShare,
9
+ fetchShares,
10
+ getReconstructionShares,
11
+ hexToBytes,
12
+ splitPrivateKey,
13
+ updateShares
14
+ } from "./chunk-OTW5PZKP.js";
15
+ import "./chunk-KXIOGAV2.js";
16
+ import "./chunk-L45R2ICF.js";
17
+ import "./chunk-DGUM43GV.js";
18
+ export {
19
+ SHAMIR_SHARES_NUM,
20
+ SHAMIR_THRESHOLD,
21
+ bytesToHex,
22
+ combineShares,
23
+ createShares,
24
+ fetchRecoveryShare,
25
+ fetchServerShare,
26
+ fetchShares,
27
+ getReconstructionShares,
28
+ hexToBytes,
29
+ splitPrivateKey,
30
+ updateShares
31
+ };
32
+ //# sourceMappingURL=shares-Y4CE3S2X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,9 @@
1
+ import {
2
+ WalletApi
3
+ } from "./chunk-DIRO3HK2.js";
4
+ import "./chunk-L45R2ICF.js";
5
+ import "./chunk-DGUM43GV.js";
6
+ export {
7
+ WalletApi
8
+ };
9
+ //# sourceMappingURL=wallet.api-GK3OBWQS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "multisigns-sdk",
3
+ "version": "1.0.0",
4
+ "description": "Unified, framework-agnostic TypeScript SDK for blockchain operations",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": "./dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "typecheck": "tsc --noEmit"
17
+ },
18
+ "keywords": [
19
+ "blockchain",
20
+ "sdk",
21
+ "wallet",
22
+ "multisig",
23
+ "evm",
24
+ "solana",
25
+ "tron",
26
+ "bitcoin"
27
+ ],
28
+ "author": "",
29
+ "license": "MIT",
30
+ "devDependencies": {
31
+ "@types/elliptic": "^6.4.18",
32
+ "tsup": "^8.5.1",
33
+ "typescript": "^5.3.0"
34
+ },
35
+ "dependencies": {
36
+ "@safe-global/types-kit": "^2.0.1",
37
+ "@solana/spl-token": "^0.4.14",
38
+ "@solana/web3.js": "^1.87.0",
39
+ "@sqds/multisig": "^2.1.4",
40
+ "bitcoinjs-lib": "^6.1.0",
41
+ "ecpair": "3.0.0",
42
+ "elliptic": "^6.6.1",
43
+ "ethers": "^6.9.0",
44
+ "hash.js": "^1.1.7",
45
+ "shamir-secret-sharing": "^0.0.4",
46
+ "tiny-secp256k1": "^2.2.4",
47
+ "tronweb": "^6.0.4",
48
+ "viem": "^2.31.3"
49
+ },
50
+ "peerDependencies": {
51
+ "buffer": "^6.0.3"
52
+ }
53
+ }