@solana/web3.js 1.97.0 → 1.98.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/README.md +4 -4
- package/lib/index.browser.cjs.js +31 -39
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +29 -37
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +31 -39
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +29 -37
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +229 -106
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +31 -39
- package/lib/index.native.js.map +1 -1
- package/package.json +5 -5
- package/src/connection.ts +23 -21
- package/src/programs/address-lookup-table/index.ts +5 -2
- package/src/utils/bigint.ts +14 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.98.1",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"homepage": "https://solana.com/",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/solana-
|
|
14
|
+
"url": "https://github.com/solana-foundation/solana-web3.js.git"
|
|
15
15
|
},
|
|
16
16
|
"bugs": {
|
|
17
|
-
"url": "http://github.com/solana-
|
|
17
|
+
"url": "http://github.com/solana-foundation/solana-web3.js.git/issues"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"clean": "rimraf ./doc ./declarations ./lib",
|
|
45
45
|
"dev": "cross-env NODE_ENV=development rollup -c --watch",
|
|
46
46
|
"prepublishOnly": "pnpm pkg delete devDependencies",
|
|
47
|
-
"publish-packages": "semantic-release --repository-url git@github.com:solana-
|
|
47
|
+
"publish-packages": "semantic-release --repository-url git@github.com:solana-foundation/solana-web3.js.git",
|
|
48
48
|
"test:lint": "eslint src/ test/ --ext .js,.ts",
|
|
49
49
|
"test:lint:fix": "eslint src/ test/ --fix --ext .js,.ts",
|
|
50
50
|
"test:live": "TEST_LIVE=1 pnpm run test:unit",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@noble/curves": "^1.4.2",
|
|
61
61
|
"@noble/hashes": "^1.4.0",
|
|
62
62
|
"@solana/buffer-layout": "^4.0.1",
|
|
63
|
+
"@solana/codecs-numbers": "^2.1.0",
|
|
63
64
|
"agentkeepalive": "^4.5.0",
|
|
64
|
-
"bigint-buffer": "^1.1.5",
|
|
65
65
|
"bn.js": "^5.2.1",
|
|
66
66
|
"borsh": "^0.7.0",
|
|
67
67
|
"bs58": "^4.0.1",
|
package/src/connection.ts
CHANGED
|
@@ -2599,20 +2599,6 @@ const GetParsedTransactionRpcResult = jsonRpcResult(
|
|
|
2599
2599
|
),
|
|
2600
2600
|
);
|
|
2601
2601
|
|
|
2602
|
-
/**
|
|
2603
|
-
* Expected JSON RPC response for the "getRecentBlockhash" message
|
|
2604
|
-
*
|
|
2605
|
-
* @deprecated Deprecated since RPC v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
|
|
2606
|
-
*/
|
|
2607
|
-
const GetRecentBlockhashAndContextRpcResult = jsonRpcResultAndContext(
|
|
2608
|
-
pick({
|
|
2609
|
-
blockhash: string(),
|
|
2610
|
-
feeCalculator: pick({
|
|
2611
|
-
lamportsPerSignature: number(),
|
|
2612
|
-
}),
|
|
2613
|
-
}),
|
|
2614
|
-
);
|
|
2615
|
-
|
|
2616
2602
|
/**
|
|
2617
2603
|
* Expected JSON RPC response for the "getLatestBlockhash" message
|
|
2618
2604
|
*/
|
|
@@ -4567,13 +4553,29 @@ export class Connection {
|
|
|
4567
4553
|
feeCalculator: FeeCalculator;
|
|
4568
4554
|
}>
|
|
4569
4555
|
> {
|
|
4570
|
-
const
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4556
|
+
const {
|
|
4557
|
+
context,
|
|
4558
|
+
value: {blockhash},
|
|
4559
|
+
} = await this.getLatestBlockhashAndContext(commitment);
|
|
4560
|
+
const feeCalculator = {
|
|
4561
|
+
get lamportsPerSignature(): number {
|
|
4562
|
+
throw new Error(
|
|
4563
|
+
'The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is ' +
|
|
4564
|
+
'no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee ' +
|
|
4565
|
+
'for a given message.',
|
|
4566
|
+
);
|
|
4567
|
+
},
|
|
4568
|
+
toJSON() {
|
|
4569
|
+
return {};
|
|
4570
|
+
},
|
|
4571
|
+
};
|
|
4572
|
+
return {
|
|
4573
|
+
context,
|
|
4574
|
+
value: {
|
|
4575
|
+
blockhash,
|
|
4576
|
+
feeCalculator,
|
|
4577
|
+
},
|
|
4578
|
+
};
|
|
4577
4579
|
}
|
|
4578
4580
|
|
|
4579
4581
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {toBufferLE} from 'bigint-buffer';
|
|
2
1
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
2
|
+
import {getU64Encoder} from '@solana/codecs-numbers';
|
|
3
3
|
|
|
4
4
|
import * as Layout from '../../layout';
|
|
5
5
|
import {PublicKey} from '../../publickey';
|
|
@@ -272,7 +272,10 @@ export class AddressLookupTableProgram {
|
|
|
272
272
|
|
|
273
273
|
static createLookupTable(params: CreateLookupTableParams) {
|
|
274
274
|
const [lookupTableAddress, bumpSeed] = PublicKey.findProgramAddressSync(
|
|
275
|
-
[
|
|
275
|
+
[
|
|
276
|
+
params.authority.toBuffer(),
|
|
277
|
+
getU64Encoder().encode(params.recentSlot) as Uint8Array,
|
|
278
|
+
],
|
|
276
279
|
this.programId,
|
|
277
280
|
);
|
|
278
281
|
|
package/src/utils/bigint.ts
CHANGED
|
@@ -1,43 +1,24 @@
|
|
|
1
1
|
import {Buffer} from 'buffer';
|
|
2
2
|
import {blob, Layout} from '@solana/buffer-layout';
|
|
3
|
-
import {
|
|
3
|
+
import {getU64Codec} from '@solana/codecs-numbers';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
encode(src: T, buffer: Buffer, offset?: number): number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const encodeDecode = <T>(layout: Layout<T>): EncodeDecode<T> => {
|
|
5
|
+
export function u64(property?: string): Layout<bigint> {
|
|
6
|
+
const layout = blob(8 /* bytes */, property);
|
|
11
7
|
const decode = layout.decode.bind(layout);
|
|
12
8
|
const encode = layout.encode.bind(layout);
|
|
13
|
-
return {decode, encode};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const bigInt =
|
|
17
|
-
(length: number) =>
|
|
18
|
-
(property?: string): Layout<bigint> => {
|
|
19
|
-
const layout = blob(length, property);
|
|
20
|
-
const {encode, decode} = encodeDecode(layout);
|
|
21
|
-
|
|
22
|
-
const bigIntLayout = layout as Layout<unknown> as Layout<bigint>;
|
|
23
|
-
|
|
24
|
-
bigIntLayout.decode = (buffer: Buffer, offset: number) => {
|
|
25
|
-
const src = decode(buffer, offset);
|
|
26
|
-
return toBigIntLE(Buffer.from(src));
|
|
27
|
-
};
|
|
28
9
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return encode(src, buffer, offset);
|
|
32
|
-
};
|
|
10
|
+
const bigIntLayout = layout as Layout<unknown> as Layout<bigint>;
|
|
11
|
+
const codec = getU64Codec();
|
|
33
12
|
|
|
34
|
-
|
|
13
|
+
bigIntLayout.decode = (buffer: Buffer, offset: number) => {
|
|
14
|
+
const src = decode(buffer as Uint8Array, offset);
|
|
15
|
+
return codec.decode(src);
|
|
35
16
|
};
|
|
36
17
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export const u192 = bigInt(24);
|
|
18
|
+
bigIntLayout.encode = (bigInt: bigint, buffer: Buffer, offset: number) => {
|
|
19
|
+
const src = codec.encode(bigInt) as Uint8Array;
|
|
20
|
+
return encode(src, buffer as Uint8Array, offset);
|
|
21
|
+
};
|
|
42
22
|
|
|
43
|
-
|
|
23
|
+
return bigIntLayout;
|
|
24
|
+
}
|