@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.browser.esm.js
CHANGED
|
@@ -1942,10 +1942,10 @@ class Transaction {
|
|
|
1942
1942
|
|
|
1943
1943
|
class TransactionMessage {
|
|
1944
1944
|
constructor(args) {
|
|
1945
|
-
this.
|
|
1945
|
+
this.payerKey = void 0;
|
|
1946
1946
|
this.instructions = void 0;
|
|
1947
1947
|
this.recentBlockhash = void 0;
|
|
1948
|
-
this.
|
|
1948
|
+
this.payerKey = args.payerKey;
|
|
1949
1949
|
this.instructions = args.instructions;
|
|
1950
1950
|
this.recentBlockhash = args.recentBlockhash;
|
|
1951
1951
|
}
|
|
@@ -1966,6 +1966,12 @@ class TransactionMessage {
|
|
|
1966
1966
|
const numWritableUnsignedAccounts = message.staticAccountKeys.length - numReadonlyUnsignedAccounts;
|
|
1967
1967
|
assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');
|
|
1968
1968
|
const accountKeys = message.getAccountKeys(args);
|
|
1969
|
+
const payerKey = accountKeys.get(0);
|
|
1970
|
+
|
|
1971
|
+
if (payerKey === undefined) {
|
|
1972
|
+
throw new Error('Failed to decompile message because no account keys were found');
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1969
1975
|
const instructions = [];
|
|
1970
1976
|
|
|
1971
1977
|
for (const compiledIx of compiledInstructions) {
|
|
@@ -2011,35 +2017,23 @@ class TransactionMessage {
|
|
|
2011
2017
|
}
|
|
2012
2018
|
|
|
2013
2019
|
return new TransactionMessage({
|
|
2014
|
-
|
|
2020
|
+
payerKey,
|
|
2015
2021
|
instructions,
|
|
2016
2022
|
recentBlockhash
|
|
2017
2023
|
});
|
|
2018
2024
|
}
|
|
2019
2025
|
|
|
2020
2026
|
compileToLegacyMessage() {
|
|
2021
|
-
const payerKey = this.accountKeys.get(0);
|
|
2022
|
-
|
|
2023
|
-
if (payerKey === undefined) {
|
|
2024
|
-
throw new Error('Failed to compile message because no account keys were found');
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
2027
|
return Message.compile({
|
|
2028
|
-
payerKey,
|
|
2028
|
+
payerKey: this.payerKey,
|
|
2029
2029
|
recentBlockhash: this.recentBlockhash,
|
|
2030
2030
|
instructions: this.instructions
|
|
2031
2031
|
});
|
|
2032
2032
|
}
|
|
2033
2033
|
|
|
2034
2034
|
compileToV0Message(addressLookupTableAccounts) {
|
|
2035
|
-
const payerKey = this.accountKeys.get(0);
|
|
2036
|
-
|
|
2037
|
-
if (payerKey === undefined) {
|
|
2038
|
-
throw new Error('Failed to compile message because no account keys were found');
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
2035
|
return MessageV0.compile({
|
|
2042
|
-
payerKey,
|
|
2036
|
+
payerKey: this.payerKey,
|
|
2043
2037
|
recentBlockhash: this.recentBlockhash,
|
|
2044
2038
|
instructions: this.instructions,
|
|
2045
2039
|
addressLookupTableAccounts
|
|
@@ -2052,6 +2046,10 @@ class TransactionMessage {
|
|
|
2052
2046
|
* Versioned transaction class
|
|
2053
2047
|
*/
|
|
2054
2048
|
class VersionedTransaction {
|
|
2049
|
+
get version() {
|
|
2050
|
+
return this.message.version;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2055
2053
|
constructor(message, signatures) {
|
|
2056
2054
|
this.signatures = void 0;
|
|
2057
2055
|
this.message = void 0;
|
|
@@ -4275,7 +4273,8 @@ const ParsedConfirmedTransactionResult = type({
|
|
|
4275
4273
|
accountKeys: array(type({
|
|
4276
4274
|
pubkey: PublicKeyFromString,
|
|
4277
4275
|
signer: boolean(),
|
|
4278
|
-
writable: boolean()
|
|
4276
|
+
writable: boolean(),
|
|
4277
|
+
source: optional(union([literal('transaction'), literal('lookupTable')]))
|
|
4279
4278
|
})),
|
|
4280
4279
|
instructions: array(ParsedOrRawInstruction),
|
|
4281
4280
|
recentBlockhash: string(),
|
|
@@ -6503,7 +6502,7 @@ class Connection {
|
|
|
6503
6502
|
*/
|
|
6504
6503
|
// eslint-disable-next-line no-dupe-class-members
|
|
6505
6504
|
async sendTransaction(transaction, signersOrOptions, options) {
|
|
6506
|
-
if ('
|
|
6505
|
+
if ('version' in transaction) {
|
|
6507
6506
|
if (signersOrOptions && Array.isArray(signersOrOptions)) {
|
|
6508
6507
|
throw new Error('Invalid arguments');
|
|
6509
6508
|
}
|
|
@@ -7451,7 +7450,7 @@ class Keypair {
|
|
|
7451
7450
|
|
|
7452
7451
|
|
|
7453
7452
|
get secretKey() {
|
|
7454
|
-
return this._keypair.secretKey;
|
|
7453
|
+
return new Uint8Array(this._keypair.secretKey);
|
|
7455
7454
|
}
|
|
7456
7455
|
|
|
7457
7456
|
}
|
|
@@ -7866,6 +7865,9 @@ class ComputeBudgetProgram {
|
|
|
7866
7865
|
*/
|
|
7867
7866
|
|
|
7868
7867
|
|
|
7868
|
+
/**
|
|
7869
|
+
* @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
|
|
7870
|
+
*/
|
|
7869
7871
|
static requestUnits(params) {
|
|
7870
7872
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
|
|
7871
7873
|
const data = encodeData(type, params);
|