@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.
- package/dist/_virtual/semver.cjs +1 -1
- package/dist/_virtual/semver.js +5 -2
- package/dist/_virtual/semver2.cjs +1 -0
- package/dist/_virtual/semver2.js +4 -0
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.cjs +1 -1
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js +612 -606
- package/dist/src/accountNameGenerator/x-names.json.cjs +1 -1
- package/dist/src/accountNameGenerator/x-names.json.js +1 -1920
- package/dist/src/bigdecimal/index.cjs +1 -1
- package/dist/src/bigdecimal/index.js +34 -26
- package/dist/src/bigdecimal/lib.cjs +1 -1
- package/dist/src/bigdecimal/lib.d.ts +8 -0
- package/dist/src/bigdecimal/lib.js +102 -38
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.cjs +1 -1
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +1 -1
- package/dist/src/features/simulation/activity/schema.cjs +1 -1
- package/dist/src/features/simulation/activity/schema.d.ts +8 -0
- package/dist/src/features/simulation/activity/schema.js +20 -19
- package/dist/src/http/HttpError.d.ts +2 -2
- package/dist/src/utils/number/prettifyNumber.cjs +1 -1
- package/dist/src/utils/number/prettifyNumber.js +26 -26
- package/package.json +12 -12
|
@@ -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
|
|
2
|
-
import { abs as
|
|
3
|
-
import { parseUnits as
|
|
4
|
-
import { formatUnits as
|
|
5
|
-
import { ONE as
|
|
6
|
-
import { createUnitsSchema as
|
|
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
|
-
|
|
9
|
-
|
|
8
|
+
k as ONE,
|
|
9
|
+
f as abs,
|
|
10
10
|
t as absBigInt,
|
|
11
11
|
c as add,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
x as
|
|
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
|
-
|
|
17
|
-
|
|
18
|
+
m as formatEther,
|
|
19
|
+
T as formatUnits,
|
|
18
20
|
b as gt,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
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
|
|
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
|
-
}),
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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:
|
|
18
|
-
value: e(l,
|
|
22
|
+
decimals: a,
|
|
23
|
+
value: e(l, s, a)
|
|
19
24
|
};
|
|
20
|
-
},
|
|
21
|
-
const [l,
|
|
22
|
-
return e(l,
|
|
23
|
-
},
|
|
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(
|
|
27
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
39
|
+
}), D = (e) => ({
|
|
35
40
|
decimals: e.decimals,
|
|
36
41
|
value: e.value >= BigInt(0) ? e.value : -e.value
|
|
37
|
-
}),
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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("../../../../../
|
|
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 "../../../../../
|
|
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),
|
|
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
|
-
}),
|
|
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
|
-
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
x,
|
|
207
|
+
D,
|
|
208
|
+
P
|
|
208
209
|
])
|
|
209
210
|
]),
|
|
210
|
-
type: t.literal(
|
|
211
|
+
type: t.literal(T),
|
|
211
212
|
transaction: r.pick({
|
|
212
213
|
hash: !0
|
|
213
214
|
}),
|
|
214
215
|
dapp: b.optional(),
|
|
215
|
-
meta:
|
|
216
|
-
}), M = t.array(p),
|
|
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,
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
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
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
},
|
|
19
|
-
...
|
|
18
|
+
}, y = (t, e) => D(t, {
|
|
19
|
+
...s.CURRENCY,
|
|
20
20
|
...e || {}
|
|
21
|
-
}),
|
|
22
|
-
...
|
|
21
|
+
}), O = (t, e) => D(t, {
|
|
22
|
+
...s.TOKEN,
|
|
23
23
|
...e || {}
|
|
24
|
-
}),
|
|
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
|
|
28
|
-
let
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
else if (
|
|
33
|
-
|
|
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
|
|
36
|
-
|
|
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 [
|
|
39
|
-
let n =
|
|
40
|
-
if (
|
|
41
|
-
const a =
|
|
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
|
|
45
|
-
return n.length <
|
|
44
|
+
const f = 1 + r.indexOf(".") + c;
|
|
45
|
+
return n.length < f && (n = r.substring(0, f)), n;
|
|
46
46
|
};
|
|
47
47
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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.
|
|
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.
|
|
48
|
-
"@commitlint/config-conventional": "19.
|
|
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.
|
|
55
|
-
"@typescript-eslint/parser": "8.
|
|
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.
|
|
59
|
+
"husky": "9.1.7",
|
|
60
60
|
"lint-staged": "15.2.10",
|
|
61
|
-
"msw": "2.6.
|
|
62
|
-
"prettier": "3.
|
|
61
|
+
"msw": "2.6.6",
|
|
62
|
+
"prettier": "3.4.1",
|
|
63
63
|
"semantic-release": "24.2.0",
|
|
64
|
-
"ts-to-zod": "3.
|
|
65
|
-
"typescript": "5.
|
|
66
|
-
"vite": "
|
|
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.
|
|
68
|
+
"vitest": "2.1.7"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@argent/x-multicall": "^7.1.0",
|