@dodoex/wallet-web3 0.0.41-0 → 0.0.41-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DefaultJsonRpcProvider-9bb11653.js → DefaultJsonRpcProvider-583987df.js} +1 -1
- package/dist/__node-resolve_empty-0b485399.js +1 -0
- package/dist/__tslib-ced6fd51.js +1 -0
- package/dist/{blocto-23c0bf43.js → blocto-f42a61b6.js} +1 -1
- package/dist/{bn-868e7d54.js → bn-d8f0262c.js} +1 -1
- package/dist/{browser-ponyfill-585d5fef.js → browser-ponyfill-635ba813.js} +1 -1
- package/dist/cjs/{DefaultJsonRpcProvider-24942da1.cjs → DefaultJsonRpcProvider-9f539cb7.cjs} +1 -1
- package/dist/cjs/{__node-resolve_empty-36be5361.cjs → __node-resolve_empty-8f743760.cjs} +1 -1
- package/dist/cjs/__tslib-86b51b1b.cjs +1 -0
- package/dist/cjs/{blocto-422c3809.cjs → blocto-71a53312.cjs} +1 -1
- package/dist/cjs/{bn-86022586.cjs → bn-f94d2173.cjs} +1 -1
- package/dist/cjs/{browser-ponyfill-20abb3e4.cjs → browser-ponyfill-e352d0ba.cjs} +1 -1
- package/dist/cjs/{draggabilly-ca312d19.cjs → draggabilly-218423e5.cjs} +1 -1
- package/dist/cjs/{ethers-aab53906.cjs → ethers-3b1d7d09.cjs} +1 -1
- package/dist/cjs/{id-934e92eb.cjs → id-d2547ab8.cjs} +1 -1
- package/dist/cjs/{index-e6c93682.cjs → index-15ff0303.cjs} +1 -1
- package/dist/cjs/{index-ec85cab6.cjs → index-16586b6f.cjs} +1 -1
- package/dist/cjs/index-3b9b0297.cjs +9 -0
- package/dist/cjs/{index-05adb5cd.cjs → index-4957886b.cjs} +1 -1
- package/dist/cjs/{index-ba0e03be.cjs → index-66442a21.cjs} +1 -1
- package/dist/cjs/{index-68232859.cjs → index-9fa73ad5.cjs} +1 -1
- package/dist/cjs/index-d400c95d.cjs +1 -0
- package/dist/cjs/{index-b90ee5df.cjs → index-e6510853.cjs} +1 -1
- package/dist/cjs/{index-7e16d704.cjs → index-f1d55466.cjs} +1 -1
- package/dist/cjs/{index-f69eb490.cjs → index-f9b3e693.cjs} +2 -2
- package/dist/cjs/{index-74c47bc0.cjs → index-fece914f.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-60ca9440.cjs → index.es-24601ae9.cjs} +1 -1
- package/dist/cjs/{interface-fa83e59e.cjs → interface-b141cac1.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-f78d70ba.cjs → lib-typedarrays-16b8679e.cjs} +1 -1
- package/dist/cjs/{portis-4fc68ab5.cjs → portis-8a542a71.cjs} +1 -1
- package/dist/cjs/{provider-37674352.cjs → provider-97d6accc.cjs} +1 -1
- package/dist/cjs/providers/wallets/index.d.ts +4 -1
- package/dist/cjs/providers/wallets/types.d.ts +1 -0
- package/dist/cjs/{rainbow-dca04672.cjs → rainbow-e2f8e93b.cjs} +1 -1
- package/dist/cjs/{sha224-6f1b400d.cjs → sha224-677fefaf.cjs} +1 -1
- package/dist/cjs/{sha256-a918267f.cjs → sha256-722ffe23.cjs} +1 -1
- package/dist/cjs/{uAuth-e5eed6df.cjs → uAuth-ad6cc7bb.cjs} +1 -1
- package/dist/cjs/{walletConnect-369e499a.cjs → walletConnect-38298739.cjs} +1 -1
- package/dist/cjs/walletLink-31aaa2a8.cjs +3 -0
- package/dist/{draggabilly-52f8bd25.js → draggabilly-ce8c12b6.js} +1 -1
- package/dist/{ethers-d3ed3af3.js → ethers-7b46939e.js} +1 -1
- package/dist/{id-34d9f7d9.js → id-854c92f2.js} +1 -1
- package/dist/index-0cd3036e.js +9 -0
- package/dist/{index-f7b4e711.js → index-34ca0120.js} +1 -1
- package/dist/{index-60db08ee.js → index-546ca9d4.js} +1 -1
- package/dist/{index-380abc63.js → index-6b1cae41.js} +1 -1
- package/dist/index-75bd164d.js +1 -0
- package/dist/{index-3424258d.js → index-7c400140.js} +2 -2
- package/dist/{index-18d80cac.js → index-c57b0448.js} +1 -1
- package/dist/{index-a2eaf3ac.js → index-cb13f500.js} +1 -1
- package/dist/{index-690ecb4d.js → index-cdfcca5b.js} +1 -1
- package/dist/{index-7ae95cd4.js → index-dd28f95d.js} +1 -1
- package/dist/{index-113d6bf1.js → index-e7c8df7f.js} +1 -1
- package/dist/{index.es-4c530ab1.js → index.es-5adf8ffb.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-bd112069.js → interface-9f8f54a0.js} +1 -1
- package/dist/{lib-typedarrays-961542ca.js → lib-typedarrays-509620fd.js} +1 -1
- package/dist/{portis-bae6f6e3.js → portis-cd3a3d3c.js} +1 -1
- package/dist/{provider-3a201692.js → provider-0d0e4055.js} +1 -1
- package/dist/providers/wallets/index.d.ts +4 -1
- package/dist/providers/wallets/types.d.ts +1 -0
- package/dist/{rainbow-a873462d.js → rainbow-0c05f6fc.js} +1 -1
- package/dist/{sha224-71a151d5.js → sha224-a8f71aae.js} +1 -1
- package/dist/{sha256-bcde7142.js → sha256-46b03365.js} +1 -1
- package/dist/{uAuth-e52b9724.js → uAuth-1a8670b8.js} +1 -1
- package/dist/walletConnect-fa40acff.js +1 -0
- package/dist/walletLink-cb34aa54.js +3 -0
- package/package.json +1 -1
- package/dist/__node-resolve_empty-9a161773.js +0 -1
- package/dist/__tslib-4811cf5d.js +0 -1
- package/dist/cjs/__tslib-47a880f2.cjs +0 -1
- package/dist/cjs/index-2e9cced1.cjs +0 -9
- package/dist/cjs/index-5cbc6300.cjs +0 -1
- package/dist/cjs/walletLink-dc90343c.cjs +0 -3
- package/dist/index-5047cb11.js +0 -9
- package/dist/index-da9b0643.js +0 -1
- package/dist/walletConnect-9e0298cd.js +0 -1
- package/dist/walletLink-6785c342.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=require("./bn-86022586.cjs"),e=require("@ethersproject/bytes"),t=require("./index-2e9cced1.cjs");let o=!1,n=!1;const s={debug:1,default:2,info:2,warning:3,error:4,off:5};let i=s.default,u=null;const a=function(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(t){r.push(e)}})),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}();var E,N;!function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"}(E||(E={})),exports.ErrorCode=void 0,(N=exports.ErrorCode||(exports.ErrorCode={})).UNKNOWN_ERROR="UNKNOWN_ERROR",N.NOT_IMPLEMENTED="NOT_IMPLEMENTED",N.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",N.NETWORK_ERROR="NETWORK_ERROR",N.SERVER_ERROR="SERVER_ERROR",N.TIMEOUT="TIMEOUT",N.BUFFER_OVERRUN="BUFFER_OVERRUN",N.NUMERIC_FAULT="NUMERIC_FAULT",N.MISSING_NEW="MISSING_NEW",N.INVALID_ARGUMENT="INVALID_ARGUMENT",N.MISSING_ARGUMENT="MISSING_ARGUMENT",N.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",N.CALL_EXCEPTION="CALL_EXCEPTION",N.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",N.NONCE_EXPIRED="NONCE_EXPIRED",N.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",N.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",N.TRANSACTION_REPLACED="TRANSACTION_REPLACED",N.ACTION_REJECTED="ACTION_REJECTED";const c="0123456789abcdef";class h{constructor(r){Object.defineProperty(this,"version",{enumerable:!0,value:r,writable:!1})}_log(r,e){const t=r.toLowerCase();null==s[t]&&this.throwArgumentError("invalid log level name","logLevel",r),i>s[t]||console.log.apply(console,e)}debug(...r){this._log(h.levels.DEBUG,r)}info(...r){this._log(h.levels.INFO,r)}warn(...r){this._log(h.levels.WARNING,r)}makeError(r,e,t){if(n)return this.makeError("censored error",e,{});e||(e=h.errors.UNKNOWN_ERROR),t||(t={});const o=[];Object.keys(t).forEach((r=>{const e=t[r];try{if(e instanceof Uint8Array){let t="";for(let r=0;r<e.length;r++)t+=c[e[r]>>4],t+=c[15&e[r]];o.push(r+"=Uint8Array(0x"+t+")")}else o.push(r+"="+JSON.stringify(e))}catch(e){o.push(r+"="+JSON.stringify(t[r].toString()))}})),o.push(`code=${e}`),o.push(`version=${this.version}`);const s=r;let i="";switch(e){case exports.ErrorCode.NUMERIC_FAULT:{i="NUMERIC_FAULT";const e=r;switch(e){case"overflow":case"underflow":case"division-by-zero":i+="-"+e;break;case"negative-power":case"negative-width":i+="-unsupported";break;case"unbound-bitwise-result":i+="-unbound-result"}break}case exports.ErrorCode.CALL_EXCEPTION:case exports.ErrorCode.INSUFFICIENT_FUNDS:case exports.ErrorCode.MISSING_NEW:case exports.ErrorCode.NONCE_EXPIRED:case exports.ErrorCode.REPLACEMENT_UNDERPRICED:case exports.ErrorCode.TRANSACTION_REPLACED:case exports.ErrorCode.UNPREDICTABLE_GAS_LIMIT:i=e}i&&(r+=" [ See: https://links.ethers.org/v5-errors-"+i+" ]"),o.length&&(r+=" ("+o.join(", ")+")");const u=new Error(r);return u.reason=s,u.code=e,Object.keys(t).forEach((function(r){u[r]=t[r]})),u}throwError(r,e,t){throw this.makeError(r,e,t)}throwArgumentError(r,e,t){return this.throwError(r,h.errors.INVALID_ARGUMENT,{argument:e,value:t})}assert(r,e,t,o){r||this.throwError(e,t,o)}assertArgument(r,e,t,o){r||this.throwArgumentError(e,t,o)}checkNormalize(r){a&&this.throwError("platform missing String.prototype.normalize",h.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:a})}checkSafeUint53(r,e){"number"==typeof r&&(null==e&&(e="value not safe"),(r<0||r>=9007199254740991)&&this.throwError(e,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:r}),r%1&&this.throwError(e,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:r}))}checkArgumentCount(r,e,t){t=t?": "+t:"",r<e&&this.throwError("missing argument"+t,h.errors.MISSING_ARGUMENT,{count:r,expectedCount:e}),r>e&&this.throwError("too many arguments"+t,h.errors.UNEXPECTED_ARGUMENT,{count:r,expectedCount:e})}checkNew(r,e){r!==Object&&null!=r||this.throwError("missing new",h.errors.MISSING_NEW,{name:e.name})}checkAbstract(r,e){r===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",h.errors.UNSUPPORTED_OPERATION,{name:r.name,operation:"new"}):r!==Object&&null!=r||this.throwError("missing new",h.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return u||(u=new h("logger/5.7.0")),u}static setCensorship(r,e){if(!r&&e&&this.globalLogger().throwError("cannot permanently disable censorship",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o){if(!r)return;this.globalLogger().throwError("error censorship permanent",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}n=!!r,o=!!e}static setLogLevel(r){const e=s[r.toLowerCase()];null!=e?i=e:h.globalLogger().warn("invalid log level - "+r)}static from(r){return new h(r)}}h.errors=exports.ErrorCode,h.levels=E;var l=Object.freeze({__proto__:null,get LogLevel(){return E},get ErrorCode(){return exports.ErrorCode},Logger:h});const g="bignumber/5.7.0";var f=r.BN.BN;const p=new h(g),R={},m=9007199254740991;let U=!1;class _{constructor(r,e){r!==R&&p.throwError("cannot call constructor directly; use BigNumber.from",h.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(r){return d(T(this).fromTwos(r))}toTwos(r){return d(T(this).toTwos(r))}abs(){return"-"===this._hex[0]?_.from(this._hex.substring(1)):this}add(r){return d(T(this).add(T(r)))}sub(r){return d(T(this).sub(T(r)))}div(r){return _.from(r).isZero()&&C("division-by-zero","div"),d(T(this).div(T(r)))}mul(r){return d(T(this).mul(T(r)))}mod(r){const e=T(r);return e.isNeg()&&C("division-by-zero","mod"),d(T(this).umod(e))}pow(r){const e=T(r);return e.isNeg()&&C("negative-power","pow"),d(T(this).pow(e))}and(r){const e=T(r);return(this.isNegative()||e.isNeg())&&C("unbound-bitwise-result","and"),d(T(this).and(e))}or(r){const e=T(r);return(this.isNegative()||e.isNeg())&&C("unbound-bitwise-result","or"),d(T(this).or(e))}xor(r){const e=T(r);return(this.isNegative()||e.isNeg())&&C("unbound-bitwise-result","xor"),d(T(this).xor(e))}mask(r){return(this.isNegative()||r<0)&&C("negative-width","mask"),d(T(this).maskn(r))}shl(r){return(this.isNegative()||r<0)&&C("negative-width","shl"),d(T(this).shln(r))}shr(r){return(this.isNegative()||r<0)&&C("negative-width","shr"),d(T(this).shrn(r))}eq(r){return T(this).eq(T(r))}lt(r){return T(this).lt(T(r))}lte(r){return T(this).lte(T(r))}gt(r){return T(this).gt(T(r))}gte(r){return T(this).gte(T(r))}isNegative(){return"-"===this._hex[0]}isZero(){return T(this).isZero()}toNumber(){try{return T(this).toNumber()}catch(r){C("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(r){}return p.throwError("this platform does not support BigInt",h.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?U||(U=!0,p.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?p.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",h.errors.UNEXPECTED_ARGUMENT,{}):p.throwError("BigNumber.toString does not accept parameters",h.errors.UNEXPECTED_ARGUMENT,{})),T(this).toString(10)}toHexString(){return this._hex}toJSON(r){return{type:"BigNumber",hex:this.toHexString()}}static from(r){if(r instanceof _)return r;if("string"==typeof r)return r.match(/^-?0x[0-9a-f]+$/i)?new _(R,I(r)):r.match(/^-?[0-9]+$/)?new _(R,I(new f(r))):p.throwArgumentError("invalid BigNumber string","value",r);if("number"==typeof r)return r%1&&C("underflow","BigNumber.from",r),(r>=m||r<=-m)&&C("overflow","BigNumber.from",r),_.from(String(r));const t=r;if("bigint"==typeof t)return _.from(t.toString());if(e.isBytes(t))return _.from(e.hexlify(t));if(t)if(t.toHexString){const r=t.toHexString();if("string"==typeof r)return _.from(r)}else{let r=t._hex;if(null==r&&"BigNumber"===t.type&&(r=t.hex),"string"==typeof r&&(e.isHexString(r)||"-"===r[0]&&e.isHexString(r.substring(1))))return _.from(r)}return p.throwArgumentError("invalid BigNumber value","value",r)}static isBigNumber(r){return!(!r||!r._isBigNumber)}}function I(r){if("string"!=typeof r)return I(r.toString(16));if("-"===r[0])return"-"===(r=r.substring(1))[0]&&p.throwArgumentError("invalid hex","value",r),"0x00"===(r=I(r))?r:"-"+r;if("0x"!==r.substring(0,2)&&(r="0x"+r),"0x"===r)return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&"0x00"===r.substring(0,4);)r="0x"+r.substring(4);return r}function d(r){return _.from(I(r))}function T(r){const e=_.from(r).toHexString();return"-"===e[0]?new f("-"+e.substring(3),16):new f(e.substring(2),16)}function C(r,e,t){const o={fault:r,operation:e};return null!=t&&(o.value=t),p.throwError(r,h.errors.NUMERIC_FAULT,o)}const O=new h("strings/5.7.0");var b,S;function x(r,e,t,o,n){if(r===exports.Utf8ErrorReason.BAD_PREFIX||r===exports.Utf8ErrorReason.UNEXPECTED_CONTINUE){let r=0;for(let o=e+1;o<t.length&&t[o]>>6==2;o++)r++;return r}return r===exports.Utf8ErrorReason.OVERRUN?t.length-e-1:0}exports.UnicodeNormalizationForm=void 0,(b=exports.UnicodeNormalizationForm||(exports.UnicodeNormalizationForm={})).current="",b.NFC="NFC",b.NFD="NFD",b.NFKC="NFKC",b.NFKD="NFKD",exports.Utf8ErrorReason=void 0,(S=exports.Utf8ErrorReason||(exports.Utf8ErrorReason={})).UNEXPECTED_CONTINUE="unexpected continuation byte",S.BAD_PREFIX="bad codepoint prefix",S.OVERRUN="string overrun",S.MISSING_CONTINUE="missing continuation byte",S.OUT_OF_RANGE="out of UTF-8 range",S.UTF16_SURROGATE="UTF-16 surrogate",S.OVERLONG="overlong representation";const w=Object.freeze({error:function(r,e,t,o,n){return O.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)},ignore:x,replace:function(r,e,t,o,n){return r===exports.Utf8ErrorReason.OVERLONG?(o.push(n),0):(o.push(65533),x(r,e,t))}});function A(r,t){null==t&&(t=w.error),r=e.arrayify(r);const o=[];let n=0;for(;n<r.length;){const e=r[n++];if(e>>7==0){o.push(e);continue}let s=null,i=null;if(192==(224&e))s=1,i=127;else if(224==(240&e))s=2,i=2047;else{if(240!=(248&e)){n+=t(128==(192&e)?exports.Utf8ErrorReason.UNEXPECTED_CONTINUE:exports.Utf8ErrorReason.BAD_PREFIX,n-1,r,o);continue}s=3,i=65535}if(n-1+s>=r.length){n+=t(exports.Utf8ErrorReason.OVERRUN,n-1,r,o);continue}let u=e&(1<<8-s-1)-1;for(let e=0;e<s;e++){let e=r[n];if(128!=(192&e)){n+=t(exports.Utf8ErrorReason.MISSING_CONTINUE,n,r,o),u=null;break}u=u<<6|63&e,n++}null!==u&&(u>1114111?n+=t(exports.Utf8ErrorReason.OUT_OF_RANGE,n-1-s,r,o,u):u>=55296&&u<=57343?n+=t(exports.Utf8ErrorReason.UTF16_SURROGATE,n-1-s,r,o,u):u<=i?n+=t(exports.Utf8ErrorReason.OVERLONG,n-1-s,r,o,u):o.push(u))}return o}function v(r,t=exports.UnicodeNormalizationForm.current){t!=exports.UnicodeNormalizationForm.current&&(O.checkNormalize(),r=r.normalize(t));let o=[];for(let e=0;e<r.length;e++){const t=r.charCodeAt(e);if(t<128)o.push(t);else if(t<2048)o.push(t>>6|192),o.push(63&t|128);else if(55296==(64512&t)){e++;const n=r.charCodeAt(e);if(e>=r.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const s=65536+((1023&t)<<10)+(1023&n);o.push(s>>18|240),o.push(s>>12&63|128),o.push(s>>6&63|128),o.push(63&s|128)}else o.push(t>>12|224),o.push(t>>6&63|128),o.push(63&t|128)}return e.arrayify(o)}function P(r){const e="0000"+r.toString(16);return"\\u"+e.substring(e.length-4)}function F(r){return r.map((r=>r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode(55296+(r>>10&1023),56320+(1023&r))))).join("")}exports.BigNumber=_,exports.Logger=h,exports.Utf8ErrorFuncs=w,exports._toEscapedUtf8String=function(r,e){return'"'+A(r,e).map((r=>{if(r<256){switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(r>=32&&r<127)return String.fromCharCode(r)}return r<=65535?P(r):P(55296+((r-=65536)>>10&1023))+P(56320+(1023&r))})).join("")+'"'},exports._toUtf8String=F,exports.id=function(r){return t.keccak256(v(r))},exports.isBigNumberish=function(r){return null!=r&&(_.isBigNumber(r)||"number"==typeof r&&r%1==0||"string"==typeof r&&!!r.match(/^-?[0-9]+$/)||e.isHexString(r)||"bigint"==typeof r||e.isBytes(r))},exports.lib_esm=l,exports.toUtf8Bytes=v,exports.toUtf8CodePoints=function(r,e=exports.UnicodeNormalizationForm.current){return A(v(r,e))},exports.toUtf8String=function(r,e){return F(A(r,e))},exports.version=g;
|
|
1
|
+
"use strict";var r=require("./bn-f94d2173.cjs"),e=require("@ethersproject/bytes"),t=require("./index-3b9b0297.cjs");let o=!1,n=!1;const s={debug:1,default:2,info:2,warning:3,error:4,off:5};let i=s.default,u=null;const a=function(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(t){r.push(e)}})),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}();var E,N;!function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"}(E||(E={})),exports.ErrorCode=void 0,(N=exports.ErrorCode||(exports.ErrorCode={})).UNKNOWN_ERROR="UNKNOWN_ERROR",N.NOT_IMPLEMENTED="NOT_IMPLEMENTED",N.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",N.NETWORK_ERROR="NETWORK_ERROR",N.SERVER_ERROR="SERVER_ERROR",N.TIMEOUT="TIMEOUT",N.BUFFER_OVERRUN="BUFFER_OVERRUN",N.NUMERIC_FAULT="NUMERIC_FAULT",N.MISSING_NEW="MISSING_NEW",N.INVALID_ARGUMENT="INVALID_ARGUMENT",N.MISSING_ARGUMENT="MISSING_ARGUMENT",N.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",N.CALL_EXCEPTION="CALL_EXCEPTION",N.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",N.NONCE_EXPIRED="NONCE_EXPIRED",N.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",N.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",N.TRANSACTION_REPLACED="TRANSACTION_REPLACED",N.ACTION_REJECTED="ACTION_REJECTED";const c="0123456789abcdef";class h{constructor(r){Object.defineProperty(this,"version",{enumerable:!0,value:r,writable:!1})}_log(r,e){const t=r.toLowerCase();null==s[t]&&this.throwArgumentError("invalid log level name","logLevel",r),i>s[t]||console.log.apply(console,e)}debug(...r){this._log(h.levels.DEBUG,r)}info(...r){this._log(h.levels.INFO,r)}warn(...r){this._log(h.levels.WARNING,r)}makeError(r,e,t){if(n)return this.makeError("censored error",e,{});e||(e=h.errors.UNKNOWN_ERROR),t||(t={});const o=[];Object.keys(t).forEach((r=>{const e=t[r];try{if(e instanceof Uint8Array){let t="";for(let r=0;r<e.length;r++)t+=c[e[r]>>4],t+=c[15&e[r]];o.push(r+"=Uint8Array(0x"+t+")")}else o.push(r+"="+JSON.stringify(e))}catch(e){o.push(r+"="+JSON.stringify(t[r].toString()))}})),o.push(`code=${e}`),o.push(`version=${this.version}`);const s=r;let i="";switch(e){case exports.ErrorCode.NUMERIC_FAULT:{i="NUMERIC_FAULT";const e=r;switch(e){case"overflow":case"underflow":case"division-by-zero":i+="-"+e;break;case"negative-power":case"negative-width":i+="-unsupported";break;case"unbound-bitwise-result":i+="-unbound-result"}break}case exports.ErrorCode.CALL_EXCEPTION:case exports.ErrorCode.INSUFFICIENT_FUNDS:case exports.ErrorCode.MISSING_NEW:case exports.ErrorCode.NONCE_EXPIRED:case exports.ErrorCode.REPLACEMENT_UNDERPRICED:case exports.ErrorCode.TRANSACTION_REPLACED:case exports.ErrorCode.UNPREDICTABLE_GAS_LIMIT:i=e}i&&(r+=" [ See: https://links.ethers.org/v5-errors-"+i+" ]"),o.length&&(r+=" ("+o.join(", ")+")");const u=new Error(r);return u.reason=s,u.code=e,Object.keys(t).forEach((function(r){u[r]=t[r]})),u}throwError(r,e,t){throw this.makeError(r,e,t)}throwArgumentError(r,e,t){return this.throwError(r,h.errors.INVALID_ARGUMENT,{argument:e,value:t})}assert(r,e,t,o){r||this.throwError(e,t,o)}assertArgument(r,e,t,o){r||this.throwArgumentError(e,t,o)}checkNormalize(r){a&&this.throwError("platform missing String.prototype.normalize",h.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:a})}checkSafeUint53(r,e){"number"==typeof r&&(null==e&&(e="value not safe"),(r<0||r>=9007199254740991)&&this.throwError(e,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:r}),r%1&&this.throwError(e,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:r}))}checkArgumentCount(r,e,t){t=t?": "+t:"",r<e&&this.throwError("missing argument"+t,h.errors.MISSING_ARGUMENT,{count:r,expectedCount:e}),r>e&&this.throwError("too many arguments"+t,h.errors.UNEXPECTED_ARGUMENT,{count:r,expectedCount:e})}checkNew(r,e){r!==Object&&null!=r||this.throwError("missing new",h.errors.MISSING_NEW,{name:e.name})}checkAbstract(r,e){r===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",h.errors.UNSUPPORTED_OPERATION,{name:r.name,operation:"new"}):r!==Object&&null!=r||this.throwError("missing new",h.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return u||(u=new h("logger/5.7.0")),u}static setCensorship(r,e){if(!r&&e&&this.globalLogger().throwError("cannot permanently disable censorship",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o){if(!r)return;this.globalLogger().throwError("error censorship permanent",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}n=!!r,o=!!e}static setLogLevel(r){const e=s[r.toLowerCase()];null!=e?i=e:h.globalLogger().warn("invalid log level - "+r)}static from(r){return new h(r)}}h.errors=exports.ErrorCode,h.levels=E;var l=Object.freeze({__proto__:null,get LogLevel(){return E},get ErrorCode(){return exports.ErrorCode},Logger:h});const g="bignumber/5.7.0";var f=r.BN.BN;const p=new h(g),R={},m=9007199254740991;let U=!1;class _{constructor(r,e){r!==R&&p.throwError("cannot call constructor directly; use BigNumber.from",h.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(r){return d(T(this).fromTwos(r))}toTwos(r){return d(T(this).toTwos(r))}abs(){return"-"===this._hex[0]?_.from(this._hex.substring(1)):this}add(r){return d(T(this).add(T(r)))}sub(r){return d(T(this).sub(T(r)))}div(r){return _.from(r).isZero()&&b("division-by-zero","div"),d(T(this).div(T(r)))}mul(r){return d(T(this).mul(T(r)))}mod(r){const e=T(r);return e.isNeg()&&b("division-by-zero","mod"),d(T(this).umod(e))}pow(r){const e=T(r);return e.isNeg()&&b("negative-power","pow"),d(T(this).pow(e))}and(r){const e=T(r);return(this.isNegative()||e.isNeg())&&b("unbound-bitwise-result","and"),d(T(this).and(e))}or(r){const e=T(r);return(this.isNegative()||e.isNeg())&&b("unbound-bitwise-result","or"),d(T(this).or(e))}xor(r){const e=T(r);return(this.isNegative()||e.isNeg())&&b("unbound-bitwise-result","xor"),d(T(this).xor(e))}mask(r){return(this.isNegative()||r<0)&&b("negative-width","mask"),d(T(this).maskn(r))}shl(r){return(this.isNegative()||r<0)&&b("negative-width","shl"),d(T(this).shln(r))}shr(r){return(this.isNegative()||r<0)&&b("negative-width","shr"),d(T(this).shrn(r))}eq(r){return T(this).eq(T(r))}lt(r){return T(this).lt(T(r))}lte(r){return T(this).lte(T(r))}gt(r){return T(this).gt(T(r))}gte(r){return T(this).gte(T(r))}isNegative(){return"-"===this._hex[0]}isZero(){return T(this).isZero()}toNumber(){try{return T(this).toNumber()}catch(r){b("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(r){}return p.throwError("this platform does not support BigInt",h.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?U||(U=!0,p.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?p.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",h.errors.UNEXPECTED_ARGUMENT,{}):p.throwError("BigNumber.toString does not accept parameters",h.errors.UNEXPECTED_ARGUMENT,{})),T(this).toString(10)}toHexString(){return this._hex}toJSON(r){return{type:"BigNumber",hex:this.toHexString()}}static from(r){if(r instanceof _)return r;if("string"==typeof r)return r.match(/^-?0x[0-9a-f]+$/i)?new _(R,I(r)):r.match(/^-?[0-9]+$/)?new _(R,I(new f(r))):p.throwArgumentError("invalid BigNumber string","value",r);if("number"==typeof r)return r%1&&b("underflow","BigNumber.from",r),(r>=m||r<=-m)&&b("overflow","BigNumber.from",r),_.from(String(r));const t=r;if("bigint"==typeof t)return _.from(t.toString());if(e.isBytes(t))return _.from(e.hexlify(t));if(t)if(t.toHexString){const r=t.toHexString();if("string"==typeof r)return _.from(r)}else{let r=t._hex;if(null==r&&"BigNumber"===t.type&&(r=t.hex),"string"==typeof r&&(e.isHexString(r)||"-"===r[0]&&e.isHexString(r.substring(1))))return _.from(r)}return p.throwArgumentError("invalid BigNumber value","value",r)}static isBigNumber(r){return!(!r||!r._isBigNumber)}}function I(r){if("string"!=typeof r)return I(r.toString(16));if("-"===r[0])return"-"===(r=r.substring(1))[0]&&p.throwArgumentError("invalid hex","value",r),"0x00"===(r=I(r))?r:"-"+r;if("0x"!==r.substring(0,2)&&(r="0x"+r),"0x"===r)return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&"0x00"===r.substring(0,4);)r="0x"+r.substring(4);return r}function d(r){return _.from(I(r))}function T(r){const e=_.from(r).toHexString();return"-"===e[0]?new f("-"+e.substring(3),16):new f(e.substring(2),16)}function b(r,e,t){const o={fault:r,operation:e};return null!=t&&(o.value=t),p.throwError(r,h.errors.NUMERIC_FAULT,o)}const C=new h("strings/5.7.0");var O,S;function x(r,e,t,o,n){if(r===exports.Utf8ErrorReason.BAD_PREFIX||r===exports.Utf8ErrorReason.UNEXPECTED_CONTINUE){let r=0;for(let o=e+1;o<t.length&&t[o]>>6==2;o++)r++;return r}return r===exports.Utf8ErrorReason.OVERRUN?t.length-e-1:0}exports.UnicodeNormalizationForm=void 0,(O=exports.UnicodeNormalizationForm||(exports.UnicodeNormalizationForm={})).current="",O.NFC="NFC",O.NFD="NFD",O.NFKC="NFKC",O.NFKD="NFKD",exports.Utf8ErrorReason=void 0,(S=exports.Utf8ErrorReason||(exports.Utf8ErrorReason={})).UNEXPECTED_CONTINUE="unexpected continuation byte",S.BAD_PREFIX="bad codepoint prefix",S.OVERRUN="string overrun",S.MISSING_CONTINUE="missing continuation byte",S.OUT_OF_RANGE="out of UTF-8 range",S.UTF16_SURROGATE="UTF-16 surrogate",S.OVERLONG="overlong representation";const w=Object.freeze({error:function(r,e,t,o,n){return C.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)},ignore:x,replace:function(r,e,t,o,n){return r===exports.Utf8ErrorReason.OVERLONG?(o.push(n),0):(o.push(65533),x(r,e,t))}});function A(r,t){null==t&&(t=w.error),r=e.arrayify(r);const o=[];let n=0;for(;n<r.length;){const e=r[n++];if(e>>7==0){o.push(e);continue}let s=null,i=null;if(192==(224&e))s=1,i=127;else if(224==(240&e))s=2,i=2047;else{if(240!=(248&e)){n+=t(128==(192&e)?exports.Utf8ErrorReason.UNEXPECTED_CONTINUE:exports.Utf8ErrorReason.BAD_PREFIX,n-1,r,o);continue}s=3,i=65535}if(n-1+s>=r.length){n+=t(exports.Utf8ErrorReason.OVERRUN,n-1,r,o);continue}let u=e&(1<<8-s-1)-1;for(let e=0;e<s;e++){let e=r[n];if(128!=(192&e)){n+=t(exports.Utf8ErrorReason.MISSING_CONTINUE,n,r,o),u=null;break}u=u<<6|63&e,n++}null!==u&&(u>1114111?n+=t(exports.Utf8ErrorReason.OUT_OF_RANGE,n-1-s,r,o,u):u>=55296&&u<=57343?n+=t(exports.Utf8ErrorReason.UTF16_SURROGATE,n-1-s,r,o,u):u<=i?n+=t(exports.Utf8ErrorReason.OVERLONG,n-1-s,r,o,u):o.push(u))}return o}function v(r,t=exports.UnicodeNormalizationForm.current){t!=exports.UnicodeNormalizationForm.current&&(C.checkNormalize(),r=r.normalize(t));let o=[];for(let e=0;e<r.length;e++){const t=r.charCodeAt(e);if(t<128)o.push(t);else if(t<2048)o.push(t>>6|192),o.push(63&t|128);else if(55296==(64512&t)){e++;const n=r.charCodeAt(e);if(e>=r.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const s=65536+((1023&t)<<10)+(1023&n);o.push(s>>18|240),o.push(s>>12&63|128),o.push(s>>6&63|128),o.push(63&s|128)}else o.push(t>>12|224),o.push(t>>6&63|128),o.push(63&t|128)}return e.arrayify(o)}function P(r){const e="0000"+r.toString(16);return"\\u"+e.substring(e.length-4)}function F(r){return r.map((r=>r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode(55296+(r>>10&1023),56320+(1023&r))))).join("")}exports.BigNumber=_,exports.Logger=h,exports.Utf8ErrorFuncs=w,exports._toEscapedUtf8String=function(r,e){return'"'+A(r,e).map((r=>{if(r<256){switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(r>=32&&r<127)return String.fromCharCode(r)}return r<=65535?P(r):P(55296+((r-=65536)>>10&1023))+P(56320+(1023&r))})).join("")+'"'},exports._toUtf8String=F,exports.id=function(r){return t.keccak256(v(r))},exports.isBigNumberish=function(r){return null!=r&&(_.isBigNumber(r)||"number"==typeof r&&r%1==0||"string"==typeof r&&!!r.match(/^-?[0-9]+$/)||e.isHexString(r)||"bigint"==typeof r||e.isBytes(r))},exports.lib_esm=l,exports.toUtf8Bytes=v,exports.toUtf8CodePoints=function(r,e=exports.UnicodeNormalizationForm.current){return A(v(r,e))},exports.toUtf8String=function(r,e){return F(A(r,e))},exports.version=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./index-2e9cced1.cjs"),t=require("./browser-ponyfill-20abb3e4.cjs"),s=require("./ethers-aab53906.cjs"),a=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),n=require("@ethersproject/contracts"),o=require("./id-934e92eb.cjs"),i=require("@ethersproject/constants"),c=require("events");function d(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("./index-ba0e03be.cjs"),require("./bn-86022586.cjs"),require("./__node-resolve_empty-36be5361.cjs"),require("./hash-7ce6fed5.cjs"),require("./inherits_browser-50deae74.cjs"),require("@ethersproject/json-wallets"),require("./interface-fa83e59e.cjs"),require("./index-5cbc6300.cjs");var u=l(r),f=l(i),h=d(c),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"}},T=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 y=T(v);E.getSDKVersion=()=>y.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{c(a.next(e))}catch(e){n(e)}}function i(e){try{c(a.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,i)}c((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,c,d,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",(c=e.TransactionListItemType||(e.TransactionListItemType={})).TRANSACTION="TRANSACTION",c.LABEL="LABEL",c.CONFLICT_HEADER="CONFLICT_HEADER",c.DATE_LABEL="DATE_LABEL",(d=e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",d.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 ce=oe;ie.MAGIC_VALUE="0x1626ba7e";ie.MAGIC_VALUE_BYTES="0x20c13b0b";const de=new ce.ethers.utils.Interface(["function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view"]);ie.EIP_1271_INTERFACE=de;const le=new ce.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 Te=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},ye=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=ye(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}}Te([(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),c=await r.signMessage(i),d={safe:e?(await Ze(this,Je,"f").getEip3770Address(e)).address:null,delegate:n,delegator:o,label:a,signature:c};return(0,tt.sendRequest)({url:`${Ze(this,Ye,"f")}/v1/delegates/`,method:tt.HttpMethod.Post,body:d})}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 c=(null===(a=null==t?void 0:t.queued)||void 0===a?void 0:a.toString())||"true";o.searchParams.set("queued",c);const d=(null===(r=null==t?void 0:t.executed)||void 0===r?void 0:r.toString())||"false";return o.searchParams.set("executed",d),(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-3b9b0297.cjs"),t=require("./browser-ponyfill-e352d0ba.cjs"),s=require("./ethers-3b1d7d09.cjs"),a=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),n=require("@ethersproject/contracts"),o=require("./id-d2547ab8.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("./index-66442a21.cjs"),require("./bn-f94d2173.cjs"),require("./__node-resolve_empty-8f743760.cjs"),require("./hash-7ce6fed5.cjs"),require("./inherits_browser-50deae74.cjs"),require("@ethersproject/json-wallets"),require("./interface-b141cac1.cjs"),require("./index-d400c95d.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"}},T=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 y=T(v);E.getSDKVersion=()=>y.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 Te=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},ye=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=ye(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}}Te([(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";var e=require("./index-2e9cced1.cjs"),t=require("@ethersproject/address"),n=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),o=require("@ethersproject/bytes"),i=require("./index-ba0e03be.cjs"),a=require("./index-74c47bc0.cjs"),s=require("./ethers-aab53906.cjs"),u=require("./id-934e92eb.cjs"),c=require("@ethersproject/json-wallets"),p=require("@ethersproject/properties"),l=require("./index-5cbc6300.cjs"),d=require("@ethersproject/transactions"),f=require("@ethersproject/contracts"),h=require("./DefaultJsonRpcProvider-24942da1.cjs");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("zustand"),require("events"),require("@ethersproject/constants"),require("./interface-fa83e59e.cjs"),require("@ethersproject/abstract-provider"),require("./bn-86022586.cjs"),require("./__node-resolve_empty-36be5361.cjs"),require("./hash-7ce6fed5.cjs"),require("./inherits_browser-50deae74.cjs");var m,y=g(t),b=g(o),v=g(c),w=g(p),P=g(d),x=Object.freeze({__proto__:null,_toEscapedUtf8String:u._toEscapedUtf8String,toUtf8Bytes:u.toUtf8Bytes,toUtf8CodePoints:u.toUtf8CodePoints,toUtf8String:u.toUtf8String,Utf8ErrorFuncs:u.Utf8ErrorFuncs,get Utf8ErrorReason(){return u.Utf8ErrorReason},get UnicodeNormalizationForm(){return u.UnicodeNormalizationForm},formatBytes32String:s.formatBytes32String,parseBytes32String:s.parseBytes32String,nameprep:s.nameprep}),_=Object.freeze({__proto__:null,id:u.id,dnsEncode:s.dnsEncode,namehash:s.namehash,isValidName:s.isValidName,ensNormalize:s.ensNormalize,messagePrefix:s.messagePrefix,hashMessage:s.hashMessage,_TypedDataEncoder:i.TypedDataEncoder}),O=Object.freeze({__proto__:null,computeHmac:s.computeHmac,ripemd160:s.ripemd160,sha256:s.sha256,sha512:s.sha512,get SupportedAlgorithm(){return s.SupportedAlgorithm}}),j=Object.freeze({__proto__:null,randomBytes:s.randomBytes,shuffled:s.shuffled});class S extends n.Signer{constructor(e,t,n,r){super(),this._address=n,this._index=null!=r?r:0,this.provider=e,this.upWallet=t}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e.__awaiter(this,void 0,void 0,(function*(){return Promise.resolve(t.getAddress(this._address))}))}signMessage(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t}'`);return yield this.upWallet.signMessage(t,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(t,n,r){return e.__awaiter(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data})}))}sendTransaction(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return{hash:yield this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data}),from:t.from}}))}connect(e){return new S(null!=e?e:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new S(this.provider,this.upWallet,this._address,this._index)}}!function(e){e.REGISTER="register"}(m||(m={}));var E,k=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},T=function(e,t){this.type=e,this.data=t},A=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},U.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(E||(E={}));var C=function(e){return o.arrayify(function(e){var t=U({},e.types);return delete t.EIP712Domain,i.TypedDataEncoder.hash(e.domain,t,e.message)}(e))},L={},N=e.getAugmentedNamespace(s.lib_esm),I=e.getAugmentedNamespace(s.lib_esm$1),D=e.getAugmentedNamespace(_),R=e.getAugmentedNamespace(s.lib_esm$2),M=e.getAugmentedNamespace(e.lib_esm),B=e.getAugmentedNamespace(u.lib_esm),F=e.getAugmentedNamespace(O),z=e.getAugmentedNamespace(s.lib_esm$3),W=e.getAugmentedNamespace(j),q=e.getAugmentedNamespace(l.lib_esm),G=e.getAugmentedNamespace(s.lib_esm$4),J=e.getAugmentedNamespace(x),V=e.getAugmentedNamespace(s.lib_esm$5),H=e.getAugmentedNamespace(s.lib_esm$6),$=e.getAugmentedNamespace(i.lib_esm);function K(){K=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),s=new j(o||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function f(){}function h(){}var g={};u(g,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(S([])));y&&y!==t&&n.call(y,i)&&(g=y);var b=h.prototype=d.prototype=Object.create(g);function v(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,s){var u=p(e[r],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return o("throw",e,a,s)}))}s(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function P(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return E()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=x(a,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,l;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=h,r(b,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:f,configurable:!0}),f.displayName=u(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},v(w.prototype),u(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new w(c(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(b),u(b,s,"Generator"),u(b,i,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=S,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}function Z(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Z(i,r,o,a,s,"next",e)}function s(e){Z(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Q(){return Q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Q.apply(this,arguments)}!function(t){var n=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=e.commonjsGlobal&&e.commonjsGlobal.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e.commonjsGlobal&&e.commonjsGlobal.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.formatBytes32String=t.Utf8ErrorFuncs=t.toUtf8String=t.toUtf8CodePoints=t.toUtf8Bytes=t._toEscapedUtf8String=t.nameprep=t.hexDataSlice=t.hexDataLength=t.hexZeroPad=t.hexValue=t.hexStripZeros=t.hexConcat=t.isHexString=t.hexlify=t.base64=t.base58=t.TransactionDescription=t.LogDescription=t.Interface=t.SigningKey=t.HDNode=t.defaultPath=t.isBytesLike=t.isBytes=t.zeroPad=t.stripZeros=t.concat=t.arrayify=t.shallowCopy=t.resolveProperties=t.getStatic=t.defineReadOnly=t.deepCopy=t.checkProperties=t.poll=t.fetchJson=t._fetchData=t.RLP=t.Logger=t.checkResultErrors=t.FormatTypes=t.ParamType=t.FunctionFragment=t.EventFragment=t.ErrorFragment=t.ConstructorFragment=t.Fragment=t.defaultAbiCoder=t.AbiCoder=void 0,t.Indexed=t.Utf8ErrorReason=t.UnicodeNormalizationForm=t.SupportedAlgorithm=t.mnemonicToSeed=t.isValidMnemonic=t.entropyToMnemonic=t.mnemonicToEntropy=t.getAccountPath=t.verifyTypedData=t.verifyMessage=t.recoverPublicKey=t.computePublicKey=t.recoverAddress=t.computeAddress=t.getJsonWalletAddress=t.TransactionTypes=t.serializeTransaction=t.parseTransaction=t.accessListify=t.joinSignature=t.splitSignature=t.soliditySha256=t.solidityKeccak256=t.solidityPack=t.shuffled=t.randomBytes=t.sha512=t.sha256=t.ripemd160=t.keccak256=t.computeHmac=t.commify=t.parseUnits=t.formatUnits=t.parseEther=t.formatEther=t.isAddress=t.getCreate2Address=t.getContractAddress=t.getIcapAddress=t.getAddress=t._TypedDataEncoder=t.id=t.isValidName=t.namehash=t.hashMessage=t.dnsEncode=t.parseBytes32String=void 0;var i=a.require$$0;Object.defineProperty(t,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(t,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(t,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(t,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(t,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(t,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(t,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(t,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(t,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(t,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(t,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(t,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(t,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var s=y.default;Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return s.getAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return s.getCreate2Address}}),Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return s.getContractAddress}}),Object.defineProperty(t,"getIcapAddress",{enumerable:!0,get:function(){return s.getIcapAddress}}),Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return s.isAddress}});var u=o(N);t.base64=u;var c=I;Object.defineProperty(t,"base58",{enumerable:!0,get:function(){return c.Base58}});var p=b.default;Object.defineProperty(t,"arrayify",{enumerable:!0,get:function(){return p.arrayify}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return p.concat}}),Object.defineProperty(t,"hexConcat",{enumerable:!0,get:function(){return p.hexConcat}}),Object.defineProperty(t,"hexDataSlice",{enumerable:!0,get:function(){return p.hexDataSlice}}),Object.defineProperty(t,"hexDataLength",{enumerable:!0,get:function(){return p.hexDataLength}}),Object.defineProperty(t,"hexlify",{enumerable:!0,get:function(){return p.hexlify}}),Object.defineProperty(t,"hexStripZeros",{enumerable:!0,get:function(){return p.hexStripZeros}}),Object.defineProperty(t,"hexValue",{enumerable:!0,get:function(){return p.hexValue}}),Object.defineProperty(t,"hexZeroPad",{enumerable:!0,get:function(){return p.hexZeroPad}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return p.isBytes}}),Object.defineProperty(t,"isBytesLike",{enumerable:!0,get:function(){return p.isBytesLike}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return p.isHexString}}),Object.defineProperty(t,"joinSignature",{enumerable:!0,get:function(){return p.joinSignature}}),Object.defineProperty(t,"zeroPad",{enumerable:!0,get:function(){return p.zeroPad}}),Object.defineProperty(t,"splitSignature",{enumerable:!0,get:function(){return p.splitSignature}}),Object.defineProperty(t,"stripZeros",{enumerable:!0,get:function(){return p.stripZeros}});var l=D;Object.defineProperty(t,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(t,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(t,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return l.namehash}});var d=R;Object.defineProperty(t,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(t,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(t,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(t,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(t,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(t,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(t,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var f=v.default;Object.defineProperty(t,"getJsonWalletAddress",{enumerable:!0,get:function(){return f.getJsonWalletAddress}});var h=M;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return h.keccak256}});var g=B;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return g.Logger}});var m=F;Object.defineProperty(t,"computeHmac",{enumerable:!0,get:function(){return m.computeHmac}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return m.ripemd160}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return m.sha256}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return m.sha512}});var x=z;Object.defineProperty(t,"solidityKeccak256",{enumerable:!0,get:function(){return x.keccak256}}),Object.defineProperty(t,"solidityPack",{enumerable:!0,get:function(){return x.pack}}),Object.defineProperty(t,"soliditySha256",{enumerable:!0,get:function(){return x.sha256}});var _=W;Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return _.randomBytes}}),Object.defineProperty(t,"shuffled",{enumerable:!0,get:function(){return _.shuffled}});var O=w.default;Object.defineProperty(t,"checkProperties",{enumerable:!0,get:function(){return O.checkProperties}}),Object.defineProperty(t,"deepCopy",{enumerable:!0,get:function(){return O.deepCopy}}),Object.defineProperty(t,"defineReadOnly",{enumerable:!0,get:function(){return O.defineReadOnly}}),Object.defineProperty(t,"getStatic",{enumerable:!0,get:function(){return O.getStatic}}),Object.defineProperty(t,"resolveProperties",{enumerable:!0,get:function(){return O.resolveProperties}}),Object.defineProperty(t,"shallowCopy",{enumerable:!0,get:function(){return O.shallowCopy}});var j=o(q);t.RLP=j;var S=G;Object.defineProperty(t,"computePublicKey",{enumerable:!0,get:function(){return S.computePublicKey}}),Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return S.recoverPublicKey}}),Object.defineProperty(t,"SigningKey",{enumerable:!0,get:function(){return S.SigningKey}});var E=J;Object.defineProperty(t,"formatBytes32String",{enumerable:!0,get:function(){return E.formatBytes32String}}),Object.defineProperty(t,"nameprep",{enumerable:!0,get:function(){return E.nameprep}}),Object.defineProperty(t,"parseBytes32String",{enumerable:!0,get:function(){return E.parseBytes32String}}),Object.defineProperty(t,"_toEscapedUtf8String",{enumerable:!0,get:function(){return E._toEscapedUtf8String}}),Object.defineProperty(t,"toUtf8Bytes",{enumerable:!0,get:function(){return E.toUtf8Bytes}}),Object.defineProperty(t,"toUtf8CodePoints",{enumerable:!0,get:function(){return E.toUtf8CodePoints}}),Object.defineProperty(t,"toUtf8String",{enumerable:!0,get:function(){return E.toUtf8String}}),Object.defineProperty(t,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return E.Utf8ErrorFuncs}});var k=P.default;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return k.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return k.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return k.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return k.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return k.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return k.TransactionTypes}});var T=V;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return T.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return T.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return T.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return T.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return T.parseUnits}});var A=H;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return A.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return A.verifyTypedData}});var U=$;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return U._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return U.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return U.poll}});var C=F;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return C.SupportedAlgorithm}});var L=J;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return L.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return L.Utf8ErrorReason}})}(L);var X="wallet.unipass.id",ee={upDomain:X,upConnectUrl:"https://"+X+"/connect",upLogoutUrl:"https://"+X+"/logout",upSignMessageUrl:"https://"+X+"/sign-message",upTransactionUrl:"https://"+X+"/send-transaction",upLoadingUrl:"https://"+X+"/connect/loading"},te=function(){return ee},ne={protocol:"https",domain:"testnet.wallet.unipass.id"},re={protocol:"https",domain:"wallet.unipass.id"},oe={mainnet:{eth:"https://node.wallet.unipass.id/eth-mainnet",polygon:"https://node.wallet.unipass.id/polygon-mainnet",bsc:"https://node.wallet.unipass.id/bsc-mainnet",rangers:"https://node.wallet.unipass.id/rangers-mainnet",scroll:"https://node.wallet.unipass.id/scroll-mainnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-mainnet",avalanche:"https://node.wallet.unipass.id/avalanche-mainnet",kcc:"https://node.wallet.unipass.id/kcc-mainnet",platon:"https://node.wallet.unipass.id/platon-mainnet",okc:"https://node.wallet.unipass.id/okc-mainnet"},testnet:{eth:"https://node.wallet.unipass.id/eth-goerli",polygon:"https://node.wallet.unipass.id/polygon-mumbai",bsc:"https://node.wallet.unipass.id/bsc-testnet",rangers:"https://node.wallet.unipass.id/rangers-robin",scroll:"https://node.wallet.unipass.id/scroll-testnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-testnet",avalanche:"https://node.wallet.unipass.id/avalanche-testnet",kcc:"https://node.wallet.unipass.id/kcc-testnet",platon:"https://node.wallet.unipass.id/platon-testnet",okc:"https://node.wallet.unipass.id/okc-testnet"}},ie=function(e){var t;t="localStorage"===e?window.localStorage||localStorage:window.sessionStorage||sessionStorage;return{get:function(e){return t.getItem(e)||""},set:function(e,n){return t.setItem(e,n||"")},remove:function(e){return t.removeItem(e)}}},ae=function(){var e=Y(K().mark((function e(t,n){var r,o;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(t.storageType).get(Pe),e.t0=r&&JSON.parse(r),e.t0){e.next=6;break}return e.next=5,ue(t,n);case 5:e.t0=e.sent;case 6:return o=e.t0,e.abrupt("return",o);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),se=function(){var e=Y(K().mark((function e(t){var n;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new A("UP_LOGOUT"),e.next=4,xe(n);case 4:ie("localStorage").remove(Pe),ie("sessionStorage").remove(Pe);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ue=function(){var e=Y(K().mark((function e(t,n){var r,o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new A("UP_LOGIN",r,t.appSettings),e.next=5,xe(o,null==n?void 0:n.connectType,null==n?void 0:n.forceLogin,null==n?void 0:n.eventListener);case 5:return(i=e.sent)&&i.address&&ie(t.storageType).set(Pe,JSON.stringify(i)),e.abrupt("return",i);case 10:throw e.prev=10,e.t0=e.catch(0),new Error("Account Not Available");case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n){return e.apply(this,arguments)}}(),ce="UP_WALLET_POP",pe=null,le=null;function de(e,t,n){var r="innerWidth=462,width=462,innerHeight=810,height=810,top="+.5*(n.screen.availHeight-30-810)+",left="+.8*(n.screen.availWidth-10-462)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";return n.open(e,t,r)}function fe(e,t,n){return he.apply(this,arguments)}function he(){return(he=Y(K().mark((function e(t,n,r){var o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==pe||null!=(o=pe)&&o.closed)){e.next=8;break}if(null!=(pe=de(t,ce,window))){e.next=6;break}return e.next=5,ge(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:le!==t?(pe.location.replace(t),pe.focus()):pe.focus();case 9:return i=setInterval((function(){if(pe&&pe.closed){var e={data:new A("UP_RESPONSE",JSON.stringify(new T("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){pe&&!pe.closed&&pe.close(),pe=null},e.abrupt("return",{popup:pe,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e,t,n){return me.apply(this,arguments)}function me(){return(me=Y(K().mark((function e(t,n,r){var o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=document.createElement("div"),'\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',o.innerHTML='\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',document.body.appendChild(o),i=document.querySelector(".up_notification_right"),e.abrupt("return",new Promise((function(e){null==i||i.addEventListener("click",(function(){document.body.removeChild(o),e(fe(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=function(){};function be(e,t,n){if("UP_LOGIN"===e)return"google"===t?te().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?te().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):te().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return te().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return te().upSignMessageUrl;if("UP_TRANSACTION"===e)return te().upTransactionUrl;if("UP_READY"===e)return te().upLoadingUrl;throw new Error("unsupport type "+e)}function ve(e,t,n,r){return we.apply(this,arguments)}function we(){return we=Y(K().mark((function e(t,n,r,o){var i,a,s,u,c,p,l,d,f,h;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h=function(e){try{null==p||p.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}},f=function(){try{window.removeEventListener("message",d),l(),i()}catch(e){console.error("Popup Close Error",e)}},d=function(e){try{if("object"!=typeof e.data)return;var t=e.data;if(!t||!t.type)return;"UP_CLOSE"===e.data.type&&f(),"UP_READY"===t.type&&s(e,{send:h,close:f}),"UP_RESPONSE"===t.type&&u(e,{send:h,close:f}),"UP_EVENT"===t.type&&a(e,{send:h,close:f})}catch(e){console.error("Popup Callback Error",e),f()}},null!=t){e.next=5;break}return e.abrupt("return",{send:ye,close:ye});case 5:return i=(null==o?void 0:o.onClose)||ye,a=(null==o?void 0:o.onMessage)||ye,s=(null==o?void 0:o.onReady)||ye,u=(null==o?void 0:o.onResponse)||ye,window.addEventListener("message",d),e.next=12,fe(be(t.type,n,r),u,t.appSetting);case 12:return c=e.sent,p=c.popup,l=c.unmount,e.abrupt("return",{send:h,close:f});case 16:case"end":return e.stop()}}),e)}))),we.apply(this,arguments)}var Pe="UP-A";function xe(e,t,n,r){return new Promise(function(){var o=Y(K().mark((function o(i,a){return K().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,ve(e,t,n,{onReady:function(t,n){return Y(K().mark((function t(){var r;return K().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.send,t.prev=1,r(e),t.next=8;break;case 5:throw t.prev=5,t.t0=t.catch(1),t.t0;case 8:case"end":return t.stop()}}),t,null,[[1,5]])})))()},onResponse:function(t,n){return Y(K().mark((function r(){var o,s,u;return K().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=n.close,r.prev=1,"object"==typeof t.data){r.next=4;break}return r.abrupt("return");case 4:s=t.data,u=JSON.parse(s.payload),r.t0=u.type,r.next="APPROVE"===r.t0?9:"DECLINE"===r.t0?12:27;break;case 9:return i(u.data),o(),r.abrupt("break",30);case 12:if("expired"!==u.data){r.next=24;break}if("UP_LOGIN"!==e.type){r.next=15;break}return r.abrupt("return");case 15:if("UP_LOGOUT"!==e.type){r.next=19;break}return i(u.data),o(),r.abrupt("return");case 19:if("UP_TRANSACTION"!==e.type&&"UP_SIGN_MESSAGE"!==e.type){r.next=24;break}return se(!1),a("can not authorize without login"),o(),r.abrupt("break",30);case 24:return a("Declined: "+(u.data||"No reason supplied")),o(),r.abrupt("break",30);case 27:return a("Declined: No reason supplied"),o(),r.abrupt("break",30);case 30:r.next=35;break;case 32:throw r.prev=32,r.t1=r.catch(1),r.t1;case 35:case"end":return r.stop()}}),r,null,[[1,32]])})))()},onMessage:function(e,t){return Y(K().mark((function t(){var n,o;return K().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}return t.abrupt("return");case 2:if(t.prev=2,"object"==typeof e.data){t.next=5;break}return t.abrupt("return");case 5:n=e.data,o=JSON.parse(n.payload),r(o),t.next=13;break;case 10:throw t.prev=10,t.t0=t.catch(2),t.t0;case 13:case"end":return t.stop()}}),t,null,[[2,10]])})))()},onClose:function(){return Y(K().mark((function e(){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a("Declined: Externally Halted");case 1:case"end":return e.stop()}}),e)})))()}});case 2:case"end":return o.stop()}}),o)})));return function(e,t){return o.apply(this,arguments)}}())}var _e=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new A("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,xe(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),Oe=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new A("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,xe(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),je="0x1626ba7e";var Se=function(){function e(e){this.initConfig(e)}var t=e.prototype;return t.initConfig=function(e){this._config={env:"prod",nodeRPC:"",chainType:"polygon",storageType:"sessionStorage"},this._config.env=e.env||"prod",this._config.chainType=e.chainType||"polygon";var t,n,o=(t=this._config.env,n=this._config.chainType,{env:t,nodeRPC:"prod"===t?oe.mainnet[n]:oe.testnet[n],chainType:n,walletUrl:"prod"===t?re:ne});this._config.nodeRPC=e.nodeRPC||o.nodeRPC,this._config.appSettings=function(e,t){return Q({},t||{},{chain:(null==t?void 0:t.chain)||e,appName:(null==t?void 0:t.appName)||"MyDemo"})}(this._config.chainType,e.appSettings),this._provider=new r.JsonRpcProvider(this._config.nodeRPC),this._auth_provider=new r.JsonRpcProvider(function(e){return"prod"===e?oe.mainnet.polygon:oe.testnet.polygon}(this._config.env));var i,a,s,u=e.walletUrl||o.walletUrl;u&&(a=(i=u).domain,s=i.protocol,ee={upDomain:a=a||X,upConnectUrl:(s=s||"https")+"://"+a+"/connect",upLogoutUrl:s+"://"+a+"/logout",upSignMessageUrl:s+"://"+a+"/sign-message",upTransactionUrl:s+"://"+a+"/send-transaction",upLoadingUrl:s+"://"+a+"/connect/loading"}),this._config.storageType=e.storageType||"sessionStorage"},t.updateConfig=function(e){this._config&&(e.chainType&&(this._config.chainType=e.chainType),e.nodeRPC&&(this._config.nodeRPC=e.nodeRPC,this._provider=new r.JsonRpcProvider(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},t.login=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ae(this._config,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getAccount=function(){var e,t;return e=this._config.storageType,(t=ie(e).get(Pe))?JSON.parse(t):void 0},t.logout=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,se(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.getProvider=function(){return this._provider},t.getAuthProvider=function(){return this._auth_provider},t.isLogin=function(){return!!this.getAccount()},t.assertLogin=function(){if(!this.isLogin())throw new Error("user is not login")},t.getAddress=function(){return this.assertLogin(),this.getAccount().address},t.sendTransaction=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,Oe(t,this._config);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.signMessage=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a,s;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),o=(r=n||{}).isEIP191Prefix,i=void 0!==o&&o,a=r.onAuthChain,s=void 0===a||a,"string"==typeof t&&(t=L.toUtf8Bytes(t)),e.next=5,_e(new k(this.getAddress(),L.hexlify(t),"V1",i,s),this._config);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidSignature=function(){var e=Y(K().mark((function e(t,n,r){var o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new f.Contract(r,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),e.next=4,o.isValidSignature(("string"==typeof(a=t)&&(a=L.toUtf8Bytes(a)),L.keccak256(L.concat([L.toUtf8Bytes("UniPass Signed Message:\n"),L.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===je);case 6:case"end":return e.stop()}var a}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.signTypedData=function(){var e=Y(K().mark((function e(t,n){var r,o;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertLogin(),null!=t){e.next=3;break}throw new Error("Missing data parameter");case 3:return r=(n||{}).onAuthChain,o=void 0===r||r,e.next=6,_e(new k(this.getAddress(),JSON.stringify(t),"V4",!1,o),this._config);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidTypedSignature=function(){var e=Y(K().mark((function e(t,n,r){var o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t){e.next=2;break}throw new Error("Missing data parameter");case 2:return n||(this.assertLogin(),n=this.getAddress()),o=new f.Contract(n,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),i=C(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===je);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function Ee(n){var r,o,i;return e.__awaiter(this,void 0,void 0,(function*(){const a=n.JsonRpcProvider||h.DefaultJsonRpcProvider,s=null!==(r=n.chainId)&&void 0!==r?r:1;let u=null!==(o=n.rpcUrl)&&void 0!==o?o:null===(i=n.rpc)||void 0===i?void 0:i[s];const c=new class extends a{constructor(t,r){super(t,r),this.updateUpWalletConfig=t=>{var r;const o=null===(r=n.rpc)||void 0===r?void 0:r[t];if(!e.SUPPORTED_CHAIN_ID.includes(t))throw new Error(`chainId ${t} not supported`);if(this.upWallet.updateConfig({chainType:e.getChainNameByChainId(t),nodeRPC:o,appSettings:{chain:e.getChainNameByChainId(t)}}),"object"==typeof this.network)this.network.chainId=t;else{const e={chainId:t,name:"unknown"};p.defineReadOnly(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.upWallet=new Se({env:e.getENVByChainId(s),chainType:e.getChainNameByChainId(s),appSettings:{appIcon:n.appLogoUrl,appName:n.appName,chain:e.getChainNameByChainId(s)},rpcUrl:u,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new S(c,this.upWallet,null!==(e=null==t?void 0:t.address)&&void 0!==e?e:"",0)}connect(){return e.__awaiter(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return e||(yield this.upWallet.login({email:false}))}))}disconnect(){return e.__awaiter(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return e.__awaiter(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return(null==e?void 0:e.address)?[null==e?void 0:e.address]:[]}))}getAddress(){const e=this.upWallet.getAccount();return Promise.resolve((null==e?void 0:e.address)?t.getAddress(null==e?void 0:e.address):null)}}(u,s);return c}))}exports.createProvider=Ee,exports.default=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield Ee(t);return e.on("connect",n.connect),e.on("disconnect",(e=>{n.disconnect(e),n.accountsChanged([])})),e.on("accountsChanged",n.accountsChanged),e.on("chainChanged",n.chainChanged),e.on("message",(({type:e,data:t})=>n.message(e,t))),yield e.connect(),e}))},exports.disconnectWallet=function(){var t;null===(t=e.useWalletStore.getState().provider)||void 0===t||t.disconnect()},exports.signTypedData=function(t){var n,r;return null===(r=null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.upWallet)||void 0===r?void 0:r.signTypedData(t)},exports.switchChain=function(t){var n;const r=t.addChainParameters.chainId,o="string"==typeof r&&(null==r?void 0:r.startsWith("0x"))?parseInt(r,16):Number(r);if(!e.SUPPORTED_CHAIN_ID.includes(o))throw new Error(`chainId ${o} not supported`);return null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.updateUpWalletConfig(o)};
|
|
1
|
+
"use strict";var e=require("./index-3b9b0297.cjs"),t=require("@ethersproject/address"),n=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),o=require("@ethersproject/bytes"),i=require("./index-66442a21.cjs"),a=require("./index-fece914f.cjs"),s=require("./ethers-3b1d7d09.cjs"),u=require("./id-d2547ab8.cjs"),c=require("@ethersproject/json-wallets"),p=require("@ethersproject/properties"),l=require("./index-d400c95d.cjs"),d=require("@ethersproject/transactions"),f=require("@ethersproject/contracts"),h=require("./DefaultJsonRpcProvider-9f539cb7.cjs");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("zustand"),require("events"),require("@ethersproject/constants"),require("./interface-b141cac1.cjs"),require("@ethersproject/abstract-provider"),require("./bn-f94d2173.cjs"),require("./__node-resolve_empty-8f743760.cjs"),require("./hash-7ce6fed5.cjs"),require("./inherits_browser-50deae74.cjs");var m,y=g(t),b=g(o),v=g(c),w=g(p),P=g(d),x=Object.freeze({__proto__:null,_toEscapedUtf8String:u._toEscapedUtf8String,toUtf8Bytes:u.toUtf8Bytes,toUtf8CodePoints:u.toUtf8CodePoints,toUtf8String:u.toUtf8String,Utf8ErrorFuncs:u.Utf8ErrorFuncs,get Utf8ErrorReason(){return u.Utf8ErrorReason},get UnicodeNormalizationForm(){return u.UnicodeNormalizationForm},formatBytes32String:s.formatBytes32String,parseBytes32String:s.parseBytes32String,nameprep:s.nameprep}),_=Object.freeze({__proto__:null,id:u.id,dnsEncode:s.dnsEncode,namehash:s.namehash,isValidName:s.isValidName,ensNormalize:s.ensNormalize,messagePrefix:s.messagePrefix,hashMessage:s.hashMessage,_TypedDataEncoder:i.TypedDataEncoder}),O=Object.freeze({__proto__:null,computeHmac:s.computeHmac,ripemd160:s.ripemd160,sha256:s.sha256,sha512:s.sha512,get SupportedAlgorithm(){return s.SupportedAlgorithm}}),j=Object.freeze({__proto__:null,randomBytes:s.randomBytes,shuffled:s.shuffled});class S extends n.Signer{constructor(e,t,n,r){super(),this._address=n,this._index=null!=r?r:0,this.provider=e,this.upWallet=t}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e.__awaiter(this,void 0,void 0,(function*(){return Promise.resolve(t.getAddress(this._address))}))}signMessage(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t}'`);return yield this.upWallet.signMessage(t,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(t,n,r){return e.__awaiter(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data})}))}sendTransaction(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return{hash:yield this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data}),from:t.from}}))}connect(e){return new S(null!=e?e:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new S(this.provider,this.upWallet,this._address,this._index)}}!function(e){e.REGISTER="register"}(m||(m={}));var E,k=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},T=function(e,t){this.type=e,this.data=t},A=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},U.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(E||(E={}));var C=function(e){return o.arrayify(function(e){var t=U({},e.types);return delete t.EIP712Domain,i.TypedDataEncoder.hash(e.domain,t,e.message)}(e))},L={},N=e.getAugmentedNamespace(s.lib_esm),I=e.getAugmentedNamespace(s.lib_esm$1),D=e.getAugmentedNamespace(_),R=e.getAugmentedNamespace(s.lib_esm$2),M=e.getAugmentedNamespace(e.lib_esm),B=e.getAugmentedNamespace(u.lib_esm),F=e.getAugmentedNamespace(O),z=e.getAugmentedNamespace(s.lib_esm$3),W=e.getAugmentedNamespace(j),q=e.getAugmentedNamespace(l.lib_esm),G=e.getAugmentedNamespace(s.lib_esm$4),J=e.getAugmentedNamespace(x),V=e.getAugmentedNamespace(s.lib_esm$5),H=e.getAugmentedNamespace(s.lib_esm$6),$=e.getAugmentedNamespace(i.lib_esm);function K(){K=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),s=new j(o||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function f(){}function h(){}var g={};u(g,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(S([])));y&&y!==t&&n.call(y,i)&&(g=y);var b=h.prototype=d.prototype=Object.create(g);function v(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,s){var u=p(e[r],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return o("throw",e,a,s)}))}s(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function P(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return E()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=x(a,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,l;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=h,r(b,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:f,configurable:!0}),f.displayName=u(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},v(w.prototype),u(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new w(c(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(b),u(b,s,"Generator"),u(b,i,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=S,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}function Z(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Z(i,r,o,a,s,"next",e)}function s(e){Z(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Q(){return Q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Q.apply(this,arguments)}!function(t){var n=e.commonjsGlobal&&e.commonjsGlobal.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=e.commonjsGlobal&&e.commonjsGlobal.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e.commonjsGlobal&&e.commonjsGlobal.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.formatBytes32String=t.Utf8ErrorFuncs=t.toUtf8String=t.toUtf8CodePoints=t.toUtf8Bytes=t._toEscapedUtf8String=t.nameprep=t.hexDataSlice=t.hexDataLength=t.hexZeroPad=t.hexValue=t.hexStripZeros=t.hexConcat=t.isHexString=t.hexlify=t.base64=t.base58=t.TransactionDescription=t.LogDescription=t.Interface=t.SigningKey=t.HDNode=t.defaultPath=t.isBytesLike=t.isBytes=t.zeroPad=t.stripZeros=t.concat=t.arrayify=t.shallowCopy=t.resolveProperties=t.getStatic=t.defineReadOnly=t.deepCopy=t.checkProperties=t.poll=t.fetchJson=t._fetchData=t.RLP=t.Logger=t.checkResultErrors=t.FormatTypes=t.ParamType=t.FunctionFragment=t.EventFragment=t.ErrorFragment=t.ConstructorFragment=t.Fragment=t.defaultAbiCoder=t.AbiCoder=void 0,t.Indexed=t.Utf8ErrorReason=t.UnicodeNormalizationForm=t.SupportedAlgorithm=t.mnemonicToSeed=t.isValidMnemonic=t.entropyToMnemonic=t.mnemonicToEntropy=t.getAccountPath=t.verifyTypedData=t.verifyMessage=t.recoverPublicKey=t.computePublicKey=t.recoverAddress=t.computeAddress=t.getJsonWalletAddress=t.TransactionTypes=t.serializeTransaction=t.parseTransaction=t.accessListify=t.joinSignature=t.splitSignature=t.soliditySha256=t.solidityKeccak256=t.solidityPack=t.shuffled=t.randomBytes=t.sha512=t.sha256=t.ripemd160=t.keccak256=t.computeHmac=t.commify=t.parseUnits=t.formatUnits=t.parseEther=t.formatEther=t.isAddress=t.getCreate2Address=t.getContractAddress=t.getIcapAddress=t.getAddress=t._TypedDataEncoder=t.id=t.isValidName=t.namehash=t.hashMessage=t.dnsEncode=t.parseBytes32String=void 0;var i=a.require$$0;Object.defineProperty(t,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(t,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(t,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(t,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(t,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(t,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(t,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(t,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(t,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(t,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(t,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(t,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(t,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var s=y.default;Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return s.getAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return s.getCreate2Address}}),Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return s.getContractAddress}}),Object.defineProperty(t,"getIcapAddress",{enumerable:!0,get:function(){return s.getIcapAddress}}),Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return s.isAddress}});var u=o(N);t.base64=u;var c=I;Object.defineProperty(t,"base58",{enumerable:!0,get:function(){return c.Base58}});var p=b.default;Object.defineProperty(t,"arrayify",{enumerable:!0,get:function(){return p.arrayify}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return p.concat}}),Object.defineProperty(t,"hexConcat",{enumerable:!0,get:function(){return p.hexConcat}}),Object.defineProperty(t,"hexDataSlice",{enumerable:!0,get:function(){return p.hexDataSlice}}),Object.defineProperty(t,"hexDataLength",{enumerable:!0,get:function(){return p.hexDataLength}}),Object.defineProperty(t,"hexlify",{enumerable:!0,get:function(){return p.hexlify}}),Object.defineProperty(t,"hexStripZeros",{enumerable:!0,get:function(){return p.hexStripZeros}}),Object.defineProperty(t,"hexValue",{enumerable:!0,get:function(){return p.hexValue}}),Object.defineProperty(t,"hexZeroPad",{enumerable:!0,get:function(){return p.hexZeroPad}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return p.isBytes}}),Object.defineProperty(t,"isBytesLike",{enumerable:!0,get:function(){return p.isBytesLike}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return p.isHexString}}),Object.defineProperty(t,"joinSignature",{enumerable:!0,get:function(){return p.joinSignature}}),Object.defineProperty(t,"zeroPad",{enumerable:!0,get:function(){return p.zeroPad}}),Object.defineProperty(t,"splitSignature",{enumerable:!0,get:function(){return p.splitSignature}}),Object.defineProperty(t,"stripZeros",{enumerable:!0,get:function(){return p.stripZeros}});var l=D;Object.defineProperty(t,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(t,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(t,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return l.namehash}});var d=R;Object.defineProperty(t,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(t,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(t,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(t,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(t,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(t,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(t,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var f=v.default;Object.defineProperty(t,"getJsonWalletAddress",{enumerable:!0,get:function(){return f.getJsonWalletAddress}});var h=M;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return h.keccak256}});var g=B;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return g.Logger}});var m=F;Object.defineProperty(t,"computeHmac",{enumerable:!0,get:function(){return m.computeHmac}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return m.ripemd160}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return m.sha256}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return m.sha512}});var x=z;Object.defineProperty(t,"solidityKeccak256",{enumerable:!0,get:function(){return x.keccak256}}),Object.defineProperty(t,"solidityPack",{enumerable:!0,get:function(){return x.pack}}),Object.defineProperty(t,"soliditySha256",{enumerable:!0,get:function(){return x.sha256}});var _=W;Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return _.randomBytes}}),Object.defineProperty(t,"shuffled",{enumerable:!0,get:function(){return _.shuffled}});var O=w.default;Object.defineProperty(t,"checkProperties",{enumerable:!0,get:function(){return O.checkProperties}}),Object.defineProperty(t,"deepCopy",{enumerable:!0,get:function(){return O.deepCopy}}),Object.defineProperty(t,"defineReadOnly",{enumerable:!0,get:function(){return O.defineReadOnly}}),Object.defineProperty(t,"getStatic",{enumerable:!0,get:function(){return O.getStatic}}),Object.defineProperty(t,"resolveProperties",{enumerable:!0,get:function(){return O.resolveProperties}}),Object.defineProperty(t,"shallowCopy",{enumerable:!0,get:function(){return O.shallowCopy}});var j=o(q);t.RLP=j;var S=G;Object.defineProperty(t,"computePublicKey",{enumerable:!0,get:function(){return S.computePublicKey}}),Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return S.recoverPublicKey}}),Object.defineProperty(t,"SigningKey",{enumerable:!0,get:function(){return S.SigningKey}});var E=J;Object.defineProperty(t,"formatBytes32String",{enumerable:!0,get:function(){return E.formatBytes32String}}),Object.defineProperty(t,"nameprep",{enumerable:!0,get:function(){return E.nameprep}}),Object.defineProperty(t,"parseBytes32String",{enumerable:!0,get:function(){return E.parseBytes32String}}),Object.defineProperty(t,"_toEscapedUtf8String",{enumerable:!0,get:function(){return E._toEscapedUtf8String}}),Object.defineProperty(t,"toUtf8Bytes",{enumerable:!0,get:function(){return E.toUtf8Bytes}}),Object.defineProperty(t,"toUtf8CodePoints",{enumerable:!0,get:function(){return E.toUtf8CodePoints}}),Object.defineProperty(t,"toUtf8String",{enumerable:!0,get:function(){return E.toUtf8String}}),Object.defineProperty(t,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return E.Utf8ErrorFuncs}});var k=P.default;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return k.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return k.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return k.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return k.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return k.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return k.TransactionTypes}});var T=V;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return T.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return T.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return T.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return T.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return T.parseUnits}});var A=H;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return A.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return A.verifyTypedData}});var U=$;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return U._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return U.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return U.poll}});var C=F;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return C.SupportedAlgorithm}});var L=J;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return L.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return L.Utf8ErrorReason}})}(L);var X="wallet.unipass.id",ee={upDomain:X,upConnectUrl:"https://"+X+"/connect",upLogoutUrl:"https://"+X+"/logout",upSignMessageUrl:"https://"+X+"/sign-message",upTransactionUrl:"https://"+X+"/send-transaction",upLoadingUrl:"https://"+X+"/connect/loading"},te=function(){return ee},ne={protocol:"https",domain:"testnet.wallet.unipass.id"},re={protocol:"https",domain:"wallet.unipass.id"},oe={mainnet:{eth:"https://node.wallet.unipass.id/eth-mainnet",polygon:"https://node.wallet.unipass.id/polygon-mainnet",bsc:"https://node.wallet.unipass.id/bsc-mainnet",rangers:"https://node.wallet.unipass.id/rangers-mainnet",scroll:"https://node.wallet.unipass.id/scroll-mainnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-mainnet",avalanche:"https://node.wallet.unipass.id/avalanche-mainnet",kcc:"https://node.wallet.unipass.id/kcc-mainnet",platon:"https://node.wallet.unipass.id/platon-mainnet",okc:"https://node.wallet.unipass.id/okc-mainnet"},testnet:{eth:"https://node.wallet.unipass.id/eth-goerli",polygon:"https://node.wallet.unipass.id/polygon-mumbai",bsc:"https://node.wallet.unipass.id/bsc-testnet",rangers:"https://node.wallet.unipass.id/rangers-robin",scroll:"https://node.wallet.unipass.id/scroll-testnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-testnet",avalanche:"https://node.wallet.unipass.id/avalanche-testnet",kcc:"https://node.wallet.unipass.id/kcc-testnet",platon:"https://node.wallet.unipass.id/platon-testnet",okc:"https://node.wallet.unipass.id/okc-testnet"}},ie=function(e){var t;t="localStorage"===e?window.localStorage||localStorage:window.sessionStorage||sessionStorage;return{get:function(e){return t.getItem(e)||""},set:function(e,n){return t.setItem(e,n||"")},remove:function(e){return t.removeItem(e)}}},ae=function(){var e=Y(K().mark((function e(t,n){var r,o;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(t.storageType).get(Pe),e.t0=r&&JSON.parse(r),e.t0){e.next=6;break}return e.next=5,ue(t,n);case 5:e.t0=e.sent;case 6:return o=e.t0,e.abrupt("return",o);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),se=function(){var e=Y(K().mark((function e(t){var n;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new A("UP_LOGOUT"),e.next=4,xe(n);case 4:ie("localStorage").remove(Pe),ie("sessionStorage").remove(Pe);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ue=function(){var e=Y(K().mark((function e(t,n){var r,o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new A("UP_LOGIN",r,t.appSettings),e.next=5,xe(o,null==n?void 0:n.connectType,null==n?void 0:n.forceLogin,null==n?void 0:n.eventListener);case 5:return(i=e.sent)&&i.address&&ie(t.storageType).set(Pe,JSON.stringify(i)),e.abrupt("return",i);case 10:throw e.prev=10,e.t0=e.catch(0),new Error("Account Not Available");case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n){return e.apply(this,arguments)}}(),ce="UP_WALLET_POP",pe=null,le=null;function de(e,t,n){var r="innerWidth=462,width=462,innerHeight=810,height=810,top="+.5*(n.screen.availHeight-30-810)+",left="+.8*(n.screen.availWidth-10-462)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";return n.open(e,t,r)}function fe(e,t,n){return he.apply(this,arguments)}function he(){return(he=Y(K().mark((function e(t,n,r){var o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==pe||null!=(o=pe)&&o.closed)){e.next=8;break}if(null!=(pe=de(t,ce,window))){e.next=6;break}return e.next=5,ge(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:le!==t?(pe.location.replace(t),pe.focus()):pe.focus();case 9:return i=setInterval((function(){if(pe&&pe.closed){var e={data:new A("UP_RESPONSE",JSON.stringify(new T("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){pe&&!pe.closed&&pe.close(),pe=null},e.abrupt("return",{popup:pe,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e,t,n){return me.apply(this,arguments)}function me(){return(me=Y(K().mark((function e(t,n,r){var o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=document.createElement("div"),'\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',o.innerHTML='\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',document.body.appendChild(o),i=document.querySelector(".up_notification_right"),e.abrupt("return",new Promise((function(e){null==i||i.addEventListener("click",(function(){document.body.removeChild(o),e(fe(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=function(){};function be(e,t,n){if("UP_LOGIN"===e)return"google"===t?te().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?te().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):te().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return te().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return te().upSignMessageUrl;if("UP_TRANSACTION"===e)return te().upTransactionUrl;if("UP_READY"===e)return te().upLoadingUrl;throw new Error("unsupport type "+e)}function ve(e,t,n,r){return we.apply(this,arguments)}function we(){return we=Y(K().mark((function e(t,n,r,o){var i,a,s,u,c,p,l,d,f,h;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h=function(e){try{null==p||p.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}},f=function(){try{window.removeEventListener("message",d),l(),i()}catch(e){console.error("Popup Close Error",e)}},d=function(e){try{if("object"!=typeof e.data)return;var t=e.data;if(!t||!t.type)return;"UP_CLOSE"===e.data.type&&f(),"UP_READY"===t.type&&s(e,{send:h,close:f}),"UP_RESPONSE"===t.type&&u(e,{send:h,close:f}),"UP_EVENT"===t.type&&a(e,{send:h,close:f})}catch(e){console.error("Popup Callback Error",e),f()}},null!=t){e.next=5;break}return e.abrupt("return",{send:ye,close:ye});case 5:return i=(null==o?void 0:o.onClose)||ye,a=(null==o?void 0:o.onMessage)||ye,s=(null==o?void 0:o.onReady)||ye,u=(null==o?void 0:o.onResponse)||ye,window.addEventListener("message",d),e.next=12,fe(be(t.type,n,r),u,t.appSetting);case 12:return c=e.sent,p=c.popup,l=c.unmount,e.abrupt("return",{send:h,close:f});case 16:case"end":return e.stop()}}),e)}))),we.apply(this,arguments)}var Pe="UP-A";function xe(e,t,n,r){return new Promise(function(){var o=Y(K().mark((function o(i,a){return K().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,ve(e,t,n,{onReady:function(t,n){return Y(K().mark((function t(){var r;return K().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.send,t.prev=1,r(e),t.next=8;break;case 5:throw t.prev=5,t.t0=t.catch(1),t.t0;case 8:case"end":return t.stop()}}),t,null,[[1,5]])})))()},onResponse:function(t,n){return Y(K().mark((function r(){var o,s,u;return K().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=n.close,r.prev=1,"object"==typeof t.data){r.next=4;break}return r.abrupt("return");case 4:s=t.data,u=JSON.parse(s.payload),r.t0=u.type,r.next="APPROVE"===r.t0?9:"DECLINE"===r.t0?12:27;break;case 9:return i(u.data),o(),r.abrupt("break",30);case 12:if("expired"!==u.data){r.next=24;break}if("UP_LOGIN"!==e.type){r.next=15;break}return r.abrupt("return");case 15:if("UP_LOGOUT"!==e.type){r.next=19;break}return i(u.data),o(),r.abrupt("return");case 19:if("UP_TRANSACTION"!==e.type&&"UP_SIGN_MESSAGE"!==e.type){r.next=24;break}return se(!1),a("can not authorize without login"),o(),r.abrupt("break",30);case 24:return a("Declined: "+(u.data||"No reason supplied")),o(),r.abrupt("break",30);case 27:return a("Declined: No reason supplied"),o(),r.abrupt("break",30);case 30:r.next=35;break;case 32:throw r.prev=32,r.t1=r.catch(1),r.t1;case 35:case"end":return r.stop()}}),r,null,[[1,32]])})))()},onMessage:function(e,t){return Y(K().mark((function t(){var n,o;return K().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}return t.abrupt("return");case 2:if(t.prev=2,"object"==typeof e.data){t.next=5;break}return t.abrupt("return");case 5:n=e.data,o=JSON.parse(n.payload),r(o),t.next=13;break;case 10:throw t.prev=10,t.t0=t.catch(2),t.t0;case 13:case"end":return t.stop()}}),t,null,[[2,10]])})))()},onClose:function(){return Y(K().mark((function e(){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a("Declined: Externally Halted");case 1:case"end":return e.stop()}}),e)})))()}});case 2:case"end":return o.stop()}}),o)})));return function(e,t){return o.apply(this,arguments)}}())}var _e=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new A("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,xe(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),Oe=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new A("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,xe(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),je="0x1626ba7e";var Se=function(){function e(e){this.initConfig(e)}var t=e.prototype;return t.initConfig=function(e){this._config={env:"prod",nodeRPC:"",chainType:"polygon",storageType:"sessionStorage"},this._config.env=e.env||"prod",this._config.chainType=e.chainType||"polygon";var t,n,o=(t=this._config.env,n=this._config.chainType,{env:t,nodeRPC:"prod"===t?oe.mainnet[n]:oe.testnet[n],chainType:n,walletUrl:"prod"===t?re:ne});this._config.nodeRPC=e.nodeRPC||o.nodeRPC,this._config.appSettings=function(e,t){return Q({},t||{},{chain:(null==t?void 0:t.chain)||e,appName:(null==t?void 0:t.appName)||"MyDemo"})}(this._config.chainType,e.appSettings),this._provider=new r.JsonRpcProvider(this._config.nodeRPC),this._auth_provider=new r.JsonRpcProvider(function(e){return"prod"===e?oe.mainnet.polygon:oe.testnet.polygon}(this._config.env));var i,a,s,u=e.walletUrl||o.walletUrl;u&&(a=(i=u).domain,s=i.protocol,ee={upDomain:a=a||X,upConnectUrl:(s=s||"https")+"://"+a+"/connect",upLogoutUrl:s+"://"+a+"/logout",upSignMessageUrl:s+"://"+a+"/sign-message",upTransactionUrl:s+"://"+a+"/send-transaction",upLoadingUrl:s+"://"+a+"/connect/loading"}),this._config.storageType=e.storageType||"sessionStorage"},t.updateConfig=function(e){this._config&&(e.chainType&&(this._config.chainType=e.chainType),e.nodeRPC&&(this._config.nodeRPC=e.nodeRPC,this._provider=new r.JsonRpcProvider(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},t.login=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ae(this._config,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getAccount=function(){var e,t;return e=this._config.storageType,(t=ie(e).get(Pe))?JSON.parse(t):void 0},t.logout=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,se(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.getProvider=function(){return this._provider},t.getAuthProvider=function(){return this._auth_provider},t.isLogin=function(){return!!this.getAccount()},t.assertLogin=function(){if(!this.isLogin())throw new Error("user is not login")},t.getAddress=function(){return this.assertLogin(),this.getAccount().address},t.sendTransaction=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,Oe(t,this._config);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.signMessage=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a,s;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),o=(r=n||{}).isEIP191Prefix,i=void 0!==o&&o,a=r.onAuthChain,s=void 0===a||a,"string"==typeof t&&(t=L.toUtf8Bytes(t)),e.next=5,_e(new k(this.getAddress(),L.hexlify(t),"V1",i,s),this._config);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidSignature=function(){var e=Y(K().mark((function e(t,n,r){var o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new f.Contract(r,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),e.next=4,o.isValidSignature(("string"==typeof(a=t)&&(a=L.toUtf8Bytes(a)),L.keccak256(L.concat([L.toUtf8Bytes("UniPass Signed Message:\n"),L.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===je);case 6:case"end":return e.stop()}var a}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.signTypedData=function(){var e=Y(K().mark((function e(t,n){var r,o;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertLogin(),null!=t){e.next=3;break}throw new Error("Missing data parameter");case 3:return r=(n||{}).onAuthChain,o=void 0===r||r,e.next=6,_e(new k(this.getAddress(),JSON.stringify(t),"V4",!1,o),this._config);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidTypedSignature=function(){var e=Y(K().mark((function e(t,n,r){var o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t){e.next=2;break}throw new Error("Missing data parameter");case 2:return n||(this.assertLogin(),n=this.getAddress()),o=new f.Contract(n,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),i=C(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===je);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function Ee(n){var r,o,i;return e.__awaiter(this,void 0,void 0,(function*(){const a=n.JsonRpcProvider||h.DefaultJsonRpcProvider,s=null!==(r=n.chainId)&&void 0!==r?r:1;let u=null!==(o=n.rpcUrl)&&void 0!==o?o:null===(i=n.rpc)||void 0===i?void 0:i[s];const c=new class extends a{constructor(t,r){super(t,r),this.updateUpWalletConfig=t=>{var r;const o=null===(r=n.rpc)||void 0===r?void 0:r[t];if(!e.SUPPORTED_CHAIN_ID.includes(t))throw new Error(`chainId ${t} not supported`);if(this.upWallet.updateConfig({chainType:e.getChainNameByChainId(t),nodeRPC:o,appSettings:{chain:e.getChainNameByChainId(t)}}),"object"==typeof this.network)this.network.chainId=t;else{const e={chainId:t,name:"unknown"};p.defineReadOnly(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.upWallet=new Se({env:e.getENVByChainId(s),chainType:e.getChainNameByChainId(s),appSettings:{appIcon:n.appLogoUrl,appName:n.appName,chain:e.getChainNameByChainId(s)},rpcUrl:u,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new S(c,this.upWallet,null!==(e=null==t?void 0:t.address)&&void 0!==e?e:"",0)}connect(){return e.__awaiter(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return e||(yield this.upWallet.login({email:false}))}))}disconnect(){return e.__awaiter(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return e.__awaiter(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return(null==e?void 0:e.address)?[null==e?void 0:e.address]:[]}))}getAddress(){const e=this.upWallet.getAccount();return Promise.resolve((null==e?void 0:e.address)?t.getAddress(null==e?void 0:e.address):null)}}(u,s);return c}))}exports.createProvider=Ee,exports.default=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield Ee(t);return e.on("connect",n.connect),e.on("disconnect",(e=>{n.disconnect(e),n.accountsChanged([])})),e.on("accountsChanged",n.accountsChanged),e.on("chainChanged",n.chainChanged),e.on("message",(({type:e,data:t})=>n.message(e,t))),yield e.connect(),e}))},exports.disconnectWallet=function(){var t;null===(t=e.useWalletStore.getState().provider)||void 0===t||t.disconnect()},exports.signTypedData=function(t){var n,r;return null===(r=null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.upWallet)||void 0===r?void 0:r.signTypedData(t)},exports.switchChain=function(t){var n;const r=t.addChainParameters.chainId,o="string"==typeof r&&(null==r?void 0:r.startsWith("0x"))?parseInt(r,16):Number(r);if(!e.SUPPORTED_CHAIN_ID.includes(o))throw new Error(`chainId ${o} not supported`);return null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.updateUpWalletConfig(o)};
|