pwc-sdk-wallet 0.8.1 → 0.8.3
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/README.md +3 -0
- package/dist/Vault.d.ts +5 -5
- package/dist/Vault.js +33 -118
- package/dist/index.d.ts +0 -3
- package/dist/index.js +4 -6
- package/dist/keyrings/SolanaKeyring.d.ts +50 -5
- package/dist/keyrings/SolanaKeyring.js +142 -20
- package/package.json +2 -3
- package/dist/chain/TronChainService.d.ts +0 -130
- package/dist/chain/TronChainService.js +0 -350
- package/dist/keyrings/TronKeyring.d.ts +0 -88
- package/dist/keyrings/TronKeyring.js +0 -286
package/README.md
CHANGED
|
@@ -1881,6 +1881,9 @@ console.log('New account address:', newAccount.address);
|
|
|
1881
1881
|
// Add a new Solana account
|
|
1882
1882
|
const newSolanaAccount = await vault.addNewSolanaAccount();
|
|
1883
1883
|
console.log('New Solana account:', newSolanaAccount.address);
|
|
1884
|
+
|
|
1885
|
+
// Note: All Solana accounts are automatically persisted when you encrypt and save the vault.
|
|
1886
|
+
// When you load the vault later, all previously added accounts will be restored.
|
|
1884
1887
|
```
|
|
1885
1888
|
|
|
1886
1889
|
#### Add New TRON Account
|
package/dist/Vault.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Recipient, MultiTransferResult } from './types/multiTransfer';
|
|
|
4
4
|
import { NFTDetailExtended, NFTBalance, NFTOptions } from './types/nft';
|
|
5
5
|
export interface Account {
|
|
6
6
|
address: string;
|
|
7
|
-
type: 'HD' | 'Simple' | 'Solana'
|
|
7
|
+
type: 'HD' | 'Simple' | 'Solana';
|
|
8
8
|
name: string;
|
|
9
9
|
}
|
|
10
10
|
export interface TransactionResponse {
|
|
@@ -51,7 +51,7 @@ export declare class Vault {
|
|
|
51
51
|
/**
|
|
52
52
|
* Creates a new Vault with a fresh mnemonic.
|
|
53
53
|
* @param password - The password used to encrypt the vault data
|
|
54
|
-
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana
|
|
54
|
+
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana). Defaults to 'evm'
|
|
55
55
|
* @returns Promise resolving to an object containing the created vault instance and its encrypted data
|
|
56
56
|
* @throws Error if mnemonic generation or keyring initialization fails
|
|
57
57
|
*/
|
|
@@ -63,7 +63,7 @@ export declare class Vault {
|
|
|
63
63
|
* Creates a new Vault from an existing mnemonic phrase.
|
|
64
64
|
* @param mnemonic - The existing mnemonic phrase (12, 15, 18, 21, or 24 words)
|
|
65
65
|
* @param password - The password used to encrypt the vault data
|
|
66
|
-
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana
|
|
66
|
+
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana). Defaults to 'evm'
|
|
67
67
|
* @returns Promise resolving to an object containing the created vault instance and its encrypted data
|
|
68
68
|
* @throws Error if mnemonic is invalid or keyring initialization fails
|
|
69
69
|
*/
|
|
@@ -92,7 +92,7 @@ export declare class Vault {
|
|
|
92
92
|
*/
|
|
93
93
|
addNewSolanaAccount(): Promise<Account>;
|
|
94
94
|
/**
|
|
95
|
-
* Adds a new TRON account derived from the TRON keyring.
|
|
95
|
+
* Adds a new TRON account derived from the TRON keyring. (TEMPORARILY DISABLED)
|
|
96
96
|
* @returns Promise resolving to the newly created TRON account information
|
|
97
97
|
* @throws Error if no TRON keyring is available in the vault
|
|
98
98
|
*/
|
|
@@ -595,7 +595,7 @@ export declare class Vault {
|
|
|
595
595
|
*/
|
|
596
596
|
sendNativeToken(fromAddress: string, to: string, amount: string, chainId: ChainId): Promise<TransactionResponse>;
|
|
597
597
|
/**
|
|
598
|
-
* Sends TRX (native TRON token) to another address.
|
|
598
|
+
* Sends TRX (native TRON token) to another address. (TEMPORARILY DISABLED)
|
|
599
599
|
* @param fromAddress - The sender's TRON address
|
|
600
600
|
* @param to - The recipient's TRON address
|
|
601
601
|
* @param amount - The amount of TRX to send as a string (e.g., "1.5")
|
package/dist/Vault.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.Vault = void 0;
|
|
|
4
4
|
const HDKeyring_1 = require("./keyrings/HDKeyring");
|
|
5
5
|
const SimpleKeyring_1 = require("./keyrings/SimpleKeyring");
|
|
6
6
|
const SolanaKeyring_1 = require("./keyrings/SolanaKeyring");
|
|
7
|
-
|
|
7
|
+
// import { TronKeyring } from './keyrings/TronKeyring'; // TEMPORARILY DISABLED - tronweb compatibility issues
|
|
8
8
|
const ChainService_1 = require("./chain/ChainService");
|
|
9
9
|
const SolanaChainService_1 = require("./chain/SolanaChainService");
|
|
10
|
-
|
|
10
|
+
// import { TronChainService } from './chain/TronChainService'; // TEMPORARILY DISABLED - tronweb compatibility issues
|
|
11
11
|
const EncryptionService_1 = require("./crypto/EncryptionService");
|
|
12
12
|
const chains_1 = require("./config/chains");
|
|
13
13
|
const constants_1 = require("./config/constants");
|
|
@@ -45,7 +45,7 @@ class Vault {
|
|
|
45
45
|
/**
|
|
46
46
|
* Creates a new Vault with a fresh mnemonic.
|
|
47
47
|
* @param password - The password used to encrypt the vault data
|
|
48
|
-
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana
|
|
48
|
+
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana). Defaults to 'evm'
|
|
49
49
|
* @returns Promise resolving to an object containing the created vault instance and its encrypted data
|
|
50
50
|
* @throws Error if mnemonic generation or keyring initialization fails
|
|
51
51
|
*/
|
|
@@ -59,11 +59,7 @@ class Vault {
|
|
|
59
59
|
return { vault, encryptedVault };
|
|
60
60
|
}
|
|
61
61
|
else if (chainType === 'tron') {
|
|
62
|
-
|
|
63
|
-
const vault = new Vault([tronKeyring], config);
|
|
64
|
-
vault.chainId = 'tron'; // Set TRON chain ID
|
|
65
|
-
const encryptedVault = await vault.encrypt(password);
|
|
66
|
-
return { vault, encryptedVault };
|
|
62
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
67
63
|
}
|
|
68
64
|
else {
|
|
69
65
|
const hdKeyring = new HDKeyring_1.HDKeyring(mnemonic);
|
|
@@ -78,7 +74,7 @@ class Vault {
|
|
|
78
74
|
* Creates a new Vault from an existing mnemonic phrase.
|
|
79
75
|
* @param mnemonic - The existing mnemonic phrase (12, 15, 18, 21, or 24 words)
|
|
80
76
|
* @param password - The password used to encrypt the vault data
|
|
81
|
-
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana
|
|
77
|
+
* @param chainType - The type of blockchain to support ('evm' for Ethereum-compatible chains, 'solana' for Solana). Defaults to 'evm'
|
|
82
78
|
* @returns Promise resolving to an object containing the created vault instance and its encrypted data
|
|
83
79
|
* @throws Error if mnemonic is invalid or keyring initialization fails
|
|
84
80
|
*/
|
|
@@ -91,11 +87,7 @@ class Vault {
|
|
|
91
87
|
return { vault, encryptedVault };
|
|
92
88
|
}
|
|
93
89
|
else if (chainType === 'tron') {
|
|
94
|
-
|
|
95
|
-
const vault = new Vault([tronKeyring], config);
|
|
96
|
-
vault.chainId = 'tron'; // Set TRON chain ID
|
|
97
|
-
const encryptedVault = await vault.encrypt(password);
|
|
98
|
-
return { vault, encryptedVault };
|
|
90
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
99
91
|
}
|
|
100
92
|
else {
|
|
101
93
|
const hdKeyring = new HDKeyring_1.HDKeyring(mnemonic);
|
|
@@ -133,10 +125,10 @@ class Vault {
|
|
|
133
125
|
}
|
|
134
126
|
else if (sKeyring.type === 'Solana') {
|
|
135
127
|
keyrings.push(await SolanaKeyring_1.SolanaKeyring.deserialize(sKeyring));
|
|
136
|
-
}
|
|
128
|
+
} /* TEMPORARILY DISABLED - tronweb compatibility issues
|
|
137
129
|
else if (sKeyring.type === 'Tron') {
|
|
138
|
-
keyrings.push(await
|
|
139
|
-
}
|
|
130
|
+
keyrings.push(await TronKeyring.deserialize(sKeyring));
|
|
131
|
+
} */
|
|
140
132
|
else {
|
|
141
133
|
throw new Error(`Unknown keyring type: ${sKeyring.type}`);
|
|
142
134
|
}
|
|
@@ -150,10 +142,10 @@ class Vault {
|
|
|
150
142
|
// Set chain ID based on keyring type
|
|
151
143
|
if (keyrings.some(k => k instanceof SolanaKeyring_1.SolanaKeyring)) {
|
|
152
144
|
vault.chainId = 'solana';
|
|
153
|
-
}
|
|
154
|
-
else if (keyrings.some(k => k instanceof
|
|
145
|
+
} /* TEMPORARILY DISABLED - tronweb compatibility issues
|
|
146
|
+
else if (keyrings.some(k => k instanceof TronKeyring)) {
|
|
155
147
|
vault.chainId = 'tron';
|
|
156
|
-
}
|
|
148
|
+
} */
|
|
157
149
|
else {
|
|
158
150
|
vault.chainId = '1'; // Default to Ethereum mainnet
|
|
159
151
|
}
|
|
@@ -196,21 +188,12 @@ class Vault {
|
|
|
196
188
|
};
|
|
197
189
|
}
|
|
198
190
|
/**
|
|
199
|
-
* Adds a new TRON account derived from the TRON keyring.
|
|
191
|
+
* Adds a new TRON account derived from the TRON keyring. (TEMPORARILY DISABLED)
|
|
200
192
|
* @returns Promise resolving to the newly created TRON account information
|
|
201
193
|
* @throws Error if no TRON keyring is available in the vault
|
|
202
194
|
*/
|
|
203
195
|
async addNewTronAccount() {
|
|
204
|
-
|
|
205
|
-
if (!tronKeyring) {
|
|
206
|
-
throw new Error('No TRON keyring available to create new accounts.');
|
|
207
|
-
}
|
|
208
|
-
const newAddress = await tronKeyring.addNewAccount();
|
|
209
|
-
return {
|
|
210
|
-
address: newAddress,
|
|
211
|
-
type: 'Tron',
|
|
212
|
-
name: `Tron ${tronKeyring.getAllAccounts().length}`
|
|
213
|
-
};
|
|
196
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
214
197
|
}
|
|
215
198
|
/**
|
|
216
199
|
* Imports an account from a private key and adds it to the vault.
|
|
@@ -271,8 +254,8 @@ class Vault {
|
|
|
271
254
|
name: `Solana ${solanaAccountCount++}`,
|
|
272
255
|
});
|
|
273
256
|
}
|
|
274
|
-
}
|
|
275
|
-
else if (keyring instanceof
|
|
257
|
+
} /* TEMPORARILY DISABLED - tronweb compatibility issues
|
|
258
|
+
else if (keyring instanceof TronKeyring) {
|
|
276
259
|
for (const address of keyring.getAllAccounts()) {
|
|
277
260
|
accounts.push({
|
|
278
261
|
address,
|
|
@@ -281,6 +264,7 @@ class Vault {
|
|
|
281
264
|
});
|
|
282
265
|
}
|
|
283
266
|
}
|
|
267
|
+
*/
|
|
284
268
|
}
|
|
285
269
|
return accounts;
|
|
286
270
|
}
|
|
@@ -401,11 +385,10 @@ class Vault {
|
|
|
401
385
|
if (chainInfo.type === 'solana') {
|
|
402
386
|
const chainService = new SolanaChainService_1.SolanaChainService(privateKey, chainInfo);
|
|
403
387
|
return chainService.getNativeBalance();
|
|
404
|
-
}
|
|
388
|
+
} /* TEMPORARILY DISABLED - tronweb compatibility issues
|
|
405
389
|
else if (chainInfo.type === 'tron') {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
390
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
391
|
+
} */
|
|
409
392
|
else {
|
|
410
393
|
const chainService = new ChainService_1.ChainService(privateKey, chainInfo);
|
|
411
394
|
return chainService.getNativeBalance();
|
|
@@ -1373,17 +1356,10 @@ class Vault {
|
|
|
1373
1356
|
to: result.to,
|
|
1374
1357
|
blockNumber: result.blockNumber || undefined
|
|
1375
1358
|
};
|
|
1376
|
-
}
|
|
1359
|
+
} /* TEMPORARILY DISABLED - tronweb compatibility issues
|
|
1377
1360
|
else if (chainInfo.type === 'tron') {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
return {
|
|
1381
|
-
hash: result.hash,
|
|
1382
|
-
from: result.from,
|
|
1383
|
-
to: result.to,
|
|
1384
|
-
blockNumber: result.blockNumber || undefined
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1361
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1362
|
+
} */
|
|
1387
1363
|
else {
|
|
1388
1364
|
const chainService = new ChainService_1.ChainService(privateKey, chainInfo);
|
|
1389
1365
|
// Create transaction request for native token transfer
|
|
@@ -1400,9 +1376,10 @@ class Vault {
|
|
|
1400
1376
|
};
|
|
1401
1377
|
}
|
|
1402
1378
|
}
|
|
1403
|
-
// --- TRON Operations ---
|
|
1379
|
+
// --- TRON Operations --- (TEMPORARILY DISABLED - tronweb compatibility issues)
|
|
1380
|
+
// All TRON-related methods are temporarily disabled due to tronweb compatibility issues with React Native
|
|
1404
1381
|
/**
|
|
1405
|
-
* Sends TRX (native TRON token) to another address.
|
|
1382
|
+
* Sends TRX (native TRON token) to another address. (TEMPORARILY DISABLED)
|
|
1406
1383
|
* @param fromAddress - The sender's TRON address
|
|
1407
1384
|
* @param to - The recipient's TRON address
|
|
1408
1385
|
* @param amount - The amount of TRX to send as a string (e.g., "1.5")
|
|
@@ -1417,19 +1394,7 @@ class Vault {
|
|
|
1417
1394
|
* ```
|
|
1418
1395
|
*/
|
|
1419
1396
|
async sendTRX(fromAddress, to, amount) {
|
|
1420
|
-
|
|
1421
|
-
if (chainInfo.type !== 'tron') {
|
|
1422
|
-
throw new Error('TRON chain configuration not found');
|
|
1423
|
-
}
|
|
1424
|
-
const privateKey = await this.getPrivateKeyFor(fromAddress);
|
|
1425
|
-
const chainService = new TronChainService_1.TronChainService(privateKey, chainInfo);
|
|
1426
|
-
const result = await chainService.sendTransaction(to, amount);
|
|
1427
|
-
return {
|
|
1428
|
-
hash: result.hash,
|
|
1429
|
-
from: result.from,
|
|
1430
|
-
to: result.to,
|
|
1431
|
-
blockNumber: result.blockNumber
|
|
1432
|
-
};
|
|
1397
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1433
1398
|
}
|
|
1434
1399
|
/**
|
|
1435
1400
|
* Sends TRC-20 tokens on TRON blockchain.
|
|
@@ -1452,19 +1417,7 @@ class Vault {
|
|
|
1452
1417
|
* ```
|
|
1453
1418
|
*/
|
|
1454
1419
|
async sendTRC20Token(fromAddress, to, amount, tokenAddress) {
|
|
1455
|
-
|
|
1456
|
-
if (chainInfo.type !== 'tron') {
|
|
1457
|
-
throw new Error('TRON chain configuration not found');
|
|
1458
|
-
}
|
|
1459
|
-
const privateKey = await this.getPrivateKeyFor(fromAddress);
|
|
1460
|
-
const chainService = new TronChainService_1.TronChainService(privateKey, chainInfo);
|
|
1461
|
-
const result = await chainService.sendToken(to, amount, tokenAddress);
|
|
1462
|
-
return {
|
|
1463
|
-
hash: result.hash,
|
|
1464
|
-
from: result.from,
|
|
1465
|
-
to: result.to,
|
|
1466
|
-
blockNumber: result.blockNumber
|
|
1467
|
-
};
|
|
1420
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1468
1421
|
}
|
|
1469
1422
|
/**
|
|
1470
1423
|
* Gets TRX balance for a specific address on TRON.
|
|
@@ -1473,13 +1426,7 @@ class Vault {
|
|
|
1473
1426
|
* @throws Error if the balance query fails
|
|
1474
1427
|
*/
|
|
1475
1428
|
async getTRXBalance(address) {
|
|
1476
|
-
|
|
1477
|
-
if (chainInfo.type !== 'tron') {
|
|
1478
|
-
throw new Error('TRON chain configuration not found');
|
|
1479
|
-
}
|
|
1480
|
-
const privateKey = await this.getPrivateKeyFor(address);
|
|
1481
|
-
const chainService = new TronChainService_1.TronChainService(privateKey, chainInfo);
|
|
1482
|
-
return await chainService.getNativeBalance();
|
|
1429
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1483
1430
|
}
|
|
1484
1431
|
/**
|
|
1485
1432
|
* Gets TRC-20 token balance for a specific address on TRON.
|
|
@@ -1489,13 +1436,7 @@ class Vault {
|
|
|
1489
1436
|
* @throws Error if the balance query fails
|
|
1490
1437
|
*/
|
|
1491
1438
|
async getTRC20TokenBalance(address, tokenAddress) {
|
|
1492
|
-
|
|
1493
|
-
if (chainInfo.type !== 'tron') {
|
|
1494
|
-
throw new Error('TRON chain configuration not found');
|
|
1495
|
-
}
|
|
1496
|
-
const privateKey = await this.getPrivateKeyFor(address);
|
|
1497
|
-
const chainService = new TronChainService_1.TronChainService(privateKey, chainInfo);
|
|
1498
|
-
return await chainService.getTokenBalance(tokenAddress);
|
|
1439
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1499
1440
|
}
|
|
1500
1441
|
/**
|
|
1501
1442
|
* Gets TRC-20 token information.
|
|
@@ -1504,21 +1445,7 @@ class Vault {
|
|
|
1504
1445
|
* @throws Error if the token query fails
|
|
1505
1446
|
*/
|
|
1506
1447
|
async getTRC20TokenInfo(tokenAddress) {
|
|
1507
|
-
|
|
1508
|
-
if (chainInfo.type !== 'tron') {
|
|
1509
|
-
throw new Error('TRON chain configuration not found');
|
|
1510
|
-
}
|
|
1511
|
-
// Use a dummy private key for read-only operations
|
|
1512
|
-
const dummyPrivateKey = '0000000000000000000000000000000000000000000000000000000000000001';
|
|
1513
|
-
const chainService = new TronChainService_1.TronChainService(dummyPrivateKey, chainInfo);
|
|
1514
|
-
const tokenInfo = await chainService.getTokenInfo(tokenAddress);
|
|
1515
|
-
return {
|
|
1516
|
-
address: tokenInfo.address,
|
|
1517
|
-
name: tokenInfo.name,
|
|
1518
|
-
symbol: tokenInfo.symbol,
|
|
1519
|
-
decimals: tokenInfo.decimals,
|
|
1520
|
-
totalSupply: tokenInfo.totalSupply
|
|
1521
|
-
};
|
|
1448
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1522
1449
|
}
|
|
1523
1450
|
/**
|
|
1524
1451
|
* Estimates the transaction fee for a TRX transfer.
|
|
@@ -1529,13 +1456,7 @@ class Vault {
|
|
|
1529
1456
|
* @throws Error if the estimation fails
|
|
1530
1457
|
*/
|
|
1531
1458
|
async estimateTRXTransferFee(fromAddress, to, amount) {
|
|
1532
|
-
|
|
1533
|
-
if (chainInfo.type !== 'tron') {
|
|
1534
|
-
throw new Error('TRON chain configuration not found');
|
|
1535
|
-
}
|
|
1536
|
-
const privateKey = await this.getPrivateKeyFor(fromAddress);
|
|
1537
|
-
const chainService = new TronChainService_1.TronChainService(privateKey, chainInfo);
|
|
1538
|
-
return await chainService.estimateTransactionFee(to, amount);
|
|
1459
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1539
1460
|
}
|
|
1540
1461
|
/**
|
|
1541
1462
|
* Estimates the transaction fee for a TRC-20 token transfer.
|
|
@@ -1547,13 +1468,7 @@ class Vault {
|
|
|
1547
1468
|
* @throws Error if the estimation fails
|
|
1548
1469
|
*/
|
|
1549
1470
|
async estimateTRC20TransferFee(fromAddress, to, amount, tokenAddress) {
|
|
1550
|
-
|
|
1551
|
-
if (chainInfo.type !== 'tron') {
|
|
1552
|
-
throw new Error('TRON chain configuration not found');
|
|
1553
|
-
}
|
|
1554
|
-
const privateKey = await this.getPrivateKeyFor(fromAddress);
|
|
1555
|
-
const chainService = new TronChainService_1.TronChainService(privateKey, chainInfo);
|
|
1556
|
-
return await chainService.estimateTokenTransferFee(to, amount, tokenAddress);
|
|
1471
|
+
throw new Error('TRON support is temporarily disabled due to tronweb compatibility issues with React Native.');
|
|
1557
1472
|
}
|
|
1558
1473
|
}
|
|
1559
1474
|
exports.Vault = Vault;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export type { Account } from './Vault';
|
|
|
3
3
|
export type { ChainId, ChainConfig } from './config/chains';
|
|
4
4
|
export type { EncryptedData } from './crypto/EncryptionService';
|
|
5
5
|
export type { Token } from './chain/ChainService';
|
|
6
|
-
export type { TronTransactionResponse, TronToken } from './chain/TronChainService';
|
|
7
6
|
export type { Recipient, MultiTransferOptions, MultiTransferResult, BatchResult, ValidationResult } from './types/multiTransfer';
|
|
8
7
|
export type { QRCodeData, WalletImportData, TransactionData } from './services/QRCodeService';
|
|
9
8
|
export { SUPPORTED_CHAINS, DERIVATION_PATHS, registerCustomChain, overrideChain, overrideChains, getChainConfig, setupChainConfigs, getAllAvailableChains, clearCustomChains, clearOverrides, clearOverride, getCustomChains, getOverrides, setGlobalRPCConfig, setGlobalExplorerConfig, clearGlobalConfigs } from './config/chains';
|
|
@@ -13,10 +12,8 @@ export { getEnvironmentConfig, validateEnvironmentConfig, getEnvVar, getEnvVarNu
|
|
|
13
12
|
export { HDKeyring } from './keyrings/HDKeyring';
|
|
14
13
|
export { SimpleKeyring } from './keyrings/SimpleKeyring';
|
|
15
14
|
export { SolanaKeyring } from './keyrings/SolanaKeyring';
|
|
16
|
-
export { TronKeyring } from './keyrings/TronKeyring';
|
|
17
15
|
export { ChainService } from './chain/ChainService';
|
|
18
16
|
export { SolanaChainService } from './chain/SolanaChainService';
|
|
19
|
-
export { TronChainService } from './chain/TronChainService';
|
|
20
17
|
export { EncryptionService } from './crypto/EncryptionService';
|
|
21
18
|
export { MultiTransferService } from './services/MultiTransferService';
|
|
22
19
|
export { BatchProcessor } from './services/BatchProcessor';
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
exports.usePWCWallet = exports.ConnectionModal =
|
|
18
|
+
exports.TransactionModal = exports.DAppBrowser = exports.TransactionHandler = exports.MessageBridgeService = exports.BrowserProviderService = exports.QRCodeService = exports.BatchProcessor = exports.MultiTransferService = exports.EncryptionService = exports.SolanaChainService = exports.ChainService = exports.SolanaKeyring = exports.SimpleKeyring = exports.HDKeyring = exports.getEnvVarBoolean = exports.getEnvVarBigInt = exports.getEnvVarNumber = exports.getEnvVar = exports.validateEnvironmentConfig = exports.getEnvironmentConfig = exports.VALIDATION_CONFIG = exports.CACHE_CONFIG = exports.NETWORK_CONFIG = exports.SECURITY_CONFIG = exports.VANITY_WALLET_CONFIG = exports.clearGlobalGasConfigs = exports.getGasConfig = exports.setGlobalNetworkGasConfig = exports.setGlobalGasConfig = exports.calculateOptimalGasPrice = exports.getNetworkGasConfig = exports.NETWORK_GAS_CONFIG = exports.GAS_CONFIG = exports.clearGlobalConfigs = exports.setGlobalExplorerConfig = exports.setGlobalRPCConfig = exports.getOverrides = exports.getCustomChains = exports.clearOverride = exports.clearOverrides = exports.clearCustomChains = exports.getAllAvailableChains = exports.setupChainConfigs = exports.getChainConfig = exports.overrideChains = exports.overrideChain = exports.registerCustomChain = exports.DERIVATION_PATHS = exports.SUPPORTED_CHAINS = exports.Vault = void 0;
|
|
19
|
+
exports.usePWCWallet = exports.ConnectionModal = void 0;
|
|
20
20
|
// The primary `Vault` class is the main entry point for interacting with the SDK.
|
|
21
21
|
var Vault_1 = require("./Vault");
|
|
22
22
|
Object.defineProperty(exports, "Vault", { enumerable: true, get: function () { return Vault_1.Vault; } });
|
|
@@ -73,15 +73,13 @@ var SimpleKeyring_1 = require("./keyrings/SimpleKeyring");
|
|
|
73
73
|
Object.defineProperty(exports, "SimpleKeyring", { enumerable: true, get: function () { return SimpleKeyring_1.SimpleKeyring; } });
|
|
74
74
|
var SolanaKeyring_1 = require("./keyrings/SolanaKeyring");
|
|
75
75
|
Object.defineProperty(exports, "SolanaKeyring", { enumerable: true, get: function () { return SolanaKeyring_1.SolanaKeyring; } });
|
|
76
|
-
|
|
77
|
-
Object.defineProperty(exports, "TronKeyring", { enumerable: true, get: function () { return TronKeyring_1.TronKeyring; } });
|
|
76
|
+
// export { TronKeyring } from './keyrings/TronKeyring'; // TEMPORARILY DISABLED
|
|
78
77
|
// Chain services
|
|
79
78
|
var ChainService_1 = require("./chain/ChainService");
|
|
80
79
|
Object.defineProperty(exports, "ChainService", { enumerable: true, get: function () { return ChainService_1.ChainService; } });
|
|
81
80
|
var SolanaChainService_1 = require("./chain/SolanaChainService");
|
|
82
81
|
Object.defineProperty(exports, "SolanaChainService", { enumerable: true, get: function () { return SolanaChainService_1.SolanaChainService; } });
|
|
83
|
-
|
|
84
|
-
Object.defineProperty(exports, "TronChainService", { enumerable: true, get: function () { return TronChainService_1.TronChainService; } });
|
|
82
|
+
// export { TronChainService } from './chain/TronChainService'; // TEMPORARILY DISABLED
|
|
85
83
|
// `EncryptionService` provides access to the underlying encryption/decryption methods.
|
|
86
84
|
var EncryptionService_1 = require("./crypto/EncryptionService");
|
|
87
85
|
Object.defineProperty(exports, "EncryptionService", { enumerable: true, get: function () { return EncryptionService_1.EncryptionService; } });
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { Keypair } from '@solana/web3.js';
|
|
2
|
+
/**
|
|
3
|
+
* Serialized keyring data structure
|
|
4
|
+
*/
|
|
5
|
+
export interface SerializedSolanaKeyring {
|
|
6
|
+
type: 'Solana';
|
|
7
|
+
mnemonic: string;
|
|
8
|
+
accounts: string[];
|
|
9
|
+
}
|
|
2
10
|
/**
|
|
3
11
|
* Solana keyring for managing multiple Solana accounts
|
|
4
12
|
* derived from a single mnemonic phrase using BIP-44 derivation paths.
|
|
@@ -9,12 +17,25 @@ export declare class SolanaKeyring {
|
|
|
9
17
|
private keypairs;
|
|
10
18
|
accounts: string[];
|
|
11
19
|
private mnemonic;
|
|
20
|
+
private seed;
|
|
21
|
+
private static seedCache;
|
|
22
|
+
private static readonly ERROR_INVALID_MNEMONIC;
|
|
23
|
+
private static readonly ERROR_INVALID_INDEX;
|
|
24
|
+
private static readonly ERROR_DUPLICATE_ACCOUNT;
|
|
25
|
+
private static readonly ERROR_ADDRESS_NOT_FOUND;
|
|
26
|
+
private static readonly ERROR_INVALID_DESERIALIZE;
|
|
27
|
+
private static readonly ERROR_ADDRESS_MISMATCH;
|
|
12
28
|
/**
|
|
13
29
|
* Creates a new SolanaKeyring instance from a mnemonic phrase.
|
|
14
30
|
* @param mnemonic - The mnemonic phrase (12, 15, 18, 21, or 24 words)
|
|
15
31
|
* @throws Error if the mnemonic is invalid
|
|
16
32
|
*/
|
|
17
33
|
constructor(mnemonic: string);
|
|
34
|
+
/**
|
|
35
|
+
* Gets or generates the seed for this keyring, using cache when available.
|
|
36
|
+
* @returns The seed buffer
|
|
37
|
+
*/
|
|
38
|
+
private getSeed;
|
|
18
39
|
/**
|
|
19
40
|
* Initializes the keyring by generating the seed and creating the first account.
|
|
20
41
|
* @param mnemonic - The mnemonic phrase to initialize from
|
|
@@ -23,21 +44,28 @@ export declare class SolanaKeyring {
|
|
|
23
44
|
/**
|
|
24
45
|
* Derives a Solana keypair at a specific index using BIP-44 derivation.
|
|
25
46
|
* @param seed - The seed buffer to derive from
|
|
26
|
-
* @param index - The account index to derive (0-based)
|
|
47
|
+
* @param index - The account index to derive (0-based, must be non-negative integer)
|
|
27
48
|
* @returns The derived Solana keypair
|
|
49
|
+
* @throws Error if index is invalid
|
|
28
50
|
*/
|
|
29
|
-
private deriveKeypair;
|
|
51
|
+
private static deriveKeypair;
|
|
30
52
|
/**
|
|
31
53
|
* Adds a new Solana account derived from the mnemonic at the next available index.
|
|
32
54
|
* @returns Promise resolving to the public key address of the newly created account
|
|
33
55
|
* @throws Error if account derivation fails or duplicate address is generated
|
|
34
56
|
*/
|
|
35
57
|
addNewAccount(): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Validates a Solana address format.
|
|
60
|
+
* @param address - The address to validate
|
|
61
|
+
* @returns True if the address is valid, false otherwise
|
|
62
|
+
*/
|
|
63
|
+
static isValidAddress(address: string): boolean;
|
|
36
64
|
/**
|
|
37
65
|
* Gets the private key for a given address managed by this keyring.
|
|
38
66
|
* @param address - The account's public key address to get the private key for
|
|
39
67
|
* @returns Promise resolving to the private key as a hex string
|
|
40
|
-
* @throws Error if the address is not found in this keyring
|
|
68
|
+
* @throws Error if the address is not found in this keyring or is invalid
|
|
41
69
|
*/
|
|
42
70
|
getPrivateKeyForAddress(address: string): Promise<string>;
|
|
43
71
|
/**
|
|
@@ -47,9 +75,9 @@ export declare class SolanaKeyring {
|
|
|
47
75
|
getMnemonic(): string;
|
|
48
76
|
/**
|
|
49
77
|
* Serializes the keyring data for encryption and storage.
|
|
50
|
-
* @returns An object containing the keyring type and
|
|
78
|
+
* @returns An object containing the keyring type, mnemonic, and accounts
|
|
51
79
|
*/
|
|
52
|
-
serialize():
|
|
80
|
+
serialize(): SerializedSolanaKeyring;
|
|
53
81
|
/**
|
|
54
82
|
* Deserializes data into a SolanaKeyring instance.
|
|
55
83
|
* @param data - The serialized keyring data
|
|
@@ -61,6 +89,7 @@ export declare class SolanaKeyring {
|
|
|
61
89
|
* Gets the Solana keypair for a given address.
|
|
62
90
|
* @param address - The account's public key address
|
|
63
91
|
* @returns The Solana keypair or undefined if not found
|
|
92
|
+
* @throws Error if the address format is invalid
|
|
64
93
|
*/
|
|
65
94
|
getKeypair(address: string): Keypair | undefined;
|
|
66
95
|
/**
|
|
@@ -68,4 +97,20 @@ export declare class SolanaKeyring {
|
|
|
68
97
|
* @returns Array of all Solana keypairs
|
|
69
98
|
*/
|
|
70
99
|
getAllKeypairs(): Keypair[];
|
|
100
|
+
/**
|
|
101
|
+
* Clears sensitive data from memory.
|
|
102
|
+
* This should be called when the keyring is no longer needed to help prevent memory dumps.
|
|
103
|
+
* Note: This does not clear the seed cache, only instance-specific data.
|
|
104
|
+
*/
|
|
105
|
+
clearSensitiveData(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Clears the seed cache to free up memory.
|
|
108
|
+
* Call this when you want to clear sensitive data from memory.
|
|
109
|
+
*/
|
|
110
|
+
static clearSeedCache(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Gets the cache size for debugging purposes.
|
|
113
|
+
* @returns Number of cached seeds
|
|
114
|
+
*/
|
|
115
|
+
static getSeedCacheSize(): number;
|
|
71
116
|
}
|