@solana/web3.js 1.22.1 → 1.23.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 +41 -0
- package/lib/index.browser.esm.js +16 -12
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +16 -12
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +7 -2
- package/lib/index.esm.js +16 -12
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +38 -28
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +5 -1
- package/package.json +7 -7
- package/src/connection.ts +4 -2
- package/src/secp256k1-program.ts +18 -6
package/module.flow.js
CHANGED
|
@@ -1728,8 +1728,9 @@ declare module "@solana/web3.js" {
|
|
|
1728
1728
|
|
|
1729
1729
|
/**
|
|
1730
1730
|
* Optional encoding for account data (default base64)
|
|
1731
|
+
* To use "jsonParsed" encoding, please refer to `getParsedProgramAccounts` in connection.ts
|
|
1731
1732
|
*/
|
|
1732
|
-
encoding?: "base64"
|
|
1733
|
+
encoding?: "base64",
|
|
1733
1734
|
|
|
1734
1735
|
/**
|
|
1735
1736
|
* Optional data slice to limit the returned account data
|
|
@@ -3647,6 +3648,7 @@ feeCalculator: FeeCalculator,...
|
|
|
3647
3648
|
message: Buffer | Uint8Array | Array<number>,
|
|
3648
3649
|
signature: Buffer | Uint8Array | Array<number>,
|
|
3649
3650
|
recoveryId: number,
|
|
3651
|
+
instructionIndex?: number,
|
|
3650
3652
|
...
|
|
3651
3653
|
};
|
|
3652
3654
|
|
|
@@ -3658,6 +3660,7 @@ feeCalculator: FeeCalculator,...
|
|
|
3658
3660
|
message: Buffer | Uint8Array | Array<number>,
|
|
3659
3661
|
signature: Buffer | Uint8Array | Array<number>,
|
|
3660
3662
|
recoveryId: number,
|
|
3663
|
+
instructionIndex?: number,
|
|
3661
3664
|
...
|
|
3662
3665
|
};
|
|
3663
3666
|
|
|
@@ -3667,6 +3670,7 @@ feeCalculator: FeeCalculator,...
|
|
|
3667
3670
|
declare export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
3668
3671
|
privateKey: Buffer | Uint8Array | Array<number>,
|
|
3669
3672
|
message: Buffer | Uint8Array | Array<number>,
|
|
3673
|
+
instructionIndex?: number,
|
|
3670
3674
|
...
|
|
3671
3675
|
};
|
|
3672
3676
|
declare export class Secp256k1Program {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.1",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"@babel/preset-env": "^7.12.11",
|
|
60
60
|
"@babel/preset-typescript": "^7.12.16",
|
|
61
61
|
"@babel/register": "^7.12.13",
|
|
62
|
-
"@commitlint/config-conventional": "^
|
|
63
|
-
"@commitlint/travis-cli": "^
|
|
62
|
+
"@commitlint/config-conventional": "^13.1.0",
|
|
63
|
+
"@commitlint/travis-cli": "^13.1.0",
|
|
64
64
|
"@rollup/plugin-alias": "^3.1.2",
|
|
65
65
|
"@rollup/plugin-babel": "^5.2.3",
|
|
66
|
-
"@rollup/plugin-commonjs": "^
|
|
66
|
+
"@rollup/plugin-commonjs": "^20.0.0",
|
|
67
67
|
"@rollup/plugin-json": "^4.1.0",
|
|
68
68
|
"@rollup/plugin-multi-entry": "^4.0.0",
|
|
69
69
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@types/chai": "^4.2.15",
|
|
75
75
|
"@types/chai-as-promised": "^7.1.3",
|
|
76
76
|
"@types/express-serve-static-core": "^4.17.21",
|
|
77
|
-
"@types/mocha": "^
|
|
77
|
+
"@types/mocha": "^9.0.0",
|
|
78
78
|
"@types/mz": "^2.7.3",
|
|
79
79
|
"@types/node": "^16.0.0",
|
|
80
80
|
"@types/node-fetch": "^2.5.8",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"cross-env": "7.0.3",
|
|
89
89
|
"eslint": "^7.19.0",
|
|
90
90
|
"eslint-config-prettier": "^8.0.0",
|
|
91
|
-
"eslint-plugin-import": "2.
|
|
91
|
+
"eslint-plugin-import": "2.24.0",
|
|
92
92
|
"eslint-plugin-mocha": "^9.0.0",
|
|
93
93
|
"eslint-plugin-prettier": "^3.0.0",
|
|
94
94
|
"esm": "^3.2.25",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"nyc": "^15.1.0",
|
|
104
104
|
"prettier": "^2.3.0",
|
|
105
105
|
"rimraf": "3.0.2",
|
|
106
|
-
"rollup": "2.
|
|
106
|
+
"rollup": "2.56.2",
|
|
107
107
|
"rollup-plugin-dts": "^3.0.1",
|
|
108
108
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
109
109
|
"rollup-plugin-terser": "^7.0.2",
|
package/src/connection.ts
CHANGED
|
@@ -1646,8 +1646,10 @@ export type GetProgramAccountsFilter = MemcmpFilter | DataSizeFilter;
|
|
|
1646
1646
|
export type GetProgramAccountsConfig = {
|
|
1647
1647
|
/** Optional commitment level */
|
|
1648
1648
|
commitment?: Commitment;
|
|
1649
|
-
/** Optional encoding for account data (default base64)
|
|
1650
|
-
|
|
1649
|
+
/** Optional encoding for account data (default base64)
|
|
1650
|
+
* To use "jsonParsed" encoding, please refer to `getParsedProgramAccounts` in connection.ts
|
|
1651
|
+
* */
|
|
1652
|
+
encoding?: 'base64';
|
|
1651
1653
|
/** Optional data slice to limit the returned account data */
|
|
1652
1654
|
dataSlice?: DataSlice;
|
|
1653
1655
|
/** Optional array of filters to apply to accounts */
|
package/src/secp256k1-program.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
|
|
23
23
|
message: Buffer | Uint8Array | Array<number>;
|
|
24
24
|
signature: Buffer | Uint8Array | Array<number>;
|
|
25
25
|
recoveryId: number;
|
|
26
|
+
instructionIndex?: number;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -33,6 +34,7 @@ export type CreateSecp256k1InstructionWithEthAddressParams = {
|
|
|
33
34
|
message: Buffer | Uint8Array | Array<number>;
|
|
34
35
|
signature: Buffer | Uint8Array | Array<number>;
|
|
35
36
|
recoveryId: number;
|
|
37
|
+
instructionIndex?: number;
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -41,6 +43,7 @@ export type CreateSecp256k1InstructionWithEthAddressParams = {
|
|
|
41
43
|
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
42
44
|
privateKey: Buffer | Uint8Array | Array<number>;
|
|
43
45
|
message: Buffer | Uint8Array | Array<number>;
|
|
46
|
+
instructionIndex?: number;
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
const SECP256K1_INSTRUCTION_LAYOUT = BufferLayout.struct([
|
|
@@ -98,12 +101,14 @@ export class Secp256k1Program {
|
|
|
98
101
|
static createInstructionWithPublicKey(
|
|
99
102
|
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
|
100
103
|
): TransactionInstruction {
|
|
101
|
-
const {publicKey, message, signature, recoveryId} =
|
|
104
|
+
const {publicKey, message, signature, recoveryId, instructionIndex} =
|
|
105
|
+
params;
|
|
102
106
|
return Secp256k1Program.createInstructionWithEthAddress({
|
|
103
107
|
ethAddress: Secp256k1Program.publicKeyToEthAddress(publicKey),
|
|
104
108
|
message,
|
|
105
109
|
signature,
|
|
106
110
|
recoveryId,
|
|
111
|
+
instructionIndex,
|
|
107
112
|
});
|
|
108
113
|
}
|
|
109
114
|
|
|
@@ -114,7 +119,13 @@ export class Secp256k1Program {
|
|
|
114
119
|
static createInstructionWithEthAddress(
|
|
115
120
|
params: CreateSecp256k1InstructionWithEthAddressParams,
|
|
116
121
|
): TransactionInstruction {
|
|
117
|
-
const {
|
|
122
|
+
const {
|
|
123
|
+
ethAddress: rawAddress,
|
|
124
|
+
message,
|
|
125
|
+
signature,
|
|
126
|
+
recoveryId,
|
|
127
|
+
instructionIndex = 0,
|
|
128
|
+
} = params;
|
|
118
129
|
|
|
119
130
|
let ethAddress;
|
|
120
131
|
if (typeof rawAddress === 'string') {
|
|
@@ -146,12 +157,12 @@ export class Secp256k1Program {
|
|
|
146
157
|
{
|
|
147
158
|
numSignatures,
|
|
148
159
|
signatureOffset,
|
|
149
|
-
signatureInstructionIndex:
|
|
160
|
+
signatureInstructionIndex: instructionIndex,
|
|
150
161
|
ethAddressOffset,
|
|
151
|
-
ethAddressInstructionIndex:
|
|
162
|
+
ethAddressInstructionIndex: instructionIndex,
|
|
152
163
|
messageDataOffset,
|
|
153
164
|
messageDataSize: message.length,
|
|
154
|
-
messageInstructionIndex:
|
|
165
|
+
messageInstructionIndex: instructionIndex,
|
|
155
166
|
signature: toBuffer(signature),
|
|
156
167
|
ethAddress: toBuffer(ethAddress),
|
|
157
168
|
recoveryId,
|
|
@@ -175,7 +186,7 @@ export class Secp256k1Program {
|
|
|
175
186
|
static createInstructionWithPrivateKey(
|
|
176
187
|
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
|
177
188
|
): TransactionInstruction {
|
|
178
|
-
const {privateKey: pkey, message} = params;
|
|
189
|
+
const {privateKey: pkey, message, instructionIndex} = params;
|
|
179
190
|
|
|
180
191
|
assert(
|
|
181
192
|
pkey.length === PRIVATE_KEY_BYTES,
|
|
@@ -195,6 +206,7 @@ export class Secp256k1Program {
|
|
|
195
206
|
message,
|
|
196
207
|
signature,
|
|
197
208
|
recoveryId,
|
|
209
|
+
instructionIndex,
|
|
198
210
|
});
|
|
199
211
|
} catch (error) {
|
|
200
212
|
throw new Error(`Error creating instruction; ${error}`);
|