@dynamic-labs-wallet/svm 0.0.140 → 0.0.142
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 +9 -9
- package/index.esm.js +9 -9
- package/package.json +2 -2
- package/src/svm/client.d.ts +4 -2
- package/src/svm/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -92,7 +92,7 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
92
92
|
* @param message The message to sign (Uint8Array)
|
|
93
93
|
* @param accountAddress Solana address (base58 encoded)
|
|
94
94
|
* @param password The password for encrypted backup shares
|
|
95
|
-
*/ async signMessage({ message, accountAddress, password = undefined, signedSessionId, mfaToken }) {
|
|
95
|
+
*/ async signMessage({ message, accountAddress, password = undefined, signedSessionId, mfaToken, onError }) {
|
|
96
96
|
await this.verifyPassword({
|
|
97
97
|
accountAddress,
|
|
98
98
|
password,
|
|
@@ -112,7 +112,8 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
112
112
|
mfaToken,
|
|
113
113
|
context: {
|
|
114
114
|
svmMessage: message
|
|
115
|
-
}
|
|
115
|
+
},
|
|
116
|
+
onError
|
|
116
117
|
});
|
|
117
118
|
const base58Signature = bs58.encode(signatureEd25519);
|
|
118
119
|
return base58Signature;
|
|
@@ -121,7 +122,7 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
121
122
|
throw new Error(browser.ERROR_SIGN_MESSAGE);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId, mfaToken, chainId }) {
|
|
125
|
+
async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId, mfaToken, chainId, onError }) {
|
|
125
126
|
await this.verifyPassword({
|
|
126
127
|
accountAddress: senderAddress,
|
|
127
128
|
password,
|
|
@@ -139,7 +140,9 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
139
140
|
chainId,
|
|
140
141
|
base58SerializedTransaction
|
|
141
142
|
});
|
|
142
|
-
const signatureEd25519 = await this.sign(signParams
|
|
143
|
+
const signatureEd25519 = await this.sign(_extends({}, signParams, {
|
|
144
|
+
onError
|
|
145
|
+
}));
|
|
143
146
|
if (!signatureEd25519) {
|
|
144
147
|
throw new Error('Signature is undefined');
|
|
145
148
|
}
|
|
@@ -261,10 +264,6 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
261
264
|
chainName,
|
|
262
265
|
privateKey: formattedPrivateKey,
|
|
263
266
|
thresholdSignatureScheme,
|
|
264
|
-
onError: (error)=>{
|
|
265
|
-
this.logger.error(browser.ERROR_IMPORT_PRIVATE_KEY, error);
|
|
266
|
-
onError == null ? void 0 : onError(error);
|
|
267
|
-
},
|
|
268
267
|
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
269
268
|
// update wallet map
|
|
270
269
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
@@ -282,7 +281,8 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
|
|
|
282
281
|
}
|
|
283
282
|
});
|
|
284
283
|
ceremonyCeremonyCompleteResolver(undefined);
|
|
285
|
-
}
|
|
284
|
+
},
|
|
285
|
+
onError
|
|
286
286
|
});
|
|
287
287
|
// Wait for the ceremony to complete before proceeding
|
|
288
288
|
await ceremonyCompletePromise;
|
package/index.esm.js
CHANGED
|
@@ -90,7 +90,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
90
90
|
* @param message The message to sign (Uint8Array)
|
|
91
91
|
* @param accountAddress Solana address (base58 encoded)
|
|
92
92
|
* @param password The password for encrypted backup shares
|
|
93
|
-
*/ async signMessage({ message, accountAddress, password = undefined, signedSessionId, mfaToken }) {
|
|
93
|
+
*/ async signMessage({ message, accountAddress, password = undefined, signedSessionId, mfaToken, onError }) {
|
|
94
94
|
await this.verifyPassword({
|
|
95
95
|
accountAddress,
|
|
96
96
|
password,
|
|
@@ -110,7 +110,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
110
110
|
mfaToken,
|
|
111
111
|
context: {
|
|
112
112
|
svmMessage: message
|
|
113
|
-
}
|
|
113
|
+
},
|
|
114
|
+
onError
|
|
114
115
|
});
|
|
115
116
|
const base58Signature = bs58.encode(signatureEd25519);
|
|
116
117
|
return base58Signature;
|
|
@@ -119,7 +120,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
119
120
|
throw new Error(ERROR_SIGN_MESSAGE);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
|
-
async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId, mfaToken, chainId }) {
|
|
123
|
+
async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId, mfaToken, chainId, onError }) {
|
|
123
124
|
await this.verifyPassword({
|
|
124
125
|
accountAddress: senderAddress,
|
|
125
126
|
password,
|
|
@@ -137,7 +138,9 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
137
138
|
chainId,
|
|
138
139
|
base58SerializedTransaction
|
|
139
140
|
});
|
|
140
|
-
const signatureEd25519 = await this.sign(signParams
|
|
141
|
+
const signatureEd25519 = await this.sign(_extends({}, signParams, {
|
|
142
|
+
onError
|
|
143
|
+
}));
|
|
141
144
|
if (!signatureEd25519) {
|
|
142
145
|
throw new Error('Signature is undefined');
|
|
143
146
|
}
|
|
@@ -259,10 +262,6 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
259
262
|
chainName,
|
|
260
263
|
privateKey: formattedPrivateKey,
|
|
261
264
|
thresholdSignatureScheme,
|
|
262
|
-
onError: (error)=>{
|
|
263
|
-
this.logger.error(ERROR_IMPORT_PRIVATE_KEY, error);
|
|
264
|
-
onError == null ? void 0 : onError(error);
|
|
265
|
-
},
|
|
266
265
|
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
267
266
|
// update wallet map
|
|
268
267
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
@@ -280,7 +279,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
280
279
|
}
|
|
281
280
|
});
|
|
282
281
|
ceremonyCeremonyCompleteResolver(undefined);
|
|
283
|
-
}
|
|
282
|
+
},
|
|
283
|
+
onError
|
|
284
284
|
});
|
|
285
285
|
// Wait for the ceremony to complete before proceeding
|
|
286
286
|
await ceremonyCompletePromise;
|
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.142",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
7
|
+
"@dynamic-labs-wallet/browser": "0.0.142",
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "^0.0.758",
|
|
9
9
|
"@solana/web3.js": "^1.98.2",
|
|
10
10
|
"bs58": "^6.0.0"
|
package/src/svm/client.d.ts
CHANGED
|
@@ -27,20 +27,22 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
27
27
|
* @param accountAddress Solana address (base58 encoded)
|
|
28
28
|
* @param password The password for encrypted backup shares
|
|
29
29
|
*/
|
|
30
|
-
signMessage({ message, accountAddress, password, signedSessionId, mfaToken, }: {
|
|
30
|
+
signMessage({ message, accountAddress, password, signedSessionId, mfaToken, onError, }: {
|
|
31
31
|
message: string;
|
|
32
32
|
accountAddress: string;
|
|
33
33
|
password?: string;
|
|
34
34
|
signedSessionId: string;
|
|
35
35
|
mfaToken?: string;
|
|
36
|
+
onError?: (error: Error) => void;
|
|
36
37
|
}): Promise<string>;
|
|
37
|
-
signTransaction({ senderAddress, transaction, password, signedSessionId, mfaToken, chainId, }: {
|
|
38
|
+
signTransaction({ senderAddress, transaction, password, signedSessionId, mfaToken, chainId, onError, }: {
|
|
38
39
|
senderAddress: string;
|
|
39
40
|
transaction: string;
|
|
40
41
|
password?: string;
|
|
41
42
|
signedSessionId: string;
|
|
42
43
|
mfaToken?: string;
|
|
43
44
|
chainId?: string;
|
|
45
|
+
onError?: (error: Error) => void;
|
|
44
46
|
}): Promise<string>;
|
|
45
47
|
private prepareTransactionForSigning;
|
|
46
48
|
private buildSignParams;
|
package/src/svm/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/svm/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,wBAAwB,EAMxB,mBAAmB,EACnB,wBAAwB,EAGzB,MAAM,8BAA8B,CAAC;AAmBtC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;gBAEZ,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,KAAK,EACL,YAAY,EACZ,QAA0B,EAC1B,UAAU,GACX,EAAE,wBAAwB;IAc3B;;;;;OAKG;IACG,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,eAAe,GAChB,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,UAAU,GAAG,MAAM,CAAC;KACnC,CAAC;IA2EI,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU;;;IAY5D;;;;;;OAMG;IACG,WAAW,CAAC,EAChB,OAAO,EACP,cAAc,EACd,QAAoB,EACpB,eAAe,EACf,QAAQ,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/svm/client.ts"],"names":[],"mappings":"AAAA,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