@argent/x-shared 1.49.1 → 1.51.0

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./utils.cjs"),e=require("./lib.cjs"),r=require("./parseUnits.cjs"),s=require("./formatUnits.cjs"),i=require("./constants.cjs"),a=require("./createUnitsSchema.cjs");exports.absBigInt=t.absBigInt;exports.formatCurrency=t.formatCurrency;exports.formatEther=t.formatEther;exports.parseCurrency=t.parseCurrency;exports.parseCurrencyAbs=t.parseCurrencyAbs;exports.parseEther=t.parseEther;exports.toBigDecimal=t.toBigDecimal;exports.abs=e.abs;exports.add=e.add;exports.div=e.div;exports.eq=e.eq;exports.gt=e.gt;exports.gte=e.gte;exports.lt=e.lt;exports.lte=e.lte;exports.mod=e.mod;exports.mul=e.mul;exports.not=e.not;exports.sub=e.sub;exports.toFixedDecimals=e.toFixedDecimals;exports.toTiniestPossibleDecimal=e.toTiniestPossibleDecimal;exports.parseUnits=r.parseUnits;exports.formatUnits=s.formatUnits;exports.ONE=i.ONE;exports.createUnitsSchema=a.createUnitsSchema;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./utils.cjs"),e=require("./lib.cjs"),r=require("./parseUnits.cjs"),s=require("./formatUnits.cjs"),i=require("./constants.cjs"),a=require("./createUnitsSchema.cjs");exports.absBigInt=t.absBigInt;exports.formatCurrency=t.formatCurrency;exports.formatEther=t.formatEther;exports.parseCurrency=t.parseCurrency;exports.parseCurrencyAbs=t.parseCurrencyAbs;exports.parseEther=t.parseEther;exports.toBigDecimal=t.toBigDecimal;exports.abs=e.abs;exports.add=e.add;exports.ceil=e.ceil;exports.div=e.div;exports.eq=e.eq;exports.floor=e.floor;exports.gt=e.gt;exports.gte=e.gte;exports.lt=e.lt;exports.lte=e.lte;exports.max=e.max;exports.min=e.min;exports.mod=e.mod;exports.mul=e.mul;exports.not=e.not;exports.pow=e.pow;exports.round=e.round;exports.sign=e.sign;exports.sqrt=e.sqrt;exports.sub=e.sub;exports.toFixedDecimals=e.toFixedDecimals;exports.toTiniestPossibleDecimal=e.toTiniestPossibleDecimal;exports.parseUnits=r.parseUnits;exports.formatUnits=s.formatUnits;exports.ONE=i.ONE;exports.createUnitsSchema=a.createUnitsSchema;
@@ -1,33 +1,41 @@
1
- import { absBigInt as t, formatCurrency as o, formatEther as a, parseCurrency as m, parseCurrencyAbs as s, parseEther as i, toBigDecimal as p } from "./utils.js";
2
- import { abs as n, add as c, div as l, eq as x, gt as b, gte as d, lt as u, lte as g, mod as h, mul as y, not as C, sub as D, toFixedDecimals as E, toTiniestPossibleDecimal as U } from "./lib.js";
3
- import { parseUnits as q } from "./parseUnits.js";
4
- import { formatUnits as A } from "./formatUnits.js";
5
- import { ONE as I } from "./constants.js";
6
- import { createUnitsSchema as O } from "./createUnitsSchema.js";
1
+ import { absBigInt as t, formatCurrency as o, formatEther as m, parseCurrency as s, parseCurrencyAbs as a, parseEther as i, toBigDecimal as n } from "./utils.js";
2
+ import { abs as f, add as c, ceil as l, div as x, eq as d, floor as u, gt as b, gte as g, lt as h, lte as y, max as C, min as D, mod as E, mul as U, not as q, pow as B, round as v, sign as w, sqrt as A, sub as F, toFixedDecimals as I, toTiniestPossibleDecimal as N } from "./lib.js";
3
+ import { parseUnits as P } from "./parseUnits.js";
4
+ import { formatUnits as T } from "./formatUnits.js";
5
+ import { ONE as k } from "./constants.js";
6
+ import { createUnitsSchema as G } from "./createUnitsSchema.js";
7
7
  export {
8
- I as ONE,
9
- n as abs,
8
+ k as ONE,
9
+ f as abs,
10
10
  t as absBigInt,
11
11
  c as add,
12
- O as createUnitsSchema,
13
- l as div,
14
- x as eq,
12
+ l as ceil,
13
+ G as createUnitsSchema,
14
+ x as div,
15
+ d as eq,
16
+ u as floor,
15
17
  o as formatCurrency,
16
- a as formatEther,
17
- A as formatUnits,
18
+ m as formatEther,
19
+ T as formatUnits,
18
20
  b as gt,
19
- d as gte,
20
- u as lt,
21
- g as lte,
22
- h as mod,
23
- y as mul,
24
- C as not,
25
- m as parseCurrency,
26
- s as parseCurrencyAbs,
21
+ g as gte,
22
+ h as lt,
23
+ y as lte,
24
+ C as max,
25
+ D as min,
26
+ E as mod,
27
+ U as mul,
28
+ q as not,
29
+ s as parseCurrency,
30
+ a as parseCurrencyAbs,
27
31
  i as parseEther,
28
- q as parseUnits,
29
- D as sub,
30
- p as toBigDecimal,
31
- E as toFixedDecimals,
32
- U as toTiniestPossibleDecimal
32
+ P as parseUnits,
33
+ B as pow,
34
+ v as round,
35
+ w as sign,
36
+ A as sqrt,
37
+ F as sub,
38
+ n as toBigDecimal,
39
+ I as toFixedDecimals,
40
+ N as toTiniestPossibleDecimal
33
41
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=(e,t)=>({decimals:t,value:t>=e.decimals?e.value*BigInt(10)**BigInt(t-e.decimals):e.value/BigInt(10)**BigInt(e.decimals-t)}),d=e=>{const t=e.value.toString().split("").reverse();let s=0;for(let i=0;i<t.length&&t[i]==="0";i++)s++;const l=e.decimals-s;return a(e,l)},r=(e,t)=>{const s=Math.max(e.decimals,t.decimals),[l,i]=[e,t].map(o=>a(o,s));return[l.value,i.value,s]},c=e=>(t,s)=>{const[l,i,o]=r(t,s);return{decimals:o,value:e(l,i,o)}},n=e=>(t,s)=>{const[l,i]=r(t,s);return e(l,i)},v=c((e,t)=>e+t),g=c((e,t)=>e-t),m=c((e,t,s)=>{if(t===BigInt(0))throw new Error("Division by zero is not allowed");return e*BigInt(10)**BigInt(s)/t}),B=(e,t)=>d({decimals:e.decimals+t.decimals,value:e.value*t.value}),I=c((e,t)=>{if(t===BigInt(0))throw new Error("Modulus by zero is not allowed");return e%t}),j=e=>({decimals:e.decimals,value:e.value>=BigInt(0)?e.value:-e.value}),u=n((e,t)=>e===t),b=n((e,t)=>e<t),w=n((e,t)=>e>t),p=n((e,t)=>e<=t),D=n((e,t)=>e>=t),f=(e,t)=>!u(e,t);exports.abs=j;exports.add=v;exports.div=m;exports.eq=u;exports.gt=w;exports.gte=D;exports.lt=b;exports.lte=p;exports.mod=I;exports.mul=B;exports.not=f;exports.sub=g;exports.toFixedDecimals=a;exports.toTiniestPossibleDecimal=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(e,t)=>({decimals:t,value:t>=e.decimals?e.value*BigInt(10)**BigInt(t-e.decimals):e.value/BigInt(10)**BigInt(e.decimals-t)}),d=e=>{if(e.value===BigInt(0))return{value:BigInt(0),decimals:0};const i=e.value.toString().replace("-","").split("").reverse();let l=0;for(const a of i){if(a!=="0")break;l++}const s=Math.max(0,e.decimals-l);return r(e,s)},v=(e,t)=>{const i=Math.max(e.decimals,t.decimals),[l,s]=[e,t].map(a=>r(a,i));return[l.value,s.value,i]},o=e=>(t,i)=>{const[l,s,a]=v(t,i);return{decimals:a,value:e(l,s,a)}},c=e=>(t,i)=>{const[l,s]=v(t,i);return e(l,s)},h=o((e,t)=>e+t),b=o((e,t)=>e-t),g=o((e,t,i)=>{if(t===BigInt(0))throw new Error("Division by zero is not allowed");return e*BigInt(10)**BigInt(i)/t}),j=(e,t)=>d({decimals:e.decimals+t.decimals,value:e.value*t.value}),p=o((e,t)=>{if(t===BigInt(0))throw new Error("Modulus by zero is not allowed");return e%t}),D=e=>({decimals:e.decimals,value:e.value>=BigInt(0)?e.value:-e.value}),m=c((e,t)=>e===t),B=c((e,t)=>e<t),q=c((e,t)=>e>t),I=c((e,t)=>e<=t),f=c((e,t)=>e>=t),A=(e,t)=>!m(e,t),w=(e,t)=>{if(!Number.isInteger(t))throw new Error("Exponent must be an integer");if(t<0)return g({value:BigInt(1),decimals:0},w(e,-t));if(t===0)return{value:BigInt(1),decimals:0};let i={value:BigInt(1),decimals:0},l={...e},s=Math.abs(t);for(;s>0;)s&1&&(i={value:i.value*l.value,decimals:i.decimals+l.decimals}),l={value:l.value*l.value,decimals:l.decimals*2},s>>=1;return i},E=e=>{if(B(e,{value:BigInt(0),decimals:0}))throw new Error("Cannot calculate square root of negative number");if(e.value===BigInt(0))return{value:BigInt(0),decimals:0};const t=e.decimals+e.decimals%2,i=r(e,t);let l=BigInt(0),s=i.value,a=s;for(;l<=s;){const n=(l+s)/BigInt(2),u=n*n;if(u===i.value){a=n;break}u<i.value?(l=n+BigInt(1),a=n):s=n-BigInt(1)}return{value:a,decimals:t/2}},M=e=>{const t=BigInt(10)**BigInt(e.decimals),i=e.value%t,l=t/BigInt(2);return{decimals:0,value:e.value/t+(i>=l?BigInt(1):BigInt(0))}},S=e=>({decimals:0,value:e.value/BigInt(10)**BigInt(e.decimals)}),y=e=>{const t=BigInt(10)**BigInt(e.decimals);return{decimals:0,value:(e.value+t-BigInt(1))/t}},z=(e,t)=>f(e,t)?e:t,F=(e,t)=>I(e,t)?e:t,O=e=>e.value===BigInt(0)?0:e.value>BigInt(0)?1:-1;exports.abs=D;exports.add=h;exports.ceil=y;exports.div=g;exports.eq=m;exports.floor=S;exports.gt=q;exports.gte=f;exports.lt=B;exports.lte=I;exports.max=z;exports.min=F;exports.mod=p;exports.mul=j;exports.not=A;exports.pow=w;exports.round=M;exports.sign=O;exports.sqrt=E;exports.sub=b;exports.toFixedDecimals=r;exports.toTiniestPossibleDecimal=d;
@@ -13,3 +13,11 @@ export declare const gt: (a: BigDecimal, b: BigDecimal) => boolean;
13
13
  export declare const lte: (a: BigDecimal, b: BigDecimal) => boolean;
14
14
  export declare const gte: (a: BigDecimal, b: BigDecimal) => boolean;
15
15
  export declare const not: (a: BigDecimal, b: BigDecimal) => boolean;
16
+ export declare const pow: (base: BigDecimal, exponent: number) => BigDecimal;
17
+ export declare const sqrt: (x: BigDecimal) => BigDecimal;
18
+ export declare const round: (x: BigDecimal) => BigDecimal;
19
+ export declare const floor: (x: BigDecimal) => BigDecimal;
20
+ export declare const ceil: (x: BigDecimal) => BigDecimal;
21
+ export declare const max: (a: BigDecimal, b: BigDecimal) => BigDecimal;
22
+ export declare const min: (a: BigDecimal, b: BigDecimal) => BigDecimal;
23
+ export declare const sign: (x: BigDecimal) => -1 | 0 | 1;
@@ -1,53 +1,117 @@
1
- const a = (e, t) => ({
1
+ const u = (e, t) => ({
2
2
  decimals: t,
3
3
  value: t >= e.decimals ? e.value * BigInt(10) ** BigInt(t - e.decimals) : e.value / BigInt(10) ** BigInt(e.decimals - t)
4
- }), d = (e) => {
5
- const t = e.value.toString().split("").reverse();
6
- let s = 0;
7
- for (let i = 0; i < t.length && t[i] === "0"; i++)
8
- s++;
9
- const l = e.decimals - s;
10
- return a(e, l);
11
- }, r = (e, t) => {
12
- const s = Math.max(e.decimals, t.decimals), [l, i] = [e, t].map((c) => a(c, s));
13
- return [l.value, i.value, s];
14
- }, o = (e) => (t, s) => {
15
- const [l, i, c] = r(t, s);
4
+ }), v = (e) => {
5
+ if (e.value === BigInt(0))
6
+ return { value: BigInt(0), decimals: 0 };
7
+ const i = e.value.toString().replace("-", "").split("").reverse();
8
+ let l = 0;
9
+ for (const a of i) {
10
+ if (a !== "0")
11
+ break;
12
+ l++;
13
+ }
14
+ const s = Math.max(0, e.decimals - l);
15
+ return u(e, s);
16
+ }, d = (e, t) => {
17
+ const i = Math.max(e.decimals, t.decimals), [l, s] = [e, t].map((a) => u(a, i));
18
+ return [l.value, s.value, i];
19
+ }, r = (e) => (t, i) => {
20
+ const [l, s, a] = d(t, i);
16
21
  return {
17
- decimals: c,
18
- value: e(l, i, c)
22
+ decimals: a,
23
+ value: e(l, s, a)
19
24
  };
20
- }, n = (e) => (t, s) => {
21
- const [l, i] = r(t, s);
22
- return e(l, i);
23
- }, v = o((e, t) => e + t), g = o((e, t) => e - t), B = o((e, t, s) => {
25
+ }, c = (e) => (t, i) => {
26
+ const [l, s] = d(t, i);
27
+ return e(l, s);
28
+ }, h = r((e, t) => e + t), j = r((e, t) => e - t), g = r((e, t, i) => {
24
29
  if (t === BigInt(0))
25
30
  throw new Error("Division by zero is not allowed");
26
- return e * BigInt(10) ** BigInt(s) / t;
27
- }), m = (e, t) => d({
31
+ return e * BigInt(10) ** BigInt(i) / t;
32
+ }), p = (e, t) => v({
28
33
  decimals: e.decimals + t.decimals,
29
34
  value: e.value * t.value
30
- }), I = o((e, t) => {
35
+ }), A = r((e, t) => {
31
36
  if (t === BigInt(0))
32
37
  throw new Error("Modulus by zero is not allowed");
33
38
  return e % t;
34
- }), j = (e) => ({
39
+ }), D = (e) => ({
35
40
  decimals: e.decimals,
36
41
  value: e.value >= BigInt(0) ? e.value : -e.value
37
- }), u = n((e, t) => e === t), w = n((e, t) => e < t), p = n((e, t) => e > t), h = n((e, t) => e <= t), A = n((e, t) => e >= t), f = (e, t) => !u(e, t);
42
+ }), m = c((e, t) => e === t), B = c((e, t) => e < t), E = c((e, t) => e > t), I = c((e, t) => e <= t), f = c((e, t) => e >= t), b = (e, t) => !m(e, t), w = (e, t) => {
43
+ if (!Number.isInteger(t))
44
+ throw new Error("Exponent must be an integer");
45
+ if (t < 0)
46
+ return g({ value: BigInt(1), decimals: 0 }, w(e, -t));
47
+ if (t === 0)
48
+ return { value: BigInt(1), decimals: 0 };
49
+ let i = { value: BigInt(1), decimals: 0 }, l = { ...e }, s = Math.abs(t);
50
+ for (; s > 0; )
51
+ s & 1 && (i = {
52
+ value: i.value * l.value,
53
+ decimals: i.decimals + l.decimals
54
+ }), l = {
55
+ value: l.value * l.value,
56
+ decimals: l.decimals * 2
57
+ }, s >>= 1;
58
+ return i;
59
+ }, q = (e) => {
60
+ if (B(e, { value: BigInt(0), decimals: 0 }))
61
+ throw new Error("Cannot calculate square root of negative number");
62
+ if (e.value === BigInt(0))
63
+ return { value: BigInt(0), decimals: 0 };
64
+ const t = e.decimals + e.decimals % 2, i = u(e, t);
65
+ let l = BigInt(0), s = i.value, a = s;
66
+ for (; l <= s; ) {
67
+ const n = (l + s) / BigInt(2), o = n * n;
68
+ if (o === i.value) {
69
+ a = n;
70
+ break;
71
+ }
72
+ o < i.value ? (l = n + BigInt(1), a = n) : s = n - BigInt(1);
73
+ }
74
+ return {
75
+ value: a,
76
+ decimals: t / 2
77
+ };
78
+ }, z = (e) => {
79
+ const t = BigInt(10) ** BigInt(e.decimals), i = e.value % t, l = t / BigInt(2);
80
+ return {
81
+ decimals: 0,
82
+ value: e.value / t + (i >= l ? BigInt(1) : BigInt(0))
83
+ };
84
+ }, M = (e) => ({
85
+ decimals: 0,
86
+ value: e.value / BigInt(10) ** BigInt(e.decimals)
87
+ }), S = (e) => {
88
+ const t = BigInt(10) ** BigInt(e.decimals);
89
+ return {
90
+ decimals: 0,
91
+ value: (e.value + t - BigInt(1)) / t
92
+ };
93
+ }, k = (e, t) => f(e, t) ? e : t, y = (e, t) => I(e, t) ? e : t, C = (e) => e.value === BigInt(0) ? 0 : e.value > BigInt(0) ? 1 : -1;
38
94
  export {
39
- j as abs,
40
- v as add,
41
- B as div,
42
- u as eq,
43
- p as gt,
44
- A as gte,
45
- w as lt,
46
- h as lte,
47
- I as mod,
48
- m as mul,
49
- f as not,
50
- g as sub,
51
- a as toFixedDecimals,
52
- d as toTiniestPossibleDecimal
95
+ D as abs,
96
+ h as add,
97
+ S as ceil,
98
+ g as div,
99
+ m as eq,
100
+ M as floor,
101
+ E as gt,
102
+ f as gte,
103
+ B as lt,
104
+ I as lte,
105
+ k as max,
106
+ y as min,
107
+ A as mod,
108
+ p as mul,
109
+ b as not,
110
+ w as pow,
111
+ z as round,
112
+ C as sign,
113
+ q as sqrt,
114
+ j as sub,
115
+ u as toFixedDecimals,
116
+ v as toTiniestPossibleDecimal
53
117
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../../../node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.cjs"),e=require("./constants.cjs");function a(t){const A=Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),r=Object.entries(e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES);switch(t){case"cairo0":return A.filter(([s])=>n.default.lt(s,"0.3.0")).map(([,s])=>s);case"cairo1":return A.filter(([s])=>n.default.gte(s,"0.3.0")).map(([,s])=>s);case"multisig":return r.map(([,s])=>s);default:return A.map(([,s])=>s)}}function c(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),"*");if(!t)throw new Error(`No argent account contract found: v${t} `);return e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES[t]}function C(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES),"*");if(!t)throw new Error(`No argent multisig contract found: v${t} `);return e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES[t]}function S(){return Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES).filter(([t])=>n.default.gte(t,"0.4.0")).map(([,t])=>t)}function o(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),"<0.3.0");if(!t)throw new Error(`No argent account contract found: v${t} `);return e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES[t]}function u(){const t=Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES).filter(([r])=>n.default.gte(r,"0.3.1")).map(([,r])=>r),A=Object.entries(e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES).filter(([r])=>n.default.gte(r,"0.1.1")).map(([,r])=>r);return[...t,...A]}function i(){return Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES).filter(([t])=>n.default.gte(t,"0.4.0")).map(([,t])=>t)}function T(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),">=0.4.0");if(!t)throw new Error(`No ledger account contract found: v${t}`);return e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES[t]}exports.getArgentAccountClassHashes=a;exports.getArgentAccountClassHashesWithTxV3Support=u;exports.getArgentAccountWithMultiSignerClassHashes=S;exports.getLastCairo0ArgentAccountClassHash=o;exports.getLatestArgentAccountClassHash=c;exports.getLatestArgentMultisigClassHash=C;exports.getLatestLedgerAccountClassHash=T;exports.getLedgerAccountClassHashes=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../../../_virtual/semver.cjs"),e=require("./constants.cjs");function a(t){const A=Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),r=Object.entries(e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES);switch(t){case"cairo0":return A.filter(([s])=>n.default.lt(s,"0.3.0")).map(([,s])=>s);case"cairo1":return A.filter(([s])=>n.default.gte(s,"0.3.0")).map(([,s])=>s);case"multisig":return r.map(([,s])=>s);default:return A.map(([,s])=>s)}}function c(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),"*");if(!t)throw new Error(`No argent account contract found: v${t} `);return e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES[t]}function C(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES),"*");if(!t)throw new Error(`No argent multisig contract found: v${t} `);return e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES[t]}function S(){return Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES).filter(([t])=>n.default.gte(t,"0.4.0")).map(([,t])=>t)}function o(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),"<0.3.0");if(!t)throw new Error(`No argent account contract found: v${t} `);return e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES[t]}function u(){const t=Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES).filter(([r])=>n.default.gte(r,"0.3.1")).map(([,r])=>r),A=Object.entries(e.ARGENT_MULTISIG_CONTRACT_CLASS_HASHES).filter(([r])=>n.default.gte(r,"0.1.1")).map(([,r])=>r);return[...t,...A]}function i(){return Object.entries(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES).filter(([t])=>n.default.gte(t,"0.4.0")).map(([,t])=>t)}function T(){const t=n.default.maxSatisfying(Object.keys(e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES),">=0.4.0");if(!t)throw new Error(`No ledger account contract found: v${t}`);return e.ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES[t]}exports.getArgentAccountClassHashes=a;exports.getArgentAccountClassHashesWithTxV3Support=u;exports.getArgentAccountWithMultiSignerClassHashes=S;exports.getLastCairo0ArgentAccountClassHash=o;exports.getLatestArgentAccountClassHash=c;exports.getLatestArgentMultisigClassHash=C;exports.getLatestLedgerAccountClassHash=T;exports.getLedgerAccountClassHashes=i;
@@ -1,4 +1,4 @@
1
- import n from "../../../../../node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js";
1
+ import n from "../../../../../_virtual/semver.js";
2
2
  import { ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES as r, ARGENT_MULTISIG_CONTRACT_CLASS_HASHES as a } from "./constants.js";
3
3
  function u(t) {
4
4
  const c = Object.entries(r), s = Object.entries(a);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),i=require("../../../staking/schema.cjs"),u=require("../transactionReview/schema.cjs"),e=require("../../../chains/starknet/address.cjs"),d=t.z.object({network:t.z.string(),hash:t.z.string(),status:t.z.string(),blockNumber:t.z.number().optional(),transactionIndex:t.z.number()}),n=t.z.object({type:t.z.enum(["token","nft"]),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()}),s=t.z.enum(["ethereum","starknet","zksync","zksync2"]),m=t.z.object({type:t.z.enum(["payment","gasFee"]),leg:t.z.enum(["credit","debit"]),asset:n,counterParty:e.addressSchemaArgentBackend.optional(),counterPartyNetwork:s.optional()}),f=t.z.object({address:e.addressSchemaArgentBackend,network:s,type:t.z.enum(["wallet","token"])}),N=t.z.object({chainId:t.z.enum(["TESTNET","MAINNET","SEPOLIA"]),ethereumNetwork:t.z.enum(["mainnet","sepolia"])}),w=t.z.enum(["approval","changePubKey","dappInteraction","deploy","gift","multicall","payment","security","trade","staking"]),p=t.z.enum(["triggerEscapeGuardian","triggerEscapeSigner","escapeGuardian","escapeSigner","guardianChanged","guardianBackupChanged","signerChanged","cancelEscape","accountUpgraded","multisigConfigurationUpdated"]),B=t.z.object({name:t.z.string(),parameters:t.z.array(t.z.unknown()).optional()}),I=t.z.object({guid:t.z.string().optional(),signerType:t.z.string().optional(),signer:t.z.object({publicKey:t.z.string().optional()}).optional()}),T=t.z.object({activeAt:t.z.string().optional(),newGuardian:t.z.string().optional(),newImplementation:t.z.string().optional(),newVersion:t.z.string().optional(),signerGuid:t.z.string().optional(),signers:t.z.array(I).optional()}),l=t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("deploy"),deployer:e.addressSchemaArgentBackend,contractAddress:e.addressSchemaArgentBackend}),t.z.object({type:t.z.literal("approval"),spender:e.addressSchemaArgentBackend,asset:n,approvalType:t.z.string()}),t.z.object({type:t.z.literal("payment"),counterparty:e.addressSchemaArgentBackend,leg:t.z.string(),asset:n,counterpartyNetwork:s.optional()}),t.z.object({type:t.z.literal("trade"),srcAsset:n,destAsset:n}),t.z.object({type:t.z.literal("security"),action:p,context:T.optional()}),t.z.object({type:t.z.literal("dappInteraction"),dappAddress:e.addressSchemaArgentBackend,function:B.optional().nullable()}),t.z.object({type:t.z.literal("staking"),stakingAction:i.stakingActionSchema,counterparty:e.addressSchemaArgentBackend,asset:n,stakerInfo:i.stakerInfoSchema})]),z=t.z.union([l,t.z.object({type:t.z.literal("multicall"),calls:t.z.array(t.z.object({details:l}))})]),y=t.z.object({dappId:t.z.string(),name:t.z.string().optional().nullable()}),c=t.z.object({sent:t.z.boolean(),asset:t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("nft"),tokenAddress:e.addressSchemaArgentBackend,tokenId:t.z.coerce.number().optional(),amount:t.z.string().optional(),collectionName:t.z.string().optional(),collectionPreviewImage:t.z.string().optional().nullable(),nftName:t.z.string().optional().nullable(),nftPreviewImage:t.z.string().optional().nullable()}),t.z.object({type:t.z.literal("token"),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.coerce.string()}).optional().nullable()})])}),g=t.z.object({type:t.z.string(),to:e.addressSchemaArgentBackend,actualFee:t.z.object({type:t.z.string(),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()})}),S=t.z.enum(["pending","success","failure"]),r=t.z.object({compositeId:t.z.string(),id:t.z.string().uuid(),status:S,wallet:e.addressSchemaArgentBackend,txSender:e.addressSchemaArgentBackend,source:t.z.string(),type:w,group:t.z.enum(["finance","security"]),submitted:t.z.number(),lastModified:t.z.number(),transaction:d,transfers:t.z.array(m),fees:t.z.array(g).optional(),relatedAddresses:t.z.array(f).nullable(),network:t.z.string(),networkDetails:N.optional(),details:z,transferSummary:t.z.array(c).optional(),dapp:y.optional(),actions:t.z.array(u.actionSchema).optional(),title:t.z.string().optional(),multisigDetails:t.z.object({signers:t.z.array(e.addressSchemaArgentBackend)}).optional()}),h=t.z.object({title:t.z.string().optional(),shortTitle:t.z.string().optional(),subtitle:t.z.string().optional(),icon:t.z.string().optional(),investment:i.investmentMetaSchema.optional()}),b="native",v="rejected",A="cancelled",k="queued",D=r.pick({status:!0,actions:!0,submitted:!0,lastModified:!0,transferSummary:!0,fees:!0,multisigDetails:!0}).extend({status:t.z.union([S,t.z.enum([v,A,k])]),type:t.z.literal(b),transaction:d.pick({hash:!0}),dapp:u.targetedDappSchema.optional(),meta:h.optional()}),j=t.z.array(r),P=t.z.object({activities:j,page:t.z.number(),pageSize:t.z.number(),totalElements:t.z.number(),totalPages:t.z.number()});function E(a){return p.safeParse(a).success}const o=a=>c.safeParse(a).success,M=a=>o(a)&&a.asset.type==="token",x=a=>o(a)&&a.asset.type==="nft";exports.NativeActivityStatusCancelled=A;exports.NativeActivityStatusQueued=k;exports.NativeActivityStatusRejected=v;exports.NativeActivityTypeNative=b;exports.activitiesSchema=j;exports.activityDappSchema=y;exports.activityDetailsSchema=z;exports.activityResponseSchema=P;exports.activitySchema=r;exports.activitySummarySchema=c;exports.activityTransferSchema=m;exports.feeSchema=g;exports.isActivityDetailsAction=E;exports.isActivitySummary=o;exports.isNftActivitySummary=x;exports.isTokenActivitySummary=M;exports.nativeActivityMetaSchema=h;exports.nativeActivitySchema=D;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),i=require("../../../staking/schema.cjs"),u=require("../transactionReview/schema.cjs"),e=require("../../../chains/starknet/address.cjs"),d=t.z.object({network:t.z.string(),hash:t.z.string(),status:t.z.string(),blockNumber:t.z.number().optional(),transactionIndex:t.z.number()}),n=t.z.object({type:t.z.enum(["token","nft"]),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()}),s=t.z.enum(["ethereum","starknet","zksync","zksync2"]),m=t.z.object({type:t.z.enum(["payment","gasFee"]),leg:t.z.enum(["credit","debit"]),asset:n,counterParty:e.addressSchemaArgentBackend.optional(),counterPartyNetwork:s.optional()}),f=t.z.object({address:e.addressSchemaArgentBackend,network:s,type:t.z.enum(["wallet","token"])}),N=t.z.object({chainId:t.z.enum(["TESTNET","MAINNET","SEPOLIA"]),ethereumNetwork:t.z.enum(["mainnet","sepolia"])}),w=t.z.enum(["approval","changePubKey","dappInteraction","deploy","gift","multicall","payment","security","trade","staking"]),p=t.z.enum(["triggerEscapeGuardian","triggerEscapeSigner","escapeGuardian","escapeSigner","guardianChanged","guardianBackupChanged","signerChanged","cancelEscape","accountUpgraded","multisigConfigurationUpdated"]),B=t.z.object({name:t.z.string(),parameters:t.z.array(t.z.unknown()).optional()}),I=t.z.object({guid:t.z.string().optional(),signerType:t.z.string().optional(),signer:t.z.object({publicKey:t.z.string().optional()}).optional()}),T=t.z.object({activeAt:t.z.string().optional(),newGuardian:t.z.string().optional(),newImplementation:t.z.string().optional(),newVersion:t.z.string().optional(),signerGuid:t.z.string().optional(),signers:t.z.array(I).optional()}),l=t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("deploy"),deployer:e.addressSchemaArgentBackend,contractAddress:e.addressSchemaArgentBackend}),t.z.object({type:t.z.literal("approval"),spender:e.addressSchemaArgentBackend,asset:n,approvalType:t.z.string()}),t.z.object({type:t.z.literal("payment"),counterparty:e.addressSchemaArgentBackend,leg:t.z.string(),asset:n,counterpartyNetwork:s.optional()}),t.z.object({type:t.z.literal("trade"),srcAsset:n,destAsset:n}),t.z.object({type:t.z.literal("security"),action:p,context:T.optional()}),t.z.object({type:t.z.literal("dappInteraction"),dappAddress:e.addressSchemaArgentBackend,function:B.optional().nullable()}),t.z.object({type:t.z.literal("staking"),stakingAction:i.stakingActionSchema,counterparty:e.addressSchemaArgentBackend,asset:n,stakerInfo:i.stakerInfoSchema})]),z=t.z.union([l,t.z.object({type:t.z.literal("multicall"),calls:t.z.array(t.z.object({details:l}))})]),y=t.z.object({dappId:t.z.string(),name:t.z.string().optional().nullable()}),c=t.z.object({sent:t.z.boolean(),asset:t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("nft"),tokenAddress:e.addressSchemaArgentBackend,tokenId:t.z.coerce.number().optional(),amount:t.z.string().optional(),collectionName:t.z.string().optional(),collectionPreviewImage:t.z.string().optional().nullable(),nftName:t.z.string().optional().nullable(),nftPreviewImage:t.z.string().optional().nullable()}),t.z.object({type:t.z.literal("token"),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.coerce.string()}).optional().nullable()})])}),g=t.z.object({type:t.z.string(),to:e.addressSchemaArgentBackend,actualFee:t.z.object({type:t.z.string(),tokenAddress:e.addressSchemaArgentBackend,amount:t.z.string().optional(),fiatAmount:t.z.object({currency:t.z.string(),currencyAmount:t.z.number()}).optional().nullable()})}),S=t.z.enum(["pending","success","failure"]),r=t.z.object({compositeId:t.z.string(),id:t.z.string().uuid(),status:S,wallet:e.addressSchemaArgentBackend,txSender:e.addressSchemaArgentBackend,source:t.z.string(),type:w,group:t.z.enum(["finance","security"]),submitted:t.z.number(),lastModified:t.z.number(),transaction:d,transfers:t.z.array(m),fees:t.z.array(g).optional(),relatedAddresses:t.z.array(f).nullable(),network:t.z.string(),networkDetails:N.optional(),details:z,transferSummary:t.z.array(c).optional(),dapp:y.optional(),actions:t.z.array(u.actionSchema).optional(),title:t.z.string().optional(),multisigDetails:t.z.object({signers:t.z.array(e.addressSchemaArgentBackend)}).optional()}),h=t.z.object({title:t.z.string().optional(),shortTitle:t.z.string().optional(),subtitle:t.z.string().optional(),icon:t.z.string().optional(),investment:i.investmentMetaSchema.optional(),isExecuteFromOutside:t.z.boolean().optional()}),b="native",v="rejected",A="cancelled",k="queued",D=r.pick({status:!0,actions:!0,submitted:!0,lastModified:!0,transferSummary:!0,fees:!0,multisigDetails:!0}).extend({status:t.z.union([S,t.z.enum([v,A,k])]),type:t.z.literal(b),transaction:d.pick({hash:!0}),dapp:u.targetedDappSchema.optional(),meta:h.optional()}),j=t.z.array(r),E=t.z.object({activities:j,page:t.z.number(),pageSize:t.z.number(),totalElements:t.z.number(),totalPages:t.z.number()});function P(a){return p.safeParse(a).success}const o=a=>c.safeParse(a).success,x=a=>o(a)&&a.asset.type==="token",M=a=>o(a)&&a.asset.type==="nft";exports.NativeActivityStatusCancelled=A;exports.NativeActivityStatusQueued=k;exports.NativeActivityStatusRejected=v;exports.NativeActivityTypeNative=b;exports.activitiesSchema=j;exports.activityDappSchema=y;exports.activityDetailsSchema=z;exports.activityResponseSchema=E;exports.activitySchema=r;exports.activitySummarySchema=c;exports.activityTransferSchema=m;exports.feeSchema=g;exports.isActivityDetailsAction=P;exports.isActivitySummary=o;exports.isNftActivitySummary=M;exports.isTokenActivitySummary=x;exports.nativeActivityMetaSchema=h;exports.nativeActivitySchema=D;
@@ -4628,6 +4628,7 @@ export declare const nativeActivityMetaSchema: z.ZodObject<{
4628
4628
  };
4629
4629
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
4630
4630
  }>>;
4631
+ isExecuteFromOutside: z.ZodOptional<z.ZodBoolean>;
4631
4632
  }, "strip", z.ZodTypeAny, {
4632
4633
  icon?: string | undefined;
4633
4634
  title?: string | undefined;
@@ -4643,6 +4644,7 @@ export declare const nativeActivityMetaSchema: z.ZodObject<{
4643
4644
  };
4644
4645
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
4645
4646
  } | undefined;
4647
+ isExecuteFromOutside?: boolean | undefined;
4646
4648
  }, {
4647
4649
  icon?: string | undefined;
4648
4650
  title?: string | undefined;
@@ -4658,6 +4660,7 @@ export declare const nativeActivityMetaSchema: z.ZodObject<{
4658
4660
  };
4659
4661
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
4660
4662
  } | undefined;
4663
+ isExecuteFromOutside?: boolean | undefined;
4661
4664
  }>;
4662
4665
  export type NativeActivityMeta = z.infer<typeof nativeActivityMetaSchema>;
4663
4666
  export declare const NativeActivityTypeNative = "native";
@@ -7030,6 +7033,7 @@ export declare const nativeActivitySchema: z.ZodObject<z.objectUtil.extendShape<
7030
7033
  };
7031
7034
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
7032
7035
  }>>;
7036
+ isExecuteFromOutside: z.ZodOptional<z.ZodBoolean>;
7033
7037
  }, "strip", z.ZodTypeAny, {
7034
7038
  icon?: string | undefined;
7035
7039
  title?: string | undefined;
@@ -7045,6 +7049,7 @@ export declare const nativeActivitySchema: z.ZodObject<z.objectUtil.extendShape<
7045
7049
  };
7046
7050
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
7047
7051
  } | undefined;
7052
+ isExecuteFromOutside?: boolean | undefined;
7048
7053
  }, {
7049
7054
  icon?: string | undefined;
7050
7055
  title?: string | undefined;
@@ -7060,6 +7065,7 @@ export declare const nativeActivitySchema: z.ZodObject<z.objectUtil.extendShape<
7060
7065
  };
7061
7066
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
7062
7067
  } | undefined;
7068
+ isExecuteFromOutside?: boolean | undefined;
7063
7069
  }>>;
7064
7070
  }>, "strip", z.ZodTypeAny, {
7065
7071
  status: "rejected" | "pending" | "success" | "failure" | "cancelled" | "queued";
@@ -7254,6 +7260,7 @@ export declare const nativeActivitySchema: z.ZodObject<z.objectUtil.extendShape<
7254
7260
  };
7255
7261
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
7256
7262
  } | undefined;
7263
+ isExecuteFromOutside?: boolean | undefined;
7257
7264
  } | undefined;
7258
7265
  }, {
7259
7266
  status: "rejected" | "pending" | "success" | "failure" | "cancelled" | "queued";
@@ -7448,6 +7455,7 @@ export declare const nativeActivitySchema: z.ZodObject<z.objectUtil.extendShape<
7448
7455
  };
7449
7456
  stakingAction: "deposit" | "stake" | "initiateWithdraw" | "withdraw" | "claim";
7450
7457
  } | undefined;
7458
+ isExecuteFromOutside?: boolean | undefined;
7451
7459
  } | undefined;
7452
7460
  }>;
7453
7461
  export type NativeActivity = z.infer<typeof nativeActivitySchema>;
@@ -183,14 +183,15 @@ const r = t.object({
183
183
  multisigDetails: t.object({
184
184
  signers: t.array(e)
185
185
  }).optional()
186
- }), T = t.object({
186
+ }), E = t.object({
187
187
  title: t.string().optional(),
188
188
  shortTitle: t.string().optional(),
189
189
  subtitle: t.string().optional(),
190
190
  /** let's not import the keys from x-ui here */
191
191
  icon: t.string().optional(),
192
- investment: g.optional()
193
- }), D = "native", E = "rejected", P = "cancelled", x = "queued", B = p.pick({
192
+ investment: g.optional(),
193
+ isExecuteFromOutside: t.boolean().optional()
194
+ }), T = "native", x = "rejected", D = "cancelled", P = "queued", F = p.pick({
194
195
  status: !0,
195
196
  actions: !0,
196
197
  submitted: !0,
@@ -202,18 +203,18 @@ const r = t.object({
202
203
  status: t.union([
203
204
  l,
204
205
  t.enum([
205
- E,
206
- P,
207
- x
206
+ x,
207
+ D,
208
+ P
208
209
  ])
209
210
  ]),
210
- type: t.literal(D),
211
+ type: t.literal(T),
211
212
  transaction: r.pick({
212
213
  hash: !0
213
214
  }),
214
215
  dapp: b.optional(),
215
- meta: T.optional()
216
- }), M = t.array(p), F = t.object({
216
+ meta: E.optional()
217
+ }), M = t.array(p), B = t.object({
217
218
  activities: M,
218
219
  page: t.number(),
219
220
  pageSize: t.number(),
@@ -223,24 +224,24 @@ const r = t.object({
223
224
  function K(n) {
224
225
  return s.safeParse(n).success;
225
226
  }
226
- const u = (n) => c.safeParse(n).success, R = (n) => u(n) && n.asset.type === "token", q = (n) => u(n) && n.asset.type === "nft";
227
+ const u = (n) => c.safeParse(n).success, O = (n) => u(n) && n.asset.type === "token", R = (n) => u(n) && n.asset.type === "nft";
227
228
  export {
228
- P as NativeActivityStatusCancelled,
229
- x as NativeActivityStatusQueued,
230
- E as NativeActivityStatusRejected,
231
- D as NativeActivityTypeNative,
229
+ D as NativeActivityStatusCancelled,
230
+ P as NativeActivityStatusQueued,
231
+ x as NativeActivityStatusRejected,
232
+ T as NativeActivityTypeNative,
232
233
  M as activitiesSchema,
233
234
  N as activityDappSchema,
234
235
  w as activityDetailsSchema,
235
- F as activityResponseSchema,
236
+ B as activityResponseSchema,
236
237
  p as activitySchema,
237
238
  c as activitySummarySchema,
238
239
  S as activityTransferSchema,
239
240
  I as feeSchema,
240
241
  K as isActivityDetailsAction,
241
242
  u as isActivitySummary,
242
- q as isNftActivitySummary,
243
- R as isTokenActivitySummary,
244
- T as nativeActivityMetaSchema,
245
- B as nativeActivitySchema
243
+ R as isNftActivitySummary,
244
+ O as isTokenActivitySummary,
245
+ E as nativeActivityMetaSchema,
246
+ F as nativeActivitySchema
246
247
  };
@@ -1,6 +1,6 @@
1
1
  import { HTTP_ERROR_MESSAGE } from './IHttpService';
2
2
  export declare class HttpError extends Error {
3
3
  readonly status: number;
4
- readonly data?: unknown;
5
- constructor(message: HTTP_ERROR_MESSAGE | string, status: number, data?: unknown);
4
+ readonly data?: unknown | undefined;
5
+ constructor(message: HTTP_ERROR_MESSAGE | string, status: number, data?: unknown | undefined);
6
6
  }
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=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}},h=(t,e)=>l(t,{...c.CURRENCY,...e||{}}),C=(t,e)=>l(t,{...c.TOKEN,...e||{}}),l=(t,{minDecimalPlaces:e,maxDecimalPlaces:N,minDecimalSignificantDigits:p,decimalPlacesWhenZero:m,allowLeadingZerosInDecimalPart:u}=c.CURRENCY)=>{if(!P.isNumeric(t))return null;const r=new s.BigNumber(typeof t=="bigint"?t.toString():t);let i;const b=`0.${"".padStart(m-1,"0")}1`;if(r.lt(new s.BigNumber(b))&&!u)i=`0.${"".padStart(m,"0")}`;else if(r.gte(1))i=e!==0?r.toFormat(e):r.toFormat(e,s.BigNumber.ROUND_FLOOR);else{const o=r.toFormat(N).split(".")[1].match(/^0+/),d=u&&o&&o.length?o[0].length:0,y=Math.max(d+p,e);i=r.toFormat(y)}const[D,g]=i.split(".");let a=D;if(g){const n=g.replace(/0+$/,"");a+=n?`.${n}`:""}const f=1+i.indexOf(".")+m;return a.length<f&&(a=i.substring(0,f)),a};exports.prettifyCurrencyNumber=h;exports.prettifyNumber=l;exports.prettifyNumberConfig=c;exports.prettifyTokenNumber=C;
@@ -1,6 +1,6 @@
1
- import { BigNumber as f } from "../../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js";
1
+ import { BigNumber as m } from "../../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js";
2
2
  import { isNumeric as C } from "./isNumeric.js";
3
- const l = {
3
+ const s = {
4
4
  CURRENCY: {
5
5
  minDecimalPlaces: 2,
6
6
  maxDecimalPlaces: 10,
@@ -15,38 +15,38 @@ const l = {
15
15
  decimalPlacesWhenZero: 1,
16
16
  allowLeadingZerosInDecimalPart: !0
17
17
  }
18
- }, R = (t, e) => p(t, {
19
- ...l.CURRENCY,
18
+ }, y = (t, e) => D(t, {
19
+ ...s.CURRENCY,
20
20
  ...e || {}
21
- }), b = (t, e) => p(t, {
22
- ...l.TOKEN,
21
+ }), O = (t, e) => D(t, {
22
+ ...s.TOKEN,
23
23
  ...e || {}
24
- }), p = (t, { minDecimalPlaces: e, maxDecimalPlaces: u, minDecimalSignificantDigits: D, decimalPlacesWhenZero: c, allowLeadingZerosInDecimalPart: o } = l.CURRENCY) => {
24
+ }), D = (t, { minDecimalPlaces: e, maxDecimalPlaces: p, minDecimalSignificantDigits: u, decimalPlacesWhenZero: c, allowLeadingZerosInDecimalPart: l } = s.CURRENCY) => {
25
25
  if (!C(t))
26
26
  return null;
27
- const r = new f(typeof t == "bigint" ? t.toString() : t);
28
- let i;
29
- const d = `0.${"".padStart(c - 1, "0")}1`;
30
- if (r.lt(new f(d)) && !o)
31
- i = `0.${"".padStart(c, "0")}`;
32
- else if (r.gte(1))
33
- i = r.toFormat(e);
27
+ const i = new m(typeof t == "bigint" ? t.toString() : t);
28
+ let r;
29
+ const N = `0.${"".padStart(c - 1, "0")}1`;
30
+ if (i.lt(new m(N)) && !l)
31
+ r = `0.${"".padStart(c, "0")}`;
32
+ else if (i.gte(1))
33
+ r = e !== 0 ? i.toFormat(e) : i.toFormat(e, m.ROUND_FLOOR);
34
34
  else {
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);
35
+ const o = i.toFormat(p).split(".")[1].match(/^0+/), P = l && o && o.length ? o[0].length : 0, h = Math.max(P + u, e);
36
+ r = i.toFormat(h);
37
37
  }
38
- const [N, s] = i.split(".");
39
- let n = N;
40
- if (s) {
41
- const a = s.replace(/0+$/, "");
38
+ const [d, g] = r.split(".");
39
+ let n = d;
40
+ if (g) {
41
+ const a = g.replace(/0+$/, "");
42
42
  n += a ? `.${a}` : "";
43
43
  }
44
- const g = 1 + i.indexOf(".") + c;
45
- return n.length < g && (n = i.substring(0, g)), n;
44
+ const f = 1 + r.indexOf(".") + c;
45
+ return n.length < f && (n = r.substring(0, f)), n;
46
46
  };
47
47
  export {
48
- R as prettifyCurrencyNumber,
49
- p as prettifyNumber,
50
- l as prettifyNumberConfig,
51
- b as prettifyTokenNumber
48
+ y as prettifyCurrencyNumber,
49
+ D as prettifyNumber,
50
+ s as prettifyNumberConfig,
51
+ O as prettifyTokenNumber
52
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argent/x-shared",
3
- "version": "1.49.1",
3
+ "version": "1.51.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/argentlabs/x-shared.git"
@@ -44,28 +44,28 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@amplitude/analytics-types": "2.8.4",
47
- "@commitlint/cli": "19.5.0",
48
- "@commitlint/config-conventional": "19.5.0",
47
+ "@commitlint/cli": "19.6.0",
48
+ "@commitlint/config-conventional": "19.6.0",
49
49
  "@rollup/plugin-typescript": "12.1.1",
50
50
  "@semantic-release/git": "10.0.1",
51
51
  "@types/async-retry": "1.4.9",
52
52
  "@types/lodash-es": "4.17.12",
53
53
  "@types/ua-parser-js": "0.7.39",
54
- "@typescript-eslint/eslint-plugin": "8.14.0",
55
- "@typescript-eslint/parser": "8.14.0",
54
+ "@typescript-eslint/eslint-plugin": "8.16.0",
55
+ "@typescript-eslint/parser": "8.16.0",
56
56
  "eslint": "8.57.1",
57
57
  "eslint-config-prettier": "9.1.0",
58
58
  "eslint-plugin-import": "2.31.0",
59
- "husky": "9.1.6",
59
+ "husky": "9.1.7",
60
60
  "lint-staged": "15.2.10",
61
- "msw": "2.6.5",
62
- "prettier": "3.3.3",
61
+ "msw": "2.6.6",
62
+ "prettier": "3.4.1",
63
63
  "semantic-release": "24.2.0",
64
- "ts-to-zod": "3.13.0",
65
- "typescript": "5.6.3",
66
- "vite": "5.4.11",
64
+ "ts-to-zod": "3.15.0",
65
+ "typescript": "5.7.2",
66
+ "vite": "6.0.2",
67
67
  "vite-plugin-dts": "4.3.0",
68
- "vitest": "2.1.5"
68
+ "vitest": "2.1.7"
69
69
  },
70
70
  "dependencies": {
71
71
  "@argent/x-multicall": "^7.1.0",