@solana/web3.js 1.41.0 → 1.41.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.41.0",
3
+ "version": "1.41.1",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -50,8 +50,8 @@
50
50
  "pretty": "prettier --check '{,{src,test}/**/}*.{j,t}s'",
51
51
  "pretty:fix": "prettier --write '{,{src,test}/**/}*.{j,t}s'",
52
52
  "re": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git",
53
- "test": "mocha -r ts-node/register './test/**/*.test.ts'",
54
- "test:cover": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' nyc --reporter=lcov mocha -r ts-node/register './test/**/*.test.ts'",
53
+ "test": "cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\" }' ts-mocha --require esm './test/**/*.test.ts'",
54
+ "test:cover": "nyc --reporter=lcov npm run test",
55
55
  "test:live": "TEST_LIVE=1 npm run test",
56
56
  "test:live-with-test-validator": "start-server-and-test 'solana-test-validator --reset --quiet' http://localhost:8899/health test:live"
57
57
  },
@@ -117,7 +117,6 @@
117
117
  "npm-run-all": "^4.1.5",
118
118
  "nyc": "^15.1.0",
119
119
  "prettier": "^2.3.0",
120
- "puppeteer": "^12.0.0",
121
120
  "rimraf": "3.0.2",
122
121
  "rollup": "2.60.2",
123
122
  "rollup-plugin-dts": "^4.0.0",
@@ -126,6 +125,7 @@
126
125
  "semantic-release": "^18.0.0",
127
126
  "sinon": "^12.0.0",
128
127
  "start-server-and-test": "^1.12.0",
128
+ "ts-mocha": "^9.0.2",
129
129
  "ts-node": "^10.0.0",
130
130
  "tslib": "^2.1.0",
131
131
  "typedoc": "^0.22.2",
package/src/loader.ts CHANGED
@@ -2,7 +2,7 @@ import {Buffer} from 'buffer';
2
2
  import * as BufferLayout from '@solana/buffer-layout';
3
3
 
4
4
  import {PublicKey} from './publickey';
5
- import {Transaction, PACKET_DATA_SIZE} from './transaction';
5
+ import {Transaction} from './transaction';
6
6
  import {SYSVAR_RENT_PUBKEY} from './sysvar';
7
7
  import {sendAndConfirmTransaction} from './util/send-and-confirm-transaction';
8
8
  import {sleep} from './util/sleep';
@@ -10,6 +10,7 @@ import type {Connection} from './connection';
10
10
  import type {Signer} from './keypair';
11
11
  import {SystemProgram} from './system-program';
12
12
  import {IInstructionInputData} from './instruction';
13
+ import {PACKET_DATA_SIZE} from './transaction-constants';
13
14
 
14
15
  // Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the
15
16
  // rest of the Transaction fields
package/src/message.ts CHANGED
@@ -5,7 +5,7 @@ import * as BufferLayout from '@solana/buffer-layout';
5
5
  import {PublicKey} from './publickey';
6
6
  import type {Blockhash} from './blockhash';
7
7
  import * as Layout from './layout';
8
- import {PACKET_DATA_SIZE} from './transaction';
8
+ import {PACKET_DATA_SIZE} from './transaction-constants';
9
9
  import * as shortvec from './util/shortvec-encoding';
10
10
  import {toBuffer} from './util/to-buffer';
11
11
 
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Maximum over-the-wire size of a Transaction
3
+ *
4
+ * 1280 is IPv6 minimum MTU
5
+ * 40 bytes is the size of the IPv6 header
6
+ * 8 bytes is the size of the fragment header
7
+ */
8
+ export const PACKET_DATA_SIZE = 1280 - 40 - 8;
9
+
10
+ export const SIGNATURE_LENGTH_IN_BYTES = 64;
@@ -2,6 +2,10 @@ import nacl from 'tweetnacl';
2
2
  import bs58 from 'bs58';
3
3
  import {Buffer} from 'buffer';
4
4
 
5
+ import {
6
+ PACKET_DATA_SIZE,
7
+ SIGNATURE_LENGTH_IN_BYTES,
8
+ } from './transaction-constants';
5
9
  import {Connection} from './connection';
6
10
  import {Message} from './message';
7
11
  import {PublicKey} from './publickey';
@@ -19,21 +23,8 @@ export type TransactionSignature = string;
19
23
 
20
24
  /**
21
25
  * Default (empty) signature
22
- *
23
- * Signatures are 64 bytes in length
24
- */
25
- const DEFAULT_SIGNATURE = Buffer.alloc(64).fill(0);
26
-
27
- /**
28
- * Maximum over-the-wire size of a Transaction
29
- *
30
- * 1280 is IPv6 minimum MTU
31
- * 40 bytes is the size of the IPv6 header
32
- * 8 bytes is the size of the fragment header
33
26
  */
34
- export const PACKET_DATA_SIZE = 1280 - 40 - 8;
35
-
36
- const SIGNATURE_LENGTH = 64;
27
+ const DEFAULT_SIGNATURE = Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);
37
28
 
38
29
  /**
39
30
  * Account metadata used to define instructions
@@ -747,8 +738,8 @@ export class Transaction {
747
738
  const signatureCount = shortvec.decodeLength(byteArray);
748
739
  let signatures = [];
749
740
  for (let i = 0; i < signatureCount; i++) {
750
- const signature = byteArray.slice(0, SIGNATURE_LENGTH);
751
- byteArray = byteArray.slice(SIGNATURE_LENGTH);
741
+ const signature = byteArray.slice(0, SIGNATURE_LENGTH_IN_BYTES);
742
+ byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
752
743
  signatures.push(bs58.encode(Buffer.from(signature)));
753
744
  }
754
745