@solana/web3.js 1.59.0 → 1.61.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/README.md +18 -0
- package/lib/index.browser.cjs.js +22 -20
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +22 -20
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +22 -20
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +8 -2
- package/lib/index.esm.js +22 -20
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +22 -20
- 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/lib/index.native.js +22 -20
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +6 -1
- package/src/keypair.ts +1 -1
- package/src/programs/compute-budget.ts +3 -0
- package/src/transaction/message.ts +15 -24
- package/src/transaction/versioned.ts +4 -0
package/lib/index.d.ts
CHANGED
|
@@ -578,6 +578,9 @@ declare module '@solana/web3.js' {
|
|
|
578
578
|
* Public key that identifies the Compute Budget program
|
|
579
579
|
*/
|
|
580
580
|
static programId: PublicKey;
|
|
581
|
+
/**
|
|
582
|
+
* @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
|
|
583
|
+
*/
|
|
581
584
|
static requestUnits(params: RequestUnitsParams): TransactionInstruction;
|
|
582
585
|
static requestHeapFrame(
|
|
583
586
|
params: RequestHeapFrameParams,
|
|
@@ -1847,7 +1850,7 @@ declare module '@solana/web3.js' {
|
|
|
1847
1850
|
}
|
|
1848
1851
|
|
|
1849
1852
|
export type TransactionMessageArgs = {
|
|
1850
|
-
|
|
1853
|
+
payerKey: PublicKey;
|
|
1851
1854
|
instructions: Array<TransactionInstruction>;
|
|
1852
1855
|
recentBlockhash: Blockhash;
|
|
1853
1856
|
};
|
|
@@ -1859,7 +1862,7 @@ declare module '@solana/web3.js' {
|
|
|
1859
1862
|
addressLookupTableAccounts: AddressLookupTableAccount[];
|
|
1860
1863
|
};
|
|
1861
1864
|
export class TransactionMessage {
|
|
1862
|
-
|
|
1865
|
+
payerKey: PublicKey;
|
|
1863
1866
|
instructions: Array<TransactionInstruction>;
|
|
1864
1867
|
recentBlockhash: Blockhash;
|
|
1865
1868
|
constructor(args: TransactionMessageArgs);
|
|
@@ -1880,6 +1883,7 @@ declare module '@solana/web3.js' {
|
|
|
1880
1883
|
export class VersionedTransaction {
|
|
1881
1884
|
signatures: Array<Uint8Array>;
|
|
1882
1885
|
message: VersionedMessage;
|
|
1886
|
+
get version(): TransactionVersion;
|
|
1883
1887
|
constructor(message: VersionedMessage, signatures?: Array<Uint8Array>);
|
|
1884
1888
|
serialize(): Uint8Array;
|
|
1885
1889
|
static deserialize(serializedTransaction: Uint8Array): VersionedTransaction;
|
|
@@ -2432,6 +2436,8 @@ declare module '@solana/web3.js' {
|
|
|
2432
2436
|
signer: boolean;
|
|
2433
2437
|
/** Indicates if the account is writable for this transaction */
|
|
2434
2438
|
writable: boolean;
|
|
2439
|
+
/** Indicates if the account key came from the transaction or a lookup table */
|
|
2440
|
+
source?: 'transaction' | 'lookupTable';
|
|
2435
2441
|
};
|
|
2436
2442
|
/**
|
|
2437
2443
|
* A parsed transaction instruction
|
package/lib/index.esm.js
CHANGED
|
@@ -1945,10 +1945,10 @@ class Transaction {
|
|
|
1945
1945
|
|
|
1946
1946
|
class TransactionMessage {
|
|
1947
1947
|
constructor(args) {
|
|
1948
|
-
this.
|
|
1948
|
+
this.payerKey = void 0;
|
|
1949
1949
|
this.instructions = void 0;
|
|
1950
1950
|
this.recentBlockhash = void 0;
|
|
1951
|
-
this.
|
|
1951
|
+
this.payerKey = args.payerKey;
|
|
1952
1952
|
this.instructions = args.instructions;
|
|
1953
1953
|
this.recentBlockhash = args.recentBlockhash;
|
|
1954
1954
|
}
|
|
@@ -1969,6 +1969,12 @@ class TransactionMessage {
|
|
|
1969
1969
|
const numWritableUnsignedAccounts = message.staticAccountKeys.length - numReadonlyUnsignedAccounts;
|
|
1970
1970
|
assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');
|
|
1971
1971
|
const accountKeys = message.getAccountKeys(args);
|
|
1972
|
+
const payerKey = accountKeys.get(0);
|
|
1973
|
+
|
|
1974
|
+
if (payerKey === undefined) {
|
|
1975
|
+
throw new Error('Failed to decompile message because no account keys were found');
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1972
1978
|
const instructions = [];
|
|
1973
1979
|
|
|
1974
1980
|
for (const compiledIx of compiledInstructions) {
|
|
@@ -2014,35 +2020,23 @@ class TransactionMessage {
|
|
|
2014
2020
|
}
|
|
2015
2021
|
|
|
2016
2022
|
return new TransactionMessage({
|
|
2017
|
-
|
|
2023
|
+
payerKey,
|
|
2018
2024
|
instructions,
|
|
2019
2025
|
recentBlockhash
|
|
2020
2026
|
});
|
|
2021
2027
|
}
|
|
2022
2028
|
|
|
2023
2029
|
compileToLegacyMessage() {
|
|
2024
|
-
const payerKey = this.accountKeys.get(0);
|
|
2025
|
-
|
|
2026
|
-
if (payerKey === undefined) {
|
|
2027
|
-
throw new Error('Failed to compile message because no account keys were found');
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
2030
|
return Message.compile({
|
|
2031
|
-
payerKey,
|
|
2031
|
+
payerKey: this.payerKey,
|
|
2032
2032
|
recentBlockhash: this.recentBlockhash,
|
|
2033
2033
|
instructions: this.instructions
|
|
2034
2034
|
});
|
|
2035
2035
|
}
|
|
2036
2036
|
|
|
2037
2037
|
compileToV0Message(addressLookupTableAccounts) {
|
|
2038
|
-
const payerKey = this.accountKeys.get(0);
|
|
2039
|
-
|
|
2040
|
-
if (payerKey === undefined) {
|
|
2041
|
-
throw new Error('Failed to compile message because no account keys were found');
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
2038
|
return MessageV0.compile({
|
|
2045
|
-
payerKey,
|
|
2039
|
+
payerKey: this.payerKey,
|
|
2046
2040
|
recentBlockhash: this.recentBlockhash,
|
|
2047
2041
|
instructions: this.instructions,
|
|
2048
2042
|
addressLookupTableAccounts
|
|
@@ -2055,6 +2049,10 @@ class TransactionMessage {
|
|
|
2055
2049
|
* Versioned transaction class
|
|
2056
2050
|
*/
|
|
2057
2051
|
class VersionedTransaction {
|
|
2052
|
+
get version() {
|
|
2053
|
+
return this.message.version;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2058
2056
|
constructor(message, signatures) {
|
|
2059
2057
|
this.signatures = void 0;
|
|
2060
2058
|
this.message = void 0;
|
|
@@ -4338,7 +4336,8 @@ const ParsedConfirmedTransactionResult = type({
|
|
|
4338
4336
|
accountKeys: array(type({
|
|
4339
4337
|
pubkey: PublicKeyFromString,
|
|
4340
4338
|
signer: boolean(),
|
|
4341
|
-
writable: boolean()
|
|
4339
|
+
writable: boolean(),
|
|
4340
|
+
source: optional(union([literal('transaction'), literal('lookupTable')]))
|
|
4342
4341
|
})),
|
|
4343
4342
|
instructions: array(ParsedOrRawInstruction),
|
|
4344
4343
|
recentBlockhash: string(),
|
|
@@ -6566,7 +6565,7 @@ class Connection {
|
|
|
6566
6565
|
*/
|
|
6567
6566
|
// eslint-disable-next-line no-dupe-class-members
|
|
6568
6567
|
async sendTransaction(transaction, signersOrOptions, options) {
|
|
6569
|
-
if ('
|
|
6568
|
+
if ('version' in transaction) {
|
|
6570
6569
|
if (signersOrOptions && Array.isArray(signersOrOptions)) {
|
|
6571
6570
|
throw new Error('Invalid arguments');
|
|
6572
6571
|
}
|
|
@@ -7514,7 +7513,7 @@ class Keypair {
|
|
|
7514
7513
|
|
|
7515
7514
|
|
|
7516
7515
|
get secretKey() {
|
|
7517
|
-
return this._keypair.secretKey;
|
|
7516
|
+
return new Uint8Array(this._keypair.secretKey);
|
|
7518
7517
|
}
|
|
7519
7518
|
|
|
7520
7519
|
}
|
|
@@ -7929,6 +7928,9 @@ class ComputeBudgetProgram {
|
|
|
7929
7928
|
*/
|
|
7930
7929
|
|
|
7931
7930
|
|
|
7931
|
+
/**
|
|
7932
|
+
* @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
|
|
7933
|
+
*/
|
|
7932
7934
|
static requestUnits(params) {
|
|
7933
7935
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
|
|
7934
7936
|
const data = encodeData(type, params);
|