@gardenfi/utils 2.4.5-beta.3 → 2.4.6-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.
Files changed (99) hide show
  1. package/dist/index10.cjs +1 -1
  2. package/dist/index10.js +4 -4
  3. package/dist/index100.cjs +1 -1
  4. package/dist/index100.js +2 -2
  5. package/dist/index121.cjs +1 -1
  6. package/dist/index121.js +1 -1
  7. package/dist/index16.cjs +1 -1
  8. package/dist/index16.js +2 -2
  9. package/dist/index18.cjs +1 -1
  10. package/dist/index18.js +2 -2
  11. package/dist/index24.cjs +1 -1
  12. package/dist/index24.js +12 -26
  13. package/dist/index242.cjs +1 -1
  14. package/dist/index242.js +3 -3
  15. package/dist/index25.cjs +1 -1
  16. package/dist/index25.js +58 -8
  17. package/dist/index26.cjs +16 -1
  18. package/dist/index26.js +113 -12
  19. package/dist/index262.cjs +1 -1
  20. package/dist/index262.js +1 -1
  21. package/dist/index266.cjs +1 -1
  22. package/dist/index266.js +2 -2
  23. package/dist/index267.cjs +1 -2
  24. package/dist/index267.js +25 -40
  25. package/dist/index268.cjs +1 -1
  26. package/dist/index268.js +6 -2
  27. package/dist/index269.cjs +2 -1
  28. package/dist/index269.js +41 -5
  29. package/dist/index27.cjs +1 -1
  30. package/dist/index27.js +32 -58
  31. package/dist/index270.cjs +1 -1
  32. package/dist/index270.js +2 -11
  33. package/dist/index271.cjs +1 -1
  34. package/dist/index271.js +9 -18
  35. package/dist/index272.cjs +1 -1
  36. package/dist/index272.js +19 -8
  37. package/dist/index273.cjs +1 -1
  38. package/dist/index273.js +8 -66
  39. package/dist/index274.cjs +1 -1
  40. package/dist/index274.js +65 -64
  41. package/dist/index275.cjs +1 -1
  42. package/dist/index275.js +60 -181
  43. package/dist/index276.cjs +1 -1
  44. package/dist/index276.js +184 -20
  45. package/dist/index277.cjs +1 -1
  46. package/dist/index277.js +21 -41
  47. package/dist/index278.cjs +1 -1
  48. package/dist/index278.js +20 -54
  49. package/dist/index279.cjs +1 -1
  50. package/dist/index279.js +54 -18
  51. package/dist/index28.cjs +1 -16
  52. package/dist/index28.js +24 -111
  53. package/dist/index280.cjs +1 -1
  54. package/dist/index280.js +34 -10
  55. package/dist/index281.cjs +1 -1
  56. package/dist/index281.js +10 -7
  57. package/dist/index282.cjs +1 -1
  58. package/dist/index282.js +13 -12
  59. package/dist/index283.cjs +1 -2
  60. package/dist/index283.js +10 -16
  61. package/dist/index284.cjs +2 -1
  62. package/dist/index284.js +18 -14
  63. package/dist/index285.cjs +1 -1
  64. package/dist/index285.js +14 -11
  65. package/dist/index286.cjs +1 -1
  66. package/dist/index286.js +11 -26
  67. package/dist/index288.cjs +1 -1
  68. package/dist/index288.js +1 -1
  69. package/dist/index29.cjs +1 -1
  70. package/dist/index29.js +7 -31
  71. package/dist/index293.cjs +1 -1
  72. package/dist/index293.js +2 -2
  73. package/dist/index295.cjs +1 -1
  74. package/dist/index295.js +10 -41
  75. package/dist/index296.cjs +1 -1
  76. package/dist/index296.js +18 -77
  77. package/dist/index297.cjs +1 -1
  78. package/dist/index297.js +43 -2
  79. package/dist/index298.cjs +1 -1
  80. package/dist/index298.js +77 -10
  81. package/dist/index299.cjs +1 -1
  82. package/dist/index299.js +2 -20
  83. package/dist/index300.cjs +1 -1
  84. package/dist/index300.js +1 -1
  85. package/dist/index304.cjs +1 -1
  86. package/dist/index304.js +1 -1
  87. package/dist/index307.cjs +1 -1
  88. package/dist/index307.js +1 -1
  89. package/dist/index309.cjs +1 -1
  90. package/dist/index309.js +1 -1
  91. package/dist/index312.cjs +1 -1
  92. package/dist/index312.js +63 -4
  93. package/dist/index313.cjs +1 -1
  94. package/dist/index313.js +40 -59
  95. package/dist/index314.cjs +1 -1
  96. package/dist/index314.js +4 -44
  97. package/dist/index55.cjs +1 -1
  98. package/dist/index55.js +1 -1
  99. package/package.json +1 -1
package/dist/index10.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("tough-cookie"),g=require("fetch-cookie"),k=require("./index14.cjs"),f=require("./index15.cjs"),h=require("./index3.cjs"),n=require("./index5.cjs"),m=require("./index26.cjs"),y=require("./index27.cjs"),C=require("./index23.cjs"),T=require("./index28.cjs"),v=require("./index29.cjs"),S=c=>c&&c.__esModule?c:{default:c},p=S(g);class u{constructor(t,i,e){if(this.url=t.endpoint("siwe"),this.walletClient=i,this.domain=(e==null?void 0:e.domain)||"app.garden.finance",this.domain.startsWith("https://")&&(this.domain=this.domain.split("https://")[1]),this.signingStatement=(e==null?void 0:e.signingStatement)??"Garden.fi",this.store=(e==null?void 0:e.store)??(typeof window<"u"?window.localStorage:new k.MemoryStorage),typeof window>"u"){const r=new w.CookieJar;this.fetchWithCookies=p.default(fetch,r)}else this.fetchWithCookies=window.fetch.bind(window)}static fromDigestKey(t,i,e){const r=m.createWalletClient({account:C.privateKeyToAccount(h.add0x(i.digestKey)),transport:y.http(),chain:v.mainnet});return new u(t,r,e)}verifyToken(t,i){try{const e=h.parseJwt(t);if(!e)return n.Ok(!1);const r=Math.floor(Date.now()/1e3)+120;return n.Ok(e.exp>r&&e.user_id.toLowerCase()===i.toLowerCase())}catch{return n.Ok(!1)}}async getToken(){var s;if(!((s=this.walletClient.account)!=null&&s.address))return n.Err("Wallet client does not have an account");const t=this.store.getItem(f.StoreKeys.AUTH_TOKEN);if(t){const o=this.verifyToken(t,this.walletClient.account.address);if(o.ok&&o.val)return n.Ok(t)}const i=await this.signStatement();if(i.error)return n.Err(i.error);let e;try{const a=await(await this.fetchWithCookies(this.url.endpoint("tokens"),{method:"POST",body:JSON.stringify({...i.val}),headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(a.error||!a.result)return n.Err(a.error??"Failed to get token");e=a.result}catch(o){return n.Err("Failed to get token",o)}if(!this.verifyToken(e,this.walletClient.account.address).val)throw new Error("Token verification failed");return this.store.setItem(f.StoreKeys.AUTH_TOKEN,e),n.Ok(e)}async signStatement(){var a;if(!((a=this.walletClient.account)!=null&&a.address))return n.Err("Wallet client does not have a valid account");const t=new Date,i=new Date(t.getTime()+300*1e3);let e;try{const l=await(await this.fetchWithCookies(this.url.endpoint("challenges"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(l.error||!l.result)return n.Err("Failed to get nonce");e=l.result}catch(d){return n.Err("Failed to get nonce",d)}const r=await this.walletClient.getChainId(),s=T.createSiweMessage({domain:this.domain,address:this.walletClient.account.address,statement:this.signingStatement,nonce:e,uri:"https://"+this.domain,version:"1",chainId:r,notBefore:i}),o=await this.walletClient.signMessage({account:this.walletClient.account,message:s});return n.Ok({message:s,signature:o,nonce:e})}async getAuthHeaders(){const t=await this.getToken();return t.ok?n.Ok({Authorization:h.Authorization(t.val)}):n.Err(t.error)}}exports.Siwe=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("tough-cookie"),g=require("fetch-cookie"),k=require("./index14.cjs"),f=require("./index15.cjs"),h=require("./index3.cjs"),n=require("./index5.cjs"),m=require("./index24.cjs"),y=require("./index25.cjs"),C=require("./index23.cjs"),T=require("./index26.cjs"),v=require("./index27.cjs"),S=c=>c&&c.__esModule?c:{default:c},p=S(g);class u{constructor(t,i,e){if(this.url=t.endpoint("siwe"),this.walletClient=i,this.domain=(e==null?void 0:e.domain)||"app.garden.finance",this.domain.startsWith("https://")&&(this.domain=this.domain.split("https://")[1]),this.signingStatement=(e==null?void 0:e.signingStatement)??"Garden.fi",this.store=(e==null?void 0:e.store)??(typeof window<"u"?window.localStorage:new k.MemoryStorage),typeof window>"u"){const r=new w.CookieJar;this.fetchWithCookies=p.default(fetch,r)}else this.fetchWithCookies=window.fetch.bind(window)}static fromDigestKey(t,i,e){const r=m.createWalletClient({account:C.privateKeyToAccount(h.add0x(i.digestKey)),transport:y.http(),chain:v.mainnet});return new u(t,r,e)}verifyToken(t,i){try{const e=h.parseJwt(t);if(!e)return n.Ok(!1);const r=Math.floor(Date.now()/1e3)+120;return n.Ok(e.exp>r&&e.user_id.toLowerCase()===i.toLowerCase())}catch{return n.Ok(!1)}}async getToken(){var s;if(!((s=this.walletClient.account)!=null&&s.address))return n.Err("Wallet client does not have an account");const t=this.store.getItem(f.StoreKeys.AUTH_TOKEN);if(t){const o=this.verifyToken(t,this.walletClient.account.address);if(o.ok&&o.val)return n.Ok(t)}const i=await this.signStatement();if(i.error)return n.Err(i.error);let e;try{const a=await(await this.fetchWithCookies(this.url.endpoint("tokens"),{method:"POST",body:JSON.stringify({...i.val}),headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(a.error||!a.result)return n.Err(a.error??"Failed to get token");e=a.result}catch(o){return n.Err("Failed to get token",o)}if(!this.verifyToken(e,this.walletClient.account.address).val)throw new Error("Token verification failed");return this.store.setItem(f.StoreKeys.AUTH_TOKEN,e),n.Ok(e)}async signStatement(){var a;if(!((a=this.walletClient.account)!=null&&a.address))return n.Err("Wallet client does not have a valid account");const t=new Date,i=new Date(t.getTime()+300*1e3);let e;try{const l=await(await this.fetchWithCookies(this.url.endpoint("challenges"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(l.error||!l.result)return n.Err("Failed to get nonce");e=l.result}catch(d){return n.Err("Failed to get nonce",d)}const r=await this.walletClient.getChainId(),s=T.createSiweMessage({domain:this.domain,address:this.walletClient.account.address,statement:this.signingStatement,nonce:e,uri:"https://"+this.domain,version:"1",chainId:r,notBefore:i}),o=await this.walletClient.signMessage({account:this.walletClient.account,message:s});return n.Ok({message:s,signature:o,nonce:e})}async getAuthHeaders(){const t=await this.getToken();return t.ok?n.Ok({Authorization:h.Authorization(t.val)}):n.Err(t.error)}}exports.Siwe=u;
package/dist/index10.js CHANGED
@@ -4,11 +4,11 @@ import { MemoryStorage as w } from "./index14.js";
4
4
  import { StoreKeys as d } from "./index15.js";
5
5
  import { add0x as g, parseJwt as k, Authorization as p } from "./index3.js";
6
6
  import { Ok as s, Err as r } from "./index5.js";
7
- import { createWalletClient as y } from "./index26.js";
8
- import { http as C } from "./index27.js";
7
+ import { createWalletClient as y } from "./index24.js";
8
+ import { http as C } from "./index25.js";
9
9
  import { privateKeyToAccount as T } from "./index23.js";
10
- import { createSiweMessage as v } from "./index28.js";
11
- import { mainnet as S } from "./index29.js";
10
+ import { createSiweMessage as v } from "./index26.js";
11
+ import { mainnet as S } from "./index27.js";
12
12
  class f {
13
13
  constructor(e, n, t) {
14
14
  if (this.url = e.endpoint("siwe"), this.walletClient = n, this.domain = (t == null ? void 0 : t.domain) || "app.garden.finance", this.domain.startsWith("https://") && (this.domain = this.domain.split("https://")[1]), this.signingStatement = (t == null ? void 0 : t.signingStatement) ?? "Garden.fi", this.store = (t == null ? void 0 : t.store) ?? (typeof window < "u" ? window.localStorage : new w()), typeof window > "u") {
package/dist/index100.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index227.cjs"),f=require("./index283.cjs"),h=require("./index284.cjs"),M=require("./index254.cjs");async function S(a,r){const{address:i,domain:t,message:s,nonce:n,scheme:d,signature:c,time:o=new Date,...g}=r,e=f.parseSiweMessage(s);if(!e.address||!h.validateSiweMessage({address:i,domain:t,message:e,nonce:n,scheme:d,time:o}))return!1;const u=l.hashMessage(s);return M.verifyHash(a,{address:e.address,hash:u,signature:c,...g})}exports.verifySiweMessage=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index227.cjs"),f=require("./index284.cjs"),h=require("./index285.cjs"),M=require("./index254.cjs");async function S(a,r){const{address:i,domain:t,message:s,nonce:n,scheme:d,signature:c,time:o=new Date,...g}=r,e=f.parseSiweMessage(s);if(!e.address||!h.validateSiweMessage({address:i,domain:t,message:e,nonce:n,scheme:d,time:o}))return!1;const u=l.hashMessage(s);return M.verifyHash(a,{address:e.address,hash:u,signature:c,...g})}exports.verifySiweMessage=S;
package/dist/index100.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { hashMessage as g } from "./index227.js";
2
- import { parseSiweMessage as l } from "./index283.js";
3
- import { validateSiweMessage as p } from "./index284.js";
2
+ import { parseSiweMessage as l } from "./index284.js";
3
+ import { validateSiweMessage as p } from "./index285.js";
4
4
  import { verifyHash as h } from "./index254.js";
5
5
  async function S(a, r) {
6
6
  const { address: i, domain: t, message: s, nonce: o, scheme: n, signature: d, time: m = /* @__PURE__ */ new Date(), ...f } = r, e = l(s);
package/dist/index121.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./index41.cjs"),p=require("./index52.cjs"),e=require("./index143.cjs"),I=require("./index155.cjs"),q=require("./index285.cjs"),m=require("./index46.cjs"),v=require("./index47.cjs");function N(t,E={}){return async(c,h={})=>{var i;const{dedupe:s=!1,methods:o,retryDelay:R=150,retryCount:l=3,uid:f}={...E,...h},{method:d}=c;if((i=o==null?void 0:o.exclude)!=null&&i.includes(d))throw new e.MethodNotSupportedRpcError(new Error("method not supported"),{method:d});if(o!=null&&o.include&&!o.include.includes(d))throw new e.MethodNotSupportedRpcError(new Error("method not supported"),{method:d});const y=s?I.stringToHex(`${f}.${v.stringify(c)}`):void 0;return q.withDedupe(()=>m.withRetry(async()=>{try{return await t(c)}catch(n){const r=n;switch(r.code){case e.ParseRpcError.code:throw new e.ParseRpcError(r);case e.InvalidRequestRpcError.code:throw new e.InvalidRequestRpcError(r);case e.MethodNotFoundRpcError.code:throw new e.MethodNotFoundRpcError(r,{method:c.method});case e.InvalidParamsRpcError.code:throw new e.InvalidParamsRpcError(r);case e.InternalRpcError.code:throw new e.InternalRpcError(r);case e.InvalidInputRpcError.code:throw new e.InvalidInputRpcError(r);case e.ResourceNotFoundRpcError.code:throw new e.ResourceNotFoundRpcError(r);case e.ResourceUnavailableRpcError.code:throw new e.ResourceUnavailableRpcError(r);case e.TransactionRejectedRpcError.code:throw new e.TransactionRejectedRpcError(r);case e.MethodNotSupportedRpcError.code:throw new e.MethodNotSupportedRpcError(r,{method:c.method});case e.LimitExceededRpcError.code:throw new e.LimitExceededRpcError(r);case e.JsonRpcVersionUnsupportedError.code:throw new e.JsonRpcVersionUnsupportedError(r);case e.UserRejectedRequestError.code:throw new e.UserRejectedRequestError(r);case e.UnauthorizedProviderError.code:throw new e.UnauthorizedProviderError(r);case e.UnsupportedProviderMethodError.code:throw new e.UnsupportedProviderMethodError(r);case e.ProviderDisconnectedError.code:throw new e.ProviderDisconnectedError(r);case e.ChainDisconnectedError.code:throw new e.ChainDisconnectedError(r);case e.SwitchChainError.code:throw new e.SwitchChainError(r);case e.UnsupportedNonOptionalCapabilityError.code:throw new e.UnsupportedNonOptionalCapabilityError(r);case e.UnsupportedChainIdError.code:throw new e.UnsupportedChainIdError(r);case e.DuplicateIdError.code:throw new e.DuplicateIdError(r);case e.UnknownBundleIdError.code:throw new e.UnknownBundleIdError(r);case e.BundleTooLargeError.code:throw new e.BundleTooLargeError(r);case e.AtomicReadyWalletRejectedUpgradeError.code:throw new e.AtomicReadyWalletRejectedUpgradeError(r);case e.AtomicityNotSupportedError.code:throw new e.AtomicityNotSupportedError(r);case 5e3:throw new e.UserRejectedRequestError(r);default:throw n instanceof U.BaseError?n:new e.UnknownRpcError(r)}}},{delay:({count:n,error:r})=>{var a;if(r&&r instanceof p.HttpRequestError){const u=(a=r==null?void 0:r.headers)==null?void 0:a.get("Retry-After");if(u!=null&&u.match(/\d/))return Number.parseInt(u)*1e3}return~~(1<<n)*R},retryCount:l,shouldRetry:({error:n})=>w(n)}),{enabled:s,id:y})}}function w(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===e.LimitExceededRpcError.code||t.code===e.InternalRpcError.code:t instanceof p.HttpRequestError&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}exports.buildRequest=N;exports.shouldRetry=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./index41.cjs"),p=require("./index52.cjs"),e=require("./index143.cjs"),I=require("./index155.cjs"),q=require("./index286.cjs"),m=require("./index46.cjs"),v=require("./index47.cjs");function N(t,E={}){return async(c,h={})=>{var i;const{dedupe:s=!1,methods:o,retryDelay:R=150,retryCount:l=3,uid:f}={...E,...h},{method:d}=c;if((i=o==null?void 0:o.exclude)!=null&&i.includes(d))throw new e.MethodNotSupportedRpcError(new Error("method not supported"),{method:d});if(o!=null&&o.include&&!o.include.includes(d))throw new e.MethodNotSupportedRpcError(new Error("method not supported"),{method:d});const y=s?I.stringToHex(`${f}.${v.stringify(c)}`):void 0;return q.withDedupe(()=>m.withRetry(async()=>{try{return await t(c)}catch(n){const r=n;switch(r.code){case e.ParseRpcError.code:throw new e.ParseRpcError(r);case e.InvalidRequestRpcError.code:throw new e.InvalidRequestRpcError(r);case e.MethodNotFoundRpcError.code:throw new e.MethodNotFoundRpcError(r,{method:c.method});case e.InvalidParamsRpcError.code:throw new e.InvalidParamsRpcError(r);case e.InternalRpcError.code:throw new e.InternalRpcError(r);case e.InvalidInputRpcError.code:throw new e.InvalidInputRpcError(r);case e.ResourceNotFoundRpcError.code:throw new e.ResourceNotFoundRpcError(r);case e.ResourceUnavailableRpcError.code:throw new e.ResourceUnavailableRpcError(r);case e.TransactionRejectedRpcError.code:throw new e.TransactionRejectedRpcError(r);case e.MethodNotSupportedRpcError.code:throw new e.MethodNotSupportedRpcError(r,{method:c.method});case e.LimitExceededRpcError.code:throw new e.LimitExceededRpcError(r);case e.JsonRpcVersionUnsupportedError.code:throw new e.JsonRpcVersionUnsupportedError(r);case e.UserRejectedRequestError.code:throw new e.UserRejectedRequestError(r);case e.UnauthorizedProviderError.code:throw new e.UnauthorizedProviderError(r);case e.UnsupportedProviderMethodError.code:throw new e.UnsupportedProviderMethodError(r);case e.ProviderDisconnectedError.code:throw new e.ProviderDisconnectedError(r);case e.ChainDisconnectedError.code:throw new e.ChainDisconnectedError(r);case e.SwitchChainError.code:throw new e.SwitchChainError(r);case e.UnsupportedNonOptionalCapabilityError.code:throw new e.UnsupportedNonOptionalCapabilityError(r);case e.UnsupportedChainIdError.code:throw new e.UnsupportedChainIdError(r);case e.DuplicateIdError.code:throw new e.DuplicateIdError(r);case e.UnknownBundleIdError.code:throw new e.UnknownBundleIdError(r);case e.BundleTooLargeError.code:throw new e.BundleTooLargeError(r);case e.AtomicReadyWalletRejectedUpgradeError.code:throw new e.AtomicReadyWalletRejectedUpgradeError(r);case e.AtomicityNotSupportedError.code:throw new e.AtomicityNotSupportedError(r);case 5e3:throw new e.UserRejectedRequestError(r);default:throw n instanceof U.BaseError?n:new e.UnknownRpcError(r)}}},{delay:({count:n,error:r})=>{var a;if(r&&r instanceof p.HttpRequestError){const u=(a=r==null?void 0:r.headers)==null?void 0:a.get("Retry-After");if(u!=null&&u.match(/\d/))return Number.parseInt(u)*1e3}return~~(1<<n)*R},retryCount:l,shouldRetry:({error:n})=>w(n)}),{enabled:s,id:y})}}function w(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===e.LimitExceededRpcError.code||t.code===e.InternalRpcError.code:t instanceof p.HttpRequestError&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}exports.buildRequest=N;exports.shouldRetry=w;
package/dist/index121.js CHANGED
@@ -2,7 +2,7 @@ import { BaseError as z } from "./index41.js";
2
2
  import { HttpRequestError as k } from "./index52.js";
3
3
  import { MethodNotSupportedRpcError as s, UnknownRpcError as J, UserRejectedRequestError as u, AtomicityNotSupportedError as f, AtomicReadyWalletRejectedUpgradeError as E, BundleTooLargeError as l, UnknownBundleIdError as R, DuplicateIdError as m, UnsupportedChainIdError as y, UnsupportedNonOptionalCapabilityError as I, SwitchChainError as U, ChainDisconnectedError as v, ProviderDisconnectedError as b, UnsupportedProviderMethodError as N, UnauthorizedProviderError as q, JsonRpcVersionUnsupportedError as C, LimitExceededRpcError as a, TransactionRejectedRpcError as D, ResourceUnavailableRpcError as P, ResourceNotFoundRpcError as x, InvalidInputRpcError as j, InternalRpcError as i, InvalidParamsRpcError as B, MethodNotFoundRpcError as M, InvalidRequestRpcError as S, ParseRpcError as T } from "./index143.js";
4
4
  import { stringToHex as O } from "./index155.js";
5
- import { withDedupe as V } from "./index285.js";
5
+ import { withDedupe as V } from "./index286.js";
6
6
  import { withRetry as W } from "./index46.js";
7
7
  import { stringify as _ } from "./index47.js";
8
8
  function te(r, A = {}) {
package/dist/index16.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index5.cjs"),a=require("./index30.cjs"),s=require("./index29.cjs"),l=require("./index31.cjs"),b=require("./index27.cjs"),n={42161:s.mainnet,421614:a.sepolia},h=async r=>{const{chain:e}=r;if(!e)return c.Err("No chain found");const o=(u=>u in n)(e.id)?n[e.id]:e;return await i(o)},i=async r=>{const e=l.createPublicClient({chain:r,transport:b.http()});try{const t=await e.getBlockNumber();return c.Ok(Number(t))}catch(t){return c.Err("Failed to fetch evm block number",t)}};exports._fetchEVMBlockNumber=i;exports.fetchEVMBlockNumber=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index5.cjs"),a=require("./index30.cjs"),s=require("./index27.cjs"),l=require("./index31.cjs"),b=require("./index25.cjs"),n={42161:s.mainnet,421614:a.sepolia},h=async r=>{const{chain:e}=r;if(!e)return c.Err("No chain found");const o=(u=>u in n)(e.id)?n[e.id]:e;return await i(o)},i=async r=>{const e=l.createPublicClient({chain:r,transport:b.http()});try{const t=await e.getBlockNumber();return c.Ok(Number(t))}catch(t){return c.Err("Failed to fetch evm block number",t)}};exports._fetchEVMBlockNumber=i;exports.fetchEVMBlockNumber=h;
package/dist/index16.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Err as c, Ok as a } from "./index5.js";
2
2
  import { sepolia as m } from "./index30.js";
3
- import { mainnet as s } from "./index29.js";
3
+ import { mainnet as s } from "./index27.js";
4
4
  import { createPublicClient as u } from "./index31.js";
5
- import { http as l } from "./index27.js";
5
+ import { http as l } from "./index25.js";
6
6
  const n = {
7
7
  42161: s,
8
8
  421614: m
package/dist/index18.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index24.cjs"),u=require("./index25.cjs");class l{static async _postWithFallback(a,t){let r="";for(const n of a)try{const s=await fetch(n,{method:"POST",...t});if(s.status>=500){r=await(s.text()||s.json());continue}return await this.parse(s)}catch(s){r=o(s);continue}throw new Error(r||"All APIs failed")}static async postWithFallback(a,t){return await c(t).retry(()=>this._postWithFallback(a,t))}static async _getWithFallback(a,t){let r="";for(const n of a)try{const s=await fetch(n,t);if(s.status>=500){r=await(s.text()||s.json());continue}return await this.parse(s)}catch(s){r=o(s);continue}throw new Error(r||"All APIs failed")}static async getWithFallback(a,t){return await c(t).retry(()=>this._getWithFallback(a,t))}static async _get(a,t){return await this.parse(await fetch(a,t))}static async get(a,t){return await c(t).retry(()=>this._get(a,t))}static async _post(a,t){return await this.parse(await fetch(a,{method:"POST",...t}))}static async post(a,t){return await c(t).retry(()=>this._post(a,t))}static async parse(a){const t=await a.text();if(a.status>=200&&a.status<300)return u.safeParseJson(t);throw new Error(t)}}function o(e){return(e==null?void 0:e.message)||(e==null?void 0:e.toString())||"unknown error"}const c=e=>new i.Retry((e==null?void 0:e.retryCount)??2,(e==null?void 0:e.retryDelay)??1e3);exports.Fetcher=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index28.cjs"),u=require("./index29.cjs");class l{static async _postWithFallback(a,t){let r="";for(const n of a)try{const s=await fetch(n,{method:"POST",...t});if(s.status>=500){r=await(s.text()||s.json());continue}return await this.parse(s)}catch(s){r=o(s);continue}throw new Error(r||"All APIs failed")}static async postWithFallback(a,t){return await c(t).retry(()=>this._postWithFallback(a,t))}static async _getWithFallback(a,t){let r="";for(const n of a)try{const s=await fetch(n,t);if(s.status>=500){r=await(s.text()||s.json());continue}return await this.parse(s)}catch(s){r=o(s);continue}throw new Error(r||"All APIs failed")}static async getWithFallback(a,t){return await c(t).retry(()=>this._getWithFallback(a,t))}static async _get(a,t){return await this.parse(await fetch(a,t))}static async get(a,t){return await c(t).retry(()=>this._get(a,t))}static async _post(a,t){return await this.parse(await fetch(a,{method:"POST",...t}))}static async post(a,t){return await c(t).retry(()=>this._post(a,t))}static async parse(a){const t=await a.text();if(a.status>=200&&a.status<300)return u.safeParseJson(t);throw new Error(t)}}function o(e){return(e==null?void 0:e.message)||(e==null?void 0:e.toString())||"unknown error"}const c=e=>new i.Retry((e==null?void 0:e.retryCount)??2,(e==null?void 0:e.retryDelay)??1e3);exports.Fetcher=l;
package/dist/index18.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Retry as h } from "./index24.js";
2
- import { safeParseJson as i } from "./index25.js";
1
+ import { Retry as h } from "./index28.js";
2
+ import { safeParseJson as i } from "./index29.js";
3
3
  class w {
4
4
  static async _postWithFallback(a, t) {
5
5
  let r = "";
package/dist/index24.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index3.cjs");class i{constructor(e,t){this.maxRetries=Math.max(e,0),this.delay=t}async retry(e){let t=0,r;for(;t<this.maxRetries+1;)try{return await e()}catch(s){t++,r=s,await a.sleep(this.delay*t)}throw r}}exports.Retry=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index49.cjs"),c=require("./index103.cjs");function r(e){const{key:t="wallet",name:l="Wallet Client",transport:n}=e;return i.createClient({...e,key:t,name:l,transport:n,type:"walletClient"}).extend(c.walletActions)}exports.createWalletClient=r;
package/dist/index24.js CHANGED
@@ -1,29 +1,15 @@
1
- import { sleep as s } from "./index3.js";
2
- class l {
3
- /**
4
- * @param {number} maxRetries - The maximum number of retries, if less < 0 then it is set to 0
5
- * @param {number} delay - The delay between retries
6
- */
7
- constructor(e, t) {
8
- this.maxRetries = Math.max(e, 0), this.delay = t;
9
- }
10
- /**
11
- * Retries a function until it succeeds or the max number of retries is reached
12
- *
13
- * @param {() => Promise<T>} fn - The function to retry
14
- * @return {Promise<T>} a Promise that resolves to the result of the function
15
- */
16
- async retry(e) {
17
- let t = 0, r;
18
- for (; t < this.maxRetries + 1; )
19
- try {
20
- return await e();
21
- } catch (a) {
22
- t++, r = a, await s(this.delay * t);
23
- }
24
- throw r;
25
- }
1
+ import { createClient as i } from "./index49.js";
2
+ import { walletActions as o } from "./index103.js";
3
+ function m(t) {
4
+ const { key: e = "wallet", name: l = "Wallet Client", transport: n } = t;
5
+ return i({
6
+ ...t,
7
+ key: e,
8
+ name: l,
9
+ transport: n,
10
+ type: "walletClient"
11
+ }).extend(o);
26
12
  }
27
13
  export {
28
- l as Retry
14
+ m as createWalletClient
29
15
  };
package/dist/index242.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index273.cjs"),c=require("./index274.cjs"),o=require("./index275.cjs");function a(t){const n=c.parseStructs(t),r=[],i=t.length;for(let e=0;e<i;e++){const s=t[e];u.isStructSignature(s)||r.push(o.parseSignature(s,n))}return r}exports.parseAbi=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index274.cjs"),c=require("./index275.cjs"),o=require("./index276.cjs");function a(t){const n=c.parseStructs(t),r=[],i=t.length;for(let e=0;e<i;e++){const s=t[e];u.isStructSignature(s)||r.push(o.parseSignature(s,n))}return r}exports.parseAbi=a;
package/dist/index242.js CHANGED
@@ -1,6 +1,6 @@
1
- import { isStructSignature as c } from "./index273.js";
2
- import { parseStructs as s } from "./index274.js";
3
- import { parseSignature as p } from "./index275.js";
1
+ import { isStructSignature as c } from "./index274.js";
2
+ import { parseStructs as s } from "./index275.js";
3
+ import { parseSignature as p } from "./index276.js";
4
4
  function a(t) {
5
5
  const i = s(t), o = [], e = t.length;
6
6
  for (let r = 0; r < e; r++) {
package/dist/index25.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=e=>{try{return JSON.parse(e)}catch{return e}};exports.safeParseJson=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index52.cjs"),E=require("./index53.cjs"),F=require("./index54.cjs"),H=require("./index55.cjs"),U=require("./index56.cjs");function _(k,r={}){const{batch:o,fetchOptions:u,key:l="http",methods:h,name:q="HTTP JSON-RPC",onFetchRequest:d,onFetchResponse:y,retryDelay:R,raw:f}=r;return({chain:n,retryCount:w,timeout:S})=>{const{batchSize:m=1e3,wait:C=0}=typeof o=="object"?o:{},b=r.retryCount??w,c=S??r.timeout??1e4,e=n==null?void 0:n.rpcUrls.default.http[0];if(!e)throw new E.UrlRequiredError;const a=H.getHttpRpcClient(e,{fetchOptions:u,onRequest:d,onResponse:y,timeout:c});return U.createTransport({key:l,methods:h,name:q,async request({method:T,params:B}){const i={method:T,params:B},{schedule:O}=F.createBatchScheduler({id:e,wait:C,shouldSplitBatch(t){return t.length>m},fn:t=>a.request({body:t}),sort:(t,g)=>t.id-g.id}),P=async t=>o?O(t):[await a.request({body:t})],[{error:s,result:p}]=await P(i);if(f)return{error:s,result:p};if(s)throw new j.RpcRequestError({body:i,error:s,url:e});return p},retryCount:b,retryDelay:R,timeout:c,type:"http"},{fetchOptions:u,url:e})}}exports.http=_;
package/dist/index25.js CHANGED
@@ -1,10 +1,60 @@
1
- const t = (r) => {
2
- try {
3
- return JSON.parse(r);
4
- } catch {
5
- return r;
6
- }
7
- };
1
+ import { RpcRequestError as O } from "./index52.js";
2
+ import { UrlRequiredError as P } from "./index53.js";
3
+ import { createBatchScheduler as U } from "./index54.js";
4
+ import { getHttpRpcClient as _ } from "./index55.js";
5
+ import { createTransport as j } from "./index56.js";
6
+ function g(k, e = {}) {
7
+ const { batch: o, fetchOptions: u, key: m = "http", methods: a, name: h = "HTTP JSON-RPC", onFetchRequest: f, onFetchResponse: y, retryDelay: d, raw: R } = e;
8
+ return ({ chain: n, retryCount: w, timeout: q }) => {
9
+ const { batchSize: C = 1e3, wait: S = 0 } = typeof o == "object" ? o : {}, b = e.retryCount ?? w, c = q ?? e.timeout ?? 1e4, r = n == null ? void 0 : n.rpcUrls.default.http[0];
10
+ if (!r)
11
+ throw new P();
12
+ const p = _(r, {
13
+ fetchOptions: u,
14
+ onRequest: f,
15
+ onResponse: y,
16
+ timeout: c
17
+ });
18
+ return j({
19
+ key: m,
20
+ methods: a,
21
+ name: h,
22
+ async request({ method: T, params: B }) {
23
+ const i = { method: T, params: B }, { schedule: E } = U({
24
+ id: r,
25
+ wait: S,
26
+ shouldSplitBatch(t) {
27
+ return t.length > C;
28
+ },
29
+ fn: (t) => p.request({
30
+ body: t
31
+ }),
32
+ sort: (t, H) => t.id - H.id
33
+ }), F = async (t) => o ? E(t) : [
34
+ await p.request({
35
+ body: t
36
+ })
37
+ ], [{ error: s, result: l }] = await F(i);
38
+ if (R)
39
+ return { error: s, result: l };
40
+ if (s)
41
+ throw new O({
42
+ body: i,
43
+ error: s,
44
+ url: r
45
+ });
46
+ return l;
47
+ },
48
+ retryCount: b,
49
+ retryDelay: d,
50
+ timeout: c,
51
+ type: "http"
52
+ }, {
53
+ fetchOptions: u,
54
+ url: r
55
+ });
56
+ };
57
+ }
8
58
  export {
9
- t as safeParseJson
59
+ g as http
10
60
  };
package/dist/index26.cjs CHANGED
@@ -1 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index49.cjs"),c=require("./index103.cjs");function r(e){const{key:t="wallet",name:l="Wallet Client",transport:n}=e;return i.createClient({...e,key:t,name:l,transport:n,type:"walletClient"}).extend(c.walletActions)}exports.createWalletClient=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index295.cjs"),M=require("./index164.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
+ `))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
+ `:"",S=`${v} wants you to sign in with your Ethereum account:
4
+ ${$}
5
+
6
+ ${I}`;let n=`URI: ${c}
7
+ Version: ${d}
8
+ Chain ID: ${o}
9
+ Nonce: ${a}
10
+ Issued At: ${m.toISOString()}`;if(l&&(n+=`
11
+ Expiration Time: ${l.toISOString()}`),f&&(n+=`
12
+ Not Before: ${f.toISOString()}`),w&&(n+=`
13
+ Request ID: ${w}`),g){let t=`
14
+ Resources:`;for(const u of g){if(!h.isUri(u))throw new e.SiweInvalidMessageFieldError({field:"resources",metaMessages:["- Every resource must be a RFC 3986 URI.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${u}`]});t+=`
15
+ - ${u}`}n+=t}return`${S}
16
+ ${n}`}const E=/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/,F=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/,b=/^localhost(:[0-9]{1,5})?$/,A=/^[a-zA-Z0-9]{8,}$/,P=/^([a-zA-Z][a-zA-Z0-9+-.]*)$/;exports.createSiweMessage=R;
package/dist/index26.js CHANGED
@@ -1,15 +1,116 @@
1
- import { createClient as i } from "./index49.js";
2
- import { walletActions as o } from "./index103.js";
3
- function m(t) {
4
- const { key: e = "wallet", name: l = "Wallet Client", transport: n } = t;
5
- return i({
6
- ...t,
7
- key: e,
8
- name: l,
9
- transport: n,
10
- type: "walletClient"
11
- }).extend(o);
1
+ import { SiweInvalidMessageFieldError as e } from "./index295.js";
2
+ import { getAddress as S } from "./index164.js";
3
+ import { isUri as $ } from "./index296.js";
4
+ function C(n) {
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
+ {
7
+ if (i !== Math.floor(i))
8
+ throw new e({
9
+ field: "chainId",
10
+ metaMessages: [
11
+ "- Chain ID must be a EIP-155 chain ID.",
12
+ "- See https://eips.ethereum.org/EIPS/eip-155",
13
+ "",
14
+ `Provided value: ${i}`
15
+ ]
16
+ });
17
+ if (!(p.test(s) || M.test(s) || x.test(s)))
18
+ throw new e({
19
+ field: "domain",
20
+ metaMessages: [
21
+ "- Domain must be an RFC 3986 authority.",
22
+ "- See https://www.rfc-editor.org/rfc/rfc3986",
23
+ "",
24
+ `Provided value: ${s}`
25
+ ]
26
+ });
27
+ if (!A.test(a))
28
+ throw new e({
29
+ field: "nonce",
30
+ metaMessages: [
31
+ "- Nonce must be at least 8 characters.",
32
+ "- Nonce must be alphanumeric.",
33
+ "",
34
+ `Provided value: ${a}`
35
+ ]
36
+ });
37
+ if (!$(c))
38
+ throw new e({
39
+ field: "uri",
40
+ metaMessages: [
41
+ "- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.",
42
+ "- See https://www.rfc-editor.org/rfc/rfc3986",
43
+ "",
44
+ `Provided value: ${c}`
45
+ ]
46
+ });
47
+ if (f !== "1")
48
+ throw new e({
49
+ field: "version",
50
+ metaMessages: [
51
+ "- Version must be '1'.",
52
+ "",
53
+ `Provided value: ${f}`
54
+ ]
55
+ });
56
+ if (o && !P.test(o))
57
+ throw new e({
58
+ field: "scheme",
59
+ metaMessages: [
60
+ "- Scheme must be an RFC 3986 URI scheme.",
61
+ "- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1",
62
+ "",
63
+ `Provided value: ${o}`
64
+ ]
65
+ });
66
+ const t = n.statement;
67
+ if (t != null && t.includes(`
68
+ `))
69
+ throw new e({
70
+ field: "statement",
71
+ metaMessages: [
72
+ "- Statement must not include '\\n'.",
73
+ "",
74
+ `Provided value: ${t}`
75
+ ]
76
+ });
77
+ }
78
+ const l = S(n.address), v = o ? `${o}://${s}` : s, I = n.statement ? `${n.statement}
79
+ ` : "", R = `${v} wants you to sign in with your Ethereum account:
80
+ ${l}
81
+
82
+ ${I}`;
83
+ let r = `URI: ${c}
84
+ Version: ${f}
85
+ Chain ID: ${i}
86
+ Nonce: ${a}
87
+ Issued At: ${g.toISOString()}`;
88
+ if (u && (r += `
89
+ Expiration Time: ${u.toISOString()}`), m && (r += `
90
+ Not Before: ${m.toISOString()}`), h && (r += `
91
+ Request ID: ${h}`), w) {
92
+ let t = `
93
+ Resources:`;
94
+ for (const d of w) {
95
+ if (!$(d))
96
+ throw new e({
97
+ field: "resources",
98
+ metaMessages: [
99
+ "- Every resource must be a RFC 3986 URI.",
100
+ "- See https://www.rfc-editor.org/rfc/rfc3986",
101
+ "",
102
+ `Provided value: ${d}`
103
+ ]
104
+ });
105
+ t += `
106
+ - ${d}`;
107
+ }
108
+ r += t;
109
+ }
110
+ return `${R}
111
+ ${r}`;
12
112
  }
113
+ const p = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(:[0-9]{1,5})?$/, M = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$/, x = /^localhost(:[0-9]{1,5})?$/, A = /^[a-zA-Z0-9]{8,}$/, P = /^([a-zA-Z][a-zA-Z0-9+-.]*)$/;
13
114
  export {
14
- m as createWalletClient
115
+ C as createSiweMessage
15
116
  };
package/dist/index262.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index296.cjs"),x=require("./index288.cjs"),_=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array(64);class u extends e.HashMD{constructor(o=32){super(64,o,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:o,B:h,C:s,D:a,E:r,F:b,G:c,H:i}=this;return[o,h,s,a,r,b,c,i]}set(o,h,s,a,r,b,c,i){this.A=o|0,this.B=h|0,this.C=s|0,this.D=a|0,this.E=r|0,this.F=b|0,this.G=c|0,this.H=i|0}process(o,h){for(let t=0;t<16;t++,h+=4)f[t]=o.getUint32(h,!1);for(let t=16;t<64;t++){const H=f[t-15],d=f[t-2],S=x.rotr(H,7)^x.rotr(H,18)^H>>>3,l=x.rotr(d,17)^x.rotr(d,19)^d>>>10;f[t]=l+f[t-7]+S+f[t-16]|0}let{A:s,B:a,C:r,D:b,E:c,F:i,G:n,H:A}=this;for(let t=0;t<64;t++){const H=x.rotr(c,6)^x.rotr(c,11)^x.rotr(c,25),d=A+H+e.Chi(c,i,n)+_[t]+f[t]|0,l=(x.rotr(s,2)^x.rotr(s,13)^x.rotr(s,22))+e.Maj(s,a,r)|0;A=n,n=i,i=c,c=b+d|0,b=r,r=a,a=s,s=d+l|0}s=s+this.A|0,a=a+this.B|0,r=r+this.C|0,b=b+this.D|0,c=c+this.E|0,i=i+this.F|0,n=n+this.G|0,A=A+this.H|0,this.set(s,a,r,b,c,i,n,A)}roundClean(){x.clean(f)}destroy(){this.set(0,0,0,0,0,0,0,0),x.clean(this.buffer)}}const I=x.createHasher(()=>new u);exports.SHA256=u;exports.sha256=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index298.cjs"),x=require("./index288.cjs"),_=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array(64);class u extends e.HashMD{constructor(o=32){super(64,o,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:o,B:h,C:s,D:a,E:r,F:b,G:c,H:i}=this;return[o,h,s,a,r,b,c,i]}set(o,h,s,a,r,b,c,i){this.A=o|0,this.B=h|0,this.C=s|0,this.D=a|0,this.E=r|0,this.F=b|0,this.G=c|0,this.H=i|0}process(o,h){for(let t=0;t<16;t++,h+=4)f[t]=o.getUint32(h,!1);for(let t=16;t<64;t++){const H=f[t-15],d=f[t-2],S=x.rotr(H,7)^x.rotr(H,18)^H>>>3,l=x.rotr(d,17)^x.rotr(d,19)^d>>>10;f[t]=l+f[t-7]+S+f[t-16]|0}let{A:s,B:a,C:r,D:b,E:c,F:i,G:n,H:A}=this;for(let t=0;t<64;t++){const H=x.rotr(c,6)^x.rotr(c,11)^x.rotr(c,25),d=A+H+e.Chi(c,i,n)+_[t]+f[t]|0,l=(x.rotr(s,2)^x.rotr(s,13)^x.rotr(s,22))+e.Maj(s,a,r)|0;A=n,n=i,i=c,c=b+d|0,b=r,r=a,a=s,s=d+l|0}s=s+this.A|0,a=a+this.B|0,r=r+this.C|0,b=b+this.D|0,c=c+this.E|0,i=i+this.F|0,n=n+this.G|0,A=A+this.H|0,this.set(s,a,r,b,c,i,n,A)}roundClean(){x.clean(f)}destroy(){this.set(0,0,0,0,0,0,0,0),x.clean(this.buffer)}}const I=x.createHasher(()=>new u);exports.SHA256=u;exports.sha256=I;
package/dist/index262.js CHANGED
@@ -1,4 +1,4 @@
1
- import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index296.js";
1
+ import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index298.js";
2
2
  import { createHasher as u, clean as C, rotr as i } from "./index288.js";
3
3
  const B = /* @__PURE__ */ Uint32Array.from([
4
4
  1116352408,
package/dist/index266.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index286.cjs"),n=require("./index269.cjs"),i=t=>{const r=typeof t=="string"?t:n.formatAbiItem(t);return e.normalizeSignature(r)};exports.toSignature=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index267.cjs"),n=require("./index268.cjs"),i=t=>{const r=typeof t=="string"?t:n.formatAbiItem(t);return e.normalizeSignature(r)};exports.toSignature=i;
package/dist/index266.js CHANGED
@@ -1,5 +1,5 @@
1
- import { normalizeSignature as o } from "./index286.js";
2
- import { formatAbiItem as n } from "./index269.js";
1
+ import { normalizeSignature as o } from "./index267.js";
2
+ import { formatAbiItem as n } from "./index268.js";
3
3
  const m = (r) => {
4
4
  const t = typeof r == "string" ? r : n(r);
5
5
  return o(t);
package/dist/index267.cjs CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index268.cjs");class t extends Error{constructor(a,e={}){var i;const s=e.cause instanceof t?e.cause.details:(i=e.cause)!=null&&i.message?e.cause.message:e.details,r=e.cause instanceof t&&e.cause.docsPath||e.docsPath,u=[a||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...s?[`Details: ${s}`]:[],`Version: abitype@${o.version}`].join(`
2
- `);super(u),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),e.cause&&(this.cause=e.cause),this.details=s,this.docsPath=r,this.metaMessages=e.metaMessages,this.shortMessage=a}}exports.BaseError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index41.cjs");function a(r){let l=!0,i="",o=0,t="",u=!1;for(let n=0;n<r.length;n++){const e=r[n];if(["(",")",","].includes(e)&&(l=!0),e==="("&&o++,e===")"&&o--,!!l){if(o===0){if(e===" "&&["event","function",""].includes(t))t="";else if(t+=e,e===")"){u=!0;break}continue}if(e===" "){r[n-1]!==","&&i!==","&&i!==",("&&(i="",l=!1);continue}t+=e,i+=e}}if(!u)throw new f.BaseError("Unable to normalize signature.");return t}exports.normalizeSignature=a;
package/dist/index267.js CHANGED
@@ -1,44 +1,29 @@
1
- import { version as o } from "./index268.js";
2
- class a extends Error {
3
- constructor(i, e = {}) {
4
- var r;
5
- const t = e.cause instanceof a ? e.cause.details : (r = e.cause) != null && r.message ? e.cause.message : e.details, s = e.cause instanceof a && e.cause.docsPath || e.docsPath, u = [
6
- i || "An error occurred.",
7
- "",
8
- ...e.metaMessages ? [...e.metaMessages, ""] : [],
9
- ...s ? [`Docs: https://abitype.dev${s}`] : [],
10
- ...t ? [`Details: ${t}`] : [],
11
- `Version: abitype@${o}`
12
- ].join(`
13
- `);
14
- super(u), Object.defineProperty(this, "details", {
15
- enumerable: !0,
16
- configurable: !0,
17
- writable: !0,
18
- value: void 0
19
- }), Object.defineProperty(this, "docsPath", {
20
- enumerable: !0,
21
- configurable: !0,
22
- writable: !0,
23
- value: void 0
24
- }), Object.defineProperty(this, "metaMessages", {
25
- enumerable: !0,
26
- configurable: !0,
27
- writable: !0,
28
- value: void 0
29
- }), Object.defineProperty(this, "shortMessage", {
30
- enumerable: !0,
31
- configurable: !0,
32
- writable: !0,
33
- value: void 0
34
- }), Object.defineProperty(this, "name", {
35
- enumerable: !0,
36
- configurable: !0,
37
- writable: !0,
38
- value: "AbiTypeError"
39
- }), e.cause && (this.cause = e.cause), this.details = t, this.docsPath = s, this.metaMessages = e.metaMessages, this.shortMessage = i;
1
+ import { BaseError as u } from "./index41.js";
2
+ function a(r) {
3
+ let l = !0, i = "", f = 0, t = "", o = !1;
4
+ for (let n = 0; n < r.length; n++) {
5
+ const e = r[n];
6
+ if (["(", ")", ","].includes(e) && (l = !0), e === "(" && f++, e === ")" && f--, !!l) {
7
+ if (f === 0) {
8
+ if (e === " " && ["event", "function", ""].includes(t))
9
+ t = "";
10
+ else if (t += e, e === ")") {
11
+ o = !0;
12
+ break;
13
+ }
14
+ continue;
15
+ }
16
+ if (e === " ") {
17
+ r[n - 1] !== "," && i !== "," && i !== ",(" && (i = "", l = !1);
18
+ continue;
19
+ }
20
+ t += e, i += e;
21
+ }
40
22
  }
23
+ if (!o)
24
+ throw new u("Unable to normalize signature.");
25
+ return t;
41
26
  }
42
27
  export {
43
- a as BaseError
28
+ a as normalizeSignature
44
29
  };
package/dist/index268.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.0.8";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index271.cjs");function a(t){var e;return t.type==="function"?`function ${t.name}(${r.formatAbiParameters(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${r.formatAbiParameters(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${r.formatAbiParameters(t.inputs)})`:t.type==="error"?`error ${t.name}(${r.formatAbiParameters(t.inputs)})`:t.type==="constructor"?`constructor(${r.formatAbiParameters(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}exports.formatAbiItem=a;
package/dist/index268.js CHANGED
@@ -1,4 +1,8 @@
1
- const o = "1.0.8";
1
+ import { formatAbiParameters as r } from "./index271.js";
2
+ function u(t) {
3
+ var n;
4
+ return t.type === "function" ? `function ${t.name}(${r(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${(n = t.outputs) != null && n.length ? ` returns (${r(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${r(t.inputs)})` : t.type === "error" ? `error ${t.name}(${r(t.inputs)})` : t.type === "constructor" ? `constructor(${r(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
5
+ }
2
6
  export {
3
- o as version
7
+ u as formatAbiItem
4
8
  };
package/dist/index269.cjs CHANGED
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index270.cjs");function a(t){var e;return t.type==="function"?`function ${t.name}(${r.formatAbiParameters(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${r.formatAbiParameters(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${r.formatAbiParameters(t.inputs)})`:t.type==="error"?`error ${t.name}(${r.formatAbiParameters(t.inputs)})`:t.type==="constructor"?`constructor(${r.formatAbiParameters(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}exports.formatAbiItem=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index270.cjs");class t extends Error{constructor(a,e={}){var i;const s=e.cause instanceof t?e.cause.details:(i=e.cause)!=null&&i.message?e.cause.message:e.details,r=e.cause instanceof t&&e.cause.docsPath||e.docsPath,u=[a||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...s?[`Details: ${s}`]:[],`Version: abitype@${o.version}`].join(`
2
+ `);super(u),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),e.cause&&(this.cause=e.cause),this.details=s,this.docsPath=r,this.metaMessages=e.metaMessages,this.shortMessage=a}}exports.BaseError=t;
package/dist/index269.js CHANGED
@@ -1,8 +1,44 @@
1
- import { formatAbiParameters as r } from "./index270.js";
2
- function u(t) {
3
- var n;
4
- return t.type === "function" ? `function ${t.name}(${r(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${(n = t.outputs) != null && n.length ? ` returns (${r(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${r(t.inputs)})` : t.type === "error" ? `error ${t.name}(${r(t.inputs)})` : t.type === "constructor" ? `constructor(${r(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
1
+ import { version as o } from "./index270.js";
2
+ class a extends Error {
3
+ constructor(i, e = {}) {
4
+ var r;
5
+ const t = e.cause instanceof a ? e.cause.details : (r = e.cause) != null && r.message ? e.cause.message : e.details, s = e.cause instanceof a && e.cause.docsPath || e.docsPath, u = [
6
+ i || "An error occurred.",
7
+ "",
8
+ ...e.metaMessages ? [...e.metaMessages, ""] : [],
9
+ ...s ? [`Docs: https://abitype.dev${s}`] : [],
10
+ ...t ? [`Details: ${t}`] : [],
11
+ `Version: abitype@${o}`
12
+ ].join(`
13
+ `);
14
+ super(u), Object.defineProperty(this, "details", {
15
+ enumerable: !0,
16
+ configurable: !0,
17
+ writable: !0,
18
+ value: void 0
19
+ }), Object.defineProperty(this, "docsPath", {
20
+ enumerable: !0,
21
+ configurable: !0,
22
+ writable: !0,
23
+ value: void 0
24
+ }), Object.defineProperty(this, "metaMessages", {
25
+ enumerable: !0,
26
+ configurable: !0,
27
+ writable: !0,
28
+ value: void 0
29
+ }), Object.defineProperty(this, "shortMessage", {
30
+ enumerable: !0,
31
+ configurable: !0,
32
+ writable: !0,
33
+ value: void 0
34
+ }), Object.defineProperty(this, "name", {
35
+ enumerable: !0,
36
+ configurable: !0,
37
+ writable: !0,
38
+ value: "AbiTypeError"
39
+ }), e.cause && (this.cause = e.cause), this.details = t, this.docsPath = s, this.metaMessages = e.metaMessages, this.shortMessage = i;
40
+ }
5
41
  }
6
42
  export {
7
- u as formatAbiItem
43
+ a as BaseError
8
44
  };