@dynamic-labs-wallet/node-svm 0.0.120 → 0.0.121
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 +19 -12
- package/index.esm.js +19 -12
- 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
|
@@ -61,7 +61,7 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
61
61
|
*
|
|
62
62
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
63
63
|
* @returns The account address, public key hex, raw public key, and client key shares
|
|
64
|
-
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
|
|
64
|
+
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
65
65
|
try {
|
|
66
66
|
let ceremonyCeremonyCompleteResolver;
|
|
67
67
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
@@ -102,7 +102,8 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
102
102
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
103
103
|
accountAddress,
|
|
104
104
|
externalServerKeyShares,
|
|
105
|
-
password
|
|
105
|
+
password,
|
|
106
|
+
signedSessionId
|
|
106
107
|
});
|
|
107
108
|
return {
|
|
108
109
|
accountAddress,
|
|
@@ -129,11 +130,12 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
129
130
|
* @param message The message to sign (Uint8Array)
|
|
130
131
|
* @param accountAddress Solana address (base58 encoded)
|
|
131
132
|
* @param password The password for encrypted backup shares
|
|
132
|
-
*/ async signMessage({ message, accountAddress, password = undefined }) {
|
|
133
|
+
*/ async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
|
|
133
134
|
await this.verifyPassword({
|
|
134
135
|
accountAddress,
|
|
135
136
|
password,
|
|
136
|
-
walletOperation: node.WalletOperation.SIGN_MESSAGE
|
|
137
|
+
walletOperation: node.WalletOperation.SIGN_MESSAGE,
|
|
138
|
+
signedSessionId
|
|
137
139
|
});
|
|
138
140
|
if (!accountAddress) {
|
|
139
141
|
throw new Error('Account address is required');
|
|
@@ -143,7 +145,8 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
143
145
|
message,
|
|
144
146
|
accountAddress: accountAddress,
|
|
145
147
|
chainName: this.chainName,
|
|
146
|
-
password
|
|
148
|
+
password,
|
|
149
|
+
signedSessionId
|
|
147
150
|
});
|
|
148
151
|
const base58Signature = new web3_js.PublicKey(signatureEd25519).toBase58();
|
|
149
152
|
return base58Signature;
|
|
@@ -152,11 +155,12 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
152
155
|
throw error;
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
|
-
async signTransaction({ senderAddress, transaction, password = undefined }) {
|
|
158
|
+
async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId }) {
|
|
156
159
|
await this.verifyPassword({
|
|
157
160
|
accountAddress: senderAddress,
|
|
158
161
|
password,
|
|
159
|
-
walletOperation: node.WalletOperation.SIGN_TRANSACTION
|
|
162
|
+
walletOperation: node.WalletOperation.SIGN_TRANSACTION,
|
|
163
|
+
signedSessionId
|
|
160
164
|
});
|
|
161
165
|
try {
|
|
162
166
|
let messageToSign;
|
|
@@ -173,7 +177,8 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
173
177
|
message: messageToSign,
|
|
174
178
|
accountAddress: senderAddress,
|
|
175
179
|
chainName: this.chainName,
|
|
176
|
-
password
|
|
180
|
+
password,
|
|
181
|
+
signedSessionId
|
|
177
182
|
});
|
|
178
183
|
if (!signatureEd25519) {
|
|
179
184
|
throw new Error('Signature is undefined');
|
|
@@ -199,11 +204,12 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
199
204
|
* @param accountAddress The account address to export the private key for
|
|
200
205
|
* @param password The password for encrypted backup shares
|
|
201
206
|
* @returns The private key
|
|
202
|
-
*/ async exportPrivateKey({ accountAddress, password = undefined }) {
|
|
207
|
+
*/ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
|
|
203
208
|
const { derivedPrivateKey } = await this.exportKey({
|
|
204
209
|
accountAddress,
|
|
205
210
|
chainName: this.chainName,
|
|
206
|
-
password
|
|
211
|
+
password,
|
|
212
|
+
signedSessionId
|
|
207
213
|
});
|
|
208
214
|
if (!derivedPrivateKey) {
|
|
209
215
|
throw new Error('Derived private key is undefined');
|
|
@@ -257,7 +263,7 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
257
263
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
258
264
|
* @param password The password for encrypted backup shares
|
|
259
265
|
* @returns The account address, raw public key, and client key shares
|
|
260
|
-
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
|
|
266
|
+
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
261
267
|
let ceremonyCeremonyCompleteResolver;
|
|
262
268
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
263
269
|
ceremonyCeremonyCompleteResolver = resolve;
|
|
@@ -294,7 +300,8 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
|
|
|
294
300
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
295
301
|
accountAddress,
|
|
296
302
|
externalServerKeyShares,
|
|
297
|
-
password
|
|
303
|
+
password,
|
|
304
|
+
signedSessionId
|
|
298
305
|
});
|
|
299
306
|
return {
|
|
300
307
|
accountAddress,
|
package/index.esm.js
CHANGED
|
@@ -59,7 +59,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
59
59
|
*
|
|
60
60
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
61
61
|
* @returns The account address, public key hex, raw public key, and client key shares
|
|
62
|
-
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
|
|
62
|
+
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
63
63
|
try {
|
|
64
64
|
let ceremonyCeremonyCompleteResolver;
|
|
65
65
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
@@ -100,7 +100,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
100
100
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
101
101
|
accountAddress,
|
|
102
102
|
externalServerKeyShares,
|
|
103
|
-
password
|
|
103
|
+
password,
|
|
104
|
+
signedSessionId
|
|
104
105
|
});
|
|
105
106
|
return {
|
|
106
107
|
accountAddress,
|
|
@@ -127,11 +128,12 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
127
128
|
* @param message The message to sign (Uint8Array)
|
|
128
129
|
* @param accountAddress Solana address (base58 encoded)
|
|
129
130
|
* @param password The password for encrypted backup shares
|
|
130
|
-
*/ async signMessage({ message, accountAddress, password = undefined }) {
|
|
131
|
+
*/ async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
|
|
131
132
|
await this.verifyPassword({
|
|
132
133
|
accountAddress,
|
|
133
134
|
password,
|
|
134
|
-
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
135
|
+
walletOperation: WalletOperation.SIGN_MESSAGE,
|
|
136
|
+
signedSessionId
|
|
135
137
|
});
|
|
136
138
|
if (!accountAddress) {
|
|
137
139
|
throw new Error('Account address is required');
|
|
@@ -141,7 +143,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
141
143
|
message,
|
|
142
144
|
accountAddress: accountAddress,
|
|
143
145
|
chainName: this.chainName,
|
|
144
|
-
password
|
|
146
|
+
password,
|
|
147
|
+
signedSessionId
|
|
145
148
|
});
|
|
146
149
|
const base58Signature = new PublicKey(signatureEd25519).toBase58();
|
|
147
150
|
return base58Signature;
|
|
@@ -150,11 +153,12 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
150
153
|
throw error;
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
|
-
async signTransaction({ senderAddress, transaction, password = undefined }) {
|
|
156
|
+
async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId }) {
|
|
154
157
|
await this.verifyPassword({
|
|
155
158
|
accountAddress: senderAddress,
|
|
156
159
|
password,
|
|
157
|
-
walletOperation: WalletOperation.SIGN_TRANSACTION
|
|
160
|
+
walletOperation: WalletOperation.SIGN_TRANSACTION,
|
|
161
|
+
signedSessionId
|
|
158
162
|
});
|
|
159
163
|
try {
|
|
160
164
|
let messageToSign;
|
|
@@ -171,7 +175,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
171
175
|
message: messageToSign,
|
|
172
176
|
accountAddress: senderAddress,
|
|
173
177
|
chainName: this.chainName,
|
|
174
|
-
password
|
|
178
|
+
password,
|
|
179
|
+
signedSessionId
|
|
175
180
|
});
|
|
176
181
|
if (!signatureEd25519) {
|
|
177
182
|
throw new Error('Signature is undefined');
|
|
@@ -197,11 +202,12 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
197
202
|
* @param accountAddress The account address to export the private key for
|
|
198
203
|
* @param password The password for encrypted backup shares
|
|
199
204
|
* @returns The private key
|
|
200
|
-
*/ async exportPrivateKey({ accountAddress, password = undefined }) {
|
|
205
|
+
*/ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
|
|
201
206
|
const { derivedPrivateKey } = await this.exportKey({
|
|
202
207
|
accountAddress,
|
|
203
208
|
chainName: this.chainName,
|
|
204
|
-
password
|
|
209
|
+
password,
|
|
210
|
+
signedSessionId
|
|
205
211
|
});
|
|
206
212
|
if (!derivedPrivateKey) {
|
|
207
213
|
throw new Error('Derived private key is undefined');
|
|
@@ -255,7 +261,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
255
261
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
256
262
|
* @param password The password for encrypted backup shares
|
|
257
263
|
* @returns The account address, raw public key, and client key shares
|
|
258
|
-
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
|
|
264
|
+
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
|
|
259
265
|
let ceremonyCeremonyCompleteResolver;
|
|
260
266
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
261
267
|
ceremonyCeremonyCompleteResolver = resolve;
|
|
@@ -292,7 +298,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
292
298
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
293
299
|
accountAddress,
|
|
294
300
|
externalServerKeyShares,
|
|
295
|
-
password
|
|
301
|
+
password,
|
|
302
|
+
signedSessionId
|
|
296
303
|
});
|
|
297
304
|
return {
|
|
298
305
|
accountAddress,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node-svm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.121",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/node": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/node": "0.0.121",
|
|
7
7
|
"@solana/web3.js": "^1.98.2"
|
|
8
8
|
},
|
|
9
9
|
"publishConfig": {
|
package/src/client/client.d.ts
CHANGED
|
@@ -15,10 +15,11 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
15
15
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
16
16
|
* @returns The account address, public key hex, raw public key, and client key shares
|
|
17
17
|
*/
|
|
18
|
-
createWalletAccount({ thresholdSignatureScheme, password, onError, }: {
|
|
18
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, signedSessionId, }: {
|
|
19
19
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
20
20
|
password?: string;
|
|
21
21
|
onError?: (error: Error) => void;
|
|
22
|
+
signedSessionId: string;
|
|
22
23
|
}): Promise<{
|
|
23
24
|
accountAddress: string;
|
|
24
25
|
rawPublicKey: Uint8Array;
|
|
@@ -34,15 +35,17 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
34
35
|
* @param accountAddress Solana address (base58 encoded)
|
|
35
36
|
* @param password The password for encrypted backup shares
|
|
36
37
|
*/
|
|
37
|
-
signMessage({ message, accountAddress, password, }: {
|
|
38
|
+
signMessage({ message, accountAddress, password, signedSessionId, }: {
|
|
38
39
|
message: string;
|
|
39
40
|
accountAddress: string;
|
|
40
41
|
password?: string;
|
|
42
|
+
signedSessionId: string;
|
|
41
43
|
}): Promise<string>;
|
|
42
|
-
signTransaction({ senderAddress, transaction, password, }: {
|
|
44
|
+
signTransaction({ senderAddress, transaction, password, signedSessionId, }: {
|
|
43
45
|
senderAddress: string;
|
|
44
46
|
transaction: VersionedTransaction | Transaction;
|
|
45
47
|
password?: string;
|
|
48
|
+
signedSessionId: string;
|
|
46
49
|
}): Promise<VersionedTransaction | Transaction>;
|
|
47
50
|
/**
|
|
48
51
|
* Exports the private key for a given account address
|
|
@@ -51,9 +54,10 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
51
54
|
* @param password The password for encrypted backup shares
|
|
52
55
|
* @returns The private key
|
|
53
56
|
*/
|
|
54
|
-
exportPrivateKey({ accountAddress, password, }: {
|
|
57
|
+
exportPrivateKey({ accountAddress, password, signedSessionId, }: {
|
|
55
58
|
accountAddress: string;
|
|
56
59
|
password?: string;
|
|
60
|
+
signedSessionId: string;
|
|
57
61
|
}): Promise<{
|
|
58
62
|
derivedPrivateKey: string;
|
|
59
63
|
}>;
|
|
@@ -87,12 +91,13 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
87
91
|
* @param password The password for encrypted backup shares
|
|
88
92
|
* @returns The account address, raw public key, and client key shares
|
|
89
93
|
*/
|
|
90
|
-
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, }: {
|
|
94
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, signedSessionId, }: {
|
|
91
95
|
privateKey: string;
|
|
92
96
|
chainName: string;
|
|
93
97
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
94
98
|
password?: string;
|
|
95
99
|
onError?: (error: Error) => void;
|
|
100
|
+
signedSessionId: string;
|
|
96
101
|
}): Promise<{
|
|
97
102
|
accountAddress: string;
|
|
98
103
|
rawPublicKey: Uint8Array | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EAGzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,WAAW,EACX,oBAAoB,EAErB,MAAM,iBAAiB,CAAC;AAIzB,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;gBAEZ,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,GACnB,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B;IAQD;;;;;OAKG;IACG,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EAGzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,WAAW,EACX,oBAAoB,EAErB,MAAM,iBAAiB,CAAC;AAIzB,qBAAa,sBAAuB,SAAQ,mBAAm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