@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.cjs.js CHANGED
@@ -5278,14 +5278,17 @@ class Connection {
5278
5278
  */
5279
5279
  class Keypair {
5280
5280
  /**
5281
- * @internal
5282
- *
5283
- * Create a new keypair instance from a {@link SignKeyPair}.
5281
+ * Create a new keypair instance.
5282
+ * Generate random keypair if no {@link Ed25519Keypair} is provided.
5284
5283
  *
5285
5284
  * @param keypair ed25519 keypair
5286
5285
  */
5287
5286
  constructor(keypair) {
5288
- this.keypair = keypair;
5287
+ if (keypair) {
5288
+ this._keypair = keypair;
5289
+ } else {
5290
+ this._keypair = nacl__namespace.sign.keyPair();
5291
+ }
5289
5292
  }
5290
5293
  /**
5291
5294
  * Generate a new random keypair
@@ -5340,7 +5343,7 @@ class Keypair {
5340
5343
 
5341
5344
 
5342
5345
  get publicKey() {
5343
- return new PublicKey(this.keypair.publicKey);
5346
+ return new PublicKey(this._keypair.publicKey);
5344
5347
  }
5345
5348
  /**
5346
5349
  * The raw secret key for this keypair
@@ -5348,7 +5351,7 @@ class Keypair {
5348
5351
 
5349
5352
 
5350
5353
  get secretKey() {
5351
- return this.keypair.secretKey;
5354
+ return this._keypair.secretKey;
5352
5355
  }
5353
5356
 
5354
5357
  }