@dynamic-labs-wallet/svm 0.0.82 → 0.0.84

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 CHANGED
@@ -23,7 +23,7 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
23
23
  *
24
24
  * @param thresholdSignatureScheme The threshold signature scheme to use
25
25
  * @returns The account address, public key hex, raw public key, and client key shares
26
- */ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
26
+ */ async createWalletAccount({ thresholdSignatureScheme, password = undefined, signedSessionId }) {
27
27
  try {
28
28
  const { rawPublicKey, clientKeyShares } = await this.keyGen({
29
29
  chainName: this.chainName,
@@ -56,7 +56,8 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
56
56
  await this.storeEncryptedBackupByWalletWithRetry({
57
57
  accountAddress,
58
58
  clientKeyShares,
59
- password
59
+ password,
60
+ signedSessionId
60
61
  });
61
62
  return {
62
63
  accountAddress,
@@ -148,13 +149,13 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
148
149
  const { derivedPrivateKey } = await this.exportKey({
149
150
  accountAddress,
150
151
  chainName: this.chainName,
151
- password
152
+ password,
153
+ signedSessionId
152
154
  });
153
155
  if (!derivedPrivateKey) {
154
156
  throw new Error('Derived private key is undefined');
155
157
  }
156
- const privateKeyBytes = Buffer.from(derivedPrivateKey, 'hex');
157
- return JSON.stringify(Array.from(privateKeyBytes));
158
+ return derivedPrivateKey;
158
159
  }
159
160
  /**
160
161
  * Exports the private key for a given account address
@@ -198,7 +199,7 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
198
199
  * @param thresholdSignatureScheme The threshold signature scheme to use
199
200
  * @param password The password for encrypted backup shares
200
201
  * @returns The account address, raw public key, and client key shares
201
- */ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
202
+ */ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
202
203
  //get public key from private key
203
204
  const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
204
205
  const formattedPrivateKey = this.decodePrivateKeyForSolana(privateKey);
@@ -235,7 +236,8 @@ class DynamicSvmWalletClient extends browser.DynamicWalletClient {
235
236
  await this.storeEncryptedBackupByWalletWithRetry({
236
237
  accountAddress,
237
238
  clientKeyShares,
238
- password
239
+ password,
240
+ signedSessionId
239
241
  });
240
242
  return {
241
243
  accountAddress,
package/index.esm.js CHANGED
@@ -21,7 +21,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
21
21
  *
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
- */ async createWalletAccount({ thresholdSignatureScheme, password = undefined }) {
24
+ */ async createWalletAccount({ thresholdSignatureScheme, password = undefined, signedSessionId }) {
25
25
  try {
26
26
  const { rawPublicKey, clientKeyShares } = await this.keyGen({
27
27
  chainName: this.chainName,
@@ -54,7 +54,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
54
54
  await this.storeEncryptedBackupByWalletWithRetry({
55
55
  accountAddress,
56
56
  clientKeyShares,
57
- password
57
+ password,
58
+ signedSessionId
58
59
  });
59
60
  return {
60
61
  accountAddress,
@@ -146,13 +147,13 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
146
147
  const { derivedPrivateKey } = await this.exportKey({
147
148
  accountAddress,
148
149
  chainName: this.chainName,
149
- password
150
+ password,
151
+ signedSessionId
150
152
  });
151
153
  if (!derivedPrivateKey) {
152
154
  throw new Error('Derived private key is undefined');
153
155
  }
154
- const privateKeyBytes = Buffer.from(derivedPrivateKey, 'hex');
155
- return JSON.stringify(Array.from(privateKeyBytes));
156
+ return derivedPrivateKey;
156
157
  }
157
158
  /**
158
159
  * Exports the private key for a given account address
@@ -196,7 +197,7 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
196
197
  * @param thresholdSignatureScheme The threshold signature scheme to use
197
198
  * @param password The password for encrypted backup shares
198
199
  * @returns The account address, raw public key, and client key shares
199
- */ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
200
+ */ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
200
201
  //get public key from private key
201
202
  const publicKey = this.getPublicKeyFromPrivateKey(privateKey);
202
203
  const formattedPrivateKey = this.decodePrivateKeyForSolana(privateKey);
@@ -233,7 +234,8 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
233
234
  await this.storeEncryptedBackupByWalletWithRetry({
234
235
  accountAddress,
235
236
  clientKeyShares,
236
- password
237
+ password,
238
+ signedSessionId
237
239
  });
238
240
  return {
239
241
  accountAddress,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/svm",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@dynamic-labs-wallet/browser": "0.0.82",
6
+ "@dynamic-labs-wallet/browser": "0.0.84",
7
7
  "@solana/web3.js": "^1.98.2",
8
8
  "bs58": "^6.0.0"
9
9
  },
@@ -14,9 +14,10 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
14
14
  * @param thresholdSignatureScheme The threshold signature scheme to use
15
15
  * @returns The account address, public key hex, raw public key, and client key shares
16
16
  */
17
- createWalletAccount({ thresholdSignatureScheme, password, }: {
17
+ createWalletAccount({ thresholdSignatureScheme, password, signedSessionId, }: {
18
18
  thresholdSignatureScheme: ThresholdSignatureScheme;
19
19
  password?: string;
20
+ signedSessionId?: string;
20
21
  }): Promise<{
21
22
  accountAddress: string;
22
23
  rawPublicKey: Uint8Array | string;
@@ -85,12 +86,13 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
85
86
  * @param password The password for encrypted backup shares
86
87
  * @returns The account address, raw public key, and client key shares
87
88
  */
88
- importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, }: {
89
+ importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, signedSessionId, }: {
89
90
  privateKey: string;
90
91
  chainName: string;
91
92
  thresholdSignatureScheme: ThresholdSignatureScheme;
92
93
  password?: string;
93
94
  onError?: (error: Error) => void;
95
+ signedSessionId?: string;
94
96
  }): Promise<{
95
97
  accountAddress: string;
96
98
  rawPublicKey: Uint8Array | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/svm/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EAGzB,MAAM,8BAA8B,CAAC;AAKtC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;gBAEZ,EACV,aAAa,EACb,SAAS,EACT,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;IASD;;;;;OAKG;IACG,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,GACrB,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,UAAU,GAAG,MAAM,CAAC;KACnC,CAAC;IA2DI,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU;;;IAY5D;;;;;;OAMG;IACG,WAAW,CAAC,EAChB,OAAO,EACP,cAAc,EACd,QAAoB,EACpB,eAAe,GAChB,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,E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