starknet 5.4.1 → 5.4.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [5.4.2](https://github.com/0xs34n/starknet.js/compare/v5.4.1...v5.4.2) (2023-04-04)
2
+
3
+ ### Bug Fixes
4
+
5
+ - implement custom ts error localy ([fa90a3e](https://github.com/0xs34n/starknet.js/commit/fa90a3e7dcbe8c0952b0681be903dffb4b4c74c6))
6
+
1
7
  ## [5.4.1](https://github.com/0xs34n/starknet.js/compare/v5.4.0...v5.4.1) (2023-04-03)
2
8
 
3
9
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as _noble_curves_abstract_weierstrass from '@noble/curves/abstract/weierstrass';
2
2
  import * as poseidon from '@noble/curves/abstract/poseidon';
3
3
  import * as microStarknet from 'micro-starknet';
4
- import { CustomError } from 'ts-custom-error/dist/custom-error';
5
4
 
6
5
  declare const IS_BROWSER: boolean;
7
6
  declare function arrayBufferToString(array: ArrayBuffer): string;
@@ -2123,6 +2122,12 @@ declare class Provider implements ProviderInterface {
2123
2122
  getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
2124
2123
  }
2125
2124
 
2125
+ declare function fixStack(target: Error, fn?: Function): void;
2126
+ declare function fixProto(target: Error, prototype: {}): void;
2127
+ declare class CustomError extends Error {
2128
+ name: string;
2129
+ constructor(message?: string);
2130
+ }
2126
2131
  declare class LibraryError extends CustomError {
2127
2132
  }
2128
2133
  declare class GatewayError extends LibraryError {
@@ -3147,4 +3152,4 @@ declare class CallData {
3147
3152
  /** @deprecated prefer the 'num' naming */
3148
3153
  declare const number: typeof num;
3149
3154
 
3150
- export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, ArraySignatureType, AsyncContractFunction, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, Hints, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonce, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, WeierstrassSignatureType, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
3155
+ export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, ArraySignatureType, AsyncContractFunction, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, CustomError, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, Hints, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonce, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, WeierstrassSignatureType, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, fixProto, fixStack, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
@@ -540,108 +540,6 @@ var starknet = (() => {
540
540
  }
541
541
  });
542
542
 
543
- // node_modules/ts-custom-error/dist/custom-error.js
544
- var require_custom_error = __commonJS({
545
- "node_modules/ts-custom-error/dist/custom-error.js"(exports) {
546
- function fixProto(target, prototype) {
547
- var setPrototypeOf = Object.setPrototypeOf;
548
- setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
549
- }
550
- function fixStack(target, fn) {
551
- if (fn === void 0) {
552
- fn = target.constructor;
553
- }
554
- var captureStackTrace = Error.captureStackTrace;
555
- captureStackTrace && captureStackTrace(target, fn);
556
- }
557
- var __extends = function() {
558
- var _extendStatics = function extendStatics(d, b) {
559
- _extendStatics = Object.setPrototypeOf || {
560
- __proto__: []
561
- } instanceof Array && function(d2, b2) {
562
- d2.__proto__ = b2;
563
- } || function(d2, b2) {
564
- for (var p in b2) {
565
- if (Object.prototype.hasOwnProperty.call(b2, p))
566
- d2[p] = b2[p];
567
- }
568
- };
569
- return _extendStatics(d, b);
570
- };
571
- return function(d, b) {
572
- if (typeof b !== "function" && b !== null)
573
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
574
- _extendStatics(d, b);
575
- function __() {
576
- this.constructor = d;
577
- }
578
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
579
- };
580
- }();
581
- var CustomError2 = function(_super) {
582
- __extends(CustomError3, _super);
583
- function CustomError3(message, options) {
584
- var _newTarget = this.constructor;
585
- var _this = _super.call(this, message, options) || this;
586
- Object.defineProperty(_this, "name", {
587
- value: _newTarget.name,
588
- enumerable: false,
589
- configurable: true
590
- });
591
- fixProto(_this, _newTarget.prototype);
592
- fixStack(_this);
593
- return _this;
594
- }
595
- return CustomError3;
596
- }(Error);
597
- var __spreadArray = function(to, from, pack) {
598
- if (pack || arguments.length === 2)
599
- for (var i = 0, l = from.length, ar; i < l; i++) {
600
- if (ar || !(i in from)) {
601
- if (!ar)
602
- ar = Array.prototype.slice.call(from, 0, i);
603
- ar[i] = from[i];
604
- }
605
- }
606
- return to.concat(ar || Array.prototype.slice.call(from));
607
- };
608
- function customErrorFactory(fn, parent) {
609
- if (parent === void 0) {
610
- parent = Error;
611
- }
612
- function CustomError3() {
613
- var args = [];
614
- for (var _i = 0; _i < arguments.length; _i++) {
615
- args[_i] = arguments[_i];
616
- }
617
- if (!(this instanceof CustomError3))
618
- return new (CustomError3.bind.apply(CustomError3, __spreadArray([void 0], args, false)))();
619
- parent.apply(this, args);
620
- Object.defineProperty(this, "name", {
621
- value: fn.name || parent.name,
622
- enumerable: false,
623
- configurable: true
624
- });
625
- fn.apply(this, args);
626
- fixStack(this, CustomError3);
627
- }
628
- return Object.defineProperties(CustomError3, {
629
- prototype: {
630
- value: Object.create(parent.prototype, {
631
- constructor: {
632
- value: CustomError3,
633
- writable: true,
634
- configurable: true
635
- }
636
- })
637
- }
638
- });
639
- }
640
- exports.CustomError = CustomError2;
641
- exports.customErrorFactory = customErrorFactory;
642
- }
643
- });
644
-
645
543
  // node_modules/url-join/lib/url-join.js
646
544
  var require_url_join = __commonJS({
647
545
  "node_modules/url-join/lib/url-join.js"(exports, module) {
@@ -716,6 +614,7 @@ var starknet = (() => {
716
614
  Contract: () => Contract,
717
615
  ContractFactory: () => ContractFactory,
718
616
  ContractInterface: () => ContractInterface,
617
+ CustomError: () => CustomError,
719
618
  EntryPointType: () => EntryPointType,
720
619
  GatewayError: () => GatewayError,
721
620
  HttpError: () => HttpError,
@@ -735,6 +634,8 @@ var starknet = (() => {
735
634
  defaultProvider: () => defaultProvider,
736
635
  ec: () => ec_exports,
737
636
  encode: () => encode_exports,
637
+ fixProto: () => fixProto,
638
+ fixStack: () => fixStack,
738
639
  getChecksumAddress: () => getChecksumAddress,
739
640
  hash: () => hash_exports,
740
641
  isUrl: () => isUrl,
@@ -10746,8 +10647,27 @@ var starknet = (() => {
10746
10647
  };
10747
10648
 
10748
10649
  // src/provider/errors.ts
10749
- var import_custom_error = __toESM(require_custom_error());
10750
- var LibraryError = class extends import_custom_error.CustomError {
10650
+ function fixStack(target, fn = target.constructor) {
10651
+ const { captureStackTrace } = Error;
10652
+ captureStackTrace && captureStackTrace(target, fn);
10653
+ }
10654
+ function fixProto(target, prototype) {
10655
+ const { setPrototypeOf } = Object;
10656
+ setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
10657
+ }
10658
+ var CustomError = class extends Error {
10659
+ constructor(message) {
10660
+ super(message);
10661
+ Object.defineProperty(this, "name", {
10662
+ value: new.target.name,
10663
+ enumerable: false,
10664
+ configurable: true
10665
+ });
10666
+ fixProto(this, new.target.prototype);
10667
+ fixStack(this);
10668
+ }
10669
+ };
10670
+ var LibraryError = class extends CustomError {
10751
10671
  };
10752
10672
  var GatewayError = class extends LibraryError {
10753
10673
  constructor(message, errorCode) {