@@ -26,7 +26,7 @@ export class WalletDeveloperControlled {
26
26
* @param {Object } [options] - Optional parameters for wallet creation.
27
27
* @param {string } [options.tag] - An optional tag to associate with the wallet.
28
28
*
29
- * @returns {Promise<MeshWallet > } A promise that resolves to the created wallet instance.
29
+ * @returns {Promise<Web3ProjectWallet > } A promise that resolves to the created wallet instance.
30
30
*
31
31
* @throws {Error } If the project's public key is not found.
32
32
* @throws {Error } If the wallet creation request to the backend fails.
@@ -66,7 +66,7 @@ export class WalletDeveloperControlled {
66
66
// create wallet
67
67
68
68
const web3Wallet : Web3ProjectWallet = {
69
- id : uuidv4 ( ) , // todo, to be removed should be generated at DB
69
+ id : uuidv4 ( ) ,
70
70
key : encryptedMnemonic ,
71
71
tags : tags || [ ] ,
72
72
projectId : this . sdk . projectId ,
@@ -110,12 +110,16 @@ export class WalletDeveloperControlled {
110
110
* Retrieves a wallet by its ID and decrypts the key with the project's private key.
111
111
*
112
112
* @param walletId - The unique identifier of the wallet to retrieve.
113
+ * @param networkId - The network ID associated with the wallet (0 or 1).
114
+ * @param decryptKey - A boolean indicating whether to decrypt the wallet key (default: false).
115
+ *
113
116
* @returns A promise that resolves to an initialized `MeshWallet` instance.
114
117
* @throws Will throw an error if the private key is not found or if the wallet retrieval fails.
115
118
*/
116
119
async getWallet (
117
120
walletId : string ,
118
- networkId : 0 | 1
121
+ networkId : 0 | 1 ,
122
+ decryptKey = false
119
123
) : Promise < {
120
124
info : Web3ProjectWallet ;
121
125
wallet : MeshWallet ;
@@ -136,6 +140,10 @@ export class WalletDeveloperControlled {
136
140
encryptedDataJSON : web3Wallet . key ,
137
141
} ) ;
138
142
143
+ if ( decryptKey ) {
144
+ web3Wallet . key = mnemonic ;
145
+ }
146
+
139
147
const wallet = new MeshWallet ( {
140
148
networkId : networkId ,
141
149
key : {
0 commit comments