@solana/web3.js 1.41.0 → 1.41.3

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/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export * from './stake-program';
16
16
  export * from './system-program';
17
17
  export * from './secp256k1-program';
18
18
  export * from './transaction';
19
+ export * from './transaction-constants';
19
20
  export * from './validator-info';
20
21
  export * from './vote-account';
21
22
  export * from './vote-program';
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