@dynamic-labs-wallet/svm 0.0.45 → 0.0.46
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 +34 -2
- package/index.esm.js +35 -3
- package/package.json +3 -3
- package/src/svm/svm.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -22,11 +22,27 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
22
22
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
23
23
|
* @returns The account address, public key hex, raw public key, and client key shares
|
|
24
24
|
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
|
|
25
|
+
let ceremonyCompleted = false;
|
|
25
26
|
try {
|
|
26
27
|
const { rawPublicKey, clientKeyShares } = await this.keyGen({
|
|
27
28
|
chainName: this.chainName,
|
|
28
|
-
thresholdSignatureScheme
|
|
29
|
+
thresholdSignatureScheme,
|
|
30
|
+
onCeremonyComplete: ()=>{
|
|
31
|
+
ceremonyCompleted = true;
|
|
32
|
+
}
|
|
29
33
|
});
|
|
34
|
+
// Wait for the ceremony to complete, timeout after 5 seconds
|
|
35
|
+
await Promise.race([
|
|
36
|
+
(async ()=>{
|
|
37
|
+
while(!ceremonyCompleted){
|
|
38
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
39
|
+
}
|
|
40
|
+
})(),
|
|
41
|
+
browser.timeoutPromise({
|
|
42
|
+
timeInMs: 5000,
|
|
43
|
+
activity: 'Ceremony'
|
|
44
|
+
})
|
|
45
|
+
]);
|
|
30
46
|
if (!rawPublicKey || !(rawPublicKey instanceof Uint8Array)) {
|
|
31
47
|
throw new Error('Raw public key is not a Uint8Array');
|
|
32
48
|
}
|
|
@@ -221,6 +237,7 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
221
237
|
* @param password The password for encrypted backup shares
|
|
222
238
|
* @returns The account address, raw public key, and client key shares
|
|
223
239
|
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
|
|
240
|
+
let ceremonyCompleted = false;
|
|
224
241
|
//get public key from private key
|
|
225
242
|
const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
|
|
226
243
|
const formattedPrivateKey = await this.decodePrivateKeyForSolana(privateKey);
|
|
@@ -228,8 +245,23 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
228
245
|
chainName,
|
|
229
246
|
privateKey: formattedPrivateKey,
|
|
230
247
|
thresholdSignatureScheme,
|
|
231
|
-
onError
|
|
248
|
+
onError,
|
|
249
|
+
onCeremonyComplete: ()=>{
|
|
250
|
+
ceremonyCompleted = true;
|
|
251
|
+
}
|
|
232
252
|
});
|
|
253
|
+
// Wait for the ceremony to complete, timeout after 5 seconds
|
|
254
|
+
await Promise.race([
|
|
255
|
+
(async ()=>{
|
|
256
|
+
while(!ceremonyCompleted){
|
|
257
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
258
|
+
}
|
|
259
|
+
})(),
|
|
260
|
+
browser.timeoutPromise({
|
|
261
|
+
timeInMs: 5000,
|
|
262
|
+
activity: 'Ceremony'
|
|
263
|
+
})
|
|
264
|
+
]);
|
|
233
265
|
if (!rawPublicKey || !clientKeyShares) {
|
|
234
266
|
throw new Error('Error creating wallet account');
|
|
235
267
|
}
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DynamicWalletClient, getClientKeyShareBackupInfo, WalletOperation } from '@dynamic-labs-wallet/browser';
|
|
1
|
+
import { DynamicWalletClient, timeoutPromise, getClientKeyShareBackupInfo, WalletOperation } from '@dynamic-labs-wallet/browser';
|
|
2
2
|
import bs58 from 'bs58';
|
|
3
3
|
import { VersionedTransaction, PublicKey, Keypair } from '@solana/web3.js';
|
|
4
4
|
import '@dynamic-labs-wallet/core';
|
|
@@ -20,11 +20,27 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
20
20
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
21
21
|
* @returns The account address, public key hex, raw public key, and client key shares
|
|
22
22
|
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
|
|
23
|
+
let ceremonyCompleted = false;
|
|
23
24
|
try {
|
|
24
25
|
const { rawPublicKey, clientKeyShares } = await this.keyGen({
|
|
25
26
|
chainName: this.chainName,
|
|
26
|
-
thresholdSignatureScheme
|
|
27
|
+
thresholdSignatureScheme,
|
|
28
|
+
onCeremonyComplete: ()=>{
|
|
29
|
+
ceremonyCompleted = true;
|
|
30
|
+
}
|
|
27
31
|
});
|
|
32
|
+
// Wait for the ceremony to complete, timeout after 5 seconds
|
|
33
|
+
await Promise.race([
|
|
34
|
+
(async ()=>{
|
|
35
|
+
while(!ceremonyCompleted){
|
|
36
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
37
|
+
}
|
|
38
|
+
})(),
|
|
39
|
+
timeoutPromise({
|
|
40
|
+
timeInMs: 5000,
|
|
41
|
+
activity: 'Ceremony'
|
|
42
|
+
})
|
|
43
|
+
]);
|
|
28
44
|
if (!rawPublicKey || !(rawPublicKey instanceof Uint8Array)) {
|
|
29
45
|
throw new Error('Raw public key is not a Uint8Array');
|
|
30
46
|
}
|
|
@@ -219,6 +235,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
219
235
|
* @param password The password for encrypted backup shares
|
|
220
236
|
* @returns The account address, raw public key, and client key shares
|
|
221
237
|
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
|
|
238
|
+
let ceremonyCompleted = false;
|
|
222
239
|
//get public key from private key
|
|
223
240
|
const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
|
|
224
241
|
const formattedPrivateKey = await this.decodePrivateKeyForSolana(privateKey);
|
|
@@ -226,8 +243,23 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
226
243
|
chainName,
|
|
227
244
|
privateKey: formattedPrivateKey,
|
|
228
245
|
thresholdSignatureScheme,
|
|
229
|
-
onError
|
|
246
|
+
onError,
|
|
247
|
+
onCeremonyComplete: ()=>{
|
|
248
|
+
ceremonyCompleted = true;
|
|
249
|
+
}
|
|
230
250
|
});
|
|
251
|
+
// Wait for the ceremony to complete, timeout after 5 seconds
|
|
252
|
+
await Promise.race([
|
|
253
|
+
(async ()=>{
|
|
254
|
+
while(!ceremonyCompleted){
|
|
255
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
256
|
+
}
|
|
257
|
+
})(),
|
|
258
|
+
timeoutPromise({
|
|
259
|
+
timeInMs: 5000,
|
|
260
|
+
activity: 'Ceremony'
|
|
261
|
+
})
|
|
262
|
+
]);
|
|
231
263
|
if (!rawPublicKey || !clientKeyShares) {
|
|
232
264
|
throw new Error('Error creating wallet account');
|
|
233
265
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/svm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
7
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser": "0.0.46",
|
|
7
|
+
"@dynamic-labs-wallet/core": "0.0.46",
|
|
8
8
|
"@solana/web3.js": "^1.98.0",
|
|
9
9
|
"bs58": "^6.0.0"
|
|
10
10
|
},
|
package/src/svm/svm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svm.d.ts","sourceRoot":"","sources":["../../src/svm/svm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"svm.d.ts","sourceRoot":"","sources":["../../src/svm/svm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAA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