@solana/web3.js 1.44.1 → 1.45.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 +34 -19
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +34 -19
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +34 -19
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.esm.js +34 -19
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +34 -19
- 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 +3 -3
- package/src/connection.ts +24 -4
- package/src/transaction.ts +19 -12
package/lib/index.browser.esm.js
CHANGED
|
@@ -2510,24 +2510,27 @@ class Transaction {
|
|
|
2510
2510
|
return this._message;
|
|
2511
2511
|
}
|
|
2512
2512
|
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
} = this;
|
|
2513
|
+
let recentBlockhash;
|
|
2514
|
+
let instructions;
|
|
2516
2515
|
|
|
2517
|
-
if (
|
|
2518
|
-
|
|
2519
|
-
this.instructions.unshift(nonceInfo.nonceInstruction);
|
|
2520
|
-
}
|
|
2516
|
+
if (this.nonceInfo) {
|
|
2517
|
+
recentBlockhash = this.nonceInfo.nonce;
|
|
2521
2518
|
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2519
|
+
if (this.instructions[0] != this.nonceInfo.nonceInstruction) {
|
|
2520
|
+
instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];
|
|
2521
|
+
} else {
|
|
2522
|
+
instructions = this.instructions;
|
|
2523
|
+
}
|
|
2524
|
+
} else {
|
|
2525
|
+
recentBlockhash = this.recentBlockhash;
|
|
2526
|
+
instructions = this.instructions;
|
|
2527
|
+
}
|
|
2525
2528
|
|
|
2526
2529
|
if (!recentBlockhash) {
|
|
2527
2530
|
throw new Error('Transaction recentBlockhash required');
|
|
2528
2531
|
}
|
|
2529
2532
|
|
|
2530
|
-
if (
|
|
2533
|
+
if (instructions.length < 1) {
|
|
2531
2534
|
console.warn('No instructions provided');
|
|
2532
2535
|
}
|
|
2533
2536
|
|
|
@@ -2542,15 +2545,15 @@ class Transaction {
|
|
|
2542
2545
|
throw new Error('Transaction fee payer required');
|
|
2543
2546
|
}
|
|
2544
2547
|
|
|
2545
|
-
for (let i = 0; i <
|
|
2546
|
-
if (
|
|
2548
|
+
for (let i = 0; i < instructions.length; i++) {
|
|
2549
|
+
if (instructions[i].programId === undefined) {
|
|
2547
2550
|
throw new Error(`Transaction instruction index ${i} has undefined program id`);
|
|
2548
2551
|
}
|
|
2549
2552
|
}
|
|
2550
2553
|
|
|
2551
2554
|
const programIds = [];
|
|
2552
2555
|
const accountMetas = [];
|
|
2553
|
-
|
|
2556
|
+
instructions.forEach(instruction => {
|
|
2554
2557
|
instruction.keys.forEach(accountMeta => {
|
|
2555
2558
|
accountMetas.push({ ...accountMeta
|
|
2556
2559
|
});
|
|
@@ -2660,7 +2663,7 @@ class Transaction {
|
|
|
2660
2663
|
}
|
|
2661
2664
|
});
|
|
2662
2665
|
const accountKeys = signedKeys.concat(unsignedKeys);
|
|
2663
|
-
const
|
|
2666
|
+
const compiledInstructions = instructions.map(instruction => {
|
|
2664
2667
|
const {
|
|
2665
2668
|
data,
|
|
2666
2669
|
programId
|
|
@@ -2671,7 +2674,7 @@ class Transaction {
|
|
|
2671
2674
|
data: bs58.encode(data)
|
|
2672
2675
|
};
|
|
2673
2676
|
});
|
|
2674
|
-
|
|
2677
|
+
compiledInstructions.forEach(instruction => {
|
|
2675
2678
|
assert(instruction.programIdIndex >= 0);
|
|
2676
2679
|
instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0));
|
|
2677
2680
|
});
|
|
@@ -2683,7 +2686,7 @@ class Transaction {
|
|
|
2683
2686
|
},
|
|
2684
2687
|
accountKeys,
|
|
2685
2688
|
recentBlockhash,
|
|
2686
|
-
instructions
|
|
2689
|
+
instructions: compiledInstructions
|
|
2687
2690
|
});
|
|
2688
2691
|
}
|
|
2689
2692
|
/**
|
|
@@ -4565,6 +4568,7 @@ function makeWebsocketUrl(endpoint) {
|
|
|
4565
4568
|
return url.toString();
|
|
4566
4569
|
}
|
|
4567
4570
|
|
|
4571
|
+
var _process$env$npm_pack;
|
|
4568
4572
|
const PublicKeyFromString = coerce(instance(PublicKey), string(), value => new PublicKey(value));
|
|
4569
4573
|
const RawAccountDataResult = tuple([string(), literal('base64')]);
|
|
4570
4574
|
const BufferFromRawAccountData = coerce(instance(Buffer), RawAccountDataResult, value => Buffer.from(value[0], 'base64'));
|
|
@@ -4775,7 +4779,7 @@ function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddlewar
|
|
|
4775
4779
|
agent,
|
|
4776
4780
|
headers: Object.assign({
|
|
4777
4781
|
'Content-Type': 'application/json'
|
|
4778
|
-
}, httpHeaders || {})
|
|
4782
|
+
}, httpHeaders || {}, COMMON_HTTP_HEADERS)
|
|
4779
4783
|
};
|
|
4780
4784
|
|
|
4781
4785
|
try {
|
|
@@ -5448,9 +5452,14 @@ const LogsNotificationResult = type({
|
|
|
5448
5452
|
* Filter for log subscriptions.
|
|
5449
5453
|
*/
|
|
5450
5454
|
|
|
5455
|
+
/** @internal */
|
|
5456
|
+
const COMMON_HTTP_HEADERS = {
|
|
5457
|
+
'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
5458
|
+
};
|
|
5451
5459
|
/**
|
|
5452
5460
|
* A connection to a fullnode JSON RPC endpoint
|
|
5453
5461
|
*/
|
|
5462
|
+
|
|
5454
5463
|
class Connection {
|
|
5455
5464
|
/** @internal */
|
|
5456
5465
|
|
|
@@ -6726,7 +6735,13 @@ class Connection {
|
|
|
6726
6735
|
throw new Error('failed to get transactions: ' + res.error.message);
|
|
6727
6736
|
}
|
|
6728
6737
|
|
|
6729
|
-
|
|
6738
|
+
const result = res.result;
|
|
6739
|
+
if (!result) return result;
|
|
6740
|
+
return { ...result,
|
|
6741
|
+
transaction: { ...result.transaction,
|
|
6742
|
+
message: new Message(result.transaction.message)
|
|
6743
|
+
}
|
|
6744
|
+
};
|
|
6730
6745
|
});
|
|
6731
6746
|
return res;
|
|
6732
6747
|
}
|