pwc-sdk-wallet 0.6.4 → 0.6.5

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/dist/Vault.d.ts CHANGED
@@ -168,7 +168,7 @@ export declare class Vault {
168
168
  * // With progress callback
169
169
  * const result = await Vault.generateVanityHDWallet(
170
170
  * "mypassword",
171
- * (attempts, address) => console.log(`Attempt ${attempts}: ${address}`)
171
+ * (attempts, address) => {}
172
172
  * );
173
173
  * ```
174
174
  */
@@ -196,7 +196,7 @@ export declare class Vault {
196
196
  * // With custom options
197
197
  * const result = await Vault.generateVanityHDWalletMobile(
198
198
  * "mypassword",
199
- * (attempts, address) => console.log(`Attempt ${attempts}: ${address}`),
199
+ * (attempts, address) => {},
200
200
  * { prefix: 'ab', maxAttempts: 10000 }
201
201
  * );
202
202
  * ```
@@ -257,7 +257,7 @@ export declare class Vault {
257
257
  * '0xmyAddress',
258
258
  * recipients,
259
259
  * '1', // Ethereum
260
- * (completed, total, txHash) => console.log(`Completed ${completed}/${total}: ${txHash}`)
260
+ * (completed, total, txHash) => {}
261
261
  * );
262
262
  *
263
263
  * console.log(`Success: ${result.successfulCount}, Failed: ${result.failedCount}`);
@@ -289,7 +289,7 @@ export declare class Vault {
289
289
  * '0xtokenContract',
290
290
  * recipients,
291
291
  * '1', // Ethereum
292
- * (completed, total, txHash) => console.log(`Completed ${completed}/${total}: ${txHash}`)
292
+ * (completed, total, txHash) => {}
293
293
  * );
294
294
  *
295
295
  * console.log(`Success: ${result.successfulCount}, Failed: ${result.failedCount}`);
package/dist/Vault.js CHANGED
@@ -253,7 +253,7 @@ class Vault {
253
253
  currentAttempts.lastAttempt = now;
254
254
  Vault.exportAttempts.set(vaultId, currentAttempts);
255
255
  // Audit logging (without sensitive data)
256
- // console.log(`Mnemonic export attempted for vault ${vaultId}, attempt ${currentAttempts.count}`);
256
+ // Mnemonic export attempt logged
257
257
  try {
258
258
  // Verify password by attempting to decrypt the vault
259
259
  const encryptedVault = await this.encrypt(password);
@@ -262,7 +262,7 @@ class Vault {
262
262
  // Reset attempts on successful export
263
263
  Vault.exportAttempts.delete(vaultId);
264
264
  // Audit logging for successful export
265
- // console.log(`Mnemonic export successful for vault ${vaultId}`);
265
+ // Mnemonic export successful
266
266
  // Use temporary data protection
267
267
  return EncryptionService_1.EncryptionService.withTemporaryData(mnemonic, (tempMnemonic) => {
268
268
  // Return a copy to avoid direct reference to the original
@@ -388,7 +388,7 @@ class Vault {
388
388
  * // With progress callback
389
389
  * const result = await Vault.generateVanityHDWallet(
390
390
  * "mypassword",
391
- * (attempts, address) => console.log(`Attempt ${attempts}: ${address}`)
391
+ * (attempts, address) => {}
392
392
  * );
393
393
  * ```
394
394
  */
@@ -456,7 +456,7 @@ class Vault {
456
456
  * // With custom options
457
457
  * const result = await Vault.generateVanityHDWalletMobile(
458
458
  * "mypassword",
459
- * (attempts, address) => console.log(`Attempt ${attempts}: ${address}`),
459
+ * (attempts, address) => {},
460
460
  * { prefix: 'ab', maxAttempts: 10000 }
461
461
  * );
462
462
  * ```
@@ -634,7 +634,7 @@ class Vault {
634
634
  * '0xmyAddress',
635
635
  * recipients,
636
636
  * '1', // Ethereum
637
- * (completed, total, txHash) => console.log(`Completed ${completed}/${total}: ${txHash}`)
637
+ * (completed, total, txHash) => {}
638
638
  * );
639
639
  *
640
640
  * console.log(`Success: ${result.successfulCount}, Failed: ${result.failedCount}`);
@@ -678,7 +678,7 @@ class Vault {
678
678
  * '0xtokenContract',
679
679
  * recipients,
680
680
  * '1', // Ethereum
681
- * (completed, total, txHash) => console.log(`Completed ${completed}/${total}: ${txHash}`)
681
+ * (completed, total, txHash) => {}
682
682
  * );
683
683
  *
684
684
  * console.log(`Success: ${result.successfulCount}, Failed: ${result.failedCount}`);
@@ -52,7 +52,7 @@ export declare const SECURITY_CONFIG: {
52
52
  };
53
53
  /**
54
54
  * Get PBKDF2 iterations based on environment
55
- * @returns Number of iterations (5000 for development, 10000 for production)
55
+ * @returns Number of iterations (10000 for production, 3000 for development)
56
56
  */
57
57
  export declare function getPBKDF2Iterations(): number;
58
58
  /**
@@ -57,10 +57,17 @@ exports.SECURITY_CONFIG = {
57
57
  };
58
58
  /**
59
59
  * Get PBKDF2 iterations based on environment
60
- * @returns Number of iterations (5000 for development, 10000 for production)
60
+ * @returns Number of iterations (10000 for production, 3000 for development)
61
61
  */
62
62
  function getPBKDF2Iterations() {
63
- return process.env.NODE_ENV === 'production' ? 3000 : 2500;
63
+ // Check if we're in Node.js environment
64
+ if (typeof process !== 'undefined' && process.env) {
65
+ // If NODE_ENV is undefined (React Native), use production values
66
+ return process.env.NODE_ENV === 'development' ? 3000 : 10000;
67
+ }
68
+ // React Native environment - use production values by default for security
69
+ // Mobile apps should be considered production by default
70
+ return 10000;
64
71
  }
65
72
  /**
66
73
  * Network configuration constants
@@ -169,8 +169,7 @@ export declare class QRCodeService {
169
169
  * ```typescript
170
170
  * // Validate QR code before processing
171
171
  * const validation = QRCodeService.validateQRCode(qrString);
172
- * console.log('QR type:', validation.type);
173
- * console.log('Is valid:', validation.isValid);
172
+ * // QR validation completed
174
173
  * ```
175
174
  */
176
175
  static validateQRCode(qrString: string): {
@@ -259,8 +259,7 @@ class QRCodeService {
259
259
  * ```typescript
260
260
  * // Validate QR code before processing
261
261
  * const validation = QRCodeService.validateQRCode(qrString);
262
- * console.log('QR type:', validation.type);
263
- * console.log('Is valid:', validation.isValid);
262
+ * // QR validation completed
264
263
  * ```
265
264
  */
266
265
  static validateQRCode(qrString) {
@@ -16,7 +16,6 @@ export declare function getProviderAuto(chainId: ChainId): ethers.JsonRpcProvide
16
16
  * @example
17
17
  * ```typescript
18
18
  * const balance = await getTokenBalance('0xToken...', '0xAccount...', '1');
19
- * console.log('Balance:', ethers.formatUnits(balance, 18));
20
19
  * ```
21
20
  */
22
21
  export declare function getTokenBalance(tokenAddress: string, account: string, chainId: ChainId): Promise<bigint>;
@@ -28,7 +27,6 @@ export declare function getTokenBalance(tokenAddress: string, account: string, c
28
27
  * @example
29
28
  * ```typescript
30
29
  * const info = await getTokenInfo('0xToken...', '1');
31
- * console.log('Token:', info.name, '(', info.symbol, ')');
32
30
  * ```
33
31
  */
34
32
  export declare function getTokenInfo(tokenAddress: string, chainId: ChainId): Promise<{
@@ -46,7 +44,6 @@ export declare function getTokenInfo(tokenAddress: string, chainId: ChainId): Pr
46
44
  * @example
47
45
  * ```typescript
48
46
  * const balance = await getNativeBalance('0xAccount...', '1');
49
- * console.log('ETH Balance:', ethers.formatEther(balance));
50
47
  * ```
51
48
  */
52
49
  export declare function getNativeBalance(account: string, chainId: ChainId): Promise<bigint>;
@@ -60,7 +57,6 @@ export declare function getNativeBalance(account: string, chainId: ChainId): Pro
60
57
  * @example
61
58
  * ```typescript
62
59
  * const allowance = await checkAllowance('0xToken...', '0xOwner...', '0xSpender...', '1');
63
- * console.log('Allowance:', ethers.formatUnits(allowance, 18));
64
60
  * ```
65
61
  */
66
62
  export declare function checkAllowance(tokenAddress: string, owner: string, spender: string, chainId: ChainId): Promise<bigint>;
@@ -128,7 +124,6 @@ export declare function approveTokenWithVault(vault: Vault, fromAddress: string,
128
124
  * @example
129
125
  * ```typescript
130
126
  * const txResponse = await sendTransaction(signedTx, '1');
131
- * console.log('Transaction hash:', txResponse.hash);
132
127
  * ```
133
128
  */
134
129
  export declare function sendTransaction(signedTx: string, chainId: ChainId): Promise<ethers.TransactionResponse>;
@@ -142,7 +137,7 @@ export declare function sendTransaction(signedTx: string, chainId: ChainId): Pro
142
137
  * ```typescript
143
138
  * trackTxStatus('0xTxHash...', '1', (status, receipt) => {
144
139
  * if (status === 'confirmed') {
145
- * console.log('Transaction confirmed!');
140
+ * // Transaction confirmed
146
141
  * }
147
142
  * });
148
143
  * ```
@@ -157,7 +152,6 @@ export declare function trackTxStatus(txHash: string, chainId: ChainId, callback
157
152
  * @example
158
153
  * ```typescript
159
154
  * const nonce = await getNonce('0xYourAddress', '1');
160
- * console.log('Current nonce:', nonce);
161
155
  * ```
162
156
  */
163
157
  export declare function getNonce(address: string, chainId: ChainId): Promise<number>;
@@ -171,7 +165,6 @@ export declare function getNonce(address: string, chainId: ChainId): Promise<num
171
165
  * @example
172
166
  * ```typescript
173
167
  * const signature = await signMessageWithVault('Hello World', vault, '0xYourAddress');
174
- * console.log('Signature:', signature);
175
168
  * ```
176
169
  */
177
170
  export declare function signMessageWithVault(message: string, vault: Vault, fromAddress: string): Promise<string>;
@@ -184,7 +177,6 @@ export declare function signMessageWithVault(message: string, vault: Vault, from
184
177
  * @example
185
178
  * ```typescript
186
179
  * const signature = await signMessage('Hello World', 'your-private-key');
187
- * console.log('Signature:', signature);
188
180
  * ```
189
181
  */
190
182
  export declare function signMessage(message: string, privateKey: string): Promise<string>;
@@ -196,7 +188,6 @@ export declare function signMessage(message: string, privateKey: string): Promis
196
188
  * @example
197
189
  * ```typescript
198
190
  * const signerAddress = await verifyMessage('Hello World', '0xSignature...');
199
- * console.log('Message was signed by:', signerAddress);
200
191
  * ```
201
192
  */
202
193
  export declare function verifyMessage(message: string, signature: string): Promise<string>;
@@ -250,7 +241,6 @@ export declare function signTypedData(typedData: any, privateKey: string): Promi
250
241
  * @example
251
242
  * ```typescript
252
243
  * const signerAddress = await verifyTypedData(typedData, '0xSignature...');
253
- * console.log('Typed data was signed by:', signerAddress);
254
244
  * ```
255
245
  */
256
246
  export declare function verifyTypedData(typedData: any, signature: string): Promise<string>;
@@ -265,8 +255,6 @@ export declare function verifyTypedData(typedData: any, signature: string): Prom
265
255
  * @example
266
256
  * ```typescript
267
257
  * const result = await signMessageWithNonce('Hello World', vault, '0xYourAddress', '1');
268
- * console.log('Signature:', result.signature);
269
- * console.log('Nonce:', result.nonce);
270
258
  * ```
271
259
  */
272
260
  export declare function signMessageWithNonce(message: string, vault: Vault, fromAddress: string, chainId: ChainId): Promise<{
@@ -284,8 +272,6 @@ export declare function signMessageWithNonce(message: string, vault: Vault, from
284
272
  * @example
285
273
  * ```typescript
286
274
  * const result = await signMessageWithNoncePrivateKey('Hello World', 'your-private-key', '0xYourAddress', '1');
287
- * console.log('Signature:', result.signature);
288
- * console.log('Nonce:', result.nonce);
289
275
  * ```
290
276
  */
291
277
  export declare function signMessageWithNoncePrivateKey(message: string, privateKey: string, address: string, chainId: ChainId): Promise<{
@@ -301,7 +287,6 @@ export declare function signMessageWithNoncePrivateKey(message: string, privateK
301
287
  * @example
302
288
  * ```typescript
303
289
  * const signerAddress = await verifyMessageWithNonce('Hello World', '0xSignature...', 5);
304
- * console.log('Message was signed by:', signerAddress);
305
290
  * ```
306
291
  */
307
292
  export declare function verifyMessageWithNonce(message: string, signature: string, nonce: number): Promise<string>;
@@ -54,7 +54,6 @@ function getProviderAuto(chainId) {
54
54
  * @example
55
55
  * ```typescript
56
56
  * const balance = await getTokenBalance('0xToken...', '0xAccount...', '1');
57
- * console.log('Balance:', ethers.formatUnits(balance, 18));
58
57
  * ```
59
58
  */
60
59
  async function getTokenBalance(tokenAddress, account, chainId) {
@@ -70,7 +69,6 @@ async function getTokenBalance(tokenAddress, account, chainId) {
70
69
  * @example
71
70
  * ```typescript
72
71
  * const info = await getTokenInfo('0xToken...', '1');
73
- * console.log('Token:', info.name, '(', info.symbol, ')');
74
72
  * ```
75
73
  */
76
74
  async function getTokenInfo(tokenAddress, chainId) {
@@ -92,7 +90,6 @@ async function getTokenInfo(tokenAddress, chainId) {
92
90
  * @example
93
91
  * ```typescript
94
92
  * const balance = await getNativeBalance('0xAccount...', '1');
95
- * console.log('ETH Balance:', ethers.formatEther(balance));
96
93
  * ```
97
94
  */
98
95
  async function getNativeBalance(account, chainId) {
@@ -109,7 +106,6 @@ async function getNativeBalance(account, chainId) {
109
106
  * @example
110
107
  * ```typescript
111
108
  * const allowance = await checkAllowance('0xToken...', '0xOwner...', '0xSpender...', '1');
112
- * console.log('Allowance:', ethers.formatUnits(allowance, 18));
113
109
  * ```
114
110
  */
115
111
  async function checkAllowance(tokenAddress, owner, spender, chainId) {
@@ -200,7 +196,6 @@ async function approveTokenWithVault(vault, fromAddress, tokenAddress, spender,
200
196
  * @example
201
197
  * ```typescript
202
198
  * const txResponse = await sendTransaction(signedTx, '1');
203
- * console.log('Transaction hash:', txResponse.hash);
204
199
  * ```
205
200
  */
206
201
  async function sendTransaction(signedTx, chainId) {
@@ -217,7 +212,7 @@ async function sendTransaction(signedTx, chainId) {
217
212
  * ```typescript
218
213
  * trackTxStatus('0xTxHash...', '1', (status, receipt) => {
219
214
  * if (status === 'confirmed') {
220
- * console.log('Transaction confirmed!');
215
+ * // Transaction confirmed
221
216
  * }
222
217
  * });
223
218
  * ```
@@ -251,7 +246,6 @@ async function trackTxStatus(txHash, chainId, callback, pollInterval = 3000) {
251
246
  * @example
252
247
  * ```typescript
253
248
  * const nonce = await getNonce('0xYourAddress', '1');
254
- * console.log('Current nonce:', nonce);
255
249
  * ```
256
250
  */
257
251
  async function getNonce(address, chainId) {
@@ -268,7 +262,6 @@ async function getNonce(address, chainId) {
268
262
  * @example
269
263
  * ```typescript
270
264
  * const signature = await signMessageWithVault('Hello World', vault, '0xYourAddress');
271
- * console.log('Signature:', signature);
272
265
  * ```
273
266
  */
274
267
  async function signMessageWithVault(message, vault, fromAddress) {
@@ -285,7 +278,6 @@ async function signMessageWithVault(message, vault, fromAddress) {
285
278
  * @example
286
279
  * ```typescript
287
280
  * const signature = await signMessage('Hello World', 'your-private-key');
288
- * console.log('Signature:', signature);
289
281
  * ```
290
282
  */
291
283
  async function signMessage(message, privateKey) {
@@ -300,7 +292,6 @@ async function signMessage(message, privateKey) {
300
292
  * @example
301
293
  * ```typescript
302
294
  * const signerAddress = await verifyMessage('Hello World', '0xSignature...');
303
- * console.log('Message was signed by:', signerAddress);
304
295
  * ```
305
296
  */
306
297
  async function verifyMessage(message, signature) {
@@ -363,7 +354,6 @@ async function signTypedData(typedData, privateKey) {
363
354
  * @example
364
355
  * ```typescript
365
356
  * const signerAddress = await verifyTypedData(typedData, '0xSignature...');
366
- * console.log('Typed data was signed by:', signerAddress);
367
357
  * ```
368
358
  */
369
359
  async function verifyTypedData(typedData, signature) {
@@ -380,8 +370,6 @@ async function verifyTypedData(typedData, signature) {
380
370
  * @example
381
371
  * ```typescript
382
372
  * const result = await signMessageWithNonce('Hello World', vault, '0xYourAddress', '1');
383
- * console.log('Signature:', result.signature);
384
- * console.log('Nonce:', result.nonce);
385
373
  * ```
386
374
  */
387
375
  async function signMessageWithNonce(message, vault, fromAddress, chainId) {
@@ -401,8 +389,6 @@ async function signMessageWithNonce(message, vault, fromAddress, chainId) {
401
389
  * @example
402
390
  * ```typescript
403
391
  * const result = await signMessageWithNoncePrivateKey('Hello World', 'your-private-key', '0xYourAddress', '1');
404
- * console.log('Signature:', result.signature);
405
- * console.log('Nonce:', result.nonce);
406
392
  * ```
407
393
  */
408
394
  async function signMessageWithNoncePrivateKey(message, privateKey, address, chainId) {
@@ -420,7 +406,6 @@ async function signMessageWithNoncePrivateKey(message, privateKey, address, chai
420
406
  * @example
421
407
  * ```typescript
422
408
  * const signerAddress = await verifyMessageWithNonce('Hello World', '0xSignature...', 5);
423
- * console.log('Message was signed by:', signerAddress);
424
409
  * ```
425
410
  */
426
411
  async function verifyMessageWithNonce(message, signature, nonce) {
@@ -44,7 +44,6 @@ export declare class NFTService {
44
44
  * '123',
45
45
  * { includeMetadata: true, includeHistory: true }
46
46
  * );
47
- * console.log('NFT:', nftDetail.name, 'Owner:', nftDetail.owner);
48
47
  * ```
49
48
  */
50
49
  getNFTDetail(contractAddress: string, tokenId: string, options?: NFTOptions): Promise<NFTDetailExtended>;
@@ -99,11 +98,6 @@ export declare class NFTService {
99
98
  * ```typescript
100
99
  * // For ERC-721
101
100
  * const balance = await nftService.getNFTBalance('0xAccount...', '0xContract...');
102
- * console.log('ERC-721 Count:', balance.count);
103
- *
104
- * // For ERC-1155
105
- * const balance = await nftService.getNFTBalance('0xAccount...', '0xContract...', '123');
106
- * console.log('ERC-1155 Balance:', balance.count);
107
101
  * ```
108
102
  */
109
103
  getNFTBalance(address: string, contractAddress: string, tokenId?: string): Promise<NFTBalance>;
@@ -116,7 +110,6 @@ export declare class NFTService {
116
110
  * @example
117
111
  * ```typescript
118
112
  * const balance = await nftService.getERC1155Balance('0xAccount...', '0xContract...', '123');
119
- * console.log('ERC-1155 Balance:', balance.toString());
120
113
  * ```
121
114
  */
122
115
  getERC1155Balance(address: string, contractAddress: string, tokenId: string): Promise<bigint>;
@@ -168,7 +161,6 @@ export declare class NFTService {
168
161
  * '0xContract...',
169
162
  * '123'
170
163
  * );
171
- * console.log('Estimated gas:', gasEstimate.toString());
172
164
  * ```
173
165
  */
174
166
  estimateGasForTransfer(fromAddress: string, toAddress: string, contractAddress: string, tokenId: string, amount?: string): Promise<bigint>;
@@ -98,7 +98,6 @@ class NFTService {
98
98
  * '123',
99
99
  * { includeMetadata: true, includeHistory: true }
100
100
  * );
101
- * console.log('NFT:', nftDetail.name, 'Owner:', nftDetail.owner);
102
101
  * ```
103
102
  */
104
103
  async getNFTDetail(contractAddress, tokenId, options = {}) {
@@ -429,11 +428,6 @@ class NFTService {
429
428
  * ```typescript
430
429
  * // For ERC-721
431
430
  * const balance = await nftService.getNFTBalance('0xAccount...', '0xContract...');
432
- * console.log('ERC-721 Count:', balance.count);
433
- *
434
- * // For ERC-1155
435
- * const balance = await nftService.getNFTBalance('0xAccount...', '0xContract...', '123');
436
- * console.log('ERC-1155 Balance:', balance.count);
437
431
  * ```
438
432
  */
439
433
  async getNFTBalance(address, contractAddress, tokenId) {
@@ -518,7 +512,6 @@ class NFTService {
518
512
  * @example
519
513
  * ```typescript
520
514
  * const balance = await nftService.getERC1155Balance('0xAccount...', '0xContract...', '123');
521
- * console.log('ERC-1155 Balance:', balance.toString());
522
515
  * ```
523
516
  */
524
517
  async getERC1155Balance(address, contractAddress, tokenId) {
@@ -630,7 +623,6 @@ class NFTService {
630
623
  * '0xContract...',
631
624
  * '123'
632
625
  * );
633
- * console.log('Estimated gas:', gasEstimate.toString());
634
626
  * ```
635
627
  */
636
628
  async estimateGasForTransfer(fromAddress, toAddress, contractAddress, tokenId, amount = "1") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pwc-sdk-wallet",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "A comprehensive wallet SDK for React Native (pwc), supporting multi-chain and multi-account features.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",