@solana/web3.js 1.42.0 → 1.43.0
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 +59 -3
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +59 -3
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +59 -3
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +40 -6
- package/lib/index.esm.js +59 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +59 -3
- 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 +1 -1
- package/src/compute-budget.ts +92 -3
- package/src/connection.ts +7 -5
- package/src/transaction.ts +0 -1
- package/src/util/send-and-confirm-raw-transaction.ts +6 -6
package/lib/index.d.ts
CHANGED
|
@@ -633,7 +633,7 @@ declare module '@solana/web3.js' {
|
|
|
633
633
|
* A strategy for confirming transactions that uses the last valid
|
|
634
634
|
* block height for a given blockhash to check for transaction expiration.
|
|
635
635
|
*/
|
|
636
|
-
export type
|
|
636
|
+
export type BlockheightBasedTransactionConfirmationStrategy = {
|
|
637
637
|
signature: TransactionSignature;
|
|
638
638
|
} & BlockhashWithExpiryBlockHeight;
|
|
639
639
|
/**
|
|
@@ -1659,7 +1659,7 @@ declare module '@solana/web3.js' {
|
|
|
1659
1659
|
}>
|
|
1660
1660
|
>;
|
|
1661
1661
|
confirmTransaction(
|
|
1662
|
-
strategy:
|
|
1662
|
+
strategy: BlockheightBasedTransactionConfirmationStrategy,
|
|
1663
1663
|
commitment?: Commitment,
|
|
1664
1664
|
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
1665
1665
|
/** @deprecated Instead, call `confirmTransaction` using a `TransactionConfirmationConfig` */
|
|
@@ -2226,20 +2226,34 @@ declare module '@solana/web3.js' {
|
|
|
2226
2226
|
static decodeRequestHeapFrame(
|
|
2227
2227
|
instruction: TransactionInstruction,
|
|
2228
2228
|
): RequestHeapFrameParams;
|
|
2229
|
+
/**
|
|
2230
|
+
* Decode set compute unit limit compute budget instruction and retrieve the instruction params.
|
|
2231
|
+
*/
|
|
2232
|
+
static decodeSetComputeUnitLimit(
|
|
2233
|
+
instruction: TransactionInstruction,
|
|
2234
|
+
): SetComputeUnitLimitParams;
|
|
2235
|
+
/**
|
|
2236
|
+
* Decode set compute unit price compute budget instruction and retrieve the instruction params.
|
|
2237
|
+
*/
|
|
2238
|
+
static decodeSetComputeUnitPrice(
|
|
2239
|
+
instruction: TransactionInstruction,
|
|
2240
|
+
): SetComputeUnitPriceParams;
|
|
2229
2241
|
}
|
|
2230
2242
|
/**
|
|
2231
2243
|
* An enumeration of valid ComputeBudgetInstructionType's
|
|
2232
2244
|
*/
|
|
2233
2245
|
export type ComputeBudgetInstructionType =
|
|
2234
2246
|
| 'RequestUnits'
|
|
2235
|
-
| 'RequestHeapFrame'
|
|
2247
|
+
| 'RequestHeapFrame'
|
|
2248
|
+
| 'SetComputeUnitLimit'
|
|
2249
|
+
| 'SetComputeUnitPrice';
|
|
2236
2250
|
/**
|
|
2237
2251
|
* Request units instruction params
|
|
2238
2252
|
*/
|
|
2239
2253
|
interface RequestUnitsParams {
|
|
2240
2254
|
/** Units to request for transaction-wide compute */
|
|
2241
2255
|
units: number;
|
|
2242
|
-
/**
|
|
2256
|
+
/** Prioritization fee lamports */
|
|
2243
2257
|
additionalFee: number;
|
|
2244
2258
|
}
|
|
2245
2259
|
/**
|
|
@@ -2249,6 +2263,20 @@ declare module '@solana/web3.js' {
|
|
|
2249
2263
|
/** Requested transaction-wide program heap size in bytes. Must be multiple of 1024. Applies to each program, including CPIs. */
|
|
2250
2264
|
bytes: number;
|
|
2251
2265
|
};
|
|
2266
|
+
/**
|
|
2267
|
+
* Set compute unit limit instruction params
|
|
2268
|
+
*/
|
|
2269
|
+
interface SetComputeUnitLimitParams {
|
|
2270
|
+
/** Transaction-wide compute unit limit */
|
|
2271
|
+
units: number;
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Set compute unit price instruction params
|
|
2275
|
+
*/
|
|
2276
|
+
interface SetComputeUnitPriceParams {
|
|
2277
|
+
/** Transaction compute unit price used for prioritization fees */
|
|
2278
|
+
microLamports: number | bigint;
|
|
2279
|
+
}
|
|
2252
2280
|
/**
|
|
2253
2281
|
* Factory class for transaction instructions to interact with the Compute Budget program
|
|
2254
2282
|
*/
|
|
@@ -2261,6 +2289,12 @@ declare module '@solana/web3.js' {
|
|
|
2261
2289
|
static requestHeapFrame(
|
|
2262
2290
|
params: RequestHeapFrameParams,
|
|
2263
2291
|
): TransactionInstruction;
|
|
2292
|
+
static setComputeUnitLimit(
|
|
2293
|
+
params: SetComputeUnitLimitParams,
|
|
2294
|
+
): TransactionInstruction;
|
|
2295
|
+
static setComputeUnitPrice(
|
|
2296
|
+
params: SetComputeUnitPriceParams,
|
|
2297
|
+
): TransactionInstruction;
|
|
2264
2298
|
}
|
|
2265
2299
|
|
|
2266
2300
|
/**
|
|
@@ -3352,14 +3386,14 @@ declare module '@solana/web3.js' {
|
|
|
3352
3386
|
*
|
|
3353
3387
|
* @param {Connection} connection
|
|
3354
3388
|
* @param {Buffer} rawTransaction
|
|
3355
|
-
* @param {
|
|
3389
|
+
* @param {BlockheightBasedTransactionConfirmationStrategy} confirmationStrategy
|
|
3356
3390
|
* @param {ConfirmOptions} [options]
|
|
3357
3391
|
* @returns {Promise<TransactionSignature>}
|
|
3358
3392
|
*/
|
|
3359
3393
|
export function sendAndConfirmRawTransaction(
|
|
3360
3394
|
connection: Connection,
|
|
3361
3395
|
rawTransaction: Buffer,
|
|
3362
|
-
confirmationStrategy:
|
|
3396
|
+
confirmationStrategy: BlockheightBasedTransactionConfirmationStrategy,
|
|
3363
3397
|
options?: ConfirmOptions,
|
|
3364
3398
|
): Promise<TransactionSignature>;
|
|
3365
3399
|
/**
|
package/lib/index.esm.js
CHANGED
|
@@ -2805,8 +2805,6 @@ class Transaction {
|
|
|
2805
2805
|
const message = this._compile();
|
|
2806
2806
|
|
|
2807
2807
|
this._partialSign(message, ...uniqueSigners);
|
|
2808
|
-
|
|
2809
|
-
this._verifySignatures(message.serialize(), true);
|
|
2810
2808
|
}
|
|
2811
2809
|
/**
|
|
2812
2810
|
* Partially sign a transaction with the specified accounts. All accounts must
|
|
@@ -4164,6 +4162,34 @@ class ComputeBudgetInstruction {
|
|
|
4164
4162
|
bytes
|
|
4165
4163
|
};
|
|
4166
4164
|
}
|
|
4165
|
+
/**
|
|
4166
|
+
* Decode set compute unit limit compute budget instruction and retrieve the instruction params.
|
|
4167
|
+
*/
|
|
4168
|
+
|
|
4169
|
+
|
|
4170
|
+
static decodeSetComputeUnitLimit(instruction) {
|
|
4171
|
+
this.checkProgramId(instruction.programId);
|
|
4172
|
+
const {
|
|
4173
|
+
units
|
|
4174
|
+
} = decodeData(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit, instruction.data);
|
|
4175
|
+
return {
|
|
4176
|
+
units
|
|
4177
|
+
};
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4180
|
+
* Decode set compute unit price compute budget instruction and retrieve the instruction params.
|
|
4181
|
+
*/
|
|
4182
|
+
|
|
4183
|
+
|
|
4184
|
+
static decodeSetComputeUnitPrice(instruction) {
|
|
4185
|
+
this.checkProgramId(instruction.programId);
|
|
4186
|
+
const {
|
|
4187
|
+
microLamports
|
|
4188
|
+
} = decodeData(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice, instruction.data);
|
|
4189
|
+
return {
|
|
4190
|
+
microLamports
|
|
4191
|
+
};
|
|
4192
|
+
}
|
|
4167
4193
|
/**
|
|
4168
4194
|
* @internal
|
|
4169
4195
|
*/
|
|
@@ -4192,6 +4218,14 @@ const COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
4192
4218
|
RequestHeapFrame: {
|
|
4193
4219
|
index: 1,
|
|
4194
4220
|
layout: BufferLayout.struct([BufferLayout.u8('instruction'), BufferLayout.u32('bytes')])
|
|
4221
|
+
},
|
|
4222
|
+
SetComputeUnitLimit: {
|
|
4223
|
+
index: 2,
|
|
4224
|
+
layout: BufferLayout.struct([BufferLayout.u8('instruction'), BufferLayout.u32('units')])
|
|
4225
|
+
},
|
|
4226
|
+
SetComputeUnitPrice: {
|
|
4227
|
+
index: 3,
|
|
4228
|
+
layout: BufferLayout.struct([BufferLayout.u8('instruction'), u64('microLamports')])
|
|
4195
4229
|
}
|
|
4196
4230
|
});
|
|
4197
4231
|
/**
|
|
@@ -4228,6 +4262,28 @@ class ComputeBudgetProgram {
|
|
|
4228
4262
|
});
|
|
4229
4263
|
}
|
|
4230
4264
|
|
|
4265
|
+
static setComputeUnitLimit(params) {
|
|
4266
|
+
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
|
|
4267
|
+
const data = encodeData(type, params);
|
|
4268
|
+
return new TransactionInstruction({
|
|
4269
|
+
keys: [],
|
|
4270
|
+
programId: this.programId,
|
|
4271
|
+
data
|
|
4272
|
+
});
|
|
4273
|
+
}
|
|
4274
|
+
|
|
4275
|
+
static setComputeUnitPrice(params) {
|
|
4276
|
+
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice;
|
|
4277
|
+
const data = encodeData(type, {
|
|
4278
|
+
microLamports: BigInt(params.microLamports)
|
|
4279
|
+
});
|
|
4280
|
+
return new TransactionInstruction({
|
|
4281
|
+
keys: [],
|
|
4282
|
+
programId: this.programId,
|
|
4283
|
+
data
|
|
4284
|
+
});
|
|
4285
|
+
}
|
|
4286
|
+
|
|
4231
4287
|
}
|
|
4232
4288
|
ComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');
|
|
4233
4289
|
|
|
@@ -9669,7 +9725,7 @@ VoteProgram.space = 3731;
|
|
|
9669
9725
|
*
|
|
9670
9726
|
* @param {Connection} connection
|
|
9671
9727
|
* @param {Buffer} rawTransaction
|
|
9672
|
-
* @param {
|
|
9728
|
+
* @param {BlockheightBasedTransactionConfirmationStrategy} confirmationStrategy
|
|
9673
9729
|
* @param {ConfirmOptions} [options]
|
|
9674
9730
|
* @returns {Promise<TransactionSignature>}
|
|
9675
9731
|
*/
|