@argent/x-shared 1.48.2 → 1.48.3

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.
Files changed (22) hide show
  1. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js +3 -3
  2. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +5 -5
  3. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +2 -2
  4. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +2 -2
  5. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +2 -2
  6. package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.cjs +1 -1
  7. package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +55 -58
  8. package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +1 -1
  9. package/dist/src/features/simulation/activity/schema.js +3 -3
  10. package/dist/src/features/simulation/activity/utils/createNativeActivity.js +3 -3
  11. package/dist/src/features/simulation/transactionReview/schema.js +4 -4
  12. package/dist/src/features/swap/models/trade.model.js +3 -3
  13. package/dist/src/nfts/BackendNftService.cjs +1 -1
  14. package/dist/src/nfts/BackendNftService.js +3 -3
  15. package/dist/src/tokens/service/types/backend.model.js +1 -1
  16. package/dist/src/transactions/estimate/utils.js +1 -1
  17. package/dist/src/transactions/transactionVersion.js +1 -1
  18. package/dist/src/transactions/txv3.cjs +1 -1
  19. package/dist/src/transactions/txv3.js +4 -4
  20. package/dist/src/utils/number/prettifyNumber.cjs +1 -1
  21. package/dist/src/utils/number/prettifyNumber.js +27 -22
  22. package/package.json +25 -25
@@ -1,12 +1,12 @@
1
1
  import { hmac as m } from "../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.js";
2
- import { concatBytes as c, randomBytes as e } from "../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js";
2
+ import { randomBytes as c, concatBytes as e } from "../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js";
3
3
  import "./abstract/weierstrass.js";
4
4
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
5
  function p(t) {
6
6
  return {
7
7
  hash: t,
8
- hmac: (o, ...r) => m(t, o, c(...r)),
9
- randomBytes: e
8
+ hmac: (o, ...r) => m(t, o, e(...r)),
9
+ randomBytes: c
10
10
  };
11
11
  }
12
12
  export {
@@ -1,4 +1,4 @@
1
- import { bitMask as L, numberToBytesLE as T, numberToBytesBE as _, bytesToNumberLE as y, bytesToNumberBE as m, validateObject as $, ensureBytes as C } from "./utils.js";
1
+ import { validateObject as L, ensureBytes as T, bytesToNumberLE as y, bytesToNumberBE as m, numberToBytesBE as _, bitMask as $, numberToBytesLE as C } from "./utils.js";
2
2
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
3
  const f = BigInt(0), u = BigInt(1), w = BigInt(2), M = BigInt(3), E = BigInt(4), b = BigInt(5), I = BigInt(8);
4
4
  BigInt(9);
@@ -109,7 +109,7 @@ function Q(e) {
109
109
  BYTES: "isSafeInteger",
110
110
  BITS: "isSafeInteger"
111
111
  }, n = A.reduce((r, s) => (r[s] = "function", r), o);
112
- return $(e, n);
112
+ return L(e, n);
113
113
  }
114
114
  function O(e, o, n) {
115
115
  if (n < f)
@@ -141,7 +141,7 @@ function V(e, o, n = !1, r = {}) {
141
141
  ORDER: e,
142
142
  BITS: s,
143
143
  BYTES: c,
144
- MASK: L(s),
144
+ MASK: $(s),
145
145
  ZERO: f,
146
146
  ONE: u,
147
147
  create: (t) => g(t, e),
@@ -171,7 +171,7 @@ function V(e, o, n = !1, r = {}) {
171
171
  // TODO: do we really need constant cmov?
172
172
  // We don't have const-time bigints anyway, so probably will be not very useful
173
173
  cmov: (t, l, a) => a ? l : t,
174
- toBytes: (t) => n ? T(t, c) : _(t, c),
174
+ toBytes: (t) => n ? C(t, c) : _(t, c),
175
175
  fromBytes: (t) => {
176
176
  if (t.length !== c)
177
177
  throw new Error(`Fp.fromBytes: expected ${c}, got ${t.length}`);
@@ -181,7 +181,7 @@ function V(e, o, n = !1, r = {}) {
181
181
  return Object.freeze(i);
182
182
  }
183
183
  function Y(e, o, n = !1) {
184
- e = C("privateHash", e);
184
+ e = T("privateHash", e);
185
185
  const r = e.length, s = x(o).nByteLength + 8;
186
186
  if (s < 24 || r < s || r > 1024)
187
187
  throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
@@ -1,7 +1,7 @@
1
1
  import { mod as ut, hashToPrivateScalar as dt, invert as ht } from "./modular.js";
2
2
  import * as mt from "./utils.js";
3
- import { bytesToNumberBE as _, bitMask as yt, concatBytes as et, validateObject as lt, ensureBytes as Y, hexToBytes as at, numberToBytesBE as rt, createHmacDrbg as pt, bytesToHex as nt } from "./utils.js";
4
- import { wNAF as wt, validateBasic as ft } from "./curve.js";
3
+ import { validateObject as lt, concatBytes as et, ensureBytes as Y, bytesToHex as nt, bytesToNumberBE as _, bitMask as yt, numberToBytesBE as rt, hexToBytes as at, createHmacDrbg as pt } from "./utils.js";
4
+ import { validateBasic as ft, wNAF as wt } from "./curve.js";
5
5
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6
6
  function Et(B) {
7
7
  const n = ft(B);
@@ -1,5 +1,5 @@
1
1
  import { number as d, exists as k, bytes as _, output as g } from "./_assert.js";
2
- import { split as B, rotlBH as A, rotlSH as H, rotlBL as m, rotlSL as S } from "./_u64.js";
2
+ import { rotlBH as B, rotlSH as A, rotlBL as H, rotlSL as m, split as S } from "./_u64.js";
3
3
  import { wrapConstructor as T, Hash as F, u32 as X, toBytes as U } from "./utils.js";
4
4
  const [O, w, y] = [[], [], []], E = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), P = /* @__PURE__ */ BigInt(2), M = /* @__PURE__ */ BigInt(7), R = /* @__PURE__ */ BigInt(256), j = /* @__PURE__ */ BigInt(113);
5
5
  for (let i = 0, t = f, s = 1, n = 0; i < 24; i++) {
@@ -9,7 +9,7 @@ for (let i = 0, t = f, s = 1, n = 0; i < 24; i++) {
9
9
  t = (t << f ^ (t >> M) * j) % R, t & P && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
10
10
  y.push(o);
11
11
  }
12
- const [C, q] = /* @__PURE__ */ B(y, !0), x = (i, t, s) => s > 32 ? A(i, t, s) : H(i, t, s), I = (i, t, s) => s > 32 ? m(i, t, s) : S(i, t, s);
12
+ const [C, q] = /* @__PURE__ */ S(y, !0), x = (i, t, s) => s > 32 ? B(i, t, s) : A(i, t, s), I = (i, t, s) => s > 32 ? H(i, t, s) : m(i, t, s);
13
13
  function v(i, t = 24) {
14
14
  const s = new Uint32Array(10);
15
15
  for (let n = 24 - t; n < 24; n++) {
@@ -1,5 +1,5 @@
1
1
  import { number as d, exists as k, bytes as B, output as A } from "./_assert.js";
2
- import { split as H, rotlBH as m, rotlSH as S, rotlBL as T, rotlSL as F } from "./_u64.js";
2
+ import { rotlBH as H, rotlSH as m, rotlBL as S, rotlSL as T, split as F } from "./_u64.js";
3
3
  import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./utils.js";
4
4
  const y = [], L = [], b = [], M = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), R = /* @__PURE__ */ BigInt(2), j = /* @__PURE__ */ BigInt(7), C = /* @__PURE__ */ BigInt(256), q = /* @__PURE__ */ BigInt(113);
5
5
  for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
@@ -9,7 +9,7 @@ for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
9
9
  t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
10
10
  b.push(o);
11
11
  }
12
- const [v, z] = /* @__PURE__ */ H(b, !0), O = (e, t, s) => s > 32 ? m(e, t, s) : S(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : F(e, t, s);
12
+ const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? H(e, t, s) : m(e, t, s), w = (e, t, s) => s > 32 ? S(e, t, s) : T(e, t, s);
13
13
  function D(e, t = 24) {
14
14
  const s = new Uint32Array(10);
15
15
  for (let n = 24 - t; n < 24; n++) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs"),E=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.cjs"),h=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.cjs"),c=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.cjs"),N=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.cjs"),R=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs"),i=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.cjs"),F=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs"),p=BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"),w=252;function g(e){for(;e[0]===0;)e=e.subarray(1);const n=e.length*8-w,t=i.bytesToNumberBE(e);return n>0?t>>BigInt(n):t}function m(e){return typeof e=="string"&&(e=$(e),e.length&1&&(e="0"+e)),i.hexToBytes(e)}const b=R.weierstrass({a:BigInt(1),b:BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),Fp:c.Field(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),n:p,nBitLength:w,Gx:BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),Gy:BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),h:BigInt(1),lowS:!1,...F.getHash(E.sha256),bits2int:g,bits2int_modN:e=>{const n=i.bytesToNumberBE(e).toString(16);return n.length===63&&(e=m(n+"0")),c.mod(g(e),p)}});function T(e){return i.ensureBytes("",typeof e=="string"?m(e):e)}const{CURVE:v,ProjectivePoint:u,Signature:_,utils:q}=b;function x(e){return`0x${i.bytesToHex(e.subarray(1)).replace(/^0+/gm,"")}`}function $(e){return e.replace(/^0x/i,"")}const a=[new u(2089986280348253421170679821480865132823066470938446095505822317253594081284n,1713931329540660377023406109199410414810705867260802078187082345529207694986n,1n),new u(996781205833008774514500082376783249102396023663454813447423147977397232763n,1668503676786377725805489344771023921079126552019160156920634619255970485781n,1n),new u(2251563274489750535117886426533222435294046428347329203627021249169616184184n,1798716007562728905295480679789526322175868328062420237419143593021674992973n,1n),new u(2138414695194151160943305727036575959195309218611738193261179310511854807447n,113410276730064486255102093846540133784865286929052426931474106396135072156n,1n),new u(2379962749567351885752724891227938183011949129833673362440656643086021394946n,776496453633298175483985398648758586525933812536653089401905292063708816422n,1n)];function y(e,n){const t=[];let r=e;for(let o=0;o<248;o++)t.push(r),r=r.double();r=n;for(let o=0;o<4;o++)t.push(r),r=r.double();return t}const k=y(a[1],a[2]),C=y(a[3],a[4]);function D(e){let n;if(typeof e=="bigint")n=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e))throw new Error(`Invalid pedersenArg: ${e}`);n=BigInt(e)}else n=i.bytesToNumberBE(T(e));if(!(0n<=n&&n<b.CURVE.Fp.ORDER))throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${n}`);return n}function B(e,n,t){let r=D(n);for(let o=0;o<252;o++){const s=t[o];if(s.equals(e))throw new Error("Same point");(r&1n)!==0n&&(e=e.add(s)),r>>=1n}return e}function O(e,n){let t=a[0];return t=B(t,e,k),t=B(t,n,C),x(t.toRawBytes(!0))}const j=i.bitMask(250),A=e=>i.bytesToNumberBE(P.keccak_256(e))&j;c.Field(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));const I=c.Field(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));function M(e,n,t){const r=e.fromBytes(E.sha256(h.utf8ToBytes(`${n}${t}`)));return e.create(r)}const U=[[3,1,1],[1,-1,1],[1,1,-2]].map(e=>e.map(BigInt));function S(e,n){if(c.validateField(e.Fp),!Number.isSafeInteger(e.rate)||!Number.isSafeInteger(e.capacity))throw new Error(`Wrong poseidon opts: ${e}`);const t=e.rate+e.capacity,r=e.roundsFull+e.roundsPartial,o=[];for(let l=0;l<r;l++){const f=[];for(let d=0;d<t;d++)f.push(M(e.Fp,"Hades",t*l+d));o.push(f)}const s=N.poseidon({...e,t,sboxPower:3,reversePartialPowIdx:!0,mds:n,roundConstants:o});return s.m=t,s.rate=e.rate,s.capacity=e.capacity,s}S({Fp:I,rate:2,capacity:1,roundsFull:8,roundsPartial:83},U);exports.CURVE=v;exports.Fp251=I;exports.ProjectivePoint=u;exports.Signature=_;exports.keccak=A;exports.pedersen=O;exports.poseidonBasic=S;exports.utils=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs"),w=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.cjs"),S=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.cjs"),c=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.cjs"),N=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.cjs"),F=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs"),i=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.cjs"),R=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs"),p=BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"),E=252;function g(e){for(;e[0]===0;)e=e.subarray(1);const n=e.length*8-E,t=i.bytesToNumberBE(e);return n>0?t>>BigInt(n):t}function m(e){return typeof e=="string"&&(e=_(e),e.length&1&&(e="0"+e)),i.hexToBytes(e)}const b=F.weierstrass({a:BigInt(1),b:BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),Fp:c.Field(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),n:p,nBitLength:E,Gx:BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),Gy:BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),h:BigInt(1),lowS:!1,...R.getHash(w.sha256),bits2int:g,bits2int_modN:e=>{const n=i.bytesToNumberBE(e).toString(16);return n.length===63&&(e=m(n+"0")),c.mod(g(e),p)}});function T(e){return i.ensureBytes("",typeof e=="string"?m(e):e)}const{ProjectivePoint:u}=b;function v(e){return`0x${i.bytesToHex(e.subarray(1)).replace(/^0+/gm,"")}`}function _(e){return e.replace(/^0x/i,"")}const a=[new u(2089986280348253421170679821480865132823066470938446095505822317253594081284n,1713931329540660377023406109199410414810705867260802078187082345529207694986n,1n),new u(996781205833008774514500082376783249102396023663454813447423147977397232763n,1668503676786377725805489344771023921079126552019160156920634619255970485781n,1n),new u(2251563274489750535117886426533222435294046428347329203627021249169616184184n,1798716007562728905295480679789526322175868328062420237419143593021674992973n,1n),new u(2138414695194151160943305727036575959195309218611738193261179310511854807447n,113410276730064486255102093846540133784865286929052426931474106396135072156n,1n),new u(2379962749567351885752724891227938183011949129833673362440656643086021394946n,776496453633298175483985398648758586525933812536653089401905292063708816422n,1n)];function y(e,n){const t=[];let r=e;for(let o=0;o<248;o++)t.push(r),r=r.double();r=n;for(let o=0;o<4;o++)t.push(r),r=r.double();return t}const q=y(a[1],a[2]),x=y(a[3],a[4]);function k(e){let n;if(typeof e=="bigint")n=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e))throw new Error(`Invalid pedersenArg: ${e}`);n=BigInt(e)}else n=i.bytesToNumberBE(T(e));if(!(0n<=n&&n<b.CURVE.Fp.ORDER))throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${n}`);return n}function B(e,n,t){let r=k(n);for(let o=0;o<252;o++){const s=t[o];if(s.equals(e))throw new Error("Same point");(r&1n)!==0n&&(e=e.add(s)),r>>=1n}return e}function $(e,n){let t=a[0];return t=B(t,e,q),t=B(t,n,x),v(t.toRawBytes(!0))}const D=i.bitMask(250),O=e=>i.bytesToNumberBE(h.keccak_256(e))&D;c.Field(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));const I=c.Field(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));function j(e,n,t){const r=e.fromBytes(w.sha256(S.utf8ToBytes(`${n}${t}`)));return e.create(r)}const A=[[3,1,1],[1,-1,1],[1,1,-2]].map(e=>e.map(BigInt));function P(e,n){if(c.validateField(e.Fp),!Number.isSafeInteger(e.rate)||!Number.isSafeInteger(e.capacity))throw new Error(`Wrong poseidon opts: ${e}`);const t=e.rate+e.capacity,r=e.roundsFull+e.roundsPartial,o=[];for(let l=0;l<r;l++){const f=[];for(let d=0;d<t;d++)f.push(j(e.Fp,"Hades",t*l+d));o.push(f)}const s=N.poseidon({...e,t,sboxPower:3,reversePartialPowIdx:!0,mds:n,roundConstants:o});return s.m=t,s.rate=e.rate,s.capacity=e.capacity,s}P({Fp:I,rate:2,capacity:1,roundsFull:8,roundsPartial:83},A);exports.Fp251=I;exports.ProjectivePoint=u;exports.keccak=O;exports.pedersen=$;exports.poseidonBasic=P;
@@ -1,22 +1,22 @@
1
- import { keccak_256 as y } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js";
1
+ import { keccak_256 as P } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js";
2
2
  import { sha256 as B } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js";
3
- import { utf8ToBytes as P } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js";
4
- import { Field as l, mod as h, validateField as R } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js";
5
- import { poseidon as b } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js";
3
+ import { utf8ToBytes as S } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js";
4
+ import { mod as h, Field as l, validateField as b } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js";
5
+ import { poseidon as R } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js";
6
6
  import { weierstrass as N } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js";
7
- import { bytesToNumberBE as c, bitMask as x, hexToBytes as F, bytesToHex as v, ensureBytes as T } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js";
7
+ import { bytesToNumberBE as c, ensureBytes as x, hexToBytes as F, bytesToHex as v, bitMask as T } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js";
8
8
  import { getHash as _ } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js";
9
9
  const d = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), w = 252;
10
10
  function m(n) {
11
11
  for (; n[0] === 0; )
12
12
  n = n.subarray(1);
13
- const t = n.length * 8 - w, e = c(n);
14
- return t > 0 ? e >> BigInt(t) : e;
13
+ const e = n.length * 8 - w, t = c(n);
14
+ return e > 0 ? t >> BigInt(e) : t;
15
15
  }
16
- function E(n) {
17
- return typeof n == "string" && (n = D(n), n.length & 1 && (n = "0" + n)), F(n);
16
+ function I(n) {
17
+ return typeof n == "string" && (n = k(n), n.length & 1 && (n = "0" + n)), F(n);
18
18
  }
19
- const I = N({
19
+ const E = N({
20
20
  a: BigInt(1),
21
21
  b: BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),
22
22
  Fp: l(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),
@@ -29,18 +29,18 @@ const I = N({
29
29
  ..._(B),
30
30
  bits2int: m,
31
31
  bits2int_modN: (n) => {
32
- const t = c(n).toString(16);
33
- return t.length === 63 && (n = E(t + "0")), h(m(n), d);
32
+ const e = c(n).toString(16);
33
+ return e.length === 63 && (n = I(e + "0")), h(m(n), d);
34
34
  }
35
35
  });
36
36
  function $(n) {
37
- return T("", typeof n == "string" ? E(n) : n);
37
+ return x("", typeof n == "string" ? I(n) : n);
38
38
  }
39
- const { CURVE: Q, ProjectivePoint: s, Signature: Y, utils: Z } = I;
40
- function C(n) {
39
+ const { ProjectivePoint: s } = E;
40
+ function D(n) {
41
41
  return `0x${v(n.subarray(1)).replace(/^0+/gm, "")}`;
42
42
  }
43
- function D(n) {
43
+ function k(n) {
44
44
  return n.replace(/^0x/i, "");
45
45
  }
46
46
  const u = [
@@ -50,85 +50,82 @@ const u = [
50
50
  new s(2138414695194151160943305727036575959195309218611738193261179310511854807447n, 113410276730064486255102093846540133784865286929052426931474106396135072156n, 1n),
51
51
  new s(2379962749567351885752724891227938183011949129833673362440656643086021394946n, 776496453633298175483985398648758586525933812536653089401905292063708816422n, 1n)
52
52
  ];
53
- function S(n, t) {
54
- const e = [];
53
+ function y(n, e) {
54
+ const t = [];
55
55
  let r = n;
56
56
  for (let o = 0; o < 248; o++)
57
- e.push(r), r = r.double();
58
- r = t;
57
+ t.push(r), r = r.double();
58
+ r = e;
59
59
  for (let o = 0; o < 4; o++)
60
- e.push(r), r = r.double();
61
- return e;
60
+ t.push(r), r = r.double();
61
+ return t;
62
62
  }
63
- const k = S(u[1], u[2]), A = S(u[3], u[4]);
63
+ const A = y(u[1], u[2]), C = y(u[3], u[4]);
64
64
  function O(n) {
65
- let t;
65
+ let e;
66
66
  if (typeof n == "bigint")
67
- t = n;
67
+ e = n;
68
68
  else if (typeof n == "number") {
69
69
  if (!Number.isSafeInteger(n))
70
70
  throw new Error(`Invalid pedersenArg: ${n}`);
71
- t = BigInt(n);
71
+ e = BigInt(n);
72
72
  } else
73
- t = c($(n));
74
- if (!(0n <= t && t < I.CURVE.Fp.ORDER))
75
- throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${t}`);
76
- return t;
73
+ e = c($(n));
74
+ if (!(0n <= e && e < E.CURVE.Fp.ORDER))
75
+ throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);
76
+ return e;
77
77
  }
78
- function g(n, t, e) {
79
- let r = O(t);
78
+ function g(n, e, t) {
79
+ let r = O(e);
80
80
  for (let o = 0; o < 252; o++) {
81
- const i = e[o];
81
+ const i = t[o];
82
82
  if (i.equals(n))
83
83
  throw new Error("Same point");
84
84
  (r & 1n) !== 0n && (n = n.add(i)), r >>= 1n;
85
85
  }
86
86
  return n;
87
87
  }
88
- function n0(n, t) {
89
- let e = u[0];
90
- return e = g(e, n, k), e = g(e, t, A), C(e.toRawBytes(!0));
88
+ function Q(n, e) {
89
+ let t = u[0];
90
+ return t = g(t, n, A), t = g(t, e, C), D(t.toRawBytes(!0));
91
91
  }
92
- const M = x(250), t0 = (n) => c(y(n)) & M;
92
+ const M = T(250), Y = (n) => c(P(n)) & M;
93
93
  l(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));
94
- const U = l(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
95
- function V(n, t, e) {
96
- const r = n.fromBytes(B(P(`${t}${e}`)));
94
+ const j = l(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
95
+ function H(n, e, t) {
96
+ const r = n.fromBytes(B(S(`${e}${t}`)));
97
97
  return n.create(r);
98
98
  }
99
- const j = [
99
+ const L = [
100
100
  [3, 1, 1],
101
101
  [1, -1, 1],
102
102
  [1, 1, -2]
103
103
  ].map((n) => n.map(BigInt));
104
- function H(n, t) {
105
- if (R(n.Fp), !Number.isSafeInteger(n.rate) || !Number.isSafeInteger(n.capacity))
104
+ function U(n, e) {
105
+ if (b(n.Fp), !Number.isSafeInteger(n.rate) || !Number.isSafeInteger(n.capacity))
106
106
  throw new Error(`Wrong poseidon opts: ${n}`);
107
- const e = n.rate + n.capacity, r = n.roundsFull + n.roundsPartial, o = [];
107
+ const t = n.rate + n.capacity, r = n.roundsFull + n.roundsPartial, o = [];
108
108
  for (let a = 0; a < r; a++) {
109
109
  const p = [];
110
- for (let f = 0; f < e; f++)
111
- p.push(V(n.Fp, "Hades", e * a + f));
110
+ for (let f = 0; f < t; f++)
111
+ p.push(H(n.Fp, "Hades", t * a + f));
112
112
  o.push(p);
113
113
  }
114
- const i = b({
114
+ const i = R({
115
115
  ...n,
116
- t: e,
116
+ t,
117
117
  sboxPower: 3,
118
118
  reversePartialPowIdx: !0,
119
- mds: t,
119
+ mds: e,
120
120
  roundConstants: o
121
121
  });
122
- return i.m = e, i.rate = n.rate, i.capacity = n.capacity, i;
122
+ return i.m = t, i.rate = n.rate, i.capacity = n.capacity, i;
123
123
  }
124
- H({ Fp: U, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, j);
124
+ U({ Fp: j, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, L);
125
125
  export {
126
- Q as CURVE,
127
- U as Fp251,
126
+ j as Fp251,
128
127
  s as ProjectivePoint,
129
- Y as Signature,
130
- t0 as keccak,
131
- n0 as pedersen,
132
- H as poseidonBasic,
133
- Z as utils
128
+ Y as keccak,
129
+ Q as pedersen,
130
+ U as poseidonBasic
134
131
  };
@@ -1,5 +1,5 @@
1
1
  import g from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.js";
2
- import { CallData as f, CairoOption as p, CairoOptionVariant as u, hash as h } from "starknet";
2
+ import { CairoOption as p, CairoOptionVariant as u, CallData as f, hash as h } from "starknet";
3
3
  import { z as H } from "zod";
4
4
  import { getSignerForMultiSigner as d, MultiSigner as A } from "../../../../signer/multisigner.js";
5
5
  import { AccountError as D } from "../../../../errors/account.js";
@@ -1,5 +1,5 @@
1
1
  import { z as t } from "zod";
2
- import { stakingActionSchema as m, stakerInfoSchema as d, investmentMetaSchema as g } from "../../../staking/schema.js";
2
+ import { stakerInfoSchema as m, stakingActionSchema as d, investmentMetaSchema as g } from "../../../staking/schema.js";
3
3
  import { actionSchema as y, targetedDappSchema as b } from "../transactionReview/schema.js";
4
4
  import { addressSchemaArgentBackend as e } from "../../../chains/starknet/address.js";
5
5
  const r = t.object({
@@ -105,10 +105,10 @@ const r = t.object({
105
105
  }),
106
106
  t.object({
107
107
  type: t.literal("staking"),
108
- stakingAction: m,
108
+ stakingAction: d,
109
109
  counterparty: e,
110
110
  asset: a,
111
- stakerInfo: d
111
+ stakerInfo: m
112
112
  })
113
113
  ]), w = t.union([
114
114
  o,
@@ -1,6 +1,6 @@
1
1
  import { isEmpty as f } from "lodash-es";
2
2
  import { normalizeActivitySummaryCollection as y } from "../normalize.js";
3
- import { NativeActivityTypeNative as v, nativeActivitySchema as u } from "../schema.js";
3
+ import { nativeActivitySchema as v, NativeActivityTypeNative as u } from "../schema.js";
4
4
  function S(t) {
5
5
  var n, o;
6
6
  const a = (o = (n = t.transactions) == null ? void 0 : n[0].reviewOfTransaction) == null ? void 0 : o.reviews;
@@ -9,7 +9,7 @@ function S(t) {
9
9
  function z({ simulateAndReview: t, ...a }) {
10
10
  var n, o, c;
11
11
  const r = {
12
- type: v,
12
+ type: u,
13
13
  ...a
14
14
  };
15
15
  if (t && !f(t.transactions)) {
@@ -23,7 +23,7 @@ function z({ simulateAndReview: t, ...a }) {
23
23
  const m = S(t);
24
24
  m && (r.actions = m);
25
25
  }
26
- return u.parse(r);
26
+ return v.parse(r);
27
27
  }
28
28
  export {
29
29
  z as createNativeActivity,
@@ -1,7 +1,7 @@
1
1
  import { z as t } from "zod";
2
2
  import { estimatedFeesSchema as b } from "../fees/schema.js";
3
- import { reasonsSchema as u, severitySchema as S } from "../warning/schema.js";
4
- import { addressSchema as f, addressSchemaArgentBackend as o } from "../../../chains/starknet/address.js";
3
+ import { severitySchema as u, reasonsSchema as S } from "../warning/schema.js";
4
+ import { addressSchemaArgentBackend as o, addressSchema as f } from "../../../chains/starknet/address.js";
5
5
  const h = t.object({
6
6
  name: t.string(),
7
7
  url: t.string(),
@@ -73,9 +73,9 @@ const h = t.object({
73
73
  reason: t.string().optional(),
74
74
  value: t.string().or(t.number()).optional()
75
75
  }), l = t.object({
76
- reason: u,
76
+ reason: S,
77
77
  details: k.optional(),
78
- severity: S
78
+ severity: u
79
79
  }), v = t.object({
80
80
  assessment: y,
81
81
  warnings: t.array(l).optional(),
@@ -1,6 +1,6 @@
1
1
  import { z as e } from "zod";
2
2
  import { webTokenSchema as n } from "../../../tokens/service/types/webToken.model.js";
3
- import { SwapQuoteRouteSchema as o, SwapDataSchema as a } from "./quote.model.js";
3
+ import { SwapDataSchema as o, SwapQuoteRouteSchema as a } from "./quote.model.js";
4
4
  var t;
5
5
  (function(r) {
6
6
  r.EXACT_PAY = "EXACT_PAY", r.EXACT_RECEIVE = "EXACT_RECEIVE";
@@ -18,8 +18,8 @@ const m = e.nativeEnum(t), p = e.object({
18
18
  totalFeePercentage: e.number(),
19
19
  expiresAt: e.number(),
20
20
  expiresIn: e.number(),
21
- route: o,
22
- data: a
21
+ route: a,
22
+ data: o
23
23
  });
24
24
  export {
25
25
  p as TradeSchema,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("url-join"),f=require("./BackendPaginationError.cjs"),A=require("../utils/address.cjs"),P=require("../chains/starknet/address.cjs"),u=32;class S{constructor(e,t){this.apiBase=e,this.httpService=t}async getNfts(e,t,r,s=1){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=this.pageToPageIndex(s),l=`${o(c,"profile",a,"nfts")}?page=${m}&size=${u}`,i=await this.httpService.get(l),n=i.content.map(p=>this.mapItem(p,r));return{totalPages:i.totalPages,page:i.number+1,count:n.length,nfts:n}}async getCollection(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s),m=`${a}/collection/${s}`,[g,l]=await Promise.all([this.httpService.get(c),this.httpService.get(m)]),i=h(g),n=l.content.map(p=>this.mapItem(p));return{...i,nfts:{totalPages:l.totalPages,page:l.number,count:n.length,data:n}}}async getNft(e,t,r,s){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=o(c,"nft",a,s),g=await this.httpService.get(m);return this.mapItem(g)}async getProfileCollections(e,t,r,s=1,a=!1){const c=this.pageToPageIndex(s),m=this.normalizeAddress(r),g=o(this.apiBase,"pandora",e,t),l=o(g,"profile",m,"collections",`?page=${c}&size=${u}`),i=await this.httpService.get(l),n=[];for(const p of i.content)if(a){const b=await this.getCollectionMetrics(e,t,p.contractAddress);n.push(h(p,b))}else n.push(h(p));return{totalPages:i.totalPages,page:i.number+1,count:n.length,collections:n}}async getCollectionMetrics(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s,"metrics");return this.httpService.get(c)}normalizeAddress(e){return P.addressSchemaArgentBackend.parse(e)}pageToPageIndex(e){if(!Number.isInteger(e))throw new f.BackendPaginationError("notANumber");const t=e-1;if(t<0)throw new f.BackendPaginationError("tooLow");return t}mapItem(e,t){var s;const r=e.name??e.tokenId;return{token_id:e.tokenId,contract_address:e.contractAddress,name:r,spec:"spec"in e?v(e.spec):void 0,description:"",best_bid_order:{payment_amount:"bestListPrice"in e?BigInt(e.bestListPrice):void 0},properties:"properties"in e&&e.properties.map(a=>({key:a.key,value:a.value}))||[],image_uri:e.imageUrls.preview,image_url_copy:e.imageUrls.full,owner:{account_address:((s=e.owner)==null?void 0:s.address)||t},contract_name:A.formatAddress(e.contractAddress)}}}function v(d){switch(d){case"erc721":case"starknetErc721":return"ERC721";case"erc1155":case"starknetErc1155":return"ERC1155"}}function h(d,e){return{contractAddress:P.addressSchema.parse(d.contractAddress),name:d.name||A.formatAddress(d.contractAddress),description:d.description??"",imageUri:d.imageUrls.preview,...e&&{owners:{total:e.numberOfItems,unique:e.uniqueOwners},...e.floorPrice&&{floorPrice:BigInt(e.floorPrice)}}}}exports.BackendNftService=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("url-join"),f=require("./BackendPaginationError.cjs"),A=require("../chains/starknet/address.cjs"),P=require("../utils/address.cjs"),u=32;class S{constructor(e,t){this.apiBase=e,this.httpService=t}async getNfts(e,t,r,s=1){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=this.pageToPageIndex(s),l=`${o(c,"profile",a,"nfts")}?page=${m}&size=${u}`,i=await this.httpService.get(l),n=i.content.map(p=>this.mapItem(p,r));return{totalPages:i.totalPages,page:i.number+1,count:n.length,nfts:n}}async getCollection(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s),m=`${a}/collection/${s}`,[g,l]=await Promise.all([this.httpService.get(c),this.httpService.get(m)]),i=h(g),n=l.content.map(p=>this.mapItem(p));return{...i,nfts:{totalPages:l.totalPages,page:l.number,count:n.length,data:n}}}async getNft(e,t,r,s){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=o(c,"nft",a,s),g=await this.httpService.get(m);return this.mapItem(g)}async getProfileCollections(e,t,r,s=1,a=!1){const c=this.pageToPageIndex(s),m=this.normalizeAddress(r),g=o(this.apiBase,"pandora",e,t),l=o(g,"profile",m,"collections",`?page=${c}&size=${u}`),i=await this.httpService.get(l),n=[];for(const p of i.content)if(a){const b=await this.getCollectionMetrics(e,t,p.contractAddress);n.push(h(p,b))}else n.push(h(p));return{totalPages:i.totalPages,page:i.number+1,count:n.length,collections:n}}async getCollectionMetrics(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s,"metrics");return this.httpService.get(c)}normalizeAddress(e){return A.addressSchemaArgentBackend.parse(e)}pageToPageIndex(e){if(!Number.isInteger(e))throw new f.BackendPaginationError("notANumber");const t=e-1;if(t<0)throw new f.BackendPaginationError("tooLow");return t}mapItem(e,t){var s;const r=e.name??e.tokenId;return{token_id:e.tokenId,contract_address:e.contractAddress,name:r,spec:"spec"in e?v(e.spec):void 0,description:"",best_bid_order:{payment_amount:"bestListPrice"in e?BigInt(e.bestListPrice):void 0},properties:"properties"in e&&e.properties.map(a=>({key:a.key,value:a.value}))||[],image_uri:e.imageUrls.preview,image_url_copy:e.imageUrls.full,owner:{account_address:((s=e.owner)==null?void 0:s.address)||t},contract_name:P.formatAddress(e.contractAddress)}}}function v(d){switch(d){case"erc721":case"starknetErc721":return"ERC721";case"erc1155":case"starknetErc1155":return"ERC1155"}}function h(d,e){return{contractAddress:A.addressSchema.parse(d.contractAddress),name:d.name||P.formatAddress(d.contractAddress),description:d.description??"",imageUri:d.imageUrls.preview,...e&&{owners:{total:e.numberOfItems,unique:e.uniqueOwners},...e.floorPrice&&{floorPrice:BigInt(e.floorPrice)}}}}exports.BackendNftService=S;
@@ -1,7 +1,7 @@
1
1
  import n from "url-join";
2
2
  import { BackendPaginationError as f } from "./BackendPaginationError.js";
3
+ import { addressSchema as P, addressSchemaArgentBackend as S } from "../chains/starknet/address.js";
3
4
  import { formatAddress as b } from "../utils/address.js";
4
- import { addressSchemaArgentBackend as P, addressSchema as S } from "../chains/starknet/address.js";
5
5
  const A = 32;
6
6
  class k {
7
7
  constructor(e, t) {
@@ -55,7 +55,7 @@ class k {
55
55
  return this.httpService.get(c);
56
56
  }
57
57
  normalizeAddress(e) {
58
- return P.parse(e);
58
+ return S.parse(e);
59
59
  }
60
60
  pageToPageIndex(e) {
61
61
  if (!Number.isInteger(e))
@@ -99,7 +99,7 @@ function w(d) {
99
99
  }
100
100
  function h(d, e) {
101
101
  return {
102
- contractAddress: S.parse(d.contractAddress),
102
+ contractAddress: P.parse(d.contractAddress),
103
103
  name: d.name || b(d.contractAddress),
104
104
  description: d.description ?? "",
105
105
  imageUri: d.imageUrls.preview,
@@ -1,5 +1,5 @@
1
1
  import { z as t } from "zod";
2
- import { addressSchemaArgentBackend as o, addressSchema as a } from "../../../chains/starknet/address.js";
2
+ import { addressSchema as a, addressSchemaArgentBackend as o } from "../../../chains/starknet/address.js";
3
3
  import { defiPositionTypeSchema as d } from "./defiPositionType.model.js";
4
4
  import { createSchemaWithWarnings as g } from "../../../utils/schemas.js";
5
5
  const f = t.object({
@@ -1,5 +1,5 @@
1
1
  import { upperCase as T } from "lodash-es";
2
- import { CallData as C, uint256 as U, num as r } from "starknet";
2
+ import { num as r, CallData as C, uint256 as U } from "starknet";
3
3
  import { isEqualAddress as I } from "../../chains/starknet/address.js";
4
4
  import { STRK_TOKEN_ADDRESS as y, ETH_TOKEN_ADDRESS as A } from "../../chains/starknet/constants.js";
5
5
  import { argentMaxFee as h } from "./argentMaxFee.js";
@@ -1,4 +1,4 @@
1
- import { constants as r, num as n } from "starknet";
1
+ import { num as n, constants as r } from "starknet";
2
2
  import { z as s } from "zod";
3
3
  const i = Object.values(r.TRANSACTION_VERSION), m = s.string().default("0x3").refine((t) => {
4
4
  const o = n.toBigInt(t);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chains/starknet/services/deploymentData/getAccountClassHash.cjs"),o=require("../chains/starknet/constants.cjs"),t=require("../chains/starknet/address.cjs"),u=[o.STRK_TOKEN_ADDRESS];function n({address:e}){return u.some(s=>t.isEqualAddress(e,s))}function a(e){return e?r.getArgentAccountClassHashesWithTxV3Support().some(s=>t.isEqualAddress(s,e)):!1}exports.classHashSupportsTxV3=a;exports.feeTokenNeedsTxV3Support=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chains/starknet/constants.cjs"),o=require("../chains/starknet/services/deploymentData/getAccountClassHash.cjs"),t=require("../chains/starknet/address.cjs"),u=[r.STRK_TOKEN_ADDRESS];function n({address:e}){return u.some(s=>t.isEqualAddress(e,s))}function a(e){return e?o.getArgentAccountClassHashesWithTxV3Support().some(s=>t.isEqualAddress(s,e)):!1}exports.classHashSupportsTxV3=a;exports.feeTokenNeedsTxV3Support=n;
@@ -1,12 +1,12 @@
1
- import { getArgentAccountClassHashesWithTxV3Support as t } from "../chains/starknet/services/deploymentData/getAccountClassHash.js";
2
- import { STRK_TOKEN_ADDRESS as s } from "../chains/starknet/constants.js";
1
+ import { STRK_TOKEN_ADDRESS as t } from "../chains/starknet/constants.js";
2
+ import { getArgentAccountClassHashesWithTxV3Support as s } from "../chains/starknet/services/deploymentData/getAccountClassHash.js";
3
3
  import { isEqualAddress as o } from "../chains/starknet/address.js";
4
- const n = [s];
4
+ const n = [t];
5
5
  function f({ address: r }) {
6
6
  return n.some((e) => o(r, e));
7
7
  }
8
8
  function m(r) {
9
- return r ? t().some((e) => o(e, r)) : !1;
9
+ return r ? s().some((e) => o(e, r)) : !1;
10
10
  }
11
11
  export {
12
12
  m as classHashSupportsTxV3,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs"),D=require("./isNumeric.cjs"),n={CURRENCY:{minDecimalPlaces:2,maxDecimalPlaces:10,minDecimalSignificantDigits:2,decimalPlacesWhenZero:2,allowLeadingZerosInDecimalPart:!0},TOKEN:{minDecimalPlaces:4,maxDecimalPlaces:16,minDecimalSignificantDigits:2,decimalPlacesWhenZero:1,allowLeadingZerosInDecimalPart:!0}},d=(e,t)=>o(e,{...n.CURRENCY,...t||{}}),P=(e,t)=>o(e,{...n.TOKEN,...t||{}}),o=(e,{minDecimalPlaces:t,maxDecimalPlaces:g,minDecimalSignificantDigits:f,decimalPlacesWhenZero:a,allowLeadingZerosInDecimalPart:s}=n.CURRENCY)=>{if(!D.isNumeric(e))return null;const r=new u.BigNumber(typeof e=="bigint"?e.toString():e);let i;const N=`0.${"".padStart(a-1,"0")}1`;if(r.lt(new u.BigNumber(N))&&!s)i=`0.${"".padStart(a,"0")}`;else if(r.gte(1))i=r.toFormat(t);else{const m=r.toFormat(g).split(".")[1].match(/^0+/),b=s&&m&&m.length?m[0].length:0,y=Math.max(b+f,t);i=r.toFormat(y)}let c=i.replace(/0+$/,"");const l=1+i.indexOf(".")+a;return c.length<l&&(c=i.substring(0,l)),c};exports.prettifyCurrencyNumber=d;exports.prettifyNumber=o;exports.prettifyNumberConfig=n;exports.prettifyTokenNumber=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs"),P=require("./isNumeric.cjs"),c={CURRENCY:{minDecimalPlaces:2,maxDecimalPlaces:10,minDecimalSignificantDigits:2,decimalPlacesWhenZero:2,allowLeadingZerosInDecimalPart:!0},TOKEN:{minDecimalPlaces:4,maxDecimalPlaces:16,minDecimalSignificantDigits:2,decimalPlacesWhenZero:1,allowLeadingZerosInDecimalPart:!0}},C=(t,e)=>l(t,{...c.CURRENCY,...e||{}}),S=(t,e)=>l(t,{...c.TOKEN,...e||{}}),l=(t,{minDecimalPlaces:e,maxDecimalPlaces:N,minDecimalSignificantDigits:p,decimalPlacesWhenZero:m,allowLeadingZerosInDecimalPart:o}=c.CURRENCY)=>{if(!P.isNumeric(t))return null;const r=new f.BigNumber(typeof t=="bigint"?t.toString():t);let i;const b=`0.${"".padStart(m-1,"0")}1`;if(r.lt(new f.BigNumber(b))&&!o)i=`0.${"".padStart(m,"0")}`;else if(r.gte(1))i=r.toFormat(e);else{const s=r.toFormat(N).split(".")[1].match(/^0+/),y=o&&s&&s.length?s[0].length:0,D=Math.max(y+p,e);i=r.toFormat(D)}const[d,u]=i.split(".");let n=d;if(u){const a=u.replace(/0+$/,"");n+=a?`.${a}`:""}const g=1+i.indexOf(".")+m;return n.length<g&&(n=i.substring(0,g)),n};exports.prettifyCurrencyNumber=C;exports.prettifyNumber=l;exports.prettifyNumberConfig=c;exports.prettifyTokenNumber=S;
@@ -1,6 +1,6 @@
1
- import { BigNumber as s } from "../../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js";
2
- import { isNumeric as P } from "./isNumeric.js";
3
- const m = {
1
+ import { BigNumber as f } from "../../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js";
2
+ import { isNumeric as C } from "./isNumeric.js";
3
+ const l = {
4
4
  CURRENCY: {
5
5
  minDecimalPlaces: 2,
6
6
  maxDecimalPlaces: 10,
@@ -15,33 +15,38 @@ const m = {
15
15
  decimalPlacesWhenZero: 1,
16
16
  allowLeadingZerosInDecimalPart: !0
17
17
  }
18
- }, x = (t, e) => g(t, {
19
- ...m.CURRENCY,
18
+ }, R = (t, e) => p(t, {
19
+ ...l.CURRENCY,
20
20
  ...e || {}
21
- }), y = (t, e) => g(t, {
22
- ...m.TOKEN,
21
+ }), b = (t, e) => p(t, {
22
+ ...l.TOKEN,
23
23
  ...e || {}
24
- }), g = (t, { minDecimalPlaces: e, maxDecimalPlaces: f, minDecimalSignificantDigits: u, decimalPlacesWhenZero: n, allowLeadingZerosInDecimalPart: o } = m.CURRENCY) => {
25
- if (!P(t))
24
+ }), p = (t, { minDecimalPlaces: e, maxDecimalPlaces: u, minDecimalSignificantDigits: D, decimalPlacesWhenZero: c, allowLeadingZerosInDecimalPart: o } = l.CURRENCY) => {
25
+ if (!C(t))
26
26
  return null;
27
- const r = new s(typeof t == "bigint" ? t.toString() : t);
27
+ const r = new f(typeof t == "bigint" ? t.toString() : t);
28
28
  let i;
29
- const p = `0.${"".padStart(n - 1, "0")}1`;
30
- if (r.lt(new s(p)) && !o)
31
- i = `0.${"".padStart(n, "0")}`;
29
+ const d = `0.${"".padStart(c - 1, "0")}1`;
30
+ if (r.lt(new f(d)) && !o)
31
+ i = `0.${"".padStart(c, "0")}`;
32
32
  else if (r.gte(1))
33
33
  i = r.toFormat(e);
34
34
  else {
35
- const c = r.toFormat(f).split(".")[1].match(/^0+/), N = o && c && c.length ? c[0].length : 0, d = Math.max(N + u, e);
36
- i = r.toFormat(d);
35
+ const m = r.toFormat(u).split(".")[1].match(/^0+/), P = o && m && m.length ? m[0].length : 0, h = Math.max(P + D, e);
36
+ i = r.toFormat(h);
37
37
  }
38
- let a = i.replace(/0+$/, "");
39
- const l = 1 + i.indexOf(".") + n;
40
- return a.length < l && (a = i.substring(0, l)), a;
38
+ const [N, s] = i.split(".");
39
+ let n = N;
40
+ if (s) {
41
+ const a = s.replace(/0+$/, "");
42
+ n += a ? `.${a}` : "";
43
+ }
44
+ const g = 1 + i.indexOf(".") + c;
45
+ return n.length < g && (n = i.substring(0, g)), n;
41
46
  };
42
47
  export {
43
- x as prettifyCurrencyNumber,
44
- g as prettifyNumber,
45
- m as prettifyNumberConfig,
46
- y as prettifyTokenNumber
48
+ R as prettifyCurrencyNumber,
49
+ p as prettifyNumber,
50
+ l as prettifyNumberConfig,
51
+ b as prettifyTokenNumber
47
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argent/x-shared",
3
- "version": "1.48.2",
3
+ "version": "1.48.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/argentlabs/x-shared.git"
@@ -43,29 +43,29 @@
43
43
  "format:fix": "prettier . --ignore-unknown --write"
44
44
  },
45
45
  "devDependencies": {
46
- "@amplitude/analytics-types": "^2.7.0",
47
- "@commitlint/cli": "^19.0.0",
48
- "@commitlint/config-conventional": "^19.0.0",
49
- "@rollup/plugin-typescript": "^12.0.0",
50
- "@semantic-release/git": "^10.0.1",
51
- "@types/async-retry": "^1.4.8",
52
- "@types/lodash-es": "^4.17.6",
53
- "@types/ua-parser-js": "^0.7.39",
54
- "@typescript-eslint/eslint-plugin": "^8.0.0",
55
- "@typescript-eslint/parser": "^8.0.0",
56
- "eslint": "^8.7.0",
57
- "eslint-config-prettier": "^9.1.0",
58
- "eslint-plugin-import": "^2.29.1",
59
- "husky": ">=7",
60
- "lint-staged": ">=10",
61
- "msw": "^2.0.0",
62
- "prettier": "^3.2.5",
63
- "semantic-release": "^24.0.0",
64
- "ts-to-zod": "^3.2.0",
65
- "typescript": "^5.0.4",
66
- "vite": "^5.0.0",
67
- "vite-plugin-dts": "^4.0.0",
68
- "vitest": "2.1.4"
46
+ "@amplitude/analytics-types": "2.8.4",
47
+ "@commitlint/cli": "19.5.0",
48
+ "@commitlint/config-conventional": "19.5.0",
49
+ "@rollup/plugin-typescript": "12.1.1",
50
+ "@semantic-release/git": "10.0.1",
51
+ "@types/async-retry": "1.4.9",
52
+ "@types/lodash-es": "4.17.12",
53
+ "@types/ua-parser-js": "0.7.39",
54
+ "@typescript-eslint/eslint-plugin": "8.14.0",
55
+ "@typescript-eslint/parser": "8.14.0",
56
+ "eslint": "8.57.1",
57
+ "eslint-config-prettier": "9.1.0",
58
+ "eslint-plugin-import": "2.31.0",
59
+ "husky": "9.1.6",
60
+ "lint-staged": "15.2.10",
61
+ "msw": "2.6.5",
62
+ "prettier": "3.3.3",
63
+ "semantic-release": "24.2.0",
64
+ "ts-to-zod": "3.13.0",
65
+ "typescript": "5.6.3",
66
+ "vite": "5.4.11",
67
+ "vite-plugin-dts": "4.3.0",
68
+ "vitest": "2.1.5"
69
69
  },
70
70
  "dependencies": {
71
71
  "@argent/x-multicall": "^7.1.0",
@@ -82,7 +82,7 @@
82
82
  "@scure/bip39": "^1.2.1",
83
83
  "async-retry": "^1.3.3",
84
84
  "lodash-es": "^4.17.21",
85
- "ua-parser-js": "^1.0.38",
85
+ "ua-parser-js": "^1.0.38 || ^2.0.0",
86
86
  "url-join": "^5.0.0",
87
87
  "zod": "^3.23.8"
88
88
  },