starknet 7.5.0 → 7.5.1
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +295 -191
- package/dist/index.global.js +432 -294
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +437 -300
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +434 -296
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as RPCSPEC07 from '@starknet-io/starknet-types-07';
|
|
|
2
2
|
import { STRUCT_EVENT, EVENT_FIELD, ENUM_EVENT, BlockHash, TransactionHash, StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision, StarknetWindowObject, Address, Permission, WatchAssetParameters as WatchAssetParameters$1, AddStarknetChainParameters as AddStarknetChainParameters$1, ChainId, AccountDeploymentData, AddInvokeTransactionParameters, AddInvokeTransactionResult, AddDeclareTransactionParameters, AddDeclareTransactionResult, Signature as Signature$2, SpecVersion, AccountChangeEventHandler as AccountChangeEventHandler$1, NetworkChangeEventHandler as NetworkChangeEventHandler$1 } from '@starknet-io/starknet-types-07';
|
|
3
3
|
export { StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision } from '@starknet-io/starknet-types-07';
|
|
4
4
|
import * as RPCSPEC08 from '@starknet-io/starknet-types-08';
|
|
5
|
-
import { PAYMASTER_API, EDataAvailabilityMode as EDataAvailabilityMode$1, SUBSCRIPTION_BLOCK_TAG, BLOCK_WITH_TX_HASHES, PENDING_BLOCK_WITH_TX_HASHES, BlockWithTxHashes as BlockWithTxHashes$1, TransactionReceipt as TransactionReceipt$1, IsSucceeded, IsReverted, IsType, OutsideExecutionTypedData, ETransactionVersion as ETransactionVersion$1, ETransactionVersion2 as ETransactionVersion2$1, ETransactionVersion3 as ETransactionVersion3$1,
|
|
5
|
+
import { PAYMASTER_API, EDataAvailabilityMode as EDataAvailabilityMode$1, SUBSCRIPTION_BLOCK_TAG, BLOCK_WITH_TX_HASHES, PENDING_BLOCK_WITH_TX_HASHES, BlockWithTxHashes as BlockWithTxHashes$1, TransactionReceipt as TransactionReceipt$1, IsSucceeded, IsReverted, IsType, OutsideExecutionTypedData, ETransactionVersion as ETransactionVersion$1, ETransactionVersion2 as ETransactionVersion2$1, ETransactionVersion3 as ETransactionVersion3$1, SUBSCRIPTION_ID, BLOCK_HEADER, EMITTED_EVENT, NEW_TXN_STATUS, TXN_HASH as TXN_HASH$1, TXN_WITH_HASH, BLOCK_STATUS, BLOCK_BODY_WITH_RECEIPTS, PENDING_BLOCK_HEADER, BlockTransactionsTraces, L1L2MessagesStatus, CONTRACT_STORAGE_KEYS, StorageProof, CASM_COMPILED_CONTRACT_CLASS, AccountChangeEventHandler, NetworkChangeEventHandler, WatchAssetParameters, AddStarknetChainParameters, Signature as Signature$1, EDAMode as EDAMode$1, PRICE_UNIT as PRICE_UNIT$1, OutsideCallV1, OutsideCallV2, EmittedEvent as EmittedEvent$1, Methods as Methods$1 } from '@starknet-io/starknet-types-08';
|
|
6
6
|
import * as weierstrass from '@noble/curves/abstract/weierstrass';
|
|
7
7
|
import { RecoveredSignatureType } from '@noble/curves/abstract/weierstrass';
|
|
8
8
|
import { Abi as Abi$1, TypedContract } from 'abi-wan-kanabi';
|
|
@@ -1033,7 +1033,6 @@ interface UniversalDetails {
|
|
|
1033
1033
|
blockIdentifier?: BlockIdentifier;
|
|
1034
1034
|
maxFee?: BigNumberish;
|
|
1035
1035
|
tip?: BigNumberish;
|
|
1036
|
-
paymaster?: PaymasterDetails;
|
|
1037
1036
|
paymasterData?: BigNumberish[];
|
|
1038
1037
|
accountDeploymentData?: BigNumberish[];
|
|
1039
1038
|
nonceDataAvailabilityMode?: EDataAvailabilityMode$1;
|
|
@@ -2243,252 +2242,385 @@ declare namespace rpc_0_8_1 {
|
|
|
2243
2242
|
export { rpc_0_8_1_RpcChannel as RpcChannel };
|
|
2244
2243
|
}
|
|
2245
2244
|
|
|
2246
|
-
declare const
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
readonly
|
|
2250
|
-
readonly
|
|
2245
|
+
declare const _default: {
|
|
2246
|
+
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
2247
|
+
prototype: WebSocket;
|
|
2248
|
+
readonly CONNECTING: 0;
|
|
2249
|
+
readonly OPEN: 1;
|
|
2250
|
+
readonly CLOSING: 2;
|
|
2251
|
+
readonly CLOSED: 3;
|
|
2251
2252
|
};
|
|
2252
|
-
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* Represents an active WebSocket subscription.
|
|
2256
|
+
*
|
|
2257
|
+
* This class should not be instantiated directly. It is returned by the
|
|
2258
|
+
* `subscribe` methods on the `WebSocketChannel`.
|
|
2259
|
+
*
|
|
2260
|
+
* @template T - The type of data expected from the subscription event.
|
|
2261
|
+
* @example
|
|
2262
|
+
* ```typescript
|
|
2263
|
+
* const channel = new WebSocketChannel({ nodeUrl: 'YOUR_NODE_URL' });
|
|
2264
|
+
* await channel.waitForConnection();
|
|
2265
|
+
*
|
|
2266
|
+
* // The 'sub' object is an instance of the Subscription class.
|
|
2267
|
+
* const sub = await channel.subscribeNewHeads();
|
|
2268
|
+
*
|
|
2269
|
+
* sub.on((data) => {
|
|
2270
|
+
* console.log('Received new head:', data);
|
|
2271
|
+
* });
|
|
2272
|
+
*
|
|
2273
|
+
* // ... later
|
|
2274
|
+
* await sub.unsubscribe();
|
|
2275
|
+
* ```
|
|
2276
|
+
*/
|
|
2277
|
+
declare class Subscription<T = any> {
|
|
2253
2278
|
/**
|
|
2254
|
-
*
|
|
2255
|
-
* @
|
|
2256
|
-
* @default public websocket enabled starknet node
|
|
2279
|
+
* The containing `WebSocketChannel` instance.
|
|
2280
|
+
* @internal
|
|
2257
2281
|
*/
|
|
2258
|
-
|
|
2282
|
+
channel: WebSocketChannel;
|
|
2259
2283
|
/**
|
|
2260
|
-
*
|
|
2261
|
-
*
|
|
2262
|
-
* * https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket#protocols .
|
|
2263
|
-
* * https://www.rfc-editor.org/rfc/rfc6455.html#section-1 .
|
|
2264
|
-
* @default WebSocket
|
|
2284
|
+
* The JSON-RPC method used to create this subscription.
|
|
2285
|
+
* @internal
|
|
2265
2286
|
*/
|
|
2266
|
-
|
|
2267
|
-
};
|
|
2268
|
-
/**
|
|
2269
|
-
* WebSocket channel provides communication with Starknet node over long-lived socket connection
|
|
2270
|
-
*/
|
|
2271
|
-
declare class WebSocketChannel {
|
|
2287
|
+
method: string;
|
|
2272
2288
|
/**
|
|
2273
|
-
*
|
|
2274
|
-
* @
|
|
2289
|
+
* The parameters used to create this subscription.
|
|
2290
|
+
* @internal
|
|
2275
2291
|
*/
|
|
2276
|
-
|
|
2292
|
+
params: any;
|
|
2277
2293
|
/**
|
|
2278
|
-
*
|
|
2294
|
+
* The unique identifier for this subscription.
|
|
2295
|
+
* @internal
|
|
2279
2296
|
*/
|
|
2280
|
-
|
|
2297
|
+
id: SUBSCRIPTION_ID;
|
|
2298
|
+
private events;
|
|
2299
|
+
private buffer;
|
|
2300
|
+
private maxBufferSize;
|
|
2301
|
+
private handler;
|
|
2302
|
+
private _isClosed;
|
|
2281
2303
|
/**
|
|
2282
|
-
*
|
|
2283
|
-
* @
|
|
2284
|
-
*
|
|
2285
|
-
*
|
|
2286
|
-
*
|
|
2287
|
-
* }
|
|
2288
|
-
* ```
|
|
2304
|
+
* @internal
|
|
2305
|
+
* @param {WebSocketChannel} channel - The WebSocketChannel instance.
|
|
2306
|
+
* @param {string} method - The RPC method used for the subscription.
|
|
2307
|
+
* @param {any} params - The parameters for the subscription.
|
|
2308
|
+
* @param {SUBSCRIPTION_ID} id - The subscription ID.
|
|
2309
|
+
* @param {number} maxBufferSize - The maximum number of events to buffer.
|
|
2289
2310
|
*/
|
|
2290
|
-
|
|
2311
|
+
constructor(channel: WebSocketChannel, method: string, params: object, id: SUBSCRIPTION_ID, maxBufferSize: number);
|
|
2291
2312
|
/**
|
|
2292
|
-
*
|
|
2293
|
-
* @
|
|
2294
|
-
* ```typescript
|
|
2295
|
-
* webSocketChannel.onNewHeads = async function (data) {
|
|
2296
|
-
* // ... do something with head data
|
|
2297
|
-
* }
|
|
2298
|
-
* ```
|
|
2313
|
+
* Indicates if the subscription has been closed.
|
|
2314
|
+
* @returns {boolean} `true` if unsubscribed, `false` otherwise.
|
|
2299
2315
|
*/
|
|
2300
|
-
|
|
2316
|
+
get isClosed(): boolean;
|
|
2301
2317
|
/**
|
|
2302
|
-
*
|
|
2303
|
-
*
|
|
2304
|
-
*
|
|
2305
|
-
*
|
|
2306
|
-
* // ... do something with event data
|
|
2307
|
-
* }
|
|
2308
|
-
* ```
|
|
2318
|
+
* Internal method to handle incoming events from the WebSocket channel.
|
|
2319
|
+
* If a handler is attached, it's invoked immediately. Otherwise, the event is buffered.
|
|
2320
|
+
* @internal
|
|
2321
|
+
* @param {T} data - The event data.
|
|
2309
2322
|
*/
|
|
2310
|
-
|
|
2323
|
+
_handleEvent(data: T): void;
|
|
2311
2324
|
/**
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2316
|
-
*
|
|
2317
|
-
* }
|
|
2318
|
-
*
|
|
2325
|
+
* Attaches a handler function to be called for each event.
|
|
2326
|
+
*
|
|
2327
|
+
* When a handler is attached, any buffered events will be passed to it sequentially.
|
|
2328
|
+
* Subsequent events will be passed directly as they arrive.
|
|
2329
|
+
*
|
|
2330
|
+
* @param {(data: T) => void} handler - The function to call with event data.
|
|
2331
|
+
* @throws {Error} If a handler is already attached to this subscription.
|
|
2319
2332
|
*/
|
|
2320
|
-
|
|
2333
|
+
on(handler: (data: T) => void): void;
|
|
2321
2334
|
/**
|
|
2322
|
-
*
|
|
2335
|
+
* Sends an unsubscribe request to the node and cleans up local resources.
|
|
2336
|
+
* @returns {Promise<boolean>} A Promise that resolves to `true` if the unsubscription was successful.
|
|
2337
|
+
*/
|
|
2338
|
+
unsubscribe(): Promise<boolean>;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
/**
|
|
2342
|
+
* Options for configuring the automatic reconnection behavior of the WebSocketChannel.
|
|
2343
|
+
*/
|
|
2344
|
+
type ReconnectOptions = {
|
|
2345
|
+
/**
|
|
2346
|
+
* The number of retries to attempt before giving up.
|
|
2347
|
+
* @default 5
|
|
2348
|
+
*/
|
|
2349
|
+
retries?: number;
|
|
2350
|
+
/**
|
|
2351
|
+
* The initial delay in milliseconds before the first retry.
|
|
2352
|
+
* This delay will be doubled for each subsequent retry (exponential backoff).
|
|
2353
|
+
* @default 2000
|
|
2354
|
+
*/
|
|
2355
|
+
delay?: number;
|
|
2356
|
+
};
|
|
2357
|
+
/**
|
|
2358
|
+
* Options for configuring the WebSocketChannel.
|
|
2359
|
+
*/
|
|
2360
|
+
type WebSocketOptions = {
|
|
2361
|
+
/**
|
|
2362
|
+
* The URL of the WebSocket endpoint of the Starknet node.
|
|
2363
|
+
* @example 'ws://localhost:9545'
|
|
2364
|
+
*/
|
|
2365
|
+
nodeUrl: string;
|
|
2366
|
+
/**
|
|
2367
|
+
* This parameter can be used to provide a custom WebSocket implementation.
|
|
2368
|
+
* This is useful in environments where the global WebSocket object is not available (e.g., Node.js).
|
|
2323
2369
|
* @example
|
|
2324
2370
|
* ```typescript
|
|
2325
|
-
*
|
|
2326
|
-
*
|
|
2327
|
-
* }
|
|
2371
|
+
* import WebSocket from 'ws';
|
|
2372
|
+
* const channel = new WebSocketChannel({ nodeUrl: '...', websocket: WebSocket });
|
|
2328
2373
|
* ```
|
|
2329
2374
|
*/
|
|
2330
|
-
|
|
2375
|
+
websocket?: typeof _default;
|
|
2331
2376
|
/**
|
|
2332
|
-
*
|
|
2377
|
+
* The maximum number of events to buffer per subscription when no handler is attached.
|
|
2378
|
+
* @default 1000
|
|
2333
2379
|
*/
|
|
2334
|
-
|
|
2380
|
+
maxBufferSize?: number;
|
|
2335
2381
|
/**
|
|
2336
|
-
*
|
|
2382
|
+
* Whether to automatically reconnect when the connection is lost.
|
|
2383
|
+
* @default true
|
|
2337
2384
|
*/
|
|
2338
|
-
|
|
2385
|
+
autoReconnect?: boolean;
|
|
2339
2386
|
/**
|
|
2340
|
-
*
|
|
2387
|
+
* Options for the automatic reconnection behavior.
|
|
2341
2388
|
*/
|
|
2342
|
-
|
|
2389
|
+
reconnectOptions?: ReconnectOptions;
|
|
2343
2390
|
/**
|
|
2344
|
-
*
|
|
2391
|
+
* The timeout in milliseconds for a `sendReceive` call.
|
|
2392
|
+
* @default 60000
|
|
2345
2393
|
*/
|
|
2346
|
-
|
|
2394
|
+
requestTimeout?: number;
|
|
2395
|
+
};
|
|
2396
|
+
type WebSocketChannelEvents = {
|
|
2397
|
+
open: Event;
|
|
2398
|
+
close: CloseEvent;
|
|
2399
|
+
message: MessageEvent<any>;
|
|
2400
|
+
error: Event;
|
|
2401
|
+
unsubscribe: SUBSCRIPTION_ID;
|
|
2402
|
+
};
|
|
2403
|
+
/**
|
|
2404
|
+
* Manages a WebSocket connection to a Starknet node for receiving real-time updates.
|
|
2405
|
+
* This class handles subscriptions, automatic reconnection, and request queueing.
|
|
2406
|
+
*
|
|
2407
|
+
* @example
|
|
2408
|
+
* ```typescript
|
|
2409
|
+
* const channel = new WebSocketChannel({ nodeUrl: 'YOUR_NODE_URL' });
|
|
2410
|
+
* await channel.waitForConnection();
|
|
2411
|
+
*
|
|
2412
|
+
* const sub = await channel.subscribeNewHeads();
|
|
2413
|
+
* sub.on((data) => {
|
|
2414
|
+
* console.log('New Block:', data);
|
|
2415
|
+
* });
|
|
2416
|
+
*
|
|
2417
|
+
* // ... later
|
|
2418
|
+
* await sub.unsubscribe();
|
|
2419
|
+
* channel.disconnect();
|
|
2420
|
+
* ```
|
|
2421
|
+
*/
|
|
2422
|
+
declare class WebSocketChannel {
|
|
2347
2423
|
/**
|
|
2348
|
-
*
|
|
2424
|
+
* The URL of the WebSocket RPC Node.
|
|
2425
|
+
* @example 'wss://starknet-sepolia.public.blastapi.io/rpc/v0_8'
|
|
2349
2426
|
*/
|
|
2350
|
-
|
|
2351
|
-
private onUnsubscribeLocal;
|
|
2427
|
+
nodeUrl: string;
|
|
2352
2428
|
/**
|
|
2353
|
-
*
|
|
2354
|
-
|
|
2429
|
+
* The underlying WebSocket instance.
|
|
2430
|
+
*/
|
|
2431
|
+
websocket: _default;
|
|
2432
|
+
private WsImplementation;
|
|
2433
|
+
private activeSubscriptions;
|
|
2434
|
+
private readonly maxBufferSize;
|
|
2435
|
+
private readonly autoReconnect;
|
|
2436
|
+
private readonly reconnectOptions;
|
|
2437
|
+
private readonly requestTimeout;
|
|
2438
|
+
private isReconnecting;
|
|
2439
|
+
private reconnectAttempts;
|
|
2440
|
+
private userInitiatedClose;
|
|
2441
|
+
private reconnectTimeoutId;
|
|
2442
|
+
private requestQueue;
|
|
2443
|
+
private events;
|
|
2444
|
+
private openListener;
|
|
2445
|
+
private closeListener;
|
|
2446
|
+
private messageListener;
|
|
2447
|
+
private errorListener;
|
|
2448
|
+
/**
|
|
2449
|
+
* JSON RPC latest sent message ID.
|
|
2450
|
+
* The receiving message is expected to contain the same ID.
|
|
2355
2451
|
*/
|
|
2356
2452
|
private sendId;
|
|
2357
2453
|
/**
|
|
2358
|
-
*
|
|
2359
|
-
*
|
|
2454
|
+
* Creates an instance of WebSocketChannel.
|
|
2455
|
+
* @param {WebSocketOptions} options - The options for configuring the channel.
|
|
2360
2456
|
*/
|
|
2361
|
-
|
|
2362
|
-
/**
|
|
2363
|
-
* Construct class and event listeners
|
|
2364
|
-
* @param options WebSocketOptions
|
|
2365
|
-
*/
|
|
2366
|
-
constructor(options?: WebSocketOptions);
|
|
2457
|
+
constructor(options: WebSocketOptions);
|
|
2367
2458
|
private idResolver;
|
|
2368
2459
|
/**
|
|
2369
|
-
*
|
|
2370
|
-
*
|
|
2371
|
-
* @
|
|
2372
|
-
*
|
|
2373
|
-
*
|
|
2374
|
-
*
|
|
2460
|
+
* Sends a JSON-RPC request over the WebSocket connection without waiting for a response.
|
|
2461
|
+
* This is a low-level method. Prefer `sendReceive` for most use cases.
|
|
2462
|
+
* @param {string} method - The RPC method name.
|
|
2463
|
+
* @param {object} [params] - The parameters for the RPC method.
|
|
2464
|
+
* @param {number} [id] - A specific request ID. If not provided, an auto-incrementing ID is used.
|
|
2465
|
+
* @returns {number} The ID of the sent request.
|
|
2466
|
+
* @throws {WebSocketNotConnectedError} If the WebSocket is not connected.
|
|
2375
2467
|
*/
|
|
2376
2468
|
send(method: string, params?: object, id?: number): number;
|
|
2377
2469
|
/**
|
|
2378
|
-
*
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
*
|
|
2383
|
-
*
|
|
2384
|
-
* @
|
|
2385
|
-
* @
|
|
2386
|
-
* @
|
|
2387
|
-
* ```typescript
|
|
2388
|
-
* const response = await this.sendReceive('starknet_method', params);
|
|
2389
|
-
* ```
|
|
2470
|
+
* Sends a JSON-RPC request and returns a Promise that resolves with the result.
|
|
2471
|
+
* This method abstracts the request/response cycle over WebSockets.
|
|
2472
|
+
* If the connection is lost, it will queue the request and send it upon reconnection.
|
|
2473
|
+
* @template T - The expected type of the result.
|
|
2474
|
+
* @param {string} method - The RPC method name.
|
|
2475
|
+
* @param {object} [params] - The parameters for the RPC method.
|
|
2476
|
+
* @returns {Promise<T>} A Promise that resolves with the RPC response result.
|
|
2477
|
+
* @throws {TimeoutError} If the request does not receive a response within the configured `requestTimeout`.
|
|
2478
|
+
* @throws {WebSocketNotConnectedError} If the WebSocket is not connected and auto-reconnect is disabled.
|
|
2390
2479
|
*/
|
|
2391
|
-
sendReceive<T
|
|
2480
|
+
sendReceive<T = any>(method: string, params?: object): Promise<T>;
|
|
2392
2481
|
/**
|
|
2393
|
-
*
|
|
2482
|
+
* Checks if the WebSocket connection is currently open.
|
|
2483
|
+
* @returns {boolean} `true` if the connection is open, `false` otherwise.
|
|
2394
2484
|
*/
|
|
2395
2485
|
isConnected(): boolean;
|
|
2396
2486
|
/**
|
|
2397
|
-
*
|
|
2398
|
-
*
|
|
2487
|
+
* Returns a Promise that resolves when the WebSocket connection is open.
|
|
2488
|
+
* Can be used to block execution until the connection is established.
|
|
2489
|
+
* @returns {Promise<number>} A Promise that resolves with the WebSocket's `readyState` when connected.
|
|
2399
2490
|
* @example
|
|
2400
2491
|
* ```typescript
|
|
2401
|
-
* const
|
|
2492
|
+
* const channel = new WebSocketChannel({ nodeUrl: '...' });
|
|
2493
|
+
* await channel.waitForConnection();
|
|
2494
|
+
* console.log('Connected!');
|
|
2402
2495
|
* ```
|
|
2403
2496
|
*/
|
|
2404
2497
|
waitForConnection(): Promise<typeof this$1.websocket.readyState>;
|
|
2405
2498
|
/**
|
|
2406
|
-
*
|
|
2499
|
+
* Closes the WebSocket connection.
|
|
2500
|
+
* This method is user-initiated and will prevent automatic reconnection for this closure.
|
|
2501
|
+
* @param {number} [code] - The WebSocket connection close code.
|
|
2502
|
+
* @param {string} [reason] - The WebSocket connection close reason.
|
|
2407
2503
|
*/
|
|
2408
2504
|
disconnect(code?: number, reason?: string): void;
|
|
2409
2505
|
/**
|
|
2410
|
-
*
|
|
2411
|
-
* @
|
|
2412
|
-
* ```typescript
|
|
2413
|
-
* const readyState = await webSocketChannel.waitForDisconnection();
|
|
2414
|
-
* ```
|
|
2506
|
+
* Returns a Promise that resolves when the WebSocket connection is closed.
|
|
2507
|
+
* @returns {Promise<number | Event>} A Promise that resolves with the WebSocket's `readyState` or a `CloseEvent` when disconnected.
|
|
2415
2508
|
*/
|
|
2416
2509
|
waitForDisconnection(): Promise<typeof this$1.websocket.readyState | Event>;
|
|
2417
2510
|
/**
|
|
2418
|
-
*
|
|
2419
|
-
*
|
|
2420
|
-
* @
|
|
2511
|
+
* Unsubscribes from a Starknet subscription.
|
|
2512
|
+
* It is recommended to use the `unsubscribe()` method on the `Subscription` object instead.
|
|
2513
|
+
* @internal
|
|
2514
|
+
* @param {SUBSCRIPTION_ID} subscriptionId - The ID of the subscription to unsubscribe from.
|
|
2515
|
+
* @returns {Promise<boolean>} A Promise that resolves with `true` if the unsubscription was successful.
|
|
2421
2516
|
*/
|
|
2422
|
-
unsubscribe(subscriptionId: SUBSCRIPTION_ID
|
|
2517
|
+
unsubscribe(subscriptionId: SUBSCRIPTION_ID): Promise<boolean>;
|
|
2423
2518
|
/**
|
|
2424
|
-
*
|
|
2425
|
-
* @param
|
|
2426
|
-
* @returns
|
|
2519
|
+
* Returns a Promise that resolves when a specific subscription is successfully unsubscribed.
|
|
2520
|
+
* @param {SUBSCRIPTION_ID} targetId - The ID of the subscription to wait for.
|
|
2521
|
+
* @returns {Promise<void>}
|
|
2427
2522
|
* @example
|
|
2428
2523
|
* ```typescript
|
|
2429
|
-
*
|
|
2524
|
+
* await channel.waitForUnsubscription(mySubscription.id);
|
|
2525
|
+
* console.log('Successfully unsubscribed.');
|
|
2430
2526
|
* ```
|
|
2431
2527
|
*/
|
|
2432
|
-
waitForUnsubscription(
|
|
2528
|
+
waitForUnsubscription(targetId: SUBSCRIPTION_ID): Promise<void>;
|
|
2433
2529
|
/**
|
|
2434
|
-
*
|
|
2530
|
+
* Manually initiates a reconnection attempt.
|
|
2531
|
+
* This creates a new WebSocket instance and re-establishes listeners.
|
|
2435
2532
|
*/
|
|
2436
2533
|
reconnect(): void;
|
|
2437
|
-
private
|
|
2534
|
+
private _processRequestQueue;
|
|
2535
|
+
private _restoreSubscriptions;
|
|
2536
|
+
private _startReconnect;
|
|
2438
2537
|
private onCloseProxy;
|
|
2439
2538
|
private onMessageProxy;
|
|
2440
2539
|
/**
|
|
2441
|
-
*
|
|
2442
|
-
*
|
|
2540
|
+
* Subscribes to new block headers.
|
|
2541
|
+
* @param {SubscriptionBlockIdentifier} [blockIdentifier] - The block to start receiving notifications from. Defaults to 'latest'.
|
|
2542
|
+
* @returns {Promise<Subscription<BLOCK_HEADER>>} A Promise that resolves with a `Subscription` object for new block headers.
|
|
2443
2543
|
*/
|
|
2444
|
-
|
|
2544
|
+
subscribeNewHeads(blockIdentifier?: SubscriptionBlockIdentifier): Promise<Subscription<BLOCK_HEADER>>;
|
|
2445
2545
|
/**
|
|
2446
|
-
*
|
|
2546
|
+
* Subscribes to events matching a given filter.
|
|
2547
|
+
* @param {BigNumberish} [fromAddress] - The contract address to filter by.
|
|
2548
|
+
* @param {string[][]} [keys] - The event keys to filter by.
|
|
2549
|
+
* @param {SubscriptionBlockIdentifier} [blockIdentifier] - The block to start receiving notifications from. Defaults to 'latest'.
|
|
2550
|
+
* @returns {Promise<Subscription<EMITTED_EVENT>>} A Promise that resolves with a `Subscription` object for the specified events.
|
|
2447
2551
|
*/
|
|
2448
|
-
|
|
2552
|
+
subscribeEvents(fromAddress?: BigNumberish, keys?: string[][], blockIdentifier?: SubscriptionBlockIdentifier): Promise<Subscription<EMITTED_EVENT>>;
|
|
2449
2553
|
/**
|
|
2450
|
-
*
|
|
2554
|
+
* Subscribes to status updates for a specific transaction.
|
|
2555
|
+
* @param {BigNumberish} transactionHash - The hash of the transaction to monitor.
|
|
2556
|
+
* @param {SubscriptionBlockIdentifier} [blockIdentifier] - The block context. Not typically required.
|
|
2557
|
+
* @returns {Promise<Subscription<NEW_TXN_STATUS>>} A Promise that resolves with a `Subscription` object for the transaction's status.
|
|
2451
2558
|
*/
|
|
2452
|
-
|
|
2559
|
+
subscribeTransactionStatus(transactionHash: BigNumberish, blockIdentifier?: SubscriptionBlockIdentifier): Promise<Subscription<NEW_TXN_STATUS>>;
|
|
2453
2560
|
/**
|
|
2454
|
-
*
|
|
2455
|
-
*
|
|
2561
|
+
* Subscribes to pending transactions.
|
|
2562
|
+
* @param {boolean} [transactionDetails] - If `true`, the full transaction details are included. Defaults to `false` (hash only).
|
|
2563
|
+
* @param {BigNumberish[]} [senderAddress] - An array of sender addresses to filter by.
|
|
2564
|
+
* @returns {Promise<Subscription<TXN_HASH | TXN_WITH_HASH>>} A Promise that resolves with a `Subscription` object for pending transactions.
|
|
2456
2565
|
*/
|
|
2457
|
-
|
|
2566
|
+
subscribePendingTransaction(transactionDetails?: boolean, senderAddress?: BigNumberish[]): Promise<Subscription<TXN_HASH$1 | TXN_WITH_HASH>>;
|
|
2458
2567
|
/**
|
|
2459
|
-
*
|
|
2568
|
+
* Internal method to remove subscription from active map.
|
|
2569
|
+
* @internal
|
|
2460
2570
|
*/
|
|
2461
|
-
|
|
2571
|
+
removeSubscription(id: SUBSCRIPTION_ID): void;
|
|
2462
2572
|
/**
|
|
2463
|
-
*
|
|
2573
|
+
* Adds a listener for a given event.
|
|
2574
|
+
* @param event The event name.
|
|
2575
|
+
* @param listener The listener function to add.
|
|
2464
2576
|
*/
|
|
2465
|
-
|
|
2577
|
+
on<K extends keyof WebSocketChannelEvents>(event: K, listener: (data: WebSocketChannelEvents[K]) => void): void;
|
|
2466
2578
|
/**
|
|
2467
|
-
*
|
|
2468
|
-
*
|
|
2579
|
+
* Removes a listener for a given event.
|
|
2580
|
+
* @param event The event name.
|
|
2581
|
+
* @param listener The listener function to remove.
|
|
2469
2582
|
*/
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
subscribePendingTransaction(transactionDetails?: boolean, senderAddress?: BigNumberish[]): Promise<string | false>;
|
|
2583
|
+
off<K extends keyof WebSocketChannelEvents>(event: K, listener: (data: WebSocketChannelEvents[K]) => void): void;
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
declare class CustomError extends Error {
|
|
2587
|
+
name: string;
|
|
2588
|
+
constructor(message?: string);
|
|
2589
|
+
}
|
|
2590
|
+
declare class LibraryError extends CustomError {
|
|
2591
|
+
}
|
|
2592
|
+
declare class RpcError<BaseErrorT extends RPC_ERROR = RPC_ERROR> extends LibraryError {
|
|
2593
|
+
readonly baseError: BaseErrorT;
|
|
2594
|
+
readonly request: {
|
|
2595
|
+
method: string;
|
|
2596
|
+
params: any;
|
|
2597
|
+
};
|
|
2598
|
+
constructor(baseError: BaseErrorT, method: string, params: any);
|
|
2599
|
+
get code(): 1 | 31 | 10 | 66 | 20 | 32 | 21 | 24 | 27 | 28 | 29 | 33 | 34 | 40 | 41 | 42 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 67 | 68 | 100 | 150 | 151 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 163;
|
|
2488
2600
|
/**
|
|
2489
|
-
*
|
|
2601
|
+
* Verifies the underlying RPC error, also serves as a type guard for the _baseError_ property
|
|
2602
|
+
* @example
|
|
2603
|
+
* ```typescript
|
|
2604
|
+
* SomeError.isType('UNEXPECTED_ERROR');
|
|
2605
|
+
* ```
|
|
2490
2606
|
*/
|
|
2491
|
-
|
|
2607
|
+
isType<N extends keyof RPC_ERROR_SET, C extends RPC_ERROR_SET[N]['code']>(typeName: N): this is RpcError<RPC_ERROR_SET[N] & {
|
|
2608
|
+
code: C;
|
|
2609
|
+
}>;
|
|
2610
|
+
}
|
|
2611
|
+
/**
|
|
2612
|
+
* Thrown when a WebSocket request does not receive a response within the configured timeout period.
|
|
2613
|
+
* @property {string} name - The name of the error, always 'TimeoutError'.
|
|
2614
|
+
*/
|
|
2615
|
+
declare class TimeoutError extends LibraryError {
|
|
2616
|
+
constructor(message: string);
|
|
2617
|
+
}
|
|
2618
|
+
/**
|
|
2619
|
+
* Thrown when an operation is attempted on a WebSocket that is not connected.
|
|
2620
|
+
* @property {string} name - The name of the error, always 'WebSocketNotConnectedError'.
|
|
2621
|
+
*/
|
|
2622
|
+
declare class WebSocketNotConnectedError extends LibraryError {
|
|
2623
|
+
constructor(message: string);
|
|
2492
2624
|
}
|
|
2493
2625
|
|
|
2494
2626
|
declare abstract class ResponseParser {
|
|
@@ -2958,34 +3090,6 @@ declare const RpcProvider_base: ts_mixer_dist_types_types.Class<any[], RpcProvid
|
|
|
2958
3090
|
declare class RpcProvider extends RpcProvider_base {
|
|
2959
3091
|
}
|
|
2960
3092
|
|
|
2961
|
-
declare function fixStack(target: Error, fn?: Function): void;
|
|
2962
|
-
declare function fixProto(target: Error, prototype: {}): void;
|
|
2963
|
-
declare class CustomError extends Error {
|
|
2964
|
-
name: string;
|
|
2965
|
-
constructor(message?: string);
|
|
2966
|
-
}
|
|
2967
|
-
declare class LibraryError extends CustomError {
|
|
2968
|
-
}
|
|
2969
|
-
declare class RpcError<BaseErrorT extends RPC_ERROR = RPC_ERROR> extends LibraryError {
|
|
2970
|
-
readonly baseError: BaseErrorT;
|
|
2971
|
-
readonly request: {
|
|
2972
|
-
method: string;
|
|
2973
|
-
params: any;
|
|
2974
|
-
};
|
|
2975
|
-
constructor(baseError: BaseErrorT, method: string, params: any);
|
|
2976
|
-
get code(): 1 | 31 | 10 | 66 | 20 | 32 | 21 | 24 | 27 | 28 | 29 | 33 | 34 | 40 | 41 | 42 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 67 | 68 | 100 | 150 | 151 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 163;
|
|
2977
|
-
/**
|
|
2978
|
-
* Verifies the underlying RPC error, also serves as a type guard for the _baseError_ property
|
|
2979
|
-
* @example
|
|
2980
|
-
* ```typescript
|
|
2981
|
-
* SomeError.isType('UNEXPECTED_ERROR');
|
|
2982
|
-
* ```
|
|
2983
|
-
*/
|
|
2984
|
-
isType<N extends keyof RPC_ERROR_SET, C extends RPC_ERROR_SET[N]['code']>(typeName: N): this is RpcError<RPC_ERROR_SET[N] & {
|
|
2985
|
-
code: C;
|
|
2986
|
-
}>;
|
|
2987
|
-
}
|
|
2988
|
-
|
|
2989
3093
|
declare const defaultProvider: RpcProvider$1;
|
|
2990
3094
|
|
|
2991
3095
|
declare abstract class SignerInterface {
|
|
@@ -8009,4 +8113,4 @@ declare class Logger {
|
|
|
8009
8113
|
*/
|
|
8010
8114
|
declare const logger: Logger;
|
|
8011
8115
|
|
|
8012
|
-
export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BLOCK_HASH, type BLOCK_NUMBER, BatchClient, type BatchClientOptions, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFixedArray, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion,
|
|
8116
|
+
export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BLOCK_HASH, type BLOCK_NUMBER, BatchClient, type BatchClientOptions, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFixedArray, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeclaredTransaction, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployAndInvokeTransaction, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransaction, type DeployTransactionReceiptResponse, type DeployedAccountTransaction, type Details, EDAMode, EDataAvailabilityMode, ETH_ADDRESS, ETransactionExecutionStatus, ETransactionStatus, ETransactionVersion, ETransactionVersion2, ETransactionVersion3, type EVENTS_CHUNK, type EmittedEvent, EntryPointType, type EntryPointsByType, type EstimateFee, type EstimateFeeAction, type EstimateFeeBulk, type EstimateFeeDetails, type EstimateFeeResponse, type EstimateFeeResponseBulk, EthSigner, type Event$1 as Event, type EventEntry, type EventFilter, type ExecutableDeployAndInvokeTransaction, type ExecutableDeployTransaction, type ExecutableInvokeTransaction, type ExecutableUserInvoke, type ExecutableUserTransaction, type ExecutionParameters, type FEE_ESTIMATE, type FELT, type FeeEstimate, type FeeMarginPercentage, type FeeMode, type FunctionAbi, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type Hint, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeOptions, type InvokeTransaction, type InvokeTransactionReceiptResponse, type InvokedTransaction, type L1HandlerTransactionReceiptResponse, type L1Message, type L1_HANDLER_TXN, type LedgerPathCalculation, LedgerSigner111 as LedgerSigner, LedgerSigner111, LedgerSigner221, LedgerSigner231, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type LogLevel, LogLevelIndex, type Methods, type MultiDeployContractResponse, type MultiType, NON_ZERO_PREFIX, type Nonce, type OptionalPayload, type OutsideCall, type OutsideExecution, type OutsideExecutionOptions, OutsideExecutionTypesV1, OutsideExecutionTypesV2, OutsideExecutionVersion, type OutsideTransaction, type PENDING_DECLARE_TXN_RECEIPT, type PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT, type PENDING_INVOKE_TXN_RECEIPT, type PENDING_L1_HANDLER_TXN_RECEIPT, type PENDING_STATE_UPDATE, type PRICE_UNIT, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PaymasterDetails, type PaymasterFeeEstimate, PaymasterInterface, type PaymasterOptions, PaymasterRpc, type PaymasterRpcOptions, type PaymasterTimeBounds, type PendingBlock, type PendingReceipt, type PendingStateUpdate, type PreparedDeployAndInvokeTransaction, type PreparedDeployTransaction, type PreparedInvokeTransaction, type PreparedTransaction, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type PythonicHints, type RESOURCE_PRICE, index$4 as RPC, rpc_0_7_1 as RPC07, rpc_0_8_1 as RPC08, RPCResponseParser, type RPC_ERROR, type RPC_ERROR_SET, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, type Receipt, ReceiptTx, type RequiredKeysOf, type ResourceBounds, type ResourceBoundsOverhead, type ResourceBoundsOverheadRPC07, type ResourceBoundsOverheadRPC08, ResponseParser, type Result, type RevertedTransactionReceiptResponse, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type STATE_UPDATE, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type Simplify, type SimulateTransaction, type SimulateTransactionDetails, type SimulateTransactionResponse, type SimulatedTransaction, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, Subscription, type SubscriptionBlockIdentifier, type SuccessfulTransactionReceiptResponse, type TRANSACTION_TRACE, type TXN_EXECUTION_STATUS, type TXN_HASH, type TXN_STATUS, TimeoutError, type TokenData, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptValue, type TransactionStatus, type TransactionStatusReceiptSets, TransactionType, type TransactionWithHash, type Tupled, type TypedContractV2, UINT_128_MAX, UINT_128_MIN, UINT_256_HIGH_MAX, UINT_256_HIGH_MIN, UINT_256_LOW_MAX, UINT_256_LOW_MIN, UINT_256_MAX, UINT_256_MIN, UINT_512_MAX, UINT_512_MIN, Uint, type Uint256, type Uint512, type UniversalDeployerContractPayload, type UniversalDetails, type UniversalSuggestedFee, type UserInvoke, type UserTransaction, type V2DeclareSignerDetails, type V2DeployAccountSignerDetails, type V2InvocationsSignerDetails, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, WebSocketChannel, WebSocketNotConnectedError, type WebSocketOptions, type WeierstrassSignatureType, addAddressPadding, byteArray, cairo, config, constants, contractClassResponseToLegacyCompiledContract, defaultPaymaster, defaultProvider, ec, encode, eth, index as events, extractContractHashes, getCalldata, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, index$2 as hash, isPendingBlock, isPendingStateUpdate, isPendingTransaction, isRPC08_FeeEstimate, isRPC08_ResourceBounds, isSierra, isSupportedSpecVersion, isV3Tx, isVersion, json, logger, merkle, num, outsideExecution, parseCalldataField, paymaster, provider, selector, shortString, src5, index$1 as stark, starknetId, toAnyPatchVersion, transaction, typedData, index$3 as types, uint256$1 as uint256, units, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, type waitForTransactionOptions, connect as wallet };
|