@solana/web3.js 1.47.1 → 1.47.4
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 +4 -11
- package/lib/index.browser.cjs.js +44 -22
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +44 -22
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +44 -22
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.esm.js +44 -22
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +44 -22
- 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 +10031 -0
- package/lib/index.native.js.map +1 -0
- package/package.json +3 -1
- package/src/__forks__/react-native/fetch-impl.ts +4 -0
- package/src/connection.ts +27 -13
- package/src/transaction.ts +18 -10
- package/src/util/__forks__/react-native/url-impl.ts +2 -0
- package/src/util/{url.ts → makeWebsocketUrl.ts} +2 -0
- package/src/util/url-impl.ts +2 -0
package/README.md
CHANGED
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
This is the Solana Javascript API built on the Solana [JSON RPC API](https://docs.solana.com/apps/jsonrpc-api)
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Documentation and examples
|
|
27
|
+
|
|
28
|
+
- [The Solana Cookbook](https://solanacookbook.com/) has extensive task-based documentation using this library.
|
|
29
|
+
- For more detail on individual functions, see the [latest API Documentation](https://solana-labs.github.io/solana-web3.js/)
|
|
27
30
|
|
|
28
31
|
## Installation
|
|
29
32
|
|
|
@@ -84,16 +87,6 @@ console.log(solanaWeb3);
|
|
|
84
87
|
console.log(solanaWeb3);
|
|
85
88
|
```
|
|
86
89
|
|
|
87
|
-
## Examples
|
|
88
|
-
|
|
89
|
-
Example scripts for the web3.js repo and native programs:
|
|
90
|
-
|
|
91
|
-
- [Web3 Examples](https://github.com/solana-labs/solana/tree/master/web3.js/examples)
|
|
92
|
-
|
|
93
|
-
Example scripts for the Solana Program Library:
|
|
94
|
-
|
|
95
|
-
- [Token Program Examples](https://github.com/solana-labs/solana-program-library/tree/master/token/js/examples)
|
|
96
|
-
|
|
97
90
|
## Flow Support (Discontinued)
|
|
98
91
|
|
|
99
92
|
Flow types are no longer supported in new releases. The last release with Flow support is v1.37.2 and its
|
package/lib/index.browser.cjs.js
CHANGED
|
@@ -2478,15 +2478,34 @@ class Transaction {
|
|
|
2478
2478
|
|
|
2479
2479
|
if (!opts) {
|
|
2480
2480
|
return;
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
this.
|
|
2485
|
-
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
if (opts.feePayer) {
|
|
2484
|
+
this.feePayer = opts.feePayer;
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
if (opts.signatures) {
|
|
2488
|
+
this.signatures = opts.signatures;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
|
|
2492
|
+
const {
|
|
2493
|
+
blockhash,
|
|
2494
|
+
lastValidBlockHeight
|
|
2495
|
+
} = opts;
|
|
2496
|
+
this.recentBlockhash = blockhash;
|
|
2497
|
+
this.lastValidBlockHeight = lastValidBlockHeight;
|
|
2486
2498
|
} else {
|
|
2487
|
-
const
|
|
2488
|
-
|
|
2489
|
-
|
|
2499
|
+
const {
|
|
2500
|
+
recentBlockhash,
|
|
2501
|
+
nonceInfo
|
|
2502
|
+
} = opts;
|
|
2503
|
+
|
|
2504
|
+
if (nonceInfo) {
|
|
2505
|
+
this.nonceInfo = nonceInfo;
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
this.recentBlockhash = recentBlockhash;
|
|
2490
2509
|
}
|
|
2491
2510
|
}
|
|
2492
2511
|
/**
|
|
@@ -4429,6 +4448,8 @@ var fastStableStringify = function(val) {
|
|
|
4429
4448
|
|
|
4430
4449
|
var fastStableStringify$1 = fastStableStringify;
|
|
4431
4450
|
|
|
4451
|
+
const URL = globalThis.URL;
|
|
4452
|
+
|
|
4432
4453
|
const MINIMUM_SLOT_PER_EPOCH = 32; // Returns the number of trailing zeros in the binary representation of self.
|
|
4433
4454
|
|
|
4434
4455
|
function trailingZeros(n) {
|
|
@@ -4826,7 +4847,11 @@ const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(superstruct.t
|
|
|
4826
4847
|
data: superstruct.array(superstruct.string()),
|
|
4827
4848
|
rentEpoch: superstruct.optional(superstruct.number())
|
|
4828
4849
|
}))))),
|
|
4829
|
-
unitsConsumed: superstruct.optional(superstruct.number())
|
|
4850
|
+
unitsConsumed: superstruct.optional(superstruct.number()),
|
|
4851
|
+
returnData: superstruct.optional(superstruct.nullable(superstruct.type({
|
|
4852
|
+
programId: superstruct.string(),
|
|
4853
|
+
data: superstruct.tuple([superstruct.string(), superstruct.literal('base64')])
|
|
4854
|
+
})))
|
|
4830
4855
|
}));
|
|
4831
4856
|
|
|
4832
4857
|
/**
|
|
@@ -6163,16 +6188,6 @@ class Connection {
|
|
|
6163
6188
|
reject(err);
|
|
6164
6189
|
}
|
|
6165
6190
|
});
|
|
6166
|
-
|
|
6167
|
-
const checkBlockHeight = async () => {
|
|
6168
|
-
try {
|
|
6169
|
-
const blockHeight = await this.getBlockHeight(commitment);
|
|
6170
|
-
return blockHeight;
|
|
6171
|
-
} catch (_e) {
|
|
6172
|
-
return -1;
|
|
6173
|
-
}
|
|
6174
|
-
};
|
|
6175
|
-
|
|
6176
6191
|
const expiryPromise = new Promise(resolve => {
|
|
6177
6192
|
if (typeof strategy === 'string') {
|
|
6178
6193
|
let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
|
|
@@ -6196,6 +6211,15 @@ class Connection {
|
|
|
6196
6211
|
} else {
|
|
6197
6212
|
let config = strategy;
|
|
6198
6213
|
|
|
6214
|
+
const checkBlockHeight = async () => {
|
|
6215
|
+
try {
|
|
6216
|
+
const blockHeight = await this.getBlockHeight(commitment);
|
|
6217
|
+
return blockHeight;
|
|
6218
|
+
} catch (_e) {
|
|
6219
|
+
return -1;
|
|
6220
|
+
}
|
|
6221
|
+
};
|
|
6222
|
+
|
|
6199
6223
|
(async () => {
|
|
6200
6224
|
let currentBlockHeight = await checkBlockHeight();
|
|
6201
6225
|
if (done) return;
|
|
@@ -6559,9 +6583,7 @@ class Connection {
|
|
|
6559
6583
|
|
|
6560
6584
|
|
|
6561
6585
|
async getRecentPerformanceSamples(limit) {
|
|
6562
|
-
const
|
|
6563
|
-
|
|
6564
|
-
const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
|
|
6586
|
+
const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
|
|
6565
6587
|
const res = superstruct.create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
|
|
6566
6588
|
|
|
6567
6589
|
if ('error' in res) {
|