@gardenfi/utils 2.1.3-beta.1 → 2.1.3-beta.2
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/index104.cjs +1 -1
- package/dist/index104.js +1 -1
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +2 -2
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +4 -4
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +1 -1
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +1 -1
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +1 -1
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +1 -1
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +6 -6
- package/dist/index230.cjs +1 -1
- package/dist/index230.js +25 -10
- package/dist/index231.cjs +1 -1
- package/dist/index231.js +13 -16
- package/dist/index232.cjs +1 -1
- package/dist/index232.js +14 -21
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +5 -30
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +14 -2
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +9 -12
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +16 -12
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +10 -47
- package/dist/index238.cjs +1 -1
- package/dist/index238.js +15 -10
- package/dist/index239.cjs +1 -1
- package/dist/index239.js +22 -7
- package/dist/index240.cjs +1 -1
- package/dist/index240.js +30 -9
- package/dist/index241.cjs +1 -1
- package/dist/index241.js +2 -14
- package/dist/index242.cjs +1 -1
- package/dist/index242.js +13 -14
- package/dist/index243.cjs +1 -1
- package/dist/index243.js +12 -9
- package/dist/index244.cjs +1 -1
- package/dist/index244.js +47 -24
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +11 -12
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +7 -24
- package/dist/index247.cjs +1 -2
- package/dist/index247.js +9 -24
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +10 -10
- package/dist/index249.cjs +1 -1
- package/dist/index249.js +14 -15
- package/dist/index250.cjs +1 -1
- package/dist/index250.js +9 -52
- package/dist/index251.cjs +1 -1
- package/dist/index251.js +24 -25
- package/dist/index252.cjs +1 -1
- package/dist/index252.js +12 -13
- package/dist/index253.cjs +1 -1
- package/dist/index253.js +24 -15
- package/dist/index254.cjs +2 -1
- package/dist/index254.js +24 -5
- package/dist/index255.cjs +1 -1
- package/dist/index255.js +12 -12
- package/dist/index256.cjs +1 -1
- package/dist/index256.js +15 -10
- package/dist/index257.cjs +1 -1
- package/dist/index257.js +52 -16
- package/dist/index266.cjs +1 -1
- package/dist/index266.js +1 -1
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +1 -1
- package/dist/index278.cjs +1 -1
- package/dist/index278.js +1 -1
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +2 -2
- package/dist/index284.cjs +1 -1
- package/dist/index284.js +1 -1
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +40 -3
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +2 -141
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +199 -148
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +3 -9
- package/dist/index290.cjs +1 -1
- package/dist/index290.js +130 -103
- package/dist/index291.cjs +1 -2
- package/dist/index291.js +123 -102
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +9 -40
- package/dist/index293.cjs +1 -1
- package/dist/index293.js +114 -2
- package/dist/index294.cjs +2 -1
- package/dist/index294.js +125 -197
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +11 -68
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +19 -11
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +68 -19
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +1 -1
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +1 -1
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +1 -1
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +1 -1
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +2 -2
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +1 -1
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +2 -2
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +1 -1
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +2 -2
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +1 -1
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -2
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +6 -6
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +2 -2
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +1 -1
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +1 -1
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +1 -1
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +4 -4
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +1 -1
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +1 -1
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +1 -1
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +3 -3
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +2 -2
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +1 -1
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +1 -1
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +1 -1
- package/package.json +1 -1
package/dist/index252.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
return r === "bytes" || r === "hex" ? a({ ...t, to: r }) : t;
|
|
1
|
+
import { from as m } from "./index293.js";
|
|
2
|
+
import { encode as c } from "./index294.js";
|
|
3
|
+
import { concat as f } from "./index291.js";
|
|
4
|
+
function d(o, t) {
|
|
5
|
+
var e;
|
|
6
|
+
const { bytecode: r, args: n } = t;
|
|
7
|
+
return f(r, (e = o.inputs) != null && e.length && (n != null && n.length) ? c(o.inputs, n) : "0x");
|
|
8
|
+
}
|
|
9
|
+
function s(o) {
|
|
10
|
+
return m(o);
|
|
13
11
|
}
|
|
14
12
|
export {
|
|
15
|
-
|
|
13
|
+
d as encode,
|
|
14
|
+
s as from
|
|
16
15
|
};
|
package/dist/index253.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=require("./index293.cjs"),s=require("./index294.cjs"),m=require("./index291.cjs");function d(e,...t){const{overloads:r}=e,o=r?u([e,...r],e.name,{args:t[0]}):e,c=f(o),i=t.length>0?s.encode(o.inputs,t[0]):void 0;return i?m.concat(c,i):c}function l(e,t={}){return n.from(e,t)}function u(e,t,r){const o=n.fromAbi(e,t,r);if(o.type!=="function")throw new n.NotFoundError({name:t,type:"function"});return o}function f(e){return n.getSelector(e)}exports.encodeData=d;exports.from=l;exports.fromAbi=u;exports.getSelector=f;
|
package/dist/index253.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { from as c, fromAbi as m, NotFoundError as i, getSelector as s } from "./index293.js";
|
|
2
|
+
import { encode as u } from "./index294.js";
|
|
3
|
+
import { concat as d } from "./index291.js";
|
|
4
|
+
function S(o, ...t) {
|
|
5
|
+
const { overloads: r } = o, e = r ? p([o, ...r], o.name, {
|
|
6
|
+
args: t[0]
|
|
7
|
+
}) : o, n = l(e), f = t.length > 0 ? u(e.inputs, t[0]) : void 0;
|
|
8
|
+
return f ? d(n, f) : n;
|
|
9
|
+
}
|
|
10
|
+
function $(o, t = {}) {
|
|
11
|
+
return c(o, t);
|
|
12
|
+
}
|
|
13
|
+
function p(o, t, r) {
|
|
14
|
+
const e = m(o, t, r);
|
|
15
|
+
if (e.type !== "function")
|
|
16
|
+
throw new i({ name: t, type: "function" });
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
function l(o) {
|
|
20
|
+
return s(o);
|
|
15
21
|
}
|
|
16
22
|
export {
|
|
17
|
-
|
|
23
|
+
S as encodeData,
|
|
24
|
+
$ as from,
|
|
25
|
+
p as fromAbi,
|
|
26
|
+
l as getSelector
|
|
18
27
|
};
|
package/dist/index254.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index38.cjs");class c extends t.BaseError{constructor({docsPath:o}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
|
|
2
|
+
`),{docsPath:o,docsSlug:"account",name:"AccountNotFoundError"})}}class u extends t.BaseError{constructor({docsPath:o,metaMessages:e,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:o,metaMessages:e,name:"AccountTypeNotSupportedError"})}}exports.AccountNotFoundError=c;exports.AccountTypeNotSupportedError=u;
|
package/dist/index254.js
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { BaseError as t } from "./index38.js";
|
|
2
|
+
class u extends t {
|
|
3
|
+
constructor({ docsPath: o } = {}) {
|
|
4
|
+
super([
|
|
5
|
+
"Could not find an Account to execute with this Action.",
|
|
6
|
+
"Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
|
|
7
|
+
].join(`
|
|
8
|
+
`), {
|
|
9
|
+
docsPath: o,
|
|
10
|
+
docsSlug: "account",
|
|
11
|
+
name: "AccountNotFoundError"
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class s extends t {
|
|
16
|
+
constructor({ docsPath: o, metaMessages: c, type: r }) {
|
|
17
|
+
super(`Account type "${r}" is not supported.`, {
|
|
18
|
+
docsPath: o,
|
|
19
|
+
metaMessages: c,
|
|
20
|
+
name: "AccountTypeNotSupportedError"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
5
23
|
}
|
|
6
24
|
export {
|
|
7
|
-
|
|
25
|
+
u as AccountNotFoundError,
|
|
26
|
+
s as AccountTypeNotSupportedError
|
|
8
27
|
};
|
package/dist/index255.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 c=require("./index143.cjs"),i=require("./index135.cjs"),s=require("./index251.cjs");function u(r,{docsPath:o,...e}){const t=(()=>{const n=s.getNodeError(r,e);return n instanceof c.UnknownNodeError?r:n})();return new i.TransactionExecutionError(t,{docsPath:o,...e})}exports.getTransactionError=u;
|
package/dist/index255.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { UnknownNodeError as c } from "./index143.js";
|
|
2
|
+
import { TransactionExecutionError as i } from "./index135.js";
|
|
3
|
+
import { getNodeError as u } from "./index251.js";
|
|
4
|
+
function s(r, { docsPath: t, ...o }) {
|
|
5
|
+
const e = (() => {
|
|
6
|
+
const n = u(r, o);
|
|
7
|
+
return n instanceof c ? r : n;
|
|
8
|
+
})();
|
|
9
|
+
return new i(e, {
|
|
10
|
+
docsPath: t,
|
|
11
|
+
...o
|
|
11
12
|
});
|
|
12
|
-
return i(r, s);
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
s as getTransactionError
|
|
16
16
|
};
|
package/dist/index256.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 t=require("./index182.cjs");function a(e){return e.map(n=>({...n,value:BigInt(n.value)}))}function r(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?t.hexToNumber(e.nonce):void 0,storageProof:e.storageProof?a(e.storageProof):void 0}}exports.formatProof=r;
|
package/dist/index256.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { hexToNumber as a } from "./index182.js";
|
|
2
|
+
function t(e) {
|
|
3
|
+
return e.map((n) => ({
|
|
4
|
+
...n,
|
|
5
|
+
value: BigInt(n.value)
|
|
6
|
+
}));
|
|
7
|
+
}
|
|
8
|
+
function o(e) {
|
|
9
|
+
return {
|
|
10
|
+
...e,
|
|
11
|
+
balance: e.balance ? BigInt(e.balance) : void 0,
|
|
12
|
+
nonce: e.nonce ? a(e.nonce) : void 0,
|
|
13
|
+
storageProof: e.storageProof ? t(e.storageProof) : void 0
|
|
14
|
+
};
|
|
10
15
|
}
|
|
11
16
|
export {
|
|
12
|
-
|
|
17
|
+
o as formatProof
|
|
13
18
|
};
|
package/dist/index257.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 y=require("./index21.cjs"),v=require("./index118.cjs"),A=require("./index127.cjs"),b=require("./index174.cjs"),h=require("./index159.cjs"),x=require("./index181.cjs"),E=require("./index185.cjs"),H=require("./index150.cjs"),D=require("./index29.cjs"),p=require("./index195.cjs"),V=require("./index189.cjs"),w=require("./index196.cjs"),z=require("./index193.cjs"),m=require("./index58.cjs"),T=require("./index177.cjs"),j=require("./index182.cjs");async function B(s,S){var l,g,f;const{address:i,factory:n,factoryData:o,hash:a,signature:e,universalSignatureVerifierAddress:c=(f=(g=(l=s.chain)==null?void 0:l.contracts)==null?void 0:g.universalSignatureVerifier)==null?void 0:f.address,...u}=S,r=E.isHex(e)?e:typeof e=="object"&&"r"in e&&"s"in e?z.serializeSignature(e):H.bytesToHex(e),d=await(async()=>!n&&!o||p.isErc6492Signature(r)?r:w.serializeErc6492Signature({address:n,data:o,signature:r}))();try{const t=c?{to:c,data:T.encodeFunctionData({abi:y.universalSignatureValidatorAbi,functionName:"isValidSig",args:[i,a,d]}),...u}:{data:b.encodeDeployData({abi:y.universalSignatureValidatorAbi,args:[i,a,d],bytecode:v.universalSignatureValidatorByteCode}),...u},{data:q}=await D.getAction(s,m.call,"call")(t);return j.hexToBool(q??"0x0")}catch(t){try{if(x.isAddressEqual(h.getAddress(i),await V.recoverAddress({hash:a,signature:e})))return!0}catch{}if(t instanceof A.CallExecutionError)return!1;throw t}}exports.verifyHash=B;
|
package/dist/index257.js
CHANGED
|
@@ -1,19 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { universalSignatureValidatorAbi as g } from "./index21.js";
|
|
2
|
+
import { universalSignatureValidatorByteCode as S } from "./index118.js";
|
|
3
|
+
import { CallExecutionError as h } from "./index127.js";
|
|
4
|
+
import { encodeDeployData as v } from "./index174.js";
|
|
5
|
+
import { getAddress as x } from "./index159.js";
|
|
6
|
+
import { isAddressEqual as b } from "./index181.js";
|
|
7
|
+
import { isHex as A } from "./index185.js";
|
|
8
|
+
import { bytesToHex as w } from "./index150.js";
|
|
9
|
+
import { getAction as E } from "./index29.js";
|
|
10
|
+
import { isErc6492Signature as V } from "./index195.js";
|
|
11
|
+
import { recoverAddress as D } from "./index189.js";
|
|
12
|
+
import { serializeErc6492Signature as H } from "./index196.js";
|
|
13
|
+
import { serializeSignature as z } from "./index193.js";
|
|
14
|
+
import { call as B } from "./index58.js";
|
|
15
|
+
import { encodeFunctionData as C } from "./index177.js";
|
|
16
|
+
import { hexToBool as T } from "./index182.js";
|
|
17
|
+
async function W(o, y) {
|
|
18
|
+
var u, d, p;
|
|
19
|
+
const { address: i, factory: n, factoryData: s, hash: a, signature: r, universalSignatureVerifierAddress: f = (p = (d = (u = o.chain) == null ? void 0 : u.contracts) == null ? void 0 : d.universalSignatureVerifier) == null ? void 0 : p.address, ...m } = y, t = A(r) ? r : typeof r == "object" && "r" in r && "s" in r ? z(r) : w(r), c = await (async () => !n && !s || V(t) ? t : H({
|
|
20
|
+
address: n,
|
|
21
|
+
data: s,
|
|
22
|
+
signature: t
|
|
23
|
+
}))();
|
|
24
|
+
try {
|
|
25
|
+
const e = f ? {
|
|
26
|
+
to: f,
|
|
27
|
+
data: C({
|
|
28
|
+
abi: g,
|
|
29
|
+
functionName: "isValidSig",
|
|
30
|
+
args: [i, a, c]
|
|
31
|
+
}),
|
|
32
|
+
...m
|
|
33
|
+
} : {
|
|
34
|
+
data: v({
|
|
35
|
+
abi: g,
|
|
36
|
+
args: [i, a, c],
|
|
37
|
+
bytecode: S
|
|
38
|
+
}),
|
|
39
|
+
...m
|
|
40
|
+
}, { data: l } = await E(o, B, "call")(e);
|
|
41
|
+
return T(l ?? "0x0");
|
|
42
|
+
} catch (e) {
|
|
43
|
+
try {
|
|
44
|
+
if (b(x(i), await D({ hash: a, signature: r })))
|
|
45
|
+
return !0;
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
if (e instanceof h)
|
|
49
|
+
return !1;
|
|
50
|
+
throw e;
|
|
51
|
+
}
|
|
16
52
|
}
|
|
17
53
|
export {
|
|
18
|
-
|
|
54
|
+
W as verifyHash
|
|
19
55
|
};
|
package/dist/index266.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index263.cjs"),A=require("./index268.cjs"),g=require("./index269.cjs"),d=require("./index270.cjs"),q=require("./index271.cjs"),h=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index263.cjs"),A=require("./index268.cjs"),g=require("./index269.cjs"),d=require("./index270.cjs"),q=require("./index271.cjs"),h=require("./index297.cjs"),o=require("./index264.cjs");function z(e,t={}){if(o.isFunctionSignature(e))return E(e,t);if(o.isEventSignature(e))return P(e,t);if(o.isErrorSignature(e))return M(e,t);if(o.isConstructorSignature(e))return I(e,t);if(o.isFallbackSignature(e))return R(e);if(o.isReceiveSignature(e))return{type:"receive",stateMutability:"payable"};throw new d.UnknownSignatureError({signature:e})}function E(e,t={}){const n=o.execFunctionSignature(e);if(!n)throw new d.InvalidSignatureError({signature:e,type:"function"});const a=u(n.parameters),r=[],c=a.length;for(let s=0;s<c;s++)r.push(m(a[s],{modifiers:o.functionModifiers,structs:t,type:"function"}));const i=[];if(n.returns){const s=u(n.returns),l=s.length;for(let f=0;f<l;f++)i.push(m(s[f],{modifiers:o.functionModifiers,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:r,outputs:i}}function P(e,t={}){const n=o.execEventSignature(e);if(!n)throw new d.InvalidSignatureError({signature:e,type:"event"});const a=u(n.parameters),r=[],c=a.length;for(let i=0;i<c;i++)r.push(m(a[i],{modifiers:o.eventModifiers,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:r}}function M(e,t={}){const n=o.execErrorSignature(e);if(!n)throw new d.InvalidSignatureError({signature:e,type:"error"});const a=u(n.parameters),r=[],c=a.length;for(let i=0;i<c;i++)r.push(m(a[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:r}}function I(e,t={}){const n=o.execConstructorSignature(e);if(!n)throw new d.InvalidSignatureError({signature:e,type:"constructor"});const a=u(n.parameters),r=[],c=a.length;for(let i=0;i<c;i++)r.push(m(a[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:r}}function R(e){const t=o.execFallbackSignature(e);if(!t)throw new d.InvalidSignatureError({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const _=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,$=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,K=/^u?int$/;function m(e,t){var p,w;const n=h.getParameterCacheKey(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(h.parameterCache.has(n))return h.parameterCache.get(n);const a=y.isTupleRegex.test(e),r=y.execTyped(a?$:_,e);if(!r)throw new g.InvalidParameterError({param:e});if(r.name&&F(r.name))throw new g.SolidityProtectedKeywordError({param:e,name:r.name});const c=r.name?{name:r.name}:{},i=r.modifier==="indexed"?{indexed:!0}:{},s=(t==null?void 0:t.structs)??{};let l,f={};if(a){l="tuple";const v=u(r.type),x=[],k=v.length;for(let b=0;b<k;b++)x.push(m(v[b],{structs:s}));f={components:x}}else if(r.type in s)l="tuple",f={components:s[r.type]};else if(K.test(r.type))l=`${r.type}256`;else if(l=r.type,(t==null?void 0:t.type)!=="struct"&&!C(l))throw new A.UnknownSolidityTypeError({type:l});if(r.modifier){if(!((w=(p=t==null?void 0:t.modifiers)==null?void 0:p.has)!=null&&w.call(p,r.modifier)))throw new g.InvalidModifierError({param:e,type:t==null?void 0:t.type,modifier:r.modifier});if(o.functionModifiers.has(r.modifier)&&!T(l,!!r.array))throw new g.InvalidFunctionModifierError({param:e,type:t==null?void 0:t.type,modifier:r.modifier})}const S={type:`${l}${r.array??""}`,...c,...i,...f};return h.parameterCache.set(n,S),S}function u(e,t=[],n="",a=0){const r=e.trim().length;for(let c=0;c<r;c++){const i=e[c],s=e.slice(c+1);switch(i){case",":return a===0?u(s,[...t,n.trim()]):u(s,t,`${n}${i}`,a);case"(":return u(s,t,`${n}${i}`,a+1);case")":return u(s,t,`${n}${i}`,a-1);default:return u(s,t,`${n}${i}`,a)}}if(n==="")return t;if(a!==0)throw new q.InvalidParenthesisError({current:n,depth:a});return t.push(n.trim()),t}function C(e){return e==="address"||e==="bool"||e==="function"||e==="string"||y.bytesRegex.test(e)||y.integerRegex.test(e)}const Z=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function F(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||y.bytesRegex.test(e)||y.integerRegex.test(e)||Z.test(e)}function T(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}exports.isSolidityKeyword=F;exports.isSolidityType=C;exports.isValidDataLocation=T;exports.parseAbiParameter=m;exports.parseConstructorSignature=I;exports.parseErrorSignature=M;exports.parseEventSignature=P;exports.parseFallbackSignature=R;exports.parseFunctionSignature=E;exports.parseSignature=z;exports.splitParameters=u;
|
package/dist/index266.js
CHANGED
|
@@ -3,7 +3,7 @@ import { UnknownSolidityTypeError as M } from "./index268.js";
|
|
|
3
3
|
import { InvalidParameterError as R, SolidityProtectedKeywordError as k, InvalidModifierError as z, InvalidFunctionModifierError as A } from "./index269.js";
|
|
4
4
|
import { UnknownSignatureError as F, InvalidSignatureError as m } from "./index270.js";
|
|
5
5
|
import { InvalidParenthesisError as T } from "./index271.js";
|
|
6
|
-
import { getParameterCacheKey as _, parameterCache as p } from "./
|
|
6
|
+
import { getParameterCacheKey as _, parameterCache as p } from "./index297.js";
|
|
7
7
|
import { isFunctionSignature as C, isEventSignature as I, isErrorSignature as Z, isConstructorSignature as K, isFallbackSignature as L, isReceiveSignature as U, functionModifiers as h, execFunctionSignature as W, execEventSignature as D, eventModifiers as V, execErrorSignature as j, execConstructorSignature as q, execFallbackSignature as B } from "./index264.js";
|
|
8
8
|
function le(e, t = {}) {
|
|
9
9
|
if (C(e))
|
package/dist/index277.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index286.cjs"),s=require("./index284.cjs"),o=require("./index298.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function c(e){return{hash:e,hmac:(r,...t)=>a.hmac(e,r,s.concatBytes(...t)),randomBytes:s.randomBytes}}function u(e,r){const t=n=>o.weierstrass({...e,...c(n)});return{...t(r),create:t}}exports.createCurve=u;exports.getHash=c;
|
package/dist/index277.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hmac as c } from "./
|
|
1
|
+
import { hmac as c } from "./index286.js";
|
|
2
2
|
import { randomBytes as m, concatBytes as n } from "./index284.js";
|
|
3
3
|
import { weierstrass as a } from "./index298.js";
|
|
4
4
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
package/dist/index278.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index288.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const d=BigInt(0),c=BigInt(1),w=BigInt(2),j=BigInt(3),E=BigInt(4),S=BigInt(5),I=BigInt(8);function g(t,i){const r=t%i;return r>=d?r:i+r}function L(t,i,r){if(i<d)throw new Error("invalid exponent, negatives unsupported");if(r<=d)throw new Error("invalid modulus");if(r===c)return d;let n=c;for(;i>d;)i&c&&(n=n*t%r),t=t*t%r,i>>=c;return n}function H(t,i,r){let n=t;for(;i-- >d;)n*=n,n%=r;return n}function m(t,i){if(t===d)throw new Error("invert: expected non-zero number");if(i<=d)throw new Error("invert: expected positive modulus, got "+i);let r=g(t,i),n=i,s=d,u=c;for(;r!==d;){const o=n/r,e=n%r,l=s-u*o;n=r,r=e,s=u,u=l}if(n!==c)throw new Error("invert: does not exist");return g(s,i)}function T(t){const i=(t-c)/w;let r,n,s;for(r=t-c,n=0;r%w===d;r/=w,n++);for(s=w;s<t&&L(s,i,t)!==t-c;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const f=(t+c)/E;return function(e,l){const h=e.pow(l,f);if(!e.eql(e.sqr(h),l))throw new Error("Cannot find square root");return h}}const u=(r+c)/w;return function(o,e){if(o.pow(e,i)===o.neg(o.ONE))throw new Error("Cannot find square root");let l=n,h=o.pow(o.mul(o.ONE,s),r),v=o.pow(e,u),q=o.pow(e,r);for(;!o.eql(q,o.ONE);){if(o.eql(q,o.ZERO))return o.ZERO;let b=1;for(let B=o.sqr(q);b<l&&!o.eql(B,o.ONE);b++)B=o.sqr(B);const y=o.pow(h,c<<BigInt(l-b-1));h=o.sqr(y),v=o.mul(v,y),q=o.mul(q,h),l=b}return v}}function x(t){if(t%E===j){const i=(t+c)/E;return function(n,s){const u=n.pow(s,i);if(!n.eql(n.sqr(u),s))throw new Error("Cannot find square root");return u}}if(t%I===S){const i=(t-S)/I;return function(n,s){const u=n.mul(s,w),f=n.pow(u,i),o=n.mul(s,f),e=n.mul(n.mul(o,w),f),l=n.mul(o,n.sub(e,n.ONE));if(!n.eql(n.sqr(l),s))throw new Error("Cannot find square root");return l}}return T(t)}const Z=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function k(t){const i={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Z.reduce((n,s)=>(n[s]="function",n),i);return a.validateObject(t,r)}function M(t,i,r){if(r<d)throw new Error("invalid exponent, negatives unsupported");if(r===d)return t.ONE;if(r===c)return i;let n=t.ONE,s=i;for(;r>d;)r&c&&(n=t.mul(n,s)),s=t.sqr(s),r>>=c;return n}function _(t,i){const r=new Array(i.length),n=i.reduce((u,f,o)=>t.is0(f)?u:(r[o]=u,t.mul(u,f)),t.ONE),s=t.inv(n);return i.reduceRight((u,f,o)=>t.is0(f)?u:(r[o]=t.mul(u,r[o]),t.mul(u,f)),s),r}function p(t,i){const r=i!==void 0?i:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function z(t,i,r=!1,n={}){if(t<=d)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:u}=p(t,i);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f;const o=Object.freeze({ORDER:t,isLE:r,BITS:s,BYTES:u,MASK:a.bitMask(s),ZERO:d,ONE:c,create:e=>g(e,t),isValid:e=>{if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return d<=e&&e<t},is0:e=>e===d,isOdd:e=>(e&c)===c,neg:e=>g(-e,t),eql:(e,l)=>e===l,sqr:e=>g(e*e,t),add:(e,l)=>g(e+l,t),sub:(e,l)=>g(e-l,t),mul:(e,l)=>g(e*l,t),pow:(e,l)=>M(o,e,l),div:(e,l)=>g(e*m(l,t),t),sqrN:e=>e*e,addN:(e,l)=>e+l,subN:(e,l)=>e-l,mulN:(e,l)=>e*l,inv:e=>m(e,t),sqrt:n.sqrt||(e=>(f||(f=x(t)),f(o,e))),invertBatch:e=>_(o,e),cmov:(e,l,h)=>h?l:e,toBytes:e=>r?a.numberToBytesLE(e,u):a.numberToBytesBE(e,u),fromBytes:e=>{if(e.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+e.length);return r?a.bytesToNumberLE(e):a.bytesToNumberBE(e)}});return Object.freeze(o)}function N(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const i=t.toString(2).length;return Math.ceil(i/8)}function C(t){const i=N(t);return i+Math.ceil(i/2)}function A(t,i,r=!1){const n=t.length,s=N(i),u=C(i);if(n<16||n<u||n>1024)throw new Error("expected "+u+"-1024 bytes of input, got "+n);const f=r?a.bytesToNumberLE(t):a.bytesToNumberBE(t),o=g(f,i-c)+c;return r?a.numberToBytesLE(o,s):a.numberToBytesBE(o,s)}exports.Field=z;exports.FpInvertBatch=_;exports.FpPow=M;exports.FpSqrt=x;exports.getFieldBytesLength=N;exports.getMinHashLength=C;exports.invert=m;exports.mapHashToField=A;exports.mod=g;exports.nLength=p;exports.pow=L;exports.pow2=H;exports.tonelliShanks=T;exports.validateField=k;
|
package/dist/index278.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { numberToBytesLE as S, numberToBytesBE as x, bitMask as _, bytesToNumberLE as y, bytesToNumberBE as L, validateObject as M } from "./
|
|
1
|
+
import { numberToBytesLE as S, numberToBytesBE as x, bitMask as _, bytesToNumberLE as y, bytesToNumberBE as L, validateObject as M } from "./index288.js";
|
|
2
2
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
3
|
const d = BigInt(0), c = BigInt(1), w = /* @__PURE__ */ BigInt(2), C = /* @__PURE__ */ BigInt(3), b = /* @__PURE__ */ BigInt(4), N = /* @__PURE__ */ BigInt(5), m = /* @__PURE__ */ BigInt(8);
|
|
4
4
|
function g(t, i) {
|
package/dist/index28.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index295.cjs"),M=require("./index159.cjs"),h=require("./index296.cjs");function R(r){const{chainId:o,domain:s,expirationTime:l,issuedAt:m=new Date,nonce:a,notBefore:f,requestId:w,resources:g,scheme:i,uri:c,version:d}=r;{if(o!==Math.floor(o))throw new e.SiweInvalidMessageFieldError({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${o}`]});if(!(E.test(s)||F.test(s)||b.test(s)))throw new e.SiweInvalidMessageFieldError({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${s}`]});if(!A.test(a))throw new e.SiweInvalidMessageFieldError({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${a}`]});if(!h.isUri(c))throw new e.SiweInvalidMessageFieldError({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${c}`]});if(d!=="1")throw new e.SiweInvalidMessageFieldError({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${d}`]});if(i&&!P.test(i))throw new e.SiweInvalidMessageFieldError({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${i}`]});const t=r.statement;if(t!=null&&t.includes(`
|
|
2
2
|
`))throw new e.SiweInvalidMessageFieldError({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${t}`]})}const $=M.getAddress(r.address),v=i?`${i}://${s}`:s,I=r.statement?`${r.statement}
|
|
3
3
|
`:"",S=`${v} wants you to sign in with your Ethereum account:
|
|
4
4
|
${$}
|
package/dist/index28.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SiweInvalidMessageFieldError as e } from "./
|
|
1
|
+
import { SiweInvalidMessageFieldError as e } from "./index295.js";
|
|
2
2
|
import { getAddress as S } from "./index159.js";
|
|
3
|
-
import { isUri as $ } from "./
|
|
3
|
+
import { isUri as $ } from "./index296.js";
|
|
4
4
|
function C(n) {
|
|
5
5
|
const { chainId: i, domain: s, expirationTime: u, issuedAt: g = /* @__PURE__ */ new Date(), nonce: a, notBefore: m, requestId: h, resources: w, scheme: o, uri: c, version: f } = n;
|
|
6
6
|
{
|
package/dist/index284.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index287.cjs"),c=require("./index282.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function p(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function a(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function l(t,e){return t<<32-e|t>>>e}const b=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function i(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function w(t){for(let e=0;e<t.length;e++)t[e]=i(t[e])}typeof Uint8Array.from([]).toHex=="function"&&Uint8Array.fromHex;function y(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function s(t){return typeof t=="string"&&(t=y(t)),c.abytes(t),t}function g(...t){let e=0;for(let n=0;n<t.length;n++){const f=t[n];c.abytes(f),e+=f.length}const r=new Uint8Array(e);for(let n=0,f=0;n<t.length;n++){const u=t[n];r.set(u,f),f+=u.length}return r}class m{clone(){return this._cloneInto()}}function B(t){const e=n=>t().update(s(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function x(t=32){if(o.crypto&&typeof o.crypto.getRandomValues=="function")return o.crypto.getRandomValues(new Uint8Array(t));if(o.crypto&&typeof o.crypto.randomBytes=="function")return Uint8Array.from(o.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}exports.Hash=m;exports.byteSwap=i;exports.byteSwap32=w;exports.concatBytes=g;exports.createView=a;exports.isLE=b;exports.randomBytes=x;exports.rotr=l;exports.toBytes=s;exports.u32=p;exports.utf8ToBytes=y;exports.wrapConstructor=B;
|
package/dist/index284.js
CHANGED
package/dist/index286.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index282.cjs"),c=require("./index284.cjs");class r extends c.Hash{constructor(t,i){super(),this.finished=!1,this.destroyed=!1,o.ahash(t);const h=c.toBytes(i);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,e=new Uint8Array(a);e.set(h.length>a?t.create().update(h).digest():h);for(let s=0;s<e.length;s++)e[s]^=54;this.iHash.update(e),this.oHash=t.create();for(let s=0;s<e.length;s++)e[s]^=106;this.oHash.update(e),e.fill(0)}update(t){return o.aexists(this),this.iHash.update(t),this}digestInto(t){o.aexists(this),o.abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:i,iHash:h,finished:a,destroyed:e,blockLen:s,outputLen:u}=this;return t=t,t.finished=a,t.destroyed=e,t.blockLen=s,t.outputLen=u,t.oHash=i._cloneInto(t.oHash),t.iHash=h._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const d=(n,t,i)=>new r(n,t).update(i).digest();d.create=(n,t)=>new r(n,t);exports.HMAC=r;exports.hmac=d;
|
package/dist/index286.js
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ahash as c, aexists as a, abytes as u } from "./index282.js";
|
|
2
|
+
import { Hash as H, toBytes as p } from "./index284.js";
|
|
3
|
+
class r extends H {
|
|
4
|
+
constructor(t, i) {
|
|
5
|
+
super(), this.finished = !1, this.destroyed = !1, c(t);
|
|
6
|
+
const h = p(i);
|
|
7
|
+
if (this.iHash = t.create(), typeof this.iHash.update != "function")
|
|
8
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
9
|
+
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
10
|
+
const o = this.blockLen, e = new Uint8Array(o);
|
|
11
|
+
e.set(h.length > o ? t.create().update(h).digest() : h);
|
|
12
|
+
for (let s = 0; s < e.length; s++)
|
|
13
|
+
e[s] ^= 54;
|
|
14
|
+
this.iHash.update(e), this.oHash = t.create();
|
|
15
|
+
for (let s = 0; s < e.length; s++)
|
|
16
|
+
e[s] ^= 106;
|
|
17
|
+
this.oHash.update(e), e.fill(0);
|
|
18
|
+
}
|
|
19
|
+
update(t) {
|
|
20
|
+
return a(this), this.iHash.update(t), this;
|
|
21
|
+
}
|
|
22
|
+
digestInto(t) {
|
|
23
|
+
a(this), u(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
|
|
24
|
+
}
|
|
25
|
+
digest() {
|
|
26
|
+
const t = new Uint8Array(this.oHash.outputLen);
|
|
27
|
+
return this.digestInto(t), t;
|
|
28
|
+
}
|
|
29
|
+
_cloneInto(t) {
|
|
30
|
+
t || (t = Object.create(Object.getPrototypeOf(this), {}));
|
|
31
|
+
const { oHash: i, iHash: h, finished: o, destroyed: e, blockLen: s, outputLen: d } = this;
|
|
32
|
+
return t = t, t.finished = o, t.destroyed = e, t.blockLen = s, t.outputLen = d, t.oHash = i._cloneInto(t.oHash), t.iHash = h._cloneInto(t.iHash), t;
|
|
33
|
+
}
|
|
34
|
+
destroy() {
|
|
35
|
+
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
36
|
+
}
|
|
3
37
|
}
|
|
38
|
+
const l = (n, t, i) => new r(n, t).update(i).digest();
|
|
39
|
+
l.create = (n, t) => new r(n, t);
|
|
4
40
|
export {
|
|
5
|
-
|
|
41
|
+
r as HMAC,
|
|
42
|
+
l as hmac
|
|
6
43
|
};
|
package/dist/index287.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=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;exports.crypto=o;
|
package/dist/index287.js
CHANGED
|
@@ -1,143 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { EnsAvatarUriResolutionError as d, EnsAvatarInvalidNftUriError as f, EnsAvatarUnsupportedNamespaceError as v, EnsAvatarInvalidMetadataError as A } from "./index141.js";
|
|
3
|
-
const b = /(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, l = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, E = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, C = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
|
|
4
|
-
async function k(t) {
|
|
5
|
-
try {
|
|
6
|
-
const e = await fetch(t, { method: "HEAD" });
|
|
7
|
-
if (e.status === 200) {
|
|
8
|
-
const n = e.headers.get("content-type");
|
|
9
|
-
return n == null ? void 0 : n.startsWith("image/");
|
|
10
|
-
}
|
|
11
|
-
return !1;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
return typeof e == "object" && typeof e.response < "u" || !globalThis.hasOwnProperty("Image") ? !1 : new Promise((n) => {
|
|
14
|
-
const r = new Image();
|
|
15
|
-
r.onload = () => {
|
|
16
|
-
n(!0);
|
|
17
|
-
}, r.onerror = () => {
|
|
18
|
-
n(!1);
|
|
19
|
-
}, r.src = t;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function w(t, e) {
|
|
24
|
-
return t ? t.endsWith("/") ? t.slice(0, -1) : t : e;
|
|
25
|
-
}
|
|
26
|
-
function N({ uri: t, gatewayUrls: e }) {
|
|
27
|
-
const n = E.test(t);
|
|
28
|
-
if (n)
|
|
29
|
-
return { uri: t, isOnChain: !0, isEncoded: n };
|
|
30
|
-
const r = w(e == null ? void 0 : e.ipfs, "https://ipfs.io"), a = w(e == null ? void 0 : e.arweave, "https://arweave.net"), i = t.match(b), { protocol: o, subpath: p, target: s, subtarget: m = "" } = (i == null ? void 0 : i.groups) || {}, u = o === "ipns:/" || p === "ipns/", h = o === "ipfs:/" || p === "ipfs/" || l.test(t);
|
|
31
|
-
if (t.startsWith("http") && !u && !h) {
|
|
32
|
-
let I = t;
|
|
33
|
-
return e != null && e.arweave && (I = t.replace(/https:\/\/arweave.net/g, e == null ? void 0 : e.arweave)), { uri: I, isOnChain: !1, isEncoded: !1 };
|
|
34
|
-
}
|
|
35
|
-
if ((u || h) && s)
|
|
36
|
-
return {
|
|
37
|
-
uri: `${r}/${u ? "ipns" : "ipfs"}/${s}${m}`,
|
|
38
|
-
isOnChain: !1,
|
|
39
|
-
isEncoded: !1
|
|
40
|
-
};
|
|
41
|
-
if (o === "ar:/" && s)
|
|
42
|
-
return {
|
|
43
|
-
uri: `${a}/${s}${m || ""}`,
|
|
44
|
-
isOnChain: !1,
|
|
45
|
-
isEncoded: !1
|
|
46
|
-
};
|
|
47
|
-
let c = t.replace(C, "");
|
|
48
|
-
if (c.startsWith("<svg") && (c = `data:image/svg+xml;base64,${btoa(c)}`), c.startsWith("data:") || c.startsWith("{"))
|
|
49
|
-
return {
|
|
50
|
-
uri: c,
|
|
51
|
-
isOnChain: !0,
|
|
52
|
-
isEncoded: !1
|
|
53
|
-
};
|
|
54
|
-
throw new d({ uri: t });
|
|
55
|
-
}
|
|
56
|
-
function R(t) {
|
|
57
|
-
if (typeof t != "object" || !("image" in t) && !("image_url" in t) && !("image_data" in t))
|
|
58
|
-
throw new A({ data: t });
|
|
59
|
-
return t.image || t.image_url || t.image_data;
|
|
60
|
-
}
|
|
61
|
-
async function O({ gatewayUrls: t, uri: e }) {
|
|
62
|
-
try {
|
|
63
|
-
const n = await fetch(e).then((a) => a.json());
|
|
64
|
-
return await _({
|
|
65
|
-
gatewayUrls: t,
|
|
66
|
-
uri: R(n)
|
|
67
|
-
});
|
|
68
|
-
} catch {
|
|
69
|
-
throw new d({ uri: e });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async function _({ gatewayUrls: t, uri: e }) {
|
|
73
|
-
const { uri: n, isOnChain: r } = N({ uri: e, gatewayUrls: t });
|
|
74
|
-
if (r || await k(n))
|
|
75
|
-
return n;
|
|
76
|
-
throw new d({ uri: e });
|
|
77
|
-
}
|
|
78
|
-
function z(t) {
|
|
79
|
-
let e = t;
|
|
80
|
-
e.startsWith("did:nft:") && (e = e.replace("did:nft:", "").replace(/_/g, "/"));
|
|
81
|
-
const [n, r, a] = e.split("/"), [i, o] = n.split(":"), [p, s] = r.split(":");
|
|
82
|
-
if (!i || i.toLowerCase() !== "eip155")
|
|
83
|
-
throw new f({ reason: "Only EIP-155 supported" });
|
|
84
|
-
if (!o)
|
|
85
|
-
throw new f({ reason: "Chain ID not found" });
|
|
86
|
-
if (!s)
|
|
87
|
-
throw new f({
|
|
88
|
-
reason: "Contract address not found"
|
|
89
|
-
});
|
|
90
|
-
if (!a)
|
|
91
|
-
throw new f({ reason: "Token ID not found" });
|
|
92
|
-
if (!p)
|
|
93
|
-
throw new f({ reason: "ERC namespace not found" });
|
|
94
|
-
return {
|
|
95
|
-
chainID: Number.parseInt(o),
|
|
96
|
-
namespace: p.toLowerCase(),
|
|
97
|
-
contractAddress: s,
|
|
98
|
-
tokenID: a
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
async function P(t, { nft: e }) {
|
|
102
|
-
if (e.namespace === "erc721")
|
|
103
|
-
return g(t, {
|
|
104
|
-
address: e.contractAddress,
|
|
105
|
-
abi: [
|
|
106
|
-
{
|
|
107
|
-
name: "tokenURI",
|
|
108
|
-
type: "function",
|
|
109
|
-
stateMutability: "view",
|
|
110
|
-
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
111
|
-
outputs: [{ name: "", type: "string" }]
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
functionName: "tokenURI",
|
|
115
|
-
args: [BigInt(e.tokenID)]
|
|
116
|
-
});
|
|
117
|
-
if (e.namespace === "erc1155")
|
|
118
|
-
return g(t, {
|
|
119
|
-
address: e.contractAddress,
|
|
120
|
-
abi: [
|
|
121
|
-
{
|
|
122
|
-
name: "uri",
|
|
123
|
-
type: "function",
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
inputs: [{ name: "_id", type: "uint256" }],
|
|
126
|
-
outputs: [{ name: "", type: "string" }]
|
|
127
|
-
}
|
|
128
|
-
],
|
|
129
|
-
functionName: "uri",
|
|
130
|
-
args: [BigInt(e.tokenID)]
|
|
131
|
-
});
|
|
132
|
-
throw new v({ namespace: e.namespace });
|
|
133
|
-
}
|
|
1
|
+
const o = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
134
2
|
export {
|
|
135
|
-
|
|
136
|
-
R as getJsonImage,
|
|
137
|
-
O as getMetadataAvatarUri,
|
|
138
|
-
P as getNftTokenUri,
|
|
139
|
-
k as isImageUri,
|
|
140
|
-
_ as parseAvatarUri,
|
|
141
|
-
z as parseNftUri,
|
|
142
|
-
N as resolveAvatarUri
|
|
3
|
+
o as crypto
|
|
143
4
|
};
|