starknet 4.19.0 → 4.19.2

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
@@ -2595,6 +2595,23 @@ var RPCResponseParser = class {
2595
2595
  }
2596
2596
  };
2597
2597
 
2598
+ // src/provider/errors.ts
2599
+ import { CustomError } from "ts-custom-error";
2600
+ var LibraryError = class extends CustomError {
2601
+ };
2602
+ var GatewayError = class extends LibraryError {
2603
+ constructor(message, errorCode) {
2604
+ super(message);
2605
+ this.errorCode = errorCode;
2606
+ }
2607
+ };
2608
+ var HttpError = class extends LibraryError {
2609
+ constructor(message, errorCode) {
2610
+ super(message);
2611
+ this.errorCode = errorCode;
2612
+ }
2613
+ };
2614
+
2598
2615
  // src/provider/utils.ts
2599
2616
  import { BN as BN2 } from "bn.js";
2600
2617
  var validBlockTags = ["latest", "pending"];
@@ -2671,7 +2688,7 @@ var RpcProvider = class {
2671
2688
  errorHandler(error) {
2672
2689
  if (error) {
2673
2690
  const { code, message } = error;
2674
- throw new Error(`${code}: ${message}`);
2691
+ throw new LibraryError(`${code}: ${message}`);
2675
2692
  }
2676
2693
  }
2677
2694
  async fetchEndpoint(method, params) {
@@ -3079,21 +3096,6 @@ function buildUrl(baseUrl, defaultPath, urlOrPath) {
3079
3096
  return isUrl(urlOrPath) ? urlOrPath : urljoin(baseUrl, urlOrPath ?? defaultPath);
3080
3097
  }
3081
3098
 
3082
- // src/provider/errors.ts
3083
- import { CustomError } from "ts-custom-error";
3084
- var GatewayError = class extends CustomError {
3085
- constructor(message, errorCode) {
3086
- super(message);
3087
- this.errorCode = errorCode;
3088
- }
3089
- };
3090
- var HttpError = class extends CustomError {
3091
- constructor(message, errorCode) {
3092
- super(message);
3093
- this.errorCode = errorCode;
3094
- }
3095
- };
3096
-
3097
3099
  // src/provider/sequencer.ts
3098
3100
  function isEmptyQueryObject(obj) {
3099
3101
  return obj === void 0 || Object.keys(obj).length === 0 || Object.keys(obj).length === 1 && Object.entries(obj).every(([k, v]) => k === "blockIdentifier" && v === null);
@@ -3260,9 +3262,11 @@ var SequencerProvider = class {
3260
3262
  }
3261
3263
  async getTransaction(txHash) {
3262
3264
  const txHashHex = toHex(toBN(txHash));
3263
- return this.fetchEndpoint("get_transaction", { transactionHash: txHashHex }).then(
3264
- (value) => this.responseParser.parseGetTransactionResponse(value)
3265
- );
3265
+ return this.fetchEndpoint("get_transaction", { transactionHash: txHashHex }).then((result) => {
3266
+ if (Object.values(result).length === 1)
3267
+ throw new LibraryError(result.status);
3268
+ return this.responseParser.parseGetTransactionResponse(result);
3269
+ });
3266
3270
  }
3267
3271
  async getTransactionReceipt(txHash) {
3268
3272
  const txHashHex = toHex(toBN(txHash));
@@ -5012,6 +5016,7 @@ export {
5012
5016
  ContractInterface,
5013
5017
  GatewayError,
5014
5018
  HttpError,
5019
+ LibraryError,
5015
5020
  Provider,
5016
5021
  ProviderInterface,
5017
5022
  RpcProvider,