@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.cjs.js
CHANGED
|
@@ -2568,24 +2568,27 @@ class Transaction {
|
|
|
2568
2568
|
return this._message;
|
|
2569
2569
|
}
|
|
2570
2570
|
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
} = this;
|
|
2571
|
+
let recentBlockhash;
|
|
2572
|
+
let instructions;
|
|
2574
2573
|
|
|
2575
|
-
if (
|
|
2576
|
-
|
|
2577
|
-
this.instructions.unshift(nonceInfo.nonceInstruction);
|
|
2578
|
-
}
|
|
2574
|
+
if (this.nonceInfo) {
|
|
2575
|
+
recentBlockhash = this.nonceInfo.nonce;
|
|
2579
2576
|
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2577
|
+
if (this.instructions[0] != this.nonceInfo.nonceInstruction) {
|
|
2578
|
+
instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];
|
|
2579
|
+
} else {
|
|
2580
|
+
instructions = this.instructions;
|
|
2581
|
+
}
|
|
2582
|
+
} else {
|
|
2583
|
+
recentBlockhash = this.recentBlockhash;
|
|
2584
|
+
instructions = this.instructions;
|
|
2585
|
+
}
|
|
2583
2586
|
|
|
2584
2587
|
if (!recentBlockhash) {
|
|
2585
2588
|
throw new Error('Transaction recentBlockhash required');
|
|
2586
2589
|
}
|
|
2587
2590
|
|
|
2588
|
-
if (
|
|
2591
|
+
if (instructions.length < 1) {
|
|
2589
2592
|
console.warn('No instructions provided');
|
|
2590
2593
|
}
|
|
2591
2594
|
|
|
@@ -2600,15 +2603,15 @@ class Transaction {
|
|
|
2600
2603
|
throw new Error('Transaction fee payer required');
|
|
2601
2604
|
}
|
|
2602
2605
|
|
|
2603
|
-
for (let i = 0; i <
|
|
2604
|
-
if (
|
|
2606
|
+
for (let i = 0; i < instructions.length; i++) {
|
|
2607
|
+
if (instructions[i].programId === undefined) {
|
|
2605
2608
|
throw new Error(`Transaction instruction index ${i} has undefined program id`);
|
|
2606
2609
|
}
|
|
2607
2610
|
}
|
|
2608
2611
|
|
|
2609
2612
|
const programIds = [];
|
|
2610
2613
|
const accountMetas = [];
|
|
2611
|
-
|
|
2614
|
+
instructions.forEach(instruction => {
|
|
2612
2615
|
instruction.keys.forEach(accountMeta => {
|
|
2613
2616
|
accountMetas.push({ ...accountMeta
|
|
2614
2617
|
});
|
|
@@ -2718,7 +2721,7 @@ class Transaction {
|
|
|
2718
2721
|
}
|
|
2719
2722
|
});
|
|
2720
2723
|
const accountKeys = signedKeys.concat(unsignedKeys);
|
|
2721
|
-
const
|
|
2724
|
+
const compiledInstructions = instructions.map(instruction => {
|
|
2722
2725
|
const {
|
|
2723
2726
|
data,
|
|
2724
2727
|
programId
|
|
@@ -2729,7 +2732,7 @@ class Transaction {
|
|
|
2729
2732
|
data: bs58__default["default"].encode(data)
|
|
2730
2733
|
};
|
|
2731
2734
|
});
|
|
2732
|
-
|
|
2735
|
+
compiledInstructions.forEach(instruction => {
|
|
2733
2736
|
assert(instruction.programIdIndex >= 0);
|
|
2734
2737
|
instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0));
|
|
2735
2738
|
});
|
|
@@ -2741,7 +2744,7 @@ class Transaction {
|
|
|
2741
2744
|
},
|
|
2742
2745
|
accountKeys,
|
|
2743
2746
|
recentBlockhash,
|
|
2744
|
-
instructions
|
|
2747
|
+
instructions: compiledInstructions
|
|
2745
2748
|
});
|
|
2746
2749
|
}
|
|
2747
2750
|
/**
|
|
@@ -4675,6 +4678,7 @@ function makeWebsocketUrl(endpoint) {
|
|
|
4675
4678
|
return url.toString();
|
|
4676
4679
|
}
|
|
4677
4680
|
|
|
4681
|
+
var _process$env$npm_pack;
|
|
4678
4682
|
const PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey), superstruct.string(), value => new PublicKey(value));
|
|
4679
4683
|
const RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal('base64')]);
|
|
4680
4684
|
const BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, value => buffer.Buffer.from(value[0], 'base64'));
|
|
@@ -4890,7 +4894,7 @@ function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddlewar
|
|
|
4890
4894
|
agent,
|
|
4891
4895
|
headers: Object.assign({
|
|
4892
4896
|
'Content-Type': 'application/json'
|
|
4893
|
-
}, httpHeaders || {})
|
|
4897
|
+
}, httpHeaders || {}, COMMON_HTTP_HEADERS)
|
|
4894
4898
|
};
|
|
4895
4899
|
|
|
4896
4900
|
try {
|
|
@@ -5564,9 +5568,14 @@ const LogsNotificationResult = superstruct.type({
|
|
|
5564
5568
|
* Filter for log subscriptions.
|
|
5565
5569
|
*/
|
|
5566
5570
|
|
|
5571
|
+
/** @internal */
|
|
5572
|
+
const COMMON_HTTP_HEADERS = {
|
|
5573
|
+
'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
5574
|
+
};
|
|
5567
5575
|
/**
|
|
5568
5576
|
* A connection to a fullnode JSON RPC endpoint
|
|
5569
5577
|
*/
|
|
5578
|
+
|
|
5570
5579
|
class Connection {
|
|
5571
5580
|
/** @internal */
|
|
5572
5581
|
|
|
@@ -6842,7 +6851,13 @@ class Connection {
|
|
|
6842
6851
|
throw new Error('failed to get transactions: ' + res.error.message);
|
|
6843
6852
|
}
|
|
6844
6853
|
|
|
6845
|
-
|
|
6854
|
+
const result = res.result;
|
|
6855
|
+
if (!result) return result;
|
|
6856
|
+
return { ...result,
|
|
6857
|
+
transaction: { ...result.transaction,
|
|
6858
|
+
message: new Message(result.transaction.message)
|
|
6859
|
+
}
|
|
6860
|
+
};
|
|
6846
6861
|
});
|
|
6847
6862
|
return res;
|
|
6848
6863
|
}
|