@strkfarm/sdk 1.1.5 → 1.1.7

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.
@@ -5719,70 +5719,15 @@ var strkfarm_risk_engine = (() => {
5719
5719
  }
5720
5720
  });
5721
5721
 
5722
- // node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/_assert.js
5723
- var require_assert = __commonJS({
5724
- "node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/_assert.js"(exports) {
5725
- "use strict";
5726
- Object.defineProperty(exports, "__esModule", { value: true });
5727
- exports.anumber = anumber4;
5728
- exports.number = anumber4;
5729
- exports.abytes = abytes4;
5730
- exports.bytes = abytes4;
5731
- exports.ahash = ahash3;
5732
- exports.aexists = aexists3;
5733
- exports.aoutput = aoutput3;
5734
- function anumber4(n) {
5735
- if (!Number.isSafeInteger(n) || n < 0)
5736
- throw new Error("positive integer expected, got " + n);
5737
- }
5738
- function isBytes6(a) {
5739
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
5740
- }
5741
- function abytes4(b, ...lengths) {
5742
- if (!isBytes6(b))
5743
- throw new Error("Uint8Array expected");
5744
- if (lengths.length > 0 && !lengths.includes(b.length))
5745
- throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
5746
- }
5747
- function ahash3(h) {
5748
- if (typeof h !== "function" || typeof h.create !== "function")
5749
- throw new Error("Hash should be wrapped by utils.wrapConstructor");
5750
- anumber4(h.outputLen);
5751
- anumber4(h.blockLen);
5752
- }
5753
- function aexists3(instance, checkFinished = true) {
5754
- if (instance.destroyed)
5755
- throw new Error("Hash instance has been destroyed");
5756
- if (checkFinished && instance.finished)
5757
- throw new Error("Hash#digest() has already been called");
5758
- }
5759
- function aoutput3(out, instance) {
5760
- abytes4(out);
5761
- const min = instance.outputLen;
5762
- if (out.length < min) {
5763
- throw new Error("digestInto() expects output buffer of length at least " + min);
5764
- }
5765
- }
5766
- var assert4 = {
5767
- number: anumber4,
5768
- bytes: abytes4,
5769
- hash: ahash3,
5770
- exists: aexists3,
5771
- output: aoutput3
5772
- };
5773
- exports.default = assert4;
5774
- }
5775
- });
5776
-
5777
- // node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/_u64.js
5722
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/_u64.js
5778
5723
  var require_u64 = __commonJS({
5779
- "node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/_u64.js"(exports) {
5724
+ "node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/_u64.js"(exports) {
5780
5725
  "use strict";
5781
5726
  Object.defineProperty(exports, "__esModule", { value: true });
5782
- exports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = void 0;
5727
+ exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
5728
+ exports.add = add;
5783
5729
  exports.fromBig = fromBig2;
5784
5730
  exports.split = split2;
5785
- exports.add = add;
5786
5731
  var U32_MASK642 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
5787
5732
  var _32n2 = /* @__PURE__ */ BigInt(32);
5788
5733
  function fromBig2(n, le = false) {
@@ -5791,9 +5736,10 @@ var strkfarm_risk_engine = (() => {
5791
5736
  return { h: Number(n >> _32n2 & U32_MASK642) | 0, l: Number(n & U32_MASK642) | 0 };
5792
5737
  }
5793
5738
  function split2(lst, le = false) {
5794
- let Ah = new Uint32Array(lst.length);
5795
- let Al = new Uint32Array(lst.length);
5796
- for (let i = 0; i < lst.length; i++) {
5739
+ const len = lst.length;
5740
+ let Ah = new Uint32Array(len);
5741
+ let Al = new Uint32Array(len);
5742
+ for (let i = 0; i < len; i++) {
5797
5743
  const { h, l } = fromBig2(lst[i], le);
5798
5744
  [Ah[i], Al[i]] = [h, l];
5799
5745
  }
@@ -5869,9 +5815,9 @@ var strkfarm_risk_engine = (() => {
5869
5815
  }
5870
5816
  });
5871
5817
 
5872
- // node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/crypto.js
5818
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/crypto.js
5873
5819
  var require_crypto = __commonJS({
5874
- "node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/crypto.js"(exports) {
5820
+ "node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/crypto.js"(exports) {
5875
5821
  "use strict";
5876
5822
  Object.defineProperty(exports, "__esModule", { value: true });
5877
5823
  exports.crypto = void 0;
@@ -5879,52 +5825,114 @@ var strkfarm_risk_engine = (() => {
5879
5825
  }
5880
5826
  });
5881
5827
 
5882
- // node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/utils.js
5828
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/utils.js
5883
5829
  var require_utils3 = __commonJS({
5884
- "node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/utils.js"(exports) {
5830
+ "node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/utils.js"(exports) {
5885
5831
  "use strict";
5886
5832
  Object.defineProperty(exports, "__esModule", { value: true });
5887
- exports.Hash = exports.nextTick = exports.byteSwapIfBE = exports.byteSwap = exports.isLE = exports.rotl = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;
5833
+ exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
5888
5834
  exports.isBytes = isBytes6;
5835
+ exports.anumber = anumber4;
5836
+ exports.abytes = abytes4;
5837
+ exports.ahash = ahash3;
5838
+ exports.aexists = aexists3;
5839
+ exports.aoutput = aoutput3;
5840
+ exports.u8 = u8;
5841
+ exports.u32 = u322;
5842
+ exports.clean = clean2;
5843
+ exports.createView = createView3;
5844
+ exports.rotr = rotr3;
5845
+ exports.rotl = rotl;
5846
+ exports.byteSwap = byteSwap2;
5889
5847
  exports.byteSwap32 = byteSwap322;
5890
5848
  exports.bytesToHex = bytesToHex3;
5891
5849
  exports.hexToBytes = hexToBytes4;
5892
5850
  exports.asyncLoop = asyncLoop;
5893
5851
  exports.utf8ToBytes = utf8ToBytes4;
5852
+ exports.bytesToUtf8 = bytesToUtf8;
5894
5853
  exports.toBytes = toBytes3;
5854
+ exports.kdfInputToBytes = kdfInputToBytes;
5895
5855
  exports.concatBytes = concatBytes4;
5896
5856
  exports.checkOpts = checkOpts;
5897
- exports.wrapConstructor = wrapConstructor2;
5898
- exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
5899
- exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts2;
5857
+ exports.createHasher = createHasher2;
5858
+ exports.createOptHasher = createOptHasher;
5859
+ exports.createXOFer = createXOFer;
5900
5860
  exports.randomBytes = randomBytes3;
5901
5861
  var crypto_1 = require_crypto();
5902
- var _assert_js_1 = require_assert();
5903
5862
  function isBytes6(a) {
5904
5863
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
5905
5864
  }
5906
- var u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
5907
- exports.u8 = u8;
5908
- var u322 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
5909
- exports.u32 = u322;
5910
- var createView3 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
5911
- exports.createView = createView3;
5912
- var rotr3 = (word, shift) => word << 32 - shift | word >>> shift;
5913
- exports.rotr = rotr3;
5914
- var rotl = (word, shift) => word << shift | word >>> 32 - shift >>> 0;
5915
- exports.rotl = rotl;
5865
+ function anumber4(n) {
5866
+ if (!Number.isSafeInteger(n) || n < 0)
5867
+ throw new Error("positive integer expected, got " + n);
5868
+ }
5869
+ function abytes4(b, ...lengths) {
5870
+ if (!isBytes6(b))
5871
+ throw new Error("Uint8Array expected");
5872
+ if (lengths.length > 0 && !lengths.includes(b.length))
5873
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
5874
+ }
5875
+ function ahash3(h) {
5876
+ if (typeof h !== "function" || typeof h.create !== "function")
5877
+ throw new Error("Hash should be wrapped by utils.createHasher");
5878
+ anumber4(h.outputLen);
5879
+ anumber4(h.blockLen);
5880
+ }
5881
+ function aexists3(instance, checkFinished = true) {
5882
+ if (instance.destroyed)
5883
+ throw new Error("Hash instance has been destroyed");
5884
+ if (checkFinished && instance.finished)
5885
+ throw new Error("Hash#digest() has already been called");
5886
+ }
5887
+ function aoutput3(out, instance) {
5888
+ abytes4(out);
5889
+ const min = instance.outputLen;
5890
+ if (out.length < min) {
5891
+ throw new Error("digestInto() expects output buffer of length at least " + min);
5892
+ }
5893
+ }
5894
+ function u8(arr) {
5895
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
5896
+ }
5897
+ function u322(arr) {
5898
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
5899
+ }
5900
+ function clean2(...arrays) {
5901
+ for (let i = 0; i < arrays.length; i++) {
5902
+ arrays[i].fill(0);
5903
+ }
5904
+ }
5905
+ function createView3(arr) {
5906
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
5907
+ }
5908
+ function rotr3(word, shift) {
5909
+ return word << 32 - shift | word >>> shift;
5910
+ }
5911
+ function rotl(word, shift) {
5912
+ return word << shift | word >>> 32 - shift >>> 0;
5913
+ }
5916
5914
  exports.isLE = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
5917
- var byteSwap2 = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
5918
- exports.byteSwap = byteSwap2;
5919
- exports.byteSwapIfBE = exports.isLE ? (n) => n : (n) => (0, exports.byteSwap)(n);
5915
+ function byteSwap2(word) {
5916
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
5917
+ }
5918
+ exports.swap8IfBE = exports.isLE ? (n) => n : (n) => byteSwap2(n);
5919
+ exports.byteSwapIfBE = exports.swap8IfBE;
5920
5920
  function byteSwap322(arr) {
5921
5921
  for (let i = 0; i < arr.length; i++) {
5922
- arr[i] = (0, exports.byteSwap)(arr[i]);
5922
+ arr[i] = byteSwap2(arr[i]);
5923
5923
  }
5924
+ return arr;
5924
5925
  }
5926
+ exports.swap32IfBE = exports.isLE ? (u) => u : byteSwap322;
5927
+ var hasHexBuiltin2 = /* @__PURE__ */ (() => (
5928
+ // @ts-ignore
5929
+ typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
5930
+ ))();
5925
5931
  var hexes3 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
5926
5932
  function bytesToHex3(bytes) {
5927
- (0, _assert_js_1.abytes)(bytes);
5933
+ abytes4(bytes);
5934
+ if (hasHexBuiltin2)
5935
+ return bytes.toHex();
5928
5936
  let hex = "";
5929
5937
  for (let i = 0; i < bytes.length; i++) {
5930
5938
  hex += hexes3[bytes[i]];
@@ -5944,10 +5952,12 @@ var strkfarm_risk_engine = (() => {
5944
5952
  function hexToBytes4(hex) {
5945
5953
  if (typeof hex !== "string")
5946
5954
  throw new Error("hex string expected, got " + typeof hex);
5955
+ if (hasHexBuiltin2)
5956
+ return Uint8Array.fromHex(hex);
5947
5957
  const hl = hex.length;
5948
5958
  const al = hl / 2;
5949
5959
  if (hl % 2)
5950
- throw new Error("padded hex string expected, got unpadded hex of length " + hl);
5960
+ throw new Error("hex string expected, got unpadded hex of length " + hl);
5951
5961
  const array = new Uint8Array(al);
5952
5962
  for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
5953
5963
  const n1 = asciiToBase163(hex.charCodeAt(hi));
@@ -5976,20 +5986,29 @@ var strkfarm_risk_engine = (() => {
5976
5986
  }
5977
5987
  function utf8ToBytes4(str) {
5978
5988
  if (typeof str !== "string")
5979
- throw new Error("utf8ToBytes expected string, got " + typeof str);
5989
+ throw new Error("string expected");
5980
5990
  return new Uint8Array(new TextEncoder().encode(str));
5981
5991
  }
5992
+ function bytesToUtf8(bytes) {
5993
+ return new TextDecoder().decode(bytes);
5994
+ }
5982
5995
  function toBytes3(data) {
5983
5996
  if (typeof data === "string")
5984
5997
  data = utf8ToBytes4(data);
5985
- (0, _assert_js_1.abytes)(data);
5998
+ abytes4(data);
5999
+ return data;
6000
+ }
6001
+ function kdfInputToBytes(data) {
6002
+ if (typeof data === "string")
6003
+ data = utf8ToBytes4(data);
6004
+ abytes4(data);
5986
6005
  return data;
5987
6006
  }
5988
6007
  function concatBytes4(...arrays) {
5989
6008
  let sum = 0;
5990
6009
  for (let i = 0; i < arrays.length; i++) {
5991
6010
  const a = arrays[i];
5992
- (0, _assert_js_1.abytes)(a);
6011
+ abytes4(a);
5993
6012
  sum += a.length;
5994
6013
  }
5995
6014
  const res = new Uint8Array(sum);
@@ -6000,20 +6019,16 @@ var strkfarm_risk_engine = (() => {
6000
6019
  }
6001
6020
  return res;
6002
6021
  }
6003
- var Hash2 = class {
6004
- // Safe version that clones internal state
6005
- clone() {
6006
- return this._cloneInto();
6007
- }
6008
- };
6009
- exports.Hash = Hash2;
6010
6022
  function checkOpts(defaults2, opts) {
6011
6023
  if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
6012
- throw new Error("Options should be object or undefined");
6024
+ throw new Error("options should be object or undefined");
6013
6025
  const merged = Object.assign(defaults2, opts);
6014
6026
  return merged;
6015
6027
  }
6016
- function wrapConstructor2(hashCons) {
6028
+ var Hash2 = class {
6029
+ };
6030
+ exports.Hash = Hash2;
6031
+ function createHasher2(hashCons) {
6017
6032
  const hashC = (msg) => hashCons().update(toBytes3(msg)).digest();
6018
6033
  const tmp = hashCons();
6019
6034
  hashC.outputLen = tmp.outputLen;
@@ -6021,7 +6036,7 @@ var strkfarm_risk_engine = (() => {
6021
6036
  hashC.create = () => hashCons();
6022
6037
  return hashC;
6023
6038
  }
6024
- function wrapConstructorWithOpts(hashCons) {
6039
+ function createOptHasher(hashCons) {
6025
6040
  const hashC = (msg, opts) => hashCons(opts).update(toBytes3(msg)).digest();
6026
6041
  const tmp = hashCons({});
6027
6042
  hashC.outputLen = tmp.outputLen;
@@ -6029,7 +6044,7 @@ var strkfarm_risk_engine = (() => {
6029
6044
  hashC.create = (opts) => hashCons(opts);
6030
6045
  return hashC;
6031
6046
  }
6032
- function wrapXOFConstructorWithOpts2(hashCons) {
6047
+ function createXOFer(hashCons) {
6033
6048
  const hashC = (msg, opts) => hashCons(opts).update(toBytes3(msg)).digest();
6034
6049
  const tmp = hashCons({});
6035
6050
  hashC.outputLen = tmp.outputLen;
@@ -6037,37 +6052,39 @@ var strkfarm_risk_engine = (() => {
6037
6052
  hashC.create = (opts) => hashCons(opts);
6038
6053
  return hashC;
6039
6054
  }
6055
+ exports.wrapConstructor = createHasher2;
6056
+ exports.wrapConstructorWithOpts = createOptHasher;
6057
+ exports.wrapXOFConstructorWithOpts = createXOFer;
6040
6058
  function randomBytes3(bytesLength = 32) {
6041
6059
  if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
6042
6060
  return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
6043
6061
  }
6044
6062
  if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") {
6045
- return crypto_1.crypto.randomBytes(bytesLength);
6063
+ return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
6046
6064
  }
6047
6065
  throw new Error("crypto.getRandomValues must be defined");
6048
6066
  }
6049
6067
  }
6050
6068
  });
6051
6069
 
6052
- // node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/sha3.js
6070
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/sha3.js
6053
6071
  var require_sha3 = __commonJS({
6054
- "node_modules/.pnpm/@noble+hashes@1.6.0/node_modules/@noble/hashes/sha3.js"(exports) {
6072
+ "node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/sha3.js"(exports) {
6055
6073
  "use strict";
6056
6074
  Object.defineProperty(exports, "__esModule", { value: true });
6057
6075
  exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = void 0;
6058
6076
  exports.keccakP = keccakP2;
6059
- var _assert_js_1 = require_assert();
6060
- var _u64_js_1 = require_u64();
6061
- var utils_js_1 = require_utils3();
6077
+ var _u64_ts_1 = require_u64();
6078
+ var utils_ts_1 = require_utils3();
6079
+ var _0n11 = BigInt(0);
6080
+ var _1n11 = BigInt(1);
6081
+ var _2n8 = BigInt(2);
6082
+ var _7n3 = BigInt(7);
6083
+ var _256n2 = BigInt(256);
6084
+ var _0x71n2 = BigInt(113);
6062
6085
  var SHA3_PI2 = [];
6063
6086
  var SHA3_ROTL2 = [];
6064
6087
  var _SHA3_IOTA2 = [];
6065
- var _0n11 = /* @__PURE__ */ BigInt(0);
6066
- var _1n11 = /* @__PURE__ */ BigInt(1);
6067
- var _2n8 = /* @__PURE__ */ BigInt(2);
6068
- var _7n3 = /* @__PURE__ */ BigInt(7);
6069
- var _256n2 = /* @__PURE__ */ BigInt(256);
6070
- var _0x71n2 = /* @__PURE__ */ BigInt(113);
6071
6088
  for (let round = 0, R = _1n11, x = 1, y = 0; round < 24; round++) {
6072
6089
  [x, y] = [y, (2 * x + 3 * y) % 5];
6073
6090
  SHA3_PI2.push(2 * (5 * y + x));
@@ -6080,9 +6097,11 @@ var strkfarm_risk_engine = (() => {
6080
6097
  }
6081
6098
  _SHA3_IOTA2.push(t);
6082
6099
  }
6083
- var [SHA3_IOTA_H2, SHA3_IOTA_L2] = /* @__PURE__ */ (0, _u64_js_1.split)(_SHA3_IOTA2, true);
6084
- var rotlH2 = (h, l, s) => s > 32 ? (0, _u64_js_1.rotlBH)(h, l, s) : (0, _u64_js_1.rotlSH)(h, l, s);
6085
- var rotlL2 = (h, l, s) => s > 32 ? (0, _u64_js_1.rotlBL)(h, l, s) : (0, _u64_js_1.rotlSL)(h, l, s);
6100
+ var IOTAS = (0, _u64_ts_1.split)(_SHA3_IOTA2, true);
6101
+ var SHA3_IOTA_H2 = IOTAS[0];
6102
+ var SHA3_IOTA_L2 = IOTAS[1];
6103
+ var rotlH2 = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBH)(h, l, s) : (0, _u64_ts_1.rotlSH)(h, l, s);
6104
+ var rotlL2 = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBL)(h, l, s) : (0, _u64_ts_1.rotlSL)(h, l, s);
6086
6105
  function keccakP2(s, rounds = 24) {
6087
6106
  const B = new Uint32Array(5 * 2);
6088
6107
  for (let round = 24 - rounds; round < 24; round++) {
@@ -6121,40 +6140,43 @@ var strkfarm_risk_engine = (() => {
6121
6140
  s[0] ^= SHA3_IOTA_H2[round];
6122
6141
  s[1] ^= SHA3_IOTA_L2[round];
6123
6142
  }
6124
- B.fill(0);
6143
+ (0, utils_ts_1.clean)(B);
6125
6144
  }
6126
- var Keccak2 = class _Keccak extends utils_js_1.Hash {
6145
+ var Keccak2 = class _Keccak extends utils_ts_1.Hash {
6127
6146
  // NOTE: we accept arguments in bytes instead of bits here.
6128
6147
  constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
6129
6148
  super();
6149
+ this.pos = 0;
6150
+ this.posOut = 0;
6151
+ this.finished = false;
6152
+ this.destroyed = false;
6153
+ this.enableXOF = false;
6130
6154
  this.blockLen = blockLen;
6131
6155
  this.suffix = suffix;
6132
6156
  this.outputLen = outputLen;
6133
6157
  this.enableXOF = enableXOF;
6134
6158
  this.rounds = rounds;
6135
- this.pos = 0;
6136
- this.posOut = 0;
6137
- this.finished = false;
6138
- this.destroyed = false;
6139
- (0, _assert_js_1.anumber)(outputLen);
6140
- if (0 >= this.blockLen || this.blockLen >= 200)
6141
- throw new Error("Sha3 supports only keccak-f1600 function");
6159
+ (0, utils_ts_1.anumber)(outputLen);
6160
+ if (!(0 < blockLen && blockLen < 200))
6161
+ throw new Error("only keccak-f1600 function is supported");
6142
6162
  this.state = new Uint8Array(200);
6143
- this.state32 = (0, utils_js_1.u32)(this.state);
6163
+ this.state32 = (0, utils_ts_1.u32)(this.state);
6164
+ }
6165
+ clone() {
6166
+ return this._cloneInto();
6144
6167
  }
6145
6168
  keccak() {
6146
- if (!utils_js_1.isLE)
6147
- (0, utils_js_1.byteSwap32)(this.state32);
6169
+ (0, utils_ts_1.swap32IfBE)(this.state32);
6148
6170
  keccakP2(this.state32, this.rounds);
6149
- if (!utils_js_1.isLE)
6150
- (0, utils_js_1.byteSwap32)(this.state32);
6171
+ (0, utils_ts_1.swap32IfBE)(this.state32);
6151
6172
  this.posOut = 0;
6152
6173
  this.pos = 0;
6153
6174
  }
6154
6175
  update(data) {
6155
- (0, _assert_js_1.aexists)(this);
6176
+ (0, utils_ts_1.aexists)(this);
6177
+ data = (0, utils_ts_1.toBytes)(data);
6178
+ (0, utils_ts_1.abytes)(data);
6156
6179
  const { blockLen, state } = this;
6157
- data = (0, utils_js_1.toBytes)(data);
6158
6180
  const len = data.length;
6159
6181
  for (let pos = 0; pos < len; ) {
6160
6182
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -6177,8 +6199,8 @@ var strkfarm_risk_engine = (() => {
6177
6199
  this.keccak();
6178
6200
  }
6179
6201
  writeInto(out) {
6180
- (0, _assert_js_1.aexists)(this, false);
6181
- (0, _assert_js_1.abytes)(out);
6202
+ (0, utils_ts_1.aexists)(this, false);
6203
+ (0, utils_ts_1.abytes)(out);
6182
6204
  this.finish();
6183
6205
  const bufferOut = this.state;
6184
6206
  const { blockLen } = this;
@@ -6198,11 +6220,11 @@ var strkfarm_risk_engine = (() => {
6198
6220
  return this.writeInto(out);
6199
6221
  }
6200
6222
  xof(bytes) {
6201
- (0, _assert_js_1.anumber)(bytes);
6223
+ (0, utils_ts_1.anumber)(bytes);
6202
6224
  return this.xofInto(new Uint8Array(bytes));
6203
6225
  }
6204
6226
  digestInto(out) {
6205
- (0, _assert_js_1.aoutput)(out, this);
6227
+ (0, utils_ts_1.aoutput)(out, this);
6206
6228
  if (this.finished)
6207
6229
  throw new Error("digest() was already called");
6208
6230
  this.writeInto(out);
@@ -6214,7 +6236,7 @@ var strkfarm_risk_engine = (() => {
6214
6236
  }
6215
6237
  destroy() {
6216
6238
  this.destroyed = true;
6217
- this.state.fill(0);
6239
+ (0, utils_ts_1.clean)(this.state);
6218
6240
  }
6219
6241
  _cloneInto(to) {
6220
6242
  const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
@@ -6232,23 +6254,23 @@ var strkfarm_risk_engine = (() => {
6232
6254
  }
6233
6255
  };
6234
6256
  exports.Keccak = Keccak2;
6235
- var gen2 = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak2(blockLen, suffix, outputLen));
6236
- exports.sha3_224 = gen2(6, 144, 224 / 8);
6237
- exports.sha3_256 = gen2(6, 136, 256 / 8);
6238
- exports.sha3_384 = gen2(6, 104, 384 / 8);
6239
- exports.sha3_512 = gen2(6, 72, 512 / 8);
6240
- exports.keccak_224 = gen2(1, 144, 224 / 8);
6241
- exports.keccak_256 = gen2(1, 136, 256 / 8);
6242
- exports.keccak_384 = gen2(1, 104, 384 / 8);
6243
- exports.keccak_512 = gen2(1, 72, 512 / 8);
6244
- var genShake2 = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapXOFConstructorWithOpts)((opts = {}) => new Keccak2(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
6245
- exports.shake128 = genShake2(31, 168, 128 / 8);
6246
- exports.shake256 = genShake2(31, 136, 256 / 8);
6257
+ var gen2 = (suffix, blockLen, outputLen) => (0, utils_ts_1.createHasher)(() => new Keccak2(blockLen, suffix, outputLen));
6258
+ exports.sha3_224 = (() => gen2(6, 144, 224 / 8))();
6259
+ exports.sha3_256 = (() => gen2(6, 136, 256 / 8))();
6260
+ exports.sha3_384 = (() => gen2(6, 104, 384 / 8))();
6261
+ exports.sha3_512 = (() => gen2(6, 72, 512 / 8))();
6262
+ exports.keccak_224 = (() => gen2(1, 144, 224 / 8))();
6263
+ exports.keccak_256 = (() => gen2(1, 136, 256 / 8))();
6264
+ exports.keccak_384 = (() => gen2(1, 104, 384 / 8))();
6265
+ exports.keccak_512 = (() => gen2(1, 72, 512 / 8))();
6266
+ var genShake2 = (suffix, blockLen, outputLen) => (0, utils_ts_1.createXOFer)((opts = {}) => new Keccak2(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
6267
+ exports.shake128 = (() => genShake2(31, 168, 128 / 8))();
6268
+ exports.shake256 = (() => genShake2(31, 136, 256 / 8))();
6247
6269
  }
6248
6270
  });
6249
6271
 
6250
6272
  // node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/_assert.js
6251
- var require_assert2 = __commonJS({
6273
+ var require_assert = __commonJS({
6252
6274
  "node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/_assert.js"(exports) {
6253
6275
  "use strict";
6254
6276
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6571,7 +6593,7 @@ var strkfarm_risk_engine = (() => {
6571
6593
  "use strict";
6572
6594
  Object.defineProperty(exports, "__esModule", { value: true });
6573
6595
  exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = exports.keccakP = void 0;
6574
- var _assert_js_1 = require_assert2();
6596
+ var _assert_js_1 = require_assert();
6575
6597
  var _u64_js_1 = require_u642();
6576
6598
  var utils_js_1 = require_utils4();
6577
6599
  var [SHA3_PI2, SHA3_ROTL2, _SHA3_IOTA2] = [[], [], []];
@@ -6763,7 +6785,7 @@ var strkfarm_risk_engine = (() => {
6763
6785
  "use strict";
6764
6786
  Object.defineProperty(exports, "__esModule", { value: true });
6765
6787
  exports.SHA2 = void 0;
6766
- var _assert_js_1 = require_assert2();
6788
+ var _assert_js_1 = require_assert();
6767
6789
  var utils_js_1 = require_utils4();
6768
6790
  function setBigUint642(view, byteOffset, value, isLE2) {
6769
6791
  if (typeof view.setBigUint64 === "function")
@@ -8760,7 +8782,7 @@ var strkfarm_risk_engine = (() => {
8760
8782
  "use strict";
8761
8783
  Object.defineProperty(exports, "__esModule", { value: true });
8762
8784
  exports.hmac = exports.HMAC = void 0;
8763
- var _assert_js_1 = require_assert2();
8785
+ var _assert_js_1 = require_assert();
8764
8786
  var utils_js_1 = require_utils4();
8765
8787
  var HMAC2 = class extends utils_js_1.Hash {
8766
8788
  constructor(hash2, _key) {
@@ -15206,7 +15228,7 @@ ${r2}}` : "}", l2;
15206
15228
  });
15207
15229
 
15208
15230
  // node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/_assert.js
15209
- var require_assert3 = __commonJS({
15231
+ var require_assert2 = __commonJS({
15210
15232
  "node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/_assert.js"(exports) {
15211
15233
  "use strict";
15212
15234
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -15276,7 +15298,7 @@ ${r2}}` : "}", l2;
15276
15298
  Object.defineProperty(exports, "__esModule", { value: true });
15277
15299
  exports.randomBytes = exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.byteSwap32 = exports.byteSwapIfBE = exports.byteSwap = exports.isLE = exports.rotl = exports.rotr = exports.createView = exports.u32 = exports.u8 = exports.isBytes = void 0;
15278
15300
  var crypto_1 = require_crypto3();
15279
- var _assert_js_1 = require_assert3();
15301
+ var _assert_js_1 = require_assert2();
15280
15302
  function isBytes6(a) {
15281
15303
  return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
15282
15304
  }
@@ -15443,7 +15465,7 @@ ${r2}}` : "}", l2;
15443
15465
  "use strict";
15444
15466
  Object.defineProperty(exports, "__esModule", { value: true });
15445
15467
  exports.HashMD = exports.Maj = exports.Chi = void 0;
15446
- var _assert_js_1 = require_assert3();
15468
+ var _assert_js_1 = require_assert2();
15447
15469
  var utils_js_1 = require_utils6();
15448
15470
  function setBigUint642(view, byteOffset, value, isLE2) {
15449
15471
  if (typeof view.setBigUint64 === "function")
@@ -15731,7 +15753,7 @@ ${r2}}` : "}", l2;
15731
15753
  "use strict";
15732
15754
  Object.defineProperty(exports, "__esModule", { value: true });
15733
15755
  exports.hmac = exports.HMAC = void 0;
15734
- var _assert_js_1 = require_assert3();
15756
+ var _assert_js_1 = require_assert2();
15735
15757
  var utils_js_1 = require_utils6();
15736
15758
  var HMAC2 = class extends utils_js_1.Hash {
15737
15759
  constructor(hash2, _key) {
@@ -31475,7 +31497,7 @@ ${r2}}` : "}", l2;
31475
31497
  // node_modules/.pnpm/@starknet-io+types-js@0.8.4/node_modules/@starknet-io/types-js/dist/esm/snip-29/index.js
31476
31498
  var snip_29_exports = {};
31477
31499
 
31478
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/index.js
31500
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/index.js
31479
31501
  var esm_exports2 = {};
31480
31502
  __export(esm_exports2, {
31481
31503
  ABI_TYPE_CONSTRUCTOR: () => ABI_TYPE_CONSTRUCTOR2,
@@ -31523,7 +31545,7 @@ ${r2}}` : "}", l2;
31523
31545
  WALLET_API: () => wallet_api_exports2
31524
31546
  });
31525
31547
 
31526
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/api/index.js
31548
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/api/index.js
31527
31549
  var api_exports2 = {};
31528
31550
  __export(api_exports2, {
31529
31551
  ABI_TYPE_CONSTRUCTOR: () => ABI_TYPE_CONSTRUCTOR2,
@@ -31566,10 +31588,10 @@ ${r2}}` : "}", l2;
31566
31588
  TXN_TYPE_L1_HANDLER: () => TXN_TYPE_L1_HANDLER2
31567
31589
  });
31568
31590
 
31569
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/api/contract.js
31591
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/api/contract.js
31570
31592
  var contract_exports2 = {};
31571
31593
 
31572
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/api/constants.js
31594
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/api/constants.js
31573
31595
  var STATUS_ACCEPTED_ON_L22 = "ACCEPTED_ON_L2";
31574
31596
  var STATUS_ACCEPTED_ON_L12 = "ACCEPTED_ON_L1";
31575
31597
  var STATUS_SUCCEEDED2 = "SUCCEEDED";
@@ -31697,25 +31719,25 @@ ${r2}}` : "}", l2;
31697
31719
  F3: ETransactionVersion4.F3
31698
31720
  };
31699
31721
 
31700
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/wallet-api/index.js
31722
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/wallet-api/index.js
31701
31723
  var wallet_api_exports2 = {};
31702
31724
  __export(wallet_api_exports2, {
31703
31725
  Permission: () => Permission2,
31704
31726
  TypedDataRevision: () => TypedDataRevision3
31705
31727
  });
31706
31728
 
31707
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/wallet-api/constants.js
31729
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/wallet-api/constants.js
31708
31730
  var Permission2 = {
31709
31731
  ACCOUNTS: "accounts"
31710
31732
  };
31711
31733
 
31712
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/wallet-api/typedData.js
31734
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/wallet-api/typedData.js
31713
31735
  var TypedDataRevision3 = {
31714
31736
  ACTIVE: "1",
31715
31737
  LEGACY: "0"
31716
31738
  };
31717
31739
 
31718
- // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/snip-29/index.js
31740
+ // node_modules/.pnpm/@starknet-io+types-js@0.9.1/node_modules/@starknet-io/types-js/dist/esm/snip-29/index.js
31719
31741
  var snip_29_exports2 = {};
31720
31742
 
31721
31743
  // node_modules/.pnpm/@scure+base@1.2.1/node_modules/@scure/base/lib/esm/index.js
@@ -39534,7 +39556,7 @@ ${indent}}` : "}";
39534
39556
  var _0n6 = BigInt(0);
39535
39557
  var Point = secp256k1.ProjectivePoint;
39536
39558
 
39537
- // node_modules/.pnpm/starknet@8.5.3/node_modules/starknet/dist/index.mjs
39559
+ // node_modules/.pnpm/starknet@8.5.2/node_modules/starknet/dist/index.mjs
39538
39560
  init_esm();
39539
39561
  var __defProp2 = Object.defineProperty;
39540
39562
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -40567,8 +40589,7 @@ ${JSON.stringify(data, null, 2)}`;
40567
40589
  */
40568
40590
  __publicField(this, "data");
40569
40591
  _a3.validate(data);
40570
- const processedData = _a3.__processData(data);
40571
- this.data = processedData.subarray(processedData.findIndex((x) => x > 0));
40592
+ this.data = _a3.__processData(data);
40572
40593
  }
40573
40594
  static __processData(data) {
40574
40595
  if (isString2(data)) {
@@ -41150,9 +41171,7 @@ ${JSON.stringify(data, null, 2)}`;
41150
41171
  constructor(data) {
41151
41172
  __publicField(this, "data");
41152
41173
  _a6.validate(data);
41153
- const processedData = _a6.__processData(data);
41154
- this.data = new Uint8Array(_a6.MAX_BYTE_SIZE);
41155
- this.data.set(processedData, _a6.MAX_BYTE_SIZE - processedData.length);
41174
+ this.data = _a6.__processData(data);
41156
41175
  }
41157
41176
  static __processData(data) {
41158
41177
  if (isString2(data)) {
@@ -41173,16 +41192,11 @@ ${JSON.stringify(data, null, 2)}`;
41173
41192
  return uint8ArrayToBigInt(this.data);
41174
41193
  }
41175
41194
  decodeUtf8() {
41176
- const cutoff = this.data.findIndex((x) => x > 0);
41177
- const pruned = this.data.subarray(cutoff >= 0 ? cutoff : Infinity);
41178
- return new TextDecoder().decode(pruned);
41195
+ return new TextDecoder().decode(this.data);
41179
41196
  }
41180
- /**
41181
- * @param padded flag for including leading zeros
41182
- */
41183
- toHexString(padded) {
41184
- const hex = padded === "padded" ? buf2hex(this.data) : this.toBigInt().toString(16);
41185
- return addHexPrefix(hex);
41197
+ toHexString() {
41198
+ const hexValue2 = this.data.length === 0 ? "0" : buf2hex(this.data);
41199
+ return addHexPrefix(hexValue2);
41186
41200
  }
41187
41201
  static validate(data) {
41188
41202
  const byteLength = _a6.__processData(data).length;
@@ -41455,11 +41469,11 @@ ${JSON.stringify(data, null, 2)}`;
41455
41469
  ]);
41456
41470
  }
41457
41471
  decodeUtf8() {
41458
- const allBytes = concatenateArrayBuffer(this.toElements());
41472
+ const allBytes = this.reconstructBytes();
41459
41473
  return new TextDecoder().decode(allBytes);
41460
41474
  }
41461
41475
  toBigInt() {
41462
- const allBytes = concatenateArrayBuffer(this.toElements());
41476
+ const allBytes = this.reconstructBytes();
41463
41477
  if (allBytes.length === 0) {
41464
41478
  return 0n;
41465
41479
  }
@@ -41470,38 +41484,14 @@ ${JSON.stringify(data, null, 2)}`;
41470
41484
  return result;
41471
41485
  }
41472
41486
  toHexString() {
41473
- const allBytes = concatenateArrayBuffer(this.toElements());
41487
+ const allBytes = this.reconstructBytes();
41474
41488
  const hexValue2 = allBytes.length === 0 ? "0" : buf2hex(allBytes);
41475
41489
  return addHexPrefix(hexValue2);
41476
41490
  }
41477
41491
  toBuffer() {
41478
- const allBytes = concatenateArrayBuffer(this.toElements());
41479
- return buffer_default.from(allBytes);
41480
- }
41481
- /**
41482
- * returns an array of all the data chunks and the pending word
41483
- * when concatenated, represents the original bytes sequence
41484
- */
41485
- toElements() {
41486
41492
  this.assertInitialized();
41487
- const allChunks = this.data.flatMap((chunk) => chunk.data);
41488
- const pendingLen = Number(this.pending_word_len.toBigInt());
41489
- if (pendingLen) {
41490
- const pending = new Uint8Array(pendingLen);
41491
- const paddingDifference = pendingLen - this.pending_word.data.length;
41492
- pending.set(this.pending_word.data, paddingDifference);
41493
- allChunks.push(pending);
41494
- }
41495
- return allChunks;
41496
- }
41497
- /**
41498
- * Private helper to check if the CairoByteArray is properly initialized
41499
- */
41500
- assertInitialized() {
41501
- assert(
41502
- this.data && this.pending_word !== void 0 && this.pending_word_len !== void 0,
41503
- "CairoByteArray is not properly initialized"
41504
- );
41493
+ const allBytes = this.reconstructBytes();
41494
+ return buffer_default.from(allBytes);
41505
41495
  }
41506
41496
  static validate(data) {
41507
41497
  assert(data !== null && data !== void 0, "Invalid input: null or undefined");
@@ -41550,6 +41540,30 @@ ${JSON.stringify(data, null, 2)}`;
41550
41540
  static isAbiType(abiType) {
41551
41541
  return abiType === _a8.abiSelector;
41552
41542
  }
41543
+ /**
41544
+ * Private helper to check if the CairoByteArray is properly initialized
41545
+ */
41546
+ assertInitialized() {
41547
+ assert(
41548
+ this.data && this.pending_word !== void 0 && this.pending_word_len !== void 0,
41549
+ "CairoByteArray is not properly initialized"
41550
+ );
41551
+ }
41552
+ /**
41553
+ * Private helper to reconstruct the full byte sequence from chunks and pending word
41554
+ */
41555
+ reconstructBytes() {
41556
+ this.assertInitialized();
41557
+ const allChunks = this.data.flatMap((chunk) => chunk.data);
41558
+ const pendingLen = Number(this.pending_word_len.toBigInt());
41559
+ if (pendingLen) {
41560
+ const pending = new Uint8Array(pendingLen);
41561
+ const paddingDifference = pendingLen - this.pending_word.data.length;
41562
+ pending.set(this.pending_word.data, paddingDifference);
41563
+ allChunks.push(pending);
41564
+ }
41565
+ return concatenateArrayBuffer(allChunks);
41566
+ }
41553
41567
  static factoryFromApiResponse(responseIterator) {
41554
41568
  const data = Array.from(
41555
41569
  { length: Number(getNext(responseIterator)) },
@@ -49088,6 +49102,7 @@ ${JSON.stringify(data, null, 2)}`;
49088
49102
  address: ContractAddr.from("0x0593e034dda23eea82d2ba9a30960ed42cf4a01502cc2351dc9b9881f9931a68"),
49089
49103
  decimals: 18,
49090
49104
  coingeckId: void 0,
49105
+ priceProxySymbol: "WBTC",
49091
49106
  displayDecimals: 6,
49092
49107
  priceCheckAmount: 1e-4
49093
49108
  // 112000 * 0.0001 = $11.2
@@ -49099,6 +49114,40 @@ ${JSON.stringify(data, null, 2)}`;
49099
49114
  decimals: 8,
49100
49115
  coingeckId: void 0,
49101
49116
  displayDecimals: 6,
49117
+ priceProxySymbol: "WBTC",
49118
+ priceCheckAmount: 1e-4
49119
+ // 112000 * 0.0001 = $11.2
49120
+ }, {
49121
+ name: "xWBTC",
49122
+ symbol: "xWBTC",
49123
+ logo: "https://assets.strkfarm.com/integrations/tokens/xwbtc.svg",
49124
+ address: ContractAddr.from("0x6a567e68c805323525fe1649adb80b03cddf92c23d2629a6779f54192dffc13"),
49125
+ decimals: 8,
49126
+ coingeckId: void 0,
49127
+ displayDecimals: 6,
49128
+ priceProxySymbol: "WBTC",
49129
+ priceCheckAmount: 1e-4
49130
+ // 112000 * 0.0001 = $11.2
49131
+ }, {
49132
+ name: "xsBTC",
49133
+ symbol: "xsBTC",
49134
+ logo: "https://assets.strkfarm.com/integrations/tokens/xsbtc_solv.svg",
49135
+ address: ContractAddr.from("0x580f3dc564a7b82f21d40d404b3842d490ae7205e6ac07b1b7af2b4a5183dc9"),
49136
+ decimals: 18,
49137
+ coingeckId: void 0,
49138
+ displayDecimals: 6,
49139
+ priceProxySymbol: "WBTC",
49140
+ priceCheckAmount: 1e-4
49141
+ // 112000 * 0.0001 = $11.2
49142
+ }, {
49143
+ name: "xtBTC",
49144
+ symbol: "xtBTC",
49145
+ logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
49146
+ address: ContractAddr.from("0x43a35c1425a0125ef8c171f1a75c6f31ef8648edcc8324b55ce1917db3f9b91"),
49147
+ decimals: 8,
49148
+ coingeckId: void 0,
49149
+ displayDecimals: 6,
49150
+ priceProxySymbol: "WBTC",
49102
49151
  priceCheckAmount: 1e-4
49103
49152
  // 112000 * 0.0001 = $11.2
49104
49153
  }];
@@ -49188,9 +49237,11 @@ ${JSON.stringify(data, null, 2)}`;
49188
49237
  // src/modules/pricer.ts
49189
49238
  var Pricer = class extends PricerBase {
49190
49239
  // e.g. ETH/USDC
49191
- constructor(config3, tokens2) {
49240
+ constructor(config3, tokens2, refreshInterval = 3e4, staleTime = 6e4) {
49192
49241
  super(config3, tokens2);
49193
49242
  this.prices = {};
49243
+ this.refreshInterval = 3e4;
49244
+ this.staleTime = 6e4;
49194
49245
  // code populates this map during runtime to determine which method to use for a given token
49195
49246
  // The method set will be the first one to try after first attempt
49196
49247
  this.methodToUse = {};
@@ -49199,6 +49250,8 @@ ${JSON.stringify(data, null, 2)}`;
49199
49250
  */
49200
49251
  this.PRICE_API = `https://api.coinbase.com/v2/prices/{{PRICER_KEY}}/buy`;
49201
49252
  this.EKUBO_API = "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_ADDRESS}}/0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8";
49253
+ this.refreshInterval = refreshInterval;
49254
+ this.staleTime = staleTime;
49202
49255
  }
49203
49256
  isReady() {
49204
49257
  const allPricesExist = Object.keys(this.prices).length === this.tokens.length;
@@ -49231,10 +49284,10 @@ ${JSON.stringify(data, null, 2)}`;
49231
49284
  this._loadPrices();
49232
49285
  setInterval(() => {
49233
49286
  this._loadPrices();
49234
- }, 3e4);
49287
+ }, this.refreshInterval);
49235
49288
  }
49236
49289
  isStale(timestamp, tokenName) {
49237
- const STALE_TIME = 6e4;
49290
+ const STALE_TIME = this.staleTime;
49238
49291
  return (/* @__PURE__ */ new Date()).getTime() - timestamp.getTime() > STALE_TIME;
49239
49292
  }
49240
49293
  assertNotStale(timestamp, tokenName) {
@@ -49260,13 +49313,25 @@ ${JSON.stringify(data, null, 2)}`;
49260
49313
  onUpdate(token.symbol);
49261
49314
  return;
49262
49315
  }
49263
- const price = await this._getPrice(token);
49264
- this.prices[token.symbol] = {
49265
- price,
49266
- timestamp: /* @__PURE__ */ new Date()
49267
- };
49316
+ if (token.priceProxySymbol) {
49317
+ const proxyToken = this.tokens.find((t) => t.symbol === token.priceProxySymbol);
49318
+ if (!proxyToken) {
49319
+ throw new FatalError(`Price proxy token ${token.priceProxySymbol} not found`);
49320
+ }
49321
+ const price = await this._getPrice(proxyToken);
49322
+ this.prices[token.symbol] = {
49323
+ price,
49324
+ timestamp: /* @__PURE__ */ new Date()
49325
+ };
49326
+ } else {
49327
+ const price = await this._getPrice(token);
49328
+ this.prices[token.symbol] = {
49329
+ price,
49330
+ timestamp: /* @__PURE__ */ new Date()
49331
+ };
49332
+ }
49268
49333
  onUpdate(token.symbol);
49269
- logger2.verbose(`Fetched price of ${token.name} as ${price}`);
49334
+ logger2.verbose(`Fetched price of ${token.name} as ${this.prices[token.symbol].price}`);
49270
49335
  break;
49271
49336
  } catch (error2) {
49272
49337
  if (retry < MAX_RETRIES) {
@@ -51056,7 +51121,7 @@ ${JSON.stringify(data, null, 2)}`;
51056
51121
  return "0x" + result;
51057
51122
  }
51058
51123
 
51059
- // node_modules/.pnpm/@avnu+avnu-sdk@3.0.2_ethers@6.15.0_moment@2.30.1_qs@6.14.0_starknet@8.5.3/node_modules/@avnu/avnu-sdk/dist/index.mjs
51124
+ // node_modules/.pnpm/@avnu+avnu-sdk@3.0.2_ethers@6.15.0_moment@2.30.1_qs@6.14.0_starknet@8.5.2/node_modules/@avnu/avnu-sdk/dist/index.mjs
51060
51125
  var import_qs = __toESM(require_lib(), 1);
51061
51126
  var BASE_URL = "https://starknet.api.avnu.fi";
51062
51127
  var ContractError = class {
@@ -55379,6 +55444,16 @@ ${JSON.stringify(data, null, 2)}`;
55379
55444
  return res.data;
55380
55445
  }
55381
55446
 
55447
+ // src/strategies/constants.ts
55448
+ var COMMON_CONTRACTS = [{
55449
+ address: ContractAddr.from("0x0636a3f51cc37f5729e4da4b1de6a8549a28f3c0d5bf3b17f150971e451ff9c2"),
55450
+ name: "Access Controller",
55451
+ sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/blob/main/src/components/accessControl.cairo"
55452
+ }];
55453
+ var ENDPOINTS = {
55454
+ VESU_BASE: "https://cache-server-t2me.onrender.com/vesu"
55455
+ };
55456
+
55382
55457
  // src/modules/harvests.ts
55383
55458
  var Harvests = class _Harvests {
55384
55459
  constructor(config3) {
@@ -55439,7 +55514,7 @@ ${JSON.stringify(data, null, 2)}`;
55439
55514
  var VESU_REWARDS_CONTRACT = ContractAddr.from("0x0387f3eb1d98632fbe3440a9f1385Aec9d87b6172491d3Dd81f1c35A7c61048F");
55440
55515
  var VesuHarvests = class _VesuHarvests extends Harvests {
55441
55516
  async getHarvests(addr) {
55442
- const result = await fetch(`https://api.vesu.xyz/users/${addr.address}/strk-rewards/calldata`);
55517
+ const result = await fetch(`${ENDPOINTS.VESU_BASE}/users/${addr.address}/strk-rewards/calldata`);
55443
55518
  const data = await result.json();
55444
55519
  const rewardsContract = VESU_REWARDS_CONTRACT;
55445
55520
  const cls = await this.config.provider.getClassAt(rewardsContract.address);
@@ -60917,13 +60992,6 @@ ${JSON.stringify(data, null, 2)}`;
60917
60992
  ]
60918
60993
  };
60919
60994
 
60920
- // src/strategies/constants.ts
60921
- var COMMON_CONTRACTS = [{
60922
- address: ContractAddr.from("0x0636a3f51cc37f5729e4da4b1de6a8549a28f3c0d5bf3b17f150971e451ff9c2"),
60923
- name: "Access Controller",
60924
- sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/blob/main/src/components/accessControl.cairo"
60925
- }];
60926
-
60927
60995
  // src/strategies/vesu-rebalance.tsx
60928
60996
  var import_jsx_runtime2 = __toESM(require_jsx_runtime());
60929
60997
  var VesuRebalance = class _VesuRebalance extends BaseStrategy {
@@ -61052,7 +61120,7 @@ ${JSON.stringify(data, null, 2)}`;
61052
61120
  };
61053
61121
  }
61054
61122
  static async getAllPossibleVerifiedPools(asset) {
61055
- const data = await getAPIUsingHeadlessBrowser("https://api.vesu.xyz/pools");
61123
+ const data = await getAPIUsingHeadlessBrowser(`${ENDPOINTS.VESU_BASE}/pools`);
61056
61124
  const verifiedPools = data.data.filter((d) => d.isVerified);
61057
61125
  const pools = verifiedPools.map((p) => {
61058
61126
  const hasMyAsset = p.assets.find((a) => asset.eqString(a.address));
@@ -61229,7 +61297,7 @@ ${JSON.stringify(data, null, 2)}`;
61229
61297
  let pools = [];
61230
61298
  try {
61231
61299
  const data = await getAPIUsingHeadlessBrowser(
61232
- "https://api.vesu.xyz/pools"
61300
+ `${ENDPOINTS.VESU_BASE}/pools`
61233
61301
  );
61234
61302
  pools = data.data;
61235
61303
  for (const pool of vesu_pools_default.data) {
@@ -66822,7 +66890,7 @@ ${JSON.stringify(data, null, 2)}`;
66822
66890
  * Calculates assets before and now in a given token of TVL per share to observe growth
66823
66891
  * @returns {Promise<number>} The weighted average APY across all pools
66824
66892
  */
66825
- async netAPY(blockIdentifier = "latest", sinceBlocks = 2e4) {
66893
+ async netAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
66826
66894
  const tvlNow = await this._getTVL(blockIdentifier);
66827
66895
  const supplyNow = await this.totalSupply(blockIdentifier);
66828
66896
  const priceNow = await this.getCurrentPrice(blockIdentifier);
@@ -67859,6 +67927,15 @@ ${JSON.stringify(data, null, 2)}`;
67859
67927
  ] })
67860
67928
  }
67861
67929
  ];
67930
+ function getLSTFAQs(lstSymbol) {
67931
+ return [
67932
+ ...faqs2,
67933
+ {
67934
+ question: "Why might I see a negative APY?",
67935
+ answer: `A negative APY can occur when ${lstSymbol}'s price drops on DEXes. This is usually temporary and tends to recover within a few days or a week.`
67936
+ }
67937
+ ];
67938
+ }
67862
67939
  var xSTRKSTRK = {
67863
67940
  name: "Ekubo xSTRK/STRK",
67864
67941
  description: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}),
@@ -67880,7 +67957,7 @@ ${JSON.stringify(data, null, 2)}`;
67880
67957
  netRisk: _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
67881
67958
  notARisks: getNoRiskTags(_corelatedPoolRiskFactors)
67882
67959
  },
67883
- apyMethodology: "APY based on 7-day historical performance, including fees and rewards.",
67960
+ apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
67884
67961
  additionalInfo: {
67885
67962
  newBounds: {
67886
67963
  lower: -1,
@@ -67897,13 +67974,7 @@ ${JSON.stringify(data, null, 2)}`;
67897
67974
  },
67898
67975
  quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "STRK")
67899
67976
  },
67900
- faqs: [
67901
- ...faqs2,
67902
- {
67903
- question: "Why might I see a negative APY?",
67904
- answer: "A negative APY can occur when xSTRK's price drops on DEXes. This is usually temporary and tends to recover within a few days or a week."
67905
- }
67906
- ],
67977
+ faqs: getLSTFAQs("xSTRK"),
67907
67978
  points: [{
67908
67979
  multiplier: 1,
67909
67980
  logo: "https://endur.fi/favicon.ico",
@@ -67912,6 +67983,78 @@ ${JSON.stringify(data, null, 2)}`;
67912
67983
  contractDetails: [],
67913
67984
  investmentSteps: []
67914
67985
  };
67986
+ var lstStrategies = [
67987
+ xSTRKSTRK,
67988
+ {
67989
+ ...xSTRKSTRK,
67990
+ name: "Ekubo xWBTC/WBTC",
67991
+ description: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}),
67992
+ address: ContractAddr.from(
67993
+ "0x2ea99b4971d3c277fa4a9b4beb7d4d7d169e683393a29eef263d5d57b4380a"
67994
+ ),
67995
+ launchBlock: 2338309,
67996
+ // must be same order as poolKey token0 and token1
67997
+ depositTokens: [
67998
+ Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
67999
+ Global.getDefaultTokens().find((t) => t.symbol === "xWBTC")
68000
+ ],
68001
+ additionalInfo: {
68002
+ ...xSTRKSTRK.additionalInfo,
68003
+ quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
68004
+ lstContract: Global.getDefaultTokens().find((t) => t.symbol === "xWBTC").address
68005
+ },
68006
+ faqs: getLSTFAQs("xWBTC"),
68007
+ points: [],
68008
+ contractDetails: [],
68009
+ investmentSteps: []
68010
+ },
68011
+ {
68012
+ ...xSTRKSTRK,
68013
+ name: "Ekubo xtBTC/tBTC",
68014
+ description: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}),
68015
+ address: ContractAddr.from(
68016
+ "0x785dc3dfc4e80ef2690a99512481e3ed3a5266180adda5a47e856245d68a4af"
68017
+ ),
68018
+ launchBlock: 2344809,
68019
+ // must be same order as poolKey token0 and token1
68020
+ depositTokens: [
68021
+ Global.getDefaultTokens().find((t) => t.symbol === "xtBTC"),
68022
+ Global.getDefaultTokens().find((t) => t.symbol === "tBTC")
68023
+ ],
68024
+ additionalInfo: {
68025
+ ...xSTRKSTRK.additionalInfo,
68026
+ quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "tBTC"),
68027
+ lstContract: Global.getDefaultTokens().find((t) => t.symbol === "xtBTC").address
68028
+ },
68029
+ faqs: getLSTFAQs("xtBTC"),
68030
+ points: [],
68031
+ contractDetails: [],
68032
+ investmentSteps: []
68033
+ },
68034
+ {
68035
+ ...xSTRKSTRK,
68036
+ name: "Ekubo xsBTC/solvBTC",
68037
+ description: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}),
68038
+ address: ContractAddr.from(
68039
+ "0x3af1c7faa7c464cf2c494e988972ad1939f1103dbfb6e47e9bf0c47e49b14ef"
68040
+ ),
68041
+ launchBlock: 2344809,
68042
+ // must be same order as poolKey token0 and token1
68043
+ depositTokens: [
68044
+ Global.getDefaultTokens().find((t) => t.symbol === "xsBTC"),
68045
+ Global.getDefaultTokens().find((t) => t.symbol === "solvBTC")
68046
+ ],
68047
+ additionalInfo: {
68048
+ ...xSTRKSTRK.additionalInfo,
68049
+ quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "solvBTC"),
68050
+ lstContract: Global.getDefaultTokens().find((t) => t.symbol === "xsBTC").address
68051
+ },
68052
+ faqs: getLSTFAQs("xsBTC"),
68053
+ points: [],
68054
+ contractDetails: [],
68055
+ investmentSteps: []
68056
+ }
68057
+ ];
67915
68058
  var ETHUSDCRe7Strategy = {
67916
68059
  ...xSTRKSTRK,
67917
68060
  name: "Ekubo ETH/USDC",
@@ -67919,12 +68062,13 @@ ${JSON.stringify(data, null, 2)}`;
67919
68062
  address: ContractAddr.from(
67920
68063
  "0x160d8fa4569ef6a12e6bf47cb943d7b5ebba8a41a69a14c1d943050ba5ff947"
67921
68064
  ),
67922
- launchBlock: 1501761,
68065
+ launchBlock: 1504232,
67923
68066
  // must be same order as poolKey token0 and token1
67924
68067
  depositTokens: [
67925
68068
  Global.getDefaultTokens().find((t) => t.symbol === "ETH"),
67926
68069
  Global.getDefaultTokens().find((t) => t.symbol === "USDC")
67927
68070
  ],
68071
+ apyMethodology: "APY based on 7-day historical performance, including fees and rewards.",
67928
68072
  additionalInfo: {
67929
68073
  newBounds: "Managed by Re7",
67930
68074
  truePrice: 1,
@@ -67960,7 +68104,7 @@ ${JSON.stringify(data, null, 2)}`;
67960
68104
  address: ContractAddr.from(
67961
68105
  "0x3a4f8debaf12af97bb911099bc011d63d6c208d4c5ba8e15d7f437785b0aaa2"
67962
68106
  ),
67963
- launchBlock: 1501761,
68107
+ launchBlock: 1506139,
67964
68108
  // must be same order as poolKey token0 and token1
67965
68109
  depositTokens: [
67966
68110
  Global.getDefaultTokens().find((t) => t.symbol === "USDC"),
@@ -67975,7 +68119,7 @@ ${JSON.stringify(data, null, 2)}`;
67975
68119
  address: ContractAddr.from(
67976
68120
  "0x351b36d0d9d8b40010658825adeeddb1397436cd41acd0ff6c6e23aaa8b5b30"
67977
68121
  ),
67978
- launchBlock: 1501762,
68122
+ launchBlock: 1504079,
67979
68123
  // must be same order as poolKey token0 and token1
67980
68124
  depositTokens: [
67981
68125
  Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
@@ -67990,7 +68134,7 @@ ${JSON.stringify(data, null, 2)}`;
67990
68134
  address: ContractAddr.from(
67991
68135
  "0x4ce3024b0ee879009112d7b0e073f8a87153dd35b029347d4247ffe48d28f51"
67992
68136
  ),
67993
- launchBlock: 1501763,
68137
+ launchBlock: 1504149,
67994
68138
  // must be same order as poolKey token0 and token1
67995
68139
  depositTokens: [
67996
68140
  Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
@@ -68005,7 +68149,7 @@ ${JSON.stringify(data, null, 2)}`;
68005
68149
  address: ContractAddr.from(
68006
68150
  "0x2bcaef2eb7706875a5fdc6853dd961a0590f850bc3a031c59887189b5e84ba1"
68007
68151
  ),
68008
- launchBlock: 1501764,
68152
+ launchBlock: 1506144,
68009
68153
  // must be same order as poolKey token0 and token1
68010
68154
  depositTokens: [
68011
68155
  Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
@@ -68035,7 +68179,7 @@ ${JSON.stringify(data, null, 2)}`;
68035
68179
  address: ContractAddr.from(
68036
68180
  "0x1c9232b8186d9317652f05055615f18a120c2ad9e5ee96c39e031c257fb945b"
68037
68181
  ),
68038
- launchBlock: 1501765,
68182
+ launchBlock: 1506145,
68039
68183
  // must be same order as poolKey token0 and token1
68040
68184
  depositTokens: [
68041
68185
  Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
@@ -68050,7 +68194,7 @@ ${JSON.stringify(data, null, 2)}`;
68050
68194
  address: ContractAddr.from(
68051
68195
  "0x1248e385c23a929a015ec298a26560fa7745bbd6e41a886550e337b02714b1b"
68052
68196
  ),
68053
- launchBlock: 1501766,
68197
+ launchBlock: 1506147,
68054
68198
  // must be same order as poolKey token0 and token1
68055
68199
  depositTokens: [
68056
68200
  Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
@@ -68060,7 +68204,7 @@ ${JSON.stringify(data, null, 2)}`;
68060
68204
  }
68061
68205
  ];
68062
68206
  var EkuboCLVaultStrategies = [
68063
- xSTRKSTRK,
68207
+ ...[lstStrategies[0]],
68064
68208
  ...RE7Strategies
68065
68209
  ];
68066
68210
  EkuboCLVaultStrategies.forEach((s) => {
@@ -68091,7 +68235,11 @@ ${JSON.stringify(data, null, 2)}`;
68091
68235
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { style: { fontWeight: "bold" }, children: "Key points to note:" }),
68092
68236
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px", color: "var(--chakra-colors-text_secondary)" }, children: [
68093
68237
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: {}, children: "1. During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices." }),
68094
- s.name.includes("xSTRK/STRK") && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: {}, children: "2. Sometimes you might see a negative APY \u2014 this is usually not a big deal. It happens when xSTRK's price drops on DEXes, but things typically bounce back within a few days or a week." })
68238
+ s.additionalInfo.lstContract && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { style: {}, children: [
68239
+ "2. Sometimes you might see a negative APY \u2014 this is usually not a big deal. It happens when ",
68240
+ s.name.split(" ")[1].split("/")[0],
68241
+ "'s price drops on DEXes, but things typically bounce back within a few days or a week."
68242
+ ] })
68095
68243
  ] })
68096
68244
  ] })
68097
68245
  ] });
@@ -72863,7 +73011,7 @@ ${JSON.stringify(data, null, 2)}`;
72863
73011
  let pools = [];
72864
73012
  try {
72865
73013
  const data = await getAPIUsingHeadlessBrowser(
72866
- "https://api.vesu.xyz/pools"
73014
+ `${ENDPOINTS.VESU_BASE}/pools`
72867
73015
  );
72868
73016
  pools = data.data;
72869
73017
  for (const pool of vesu_pools_default.data) {