starknet 5.0.0 → 5.0.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.js CHANGED
@@ -65,9 +65,6 @@ __export(src_exports, {
65
65
  });
66
66
  module.exports = __toCommonJS(src_exports);
67
67
 
68
- // src/contract/default.ts
69
- var import_minimalistic_assert4 = __toESM(require("minimalistic-assert"));
70
-
71
68
  // src/types/lib.ts
72
69
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
73
70
  TransactionStatus2["NOT_RECEIVED"] = "NOT_RECEIVED";
@@ -2299,7 +2296,15 @@ __export(number_exports, {
2299
2296
  toHex: () => toHex,
2300
2297
  toHexString: () => toHexString
2301
2298
  });
2302
- var import_minimalistic_assert = __toESM(require("minimalistic-assert"));
2299
+
2300
+ // src/utils/assert.ts
2301
+ function assert(condition, message) {
2302
+ if (!condition) {
2303
+ throw new Error(message || "Assertion failure");
2304
+ }
2305
+ }
2306
+
2307
+ // src/utils/number.ts
2303
2308
  function isHex(hex) {
2304
2309
  return /^0x[0-9a-f]*$/i.test(hex);
2305
2310
  }
@@ -2321,7 +2326,7 @@ function assertInRange(input, lowerBound, upperBound, inputName = "") {
2321
2326
  const inputBigInt = BigInt(input);
2322
2327
  const lowerBoundBigInt = BigInt(lowerBound);
2323
2328
  const upperBoundBigInt = BigInt(upperBound);
2324
- (0, import_minimalistic_assert.default)(
2329
+ assert(
2325
2330
  inputBigInt >= lowerBoundBigInt && inputBigInt <= upperBoundBigInt,
2326
2331
  `Message not signable, ${messageSuffix}.`
2327
2332
  );
@@ -2890,7 +2895,7 @@ function useEncoded(decoded) {
2890
2895
  }
2891
2896
  function getStarknetIdContract(chainId) {
2892
2897
  const starknetIdMainnetContract = "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";
2893
- const starknetIdTestnetContract = "0x05cf267a0af6101667013fc6bd3f6c11116a14cda9b8c4b1198520d59f900b17";
2898
+ const starknetIdTestnetContract = "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";
2894
2899
  switch (chainId) {
2895
2900
  case "0x534e5f4d41494e" /* SN_MAIN */:
2896
2901
  return starknetIdMainnetContract;
@@ -3974,9 +3979,6 @@ var ProviderInterface = class {
3974
3979
  // src/provider/index.ts
3975
3980
  var defaultProvider = new Provider();
3976
3981
 
3977
- // src/utils/calldata/index.ts
3978
- var import_minimalistic_assert3 = __toESM(require("minimalistic-assert"));
3979
-
3980
3982
  // src/utils/calldata/formatter.ts
3981
3983
  var guard = {
3982
3984
  isBN: (data, type, key) => {
@@ -4202,27 +4204,26 @@ function responseParser(responseIterator, output, structs, parsedResult) {
4202
4204
  }
4203
4205
 
4204
4206
  // src/utils/calldata/validate.ts
4205
- var import_minimalistic_assert2 = __toESM(require("minimalistic-assert"));
4206
4207
  var validateFelt = (parameter, input) => {
4207
- (0, import_minimalistic_assert2.default)(
4208
+ assert(
4208
4209
  typeof parameter === "string" || typeof parameter === "number" || typeof parameter === "bigint",
4209
4210
  `Validate: arg ${input.name} should be a felt (string, number, BigNumber)`
4210
4211
  );
4211
4212
  };
4212
4213
  var validateStruct = (parameter, input, structs) => {
4213
- (0, import_minimalistic_assert2.default)(
4214
+ assert(
4214
4215
  typeof parameter === "object" && !Array.isArray(parameter),
4215
4216
  `Validate: arg ${input.name} is cairo type struct (${input.type}), and should be defined as js object (not array)`
4216
4217
  );
4217
4218
  structs[input.type].members.forEach(({ name }) => {
4218
- (0, import_minimalistic_assert2.default)(
4219
+ assert(
4219
4220
  Object.keys(parameter).includes(name),
4220
4221
  `Validate: arg ${input.name} should have a property ${name}`
4221
4222
  );
4222
4223
  });
4223
4224
  };
4224
4225
  var validateTuple = (parameter, input) => {
4225
- (0, import_minimalistic_assert2.default)(
4226
+ assert(
4226
4227
  typeof parameter === "object" && !Array.isArray(parameter),
4227
4228
  `Validate: arg ${input.name} should be a tuple (defined as object)`
4228
4229
  );
@@ -4231,7 +4232,7 @@ var validateArray = (parameter, input, structs) => {
4231
4232
  const baseType = input.type.replace("*", "");
4232
4233
  if (isTypeFelt(baseType) && isLongText(parameter))
4233
4234
  return;
4234
- (0, import_minimalistic_assert2.default)(Array.isArray(parameter), `Validate: arg ${input.name} should be an Array`);
4235
+ assert(Array.isArray(parameter), `Validate: arg ${input.name} should be an Array`);
4235
4236
  switch (true) {
4236
4237
  case isTypeFelt(baseType):
4237
4238
  parameter.forEach((param) => validateFelt(param, input));
@@ -4291,7 +4292,7 @@ var CallData = class {
4291
4292
  const isView = abi.stateMutability === "view";
4292
4293
  return type === "INVOKE" ? !isView : isView;
4293
4294
  }).map((abi) => abi.name);
4294
- (0, import_minimalistic_assert3.default)(
4295
+ assert(
4295
4296
  invocableFunctionNames.includes(method),
4296
4297
  `${type === "INVOKE" ? "invocable" : "viewable"} method not found in abi`
4297
4298
  );
@@ -4490,7 +4491,7 @@ var Contract = class {
4490
4491
  }
4491
4492
  async call(method, args = [], options = { parseRequest: true, parseResponse: true, formatResponse: void 0 }) {
4492
4493
  var _a;
4493
- (0, import_minimalistic_assert4.default)(this.address !== null, "contract is not connected to an address");
4494
+ assert(this.address !== null, "contract is not connected to an address");
4494
4495
  const blockIdentifier = (options == null ? void 0 : options.blockIdentifier) || void 0;
4495
4496
  let calldata = args[0];
4496
4497
  if (options.parseRequest && !((_a = args[0]) == null ? void 0 : _a.compiled)) {
@@ -4518,7 +4519,7 @@ var Contract = class {
4518
4519
  invoke(method, args = [], options = {
4519
4520
  parseRequest: true
4520
4521
  }) {
4521
- (0, import_minimalistic_assert4.default)(this.address !== null, "contract is not connected to an address");
4522
+ assert(this.address !== null, "contract is not connected to an address");
4522
4523
  let calldata = args == null ? void 0 : args[0];
4523
4524
  if (options.parseRequest && !(calldata == null ? void 0 : calldata.compiled)) {
4524
4525
  const { inputs } = this.abi.find((abi) => abi.name === method);
@@ -4552,7 +4553,7 @@ var Contract = class {
4552
4553
  }
4553
4554
  async estimate(method, args = []) {
4554
4555
  var _a;
4555
- (0, import_minimalistic_assert4.default)(this.address !== null, "contract is not connected to an address");
4556
+ assert(this.address !== null, "contract is not connected to an address");
4556
4557
  if (!((_a = args[0]) == null ? void 0 : _a.compiled)) {
4557
4558
  this.callData.validate("INVOKE", method, args);
4558
4559
  }
@@ -4579,7 +4580,6 @@ var ContractInterface = class {
4579
4580
  };
4580
4581
 
4581
4582
  // src/contract/contractFactory.ts
4582
- var import_minimalistic_assert5 = __toESM(require("minimalistic-assert"));
4583
4583
  var ContractFactory = class {
4584
4584
  constructor(compiledContract, classHash, account, abi = compiledContract.abi) {
4585
4585
  this.abi = abi;
@@ -4617,7 +4617,7 @@ var ContractFactory = class {
4617
4617
  constructorCalldata,
4618
4618
  salt: addressSalt
4619
4619
  });
4620
- (0, import_minimalistic_assert5.default)(Boolean(contract_address), "Deployment of the contract failed");
4620
+ assert(Boolean(contract_address), "Deployment of the contract failed");
4621
4621
  const contractInstance = new Contract(
4622
4622
  this.compiledContract.abi,
4623
4623
  contract_address,