@gardenfi/utils 2.4.0 → 2.4.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/index107.cjs +1 -1
- package/dist/index107.js +1 -1
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +1 -1
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +4 -4
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +1 -1
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +1 -1
- package/dist/index115.cjs +1 -1
- package/dist/index115.js +1 -1
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +1 -1
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +6 -6
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +25 -10
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +13 -16
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +14 -21
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +5 -30
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +14 -2
- package/dist/index238.cjs +1 -1
- package/dist/index238.js +9 -12
- package/dist/index239.cjs +1 -1
- package/dist/index239.js +16 -12
- package/dist/index240.cjs +1 -1
- package/dist/index240.js +10 -47
- package/dist/index241.cjs +1 -1
- package/dist/index241.js +15 -10
- package/dist/index242.cjs +1 -1
- package/dist/index242.js +22 -7
- package/dist/index243.cjs +1 -1
- package/dist/index243.js +30 -9
- package/dist/index244.cjs +1 -1
- package/dist/index244.js +2 -14
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +13 -14
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +12 -9
- package/dist/index247.cjs +1 -1
- package/dist/index247.js +47 -24
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +11 -12
- package/dist/index249.cjs +1 -1
- package/dist/index249.js +7 -24
- package/dist/index250.cjs +1 -1
- package/dist/index250.js +8 -12
- package/dist/index251.cjs +1 -1
- package/dist/index251.js +13 -15
- package/dist/index252.cjs +1 -2
- package/dist/index252.js +11 -21
- package/dist/index253.cjs +1 -1
- package/dist/index253.js +9 -52
- package/dist/index254.cjs +1 -1
- package/dist/index254.js +24 -25
- package/dist/index255.cjs +1 -1
- package/dist/index255.js +12 -13
- package/dist/index256.cjs +1 -1
- package/dist/index256.js +24 -15
- package/dist/index257.cjs +1 -1
- package/dist/index257.js +13 -5
- package/dist/index258.cjs +1 -1
- package/dist/index258.js +15 -13
- package/dist/index259.cjs +2 -1
- package/dist/index259.js +24 -10
- package/dist/index260.cjs +1 -1
- package/dist/index260.js +52 -16
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +1 -1
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +1 -1
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +1 -1
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +139 -3
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +39 -137
- package/dist/index290.cjs +1 -1
- package/dist/index290.js +72 -149
- package/dist/index291.cjs +1 -1
- package/dist/index291.js +2 -10
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +3 -113
- package/dist/index293.cjs +1 -2
- package/dist/index293.js +128 -122
- package/dist/index294.cjs +1 -1
- package/dist/index294.js +153 -137
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +9 -42
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +107 -72
- package/dist/index297.cjs +2 -1
- package/dist/index297.js +135 -2
- package/dist/index301.cjs +1 -1
- package/dist/index301.js +2 -2
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +1 -1
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +1 -1
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +1 -1
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +2 -2
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +1 -1
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +1 -1
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +2 -2
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +1 -1
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +2 -2
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +1 -1
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +2 -2
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +6 -6
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +2 -2
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +1 -1
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +1 -1
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +1 -1
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +4 -4
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +1 -1
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +1 -1
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +1 -1
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +3 -3
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +2 -2
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +1 -1
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +1 -1
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +1 -1
- package/package.json +1 -1
package/dist/index107.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index48.cjs"),f=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index48.cjs"),f=require("./index259.cjs"),g=require("./index184.cjs"),s=require("./index32.cjs"),h=require("./index74.cjs"),A=require("./index86.cjs");async function p(o,n){var i;const{account:c=o.account,chainId:u,nonce:a}=n;if(!c)throw new f.AccountNotFoundError({docsPath:"/docs/eip7702/prepareAuthorization"});const r=d.parseAccount(c),t=(()=>{if(n.executor)return n.executor==="self"?n.executor:d.parseAccount(n.executor)})(),e={address:n.contractAddress??n.address,chainId:u,nonce:a};return typeof e.chainId>"u"&&(e.chainId=((i=o.chain)==null?void 0:i.id)??await s.getAction(o,h.getChainId,"getChainId")({})),typeof e.nonce>"u"&&(e.nonce=await s.getAction(o,A.getTransactionCount,"getTransactionCount")({address:r.address,blockTag:"pending"}),(t==="self"||t!=null&&t.address&&g.isAddressEqual(t.address,r.address))&&(e.nonce+=1)),e}exports.prepareAuthorization=p;
|
package/dist/index107.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAccount as e } from "./index48.js";
|
|
2
|
-
import { AccountNotFoundError as f } from "./
|
|
2
|
+
import { AccountNotFoundError as f } from "./index259.js";
|
|
3
3
|
import { isAddressEqual as h } from "./index184.js";
|
|
4
4
|
import { getAction as a } from "./index32.js";
|
|
5
5
|
import { getChainId as p } from "./index74.js";
|
package/dist/index110.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./index48.cjs"),h=require("./index41.cjs"),w=require("./index141.cjs"),N=require("./index180.cjs"),g=require("./index157.cjs"),M=require("./index185.cjs"),c=require("./index153.cjs"),S=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./index48.cjs"),h=require("./index41.cjs"),w=require("./index141.cjs"),N=require("./index180.cjs"),g=require("./index157.cjs"),M=require("./index185.cjs"),c=require("./index153.cjs"),S=require("./index257.cjs"),_=require("./index111.cjs"),T="0x5792579257925792579257925792579257925792579257925792579257925792",v=c.numberToHex(0,{size:32});async function H(i,s){const{account:f=i.account,capabilities:l,chain:u=i.chain,experimental_fallback:x,experimental_fallbackDelay:m=32,forceAtomic:b=!1,id:y,version:C="2.0.0"}=s,r=f?k.parseAccount(f):null,d=s.calls.map(a=>{const e=a,o=e.abi?N.encodeFunctionData({abi:e.abi,functionName:e.functionName,args:e.args}):e.data;return{data:e.dataSuffix&&o?g.concat([o,e.dataSuffix]):o,to:e.to,value:e.value?c.numberToHex(e.value):void 0}});try{const a=await i.request({method:"wallet_sendCalls",params:[{atomicRequired:b,calls:d,capabilities:l,chainId:c.numberToHex(u.id),from:r==null?void 0:r.address,id:y,version:C}]},{retryCount:0});return typeof a=="string"?{id:a}:a}catch(a){const e=a;if(x&&(e.name==="MethodNotFoundRpcError"||e.name==="MethodNotSupportedRpcError"||e.name==="UnknownRpcError"||e.details.toLowerCase().includes("does not exist / is not available")||e.details.toLowerCase().includes("missing or invalid. request()")||e.details.toLowerCase().includes("did not match any variant of untagged enum")||e.details.toLowerCase().includes("account upgraded to unsupported contract")||e.details.toLowerCase().includes("eip-7702 not supported")||e.details.toLowerCase().includes("unsupported wc_ method"))){if(l&&Object.values(l).some(n=>!n.optional)){const n="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new w.UnsupportedNonOptionalCapabilityError(new h.BaseError(n,{details:n}))}if(b&&d.length>1){const t="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new w.AtomicityNotSupportedError(new h.BaseError(t,{details:t}))}const o=[];for(const t of d){const n=_.sendTransaction(i,{account:r,chain:u,data:t.data,to:t.to,value:t.value?M.hexToBigInt(t.value):void 0});o.push(n),m>0&&await new Promise(E=>setTimeout(E,m))}const p=await Promise.allSettled(o);if(p.every(t=>t.status==="rejected"))throw p[0].reason;const q=p.map(t=>t.status==="fulfilled"?t.value:v);return{id:g.concat([...q,c.numberToHex(u.id,{size:32}),T])}}throw S.getTransactionError(a,{...s,account:r,chain:s.chain})}}exports.fallbackMagicIdentifier=T;exports.fallbackTransactionErrorMagicIdentifier=v;exports.sendCalls=H;
|
package/dist/index110.js
CHANGED
|
@@ -5,7 +5,7 @@ import { encodeFunctionData as k } from "./index180.js";
|
|
|
5
5
|
import { concat as b } from "./index157.js";
|
|
6
6
|
import { hexToBigInt as _ } from "./index185.js";
|
|
7
7
|
import { numberToHex as c } from "./index153.js";
|
|
8
|
-
import { getTransactionError as L } from "./
|
|
8
|
+
import { getTransactionError as L } from "./index257.js";
|
|
9
9
|
import { sendTransaction as S } from "./index111.js";
|
|
10
10
|
const A = "0x5792579257925792579257925792579257925792579257925792579257925792", I = c(0, {
|
|
11
11
|
size: 32
|
package/dist/index111.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index48.cjs"),u=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index48.cjs"),u=require("./index259.cjs"),O=require("./index41.cjs"),j=require("./index250.cjs"),B=require("./index215.cjs"),U=require("./index257.cjs"),W=require("./index246.cjs"),k=require("./index187.cjs"),l=require("./index32.cjs"),D=require("./index223.cjs"),H=require("./index200.cjs"),J=require("./index74.cjs"),L=require("./index99.cjs"),K=require("./index100.cjs"),f=new D.LruMap(128);async function Q(r,e){var M,z,I,S;const{account:d=r.account,chain:n=r.chain,accessList:w,authorizationList:s,blobs:q,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,type:C,value:N,...P}=e;if(typeof d>"u")throw new u.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const t=d?G.parseAccount(d):null;try{H.assertRequest(e);const a=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await j.recoverAuthorizationAddress({authorization:s[0]}).catch(()=>{throw new O.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((t==null?void 0:t.type)==="json-rpc"||t===null){let i;n!==null&&(i=await l.getAction(r,J.getChainId,"getChainId")({}),B.assertCurrentChain({currentChainId:i,chain:n}));const c=(I=(z=(M=r.chain)==null?void 0:M.formatters)==null?void 0:z.transactionRequest)==null?void 0:I.format,F=(c||k.formatTransactionRequest)({...W.extract(P,{format:c}),accessList:w,authorizationList:s,blobs:q,chainId:i,data:m,from:t==null?void 0:t.address,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,to:a,type:C,value:N}),v=f.get(r.uid),_=v?"wallet_sendTransaction":"eth_sendTransaction";try{return await r.request({method:_,params:[F]},{retryCount:0})}catch(x){if(v===!1)throw x;const o=x;if(o.name==="InvalidInputRpcError"||o.name==="InvalidParamsRpcError"||o.name==="MethodNotFoundRpcError"||o.name==="MethodNotSupportedRpcError")return await r.request({method:"wallet_sendTransaction",params:[F]},{retryCount:0}).then(p=>(f.set(r.uid,!0),p)).catch(p=>{const h=p;throw h.name==="MethodNotFoundRpcError"||h.name==="MethodNotSupportedRpcError"?(f.set(r.uid,!1),o):h});throw o}}if((t==null?void 0:t.type)==="local"){const i=await l.getAction(r,L.prepareTransactionRequest,"prepareTransactionRequest")({account:t,accessList:w,authorizationList:s,blobs:q,chain:n,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,nonceManager:t.nonceManager,parameters:[...L.defaultParameters,"sidecars"],type:C,value:N,...P,to:a}),c=(S=n==null?void 0:n.serializers)==null?void 0:S.transaction,b=await t.signTransaction(i,{serializer:c});return await l.getAction(r,K.sendRawTransaction,"sendRawTransaction")({serializedTransaction:b})}throw(t==null?void 0:t.type)==="smart"?new u.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new u.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:t==null?void 0:t.type})}catch(a){throw a instanceof u.AccountTypeNotSupportedError?a:U.getTransactionError(a,{...e,account:t,chain:e.chain||void 0})}}exports.sendTransaction=Q;
|
package/dist/index111.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parseAccount as _ } from "./index48.js";
|
|
2
|
-
import { AccountNotFoundError as G, AccountTypeNotSupportedError as p } from "./
|
|
2
|
+
import { AccountNotFoundError as G, AccountTypeNotSupportedError as p } from "./index259.js";
|
|
3
3
|
import { BaseError as B } from "./index41.js";
|
|
4
|
-
import { recoverAuthorizationAddress as O } from "./
|
|
4
|
+
import { recoverAuthorizationAddress as O } from "./index250.js";
|
|
5
5
|
import { assertCurrentChain as U } from "./index215.js";
|
|
6
|
-
import { getTransactionError as W } from "./
|
|
7
|
-
import { extract as j } from "./
|
|
6
|
+
import { getTransactionError as W } from "./index257.js";
|
|
7
|
+
import { extract as j } from "./index246.js";
|
|
8
8
|
import { formatTransactionRequest as k } from "./index187.js";
|
|
9
9
|
import { getAction as f } from "./index32.js";
|
|
10
10
|
import { LruMap as D } from "./index223.js";
|
package/dist/index113.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index48.cjs"),r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index48.cjs"),r=require("./index259.cjs"),e=require("./index107.cjs");async function a(t,n){const{account:i=t.account}=n;if(!i)throw new r.AccountNotFoundError({docsPath:"/docs/eip7702/signAuthorization"});const o=u.parseAccount(i);if(!o.signAuthorization)throw new r.AccountTypeNotSupportedError({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:o.type});const c=await e.prepareAuthorization(t,n);return o.signAuthorization(c)}exports.signAuthorization=a;
|
package/dist/index113.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAccount as c } from "./index48.js";
|
|
2
|
-
import { AccountNotFoundError as u, AccountTypeNotSupportedError as a } from "./
|
|
2
|
+
import { AccountNotFoundError as u, AccountTypeNotSupportedError as a } from "./index259.js";
|
|
3
3
|
import { prepareAuthorization as s } from "./index107.js";
|
|
4
4
|
async function A(t, n) {
|
|
5
5
|
const { account: i = t.account } = n;
|
package/dist/index114.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index48.cjs"),a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index48.cjs"),a=require("./index259.cjs"),o=require("./index153.cjs");async function i(n,{account:e=n.account,message:r}){if(!e)throw new a.AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const t=c.parseAccount(e);if(t.signMessage)return t.signMessage({message:r});const s=typeof r=="string"?o.stringToHex(r):r.raw instanceof Uint8Array?o.toHex(r.raw):r.raw;return n.request({method:"personal_sign",params:[s,t.address]},{retryCount:0})}exports.signMessage=i;
|
package/dist/index114.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAccount as e } from "./index48.js";
|
|
2
|
-
import { AccountNotFoundError as i } from "./
|
|
2
|
+
import { AccountNotFoundError as i } from "./index259.js";
|
|
3
3
|
import { stringToHex as a, toHex as c } from "./index153.js";
|
|
4
4
|
async function g(n, { account: o = n.account, message: r }) {
|
|
5
5
|
if (!o)
|
package/dist/index115.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index48.cjs"),f=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index48.cjs"),f=require("./index259.cjs"),C=require("./index215.cjs"),T=require("./index153.cjs"),m=require("./index187.cjs"),I=require("./index32.cjs"),w=require("./index200.cjs"),A=require("./index74.cjs");async function R(t,s){var i,u,d,h;const{account:o=t.account,chain:n=t.chain,...c}=s;if(!o)throw new f.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const r=g.parseAccount(o);w.assertRequest({account:r,...s});const a=await I.getAction(t,A.getChainId,"getChainId")({});n!==null&&C.assertCurrentChain({currentChainId:a,chain:n});const e=(n==null?void 0:n.formatters)||((i=t.chain)==null?void 0:i.formatters),q=((u=e==null?void 0:e.transactionRequest)==null?void 0:u.format)||m.formatTransactionRequest;return r.signTransaction?r.signTransaction({...c,chainId:a},{serializer:(h=(d=t.chain)==null?void 0:d.serializers)==null?void 0:h.transaction}):await t.request({method:"eth_signTransaction",params:[{...q(c),chainId:T.numberToHex(a),from:r.address}]},{retryCount:0})}exports.signTransaction=R;
|
package/dist/index115.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAccount as d } from "./index48.js";
|
|
2
|
-
import { AccountNotFoundError as p } from "./
|
|
2
|
+
import { AccountNotFoundError as p } from "./index259.js";
|
|
3
3
|
import { assertCurrentChain as g } from "./index215.js";
|
|
4
4
|
import { numberToHex as T } from "./index153.js";
|
|
5
5
|
import { formatTransactionRequest as C } from "./index187.js";
|
package/dist/index116.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index48.cjs"),y=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index48.cjs"),y=require("./index259.cjs"),s=require("./index191.cjs");async function p(c,r){const{account:i=c.account,domain:t,message:a,primaryType:e}=r;if(!i)throw new y.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const n=u.parseAccount(i),o={EIP712Domain:s.getTypesForEIP712Domain({domain:t}),...r.types};if(s.validateTypedData({domain:t,message:a,primaryType:e,types:o}),n.signTypedData)return n.signTypedData({domain:t,message:a,primaryType:e,types:o});const d=s.serializeTypedData({domain:t,message:a,primaryType:e,types:o});return c.request({method:"eth_signTypedData_v4",params:[n.address,d]},{retryCount:0})}exports.signTypedData=p;
|
package/dist/index116.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAccount as p } from "./index48.js";
|
|
2
|
-
import { AccountNotFoundError as d } from "./
|
|
2
|
+
import { AccountNotFoundError as d } from "./index259.js";
|
|
3
3
|
import { getTypesForEIP712Domain as y, validateTypedData as m, serializeTypedData as u } from "./index191.js";
|
|
4
4
|
async function f(r, s) {
|
|
5
5
|
const { account: c = r.account, domain: t, message: a, primaryType: o } = s;
|
package/dist/index23.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index195.cjs"),u=require("./index153.cjs"),a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index195.cjs"),u=require("./index153.cjs"),a=require("./index233.cjs"),g=require("./index193.cjs"),y=require("./index234.cjs"),d=require("./index235.cjs"),T=require("./index236.cjs"),l=require("./index237.cjs"),q=require("./index238.cjs");function A(s,t={}){const{nonceManager:c}=t,e=u.toHex(i.secp256k1.getPublicKey(s.slice(2),!1)),o=g.publicKeyToAddress(e);return{...a.toAccount({address:o,nonceManager:c,async sign({hash:n}){return y.sign({hash:n,privateKey:s,to:"hex"})},async signAuthorization(n){return d.signAuthorization({...n,privateKey:s})},async signMessage({message:n}){return T.signMessage({message:n,privateKey:s})},async signTransaction(n,{serializer:r}={}){return l.signTransaction({privateKey:s,transaction:n,serializer:r})},async signTypedData(n){return q.signTypedData({...n,privateKey:s})}}),publicKey:e,source:"privateKey"}}exports.privateKeyToAccount=A;
|
package/dist/index23.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { secp256k1 as e } from "./index195.js";
|
|
2
2
|
import { toHex as a } from "./index153.js";
|
|
3
|
-
import { toAccount as m } from "./
|
|
3
|
+
import { toAccount as m } from "./index233.js";
|
|
4
4
|
import { publicKeyToAddress as u } from "./index193.js";
|
|
5
|
-
import { sign as g } from "./
|
|
6
|
-
import { signAuthorization as p } from "./
|
|
7
|
-
import { signMessage as f } from "./
|
|
8
|
-
import { signTransaction as y } from "./
|
|
9
|
-
import { signTypedData as d } from "./
|
|
5
|
+
import { sign as g } from "./index234.js";
|
|
6
|
+
import { signAuthorization as p } from "./index235.js";
|
|
7
|
+
import { signMessage as f } from "./index236.js";
|
|
8
|
+
import { signTransaction as y } from "./index237.js";
|
|
9
|
+
import { signTypedData as d } from "./index238.js";
|
|
10
10
|
function H(n, t = {}) {
|
|
11
11
|
const { nonceManager: s } = t, r = a(e.getPublicKey(n.slice(2), !1)), c = u(r);
|
|
12
12
|
return {
|
package/dist/index233.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("./index148.cjs"),t=require("./index174.cjs");function i(s){if(typeof s=="string"){if(!t.isAddress(s,{strict:!1}))throw new n.InvalidAddressError({address:s});return{address:s,type:"json-rpc"}}if(!t.isAddress(s.address,{strict:!1}))throw new n.InvalidAddressError({address:s.address});return{address:s.address,nonceManager:s.nonceManager,sign:s.sign,signAuthorization:s.signAuthorization,signMessage:s.signMessage,signTransaction:s.signTransaction,signTypedData:s.signTypedData,source:"custom",type:"local"}}exports.toAccount=i;
|
package/dist/index233.js
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { InvalidAddressError as s } from "./index148.js";
|
|
2
|
+
import { isAddress as a } from "./index174.js";
|
|
3
|
+
function r(n) {
|
|
4
|
+
if (typeof n == "string") {
|
|
5
|
+
if (!a(n, { strict: !1 }))
|
|
6
|
+
throw new s({ address: n });
|
|
7
|
+
return {
|
|
8
|
+
address: n,
|
|
9
|
+
type: "json-rpc"
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (!a(n.address, { strict: !1 }))
|
|
13
|
+
throw new s({ address: n.address });
|
|
14
|
+
return {
|
|
15
|
+
address: n.address,
|
|
16
|
+
nonceManager: n.nonceManager,
|
|
17
|
+
sign: n.sign,
|
|
18
|
+
signAuthorization: n.signAuthorization,
|
|
19
|
+
signMessage: n.signMessage,
|
|
20
|
+
signTransaction: n.signTransaction,
|
|
21
|
+
signTypedData: n.signTypedData,
|
|
22
|
+
source: "custom",
|
|
23
|
+
type: "local"
|
|
24
|
+
};
|
|
10
25
|
}
|
|
11
26
|
export {
|
|
12
|
-
|
|
27
|
+
r as toAccount
|
|
13
28
|
};
|
package/dist/index234.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("./index195.cjs"),s=require("./index153.cjs"),a=require("./index196.cjs");let l=!1;async function g({hash:t,privateKey:i,to:e="object"}){const{r:u,s:c,recovery:r}=o.secp256k1.sign(t.slice(2),i.slice(2),{lowS:!0,extraEntropy:l}),n={r:s.numberToHex(u,{size:32}),s:s.numberToHex(c,{size:32}),v:r?28n:27n,yParity:r};return e==="bytes"||e==="hex"?a.serializeSignature({...n,to:e}):n}exports.sign=g;
|
package/dist/index234.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
n.byteLength > 255 && (n = i(h(f(l[r])))), e[t] = n.length, e.set(n, t + 1), t += n.length + 1;
|
|
14
|
-
}
|
|
15
|
-
return e.byteLength !== t + 1 ? e.slice(0, t + 1) : e;
|
|
1
|
+
import { secp256k1 as u } from "./index195.js";
|
|
2
|
+
import { numberToHex as i } from "./index153.js";
|
|
3
|
+
import { serializeSignature as a } from "./index196.js";
|
|
4
|
+
let m = !1;
|
|
5
|
+
async function y({ hash: n, privateKey: s, to: r = "object" }) {
|
|
6
|
+
const { r: o, s: c, recovery: e } = u.sign(n.slice(2), s.slice(2), { lowS: !0, extraEntropy: m }), t = {
|
|
7
|
+
r: i(o, { size: 32 }),
|
|
8
|
+
s: i(c, { size: 32 }),
|
|
9
|
+
v: e ? 28n : 27n,
|
|
10
|
+
yParity: e
|
|
11
|
+
};
|
|
12
|
+
return r === "bytes" || r === "hex" ? a({ ...t, to: r }) : t;
|
|
16
13
|
}
|
|
17
14
|
export {
|
|
18
|
-
y as
|
|
15
|
+
y as sign
|
|
19
16
|
};
|
package/dist/index235.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("./index239.cjs"),a=require("./index234.cjs");async function u(t){const{chainId:n,nonce:i,privateKey:r,to:o="object"}=t,s=t.contractAddress??t.address,e=await a.sign({hash:c.hashAuthorization({address:s,chainId:n,nonce:i}),privateKey:r,to:o});return o==="object"?{address:s,chainId:n,nonce:i,...e}:e}exports.signAuthorization=u;
|
package/dist/index235.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const d = p ? (
|
|
9
|
-
// if it is encoded, decode it
|
|
10
|
-
atob(a.replace("data:application/json;base64,", ""))
|
|
11
|
-
) : (
|
|
12
|
-
// if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
|
|
13
|
-
a
|
|
14
|
-
), u = JSON.parse(d);
|
|
15
|
-
return o({ uri: A(u), gatewayUrls: t });
|
|
16
|
-
}
|
|
17
|
-
let n = i.tokenID;
|
|
18
|
-
return i.namespace === "erc1155" && (n = n.replace("0x", "").padStart(64, "0")), N({
|
|
19
|
-
gatewayUrls: t,
|
|
20
|
-
uri: a.replace(/(?:0x)?{id}/, n)
|
|
1
|
+
import { hashAuthorization as a } from "./index239.js";
|
|
2
|
+
import { sign as e } from "./index234.js";
|
|
3
|
+
async function u(t) {
|
|
4
|
+
const { chainId: o, nonce: n, privateKey: c, to: i = "object" } = t, r = t.contractAddress ?? t.address, s = await e({
|
|
5
|
+
hash: a({ address: r, chainId: o, nonce: n }),
|
|
6
|
+
privateKey: c,
|
|
7
|
+
to: i
|
|
21
8
|
});
|
|
9
|
+
return i === "object" ? {
|
|
10
|
+
address: r,
|
|
11
|
+
chainId: o,
|
|
12
|
+
nonce: n,
|
|
13
|
+
...s
|
|
14
|
+
} : s;
|
|
22
15
|
}
|
|
23
16
|
export {
|
|
24
|
-
|
|
17
|
+
u as signAuthorization
|
|
25
18
|
};
|
package/dist/index236.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("./index226.cjs"),n=require("./index234.cjs");async function t({message:e,privateKey:s}){return await n.sign({hash:a.hashMessage(e),privateKey:s,to:"hex"})}exports.signMessage=t;
|
package/dist/index236.js
CHANGED
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
4
|
-
return {
|
|
5
|
-
...typeof t.baseFeePerGas == "bigint" && {
|
|
6
|
-
baseFeePerGas: a(t.baseFeePerGas)
|
|
7
|
-
},
|
|
8
|
-
...typeof t.blobBaseFee == "bigint" && {
|
|
9
|
-
blobBaseFee: a(t.blobBaseFee)
|
|
10
|
-
},
|
|
11
|
-
...typeof t.feeRecipient == "string" && {
|
|
12
|
-
feeRecipient: t.feeRecipient
|
|
13
|
-
},
|
|
14
|
-
...typeof t.gasLimit == "bigint" && {
|
|
15
|
-
gasLimit: a(t.gasLimit)
|
|
16
|
-
},
|
|
17
|
-
...typeof t.number == "bigint" && {
|
|
18
|
-
number: a(t.number)
|
|
19
|
-
},
|
|
20
|
-
...typeof t.prevRandao == "bigint" && {
|
|
21
|
-
prevRandao: a(t.prevRandao)
|
|
22
|
-
},
|
|
23
|
-
...typeof t.time == "bigint" && {
|
|
24
|
-
time: a(t.time)
|
|
25
|
-
},
|
|
26
|
-
...t.withdrawals && {
|
|
27
|
-
withdrawals: t.withdrawals.map(e)
|
|
28
|
-
}
|
|
29
|
-
};
|
|
1
|
+
import { hashMessage as e } from "./index226.js";
|
|
2
|
+
import { sign as o } from "./index234.js";
|
|
3
|
+
async function i({ message: s, privateKey: a }) {
|
|
4
|
+
return await o({ hash: e(s), privateKey: a, to: "hex" });
|
|
30
5
|
}
|
|
31
6
|
export {
|
|
32
|
-
|
|
7
|
+
i as signMessage
|
|
33
8
|
};
|
package/dist/index237.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index154.cjs"),c=require("./index231.cjs"),o=require("./index234.cjs");async function u(i){const{privateKey:r,transaction:e,serializer:n=c.serializeTransaction}=i,a=e.type==="eip4844"?{...e,sidecars:!1}:e,s=await o.sign({hash:t.keccak256(n(a)),privateKey:r});return n(e,s)}exports.signTransaction=u;
|
package/dist/index237.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { keccak256 as e } from "./index154.js";
|
|
2
|
+
import { serializeTransaction as o } from "./index231.js";
|
|
3
|
+
import { sign as c } from "./index234.js";
|
|
4
|
+
async function u(n) {
|
|
5
|
+
const { privateKey: a, transaction: r, serializer: i = o } = n, t = r.type === "eip4844" ? {
|
|
6
|
+
...r,
|
|
7
|
+
sidecars: !1
|
|
8
|
+
} : r, s = await c({
|
|
9
|
+
hash: e(i(t)),
|
|
10
|
+
privateKey: a
|
|
11
|
+
});
|
|
12
|
+
return i(r, s);
|
|
13
|
+
}
|
|
2
14
|
export {
|
|
3
|
-
|
|
15
|
+
u as signTransaction
|
|
4
16
|
};
|
package/dist/index238.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("./index190.cjs"),s=require("./index234.cjs");async function i(e){const{privateKey:t,...a}=e;return await s.sign({hash:n.hashTypedData(a),privateKey:t,to:"hex"})}exports.signTypedData=i;
|
package/dist/index238.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return new c(e, {
|
|
10
|
-
docsPath: t,
|
|
11
|
-
...o
|
|
1
|
+
import { hashTypedData as o } from "./index190.js";
|
|
2
|
+
import { sign as r } from "./index234.js";
|
|
3
|
+
async function p(t) {
|
|
4
|
+
const { privateKey: a, ...e } = t;
|
|
5
|
+
return await r({
|
|
6
|
+
hash: o(e),
|
|
7
|
+
privateKey: a,
|
|
8
|
+
to: "hex"
|
|
12
9
|
});
|
|
13
10
|
}
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
p as signTypedData
|
|
16
13
|
};
|
package/dist/index239.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index157.cjs"),u=require("./index152.cjs"),c=require("./index153.cjs"),a=require("./index197.cjs"),h=require("./index154.cjs");function d(e){const{chainId:t,nonce:o,to:r}=e,s=e.contractAddress??e.address,n=h.keccak256(i.concatHex(["0x05",a.toRlp([t?c.numberToHex(t):"0x",s,o?c.numberToHex(o):"0x"])]));return r==="bytes"?u.hexToBytes(n):n}exports.hashAuthorization=d;
|
package/dist/index239.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { concatHex as i } from "./index157.js";
|
|
2
|
+
import { hexToBytes as m } from "./index152.js";
|
|
3
|
+
import { numberToHex as c } from "./index153.js";
|
|
4
|
+
import { toRlp as d } from "./index197.js";
|
|
5
|
+
import { keccak256 as f } from "./index154.js";
|
|
6
|
+
function b(o) {
|
|
7
|
+
const { chainId: t, nonce: r, to: s } = o, e = o.contractAddress ?? o.address, n = f(i([
|
|
8
|
+
"0x05",
|
|
9
|
+
d([
|
|
10
|
+
t ? c(t) : "0x",
|
|
11
|
+
e,
|
|
12
|
+
r ? c(r) : "0x"
|
|
13
|
+
])
|
|
14
|
+
]));
|
|
15
|
+
return s === "bytes" ? m(n) : n;
|
|
12
16
|
}
|
|
13
17
|
export {
|
|
14
|
-
|
|
18
|
+
b as hashAuthorization
|
|
15
19
|
};
|
package/dist/index240.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 d=require("./index131.cjs"),f=require("./index41.cjs"),i=require("./index130.cjs");function v(e,l){var t,o,n,a,s,u;if(!(e instanceof f.BaseError))return!1;const r=e.walk(c=>c instanceof i.ContractFunctionRevertedError);return r instanceof i.ContractFunctionRevertedError?!!(((t=r.data)==null?void 0:t.errorName)==="ResolverNotFound"||((o=r.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((n=r.data)==null?void 0:n.errorName)==="ResolverNotContract"||((a=r.data)==null?void 0:a.errorName)==="ResolverError"||((s=r.data)==null?void 0:s.errorName)==="HttpError"||(u=r.reason)!=null&&u.includes("Wildcard on non-extended resolvers is not supported")||l==="reverse"&&r.reason===d.panicReasons[50]):!1}exports.isNullUniversalResolverError=v;
|
package/dist/index240.js
CHANGED
|
@@ -1,50 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
throw new d({
|
|
11
|
-
size: e.length,
|
|
12
|
-
targetSize: 66,
|
|
13
|
-
type: "hex"
|
|
14
|
-
});
|
|
15
|
-
if (n.length !== 66)
|
|
16
|
-
throw new d({
|
|
17
|
-
size: n.length,
|
|
18
|
-
targetSize: 66,
|
|
19
|
-
type: "hex"
|
|
20
|
-
});
|
|
21
|
-
return t[e] = n, t;
|
|
22
|
-
}, {});
|
|
23
|
-
}
|
|
24
|
-
function m(r) {
|
|
25
|
-
const { balance: t, nonce: e, state: n, stateDiff: o, code: f } = r, i = {};
|
|
26
|
-
if (f !== void 0 && (i.code = f), t !== void 0 && (i.balance = c(t)), e !== void 0 && (i.nonce = c(e)), n !== void 0 && (i.state = s(n)), o !== void 0) {
|
|
27
|
-
if (i.state)
|
|
28
|
-
throw new h();
|
|
29
|
-
i.stateDiff = s(o);
|
|
30
|
-
}
|
|
31
|
-
return i;
|
|
32
|
-
}
|
|
33
|
-
function A(r) {
|
|
34
|
-
if (!r)
|
|
35
|
-
return;
|
|
36
|
-
const t = {};
|
|
37
|
-
for (const { address: e, ...n } of r) {
|
|
38
|
-
if (!l(e, { strict: !1 }))
|
|
39
|
-
throw new a({ address: e });
|
|
40
|
-
if (t[e])
|
|
41
|
-
throw new u({ address: e });
|
|
42
|
-
t[e] = m(n);
|
|
43
|
-
}
|
|
44
|
-
return t;
|
|
1
|
+
import { panicReasons as l } from "./index131.js";
|
|
2
|
+
import { BaseError as c } from "./index41.js";
|
|
3
|
+
import { ContractFunctionRevertedError as i } from "./index130.js";
|
|
4
|
+
function N(e, f) {
|
|
5
|
+
var t, o, n, a, s, u;
|
|
6
|
+
if (!(e instanceof c))
|
|
7
|
+
return !1;
|
|
8
|
+
const r = e.walk((d) => d instanceof i);
|
|
9
|
+
return r instanceof i ? !!(((t = r.data) == null ? void 0 : t.errorName) === "ResolverNotFound" || ((o = r.data) == null ? void 0 : o.errorName) === "ResolverWildcardNotSupported" || ((n = r.data) == null ? void 0 : n.errorName) === "ResolverNotContract" || ((a = r.data) == null ? void 0 : a.errorName) === "ResolverError" || ((s = r.data) == null ? void 0 : s.errorName) === "HttpError" || (u = r.reason) != null && u.includes("Wildcard on non-extended resolvers is not supported") || f === "reverse" && r.reason === l[50]) : !1;
|
|
45
10
|
}
|
|
46
11
|
export {
|
|
47
|
-
|
|
48
|
-
s as serializeStateMapping,
|
|
49
|
-
A as serializeStateOverride
|
|
12
|
+
N as isNullUniversalResolverError
|
|
50
13
|
};
|
package/dist/index241.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 l=require("./index152.cjs"),a=require("./index292.cjs"),c=require("./index151.cjs");function h(i){const r=i.replace(/^\.|\.$/gm,"");if(r.length===0)return new Uint8Array(1);const e=new Uint8Array(l.stringToBytes(r).byteLength+2);let t=0;const o=r.split(".");for(let s=0;s<o.length;s++){let n=l.stringToBytes(o[s]);n.byteLength>255&&(n=l.stringToBytes(a.encodeLabelhash(c.labelhash(o[s])))),e[t]=n.length,e.set(n,t+1),t+=n.length+1}return e.byteLength!==t+1?e.slice(0,t+1):e}exports.packetToBytes=h;
|
package/dist/index241.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { stringToBytes as i } from "./index152.js";
|
|
2
|
+
import { encodeLabelhash as h } from "./index292.js";
|
|
3
|
+
import { labelhash as f } from "./index151.js";
|
|
4
|
+
function y(s) {
|
|
5
|
+
const o = s.replace(/^\.|\.$/gm, "");
|
|
6
|
+
if (o.length === 0)
|
|
7
|
+
return new Uint8Array(1);
|
|
8
|
+
const e = new Uint8Array(i(o).byteLength + 2);
|
|
9
|
+
let t = 0;
|
|
10
|
+
const l = o.split(".");
|
|
11
|
+
for (let r = 0; r < l.length; r++) {
|
|
12
|
+
let n = i(l[r]);
|
|
13
|
+
n.byteLength > 255 && (n = i(h(f(l[r])))), e[t] = n.length, e.set(n, t + 1), t += n.length + 1;
|
|
9
14
|
}
|
|
10
|
-
return
|
|
15
|
+
return e.byteLength !== t + 1 ? e.slice(0, t + 1) : e;
|
|
11
16
|
}
|
|
12
17
|
export {
|
|
13
|
-
|
|
18
|
+
y as packetToBytes
|
|
14
19
|
};
|
package/dist/index242.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index293.cjs");async function f(i,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?l(i,{gatewayUrls:t,record:r}):e.parseAvatarUri({uri:r,gatewayUrls:t})}async function l(i,{gatewayUrls:t,record:r}){const n=e.parseNftUri(r),o=await e.getNftTokenUri(i,{nft:n}),{uri:a,isOnChain:c,isEncoded:p}=e.resolveAvatarUri({uri:o,gatewayUrls:t});if(c&&(a.includes("data:application/json;base64,")||a.startsWith("{"))){const u=p?atob(a.replace("data:application/json;base64,","")):a,d=JSON.parse(u);return e.parseAvatarUri({uri:e.getJsonImage(d),gatewayUrls:t})}let s=n.tokenID;return n.namespace==="erc1155"&&(s=s.replace("0x","").padStart(64,"0")),e.getMetadataAvatarUri({gatewayUrls:t,uri:a.replace(/(?:0x)?{id}/,s)})}exports.parseAvatarRecord=f;
|