@dodoex/wallet-web3 0.0.29-1 → 0.0.29-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/__node-resolve_empty-d33b2526.js +1 -0
  2. package/dist/{blocto-3233e8b5.js → blocto-e0c3fba1.js} +1 -1
  3. package/dist/bn-67d99a17.js +1 -0
  4. package/dist/{browser-ponyfill-f816b726.js → browser-ponyfill-44c16c11.js} +1 -1
  5. package/dist/cjs/{__node-resolve_empty-0dd66a00.cjs → __node-resolve_empty-99e1fe6a.cjs} +1 -1
  6. package/dist/cjs/{blocto-67356537.cjs → blocto-6db880e3.cjs} +1 -1
  7. package/dist/cjs/bn-9be07c83.cjs +1 -0
  8. package/dist/cjs/{browser-ponyfill-4f18e485.cjs → browser-ponyfill-0c3c6a1d.cjs} +1 -1
  9. package/dist/cjs/{ethers-ae8365c6.cjs → ethers-553c2892.cjs} +1 -1
  10. package/dist/cjs/{id-a5369fec.cjs → id-07decbd4.cjs} +1 -1
  11. package/dist/cjs/{index-5295919d.cjs → index-136ec288.cjs} +1 -1
  12. package/dist/cjs/{index-18e53038.cjs → index-19d69924.cjs} +1 -1
  13. package/dist/cjs/{index-01114acc.cjs → index-2ef621f6.cjs} +1 -1
  14. package/dist/cjs/{index-81701808.cjs → index-373a72d9.cjs} +1 -1
  15. package/dist/cjs/{index-d925012b.cjs → index-4b3d4170.cjs} +1 -1
  16. package/dist/cjs/{index-aa1663b2.cjs → index-66395df0.cjs} +1 -1
  17. package/dist/cjs/{index-6024b45b.cjs → index-b8a341ce.cjs} +1 -1
  18. package/dist/cjs/index-e178b1f3.cjs +15 -0
  19. package/dist/cjs/{index-9c38ef81.cjs → index-ec81b44d.cjs} +1 -1
  20. package/dist/cjs/{index-40782cd0.cjs → index-edc6cd1d.cjs} +1 -1
  21. package/dist/cjs/index.cjs +1 -1
  22. package/dist/cjs/{interface-381a1867.cjs → interface-a76cb731.cjs} +1 -1
  23. package/dist/cjs/{portis-00d84abf.cjs → portis-59e137a1.cjs} +1 -1
  24. package/dist/cjs/{provider-1fd8592b.cjs → provider-b0f94199.cjs} +1 -1
  25. package/dist/cjs/rainbow-9872e246.cjs +1 -0
  26. package/dist/cjs/{typed-data-f4c4259c.cjs → typed-data-bfb59085.cjs} +1 -1
  27. package/dist/cjs/uAuth-cf05b8e2.cjs +1 -0
  28. package/dist/cjs/walletConnect-530e02c9.cjs +1 -0
  29. package/dist/cjs/walletLink-b1c6c8dc.cjs +1 -0
  30. package/dist/{ethers-1fa5d7da.js → ethers-60251e65.js} +1 -1
  31. package/dist/{id-241466ee.js → id-0598d431.js} +1 -1
  32. package/dist/{index-bae507df.js → index-1ae3396a.js} +1 -1
  33. package/dist/{index-1d2d4d92.js → index-2ee17786.js} +1 -1
  34. package/dist/{index-23cdb4b9.js → index-33fbffcd.js} +2 -2
  35. package/dist/{index-c32b134d.js → index-585b9501.js} +1 -1
  36. package/dist/{index-a27e6d76.js → index-900fd90f.js} +1 -1
  37. package/dist/{index-23612abc.js → index-b16ae8fe.js} +1 -1
  38. package/dist/index-bc6b4ac4.js +15 -0
  39. package/dist/{index-ab295bee.js → index-d7e1a9f2.js} +1 -1
  40. package/dist/{index-0d75d6ba.js → index-deecbaf1.js} +1 -1
  41. package/dist/{index-2eb3ae24.js → index-e8318bc1.js} +1 -1
  42. package/dist/index.js +1 -1
  43. package/dist/{interface-f4fa20b2.js → interface-7179eae0.js} +1 -1
  44. package/dist/{portis-b8816fb7.js → portis-c06b505a.js} +1 -1
  45. package/dist/{provider-fcf01622.js → provider-851ce70a.js} +1 -1
  46. package/dist/rainbow-bebe571d.js +1 -0
  47. package/dist/{typed-data-a8efb1b6.js → typed-data-949a2805.js} +1 -1
  48. package/dist/uAuth-33b72e8b.js +1 -0
  49. package/dist/walletConnect-3e4e5cc0.js +1 -0
  50. package/dist/walletLink-7baca3ea.js +1 -0
  51. package/package.json +1 -1
  52. package/dist/__node-resolve_empty-62830e5c.js +0 -1
  53. package/dist/__tslib-72ac33fc.js +0 -1
  54. package/dist/_commonjs-dynamic-modules-7cfc9805.js +0 -1
  55. package/dist/bn-9b750297.js +0 -1
  56. package/dist/cjs/__tslib-ec033c18.cjs +0 -1
  57. package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +0 -1
  58. package/dist/cjs/bn-4a4bfa0a.cjs +0 -1
  59. package/dist/cjs/index-2e6f9c53.cjs +0 -15
  60. package/dist/cjs/index-df8e5839.cjs +0 -1
  61. package/dist/cjs/index-eb09e54d.cjs +0 -60
  62. package/dist/cjs/index.es-0c458619.cjs +0 -9
  63. package/dist/cjs/rainbow-e590de84.cjs +0 -1
  64. package/dist/cjs/uAuth-9129d9d5.cjs +0 -1
  65. package/dist/cjs/walletConnect-c4df4e10.cjs +0 -1
  66. package/dist/cjs/walletLink-30c9ba99.cjs +0 -1
  67. package/dist/index-0ee5ef8d.js +0 -60
  68. package/dist/index-15ca614d.js +0 -15
  69. package/dist/index-e0d3617a.js +0 -1
  70. package/dist/index.es-565c5077.js +0 -9
  71. package/dist/rainbow-865b4947.js +0 -1
  72. package/dist/uAuth-10f72d35.js +0 -1
  73. package/dist/walletConnect-68af47c4.js +0 -1
  74. package/dist/walletLink-014e5649.js +0 -1
@@ -1 +1 @@
1
- "use strict";var r=require("@ethersproject/bytes"),t=require("./id-a5369fec.cjs");const e=new t.Logger("rlp/5.7.0");function o(r){const t=[];for(;r;)t.unshift(255&r),r>>=8;return t}function n(r,t,e){let o=0;for(let n=0;n<e;n++)o=256*o+r[t+n];return o}function s(t){if(Array.isArray(t)){let r=[];if(t.forEach((function(t){r=r.concat(s(t))})),r.length<=55)return r.unshift(192+r.length),r;const e=o(r.length);return e.unshift(247+e.length),e.concat(r)}r.isBytesLike(t)||e.throwArgumentError("RLP object must be BytesLike","object",t);const n=Array.prototype.slice.call(r.arrayify(t));if(1===n.length&&n[0]<=127)return n;if(n.length<=55)return n.unshift(128+n.length),n;const c=o(n.length);return c.unshift(183+c.length),c.concat(n)}function c(t){return r.hexlify(s(t))}function h(r,o,n,s){const c=[];for(;n<o+1+s;){const h=u(r,n);c.push(h.result),(n+=h.consumed)>o+1+s&&e.throwError("child data too short",t.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+s,result:c}}function u(o,s){if(0===o.length&&e.throwError("data too short",t.Logger.errors.BUFFER_OVERRUN,{}),o[s]>=248){const r=o[s]-247;s+1+r>o.length&&e.throwError("data short segment too short",t.Logger.errors.BUFFER_OVERRUN,{});const c=n(o,s+1,r);return s+1+r+c>o.length&&e.throwError("data long segment too short",t.Logger.errors.BUFFER_OVERRUN,{}),h(o,s,s+1+r,r+c)}if(o[s]>=192){const r=o[s]-192;return s+1+r>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{}),h(o,s,s+1,r)}if(o[s]>=184){const c=o[s]-183;s+1+c>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{});const h=n(o,s+1,c);s+1+c+h>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+c+h,result:r.hexlify(o.slice(s+1+c,s+1+c+h))}}if(o[s]>=128){const n=o[s]-128;s+1+n>o.length&&e.throwError("data too short",t.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:r.hexlify(o.slice(s+1,s+1+n))}}return{consumed:1,result:r.hexlify(o[s])}}function l(t){const o=r.arrayify(t),n=u(o,0);return n.consumed!==o.length&&e.throwArgumentError("invalid rlp data","data",t),n.result}var a=Object.freeze({__proto__:null,encode:c,decode:l});exports.decode=l,exports.encode=c,exports.lib_esm=a;
1
+ "use strict";var r=require("@ethersproject/bytes"),t=require("./id-07decbd4.cjs");const e=new t.Logger("rlp/5.7.0");function o(r){const t=[];for(;r;)t.unshift(255&r),r>>=8;return t}function n(r,t,e){let o=0;for(let n=0;n<e;n++)o=256*o+r[t+n];return o}function s(t){if(Array.isArray(t)){let r=[];if(t.forEach((function(t){r=r.concat(s(t))})),r.length<=55)return r.unshift(192+r.length),r;const e=o(r.length);return e.unshift(247+e.length),e.concat(r)}r.isBytesLike(t)||e.throwArgumentError("RLP object must be BytesLike","object",t);const n=Array.prototype.slice.call(r.arrayify(t));if(1===n.length&&n[0]<=127)return n;if(n.length<=55)return n.unshift(128+n.length),n;const c=o(n.length);return c.unshift(183+c.length),c.concat(n)}function c(t){return r.hexlify(s(t))}function h(r,o,n,s){const c=[];for(;n<o+1+s;){const h=u(r,n);c.push(h.result),(n+=h.consumed)>o+1+s&&e.throwError("child data too short",t.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+s,result:c}}function u(o,s){if(0===o.length&&e.throwError("data too short",t.Logger.errors.BUFFER_OVERRUN,{}),o[s]>=248){const r=o[s]-247;s+1+r>o.length&&e.throwError("data short segment too short",t.Logger.errors.BUFFER_OVERRUN,{});const c=n(o,s+1,r);return s+1+r+c>o.length&&e.throwError("data long segment too short",t.Logger.errors.BUFFER_OVERRUN,{}),h(o,s,s+1+r,r+c)}if(o[s]>=192){const r=o[s]-192;return s+1+r>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{}),h(o,s,s+1,r)}if(o[s]>=184){const c=o[s]-183;s+1+c>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{});const h=n(o,s+1,c);s+1+c+h>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+c+h,result:r.hexlify(o.slice(s+1+c,s+1+c+h))}}if(o[s]>=128){const n=o[s]-128;s+1+n>o.length&&e.throwError("data too short",t.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:r.hexlify(o.slice(s+1,s+1+n))}}return{consumed:1,result:r.hexlify(o[s])}}function l(t){const o=r.arrayify(t),n=u(o,0);return n.consumed!==o.length&&e.throwArgumentError("invalid rlp data","data",t),n.result}var i=Object.freeze({__proto__:null,encode:c,decode:l});exports.decode=l,exports.encode=c,exports.lib_esm=i;
@@ -1 +1 @@
1
- "use strict";var e=require("./index-5295919d.cjs"),t=require("./browser-ponyfill-4f18e485.cjs"),s=require("./ethers-ae8365c6.cjs"),a=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),n=require("@ethersproject/contracts"),o=require("./id-a5369fec.cjs"),i=require("@ethersproject/constants"),d=require("events");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}require("zustand"),require("@ethersproject/address"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),require("@ethersproject/abstract-provider"),require("./typed-data-f4c4259c.cjs"),require("./__node-resolve_empty-0dd66a00.cjs"),require("./hash-282034e6.cjs"),require("./inherits_browser-f88a000a.cjs"),require("@ethersproject/json-wallets"),require("./interface-381a1867.cjs"),require("./index-81701808.cjs"),require("./index-9c38ef81.cjs");var u=l(r),f=l(i),h=c(d),g={},p={},m={},_={},E={},v={name:"@safe-global/safe-apps-sdk",version:"7.10.1",description:"SDK developed to integrate third-party apps with Safe app.",main:"dist/src/index.js",typings:"dist/src/index.d.ts",_files:["dist/**/*","src/**/*","CHANGELOG.md","README.md"],keywords:["Safe","sdk","apps"],scripts:{test:"jest","format-dist":"sed -i '' 's/\"files\":/\"_files\":/' dist/package.json",build:"yarn rimraf dist && tsc && yarn format-dist"},author:"Safe (https://safe.global)",license:"MIT",dependencies:{"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",ethers:"^5.7.2"},devDependencies:{rimraf:"^3.0.2"},repository:{type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},bugs:{url:"https://github.com/safe-global/safe-apps-sdk/issues"},homepage:"https://github.com/safe-global/safe-apps-sdk#readme",publishConfig:{access:"public"}},y=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(E,"__esModule",{value:!0}),E.getSDKVersion=void 0;const T=y(v);E.getSDKVersion=()=>T.default.version.split("-")[0];var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.generateRequestId=void 0;const b=e=>e.toString(16).padStart(2,"0");w.generateRequestId=()=>"undefined"!=typeof window?(e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,b).join("")})(10):(new Date).getTime().toString(36),Object.defineProperty(_,"__esModule",{value:!0}),_.MessageFormatter=void 0;const S=E,I=w;class A{}_.MessageFormatter=A,A.makeRequest=(e,t)=>({id:(0,I.generateRequestId)(),method:e,params:t,env:{sdkVersion:(0,S.getSDKVersion)()}}),A.makeResponse=(e,t,s)=>({id:e,success:!0,version:s,data:t}),A.makeErrorResponse=(e,t,s)=>({id:e,success:!1,error:t,version:s});var P={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.RestrictedMethods=e.Methods=void 0,(t=e.Methods||(e.Methods={})).sendTransactions="sendTransactions",t.rpcCall="rpcCall",t.getChainInfo="getChainInfo",t.getSafeInfo="getSafeInfo",t.getTxBySafeTxHash="getTxBySafeTxHash",t.getSafeBalances="getSafeBalances",t.signMessage="signMessage",t.signTypedMessage="signTypedMessage",t.getEnvironmentInfo="getEnvironmentInfo",t.getOffChainSignature="getOffChainSignature",t.requestAddressBook="requestAddressBook",t.wallet_getPermissions="wallet_getPermissions",t.wallet_requestPermissions="wallet_requestPermissions",(e.RestrictedMethods||(e.RestrictedMethods={})).requestAddressBook="requestAddressBook"}(P),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0});const r=_;t.default=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="undefined"==typeof window,this.isValidMessage=({origin:e,data:t,source:s})=>{const a=!t,r=!this.isServer&&s===window.parent,n=(void 0!==t.version&&parseInt(t.version.split(".")[0]))>=1;let o=!0;return Array.isArray(this.allowedOrigins)&&(o=void 0!==this.allowedOrigins.find((t=>t.test(e)))),!a&&r&&n&&o},this.logIncomingMessage=e=>{console.info(`Safe Apps SDK v1: A message was received from origin ${e.origin}. `,e.data)},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{const{id:t}=e,s=this.callbacks.get(t);s&&(s(e),this.callbacks.delete(t))},this.send=(e,t)=>{const s=r.MessageFormatter.makeRequest(e,t);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise(((e,t)=>{this.callbacks.set(s.id,(s=>{s.success?e(s):t(new Error(s.error))}))}))},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}},a(P,t)}(m);var O={},C={},M={};Object.defineProperty(M,"__esModule",{value:!0}),M.isObjectEIP712TypedData=void 0;M.isObjectEIP712TypedData=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;var j={};Object.defineProperty(j,"__esModule",{value:!0});var R={},N={},L={},D={},x=e.commonjsGlobal&&e.commonjsGlobal.__awaiter||function(e,t,s,a){return new(s||(s=Promise))((function(r,n){function o(e){try{d(a.next(e))}catch(e){n(e)}}function i(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,i)}d((a=a.apply(e,t||[])).next())}))},G=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,"__esModule",{value:!0}),D.fetchData=D.stringifyQuery=D.insertParams=void 0;const H=G(t.browserPonyfill.exports);D.insertParams=function(e,t){return t?Object.keys(t).reduce(((e,s)=>function(e,t,s){return e.replace(new RegExp(`\\{${t}\\}`,"g"),s)}(e,s,String(t[s]))),e):e},D.stringifyQuery=function(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach((s=>{null!=e[s]&&t.append(s,String(e[s]))}));const s=t.toString();return s?`?${s}`:""},D.fetchData=function(e,t){return x(this,void 0,void 0,(function*(){let s;null!=t&&(s={method:"POST",body:"string"==typeof t?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}});const a=yield(0,H.default)(e,s);let r;try{r=yield a.json()}catch(e){if(a.headers&&"0"!==a.headers.get("content-length"))throw new Error(`Invalid response content: ${a.statusText}`)}if(!a.ok){const e="object"==typeof(n=r)&&null!==n&&"code"in n&&"message"in n?`${r.code}: ${r.message}`:a.statusText;throw new Error(e)}var n;return r}))},Object.defineProperty(L,"__esModule",{value:!0}),L.getEndpoint=L.postEndpoint=void 0;const B=D;function q(e,t,s,a){return`${e}${(0,B.insertParams)(t,s)}${(0,B.stringifyQuery)(a)}`}L.postEndpoint=function(e,t,s){const a=q(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,B.fetchData)(a,null==s?void 0:s.body)},L.getEndpoint=function(e,t,s,a){if(a)return(0,B.fetchData)(a);const r=q(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,B.fetchData)(r)};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.DEFAULT_BASE_URL=void 0,k.DEFAULT_BASE_URL="https://safe-client.safe.global";var U={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,(t=e.ImplementationVersionState||(e.ImplementationVersionState={})).UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(U);var $={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,(t=e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})).NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST",(e.SafeAppFeatures||(e.SafeAppFeatures={})).BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS",(s=e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={})).TWITTER="TWITTER",s.GITHUB="GITHUB",s.DISCORD="DISCORD"}($);var F={};!function(e){var t,s,a,r,n,o,i,d,c,l;Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,(t=e.Operation||(e.Operation={}))[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE",(s=e.TransactionStatus||(e.TransactionStatus={})).AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",s.AWAITING_EXECUTION="AWAITING_EXECUTION",s.CANCELLED="CANCELLED",s.FAILED="FAILED",s.SUCCESS="SUCCESS",(a=e.TransferDirection||(e.TransferDirection={})).INCOMING="INCOMING",a.OUTGOING="OUTGOING",a.UNKNOWN="UNKNOWN",(r=e.TransactionTokenType||(e.TransactionTokenType={})).ERC20="ERC20",r.ERC721="ERC721",r.NATIVE_COIN="NATIVE_COIN",(n=e.SettingsInfoType||(e.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD",(o=e.TransactionInfoType||(e.TransactionInfoType={})).TRANSFER="Transfer",o.SETTINGS_CHANGE="SettingsChange",o.CUSTOM="Custom",o.CREATION="Creation",(i=e.ConflictType||(e.ConflictType={})).NONE="None",i.HAS_NEXT="HasNext",i.END="End",(d=e.TransactionListItemType||(e.TransactionListItemType={})).TRANSACTION="TRANSACTION",d.LABEL="LABEL",d.CONFLICT_HEADER="CONFLICT_HEADER",d.DATE_LABEL="DATE_LABEL",(c=e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",c.MODULE="MODULE",(l=e.LabelValue||(e.LabelValue={})).Queued="Queued",l.Next="Next"}(F);var W={};!function(e){var t,s,a;Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,(t=e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})).API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN",(s=e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})).ORACLE="ORACLE",s.FIXED="FIXED",s.UNKNOWN="UNKNOWN",(a=e.FEATURES||(e.FEATURES={})).ERC721="ERC721",a.SAFE_APPS="SAFE_APPS",a.CONTRACT_INTERACTION="CONTRACT_INTERACTION",a.DOMAIN_LOOKUP="DOMAIN_LOOKUP",a.SPENDING_LIMIT="SPENDING_LIMIT",a.EIP1559="EIP1559",a.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",a.TX_SIMULATION="TX_SIMULATION",a.EIP1271="EIP1271"}(W);var V={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,(t=e.TokenType||(e.TokenType={})).ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(V);var K={};Object.defineProperty(K,"__esModule",{value:!0});var Q={};Object.defineProperty(Q,"__esModule",{value:!0});var X={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,(t=e.SafeMessageListItemType||(e.SafeMessageListItemType={})).DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE",(s=e.SafeMessageStatus||(e.SafeMessageStatus={})).NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",s.CONFIRMED="CONFIRMED"}(X),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.confirmSafeMessage=t.proposeSafeMessage=t.getSafeMessage=t.getSafeMessages=t.getDecodedData=t.getMasterCopies=t.getSafeApps=t.getChainConfig=t.getChainsConfig=t.proposeTransaction=t.postSafeGasEstimation=t.getTransactionDetails=t.getTransactionQueue=t.getTransactionHistory=t.getCollectiblesPage=t.getCollectibles=t.getOwnedSafes=t.getFiatCurrencies=t.getBalances=t.getMultisigTransactions=t.getModuleTransactions=t.getIncomingTransfers=t.getSafeInfo=t.setBaseUrl=void 0;const r=L,n=k;a(U,t),a($,t),a(F,t),a(W,t),a(V,t),a(K,t),a(Q,t),a(X,t);let o=n.DEFAULT_BASE_URL;t.setBaseUrl=e=>{o=e},t.getSafeInfo=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},t.getIncomingTransfers=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:e,address:t},query:s},a)},t.getModuleTransactions=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getMultisigTransactions=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getBalances=function(e,t,s="usd",a={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:s},query:a})},t.getFiatCurrencies=function(){return(0,r.getEndpoint)(o,"/v1/balances/supported-fiat-codes")},t.getOwnedSafes=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},t.getCollectibles=function(e,t,s={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s})},t.getCollectiblesPage=function(e,t,s={},a){return(0,r.getEndpoint)(o,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s},a)},t.getTransactionHistory=function(e,t,s){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:{}},s)},t.getTransactionQueue=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:{trusted:a}},s)},t.getTransactionDetails=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},t.postSafeGasEstimation=function(e,t,s){return(0,r.postEndpoint)(o,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:s})},t.proposeTransaction=function(e,t,s){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:s})},t.getChainsConfig=function(e){return(0,r.getEndpoint)(o,"/v1/chains",{query:e})},t.getChainConfig=function(e){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}",{path:{chainId:e}})},t.getSafeApps=function(e,t={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},t.getMasterCopies=function(e){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},t.getDecodedData=function(e,t){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t}})},t.getSafeMessages=function(e,t,s){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},s)},t.getSafeMessage=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},t.proposeSafeMessage=function(e,t,s){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},body:s})},t.confirmSafeMessage=function(e,t,s){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:s})}}(N),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransferDirection=e.TransactionStatus=e.TokenType=e.Operation=void 0;var t=N;Object.defineProperty(e,"Operation",{enumerable:!0,get:function(){return t.Operation}}),Object.defineProperty(e,"TokenType",{enumerable:!0,get:function(){return t.TokenType}}),Object.defineProperty(e,"TransactionStatus",{enumerable:!0,get:function(){return t.TransactionStatus}}),Object.defineProperty(e,"TransferDirection",{enumerable:!0,get:function(){return t.TransferDirection}})}(R);var Y={};Object.defineProperty(Y,"__esModule",{value:!0}),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),a(M,t),a(j,t),a(R,t),a(Y,t)}(C),Object.defineProperty(O,"__esModule",{value:!0}),O.TXs=void 0;const J=P,z=C;O.TXs=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(J.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(J.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,z.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(J.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const s={txs:e,params:t};return(await this.communicator.send(J.Methods.sendTransactions,s)).data}};var Z={},ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.RPC_CALLS=void 0,ee.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},Object.defineProperty(Z,"__esModule",{value:!0}),Z.Eth=void 0;const te=ee,se=P,ae={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};Z.Eth=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:te.RPC_CALLS.eth_call,formatters:[null,ae.defaultBlockParam]}),this.getBalance=this.buildRequest({call:te.RPC_CALLS.eth_getBalance,formatters:[null,ae.defaultBlockParam]}),this.getCode=this.buildRequest({call:te.RPC_CALLS.eth_getCode,formatters:[null,ae.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:te.RPC_CALLS.eth_getStorageAt,formatters:[null,ae.blockNumberToHex,ae.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:te.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:te.RPC_CALLS.eth_getBlockByHash,formatters:[null,ae.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:te.RPC_CALLS.eth_getBlockByNumber,formatters:[ae.blockNumberToHex,ae.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:te.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:te.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:te.RPC_CALLS.eth_getTransactionCount,formatters:[null,ae.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:te.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:te.RPC_CALLS.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:te.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:s}=e;return async e=>{s&&Array.isArray(e)&&s.forEach(((t,s)=>{t&&(e[s]=t(e[s]))}));const a={call:t,params:e||[]};return(await this.communicator.send(se.Methods.rpcCall,a)).data}}};var re={};try{const e=window;null==e._ethers&&(e._ethers=s.ethers)}catch(e){}var ne=Object.freeze({__proto__:null,ethers:s.ethers,Signer:a.Signer,Wallet:s.Wallet,VoidSigner:a.VoidSigner,getDefaultProvider:r.getDefaultProvider,providers:u,BaseContract:n.BaseContract,Contract:n.Contract,ContractFactory:n.ContractFactory,BigNumber:o.BigNumber,FixedNumber:s.FixedNumber,constants:f,get errors(){return o.ErrorCode},logger:s.logger,utils:s.utils,wordlists:s.wordlists,version:s.version,Wordlist:s.Wordlist}),oe=e.getAugmentedNamespace(ne),ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.MAGIC_VALUE_BYTES=ie.MAGIC_VALUE=ie.EIP_1271_BYTES_INTERFACE=ie.EIP_1271_INTERFACE=void 0;const de=oe;ie.MAGIC_VALUE="0x1626ba7e";ie.MAGIC_VALUE_BYTES="0x20c13b0b";const ce=new de.ethers.utils.Interface(["function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view"]);ie.EIP_1271_INTERFACE=ce;const le=new de.ethers.utils.Interface(["function isValidSignature(bytes calldata _data, bytes calldata _signature) public view"]);ie.EIP_1271_BYTES_INTERFACE=le;var ue={},fe={},he={};Object.defineProperty(he,"__esModule",{value:!0}),he.PermissionsError=he.PERMISSIONS_REQUEST_REJECTED=void 0,he.PERMISSIONS_REQUEST_REJECTED=4001;class ge extends Error{constructor(e,t,s){super(e),this.code=t,this.data=s,Object.setPrototypeOf(this,ge.prototype)}}he.PermissionsError=ge,Object.defineProperty(fe,"__esModule",{value:!0}),fe.Wallet=void 0;const pe=P,me=he;fe.Wallet=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(pe.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new me.PermissionsError("Permissions request is invalid",me.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(pe.Methods.wallet_requestPermissions,e)).data}catch(e){throw new me.PermissionsError("Permissions rejected",me.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every((e=>"object"==typeof e&&Object.keys(e).every((e=>!!Object.values(pe.RestrictedMethods).includes(e)))))}},Object.defineProperty(ue,"__esModule",{value:!0});const _e=fe,Ee=he,ve=(e,t)=>t.some((t=>t.parentCapability===e));ue.default=()=>(e,t,s)=>{const a=s.value;return s.value=async function(){const e=new _e.Wallet(this.communicator);let s=await e.getPermissions();if(ve(t,s)||(s=await e.requestPermissions([{[t]:{}}])),!ve(t,s))throw new Ee.PermissionsError("Permissions rejected",Ee.PERMISSIONS_REQUEST_REJECTED);return a.apply(this)},s};var ye=e.commonjsGlobal&&e.commonjsGlobal.__decorate||function(e,t,s,a){var r,n=arguments.length,o=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,a);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(o=(n<3?r(o):n>3?r(t,s,o):r(t,s))||o);return n>3&&o&&Object.defineProperty(t,s,o),o},Te=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(re,"__esModule",{value:!0}),re.Safe=void 0;const we=oe,be=ie,Se=P,Ie=ee,Ae=C,Pe=Te(ue);class Oe{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(Se.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(Se.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(Se.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const s=await this.getInfo(),a=be.EIP_1271_INTERFACE.encodeFunctionData("isValidSignature",[e,t]),r={call:Ie.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:a},"latest"]};try{return(await this.communicator.send(Se.Methods.rpcCall,r)).data.slice(0,10).toLowerCase()===be.MAGIC_VALUE}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){const s=await this.getInfo(),a=we.ethers.utils.arrayify(e),r=be.EIP_1271_BYTES_INTERFACE.encodeFunctionData("isValidSignature",[a,t]),n={call:Ie.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(Se.Methods.rpcCall,n)).data.slice(0,10).toLowerCase()===be.MAGIC_VALUE_BYTES}catch(e){return!1}}calculateMessageHash(e){return we.ethers.utils.hashMessage(e)}calculateTypedMessageHash(e){return we.ethers.utils._TypedDataEncoder.hash(e.domain,e.types,e.message)}async getOffChainSignature(e){return(await this.communicator.send(Se.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let s;if("string"==typeof e&&(s=async()=>{const s=this.calculateMessageHash(e);return await this.isMessageHashSigned(s,t)}),(0,Ae.isObjectEIP712TypedData)(e)&&(s=async()=>{const s=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(s,t)}),s){return await s()}throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const a of s){if(await a(e,t))return!0}return!1}async getEnvironmentInfo(){return(await this.communicator.send(Se.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(Se.Methods.requestAddressBook,void 0)).data}}ye([(0,Pe.default)()],Oe.prototype,"requestAddressBook",null),re.Safe=Oe;var Ce=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(p,"__esModule",{value:!0});const Me=Ce(m),je=O,Re=Z,Ne=re,Le=fe;p.default=class{constructor(e={}){const{allowedDomains:t=null,debug:s=!1}=e;this.communicator=new Me.default(t,s),this.eth=new Re.Eth(this.communicator),this.txs=new je.TXs(this.communicator),this.safe=new Ne.Safe(this.communicator),this.wallet=new Le.Wallet(this.communicator)}},function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSDKVersion=void 0;const n=r(p);t.default=n.default,a(p,t),a(C,t),a(P,t),a(_,t);var o=E;Object.defineProperty(t,"getSDKVersion",{enumerable:!0,get:function(){return o.getSDKVersion}})}(g);var De=e.getDefaultExportFromCjs(g),xe={},Ge={},He={};Object.defineProperty(He,"__esModule",{value:!0}),He.getLowerCase=void 0,He.getLowerCase=function(e){return e?e.toLowerCase():e},Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.SafeAppProvider=void 0;const Be=h.default,qe=He;class ke extends Be.EventEmitter{constructor(e,t){super(),this.submittedTxs=new Map,this.safe=e,this.sdk=t}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(e){const{method:t,params:s=[]}=e;switch(t){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(e),"0x"}case"eth_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(t),"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[e,t]=s,a="string"==typeof t?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase())throw new Error("The address is invalid");return await this.sdk.txs.signTypedMessage(a),"0x"}case"eth_sendTransaction":const t=Object.assign({value:"0",data:"0x"},s[0]);"string"==typeof t.gas&&t.gas.startsWith("0x")&&(t.gas=parseInt(t.gas,16));const a=await this.sdk.txs.send({txs:[t],params:{safeTxGas:t.gas}});return this.submittedTxs.set(a.safeTxHash,{from:this.safe.safeAddress,hash:a.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:t.data,value:t.value,to:t.to,blockHash:null,blockNumber:null,transactionIndex:null}),a.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,qe.getLowerCase)(s[0]),s[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,qe.getLowerCase)(s[0]),s[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,qe.getLowerCase)(s[0]),s[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,qe.getLowerCase)(s[0]),s[1],s[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([s[0],s[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([s[0],s[1]]);case"eth_getTransactionByHash":let r=s[0];try{r=(await this.sdk.txs.getBySafeTxHash(r)).txHash||r}catch(e){}return this.submittedTxs.has(r)?this.submittedTxs.get(r):this.sdk.eth.getTransactionByHash([r]).then((e=>(e&&(e.hash=s[0]),e)));case"eth_getTransactionReceipt":{let e=s[0];try{e=(await this.sdk.txs.getBySafeTxHash(e)).txHash||e}catch(e){}return this.sdk.eth.getTransactionReceipt([e]).then((e=>(e&&(e.transactionHash=s[0]),e)))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(s[0]);case"eth_call":return this.sdk.eth.call([s[0],s[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([s[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(s[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([s[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then((s=>t(null,{jsonrpc:"2.0",id:e.id,result:s}))).catch((e=>t(e,null)))}}let Ue,$e;function Fe(){return e.__awaiter(this,void 0,void 0,(function*(){return $e||($e=new De),void 0===Ue&&(Ue=yield Promise.race([$e.safe.getInfo(),new Promise((e=>setTimeout(e,200)))])),Ue}))}Ge.SafeAppProvider=ke,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppProvider=void 0;var t=Ge;Object.defineProperty(e,"SafeAppProvider",{enumerable:!0,get:function(){return t.SafeAppProvider}})}(xe);var We={},Ve={},Ke={};Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.getTxServiceBaseUrl=void 0,Ke.getTxServiceBaseUrl=function(e){return`${e}/api`};var Qe={},Xe={exports:{}};!function(t,s){var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e.commonjsGlobal)return e.commonjsGlobal;throw new Error("unable to locate global object")}();t.exports=s=a.fetch,a.fetch&&(s.default=a.fetch.bind(a)),s.Headers=a.Headers,s.Request=a.Request,s.Response=a.Response}(Xe,Xe.exports),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendRequest=t.HttpMethod=void 0;const a=s(Xe.exports);var r;(r=t.HttpMethod||(t.HttpMethod={})).Get="get",r.Post="post",r.Delete="delete",t.sendRequest=async function({url:e,method:t,body:s}){const r=await(0,a.default)(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)});let n;try{n=await r.json()}catch(e){if(!r.ok)throw new Error(r.statusText)}if(r.ok)return n;if(n.data)throw new Error(n.data);if(n.detail)throw new Error(n.detail);if(n.message)throw new Error(n.message);if(n.nonFieldErrors)throw new Error(n.nonFieldErrors);if(n.delegate)throw new Error(n.delegate);if(n.safe)throw new Error(n.safe);if(n.delegator)throw new Error(n.delegator);throw new Error(r.statusText)}}(Qe);var Ye,Je,ze=e.commonjsGlobal&&e.commonjsGlobal.__classPrivateFieldSet||function(e,t,s,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,s):r?r.value=s:t.set(e,s),s},Ze=e.commonjsGlobal&&e.commonjsGlobal.__classPrivateFieldGet||function(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)};Object.defineProperty(Ve,"__esModule",{value:!0});const et=Ke,tt=Qe;Ye=new WeakMap,Je=new WeakMap,Ve.default=class{constructor({txServiceUrl:e,ethAdapter:t}){Ye.set(this,void 0),Je.set(this,void 0),ze(this,Ye,(0,et.getTxServiceBaseUrl)(e),"f"),ze(this,Je,t,"f")}async getServiceInfo(){return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/about`,method:tt.HttpMethod.Get})}async getServiceMasterCopiesInfo(){return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/about/master-copies`,method:tt.HttpMethod.Get})}async decodeData(e){if(""===e)throw new Error("Invalid data");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/data-decoder/`,method:tt.HttpMethod.Post,body:{data:e}})}async getSafesByOwner(e){if(""===e)throw new Error("Invalid owner address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/owners/${t}/safes/`,method:tt.HttpMethod.Get})}async getSafesByModule(e){if(""===e)throw new Error("Invalid module address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/modules/${t}/safes/`,method:tt.HttpMethod.Get})}async getTransaction(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/multisig-transactions/${e}/`,method:tt.HttpMethod.Get})}async getTransactionConfirmations(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:tt.HttpMethod.Get})}async confirmTransaction(e,t){if(""===e)throw new Error("Invalid safeTxHash");if(""===t)throw new Error("Invalid signature");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:tt.HttpMethod.Post,body:{signature:t}})}async getSafeInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/`,method:tt.HttpMethod.Get})}async getSafeDelegates({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,limit:r,offset:n}){const o=new URL(`${Ze(this,Ye,"f")}/v1/delegates`);if(e){const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);o.searchParams.set("safe",t)}if(t){const{address:e}=await Ze(this,Je,"f").getEip3770Address(t);o.searchParams.set("delegate",e)}if(s){const{address:e}=await Ze(this,Je,"f").getEip3770Address(s);o.searchParams.set("delegator",e)}return a&&o.searchParams.set("label",a),r&&o.searchParams.set("limit",r),n&&o.searchParams.set("offset",n),(0,tt.sendRequest)({url:o.toString(),method:tt.HttpMethod.Get})}async addSafeDelegate({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,signer:r}){if(""===t)throw new Error("Invalid Safe delegate address");if(""===s)throw new Error("Invalid Safe delegator address");if(""===a)throw new Error("Invalid label");const{address:n}=await Ze(this,Je,"f").getEip3770Address(t),{address:o}=await Ze(this,Je,"f").getEip3770Address(s),i=n+Math.floor(Date.now()/1e3/3600),d=await r.signMessage(i),c={safe:e?(await Ze(this,Je,"f").getEip3770Address(e)).address:null,delegate:n,delegator:o,label:a,signature:d};return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/delegates/`,method:tt.HttpMethod.Post,body:c})}async removeSafeDelegate({delegateAddress:e,delegatorAddress:t,signer:s}){if(""===e)throw new Error("Invalid Safe delegate address");if(""===t)throw new Error("Invalid Safe delegator address");const{address:a}=await Ze(this,Je,"f").getEip3770Address(e),{address:r}=await Ze(this,Je,"f").getEip3770Address(t),n=a+Math.floor(Date.now()/1e3/3600),o=await s.signMessage(n);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/delegates/${a}`,method:tt.HttpMethod.Delete,body:{delegate:a,delegator:r,signature:o}})}async getSafeCreationInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/creation/`,method:tt.HttpMethod.Get})}async estimateSafeTransaction(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${s}/multisig-transactions/estimations/`,method:tt.HttpMethod.Post,body:t})}async proposeTransaction({safeAddress:e,safeTransactionData:t,safeTxHash:s,senderAddress:a,senderSignature:r,origin:n}){if(""===e)throw new Error("Invalid Safe address");const{address:o}=await Ze(this,Je,"f").getEip3770Address(e),{address:i}=await Ze(this,Je,"f").getEip3770Address(a);if(""===s)throw new Error("Invalid safeTxHash");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${o}/multisig-transactions/`,method:tt.HttpMethod.Post,body:{...t,contractTransactionHash:s,sender:i,signature:r,origin:n}})}async getIncomingTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/incoming-transfers?executed=true`,method:tt.HttpMethod.Get})}async getModuleTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/module-transactions/`,method:tt.HttpMethod.Get})}async getMultisigTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/multisig-transactions/`,method:tt.HttpMethod.Get})}async getPendingTransactions(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await Ze(this,Je,"f").getEip3770Address(e),a=t||(await this.getSafeInfo(s)).nonce;return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${s}/multisig-transactions/?executed=false&nonce__gte=${a}`,method:tt.HttpMethod.Get})}async getAllTransactions(e,t){var s,a,r;if(""===e)throw new Error("Invalid Safe address");const{address:n}=await Ze(this,Je,"f").getEip3770Address(e),o=new URL(`${Ze(this,Ye,"f")}/v1/safes/${n}/all-transactions/`),i=(null===(s=null==t?void 0:t.trusted)||void 0===s?void 0:s.toString())||"true";o.searchParams.set("trusted",i);const d=(null===(a=null==t?void 0:t.queued)||void 0===a?void 0:a.toString())||"true";o.searchParams.set("queued",d);const c=(null===(r=null==t?void 0:t.executed)||void 0===r?void 0:r.toString())||"false";return o.searchParams.set("executed",c),(0,tt.sendRequest)({url:o.toString(),method:tt.HttpMethod.Get})}async getNextNonce(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e),s=await this.getPendingTransactions(t);if(s.results.length>0){const e=s.results.map((e=>e.nonce));return Math.max(...e)+1}return(await this.getSafeInfo(t)).nonce}async getTokenList(){return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/tokens/`,method:tt.HttpMethod.Get})}async getToken(e){if(""===e)throw new Error("Invalid token address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/tokens/${t}/`,method:tt.HttpMethod.Get})}};var st={};Object.defineProperty(st,"__esModule",{value:!0}),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(Ve);a(st,t),t.default=n.default}(We);var at=e.getDefaultExportFromCjs(We);const rt={1:"https://safe-transaction-mainnet.safe.global/",5:"https://safe-transaction-goerli.safe.global/",42161:"https://safe-transaction-arbitrum.safe.global/",43114:"https://safe-transaction-avalanche.safe.global/",1313161554:"https://safe-transaction-aurora.safe.global/",56:"https://safe-transaction-bsc.safe.global/",10:"https://safe-transaction-optimism.safe.global/",137:"https://safe-transaction-polygon.safe.global/"};let nt;function ot(t){return e.__awaiter(this,void 0,void 0,(function*(){if((null==nt?void 0:nt.chainId)===t)return nt.safeService;if(!e.useWalletStore.getState().provider)throw new Error("provider is undefined");const s=function(){return{getEip3770Address:t=>e.__awaiter(this,void 0,void 0,(function*(){const{address:e,prefix:s}=function(e){const t=e.split(":"),s=t.length>1?t[1]:t[0];return{prefix:t.length>1?t[0]:"",address:s}}(t);return{address:e,prefix:s}}))}}(),a=rt[t];if(!a)return;const r=new at({txServiceUrl:a,ethAdapter:s});return nt={safeService:r,chainId:t},nt.safeService}))}exports.default=function(t){return e.__awaiter(this,void 0,void 0,(function*(){const s=yield Fe();if(!s)throw Error("Could not load Safe information");const a=new xe.SafeAppProvider(s,$e);return a.on("connect",t.connect),a.on("disconnect",t.disconnect),a.on("accountsChanged",t.accountsChanged),a.on("chainChanged",t.chainChanged),a.on("message",t.message),e.convertWeb3Provider(a)}))},exports.getAccountIsSafe=function(t,s){return e.__awaiter(this,void 0,void 0,(function*(){if(!s)return!1;const e=yield ot(t);if(!e)return!1;try{return!!(yield e.getSafeInfo(s))}catch(e){return console.error(e),!1}}))},exports.getConnectedSafe=Fe,exports.getIsSafe=function(){return e.__awaiter(this,void 0,void 0,(function*(){return!!(yield Fe())}))},exports.getSafeHashDetailUrl=function(e,t,s){const a={1:"eth",5:"gor",137:"matic",56:"bnb",42161:"arb1",10:"oeth",43114:"avax",1313161554:"aurora"}[t];if(!a)throw new Error(`Not Supported network: ${t}`);return`https://app.safe.global/transactions/tx?id=multisig_${s}_${e}&safe=${a}%3A${s}`},exports.getSafeTxHash=function(t,s,a){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield ot(t);if(!e)return console.error(`chainId: ${t} is not supported safe`),a;if(a!==s)return a;const r=yield e.getMultisigTransactions(a),[n]=r.results;return n.safeTxHash}))},exports.getSafeTxStatus=function(t,s,a){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield ot(t);if(!e)throw new Error(`chainId: ${t} is not supported safe`);try{const{results:t}=yield e.getMultisigTransactions(a),r=t.find((e=>e.safeTxHash.toLocaleLowerCase()===s.toLocaleLowerCase()));if(!r)return null;if(t.some((e=>!(e.nonce!==r.nonce||e.safeTxHash.toLocaleLowerCase()===s.toLocaleLowerCase()||!e.isExecuted||!e.isSuccessful))))return"rejected";if(null===r.isExecuted||null===r.isSuccessful)return null;return{status:r.isExecuted&&r.isSuccessful||!1,transactionHash:r.transactionHash,blockNumber:r.blockNumber||null}}catch(e){throw console.error(e),new Error(`safeTxHash: ${s} is not valid.`)}}))};
1
+ "use strict";var e=require("./index-136ec288.cjs"),t=require("./browser-ponyfill-0c3c6a1d.cjs"),s=require("./ethers-553c2892.cjs"),a=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),n=require("@ethersproject/contracts"),o=require("./id-07decbd4.cjs"),i=require("@ethersproject/constants"),d=require("events");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}require("zustand"),require("@ethersproject/address"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),require("@ethersproject/abstract-provider"),require("./typed-data-bfb59085.cjs"),require("./__node-resolve_empty-99e1fe6a.cjs"),require("./hash-282034e6.cjs"),require("./inherits_browser-f88a000a.cjs"),require("@ethersproject/json-wallets"),require("./interface-a76cb731.cjs"),require("./index-373a72d9.cjs"),require("./index-ec81b44d.cjs");var u=l(r),f=l(i),h=c(d),g={},p={},m={},_={},E={},v={name:"@safe-global/safe-apps-sdk",version:"7.10.1",description:"SDK developed to integrate third-party apps with Safe app.",main:"dist/src/index.js",typings:"dist/src/index.d.ts",_files:["dist/**/*","src/**/*","CHANGELOG.md","README.md"],keywords:["Safe","sdk","apps"],scripts:{test:"jest","format-dist":"sed -i '' 's/\"files\":/\"_files\":/' dist/package.json",build:"yarn rimraf dist && tsc && yarn format-dist"},author:"Safe (https://safe.global)",license:"MIT",dependencies:{"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",ethers:"^5.7.2"},devDependencies:{rimraf:"^3.0.2"},repository:{type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},bugs:{url:"https://github.com/safe-global/safe-apps-sdk/issues"},homepage:"https://github.com/safe-global/safe-apps-sdk#readme",publishConfig:{access:"public"}},y=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(E,"__esModule",{value:!0}),E.getSDKVersion=void 0;const T=y(v);E.getSDKVersion=()=>T.default.version.split("-")[0];var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.generateRequestId=void 0;const b=e=>e.toString(16).padStart(2,"0");w.generateRequestId=()=>"undefined"!=typeof window?(e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,b).join("")})(10):(new Date).getTime().toString(36),Object.defineProperty(_,"__esModule",{value:!0}),_.MessageFormatter=void 0;const S=E,I=w;class A{}_.MessageFormatter=A,A.makeRequest=(e,t)=>({id:(0,I.generateRequestId)(),method:e,params:t,env:{sdkVersion:(0,S.getSDKVersion)()}}),A.makeResponse=(e,t,s)=>({id:e,success:!0,version:s,data:t}),A.makeErrorResponse=(e,t,s)=>({id:e,success:!1,error:t,version:s});var P={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.RestrictedMethods=e.Methods=void 0,(t=e.Methods||(e.Methods={})).sendTransactions="sendTransactions",t.rpcCall="rpcCall",t.getChainInfo="getChainInfo",t.getSafeInfo="getSafeInfo",t.getTxBySafeTxHash="getTxBySafeTxHash",t.getSafeBalances="getSafeBalances",t.signMessage="signMessage",t.signTypedMessage="signTypedMessage",t.getEnvironmentInfo="getEnvironmentInfo",t.getOffChainSignature="getOffChainSignature",t.requestAddressBook="requestAddressBook",t.wallet_getPermissions="wallet_getPermissions",t.wallet_requestPermissions="wallet_requestPermissions",(e.RestrictedMethods||(e.RestrictedMethods={})).requestAddressBook="requestAddressBook"}(P),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0});const r=_;t.default=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="undefined"==typeof window,this.isValidMessage=({origin:e,data:t,source:s})=>{const a=!t,r=!this.isServer&&s===window.parent,n=(void 0!==t.version&&parseInt(t.version.split(".")[0]))>=1;let o=!0;return Array.isArray(this.allowedOrigins)&&(o=void 0!==this.allowedOrigins.find((t=>t.test(e)))),!a&&r&&n&&o},this.logIncomingMessage=e=>{console.info(`Safe Apps SDK v1: A message was received from origin ${e.origin}. `,e.data)},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{const{id:t}=e,s=this.callbacks.get(t);s&&(s(e),this.callbacks.delete(t))},this.send=(e,t)=>{const s=r.MessageFormatter.makeRequest(e,t);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise(((e,t)=>{this.callbacks.set(s.id,(s=>{s.success?e(s):t(new Error(s.error))}))}))},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}},a(P,t)}(m);var O={},C={},M={};Object.defineProperty(M,"__esModule",{value:!0}),M.isObjectEIP712TypedData=void 0;M.isObjectEIP712TypedData=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;var j={};Object.defineProperty(j,"__esModule",{value:!0});var R={},N={},L={},D={},x=e.commonjsGlobal&&e.commonjsGlobal.__awaiter||function(e,t,s,a){return new(s||(s=Promise))((function(r,n){function o(e){try{d(a.next(e))}catch(e){n(e)}}function i(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,i)}d((a=a.apply(e,t||[])).next())}))},G=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,"__esModule",{value:!0}),D.fetchData=D.stringifyQuery=D.insertParams=void 0;const H=G(t.browserPonyfill.exports);D.insertParams=function(e,t){return t?Object.keys(t).reduce(((e,s)=>function(e,t,s){return e.replace(new RegExp(`\\{${t}\\}`,"g"),s)}(e,s,String(t[s]))),e):e},D.stringifyQuery=function(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach((s=>{null!=e[s]&&t.append(s,String(e[s]))}));const s=t.toString();return s?`?${s}`:""},D.fetchData=function(e,t){return x(this,void 0,void 0,(function*(){let s;null!=t&&(s={method:"POST",body:"string"==typeof t?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}});const a=yield(0,H.default)(e,s);let r;try{r=yield a.json()}catch(e){if(a.headers&&"0"!==a.headers.get("content-length"))throw new Error(`Invalid response content: ${a.statusText}`)}if(!a.ok){const e="object"==typeof(n=r)&&null!==n&&"code"in n&&"message"in n?`${r.code}: ${r.message}`:a.statusText;throw new Error(e)}var n;return r}))},Object.defineProperty(L,"__esModule",{value:!0}),L.getEndpoint=L.postEndpoint=void 0;const B=D;function q(e,t,s,a){return`${e}${(0,B.insertParams)(t,s)}${(0,B.stringifyQuery)(a)}`}L.postEndpoint=function(e,t,s){const a=q(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,B.fetchData)(a,null==s?void 0:s.body)},L.getEndpoint=function(e,t,s,a){if(a)return(0,B.fetchData)(a);const r=q(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,B.fetchData)(r)};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.DEFAULT_BASE_URL=void 0,k.DEFAULT_BASE_URL="https://safe-client.safe.global";var U={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,(t=e.ImplementationVersionState||(e.ImplementationVersionState={})).UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(U);var $={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,(t=e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})).NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST",(e.SafeAppFeatures||(e.SafeAppFeatures={})).BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS",(s=e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={})).TWITTER="TWITTER",s.GITHUB="GITHUB",s.DISCORD="DISCORD"}($);var F={};!function(e){var t,s,a,r,n,o,i,d,c,l;Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,(t=e.Operation||(e.Operation={}))[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE",(s=e.TransactionStatus||(e.TransactionStatus={})).AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",s.AWAITING_EXECUTION="AWAITING_EXECUTION",s.CANCELLED="CANCELLED",s.FAILED="FAILED",s.SUCCESS="SUCCESS",(a=e.TransferDirection||(e.TransferDirection={})).INCOMING="INCOMING",a.OUTGOING="OUTGOING",a.UNKNOWN="UNKNOWN",(r=e.TransactionTokenType||(e.TransactionTokenType={})).ERC20="ERC20",r.ERC721="ERC721",r.NATIVE_COIN="NATIVE_COIN",(n=e.SettingsInfoType||(e.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD",(o=e.TransactionInfoType||(e.TransactionInfoType={})).TRANSFER="Transfer",o.SETTINGS_CHANGE="SettingsChange",o.CUSTOM="Custom",o.CREATION="Creation",(i=e.ConflictType||(e.ConflictType={})).NONE="None",i.HAS_NEXT="HasNext",i.END="End",(d=e.TransactionListItemType||(e.TransactionListItemType={})).TRANSACTION="TRANSACTION",d.LABEL="LABEL",d.CONFLICT_HEADER="CONFLICT_HEADER",d.DATE_LABEL="DATE_LABEL",(c=e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",c.MODULE="MODULE",(l=e.LabelValue||(e.LabelValue={})).Queued="Queued",l.Next="Next"}(F);var W={};!function(e){var t,s,a;Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,(t=e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})).API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN",(s=e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})).ORACLE="ORACLE",s.FIXED="FIXED",s.UNKNOWN="UNKNOWN",(a=e.FEATURES||(e.FEATURES={})).ERC721="ERC721",a.SAFE_APPS="SAFE_APPS",a.CONTRACT_INTERACTION="CONTRACT_INTERACTION",a.DOMAIN_LOOKUP="DOMAIN_LOOKUP",a.SPENDING_LIMIT="SPENDING_LIMIT",a.EIP1559="EIP1559",a.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",a.TX_SIMULATION="TX_SIMULATION",a.EIP1271="EIP1271"}(W);var V={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,(t=e.TokenType||(e.TokenType={})).ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(V);var K={};Object.defineProperty(K,"__esModule",{value:!0});var Q={};Object.defineProperty(Q,"__esModule",{value:!0});var X={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,(t=e.SafeMessageListItemType||(e.SafeMessageListItemType={})).DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE",(s=e.SafeMessageStatus||(e.SafeMessageStatus={})).NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",s.CONFIRMED="CONFIRMED"}(X),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.confirmSafeMessage=t.proposeSafeMessage=t.getSafeMessage=t.getSafeMessages=t.getDecodedData=t.getMasterCopies=t.getSafeApps=t.getChainConfig=t.getChainsConfig=t.proposeTransaction=t.postSafeGasEstimation=t.getTransactionDetails=t.getTransactionQueue=t.getTransactionHistory=t.getCollectiblesPage=t.getCollectibles=t.getOwnedSafes=t.getFiatCurrencies=t.getBalances=t.getMultisigTransactions=t.getModuleTransactions=t.getIncomingTransfers=t.getSafeInfo=t.setBaseUrl=void 0;const r=L,n=k;a(U,t),a($,t),a(F,t),a(W,t),a(V,t),a(K,t),a(Q,t),a(X,t);let o=n.DEFAULT_BASE_URL;t.setBaseUrl=e=>{o=e},t.getSafeInfo=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},t.getIncomingTransfers=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:e,address:t},query:s},a)},t.getModuleTransactions=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getMultisigTransactions=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getBalances=function(e,t,s="usd",a={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:s},query:a})},t.getFiatCurrencies=function(){return(0,r.getEndpoint)(o,"/v1/balances/supported-fiat-codes")},t.getOwnedSafes=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},t.getCollectibles=function(e,t,s={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s})},t.getCollectiblesPage=function(e,t,s={},a){return(0,r.getEndpoint)(o,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s},a)},t.getTransactionHistory=function(e,t,s){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:{}},s)},t.getTransactionQueue=function(e,t,s,a){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:{trusted:a}},s)},t.getTransactionDetails=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},t.postSafeGasEstimation=function(e,t,s){return(0,r.postEndpoint)(o,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:s})},t.proposeTransaction=function(e,t,s){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:s})},t.getChainsConfig=function(e){return(0,r.getEndpoint)(o,"/v1/chains",{query:e})},t.getChainConfig=function(e){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}",{path:{chainId:e}})},t.getSafeApps=function(e,t={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},t.getMasterCopies=function(e){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},t.getDecodedData=function(e,t){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t}})},t.getSafeMessages=function(e,t,s){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},s)},t.getSafeMessage=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},t.proposeSafeMessage=function(e,t,s){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},body:s})},t.confirmSafeMessage=function(e,t,s){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:s})}}(N),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransferDirection=e.TransactionStatus=e.TokenType=e.Operation=void 0;var t=N;Object.defineProperty(e,"Operation",{enumerable:!0,get:function(){return t.Operation}}),Object.defineProperty(e,"TokenType",{enumerable:!0,get:function(){return t.TokenType}}),Object.defineProperty(e,"TransactionStatus",{enumerable:!0,get:function(){return t.TransactionStatus}}),Object.defineProperty(e,"TransferDirection",{enumerable:!0,get:function(){return t.TransferDirection}})}(R);var Y={};Object.defineProperty(Y,"__esModule",{value:!0}),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),a(M,t),a(j,t),a(R,t),a(Y,t)}(C),Object.defineProperty(O,"__esModule",{value:!0}),O.TXs=void 0;const J=P,z=C;O.TXs=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(J.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(J.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,z.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(J.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const s={txs:e,params:t};return(await this.communicator.send(J.Methods.sendTransactions,s)).data}};var Z={},ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.RPC_CALLS=void 0,ee.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},Object.defineProperty(Z,"__esModule",{value:!0}),Z.Eth=void 0;const te=ee,se=P,ae={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};Z.Eth=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:te.RPC_CALLS.eth_call,formatters:[null,ae.defaultBlockParam]}),this.getBalance=this.buildRequest({call:te.RPC_CALLS.eth_getBalance,formatters:[null,ae.defaultBlockParam]}),this.getCode=this.buildRequest({call:te.RPC_CALLS.eth_getCode,formatters:[null,ae.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:te.RPC_CALLS.eth_getStorageAt,formatters:[null,ae.blockNumberToHex,ae.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:te.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:te.RPC_CALLS.eth_getBlockByHash,formatters:[null,ae.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:te.RPC_CALLS.eth_getBlockByNumber,formatters:[ae.blockNumberToHex,ae.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:te.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:te.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:te.RPC_CALLS.eth_getTransactionCount,formatters:[null,ae.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:te.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:te.RPC_CALLS.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:te.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:s}=e;return async e=>{s&&Array.isArray(e)&&s.forEach(((t,s)=>{t&&(e[s]=t(e[s]))}));const a={call:t,params:e||[]};return(await this.communicator.send(se.Methods.rpcCall,a)).data}}};var re={};try{const e=window;null==e._ethers&&(e._ethers=s.ethers)}catch(e){}var ne=Object.freeze({__proto__:null,ethers:s.ethers,Signer:a.Signer,Wallet:s.Wallet,VoidSigner:a.VoidSigner,getDefaultProvider:r.getDefaultProvider,providers:u,BaseContract:n.BaseContract,Contract:n.Contract,ContractFactory:n.ContractFactory,BigNumber:o.BigNumber,FixedNumber:s.FixedNumber,constants:f,get errors(){return o.ErrorCode},logger:s.logger,utils:s.utils,wordlists:s.wordlists,version:s.version,Wordlist:s.Wordlist}),oe=e.getAugmentedNamespace(ne),ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.MAGIC_VALUE_BYTES=ie.MAGIC_VALUE=ie.EIP_1271_BYTES_INTERFACE=ie.EIP_1271_INTERFACE=void 0;const de=oe;ie.MAGIC_VALUE="0x1626ba7e";ie.MAGIC_VALUE_BYTES="0x20c13b0b";const ce=new de.ethers.utils.Interface(["function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view"]);ie.EIP_1271_INTERFACE=ce;const le=new de.ethers.utils.Interface(["function isValidSignature(bytes calldata _data, bytes calldata _signature) public view"]);ie.EIP_1271_BYTES_INTERFACE=le;var ue={},fe={},he={};Object.defineProperty(he,"__esModule",{value:!0}),he.PermissionsError=he.PERMISSIONS_REQUEST_REJECTED=void 0,he.PERMISSIONS_REQUEST_REJECTED=4001;class ge extends Error{constructor(e,t,s){super(e),this.code=t,this.data=s,Object.setPrototypeOf(this,ge.prototype)}}he.PermissionsError=ge,Object.defineProperty(fe,"__esModule",{value:!0}),fe.Wallet=void 0;const pe=P,me=he;fe.Wallet=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(pe.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new me.PermissionsError("Permissions request is invalid",me.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(pe.Methods.wallet_requestPermissions,e)).data}catch(e){throw new me.PermissionsError("Permissions rejected",me.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every((e=>"object"==typeof e&&Object.keys(e).every((e=>!!Object.values(pe.RestrictedMethods).includes(e)))))}},Object.defineProperty(ue,"__esModule",{value:!0});const _e=fe,Ee=he,ve=(e,t)=>t.some((t=>t.parentCapability===e));ue.default=()=>(e,t,s)=>{const a=s.value;return s.value=async function(){const e=new _e.Wallet(this.communicator);let s=await e.getPermissions();if(ve(t,s)||(s=await e.requestPermissions([{[t]:{}}])),!ve(t,s))throw new Ee.PermissionsError("Permissions rejected",Ee.PERMISSIONS_REQUEST_REJECTED);return a.apply(this)},s};var ye=e.commonjsGlobal&&e.commonjsGlobal.__decorate||function(e,t,s,a){var r,n=arguments.length,o=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,a);else for(var i=e.length-1;i>=0;i--)(r=e[i])&&(o=(n<3?r(o):n>3?r(t,s,o):r(t,s))||o);return n>3&&o&&Object.defineProperty(t,s,o),o},Te=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(re,"__esModule",{value:!0}),re.Safe=void 0;const we=oe,be=ie,Se=P,Ie=ee,Ae=C,Pe=Te(ue);class Oe{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(Se.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(Se.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(Se.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const s=await this.getInfo(),a=be.EIP_1271_INTERFACE.encodeFunctionData("isValidSignature",[e,t]),r={call:Ie.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:a},"latest"]};try{return(await this.communicator.send(Se.Methods.rpcCall,r)).data.slice(0,10).toLowerCase()===be.MAGIC_VALUE}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){const s=await this.getInfo(),a=we.ethers.utils.arrayify(e),r=be.EIP_1271_BYTES_INTERFACE.encodeFunctionData("isValidSignature",[a,t]),n={call:Ie.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(Se.Methods.rpcCall,n)).data.slice(0,10).toLowerCase()===be.MAGIC_VALUE_BYTES}catch(e){return!1}}calculateMessageHash(e){return we.ethers.utils.hashMessage(e)}calculateTypedMessageHash(e){return we.ethers.utils._TypedDataEncoder.hash(e.domain,e.types,e.message)}async getOffChainSignature(e){return(await this.communicator.send(Se.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let s;if("string"==typeof e&&(s=async()=>{const s=this.calculateMessageHash(e);return await this.isMessageHashSigned(s,t)}),(0,Ae.isObjectEIP712TypedData)(e)&&(s=async()=>{const s=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(s,t)}),s){return await s()}throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const a of s){if(await a(e,t))return!0}return!1}async getEnvironmentInfo(){return(await this.communicator.send(Se.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(Se.Methods.requestAddressBook,void 0)).data}}ye([(0,Pe.default)()],Oe.prototype,"requestAddressBook",null),re.Safe=Oe;var Ce=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(p,"__esModule",{value:!0});const Me=Ce(m),je=O,Re=Z,Ne=re,Le=fe;p.default=class{constructor(e={}){const{allowedDomains:t=null,debug:s=!1}=e;this.communicator=new Me.default(t,s),this.eth=new Re.Eth(this.communicator),this.txs=new je.TXs(this.communicator),this.safe=new Ne.Safe(this.communicator),this.wallet=new Le.Wallet(this.communicator)}},function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSDKVersion=void 0;const n=r(p);t.default=n.default,a(p,t),a(C,t),a(P,t),a(_,t);var o=E;Object.defineProperty(t,"getSDKVersion",{enumerable:!0,get:function(){return o.getSDKVersion}})}(g);var De=e.getDefaultExportFromCjs(g),xe={},Ge={},He={};Object.defineProperty(He,"__esModule",{value:!0}),He.getLowerCase=void 0,He.getLowerCase=function(e){return e?e.toLowerCase():e},Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.SafeAppProvider=void 0;const Be=h.default,qe=He;class ke extends Be.EventEmitter{constructor(e,t){super(),this.submittedTxs=new Map,this.safe=e,this.sdk=t}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(e){const{method:t,params:s=[]}=e;switch(t){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(e),"0x"}case"eth_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(t),"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[e,t]=s,a="string"==typeof t?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase())throw new Error("The address is invalid");return await this.sdk.txs.signTypedMessage(a),"0x"}case"eth_sendTransaction":const t=Object.assign({value:"0",data:"0x"},s[0]);"string"==typeof t.gas&&t.gas.startsWith("0x")&&(t.gas=parseInt(t.gas,16));const a=await this.sdk.txs.send({txs:[t],params:{safeTxGas:t.gas}});return this.submittedTxs.set(a.safeTxHash,{from:this.safe.safeAddress,hash:a.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:t.data,value:t.value,to:t.to,blockHash:null,blockNumber:null,transactionIndex:null}),a.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,qe.getLowerCase)(s[0]),s[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,qe.getLowerCase)(s[0]),s[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,qe.getLowerCase)(s[0]),s[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,qe.getLowerCase)(s[0]),s[1],s[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([s[0],s[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([s[0],s[1]]);case"eth_getTransactionByHash":let r=s[0];try{r=(await this.sdk.txs.getBySafeTxHash(r)).txHash||r}catch(e){}return this.submittedTxs.has(r)?this.submittedTxs.get(r):this.sdk.eth.getTransactionByHash([r]).then((e=>(e&&(e.hash=s[0]),e)));case"eth_getTransactionReceipt":{let e=s[0];try{e=(await this.sdk.txs.getBySafeTxHash(e)).txHash||e}catch(e){}return this.sdk.eth.getTransactionReceipt([e]).then((e=>(e&&(e.transactionHash=s[0]),e)))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(s[0]);case"eth_call":return this.sdk.eth.call([s[0],s[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([s[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(s[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([s[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then((s=>t(null,{jsonrpc:"2.0",id:e.id,result:s}))).catch((e=>t(e,null)))}}let Ue,$e;function Fe(){return e.__awaiter(this,void 0,void 0,(function*(){return $e||($e=new De),void 0===Ue&&(Ue=yield Promise.race([$e.safe.getInfo(),new Promise((e=>setTimeout(e,200)))])),Ue}))}Ge.SafeAppProvider=ke,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppProvider=void 0;var t=Ge;Object.defineProperty(e,"SafeAppProvider",{enumerable:!0,get:function(){return t.SafeAppProvider}})}(xe);var We={},Ve={},Ke={};Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.getTxServiceBaseUrl=void 0,Ke.getTxServiceBaseUrl=function(e){return`${e}/api`};var Qe={},Xe={exports:{}};!function(t,s){var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e.commonjsGlobal)return e.commonjsGlobal;throw new Error("unable to locate global object")}();t.exports=s=a.fetch,a.fetch&&(s.default=a.fetch.bind(a)),s.Headers=a.Headers,s.Request=a.Request,s.Response=a.Response}(Xe,Xe.exports),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendRequest=t.HttpMethod=void 0;const a=s(Xe.exports);var r;(r=t.HttpMethod||(t.HttpMethod={})).Get="get",r.Post="post",r.Delete="delete",t.sendRequest=async function({url:e,method:t,body:s}){const r=await(0,a.default)(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)});let n;try{n=await r.json()}catch(e){if(!r.ok)throw new Error(r.statusText)}if(r.ok)return n;if(n.data)throw new Error(n.data);if(n.detail)throw new Error(n.detail);if(n.message)throw new Error(n.message);if(n.nonFieldErrors)throw new Error(n.nonFieldErrors);if(n.delegate)throw new Error(n.delegate);if(n.safe)throw new Error(n.safe);if(n.delegator)throw new Error(n.delegator);throw new Error(r.statusText)}}(Qe);var Ye,Je,ze=e.commonjsGlobal&&e.commonjsGlobal.__classPrivateFieldSet||function(e,t,s,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,s):r?r.value=s:t.set(e,s),s},Ze=e.commonjsGlobal&&e.commonjsGlobal.__classPrivateFieldGet||function(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)};Object.defineProperty(Ve,"__esModule",{value:!0});const et=Ke,tt=Qe;Ye=new WeakMap,Je=new WeakMap,Ve.default=class{constructor({txServiceUrl:e,ethAdapter:t}){Ye.set(this,void 0),Je.set(this,void 0),ze(this,Ye,(0,et.getTxServiceBaseUrl)(e),"f"),ze(this,Je,t,"f")}async getServiceInfo(){return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/about`,method:tt.HttpMethod.Get})}async getServiceMasterCopiesInfo(){return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/about/master-copies`,method:tt.HttpMethod.Get})}async decodeData(e){if(""===e)throw new Error("Invalid data");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/data-decoder/`,method:tt.HttpMethod.Post,body:{data:e}})}async getSafesByOwner(e){if(""===e)throw new Error("Invalid owner address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/owners/${t}/safes/`,method:tt.HttpMethod.Get})}async getSafesByModule(e){if(""===e)throw new Error("Invalid module address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/modules/${t}/safes/`,method:tt.HttpMethod.Get})}async getTransaction(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/multisig-transactions/${e}/`,method:tt.HttpMethod.Get})}async getTransactionConfirmations(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:tt.HttpMethod.Get})}async confirmTransaction(e,t){if(""===e)throw new Error("Invalid safeTxHash");if(""===t)throw new Error("Invalid signature");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:tt.HttpMethod.Post,body:{signature:t}})}async getSafeInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/`,method:tt.HttpMethod.Get})}async getSafeDelegates({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,limit:r,offset:n}){const o=new URL(`${Ze(this,Ye,"f")}/v1/delegates`);if(e){const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);o.searchParams.set("safe",t)}if(t){const{address:e}=await Ze(this,Je,"f").getEip3770Address(t);o.searchParams.set("delegate",e)}if(s){const{address:e}=await Ze(this,Je,"f").getEip3770Address(s);o.searchParams.set("delegator",e)}return a&&o.searchParams.set("label",a),r&&o.searchParams.set("limit",r),n&&o.searchParams.set("offset",n),(0,tt.sendRequest)({url:o.toString(),method:tt.HttpMethod.Get})}async addSafeDelegate({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,signer:r}){if(""===t)throw new Error("Invalid Safe delegate address");if(""===s)throw new Error("Invalid Safe delegator address");if(""===a)throw new Error("Invalid label");const{address:n}=await Ze(this,Je,"f").getEip3770Address(t),{address:o}=await Ze(this,Je,"f").getEip3770Address(s),i=n+Math.floor(Date.now()/1e3/3600),d=await r.signMessage(i),c={safe:e?(await Ze(this,Je,"f").getEip3770Address(e)).address:null,delegate:n,delegator:o,label:a,signature:d};return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/delegates/`,method:tt.HttpMethod.Post,body:c})}async removeSafeDelegate({delegateAddress:e,delegatorAddress:t,signer:s}){if(""===e)throw new Error("Invalid Safe delegate address");if(""===t)throw new Error("Invalid Safe delegator address");const{address:a}=await Ze(this,Je,"f").getEip3770Address(e),{address:r}=await Ze(this,Je,"f").getEip3770Address(t),n=a+Math.floor(Date.now()/1e3/3600),o=await s.signMessage(n);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/delegates/${a}`,method:tt.HttpMethod.Delete,body:{delegate:a,delegator:r,signature:o}})}async getSafeCreationInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/creation/`,method:tt.HttpMethod.Get})}async estimateSafeTransaction(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${s}/multisig-transactions/estimations/`,method:tt.HttpMethod.Post,body:t})}async proposeTransaction({safeAddress:e,safeTransactionData:t,safeTxHash:s,senderAddress:a,senderSignature:r,origin:n}){if(""===e)throw new Error("Invalid Safe address");const{address:o}=await Ze(this,Je,"f").getEip3770Address(e),{address:i}=await Ze(this,Je,"f").getEip3770Address(a);if(""===s)throw new Error("Invalid safeTxHash");return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${o}/multisig-transactions/`,method:tt.HttpMethod.Post,body:{...t,contractTransactionHash:s,sender:i,signature:r,origin:n}})}async getIncomingTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/incoming-transfers?executed=true`,method:tt.HttpMethod.Get})}async getModuleTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/module-transactions/`,method:tt.HttpMethod.Get})}async getMultisigTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${t}/multisig-transactions/`,method:tt.HttpMethod.Get})}async getPendingTransactions(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await Ze(this,Je,"f").getEip3770Address(e),a=t||(await this.getSafeInfo(s)).nonce;return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/safes/${s}/multisig-transactions/?executed=false&nonce__gte=${a}`,method:tt.HttpMethod.Get})}async getAllTransactions(e,t){var s,a,r;if(""===e)throw new Error("Invalid Safe address");const{address:n}=await Ze(this,Je,"f").getEip3770Address(e),o=new URL(`${Ze(this,Ye,"f")}/v1/safes/${n}/all-transactions/`),i=(null===(s=null==t?void 0:t.trusted)||void 0===s?void 0:s.toString())||"true";o.searchParams.set("trusted",i);const d=(null===(a=null==t?void 0:t.queued)||void 0===a?void 0:a.toString())||"true";o.searchParams.set("queued",d);const c=(null===(r=null==t?void 0:t.executed)||void 0===r?void 0:r.toString())||"false";return o.searchParams.set("executed",c),(0,tt.sendRequest)({url:o.toString(),method:tt.HttpMethod.Get})}async getNextNonce(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e),s=await this.getPendingTransactions(t);if(s.results.length>0){const e=s.results.map((e=>e.nonce));return Math.max(...e)+1}return(await this.getSafeInfo(t)).nonce}async getTokenList(){return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/tokens/`,method:tt.HttpMethod.Get})}async getToken(e){if(""===e)throw new Error("Invalid token address");const{address:t}=await Ze(this,Je,"f").getEip3770Address(e);return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/tokens/${t}/`,method:tt.HttpMethod.Get})}};var st={};Object.defineProperty(st,"__esModule",{value:!0}),function(t){var s=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e.commonjsGlobal&&e.commonjsGlobal.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(Ve);a(st,t),t.default=n.default}(We);var at=e.getDefaultExportFromCjs(We);const rt={1:"https://safe-transaction-mainnet.safe.global/",5:"https://safe-transaction-goerli.safe.global/",42161:"https://safe-transaction-arbitrum.safe.global/",43114:"https://safe-transaction-avalanche.safe.global/",1313161554:"https://safe-transaction-aurora.safe.global/",56:"https://safe-transaction-bsc.safe.global/",10:"https://safe-transaction-optimism.safe.global/",137:"https://safe-transaction-polygon.safe.global/"};let nt;function ot(t){return e.__awaiter(this,void 0,void 0,(function*(){if((null==nt?void 0:nt.chainId)===t)return nt.safeService;if(!e.useWalletStore.getState().provider)throw new Error("provider is undefined");const s=function(){return{getEip3770Address:t=>e.__awaiter(this,void 0,void 0,(function*(){const{address:e,prefix:s}=function(e){const t=e.split(":"),s=t.length>1?t[1]:t[0];return{prefix:t.length>1?t[0]:"",address:s}}(t);return{address:e,prefix:s}}))}}(),a=rt[t];if(!a)return;const r=new at({txServiceUrl:a,ethAdapter:s});return nt={safeService:r,chainId:t},nt.safeService}))}exports.default=function(t){return e.__awaiter(this,void 0,void 0,(function*(){const s=yield Fe();if(!s)throw Error("Could not load Safe information");const a=new xe.SafeAppProvider(s,$e);return a.on("connect",t.connect),a.on("disconnect",t.disconnect),a.on("accountsChanged",t.accountsChanged),a.on("chainChanged",t.chainChanged),a.on("message",t.message),e.convertWeb3Provider(a)}))},exports.getAccountIsSafe=function(t,s){return e.__awaiter(this,void 0,void 0,(function*(){if(!s)return!1;const e=yield ot(t);if(!e)return!1;try{return!!(yield e.getSafeInfo(s))}catch(e){return console.error(e),!1}}))},exports.getConnectedSafe=Fe,exports.getIsSafe=function(){return e.__awaiter(this,void 0,void 0,(function*(){return!!(yield Fe())}))},exports.getSafeHashDetailUrl=function(e,t,s){const a={1:"eth",5:"gor",137:"matic",56:"bnb",42161:"arb1",10:"oeth",43114:"avax",1313161554:"aurora"}[t];if(!a)throw new Error(`Not Supported network: ${t}`);return`https://app.safe.global/transactions/tx?id=multisig_${s}_${e}&safe=${a}%3A${s}`},exports.getSafeTxHash=function(t,s,a){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield ot(t);if(!e)return console.error(`chainId: ${t} is not supported safe`),a;if(a!==s)return a;const r=yield e.getMultisigTransactions(a),[n]=r.results;return n.safeTxHash}))},exports.getSafeTxStatus=function(t,s,a){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield ot(t);if(!e)throw new Error(`chainId: ${t} is not supported safe`);try{const{results:t}=yield e.getMultisigTransactions(a),r=t.find((e=>e.safeTxHash.toLocaleLowerCase()===s.toLocaleLowerCase()));if(!r)return null;if(t.some((e=>!(e.nonce!==r.nonce||e.safeTxHash.toLocaleLowerCase()===s.toLocaleLowerCase()||!e.isExecuted||!e.isSuccessful))))return"rejected";if(null===r.isExecuted||null===r.isSuccessful)return null;return{status:r.isExecuted&&r.isSuccessful||!1,transactionHash:r.transactionHash,blockNumber:r.blockNumber||null}}catch(e){throw console.error(e),new Error(`safeTxHash: ${s} is not valid.`)}}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./index-5295919d.cjs");require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),Object.defineProperty(exports,"ChainId",{enumerable:!0,get:function(){return e.ChainId}}),exports.HD_PATH_LIST=e.HD_PATH_LIST,exports.OpenBlockIframeWallet=e.OpenBlockIframeWallet,Object.defineProperty(exports,"WalletType",{enumerable:!0,get:function(){return e.WalletType}}),Object.defineProperty(exports,"WatchResult",{enumerable:!0,get:function(){return e.WatchResult}}),exports.allWalletList=e.allWalletList,exports.allWalletObject=e.allWalletObject,exports.approve=e.approve,exports.convertTransactionType=e.convertTransactionType,exports.convertWeb3Provider=e.convertWeb3Provider,exports.default=e.Core,exports.getBinanceConnector=e.getBinanceConnector,exports.getBinancePackage=e.getBinancePackage,exports.getBloctoConnector=e.getBloctoConnector,exports.getBloctoPackage=e.getBloctoPackage,exports.getContract=e.getContract,exports.getCyberConnector=e.getCyberConnector,exports.getCyberPackage=e.getCyberPackage,exports.getEstimateGas=e.getEstimateGas,exports.getGasPrice=e.getGasPrice,exports.getGnosisPackage=e.getGnosisPackage,exports.getIsAndroid=e.getIsAndroid,exports.getIsIOS=e.getIsIOS,exports.getIsMobile=e.getIsMobile,exports.getIsOpenBlockIframe=e.getIsOpenBlockIframe,exports.getIsolatedEnvironmentWallet=e.getIsolatedEnvironmentWallet,exports.getLedgerUSBPackage=e.getLedgerUSBPackage,exports.getMetamaskConnector=e.getMetamaskConnector,exports.getMetamaskPackage=e.getMetamaskPackage,exports.getOpenBlockIframeConnector=e.connectOpenBlockIframe,exports.getPortisConnector=e.getPortisConnector,exports.getPortisPackage=e.getPortisPackage,exports.getProviderByChain=e.getProviderByChain,exports.getRainbowConnectPackage=e.getRainbowConnectPackage,exports.getRainbowConnector=e.getRainbowConnector,exports.getUAuthPackage=e.getUAuthPackage,exports.getUniPassConnector=e.getUniPassConnector,exports.getUniPassPackage=e.getUniPassPackage,exports.getWalletConnectConnector=e.getWalletConnectConnector,exports.getWalletConnectPackage=e.getWalletConnectPackage,exports.getWalletDisabledState=e.getWalletDisabledState,exports.getWalletLinkConnector=e.getWalletLinkConnector,exports.getWalletLinkPackage=e.getWalletLinkPackage,exports.getWalletList=e.getWalletList,exports.getWindow=e.getWindow,exports.injectedConnect=e.injectedConnect,exports.isAddress=e.isAddress,exports.isLargeIOS=e.isLargeIOS,exports.isSmallIOS=e.isSmallIOS,exports.isSupportWebHid=e.isSupportWebHid,exports.personalSign=e.personalSign,exports.registerNetworkWithMetamask=e.registerNetworkWithMetamask,exports.sendTransaction=e.sendTransaction,exports.sign=e.sign,exports.signTransaction=e.signTransaction,exports.signTypedData=e.signTypedData,exports.standaloneList=e.standaloneList,exports.standaloneListObject=e.standaloneListObject,exports.useWalletStore=e.useWalletStore,exports.watchTx=e.watchTx;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./index-136ec288.cjs");require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),Object.defineProperty(exports,"ChainId",{enumerable:!0,get:function(){return e.ChainId}}),exports.HD_PATH_LIST=e.HD_PATH_LIST,exports.OpenBlockIframeWallet=e.OpenBlockIframeWallet,Object.defineProperty(exports,"WalletType",{enumerable:!0,get:function(){return e.WalletType}}),Object.defineProperty(exports,"WatchResult",{enumerable:!0,get:function(){return e.WatchResult}}),exports.allWalletList=e.allWalletList,exports.allWalletObject=e.allWalletObject,exports.approve=e.approve,exports.convertTransactionType=e.convertTransactionType,exports.convertWeb3Provider=e.convertWeb3Provider,exports.default=e.Core,exports.getBinanceConnector=e.getBinanceConnector,exports.getBinancePackage=e.getBinancePackage,exports.getBloctoConnector=e.getBloctoConnector,exports.getBloctoPackage=e.getBloctoPackage,exports.getContract=e.getContract,exports.getCyberConnector=e.getCyberConnector,exports.getCyberPackage=e.getCyberPackage,exports.getEstimateGas=e.getEstimateGas,exports.getGasPrice=e.getGasPrice,exports.getGnosisPackage=e.getGnosisPackage,exports.getIsAndroid=e.getIsAndroid,exports.getIsIOS=e.getIsIOS,exports.getIsMobile=e.getIsMobile,exports.getIsOpenBlockIframe=e.getIsOpenBlockIframe,exports.getIsolatedEnvironmentWallet=e.getIsolatedEnvironmentWallet,exports.getLedgerUSBPackage=e.getLedgerUSBPackage,exports.getMetamaskConnector=e.getMetamaskConnector,exports.getMetamaskPackage=e.getMetamaskPackage,exports.getOpenBlockIframeConnector=e.connectOpenBlockIframe,exports.getPortisConnector=e.getPortisConnector,exports.getPortisPackage=e.getPortisPackage,exports.getProviderByChain=e.getProviderByChain,exports.getRainbowConnectPackage=e.getRainbowConnectPackage,exports.getRainbowConnector=e.getRainbowConnector,exports.getUAuthPackage=e.getUAuthPackage,exports.getUniPassConnector=e.getUniPassConnector,exports.getUniPassPackage=e.getUniPassPackage,exports.getWalletConnectConnector=e.getWalletConnectConnector,exports.getWalletConnectPackage=e.getWalletConnectPackage,exports.getWalletDisabledState=e.getWalletDisabledState,exports.getWalletLinkConnector=e.getWalletLinkConnector,exports.getWalletLinkPackage=e.getWalletLinkPackage,exports.getWalletList=e.getWalletList,exports.getWindow=e.getWindow,exports.injectedConnect=e.injectedConnect,exports.isAddress=e.isAddress,exports.isLargeIOS=e.isLargeIOS,exports.isSmallIOS=e.isSmallIOS,exports.isSupportWebHid=e.isSupportWebHid,exports.personalSign=e.personalSign,exports.registerNetworkWithMetamask=e.registerNetworkWithMetamask,exports.sendTransaction=e.sendTransaction,exports.sign=e.sign,exports.signTransaction=e.signTransaction,exports.signTypedData=e.signTypedData,exports.standaloneList=e.standaloneList,exports.standaloneListObject=e.standaloneListObject,exports.useWalletStore=e.useWalletStore,exports.watchTx=e.watchTx;
@@ -1 +1 @@
1
- "use strict";var t=require("@ethersproject/address"),e=require("@ethersproject/bytes"),r=require("./id-a5369fec.cjs"),n=require("./index-5295919d.cjs"),a=require("@ethersproject/properties"),s=require("@ethersproject/constants");const i="abi/5.7.0",o=new r.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",r.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),m(this,e);let n=this.type.match(p);m(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:g.fromObject({type:n[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",r.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 n=t.split("@");return 1!==n.length?(n.length>2&&o.throwArgumentError("invalid human-readable ABI signature","value",t),n[1].match(/^[0-9]+$/)||o.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=r.BigNumber.from(n[1]),n[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",r.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 n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(g.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?r.BigNumber.from(t.gas):null};return new _(u,n)}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 n={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?r.BigNumber.from(t.gas):null};return new x(u,n)}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 r.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 n=e.arrayify(r.BigNumber.from(t));return n.length>this.wordSize&&R.throwError("value out-of-bounds",r.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:n.length}),n.length%this.wordSize&&(n=e.concat([this._padding.slice(n.length%this.wordSize),n])),n}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,n){let a=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+a>this._data.length&&(this.allowLoose&&n&&this._offset+e<=this._data.length?a=e:R.throwError("data out-of-bounds",r.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 r.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 r.Logger(i);function k(t,e,n){let a=null;if(Array.isArray(n))a=n;else if(n&&"object"==typeof n){let t={};a=e.map((e=>{const a=e.localName;return a||z.throwError("cannot encode object for signature with missing names",r.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[a]&&z.throwError("cannot encode object for signature with duplicate names",r.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[a]=!0,n[a]}))}else z.throwArgumentError("invalid tuple value","tuple",n);e.length!==a.length&&z.throwArgumentError("types/value length mismatch","tuple",n);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 n=[],a=t.subReader(0);e.forEach((e=>{let s=null;if(e.dynamic){let n=t.readValue(),i=a.subReader(n.toNumber());try{s=e.decode(i)}catch(t){if(t.code===r.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===r.Logger.errors.BUFFER_OVERRUN)throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}null!=s&&n.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 r=t.localName;if(!r||1!==s[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const a=n[e];a instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw a}}):n[r]=a}));for(let t=0;t<n.length;t++){const e=n[t];e instanceof Error&&Object.defineProperty(n,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(n)}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",r.Logger.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let n=[];for(let t=0;t<e;t++)n.push(new C(this.coder));return t.coerce(this.name,P(t,n))}}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 n=r.BigNumber.from(e),a=s.MaxUint256.mask(8*t.wordSize);if(this.signed){let t=a.mask(8*this.size-1);(n.gt(t)||n.lt(t.add(s.One).mul(s.NegativeOne)))&&this._throwError("value out-of-bounds",e)}else(n.lt(s.Zero)||n.gt(a.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(n)}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,r.toUtf8Bytes(e))}decode(t){return r.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 r.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",r.Logger.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const n=t.map((t=>this._getCoder(g.from(t)))),a=new H(n,"_"),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 r.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,n){"string"==typeof t&&(t=this.getFunction(t));let a=e.arrayify(n),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,r.Logger.errors.CALL_EXCEPTION,{method:t.format(),data:e.hexlify(n),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(),r.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=r.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,n,a){if("string"==typeof t&&(t=this.getEvent(t)),null!=a&&!t.anonymous){let n=this.getEventTopic(t);e.isHexString(a[0],32)&&a[0].toLowerCase()===n||Y.throwError("fragment/topic mismatch",r.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,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,n,!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:r.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-07decbd4.cjs"),n=require("./index-136ec288.cjs"),a=require("@ethersproject/properties"),s=require("@ethersproject/constants");const i="abi/5.7.0",o=new r.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",r.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),m(this,e);let n=this.type.match(p);m(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:g.fromObject({type:n[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",r.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 n=t.split("@");return 1!==n.length?(n.length>2&&o.throwArgumentError("invalid human-readable ABI signature","value",t),n[1].match(/^[0-9]+$/)||o.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=r.BigNumber.from(n[1]),n[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",r.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 n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(g.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?r.BigNumber.from(t.gas):null};return new _(u,n)}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 n={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?r.BigNumber.from(t.gas):null};return new x(u,n)}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 r.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 n=e.arrayify(r.BigNumber.from(t));return n.length>this.wordSize&&R.throwError("value out-of-bounds",r.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:n.length}),n.length%this.wordSize&&(n=e.concat([this._padding.slice(n.length%this.wordSize),n])),n}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,n){let a=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+a>this._data.length&&(this.allowLoose&&n&&this._offset+e<=this._data.length?a=e:R.throwError("data out-of-bounds",r.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 r.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 r.Logger(i);function k(t,e,n){let a=null;if(Array.isArray(n))a=n;else if(n&&"object"==typeof n){let t={};a=e.map((e=>{const a=e.localName;return a||z.throwError("cannot encode object for signature with missing names",r.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[a]&&z.throwError("cannot encode object for signature with duplicate names",r.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[a]=!0,n[a]}))}else z.throwArgumentError("invalid tuple value","tuple",n);e.length!==a.length&&z.throwArgumentError("types/value length mismatch","tuple",n);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 n=[],a=t.subReader(0);e.forEach((e=>{let s=null;if(e.dynamic){let n=t.readValue(),i=a.subReader(n.toNumber());try{s=e.decode(i)}catch(t){if(t.code===r.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===r.Logger.errors.BUFFER_OVERRUN)throw t;s=t,s.baseType=e.name,s.name=e.localName,s.type=e.type}null!=s&&n.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 r=t.localName;if(!r||1!==s[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const a=n[e];a instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw a}}):n[r]=a}));for(let t=0;t<n.length;t++){const e=n[t];e instanceof Error&&Object.defineProperty(n,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(n)}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",r.Logger.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let n=[];for(let t=0;t<e;t++)n.push(new C(this.coder));return t.coerce(this.name,P(t,n))}}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 n=r.BigNumber.from(e),a=s.MaxUint256.mask(8*t.wordSize);if(this.signed){let t=a.mask(8*this.size-1);(n.gt(t)||n.lt(t.add(s.One).mul(s.NegativeOne)))&&this._throwError("value out-of-bounds",e)}else(n.lt(s.Zero)||n.gt(a.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(n)}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,r.toUtf8Bytes(e))}decode(t){return r.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 r.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",r.Logger.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const n=t.map((t=>this._getCoder(g.from(t)))),a=new H(n,"_"),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 r.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,n){"string"==typeof t&&(t=this.getFunction(t));let a=e.arrayify(n),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,r.Logger.errors.CALL_EXCEPTION,{method:t.format(),data:e.hexlify(n),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(),r.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=r.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,n,a){if("string"==typeof t&&(t=this.getEvent(t)),null!=a&&!t.anonymous){let n=this.getEventTopic(t);e.isHexString(a[0],32)&&a[0].toLowerCase()===n||Y.throwError("fragment/topic mismatch",r.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,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,n,!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:r.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,4 +1,4 @@
1
- "use strict";var e=require("./index-5295919d.cjs");require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");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){
1
+ "use strict";var e=require("./index-136ec288.cjs");require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");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-5295919d.cjs");require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],s=["https://oec.cocoswap.com"];class o{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,s;if(e.data.target!==t)return;const o=null===(s=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===s?void 0:s.mark;o&&("call_method"===o.type?this._handleNormalMethod(o,e):"register_event"===o.type&&this._handleEventMethod(o,e))}),!1)}_handleNormalMethod(e,t){var i,n,s,o,r;(null===(i=t.data.value.data)||void 0===i?void 0:i.error)?null===(n=this.callBackList[e.id])||void 0===n||n.reject(null===(s=t.data.value.data)||void 0===s?void 0:s.error):null===(o=this.callBackList[e.id])||void 0===o||o.resolve(null===(r=t.data.value.data)||void 0===r?void 0:r.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,o,r,a,d,h,l;const c=null===(a=null===(r=null===(o=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===o?void 0:o.data)||void 0===r?void 0:r.mark)||void 0===a?void 0:a.eventName,u=null===(l=null===(h=null===(d=t.data)||void 0===d?void 0:d.value)||void 0===h?void 0:h.data)||void 0===l?void 0:l.params;if(c){const e=this.eventListener[c];if(!e)return void("https://app.openocean.finance"===window.location.origin&&window.location.reload());e.forEach((e=>{"chainChanged"===c&&(this.chainId=u,this.networkVersion=Number(u)),s.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,s)=>{const o=(()=>{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:o,method:e.method,type:"call_method"}}),window.parent.postMessage({from:t,target:i,data:e},"*"),this.callBackList[o]={resolve:n,reject:s}}))}_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 o;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
+ "use strict";var e=require("./index-136ec288.cjs");require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],s=["https://oec.cocoswap.com"];class o{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,s;if(e.data.target!==t)return;const o=null===(s=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===s?void 0:s.mark;o&&("call_method"===o.type?this._handleNormalMethod(o,e):"register_event"===o.type&&this._handleEventMethod(o,e))}),!1)}_handleNormalMethod(e,t){var i,n,s,o,r;(null===(i=t.data.value.data)||void 0===i?void 0:i.error)?null===(n=this.callBackList[e.id])||void 0===n||n.reject(null===(s=t.data.value.data)||void 0===s?void 0:s.error):null===(o=this.callBackList[e.id])||void 0===o||o.resolve(null===(r=t.data.value.data)||void 0===r?void 0:r.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,o,r,a,d,h,l;const c=null===(a=null===(r=null===(o=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===o?void 0:o.data)||void 0===r?void 0:r.mark)||void 0===a?void 0:a.eventName,u=null===(l=null===(h=null===(d=t.data)||void 0===d?void 0:d.value)||void 0===h?void 0:h.data)||void 0===l?void 0:l.params;if(c){const e=this.eventListener[c];if(!e)return void("https://app.openocean.finance"===window.location.origin&&window.location.reload());e.forEach((e=>{"chainChanged"===c&&(this.chainId=u,this.networkVersion=Number(u)),s.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,s)=>{const o=(()=>{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:o,method:e.method,type:"call_method"}}),window.parent.postMessage({from:t,target:i,data:e},"*"),this.callBackList[o]={resolve:n,reject:s}}))}_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 o;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};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./index-136ec288.cjs"),r=require("@walletconnect/ethereum-provider");require("@ethersproject/address"),require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),exports.default=function({chainId:o,rpcUrl:n,rpc:t,walletConnectParams:i,darkMode:c},a){return e.__awaiter(this,void 0,void 0,(function*(){let s,d,l="wss://relay.walletconnect.com",u=!0;i&&(l=i.bridge||l,u=void 0!==i.qrcode?i.qrcode:u,i.infuraId,d=i.qrModalOptions||void 0),t?s=t:o&&n&&(s={[o]:n});const p=e.getIsMobile(),h=yield r.EthereumProvider.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:o?[o]:[],showQrModal:!p,rpcMap:s,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",a.connect),h.on("disconnect",(e=>{a.disconnect(e),a.accountsChanged([])})),h.on("accountsChanged",a.accountsChanged),h.on("chainChanged",a.chainChanged),h.on("message",(({type:e,data:r})=>a.message(e,r))),new Promise((r=>e.__awaiter(this,void 0,void 0,(function*(){p?(h.once("display_uri",(o=>{let n=o;e.getIsIOS()&&(n=`rainbow://wc?uri=${encodeURIComponent(o)}&connector=rainbowkit`),window.location.href=n,r(e.convertWeb3Provider(h))})),h.enable()):(yield h.enable(),r(e.convertWeb3Provider(h)))}))))}))};
@@ -1 +1 @@
1
- "use strict";var t=require("@ethersproject/address"),r=require("@ethersproject/bytes"),e=require("./index-5295919d.cjs"),n=require("@ethersproject/properties"),i=require("./id-a5369fec.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 i.Logger(o),c=new Uint8Array(32);c.fill(0);const f=i.BigNumber.from(-1),u=i.BigNumber.from(0),h=i.BigNumber.from(1),y=i.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 i.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 e=""===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(e?o-1:o),c=e?a.add(h).mul(f):u;return function(t){const e=i.BigNumber.from(t);return(e.lt(c)||e.gt(a))&&s.throwArgumentError(`value out-of-bounds for ${n}`,"value",t),r.hexZeroPad(e.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,e,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(e),u=n.shallowCopy(e);return u.EIP712Domain?s.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):u.EIP712Domain=c,f.encode(o),{types:u,domain:a,primaryType:f.primaryType,message:f.visit(o,((t,e)=>{if(t.match(/^bytes(\d*)/))return r.hexlify(r.arrayify(e));if(t.match(/^u?int/))return i.BigNumber.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&s.throwArgumentError("invalid string","value",e),e}return s.throwArgumentError("unsupported type","type",t)}))}}}exports.TypedDataEncoder=x,exports.version=o;
1
+ "use strict";var t=require("@ethersproject/address"),r=require("@ethersproject/bytes"),e=require("./index-136ec288.cjs"),n=require("@ethersproject/properties"),i=require("./id-07decbd4.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 i.Logger(o),c=new Uint8Array(32);c.fill(0);const f=i.BigNumber.from(-1),u=i.BigNumber.from(0),h=i.BigNumber.from(1),y=i.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 i.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 e=""===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(e?o-1:o),c=e?a.add(h).mul(f):u;return function(t){const e=i.BigNumber.from(t);return(e.lt(c)||e.gt(a))&&s.throwArgumentError(`value out-of-bounds for ${n}`,"value",t),r.hexZeroPad(e.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,e,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(e),u=n.shallowCopy(e);return u.EIP712Domain?s.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):u.EIP712Domain=c,f.encode(o),{types:u,domain:a,primaryType:f.primaryType,message:f.visit(o,((t,e)=>{if(t.match(/^bytes(\d*)/))return r.hexlify(r.arrayify(e));if(t.match(/^u?int/))return i.BigNumber.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&s.throwArgumentError("invalid string","value",e),e}return s.throwArgumentError("unsupported type","type",t)}))}}}exports.TypedDataEncoder=x,exports.version=o;