@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/lib/index.d.ts
CHANGED
|
@@ -1136,8 +1136,10 @@ declare module '@solana/web3.js' {
|
|
|
1136
1136
|
export type GetProgramAccountsConfig = {
|
|
1137
1137
|
/** Optional commitment level */
|
|
1138
1138
|
commitment?: Commitment;
|
|
1139
|
-
/** Optional encoding for account data (default base64)
|
|
1140
|
-
|
|
1139
|
+
/** Optional encoding for account data (default base64)
|
|
1140
|
+
* To use "jsonParsed" encoding, please refer to `getParsedProgramAccounts` in connection.ts
|
|
1141
|
+
* */
|
|
1142
|
+
encoding?: 'base64';
|
|
1141
1143
|
/** Optional data slice to limit the returned account data */
|
|
1142
1144
|
dataSlice?: DataSlice;
|
|
1143
1145
|
/** Optional array of filters to apply to accounts */
|
|
@@ -2600,6 +2602,7 @@ declare module '@solana/web3.js' {
|
|
|
2600
2602
|
message: Buffer | Uint8Array | Array<number>;
|
|
2601
2603
|
signature: Buffer | Uint8Array | Array<number>;
|
|
2602
2604
|
recoveryId: number;
|
|
2605
|
+
instructionIndex?: number;
|
|
2603
2606
|
};
|
|
2604
2607
|
/**
|
|
2605
2608
|
* Params for creating an secp256k1 instruction using an Ethereum address
|
|
@@ -2609,6 +2612,7 @@ declare module '@solana/web3.js' {
|
|
|
2609
2612
|
message: Buffer | Uint8Array | Array<number>;
|
|
2610
2613
|
signature: Buffer | Uint8Array | Array<number>;
|
|
2611
2614
|
recoveryId: number;
|
|
2615
|
+
instructionIndex?: number;
|
|
2612
2616
|
};
|
|
2613
2617
|
/**
|
|
2614
2618
|
* Params for creating an secp256k1 instruction using a private key
|
|
@@ -2616,6 +2620,7 @@ declare module '@solana/web3.js' {
|
|
|
2616
2620
|
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
2617
2621
|
privateKey: Buffer | Uint8Array | Array<number>;
|
|
2618
2622
|
message: Buffer | Uint8Array | Array<number>;
|
|
2623
|
+
instructionIndex?: number;
|
|
2619
2624
|
};
|
|
2620
2625
|
export class Secp256k1Program {
|
|
2621
2626
|
/**
|
package/lib/index.esm.js
CHANGED
|
@@ -2118,8 +2118,7 @@ class Loader {
|
|
|
2118
2118
|
* Can be used to calculate transaction fees
|
|
2119
2119
|
*/
|
|
2120
2120
|
static getMinNumSignatures(dataLength) {
|
|
2121
|
-
return 2 * (
|
|
2122
|
-
Math.ceil(dataLength / Loader.chunkSize) + 1 + // Add one for Create transaction
|
|
2121
|
+
return 2 * (Math.ceil(dataLength / Loader.chunkSize) + 1 + // Add one for Create transaction
|
|
2123
2122
|
1) // Add one for Finalize transaction
|
|
2124
2123
|
;
|
|
2125
2124
|
}
|
|
@@ -2716,8 +2715,8 @@ function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRet
|
|
|
2716
2715
|
if (res.status !== 429
|
|
2717
2716
|
/* Too many requests */
|
|
2718
2717
|
) {
|
|
2719
|
-
|
|
2720
|
-
|
|
2718
|
+
break;
|
|
2719
|
+
}
|
|
2721
2720
|
|
|
2722
2721
|
if (disableRetryOnRateLimit === true) {
|
|
2723
2722
|
break;
|
|
@@ -6383,13 +6382,15 @@ class Secp256k1Program {
|
|
|
6383
6382
|
publicKey,
|
|
6384
6383
|
message,
|
|
6385
6384
|
signature,
|
|
6386
|
-
recoveryId
|
|
6385
|
+
recoveryId,
|
|
6386
|
+
instructionIndex
|
|
6387
6387
|
} = params;
|
|
6388
6388
|
return Secp256k1Program.createInstructionWithEthAddress({
|
|
6389
6389
|
ethAddress: Secp256k1Program.publicKeyToEthAddress(publicKey),
|
|
6390
6390
|
message,
|
|
6391
6391
|
signature,
|
|
6392
|
-
recoveryId
|
|
6392
|
+
recoveryId,
|
|
6393
|
+
instructionIndex
|
|
6393
6394
|
});
|
|
6394
6395
|
}
|
|
6395
6396
|
/**
|
|
@@ -6403,7 +6404,8 @@ class Secp256k1Program {
|
|
|
6403
6404
|
ethAddress: rawAddress,
|
|
6404
6405
|
message,
|
|
6405
6406
|
signature,
|
|
6406
|
-
recoveryId
|
|
6407
|
+
recoveryId,
|
|
6408
|
+
instructionIndex = 0
|
|
6407
6409
|
} = params;
|
|
6408
6410
|
let ethAddress;
|
|
6409
6411
|
|
|
@@ -6427,12 +6429,12 @@ class Secp256k1Program {
|
|
|
6427
6429
|
SECP256K1_INSTRUCTION_LAYOUT.encode({
|
|
6428
6430
|
numSignatures,
|
|
6429
6431
|
signatureOffset,
|
|
6430
|
-
signatureInstructionIndex:
|
|
6432
|
+
signatureInstructionIndex: instructionIndex,
|
|
6431
6433
|
ethAddressOffset,
|
|
6432
|
-
ethAddressInstructionIndex:
|
|
6434
|
+
ethAddressInstructionIndex: instructionIndex,
|
|
6433
6435
|
messageDataOffset,
|
|
6434
6436
|
messageDataSize: message.length,
|
|
6435
|
-
messageInstructionIndex:
|
|
6437
|
+
messageInstructionIndex: instructionIndex,
|
|
6436
6438
|
signature: toBuffer(signature),
|
|
6437
6439
|
ethAddress: toBuffer(ethAddress),
|
|
6438
6440
|
recoveryId
|
|
@@ -6453,7 +6455,8 @@ class Secp256k1Program {
|
|
|
6453
6455
|
static createInstructionWithPrivateKey(params) {
|
|
6454
6456
|
const {
|
|
6455
6457
|
privateKey: pkey,
|
|
6456
|
-
message
|
|
6458
|
+
message,
|
|
6459
|
+
instructionIndex
|
|
6457
6460
|
} = params;
|
|
6458
6461
|
assert(pkey.length === PRIVATE_KEY_BYTES, `Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`);
|
|
6459
6462
|
|
|
@@ -6470,7 +6473,8 @@ class Secp256k1Program {
|
|
|
6470
6473
|
publicKey,
|
|
6471
6474
|
message,
|
|
6472
6475
|
signature,
|
|
6473
|
-
recoveryId
|
|
6476
|
+
recoveryId,
|
|
6477
|
+
instructionIndex
|
|
6474
6478
|
});
|
|
6475
6479
|
} catch (error) {
|
|
6476
6480
|
throw new Error(`Error creating instruction; ${error}`);
|