@solana/web3.js 1.68.1 → 1.70.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 +0 -13
- package/lib/index.browser.cjs.js +47 -9
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +47 -9
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +66 -14
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +247 -234
- package/lib/index.esm.js +65 -13
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +47 -9
- 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 +47 -9
- package/lib/index.native.js.map +1 -1
- package/package.json +6 -5
- package/src/connection.ts +120 -31
- package/src/epoch-schedule.ts +1 -1
- package/src/utils/send-and-confirm-transaction.ts +14 -1
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,9 +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;
|
|
17516
17519
|
|
|
17520
|
+
{
|
|
17521
|
+
if (httpAgent != null) {
|
|
17522
|
+
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.');
|
|
17523
|
+
}
|
|
17524
|
+
}
|
|
17525
|
+
|
|
17517
17526
|
let fetchWithMiddleware;
|
|
17518
17527
|
|
|
17519
17528
|
if (fetchMiddleware) {
|
|
@@ -18420,6 +18429,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18420
18429
|
let fetch;
|
|
18421
18430
|
let fetchMiddleware;
|
|
18422
18431
|
let disableRetryOnRateLimit;
|
|
18432
|
+
let httpAgent;
|
|
18423
18433
|
|
|
18424
18434
|
if (commitmentOrConfig && typeof commitmentOrConfig === 'string') {
|
|
18425
18435
|
this._commitment = commitmentOrConfig;
|
|
@@ -18431,11 +18441,12 @@ var solanaWeb3 = (function (exports) {
|
|
|
18431
18441
|
fetch = commitmentOrConfig.fetch;
|
|
18432
18442
|
fetchMiddleware = commitmentOrConfig.fetchMiddleware;
|
|
18433
18443
|
disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
|
|
18444
|
+
httpAgent = commitmentOrConfig.httpAgent;
|
|
18434
18445
|
}
|
|
18435
18446
|
|
|
18436
18447
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
18437
18448
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
18438
|
-
this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit);
|
|
18449
|
+
this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent);
|
|
18439
18450
|
this._rpcRequest = createRpcRequest(this._rpcClient);
|
|
18440
18451
|
this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);
|
|
18441
18452
|
this._rpcWebSocket = new Client_1(this._rpcWsEndpoint, {
|
|
@@ -18926,7 +18937,14 @@ var solanaWeb3 = (function (exports) {
|
|
|
18926
18937
|
if (typeof strategy == 'string') {
|
|
18927
18938
|
rawSignature = strategy;
|
|
18928
18939
|
} else {
|
|
18940
|
+
var _config$abortSignal;
|
|
18941
|
+
|
|
18929
18942
|
const config = strategy;
|
|
18943
|
+
|
|
18944
|
+
if ((_config$abortSignal = config.abortSignal) !== null && _config$abortSignal !== void 0 && _config$abortSignal.aborted) {
|
|
18945
|
+
return Promise.reject(config.abortSignal.reason);
|
|
18946
|
+
}
|
|
18947
|
+
|
|
18930
18948
|
rawSignature = config.signature;
|
|
18931
18949
|
}
|
|
18932
18950
|
|
|
@@ -18958,6 +18976,22 @@ var solanaWeb3 = (function (exports) {
|
|
|
18958
18976
|
}
|
|
18959
18977
|
}
|
|
18960
18978
|
|
|
18979
|
+
getCancellationPromise(signal) {
|
|
18980
|
+
return new Promise((_, reject) => {
|
|
18981
|
+
if (signal == null) {
|
|
18982
|
+
return;
|
|
18983
|
+
}
|
|
18984
|
+
|
|
18985
|
+
if (signal.aborted) {
|
|
18986
|
+
reject(signal.reason);
|
|
18987
|
+
} else {
|
|
18988
|
+
signal.addEventListener('abort', () => {
|
|
18989
|
+
reject(signal.reason);
|
|
18990
|
+
});
|
|
18991
|
+
}
|
|
18992
|
+
});
|
|
18993
|
+
}
|
|
18994
|
+
|
|
18961
18995
|
getTransactionConfirmationPromise({
|
|
18962
18996
|
commitment,
|
|
18963
18997
|
signature
|
|
@@ -19076,6 +19110,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19076
19110
|
async confirmTransactionUsingBlockHeightExceedanceStrategy({
|
|
19077
19111
|
commitment,
|
|
19078
19112
|
strategy: {
|
|
19113
|
+
abortSignal,
|
|
19079
19114
|
lastValidBlockHeight,
|
|
19080
19115
|
signature
|
|
19081
19116
|
}
|
|
@@ -19114,10 +19149,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
19114
19149
|
commitment,
|
|
19115
19150
|
signature
|
|
19116
19151
|
});
|
|
19152
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
19117
19153
|
let result;
|
|
19118
19154
|
|
|
19119
19155
|
try {
|
|
19120
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
19156
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
19121
19157
|
|
|
19122
19158
|
if (outcome.__type === exports.TransactionStatus.PROCESSED) {
|
|
19123
19159
|
result = outcome.response;
|
|
@@ -19135,6 +19171,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19135
19171
|
async confirmTransactionUsingDurableNonceStrategy({
|
|
19136
19172
|
commitment,
|
|
19137
19173
|
strategy: {
|
|
19174
|
+
abortSignal,
|
|
19138
19175
|
minContextSlot,
|
|
19139
19176
|
nonceAccountPubkey,
|
|
19140
19177
|
nonceValue,
|
|
@@ -19192,10 +19229,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
19192
19229
|
commitment,
|
|
19193
19230
|
signature
|
|
19194
19231
|
});
|
|
19232
|
+
const cancellationPromise = this.getCancellationPromise(abortSignal);
|
|
19195
19233
|
let result;
|
|
19196
19234
|
|
|
19197
19235
|
try {
|
|
19198
|
-
const outcome = await Promise.race([confirmationPromise, expiryPromise]);
|
|
19236
|
+
const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
|
|
19199
19237
|
|
|
19200
19238
|
if (outcome.__type === exports.TransactionStatus.PROCESSED) {
|
|
19201
19239
|
result = outcome.response;
|