starknet 11.10.1 → 11.10.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
@@ -6947,39 +6947,25 @@ function extractCairo0Tuple(type) {
6947
6947
  }
6948
6948
  return recomposed;
6949
6949
  }
6950
- function getClosureOffset(input, open, close) {
6951
- for (let i = 0, counter = 0; i < input.length; i++) {
6952
- if (input[i] === open) {
6953
- counter++;
6954
- } else if (input[i] === close && --counter === 0) {
6955
- return i;
6956
- }
6957
- }
6958
- return Number.POSITIVE_INFINITY;
6959
- }
6960
6950
  function extractCairo1Tuple(type) {
6961
6951
  const input = type.slice(1, -1);
6962
6952
  const result = [];
6953
+ let depth = 0;
6963
6954
  let currentIndex = 0;
6964
- let limitIndex;
6965
- while (currentIndex < input.length) {
6966
- switch (true) {
6967
- // Tuple
6968
- case input[currentIndex] === "(": {
6969
- limitIndex = currentIndex + getClosureOffset(input.slice(currentIndex), "(", ")") + 1;
6970
- break;
6971
- }
6972
- case (input.startsWith("core::result::Result::<", currentIndex) || input.startsWith("core::array::Array::<", currentIndex) || input.startsWith("core::option::Option::<", currentIndex)): {
6973
- limitIndex = currentIndex + getClosureOffset(input.slice(currentIndex), "<", ">") + 1;
6974
- break;
6975
- }
6976
- default: {
6977
- const commaIndex = input.indexOf(",", currentIndex);
6978
- limitIndex = commaIndex !== -1 ? commaIndex : Number.POSITIVE_INFINITY;
6979
- }
6955
+ for (let i = 0; i < input.length; i++) {
6956
+ const char = input[i];
6957
+ if (char === "(" || char === "<" || char === "[") {
6958
+ depth++;
6959
+ } else if (char === ")" || char === ">" || char === "]") {
6960
+ depth--;
6961
+ } else if (char === "," && depth === 0) {
6962
+ result.push(input.slice(currentIndex, i));
6963
+ currentIndex = i + 2;
6964
+ i++;
6980
6965
  }
6981
- result.push(input.slice(currentIndex, limitIndex));
6982
- currentIndex = limitIndex + 2;
6966
+ }
6967
+ if (currentIndex < input.length) {
6968
+ result.push(input.slice(currentIndex));
6983
6969
  }
6984
6970
  return result;
6985
6971
  }