@solana/web3.js 1.93.1 → 1.93.3
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 +25 -8
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +25 -8
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +25 -8
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +115 -83
- package/lib/index.esm.js +25 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +25 -8
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +25 -8
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/__forks__/browser/fetch-impl.ts +3 -3
- package/src/__forks__/react-native/fetch-impl.ts +3 -3
- package/src/connection.ts +74 -6
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const Headers = globalThis.Headers;
|
|
2
|
-
export const Request = globalThis.Request;
|
|
3
|
-
export const Response = globalThis.Response;
|
|
1
|
+
export const Headers: typeof globalThis.Headers = globalThis.Headers;
|
|
2
|
+
export const Request: typeof globalThis.Request = globalThis.Request;
|
|
3
|
+
export const Response: typeof globalThis.Response = globalThis.Response;
|
|
4
4
|
export default globalThis.fetch;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const Headers = globalThis.Headers;
|
|
2
|
-
export const Request = globalThis.Request;
|
|
3
|
-
export const Response = globalThis.Response;
|
|
1
|
+
export const Headers: typeof globalThis.Headers = globalThis.Headers;
|
|
2
|
+
export const Request: typeof globalThis.Request = globalThis.Request;
|
|
3
|
+
export const Response: typeof globalThis.Response = globalThis.Response;
|
|
4
4
|
export default globalThis.fetch;
|
package/src/connection.ts
CHANGED
|
@@ -270,7 +270,7 @@ export type ConfirmOptions = {
|
|
|
270
270
|
export type ConfirmedSignaturesForAddress2Options = {
|
|
271
271
|
/**
|
|
272
272
|
* Start searching backwards from this transaction signature.
|
|
273
|
-
* @
|
|
273
|
+
* @remarks If not provided the search starts from the highest max confirmed block.
|
|
274
274
|
*/
|
|
275
275
|
before?: TransactionSignature;
|
|
276
276
|
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
@@ -285,7 +285,7 @@ export type ConfirmedSignaturesForAddress2Options = {
|
|
|
285
285
|
export type SignaturesForAddressOptions = {
|
|
286
286
|
/**
|
|
287
287
|
* Start searching backwards from this transaction signature.
|
|
288
|
-
* @
|
|
288
|
+
* @remarks If not provided the search starts from the highest max confirmed block.
|
|
289
289
|
*/
|
|
290
290
|
before?: TransactionSignature;
|
|
291
291
|
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
@@ -2787,6 +2787,39 @@ export type GetNonceAndContextConfig = {
|
|
|
2787
2787
|
minContextSlot?: number;
|
|
2788
2788
|
};
|
|
2789
2789
|
|
|
2790
|
+
export type AccountSubscriptionConfig = Readonly<{
|
|
2791
|
+
/** Optional commitment level */
|
|
2792
|
+
commitment?: Commitment;
|
|
2793
|
+
/**
|
|
2794
|
+
* Encoding format for Account data
|
|
2795
|
+
* - `base58` is slow.
|
|
2796
|
+
* - `jsonParsed` encoding attempts to use program-specific state parsers to return more
|
|
2797
|
+
* human-readable and explicit account state data
|
|
2798
|
+
* - If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64`
|
|
2799
|
+
* encoding, detectable when the `data` field is type `string`.
|
|
2800
|
+
*/
|
|
2801
|
+
encoding?: 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
|
|
2802
|
+
}>;
|
|
2803
|
+
|
|
2804
|
+
export type ProgramAccountSubscriptionConfig = Readonly<{
|
|
2805
|
+
/** Optional commitment level */
|
|
2806
|
+
commitment?: Commitment;
|
|
2807
|
+
/**
|
|
2808
|
+
* Encoding format for Account data
|
|
2809
|
+
* - `base58` is slow.
|
|
2810
|
+
* - `jsonParsed` encoding attempts to use program-specific state parsers to return more
|
|
2811
|
+
* human-readable and explicit account state data
|
|
2812
|
+
* - If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64`
|
|
2813
|
+
* encoding, detectable when the `data` field is type `string`.
|
|
2814
|
+
*/
|
|
2815
|
+
encoding?: 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
|
|
2816
|
+
/**
|
|
2817
|
+
* Filter results using various filter objects
|
|
2818
|
+
* The resultant account must meet ALL filter criteria to be included in the returned results
|
|
2819
|
+
*/
|
|
2820
|
+
filters?: GetProgramAccountsFilter[];
|
|
2821
|
+
}>;
|
|
2822
|
+
|
|
2790
2823
|
/**
|
|
2791
2824
|
* Information describing an account
|
|
2792
2825
|
*/
|
|
@@ -6334,18 +6367,34 @@ export class Connection {
|
|
|
6334
6367
|
*
|
|
6335
6368
|
* @param publicKey Public key of the account to monitor
|
|
6336
6369
|
* @param callback Function to invoke whenever the account is changed
|
|
6337
|
-
* @param
|
|
6370
|
+
* @param config
|
|
6338
6371
|
* @return subscription id
|
|
6339
6372
|
*/
|
|
6373
|
+
onAccountChange(
|
|
6374
|
+
publicKey: PublicKey,
|
|
6375
|
+
callback: AccountChangeCallback,
|
|
6376
|
+
config?: AccountSubscriptionConfig,
|
|
6377
|
+
): ClientSubscriptionId;
|
|
6378
|
+
/** @deprecated Instead, pass in an {@link AccountSubscriptionConfig} */
|
|
6379
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6340
6380
|
onAccountChange(
|
|
6341
6381
|
publicKey: PublicKey,
|
|
6342
6382
|
callback: AccountChangeCallback,
|
|
6343
6383
|
commitment?: Commitment,
|
|
6384
|
+
): ClientSubscriptionId;
|
|
6385
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6386
|
+
onAccountChange(
|
|
6387
|
+
publicKey: PublicKey,
|
|
6388
|
+
callback: AccountChangeCallback,
|
|
6389
|
+
commitmentOrConfig?: Commitment | AccountSubscriptionConfig,
|
|
6344
6390
|
): ClientSubscriptionId {
|
|
6391
|
+
const {commitment, config} =
|
|
6392
|
+
extractCommitmentFromConfig(commitmentOrConfig);
|
|
6345
6393
|
const args = this._buildArgs(
|
|
6346
6394
|
[publicKey.toBase58()],
|
|
6347
6395
|
commitment || this._commitment || 'finalized', // Apply connection/server default.
|
|
6348
6396
|
'base64',
|
|
6397
|
+
config,
|
|
6349
6398
|
);
|
|
6350
6399
|
return this._makeSubscription(
|
|
6351
6400
|
{
|
|
@@ -6394,21 +6443,40 @@ export class Connection {
|
|
|
6394
6443
|
*
|
|
6395
6444
|
* @param programId Public key of the program to monitor
|
|
6396
6445
|
* @param callback Function to invoke whenever the account is changed
|
|
6397
|
-
* @param
|
|
6398
|
-
* @param filters The program account filters to pass into the RPC method
|
|
6446
|
+
* @param config
|
|
6399
6447
|
* @return subscription id
|
|
6400
6448
|
*/
|
|
6449
|
+
onProgramAccountChange(
|
|
6450
|
+
programId: PublicKey,
|
|
6451
|
+
callback: ProgramAccountChangeCallback,
|
|
6452
|
+
config?: ProgramAccountSubscriptionConfig,
|
|
6453
|
+
): ClientSubscriptionId;
|
|
6454
|
+
/** @deprecated Instead, pass in a {@link ProgramAccountSubscriptionConfig} */
|
|
6455
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6401
6456
|
onProgramAccountChange(
|
|
6402
6457
|
programId: PublicKey,
|
|
6403
6458
|
callback: ProgramAccountChangeCallback,
|
|
6404
6459
|
commitment?: Commitment,
|
|
6405
6460
|
filters?: GetProgramAccountsFilter[],
|
|
6461
|
+
): ClientSubscriptionId;
|
|
6462
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6463
|
+
onProgramAccountChange(
|
|
6464
|
+
programId: PublicKey,
|
|
6465
|
+
callback: ProgramAccountChangeCallback,
|
|
6466
|
+
commitmentOrConfig?: Commitment | ProgramAccountSubscriptionConfig,
|
|
6467
|
+
maybeFilters?: GetProgramAccountsFilter[],
|
|
6406
6468
|
): ClientSubscriptionId {
|
|
6469
|
+
const {commitment, config} =
|
|
6470
|
+
extractCommitmentFromConfig(commitmentOrConfig);
|
|
6407
6471
|
const args = this._buildArgs(
|
|
6408
6472
|
[programId.toBase58()],
|
|
6409
6473
|
commitment || this._commitment || 'finalized', // Apply connection/server default.
|
|
6410
6474
|
'base64' /* encoding */,
|
|
6411
|
-
|
|
6475
|
+
config
|
|
6476
|
+
? config
|
|
6477
|
+
: maybeFilters
|
|
6478
|
+
? {filters: maybeFilters}
|
|
6479
|
+
: undefined /* extra */,
|
|
6412
6480
|
);
|
|
6413
6481
|
return this._makeSubscription(
|
|
6414
6482
|
{
|