@dodoex/wallet-web3 0.0.67 → 0.0.69

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 (81) hide show
  1. package/LICENSE +674 -674
  2. package/dist/{alchemy-provider-5870b6fa-18c81351.js → alchemy-provider-5870b6fa-98301b29.js} +1 -1
  3. package/dist/{alchemy-websocket-provider-213da986-4e051507.js → alchemy-websocket-provider-213da986-527bd00c.js} +1 -1
  4. package/dist/{blocto-b790d079.js → blocto-4cd4d584.js} +1 -1
  5. package/dist/{ccip-1b50a4b6.js → ccip-54c844f6.js} +1 -1
  6. package/dist/cjs/{alchemy-provider-5870b6fa-757dd405.cjs → alchemy-provider-5870b6fa-5fa09d45.cjs} +1 -1
  7. package/dist/cjs/{alchemy-websocket-provider-213da986-63a14c19.cjs → alchemy-websocket-provider-213da986-812c11a4.cjs} +1 -1
  8. package/dist/cjs/{blocto-6ad74a7c.cjs → blocto-ca14595c.cjs} +1 -1
  9. package/dist/cjs/{ccip-29a0c692.cjs → ccip-7bfe8ec4.cjs} +1 -1
  10. package/dist/cjs/core/index.d.ts +1 -1
  11. package/dist/cjs/{draggabilly-1db23d29.cjs → draggabilly-4d7af541.cjs} +1 -1
  12. package/dist/cjs/id-f2245cff.cjs +1 -0
  13. package/dist/cjs/{index-ec75bd64.cjs → index-080f2823.cjs} +1 -1
  14. package/dist/cjs/{index-8b646c2c.cjs → index-0acb20b2.cjs} +1 -1
  15. package/dist/cjs/{index-0da0f3e1.cjs → index-2de154e4.cjs} +1 -1
  16. package/dist/cjs/{index-10420800.cjs → index-61fa3fd8.cjs} +1 -1
  17. package/dist/cjs/{index-32fdf8e5.cjs → index-6302afc1.cjs} +1 -1
  18. package/dist/cjs/{index-5a6afdc1.cjs → index-63e80e27.cjs} +2 -2
  19. package/dist/cjs/{index-7ee26fab.cjs → index-81c83e9a.cjs} +1 -1
  20. package/dist/cjs/{index-eeda7d0a.cjs → index-9cd11db8.cjs} +1 -1
  21. package/dist/cjs/{index-43289a57.cjs → index-ba440ebf.cjs} +4 -4
  22. package/dist/cjs/{index-42ebd156.cjs → index-f81aedc0.cjs} +1 -1
  23. package/dist/cjs/index.cjs +1 -1
  24. package/dist/cjs/{index.es-38733083.cjs → index.es-7068a9f3.cjs} +1 -1
  25. package/dist/cjs/{interface-78ed6726.cjs → interface-38248c79.cjs} +1 -1
  26. package/dist/cjs/{lib-typedarrays-765e8073.cjs → lib-typedarrays-a1fd54be.cjs} +1 -1
  27. package/dist/cjs/{portis-bbdb30f7.cjs → portis-e0ff7fc1.cjs} +1 -1
  28. package/dist/cjs/{provider-214a541f.cjs → provider-7e4e6eb0.cjs} +1 -1
  29. package/dist/cjs/providers/connector/alchemy/index.d.ts +8 -12
  30. package/dist/cjs/providers/connector/alchemy/provider.d.ts +1 -1
  31. package/dist/cjs/providers/connector/index.d.ts +8 -12
  32. package/dist/cjs/providers/connector/types.d.ts +4 -1
  33. package/dist/cjs/providers/wallets/index.d.ts +0 -2
  34. package/dist/cjs/rainbow-22e4427a.cjs +1 -0
  35. package/dist/cjs/{sha224-e35247b0.cjs → sha224-6a65f75b.cjs} +1 -1
  36. package/dist/cjs/{sha256-1da100f2.cjs → sha256-d3f4258d.cjs} +1 -1
  37. package/dist/cjs/{typed-data-ac450224.cjs → typed-data-9845003a.cjs} +1 -1
  38. package/dist/cjs/{uAuth-fb59a769.cjs → uAuth-6049eeea.cjs} +1 -1
  39. package/dist/cjs/walletConnect-aa1986c5.cjs +1 -0
  40. package/dist/cjs/walletLink-f10f8063.cjs +3 -0
  41. package/dist/core/index.d.ts +1 -1
  42. package/dist/{draggabilly-e5894c14.js → draggabilly-eb471634.js} +1 -1
  43. package/dist/id-0a46be36.js +1 -0
  44. package/dist/{index-c079cfa5.js → index-072f962e.js} +1 -1
  45. package/dist/{index-446c71f4.js → index-16c75eee.js} +4 -4
  46. package/dist/{index-bccf7498.js → index-3b5f0416.js} +1 -1
  47. package/dist/{index-87c6229a.js → index-4dece22b.js} +1 -1
  48. package/dist/{index-afeddbec.js → index-638a17dc.js} +1 -1
  49. package/dist/{index-730e4ec4.js → index-75b35923.js} +1 -1
  50. package/dist/{index-a42068f2.js → index-80d91849.js} +1 -1
  51. package/dist/{index-fd6b6765.js → index-8430c25c.js} +1 -1
  52. package/dist/{index-b2d7f586.js → index-9c3cf2c5.js} +1 -1
  53. package/dist/{index-38803328.js → index-b790f6f1.js} +2 -2
  54. package/dist/{index.es-77497000.js → index.es-8b3272b7.js} +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/{interface-789628fd.js → interface-bbbac810.js} +1 -1
  57. package/dist/{lib-typedarrays-13c0d1d7.js → lib-typedarrays-293c8a76.js} +1 -1
  58. package/dist/{portis-85dc7ba5.js → portis-4409d446.js} +1 -1
  59. package/dist/{provider-b787ad38.js → provider-d326196f.js} +1 -1
  60. package/dist/providers/connector/alchemy/index.d.ts +8 -12
  61. package/dist/providers/connector/alchemy/provider.d.ts +1 -1
  62. package/dist/providers/connector/index.d.ts +8 -12
  63. package/dist/providers/connector/types.d.ts +4 -1
  64. package/dist/providers/wallets/index.d.ts +0 -2
  65. package/dist/rainbow-6a8e854c.js +1 -0
  66. package/dist/sha224-12ff07c7.js +1 -0
  67. package/dist/{sha256-8f491017.js → sha256-9e7d3d05.js} +1 -1
  68. package/dist/{typed-data-e7777a2c.js → typed-data-bcf20312.js} +1 -1
  69. package/dist/{uAuth-2d4231df.js → uAuth-0f21a9b3.js} +1 -1
  70. package/dist/walletConnect-db79b446.js +1 -0
  71. package/dist/walletLink-ae1d6836.js +3 -0
  72. package/package.json +94 -93
  73. package/dist/cjs/id-18175452.cjs +0 -1
  74. package/dist/cjs/rainbow-bdbbdf92.cjs +0 -1
  75. package/dist/cjs/walletConnect-e3be2b57.cjs +0 -1
  76. package/dist/cjs/walletLink-0372cd75.cjs +0 -3
  77. package/dist/id-68d53df0.js +0 -1
  78. package/dist/rainbow-e0ef719e.js +0 -1
  79. package/dist/sha224-cac5c58b.js +0 -1
  80. package/dist/walletConnect-e5320b71.js +0 -1
  81. package/dist/walletLink-24205b0c.js +0 -3
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{bj as ChainId,H as HD_PATH_LIST,bf as OpenBlockIframeWallet,aC as WalletType,bN as WatchResult,be as allWalletList,bc as allWalletObject,bT as approve,a as convertTransactionType,A as convertWeb3Provider,bb as default,bJ as getAlchemyConnector,by as getAlchemyPackage,bG as getBinanceConnector,bv as getBinancePackage,bz as getBloctoConnector,br as getBloctoPackage,bR as getContract,bE as getCyberConnector,bt as getCyberPackage,bO as getEstimateGas,bP as getGasPrice,bm as getGnosisPackage,b_ as getIsAndroid,O as getIsIOS,N as getIsMobile,bM as getIsOpenBlockIframe,bi as getIsolatedEnvironmentWallet,bl as getLedgerUSBPackage,bH as getMetamaskConnector,bw as getMetamaskPackage,bL as getOpenBlockIframeConnector,bA as getPortisConnector,bo as getPortisPackage,bS as getProviderByChain,bs as getRainbowConnectPackage,bD as getRainbowConnector,bI as getSocialLoginConnector,bx as getSocialLoginPackage,bn as getUAuthPackage,bF as getUniPassConnector,bu as getUniPassPackage,bC as getWalletConnectConnector,bq as getWalletConnectPackage,bg as getWalletDisabledState,bB as getWalletLinkConnector,bp as getWalletLinkPackage,bh as getWalletList,c1 as getWindow,K as injectedConnect,c2 as isAddress,c0 as isLargeIOS,b$ as isSmallIOS,bZ as isSupportWebHid,bV as personalSign,bK as registerNetworkWithMetamask,bQ as sendTransaction,bW as sign,bX as signTransaction,bY as signTypedData,bd as standaloneList,bk as standaloneListObject,C as useWalletStore,bU as watchTx}from"./index-446c71f4.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";
1
+ export{bj as ChainId,H as HD_PATH_LIST,bf as OpenBlockIframeWallet,aC as WalletType,bN as WatchResult,be as allWalletList,bc as allWalletObject,bT as approve,a as convertTransactionType,A as convertWeb3Provider,bb as default,bJ as getAlchemyConnector,by as getAlchemyPackage,bG as getBinanceConnector,bv as getBinancePackage,bz as getBloctoConnector,br as getBloctoPackage,bR as getContract,bE as getCyberConnector,bt as getCyberPackage,bO as getEstimateGas,bP as getGasPrice,bm as getGnosisPackage,b_ as getIsAndroid,O as getIsIOS,N as getIsMobile,bM as getIsOpenBlockIframe,bi as getIsolatedEnvironmentWallet,bl as getLedgerUSBPackage,bH as getMetamaskConnector,bw as getMetamaskPackage,bL as getOpenBlockIframeConnector,bA as getPortisConnector,bo as getPortisPackage,bS as getProviderByChain,bs as getRainbowConnectPackage,bD as getRainbowConnector,bI as getSocialLoginConnector,bx as getSocialLoginPackage,bn as getUAuthPackage,bF as getUniPassConnector,bu as getUniPassPackage,bC as getWalletConnectConnector,bq as getWalletConnectPackage,bg as getWalletDisabledState,bB as getWalletLinkConnector,bp as getWalletLinkPackage,bh as getWalletList,c1 as getWindow,K as injectedConnect,c2 as isAddress,c0 as isLargeIOS,b$ as isSmallIOS,bZ as isSupportWebHid,bV as personalSign,bK as registerNetworkWithMetamask,bQ as sendTransaction,bW as sign,bX as signTransaction,bY as signTypedData,bd as standaloneList,bk as standaloneListObject,C as useWalletStore,bU as watchTx}from"./index-16c75eee.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";
@@ -1 +1 @@
1
- import{getAddress as t}from"@ethersproject/address";import{hexConcat as e,concat as r,arrayify as n,hexlify as a,hexZeroPad as s,hexDataSlice as o,isHexString as i}from"@ethersproject/bytes";import{i as u}from"./id-68d53df0.js";import{L as c,B as l,t as h,b as m,k as p}from"./index-446c71f4.js";import{defineReadOnly as d,Description as g,getStatic as f}from"@ethersproject/properties";import{MaxUint256 as y,One as b,NegativeOne as w,Zero as E}from"@ethersproject/constants";const v="abi/5.7.0",_=new c(v),A={};let x={calldata:!0,memory:!0,storage:!0},O={calldata:!0,memory:!0};function S(t,e){if("bytes"===t||"string"===t){if(x[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&O[e])return!0;return(x[e]||"payable"===e)&&_.throwArgumentError("invalid modifier","name",e),!1}function j(t,e){for(let r in e)d(t,r,e[r])}const N=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),T=new RegExp(/^(.*)\[([0-9]*)\]$/);class F{constructor(t,e){t!==A&&_.throwError("use fromString",c.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),j(this,e);let r=this.type.match(T);j(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:F.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==N.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===N.full?", ":",")+")"):e+=this.type,t!==N.sighash&&(!0===this.indexed&&(e+=" indexed"),t===N.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?F.fromString(t,e):F.fromObject(t)}static fromObject(t){return F.isParamType(t)?t:new F(A,{name:t.name||null,type:$(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(F.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){_.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function a(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let s={type:"",name:"",state:{allowType:!0}},o=s;for(let r=0;r<t.length;r++){let s=t[r];switch(s){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=$(o.type),o.components=[a(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(e||n(r),o.indexed=!0,o.name=""),S(o.type,o.name)&&(o.name=""),o.type=$(o.type);let t=o;o=o.parent,o||n(r),delete t.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(e||n(r),o.indexed=!0,o.name=""),S(o.type,o.name)&&(o.name=""),o.type=$(o.type);let i=a(o.parent);o.parent.components.push(i),delete o.parent,o=i;break;case" ":o.state.allowType&&""!==o.type&&(o.type=$(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(e||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):S(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(r)}}return o.parent&&_.throwArgumentError("unexpected eof","param",t),delete s.state,"indexed"===o.name?(e||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):S(o.type,o.name)&&(o.name=""),s.type=$(s.type),s}(t,!!e),F.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function V(t,e){return function(t){t=t.trim();let e=[],r="",n=0;for(let a=0;a<t.length;a++){let s=t[a];","===s&&0===n?(e.push(r),r=""):(r+=s,"("===s?n++:")"===s&&(n--,-1===n&&_.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>F.fromString(t,e)))}class M{constructor(t,e){t!==A&&_.throwError("use a static from method",c.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),j(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return M.isFragment(t)?t:"string"==typeof t?M.fromString(t):M.fromObject(t)}static fromObject(t){if(M.isFragment(t))return t;switch(t.type){case"function":return L.fromObject(t);case"event":return z.fromObject(t);case"constructor":return k.fromObject(t);case"error":return U.fromObject(t);case"fallback":case"receive":return null}return _.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?z.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?L.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?k.fromString(t.trim()):"error"===t.split(" ")[0]?U.fromString(t.substring(5).trim()):_.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class z extends M{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==N.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ",t!==N.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?z.fromString(t):z.fromObject(t)}static fromObject(t){if(z.isEventFragment(t))return t;"event"!==t.type&&_.throwArgumentError("invalid event object","value",t);const e={name:D(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(F.fromObject):[],type:"event"};return new z(A,e)}static fromString(t){let e=t.match(J);e||_.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:_.warn("unknown modifier: "+t)}})),z.fromObject({name:e[1].trim(),anonymous:r,inputs:V(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function R(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&_.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||_.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=l.from(r[1]),r[0]):t}function C(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function P(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&_.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&_.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||_.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&_.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&_.throwArgumentError("unable to determine stateMutability","value",t),e}class k extends M{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===N.sighash&&_.throwError("cannot format a constructor for sighash",c.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?k.fromString(t):k.fromObject(t)}static fromObject(t){if(k.isConstructorFragment(t))return t;"constructor"!==t.type&&_.throwArgumentError("invalid constructor object","value",t);let e=P(t);e.constant&&_.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(F.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?l.from(t.gas):null};return new k(A,r)}static fromString(t){let e={type:"constructor"},r=(t=R(t,e)).match(J);return r&&"constructor"===r[1].trim()||_.throwArgumentError("invalid constructor string","value",t),e.inputs=V(r[2].trim(),!1),C(r[3].trim(),e),k.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class L extends k{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==N.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ",t!==N.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?L.fromString(t):L.fromObject(t)}static fromObject(t){if(L.isFunctionFragment(t))return t;"function"!==t.type&&_.throwArgumentError("invalid function object","value",t);let e=P(t);const r={type:t.type,name:D(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(F.fromObject):[],outputs:t.outputs?t.outputs.map(F.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?l.from(t.gas):null};return new L(A,r)}static fromString(t){let e={type:"function"},r=(t=R(t,e)).split(" returns ");r.length>2&&_.throwArgumentError("invalid function string","value",t);let n=r[0].match(J);if(n||_.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&D(e.name),e.inputs=V(n[2],!1),C(n[3].trim(),e),r.length>1){let n=r[1].match(J);""==n[1].trim()&&""==n[3].trim()||_.throwArgumentError("unexpected tokens","value",t),e.outputs=V(n[2],!1)}else e.outputs=[];return L.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function I(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||_.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class U extends M{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==N.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?U.fromString(t):U.fromObject(t)}static fromObject(t){if(U.isErrorFragment(t))return t;"error"!==t.type&&_.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:D(t.name),inputs:t.inputs?t.inputs.map(F.fromObject):[]};return I(new U(A,e))}static fromString(t){let e={type:"error"},r=t.match(J);return r||_.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&D(e.name),e.inputs=V(r[2],!1),I(U.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function $(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const B=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function D(t){return t&&t.match(B)||_.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const J=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const W=new c(v);function G(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let a in n){const s=t.slice();s.push(a);try{r(s,n[a])}catch(t){e.push({path:s,error:t})}}};return r([],t),e}class Z{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){W.throwArgumentError(t,this.localName,e)}}class H{constructor(t){d(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return e(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(r(t._data))}writeBytes(t){let e=n(t);const a=e.length%this.wordSize;return a&&(e=r([e,this._padding.slice(a)])),this._writeData(e)}_getValue(t){let e=n(l.from(t));return e.length>this.wordSize&&W.throwError("value out-of-bounds",c.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=r([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class X{constructor(t,e,r,a){d(this,"_data",n(t)),d(this,"wordSize",e||32),d(this,"_coerceFunc",r),d(this,"allowLoose",a),this._offset=0}get data(){return a(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):X.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:W.throwError("data out-of-bounds",c.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new X(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return l.from(this.readBytes(this.wordSize))}}class q extends Z{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=t(r)}catch(t){this._throwError(t.message,r)}return e.writeValue(r)}decode(e){return t(s(e.readValue().toHexString(),20))}}class K extends Z{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const Q=new c(v);function Y(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||Q.throwError("cannot encode object for signature with missing names",c.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&Q.throwError("cannot encode object for signature with duplicate names",c.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else Q.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&Q.throwArgumentError("types/value length mismatch","tuple",r);let a=new H(t.wordSize),s=new H(t.wordSize),o=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=s.length;t.encode(s,r);let n=a.writeUpdatableValue();o.push((t=>{n(t+e)}))}else t.encode(a,r)})),o.forEach((t=>{t(a.length)}));let i=t.appendWriter(a);return i+=t.appendWriter(s),i}function tt(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let a=null;if(e.dynamic){let r=t.readValue(),s=n.subReader(r.toNumber());try{a=e.decode(s)}catch(t){if(t.code===c.errors.BUFFER_OVERRUN)throw t;a=t,a.baseType=e.name,a.name=e.localName,a.type=e.type}}else try{a=e.decode(t)}catch(t){if(t.code===c.errors.BUFFER_OVERRUN)throw t;a=t,a.baseType=e.name,a.name=e.localName,a.type=e.type}null!=a&&r.push(a)}));const a=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==a[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const s=r[e];s instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw s}}):r[n]=s}));for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(r)}class et extends Z{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),Q.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let t=0;t<e.length;t++)n.push(this.coder);return Y(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&Q.throwError("insufficient data length",c.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new K(this.coder));return t.coerce(this.name,tt(t,r))}}class rt extends Z{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class nt extends Z{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=n(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class at extends nt{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,a(super.decode(t)))}}class st extends Z{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let r=n(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,a(t.readBytes(this.size)))}}class ot extends Z{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}class it extends Z{constructor(t,e,r){const n=(e?"int":"uint")+8*t;super(n,n,r,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let r=l.from(e),n=y.mask(8*t.wordSize);if(this.signed){let t=n.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(b).mul(w)))&&this._throwError("value out-of-bounds",e)}else(r.lt(E)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}class ut extends nt{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,h(e))}decode(t){return m(super.decode(t))}}class ct extends Z{constructor(t,e){let r=!1;const n=[];t.forEach((t=>{t.dynamic&&(r=!0),n.push(t.type)}));super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let a=r.localName;a&&1===e[a]&&("length"===a&&(a="_length"),null==t[a]&&(t[a]=t[n]))})),Object.freeze(t)}encode(t,e){return Y(t,this.coders,e)}decode(t){return t.coerce(this.name,tt(t,this.coders))}}const lt=new c(v),ht=new RegExp(/^bytes([0-9]*)$/),mt=new RegExp(/^(u?int)([0-9]*)$/);class pt{constructor(t){d(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new q(t.name);case"bool":return new rt(t.name);case"string":return new ut(t.name);case"bytes":return new at(t.name);case"array":return new et(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new ct((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new ot(t.name)}let e=t.type.match(mt);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&lt.throwArgumentError("invalid "+e[1]+" bit length","param",t),new it(r/8,"int"===e[1],t.name)}if(e=t.type.match(ht),e){let r=parseInt(e[1]);return(0===r||r>32)&&lt.throwArgumentError("invalid bytes length","param",t),new st(r,t.name)}return lt.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new X(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new H(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(F.from(t))));return new ct(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&lt.throwError("types/values length mismatch",c.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(F.from(t)))),n=new ct(r,"_"),a=this._getWriter();return n.encode(a,e),a.data}decode(t,e,r){const a=t.map((t=>this._getCoder(F.from(t))));return new ct(a,"_").decode(this._getReader(n(e),r))}}const dt=new pt,gt=new c(v);class ft extends g{}class yt extends g{}class bt extends g{}class wt extends g{static isIndexed(t){return!(!t||!t._isIndexed)}}const Et={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vt(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class _t{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,d(this,"fragments",e.map((t=>M.from(t))).filter((t=>null!=t))),d(this,"_abiCoder",f(new.target,"getAbiCoder")()),d(this,"functions",{}),d(this,"errors",{}),d(this,"events",{}),d(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void gt.warn("duplicate definition - constructor"):void d(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?gt.warn("duplicate definition - "+r):e[r]=t})),this.deploy||d(this,"deploy",k.from({payable:!1,type:"constructor"})),d(this,"_isInterface",!0)}format(t){t||(t=N.full),t===N.sighash&&gt.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===N.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return dt}static getAddress(e){return t(e)}static getSighash(t){return o(u(t.format()),0,4)}static getEventTopic(t){return u(t.format())}getFunction(t){if(i(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];gt.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?gt.throwArgumentError("no matching function","name",e):r.length>1&&gt.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[L.fromString(t).format()];return e||gt.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(i(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];gt.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?gt.throwArgumentError("no matching event","name",e):r.length>1&&gt.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[z.fromString(t).format()];return e||gt.throwArgumentError("no matching event","signature",t),e}getError(t){if(i(t)){const e=f(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}gt.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?gt.throwArgumentError("no matching error","name",e):r.length>1&&gt.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[L.fromString(t).format()];return e||gt.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return f(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),f(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=n(e);return a(r.slice(0,4))!==this.getSighash(t)&&gt.throwArgumentError(`data signature does not match error ${t.name}.`,"data",a(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),a(r([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=n(e);return a(r.slice(0,4))!==this.getSighash(t)&&gt.throwArgumentError(`data signature does not match function ${t.name}.`,"data",a(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),a(r([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=n(e),s=null,o="",i=null,u=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=a(r.slice(0,4)),e=Et[t];if(e)i=this._abiCoder.decode(e.inputs,r.slice(4)),u=e.name,l=e.signature,e.reason&&(s=i[0]),"Error"===u?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(i[0])}`:"Panic"===u&&(o=`; VM Exception while processing transaction: reverted with panic code ${i[0]}`);else try{const e=this.getError(t);i=this._abiCoder.decode(e.inputs,r.slice(4)),u=e.name,l=e.format()}catch(t){}break}}return gt.throwError("call revert exception"+o,c.errors.CALL_EXCEPTION,{method:t.format(),data:a(e),errorArgs:i,errorName:u,errorSignature:l,reason:s})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),a(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&gt.throwError("too many arguments for "+t.format(),c.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?u(e):"bytes"===t.type?p(a(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=l.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),s(a(e),32));for(e.forEach(((e,a)=>{let s=t.inputs[a];s.indexed?null==e?r.push(null):"array"===s.baseType||"tuple"===s.baseType?gt.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,e):Array.isArray(e)?r.push(e.map((t=>n(s,t)))):r.push(n(s,e)):null!=e&&gt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],a=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&gt.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,s)=>{const o=e[s];if(t.indexed)if("string"===t.type)r.push(u(o));else if("bytes"===t.type)r.push(p(o));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[o]))}else n.push(t),a.push(o)})),{data:this._abiCoder.encode(n,a),topics:r}}decodeEventLog(t,e,n){if("string"==typeof t&&(t=this.getEvent(t)),null!=n&&!t.anonymous){let e=this.getEventTopic(t);i(n[0],32)&&n[0].toLowerCase()===e||gt.throwError("fragment/topic mismatch",c.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:n[0]}),n=n.slice(1)}let a=[],s=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(a.push(F.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(a.push(t),o.push(!1)):(s.push(t),o.push(!1))}));let u=null!=n?this._abiCoder.decode(a,r(n)):null,l=this._abiCoder.decode(s,e,!0),h=[],m=0,p=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==u)h[e]=new wt({_isIndexed:!0,hash:null});else if(o[e])h[e]=new wt({_isIndexed:!0,hash:u[p++]});else try{h[e]=u[p++]}catch(t){h[e]=t}else try{h[e]=l[m++]}catch(t){h[e]=t}if(t.name&&null==h[t.name]){const r=h[e];r instanceof Error?Object.defineProperty(h,t.name,{enumerable:!0,get:()=>{throw vt(`property ${JSON.stringify(t.name)}`,r)}}):h[t.name]=r}}));for(let t=0;t<h.length;t++){const e=h[t];e instanceof Error&&Object.defineProperty(h,t,{enumerable:!0,get:()=>{throw vt(`index ${t}`,e)}})}return Object.freeze(h)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new yt({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:l.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new ft({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=a(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new bt({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}export{pt as A,k as C,U as E,M as F,_t as I,ft as L,F as P,yt as T,z as a,L as b,N as c,dt as d,G as e,wt as f};
1
+ import{getAddress as t}from"@ethersproject/address";import{hexConcat as e,concat as r,arrayify as n,hexlify as a,hexZeroPad as s,hexDataSlice as o,isHexString as i}from"@ethersproject/bytes";import{i as u}from"./id-0a46be36.js";import{L as c,B as l,t as h,b as m,k as p}from"./index-16c75eee.js";import{defineReadOnly as d,Description as g,getStatic as f}from"@ethersproject/properties";import{MaxUint256 as y,One as b,NegativeOne as w,Zero as E}from"@ethersproject/constants";const v="abi/5.7.0",_=new c(v),A={};let x={calldata:!0,memory:!0,storage:!0},O={calldata:!0,memory:!0};function S(t,e){if("bytes"===t||"string"===t){if(x[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&O[e])return!0;return(x[e]||"payable"===e)&&_.throwArgumentError("invalid modifier","name",e),!1}function j(t,e){for(let r in e)d(t,r,e[r])}const N=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),T=new RegExp(/^(.*)\[([0-9]*)\]$/);class F{constructor(t,e){t!==A&&_.throwError("use fromString",c.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),j(this,e);let r=this.type.match(T);j(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:F.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==N.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===N.full?", ":",")+")"):e+=this.type,t!==N.sighash&&(!0===this.indexed&&(e+=" indexed"),t===N.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?F.fromString(t,e):F.fromObject(t)}static fromObject(t){return F.isParamType(t)?t:new F(A,{name:t.name||null,type:$(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(F.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){_.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function a(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let s={type:"",name:"",state:{allowType:!0}},o=s;for(let r=0;r<t.length;r++){let s=t[r];switch(s){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=$(o.type),o.components=[a(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(e||n(r),o.indexed=!0,o.name=""),S(o.type,o.name)&&(o.name=""),o.type=$(o.type);let t=o;o=o.parent,o||n(r),delete t.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(e||n(r),o.indexed=!0,o.name=""),S(o.type,o.name)&&(o.name=""),o.type=$(o.type);let i=a(o.parent);o.parent.components.push(i),delete o.parent,o=i;break;case" ":o.state.allowType&&""!==o.type&&(o.type=$(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(e||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):S(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(r)}}return o.parent&&_.throwArgumentError("unexpected eof","param",t),delete s.state,"indexed"===o.name?(e||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):S(o.type,o.name)&&(o.name=""),s.type=$(s.type),s}(t,!!e),F.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function V(t,e){return function(t){t=t.trim();let e=[],r="",n=0;for(let a=0;a<t.length;a++){let s=t[a];","===s&&0===n?(e.push(r),r=""):(r+=s,"("===s?n++:")"===s&&(n--,-1===n&&_.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>F.fromString(t,e)))}class M{constructor(t,e){t!==A&&_.throwError("use a static from method",c.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),j(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return M.isFragment(t)?t:"string"==typeof t?M.fromString(t):M.fromObject(t)}static fromObject(t){if(M.isFragment(t))return t;switch(t.type){case"function":return L.fromObject(t);case"event":return z.fromObject(t);case"constructor":return k.fromObject(t);case"error":return U.fromObject(t);case"fallback":case"receive":return null}return _.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?z.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?L.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?k.fromString(t.trim()):"error"===t.split(" ")[0]?U.fromString(t.substring(5).trim()):_.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class z extends M{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==N.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ",t!==N.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?z.fromString(t):z.fromObject(t)}static fromObject(t){if(z.isEventFragment(t))return t;"event"!==t.type&&_.throwArgumentError("invalid event object","value",t);const e={name:D(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(F.fromObject):[],type:"event"};return new z(A,e)}static fromString(t){let e=t.match(J);e||_.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:_.warn("unknown modifier: "+t)}})),z.fromObject({name:e[1].trim(),anonymous:r,inputs:V(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function R(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&_.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||_.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=l.from(r[1]),r[0]):t}function C(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function P(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&_.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&_.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||_.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&_.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&_.throwArgumentError("unable to determine stateMutability","value",t),e}class k extends M{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===N.sighash&&_.throwError("cannot format a constructor for sighash",c.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?k.fromString(t):k.fromObject(t)}static fromObject(t){if(k.isConstructorFragment(t))return t;"constructor"!==t.type&&_.throwArgumentError("invalid constructor object","value",t);let e=P(t);e.constant&&_.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(F.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?l.from(t.gas):null};return new k(A,r)}static fromString(t){let e={type:"constructor"},r=(t=R(t,e)).match(J);return r&&"constructor"===r[1].trim()||_.throwArgumentError("invalid constructor string","value",t),e.inputs=V(r[2].trim(),!1),C(r[3].trim(),e),k.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class L extends k{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==N.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ",t!==N.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?L.fromString(t):L.fromObject(t)}static fromObject(t){if(L.isFunctionFragment(t))return t;"function"!==t.type&&_.throwArgumentError("invalid function object","value",t);let e=P(t);const r={type:t.type,name:D(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(F.fromObject):[],outputs:t.outputs?t.outputs.map(F.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?l.from(t.gas):null};return new L(A,r)}static fromString(t){let e={type:"function"},r=(t=R(t,e)).split(" returns ");r.length>2&&_.throwArgumentError("invalid function string","value",t);let n=r[0].match(J);if(n||_.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&D(e.name),e.inputs=V(n[2],!1),C(n[3].trim(),e),r.length>1){let n=r[1].match(J);""==n[1].trim()&&""==n[3].trim()||_.throwArgumentError("unexpected tokens","value",t),e.outputs=V(n[2],!1)}else e.outputs=[];return L.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function I(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||_.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class U extends M{format(t){if(t||(t=N.sighash),N[t]||_.throwArgumentError("invalid format type","format",t),t===N.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==N.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===N.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?U.fromString(t):U.fromObject(t)}static fromObject(t){if(U.isErrorFragment(t))return t;"error"!==t.type&&_.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:D(t.name),inputs:t.inputs?t.inputs.map(F.fromObject):[]};return I(new U(A,e))}static fromString(t){let e={type:"error"},r=t.match(J);return r||_.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&D(e.name),e.inputs=V(r[2],!1),I(U.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function $(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const B=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function D(t){return t&&t.match(B)||_.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const J=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const W=new c(v);function G(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let a in n){const s=t.slice();s.push(a);try{r(s,n[a])}catch(t){e.push({path:s,error:t})}}};return r([],t),e}class Z{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){W.throwArgumentError(t,this.localName,e)}}class H{constructor(t){d(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return e(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(r(t._data))}writeBytes(t){let e=n(t);const a=e.length%this.wordSize;return a&&(e=r([e,this._padding.slice(a)])),this._writeData(e)}_getValue(t){let e=n(l.from(t));return e.length>this.wordSize&&W.throwError("value out-of-bounds",c.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=r([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class X{constructor(t,e,r,a){d(this,"_data",n(t)),d(this,"wordSize",e||32),d(this,"_coerceFunc",r),d(this,"allowLoose",a),this._offset=0}get data(){return a(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):X.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:W.throwError("data out-of-bounds",c.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new X(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return l.from(this.readBytes(this.wordSize))}}class q extends Z{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=t(r)}catch(t){this._throwError(t.message,r)}return e.writeValue(r)}decode(e){return t(s(e.readValue().toHexString(),20))}}class K extends Z{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const Q=new c(v);function Y(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||Q.throwError("cannot encode object for signature with missing names",c.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&Q.throwError("cannot encode object for signature with duplicate names",c.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else Q.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&Q.throwArgumentError("types/value length mismatch","tuple",r);let a=new H(t.wordSize),s=new H(t.wordSize),o=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=s.length;t.encode(s,r);let n=a.writeUpdatableValue();o.push((t=>{n(t+e)}))}else t.encode(a,r)})),o.forEach((t=>{t(a.length)}));let i=t.appendWriter(a);return i+=t.appendWriter(s),i}function tt(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let a=null;if(e.dynamic){let r=t.readValue(),s=n.subReader(r.toNumber());try{a=e.decode(s)}catch(t){if(t.code===c.errors.BUFFER_OVERRUN)throw t;a=t,a.baseType=e.name,a.name=e.localName,a.type=e.type}}else try{a=e.decode(t)}catch(t){if(t.code===c.errors.BUFFER_OVERRUN)throw t;a=t,a.baseType=e.name,a.name=e.localName,a.type=e.type}null!=a&&r.push(a)}));const a=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==a[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const s=r[e];s instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw s}}):r[n]=s}));for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(r)}class et extends Z{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),Q.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let t=0;t<e.length;t++)n.push(this.coder);return Y(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&Q.throwError("insufficient data length",c.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new K(this.coder));return t.coerce(this.name,tt(t,r))}}class rt extends Z{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class nt extends Z{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=n(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class at extends nt{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,a(super.decode(t)))}}class st extends Z{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let r=n(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,a(t.readBytes(this.size)))}}class ot extends Z{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}class it extends Z{constructor(t,e,r){const n=(e?"int":"uint")+8*t;super(n,n,r,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let r=l.from(e),n=y.mask(8*t.wordSize);if(this.signed){let t=n.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(b).mul(w)))&&this._throwError("value out-of-bounds",e)}else(r.lt(E)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}class ut extends nt{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,h(e))}decode(t){return m(super.decode(t))}}class ct extends Z{constructor(t,e){let r=!1;const n=[];t.forEach((t=>{t.dynamic&&(r=!0),n.push(t.type)}));super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let a=r.localName;a&&1===e[a]&&("length"===a&&(a="_length"),null==t[a]&&(t[a]=t[n]))})),Object.freeze(t)}encode(t,e){return Y(t,this.coders,e)}decode(t){return t.coerce(this.name,tt(t,this.coders))}}const lt=new c(v),ht=new RegExp(/^bytes([0-9]*)$/),mt=new RegExp(/^(u?int)([0-9]*)$/);class pt{constructor(t){d(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new q(t.name);case"bool":return new rt(t.name);case"string":return new ut(t.name);case"bytes":return new at(t.name);case"array":return new et(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new ct((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new ot(t.name)}let e=t.type.match(mt);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&lt.throwArgumentError("invalid "+e[1]+" bit length","param",t),new it(r/8,"int"===e[1],t.name)}if(e=t.type.match(ht),e){let r=parseInt(e[1]);return(0===r||r>32)&&lt.throwArgumentError("invalid bytes length","param",t),new st(r,t.name)}return lt.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new X(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new H(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(F.from(t))));return new ct(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&lt.throwError("types/values length mismatch",c.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(F.from(t)))),n=new ct(r,"_"),a=this._getWriter();return n.encode(a,e),a.data}decode(t,e,r){const a=t.map((t=>this._getCoder(F.from(t))));return new ct(a,"_").decode(this._getReader(n(e),r))}}const dt=new pt,gt=new c(v);class ft extends g{}class yt extends g{}class bt extends g{}class wt extends g{static isIndexed(t){return!(!t||!t._isIndexed)}}const Et={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vt(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class _t{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,d(this,"fragments",e.map((t=>M.from(t))).filter((t=>null!=t))),d(this,"_abiCoder",f(new.target,"getAbiCoder")()),d(this,"functions",{}),d(this,"errors",{}),d(this,"events",{}),d(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void gt.warn("duplicate definition - constructor"):void d(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?gt.warn("duplicate definition - "+r):e[r]=t})),this.deploy||d(this,"deploy",k.from({payable:!1,type:"constructor"})),d(this,"_isInterface",!0)}format(t){t||(t=N.full),t===N.sighash&&gt.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===N.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return dt}static getAddress(e){return t(e)}static getSighash(t){return o(u(t.format()),0,4)}static getEventTopic(t){return u(t.format())}getFunction(t){if(i(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];gt.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?gt.throwArgumentError("no matching function","name",e):r.length>1&&gt.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[L.fromString(t).format()];return e||gt.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(i(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];gt.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?gt.throwArgumentError("no matching event","name",e):r.length>1&&gt.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[z.fromString(t).format()];return e||gt.throwArgumentError("no matching event","signature",t),e}getError(t){if(i(t)){const e=f(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}gt.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?gt.throwArgumentError("no matching error","name",e):r.length>1&&gt.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[L.fromString(t).format()];return e||gt.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return f(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),f(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=n(e);return a(r.slice(0,4))!==this.getSighash(t)&&gt.throwArgumentError(`data signature does not match error ${t.name}.`,"data",a(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),a(r([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=n(e);return a(r.slice(0,4))!==this.getSighash(t)&&gt.throwArgumentError(`data signature does not match function ${t.name}.`,"data",a(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),a(r([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=n(e),s=null,o="",i=null,u=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=a(r.slice(0,4)),e=Et[t];if(e)i=this._abiCoder.decode(e.inputs,r.slice(4)),u=e.name,l=e.signature,e.reason&&(s=i[0]),"Error"===u?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(i[0])}`:"Panic"===u&&(o=`; VM Exception while processing transaction: reverted with panic code ${i[0]}`);else try{const e=this.getError(t);i=this._abiCoder.decode(e.inputs,r.slice(4)),u=e.name,l=e.format()}catch(t){}break}}return gt.throwError("call revert exception"+o,c.errors.CALL_EXCEPTION,{method:t.format(),data:a(e),errorArgs:i,errorName:u,errorSignature:l,reason:s})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),a(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&gt.throwError("too many arguments for "+t.format(),c.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?u(e):"bytes"===t.type?p(a(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=l.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),s(a(e),32));for(e.forEach(((e,a)=>{let s=t.inputs[a];s.indexed?null==e?r.push(null):"array"===s.baseType||"tuple"===s.baseType?gt.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,e):Array.isArray(e)?r.push(e.map((t=>n(s,t)))):r.push(n(s,e)):null!=e&&gt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],a=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&gt.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,s)=>{const o=e[s];if(t.indexed)if("string"===t.type)r.push(u(o));else if("bytes"===t.type)r.push(p(o));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[o]))}else n.push(t),a.push(o)})),{data:this._abiCoder.encode(n,a),topics:r}}decodeEventLog(t,e,n){if("string"==typeof t&&(t=this.getEvent(t)),null!=n&&!t.anonymous){let e=this.getEventTopic(t);i(n[0],32)&&n[0].toLowerCase()===e||gt.throwError("fragment/topic mismatch",c.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:n[0]}),n=n.slice(1)}let a=[],s=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(a.push(F.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(a.push(t),o.push(!1)):(s.push(t),o.push(!1))}));let u=null!=n?this._abiCoder.decode(a,r(n)):null,l=this._abiCoder.decode(s,e,!0),h=[],m=0,p=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==u)h[e]=new wt({_isIndexed:!0,hash:null});else if(o[e])h[e]=new wt({_isIndexed:!0,hash:u[p++]});else try{h[e]=u[p++]}catch(t){h[e]=t}else try{h[e]=l[m++]}catch(t){h[e]=t}if(t.name&&null==h[t.name]){const r=h[e];r instanceof Error?Object.defineProperty(h,t.name,{enumerable:!0,get:()=>{throw vt(`property ${JSON.stringify(t.name)}`,r)}}):h[t.name]=r}}));for(let t=0;t<h.length;t++){const e=h[t];e instanceof Error&&Object.defineProperty(h,t,{enumerable:!0,get:()=>{throw vt(`index ${t}`,e)}})}return Object.freeze(h)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new yt({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:l.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new ft({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=a(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new bt({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}export{pt as A,k as C,U as E,M as F,_t as I,ft as L,F as P,yt as T,z as a,L as b,N as c,dt as d,G as e,wt as f};
@@ -1 +1 @@
1
- import{c as r}from"./index-446c71f4.js";import{r as t}from"./sha256-8f491017.js";var o,i,e={exports:{}},n={exports:{}};function a(){return o?n.exports:(o=1,n.exports=(f=t(),e=(i=f).lib,a=e.Base,s=e.WordArray,(h=i.x64={}).Word=a.extend({init:function(r,t){this.high=r,this.low=t}}),h.WordArray=a.extend({init:function(t,o){t=this.words=t||[],this.sigBytes=o!=r?o:8*t.length},toX32:function(){for(var r=this.words,t=r.length,o=[],i=0;i<t;i++){var e=r[i];o.push(e.high),o.push(e.low)}return s.create(o,this.sigBytes)},clone:function(){for(var r=a.clone.call(this),t=r.words=this.words.slice(0),o=t.length,i=0;i<o;i++)t[i]=t[i].clone();return r}}),f));var r,i,e,a,s,h,f}e.exports=(i=t(),a(),function(r){var t=i,o=t.lib,e=o.WordArray,n=o.Hasher,a=t.x64.Word,s=t.algo,h=[],f=[],c=[];!function(){for(var r=1,t=0,o=0;o<24;o++){h[r+5*t]=(o+1)*(o+2)/2%64;var i=(2*r+3*t)%5;r=t%5,t=i}for(r=0;r<5;r++)for(t=0;t<5;t++)f[r+5*t]=t+(2*r+3*t)%5*5;for(var e=1,n=0;n<24;n++){for(var s=0,l=0,g=0;g<7;g++){if(1&e){var u=(1<<g)-1;u<32?l^=1<<u:s^=1<<u-32}128&e?e=e<<1^113:e<<=1}c[n]=a.create(s,l)}}();var l=[];!function(){for(var r=0;r<25;r++)l[r]=a.create()}();var g=s.SHA3=n.extend({cfg:n.cfg.extend({outputLength:512}),_doReset:function(){for(var r=this._state=[],t=0;t<25;t++)r[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(r,t){for(var o=this._state,i=this.blockSize/2,e=0;e<i;e++){var n=r[t+2*e],a=r[t+2*e+1];n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(W=o[e]).high^=a,W.low^=n}for(var s=0;s<24;s++){for(var g=0;g<5;g++){for(var u=0,v=0,y=0;y<5;y++)u^=(W=o[g+5*y]).high,v^=W.low;var p=l[g];p.high=u,p.low=v}for(g=0;g<5;g++){var w=l[(g+4)%5],d=l[(g+1)%5],A=d.high,x=d.low;for(u=w.high^(A<<1|x>>>31),v=w.low^(x<<1|A>>>31),y=0;y<5;y++)(W=o[g+5*y]).high^=u,W.low^=v}for(var _=1;_<25;_++){var b=(W=o[_]).high,B=W.low,H=h[_];H<32?(u=b<<H|B>>>32-H,v=B<<H|b>>>32-H):(u=B<<H-32|b>>>64-H,v=b<<H-32|B>>>64-H);var m=l[f[_]];m.high=u,m.low=v}var S=l[0],U=o[0];for(S.high=U.high,S.low=U.low,g=0;g<5;g++)for(y=0;y<5;y++){var W=o[_=g+5*y],L=l[_],k=l[(g+1)%5+5*y],z=l[(g+2)%5+5*y];W.high=L.high^~k.high&z.high,W.low=L.low^~k.low&z.low}W=o[0];var F=c[s];W.high^=F.high,W.low^=F.low}},_doFinalize:function(){var t=this._data,o=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;o[i>>>5]|=1<<24-i%32,o[(r.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*o.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,h=s/8,f=[],c=0;c<h;c++){var l=a[c],g=l.high,u=l.low;g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8),u=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),f.push(u),f.push(g)}return new e.init(f,s)},clone:function(){for(var r=n.clone.call(this),t=r._state=this._state.slice(0),o=0;o<25;o++)t[o]=t[o].clone();return r}});t.SHA3=n._createHelper(g),t.HmacSHA3=n._createHmacHelper(g)}(Math),i.SHA3);var s={exports:{}};s.exports=function(r){return function(){if("function"==typeof ArrayBuffer){var t=r.lib.WordArray,o=t.init,i=t.init=function(r){if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),(r instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(r=new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),r instanceof Uint8Array){for(var t=r.byteLength,i=[],e=0;e<t;e++)i[e>>>2]|=r[e]<<24-e%4*8;o.call(this,i,t)}else o.apply(this,arguments)};i.prototype=t}}(),r.lib.WordArray}(t());export{s as l,a as r,e as s};
1
+ import{c as r}from"./index-16c75eee.js";import{r as t}from"./sha256-9e7d3d05.js";var o,i,e={exports:{}},n={exports:{}};function a(){return o?n.exports:(o=1,n.exports=(f=t(),e=(i=f).lib,a=e.Base,s=e.WordArray,(h=i.x64={}).Word=a.extend({init:function(r,t){this.high=r,this.low=t}}),h.WordArray=a.extend({init:function(t,o){t=this.words=t||[],this.sigBytes=o!=r?o:8*t.length},toX32:function(){for(var r=this.words,t=r.length,o=[],i=0;i<t;i++){var e=r[i];o.push(e.high),o.push(e.low)}return s.create(o,this.sigBytes)},clone:function(){for(var r=a.clone.call(this),t=r.words=this.words.slice(0),o=t.length,i=0;i<o;i++)t[i]=t[i].clone();return r}}),f));var r,i,e,a,s,h,f}e.exports=(i=t(),a(),function(r){var t=i,o=t.lib,e=o.WordArray,n=o.Hasher,a=t.x64.Word,s=t.algo,h=[],f=[],c=[];!function(){for(var r=1,t=0,o=0;o<24;o++){h[r+5*t]=(o+1)*(o+2)/2%64;var i=(2*r+3*t)%5;r=t%5,t=i}for(r=0;r<5;r++)for(t=0;t<5;t++)f[r+5*t]=t+(2*r+3*t)%5*5;for(var e=1,n=0;n<24;n++){for(var s=0,l=0,g=0;g<7;g++){if(1&e){var u=(1<<g)-1;u<32?l^=1<<u:s^=1<<u-32}128&e?e=e<<1^113:e<<=1}c[n]=a.create(s,l)}}();var l=[];!function(){for(var r=0;r<25;r++)l[r]=a.create()}();var g=s.SHA3=n.extend({cfg:n.cfg.extend({outputLength:512}),_doReset:function(){for(var r=this._state=[],t=0;t<25;t++)r[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(r,t){for(var o=this._state,i=this.blockSize/2,e=0;e<i;e++){var n=r[t+2*e],a=r[t+2*e+1];n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(W=o[e]).high^=a,W.low^=n}for(var s=0;s<24;s++){for(var g=0;g<5;g++){for(var u=0,v=0,y=0;y<5;y++)u^=(W=o[g+5*y]).high,v^=W.low;var p=l[g];p.high=u,p.low=v}for(g=0;g<5;g++){var w=l[(g+4)%5],d=l[(g+1)%5],A=d.high,x=d.low;for(u=w.high^(A<<1|x>>>31),v=w.low^(x<<1|A>>>31),y=0;y<5;y++)(W=o[g+5*y]).high^=u,W.low^=v}for(var _=1;_<25;_++){var b=(W=o[_]).high,B=W.low,H=h[_];H<32?(u=b<<H|B>>>32-H,v=B<<H|b>>>32-H):(u=B<<H-32|b>>>64-H,v=b<<H-32|B>>>64-H);var m=l[f[_]];m.high=u,m.low=v}var S=l[0],U=o[0];for(S.high=U.high,S.low=U.low,g=0;g<5;g++)for(y=0;y<5;y++){var W=o[_=g+5*y],L=l[_],k=l[(g+1)%5+5*y],z=l[(g+2)%5+5*y];W.high=L.high^~k.high&z.high,W.low=L.low^~k.low&z.low}W=o[0];var F=c[s];W.high^=F.high,W.low^=F.low}},_doFinalize:function(){var t=this._data,o=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;o[i>>>5]|=1<<24-i%32,o[(r.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*o.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,h=s/8,f=[],c=0;c<h;c++){var l=a[c],g=l.high,u=l.low;g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8),u=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),f.push(u),f.push(g)}return new e.init(f,s)},clone:function(){for(var r=n.clone.call(this),t=r._state=this._state.slice(0),o=0;o<25;o++)t[o]=t[o].clone();return r}});t.SHA3=n._createHelper(g),t.HmacSHA3=n._createHmacHelper(g)}(Math),i.SHA3);var s={exports:{}};s.exports=function(r){return function(){if("function"==typeof ArrayBuffer){var t=r.lib.WordArray,o=t.init,i=t.init=function(r){if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),(r instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(r=new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),r instanceof Uint8Array){for(var t=r.byteLength,i=[],e=0;e<t;e++)i[e>>>2]|=r[e]<<24-e%4*8;o.call(this,i,t)}else o.apply(this,arguments)};i.prototype=t}}(),r.lib.WordArray}(t());export{s as l,a as r,e as s};
@@ -1,4 +1,4 @@
1
- import{z as e,c as t,_ as r,A as n}from"./index-446c71f4.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";var i={exports:{}},o=e(i.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=262)}([function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){(function(e){
1
+ import{z as e,c as t,_ as r,A as n}from"./index-16c75eee.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";var i={exports:{}},o=e(i.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=262)}([function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){(function(e){
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *
@@ -1 +1 @@
1
- import{_ as e}from"./index-446c71f4.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],o=["https://oec.cocoswap.com"];class s{constructor(){console.log("start initialize openblockinpage provider"),this.callBackList={},this.eventListener={},this.isMetaMask=!0,this.isOpenBlock=!0,this.chainId=null,this.networkVersion=null,this.selectedAddress=null,this.request=this.request.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.on=this.on.bind(this),this.isConnected=this.isConnected.bind(this),this.enable=this.enable.bind(this),this._metamask=this._getExperimentalApi(),this._initInpageListener(),this.getProviderData()}getProviderData(){var t;return e(this,void 0,void 0,(function*(){const e=yield this.request("metamask_getProviderState");this.chainId=null==e?void 0:e.chainId,this.networkVersion=null==e?void 0:e.networkVersion,this.selectedAddress=null===(t=null==e?void 0:e.accounts)||void 0===t?void 0:t[0]}))}request(t){return e(this,void 0,void 0,(function*(){if("eth_requestAccounts"===t.method){const e=yield this._hookRequest("eth_accounts");if(e.length)return new Promise((t=>t(e)))}return this._hookRequest(t)}))}send(...t){return e(this,void 0,void 0,(function*(){if("function"!=typeof t[1])return"string"==typeof t[0]?this.request({method:t[0],params:t[1]}):1===t.length?this.request(t):void 0;this.sendAsync(t[0],t[1])}))}sendAsync(...t){return e(this,void 0,void 0,(function*(){const e={method:t[0].method,params:t[0].params},i=t[0].id;this.request(e).then((e=>{t[1](null,{id:i,jsonrpc:"2.0",result:e})})).catch((e=>{t[1](null,{id:i,jsonrpc:"2.0",error:e})}))}))}isConnected(){return!0}enable(){return e(this,void 0,void 0,(function*(){const e=yield this._hookRequest("eth_accounts");return e.length?new Promise((t=>t(e))):this.request({method:"eth_requestAccounts"})}))}on(e,t){"string"==typeof e&&"function"==typeof t&&(this.eventListener[e]&&this.eventListener[e].length>5||(this.eventListener[e]?(this.eventListener[e].push(t),this.eventListener[e]=Array.from(new Set(this.eventListener[e]))):this.eventListener[e]||(this.eventListener=Object.assign(Object.assign({},this.eventListener),{[e]:[t]})),this._registerEvent(e)))}removeListener(){}_initInpageListener(){window.addEventListener("message",(e=>{var i,n,o;if(e.data.target!==t)return;const s=null===(o=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===o?void 0:o.mark;s&&("call_method"===s.type?this._handleNormalMethod(s,e):"register_event"===s.type&&this._handleEventMethod(s,e))}),!1)}_handleNormalMethod(e,t){var i,n,o,s,r;(null===(i=t.data.value.data)||void 0===i?void 0:i.error)?null===(n=this.callBackList[e.id])||void 0===n||n.reject(null===(o=t.data.value.data)||void 0===o?void 0:o.error):null===(s=this.callBackList[e.id])||void 0===s||s.resolve(null===(r=t.data.value.data)||void 0===r?void 0:r.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,s,r,a,d,h,l;const c=null===(a=null===(r=null===(s=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===s?void 0:s.data)||void 0===r?void 0:r.mark)||void 0===a?void 0:a.eventName,u=null===(l=null===(h=null===(d=t.data)||void 0===d?void 0:d.value)||void 0===h?void 0:h.data)||void 0===l?void 0:l.params;if(c){const e=this.eventListener[c];if(!e)return void("https://app.openocean.finance"===window.location.origin&&window.location.reload());e.forEach((e=>{"chainChanged"===c&&(this.chainId=u,this.networkVersion=Number(u)),o.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,o)=>{const s=(()=>{function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+e()+e()+e()+e()+e()+e()})();"string"==typeof e&&(e={method:e}),e=Object.assign(Object.assign({},e),{mark:{id:s,method:e.method,type:"call_method"}}),window.parent.postMessage({from:t,target:i,data:e},"*"),this.callBackList[s]={resolve:n,reject:o}}))}_registerEvent(e){const n={mark:{eventName:e,type:"register_event"},eventName:e};window.parent.postMessage({from:t,target:i,data:n},"*")}_getExperimentalApi(){return new Proxy({isUnlocked:()=>new Promise((e=>e(!0)))},{get:(e,t,...i)=>Reflect.get(e,t,...i)})}}function r(){var e;if(null===(e=window.obethereum)||void 0===e?void 0:e.isOpenBlock)return window.obethereum;let t=new s;t=new Proxy(t,{deleteProperty:()=>!0});try{Object.defineProperty(window,"obethereum",{set(e){console.log("set ethereum",e)},get:()=>t})}catch(e){console.log("initializeProvider error",e),window.obethereum=t}return window.web3=Object.assign({},window.web3),window.web3.currentProvider=t,window.dispatchEvent(new Event("ethereum#initialized")),t}export{r as default};
1
+ import{_ as e}from"./index-16c75eee.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],o=["https://oec.cocoswap.com"];class s{constructor(){console.log("start initialize openblockinpage provider"),this.callBackList={},this.eventListener={},this.isMetaMask=!0,this.isOpenBlock=!0,this.chainId=null,this.networkVersion=null,this.selectedAddress=null,this.request=this.request.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.on=this.on.bind(this),this.isConnected=this.isConnected.bind(this),this.enable=this.enable.bind(this),this._metamask=this._getExperimentalApi(),this._initInpageListener(),this.getProviderData()}getProviderData(){var t;return e(this,void 0,void 0,(function*(){const e=yield this.request("metamask_getProviderState");this.chainId=null==e?void 0:e.chainId,this.networkVersion=null==e?void 0:e.networkVersion,this.selectedAddress=null===(t=null==e?void 0:e.accounts)||void 0===t?void 0:t[0]}))}request(t){return e(this,void 0,void 0,(function*(){if("eth_requestAccounts"===t.method){const e=yield this._hookRequest("eth_accounts");if(e.length)return new Promise((t=>t(e)))}return this._hookRequest(t)}))}send(...t){return e(this,void 0,void 0,(function*(){if("function"!=typeof t[1])return"string"==typeof t[0]?this.request({method:t[0],params:t[1]}):1===t.length?this.request(t):void 0;this.sendAsync(t[0],t[1])}))}sendAsync(...t){return e(this,void 0,void 0,(function*(){const e={method:t[0].method,params:t[0].params},i=t[0].id;this.request(e).then((e=>{t[1](null,{id:i,jsonrpc:"2.0",result:e})})).catch((e=>{t[1](null,{id:i,jsonrpc:"2.0",error:e})}))}))}isConnected(){return!0}enable(){return e(this,void 0,void 0,(function*(){const e=yield this._hookRequest("eth_accounts");return e.length?new Promise((t=>t(e))):this.request({method:"eth_requestAccounts"})}))}on(e,t){"string"==typeof e&&"function"==typeof t&&(this.eventListener[e]&&this.eventListener[e].length>5||(this.eventListener[e]?(this.eventListener[e].push(t),this.eventListener[e]=Array.from(new Set(this.eventListener[e]))):this.eventListener[e]||(this.eventListener=Object.assign(Object.assign({},this.eventListener),{[e]:[t]})),this._registerEvent(e)))}removeListener(){}_initInpageListener(){window.addEventListener("message",(e=>{var i,n,o;if(e.data.target!==t)return;const s=null===(o=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===o?void 0:o.mark;s&&("call_method"===s.type?this._handleNormalMethod(s,e):"register_event"===s.type&&this._handleEventMethod(s,e))}),!1)}_handleNormalMethod(e,t){var i,n,o,s,r;(null===(i=t.data.value.data)||void 0===i?void 0:i.error)?null===(n=this.callBackList[e.id])||void 0===n||n.reject(null===(o=t.data.value.data)||void 0===o?void 0:o.error):null===(s=this.callBackList[e.id])||void 0===s||s.resolve(null===(r=t.data.value.data)||void 0===r?void 0:r.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,s,r,a,d,h,l;const c=null===(a=null===(r=null===(s=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===s?void 0:s.data)||void 0===r?void 0:r.mark)||void 0===a?void 0:a.eventName,u=null===(l=null===(h=null===(d=t.data)||void 0===d?void 0:d.value)||void 0===h?void 0:h.data)||void 0===l?void 0:l.params;if(c){const e=this.eventListener[c];if(!e)return void("https://app.openocean.finance"===window.location.origin&&window.location.reload());e.forEach((e=>{"chainChanged"===c&&(this.chainId=u,this.networkVersion=Number(u)),o.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,o)=>{const s=(()=>{function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+e()+e()+e()+e()+e()+e()})();"string"==typeof e&&(e={method:e}),e=Object.assign(Object.assign({},e),{mark:{id:s,method:e.method,type:"call_method"}}),window.parent.postMessage({from:t,target:i,data:e},"*"),this.callBackList[s]={resolve:n,reject:o}}))}_registerEvent(e){const n={mark:{eventName:e,type:"register_event"},eventName:e};window.parent.postMessage({from:t,target:i,data:n},"*")}_getExperimentalApi(){return new Proxy({isUnlocked:()=>new Promise((e=>e(!0)))},{get:(e,t,...i)=>Reflect.get(e,t,...i)})}}function r(){var e;if(null===(e=window.obethereum)||void 0===e?void 0:e.isOpenBlock)return window.obethereum;let t=new s;t=new Proxy(t,{deleteProperty:()=>!0});try{Object.defineProperty(window,"obethereum",{set(e){console.log("set ethereum",e)},get:()=>t})}catch(e){console.log("initializeProvider error",e),window.obethereum=t}return window.web3=Object.assign({},window.web3),window.web3.currentProvider=t,window.dispatchEvent(new Event("ethereum#initialized")),t}export{r as default};
@@ -331,10 +331,9 @@ export default function connector(params: ConnectorParams, events: ConnectEvents
331
331
  nonceKey: bigint;
332
332
  stateOverride: import("viem").StateOverride;
333
333
  } & ({
334
- paymasterAndData: `0x${string}`;
334
+ paymasterAndData: "0x";
335
335
  } | {
336
- paymasterData: `0x${string}`;
337
- paymaster: `0x${string}`;
336
+ paymasterData: "0x";
338
337
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
339
338
  multiplier: number;
340
339
  };
@@ -367,10 +366,9 @@ export default function connector(params: ConnectorParams, events: ConnectEvents
367
366
  nonceKey: bigint;
368
367
  stateOverride: import("viem").StateOverride;
369
368
  } & ({
370
- paymasterAndData: `0x${string}`;
369
+ paymasterAndData: "0x";
371
370
  } | {
372
- paymasterData: `0x${string}`;
373
- paymaster: `0x${string}`;
371
+ paymasterData: "0x";
374
372
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
375
373
  multiplier: number;
376
374
  };
@@ -706,10 +704,9 @@ export default function connector(params: ConnectorParams, events: ConnectEvents
706
704
  nonceKey: bigint;
707
705
  stateOverride: import("viem").StateOverride;
708
706
  } & ({
709
- paymasterAndData: `0x${string}`;
707
+ paymasterAndData: "0x";
710
708
  } | {
711
- paymasterData: `0x${string}`;
712
- paymaster: `0x${string}`;
709
+ paymasterData: "0x";
713
710
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
714
711
  multiplier: number;
715
712
  };
@@ -740,10 +737,9 @@ export default function connector(params: ConnectorParams, events: ConnectEvents
740
737
  nonceKey: bigint;
741
738
  stateOverride: import("viem").StateOverride;
742
739
  } & ({
743
- paymasterAndData: `0x${string}`;
740
+ paymasterAndData: "0x";
744
741
  } | {
745
- paymasterData: `0x${string}`;
746
- paymaster: `0x${string}`;
742
+ paymasterData: "0x";
747
743
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
748
744
  multiplier: number;
749
745
  };
@@ -4,7 +4,7 @@ import { JsonRpcSigner } from '@ethersproject/providers';
4
4
  import { AlchemySigner } from '@alchemy/aa-alchemy';
5
5
  import { ChainId } from '../../wallets';
6
6
  export declare const supportChainIds: ChainId[];
7
- export declare function getAlchemySigner(chainId: number): AlchemySigner;
7
+ export declare function getAlchemySigner(chainId: number, apiKeyObject: NonNullable<ConnectorParams['alchemyParams']>['apiKeyObject']): AlchemySigner;
8
8
  export declare function createProvider(params: ConnectorParams): Promise<{
9
9
  rpcUrl?: string | undefined;
10
10
  readonly smartAccountClient: {
@@ -494,10 +494,9 @@ export declare function getAlchemyConnector(params: ConnectorParams, events: Con
494
494
  nonceKey: bigint;
495
495
  stateOverride: import("viem").StateOverride;
496
496
  } & ({
497
- paymasterAndData: `0x${string}`;
497
+ paymasterAndData: "0x";
498
498
  } | {
499
- paymasterData: `0x${string}`;
500
- paymaster: `0x${string}`;
499
+ paymasterData: "0x";
501
500
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
502
501
  multiplier: number;
503
502
  };
@@ -530,10 +529,9 @@ export declare function getAlchemyConnector(params: ConnectorParams, events: Con
530
529
  nonceKey: bigint;
531
530
  stateOverride: import("viem").StateOverride;
532
531
  } & ({
533
- paymasterAndData: `0x${string}`;
532
+ paymasterAndData: "0x";
534
533
  } | {
535
- paymasterData: `0x${string}`;
536
- paymaster: `0x${string}`;
534
+ paymasterData: "0x";
537
535
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
538
536
  multiplier: number;
539
537
  };
@@ -869,10 +867,9 @@ export declare function getAlchemyConnector(params: ConnectorParams, events: Con
869
867
  nonceKey: bigint;
870
868
  stateOverride: import("viem").StateOverride;
871
869
  } & ({
872
- paymasterAndData: `0x${string}`;
870
+ paymasterAndData: "0x";
873
871
  } | {
874
- paymasterData: `0x${string}`;
875
- paymaster: `0x${string}`;
872
+ paymasterData: "0x";
876
873
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
877
874
  multiplier: number;
878
875
  };
@@ -903,10 +900,9 @@ export declare function getAlchemyConnector(params: ConnectorParams, events: Con
903
900
  nonceKey: bigint;
904
901
  stateOverride: import("viem").StateOverride;
905
902
  } & ({
906
- paymasterAndData: `0x${string}`;
903
+ paymasterAndData: "0x";
907
904
  } | {
908
- paymasterData: `0x${string}`;
909
- paymaster: `0x${string}`;
905
+ paymasterData: "0x";
910
906
  paymasterVerificationGasLimit: number | bigint | `0x${string}` | {
911
907
  multiplier: number;
912
908
  };
@@ -66,6 +66,9 @@ export type ConnectorParams = {
66
66
  wallet?: WalletEntryOption;
67
67
  };
68
68
  alchemyParams?: {
69
- authParams: AuthParams;
69
+ authParams: AuthParams | undefined;
70
+ apiKeyObject: {
71
+ [key: number]: string;
72
+ };
70
73
  };
71
74
  };
@@ -35,8 +35,6 @@ export declare const allWalletObject: {
35
35
  SocialLogin: Wallet;
36
36
  Alchemy: Wallet;
37
37
  Bybit: Wallet;
38
- Zerion: Wallet;
39
- Holdstation: Wallet;
40
38
  MetamaskWallet: Wallet;
41
39
  };
42
40
  export declare const standaloneList: Wallet[];
@@ -0,0 +1 @@
1
+ import{_ as e,N as o,O as t,A as r}from"./index-16c75eee.js";import{EthereumProvider as n}from"./index.es-8b3272b7.js";import"@ethersproject/address";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";import"./_commonjs-dynamic-modules-7cfc9805.js";function i({chainId:i,rpcUrl:c,rpc:s,walletConnectParams:a,darkMode:d},p){return e(this,void 0,void 0,(function*(){let l,m,h="wss://relay.walletconnect.com",u=!0;a&&(h=a.bridge||h,u=void 0!==a.qrcode?a.qrcode:u,a.infuraId,m=a.qrModalOptions||void 0),s?l=s:i&&c&&(l={[i]:c});const j=o(),b=yield n.init({projectId:null==a?void 0:a.projectId,chains:i?[i]:[],showQrModal:!j,rpcMap:l,qrModalOptions:Object.assign({themeMode:d?"dark":"light"},m)});return b.on("display_uri",(e=>{(null==m?void 0:m.openCallback)&&m.openCallback(e)})),b.on("connect",p.connect),b.on("disconnect",(e=>{p.disconnect(e),p.accountsChanged([])})),b.on("accountsChanged",p.accountsChanged),b.on("chainChanged",p.chainChanged),b.on("message",(({type:e,data:o})=>p.message(e,o))),new Promise((o=>e(this,void 0,void 0,(function*(){j?(b.once("display_uri",(e=>{let n=e;t()&&(n=`rainbow://wc?uri=${encodeURIComponent(e)}&connector=rainbowkit`),window.location.href=n,o(r(b))})),b.enable()):(yield b.enable(),o(r(b)))}))))}))}export{i as default};
@@ -0,0 +1 @@
1
+ import{c as e}from"./index-16c75eee.js";import{r,s as t}from"./sha256-9e7d3d05.js";var a,s={exports:{}};function o(){return a?s.exports:(a=1,s.exports=(p=r(),t.exports,o=(e=p).lib.WordArray,i=e.algo,n=i.SHA256,c=i.SHA224=n.extend({_doReset:function(){this._hash=new o.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),e.SHA224=n._createHelper(c),e.HmacSHA224=n._createHmacHelper(c),p.SHA224));var e,o,i,n,c,p}export{o as r};
@@ -1 +1 @@
1
- import{c as t,r as n}from"./index-446c71f4.js";import{c as r}from"./_commonjs-dynamic-modules-7cfc9805.js";var e,i={exports:{}};function o(){return e||(e=1,i.exports=(o=o||function(e,i){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),"undefined"!=typeof self&&self.crypto&&(o=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(o=globalThis.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==t&&t.crypto&&(o=t.crypto),!o&&"function"==typeof r)try{o=n}catch(t){}var s=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(n){var r;return t.prototype=n,r=new t,t.prototype=null,r}}(),c={},f=c.lib={},u=f.Base={extend:function(t){var n=a(this);return t&&n.mixIn(t),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},h=f.WordArray=u.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=i?n:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var n=this.words,r=t.words,e=this.sigBytes,i=t.sigBytes;if(this.clamp(),e%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;n[e+o>>>2]|=s<<24-(e+o)%4*8}else for(var a=0;a<i;a+=4)n[e+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(s());return new h.init(n,t)}}),p=c.enc={},d=p.Hex={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e+=2)r[e>>>3]|=parseInt(t.substr(e,2),16)<<24-e%8*4;return new h.init(r,n/2)}},l=p.Latin1={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e++)r[e>>>2]|=(255&t.charCodeAt(e))<<24-e%4*8;return new h.init(r,n)}},y=p.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},g=f.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=y.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,f=e.min(4*c,o);if(c){for(var u=0;u<c;u+=s)this._doProcessBlock(i,u);n=i.splice(0,c),r.sigBytes-=f}return new h.init(n,f)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});f.Hasher=g.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(n,r){return new t.init(r).finalize(n)}},_createHmacHelper:function(t){return function(n,r){return new w.HMAC.init(t,r).finalize(n)}}});var w=c.algo={};return c}(Math),o)),i.exports;var o}var s,a={exports:{}};a.exports=(s=o(),function(t){var n=s,r=n.lib,e=r.WordArray,i=r.Hasher,o=n.algo,a=[],c=[];!function(){function n(n){for(var r=t.sqrt(n),e=2;e<=r;e++)if(!(n%e))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var e=2,i=0;i<64;)n(e)&&(i<8&&(a[i]=r(t.pow(e,.5))),c[i]=r(t.pow(e,1/3)),i++),e++}();var f=[],u=o.SHA256=i.extend({_doReset:function(){this._hash=new e.init(a.slice(0))},_doProcessBlock:function(t,n){for(var r=this._hash.words,e=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],h=r[6],p=r[7],d=0;d<64;d++){if(d<16)f[d]=0|t[n+d];else{var l=f[d-15],y=(l<<25|l>>>7)^(l<<14|l>>>18)^l>>>3,g=f[d-2],w=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;f[d]=y+f[d-7]+w+f[d-16]}var v=e&i^e&o^i&o,m=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),_=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&h)+c[d]+f[d];p=h,h=u,u=a,a=s+_|0,s=o,o=i,i=e,e=_+(m+v)|0}r[0]=r[0]+e|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+h|0,r[7]=r[7]+p|0},_doFinalize:function(){var n=this._data,r=n.words,e=8*this._nDataBytes,i=8*n.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(e/4294967296),r[15+(i+64>>>9<<4)]=e,n.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=i._createHelper(u),n.HmacSHA256=i._createHmacHelper(u)}(Math),s.SHA256);export{o as r,a as s};
1
+ import{c as t,r as n}from"./index-16c75eee.js";import{c as r}from"./_commonjs-dynamic-modules-7cfc9805.js";var e,i={exports:{}};function o(){return e||(e=1,i.exports=(o=o||function(e,i){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),"undefined"!=typeof self&&self.crypto&&(o=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(o=globalThis.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==t&&t.crypto&&(o=t.crypto),!o&&"function"==typeof r)try{o=n}catch(t){}var s=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(n){var r;return t.prototype=n,r=new t,t.prototype=null,r}}(),c={},f=c.lib={},u=f.Base={extend:function(t){var n=a(this);return t&&n.mixIn(t),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},h=f.WordArray=u.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=i?n:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var n=this.words,r=t.words,e=this.sigBytes,i=t.sigBytes;if(this.clamp(),e%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;n[e+o>>>2]|=s<<24-(e+o)%4*8}else for(var a=0;a<i;a+=4)n[e+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(s());return new h.init(n,t)}}),p=c.enc={},d=p.Hex={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e+=2)r[e>>>3]|=parseInt(t.substr(e,2),16)<<24-e%8*4;return new h.init(r,n/2)}},l=p.Latin1={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e++)r[e>>>2]|=(255&t.charCodeAt(e))<<24-e%4*8;return new h.init(r,n)}},y=p.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},g=f.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=y.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,f=e.min(4*c,o);if(c){for(var u=0;u<c;u+=s)this._doProcessBlock(i,u);n=i.splice(0,c),r.sigBytes-=f}return new h.init(n,f)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});f.Hasher=g.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(n,r){return new t.init(r).finalize(n)}},_createHmacHelper:function(t){return function(n,r){return new w.HMAC.init(t,r).finalize(n)}}});var w=c.algo={};return c}(Math),o)),i.exports;var o}var s,a={exports:{}};a.exports=(s=o(),function(t){var n=s,r=n.lib,e=r.WordArray,i=r.Hasher,o=n.algo,a=[],c=[];!function(){function n(n){for(var r=t.sqrt(n),e=2;e<=r;e++)if(!(n%e))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var e=2,i=0;i<64;)n(e)&&(i<8&&(a[i]=r(t.pow(e,.5))),c[i]=r(t.pow(e,1/3)),i++),e++}();var f=[],u=o.SHA256=i.extend({_doReset:function(){this._hash=new e.init(a.slice(0))},_doProcessBlock:function(t,n){for(var r=this._hash.words,e=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],h=r[6],p=r[7],d=0;d<64;d++){if(d<16)f[d]=0|t[n+d];else{var l=f[d-15],y=(l<<25|l>>>7)^(l<<14|l>>>18)^l>>>3,g=f[d-2],w=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;f[d]=y+f[d-7]+w+f[d-16]}var v=e&i^e&o^i&o,m=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),_=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&h)+c[d]+f[d];p=h,h=u,u=a,a=s+_|0,s=o,o=i,i=e,e=_+(m+v)|0}r[0]=r[0]+e|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+h|0,r[7]=r[7]+p|0},_doFinalize:function(){var n=this._data,r=n.words,e=8*this._nDataBytes,i=8*n.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(e/4294967296),r[15+(i+64>>>9<<4)]=e,n.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=i._createHelper(u),n.HmacSHA256=i._createHmacHelper(u)}(Math),s.SHA256);export{o as r,a as s};
@@ -1 +1 @@
1
- import{getAddress as t}from"@ethersproject/address";import{hexZeroPad as r,hexConcat as n,isHexString as e,hexlify as o,arrayify as i}from"@ethersproject/bytes";import{L as s,B as a,k as c}from"./index-446c71f4.js";import{defineReadOnly as f,deepCopy as u,shallowCopy as h}from"@ethersproject/properties";import{i as m}from"./id-68d53df0.js";const y="hash/5.7.0";var p=function(t,r,n,e){return new(n||(n=Promise))((function(o,i){function s(t){try{c(e.next(t))}catch(t){i(t)}}function a(t){try{c(e.throw(t))}catch(t){i(t)}}function c(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}c((e=e.apply(t,r||[])).next())}))};const d=new s(y),g=new Uint8Array(32);g.fill(0);const l=a.from(-1),v=a.from(0),w=a.from(1),E=a.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(w.toHexString(),32),$=r(v.toHexString(),32),b={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},x=["name","version","chainId","verifyingContract","salt"];function S(t){return function(r){return"string"!=typeof r&&d.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const C={name:S("name"),version:S("version"),chainId:function(t){try{return a.from(t).toString()}catch(t){}return d.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(r){try{return t(r).toLowerCase()}catch(t){}return d.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",r)},salt:function(t){try{const r=i(t);if(32!==r.length)throw new Error("bad length");return o(r)}catch(t){}return d.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function O(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],o=parseInt(t[2]||"256");(o%8!=0||o>256||t[2]&&t[2]!==String(o))&&d.throwArgumentError("invalid numeric width","type",e);const i=E.mask(n?o-1:o),s=n?i.add(w).mul(l):v;return function(t){const n=a.from(t);return(n.lt(s)||n.gt(i))&&d.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),r(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&d.throwArgumentError("invalid bytes width","type",e),function(t){return i(t).length!==r&&d.throwArgumentError(`invalid length for ${e}`,"value",t),function(t){const r=i(t),e=r.length%32;return e?n([r,g.slice(e)]):o(r)}(t)}}}switch(e){case"address":return function(n){return r(t(n),32)};case"bool":return function(t){return t?A:$};case"bytes":return function(t){return c(t)};case"string":return function(t){return m(t)}}return null}function I(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class _{constructor(t){f(this,"types",Object.freeze(u(t))),f(this,"_encoderCache",{}),f(this,"_types",{});const r={},n={},e={};Object.keys(t).forEach((t=>{r[t]={},n[t]=[],e[t]={}}));for(const e in t){const o={};t[e].forEach((i=>{o[i.name]&&d.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(e)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===e&&d.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);O(s)||(n[s]||d.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),n[s].push(e),r[e][s]=!0)}))}const o=Object.keys(n).filter((t=>0===n[t].length));0===o.length?d.throwArgumentError("missing primary type","types",t):o.length>1&&d.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),f(this,"primaryType",o[0]),function o(i,s){s[i]&&d.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(r[i]).forEach((t=>{n[t]&&(o(t,s),Object.keys(s).forEach((r=>{e[r][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const r in e){const n=Object.keys(e[r]);n.sort(),this._types[r]=I(r,t[r])+n.map((r=>I(r,t[r]))).join("")}}getEncoder(t){let r=this._encoderCache[t];return r||(r=this._encoderCache[t]=this._getEncoder(t)),r}_getEncoder(t){{const r=O(t);if(r)return r}const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],e=this.getEncoder(t),o=parseInt(r[3]);return r=>{o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r);let i=r.map(e);return this._types[t]&&(i=i.map(c)),c(n(i))}}const e=this.types[t];if(e){const r=m(this._types[t]);return t=>{const o=e.map((({name:r,type:n})=>{const e=this.getEncoder(n)(t[r]);return this._types[n]?c(e):e}));return o.unshift(r),n(o)}}return d.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||d.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return c(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,n){if(O(t))return n(t,r);const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],o=parseInt(e[3]);return o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,n)))}const o=this.types[t];return o?o.reduce(((t,{name:e,type:o})=>(t[e]=this._visit(o,r[e],n),t)),{}):d.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new _(t)}static getPrimaryType(t){return _.from(t).primaryType}static hashStruct(t,r,n){return _.from(r).hashStruct(t,n)}static hashDomain(t){const r=[];for(const n in t){const e=b[n];e||d.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),r.push({name:n,type:e})}return r.sort(((t,r)=>x.indexOf(t.name)-x.indexOf(r.name))),_.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,r,e){return n(["0x1901",_.hashDomain(t),_.from(r).hash(e)])}static hash(t,r,n){return c(_.encode(t,r,n))}static resolveNames(t,r,n,o){return p(this,void 0,void 0,(function*(){t=h(t);const i={};t.verifyingContract&&!e(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=_.from(r);s.visit(n,((t,r)=>("address"!==t||e(r,20)||(i[r]="0x"),r)));for(const t in i)i[t]=yield o(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=s.visit(n,((t,r)=>"address"===t&&i[r]?i[r]:r)),{domain:t,value:n}}))}static getPayload(t,r,n){_.hashDomain(t);const e={},s=[];x.forEach((r=>{const n=t[r];null!=n&&(e[r]=C[r](n),s.push({name:r,type:b[r]}))}));const c=_.from(r),f=h(r);return f.EIP712Domain?d.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):f.EIP712Domain=s,c.encode(n),{types:f,domain:e,primaryType:c.primaryType,message:c.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return o(i(r));if(t.match(/^u?int/))return a.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&d.throwArgumentError("invalid string","value",r),r}return d.throwArgumentError("unsupported type","type",t)}))}}}export{_ as T,y as v};
1
+ import{getAddress as t}from"@ethersproject/address";import{hexZeroPad as r,hexConcat as n,isHexString as e,hexlify as o,arrayify as i}from"@ethersproject/bytes";import{L as s,B as a,k as c}from"./index-16c75eee.js";import{defineReadOnly as f,deepCopy as u,shallowCopy as h}from"@ethersproject/properties";import{i as m}from"./id-0a46be36.js";const y="hash/5.7.0";var p=function(t,r,n,e){return new(n||(n=Promise))((function(o,i){function s(t){try{c(e.next(t))}catch(t){i(t)}}function a(t){try{c(e.throw(t))}catch(t){i(t)}}function c(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}c((e=e.apply(t,r||[])).next())}))};const d=new s(y),g=new Uint8Array(32);g.fill(0);const l=a.from(-1),v=a.from(0),w=a.from(1),E=a.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(w.toHexString(),32),b=r(v.toHexString(),32),$={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},x=["name","version","chainId","verifyingContract","salt"];function S(t){return function(r){return"string"!=typeof r&&d.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const C={name:S("name"),version:S("version"),chainId:function(t){try{return a.from(t).toString()}catch(t){}return d.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(r){try{return t(r).toLowerCase()}catch(t){}return d.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",r)},salt:function(t){try{const r=i(t);if(32!==r.length)throw new Error("bad length");return o(r)}catch(t){}return d.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function O(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],o=parseInt(t[2]||"256");(o%8!=0||o>256||t[2]&&t[2]!==String(o))&&d.throwArgumentError("invalid numeric width","type",e);const i=E.mask(n?o-1:o),s=n?i.add(w).mul(l):v;return function(t){const n=a.from(t);return(n.lt(s)||n.gt(i))&&d.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),r(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&d.throwArgumentError("invalid bytes width","type",e),function(t){return i(t).length!==r&&d.throwArgumentError(`invalid length for ${e}`,"value",t),function(t){const r=i(t),e=r.length%32;return e?n([r,g.slice(e)]):o(r)}(t)}}}switch(e){case"address":return function(n){return r(t(n),32)};case"bool":return function(t){return t?A:b};case"bytes":return function(t){return c(t)};case"string":return function(t){return m(t)}}return null}function I(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class _{constructor(t){f(this,"types",Object.freeze(u(t))),f(this,"_encoderCache",{}),f(this,"_types",{});const r={},n={},e={};Object.keys(t).forEach((t=>{r[t]={},n[t]=[],e[t]={}}));for(const e in t){const o={};t[e].forEach((i=>{o[i.name]&&d.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(e)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===e&&d.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);O(s)||(n[s]||d.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),n[s].push(e),r[e][s]=!0)}))}const o=Object.keys(n).filter((t=>0===n[t].length));0===o.length?d.throwArgumentError("missing primary type","types",t):o.length>1&&d.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),f(this,"primaryType",o[0]),function o(i,s){s[i]&&d.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(r[i]).forEach((t=>{n[t]&&(o(t,s),Object.keys(s).forEach((r=>{e[r][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const r in e){const n=Object.keys(e[r]);n.sort(),this._types[r]=I(r,t[r])+n.map((r=>I(r,t[r]))).join("")}}getEncoder(t){let r=this._encoderCache[t];return r||(r=this._encoderCache[t]=this._getEncoder(t)),r}_getEncoder(t){{const r=O(t);if(r)return r}const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],e=this.getEncoder(t),o=parseInt(r[3]);return r=>{o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r);let i=r.map(e);return this._types[t]&&(i=i.map(c)),c(n(i))}}const e=this.types[t];if(e){const r=m(this._types[t]);return t=>{const o=e.map((({name:r,type:n})=>{const e=this.getEncoder(n)(t[r]);return this._types[n]?c(e):e}));return o.unshift(r),n(o)}}return d.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||d.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return c(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,n){if(O(t))return n(t,r);const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],o=parseInt(e[3]);return o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,n)))}const o=this.types[t];return o?o.reduce(((t,{name:e,type:o})=>(t[e]=this._visit(o,r[e],n),t)),{}):d.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new _(t)}static getPrimaryType(t){return _.from(t).primaryType}static hashStruct(t,r,n){return _.from(r).hashStruct(t,n)}static hashDomain(t){const r=[];for(const n in t){const e=$[n];e||d.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),r.push({name:n,type:e})}return r.sort(((t,r)=>x.indexOf(t.name)-x.indexOf(r.name))),_.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,r,e){return n(["0x1901",_.hashDomain(t),_.from(r).hash(e)])}static hash(t,r,n){return c(_.encode(t,r,n))}static resolveNames(t,r,n,o){return p(this,void 0,void 0,(function*(){t=h(t);const i={};t.verifyingContract&&!e(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=_.from(r);s.visit(n,((t,r)=>("address"!==t||e(r,20)||(i[r]="0x"),r)));for(const t in i)i[t]=yield o(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=s.visit(n,((t,r)=>"address"===t&&i[r]?i[r]:r)),{domain:t,value:n}}))}static getPayload(t,r,n){_.hashDomain(t);const e={},s=[];x.forEach((r=>{const n=t[r];null!=n&&(e[r]=C[r](n),s.push({name:r,type:$[r]}))}));const c=_.from(r),f=h(r);return f.EIP712Domain?d.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):f.EIP712Domain=s,c.encode(n),{types:f,domain:e,primaryType:c.primaryType,message:c.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return o(i(r));if(t.match(/^u?int/))return a.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&d.throwArgumentError("invalid string","value",r),r}return d.throwArgumentError("unsupported type","type",t)}))}}}export{_ as T,y as v};