@gardenfi/utils 2.0.6 → 2.1.0-beta.1
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/index.cjs +1 -1
- package/dist/index.js +22 -20
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +37 -19
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +26 -126
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +3 -113
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +10 -77
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +20 -2
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +17 -16
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +643 -18
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +168 -12
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +9 -220
- package/dist/index108.cjs +1 -2
- package/dist/index108.js +128 -3
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +2 -35
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +19 -134
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +2 -19
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +32 -64
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +35 -64
- package/dist/index113.cjs +2 -1
- package/dist/index113.js +3 -2
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +5 -41
- package/dist/index115.cjs +1 -1
- package/dist/index115.js +10 -643
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +16 -227
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +6 -172
- package/dist/index118.cjs +1 -0
- package/dist/index118.js +7 -0
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +136 -10
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +15 -2
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +2 -34
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +32 -17
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +14 -183
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +187 -92
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +92 -34
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +36 -32
- package/dist/index20.cjs +1 -16
- package/dist/index20.js +30 -112
- package/dist/index21.cjs +16 -1
- package/dist/index21.js +113 -30
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +31 -18
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +41 -7
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +3 -3
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +23 -19
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +6 -8
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +12 -30
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +15 -26
- package/dist/index29.cjs +1 -2
- package/dist/index29.js +5 -65
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +13 -51
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +10 -12
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +12 -24
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +11 -75
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +13 -23
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +23 -7
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +55 -32
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +16 -15
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +6 -2
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +8 -8
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +171 -20
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +100 -9
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +20 -33
- package/dist/index43.cjs +1 -2
- package/dist/index43.js +17 -59
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +8 -2
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +21 -6
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +8 -6
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +31 -4
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +26 -11
- package/dist/index49.cjs +2 -5
- package/dist/index49.js +53 -44
- package/dist/index50.cjs +1 -2
- package/dist/index50.js +50 -33
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +12 -5
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +24 -3
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +75 -21
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +7 -12
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +32 -55
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +15 -8
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -22
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +8 -11
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +20 -8
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +40 -22
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +40 -10
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +34 -11
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +69 -6
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +112 -13
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +64 -29
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +2 -15
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +14 -62
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +218 -22
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +232 -3
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +12 -3
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +24 -2
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +34 -13
- package/dist/index71.cjs +2 -1
- package/dist/index71.js +59 -41
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +21 -5
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +8 -8
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +18 -103
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +36 -185
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +8 -18
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +103 -10
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +3 -19
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +16 -11
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +2 -100
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +8 -25
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +10 -6
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +11 -13
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +13 -15
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +6 -5
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +78 -13
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +14 -10
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +18 -16
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +182 -162
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +62 -36
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +105 -34
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +4 -8
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +2 -5
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +6 -10
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +12 -2
- package/dist/index94.cjs +5 -1
- package/dist/index94.js +49 -97
- package/dist/index95.cjs +2 -1
- package/dist/index95.js +33 -41
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +5 -20
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +3 -6
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +7 -5
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +30 -35
- package/dist/src/index.d.ts +1 -0
- package/dist/src/lib/auth/siwe/siwe.d.ts +3 -2
- package/dist/src/lib/digestKey/digestKey.d.ts +12 -0
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index2.cjs"),e=require("./index3.cjs"),s=require("./index4.cjs"),r=require("./index5.cjs"),i=require("./index6.cjs"),n=require("./index7.cjs"),u=require("./index8.cjs"),c=require("./index9.cjs"),a=require("./index10.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index2.cjs"),e=require("./index3.cjs"),s=require("./index4.cjs"),r=require("./index5.cjs"),i=require("./index6.cjs"),n=require("./index7.cjs"),u=require("./index8.cjs"),c=require("./index9.cjs"),a=require("./index10.cjs"),y=require("./index11.cjs"),p=require("./index12.cjs"),k=require("./index13.cjs"),l=require("./index14.cjs"),t=require("./index15.cjs"),A=require("./index16.cjs");exports.ApiStatus=o.ApiStatus;exports.Authorization=e.Authorization;exports.Environment=e.Environment;exports.Network=e.Network;exports.add0x=e.add0x;exports.hexToU32Array=e.hexToU32Array;exports.parseJwt=e.parseJwt;exports.sleep=e.sleep;exports.with0x=e.with0x;exports.checkAllowanceAndApprove=s.checkAllowanceAndApprove;exports.Err=r.Err;exports.Ok=r.Ok;exports.Result=r.Result;exports.Void=r.Void;exports.DigestKey=i.DigestKey;exports.Url=n.Url;exports.AuthHeaderEnum=u.AuthHeaderEnum;exports.Siwe=c.Siwe;exports.ApiKey=a.ApiKey;exports.Passkey=y.Passkey;exports.PasskeyLogin=p.PasskeyLogin;exports.MemoryStorage=k.MemoryStorage;exports.StoreKeys=l.StoreKeys;exports.fetchBitcoinBlockNumber=t.fetchBitcoinBlockNumber;exports.fetchEVMBlockNumber=t.fetchEVMBlockNumber;exports.EventBroker=A.EventBroker;
|
package/dist/index.js
CHANGED
|
@@ -2,38 +2,40 @@ import { ApiStatus as e } from "./index2.js";
|
|
|
2
2
|
import { Authorization as p, Environment as m, Network as x, add0x as f, hexToU32Array as i, parseJwt as a, sleep as n, with0x as s } from "./index3.js";
|
|
3
3
|
import { checkAllowanceAndApprove as k } from "./index4.js";
|
|
4
4
|
import { Err as h, Ok as l, Result as u, Void as y } from "./index5.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
5
|
+
import { DigestKey as w } from "./index6.js";
|
|
6
|
+
import { Url as B } from "./index7.js";
|
|
7
|
+
import { AuthHeaderEnum as g } from "./index8.js";
|
|
8
|
+
import { Siwe as K } from "./index9.js";
|
|
9
|
+
import { ApiKey as b } from "./index10.js";
|
|
10
|
+
import { Passkey as P } from "./index11.js";
|
|
11
|
+
import { PasskeyLogin as V } from "./index12.js";
|
|
12
|
+
import { MemoryStorage as D } from "./index13.js";
|
|
13
|
+
import { StoreKeys as J } from "./index14.js";
|
|
14
|
+
import { fetchBitcoinBlockNumber as O, fetchEVMBlockNumber as R } from "./index15.js";
|
|
15
|
+
import { EventBroker as j } from "./index16.js";
|
|
15
16
|
export {
|
|
16
17
|
b as ApiKey,
|
|
17
18
|
e as ApiStatus,
|
|
18
|
-
|
|
19
|
+
g as AuthHeaderEnum,
|
|
19
20
|
p as Authorization,
|
|
21
|
+
w as DigestKey,
|
|
20
22
|
m as Environment,
|
|
21
23
|
h as Err,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
j as EventBroker,
|
|
25
|
+
D as MemoryStorage,
|
|
24
26
|
x as Network,
|
|
25
27
|
l as Ok,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
P as Passkey,
|
|
29
|
+
V as PasskeyLogin,
|
|
28
30
|
u as Result,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
K as Siwe,
|
|
32
|
+
J as StoreKeys,
|
|
33
|
+
B as Url,
|
|
32
34
|
y as Void,
|
|
33
35
|
f as add0x,
|
|
34
36
|
k as checkAllowanceAndApprove,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
O as fetchBitcoinBlockNumber,
|
|
38
|
+
R as fetchEVMBlockNumber,
|
|
37
39
|
i as hexToU32Array,
|
|
38
40
|
a as parseJwt,
|
|
39
41
|
n as sleep,
|
package/dist/index10.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index17.cjs"),l=require("./index8.cjs");class f{constructor(e){this.apiKey=e}async getToken(){const e=this.verifyToken();return e.error?t.Err(e.error):e.val?t.Ok(this.apiKey):t.Err("Token verification failed")}verifyToken(){const e=this.decodeBase64UrlSafe(this.apiKey),r=this.extractData(e);if(r.error)return t.Err(r.error);const{expiryTimestamp:i}=r.val;return i<new Date?t.Err("Token expired"):t.Ok(!0)}decodeBase64UrlSafe(e){let r=e.replace(/_/g,"/").replace(/-/g,"+");for(;r.length%4!==0;)r+="=";return Uint8Array.from(atob(r),i=>i.charCodeAt(0))}extractData(e){const r=new TextEncoder().encode("::"),i=e.findIndex((n,a)=>e.slice(a,a+r.length).every((u,d)=>u===r[d]));if(i===-1)return t.Err("Invalid format: delimiter not found");const o=e.slice(0,8),s=new DataView(o.buffer).getBigUint64(0,!1),c=e.slice(i+r.length);return t.Ok({expiryTimestamp:new Date(Number(s)*1e3),signature:Array.from(c).map(n=>n.toString(16).padStart(2,"0")).join("")})}async getAuthHeaders(){const e=await this.getToken();return e.ok?t.Ok({[l.AuthHeaderEnum.ApiKey]:e.val}):t.Err(e.error??"Failed to get auth token")}}exports.ApiKey=f;
|
package/dist/index10.js
CHANGED
|
@@ -1,28 +1,46 @@
|
|
|
1
|
-
import { Err as
|
|
2
|
-
import { AuthHeaderEnum as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.token = t;
|
|
1
|
+
import { Err as i, Ok as n } from "./index17.js";
|
|
2
|
+
import { AuthHeaderEnum as u } from "./index8.js";
|
|
3
|
+
class h {
|
|
4
|
+
constructor(e) {
|
|
5
|
+
this.apiKey = e;
|
|
7
6
|
}
|
|
8
7
|
async getToken() {
|
|
9
|
-
|
|
8
|
+
const e = this.verifyToken();
|
|
9
|
+
return e.error ? i(e.error) : e.val ? n(this.apiKey) : i("Token verification failed");
|
|
10
10
|
}
|
|
11
|
-
verifyToken(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
verifyToken() {
|
|
12
|
+
const e = this.decodeBase64UrlSafe(this.apiKey), r = this.extractData(e);
|
|
13
|
+
if (r.error)
|
|
14
|
+
return i(r.error);
|
|
15
|
+
const { expiryTimestamp: t } = r.val;
|
|
16
|
+
return t < /* @__PURE__ */ new Date() ? i("Token expired") : n(!0);
|
|
17
|
+
}
|
|
18
|
+
decodeBase64UrlSafe(e) {
|
|
19
|
+
let r = e.replace(/_/g, "/").replace(/-/g, "+");
|
|
20
|
+
for (; r.length % 4 !== 0; )
|
|
21
|
+
r += "=";
|
|
22
|
+
return Uint8Array.from(atob(r), (t) => t.charCodeAt(0));
|
|
23
|
+
}
|
|
24
|
+
extractData(e) {
|
|
25
|
+
const r = new TextEncoder().encode("::"), t = e.findIndex(
|
|
26
|
+
(a, o) => e.slice(o, o + r.length).every((f, l) => f === r[l])
|
|
27
|
+
);
|
|
28
|
+
if (t === -1)
|
|
29
|
+
return i("Invalid format: delimiter not found");
|
|
30
|
+
const s = e.slice(0, 8), c = new DataView(s.buffer).getBigUint64(
|
|
31
|
+
0,
|
|
32
|
+
!1
|
|
33
|
+
), d = e.slice(t + r.length);
|
|
34
|
+
return n({
|
|
35
|
+
expiryTimestamp: new Date(Number(c) * 1e3),
|
|
36
|
+
signature: Array.from(d).map((a) => a.toString(16).padStart(2, "0")).join("")
|
|
37
|
+
});
|
|
20
38
|
}
|
|
21
39
|
async getAuthHeaders() {
|
|
22
|
-
const
|
|
23
|
-
return
|
|
40
|
+
const e = await this.getToken();
|
|
41
|
+
return e.ok ? n({ [u.ApiKey]: e.val }) : i(e.error ?? "Failed to get auth token");
|
|
24
42
|
}
|
|
25
43
|
}
|
|
26
44
|
export {
|
|
27
|
-
|
|
45
|
+
h as ApiKey
|
|
28
46
|
};
|
package/dist/index100.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 s=require("./index57.cjs"),e=require("./index71.cjs");class i extends e.BaseError{constructor({domain:r}){super(`Invalid domain "${s.stringify(r)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class o extends e.BaseError{constructor({primaryType:r,types:a}){super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(a))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class n extends e.BaseError{constructor({type:r}){super(`Struct type "${r}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}exports.InvalidDomainError=i;exports.InvalidPrimaryTypeError=o;exports.InvalidStructTypeError=n;
|
package/dist/index100.js
CHANGED
|
@@ -1,130 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (t < 0)
|
|
25
|
-
throw new o({ offset: t });
|
|
26
|
-
const i = this.position - t;
|
|
27
|
-
this.assertPosition(i), this.position = i;
|
|
28
|
-
},
|
|
29
|
-
getReadCount(t) {
|
|
30
|
-
return this.positionReadCount.get(t || this.position) || 0;
|
|
31
|
-
},
|
|
32
|
-
incrementPosition(t) {
|
|
33
|
-
if (t < 0)
|
|
34
|
-
throw new o({ offset: t });
|
|
35
|
-
const i = this.position + t;
|
|
36
|
-
this.assertPosition(i), this.position = i;
|
|
37
|
-
},
|
|
38
|
-
inspectByte(t) {
|
|
39
|
-
const i = t ?? this.position;
|
|
40
|
-
return this.assertPosition(i), this.bytes[i];
|
|
41
|
-
},
|
|
42
|
-
inspectBytes(t, i) {
|
|
43
|
-
const s = i ?? this.position;
|
|
44
|
-
return this.assertPosition(s + t - 1), this.bytes.subarray(s, s + t);
|
|
45
|
-
},
|
|
46
|
-
inspectUint8(t) {
|
|
47
|
-
const i = t ?? this.position;
|
|
48
|
-
return this.assertPosition(i), this.bytes[i];
|
|
49
|
-
},
|
|
50
|
-
inspectUint16(t) {
|
|
51
|
-
const i = t ?? this.position;
|
|
52
|
-
return this.assertPosition(i + 1), this.dataView.getUint16(i);
|
|
53
|
-
},
|
|
54
|
-
inspectUint24(t) {
|
|
55
|
-
const i = t ?? this.position;
|
|
56
|
-
return this.assertPosition(i + 2), (this.dataView.getUint16(i) << 8) + this.dataView.getUint8(i + 2);
|
|
57
|
-
},
|
|
58
|
-
inspectUint32(t) {
|
|
59
|
-
const i = t ?? this.position;
|
|
60
|
-
return this.assertPosition(i + 3), this.dataView.getUint32(i);
|
|
61
|
-
},
|
|
62
|
-
pushByte(t) {
|
|
63
|
-
this.assertPosition(this.position), this.bytes[this.position] = t, this.position++;
|
|
64
|
-
},
|
|
65
|
-
pushBytes(t) {
|
|
66
|
-
this.assertPosition(this.position + t.length - 1), this.bytes.set(t, this.position), this.position += t.length;
|
|
67
|
-
},
|
|
68
|
-
pushUint8(t) {
|
|
69
|
-
this.assertPosition(this.position), this.bytes[this.position] = t, this.position++;
|
|
70
|
-
},
|
|
71
|
-
pushUint16(t) {
|
|
72
|
-
this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, t), this.position += 2;
|
|
73
|
-
},
|
|
74
|
-
pushUint24(t) {
|
|
75
|
-
this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, t >> 8), this.dataView.setUint8(this.position + 2, t & 255), this.position += 3;
|
|
76
|
-
},
|
|
77
|
-
pushUint32(t) {
|
|
78
|
-
this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, t), this.position += 4;
|
|
79
|
-
},
|
|
80
|
-
readByte() {
|
|
81
|
-
this.assertReadLimit(), this._touch();
|
|
82
|
-
const t = this.inspectByte();
|
|
83
|
-
return this.position++, t;
|
|
84
|
-
},
|
|
85
|
-
readBytes(t, i) {
|
|
86
|
-
this.assertReadLimit(), this._touch();
|
|
87
|
-
const s = this.inspectBytes(t);
|
|
88
|
-
return this.position += i ?? t, s;
|
|
89
|
-
},
|
|
90
|
-
readUint8() {
|
|
91
|
-
this.assertReadLimit(), this._touch();
|
|
92
|
-
const t = this.inspectUint8();
|
|
93
|
-
return this.position += 1, t;
|
|
94
|
-
},
|
|
95
|
-
readUint16() {
|
|
96
|
-
this.assertReadLimit(), this._touch();
|
|
97
|
-
const t = this.inspectUint16();
|
|
98
|
-
return this.position += 2, t;
|
|
99
|
-
},
|
|
100
|
-
readUint24() {
|
|
101
|
-
this.assertReadLimit(), this._touch();
|
|
102
|
-
const t = this.inspectUint24();
|
|
103
|
-
return this.position += 3, t;
|
|
104
|
-
},
|
|
105
|
-
readUint32() {
|
|
106
|
-
this.assertReadLimit(), this._touch();
|
|
107
|
-
const t = this.inspectUint32();
|
|
108
|
-
return this.position += 4, t;
|
|
109
|
-
},
|
|
110
|
-
get remaining() {
|
|
111
|
-
return this.bytes.length - this.position;
|
|
112
|
-
},
|
|
113
|
-
setPosition(t) {
|
|
114
|
-
const i = this.position;
|
|
115
|
-
return this.assertPosition(t), this.position = t, () => this.position = i;
|
|
116
|
-
},
|
|
117
|
-
_touch() {
|
|
118
|
-
if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
|
|
119
|
-
return;
|
|
120
|
-
const t = this.getReadCount();
|
|
121
|
-
this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++;
|
|
1
|
+
import { stringify as a } from "./index57.js";
|
|
2
|
+
import { BaseError as t } from "./index71.js";
|
|
3
|
+
class n extends t {
|
|
4
|
+
constructor({ domain: r }) {
|
|
5
|
+
super(`Invalid domain "${a(r)}".`, {
|
|
6
|
+
metaMessages: ["Must be a valid EIP-712 domain."]
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class p extends t {
|
|
11
|
+
constructor({ primaryType: r, types: s }) {
|
|
12
|
+
super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(s))}\`.`, {
|
|
13
|
+
docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
|
|
14
|
+
metaMessages: ["Check that the primary type is a key in `types`."]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class y extends t {
|
|
19
|
+
constructor({ type: r }) {
|
|
20
|
+
super(`Struct type "${r}" is invalid.`, {
|
|
21
|
+
metaMessages: ["Struct type must not be a Solidity type."],
|
|
22
|
+
name: "InvalidStructTypeError"
|
|
23
|
+
});
|
|
122
24
|
}
|
|
123
|
-
};
|
|
124
|
-
function a(t, { recursiveReadLimit: i = 8192 } = {}) {
|
|
125
|
-
const s = Object.create(h);
|
|
126
|
-
return s.bytes = t, s.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), s.positionReadCount = /* @__PURE__ */ new Map(), s.recursiveReadLimit = i, s;
|
|
127
25
|
}
|
|
128
26
|
export {
|
|
129
|
-
|
|
27
|
+
n as InvalidDomainError,
|
|
28
|
+
p as InvalidPrimaryTypeError,
|
|
29
|
+
y as InvalidStructTypeError
|
|
130
30
|
};
|
package/dist/index101.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 e=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,t=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;exports.bytesRegex=e;exports.integerRegex=t;
|
package/dist/index101.js
CHANGED
|
@@ -1,115 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { wrapConstructor as D, rotr as i } from "./index111.js";
|
|
3
|
-
const g = /* @__PURE__ */ new Uint32Array([
|
|
4
|
-
1116352408,
|
|
5
|
-
1899447441,
|
|
6
|
-
3049323471,
|
|
7
|
-
3921009573,
|
|
8
|
-
961987163,
|
|
9
|
-
1508970993,
|
|
10
|
-
2453635748,
|
|
11
|
-
2870763221,
|
|
12
|
-
3624381080,
|
|
13
|
-
310598401,
|
|
14
|
-
607225278,
|
|
15
|
-
1426881987,
|
|
16
|
-
1925078388,
|
|
17
|
-
2162078206,
|
|
18
|
-
2614888103,
|
|
19
|
-
3248222580,
|
|
20
|
-
3835390401,
|
|
21
|
-
4022224774,
|
|
22
|
-
264347078,
|
|
23
|
-
604807628,
|
|
24
|
-
770255983,
|
|
25
|
-
1249150122,
|
|
26
|
-
1555081692,
|
|
27
|
-
1996064986,
|
|
28
|
-
2554220882,
|
|
29
|
-
2821834349,
|
|
30
|
-
2952996808,
|
|
31
|
-
3210313671,
|
|
32
|
-
3336571891,
|
|
33
|
-
3584528711,
|
|
34
|
-
113926993,
|
|
35
|
-
338241895,
|
|
36
|
-
666307205,
|
|
37
|
-
773529912,
|
|
38
|
-
1294757372,
|
|
39
|
-
1396182291,
|
|
40
|
-
1695183700,
|
|
41
|
-
1986661051,
|
|
42
|
-
2177026350,
|
|
43
|
-
2456956037,
|
|
44
|
-
2730485921,
|
|
45
|
-
2820302411,
|
|
46
|
-
3259730800,
|
|
47
|
-
3345764771,
|
|
48
|
-
3516065817,
|
|
49
|
-
3600352804,
|
|
50
|
-
4094571909,
|
|
51
|
-
275423344,
|
|
52
|
-
430227734,
|
|
53
|
-
506948616,
|
|
54
|
-
659060556,
|
|
55
|
-
883997877,
|
|
56
|
-
958139571,
|
|
57
|
-
1322822218,
|
|
58
|
-
1537002063,
|
|
59
|
-
1747873779,
|
|
60
|
-
1955562222,
|
|
61
|
-
2024104815,
|
|
62
|
-
2227730452,
|
|
63
|
-
2361852424,
|
|
64
|
-
2428436474,
|
|
65
|
-
2756734187,
|
|
66
|
-
3204031479,
|
|
67
|
-
3329325298
|
|
68
|
-
]), b = /* @__PURE__ */ new Uint32Array([
|
|
69
|
-
1779033703,
|
|
70
|
-
3144134277,
|
|
71
|
-
1013904242,
|
|
72
|
-
2773480762,
|
|
73
|
-
1359893119,
|
|
74
|
-
2600822924,
|
|
75
|
-
528734635,
|
|
76
|
-
1541459225
|
|
77
|
-
]), h = /* @__PURE__ */ new Uint32Array(64);
|
|
78
|
-
class w extends m {
|
|
79
|
-
constructor() {
|
|
80
|
-
super(64, 32, 8, !1), this.A = b[0] | 0, this.B = b[1] | 0, this.C = b[2] | 0, this.D = b[3] | 0, this.E = b[4] | 0, this.F = b[5] | 0, this.G = b[6] | 0, this.H = b[7] | 0;
|
|
81
|
-
}
|
|
82
|
-
get() {
|
|
83
|
-
const { A: d, B: o, C: t, D: s, E: a, F: f, G: c, H: e } = this;
|
|
84
|
-
return [d, o, t, s, a, f, c, e];
|
|
85
|
-
}
|
|
86
|
-
// prettier-ignore
|
|
87
|
-
set(d, o, t, s, a, f, c, e) {
|
|
88
|
-
this.A = d | 0, this.B = o | 0, this.C = t | 0, this.D = s | 0, this.E = a | 0, this.F = f | 0, this.G = c | 0, this.H = e | 0;
|
|
89
|
-
}
|
|
90
|
-
process(d, o) {
|
|
91
|
-
for (let x = 0; x < 16; x++, o += 4)
|
|
92
|
-
h[x] = d.getUint32(o, !1);
|
|
93
|
-
for (let x = 16; x < 64; x++) {
|
|
94
|
-
const A = h[x - 15], n = h[x - 2], C = i(A, 7) ^ i(A, 18) ^ A >>> 3, H = i(n, 17) ^ i(n, 19) ^ n >>> 10;
|
|
95
|
-
h[x] = H + h[x - 7] + C + h[x - 16] | 0;
|
|
96
|
-
}
|
|
97
|
-
let { A: t, B: s, C: a, D: f, E: c, F: e, G: r, H: l } = this;
|
|
98
|
-
for (let x = 0; x < 64; x++) {
|
|
99
|
-
const A = i(c, 6) ^ i(c, 11) ^ i(c, 25), n = l + A + p(c, e, r) + g[x] + h[x] | 0, H = (i(t, 2) ^ i(t, 13) ^ i(t, 22)) + u(t, s, a) | 0;
|
|
100
|
-
l = r, r = e, e = c, c = f + n | 0, f = a, a = s, s = t, t = n + H | 0;
|
|
101
|
-
}
|
|
102
|
-
t = t + this.A | 0, s = s + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, c = c + this.E | 0, e = e + this.F | 0, r = r + this.G | 0, l = l + this.H | 0, this.set(t, s, a, f, c, e, r, l);
|
|
103
|
-
}
|
|
104
|
-
roundClean() {
|
|
105
|
-
h.fill(0);
|
|
106
|
-
}
|
|
107
|
-
destroy() {
|
|
108
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const G = /* @__PURE__ */ D(() => new w());
|
|
1
|
+
const e = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, t = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
112
2
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
3
|
+
e as bytesRegex,
|
|
4
|
+
t as integerRegex
|
|
115
5
|
};
|
package/dist/index102.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("./index71.cjs");class t extends a.BaseError{constructor(e){const{docsPath:s,field:r,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${r}".`,{docsPath:s,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}exports.SiweInvalidMessageFieldError=t;
|
package/dist/index102.js
CHANGED
|
@@ -1,81 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { slice as I } from "./index89.js";
|
|
11
|
-
import { hexToNumber as G } from "./index34.js";
|
|
12
|
-
function C(t) {
|
|
13
|
-
const { authorizationList: e } = t;
|
|
14
|
-
if (e)
|
|
15
|
-
for (const o of e) {
|
|
16
|
-
const { contractAddress: r, chainId: i } = o;
|
|
17
|
-
if (!f(r))
|
|
18
|
-
throw new s({ address: r });
|
|
19
|
-
if (i < 0)
|
|
20
|
-
throw new n({ chainId: i });
|
|
21
|
-
}
|
|
22
|
-
c(t);
|
|
23
|
-
}
|
|
24
|
-
function L(t) {
|
|
25
|
-
const { blobVersionedHashes: e } = t;
|
|
26
|
-
if (e) {
|
|
27
|
-
if (e.length === 0)
|
|
28
|
-
throw new P();
|
|
29
|
-
for (const o of e) {
|
|
30
|
-
const r = F(o), i = G(I(o, 0, 1));
|
|
31
|
-
if (r !== 32)
|
|
32
|
-
throw new p({ hash: o, size: r });
|
|
33
|
-
if (i !== d)
|
|
34
|
-
throw new x({
|
|
35
|
-
hash: o,
|
|
36
|
-
version: i
|
|
37
|
-
});
|
|
38
|
-
}
|
|
1
|
+
import { BaseError as i } from "./index71.js";
|
|
2
|
+
class d extends i {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
const { docsPath: s, field: r, metaMessages: a } = e;
|
|
5
|
+
super(`Invalid Sign-In with Ethereum message field "${r}".`, {
|
|
6
|
+
docsPath: s,
|
|
7
|
+
metaMessages: a,
|
|
8
|
+
name: "SiweInvalidMessageFieldError"
|
|
9
|
+
});
|
|
39
10
|
}
|
|
40
|
-
c(t);
|
|
41
|
-
}
|
|
42
|
-
function c(t) {
|
|
43
|
-
const { chainId: e, maxPriorityFeePerGas: o, maxFeePerGas: r, to: i } = t;
|
|
44
|
-
if (e <= 0)
|
|
45
|
-
throw new n({ chainId: e });
|
|
46
|
-
if (i && !f(i))
|
|
47
|
-
throw new s({ address: i });
|
|
48
|
-
if (r && r > m)
|
|
49
|
-
throw new w({ maxFeePerGas: r });
|
|
50
|
-
if (o && r && o > r)
|
|
51
|
-
throw new E({ maxFeePerGas: r, maxPriorityFeePerGas: o });
|
|
52
|
-
}
|
|
53
|
-
function B(t) {
|
|
54
|
-
const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
|
|
55
|
-
if (e <= 0)
|
|
56
|
-
throw new n({ chainId: e });
|
|
57
|
-
if (a && !f(a))
|
|
58
|
-
throw new s({ address: a });
|
|
59
|
-
if (o || i)
|
|
60
|
-
throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
|
|
61
|
-
if (r && r > m)
|
|
62
|
-
throw new w({ maxFeePerGas: r });
|
|
63
|
-
}
|
|
64
|
-
function K(t) {
|
|
65
|
-
const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
|
|
66
|
-
if (a && !f(a))
|
|
67
|
-
throw new s({ address: a });
|
|
68
|
-
if (typeof e < "u" && e <= 0)
|
|
69
|
-
throw new n({ chainId: e });
|
|
70
|
-
if (o || i)
|
|
71
|
-
throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
|
|
72
|
-
if (r && r > m)
|
|
73
|
-
throw new w({ maxFeePerGas: r });
|
|
74
11
|
}
|
|
75
12
|
export {
|
|
76
|
-
|
|
77
|
-
B as assertTransactionEIP2930,
|
|
78
|
-
L as assertTransactionEIP4844,
|
|
79
|
-
C as assertTransactionEIP7702,
|
|
80
|
-
K as assertTransactionLegacy
|
|
13
|
+
d as SiweInvalidMessageFieldError
|
|
81
14
|
};
|
package/dist/index103.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=1;exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(e){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e)||/%[^0-9a-f]/i.test(e)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))return!1;const s=a(e),f=s[1],t=s[2],i=s[3],r=s[4],l=s[5];if(!(f!=null&&f.length&&i.length>=0))return!1;if(t!=null&&t.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(f.toLowerCase()))return!1;let n="";return n+=`${f}:`,t!=null&&t.length&&(n+=`//${t}`),n+=i,r!=null&&r.length&&(n+=`?${r}`),l!=null&&l.length&&(n+=`#${l}`),n}function a(e){return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}exports.isUri=o;
|
package/dist/index103.js
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
function o(e) {
|
|
2
|
+
if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e) || /%[^0-9a-f]/i.test(e) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))
|
|
3
|
+
return !1;
|
|
4
|
+
const s = a(e), f = s[1], t = s[2], i = s[3], r = s[4], l = s[5];
|
|
5
|
+
if (!(f != null && f.length && i.length >= 0))
|
|
6
|
+
return !1;
|
|
7
|
+
if (t != null && t.length) {
|
|
8
|
+
if (!(i.length === 0 || /^\//.test(i)))
|
|
9
|
+
return !1;
|
|
10
|
+
} else if (/^\/\//.test(i))
|
|
11
|
+
return !1;
|
|
12
|
+
if (!/^[a-z][a-z0-9\+\-\.]*$/.test(f.toLowerCase()))
|
|
13
|
+
return !1;
|
|
14
|
+
let n = "";
|
|
15
|
+
return n += `${f}:`, t != null && t.length && (n += `//${t}`), n += i, r != null && r.length && (n += `?${r}`), l != null && l.length && (n += `#${l}`), n;
|
|
16
|
+
}
|
|
17
|
+
function a(e) {
|
|
18
|
+
return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);
|
|
19
|
+
}
|
|
2
20
|
export {
|
|
3
|
-
|
|
21
|
+
o as isUri
|
|
4
22
|
};
|
package/dist/index104.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 n=BigInt(2**32-1),i=BigInt(32);function u(t,e=!1){return e?{h:Number(t&n),l:Number(t>>i&n)}:{h:Number(t>>i&n)|0,l:Number(t&n)|0}}function g(t,e=!1){let r=new Uint32Array(t.length),l=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:c,l:f}=u(t[o],e);[r[o],l[o]]=[c,f]}return[r,l]}const B=(t,e,r)=>t<<r|e>>>32-r,h=(t,e,r)=>e<<r|t>>>32-r,m=(t,e,r)=>e<<r-32|t>>>64-r,S=(t,e,r)=>t<<r-32|e>>>64-r;exports.fromBig=u;exports.rotlBH=m;exports.rotlBL=S;exports.rotlSH=B;exports.rotlSL=h;exports.split=g;
|
package/dist/index104.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
o ? i(o) : "0x",
|
|
11
|
-
s,
|
|
12
|
-
n ? i(n) : "0x",
|
|
13
|
-
...c({}, a)
|
|
14
|
-
]);
|
|
1
|
+
const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
|
|
2
|
+
function f(t, r = !1) {
|
|
3
|
+
return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
|
|
4
|
+
}
|
|
5
|
+
function h(t, r = !1) {
|
|
6
|
+
let n = new Uint32Array(t.length), l = new Uint32Array(t.length);
|
|
7
|
+
for (let e = 0; e < t.length; e++) {
|
|
8
|
+
const { h: c, l: u } = f(t[e], r);
|
|
9
|
+
[n[e], l[e]] = [c, u];
|
|
15
10
|
}
|
|
16
|
-
return
|
|
11
|
+
return [n, l];
|
|
17
12
|
}
|
|
13
|
+
const g = (t, r, n) => t << n | r >>> 32 - n, m = (t, r, n) => r << n | t >>> 32 - n, A = (t, r, n) => r << n - 32 | t >>> 64 - n, B = (t, r, n) => t << n - 32 | r >>> 64 - n;
|
|
18
14
|
export {
|
|
19
|
-
|
|
15
|
+
f as fromBig,
|
|
16
|
+
A as rotlBH,
|
|
17
|
+
B as rotlBL,
|
|
18
|
+
g as rotlSH,
|
|
19
|
+
m as rotlSL,
|
|
20
|
+
h as split
|
|
20
21
|
};
|