@dynamic-labs-wallet/sui 0.0.82 → 0.0.83
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 +15 -10
- package/index.esm.js +15 -10
- package/package.json +2 -2
- package/src/client/client.d.ts +10 -5
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -44,7 +44,7 @@ const formatMessage = (message, intentScope)=>{
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
47
|
-
async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
|
|
47
|
+
async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
48
48
|
try {
|
|
49
49
|
// Generate key shares for given threshold signature scheme (TSS)
|
|
50
50
|
const { rawPublicKey, clientKeyShares } = await this.keyGen({
|
|
@@ -79,7 +79,8 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
79
79
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
80
80
|
accountAddress,
|
|
81
81
|
clientKeyShares,
|
|
82
|
-
password
|
|
82
|
+
password,
|
|
83
|
+
signedSessionId
|
|
83
84
|
});
|
|
84
85
|
return {
|
|
85
86
|
accountAddress,
|
|
@@ -153,7 +154,7 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
153
154
|
throw error;
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
|
-
async signMessage({ message, accountAddress, password = undefined }) {
|
|
157
|
+
async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
|
|
157
158
|
if (!accountAddress) {
|
|
158
159
|
throw new Error('Account address is required');
|
|
159
160
|
}
|
|
@@ -163,7 +164,8 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
163
164
|
message: formattedMessage,
|
|
164
165
|
accountAddress: accountAddress,
|
|
165
166
|
chainName: this.chainName,
|
|
166
|
-
password
|
|
167
|
+
password,
|
|
168
|
+
signedSessionId
|
|
167
169
|
});
|
|
168
170
|
const formattedSignature = await this.formatSignature(signatureEd25519, accountAddress);
|
|
169
171
|
await this.verifyMessageSignature({
|
|
@@ -177,7 +179,7 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
177
179
|
throw error;
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
|
-
async signTransaction({ transaction, senderAddress, password = undefined }) {
|
|
182
|
+
async signTransaction({ transaction, senderAddress, password = undefined, signedSessionId }) {
|
|
181
183
|
if (!senderAddress) {
|
|
182
184
|
throw new Error('Account address is required');
|
|
183
185
|
}
|
|
@@ -187,7 +189,8 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
187
189
|
message: formattedMessage,
|
|
188
190
|
accountAddress: senderAddress,
|
|
189
191
|
chainName: this.chainName,
|
|
190
|
-
password
|
|
192
|
+
password,
|
|
193
|
+
signedSessionId
|
|
191
194
|
});
|
|
192
195
|
const formattedSignature = await this.formatSignature(signatureEd25519, senderAddress);
|
|
193
196
|
await this.verifyTransactionSignature({
|
|
@@ -258,7 +261,7 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
258
261
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
259
262
|
* @param password The password for encrypted backup shares
|
|
260
263
|
* @returns The account address, raw public key, and client key shares
|
|
261
|
-
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
|
|
264
|
+
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
262
265
|
try {
|
|
263
266
|
const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
|
|
264
267
|
const formattedPrivateKey = await this.convertSuiPrivateKeyToHex(privateKey);
|
|
@@ -298,7 +301,8 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
298
301
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
299
302
|
accountAddress,
|
|
300
303
|
clientKeyShares,
|
|
301
|
-
password
|
|
304
|
+
password,
|
|
305
|
+
signedSessionId
|
|
302
306
|
});
|
|
303
307
|
return {
|
|
304
308
|
accountAddress,
|
|
@@ -316,12 +320,13 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
316
320
|
* @param accountAddress The account address to export the private key for
|
|
317
321
|
* @param password The password for encrypted backup shares
|
|
318
322
|
* @returns The private key
|
|
319
|
-
*/ async exportPrivateKey({ accountAddress, password = undefined }) {
|
|
323
|
+
*/ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
|
|
320
324
|
try {
|
|
321
325
|
const { derivedPrivateKey } = await this.exportKey({
|
|
322
326
|
accountAddress,
|
|
323
327
|
chainName: this.chainName,
|
|
324
|
-
password
|
|
328
|
+
password,
|
|
329
|
+
signedSessionId
|
|
325
330
|
});
|
|
326
331
|
if (!derivedPrivateKey) {
|
|
327
332
|
throw new Error('Derived private key is undefined');
|
package/index.esm.js
CHANGED
|
@@ -42,7 +42,7 @@ const formatMessage = (message, intentScope)=>{
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
45
|
-
async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
|
|
45
|
+
async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
46
46
|
try {
|
|
47
47
|
// Generate key shares for given threshold signature scheme (TSS)
|
|
48
48
|
const { rawPublicKey, clientKeyShares } = await this.keyGen({
|
|
@@ -77,7 +77,8 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
77
77
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
78
78
|
accountAddress,
|
|
79
79
|
clientKeyShares,
|
|
80
|
-
password
|
|
80
|
+
password,
|
|
81
|
+
signedSessionId
|
|
81
82
|
});
|
|
82
83
|
return {
|
|
83
84
|
accountAddress,
|
|
@@ -151,7 +152,7 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
151
152
|
throw error;
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
async signMessage({ message, accountAddress, password = undefined }) {
|
|
155
|
+
async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
|
|
155
156
|
if (!accountAddress) {
|
|
156
157
|
throw new Error('Account address is required');
|
|
157
158
|
}
|
|
@@ -161,7 +162,8 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
161
162
|
message: formattedMessage,
|
|
162
163
|
accountAddress: accountAddress,
|
|
163
164
|
chainName: this.chainName,
|
|
164
|
-
password
|
|
165
|
+
password,
|
|
166
|
+
signedSessionId
|
|
165
167
|
});
|
|
166
168
|
const formattedSignature = await this.formatSignature(signatureEd25519, accountAddress);
|
|
167
169
|
await this.verifyMessageSignature({
|
|
@@ -175,7 +177,7 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
175
177
|
throw error;
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
|
-
async signTransaction({ transaction, senderAddress, password = undefined }) {
|
|
180
|
+
async signTransaction({ transaction, senderAddress, password = undefined, signedSessionId }) {
|
|
179
181
|
if (!senderAddress) {
|
|
180
182
|
throw new Error('Account address is required');
|
|
181
183
|
}
|
|
@@ -185,7 +187,8 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
185
187
|
message: formattedMessage,
|
|
186
188
|
accountAddress: senderAddress,
|
|
187
189
|
chainName: this.chainName,
|
|
188
|
-
password
|
|
190
|
+
password,
|
|
191
|
+
signedSessionId
|
|
189
192
|
});
|
|
190
193
|
const formattedSignature = await this.formatSignature(signatureEd25519, senderAddress);
|
|
191
194
|
await this.verifyTransactionSignature({
|
|
@@ -256,7 +259,7 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
256
259
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
257
260
|
* @param password The password for encrypted backup shares
|
|
258
261
|
* @returns The account address, raw public key, and client key shares
|
|
259
|
-
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
|
|
262
|
+
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
260
263
|
try {
|
|
261
264
|
const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
|
|
262
265
|
const formattedPrivateKey = await this.convertSuiPrivateKeyToHex(privateKey);
|
|
@@ -296,7 +299,8 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
296
299
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
297
300
|
accountAddress,
|
|
298
301
|
clientKeyShares,
|
|
299
|
-
password
|
|
302
|
+
password,
|
|
303
|
+
signedSessionId
|
|
300
304
|
});
|
|
301
305
|
return {
|
|
302
306
|
accountAddress,
|
|
@@ -314,12 +318,13 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
314
318
|
* @param accountAddress The account address to export the private key for
|
|
315
319
|
* @param password The password for encrypted backup shares
|
|
316
320
|
* @returns The private key
|
|
317
|
-
*/ async exportPrivateKey({ accountAddress, password = undefined }) {
|
|
321
|
+
*/ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
|
|
318
322
|
try {
|
|
319
323
|
const { derivedPrivateKey } = await this.exportKey({
|
|
320
324
|
accountAddress,
|
|
321
325
|
chainName: this.chainName,
|
|
322
|
-
password
|
|
326
|
+
password,
|
|
327
|
+
signedSessionId
|
|
323
328
|
});
|
|
324
329
|
if (!derivedPrivateKey) {
|
|
325
330
|
throw new Error('Derived private key is undefined');
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/sui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser": "0.0.83",
|
|
7
7
|
"@mysten/sui": "1.26.0",
|
|
8
8
|
"@noble/hashes": "1.7.1",
|
|
9
9
|
"bech32-converting": "^1.0.9"
|
package/src/client/client.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { ClientKeyShare, DynamicWalletClient, ThresholdSignatureScheme, DynamicW
|
|
|
2
2
|
export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
3
3
|
readonly chainName = "SUI";
|
|
4
4
|
constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, }: DynamicWalletClientProps);
|
|
5
|
-
createWalletAccount({ thresholdSignatureScheme, password, onError, }: {
|
|
5
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, signedSessionId, }: {
|
|
6
6
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
7
7
|
password?: string;
|
|
8
8
|
onError?: (error: Error) => void;
|
|
9
|
+
signedSessionId?: string;
|
|
9
10
|
}): Promise<{
|
|
10
11
|
accountAddress: string;
|
|
11
12
|
publicKeyHex: string;
|
|
@@ -21,15 +22,17 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
21
22
|
private formatSignature;
|
|
22
23
|
private verifyMessageSignature;
|
|
23
24
|
private verifyTransactionSignature;
|
|
24
|
-
signMessage({ message, accountAddress, password, }: {
|
|
25
|
+
signMessage({ message, accountAddress, password, signedSessionId, }: {
|
|
25
26
|
message: string;
|
|
26
27
|
accountAddress: string;
|
|
27
28
|
password?: string;
|
|
29
|
+
signedSessionId?: string;
|
|
28
30
|
}): Promise<string>;
|
|
29
|
-
signTransaction({ transaction, senderAddress, password, }: {
|
|
31
|
+
signTransaction({ transaction, senderAddress, password, signedSessionId, }: {
|
|
30
32
|
transaction: string;
|
|
31
33
|
senderAddress: string;
|
|
32
34
|
password?: string;
|
|
35
|
+
signedSessionId?: string;
|
|
33
36
|
}): Promise<string>;
|
|
34
37
|
deriveAccountAddress({ rawPublicKey }: {
|
|
35
38
|
rawPublicKey: string;
|
|
@@ -62,12 +65,13 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
62
65
|
* @param password The password for encrypted backup shares
|
|
63
66
|
* @returns The account address, raw public key, and client key shares
|
|
64
67
|
*/
|
|
65
|
-
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, }: {
|
|
68
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, signedSessionId, }: {
|
|
66
69
|
privateKey: string;
|
|
67
70
|
chainName: string;
|
|
68
71
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
69
72
|
password?: string;
|
|
70
73
|
onError?: (error: Error) => void;
|
|
74
|
+
signedSessionId?: string;
|
|
71
75
|
}): Promise<{
|
|
72
76
|
accountAddress: string;
|
|
73
77
|
rawPublicKey: string | undefined;
|
|
@@ -80,9 +84,10 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
80
84
|
* @param password The password for encrypted backup shares
|
|
81
85
|
* @returns The private key
|
|
82
86
|
*/
|
|
83
|
-
exportPrivateKey({ accountAddress, password, }: {
|
|
87
|
+
exportPrivateKey({ accountAddress, password, signedSessionId, }: {
|
|
84
88
|
accountAddress: string;
|
|
85
89
|
password?: string;
|
|
90
|
+
signedSessionId?: string;
|
|
86
91
|
}): Promise<string>;
|
|
87
92
|
getSuiWallets(): Promise<any>;
|
|
88
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EAGzB,MAAM,8BAA8B,CAAC;AAkBtC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;gBAEf,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,KAAK,GACN,EAAE,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