@gardenfi/utils 2.4.5-beta.2 → 2.4.5-beta.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.
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +3 -3
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +2 -2
- package/dist/index121.cjs +1 -1
- package/dist/index121.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +3 -3
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +2 -2
- package/dist/index197.cjs +1 -1
- package/dist/index197.js +3 -3
- package/dist/index226.cjs +1 -1
- package/dist/index226.js +2 -2
- package/dist/index229.cjs +1 -1
- package/dist/index229.js +2 -2
- package/dist/index230.cjs +1 -1
- package/dist/index230.js +1 -1
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +1 -1
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +1 -1
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +2 -2
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +27 -31
- package/dist/index242.cjs +1 -1
- package/dist/index242.js +3 -3
- package/dist/index249.cjs +1 -1
- package/dist/index249.js +3 -3
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +7 -31
- package/dist/index250.cjs +1 -1
- package/dist/index250.js +3 -3
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +10 -9
- package/dist/index262.cjs +1 -2
- package/dist/index262.js +102 -40
- package/dist/index263.cjs +1 -1
- package/dist/index263.js +7 -2
- package/dist/index264.cjs +1 -1
- package/dist/index264.js +224 -5
- package/dist/index265.cjs +1 -1
- package/dist/index265.js +6 -10
- package/dist/index266.cjs +1 -1
- package/dist/index266.js +7 -20
- package/dist/index267.cjs +2 -1
- package/dist/index267.js +41 -8
- package/dist/index268.cjs +1 -1
- package/dist/index268.js +2 -67
- package/dist/index269.cjs +1 -1
- package/dist/index269.js +5 -65
- package/dist/index270.cjs +1 -1
- package/dist/index270.js +9 -185
- package/dist/index271.cjs +1 -1
- package/dist/index271.js +17 -20
- package/dist/index272.cjs +1 -1
- package/dist/index272.js +8 -42
- package/dist/index273.cjs +1 -1
- package/dist/index273.js +62 -72
- package/dist/index274.cjs +1 -1
- package/dist/index274.js +61 -36
- package/dist/index275.cjs +1 -1
- package/dist/index275.js +185 -15
- package/dist/index276.cjs +1 -1
- package/dist/index276.js +21 -12
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +42 -12
- package/dist/index278.cjs +1 -2
- package/dist/index278.js +76 -18
- package/dist/index279.cjs +1 -1
- package/dist/index279.js +39 -13
- package/dist/index28.cjs +16 -1
- package/dist/index28.js +113 -12
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +16 -11
- package/dist/index281.cjs +1 -1
- package/dist/index281.js +7 -149
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +10 -7
- package/dist/index283.cjs +2 -1
- package/dist/index283.js +16 -111
- package/dist/index284.cjs +1 -2
- package/dist/index284.js +13 -133
- package/dist/index285.cjs +1 -1
- package/dist/index285.js +11 -103
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +26 -6
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +18 -223
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +146 -6
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +4 -7
- package/dist/index29.cjs +1 -16
- package/dist/index29.js +30 -112
- package/dist/index290.cjs +1 -1
- package/dist/index290.js +137 -23
- package/dist/index291.cjs +1 -1
- package/dist/index291.js +153 -17
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +9 -146
- package/dist/index293.cjs +1 -1
- package/dist/index293.js +113 -3
- package/dist/index294.cjs +2 -1
- package/dist/index294.js +122 -128
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +41 -10
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +77 -18
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +2 -43
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +10 -77
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +20 -2
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +31 -27
- package/dist/index300.cjs +1 -1
- package/dist/index300.js +698 -68
- package/dist/index301.cjs +1 -2
- package/dist/index301.js +137 -64
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +201 -4
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +68 -40
- package/dist/index304.cjs +2 -1
- package/dist/index304.js +66 -7
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +4 -62
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +33 -70
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +8 -4
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +55 -187
- package/dist/index309.cjs +1 -1
- package/dist/index309.js +68 -689
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +12 -8
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +4 -140
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +181 -188
- package/dist/index312.cjs +1 -1
- package/dist/index312.js +4 -63
- package/dist/index313.cjs +1 -1
- package/dist/index313.js +59 -40
- package/dist/index314.cjs +1 -1
- package/dist/index314.js +44 -4
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +1 -1
- package/package.json +1 -1
package/dist/index312.js
CHANGED
|
@@ -1,66 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { assertSize as p } from "./index303.js";
|
|
5
|
-
const l = /* @__PURE__ */ new TextEncoder();
|
|
6
|
-
function E(e) {
|
|
7
|
-
return e instanceof Uint8Array ? e : typeof e == "string" ? y(e) : z(e);
|
|
8
|
-
}
|
|
9
|
-
function z(e) {
|
|
10
|
-
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
11
|
-
}
|
|
12
|
-
function y(e, t = {}) {
|
|
13
|
-
const { size: r } = t;
|
|
14
|
-
let n = e;
|
|
15
|
-
r && (p(e, r), n = h(e, r));
|
|
16
|
-
let i = n.slice(2);
|
|
17
|
-
i.length % 2 && (i = `0${i}`);
|
|
18
|
-
const f = i.length / 2, a = new Uint8Array(f);
|
|
19
|
-
for (let s = 0, o = 0; s < f; s++) {
|
|
20
|
-
const d = b(i.charCodeAt(o++)), u = b(i.charCodeAt(o++));
|
|
21
|
-
if (d === void 0 || u === void 0)
|
|
22
|
-
throw new c(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
|
|
23
|
-
a[s] = d * 16 + u;
|
|
24
|
-
}
|
|
25
|
-
return a;
|
|
26
|
-
}
|
|
27
|
-
function C(e, t = {}) {
|
|
28
|
-
const { size: r } = t, n = l.encode(e);
|
|
29
|
-
return typeof r == "number" ? (g(n, r), x(n, r)) : n;
|
|
30
|
-
}
|
|
31
|
-
function x(e, t) {
|
|
32
|
-
return m(e, { dir: "right", size: t });
|
|
33
|
-
}
|
|
34
|
-
function U(e) {
|
|
35
|
-
return e.length;
|
|
36
|
-
}
|
|
37
|
-
class B extends c {
|
|
38
|
-
constructor({ givenSize: t, maxSize: r }) {
|
|
39
|
-
super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
|
|
40
|
-
enumerable: !0,
|
|
41
|
-
configurable: !0,
|
|
42
|
-
writable: !0,
|
|
43
|
-
value: "Bytes.SizeOverflowError"
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
class O extends c {
|
|
48
|
-
constructor({ size: t, targetSize: r, type: n }) {
|
|
49
|
-
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
|
|
50
|
-
enumerable: !0,
|
|
51
|
-
configurable: !0,
|
|
52
|
-
writable: !0,
|
|
53
|
-
value: "Bytes.SizeExceedsPaddingSizeError"
|
|
54
|
-
});
|
|
55
|
-
}
|
|
1
|
+
import { version as r } from "./index316.js";
|
|
2
|
+
function e() {
|
|
3
|
+
return r;
|
|
56
4
|
}
|
|
57
5
|
export {
|
|
58
|
-
|
|
59
|
-
B as SizeOverflowError,
|
|
60
|
-
E as from,
|
|
61
|
-
z as fromArray,
|
|
62
|
-
y as fromHex,
|
|
63
|
-
C as fromString,
|
|
64
|
-
x as padRight,
|
|
65
|
-
U as size
|
|
6
|
+
e as getVersion
|
|
66
7
|
};
|
package/dist/index313.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index304.cjs"),y=require("./index291.cjs"),s=require("./index314.cjs"),z=require("./index306.cjs"),S=new TextEncoder;function x(e){return e instanceof Uint8Array?e:typeof e=="string"?h(e):g(e)}function g(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function h(e,t={}){const{size:r}=t;let n=e;r&&(z.assertSize(e,r),n=y.padRight(e,r));let i=n.slice(2);i.length%2&&(i=`0${i}`);const d=i.length/2,f=new Uint8Array(d);for(let c=0,o=0;c<d;c++){const u=s.charCodeToBase16(i.charCodeAt(o++)),b=s.charCodeToBase16(i.charCodeAt(o++));if(u===void 0||b===void 0)throw new a.BaseError(`Invalid byte sequence ("${i[o-2]}${i[o-1]}" in "${i}").`);f[c]=u*16+b}return f}function m(e,t={}){const{size:r}=t,n=S.encode(e);return typeof r=="number"?(s.assertSize(n,r),l(n,r)):n}function l(e,t){return s.pad(e,{dir:"right",size:t})}function E(e){return e.length}class p extends a.BaseError{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class $ extends a.BaseError{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}exports.SizeExceedsPaddingSizeError=$;exports.SizeOverflowError=p;exports.from=x;exports.fromArray=g;exports.fromHex=h;exports.fromString=m;exports.padRight=l;exports.size=E;
|
package/dist/index313.js
CHANGED
|
@@ -1,47 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { BaseError as c } from "./index304.js";
|
|
2
|
+
import { padRight as h } from "./index291.js";
|
|
3
|
+
import { charCodeToBase16 as b, assertSize as g, pad as m } from "./index314.js";
|
|
4
|
+
import { assertSize as p } from "./index306.js";
|
|
5
|
+
const l = /* @__PURE__ */ new TextEncoder();
|
|
6
|
+
function E(e) {
|
|
7
|
+
return e instanceof Uint8Array ? e : typeof e == "string" ? y(e) : z(e);
|
|
8
|
+
}
|
|
9
|
+
function z(e) {
|
|
10
|
+
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
11
|
+
}
|
|
12
|
+
function y(e, t = {}) {
|
|
13
|
+
const { size: r } = t;
|
|
14
|
+
let n = e;
|
|
15
|
+
r && (p(e, r), n = h(e, r));
|
|
16
|
+
let i = n.slice(2);
|
|
17
|
+
i.length % 2 && (i = `0${i}`);
|
|
18
|
+
const f = i.length / 2, a = new Uint8Array(f);
|
|
19
|
+
for (let s = 0, o = 0; s < f; s++) {
|
|
20
|
+
const d = b(i.charCodeAt(o++)), u = b(i.charCodeAt(o++));
|
|
21
|
+
if (d === void 0 || u === void 0)
|
|
22
|
+
throw new c(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
|
|
23
|
+
a[s] = d * 16 + u;
|
|
24
|
+
}
|
|
25
|
+
return a;
|
|
26
|
+
}
|
|
27
|
+
function C(e, t = {}) {
|
|
28
|
+
const { size: r } = t, n = l.encode(e);
|
|
29
|
+
return typeof r == "number" ? (g(n, r), x(n, r)) : n;
|
|
30
|
+
}
|
|
31
|
+
function x(e, t) {
|
|
32
|
+
return m(e, { dir: "right", size: t });
|
|
33
|
+
}
|
|
34
|
+
function U(e) {
|
|
35
|
+
return e.length;
|
|
36
|
+
}
|
|
37
|
+
class B extends c {
|
|
38
|
+
constructor({ givenSize: t, maxSize: r }) {
|
|
39
|
+
super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
|
|
40
|
+
enumerable: !0,
|
|
41
|
+
configurable: !0,
|
|
42
|
+
writable: !0,
|
|
43
|
+
value: "Bytes.SizeOverflowError"
|
|
7
44
|
});
|
|
45
|
+
}
|
|
8
46
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
function s(e) {
|
|
18
|
-
if (e >= n.zero && e <= n.nine)
|
|
19
|
-
return e - n.zero;
|
|
20
|
-
if (e >= n.A && e <= n.F)
|
|
21
|
-
return e - (n.A - 10);
|
|
22
|
-
if (e >= n.a && e <= n.f)
|
|
23
|
-
return e - (n.a - 10);
|
|
24
|
-
}
|
|
25
|
-
function S(e, t = {}) {
|
|
26
|
-
const { dir: z, size: i = 32 } = t;
|
|
27
|
-
if (i === 0)
|
|
28
|
-
return e;
|
|
29
|
-
if (e.length > i)
|
|
30
|
-
throw new a({
|
|
31
|
-
size: e.length,
|
|
32
|
-
targetSize: i,
|
|
33
|
-
type: "Bytes"
|
|
47
|
+
class O extends c {
|
|
48
|
+
constructor({ size: t, targetSize: r, type: n }) {
|
|
49
|
+
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
|
|
50
|
+
enumerable: !0,
|
|
51
|
+
configurable: !0,
|
|
52
|
+
writable: !0,
|
|
53
|
+
value: "Bytes.SizeExceedsPaddingSizeError"
|
|
34
54
|
});
|
|
35
|
-
const o = new Uint8Array(i);
|
|
36
|
-
for (let r = 0; r < i; r++) {
|
|
37
|
-
const f = z === "right";
|
|
38
|
-
o[f ? r : i - r - 1] = e[f ? r : e.length - r - 1];
|
|
39
55
|
}
|
|
40
|
-
return o;
|
|
41
56
|
}
|
|
42
57
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
O as SizeExceedsPaddingSizeError,
|
|
59
|
+
B as SizeOverflowError,
|
|
60
|
+
E as from,
|
|
61
|
+
z as fromArray,
|
|
62
|
+
y as fromHex,
|
|
63
|
+
C as fromString,
|
|
64
|
+
x as padRight,
|
|
65
|
+
U as size
|
|
47
66
|
};
|
package/dist/index314.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index313.cjs");function s(e,t){if(o.size(e)>t)throw new o.SizeOverflowError({givenSize:o.size(e),maxSize:t})}const n={zero:48,nine:57,A:65,F:70,a:97,f:102};function u(e){if(e>=n.zero&&e<=n.nine)return e-n.zero;if(e>=n.A&&e<=n.F)return e-(n.A-10);if(e>=n.a&&e<=n.f)return e-(n.a-10)}function z(e,t={}){const{dir:f,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new o.SizeExceedsPaddingSizeError({size:e.length,targetSize:r,type:"Bytes"});const d=new Uint8Array(r);for(let i=0;i<r;i++){const a=f==="right";d[a?i:r-i-1]=e[a?i:e.length-i-1]}return d}exports.assertSize=s;exports.charCodeMap=n;exports.charCodeToBase16=u;exports.pad=z;
|
package/dist/index314.js
CHANGED
|
@@ -1,7 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function e
|
|
3
|
-
|
|
1
|
+
import { size as d, SizeOverflowError as u, SizeExceedsPaddingSizeError as a } from "./index313.js";
|
|
2
|
+
function p(e, t) {
|
|
3
|
+
if (d(e) > t)
|
|
4
|
+
throw new u({
|
|
5
|
+
givenSize: d(e),
|
|
6
|
+
maxSize: t
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
const n = {
|
|
10
|
+
zero: 48,
|
|
11
|
+
nine: 57,
|
|
12
|
+
A: 65,
|
|
13
|
+
F: 70,
|
|
14
|
+
a: 97,
|
|
15
|
+
f: 102
|
|
16
|
+
};
|
|
17
|
+
function s(e) {
|
|
18
|
+
if (e >= n.zero && e <= n.nine)
|
|
19
|
+
return e - n.zero;
|
|
20
|
+
if (e >= n.A && e <= n.F)
|
|
21
|
+
return e - (n.A - 10);
|
|
22
|
+
if (e >= n.a && e <= n.f)
|
|
23
|
+
return e - (n.a - 10);
|
|
24
|
+
}
|
|
25
|
+
function S(e, t = {}) {
|
|
26
|
+
const { dir: z, size: i = 32 } = t;
|
|
27
|
+
if (i === 0)
|
|
28
|
+
return e;
|
|
29
|
+
if (e.length > i)
|
|
30
|
+
throw new a({
|
|
31
|
+
size: e.length,
|
|
32
|
+
targetSize: i,
|
|
33
|
+
type: "Bytes"
|
|
34
|
+
});
|
|
35
|
+
const o = new Uint8Array(i);
|
|
36
|
+
for (let r = 0; r < i; r++) {
|
|
37
|
+
const f = z === "right";
|
|
38
|
+
o[f ? r : i - r - 1] = e[f ? r : e.length - r - 1];
|
|
39
|
+
}
|
|
40
|
+
return o;
|
|
4
41
|
}
|
|
5
42
|
export {
|
|
6
|
-
|
|
43
|
+
p as assertSize,
|
|
44
|
+
n as charCodeMap,
|
|
45
|
+
s as charCodeToBase16,
|
|
46
|
+
S as pad
|
|
7
47
|
};
|
package/dist/index55.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index52.cjs"),j=require("./index222.cjs"),u=require("./index47.cjs"),l=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index52.cjs"),j=require("./index222.cjs"),u=require("./index47.cjs"),l=require("./index282.cjs");function C(s,i={}){return{async request(h){var w;const{body:r,onRequest:o=i.onRequest,onResponse:p=i.onResponse,timeout:d=i.timeout??1e4}=h,f={...i.fetchOptions??{},...h.fetchOptions??{}},{headers:q,method:m,signal:T}=f;try{const t=await j.withTimeout(async({signal:a})=>{const c={...f,body:Array.isArray(r)?u.stringify(r.map(g=>({jsonrpc:"2.0",id:g.id??l.idCache.take(),...g}))):u.stringify({jsonrpc:"2.0",id:r.id??l.idCache.take(),...r}),headers:{"Content-Type":"application/json",...q},method:m||"POST",signal:T||(d>0?a:null)},R=new Request(s,c),y=await(o==null?void 0:o(R,c))??{...c,url:s};return await fetch(y.url??s,y)},{errorInstance:new n.TimeoutError({body:r,url:s}),timeout:d,signal:!0});p&&await p(t);let e;if((w=t.headers.get("Content-Type"))!=null&&w.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(a){if(t.ok)throw a;e={error:e}}}if(!t.ok)throw new n.HttpRequestError({body:r,details:u.stringify(e.error)||t.statusText,headers:t.headers,status:t.status,url:s});return e}catch(t){throw t instanceof n.HttpRequestError||t instanceof n.TimeoutError?t:new n.HttpRequestError({body:r,cause:t,url:s})}}}}exports.getHttpRpcClient=C;
|
package/dist/index55.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TimeoutError as g, HttpRequestError as c } from "./index52.js";
|
|
2
2
|
import { withTimeout as k } from "./index222.js";
|
|
3
3
|
import { stringify as p } from "./index47.js";
|
|
4
|
-
import { idCache as l } from "./
|
|
4
|
+
import { idCache as l } from "./index282.js";
|
|
5
5
|
function H(s, o = {}) {
|
|
6
6
|
return {
|
|
7
7
|
async request(h) {
|