@solana/web3.js 1.43.0 → 1.43.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 +36 -4
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +34 -1
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +36 -4
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +34 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +11848 -12238
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +4 -2
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +3 -3
- package/src/compute-budget.ts +1 -1
- package/src/system-program.ts +1 -1
- package/src/util/bigint.ts +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.1",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@babel/runtime": "^7.12.5",
|
|
60
60
|
"@ethersproject/sha2": "^5.5.0",
|
|
61
61
|
"@solana/buffer-layout": "^4.0.0",
|
|
62
|
-
"
|
|
62
|
+
"bigint-buffer": "^1.1.5",
|
|
63
63
|
"bn.js": "^5.0.0",
|
|
64
64
|
"borsh": "^0.7.0",
|
|
65
65
|
"bs58": "^4.0.1",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"eslint": "^7.19.0",
|
|
111
111
|
"eslint-config-prettier": "^8.0.0",
|
|
112
112
|
"eslint-plugin-import": "2.26.0",
|
|
113
|
-
"eslint-plugin-mocha": "^
|
|
113
|
+
"eslint-plugin-mocha": "^10.0.4",
|
|
114
114
|
"eslint-plugin-prettier": "^4.0.0",
|
|
115
115
|
"esm": "^3.2.25",
|
|
116
116
|
"http-server": "^14.0.0",
|
package/src/compute-budget.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
2
|
-
import {u64} from '@solana/buffer-layout-utils';
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
encodeData,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
} from './instruction';
|
|
10
9
|
import {PublicKey} from './publickey';
|
|
11
10
|
import {TransactionInstruction} from './transaction';
|
|
11
|
+
import {u64} from './util/bigint';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Compute Budget Instruction class
|
package/src/system-program.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
2
|
-
import {u64} from '@solana/buffer-layout-utils';
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
encodeData,
|
|
@@ -13,6 +12,7 @@ import {PublicKey} from './publickey';
|
|
|
13
12
|
import {SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY} from './sysvar';
|
|
14
13
|
import {Transaction, TransactionInstruction} from './transaction';
|
|
15
14
|
import {toBuffer} from './util/to-buffer';
|
|
15
|
+
import {u64} from './util/bigint';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Create account system transaction params
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {Buffer} from 'buffer';
|
|
2
|
+
import {blob, Layout} from '@solana/buffer-layout';
|
|
3
|
+
import {toBigIntLE, toBufferLE} from 'bigint-buffer';
|
|
4
|
+
|
|
5
|
+
interface EncodeDecode<T> {
|
|
6
|
+
decode(buffer: Buffer, offset?: number): T;
|
|
7
|
+
encode(src: T, buffer: Buffer, offset?: number): number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const encodeDecode = <T>(layout: Layout<T>): EncodeDecode<T> => {
|
|
11
|
+
const decode = layout.decode.bind(layout);
|
|
12
|
+
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
|
+
|
|
29
|
+
bigIntLayout.encode = (bigInt: bigint, buffer: Buffer, offset: number) => {
|
|
30
|
+
const src = toBufferLE(bigInt, length);
|
|
31
|
+
return encode(src, buffer, offset);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return bigIntLayout;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const u64 = bigInt(8);
|
|
38
|
+
|
|
39
|
+
export const u128 = bigInt(16);
|
|
40
|
+
|
|
41
|
+
export const u192 = bigInt(24);
|
|
42
|
+
|
|
43
|
+
export const u256 = bigInt(32);
|