@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/lib/index.browser.cjs.js +14 -17
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +15 -17
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +14 -17
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +0 -8
- package/lib/index.esm.js +15 -17
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +14 -17
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +4 -4
- package/src/loader.ts +2 -1
- package/src/message.ts +1 -1
- package/src/transaction-constants.ts +10 -0
- package/src/transaction.ts +7 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.41.
|
|
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": "
|
|
54
|
-
"test:cover": "
|
|
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
|
|
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;
|
package/src/transaction.ts
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
751
|
-
byteArray = byteArray.slice(
|
|
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
|
|