@solana/web3.js 1.30.2 → 1.31.0

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.esm.js CHANGED
@@ -1,5 +1,4 @@
1
- import * as nacl from 'tweetnacl';
2
- import nacl__default from 'tweetnacl';
1
+ import nacl from 'tweetnacl';
3
2
  import { Buffer } from 'buffer';
4
3
  import BN from 'bn.js';
5
4
  import bs58 from 'bs58';
@@ -12,7 +11,7 @@ import RpcClient from 'jayson/lib/client/browser';
12
11
  import http from 'http';
13
12
  import https from 'https';
14
13
  import secp256k1 from 'secp256k1';
15
- import { keccak_256 } from 'js-sha3';
14
+ import sha3 from 'js-sha3';
16
15
 
17
16
  const toBuffer = arr => {
18
17
  if (Buffer.isBuffer(arr)) {
@@ -1925,7 +1924,7 @@ SOLANA_SCHEMA.set(PublicKey, {
1925
1924
  fields: [['_bn', 'u256']]
1926
1925
  }); // @ts-ignore
1927
1926
 
1928
- let naclLowLevel = nacl__default.lowlevel; // Check that a pubkey is on the curve.
1927
+ let naclLowLevel = nacl.lowlevel; // Check that a pubkey is on the curve.
1929
1928
  // This function and its dependents were sourced from:
1930
1929
  // https://github.com/dchest/tweetnacl-js/blob/f1ec050ceae0861f34280e62498b1d3ed9c350c6/nacl.js#L792
1931
1930
 
@@ -2700,7 +2699,7 @@ class Transaction {
2700
2699
  _partialSign(message, ...signers) {
2701
2700
  const signData = message.serialize();
2702
2701
  signers.forEach(signer => {
2703
- const signature = nacl__default.sign.detached(signData, signer.secretKey);
2702
+ const signature = nacl.sign.detached(signData, signer.secretKey);
2704
2703
 
2705
2704
  this._addSignature(signer.publicKey, toBuffer(signature));
2706
2705
  });
@@ -2756,7 +2755,7 @@ class Transaction {
2756
2755
  return false;
2757
2756
  }
2758
2757
  } else {
2759
- if (!nacl__default.sign.detached.verify(signData, signature, publicKey.toBuffer())) {
2758
+ if (!nacl.sign.detached.verify(signData, signature, publicKey.toBuffer())) {
2760
2759
  return false;
2761
2760
  }
2762
2761
  }
@@ -7397,7 +7396,7 @@ class Ed25519Program {
7397
7396
  try {
7398
7397
  const keypair = Keypair.fromSecretKey(privateKey);
7399
7398
  const publicKey = keypair.publicKey.toBytes();
7400
- const signature = nacl__default.sign.detached(message, keypair.secretKey);
7399
+ const signature = nacl.sign.detached(message, keypair.secretKey);
7401
7400
  return this.createInstructionWithPublicKey({
7402
7401
  publicKey,
7403
7402
  message,
@@ -8194,7 +8193,7 @@ class Secp256k1Program {
8194
8193
  assert(publicKey.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`);
8195
8194
 
8196
8195
  try {
8197
- return Buffer.from(keccak_256.update(toBuffer(publicKey)).digest()).slice(-ETHEREUM_ADDRESS_BYTES);
8196
+ return Buffer.from(sha3.keccak_256.update(toBuffer(publicKey)).digest()).slice(-ETHEREUM_ADDRESS_BYTES);
8198
8197
  } catch (error) {
8199
8198
  throw new Error(`Error constructing Ethereum address: ${error}`);
8200
8199
  }
@@ -8292,7 +8291,7 @@ class Secp256k1Program {
8292
8291
  const privateKey = toBuffer(pkey);
8293
8292
  const publicKey = publicKeyCreate(privateKey, false).slice(1); // throw away leading byte
8294
8293
 
8295
- const messageHash = Buffer.from(keccak_256.update(toBuffer(message)).digest());
8294
+ const messageHash = Buffer.from(sha3.keccak_256.update(toBuffer(message)).digest());
8296
8295
  const {
8297
8296
  signature,
8298
8297
  recid: recoveryId