@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.
@@ -7180,14 +7180,17 @@ class Connection {
7180
7180
  */
7181
7181
  class Keypair {
7182
7182
  /**
7183
- * @internal
7184
- *
7185
- * Create a new keypair instance from a {@link SignKeyPair}.
7183
+ * Create a new keypair instance.
7184
+ * Generate random keypair if no {@link Ed25519Keypair} is provided.
7186
7185
  *
7187
7186
  * @param keypair ed25519 keypair
7188
7187
  */
7189
7188
  constructor(keypair) {
7190
- this.keypair = keypair;
7189
+ if (keypair) {
7190
+ this._keypair = keypair;
7191
+ } else {
7192
+ this._keypair = nacl.sign.keyPair();
7193
+ }
7191
7194
  }
7192
7195
  /**
7193
7196
  * Generate a new random keypair
@@ -7242,7 +7245,7 @@ class Keypair {
7242
7245
 
7243
7246
 
7244
7247
  get publicKey() {
7245
- return new PublicKey(this.keypair.publicKey);
7248
+ return new PublicKey(this._keypair.publicKey);
7246
7249
  }
7247
7250
  /**
7248
7251
  * The raw secret key for this keypair
@@ -7250,7 +7253,7 @@ class Keypair {
7250
7253
 
7251
7254
 
7252
7255
  get secretKey() {
7253
- return this.keypair.secretKey;
7256
+ return this._keypair.secretKey;
7254
7257
  }
7255
7258
 
7256
7259
  }