@solana/web3.js 1.68.1 → 1.70.0-pr-29130
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 +0 -13
- package/lib/index.browser.cjs.js +48 -11
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +48 -11
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +2821 -221
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +247 -234
- package/lib/index.esm.js +2814 -219
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +48 -11
- 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 +48 -11
- package/lib/index.native.js.map +1 -1
- package/package.json +7 -5
- package/src/connection.ts +123 -35
- package/src/epoch-schedule.ts +1 -1
- package/src/utils/send-and-confirm-transaction.ts +14 -1
- package/src/agent-manager.ts +0 -44
package/lib/index.iife.js
CHANGED
|
@@ -12697,6 +12697,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
12697
12697
|
|
|
12698
12698
|
if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {
|
|
12699
12699
|
status = (await connection.confirmTransaction({
|
|
12700
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
12700
12701
|
signature: signature,
|
|
12701
12702
|
blockhash: transaction.recentBlockhash,
|
|
12702
12703
|
lastValidBlockHeight: transaction.lastValidBlockHeight
|
|
@@ -12707,12 +12708,17 @@ var solanaWeb3 = (function (exports) {
|
|
|
12707
12708
|
} = transaction.nonceInfo;
|
|
12708
12709
|
const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;
|
|
12709
12710
|
status = (await connection.confirmTransaction({
|
|
12711
|
+
abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
|
|
12710
12712
|
minContextSlot: transaction.minNonceContextSlot,
|
|
12711
12713
|
nonceAccountPubkey,
|
|
12712
12714
|
nonceValue: transaction.nonceInfo.nonce,
|
|
12713
12715
|
signature
|
|
12714
12716
|
}, options && options.commitment)).value;
|
|
12715
12717
|
} else {
|
|
12718
|
+
if ((options === null || options === void 0 ? void 0 : options.abortSignal) != null) {
|
|
12719
|
+
console.warn('sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was ' + 'supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` ' + 'or a combination of `nonceInfo` and `minNonceContextSlot` are abortable.');
|
|
12720
|
+
}
|
|
12721
|
+
|
|
12716
12722
|
status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
|
|
12717
12723
|
}
|
|
12718
12724
|
|
|
@@ -17041,7 +17047,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
17041
17047
|
/**
|
|
17042
17048
|
* Epoch schedule
|
|
17043
17049
|
* (see https://docs.solana.com/terminology#epoch)
|
|
17044
|
-
* Can be retrieved with the {@link
|
|
17050
|
+
* Can be retrieved with the {@link Connection.getEpochSchedule} method
|
|
17045
17051
|
*/
|
|
17046
17052
|
|
|
17047
17053
|
|
|
@@ -17313,13 +17319,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
17313
17319
|
};
|
|
17314
17320
|
}
|
|
17315
17321
|
/**
|
|
17316
|
-
*
|
|
17322
|
+
* @internal
|
|
17317
17323
|
*/
|
|
17318
17324
|
|
|
17319
17325
|
|
|
17320
|
-
/**
|
|
17321
|
-
* @internal
|
|
17322
|
-
*/
|
|
17323
17326
|
function createRpcResult(result) {
|
|
17324
17327
|
return union([type({
|
|
17325
17328
|
jsonrpc: literal('2.0'),
|
|
@@ -17511,8 +17514,15 @@ var solanaWeb3 = (function (exports) {
|
|
|
17511
17514
|
* A performance sample
|
|
17512
17515
|
*/
|
|
17513
17516
|
|
|
17514
|
-
function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
|
|
17517
|
+
function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent) {
|
|
17515
17518
|
const fetch = customFetch ? customFetch : fetchImpl;
|
|
17519
|
+
let agent;
|
|
17520
|
+
|
|
17521
|
+
{
|
|
17522
|
+
if (httpAgent != null) {
|
|
17523
|
+
console.warn('You have supplied an `httpAgent` when creating a `Connection` in a browser environment.' + 'It has been ignored; `httpAgent` is only used in Node environments.');
|
|
17524
|
+
}
|
|
17525
|
+
}
|
|
17516
17526
|
|
|
17517
17527
|
let fetchWithMiddleware;
|
|
17518
17528
|
|
|
@@ -17530,7 +17540,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
17530
17540
|
}
|
|
17531
17541
|
|
|
17532
17542
|
const clientBrowser = new RpcClient(async (request, callback) => {
|
|
17533
|
-
const agent = undefined;
|
|
17534
17543
|
const options = {
|
|
17535
17544
|
method: 'POST',
|
|
17536
17545
|
body: request,
|
|
@@ -17582,7 +17591,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
17582
17591
|
}
|
|
17583
17592
|
} catch (err) {
|
|
17584
17593
|
if (err instanceof Error) callback(err);
|
|
17585
|
-
} finally {
|
|
17586
17594
|
}
|
|
17587
17595
|
}, {});
|
|
17588
17596
|
return clientBrowser;
|
|
@@ -18420,6 +18428,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18420
18428
|
let fetch;
|
|
18421
18429
|
let fetchMiddleware;
|
|
18422
18430
|
let disableRetryOnRateLimit;
|
|
18431
|
+
let httpAgent;
|
|
18423
18432
|
|
|
18424
18433
|
if (commitmentOrConfig && typeof commitmentOrConfig === 'string') {
|
|
18425
18434
|
this._commitment = commitmentOrConfig;
|
|
@@ -18431,11 +18440,12 @@ var solanaWeb3 = (function (exports) {
|
|
|
18431
18440
|
fetch = commitmentOrConfig.fetch;
|
|
18432
18441
|
fetchMiddleware = commitmentOrConfig.fetchMiddleware;
|
|
18433
18442
|
disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
|
|
18443
|
+
httpAgent = commitmentOrConfig.httpAgent;
|
|
18434
18444
|
}
|
|
18435
18445
|
|
|
18436
18446
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
18437
18447
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
18438
|
-
this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit);
|
|
18448
|
+
this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent);
|
|
18439
18449
|
this._rpcRequest = createRpcRequest(this._rpcClient);
|
|
18440
18450
|
this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);
|
|
18441
18451
|
this._rpcWebSocket = new Client_1(this._rpcWsEndpoint, {
|
|
@@ -18926,7 +18936,14 @@ var solanaWeb3 = (function (exports) {
|
|
|
18926
18936
|
if (typeof strategy == 'string') {
|
|
18927
18937
|
rawSignature = strategy;
|
|
18928
18938
|
} else {
|
|
18939
|
+
var _config$abortSignal;
|
|
18940
|
+
|
|
18929
18941
|
const config = strategy;
|
|
18942
|
+
|
|
18943
|
+
if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
|
|
18944
|
+
return Promise.reject(config.abortSignal.reason);
|
|
18945
|
+
}
|
|
18946
|
+
|
|
18930
18947
|
rawSignature = config.signature;
|
|
18931
18948
|
}
|
|
18932
18949
|
|
|
@@ -18958,6 +18975,22 @@ var solanaWeb3 = (function (exports) {
|
|
|
18958
18975
|
}
|
|
18959
18976
|
}
|
|
18960
18977
|
|
|
18978
|
+
getCancellationPromise(signal) {
|
|
18979
|
+
return new Promise((_, reject) => {
|
|
18980
|
+
if (signal == null) {
|
|
18981
|
+
return;
|
|
18982
|
+
}
|
|
18983
|
+
|
|
18984
|
+
if (signal.aborted) {
|
|
18985
|
+
reject(signal.reason);
|
|
18986
|
+
} else {
|
|
18987
|
+
signal.addEventListener('abort', () => {
|
|
18988
|
+
reject(signal.reason);
|
|
18989
|
+
});
|
|
18990
|
+
}
|
|
18991
|
+
});
|
|
18992
|
+
}
|
|
18993
|
+
|
|
18961
18994
|
getTransactionConfirmationPromise({
|
|
18962
18995
|
commitment,
|
|
18963
18996
|
signature
|
|
@@ -19076,6 +19109,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19076
19109
|
async confirmTransactionUsingBlockHeightExceedanceStrategy({
|
|
19077
19110
|
commitment,
|
|
19078
19111
|
strategy: {
|
|
19112
|
+
abortSignal,
|
|
19079
19113
|
lastValidBlockHeight,
|
|
19080
19114
|
signature
|
|
19081
19115
|
}
|
|
@@ -19114,10 +19148,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
19114
19148
|
commitment,
|
|
19115
19149
|
signature
|
|
19116
19150
|
});
|
|
19151
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
19117
19152
|
let result;
|
|
19118
19153
|
|
|
19119
19154
|
try {
|
|
19120
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
19155
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
19121
19156
|
|
|
19122
19157
|
if (outcome.__type === exports.TransactionStatus.PROCESSED) {
|
|
19123
19158
|
result = outcome.response;
|
|
@@ -19135,6 +19170,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19135
19170
|
async confirmTransactionUsingDurableNonceStrategy({
|
|
19136
19171
|
commitment,
|
|
19137
19172
|
strategy: {
|
|
19173
|
+
abortSignal,
|
|
19138
19174
|
minContextSlot,
|
|
19139
19175
|
nonceAccountPubkey,
|
|
19140
19176
|
nonceValue,
|
|
@@ -19192,10 +19228,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
19192
19228
|
commitment,
|
|
19193
19229
|
signature
|
|
19194
19230
|
});
|
|
19231
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
19195
19232
|
let result;
|
|
19196
19233
|
|
|
19197
19234
|
try {
|
|
19198
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
19235
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
19199
19236
|
|
|
19200
19237
|
if (outcome.__type === exports.TransactionStatus.PROCESSED) {
|
|
19201
19238
|
result = outcome.response;
|