@dodoex/wallet-web3 0.4.1-rise → 0.4.1-rise.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{alchemy-provider-5870b6fa-14ec4a67.js → alchemy-provider-5870b6fa-bb85ec6a.js} +1 -1
- package/dist/{alchemy-websocket-provider-213da986-248efea7.js → alchemy-websocket-provider-213da986-d5400b6b.js} +1 -1
- package/dist/{blocto-f754a82a.js → blocto-eff0b92d.js} +1 -1
- package/dist/{ccip-e1bced07.js → ccip-8aed4fac.js} +1 -1
- package/dist/{ccip-97718869.js → ccip-f0761404.js} +1 -1
- package/dist/cjs/{alchemy-provider-5870b6fa-116ab07a.cjs → alchemy-provider-5870b6fa-382979ef.cjs} +1 -1
- package/dist/cjs/{alchemy-websocket-provider-213da986-87ccad9d.cjs → alchemy-websocket-provider-213da986-4ce7835d.cjs} +1 -1
- package/dist/cjs/{blocto-95507d3f.cjs → blocto-14fc9f60.cjs} +1 -1
- package/dist/cjs/{ccip-51bad854.cjs → ccip-2b0ca597.cjs} +1 -1
- package/dist/cjs/{ccip-b38d78bc.cjs → ccip-a1973409.cjs} +1 -1
- package/dist/cjs/{draggabilly-e359aaca.cjs → draggabilly-5c6a8eb9.cjs} +1 -1
- package/dist/cjs/id-030fb120.cjs +1 -0
- package/dist/cjs/{index-9ccb1170.cjs → index-0eb47a78.cjs} +1 -1
- package/dist/cjs/{index-69bd892e.cjs → index-21073eb0.cjs} +1 -1
- package/dist/cjs/{index-96e65b8a.cjs → index-34ad5f20.cjs} +1 -1
- package/dist/cjs/{index-f544eb4c.cjs → index-418ee7e2.cjs} +1 -1
- package/dist/cjs/{index-fadaf8b8.cjs → index-5ce728f7.cjs} +4 -4
- package/dist/cjs/{index-643e5119.cjs → index-5d7df663.cjs} +1 -1
- package/dist/cjs/{index-5f0913a9.cjs → index-6507817d.cjs} +2 -2
- package/dist/cjs/{index-10a24541.cjs → index-67de37f3.cjs} +1 -1
- package/dist/cjs/{index-39f61aea.cjs → index-ceef92b9.cjs} +1 -1
- package/dist/cjs/{index-7af70508.cjs → index-d2b3e830.cjs} +2 -2
- package/dist/cjs/{index-bb10a98a.cjs → index-ddd9f3b1.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-f545ef05.cjs → index.es-26c6ee46.cjs} +1 -1
- package/dist/cjs/{interface-8a637174.cjs → interface-301bc9d4.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-cad6d780.cjs → lib-typedarrays-e51b5d1f.cjs} +1 -1
- package/dist/cjs/{portis-6bb18e8c.cjs → portis-6ae03796.cjs} +1 -1
- package/dist/cjs/{provider-ef4d48ff.cjs → provider-aec1ee59.cjs} +1 -1
- package/dist/cjs/{rainbow-23f226c3.cjs → rainbow-920371d7.cjs} +1 -1
- package/dist/cjs/{secp256k1-12b6c26a.cjs → secp256k1-88c91671.cjs} +1 -1
- package/dist/cjs/{sha224-80c902fd.cjs → sha224-44664857.cjs} +1 -1
- package/dist/cjs/{sha256-5fef9f66.cjs → sha256-559d937c.cjs} +1 -1
- package/dist/cjs/{typed-data-6fcfdd47.cjs → typed-data-2ac6e5bb.cjs} +1 -1
- package/dist/cjs/{uAuth-2e9ca189.cjs → uAuth-63dec270.cjs} +1 -1
- package/dist/cjs/{walletConnect-a924de37.cjs → walletConnect-1514d700.cjs} +1 -1
- package/dist/cjs/{walletLink-61f852a1.cjs → walletLink-5879a68b.cjs} +1 -1
- package/dist/{draggabilly-3125c6e9.js → draggabilly-f3461ab1.js} +1 -1
- package/dist/id-155c1875.js +1 -0
- package/dist/{index-388a0406.js → index-01b9db23.js} +1 -1
- package/dist/{index-dca9f9d5.js → index-14f309d2.js} +1 -1
- package/dist/{index-ce22e241.js → index-31a37014.js} +2 -2
- package/dist/{index-ecc4ef84.js → index-4b6c652e.js} +1 -1
- package/dist/{index-3f3b3b93.js → index-609bf40c.js} +1 -1
- package/dist/{index-bbbb136d.js → index-ad6d7603.js} +1 -1
- package/dist/{index-435c5426.js → index-b6f1e8cc.js} +2 -2
- package/dist/{index-9534d8ad.js → index-c836d1b2.js} +4 -4
- package/dist/{index-f9b4c373.js → index-c8e0cbe6.js} +1 -1
- package/dist/{index-be44c6cf.js → index-e01611dd.js} +1 -1
- package/dist/{index-4f2cd06b.js → index-fff9fb0c.js} +2 -2
- package/dist/{index.es-54e0c8fc.js → index.es-9ce4fdd7.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-a828a662.js → interface-226cc3e0.js} +1 -1
- package/dist/{lib-typedarrays-87be4777.js → lib-typedarrays-c1439d8d.js} +1 -1
- package/dist/{portis-2c5bf8b6.js → portis-9112d997.js} +1 -1
- package/dist/{provider-68c12b1a.js → provider-1e6242a3.js} +1 -1
- package/dist/{rainbow-049a1739.js → rainbow-280f7951.js} +1 -1
- package/dist/{secp256k1-981bc92b.js → secp256k1-d403d4c1.js} +1 -1
- package/dist/sha224-34dbb09c.js +1 -0
- package/dist/{sha256-5efde761.js → sha256-ecf76121.js} +1 -1
- package/dist/{typed-data-fd8be8f8.js → typed-data-cfc1152c.js} +1 -1
- package/dist/{uAuth-d6acd696.js → uAuth-2883581a.js} +1 -1
- package/dist/{walletConnect-bad92dcf.js → walletConnect-6bf9ed97.js} +1 -1
- package/dist/{walletLink-b85ce653.js → walletLink-0444bb94.js} +1 -1
- package/package.json +1 -1
- package/dist/cjs/id-2a5c5ef2.cjs +0 -1
- package/dist/id-cdf2dadd.js +0 -1
- package/dist/sha224-5fac1d2c.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@ethersproject/address"),e=require("@ethersproject/bytes"),r=require("./id-2a5c5ef2.cjs"),n=require("./index-fadaf8b8.cjs"),a=require("@ethersproject/properties"),s=require("@ethersproject/constants");const i="abi/5.7.0",o=new n.Logger(i),u={};let c={calldata:!0,memory:!0,storage:!0},l={calldata:!0,memory:!0};function h(t,e){if("bytes"===t||"string"===t){if(c[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&l[e])return!0;return(c[e]||"payable"===e)&&o.throwArgumentError("invalid modifier","name",e),!1}function m(t,e){for(let r in e)a.defineReadOnly(t,r,e[r])}const d=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),p=new RegExp(/^(.*)\[([0-9]*)\]$/);class g{constructor(t,e){t!==u&&o.throwError("use fromString",n.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),m(this,e);let r=this.type.match(p);m(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:g.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=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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!==d.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===d.full?", ":",")+")"):e+=this.type,t!==d.sighash&&(!0===this.indexed&&(e+=" indexed"),t===d.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?g.fromString(t,e):g.fromObject(t)}static fromObject(t){return g.isParamType(t)?t:new g(u,{name:t.name||null,type:S(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(g.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){o.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}},i=s;for(let r=0;r<t.length;r++){let s=t[r];switch(s){case"(":i.state.allowType&&""===i.type?i.type="tuple":i.state.allowParams||n(r),i.state.allowType=!1,i.type=S(i.type),i.components=[a(i)],i=i.components[0];break;case")":delete i.state,"indexed"===i.name&&(e||n(r),i.indexed=!0,i.name=""),h(i.type,i.name)&&(i.name=""),i.type=S(i.type);let t=i;i=i.parent,i||n(r),delete t.parent,i.state.allowParams=!1,i.state.allowName=!0,i.state.allowArray=!0;break;case",":delete i.state,"indexed"===i.name&&(e||n(r),i.indexed=!0,i.name=""),h(i.type,i.name)&&(i.name=""),i.type=S(i.type);let o=a(i.parent);i.parent.components.push(o),delete i.parent,i=o;break;case" ":i.state.allowType&&""!==i.type&&(i.type=S(i.type),delete i.state.allowType,i.state.allowName=!0,i.state.allowParams=!0),i.state.allowName&&""!==i.name&&("indexed"===i.name?(e||n(r),i.indexed&&n(r),i.indexed=!0,i.name=""):h(i.type,i.name)?i.name="":i.state.allowName=!1);break;case"[":i.state.allowArray||n(r),i.type+=s,i.state.allowArray=!1,i.state.allowName=!1,i.state.readArray=!0;break;case"]":i.state.readArray||n(r),i.type+=s,i.state.readArray=!1,i.state.allowArray=!0,i.state.allowName=!0;break;default:i.state.allowType?(i.type+=s,i.state.allowParams=!0,i.state.allowArray=!0):i.state.allowName?(i.name+=s,delete i.state.allowArray):i.state.readArray?i.type+=s:n(r)}}return i.parent&&o.throwArgumentError("unexpected eof","param",t),delete s.state,"indexed"===i.name?(e||n(r.length-7),i.indexed&&n(r.length-7),i.indexed=!0,i.name=""):h(i.type,i.name)&&(i.name=""),s.type=S(s.type),s}(t,!!e),g.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function f(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&&o.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>g.fromString(t,e)))}class y{constructor(t,e){t!==u&&o.throwError("use a static from method",n.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),m(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return y.isFragment(t)?t:"string"==typeof t?y.fromString(t):y.fromObject(t)}static fromObject(t){if(y.isFragment(t))return t;switch(t.type){case"function":return x.fromObject(t);case"event":return b.fromObject(t);case"constructor":return _.fromObject(t);case"error":return O.fromObject(t);case"fallback":case"receive":return null}return o.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]?b.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?x.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?_.fromString(t.trim()):"error"===t.split(" ")[0]?O.fromString(t.substring(5).trim()):o.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class b extends y{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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!==d.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?b.fromString(t):b.fromObject(t)}static fromObject(t){if(b.isEventFragment(t))return t;"event"!==t.type&&o.throwArgumentError("invalid event object","value",t);const e={name:j(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(g.fromObject):[],type:"event"};return new b(u,e)}static fromString(t){let e=t.match(F);e||o.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:o.warn("unknown modifier: "+t)}})),b.fromObject({name:e[1].trim(),anonymous:r,inputs:f(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function w(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&o.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||o.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=n.BigNumber.from(r[1]),r[0]):t}function E(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 v(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&&o.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&o.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||o.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&&o.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&&o.throwArgumentError("unable to determine stateMutability","value",t),e}class _ extends y{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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===d.sighash&&o.throwError("cannot format a constructor for sighash",n.Logger.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?_.fromString(t):_.fromObject(t)}static fromObject(t){if(_.isConstructorFragment(t))return t;"constructor"!==t.type&&o.throwArgumentError("invalid constructor object","value",t);let e=v(t);e.constant&&o.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(g.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.BigNumber.from(t.gas):null};return new _(u,r)}static fromString(t){let e={type:"constructor"},r=(t=w(t,e)).match(F);return r&&"constructor"===r[1].trim()||o.throwArgumentError("invalid constructor string","value",t),e.inputs=f(r[2].trim(),!1),E(r[3].trim(),e),_.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class x extends _{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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!==d.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.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?x.fromString(t):x.fromObject(t)}static fromObject(t){if(x.isFunctionFragment(t))return t;"function"!==t.type&&o.throwArgumentError("invalid function object","value",t);let e=v(t);const r={type:t.type,name:j(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(g.fromObject):[],outputs:t.outputs?t.outputs.map(g.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.BigNumber.from(t.gas):null};return new x(u,r)}static fromString(t){let e={type:"function"},r=(t=w(t,e)).split(" returns ");r.length>2&&o.throwArgumentError("invalid function string","value",t);let n=r[0].match(F);if(n||o.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&j(e.name),e.inputs=f(n[2],!1),E(n[3].trim(),e),r.length>1){let n=r[1].match(F);""==n[1].trim()&&""==n[3].trim()||o.throwArgumentError("unexpected tokens","value",t),e.outputs=f(n[2],!1)}else e.outputs=[];return x.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function A(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||o.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class O extends y{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?O.fromString(t):O.fromObject(t)}static fromObject(t){if(O.isErrorFragment(t))return t;"error"!==t.type&&o.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:j(t.name),inputs:t.inputs?t.inputs.map(g.fromObject):[]};return A(new O(u,e))}static fromString(t){let e={type:"error"},r=t.match(F);return r||o.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&j(e.name),e.inputs=f(r[2],!1),A(O.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function S(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const N=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function j(t){return t&&t.match(N)||o.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const F=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const R=new n.Logger(i);class T{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){R.throwArgumentError(t,this.localName,e)}}class L{constructor(t){a.defineReadOnly(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return e.hexConcat(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(e.concat(t._data))}writeBytes(t){let r=e.arrayify(t);const n=r.length%this.wordSize;return n&&(r=e.concat([r,this._padding.slice(n)])),this._writeData(r)}_getValue(t){let r=e.arrayify(n.BigNumber.from(t));return r.length>this.wordSize&&R.throwError("value out-of-bounds",n.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=e.concat([this._padding.slice(r.length%this.wordSize),r])),r}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 M{constructor(t,r,n,s){a.defineReadOnly(this,"_data",e.arrayify(t)),a.defineReadOnly(this,"wordSize",r||32),a.defineReadOnly(this,"_coerceFunc",n),a.defineReadOnly(this,"allowLoose",s),this._offset=0}get data(){return e.hexlify(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):M.coerce(t,e)}_peekBytes(t,e,r){let a=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+a>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?a=e:R.throwError("data out-of-bounds",n.Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+a})),this._data.slice(this._offset,this._offset+a)}subReader(t){return new M(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 n.BigNumber.from(this.readBytes(this.wordSize))}}class V extends T{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=t.getAddress(r)}catch(t){this._throwError(t.message,r)}return e.writeValue(r)}decode(r){return t.getAddress(e.hexZeroPad(r.readValue().toHexString(),20))}}class C extends T{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 z=new n.Logger(i);function k(t,e,r){let a=null;if(Array.isArray(r))a=r;else if(r&&"object"==typeof r){let t={};a=e.map((e=>{const a=e.localName;return a||z.throwError("cannot encode object for signature with missing names",n.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[a]&&z.throwError("cannot encode object for signature with duplicate names",n.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[a]=!0,r[a]}))}else z.throwArgumentError("invalid tuple value","tuple",r);e.length!==a.length&&z.throwArgumentError("types/value length mismatch","tuple",r);let s=new L(t.wordSize),i=new L(t.wordSize),o=[];e.forEach(((t,e)=>{let r=a[e];if(t.dynamic){let e=i.length;t.encode(i,r);let n=s.writeUpdatableValue();o.push((t=>{n(t+e)}))}else t.encode(s,r)})),o.forEach((t=>{t(s.length)}));let u=t.appendWriter(s);return u+=t.appendWriter(i),u}function P(t,e){let r=[],a=t.subReader(0);e.forEach((e=>{let s=null;if(e.dynamic){let r=t.readValue(),i=a.subReader(r.toNumber());try{s=e.decode(i)}catch(t){if(t.code===n.Logger.errors.BUFFER_OVERRUN)throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}}else try{s=e.decode(t)}catch(t){if(t.code===n.Logger.errors.BUFFER_OVERRUN)throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}null!=s&&r.push(s)}));const s=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!==s[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const a=r[e];a instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw a}}):r[n]=a}));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 B extends T{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)),z.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 k(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&z.throwError("insufficient data length",n.Logger.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new C(this.coder));return t.coerce(this.name,P(t,r))}}class I extends T{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 U extends T{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,r){r=e.arrayify(r);let n=t.writeValue(r.length);return n+=t.writeBytes(r),n}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class D extends U{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,e.hexlify(super.decode(t)))}}class $ extends T{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,r){let n=e.arrayify(r);return n.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(n)}decode(t){return t.coerce(this.name,e.hexlify(t.readBytes(this.size)))}}class J extends T{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 W extends T{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=n.BigNumber.from(e),a=s.MaxUint256.mask(8*t.wordSize);if(this.signed){let t=a.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(s.One).mul(s.NegativeOne)))&&this._throwError("value out-of-bounds",e)}else(r.lt(s.Zero)||r.gt(a.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 q extends U{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,n.toUtf8Bytes(e))}decode(t){return n.toUtf8String(super.decode(t))}}class H extends T{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 k(t,this.coders,e)}decode(t){return t.coerce(this.name,P(t,this.coders))}}const Z=new n.Logger(i),G=new RegExp(/^bytes([0-9]*)$/),X=new RegExp(/^(u?int)([0-9]*)$/);class K{constructor(t){a.defineReadOnly(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new V(t.name);case"bool":return new I(t.name);case"string":return new q(t.name);case"bytes":return new D(t.name);case"array":return new B(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new H((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new J(t.name)}let e=t.type.match(X);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&Z.throwArgumentError("invalid "+e[1]+" bit length","param",t),new W(r/8,"int"===e[1],t.name)}if(e=t.type.match(G),e){let r=parseInt(e[1]);return(0===r||r>32)&&Z.throwArgumentError("invalid bytes length","param",t),new $(r,t.name)}return Z.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new M(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new L(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(g.from(t))));return new H(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Z.throwError("types/values length mismatch",n.Logger.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(g.from(t)))),a=new H(r,"_"),s=this._getWriter();return a.encode(s,e),s.data}decode(t,r,n){const a=t.map((t=>this._getCoder(g.from(t))));return new H(a,"_").decode(this._getReader(e.arrayify(r),n))}}const Q=new K,Y=new n.Logger(i);class tt extends a.Description{}class et extends a.Description{}class rt extends a.Description{}class nt extends a.Description{static isIndexed(t){return!(!t||!t._isIndexed)}}const at={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function st(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}exports.AbiCoder=K,exports.ConstructorFragment=_,exports.ErrorFragment=O,exports.EventFragment=b,exports.FormatTypes=d,exports.Fragment=y,exports.FunctionFragment=x,exports.Indexed=nt,exports.Interface=class{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,a.defineReadOnly(this,"fragments",e.map((t=>y.from(t))).filter((t=>null!=t))),a.defineReadOnly(this,"_abiCoder",a.getStatic(new.target,"getAbiCoder")()),a.defineReadOnly(this,"functions",{}),a.defineReadOnly(this,"errors",{}),a.defineReadOnly(this,"events",{}),a.defineReadOnly(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void Y.warn("duplicate definition - constructor"):void a.defineReadOnly(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]?Y.warn("duplicate definition - "+r):e[r]=t})),this.deploy||a.defineReadOnly(this,"deploy",_.from({payable:!1,type:"constructor"})),a.defineReadOnly(this,"_isInterface",!0)}format(t){t||(t=d.full),t===d.sighash&&Y.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===d.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return Q}static getAddress(e){return t.getAddress(e)}static getSighash(t){return e.hexDataSlice(r.id(t.format()),0,4)}static getEventTopic(t){return r.id(t.format())}getFunction(t){if(e.isHexString(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];Y.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?Y.throwArgumentError("no matching function","name",e):r.length>1&&Y.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const r=this.functions[x.fromString(t).format()];return r||Y.throwArgumentError("no matching function","signature",t),r}getEvent(t){if(e.isHexString(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];Y.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?Y.throwArgumentError("no matching event","name",e):r.length>1&&Y.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const r=this.events[b.fromString(t).format()];return r||Y.throwArgumentError("no matching event","signature",t),r}getError(t){if(e.isHexString(t)){const e=a.getStatic(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}Y.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?Y.throwArgumentError("no matching error","name",e):r.length>1&&Y.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const r=this.errors[x.fromString(t).format()];return r||Y.throwArgumentError("no matching error","signature",t),r}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return a.getStatic(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),a.getStatic(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,r){"string"==typeof t&&(t=this.getError(t));const n=e.arrayify(r);return e.hexlify(n.slice(0,4))!==this.getSighash(t)&&Y.throwArgumentError(`data signature does not match error ${t.name}.`,"data",e.hexlify(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,r){return"string"==typeof t&&(t=this.getError(t)),e.hexlify(e.concat([this.getSighash(t),this._encodeParams(t.inputs,r||[])]))}decodeFunctionData(t,r){"string"==typeof t&&(t=this.getFunction(t));const n=e.arrayify(r);return e.hexlify(n.slice(0,4))!==this.getSighash(t)&&Y.throwArgumentError(`data signature does not match function ${t.name}.`,"data",e.hexlify(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,r){return"string"==typeof t&&(t=this.getFunction(t)),e.hexlify(e.concat([this.getSighash(t),this._encodeParams(t.inputs,r||[])]))}decodeFunctionResult(t,r){"string"==typeof t&&(t=this.getFunction(t));let a=e.arrayify(r),s=null,i="",o=null,u=null,c=null;switch(a.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,a)}catch(t){}break;case 4:{const t=e.hexlify(a.slice(0,4)),r=at[t];if(r)o=this._abiCoder.decode(r.inputs,a.slice(4)),u=r.name,c=r.signature,r.reason&&(s=o[0]),"Error"===u?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===u&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,a.slice(4)),u=e.name,c=e.format()}catch(t){}break}}return Y.throwError("call revert exception"+i,n.Logger.errors.CALL_EXCEPTION,{method:t.format(),data:e.hexlify(r),errorArgs:o,errorName:u,errorSignature:c,reason:s})}encodeFunctionResult(t,r){return"string"==typeof t&&(t=this.getFunction(t)),e.hexlify(this._abiCoder.encode(t.outputs,r||[]))}encodeFilterTopics(t,a){"string"==typeof t&&(t=this.getEvent(t)),a.length>t.inputs.length&&Y.throwError("too many arguments for "+t.format(),n.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:a});let s=[];t.anonymous||s.push(this.getEventTopic(t));const i=(t,a)=>"string"===t.type?r.id(a):"bytes"===t.type?n.keccak256(e.hexlify(a)):("bool"===t.type&&"boolean"==typeof a&&(a=a?"0x01":"0x00"),t.type.match(/^u?int/)&&(a=n.BigNumber.from(a).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[a]),e.hexZeroPad(e.hexlify(a),32));for(a.forEach(((e,r)=>{let n=t.inputs[r];n.indexed?null==e?s.push(null):"array"===n.baseType||"tuple"===n.baseType?Y.throwArgumentError("filtering with tuples or arrays not supported","contract."+n.name,e):Array.isArray(e)?s.push(e.map((t=>i(n,t)))):s.push(i(n,e)):null!=e&&Y.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+n.name,e)}));s.length&&null===s[s.length-1];)s.pop();return s}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const a=[],s=[],i=[];return t.anonymous||a.push(this.getEventTopic(t)),e.length!==t.inputs.length&&Y.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const u=e[o];if(t.indexed)if("string"===t.type)a.push(r.id(u));else if("bytes"===t.type)a.push(n.keccak256(u));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");a.push(this._abiCoder.encode([t.type],[u]))}else s.push(t),i.push(u)})),{data:this._abiCoder.encode(s,i),topics:a}}decodeEventLog(t,r,a){if("string"==typeof t&&(t=this.getEvent(t)),null!=a&&!t.anonymous){let r=this.getEventTopic(t);e.isHexString(a[0],32)&&a[0].toLowerCase()===r||Y.throwError("fragment/topic mismatch",n.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:r,value:a[0]}),a=a.slice(1)}let s=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(s.push(g.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(s.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let u=null!=a?this._abiCoder.decode(s,e.concat(a)):null,c=this._abiCoder.decode(i,r,!0),l=[],h=0,m=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==u)l[e]=new nt({_isIndexed:!0,hash:null});else if(o[e])l[e]=new nt({_isIndexed:!0,hash:u[m++]});else try{l[e]=u[m++]}catch(t){l[e]=t}else try{l[e]=c[h++]}catch(t){l[e]=t}if(t.name&&null==l[t.name]){const r=l[e];r instanceof Error?Object.defineProperty(l,t.name,{enumerable:!0,get:()=>{throw st(`property ${JSON.stringify(t.name)}`,r)}}):l[t.name]=r}}));for(let t=0;t<l.length;t++){const e=l[t];e instanceof Error&&Object.defineProperty(l,t,{enumerable:!0,get:()=>{throw st(`index ${t}`,e)}})}return Object.freeze(l)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new et({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:n.BigNumber.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new tt({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const r=e.hexlify(t);let n=this.getError(r.substring(0,10).toLowerCase());return n?new rt({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!(!t||!t._isInterface)}},exports.LogDescription=tt,exports.ParamType=g,exports.TransactionDescription=et,exports.checkResultErrors=function(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},exports.defaultAbiCoder=Q;
|
|
1
|
+
"use strict";var t=require("@ethersproject/address"),e=require("@ethersproject/bytes"),r=require("./id-030fb120.cjs"),n=require("./index-5ce728f7.cjs"),a=require("@ethersproject/properties"),s=require("@ethersproject/constants");const i="abi/5.7.0",o=new n.Logger(i),u={};let c={calldata:!0,memory:!0,storage:!0},l={calldata:!0,memory:!0};function h(t,e){if("bytes"===t||"string"===t){if(c[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&l[e])return!0;return(c[e]||"payable"===e)&&o.throwArgumentError("invalid modifier","name",e),!1}function m(t,e){for(let r in e)a.defineReadOnly(t,r,e[r])}const d=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),p=new RegExp(/^(.*)\[([0-9]*)\]$/);class g{constructor(t,e){t!==u&&o.throwError("use fromString",n.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),m(this,e);let r=this.type.match(p);m(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:g.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=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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!==d.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===d.full?", ":",")+")"):e+=this.type,t!==d.sighash&&(!0===this.indexed&&(e+=" indexed"),t===d.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?g.fromString(t,e):g.fromObject(t)}static fromObject(t){return g.isParamType(t)?t:new g(u,{name:t.name||null,type:S(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(g.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){o.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}},i=s;for(let r=0;r<t.length;r++){let s=t[r];switch(s){case"(":i.state.allowType&&""===i.type?i.type="tuple":i.state.allowParams||n(r),i.state.allowType=!1,i.type=S(i.type),i.components=[a(i)],i=i.components[0];break;case")":delete i.state,"indexed"===i.name&&(e||n(r),i.indexed=!0,i.name=""),h(i.type,i.name)&&(i.name=""),i.type=S(i.type);let t=i;i=i.parent,i||n(r),delete t.parent,i.state.allowParams=!1,i.state.allowName=!0,i.state.allowArray=!0;break;case",":delete i.state,"indexed"===i.name&&(e||n(r),i.indexed=!0,i.name=""),h(i.type,i.name)&&(i.name=""),i.type=S(i.type);let o=a(i.parent);i.parent.components.push(o),delete i.parent,i=o;break;case" ":i.state.allowType&&""!==i.type&&(i.type=S(i.type),delete i.state.allowType,i.state.allowName=!0,i.state.allowParams=!0),i.state.allowName&&""!==i.name&&("indexed"===i.name?(e||n(r),i.indexed&&n(r),i.indexed=!0,i.name=""):h(i.type,i.name)?i.name="":i.state.allowName=!1);break;case"[":i.state.allowArray||n(r),i.type+=s,i.state.allowArray=!1,i.state.allowName=!1,i.state.readArray=!0;break;case"]":i.state.readArray||n(r),i.type+=s,i.state.readArray=!1,i.state.allowArray=!0,i.state.allowName=!0;break;default:i.state.allowType?(i.type+=s,i.state.allowParams=!0,i.state.allowArray=!0):i.state.allowName?(i.name+=s,delete i.state.allowArray):i.state.readArray?i.type+=s:n(r)}}return i.parent&&o.throwArgumentError("unexpected eof","param",t),delete s.state,"indexed"===i.name?(e||n(r.length-7),i.indexed&&n(r.length-7),i.indexed=!0,i.name=""):h(i.type,i.name)&&(i.name=""),s.type=S(s.type),s}(t,!!e),g.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function f(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&&o.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>g.fromString(t,e)))}class y{constructor(t,e){t!==u&&o.throwError("use a static from method",n.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),m(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return y.isFragment(t)?t:"string"==typeof t?y.fromString(t):y.fromObject(t)}static fromObject(t){if(y.isFragment(t))return t;switch(t.type){case"function":return x.fromObject(t);case"event":return b.fromObject(t);case"constructor":return _.fromObject(t);case"error":return O.fromObject(t);case"fallback":case"receive":return null}return o.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]?b.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?x.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?_.fromString(t.trim()):"error"===t.split(" ")[0]?O.fromString(t.substring(5).trim()):o.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class b extends y{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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!==d.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?b.fromString(t):b.fromObject(t)}static fromObject(t){if(b.isEventFragment(t))return t;"event"!==t.type&&o.throwArgumentError("invalid event object","value",t);const e={name:j(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(g.fromObject):[],type:"event"};return new b(u,e)}static fromString(t){let e=t.match(F);e||o.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:o.warn("unknown modifier: "+t)}})),b.fromObject({name:e[1].trim(),anonymous:r,inputs:f(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function w(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&o.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||o.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=n.BigNumber.from(r[1]),r[0]):t}function E(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 v(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&&o.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&o.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||o.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&&o.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&&o.throwArgumentError("unable to determine stateMutability","value",t),e}class _ extends y{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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===d.sighash&&o.throwError("cannot format a constructor for sighash",n.Logger.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?_.fromString(t):_.fromObject(t)}static fromObject(t){if(_.isConstructorFragment(t))return t;"constructor"!==t.type&&o.throwArgumentError("invalid constructor object","value",t);let e=v(t);e.constant&&o.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(g.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.BigNumber.from(t.gas):null};return new _(u,r)}static fromString(t){let e={type:"constructor"},r=(t=w(t,e)).match(F);return r&&"constructor"===r[1].trim()||o.throwArgumentError("invalid constructor string","value",t),e.inputs=f(r[2].trim(),!1),E(r[3].trim(),e),_.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class x extends _{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.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!==d.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",t!==d.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?x.fromString(t):x.fromObject(t)}static fromObject(t){if(x.isFunctionFragment(t))return t;"function"!==t.type&&o.throwArgumentError("invalid function object","value",t);let e=v(t);const r={type:t.type,name:j(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(g.fromObject):[],outputs:t.outputs?t.outputs.map(g.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?n.BigNumber.from(t.gas):null};return new x(u,r)}static fromString(t){let e={type:"function"},r=(t=w(t,e)).split(" returns ");r.length>2&&o.throwArgumentError("invalid function string","value",t);let n=r[0].match(F);if(n||o.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&j(e.name),e.inputs=f(n[2],!1),E(n[3].trim(),e),r.length>1){let n=r[1].match(F);""==n[1].trim()&&""==n[3].trim()||o.throwArgumentError("unexpected tokens","value",t),e.outputs=f(n[2],!1)}else e.outputs=[];return x.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function A(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||o.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class O extends y{format(t){if(t||(t=d.sighash),d[t]||o.throwArgumentError("invalid format type","format",t),t===d.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==d.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===d.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?O.fromString(t):O.fromObject(t)}static fromObject(t){if(O.isErrorFragment(t))return t;"error"!==t.type&&o.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:j(t.name),inputs:t.inputs?t.inputs.map(g.fromObject):[]};return A(new O(u,e))}static fromString(t){let e={type:"error"},r=t.match(F);return r||o.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&j(e.name),e.inputs=f(r[2],!1),A(O.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function S(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const N=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function j(t){return t&&t.match(N)||o.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const F=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const R=new n.Logger(i);class T{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){R.throwArgumentError(t,this.localName,e)}}class L{constructor(t){a.defineReadOnly(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return e.hexConcat(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(e.concat(t._data))}writeBytes(t){let r=e.arrayify(t);const n=r.length%this.wordSize;return n&&(r=e.concat([r,this._padding.slice(n)])),this._writeData(r)}_getValue(t){let r=e.arrayify(n.BigNumber.from(t));return r.length>this.wordSize&&R.throwError("value out-of-bounds",n.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=e.concat([this._padding.slice(r.length%this.wordSize),r])),r}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 M{constructor(t,r,n,s){a.defineReadOnly(this,"_data",e.arrayify(t)),a.defineReadOnly(this,"wordSize",r||32),a.defineReadOnly(this,"_coerceFunc",n),a.defineReadOnly(this,"allowLoose",s),this._offset=0}get data(){return e.hexlify(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):M.coerce(t,e)}_peekBytes(t,e,r){let a=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+a>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?a=e:R.throwError("data out-of-bounds",n.Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+a})),this._data.slice(this._offset,this._offset+a)}subReader(t){return new M(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 n.BigNumber.from(this.readBytes(this.wordSize))}}class V extends T{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=t.getAddress(r)}catch(t){this._throwError(t.message,r)}return e.writeValue(r)}decode(r){return t.getAddress(e.hexZeroPad(r.readValue().toHexString(),20))}}class C extends T{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 z=new n.Logger(i);function k(t,e,r){let a=null;if(Array.isArray(r))a=r;else if(r&&"object"==typeof r){let t={};a=e.map((e=>{const a=e.localName;return a||z.throwError("cannot encode object for signature with missing names",n.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[a]&&z.throwError("cannot encode object for signature with duplicate names",n.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[a]=!0,r[a]}))}else z.throwArgumentError("invalid tuple value","tuple",r);e.length!==a.length&&z.throwArgumentError("types/value length mismatch","tuple",r);let s=new L(t.wordSize),i=new L(t.wordSize),o=[];e.forEach(((t,e)=>{let r=a[e];if(t.dynamic){let e=i.length;t.encode(i,r);let n=s.writeUpdatableValue();o.push((t=>{n(t+e)}))}else t.encode(s,r)})),o.forEach((t=>{t(s.length)}));let u=t.appendWriter(s);return u+=t.appendWriter(i),u}function P(t,e){let r=[],a=t.subReader(0);e.forEach((e=>{let s=null;if(e.dynamic){let r=t.readValue(),i=a.subReader(r.toNumber());try{s=e.decode(i)}catch(t){if(t.code===n.Logger.errors.BUFFER_OVERRUN)throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}}else try{s=e.decode(t)}catch(t){if(t.code===n.Logger.errors.BUFFER_OVERRUN)throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}null!=s&&r.push(s)}));const s=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!==s[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const a=r[e];a instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw a}}):r[n]=a}));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 B extends T{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)),z.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 k(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&z.throwError("insufficient data length",n.Logger.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new C(this.coder));return t.coerce(this.name,P(t,r))}}class I extends T{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 U extends T{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,r){r=e.arrayify(r);let n=t.writeValue(r.length);return n+=t.writeBytes(r),n}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class D extends U{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,e.hexlify(super.decode(t)))}}class $ extends T{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,r){let n=e.arrayify(r);return n.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(n)}decode(t){return t.coerce(this.name,e.hexlify(t.readBytes(this.size)))}}class J extends T{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 W extends T{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=n.BigNumber.from(e),a=s.MaxUint256.mask(8*t.wordSize);if(this.signed){let t=a.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(s.One).mul(s.NegativeOne)))&&this._throwError("value out-of-bounds",e)}else(r.lt(s.Zero)||r.gt(a.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 q extends U{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,n.toUtf8Bytes(e))}decode(t){return n.toUtf8String(super.decode(t))}}class H extends T{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 k(t,this.coders,e)}decode(t){return t.coerce(this.name,P(t,this.coders))}}const Z=new n.Logger(i),G=new RegExp(/^bytes([0-9]*)$/),X=new RegExp(/^(u?int)([0-9]*)$/);class K{constructor(t){a.defineReadOnly(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new V(t.name);case"bool":return new I(t.name);case"string":return new q(t.name);case"bytes":return new D(t.name);case"array":return new B(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new H((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new J(t.name)}let e=t.type.match(X);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&Z.throwArgumentError("invalid "+e[1]+" bit length","param",t),new W(r/8,"int"===e[1],t.name)}if(e=t.type.match(G),e){let r=parseInt(e[1]);return(0===r||r>32)&&Z.throwArgumentError("invalid bytes length","param",t),new $(r,t.name)}return Z.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new M(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new L(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(g.from(t))));return new H(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Z.throwError("types/values length mismatch",n.Logger.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(g.from(t)))),a=new H(r,"_"),s=this._getWriter();return a.encode(s,e),s.data}decode(t,r,n){const a=t.map((t=>this._getCoder(g.from(t))));return new H(a,"_").decode(this._getReader(e.arrayify(r),n))}}const Q=new K,Y=new n.Logger(i);class tt extends a.Description{}class et extends a.Description{}class rt extends a.Description{}class nt extends a.Description{static isIndexed(t){return!(!t||!t._isIndexed)}}const at={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function st(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}exports.AbiCoder=K,exports.ConstructorFragment=_,exports.ErrorFragment=O,exports.EventFragment=b,exports.FormatTypes=d,exports.Fragment=y,exports.FunctionFragment=x,exports.Indexed=nt,exports.Interface=class{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,a.defineReadOnly(this,"fragments",e.map((t=>y.from(t))).filter((t=>null!=t))),a.defineReadOnly(this,"_abiCoder",a.getStatic(new.target,"getAbiCoder")()),a.defineReadOnly(this,"functions",{}),a.defineReadOnly(this,"errors",{}),a.defineReadOnly(this,"events",{}),a.defineReadOnly(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void Y.warn("duplicate definition - constructor"):void a.defineReadOnly(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]?Y.warn("duplicate definition - "+r):e[r]=t})),this.deploy||a.defineReadOnly(this,"deploy",_.from({payable:!1,type:"constructor"})),a.defineReadOnly(this,"_isInterface",!0)}format(t){t||(t=d.full),t===d.sighash&&Y.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===d.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return Q}static getAddress(e){return t.getAddress(e)}static getSighash(t){return e.hexDataSlice(r.id(t.format()),0,4)}static getEventTopic(t){return r.id(t.format())}getFunction(t){if(e.isHexString(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];Y.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?Y.throwArgumentError("no matching function","name",e):r.length>1&&Y.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const r=this.functions[x.fromString(t).format()];return r||Y.throwArgumentError("no matching function","signature",t),r}getEvent(t){if(e.isHexString(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];Y.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?Y.throwArgumentError("no matching event","name",e):r.length>1&&Y.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const r=this.events[b.fromString(t).format()];return r||Y.throwArgumentError("no matching event","signature",t),r}getError(t){if(e.isHexString(t)){const e=a.getStatic(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}Y.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?Y.throwArgumentError("no matching error","name",e):r.length>1&&Y.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const r=this.errors[x.fromString(t).format()];return r||Y.throwArgumentError("no matching error","signature",t),r}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return a.getStatic(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),a.getStatic(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,r){"string"==typeof t&&(t=this.getError(t));const n=e.arrayify(r);return e.hexlify(n.slice(0,4))!==this.getSighash(t)&&Y.throwArgumentError(`data signature does not match error ${t.name}.`,"data",e.hexlify(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,r){return"string"==typeof t&&(t=this.getError(t)),e.hexlify(e.concat([this.getSighash(t),this._encodeParams(t.inputs,r||[])]))}decodeFunctionData(t,r){"string"==typeof t&&(t=this.getFunction(t));const n=e.arrayify(r);return e.hexlify(n.slice(0,4))!==this.getSighash(t)&&Y.throwArgumentError(`data signature does not match function ${t.name}.`,"data",e.hexlify(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,r){return"string"==typeof t&&(t=this.getFunction(t)),e.hexlify(e.concat([this.getSighash(t),this._encodeParams(t.inputs,r||[])]))}decodeFunctionResult(t,r){"string"==typeof t&&(t=this.getFunction(t));let a=e.arrayify(r),s=null,i="",o=null,u=null,c=null;switch(a.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,a)}catch(t){}break;case 4:{const t=e.hexlify(a.slice(0,4)),r=at[t];if(r)o=this._abiCoder.decode(r.inputs,a.slice(4)),u=r.name,c=r.signature,r.reason&&(s=o[0]),"Error"===u?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===u&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,a.slice(4)),u=e.name,c=e.format()}catch(t){}break}}return Y.throwError("call revert exception"+i,n.Logger.errors.CALL_EXCEPTION,{method:t.format(),data:e.hexlify(r),errorArgs:o,errorName:u,errorSignature:c,reason:s})}encodeFunctionResult(t,r){return"string"==typeof t&&(t=this.getFunction(t)),e.hexlify(this._abiCoder.encode(t.outputs,r||[]))}encodeFilterTopics(t,a){"string"==typeof t&&(t=this.getEvent(t)),a.length>t.inputs.length&&Y.throwError("too many arguments for "+t.format(),n.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:a});let s=[];t.anonymous||s.push(this.getEventTopic(t));const i=(t,a)=>"string"===t.type?r.id(a):"bytes"===t.type?n.keccak256(e.hexlify(a)):("bool"===t.type&&"boolean"==typeof a&&(a=a?"0x01":"0x00"),t.type.match(/^u?int/)&&(a=n.BigNumber.from(a).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[a]),e.hexZeroPad(e.hexlify(a),32));for(a.forEach(((e,r)=>{let n=t.inputs[r];n.indexed?null==e?s.push(null):"array"===n.baseType||"tuple"===n.baseType?Y.throwArgumentError("filtering with tuples or arrays not supported","contract."+n.name,e):Array.isArray(e)?s.push(e.map((t=>i(n,t)))):s.push(i(n,e)):null!=e&&Y.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+n.name,e)}));s.length&&null===s[s.length-1];)s.pop();return s}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const a=[],s=[],i=[];return t.anonymous||a.push(this.getEventTopic(t)),e.length!==t.inputs.length&&Y.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const u=e[o];if(t.indexed)if("string"===t.type)a.push(r.id(u));else if("bytes"===t.type)a.push(n.keccak256(u));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");a.push(this._abiCoder.encode([t.type],[u]))}else s.push(t),i.push(u)})),{data:this._abiCoder.encode(s,i),topics:a}}decodeEventLog(t,r,a){if("string"==typeof t&&(t=this.getEvent(t)),null!=a&&!t.anonymous){let r=this.getEventTopic(t);e.isHexString(a[0],32)&&a[0].toLowerCase()===r||Y.throwError("fragment/topic mismatch",n.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:r,value:a[0]}),a=a.slice(1)}let s=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(s.push(g.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(s.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let u=null!=a?this._abiCoder.decode(s,e.concat(a)):null,c=this._abiCoder.decode(i,r,!0),l=[],h=0,m=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==u)l[e]=new nt({_isIndexed:!0,hash:null});else if(o[e])l[e]=new nt({_isIndexed:!0,hash:u[m++]});else try{l[e]=u[m++]}catch(t){l[e]=t}else try{l[e]=c[h++]}catch(t){l[e]=t}if(t.name&&null==l[t.name]){const r=l[e];r instanceof Error?Object.defineProperty(l,t.name,{enumerable:!0,get:()=>{throw st(`property ${JSON.stringify(t.name)}`,r)}}):l[t.name]=r}}));for(let t=0;t<l.length;t++){const e=l[t];e instanceof Error&&Object.defineProperty(l,t,{enumerable:!0,get:()=>{throw st(`index ${t}`,e)}})}return Object.freeze(l)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new et({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:n.BigNumber.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new tt({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const r=e.hexlify(t);let n=this.getError(r.substring(0,10).toLowerCase());return n?new rt({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!(!t||!t._isInterface)}},exports.LogDescription=tt,exports.ParamType=g,exports.TransactionDescription=et,exports.checkResultErrors=function(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},exports.defaultAbiCoder=Q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r,t,e=require("./index-
|
|
1
|
+
"use strict";var r,t,e=require("./index-5ce728f7.cjs"),o=require("./sha256-559d937c.cjs"),i={exports:{}},n={exports:{}};function a(){return r||(r=1,t=n,e.commonjsGlobal,t.exports=(l=o.requireCore(),s=(a=l).lib,h=s.Base,f=s.WordArray,(c=a.x64={}).Word=h.extend({init:function(r,t){this.high=r,this.low=t}}),c.WordArray=h.extend({init:function(r,t){r=this.words=r||[],this.sigBytes=t!=i?t:8*r.length},toX32:function(){for(var r=this.words,t=r.length,e=[],o=0;o<t;o++){var i=r[o];e.push(i.high),e.push(i.low)}return f.create(e,this.sigBytes)},clone:function(){for(var r=h.clone.call(this),t=r.words=this.words.slice(0),e=t.length,o=0;o<e;o++)t[o]=t[o].clone();return r}}),l)),n.exports;var t,i,a,s,h,f,c,l}var s,h={exports:{}};exports.requireLibTypedarrays=function(){return s||(s=1,r=h,e.commonjsGlobal,r.exports=(t=o.requireCore(),function(){if("function"==typeof ArrayBuffer){var r=t.lib.WordArray,e=r.init,o=r.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,o=[],i=0;i<t;i++)o[i>>>2]|=r[i]<<24-i%4*8;e.call(this,o,t)}else e.apply(this,arguments)};o.prototype=r}}(),t.lib.WordArray)),h.exports;var r,t},exports.requireSha3=function(){return t||(t=1,r=i,e.commonjsGlobal,r.exports=(n=o.requireCore(),a(),function(r){var t=n,e=t.lib,o=e.WordArray,i=e.Hasher,a=t.x64.Word,s=t.algo,h=[],f=[],c=[];!function(){for(var r=1,t=0,e=0;e<24;e++){h[r+5*t]=(e+1)*(e+2)/2%64;var o=(2*r+3*t)%5;r=t%5,t=o}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 i=1,n=0;n<24;n++){for(var s=0,l=0,u=0;u<7;u++){if(1&i){var v=(1<<u)-1;v<32?l^=1<<v:s^=1<<v-32}128&i?i=i<<1^113:i<<=1}c[n]=a.create(s,l)}}();var l=[];!function(){for(var r=0;r<25;r++)l[r]=a.create()}();var u=s.SHA3=i.extend({cfg:i.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 e=this._state,o=this.blockSize/2,i=0;i<o;i++){var n=r[t+2*i],a=r[t+2*i+1];n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(U=e[i]).high^=a,U.low^=n}for(var s=0;s<24;s++){for(var u=0;u<5;u++){for(var v=0,g=0,y=0;y<5;y++)v^=(U=e[u+5*y]).high,g^=U.low;var p=l[u];p.high=v,p.low=g}for(u=0;u<5;u++){var w=l[(u+4)%5],d=l[(u+1)%5],A=d.high,x=d.low;for(v=w.high^(A<<1|x>>>31),g=w.low^(x<<1|A>>>31),y=0;y<5;y++)(U=e[u+5*y]).high^=v,U.low^=g}for(var b=1;b<25;b++){var _=(U=e[b]).high,m=U.low,B=h[b];B<32?(v=_<<B|m>>>32-B,g=m<<B|_>>>32-B):(v=m<<B-32|_>>>64-B,g=_<<B-32|m>>>64-B);var H=l[f[b]];H.high=v,H.low=g}var q=l[0],S=e[0];for(q.high=S.high,q.low=S.low,u=0;u<5;u++)for(y=0;y<5;y++){var U=e[b=u+5*y],W=l[b],C=l[(u+1)%5+5*y],L=l[(u+2)%5+5*y];U.high=W.high^~C.high&L.high,U.low=W.low^~C.low&L.low}U=e[0];var j=c[s];U.high^=j.high,U.low^=j.low}},_doFinalize:function(){var t=this._data,e=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;e[i>>>5]|=1<<24-i%32,e[(r.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*e.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],u=l.high,v=l.low;u=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),v=16711935&(v<<8|v>>>24)|4278255360&(v<<24|v>>>8),f.push(v),f.push(u)}return new o.init(f,s)},clone:function(){for(var r=i.clone.call(this),t=r._state=this._state.slice(0),e=0;e<25;e++)t[e]=t[e].clone();return r}});t.SHA3=i._createHelper(u),t.HmacSHA3=i._createHmacHelper(u)}(Math),n.SHA3)),i.exports;var r,n},exports.requireX64Core=a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-5ce728f7.cjs");require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/address"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("events"),require("@ethersproject/constants"),require("@ethersproject/transactions");var t,r={exports:{}};t=r,e.commonjsGlobal,t.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
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-5ce728f7.cjs");require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/address"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("events"),require("@ethersproject/constants"),require("@ethersproject/transactions");const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],r=["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.__awaiter(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.__awaiter(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.__awaiter(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.__awaiter(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.__awaiter(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,r;if(e.data.target!==t)return;const s=null===(r=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===r?void 0:r.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,r,s,o;(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===(r=t.data.value.data)||void 0===r?void 0:r.error):null===(s=this.callBackList[e.id])||void 0===s||s.resolve(null===(o=t.data.value.data)||void 0===o?void 0:o.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,s,o,a,d,h,l;const c=null===(a=null===(o=null===(s=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===s?void 0:s.data)||void 0===o?void 0:o.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)),r.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,r)=>{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:r}}))}_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)})}}exports.default=function(){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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-5ce728f7.cjs"),r=require("./index.es-26c6ee46.cjs");require("@ethersproject/address"),require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("events"),require("@ethersproject/constants"),require("@ethersproject/transactions"),require("./_commonjs-dynamic-modules-f09a98c7.cjs"),exports.default=function({chainId:o,rpcUrl:t,rpc:n,walletConnectParams:i,darkMode:c},s){return e.__awaiter(this,void 0,void 0,(function*(){let a,d,u="wss://relay.walletconnect.com",l=!0;i&&(u=i.bridge||u,l=void 0!==i.qrcode?i.qrcode:l,i.infuraId,d=i.qrModalOptions||void 0),n?a=n:o&&t&&(a={[o]:t});const p=e.getIsMobile(),h=yield r.EthereumProvider.init({projectId:null==i?void 0:i.projectId,chains:o?[o]:[],showQrModal:!p,rpcMap:a,qrModalOptions:Object.assign({themeMode:c?"dark":"light"},d)});return h.on("display_uri",(e=>{(null==d?void 0:d.openCallback)&&d.openCallback(e)})),h.on("connect",s.connect),h.on("disconnect",(e=>{s.disconnect(e),s.accountsChanged([])})),h.on("accountsChanged",s.accountsChanged),h.on("chainChanged",s.chainChanged),h.on("message",(({type:e,data:r})=>s.message(e,r))),new Promise((r=>e.__awaiter(this,void 0,void 0,(function*(){p?(h.once("display_uri",(o=>{let t=o;e.getIsIOS()&&(t=`rainbow://wc?uri=${encodeURIComponent(o)}&connector=rainbowkit`),window.location.href=t,r(e.convertWeb3Provider(h))})),h.enable()):(yield h.enable(),r(e.convertWeb3Provider(h)))}))))}))};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("./index-
|
|
1
|
+
"use strict";var t=require("./index-5ce728f7.cjs");require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/address"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("events"),require("@ethersproject/constants"),require("@ethersproject/transactions");class e extends t.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,t.ahash(e);const n=t.toBytes(r);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=e.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),t.clean(i)}update(e){return t.aexists(this),this.iHash.update(e),this}digestInto(e){t.aexists(this),t.abytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return t.finished=n,t.destroyed=o,t.blockLen=i,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const r=(t,r,n)=>new e(t,r).update(n).digest();r.create=(t,r)=>new e(t,r)
|
|
2
2
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;const n=BigInt(0),o=BigInt(1);function i(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function s(t){if(!i(t))throw new Error("Uint8Array expected")}function a(t,e){if("boolean"!=typeof e)throw new Error(t+" boolean expected, got "+e)}function f(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function c(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?n:BigInt("0x"+t)}const u="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,d=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function l(t){if(s(t),u)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=d[t[r]];return e}const h={_0:48,_9:57,A:65,F:70,a:97,f:102};function w(t){return t>=h._0&&t<=h._9?t-h._0:t>=h.A&&t<=h.F?t-(h.A-10):t>=h.a&&t<=h.f?t-(h.a-10):void 0}function g(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);if(u)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,o=0;e<r;e++,o+=2){const r=w(t.charCodeAt(o)),i=w(t.charCodeAt(o+1));if(void 0===r||void 0===i){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}n[e]=16*r+i}return n}function p(t){return c(l(t))}function m(t){return s(t),c(l(Uint8Array.from(t).reverse()))}function y(t,e){return g(t.toString(16).padStart(2*e,"0"))}function b(t,e){return y(t,e).reverse()}function E(t,e,r){let n;if("string"==typeof e)try{n=g(e)}catch(e){throw new Error(t+" must be hex string or Uint8Array, cause: "+e)}else{if(!i(e))throw new Error(t+" must be hex string or Uint8Array");n=Uint8Array.from(e)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(t+" of length "+r+" expected, got "+o);return n}function v(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];s(n),e+=n.length}const r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const o=t[e];r.set(o,n),n+=o.length}return r}function x(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}const B=t=>"bigint"==typeof t&&n<=t;function S(t,e,r){return B(t)&&B(e)&&B(r)&&e<=t&&t<r}function A(t,e,r,n){if(!S(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}const O=t=>(o<<BigInt(t))-o,I=t=>new Uint8Array(t),q=t=>Uint8Array.from(t);const R={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||i(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function N(t,e,r={}){const n=(e,r,n)=>{const o=R[r];if("function"!=typeof o)throw new Error("invalid validator function");const i=t[e];if(!(n&&void 0===i||o(i,t)))throw new Error("param "+String(e)+" is invalid. Expected "+r+", got "+i)};for(const[t,r]of Object.entries(e))n(t,r,!1);for(const[t,e]of Object.entries(r))n(t,e,!0);return t}function T(t){const e=new WeakMap;return(r,...n)=>{const o=e.get(r);if(void 0!==o)return o;const i=t(r,...n);return e.set(r,i),i}}const H=BigInt(0),P=BigInt(1),U=BigInt(2),k=BigInt(3),Z=BigInt(4),C=BigInt(5),L=BigInt(8);function z(t,e){const r=t%e;return r>=H?r:e+r}function F(t,e,r){let n=t;for(;e-- >H;)n*=n,n%=r;return n}function _(t,e){if(t===H)throw new Error("invert: expected non-zero number");if(e<=H)throw new Error("invert: expected positive modulus, got "+e);let r=z(t,e),n=e,o=H,i=P;for(;r!==H;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==P)throw new Error("invert: does not exist");return z(o,e)}function D(t,e){const r=(t.ORDER+P)/Z,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function V(t,e){const r=(t.ORDER-C)/L,n=t.mul(e,U),o=t.pow(n,r),i=t.mul(e,o),s=t.mul(t.mul(i,U),o),a=t.mul(i,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function j(t){return t%Z===k?D:t%L===C?V:function(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let e=t-P,r=0;for(;e%U===H;)e/=U,r++;let n=U;const o=X(t);for(;1===W(o,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return D;let i=o.pow(n,e);const s=(e+P)/U;return function(t,n){if(t.is0(n))return n;if(1!==W(t,n))throw new Error("Cannot find square root");let o=r,a=t.mul(t.ONE,i),f=t.pow(n,e),c=t.pow(n,s);for(;!t.eql(f,t.ONE);){if(t.is0(f))return t.ZERO;let e=1,r=t.sqr(f);for(;!t.eql(r,t.ONE);)if(e++,r=t.sqr(r),e===o)throw new Error("Cannot find square root");const n=P<<BigInt(o-e-1),i=t.pow(a,n);o=e,a=t.sqr(i),f=t.mul(f,a),c=t.mul(c,i)}return c}}(t)}const K=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function M(t){return N(t,K.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}function Y(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),o=e.reduce(((e,r,o)=>t.is0(r)?e:(n[o]=e,t.mul(e,r))),t.ONE),i=t.inv(o);return e.reduceRight(((e,r,o)=>t.is0(r)?e:(n[o]=t.mul(e,n[o]),t.mul(e,r))),i),n}function W(t,e){const r=(t.ORDER-P)/U,n=t.pow(e,r),o=t.eql(n,t.ONE),i=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!o&&!i&&!s)throw new Error("invalid Legendre symbol result");return o?1:i?0:-1}function G(e,r){void 0!==r&&t.anumber(r);const n=void 0!==r?r:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function X(t,e,r=!1,n={}){if(t<=H)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:o,nByteLength:i}=G(t,e);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const a=Object.freeze({ORDER:t,isLE:r,BITS:o,BYTES:i,MASK:O(o),ZERO:H,ONE:P,create:e=>z(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("invalid field element: expected bigint, got "+typeof e);return H<=e&&e<t},is0:t=>t===H,isOdd:t=>(t&P)===P,neg:e=>z(-e,t),eql:(t,e)=>t===e,sqr:e=>z(e*e,t),add:(e,r)=>z(e+r,t),sub:(e,r)=>z(e-r,t),mul:(e,r)=>z(e*r,t),pow:(t,e)=>function(t,e,r){if(r<H)throw new Error("invalid exponent, negatives unsupported");if(r===H)return t.ONE;if(r===P)return e;let n=t.ONE,o=e;for(;r>H;)r&P&&(n=t.mul(n,o)),o=t.sqr(o),r>>=P;return n}(a,t,e),div:(e,r)=>z(e*_(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>_(e,t),sqrt:n.sqrt||(e=>(s||(s=j(t)),s(a,e))),toBytes:t=>r?b(t,i):y(t,i),fromBytes:t=>{if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);return r?m(t):p(t)},invertBatch:t=>Y(a,t),cmov:(t,e,r)=>r?e:t});return Object.freeze(a)}function J(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Q(t){const e=J(t);return e+Math.ceil(e/2)}const $=BigInt(0),tt=BigInt(1);function et(t,e){const r=e.negate();return t?r:e}function rt(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function nt(t,e){rt(t,e);const r=2**t;return{windows:Math.ceil(e/t)+1,windowSize:2**(t-1),mask:O(t),maxNumber:r,shiftBy:BigInt(t)}}function ot(t,e,r){const{windowSize:n,mask:o,maxNumber:i,shiftBy:s}=r;let a=Number(t&o),f=t>>s;a>n&&(a-=i,f+=tt);const c=e*n;return{nextN:f,offset:c+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:e%2!=0,offsetF:c}}const it=new WeakMap,st=new WeakMap;function at(t){return st.get(t)||1}function ft(t,e,r,i){!function(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach(((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)}))}(r,t),function(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach(((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)}))}(i,e);const s=r.length,a=i.length;if(s!==a)throw new Error("arrays of points and scalars must have equal length");const f=t.ZERO,c=function(t){let e;for(e=0;t>n;t>>=o,e+=1);return e}(BigInt(s));let u=1;c>12?u=c-3:c>4?u=c-2:c>0&&(u=2);const d=O(u),l=new Array(Number(d)+1).fill(f);let h=f;for(let t=Math.floor((e.BITS-1)/u)*u;t>=0;t-=u){l.fill(f);for(let e=0;e<a;e++){const n=i[e],o=Number(n>>BigInt(t)&d);l[o]=l[o].add(r[e])}let e=f;for(let t=l.length-1,r=f;t>0;t--)r=r.add(l[t]),e=e.add(r);if(h=h.add(e),0!==t)for(let t=0;t<u;t++)h=h.double()}return h}function ct(t){return M(t.Fp),N(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...G(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function ut(t){void 0!==t.lowS&&a("lowS",t.lowS),void 0!==t.prehash&&a("prehash",t.prehash)}class dt extends Error{constructor(t=""){super(t)}}const lt={Err:dt,_tlv:{encode:(t,e)=>{const{Err:r}=lt;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(1&e.length)throw new r("tlv.encode: unpadded data");const n=e.length/2,o=f(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");const i=n>127?f(o.length/2|128):"";return f(t)+i+o+e},decode(t,e){const{Err:r}=lt;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const o=e[n++];let i=0;if(!!(128&o)){const t=127&o;if(!t)throw new r("tlv.decode(long): indefinite length not supported");if(t>4)throw new r("tlv.decode(long): byte length is too big");const s=e.subarray(n,n+t);if(s.length!==t)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(const t of s)i=i<<8|t;if(n+=t,i<128)throw new r("tlv.decode(long): not minimal encoding")}else i=o;const s=e.subarray(n,n+i);if(s.length!==i)throw new r("tlv.decode: wrong value length");return{v:s,l:e.subarray(n+i)}}},_int:{encode(t){const{Err:e}=lt;if(t<wt)throw new e("integer: negative integers are not allowed");let r=f(t);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=lt;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return p(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=lt,o=E("signature",t),{v:i,l:s}=n.decode(48,o);if(s.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:f}=n.decode(2,i),{v:c,l:u}=n.decode(2,f);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(c)}},hexFromSig(t){const{_tlv:e,_int:r}=lt,n=e.encode(2,r.encode(t.r))+e.encode(2,r.encode(t.s));return e.encode(48,n)}};function ht(t,e){return l(y(t,e))}const wt=BigInt(0),gt=BigInt(1),pt=BigInt(2),mt=BigInt(3),yt=BigInt(4);function bt(t){const e=function(t){const e=ct(t);N(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:r,Fp:n,a:o}=e;if(r){if(!n.eql(o,n.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}(t),{Fp:r}=e,n=X(e.n,e.nBitLength),o=e.toBytes||((t,e,n)=>{const o=e.toAffine();return v(Uint8Array.from([4]),r.toBytes(o.x),r.toBytes(o.y))}),s=e.fromBytes||(t=>{const e=t.subarray(1);return{x:r.fromBytes(e.subarray(0,r.BYTES)),y:r.fromBytes(e.subarray(r.BYTES,2*r.BYTES))}});function f(t){const{a:n,b:o}=e,i=r.sqr(t),s=r.mul(i,t);return r.add(r.add(s,r.mul(t,n)),o)}function c(t,e){const n=r.sqr(e),o=f(t);return r.eql(n,o)}if(!c(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const u=r.mul(r.pow(e.a,mt),yt),d=r.mul(r.sqr(e.b),BigInt(27));if(r.is0(r.add(u,d)))throw new Error("bad curve params: a or b");function h(t){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:o,n:s}=e;if(r&&"bigint"!=typeof t){if(i(t)&&(t=l(t)),"string"!=typeof t||!r.includes(t.length))throw new Error("invalid private key");t=t.padStart(2*n,"0")}let a;try{a="bigint"==typeof t?t:p(E("private key",t,n))}catch(e){throw new Error("invalid private key, expected hex or "+n+" bytes, got "+typeof t)}return o&&(a=z(a,s)),A("private key",a,gt,s),a}function w(t){if(!(t instanceof y))throw new Error("ProjectivePoint expected")}const g=T(((t,e)=>{const{px:n,py:o,pz:i}=t;if(r.eql(i,r.ONE))return{x:n,y:o};const s=t.is0();null==e&&(e=s?r.ONE:r.inv(i));const a=r.mul(n,e),f=r.mul(o,e),c=r.mul(i,e);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:f}})),m=T((t=>{if(t.is0()){if(e.allowInfinityPoint&&!r.is0(t.py))return;throw new Error("bad point: ZERO")}const{x:n,y:o}=t.toAffine();if(!r.isValid(n)||!r.isValid(o))throw new Error("bad point: x or y not FE");if(!c(n,o))throw new Error("bad point: equation left != right");if(!t.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class y{constructor(t,e,n){if(null==t||!r.isValid(t))throw new Error("x required");if(null==e||!r.isValid(e)||r.is0(e))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required");this.px=t,this.py=e,this.pz=n,Object.freeze(this)}static fromAffine(t){const{x:e,y:n}=t||{};if(!t||!r.isValid(e)||!r.isValid(n))throw new Error("invalid affine point");if(t instanceof y)throw new Error("projective point not allowed");const o=t=>r.eql(t,r.ZERO);return o(e)&&o(n)?y.ZERO:new y(e,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=Y(r,t.map((t=>t.pz)));return t.map(((t,r)=>t.toAffine(e[r]))).map(y.fromAffine)}static fromHex(t){const e=y.fromAffine(s(E("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return y.BASE.multiply(h(t))}static msm(t,e){return ft(y,n,t,e)}_setWindowSize(t){B.setWindowSize(this,t)}assertValidity(){m(this)}hasEvenY(){const{y:t}=this.toAffine();if(r.isOdd)return!r.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){w(t);const{px:e,py:n,pz:o}=this,{px:i,py:s,pz:a}=t,f=r.eql(r.mul(e,a),r.mul(i,o)),c=r.eql(r.mul(n,a),r.mul(s,o));return f&&c}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:t,b:n}=e,o=r.mul(n,mt),{px:i,py:s,pz:a}=this;let f=r.ZERO,c=r.ZERO,u=r.ZERO,d=r.mul(i,i),l=r.mul(s,s),h=r.mul(a,a),w=r.mul(i,s);return w=r.add(w,w),u=r.mul(i,a),u=r.add(u,u),f=r.mul(t,u),c=r.mul(o,h),c=r.add(f,c),f=r.sub(l,c),c=r.add(l,c),c=r.mul(f,c),f=r.mul(w,f),u=r.mul(o,u),h=r.mul(t,h),w=r.sub(d,h),w=r.mul(t,w),w=r.add(w,u),u=r.add(d,d),d=r.add(u,d),d=r.add(d,h),d=r.mul(d,w),c=r.add(c,d),h=r.mul(s,a),h=r.add(h,h),d=r.mul(h,w),f=r.sub(f,d),u=r.mul(h,l),u=r.add(u,u),u=r.add(u,u),new y(f,c,u)}add(t){w(t);const{px:n,py:o,pz:i}=this,{px:s,py:a,pz:f}=t;let c=r.ZERO,u=r.ZERO,d=r.ZERO;const l=e.a,h=r.mul(e.b,mt);let g=r.mul(n,s),p=r.mul(o,a),m=r.mul(i,f),b=r.add(n,o),E=r.add(s,a);b=r.mul(b,E),E=r.add(g,p),b=r.sub(b,E),E=r.add(n,i);let v=r.add(s,f);return E=r.mul(E,v),v=r.add(g,m),E=r.sub(E,v),v=r.add(o,i),c=r.add(a,f),v=r.mul(v,c),c=r.add(p,m),v=r.sub(v,c),d=r.mul(l,E),c=r.mul(h,m),d=r.add(c,d),c=r.sub(p,d),d=r.add(p,d),u=r.mul(c,d),p=r.add(g,g),p=r.add(p,g),m=r.mul(l,m),E=r.mul(h,E),p=r.add(p,m),m=r.sub(g,m),m=r.mul(l,m),E=r.add(E,m),g=r.mul(p,E),u=r.add(u,g),g=r.mul(v,E),c=r.mul(b,c),c=r.sub(c,g),g=r.mul(b,p),d=r.mul(v,d),d=r.add(d,g),new y(c,u,d)}subtract(t){return this.add(t.negate())}is0(){return this.equals(y.ZERO)}wNAF(t){return B.wNAFCached(this,t,y.normalizeZ)}multiplyUnsafe(t){const{endo:n,n:o}=e;A("scalar",t,wt,o);const i=y.ZERO;if(t===wt)return i;if(this.is0()||t===gt)return this;if(!n||B.hasPrecomputes(this))return B.wNAFCachedUnsafe(this,t,y.normalizeZ);let{k1neg:s,k1:a,k2neg:f,k2:c}=n.splitScalar(t),u=i,d=i,l=this;for(;a>wt||c>wt;)a>&&(u=u.add(l)),c>&&(d=d.add(l)),l=l.double(),a>>=gt,c>>=gt;return s&&(u=u.negate()),f&&(d=d.negate()),d=new y(r.mul(d.px,n.beta),d.py,d.pz),u.add(d)}multiply(t){const{endo:n,n:o}=e;let i,s;if(A("scalar",t,gt,o),n){const{k1neg:e,k1:o,k2neg:a,k2:f}=n.splitScalar(t);let{p:c,f:u}=this.wNAF(o),{p:d,f:l}=this.wNAF(f);c=B.constTimeNegate(e,c),d=B.constTimeNegate(a,d),d=new y(r.mul(d.px,n.beta),d.py,d.pz),i=c.add(d),s=u.add(l)}else{const{p:e,f:r}=this.wNAF(t);i=e,s=r}return y.normalizeZ([i,s])[0]}multiplyAndAddUnsafe(t,e,r){const n=y.BASE,o=(t,e)=>e!==wt&&e!==gt&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),i=o(this,e).add(o(t,r));return i.is0()?void 0:i}toAffine(t){return g(this,t)}isTorsionFree(){const{h:t,isTorsionFree:r}=e;if(t===gt)return!0;if(r)return r(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:r}=e;return t===gt?this:r?r(y,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return a("isCompressed",t),this.assertValidity(),o(y,this,t)}toHex(t=!0){return a("isCompressed",t),l(this.toRawBytes(t))}}y.BASE=new y(e.Gx,e.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const{endo:b,nBitLength:x}=e,B=(O=y,I=b?Math.ceil(x/2):x,{constTimeNegate:et,hasPrecomputes:t=>1!==at(t),unsafeLadder(t,e,r=O.ZERO){let n=t;for(;e>$;)e&tt&&(r=r.add(n)),n=n.double(),e>>=tt;return r},precomputeWindow(t,e){const{windows:r,windowSize:n}=nt(e,I),o=[];let i=t,s=i;for(let t=0;t<r;t++){s=i,o.push(s);for(let t=1;t<n;t++)s=s.add(i),o.push(s);i=s.double()}return o},wNAF(t,e,r){let n=O.ZERO,o=O.BASE;const i=nt(t,I);for(let t=0;t<i.windows;t++){const{nextN:s,offset:a,isZero:f,isNeg:c,isNegF:u,offsetF:d}=ot(r,t,i);r=s,f?o=o.add(et(u,e[d])):n=n.add(et(c,e[a]))}return{p:n,f:o}},wNAFUnsafe(t,e,r,n=O.ZERO){const o=nt(t,I);for(let t=0;t<o.windows&&r!==$;t++){const{nextN:i,offset:s,isZero:a,isNeg:f}=ot(r,t,o);if(r=i,!a){const t=e[s];n=n.add(f?t.negate():t)}}return n},getPrecomputes(t,e,r){let n=it.get(e);return n||(n=this.precomputeWindow(e,t),1!==t&&it.set(e,r(n))),n},wNAFCached(t,e,r){const n=at(t);return this.wNAF(n,this.getPrecomputes(n,t,r),e)},wNAFCachedUnsafe(t,e,r,n){const o=at(t);return 1===o?this.unsafeLadder(t,e,n):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),e,n)},setWindowSize(t,e){rt(e,I),st.set(t,e),it.delete(t)}});var O,I;return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:h,weierstrassEquation:f,isWithinCurveOrder:function(t){return S(t,gt,e.n)}}}function Et(t){const e=function(t){const e=ct(t);return N(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n,nByteLength:o,nBitLength:s}=e,f=r.BYTES+1,c=2*r.BYTES+1;function u(t){return z(t,n)}function d(t){return _(t,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:h,weierstrassEquation:w,isWithinCurveOrder:x}=bt({...e,toBytes(t,e,n){const o=e.toAffine(),i=r.toBytes(o.x),s=v;return a("isCompressed",n),n?s(Uint8Array.from([e.hasEvenY()?2:3]),i):s(Uint8Array.from([4]),i,r.toBytes(o.y))},fromBytes(t){const e=t.length,n=t[0],o=t.subarray(1);if(e!==f||2!==n&&3!==n){if(e===c&&4===n){return{x:r.fromBytes(o.subarray(0,r.BYTES)),y:r.fromBytes(o.subarray(r.BYTES,2*r.BYTES))}}throw new Error("invalid Point, expected length of "+f+", or uncompressed "+c+", got "+e)}{const t=p(o);if(!S(t,gt,r.ORDER))throw new Error("Point is not on curve");const e=w(t);let i;try{i=r.sqrt(e)}catch(t){const e=t instanceof Error?": "+t.message:"";throw new Error("Point is not on curve"+e)}return 1==(1&n)!==((i>)===gt)&&(i=r.neg(i)),{x:t,y:i}}}});function B(t){return t>n>>gt}const R=(t,e,r)=>p(t.slice(e,r));class T{constructor(t,e,r){A("r",t,gt,n),A("s",e,gt,n),this.r=t,this.s=e,null!=r&&(this.recovery=r),Object.freeze(this)}static fromCompact(t){const e=o;return t=E("compactSignature",t,2*e),new T(R(t,0,e),R(t,e,2*e))}static fromDER(t){const{r:e,s:r}=lt.toSig(E("DER",t));return new T(e,r)}assertValidity(){}addRecoveryBit(t){return new T(this.r,this.s,t)}recoverPublicKey(t){const{r:n,s:o,recovery:i}=this,s=Z(E("msgHash",t));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const a=2===i||3===i?n+e.n:n;if(a>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=0==(1&i)?"02":"03",c=l.fromHex(f+ht(a,r.BYTES)),h=d(a),w=u(-s*h),g=u(o*h),p=l.BASE.multiplyAndAddUnsafe(c,w,g);if(!p)throw new Error("point at infinify");return p.assertValidity(),p}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new T(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return g(this.toDERHex())}toDERHex(){return lt.hexFromSig(this)}toCompactRawBytes(){return g(this.toCompactHex())}toCompactHex(){const t=o;return ht(this.r,t)+ht(this.s,t)}}const H={isValidPrivateKey(t){try{return h(t),!0}catch(t){return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const t=Q(e.n);return function(t,e,r=!1){const n=t.length,o=J(e),i=Q(e);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);const s=z(r?m(t):p(t),e-P)+P;return r?b(s,o):y(s,o)}(e.randomBytes(t),e.n)},precompute:(t=8,e=l.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function U(t){if("bigint"==typeof t)return!1;if(t instanceof l)return!0;const n=E("key",t).length,i=r.BYTES,s=i+1,a=2*i+1;return e.allowedPrivateKeyLengths||o===s?void 0:n===s||n===a}const k=e.bits2int||function(t){if(t.length>8192)throw new Error("input is too large");const e=p(t),r=8*t.length-s;return r>0?e>>BigInt(r):e},Z=e.bits2int_modN||function(t){return u(k(t))},C=O(s);function L(t){return A("num < 2^"+s,t,wt,C),y(t,o)}function F(t,n,o=D){if(["recovered","canonical"].some((t=>t in o)))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:s}=e;let{lowS:a,prehash:f,extraEntropy:c}=o;null==a&&(a=!0),t=E("msgHash",t),ut(o),f&&(t=E("prehashed msgHash",i(t)));const w=Z(t),g=h(n),p=[L(g),L(w)];if(null!=c&&!1!==c){const t=!0===c?s(r.BYTES):c;p.push(E("extraEntropy",t))}const m=v(...p),y=w;return{seed:m,k2sig:function(t){const e=k(t);if(!x(e))return;const r=d(e),n=l.BASE.multiply(e).toAffine(),o=u(n.x);if(o===wt)return;const i=u(r*u(y+o*g));if(i===wt)return;let s=(n.x===o?0:2)|Number(n.y>),f=i;return a&&B(i)&&(f=function(t){return B(t)?u(-t):t}(i),s^=1),new T(o,f,s)}}}const D={lowS:e.lowS,prehash:!1},V={lowS:e.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return l.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,r=!0){if(!0===U(t))throw new Error("first arg must be private key");if(!1===U(e))throw new Error("second arg must be public key");return l.fromHex(e).multiply(h(t)).toRawBytes(r)},sign:function(t,r,n=D){const{seed:o,k2sig:i}=F(t,r,n),s=e;return function(t,e,r){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=I(t),o=I(t),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},a=(...t)=>r(o,n,...t),f=(t=I(0))=>{o=a(q([0]),t),n=a(),0!==t.length&&(o=a(q([1]),t),n=a())},c=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const r=[];for(;t<e;){n=a();const e=n.slice();r.push(e),t+=n.length}return v(...r)};return(t,e)=>{let r;for(s(),f(t);!(r=e(c()));)f();return s(),r}}(s.hash.outputLen,s.nByteLength,s.hmac)(o,i)},verify:function(t,r,n,o=V){const s=t;r=E("msgHash",r),n=E("publicKey",n);const{lowS:a,prehash:f,format:c}=o;if(ut(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==c&&"compact"!==c&&"der"!==c)throw new Error("format must be compact or der");const h="string"==typeof s||i(s),w=!h&&!c&&"object"==typeof s&&null!==s&&"bigint"==typeof s.r&&"bigint"==typeof s.s;if(!h&&!w)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let g,p;try{if(w&&(g=new T(s.r,s.s)),h){try{"compact"!==c&&(g=T.fromDER(s))}catch(t){if(!(t instanceof lt.Err))throw t}g||"der"===c||(g=T.fromCompact(s))}p=l.fromHex(n)}catch(t){return!1}if(!g)return!1;if(a&&g.hasHighS())return!1;f&&(r=e.hash(r));const{r:m,s:y}=g,b=Z(r),v=d(y),x=u(b*v),B=u(m*v),S=l.BASE.multiplyAndAddUnsafe(p,x,B)?.toAffine();return!!S&&u(S.x)===m},ProjectivePoint:l,Signature:T,utils:H}}function vt(t,e){if(M(t),!t.isValid(e.A)||!t.isValid(e.B)||!t.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const r=function(t,e){const r=t.ORDER;let n=wt;for(let t=r-gt;t%pt===wt;t/=pt)n+=gt;const o=n,i=pt<<o-gt-gt,s=i*pt,a=(r-gt)/s,f=(a-gt)/pt,c=s-gt,u=i,d=t.pow(e,a),l=t.pow(e,(a+gt)/pt);let h=(e,r)=>{let n=d,i=t.pow(r,c),s=t.sqr(i);s=t.mul(s,r);let a=t.mul(e,s);a=t.pow(a,f),a=t.mul(a,i),i=t.mul(a,r),s=t.mul(a,e);let h=t.mul(s,i);a=t.pow(h,u);let w=t.eql(a,t.ONE);i=t.mul(s,l),a=t.mul(h,n),s=t.cmov(i,s,w),h=t.cmov(a,h,w);for(let e=o;e>gt;e--){let r=e-pt;r=pt<<r-gt;let o=t.pow(h,r);const a=t.eql(o,t.ONE);i=t.mul(s,n),n=t.mul(n,n),o=t.mul(h,n),s=t.cmov(i,s,a),h=t.cmov(o,h,a)}return{isValid:w,value:s}};if(t.ORDER%yt===mt){const r=(t.ORDER-mt)/yt,n=t.sqrt(t.neg(e));h=(e,o)=>{let i=t.sqr(o);const s=t.mul(e,o);i=t.mul(i,s);let a=t.pow(i,r);a=t.mul(a,s);const f=t.mul(a,n),c=t.mul(t.sqr(a),o),u=t.eql(c,e);return{isValid:u,value:t.cmov(f,a,u)}}}return h}(t,e.Z);if(!t.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let o,i,s,a,f,c,u,d;o=t.sqr(n),o=t.mul(o,e.Z),i=t.sqr(o),i=t.add(i,o),s=t.add(i,t.ONE),s=t.mul(s,e.B),a=t.cmov(e.Z,t.neg(i),!t.eql(i,t.ZERO)),a=t.mul(a,e.A),i=t.sqr(s),c=t.sqr(a),f=t.mul(c,e.A),i=t.add(i,f),i=t.mul(i,s),c=t.mul(c,a),f=t.mul(c,e.B),i=t.add(i,f),u=t.mul(o,s);const{isValid:l,value:h}=r(i,c);d=t.mul(o,n),d=t.mul(d,h),u=t.cmov(u,s,l),d=t.cmov(d,h,l);const w=t.isOdd(n)===t.isOdd(d);d=t.cmov(t.neg(d),d,w);const g=Y(t,[a],!0)[0];return u=t.mul(u,g),{x:u,y:d}}}function xt(e){return{hash:e,hmac:(n,...o)=>r(e,n,t.concatBytes(...o)),randomBytes:t.randomBytes}}const Bt=p;function St(t,e){if(Ot(t),Ot(e),t<0||t>=1<<8*e)throw new Error("invalid I2OSP input: "+t);const r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=255&t,t>>>=8;return new Uint8Array(r)}function At(t,e){const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function Ot(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function It(t,e,r){N(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:o,m:i,hash:a,expand:f,DST:c}=r;s(t),Ot(e);const u="string"==typeof c?x(c):c,d=n.toString(2).length,l=Math.ceil((d+o)/8),h=e*i*l;let w;if("xmd"===f)w=function(t,e,r,n){s(t),s(e),Ot(r),e.length>255&&(e=n(v(x("H2C-OVERSIZE-DST-"),e)));const{outputLen:o,blockLen:i}=n,a=Math.ceil(r/o);if(r>65535||a>255)throw new Error("expand_message_xmd: invalid lenInBytes");const f=v(e,St(e.length,1)),c=St(0,i),u=St(r,2),d=new Array(a),l=n(v(c,t,u,St(0,1),f));d[0]=n(v(l,St(1,1),f));for(let t=1;t<=a;t++){const e=[At(l,d[t-1]),St(t+1,1),f];d[t]=n(v(...e))}return v(...d).slice(0,r)}(t,u,h,a);else if("xof"===f)w=function(t,e,r,n,o){if(s(t),s(e),Ot(r),e.length>255){const t=Math.ceil(2*n/8);e=o.create({dkLen:t}).update(x("H2C-OVERSIZE-DST-")).update(e).digest()}if(r>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return o.create({dkLen:r}).update(t).update(St(r,2)).update(e).update(St(e.length,1)).digest()}(t,u,h,o,a);else{if("_internal_pass"!==f)throw new Error('expand must be "xmd" or "xof"');w=t}const g=new Array(e);for(let t=0;t<e;t++){const e=new Array(i);for(let r=0;r<i;r++){const o=l*(r+t*i),s=w.subarray(o,o+l);e[r]=z(Bt(s),n)}g[t]=e}return g}const qt=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Rt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Nt=BigInt(0),Tt=BigInt(1),Ht=BigInt(2),Pt=(t,e)=>(t+e/Ht)/e;function Ut(t){const e=qt,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),c=t*t*t%e,u=c*c*t%e,d=F(u,r,e)*u%e,l=F(d,r,e)*u%e,h=F(l,Ht,e)*c%e,w=F(h,o,e)*h%e,g=F(w,i,e)*w%e,p=F(g,a,e)*g%e,m=F(p,f,e)*p%e,y=F(m,a,e)*g%e,b=F(y,r,e)*u%e,E=F(b,s,e)*w%e,v=F(E,n,e)*c%e,x=F(v,Ht,e);if(!kt.eql(kt.sqr(x),t))throw new Error("Cannot find square root");return x}const kt=X(qt,void 0,void 0,{sqrt:Ut}),Zt=function(t,e){const r=e=>Et({...t,...xt(e)});return{...r(e),create:r}}({a:Nt,b:BigInt(7),Fp:kt,n:Rt,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Rt,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Tt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=Pt(i*t,e),f=Pt(-n*t,e);let c=z(t-a*r-f*o,e),u=z(-a*n-f*i,e);const d=c>s,l=u>s;if(d&&(c=e-c),l&&(u=e-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:c,k2neg:l,k2:u}}}},t.sha256),Ct={};function Lt(e,...r){let n=Ct[e];if(void 0===n){const r=t.sha256(Uint8Array.from(e,(t=>t.charCodeAt(0))));n=v(r,r),Ct[e]=n}return t.sha256(v(n,...r))}const zt=t=>t.toRawBytes(!0).slice(1),Ft=t=>y(t,32),_t=t=>z(t,qt),Dt=t=>z(t,Rt),Vt=(()=>Zt.ProjectivePoint)(),jt=(t,e,r)=>Vt.BASE.multiplyAndAddUnsafe(t,e,r);function Kt(t){let e=Zt.utils.normPrivateKeyToScalar(t),r=Vt.fromPrivateKey(e);return{scalar:r.hasEvenY()?e:Dt(-e),bytes:zt(r)}}function Mt(t){A("x",t,Tt,qt);const e=_t(t*t);let r=Ut(_t(e*t+BigInt(7)));r%Ht!==Nt&&(r=_t(-r));const n=new Vt(t,r,Tt);return n.assertValidity(),n}const Yt=p;function Wt(...t){return Dt(Yt(Lt("BIP0340/challenge",...t)))}function Gt(t){return Kt(t).bytes}function Xt(e,r,n=t.randomBytes(32)){const o=E("message",e),{bytes:i,scalar:s}=Kt(r),a=E("auxRand",n,32),f=Ft(s^Yt(Lt("BIP0340/aux",a))),c=Lt("BIP0340/nonce",f,i,o),u=Dt(Yt(c));if(u===Nt)throw new Error("sign failed: k is zero");const{bytes:d,scalar:l}=Kt(u),h=Wt(d,i,o),w=new Uint8Array(64);if(w.set(d,0),w.set(Ft(Dt(l+h*s)),32),!Jt(w,o,i))throw new Error("sign: Invalid signature produced");return w}function Jt(t,e,r){const n=E("signature",t,64),o=E("message",e),i=E("publicKey",r,32);try{const t=Mt(Yt(i)),e=Yt(n.subarray(0,32));if(!S(e,Tt,qt))return!1;const r=Yt(n.subarray(32,64));if(!S(r,Tt,Rt))return!1;const s=Wt(Ft(e),zt(t),o),a=jt(t,r,Dt(-s));return!(!a||!a.hasEvenY()||a.toAffine().x!==e)}catch(t){return!1}}const Qt=(()=>({getPublicKey:Gt,sign:Xt,verify:Jt,utils:{randomPrivateKey:Zt.utils.randomPrivateKey,lift_x:Mt,pointToBytes:zt,numberToBytesBE:y,bytesToNumberBE:p,taggedHash:Lt,mod:z}}))(),$t=(()=>function(t,e){const r=e.map((t=>Array.from(t).reverse()));return(e,n)=>{const[o,i,s,a]=r.map((r=>r.reduce(((r,n)=>t.add(t.mul(r,e),n))))),[f,c]=Y(t,[i,a],!0);return e=t.mul(o,f),n=t.mul(n,t.mul(s,c)),{x:e,y:n}}}(kt,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((t=>t.map((t=>BigInt(t)))))))(),te=(()=>vt(kt,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:kt.create(BigInt("-11"))}))(),ee=(()=>function(t,e,r){if("function"!=typeof e)throw new Error("mapToCurve() must be defined");function n(r){return t.fromAffine(e(r))}function o(e){const r=e.clearCofactor();return r.equals(t.ZERO)?t.ZERO:(r.assertValidity(),r)}return{defaults:r,hashToCurve(t,e){const i=It(t,2,{...r,DST:r.DST,...e}),s=n(i[0]),a=n(i[1]);return o(s.add(a))},encodeToCurve:(t,e)=>o(n(It(t,1,{...r,DST:r.encodeDST,...e})[0])),mapToCurve(t){if(!Array.isArray(t))throw new Error("expected array of bigints");for(const e of t)if("bigint"!=typeof e)throw new Error("expected array of bigints");return o(n(t))}}}(Zt.ProjectivePoint,(t=>{const{x:e,y:r}=te(kt.create(t[0]));return $t(e,r)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:kt.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))(),re=(()=>ee.hashToCurve)(),ne=(()=>ee.encodeToCurve)();exports.encodeToCurve=ne,exports.hashToCurve=re,exports.schnorr=Qt,exports.secp256k1=Zt,exports.secp256k1_hasher=ee;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,r=require("./index-
|
|
1
|
+
"use strict";var e,r=require("./index-5ce728f7.cjs"),i=require("./sha256-559d937c.cjs"),t={exports:{}};exports.requireSha224=function(){return e||(e=1,a=t,r.commonjsGlobal,a.exports=(l=i.requireCore(),i.requireSha256(),s=(o=l).lib.WordArray,n=o.algo,c=n.SHA256,u=n.SHA224=c.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=c._doFinalize.call(this);return e.sigBytes-=4,e}}),o.SHA224=c._createHelper(u),o.HmacSHA224=c._createHmacHelper(u),l.SHA224)),t.exports;var a,o,s,n,c,u,l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,n=require("./index-
|
|
1
|
+
"use strict";var t,n=require("./index-5ce728f7.cjs"),e=require("./_commonjs-dynamic-modules-f09a98c7.cjs"),r={exports:{}};function i(){return t||(t=1,i=r,n.commonjsGlobal,i.exports=(o=o||function(t,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==n.commonjsGlobal&&n.commonjsGlobal.crypto&&(i=n.commonjsGlobal.crypto),!i&&"function"==typeof e.commonjsRequire)try{i=n.require$$1}catch(t){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function t(){}return function(n){var e;return t.prototype=n,e=new t,t.prototype=null,e}}(),a={},c=a.lib={},u=c.Base={extend:function(t){var n=s(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)}},f=c.WordArray=u.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=r?n:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var n=this.words,e=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=e[o>>>2]>>>24-o%4*8&255;n[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)n[r+a>>>2]=e[a>>>2];return this.sigBytes+=i,this},clamp:function(){var n=this.words,e=this.sigBytes;n[e>>>2]&=4294967295<<32-e%4*8,n.length=t.ceil(e/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var n=[],e=0;e<t;e+=4)n.push(o());return new f.init(n,t)}}),h=a.enc={},l=h.Hex={stringify:function(t){for(var n=t.words,e=t.sigBytes,r=[],i=0;i<e;i++){var o=n[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var n=t.length,e=[],r=0;r<n;r+=2)e[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new f.init(e,n/2)}},p=h.Latin1={stringify:function(t){for(var n=t.words,e=t.sigBytes,r=[],i=0;i<e;i++){var o=n[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var n=t.length,e=[],r=0;r<n;r++)e[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new f.init(e,n)}},d=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},y=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(n){var e,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=n?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,u=t.min(4*c,o);if(c){for(var h=0;h<c;h+=s)this._doProcessBlock(i,h);e=i.splice(0,c),r.sigBytes-=u}return new f.init(e,u)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});c.Hasher=y.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){y.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,e){return new t.init(e).finalize(n)}},_createHmacHelper:function(t){return function(n,e){return new g.HMAC.init(t,e).finalize(n)}}});var g=a.algo={};return a}(Math),o)),r.exports;var i,o}var o,s={exports:{}};exports.requireCore=i,exports.requireSha256=function(){return o||(o=1,t=s,n.commonjsGlobal,t.exports=(e=i(),function(t){var n=e,r=n.lib,i=r.WordArray,o=r.Hasher,s=n.algo,a=[],c=[];!function(){function n(n){for(var e=t.sqrt(n),r=2;r<=e;r++)if(!(n%r))return!1;return!0}function e(t){return 4294967296*(t-(0|t))|0}for(var r=2,i=0;i<64;)n(r)&&(i<8&&(a[i]=e(t.pow(r,.5))),c[i]=e(t.pow(r,1/3)),i++),r++}();var u=[],f=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,n){for(var e=this._hash.words,r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],f=e[5],h=e[6],l=e[7],p=0;p<64;p++){if(p<16)u[p]=0|t[n+p];else{var d=u[p-15],y=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,g=u[p-2],m=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;u[p]=y+u[p-7]+m+u[p-16]}var w=r&i^r&o^i&o,v=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),_=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&h)+c[p]+u[p];l=h,h=f,f=a,a=s+_|0,s=o,o=i,i=r,r=_+(v+w)|0}e[0]=e[0]+r|0,e[1]=e[1]+i|0,e[2]=e[2]+o|0,e[3]=e[3]+s|0,e[4]=e[4]+a|0,e[5]=e[5]+f|0,e[6]=e[6]+h|0,e[7]=e[7]+l|0},_doFinalize:function(){var n=this._data,e=n.words,r=8*this._nDataBytes,i=8*n.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=t.floor(r/4294967296),e[15+(i+64>>>9<<4)]=r,n.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=o._createHelper(f),n.HmacSHA256=o._createHmacHelper(f)}(Math),e.SHA256)),s.exports;var t,e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@ethersproject/address"),r=require("@ethersproject/bytes"),e=require("./index-
|
|
1
|
+
"use strict";var t=require("@ethersproject/address"),r=require("@ethersproject/bytes"),e=require("./index-5ce728f7.cjs"),n=require("@ethersproject/properties"),i=require("./id-030fb120.cjs");const o="hash/5.7.0";var a=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(a,s)}c((n=n.apply(t,r||[])).next())}))};const s=new e.Logger(o),c=new Uint8Array(32);c.fill(0);const f=e.BigNumber.from(-1),u=e.BigNumber.from(0),h=e.BigNumber.from(1),y=e.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const m=r.hexZeroPad(h.toHexString(),32),d=r.hexZeroPad(u.toHexString(),32),g={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},p=["name","version","chainId","verifyingContract","salt"];function l(t){return function(r){return"string"!=typeof r&&s.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const v={name:l("name"),version:l("version"),chainId:function(t){try{return e.BigNumber.from(t).toString()}catch(t){}return s.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(r){try{return t.getAddress(r).toLowerCase()}catch(t){}return s.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",r)},salt:function(t){try{const e=r.arrayify(t);if(32!==e.length)throw new Error("bad length");return r.hexlify(e)}catch(t){}return s.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function w(n){{const t=n.match(/^(u?)int(\d*)$/);if(t){const i=""===t[1],o=parseInt(t[2]||"256");(o%8!=0||o>256||t[2]&&t[2]!==String(o))&&s.throwArgumentError("invalid numeric width","type",n);const a=y.mask(i?o-1:o),c=i?a.add(h).mul(f):u;return function(t){const i=e.BigNumber.from(t);return(i.lt(c)||i.gt(a))&&s.throwArgumentError(`value out-of-bounds for ${n}`,"value",t),r.hexZeroPad(i.toTwos(256).toHexString(),32)}}}{const t=n.match(/^bytes(\d+)$/);if(t){const e=parseInt(t[1]);return(0===e||e>32||t[1]!==String(e))&&s.throwArgumentError("invalid bytes width","type",n),function(t){return r.arrayify(t).length!==e&&s.throwArgumentError(`invalid length for ${n}`,"value",t),function(t){const e=r.arrayify(t),n=e.length%32;return n?r.hexConcat([e,c.slice(n)]):r.hexlify(e)}(t)}}}switch(n){case"address":return function(e){return r.hexZeroPad(t.getAddress(e),32)};case"bool":return function(t){return t?m:d};case"bytes":return function(t){return e.keccak256(t)};case"string":return function(t){return i.id(t)}}return null}function E(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class x{constructor(t){n.defineReadOnly(this,"types",Object.freeze(n.deepCopy(t))),n.defineReadOnly(this,"_encoderCache",{}),n.defineReadOnly(this,"_types",{});const r={},e={},i={};Object.keys(t).forEach((t=>{r[t]={},e[t]=[],i[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&s.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===n&&s.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);w(a)||(e[a]||s.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),e[a].push(n),r[n][a]=!0)}))}const o=Object.keys(e).filter((t=>0===e[t].length));0===o.length?s.throwArgumentError("missing primary type","types",t):o.length>1&&s.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),n.defineReadOnly(this,"primaryType",o[0]),function n(o,a){a[o]&&s.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(r[o]).forEach((t=>{e[t]&&(n(t,a),Object.keys(a).forEach((r=>{i[r][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const r in i){const e=Object.keys(i[r]);e.sort(),this._types[r]=E(r,t[r])+e.map((r=>E(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=w(t);if(r)return r}const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=this.getEncoder(t),o=parseInt(n[3]);return n=>{o>=0&&n.length!==o&&s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",n);let a=n.map(i);return this._types[t]&&(a=a.map(e.keccak256)),e.keccak256(r.hexConcat(a))}}const o=this.types[t];if(o){const n=i.id(this._types[t]);return t=>{const i=o.map((({name:r,type:n})=>{const i=this.getEncoder(n)(t[r]);return this._types[n]?e.keccak256(i):i}));return i.unshift(n),r.hexConcat(i)}}return s.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||s.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return e.keccak256(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,e){if(w(t))return e(t,r);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&r.length!==i&&s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,e)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,r[n],e),t)),{}):s.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new x(t)}static getPrimaryType(t){return x.from(t).primaryType}static hashStruct(t,r,e){return x.from(r).hashStruct(t,e)}static hashDomain(t){const r=[];for(const e in t){const n=g[e];n||s.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(e)}`,"domain",t),r.push({name:e,type:n})}return r.sort(((t,r)=>p.indexOf(t.name)-p.indexOf(r.name))),x.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,e,n){return r.hexConcat(["0x1901",x.hashDomain(t),x.from(e).hash(n)])}static hash(t,r,n){return e.keccak256(x.encode(t,r,n))}static resolveNames(t,e,i,o){return a(this,void 0,void 0,(function*(){t=n.shallowCopy(t);const a={};t.verifyingContract&&!r.isHexString(t.verifyingContract,20)&&(a[t.verifyingContract]="0x");const s=x.from(e);s.visit(i,((t,e)=>("address"!==t||r.isHexString(e,20)||(a[e]="0x"),e)));for(const t in a)a[t]=yield o(t);return t.verifyingContract&&a[t.verifyingContract]&&(t.verifyingContract=a[t.verifyingContract]),i=s.visit(i,((t,r)=>"address"===t&&a[r]?a[r]:r)),{domain:t,value:i}}))}static getPayload(t,i,o){x.hashDomain(t);const a={},c=[];p.forEach((r=>{const e=t[r];null!=e&&(a[r]=v[r](e),c.push({name:r,type:g[r]}))}));const f=x.from(i),u=n.shallowCopy(i);return u.EIP712Domain?s.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",i):u.EIP712Domain=c,f.encode(o),{types:u,domain:a,primaryType:f.primaryType,message:f.visit(o,((t,n)=>{if(t.match(/^bytes(\d*)/))return r.hexlify(r.arrayify(n));if(t.match(/^u?int/))return e.BigNumber.from(n).toString();switch(t){case"address":return n.toLowerCase();case"bool":return!!n;case"string":return"string"!=typeof n&&s.throwArgumentError("invalid string","value",n),n}return s.throwArgumentError("unsupported type","type",t)}))}}}exports.TypedDataEncoder=x,exports.version=o;
|