starknet 8.2.0 → 8.3.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/dist/index.mjs CHANGED
@@ -6869,7 +6869,7 @@ var Subscription = class {
6869
6869
  }
6870
6870
  };
6871
6871
 
6872
- // src/channel/ws/ws_0_8.ts
6872
+ // src/channel/ws/ws_0_9.ts
6873
6873
  var WebSocketChannel = class {
6874
6874
  /**
6875
6875
  * The URL of the WebSocket RPC Node.
@@ -7217,19 +7217,19 @@ var WebSocketChannel = class {
7217
7217
  }
7218
7218
  /**
7219
7219
  * Subscribes to new block headers.
7220
- * @param {SubscriptionBlockIdentifier} [blockIdentifier] - The block to start receiving notifications from. Defaults to 'latest'.
7220
+ * @param {SubscribeNewHeadsParams} params - The parameters for the subscription.
7221
7221
  * @returns {Promise<Subscription<BLOCK_HEADER>>} A Promise that resolves with a `Subscription` object for new block headers.
7222
7222
  */
7223
- async subscribeNewHeads(blockIdentifier) {
7223
+ async subscribeNewHeads(params = {}) {
7224
7224
  const method = "starknet_subscribeNewHeads";
7225
- const params = {
7226
- block_id: blockIdentifier ? new Block(blockIdentifier).identifier : void 0
7225
+ const rpcParams = {
7226
+ block_id: params.blockIdentifier ? new Block(params.blockIdentifier).identifier : void 0
7227
7227
  };
7228
- const subId = await this.sendReceive(method, params);
7228
+ const subId = await this.sendReceive(method, rpcParams);
7229
7229
  const subscription = new Subscription({
7230
7230
  channel: this,
7231
7231
  method,
7232
- params,
7232
+ params: rpcParams,
7233
7233
  id: subId,
7234
7234
  maxBufferSize: this.maxBufferSize
7235
7235
  });
@@ -7238,23 +7238,22 @@ var WebSocketChannel = class {
7238
7238
  }
7239
7239
  /**
7240
7240
  * Subscribes to events matching a given filter.
7241
- * @param {BigNumberish} [fromAddress] - The contract address to filter by.
7242
- * @param {string[][]} [keys] - The event keys to filter by.
7243
- * @param {SubscriptionBlockIdentifier} [blockIdentifier] - The block to start receiving notifications from. Defaults to 'latest'.
7241
+ * @param {SubscribeEventsParams} params - The parameters for the subscription.
7244
7242
  * @returns {Promise<Subscription<EMITTED_EVENT>>} A Promise that resolves with a `Subscription` object for the specified events.
7245
7243
  */
7246
- async subscribeEvents(fromAddress, keys, blockIdentifier) {
7244
+ async subscribeEvents(params = {}) {
7247
7245
  const method = "starknet_subscribeEvents";
7248
- const params = {
7249
- from_address: fromAddress !== void 0 ? toHex(fromAddress) : void 0,
7250
- keys,
7251
- block_id: blockIdentifier ? new Block(blockIdentifier).identifier : void 0
7246
+ const rpcParams = {
7247
+ from_address: params.fromAddress !== void 0 ? toHex(params.fromAddress) : void 0,
7248
+ keys: params.keys,
7249
+ block_id: params.blockIdentifier ? new Block(params.blockIdentifier).identifier : void 0,
7250
+ finality_status: params.finalityStatus
7252
7251
  };
7253
- const subId = await this.sendReceive(method, params);
7252
+ const subId = await this.sendReceive(method, rpcParams);
7254
7253
  const subscription = new Subscription({
7255
7254
  channel: this,
7256
7255
  method,
7257
- params,
7256
+ params: rpcParams,
7258
7257
  id: subId,
7259
7258
  maxBufferSize: this.maxBufferSize
7260
7259
  });
@@ -7263,21 +7262,20 @@ var WebSocketChannel = class {
7263
7262
  }
7264
7263
  /**
7265
7264
  * Subscribes to status updates for a specific transaction.
7266
- * @param {BigNumberish} transactionHash - The hash of the transaction to monitor.
7267
- * @param {SubscriptionBlockIdentifier} [blockIdentifier] - The block context. Not typically required.
7265
+ * @param {SubscribeTransactionStatusParams} params - The parameters for the subscription.
7268
7266
  * @returns {Promise<Subscription<NEW_TXN_STATUS>>} A Promise that resolves with a `Subscription` object for the transaction's status.
7269
7267
  */
7270
- async subscribeTransactionStatus(transactionHash, blockIdentifier) {
7268
+ async subscribeTransactionStatus(params) {
7271
7269
  const method = "starknet_subscribeTransactionStatus";
7272
- const params = {
7273
- transaction_hash: toHex(transactionHash),
7274
- block_id: blockIdentifier ? new Block(blockIdentifier).identifier : void 0
7270
+ const rpcParams = {
7271
+ transaction_hash: toHex(params.transactionHash),
7272
+ block_id: params.blockIdentifier ? new Block(params.blockIdentifier).identifier : void 0
7275
7273
  };
7276
- const subId = await this.sendReceive(method, params);
7274
+ const subId = await this.sendReceive(method, rpcParams);
7277
7275
  const subscription = new Subscription({
7278
7276
  channel: this,
7279
7277
  method,
7280
- params,
7278
+ params: rpcParams,
7281
7279
  id: subId,
7282
7280
  maxBufferSize: this.maxBufferSize
7283
7281
  });
@@ -7285,22 +7283,43 @@ var WebSocketChannel = class {
7285
7283
  return subscription;
7286
7284
  }
7287
7285
  /**
7288
- * Subscribes to pending transactions.
7289
- * @param {boolean} [transactionDetails] - If `true`, the full transaction details are included. Defaults to `false` (hash only).
7290
- * @param {BigNumberish[]} [senderAddress] - An array of sender addresses to filter by.
7291
- * @returns {Promise<Subscription<TXN_HASH | TXN_WITH_HASH>>} A Promise that resolves with a `Subscription` object for pending transactions.
7286
+ * Subscribes to new transaction receipts.
7287
+ * @param {SubscribeNewTransactionReceiptsParams} params - The parameters for the subscription.
7288
+ * @returns {Promise<Subscription<NewTransactionReceiptsEvent['result']>>} A Promise that resolves with a `Subscription` object for new transaction receipts.
7292
7289
  */
7293
- async subscribePendingTransaction(transactionDetails, senderAddress) {
7294
- const method = "starknet_subscribePendingTransactions";
7295
- const params = {
7296
- transaction_details: transactionDetails,
7297
- sender_address: senderAddress && bigNumberishArrayToHexadecimalStringArray(senderAddress)
7290
+ async subscribeNewTransactionReceipts(params = {}) {
7291
+ const method = "starknet_subscribeNewTransactionReceipts";
7292
+ const rpcParams = {
7293
+ finality_status: params.finalityStatus,
7294
+ sender_address: params.senderAddress && bigNumberishArrayToHexadecimalStringArray(params.senderAddress)
7295
+ };
7296
+ const subId = await this.sendReceive(method, rpcParams);
7297
+ const subscription = new Subscription({
7298
+ channel: this,
7299
+ method,
7300
+ params: rpcParams,
7301
+ id: subId,
7302
+ maxBufferSize: this.maxBufferSize
7303
+ });
7304
+ this.activeSubscriptions.set(subId, subscription);
7305
+ return subscription;
7306
+ }
7307
+ /**
7308
+ * Subscribes to new transactions.
7309
+ * @param {SubscribeNewTransactionsParams} params - The parameters for the subscription.
7310
+ * @returns {Promise<Subscription<NewTransactionEvent['result']>>} A Promise that resolves with a `Subscription` object for new transactions.
7311
+ */
7312
+ async subscribeNewTransactions(params = {}) {
7313
+ const method = "starknet_subscribeNewTransactions";
7314
+ const rpcParams = {
7315
+ finality_status: params.finalityStatus,
7316
+ sender_address: params.senderAddress && bigNumberishArrayToHexadecimalStringArray(params.senderAddress)
7298
7317
  };
7299
- const subId = await this.sendReceive(method, params);
7318
+ const subId = await this.sendReceive(method, rpcParams);
7300
7319
  const subscription = new Subscription({
7301
7320
  channel: this,
7302
7321
  method,
7303
- params,
7322
+ params: rpcParams,
7304
7323
  id: subId,
7305
7324
  maxBufferSize: this.maxBufferSize
7306
7325
  });