@solana/web3.js 1.12.1 → 1.13.1
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/lib/index.browser.esm.js +9 -6
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +9 -6
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +17 -7
- package/lib/index.esm.js +9 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +9 -6
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +17 -6
- package/package.json +6 -6
- package/src/connection.ts +4 -6
- package/src/keypair.ts +21 -7
- package/src/publickey.ts +2 -16
- package/src/stake-program.ts +2 -7
package/lib/index.d.ts
CHANGED
|
@@ -154,11 +154,25 @@ declare module '@solana/web3.js' {
|
|
|
154
154
|
publicKey: PublicKey;
|
|
155
155
|
secretKey: Uint8Array;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Ed25519 Keypair
|
|
159
|
+
*/
|
|
160
|
+
interface Ed25519Keypair {
|
|
161
|
+
publicKey: Uint8Array;
|
|
162
|
+
secretKey: Uint8Array;
|
|
163
|
+
}
|
|
157
164
|
/**
|
|
158
165
|
* An account keypair used for signing transactions.
|
|
159
166
|
*/
|
|
160
167
|
export class Keypair {
|
|
161
|
-
private
|
|
168
|
+
private _keypair;
|
|
169
|
+
/**
|
|
170
|
+
* Create a new keypair instance.
|
|
171
|
+
* Generate random keypair if no {@link Ed25519Keypair} is provided.
|
|
172
|
+
*
|
|
173
|
+
* @param keypair ed25519 keypair
|
|
174
|
+
*/
|
|
175
|
+
constructor(keypair?: Ed25519Keypair);
|
|
162
176
|
/**
|
|
163
177
|
* Generate a new random keypair
|
|
164
178
|
*/
|
|
@@ -1479,9 +1493,7 @@ declare module '@solana/web3.js' {
|
|
|
1479
1493
|
* Fetch a recent blockhash from the cluster, return with context
|
|
1480
1494
|
* @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
|
|
1481
1495
|
*/
|
|
1482
|
-
getRecentBlockhashAndContext(
|
|
1483
|
-
commitment?: Commitment,
|
|
1484
|
-
): Promise<
|
|
1496
|
+
getRecentBlockhashAndContext(commitment?: Commitment): Promise<
|
|
1485
1497
|
RpcResponseAndContext<{
|
|
1486
1498
|
blockhash: Blockhash;
|
|
1487
1499
|
feeCalculator: FeeCalculator;
|
|
@@ -1503,9 +1515,7 @@ declare module '@solana/web3.js' {
|
|
|
1503
1515
|
* Fetch a recent blockhash from the cluster
|
|
1504
1516
|
* @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
|
|
1505
1517
|
*/
|
|
1506
|
-
getRecentBlockhash(
|
|
1507
|
-
commitment?: Commitment,
|
|
1508
|
-
): Promise<{
|
|
1518
|
+
getRecentBlockhash(commitment?: Commitment): Promise<{
|
|
1509
1519
|
blockhash: Blockhash;
|
|
1510
1520
|
feeCalculator: FeeCalculator;
|
|
1511
1521
|
}>;
|
package/lib/index.esm.js
CHANGED
|
@@ -5240,14 +5240,17 @@ class Connection {
|
|
|
5240
5240
|
*/
|
|
5241
5241
|
class Keypair {
|
|
5242
5242
|
/**
|
|
5243
|
-
*
|
|
5244
|
-
*
|
|
5245
|
-
* Create a new keypair instance from a {@link SignKeyPair}.
|
|
5243
|
+
* Create a new keypair instance.
|
|
5244
|
+
* Generate random keypair if no {@link Ed25519Keypair} is provided.
|
|
5246
5245
|
*
|
|
5247
5246
|
* @param keypair ed25519 keypair
|
|
5248
5247
|
*/
|
|
5249
5248
|
constructor(keypair) {
|
|
5250
|
-
|
|
5249
|
+
if (keypair) {
|
|
5250
|
+
this._keypair = keypair;
|
|
5251
|
+
} else {
|
|
5252
|
+
this._keypair = nacl.sign.keyPair();
|
|
5253
|
+
}
|
|
5251
5254
|
}
|
|
5252
5255
|
/**
|
|
5253
5256
|
* Generate a new random keypair
|
|
@@ -5302,7 +5305,7 @@ class Keypair {
|
|
|
5302
5305
|
|
|
5303
5306
|
|
|
5304
5307
|
get publicKey() {
|
|
5305
|
-
return new PublicKey(this.
|
|
5308
|
+
return new PublicKey(this._keypair.publicKey);
|
|
5306
5309
|
}
|
|
5307
5310
|
/**
|
|
5308
5311
|
* The raw secret key for this keypair
|
|
@@ -5310,7 +5313,7 @@ class Keypair {
|
|
|
5310
5313
|
|
|
5311
5314
|
|
|
5312
5315
|
get secretKey() {
|
|
5313
|
-
return this.
|
|
5316
|
+
return this._keypair.secretKey;
|
|
5314
5317
|
}
|
|
5315
5318
|
|
|
5316
5319
|
}
|