@wormhole-foundation/wormhole-connect 2.0.0-beta.2-development → 2.1.0-beta.0-development
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/README.md +1 -0
- package/dist/assets/{ccip-B8McgJws.js → ccip-B5XelJyO.js} +1 -1
- package/dist/assets/{evm-B2eiT45I.js → evm-90nXZZVS.js} +3 -3
- package/dist/assets/{index.es-BO6bR5S4.js → index.es-Ed25jZ6s.js} +1 -1
- package/dist/assets/sui-DbbCSZ5V.js +1 -0
- package/dist/main.js +75 -75
- package/dist/src/config/constants.d.ts.map +1 -1
- package/dist/src/config/devnet/chains.d.ts.map +1 -1
- package/dist/src/config/devnet/index.d.ts.map +1 -1
- package/dist/src/config/devnet/rpcs.d.ts +0 -6
- package/dist/src/config/devnet/rpcs.d.ts.map +1 -1
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/mainnet/chains.d.ts.map +1 -1
- package/dist/src/config/mainnet/index.d.ts.map +1 -1
- package/dist/src/config/mainnet/rpcs.d.ts +0 -6
- package/dist/src/config/mainnet/rpcs.d.ts.map +1 -1
- package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/src/config/testnet/chains.d.ts.map +1 -1
- package/dist/src/config/testnet/index.d.ts.map +1 -1
- package/dist/src/config/testnet/rpcs.d.ts +0 -6
- package/dist/src/config/testnet/rpcs.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/config/tokens.d.ts +4 -0
- package/dist/src/config/tokens.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +2 -9
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/contexts/TokensContext.d.ts +1 -0
- package/dist/src/contexts/TokensContext.d.ts.map +1 -1
- package/dist/src/icons/ChainIcons.d.ts.map +1 -1
- package/dist/src/icons/Chains/UNI.d.ts +4 -0
- package/dist/src/icons/Chains/UNI.d.ts.map +1 -0
- package/dist/src/icons/TokenIcons.d.ts.map +1 -1
- package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
- package/dist/src/sdklegacy/config/DEVNET.d.ts.map +1 -1
- package/dist/src/sdklegacy/config/MAINNET.d.ts.map +1 -1
- package/dist/src/sdklegacy/config/TESTNET.d.ts.map +1 -1
- package/dist/src/sdklegacy/types.d.ts +0 -4
- package/dist/src/sdklegacy/types.d.ts.map +1 -1
- package/dist/src/utils/sdkv2.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -1
- package/dist/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -1
- package/lib/{aptos-Dbfuz96f.js → aptos--edUC0Jm.js} +1 -1
- package/lib/{aptos-KMTKpvnn.mjs → aptos-BrgNOgGM.mjs} +2 -2
- package/lib/{aptos-DTHJQbIb.js → aptos-CGjKms8W.js} +2 -2
- package/lib/{aptos-B3TWiavl.mjs → aptos-dXuHBY5i.mjs} +5 -5
- package/lib/{base64-Ci4lr2or.js → base64-BbtWjSSq.js} +1 -1
- package/lib/{base64-D-sBGnCV.mjs → base64-Cx-uEAcH.mjs} +1 -1
- package/lib/{ccip-CBfsTddJ.js → ccip-BRw4HAHQ.js} +1 -1
- package/lib/{ccip-IV8wn7mX.mjs → ccip-BiTI0Vsw.mjs} +1 -1
- package/lib/{chunk-OR6GFWLG-CFPMvzOj.js → chunk-OR6GFWLG-S-Fr6JAP.js} +1 -1
- package/lib/{chunk-OR6GFWLG-m97dlZZV.mjs → chunk-OR6GFWLG-r6sLFcMR.mjs} +3 -3
- package/lib/{events-CjPLRE-d.js → events-BIriznPM.js} +1 -1
- package/lib/{events-Dtbo0st9.mjs → events-CpW8AkTD.mjs} +1 -1
- package/lib/{evm-BFBdsLYZ.js → evm-BSyj6JzA.js} +11 -11
- package/lib/{evm-kkjU8AsQ.mjs → evm-CxlQ91gJ.mjs} +5 -5
- package/lib/{evm-JbOZ35C0.mjs → evm-Cyvodxhp.mjs} +388 -323
- package/lib/{evm-DuCtpTHQ.js → evm-DYaM3YMG.js} +1 -1
- package/lib/{index-DL2KYGb2.mjs → index--NM0JjnQ.mjs} +1 -1
- package/lib/{index-HF2DcpAR.mjs → index-Amhia1ZS.mjs} +2 -2
- package/lib/{index-DmkA2z4q.js → index-B0dvPq6m.js} +1 -1
- package/lib/{index-DFDFr1Hv.mjs → index-B2EArRT7.mjs} +1 -1
- package/lib/{index-Br4OTc1S.js → index-BBfGNpdz.js} +101 -101
- package/lib/{index-Bo9bOQTx.mjs → index-BEZxctGp.mjs} +1 -1
- package/lib/{index-D9NMKVsX.mjs → index-BJMqYpY6.mjs} +2 -2
- package/lib/{index-BE5ihayy.mjs → index-BMcGCzso.mjs} +2 -2
- package/lib/{index-MdL7XQBR.mjs → index-BND6j-zd.mjs} +1 -1
- package/lib/{index-SrHywpn-.js → index-BQ9AZknw.js} +1 -1
- package/lib/{index-DtJ3gwwu.js → index-BXyAX-bb.js} +1 -1
- package/lib/{index-DCfPCVGM.mjs → index-B_oqyOcL.mjs} +1 -1
- package/lib/{index-DUrL3GHD.mjs → index-Bhz1Rs3C.mjs} +3 -3
- package/lib/{index-CM5aJCsU.mjs → index-BnV0tUca.mjs} +3 -3
- package/lib/{index-BL5dRh07.mjs → index-C-Dl1g5N.mjs} +2 -2
- package/lib/{index-DWTXe9yU.mjs → index-CC6Tw8Ue.mjs} +4 -4
- package/lib/{index-DPlTznQs.js → index-CCzyci2v.js} +1 -1
- package/lib/{index-DzgnqJ7-.js → index-CHBZ4cXy.js} +1 -1
- package/lib/{index-B0lJ-tdN.js → index-CVYH-ljt.js} +1 -1
- package/lib/{index-D2v_ZH9c.mjs → index-CXN2TSeM.mjs} +2 -2
- package/lib/{index-DcKePNaA.js → index-Cajic-Zj.js} +1 -1
- package/lib/{index-gUz3Q8gE.js → index-ChdEfYe-.js} +1 -1
- package/lib/{index-IbmfT3Tg.mjs → index-ChzcO2lh.mjs} +5 -5
- package/lib/{index-CS3m8qJT.js → index-CjdAAhpi.js} +1 -1
- package/lib/{index-B3CeIlMx.mjs → index-CttRUMXZ.mjs} +6922 -6947
- package/lib/{index-Dy3WJQ-h.js → index-DBFaWeUh.js} +1 -1
- package/lib/{index-DLegUdzU.js → index-DCxu_9fC.js} +1 -1
- package/lib/{index-BoYglZwX.mjs → index-DFp-75l7.mjs} +2 -2
- package/lib/{index-CWSjFjhh.mjs → index-DM6ABGI6.mjs} +2 -2
- package/lib/{index-B4_J2HAU.js → index-DOOjj9wv.js} +1 -1
- package/lib/{index-DNNfs5Ot.js → index-DSooDhqr.js} +1 -1
- package/lib/{index-BdUX86K5.js → index-DkXzI9E6.js} +1 -1
- package/lib/{index-vlui53ey.mjs → index-Dt2sCuyA.mjs} +2 -2
- package/lib/{index-BasVT8K7.js → index-DzwZyiM9.js} +1 -1
- package/lib/{index-pi5LLTZ3.js → index-OgMy4QSY.js} +1 -1
- package/lib/{index-B2h28IP4.mjs → index-PQxGZteo.mjs} +2 -2
- package/lib/{index-QzouONBY.js → index-eY3JxOiX.js} +1 -1
- package/lib/{index-CfVm24rf.mjs → index-mdH3MkQ5.mjs} +1 -1
- package/lib/{index-DlMM2TKj.js → index-nFX-Pkvm.js} +1 -1
- package/lib/{index-B1ELgSA6.js → index-zxhCTPTL.js} +1 -1
- package/lib/{index.es-SaEPft-i.mjs → index.es-C2Qro_0A.mjs} +6 -6
- package/lib/{index.es-DFpbuPuY.js → index.es-DU7kQxBj.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{signer-RSvbDa7c.mjs → signer-Bxzj_sfg.mjs} +1 -1
- package/lib/{signer-CeSFiipD.js → signer-Oenym_zt.js} +1 -1
- package/lib/solana-BsoOVBn3.js +1 -0
- package/lib/{solana-DwgjV-W7.js → solana-Bwr_Oe17.js} +1 -1
- package/lib/{solana-ClVJj67l.mjs → solana-CvLCZYlJ.mjs} +4 -4
- package/lib/{solana-DmG1qAvz.mjs → solana-D7_c2sjy.mjs} +5 -5
- package/lib/{solanaEmbed.esm-Cu2iyuQy.mjs → solanaEmbed.esm-C5KdLEHG.mjs} +2 -2
- package/lib/{solanaEmbed.esm-DY919Dj0.js → solanaEmbed.esm-CrRRGcT6.js} +1 -1
- package/lib/src/config/constants.d.ts.map +1 -1
- package/lib/src/config/devnet/chains.d.ts.map +1 -1
- package/lib/src/config/devnet/index.d.ts.map +1 -1
- package/lib/src/config/devnet/rpcs.d.ts +0 -6
- package/lib/src/config/devnet/rpcs.d.ts.map +1 -1
- package/lib/src/config/index.d.ts.map +1 -1
- package/lib/src/config/mainnet/chains.d.ts.map +1 -1
- package/lib/src/config/mainnet/index.d.ts.map +1 -1
- package/lib/src/config/mainnet/rpcs.d.ts +0 -6
- package/lib/src/config/mainnet/rpcs.d.ts.map +1 -1
- package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
- package/lib/src/config/testnet/chains.d.ts.map +1 -1
- package/lib/src/config/testnet/index.d.ts.map +1 -1
- package/lib/src/config/testnet/rpcs.d.ts +0 -6
- package/lib/src/config/testnet/rpcs.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/config/tokens.d.ts +4 -0
- package/lib/src/config/tokens.d.ts.map +1 -1
- package/lib/src/config/types.d.ts +2 -9
- package/lib/src/config/types.d.ts.map +1 -1
- package/lib/src/contexts/TokensContext.d.ts +1 -0
- package/lib/src/contexts/TokensContext.d.ts.map +1 -1
- package/lib/src/icons/ChainIcons.d.ts.map +1 -1
- package/lib/src/icons/Chains/UNI.d.ts +4 -0
- package/lib/src/icons/Chains/UNI.d.ts.map +1 -0
- package/lib/src/icons/TokenIcons.d.ts.map +1 -1
- package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
- package/lib/src/sdklegacy/config/DEVNET.d.ts.map +1 -1
- package/lib/src/sdklegacy/config/MAINNET.d.ts.map +1 -1
- package/lib/src/sdklegacy/config/TESTNET.d.ts.map +1 -1
- package/lib/src/sdklegacy/types.d.ts +0 -4
- package/lib/src/sdklegacy/types.d.ts.map +1 -1
- package/lib/src/utils/sdkv2.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -1
- package/lib/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -1
- package/lib/{sui-D1lxvss1.mjs → sui-BQq3s7Q3.mjs} +5 -5
- package/lib/{sui-CIBoUTGj.mjs → sui-C7ivLHLu.mjs} +323 -319
- package/lib/{sui-BzgBbOVR.js → sui-CDzPbVuH.js} +2 -2
- package/lib/sui-CbH-5eUE.js +1 -0
- package/lib/{utf8-BZ7GX1-B.mjs → utf8-CDOzcEr-.mjs} +1 -1
- package/lib/{utf8-CQNNfvVV.js → utf8-Dez257K6.js} +1 -1
- package/package.json +20 -20
- package/dist/assets/sui-C-nd2a3Y.js +0 -1
- package/lib/solana-Bwjjv4LB.js +0 -1
- package/lib/sui-C0CqiXaB.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const k=require("./index-Br4OTc1S.js"),De=require("./index-DcKePNaA.js");function $n(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function Hn(e,n){n||(n=e.reduce((o,d)=>o+d.length,0));const r=$n(n);let f=0;for(const o of e)r.set(o,f),f+=o.length;return r}const vn={...De.identityBase,...De.base2,...De.base8,...De.base10,...De.base16,...De.base32,...De.base36,...De.base58,...De.base64,...De.base256emoji};function Gn(e,n,r,f){return{name:e,prefix:n,encoder:{name:e,prefix:n,encode:r},decoder:{decode:f}}}const Sn=Gn("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),qt=Gn("ascii","a",e=>{let n="a";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return n},e=>{e=e.substring(1);const n=$n(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}),Wn={utf8:Sn,"utf-8":Sn,hex:vn.base16,latin1:qt,ascii:qt,binary:qt,...vn};function ht(e,n="utf8"){const r=Wn[n];if(!r)throw new Error(`Unsupported encoding "${n}"`);return(n==="utf8"||n==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}function At(e,n="utf8"){const r=Wn[n];if(!r)throw new Error(`Unsupported encoding "${n}"`);return(n==="utf8"||n==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}var En=function(e,n,r){if(r||arguments.length===2)for(var f=0,o=n.length,d;f<o;f++)(d||!(f in n))&&(d||(d=Array.prototype.slice.call(n,0,f)),d[f]=n[f]);return e.concat(d||Array.prototype.slice.call(n))},qr=function(){function e(n,r,f){this.name=n,this.version=r,this.os=f,this.type="browser"}return e}(),Zr=function(){function e(n){this.version=n,this.type="node",this.name="node",this.os=k.dist.process.platform}return e}(),Qr=function(){function e(n,r,f,o){this.name=n,this.version=r,this.os=f,this.bot=o,this.type="bot-device"}return e}(),ei=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ti=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),ni=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,ri=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,In=3,ii=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",ni]],On=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function si(e){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ti:typeof navigator<"u"?ai(navigator.userAgent):ci()}function oi(e){return e!==""&&ii.reduce(function(n,r){var f=r[0],o=r[1];if(n)return n;var d=o.exec(e);return!!d&&[f,d]},!1)}function ai(e){var n=oi(e);if(!n)return null;var r=n[0],f=n[1];if(r==="searchbot")return new ei;var o=f[1]&&f[1].split(".").join("_").split("_").slice(0,3);o?o.length<In&&(o=En(En([],o,!0),ui(In-o.length),!0)):o=[];var d=o.join("."),E=fi(e),S=ri.exec(e);return S&&S[1]?new Qr(r,d,E,S[1]):new qr(r,d,E)}function fi(e){for(var n=0,r=On.length;n<r;n++){var f=On[n],o=f[0],d=f[1],E=d.exec(e);if(E)return o}return null}function ci(){var e=typeof k.dist.process<"u"&&k.dist.process.version;return e?new Zr(k.dist.process.version.slice(1)):null}function ui(e){for(var n=[],r=0;r<e;r++)n.push("0");return n}const li={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},di=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,hi=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,bi=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function gi(e,n){if(e==="__proto__"||e==="constructor"&&n&&typeof n=="object"&&"prototype"in n){yi(e);return}return n}function yi(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function zt(e,n={}){if(typeof e!="string")return e;const r=e.trim();if(e[0]==='"'&&e.endsWith('"')&&!e.includes("\\"))return r.slice(1,-1);if(r.length<=9){const f=r.toLowerCase();if(f==="true")return!0;if(f==="false")return!1;if(f==="undefined")return;if(f==="null")return null;if(f==="nan")return Number.NaN;if(f==="infinity")return Number.POSITIVE_INFINITY;if(f==="-infinity")return Number.NEGATIVE_INFINITY}if(!bi.test(e)){if(n.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(di.test(e)||hi.test(e)){if(n.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,gi)}return JSON.parse(e)}catch(f){if(n.strict)throw f;return e}}function pi(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function Te(e,...n){try{return pi(e(...n))}catch(r){return Promise.reject(r)}}function _i(e){const n=typeof e;return e===null||n!=="object"&&n!=="function"}function mi(e){const n=Object.getPrototypeOf(e);return!n||n.isPrototypeOf(Object)}function $t(e){if(_i(e))return String(e);if(mi(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return $t(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const tn="base64:";function xi(e){return typeof e=="string"?e:tn+Si(e)}function wi(e){return typeof e!="string"||!e.startsWith(tn)?e:vi(e.slice(tn.length))}function vi(e){return globalThis.Buffer?k.dist.Buffer.from(e,"base64"):Uint8Array.from(globalThis.atob(e),n=>n.codePointAt(0))}function Si(e){return globalThis.Buffer?k.dist.Buffer.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}function Ue(e){var n;return e&&((n=e.split("?")[0])==null?void 0:n.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Ei(...e){return Ue(e.join(":"))}function Kt(e){return e=Ue(e),e?e+":":""}const Ii="memory",Oi=()=>{const e=new Map;return{name:Ii,getInstance:()=>e,hasItem(n){return e.has(n)},getItem(n){return e.get(n)??null},getItemRaw(n){return e.get(n)??null},setItem(n,r){e.set(n,r)},setItemRaw(n,r){e.set(n,r)},removeItem(n){e.delete(n)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}};function Ti(e={}){const n={mounts:{"":e.driver||Oi()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=s=>{for(const u of n.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:n.mounts[u]};return{base:"",relativeKey:s,driver:n.mounts[""]}},f=(s,u)=>n.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:n.mounts[y]})),o=(s,u)=>{if(n.watching){u=Ue(u);for(const y of n.watchListeners)y(s,u)}},d=async()=>{if(!n.watching){n.watching=!0;for(const s in n.mounts)n.unwatch[s]=await Tn(n.mounts[s],o,s)}},E=async()=>{if(n.watching){for(const s in n.unwatch)await n.unwatch[s]();n.unwatch={},n.watching=!1}},S=(s,u,y)=>{const v=new Map,w=x=>{let j=v.get(x.base);return j||(j={driver:x.driver,base:x.base,items:[]},v.set(x.base,j)),j};for(const x of s){const j=typeof x=="string",H=Ue(j?x:x.key),ue=j?void 0:x.value,M=j||!x.options?u:{...u,...x.options},Ae=r(H);w(Ae).items.push({key:H,value:ue,relativeKey:Ae.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Ue(s);const{relativeKey:y,driver:v}=r(s);return Te(v.hasItem,y,u)},getItem(s,u={}){s=Ue(s);const{relativeKey:y,driver:v}=r(s);return Te(v.getItem,y,u).then(w=>zt(w))},getItems(s,u={}){return S(s,u,y=>y.driver.getItems?Te(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:Ei(y.base,w.key),value:zt(w.value)}))):Promise.all(y.items.map(v=>Te(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:zt(w)})))))},getItemRaw(s,u={}){s=Ue(s);const{relativeKey:y,driver:v}=r(s);return v.getItemRaw?Te(v.getItemRaw,y,u):Te(v.getItem,y,u).then(w=>wi(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Ue(s);const{relativeKey:v,driver:w}=r(s);w.setItem&&(await Te(w.setItem,v,$t(u),y),w.watch||o("update",s))},async setItems(s,u){await S(s,u,async y=>{if(y.driver.setItems)return Te(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:$t(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Te(y.driver.setItem,v.relativeKey,$t(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Ue(s);const{relativeKey:v,driver:w}=r(s);if(w.setItemRaw)await Te(w.setItemRaw,v,u,y);else if(w.setItem)await Te(w.setItem,v,xi(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Ue(s);const{relativeKey:y,driver:v}=r(s);v.removeItem&&(await Te(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Te(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Ue(s);const{relativeKey:y,driver:v}=r(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Te(v.getMeta,y,u)),!u.nativeOnly){const x=await Te(v.getItem,y+"$",u).then(j=>zt(j));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=Kt(s);const y=f(s,!0);let v=[];const w=[];for(const x of y){const j=await Te(x.driver.getKeys,x.relativeBase,u);for(const H of j){const ue=x.mountpoint+Ue(H);v.some(M=>ue.startsWith(M))||w.push(ue)}v=[x.mountpoint,...v.filter(H=>!H.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=Kt(s),await Promise.all(f(s,!1).map(async y=>{if(y.driver.clear)return Te(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(n.mounts).map(s=>An(s)))},async watch(s){return await d(),n.watchListeners.push(s),async()=>{n.watchListeners=n.watchListeners.filter(u=>u!==s),n.watchListeners.length===0&&await E()}},async unwatch(){n.watchListeners=[],await E()},mount(s,u){if(s=Kt(s),s&&n.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(n.mountpoints.push(s),n.mountpoints.sort((y,v)=>v.length-y.length)),n.mounts[s]=u,n.watching&&Promise.resolve(Tn(u,o,s)).then(y=>{n.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){var y,v;s=Kt(s),!(!s||!n.mounts[s])&&(n.watching&&s in n.unwatch&&((v=(y=n.unwatch)[s])==null||v.call(y),delete n.unwatch[s]),u&&await An(n.mounts[s]),n.mountpoints=n.mountpoints.filter(w=>w!==s),delete n.mounts[s])},getMount(s=""){s=Ue(s)+":";const u=r(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Ue(s),f(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function Tn(e,n,r){return e.watch?e.watch((f,o)=>n(f,r+o)):()=>{}}async function An(e){typeof e.dispose=="function"&&await Te(e.dispose)}function bt(e){return new Promise((n,r)=>{e.oncomplete=e.onsuccess=()=>n(e.result),e.onabort=e.onerror=()=>r(e.error)})}function Fn(e,n){const r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(n);const f=bt(r);return(o,d)=>f.then(E=>d(E.transaction(n,o).objectStore(n)))}let Zt;function Lt(){return Zt||(Zt=Fn("keyval-store","keyval")),Zt}function Ln(e,n=Lt()){return n("readonly",r=>bt(r.get(e)))}function Ai(e,n,r=Lt()){return r("readwrite",f=>(f.put(n,e),bt(f.transaction)))}function Li(e,n=Lt()){return n("readwrite",r=>(r.delete(e),bt(r.transaction)))}function Ri(e=Lt()){return e("readwrite",n=>(n.clear(),bt(n.transaction)))}function Pi(e,n){return e.openCursor().onsuccess=function(){this.result&&(n(this.result),this.result.continue())},bt(e.transaction)}function Ci(e=Lt()){return e("readonly",n=>{if(n.getAllKeys)return bt(n.getAllKeys());const r=[];return Pi(n,f=>r.push(f.key)).then(()=>r)})}const Ni=e=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString()+"n":r),ji=e=>{const n=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=e.replace(n,'$1"$2n"$3');return JSON.parse(r,(f,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Jn(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return ji(e)}catch{return e}}function kn(e){return typeof e=="string"?e:Ni(e)||""}const Mi="idb-keyval";var Bi=(e={})=>{const n=e.base&&e.base.length>0?`${e.base}:`:"",r=o=>n+o;let f;return e.dbName&&e.storeName&&(f=Fn(e.dbName,e.storeName)),{name:Mi,options:e,async hasItem(o){return!(typeof await Ln(r(o),f)>"u")},async getItem(o){return await Ln(r(o),f)??null},setItem(o,d){return Ai(r(o),d,f)},removeItem(o){return Li(r(o),f)},getKeys(){return Ci(f)},clear(){return Ri(f)}}};const Di="WALLET_CONNECT_V2_INDEXED_DB",zi="keyvaluestorage";let Ki=class{constructor(){this.indexedDb=Ti({driver:Bi({dbName:Di,storeName:zi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(n=>[n.key,n.value])}async getItem(n){const r=await this.indexedDb.getItem(n);if(r!==null)return r}async setItem(n,r){await this.indexedDb.setItem(n,kn(r))}async removeItem(n){await this.indexedDb.removeItem(n)}};var Qt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof k.dist.global<"u"?k.dist.global:typeof self<"u"?self:{},Ht={exports:{}};(function(){let e;function n(){}e=n,e.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},e.prototype.setItem=function(r,f){this[r]=String(f)},e.prototype.removeItem=function(r){delete this[r]},e.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(f){r[f]=void 0,delete r[f]})},e.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qt<"u"&&Qt.localStorage?Ht.exports=Qt.localStorage:typeof window<"u"&&window.localStorage?Ht.exports=window.localStorage:Ht.exports=new n})();function Ui(e){var n;return[e[0],Jn((n=e[1])!=null?n:"")]}class $i{constructor(){this.localStorage=Ht.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ui)}async getItem(n){const r=this.localStorage.getItem(n);if(r!==null)return Jn(r)}async setItem(n,r){this.localStorage.setItem(n,kn(r))}async removeItem(n){this.localStorage.removeItem(n)}}const Hi="wc_storage_version",Rn=1,Gi=async(e,n,r)=>{const f=Hi,o=await n.getItem(f);if(o&&o>=Rn){r(n);return}const d=await e.getKeys();if(!d.length){r(n);return}const E=[];for(;d.length;){const S=d.shift();if(!S)continue;const g=S.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await e.getItem(S);await n.setItem(S,s),E.push(S)}}await n.setItem(f,Rn),r(n),Wi(e,E)},Wi=async(e,n)=>{n.length&&n.forEach(async r=>{await e.removeItem(r)})};class Fi{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const n=new $i;this.storage=n;try{const r=new Ki;Gi(n,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(n){return await this.initialize(),this.storage.getItem(n)}async setItem(n,r){return await this.initialize(),this.storage.setItem(n,r)}async removeItem(n){return await this.initialize(),this.storage.removeItem(n)}async initialize(){this.initialized||await new Promise(n=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),n())},20)})}}class Ji{}function ki(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var Vi=Xi;function Xi(e,n,r){var f=r&&r.stringify||ki,o=1;if(typeof e=="object"&&e!==null){var d=n.length+o;if(d===1)return e;var E=new Array(d);E[0]=f(e);for(var S=1;S<d;S++)E[S]=f(n[S]);return E.join(" ")}if(typeof e!="string")return e;var g=n.length;if(g===0)return e;for(var s="",u=1-o,y=-1,v=e&&e.length||0,w=0;w<v;){if(e.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,e.charCodeAt(w+1)){case 100:case 102:if(u>=g||n[u]==null)break;y<w&&(s+=e.slice(y,w)),s+=Number(n[u]),y=w+2,w++;break;case 105:if(u>=g||n[u]==null)break;y<w&&(s+=e.slice(y,w)),s+=Math.floor(Number(n[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||n[u]===void 0)break;y<w&&(s+=e.slice(y,w));var x=typeof n[u];if(x==="string"){s+="'"+n[u]+"'",y=w+2,w++;break}if(x==="function"){s+=n[u].name||"<anonymous>",y=w+2,w++;break}s+=f(n[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=e.slice(y,w)),s+=String(n[u]),y=w+2,w++;break;case 37:y<w&&(s+=e.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?e:(y<v&&(s+=e.slice(y)),s)}const Pn=Vi;var mt=Qe;const It=ss().console||{},Yi={mapHttpRequest:Ut,mapHttpResponse:Ut,wrapRequestSerializer:en,wrapResponseSerializer:en,wrapErrorSerializer:en,req:Ut,res:Ut,err:ts};function qi(e,n){return Array.isArray(e)?e.filter(function(f){return f!=="!stdSerializers.err"}):e===!0?Object.keys(n):!1}function Qe(e){e=e||{},e.browser=e.browser||{};const n=e.browser.transmit;if(n&&typeof n.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||It;e.browser.write&&(e.browser.asObject=!0);const f=e.serializers||{},o=qi(e.browser.serialize,f);let d=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(d=!1);const E=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),e.enabled===!1&&(e.level="silent");const S=e.level||"info",g=Object.create(r);g.log||(g.log=Ot),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:n,serialize:o,asObject:e.browser.asObject,levels:E,timestamp:ns(e)};g.levels=Qe.levels,g.level=S,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Ot,g.serializers=f,g._serialize=o,g._stdErrSerialize=d,g.child=w,n&&(g._logEvent=nn());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,pt(s,g,"error","log"),pt(s,g,"fatal","error"),pt(s,g,"warn","error"),pt(s,g,"info","log"),pt(s,g,"debug","log"),pt(s,g,"trace","log")}function w(x,j){if(!x)throw new Error("missing bindings for child Pino");j=j||{},o&&x.serializers&&(j.serializers=x.serializers);const H=j.serializers;if(o&&H){var ue=Object.assign({},f,H),M=e.browser.serialize===!0?Object.keys(ue):o;delete x.serializers,Vt([x],M,ue,this._stdErrSerialize)}function Ae(ge){this._childLevel=(ge._childLevel|0)+1,this.error=_t(ge,x,"error"),this.fatal=_t(ge,x,"fatal"),this.warn=_t(ge,x,"warn"),this.info=_t(ge,x,"info"),this.debug=_t(ge,x,"debug"),this.trace=_t(ge,x,"trace"),ue&&(this.serializers=ue,this._serialize=M),n&&(this._logEvent=nn([].concat(ge._logEvent.bindings,x)))}return Ae.prototype=this,new Ae(this)}return g}Qe.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qe.stdSerializers=Yi;Qe.stdTimeFunctions=Object.assign({},{nullTime:Vn,epochTime:Xn,unixTime:rs,isoTime:is});function pt(e,n,r,f){const o=Object.getPrototypeOf(n);n[r]=n.levelVal>n.levels.values[r]?Ot:o[r]?o[r]:It[r]||It[f]||Ot,Zi(e,n,r)}function Zi(e,n,r){!e.transmit&&n[r]===Ot||(n[r]=function(f){return function(){const d=e.timestamp(),E=new Array(arguments.length),S=Object.getPrototypeOf&&Object.getPrototypeOf(this)===It?It:this;for(var g=0;g<E.length;g++)E[g]=arguments[g];if(e.serialize&&!e.asObject&&Vt(E,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?f.call(S,Qi(this,r,E,d)):f.apply(S,E),e.transmit){const s=e.transmit.level||n.level,u=Qe.levels.values[s],y=Qe.levels.values[r];if(y<u)return;es(this,{ts:d,methodLevel:r,methodValue:y,transmitLevel:s,transmitValue:Qe.levels.values[e.transmit.level||n.level],send:e.transmit.send,val:n.levelVal},E)}}}(n[r]))}function Qi(e,n,r,f){e._serialize&&Vt(r,e._serialize,e.serializers,e._stdErrSerialize);const o=r.slice();let d=o[0];const E={};f&&(E.time=f),E.level=Qe.levels.values[n];let S=(e._childLevel|0)+1;if(S<1&&(S=1),d!==null&&typeof d=="object"){for(;S--&&typeof o[0]=="object";)Object.assign(E,o.shift());d=o.length?Pn(o.shift(),o):void 0}else typeof d=="string"&&(d=Pn(o.shift(),o));return d!==void 0&&(E.msg=d),E}function Vt(e,n,r,f){for(const o in e)if(f&&e[o]instanceof Error)e[o]=Qe.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o]))for(const d in e[o])n&&n.indexOf(d)>-1&&d in r&&(e[o][d]=r[d](e[o][d]))}function _t(e,n,r){return function(){const f=new Array(1+arguments.length);f[0]=n;for(var o=1;o<f.length;o++)f[o]=arguments[o-1];return e[r].apply(this,f)}}function es(e,n,r){const f=n.send,o=n.ts,d=n.methodLevel,E=n.methodValue,S=n.val,g=e._logEvent.bindings;Vt(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter(function(s){return g.indexOf(s)===-1}),e._logEvent.level.label=d,e._logEvent.level.value=E,f(d,e._logEvent,S),e._logEvent=nn(g)}function nn(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function ts(e){const n={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)n[r]===void 0&&(n[r]=e[r]);return n}function ns(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Vn:Xn}function Ut(){return{}}function en(e){return e}function Ot(){}function Vn(){return!1}function Xn(){return Date.now()}function rs(){return Math.round(Date.now()/1e3)}function is(){return new Date(Date.now()).toISOString()}function ss(){function e(n){return typeof n<"u"&&n}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}const an=k.getDefaultExportFromCjs(mt),os=e=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString()+"n":r);function Cn(e){return typeof e=="string"?e:os(e)||""}const as={level:"info"},Rt="custom_context",fn=1e3*1024;class fs{constructor(n){this.nodeValue=n,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Nn{constructor(n){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=n,this.sizeInBytes=0}append(n){const r=new fs(n);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${n} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const n=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=n.size}toArray(){const n=[];let r=this.head;for(;r!==null;)n.push(r.value),r=r.next;return n}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let n=this.head;return{next:()=>{if(!n)return{done:!0,value:null};const r=n.value;return n=n.next,{done:!1,value:r}}}}}class Yn{constructor(n,r=fn){this.level=n??"error",this.levelValue=mt.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Nn(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(n,r){r===mt.levels.values.error?console.error(n):r===mt.levels.values.warn?console.warn(n):r===mt.levels.values.debug?console.debug(n):r===mt.levels.values.trace?console.trace(n):console.log(n)}appendToLogs(n){this.logs.append(Cn({timestamp:new Date().toISOString(),log:n}));const r=typeof n=="string"?JSON.parse(n).level:n.level;r>=this.levelValue&&this.forwardToConsole(n,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Nn(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(n){const r=this.getLogArray();return r.push(Cn({extraMetadata:n})),new Blob(r,{type:"application/json"})}}class cs{constructor(n,r=fn){this.baseChunkLogger=new Yn(n,r)}write(n){this.baseChunkLogger.appendToLogs(n)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(n){return this.baseChunkLogger.logsToBlob(n)}downloadLogsBlobInBrowser(n){const r=URL.createObjectURL(this.logsToBlob(n)),f=document.createElement("a");f.href=r,f.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(r)}}class us{constructor(n,r=fn){this.baseChunkLogger=new Yn(n,r)}write(n){this.baseChunkLogger.appendToLogs(n)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(n){return this.baseChunkLogger.logsToBlob(n)}}var ls=Object.defineProperty,ds=Object.defineProperties,hs=Object.getOwnPropertyDescriptors,jn=Object.getOwnPropertySymbols,bs=Object.prototype.hasOwnProperty,gs=Object.prototype.propertyIsEnumerable,Mn=(e,n,r)=>n in e?ls(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,Gt=(e,n)=>{for(var r in n||(n={}))bs.call(n,r)&&Mn(e,r,n[r]);if(jn)for(var r of jn(n))gs.call(n,r)&&Mn(e,r,n[r]);return e},Wt=(e,n)=>ds(e,hs(n));function ys(e){return Wt(Gt({},e),{level:(e==null?void 0:e.level)||as.level})}function ps(e,n=Rt){return e[n]||""}function _s(e,n,r=Rt){return e[r]=n,e}function qn(e,n=Rt){let r="";return typeof e.bindings>"u"?r=ps(e,n):r=e.bindings().context||"",r}function ms(e,n,r=Rt){const f=qn(e,r);return f.trim()?`${f}/${n}`:n}function xs(e,n,r=Rt){const f=ms(e,n,r),o=e.child({context:f});return _s(o,f,r)}function ws(e){var n,r;const f=new cs((n=e.opts)==null?void 0:n.level,e.maxSizeInBytes);return{logger:an(Wt(Gt({},e.opts),{level:"trace",browser:Wt(Gt({},(r=e.opts)==null?void 0:r.browser),{write:o=>f.write(o)})})),chunkLoggerController:f}}function vs(e){var n;const r=new us((n=e.opts)==null?void 0:n.level,e.maxSizeInBytes);return{logger:an(Wt(Gt({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}function Ss(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?ws(e):vs(e)}var cn={},Zn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var n=De.binary,r=De.wipe;e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var f=function(){function S(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return S.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},S.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},S.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},S.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(d(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=d(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},S.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;n.writeUint32BE(y,this._buffer,w-8),n.writeUint32BE(v,this._buffer,w-4),d(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)n.writeUint32BE(this._stateHi[x],g,x*8),n.writeUint32BE(this._stateLo[x],g,x*8+4);return this},S.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},S.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},S.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},S.prototype.cleanSavedState=function(g){r.wipe(g.stateHi),r.wipe(g.stateLo),g.buffer&&r.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},S}();e.SHA512=f;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function d(S,g,s,u,y,v,w){for(var x=s[0],j=s[1],H=s[2],ue=s[3],M=s[4],Ae=s[5],ge=s[6],Ne=s[7],G=u[0],N=u[1],je=u[2],et=u[3],ye=u[4],Je=u[5],$e=u[6],Xe=u[7],m,_,Y,le,L,I,O,A;w>=128;){for(var Le=0;Le<16;Le++){var ne=8*Le+v;S[Le]=n.readUint32BE(y,ne),g[Le]=n.readUint32BE(y,ne+4)}for(var Le=0;Le<80;Le++){var xt=x,B=j,gt=H,b=ue,h=M,l=Ae,t=ge,a=Ne,R=G,P=N,z=je,K=et,D=ye,U=Je,Re=$e,de=Xe;if(m=Ne,_=Xe,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=(M>>>14|ye<<18)^(M>>>18|ye<<14)^(ye>>>9|M<<23),_=(ye>>>14|M<<18)^(ye>>>18|M<<14)^(M>>>9|ye<<23),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=M&Ae^~M&ge,_=ye&Je^~ye&$e,L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=o[Le*2],_=o[Le*2+1],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=S[Le%16],_=g[Le%16],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,Y=O&65535|A<<16,le=L&65535|I<<16,m=Y,_=le,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=(x>>>28|G<<4)^(G>>>2|x<<30)^(G>>>7|x<<25),_=(G>>>28|x<<4)^(x>>>2|G<<30)^(x>>>7|G<<25),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=x&j^x&H^j&H,_=G&N^G&je^N&je,L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,a=O&65535|A<<16,de=L&65535|I<<16,m=b,_=K,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=Y,_=le,L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,b=O&65535|A<<16,K=L&65535|I<<16,j=xt,H=B,ue=gt,M=b,Ae=h,ge=l,Ne=t,x=a,N=R,je=P,et=z,ye=K,Je=D,$e=U,Xe=Re,G=de,Le%16===15)for(var ne=0;ne<16;ne++)m=S[ne],_=g[ne],L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=S[(ne+9)%16],_=g[(ne+9)%16],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,Y=S[(ne+1)%16],le=g[(ne+1)%16],m=(Y>>>1|le<<31)^(Y>>>8|le<<24)^Y>>>7,_=(le>>>1|Y<<31)^(le>>>8|Y<<24)^(le>>>7|Y<<25),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,Y=S[(ne+14)%16],le=g[(ne+14)%16],m=(Y>>>19|le<<13)^(le>>>29|Y<<3)^Y>>>6,_=(le>>>19|Y<<13)^(Y>>>29|le<<3)^(le>>>6|Y<<26),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,S[ne]=O&65535|A<<16,g[ne]=L&65535|I<<16}m=x,_=G,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[0],_=u[0],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[0]=x=O&65535|A<<16,u[0]=G=L&65535|I<<16,m=j,_=N,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[1],_=u[1],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[1]=j=O&65535|A<<16,u[1]=N=L&65535|I<<16,m=H,_=je,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[2],_=u[2],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[2]=H=O&65535|A<<16,u[2]=je=L&65535|I<<16,m=ue,_=et,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[3],_=u[3],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[3]=ue=O&65535|A<<16,u[3]=et=L&65535|I<<16,m=M,_=ye,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[4],_=u[4],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[4]=M=O&65535|A<<16,u[4]=ye=L&65535|I<<16,m=Ae,_=Je,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[5],_=u[5],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[5]=Ae=O&65535|A<<16,u[5]=Je=L&65535|I<<16,m=ge,_=$e,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[6],_=u[6],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[6]=ge=O&65535|A<<16,u[6]=$e=L&65535|I<<16,m=Ne,_=Xe,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[7],_=u[7],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[7]=Ne=O&65535|A<<16,u[7]=Xe=L&65535|I<<16,v+=128,w-=128}return v}function E(S){var g=new f;g.update(S);var s=g.digest();return g.clean(),s}e.hash=E})(Zn);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.convertSecretKeyToX25519=e.convertPublicKeyToX25519=e.verify=e.sign=e.extractPublicKeyFromSecretKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.SEED_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=e.SIGNATURE_LENGTH=void 0;const n=De.random,r=Zn,f=De.wipe;e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.SEED_LENGTH=32;function o(b){const h=new Float64Array(16);if(b)for(let l=0;l<b.length;l++)h[l]=b[l];return h}const d=new Uint8Array(32);d[0]=9;const E=o(),S=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(b,h){for(let l=0;l<16;l++)b[l]=h[l]|0}function x(b){let h=1;for(let l=0;l<16;l++){let t=b[l]+h+65535;h=Math.floor(t/65536),b[l]=t-h*65536}b[0]+=h-1+37*(h-1)}function j(b,h,l){const t=~(l-1);for(let a=0;a<16;a++){const R=t&(b[a]^h[a]);b[a]^=R,h[a]^=R}}function H(b,h){const l=o(),t=o();for(let a=0;a<16;a++)t[a]=h[a];x(t),x(t),x(t);for(let a=0;a<2;a++){l[0]=t[0]-65517;for(let P=1;P<15;P++)l[P]=t[P]-65535-(l[P-1]>>16&1),l[P-1]&=65535;l[15]=t[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,j(t,l,1-R)}for(let a=0;a<16;a++)b[2*a]=t[a]&255,b[2*a+1]=t[a]>>8}function ue(b,h){let l=0;for(let t=0;t<32;t++)l|=b[t]^h[t];return(1&l-1>>>8)-1}function M(b,h){const l=new Uint8Array(32),t=new Uint8Array(32);return H(l,b),H(t,h),ue(l,t)}function Ae(b){const h=new Uint8Array(32);return H(h,b),h[0]&1}function ge(b,h){for(let l=0;l<16;l++)b[l]=h[2*l]+(h[2*l+1]<<8);b[15]&=32767}function Ne(b,h,l){for(let t=0;t<16;t++)b[t]=h[t]+l[t]}function G(b,h,l){for(let t=0;t<16;t++)b[t]=h[t]-l[t]}function N(b,h,l){let t,a,R=0,P=0,z=0,K=0,D=0,U=0,Re=0,de=0,Pe=0,pe=0,he=0,re=0,te=0,q=0,V=0,$=0,ie=0,_e=0,W=0,Me=0,ze=0,He=0,Ge=0,Ke=0,Ye=0,Ze=0,st=0,We=0,ct=0,wt=0,Pt=0,se=l[0],Z=l[1],oe=l[2],ae=l[3],fe=l[4],Q=l[5],me=l[6],xe=l[7],we=l[8],ve=l[9],Se=l[10],be=l[11],ce=l[12],J=l[13],Ee=l[14],Ie=l[15];t=h[0],R+=t*se,P+=t*Z,z+=t*oe,K+=t*ae,D+=t*fe,U+=t*Q,Re+=t*me,de+=t*xe,Pe+=t*we,pe+=t*ve,he+=t*Se,re+=t*be,te+=t*ce,q+=t*J,V+=t*Ee,$+=t*Ie,t=h[1],P+=t*se,z+=t*Z,K+=t*oe,D+=t*ae,U+=t*fe,Re+=t*Q,de+=t*me,Pe+=t*xe,pe+=t*we,he+=t*ve,re+=t*Se,te+=t*be,q+=t*ce,V+=t*J,$+=t*Ee,ie+=t*Ie,t=h[2],z+=t*se,K+=t*Z,D+=t*oe,U+=t*ae,Re+=t*fe,de+=t*Q,Pe+=t*me,pe+=t*xe,he+=t*we,re+=t*ve,te+=t*Se,q+=t*be,V+=t*ce,$+=t*J,ie+=t*Ee,_e+=t*Ie,t=h[3],K+=t*se,D+=t*Z,U+=t*oe,Re+=t*ae,de+=t*fe,Pe+=t*Q,pe+=t*me,he+=t*xe,re+=t*we,te+=t*ve,q+=t*Se,V+=t*be,$+=t*ce,ie+=t*J,_e+=t*Ee,W+=t*Ie,t=h[4],D+=t*se,U+=t*Z,Re+=t*oe,de+=t*ae,Pe+=t*fe,pe+=t*Q,he+=t*me,re+=t*xe,te+=t*we,q+=t*ve,V+=t*Se,$+=t*be,ie+=t*ce,_e+=t*J,W+=t*Ee,Me+=t*Ie,t=h[5],U+=t*se,Re+=t*Z,de+=t*oe,Pe+=t*ae,pe+=t*fe,he+=t*Q,re+=t*me,te+=t*xe,q+=t*we,V+=t*ve,$+=t*Se,ie+=t*be,_e+=t*ce,W+=t*J,Me+=t*Ee,ze+=t*Ie,t=h[6],Re+=t*se,de+=t*Z,Pe+=t*oe,pe+=t*ae,he+=t*fe,re+=t*Q,te+=t*me,q+=t*xe,V+=t*we,$+=t*ve,ie+=t*Se,_e+=t*be,W+=t*ce,Me+=t*J,ze+=t*Ee,He+=t*Ie,t=h[7],de+=t*se,Pe+=t*Z,pe+=t*oe,he+=t*ae,re+=t*fe,te+=t*Q,q+=t*me,V+=t*xe,$+=t*we,ie+=t*ve,_e+=t*Se,W+=t*be,Me+=t*ce,ze+=t*J,He+=t*Ee,Ge+=t*Ie,t=h[8],Pe+=t*se,pe+=t*Z,he+=t*oe,re+=t*ae,te+=t*fe,q+=t*Q,V+=t*me,$+=t*xe,ie+=t*we,_e+=t*ve,W+=t*Se,Me+=t*be,ze+=t*ce,He+=t*J,Ge+=t*Ee,Ke+=t*Ie,t=h[9],pe+=t*se,he+=t*Z,re+=t*oe,te+=t*ae,q+=t*fe,V+=t*Q,$+=t*me,ie+=t*xe,_e+=t*we,W+=t*ve,Me+=t*Se,ze+=t*be,He+=t*ce,Ge+=t*J,Ke+=t*Ee,Ye+=t*Ie,t=h[10],he+=t*se,re+=t*Z,te+=t*oe,q+=t*ae,V+=t*fe,$+=t*Q,ie+=t*me,_e+=t*xe,W+=t*we,Me+=t*ve,ze+=t*Se,He+=t*be,Ge+=t*ce,Ke+=t*J,Ye+=t*Ee,Ze+=t*Ie,t=h[11],re+=t*se,te+=t*Z,q+=t*oe,V+=t*ae,$+=t*fe,ie+=t*Q,_e+=t*me,W+=t*xe,Me+=t*we,ze+=t*ve,He+=t*Se,Ge+=t*be,Ke+=t*ce,Ye+=t*J,Ze+=t*Ee,st+=t*Ie,t=h[12],te+=t*se,q+=t*Z,V+=t*oe,$+=t*ae,ie+=t*fe,_e+=t*Q,W+=t*me,Me+=t*xe,ze+=t*we,He+=t*ve,Ge+=t*Se,Ke+=t*be,Ye+=t*ce,Ze+=t*J,st+=t*Ee,We+=t*Ie,t=h[13],q+=t*se,V+=t*Z,$+=t*oe,ie+=t*ae,_e+=t*fe,W+=t*Q,Me+=t*me,ze+=t*xe,He+=t*we,Ge+=t*ve,Ke+=t*Se,Ye+=t*be,Ze+=t*ce,st+=t*J,We+=t*Ee,ct+=t*Ie,t=h[14],V+=t*se,$+=t*Z,ie+=t*oe,_e+=t*ae,W+=t*fe,Me+=t*Q,ze+=t*me,He+=t*xe,Ge+=t*we,Ke+=t*ve,Ye+=t*Se,Ze+=t*be,st+=t*ce,We+=t*J,ct+=t*Ee,wt+=t*Ie,t=h[15],$+=t*se,ie+=t*Z,_e+=t*oe,W+=t*ae,Me+=t*fe,ze+=t*Q,He+=t*me,Ge+=t*xe,Ke+=t*we,Ye+=t*ve,Ze+=t*Se,st+=t*be,We+=t*ce,ct+=t*J,wt+=t*Ee,Pt+=t*Ie,R+=38*ie,P+=38*_e,z+=38*W,K+=38*Me,D+=38*ze,U+=38*He,Re+=38*Ge,de+=38*Ke,Pe+=38*Ye,pe+=38*Ze,he+=38*st,re+=38*We,te+=38*ct,q+=38*wt,V+=38*Pt,a=1,t=R+a+65535,a=Math.floor(t/65536),R=t-a*65536,t=P+a+65535,a=Math.floor(t/65536),P=t-a*65536,t=z+a+65535,a=Math.floor(t/65536),z=t-a*65536,t=K+a+65535,a=Math.floor(t/65536),K=t-a*65536,t=D+a+65535,a=Math.floor(t/65536),D=t-a*65536,t=U+a+65535,a=Math.floor(t/65536),U=t-a*65536,t=Re+a+65535,a=Math.floor(t/65536),Re=t-a*65536,t=de+a+65535,a=Math.floor(t/65536),de=t-a*65536,t=Pe+a+65535,a=Math.floor(t/65536),Pe=t-a*65536,t=pe+a+65535,a=Math.floor(t/65536),pe=t-a*65536,t=he+a+65535,a=Math.floor(t/65536),he=t-a*65536,t=re+a+65535,a=Math.floor(t/65536),re=t-a*65536,t=te+a+65535,a=Math.floor(t/65536),te=t-a*65536,t=q+a+65535,a=Math.floor(t/65536),q=t-a*65536,t=V+a+65535,a=Math.floor(t/65536),V=t-a*65536,t=$+a+65535,a=Math.floor(t/65536),$=t-a*65536,R+=a-1+37*(a-1),a=1,t=R+a+65535,a=Math.floor(t/65536),R=t-a*65536,t=P+a+65535,a=Math.floor(t/65536),P=t-a*65536,t=z+a+65535,a=Math.floor(t/65536),z=t-a*65536,t=K+a+65535,a=Math.floor(t/65536),K=t-a*65536,t=D+a+65535,a=Math.floor(t/65536),D=t-a*65536,t=U+a+65535,a=Math.floor(t/65536),U=t-a*65536,t=Re+a+65535,a=Math.floor(t/65536),Re=t-a*65536,t=de+a+65535,a=Math.floor(t/65536),de=t-a*65536,t=Pe+a+65535,a=Math.floor(t/65536),Pe=t-a*65536,t=pe+a+65535,a=Math.floor(t/65536),pe=t-a*65536,t=he+a+65535,a=Math.floor(t/65536),he=t-a*65536,t=re+a+65535,a=Math.floor(t/65536),re=t-a*65536,t=te+a+65535,a=Math.floor(t/65536),te=t-a*65536,t=q+a+65535,a=Math.floor(t/65536),q=t-a*65536,t=V+a+65535,a=Math.floor(t/65536),V=t-a*65536,t=$+a+65535,a=Math.floor(t/65536),$=t-a*65536,R+=a-1+37*(a-1),b[0]=R,b[1]=P,b[2]=z,b[3]=K,b[4]=D,b[5]=U,b[6]=Re,b[7]=de,b[8]=Pe,b[9]=pe,b[10]=he,b[11]=re,b[12]=te,b[13]=q,b[14]=V,b[15]=$}function je(b,h){N(b,h,h)}function et(b,h){const l=o();let t;for(t=0;t<16;t++)l[t]=h[t];for(t=253;t>=0;t--)je(l,l),t!==2&&t!==4&&N(l,l,h);for(t=0;t<16;t++)b[t]=l[t]}function ye(b,h){const l=o();let t;for(t=0;t<16;t++)l[t]=h[t];for(t=250;t>=0;t--)je(l,l),t!==1&&N(l,l,h);for(t=0;t<16;t++)b[t]=l[t]}function Je(b,h){const l=o(),t=o(),a=o(),R=o(),P=o(),z=o(),K=o(),D=o(),U=o();G(l,b[1],b[0]),G(U,h[1],h[0]),N(l,l,U),Ne(t,b[0],b[1]),Ne(U,h[0],h[1]),N(t,t,U),N(a,b[3],h[3]),N(a,a,s),N(R,b[2],h[2]),Ne(R,R,R),G(P,t,l),G(z,R,a),Ne(K,R,a),Ne(D,t,l),N(b[0],P,z),N(b[1],D,K),N(b[2],K,z),N(b[3],P,D)}function $e(b,h,l){for(let t=0;t<4;t++)j(b[t],h[t],l)}function Xe(b,h){const l=o(),t=o(),a=o();et(a,h[2]),N(l,h[0],a),N(t,h[1],a),H(b,t),b[31]^=Ae(l)<<7}function m(b,h,l){w(b[0],E),w(b[1],S),w(b[2],S),w(b[3],E);for(let t=255;t>=0;--t){const a=l[t/8|0]>>(t&7)&1;$e(b,h,a),Je(h,b),Je(b,b),$e(b,h,a)}}function _(b,h){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],S),N(l[3],u,y),m(b,l,h)}function Y(b){if(b.length!==e.SEED_LENGTH)throw new Error(`ed25519: seed must be ${e.SEED_LENGTH} bytes`);const h=(0,r.hash)(b);h[0]&=248,h[31]&=127,h[31]|=64;const l=new Uint8Array(32),t=[o(),o(),o(),o()];_(t,h),Xe(l,t);const a=new Uint8Array(64);return a.set(b),a.set(l,32),{publicKey:l,secretKey:a}}e.generateKeyPairFromSeed=Y;function le(b){const h=(0,n.randomBytes)(32,b),l=Y(h);return(0,f.wipe)(h),l}e.generateKeyPair=le;function L(b){if(b.length!==e.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(b.subarray(32))}e.extractPublicKeyFromSecretKey=L;const I=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(b,h){let l,t,a,R;for(t=63;t>=32;--t){for(l=0,a=t-32,R=t-12;a<R;++a)h[a]+=l-16*h[t]*I[a-(t-32)],l=Math.floor((h[a]+128)/256),h[a]-=l*256;h[a]+=l,h[t]=0}for(l=0,a=0;a<32;a++)h[a]+=l-(h[31]>>4)*I[a],l=h[a]>>8,h[a]&=255;for(a=0;a<32;a++)h[a]-=l*I[a];for(t=0;t<32;t++)h[t+1]+=h[t]>>8,b[t]=h[t]&255}function A(b){const h=new Float64Array(64);for(let l=0;l<64;l++)h[l]=b[l];for(let l=0;l<64;l++)b[l]=0;O(b,h)}function Le(b,h){const l=new Float64Array(64),t=[o(),o(),o(),o()],a=(0,r.hash)(b.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const P=new r.SHA512;P.update(R.subarray(32)),P.update(h);const z=P.digest();P.clean(),A(z),_(t,z),Xe(R,t),P.reset(),P.update(R.subarray(0,32)),P.update(b.subarray(32)),P.update(h);const K=P.digest();A(K);for(let D=0;D<32;D++)l[D]=z[D];for(let D=0;D<32;D++)for(let U=0;U<32;U++)l[D+U]+=K[D]*a[U];return O(R.subarray(32),l),R}e.sign=Le;function ne(b,h){const l=o(),t=o(),a=o(),R=o(),P=o(),z=o(),K=o();return w(b[2],S),ge(b[1],h),je(a,b[1]),N(R,a,g),G(a,a,b[2]),Ne(R,b[2],R),je(P,R),je(z,P),N(K,z,P),N(l,K,a),N(l,l,R),ye(l,l),N(l,l,a),N(l,l,R),N(l,l,R),N(b[0],l,R),je(t,b[0]),N(t,t,R),M(t,a)&&N(b[0],b[0],v),je(t,b[0]),N(t,t,R),M(t,a)?-1:(Ae(b[0])===h[31]>>7&&G(b[0],E,b[0]),N(b[3],b[0],b[1]),0)}function xt(b,h,l){const t=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==e.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);if(ne(R,b))return!1;const P=new r.SHA512;P.update(l.subarray(0,32)),P.update(b),P.update(h);const z=P.digest();return A(z),m(a,R,z),_(R,l.subarray(32)),Je(a,R),Xe(t,a),!ue(l,t)}e.verify=xt;function B(b){let h=[o(),o(),o(),o()];if(ne(h,b))throw new Error("Ed25519: invalid public key");let l=o(),t=o(),a=h[1];Ne(l,S,a),G(t,S,a),et(t,t),N(l,l,t);let R=new Uint8Array(32);return H(R,l),R}e.convertPublicKeyToX25519=B;function gt(b){const h=(0,r.hash)(b.subarray(0,32));h[0]&=248,h[31]&=127,h[31]|=64;const l=new Uint8Array(h.subarray(0,32));return(0,f.wipe)(h),l}e.convertSecretKeyToX25519=gt})(cn);const Es="EdDSA",Is="JWT",Ft=".",Xt="base64url",Qn="utf8",er="utf8",Os=":",Ts="did",As="key",Bn="base58btc",Ls="z",Rs="K36",Ps=32,Cs=e=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString()+"n":r),Ns=e=>{const n=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=e.replace(n,'$1"$2n"$3');return JSON.parse(r,(f,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function js(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return Ns(e)}catch{return e}}function Ms(e){return typeof e=="string"?e:Cs(e)||""}function Dn(e){return js(At(ht(e,Xt),Qn))}function Jt(e){return At(ht(Ms(e),Qn),Xt)}function tr(e){const n=ht(Rs,Bn),r=Ls+At(Hn([n,e]),Bn);return[Ts,As,r].join(Os)}function Bs(e){return At(e,Xt)}function Ds(e){return ht(e,Xt)}function zs(e){return ht([Jt(e.header),Jt(e.payload)].join(Ft),er)}function Ks(e){return[Jt(e.header),Jt(e.payload),Bs(e.signature)].join(Ft)}function Us(e){const n=e.split(Ft),r=Dn(n[0]),f=Dn(n[1]),o=Ds(n[2]),d=ht(n.slice(0,2).join(Ft),er);return{header:r,payload:f,signature:o,data:d}}function $s(e=De.random.randomBytes(Ps)){return cn.generateKeyPairFromSeed(e)}async function Hs(e,n,r,f,o=De.cjs.fromMiliseconds(Date.now())){const d={alg:Es,typ:Is},E=tr(f.publicKey),S=o+r,g={iss:E,sub:e,aud:n,iat:o,exp:S},s=zs({header:d,payload:g}),u=cn.sign(f.secretKey,s);return Ks({header:d,payload:g,signature:u})}const Gs="PARSE_ERROR",Ws="INVALID_REQUEST",Fs="METHOD_NOT_FOUND",Js="INVALID_PARAMS",nr="INTERNAL_ERROR",un="SERVER_ERROR",ks=[-32700,-32600,-32601,-32602,-32603],Et={[Gs]:{code:-32700,message:"Parse error"},[Ws]:{code:-32600,message:"Invalid Request"},[Fs]:{code:-32601,message:"Method not found"},[Js]:{code:-32602,message:"Invalid params"},[nr]:{code:-32603,message:"Internal error"},[un]:{code:-32e3,message:"Server error"}},rr=un;function Vs(e){return ks.includes(e)}function zn(e){return Object.keys(Et).includes(e)?Et[e]:Et[rr]}function Xs(e){const n=Object.values(Et).find(r=>r.code===e);return n||Et[rr]}function Ys(e,n,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${n}`):e}var ir={};/*! *****************************************************************************
|
|
1
|
+
"use strict";const k=require("./index-BBfGNpdz.js"),De=require("./index-Cajic-Zj.js");function $n(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function Hn(e,n){n||(n=e.reduce((o,d)=>o+d.length,0));const r=$n(n);let f=0;for(const o of e)r.set(o,f),f+=o.length;return r}const vn={...De.identityBase,...De.base2,...De.base8,...De.base10,...De.base16,...De.base32,...De.base36,...De.base58,...De.base64,...De.base256emoji};function Gn(e,n,r,f){return{name:e,prefix:n,encoder:{name:e,prefix:n,encode:r},decoder:{decode:f}}}const Sn=Gn("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),qt=Gn("ascii","a",e=>{let n="a";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return n},e=>{e=e.substring(1);const n=$n(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}),Wn={utf8:Sn,"utf-8":Sn,hex:vn.base16,latin1:qt,ascii:qt,binary:qt,...vn};function ht(e,n="utf8"){const r=Wn[n];if(!r)throw new Error(`Unsupported encoding "${n}"`);return(n==="utf8"||n==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}function At(e,n="utf8"){const r=Wn[n];if(!r)throw new Error(`Unsupported encoding "${n}"`);return(n==="utf8"||n==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}var En=function(e,n,r){if(r||arguments.length===2)for(var f=0,o=n.length,d;f<o;f++)(d||!(f in n))&&(d||(d=Array.prototype.slice.call(n,0,f)),d[f]=n[f]);return e.concat(d||Array.prototype.slice.call(n))},qr=function(){function e(n,r,f){this.name=n,this.version=r,this.os=f,this.type="browser"}return e}(),Zr=function(){function e(n){this.version=n,this.type="node",this.name="node",this.os=k.dist.process.platform}return e}(),Qr=function(){function e(n,r,f,o){this.name=n,this.version=r,this.os=f,this.bot=o,this.type="bot-device"}return e}(),ei=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ti=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),ni=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,ri=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,In=3,ii=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",ni]],On=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function si(e){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ti:typeof navigator<"u"?ai(navigator.userAgent):ci()}function oi(e){return e!==""&&ii.reduce(function(n,r){var f=r[0],o=r[1];if(n)return n;var d=o.exec(e);return!!d&&[f,d]},!1)}function ai(e){var n=oi(e);if(!n)return null;var r=n[0],f=n[1];if(r==="searchbot")return new ei;var o=f[1]&&f[1].split(".").join("_").split("_").slice(0,3);o?o.length<In&&(o=En(En([],o,!0),ui(In-o.length),!0)):o=[];var d=o.join("."),E=fi(e),S=ri.exec(e);return S&&S[1]?new Qr(r,d,E,S[1]):new qr(r,d,E)}function fi(e){for(var n=0,r=On.length;n<r;n++){var f=On[n],o=f[0],d=f[1],E=d.exec(e);if(E)return o}return null}function ci(){var e=typeof k.dist.process<"u"&&k.dist.process.version;return e?new Zr(k.dist.process.version.slice(1)):null}function ui(e){for(var n=[],r=0;r<e;r++)n.push("0");return n}const li={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},di=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,hi=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,bi=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function gi(e,n){if(e==="__proto__"||e==="constructor"&&n&&typeof n=="object"&&"prototype"in n){yi(e);return}return n}function yi(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function zt(e,n={}){if(typeof e!="string")return e;const r=e.trim();if(e[0]==='"'&&e.endsWith('"')&&!e.includes("\\"))return r.slice(1,-1);if(r.length<=9){const f=r.toLowerCase();if(f==="true")return!0;if(f==="false")return!1;if(f==="undefined")return;if(f==="null")return null;if(f==="nan")return Number.NaN;if(f==="infinity")return Number.POSITIVE_INFINITY;if(f==="-infinity")return Number.NEGATIVE_INFINITY}if(!bi.test(e)){if(n.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(di.test(e)||hi.test(e)){if(n.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,gi)}return JSON.parse(e)}catch(f){if(n.strict)throw f;return e}}function pi(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function Te(e,...n){try{return pi(e(...n))}catch(r){return Promise.reject(r)}}function _i(e){const n=typeof e;return e===null||n!=="object"&&n!=="function"}function mi(e){const n=Object.getPrototypeOf(e);return!n||n.isPrototypeOf(Object)}function $t(e){if(_i(e))return String(e);if(mi(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return $t(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const tn="base64:";function xi(e){return typeof e=="string"?e:tn+Si(e)}function wi(e){return typeof e!="string"||!e.startsWith(tn)?e:vi(e.slice(tn.length))}function vi(e){return globalThis.Buffer?k.dist.Buffer.from(e,"base64"):Uint8Array.from(globalThis.atob(e),n=>n.codePointAt(0))}function Si(e){return globalThis.Buffer?k.dist.Buffer.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}function Ue(e){var n;return e&&((n=e.split("?")[0])==null?void 0:n.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Ei(...e){return Ue(e.join(":"))}function Kt(e){return e=Ue(e),e?e+":":""}const Ii="memory",Oi=()=>{const e=new Map;return{name:Ii,getInstance:()=>e,hasItem(n){return e.has(n)},getItem(n){return e.get(n)??null},getItemRaw(n){return e.get(n)??null},setItem(n,r){e.set(n,r)},setItemRaw(n,r){e.set(n,r)},removeItem(n){e.delete(n)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}};function Ti(e={}){const n={mounts:{"":e.driver||Oi()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=s=>{for(const u of n.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:n.mounts[u]};return{base:"",relativeKey:s,driver:n.mounts[""]}},f=(s,u)=>n.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:n.mounts[y]})),o=(s,u)=>{if(n.watching){u=Ue(u);for(const y of n.watchListeners)y(s,u)}},d=async()=>{if(!n.watching){n.watching=!0;for(const s in n.mounts)n.unwatch[s]=await Tn(n.mounts[s],o,s)}},E=async()=>{if(n.watching){for(const s in n.unwatch)await n.unwatch[s]();n.unwatch={},n.watching=!1}},S=(s,u,y)=>{const v=new Map,w=x=>{let j=v.get(x.base);return j||(j={driver:x.driver,base:x.base,items:[]},v.set(x.base,j)),j};for(const x of s){const j=typeof x=="string",H=Ue(j?x:x.key),ue=j?void 0:x.value,M=j||!x.options?u:{...u,...x.options},Ae=r(H);w(Ae).items.push({key:H,value:ue,relativeKey:Ae.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Ue(s);const{relativeKey:y,driver:v}=r(s);return Te(v.hasItem,y,u)},getItem(s,u={}){s=Ue(s);const{relativeKey:y,driver:v}=r(s);return Te(v.getItem,y,u).then(w=>zt(w))},getItems(s,u={}){return S(s,u,y=>y.driver.getItems?Te(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:Ei(y.base,w.key),value:zt(w.value)}))):Promise.all(y.items.map(v=>Te(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:zt(w)})))))},getItemRaw(s,u={}){s=Ue(s);const{relativeKey:y,driver:v}=r(s);return v.getItemRaw?Te(v.getItemRaw,y,u):Te(v.getItem,y,u).then(w=>wi(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Ue(s);const{relativeKey:v,driver:w}=r(s);w.setItem&&(await Te(w.setItem,v,$t(u),y),w.watch||o("update",s))},async setItems(s,u){await S(s,u,async y=>{if(y.driver.setItems)return Te(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:$t(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Te(y.driver.setItem,v.relativeKey,$t(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Ue(s);const{relativeKey:v,driver:w}=r(s);if(w.setItemRaw)await Te(w.setItemRaw,v,u,y);else if(w.setItem)await Te(w.setItem,v,xi(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Ue(s);const{relativeKey:y,driver:v}=r(s);v.removeItem&&(await Te(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Te(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Ue(s);const{relativeKey:y,driver:v}=r(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Te(v.getMeta,y,u)),!u.nativeOnly){const x=await Te(v.getItem,y+"$",u).then(j=>zt(j));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=Kt(s);const y=f(s,!0);let v=[];const w=[];for(const x of y){const j=await Te(x.driver.getKeys,x.relativeBase,u);for(const H of j){const ue=x.mountpoint+Ue(H);v.some(M=>ue.startsWith(M))||w.push(ue)}v=[x.mountpoint,...v.filter(H=>!H.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=Kt(s),await Promise.all(f(s,!1).map(async y=>{if(y.driver.clear)return Te(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(n.mounts).map(s=>An(s)))},async watch(s){return await d(),n.watchListeners.push(s),async()=>{n.watchListeners=n.watchListeners.filter(u=>u!==s),n.watchListeners.length===0&&await E()}},async unwatch(){n.watchListeners=[],await E()},mount(s,u){if(s=Kt(s),s&&n.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(n.mountpoints.push(s),n.mountpoints.sort((y,v)=>v.length-y.length)),n.mounts[s]=u,n.watching&&Promise.resolve(Tn(u,o,s)).then(y=>{n.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){var y,v;s=Kt(s),!(!s||!n.mounts[s])&&(n.watching&&s in n.unwatch&&((v=(y=n.unwatch)[s])==null||v.call(y),delete n.unwatch[s]),u&&await An(n.mounts[s]),n.mountpoints=n.mountpoints.filter(w=>w!==s),delete n.mounts[s])},getMount(s=""){s=Ue(s)+":";const u=r(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Ue(s),f(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function Tn(e,n,r){return e.watch?e.watch((f,o)=>n(f,r+o)):()=>{}}async function An(e){typeof e.dispose=="function"&&await Te(e.dispose)}function bt(e){return new Promise((n,r)=>{e.oncomplete=e.onsuccess=()=>n(e.result),e.onabort=e.onerror=()=>r(e.error)})}function Fn(e,n){const r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(n);const f=bt(r);return(o,d)=>f.then(E=>d(E.transaction(n,o).objectStore(n)))}let Zt;function Lt(){return Zt||(Zt=Fn("keyval-store","keyval")),Zt}function Ln(e,n=Lt()){return n("readonly",r=>bt(r.get(e)))}function Ai(e,n,r=Lt()){return r("readwrite",f=>(f.put(n,e),bt(f.transaction)))}function Li(e,n=Lt()){return n("readwrite",r=>(r.delete(e),bt(r.transaction)))}function Ri(e=Lt()){return e("readwrite",n=>(n.clear(),bt(n.transaction)))}function Pi(e,n){return e.openCursor().onsuccess=function(){this.result&&(n(this.result),this.result.continue())},bt(e.transaction)}function Ci(e=Lt()){return e("readonly",n=>{if(n.getAllKeys)return bt(n.getAllKeys());const r=[];return Pi(n,f=>r.push(f.key)).then(()=>r)})}const Ni=e=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString()+"n":r),ji=e=>{const n=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=e.replace(n,'$1"$2n"$3');return JSON.parse(r,(f,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Jn(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return ji(e)}catch{return e}}function kn(e){return typeof e=="string"?e:Ni(e)||""}const Mi="idb-keyval";var Bi=(e={})=>{const n=e.base&&e.base.length>0?`${e.base}:`:"",r=o=>n+o;let f;return e.dbName&&e.storeName&&(f=Fn(e.dbName,e.storeName)),{name:Mi,options:e,async hasItem(o){return!(typeof await Ln(r(o),f)>"u")},async getItem(o){return await Ln(r(o),f)??null},setItem(o,d){return Ai(r(o),d,f)},removeItem(o){return Li(r(o),f)},getKeys(){return Ci(f)},clear(){return Ri(f)}}};const Di="WALLET_CONNECT_V2_INDEXED_DB",zi="keyvaluestorage";let Ki=class{constructor(){this.indexedDb=Ti({driver:Bi({dbName:Di,storeName:zi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(n=>[n.key,n.value])}async getItem(n){const r=await this.indexedDb.getItem(n);if(r!==null)return r}async setItem(n,r){await this.indexedDb.setItem(n,kn(r))}async removeItem(n){await this.indexedDb.removeItem(n)}};var Qt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof k.dist.global<"u"?k.dist.global:typeof self<"u"?self:{},Ht={exports:{}};(function(){let e;function n(){}e=n,e.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},e.prototype.setItem=function(r,f){this[r]=String(f)},e.prototype.removeItem=function(r){delete this[r]},e.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(f){r[f]=void 0,delete r[f]})},e.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qt<"u"&&Qt.localStorage?Ht.exports=Qt.localStorage:typeof window<"u"&&window.localStorage?Ht.exports=window.localStorage:Ht.exports=new n})();function Ui(e){var n;return[e[0],Jn((n=e[1])!=null?n:"")]}class $i{constructor(){this.localStorage=Ht.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ui)}async getItem(n){const r=this.localStorage.getItem(n);if(r!==null)return Jn(r)}async setItem(n,r){this.localStorage.setItem(n,kn(r))}async removeItem(n){this.localStorage.removeItem(n)}}const Hi="wc_storage_version",Rn=1,Gi=async(e,n,r)=>{const f=Hi,o=await n.getItem(f);if(o&&o>=Rn){r(n);return}const d=await e.getKeys();if(!d.length){r(n);return}const E=[];for(;d.length;){const S=d.shift();if(!S)continue;const g=S.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await e.getItem(S);await n.setItem(S,s),E.push(S)}}await n.setItem(f,Rn),r(n),Wi(e,E)},Wi=async(e,n)=>{n.length&&n.forEach(async r=>{await e.removeItem(r)})};class Fi{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const n=new $i;this.storage=n;try{const r=new Ki;Gi(n,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(n){return await this.initialize(),this.storage.getItem(n)}async setItem(n,r){return await this.initialize(),this.storage.setItem(n,r)}async removeItem(n){return await this.initialize(),this.storage.removeItem(n)}async initialize(){this.initialized||await new Promise(n=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),n())},20)})}}class Ji{}function ki(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var Vi=Xi;function Xi(e,n,r){var f=r&&r.stringify||ki,o=1;if(typeof e=="object"&&e!==null){var d=n.length+o;if(d===1)return e;var E=new Array(d);E[0]=f(e);for(var S=1;S<d;S++)E[S]=f(n[S]);return E.join(" ")}if(typeof e!="string")return e;var g=n.length;if(g===0)return e;for(var s="",u=1-o,y=-1,v=e&&e.length||0,w=0;w<v;){if(e.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,e.charCodeAt(w+1)){case 100:case 102:if(u>=g||n[u]==null)break;y<w&&(s+=e.slice(y,w)),s+=Number(n[u]),y=w+2,w++;break;case 105:if(u>=g||n[u]==null)break;y<w&&(s+=e.slice(y,w)),s+=Math.floor(Number(n[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||n[u]===void 0)break;y<w&&(s+=e.slice(y,w));var x=typeof n[u];if(x==="string"){s+="'"+n[u]+"'",y=w+2,w++;break}if(x==="function"){s+=n[u].name||"<anonymous>",y=w+2,w++;break}s+=f(n[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=e.slice(y,w)),s+=String(n[u]),y=w+2,w++;break;case 37:y<w&&(s+=e.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?e:(y<v&&(s+=e.slice(y)),s)}const Pn=Vi;var mt=Qe;const It=ss().console||{},Yi={mapHttpRequest:Ut,mapHttpResponse:Ut,wrapRequestSerializer:en,wrapResponseSerializer:en,wrapErrorSerializer:en,req:Ut,res:Ut,err:ts};function qi(e,n){return Array.isArray(e)?e.filter(function(f){return f!=="!stdSerializers.err"}):e===!0?Object.keys(n):!1}function Qe(e){e=e||{},e.browser=e.browser||{};const n=e.browser.transmit;if(n&&typeof n.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||It;e.browser.write&&(e.browser.asObject=!0);const f=e.serializers||{},o=qi(e.browser.serialize,f);let d=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(d=!1);const E=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),e.enabled===!1&&(e.level="silent");const S=e.level||"info",g=Object.create(r);g.log||(g.log=Ot),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:n,serialize:o,asObject:e.browser.asObject,levels:E,timestamp:ns(e)};g.levels=Qe.levels,g.level=S,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Ot,g.serializers=f,g._serialize=o,g._stdErrSerialize=d,g.child=w,n&&(g._logEvent=nn());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,pt(s,g,"error","log"),pt(s,g,"fatal","error"),pt(s,g,"warn","error"),pt(s,g,"info","log"),pt(s,g,"debug","log"),pt(s,g,"trace","log")}function w(x,j){if(!x)throw new Error("missing bindings for child Pino");j=j||{},o&&x.serializers&&(j.serializers=x.serializers);const H=j.serializers;if(o&&H){var ue=Object.assign({},f,H),M=e.browser.serialize===!0?Object.keys(ue):o;delete x.serializers,Vt([x],M,ue,this._stdErrSerialize)}function Ae(ge){this._childLevel=(ge._childLevel|0)+1,this.error=_t(ge,x,"error"),this.fatal=_t(ge,x,"fatal"),this.warn=_t(ge,x,"warn"),this.info=_t(ge,x,"info"),this.debug=_t(ge,x,"debug"),this.trace=_t(ge,x,"trace"),ue&&(this.serializers=ue,this._serialize=M),n&&(this._logEvent=nn([].concat(ge._logEvent.bindings,x)))}return Ae.prototype=this,new Ae(this)}return g}Qe.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qe.stdSerializers=Yi;Qe.stdTimeFunctions=Object.assign({},{nullTime:Vn,epochTime:Xn,unixTime:rs,isoTime:is});function pt(e,n,r,f){const o=Object.getPrototypeOf(n);n[r]=n.levelVal>n.levels.values[r]?Ot:o[r]?o[r]:It[r]||It[f]||Ot,Zi(e,n,r)}function Zi(e,n,r){!e.transmit&&n[r]===Ot||(n[r]=function(f){return function(){const d=e.timestamp(),E=new Array(arguments.length),S=Object.getPrototypeOf&&Object.getPrototypeOf(this)===It?It:this;for(var g=0;g<E.length;g++)E[g]=arguments[g];if(e.serialize&&!e.asObject&&Vt(E,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?f.call(S,Qi(this,r,E,d)):f.apply(S,E),e.transmit){const s=e.transmit.level||n.level,u=Qe.levels.values[s],y=Qe.levels.values[r];if(y<u)return;es(this,{ts:d,methodLevel:r,methodValue:y,transmitLevel:s,transmitValue:Qe.levels.values[e.transmit.level||n.level],send:e.transmit.send,val:n.levelVal},E)}}}(n[r]))}function Qi(e,n,r,f){e._serialize&&Vt(r,e._serialize,e.serializers,e._stdErrSerialize);const o=r.slice();let d=o[0];const E={};f&&(E.time=f),E.level=Qe.levels.values[n];let S=(e._childLevel|0)+1;if(S<1&&(S=1),d!==null&&typeof d=="object"){for(;S--&&typeof o[0]=="object";)Object.assign(E,o.shift());d=o.length?Pn(o.shift(),o):void 0}else typeof d=="string"&&(d=Pn(o.shift(),o));return d!==void 0&&(E.msg=d),E}function Vt(e,n,r,f){for(const o in e)if(f&&e[o]instanceof Error)e[o]=Qe.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o]))for(const d in e[o])n&&n.indexOf(d)>-1&&d in r&&(e[o][d]=r[d](e[o][d]))}function _t(e,n,r){return function(){const f=new Array(1+arguments.length);f[0]=n;for(var o=1;o<f.length;o++)f[o]=arguments[o-1];return e[r].apply(this,f)}}function es(e,n,r){const f=n.send,o=n.ts,d=n.methodLevel,E=n.methodValue,S=n.val,g=e._logEvent.bindings;Vt(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter(function(s){return g.indexOf(s)===-1}),e._logEvent.level.label=d,e._logEvent.level.value=E,f(d,e._logEvent,S),e._logEvent=nn(g)}function nn(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function ts(e){const n={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)n[r]===void 0&&(n[r]=e[r]);return n}function ns(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Vn:Xn}function Ut(){return{}}function en(e){return e}function Ot(){}function Vn(){return!1}function Xn(){return Date.now()}function rs(){return Math.round(Date.now()/1e3)}function is(){return new Date(Date.now()).toISOString()}function ss(){function e(n){return typeof n<"u"&&n}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}const an=k.getDefaultExportFromCjs(mt),os=e=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString()+"n":r);function Cn(e){return typeof e=="string"?e:os(e)||""}const as={level:"info"},Rt="custom_context",fn=1e3*1024;class fs{constructor(n){this.nodeValue=n,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Nn{constructor(n){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=n,this.sizeInBytes=0}append(n){const r=new fs(n);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${n} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const n=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=n.size}toArray(){const n=[];let r=this.head;for(;r!==null;)n.push(r.value),r=r.next;return n}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let n=this.head;return{next:()=>{if(!n)return{done:!0,value:null};const r=n.value;return n=n.next,{done:!1,value:r}}}}}class Yn{constructor(n,r=fn){this.level=n??"error",this.levelValue=mt.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Nn(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(n,r){r===mt.levels.values.error?console.error(n):r===mt.levels.values.warn?console.warn(n):r===mt.levels.values.debug?console.debug(n):r===mt.levels.values.trace?console.trace(n):console.log(n)}appendToLogs(n){this.logs.append(Cn({timestamp:new Date().toISOString(),log:n}));const r=typeof n=="string"?JSON.parse(n).level:n.level;r>=this.levelValue&&this.forwardToConsole(n,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Nn(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(n){const r=this.getLogArray();return r.push(Cn({extraMetadata:n})),new Blob(r,{type:"application/json"})}}class cs{constructor(n,r=fn){this.baseChunkLogger=new Yn(n,r)}write(n){this.baseChunkLogger.appendToLogs(n)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(n){return this.baseChunkLogger.logsToBlob(n)}downloadLogsBlobInBrowser(n){const r=URL.createObjectURL(this.logsToBlob(n)),f=document.createElement("a");f.href=r,f.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(r)}}class us{constructor(n,r=fn){this.baseChunkLogger=new Yn(n,r)}write(n){this.baseChunkLogger.appendToLogs(n)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(n){return this.baseChunkLogger.logsToBlob(n)}}var ls=Object.defineProperty,ds=Object.defineProperties,hs=Object.getOwnPropertyDescriptors,jn=Object.getOwnPropertySymbols,bs=Object.prototype.hasOwnProperty,gs=Object.prototype.propertyIsEnumerable,Mn=(e,n,r)=>n in e?ls(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,Gt=(e,n)=>{for(var r in n||(n={}))bs.call(n,r)&&Mn(e,r,n[r]);if(jn)for(var r of jn(n))gs.call(n,r)&&Mn(e,r,n[r]);return e},Wt=(e,n)=>ds(e,hs(n));function ys(e){return Wt(Gt({},e),{level:(e==null?void 0:e.level)||as.level})}function ps(e,n=Rt){return e[n]||""}function _s(e,n,r=Rt){return e[r]=n,e}function qn(e,n=Rt){let r="";return typeof e.bindings>"u"?r=ps(e,n):r=e.bindings().context||"",r}function ms(e,n,r=Rt){const f=qn(e,r);return f.trim()?`${f}/${n}`:n}function xs(e,n,r=Rt){const f=ms(e,n,r),o=e.child({context:f});return _s(o,f,r)}function ws(e){var n,r;const f=new cs((n=e.opts)==null?void 0:n.level,e.maxSizeInBytes);return{logger:an(Wt(Gt({},e.opts),{level:"trace",browser:Wt(Gt({},(r=e.opts)==null?void 0:r.browser),{write:o=>f.write(o)})})),chunkLoggerController:f}}function vs(e){var n;const r=new us((n=e.opts)==null?void 0:n.level,e.maxSizeInBytes);return{logger:an(Wt(Gt({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}function Ss(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?ws(e):vs(e)}var cn={},Zn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var n=De.binary,r=De.wipe;e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var f=function(){function S(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return S.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},S.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},S.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},S.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(d(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=d(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},S.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;n.writeUint32BE(y,this._buffer,w-8),n.writeUint32BE(v,this._buffer,w-4),d(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)n.writeUint32BE(this._stateHi[x],g,x*8),n.writeUint32BE(this._stateLo[x],g,x*8+4);return this},S.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},S.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},S.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},S.prototype.cleanSavedState=function(g){r.wipe(g.stateHi),r.wipe(g.stateLo),g.buffer&&r.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},S}();e.SHA512=f;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function d(S,g,s,u,y,v,w){for(var x=s[0],j=s[1],H=s[2],ue=s[3],M=s[4],Ae=s[5],ge=s[6],Ne=s[7],G=u[0],N=u[1],je=u[2],et=u[3],ye=u[4],Je=u[5],$e=u[6],Xe=u[7],m,_,Y,le,L,I,O,A;w>=128;){for(var Le=0;Le<16;Le++){var ne=8*Le+v;S[Le]=n.readUint32BE(y,ne),g[Le]=n.readUint32BE(y,ne+4)}for(var Le=0;Le<80;Le++){var xt=x,B=j,gt=H,b=ue,h=M,l=Ae,t=ge,a=Ne,R=G,P=N,z=je,K=et,D=ye,U=Je,Re=$e,de=Xe;if(m=Ne,_=Xe,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=(M>>>14|ye<<18)^(M>>>18|ye<<14)^(ye>>>9|M<<23),_=(ye>>>14|M<<18)^(ye>>>18|M<<14)^(M>>>9|ye<<23),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=M&Ae^~M&ge,_=ye&Je^~ye&$e,L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=o[Le*2],_=o[Le*2+1],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=S[Le%16],_=g[Le%16],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,Y=O&65535|A<<16,le=L&65535|I<<16,m=Y,_=le,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=(x>>>28|G<<4)^(G>>>2|x<<30)^(G>>>7|x<<25),_=(G>>>28|x<<4)^(x>>>2|G<<30)^(x>>>7|G<<25),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,m=x&j^x&H^j&H,_=G&N^G&je^N&je,L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,a=O&65535|A<<16,de=L&65535|I<<16,m=b,_=K,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=Y,_=le,L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,b=O&65535|A<<16,K=L&65535|I<<16,j=xt,H=B,ue=gt,M=b,Ae=h,ge=l,Ne=t,x=a,N=R,je=P,et=z,ye=K,Je=D,$e=U,Xe=Re,G=de,Le%16===15)for(var ne=0;ne<16;ne++)m=S[ne],_=g[ne],L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=S[(ne+9)%16],_=g[(ne+9)%16],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,Y=S[(ne+1)%16],le=g[(ne+1)%16],m=(Y>>>1|le<<31)^(Y>>>8|le<<24)^Y>>>7,_=(le>>>1|Y<<31)^(le>>>8|Y<<24)^(le>>>7|Y<<25),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,Y=S[(ne+14)%16],le=g[(ne+14)%16],m=(Y>>>19|le<<13)^(le>>>29|Y<<3)^Y>>>6,_=(le>>>19|Y<<13)^(Y>>>29|le<<3)^(le>>>6|Y<<26),L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,S[ne]=O&65535|A<<16,g[ne]=L&65535|I<<16}m=x,_=G,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[0],_=u[0],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[0]=x=O&65535|A<<16,u[0]=G=L&65535|I<<16,m=j,_=N,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[1],_=u[1],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[1]=j=O&65535|A<<16,u[1]=N=L&65535|I<<16,m=H,_=je,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[2],_=u[2],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[2]=H=O&65535|A<<16,u[2]=je=L&65535|I<<16,m=ue,_=et,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[3],_=u[3],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[3]=ue=O&65535|A<<16,u[3]=et=L&65535|I<<16,m=M,_=ye,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[4],_=u[4],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[4]=M=O&65535|A<<16,u[4]=ye=L&65535|I<<16,m=Ae,_=Je,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[5],_=u[5],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[5]=Ae=O&65535|A<<16,u[5]=Je=L&65535|I<<16,m=ge,_=$e,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[6],_=u[6],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[6]=ge=O&65535|A<<16,u[6]=$e=L&65535|I<<16,m=Ne,_=Xe,L=_&65535,I=_>>>16,O=m&65535,A=m>>>16,m=s[7],_=u[7],L+=_&65535,I+=_>>>16,O+=m&65535,A+=m>>>16,I+=L>>>16,O+=I>>>16,A+=O>>>16,s[7]=Ne=O&65535|A<<16,u[7]=Xe=L&65535|I<<16,v+=128,w-=128}return v}function E(S){var g=new f;g.update(S);var s=g.digest();return g.clean(),s}e.hash=E})(Zn);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.convertSecretKeyToX25519=e.convertPublicKeyToX25519=e.verify=e.sign=e.extractPublicKeyFromSecretKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.SEED_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=e.SIGNATURE_LENGTH=void 0;const n=De.random,r=Zn,f=De.wipe;e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.SEED_LENGTH=32;function o(b){const h=new Float64Array(16);if(b)for(let l=0;l<b.length;l++)h[l]=b[l];return h}const d=new Uint8Array(32);d[0]=9;const E=o(),S=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(b,h){for(let l=0;l<16;l++)b[l]=h[l]|0}function x(b){let h=1;for(let l=0;l<16;l++){let t=b[l]+h+65535;h=Math.floor(t/65536),b[l]=t-h*65536}b[0]+=h-1+37*(h-1)}function j(b,h,l){const t=~(l-1);for(let a=0;a<16;a++){const R=t&(b[a]^h[a]);b[a]^=R,h[a]^=R}}function H(b,h){const l=o(),t=o();for(let a=0;a<16;a++)t[a]=h[a];x(t),x(t),x(t);for(let a=0;a<2;a++){l[0]=t[0]-65517;for(let P=1;P<15;P++)l[P]=t[P]-65535-(l[P-1]>>16&1),l[P-1]&=65535;l[15]=t[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,j(t,l,1-R)}for(let a=0;a<16;a++)b[2*a]=t[a]&255,b[2*a+1]=t[a]>>8}function ue(b,h){let l=0;for(let t=0;t<32;t++)l|=b[t]^h[t];return(1&l-1>>>8)-1}function M(b,h){const l=new Uint8Array(32),t=new Uint8Array(32);return H(l,b),H(t,h),ue(l,t)}function Ae(b){const h=new Uint8Array(32);return H(h,b),h[0]&1}function ge(b,h){for(let l=0;l<16;l++)b[l]=h[2*l]+(h[2*l+1]<<8);b[15]&=32767}function Ne(b,h,l){for(let t=0;t<16;t++)b[t]=h[t]+l[t]}function G(b,h,l){for(let t=0;t<16;t++)b[t]=h[t]-l[t]}function N(b,h,l){let t,a,R=0,P=0,z=0,K=0,D=0,U=0,Re=0,de=0,Pe=0,pe=0,he=0,re=0,te=0,q=0,V=0,$=0,ie=0,_e=0,W=0,Me=0,ze=0,He=0,Ge=0,Ke=0,Ye=0,Ze=0,st=0,We=0,ct=0,wt=0,Pt=0,se=l[0],Z=l[1],oe=l[2],ae=l[3],fe=l[4],Q=l[5],me=l[6],xe=l[7],we=l[8],ve=l[9],Se=l[10],be=l[11],ce=l[12],J=l[13],Ee=l[14],Ie=l[15];t=h[0],R+=t*se,P+=t*Z,z+=t*oe,K+=t*ae,D+=t*fe,U+=t*Q,Re+=t*me,de+=t*xe,Pe+=t*we,pe+=t*ve,he+=t*Se,re+=t*be,te+=t*ce,q+=t*J,V+=t*Ee,$+=t*Ie,t=h[1],P+=t*se,z+=t*Z,K+=t*oe,D+=t*ae,U+=t*fe,Re+=t*Q,de+=t*me,Pe+=t*xe,pe+=t*we,he+=t*ve,re+=t*Se,te+=t*be,q+=t*ce,V+=t*J,$+=t*Ee,ie+=t*Ie,t=h[2],z+=t*se,K+=t*Z,D+=t*oe,U+=t*ae,Re+=t*fe,de+=t*Q,Pe+=t*me,pe+=t*xe,he+=t*we,re+=t*ve,te+=t*Se,q+=t*be,V+=t*ce,$+=t*J,ie+=t*Ee,_e+=t*Ie,t=h[3],K+=t*se,D+=t*Z,U+=t*oe,Re+=t*ae,de+=t*fe,Pe+=t*Q,pe+=t*me,he+=t*xe,re+=t*we,te+=t*ve,q+=t*Se,V+=t*be,$+=t*ce,ie+=t*J,_e+=t*Ee,W+=t*Ie,t=h[4],D+=t*se,U+=t*Z,Re+=t*oe,de+=t*ae,Pe+=t*fe,pe+=t*Q,he+=t*me,re+=t*xe,te+=t*we,q+=t*ve,V+=t*Se,$+=t*be,ie+=t*ce,_e+=t*J,W+=t*Ee,Me+=t*Ie,t=h[5],U+=t*se,Re+=t*Z,de+=t*oe,Pe+=t*ae,pe+=t*fe,he+=t*Q,re+=t*me,te+=t*xe,q+=t*we,V+=t*ve,$+=t*Se,ie+=t*be,_e+=t*ce,W+=t*J,Me+=t*Ee,ze+=t*Ie,t=h[6],Re+=t*se,de+=t*Z,Pe+=t*oe,pe+=t*ae,he+=t*fe,re+=t*Q,te+=t*me,q+=t*xe,V+=t*we,$+=t*ve,ie+=t*Se,_e+=t*be,W+=t*ce,Me+=t*J,ze+=t*Ee,He+=t*Ie,t=h[7],de+=t*se,Pe+=t*Z,pe+=t*oe,he+=t*ae,re+=t*fe,te+=t*Q,q+=t*me,V+=t*xe,$+=t*we,ie+=t*ve,_e+=t*Se,W+=t*be,Me+=t*ce,ze+=t*J,He+=t*Ee,Ge+=t*Ie,t=h[8],Pe+=t*se,pe+=t*Z,he+=t*oe,re+=t*ae,te+=t*fe,q+=t*Q,V+=t*me,$+=t*xe,ie+=t*we,_e+=t*ve,W+=t*Se,Me+=t*be,ze+=t*ce,He+=t*J,Ge+=t*Ee,Ke+=t*Ie,t=h[9],pe+=t*se,he+=t*Z,re+=t*oe,te+=t*ae,q+=t*fe,V+=t*Q,$+=t*me,ie+=t*xe,_e+=t*we,W+=t*ve,Me+=t*Se,ze+=t*be,He+=t*ce,Ge+=t*J,Ke+=t*Ee,Ye+=t*Ie,t=h[10],he+=t*se,re+=t*Z,te+=t*oe,q+=t*ae,V+=t*fe,$+=t*Q,ie+=t*me,_e+=t*xe,W+=t*we,Me+=t*ve,ze+=t*Se,He+=t*be,Ge+=t*ce,Ke+=t*J,Ye+=t*Ee,Ze+=t*Ie,t=h[11],re+=t*se,te+=t*Z,q+=t*oe,V+=t*ae,$+=t*fe,ie+=t*Q,_e+=t*me,W+=t*xe,Me+=t*we,ze+=t*ve,He+=t*Se,Ge+=t*be,Ke+=t*ce,Ye+=t*J,Ze+=t*Ee,st+=t*Ie,t=h[12],te+=t*se,q+=t*Z,V+=t*oe,$+=t*ae,ie+=t*fe,_e+=t*Q,W+=t*me,Me+=t*xe,ze+=t*we,He+=t*ve,Ge+=t*Se,Ke+=t*be,Ye+=t*ce,Ze+=t*J,st+=t*Ee,We+=t*Ie,t=h[13],q+=t*se,V+=t*Z,$+=t*oe,ie+=t*ae,_e+=t*fe,W+=t*Q,Me+=t*me,ze+=t*xe,He+=t*we,Ge+=t*ve,Ke+=t*Se,Ye+=t*be,Ze+=t*ce,st+=t*J,We+=t*Ee,ct+=t*Ie,t=h[14],V+=t*se,$+=t*Z,ie+=t*oe,_e+=t*ae,W+=t*fe,Me+=t*Q,ze+=t*me,He+=t*xe,Ge+=t*we,Ke+=t*ve,Ye+=t*Se,Ze+=t*be,st+=t*ce,We+=t*J,ct+=t*Ee,wt+=t*Ie,t=h[15],$+=t*se,ie+=t*Z,_e+=t*oe,W+=t*ae,Me+=t*fe,ze+=t*Q,He+=t*me,Ge+=t*xe,Ke+=t*we,Ye+=t*ve,Ze+=t*Se,st+=t*be,We+=t*ce,ct+=t*J,wt+=t*Ee,Pt+=t*Ie,R+=38*ie,P+=38*_e,z+=38*W,K+=38*Me,D+=38*ze,U+=38*He,Re+=38*Ge,de+=38*Ke,Pe+=38*Ye,pe+=38*Ze,he+=38*st,re+=38*We,te+=38*ct,q+=38*wt,V+=38*Pt,a=1,t=R+a+65535,a=Math.floor(t/65536),R=t-a*65536,t=P+a+65535,a=Math.floor(t/65536),P=t-a*65536,t=z+a+65535,a=Math.floor(t/65536),z=t-a*65536,t=K+a+65535,a=Math.floor(t/65536),K=t-a*65536,t=D+a+65535,a=Math.floor(t/65536),D=t-a*65536,t=U+a+65535,a=Math.floor(t/65536),U=t-a*65536,t=Re+a+65535,a=Math.floor(t/65536),Re=t-a*65536,t=de+a+65535,a=Math.floor(t/65536),de=t-a*65536,t=Pe+a+65535,a=Math.floor(t/65536),Pe=t-a*65536,t=pe+a+65535,a=Math.floor(t/65536),pe=t-a*65536,t=he+a+65535,a=Math.floor(t/65536),he=t-a*65536,t=re+a+65535,a=Math.floor(t/65536),re=t-a*65536,t=te+a+65535,a=Math.floor(t/65536),te=t-a*65536,t=q+a+65535,a=Math.floor(t/65536),q=t-a*65536,t=V+a+65535,a=Math.floor(t/65536),V=t-a*65536,t=$+a+65535,a=Math.floor(t/65536),$=t-a*65536,R+=a-1+37*(a-1),a=1,t=R+a+65535,a=Math.floor(t/65536),R=t-a*65536,t=P+a+65535,a=Math.floor(t/65536),P=t-a*65536,t=z+a+65535,a=Math.floor(t/65536),z=t-a*65536,t=K+a+65535,a=Math.floor(t/65536),K=t-a*65536,t=D+a+65535,a=Math.floor(t/65536),D=t-a*65536,t=U+a+65535,a=Math.floor(t/65536),U=t-a*65536,t=Re+a+65535,a=Math.floor(t/65536),Re=t-a*65536,t=de+a+65535,a=Math.floor(t/65536),de=t-a*65536,t=Pe+a+65535,a=Math.floor(t/65536),Pe=t-a*65536,t=pe+a+65535,a=Math.floor(t/65536),pe=t-a*65536,t=he+a+65535,a=Math.floor(t/65536),he=t-a*65536,t=re+a+65535,a=Math.floor(t/65536),re=t-a*65536,t=te+a+65535,a=Math.floor(t/65536),te=t-a*65536,t=q+a+65535,a=Math.floor(t/65536),q=t-a*65536,t=V+a+65535,a=Math.floor(t/65536),V=t-a*65536,t=$+a+65535,a=Math.floor(t/65536),$=t-a*65536,R+=a-1+37*(a-1),b[0]=R,b[1]=P,b[2]=z,b[3]=K,b[4]=D,b[5]=U,b[6]=Re,b[7]=de,b[8]=Pe,b[9]=pe,b[10]=he,b[11]=re,b[12]=te,b[13]=q,b[14]=V,b[15]=$}function je(b,h){N(b,h,h)}function et(b,h){const l=o();let t;for(t=0;t<16;t++)l[t]=h[t];for(t=253;t>=0;t--)je(l,l),t!==2&&t!==4&&N(l,l,h);for(t=0;t<16;t++)b[t]=l[t]}function ye(b,h){const l=o();let t;for(t=0;t<16;t++)l[t]=h[t];for(t=250;t>=0;t--)je(l,l),t!==1&&N(l,l,h);for(t=0;t<16;t++)b[t]=l[t]}function Je(b,h){const l=o(),t=o(),a=o(),R=o(),P=o(),z=o(),K=o(),D=o(),U=o();G(l,b[1],b[0]),G(U,h[1],h[0]),N(l,l,U),Ne(t,b[0],b[1]),Ne(U,h[0],h[1]),N(t,t,U),N(a,b[3],h[3]),N(a,a,s),N(R,b[2],h[2]),Ne(R,R,R),G(P,t,l),G(z,R,a),Ne(K,R,a),Ne(D,t,l),N(b[0],P,z),N(b[1],D,K),N(b[2],K,z),N(b[3],P,D)}function $e(b,h,l){for(let t=0;t<4;t++)j(b[t],h[t],l)}function Xe(b,h){const l=o(),t=o(),a=o();et(a,h[2]),N(l,h[0],a),N(t,h[1],a),H(b,t),b[31]^=Ae(l)<<7}function m(b,h,l){w(b[0],E),w(b[1],S),w(b[2],S),w(b[3],E);for(let t=255;t>=0;--t){const a=l[t/8|0]>>(t&7)&1;$e(b,h,a),Je(h,b),Je(b,b),$e(b,h,a)}}function _(b,h){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],S),N(l[3],u,y),m(b,l,h)}function Y(b){if(b.length!==e.SEED_LENGTH)throw new Error(`ed25519: seed must be ${e.SEED_LENGTH} bytes`);const h=(0,r.hash)(b);h[0]&=248,h[31]&=127,h[31]|=64;const l=new Uint8Array(32),t=[o(),o(),o(),o()];_(t,h),Xe(l,t);const a=new Uint8Array(64);return a.set(b),a.set(l,32),{publicKey:l,secretKey:a}}e.generateKeyPairFromSeed=Y;function le(b){const h=(0,n.randomBytes)(32,b),l=Y(h);return(0,f.wipe)(h),l}e.generateKeyPair=le;function L(b){if(b.length!==e.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(b.subarray(32))}e.extractPublicKeyFromSecretKey=L;const I=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(b,h){let l,t,a,R;for(t=63;t>=32;--t){for(l=0,a=t-32,R=t-12;a<R;++a)h[a]+=l-16*h[t]*I[a-(t-32)],l=Math.floor((h[a]+128)/256),h[a]-=l*256;h[a]+=l,h[t]=0}for(l=0,a=0;a<32;a++)h[a]+=l-(h[31]>>4)*I[a],l=h[a]>>8,h[a]&=255;for(a=0;a<32;a++)h[a]-=l*I[a];for(t=0;t<32;t++)h[t+1]+=h[t]>>8,b[t]=h[t]&255}function A(b){const h=new Float64Array(64);for(let l=0;l<64;l++)h[l]=b[l];for(let l=0;l<64;l++)b[l]=0;O(b,h)}function Le(b,h){const l=new Float64Array(64),t=[o(),o(),o(),o()],a=(0,r.hash)(b.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const P=new r.SHA512;P.update(R.subarray(32)),P.update(h);const z=P.digest();P.clean(),A(z),_(t,z),Xe(R,t),P.reset(),P.update(R.subarray(0,32)),P.update(b.subarray(32)),P.update(h);const K=P.digest();A(K);for(let D=0;D<32;D++)l[D]=z[D];for(let D=0;D<32;D++)for(let U=0;U<32;U++)l[D+U]+=K[D]*a[U];return O(R.subarray(32),l),R}e.sign=Le;function ne(b,h){const l=o(),t=o(),a=o(),R=o(),P=o(),z=o(),K=o();return w(b[2],S),ge(b[1],h),je(a,b[1]),N(R,a,g),G(a,a,b[2]),Ne(R,b[2],R),je(P,R),je(z,P),N(K,z,P),N(l,K,a),N(l,l,R),ye(l,l),N(l,l,a),N(l,l,R),N(l,l,R),N(b[0],l,R),je(t,b[0]),N(t,t,R),M(t,a)&&N(b[0],b[0],v),je(t,b[0]),N(t,t,R),M(t,a)?-1:(Ae(b[0])===h[31]>>7&&G(b[0],E,b[0]),N(b[3],b[0],b[1]),0)}function xt(b,h,l){const t=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==e.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);if(ne(R,b))return!1;const P=new r.SHA512;P.update(l.subarray(0,32)),P.update(b),P.update(h);const z=P.digest();return A(z),m(a,R,z),_(R,l.subarray(32)),Je(a,R),Xe(t,a),!ue(l,t)}e.verify=xt;function B(b){let h=[o(),o(),o(),o()];if(ne(h,b))throw new Error("Ed25519: invalid public key");let l=o(),t=o(),a=h[1];Ne(l,S,a),G(t,S,a),et(t,t),N(l,l,t);let R=new Uint8Array(32);return H(R,l),R}e.convertPublicKeyToX25519=B;function gt(b){const h=(0,r.hash)(b.subarray(0,32));h[0]&=248,h[31]&=127,h[31]|=64;const l=new Uint8Array(h.subarray(0,32));return(0,f.wipe)(h),l}e.convertSecretKeyToX25519=gt})(cn);const Es="EdDSA",Is="JWT",Ft=".",Xt="base64url",Qn="utf8",er="utf8",Os=":",Ts="did",As="key",Bn="base58btc",Ls="z",Rs="K36",Ps=32,Cs=e=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString()+"n":r),Ns=e=>{const n=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=e.replace(n,'$1"$2n"$3');return JSON.parse(r,(f,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function js(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return Ns(e)}catch{return e}}function Ms(e){return typeof e=="string"?e:Cs(e)||""}function Dn(e){return js(At(ht(e,Xt),Qn))}function Jt(e){return At(ht(Ms(e),Qn),Xt)}function tr(e){const n=ht(Rs,Bn),r=Ls+At(Hn([n,e]),Bn);return[Ts,As,r].join(Os)}function Bs(e){return At(e,Xt)}function Ds(e){return ht(e,Xt)}function zs(e){return ht([Jt(e.header),Jt(e.payload)].join(Ft),er)}function Ks(e){return[Jt(e.header),Jt(e.payload),Bs(e.signature)].join(Ft)}function Us(e){const n=e.split(Ft),r=Dn(n[0]),f=Dn(n[1]),o=Ds(n[2]),d=ht(n.slice(0,2).join(Ft),er);return{header:r,payload:f,signature:o,data:d}}function $s(e=De.random.randomBytes(Ps)){return cn.generateKeyPairFromSeed(e)}async function Hs(e,n,r,f,o=De.cjs.fromMiliseconds(Date.now())){const d={alg:Es,typ:Is},E=tr(f.publicKey),S=o+r,g={iss:E,sub:e,aud:n,iat:o,exp:S},s=zs({header:d,payload:g}),u=cn.sign(f.secretKey,s);return Ks({header:d,payload:g,signature:u})}const Gs="PARSE_ERROR",Ws="INVALID_REQUEST",Fs="METHOD_NOT_FOUND",Js="INVALID_PARAMS",nr="INTERNAL_ERROR",un="SERVER_ERROR",ks=[-32700,-32600,-32601,-32602,-32603],Et={[Gs]:{code:-32700,message:"Parse error"},[Ws]:{code:-32600,message:"Invalid Request"},[Fs]:{code:-32601,message:"Method not found"},[Js]:{code:-32602,message:"Invalid params"},[nr]:{code:-32603,message:"Internal error"},[un]:{code:-32e3,message:"Server error"}},rr=un;function Vs(e){return ks.includes(e)}function zn(e){return Object.keys(Et).includes(e)?Et[e]:Et[rr]}function Xs(e){const n=Object.values(Et).find(r=>r.code===e);return n||Et[rr]}function Ys(e,n,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${n}`):e}var ir={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var xr=Object.defineProperty;var Br=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var D=(t,e,r)=>Br(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index-Br4OTc1S.js"),b=require("./sui-BzgBbOVR.js");require("./index-DtJ3gwwu.js");const Ht=require("./unsignedTransaction-DzSLsK-p.js");class Cr extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...c}=e,{path:a}=e,o=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??o),s!=null&&(this.cause=o),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function $r(t){return K(t)&&typeof t[Symbol.iterator]=="function"}function K(t){return typeof t=="object"&&t!=null}function J(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Ur(t){const{done:e,value:r}=t.next();return e?void 0:r}function Pr(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:c}=r,{refinement:a,message:o=`Expected a value of type \`${c}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=t;return{value:n,type:c,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:o}}function*Lt(t,e,r,n){$r(t)||(t=[t]);for(const i of t){const s=Pr(i,e,r,n);s&&(yield s)}}function*lt(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:c=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),c&&e.type!=="type"&&K(e.schema)&&K(t)&&!Array.isArray(t)))for(const d in t)e.schema[d]===void 0&&delete t[d];let o="valid";for(const d of e.validator(t,a))d.explanation=r.message,o="not_valid",yield[d,void 0];for(let[d,u,h]of e.entries(t,a)){const m=lt(u,h,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,u],coerce:s,mask:c,message:r.message});for(const y of m)y[0]?(o=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(u=y[1],d===void 0?t=u:t instanceof Map?t.set(d,u):t instanceof Set?t.add(u):K(t)&&(u!==void 0||d in t)&&(t[d]=u))}if(o!=="not_valid")for(const d of e.refiner(t,a))d.explanation=r.message,o="not_refined",yield[d,void 0];o==="valid"&&(yield[void 0,t])}class te{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:c=o=>o,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=c,i?this.validator=(o,d)=>{const u=i(o,d);return Lt(u,d,this,o)}:this.validator=()=>[],s?this.refiner=(o,d)=>{const u=s(o,d);return Lt(u,d,this,o)}:this.refiner=()=>[]}assert(e,r){return nt(e,this,r)}create(e,r){return Xt(e,this,r)}is(e){return L(e,this)}mask(e,r){return Zt(e,this,r)}validate(e,r={}){return _e(e,this,r)}}function nt(t,e,r){const n=_e(t,e,{message:r});if(n[0])throw n[0]}function Xt(t,e,r){const n=_e(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Zt(t,e,r){const n=_e(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(t,e){return!_e(t,e)[0]}function _e(t,e,r={}){const n=lt(t,e,r),i=Ur(n);return i[0]?[new Cr(i[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function je(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Rr(n):p(n)}function W(t,e){return new te({type:t,schema:null,validator:e})}function it(){return W("any",()=>!0)}function E(t){return new te({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${J(e)}`}})}function Mr(){return W("bigint",t=>typeof t=="bigint")}function z(){return W("boolean",t=>typeof t=="boolean")}function ee(){return W("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${J(t)}`)}function k(t){const e=J(t),r=typeof t;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${J(n)}`}})}function Yt(){return W("never",()=>!1)}function $(t){return new te({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function ge(){return W("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${J(t)}`)}function p(t){const e=t?Object.keys(t):[],r=Yt();return new te({type:"object",schema:t||null,*entries(n){if(t&&K(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function v(t){return new te({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Q(t,e){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function g(){return W("string",t=>typeof t=="string"||`Expected a string, but received: ${J(t)}`)}function Qt(t){const e=Yt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(t){const e=Object.keys(t);return new te({type:"type",schema:t,*entries(r){if(K(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(t){const e=t.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...c]=lt(r,s,n),[a]=c;if(a[0])for(const[o]of c)o&&i.push(o);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${J(r)}`,...i]}})}function er(){return W("unknown",()=>!0)}const ft=U([p({AddressOwner:g()}),p({ObjectOwner:g()}),p({Shared:p({initial_shared_version:$(g())})}),k("Immutable")]);W("SuiJsonValue",()=>!0);const Nr=U([p({u32:g()}),p({u64:g()}),p({f64:g()})]);p({attributes:Q(g(),$(Nr)),featureFlags:Q(g(),z()),maxSupportedProtocolVersion:g(),minSupportedProtocolVersion:g(),protocolVersion:g()});U([g(),k("package")]);const ce=p({digest:g(),objectId:g(),version:U([ge(),g(),Mr()])});p({owner:ft,reference:ce});p({objectId:g(),sequenceNumber:g()});p({payment:E(ce),owner:g(),price:g(),budget:g()});const Dr=je(ce,p({type:g(),owner:ft,previousTransaction:g()})),Vr=Q(g(),it()),zr=Q(g(),er()),Fr=p({type:g(),fields:Vr,hasPublicTransfer:z()}),Gr=p({disassembled:zr}),Lr=U([je(Fr,p({dataType:k("moveObject")})),je(Gr,p({dataType:k("package")}))]),Wr=p({type:g(),hasPublicTransfer:z(),version:g(),bcsBytes:g()}),Kr=p({id:g(),moduleMap:Q(g(),g())}),Jr=U([je(Wr,p({dataType:k("moveObject")})),je(Kr,p({dataType:k("package")}))]);BigInt(1e9);const tr=p({code:g(),error:v(g()),object_id:v(g()),parent_object_id:v(g()),version:v(g()),digest:v(g())}),qr=p({data:$(v(Q(g(),g()))),error:$(v(tr))}),Hr=U([qr,v(Q(g(),g()))]),rr=p({objectId:g(),version:g(),digest:g(),type:$(v(g())),content:$(v(Lr)),bcs:$(v(Jr)),owner:$(v(ft)),previousTransaction:$(v(g())),storageRebate:$(v(g())),display:$(v(Hr))});p({showType:$(v(z())),showContent:$(v(z())),showBcs:$(v(z())),showOwner:$(v(z())),showPreviousTransaction:$(v(z())),showStorageRebate:$(v(z())),showDisplay:$(v(z()))});U([k("Exists"),k("notExists"),k("Deleted")]);E(Dr);const Xr=p({data:$(v(rr)),error:$(v(tr))});function Zr(t){return t.data}function Yr(t){if(t.error&&"object_id"in t.error&&"version"in t.error&&"digest"in t.error){const e=t.error;return{objectId:e.object_id,version:e.version,digest:e.digest}}}function Wt(t){if("reference"in t)return t.reference;const e=Zr(t);return e?{objectId:e.objectId,version:e.version,digest:e.digest}:Yr(t)}p({objectId:g(),atCheckpoint:v(ge())});p({data:E(Xr),nextCursor:v($(g())),hasNextPage:z()});U([p({details:rr,status:k("VersionFound")}),p({details:g(),status:k("ObjectNotExists")}),p({details:ce,status:k("ObjectDeleted")}),p({details:Qt([g(),ge()]),status:k("VersionNotFound")}),p({details:p({asked_version:ge(),latest_version:ge(),object_id:g()}),status:k("VersionTooHigh")})]);const Qr=U([g(),p({Object:g()})]);E(Qr);const en=p({address:g(),name:g()}),tn=U([k("Private"),k("Public"),k("Friend")]),gt=p({abilities:E(g())}),rn=p({constraints:gt,isPhantom:z()}),nn=p({TypeParameter:ge()}),Xe=Qt([p({module:g(),package:g(),function:g()}),g()]);p({rank3Days:E(Xe),rank7Days:E(Xe),rank30Days:E(Xe)});function nr(t){if(!t)return!1;if(typeof t=="string"||L(t,nn)||ir(t))return!0;if(typeof t!="object")return!1;const e=t;return!!(L(e.Reference,me)||L(e.MutableReference,me)||L(e.Vector,me))}const me=W("SuiMoveNormalizedType",nr);function ir(t){if(!t||typeof t!="object")return!1;const e=t;if(!e.Struct||typeof e.Struct!="object")return!1;const r=e.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>nr(n)))}W("SuiMoveNormalizedStructType",ir);const sn=p({visibility:tn,isEntry:z(),typeParameters:E(gt),parameters:E(me),return:E(me)}),an=p({name:g(),type:me}),on=p({abilities:gt,typeParameters:E(rn),fields:E(an)}),cn=p({fileFormatVersion:ge(),address:g(),name:g(),friends:E(en),structs:Q(g(),on),exposedFunctions:Q(g(),sn)});Q(g(),cn);function st(t){return typeof t=="object"&&"MutableReference"in t?t.MutableReference:void 0}function sr(t){return typeof t=="object"&&"Reference"in t?t.Reference:void 0}function ht(t){if(typeof t=="object"&&"Struct"in t)return t;const e=sr(t),r=st(t);if(typeof e=="object"&&"Struct"in e)return e;if(typeof r=="object"&&"Struct"in r)return r}function un(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var c=t.length,a=t.charAt(0),o=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var S=0,T=0,f=0,O=y.length;f!==O&&y[f]===0;)f++,S++;for(var B=(O-f)*d+1>>>0,P=new Uint8Array(B);f!==O;){for(var A=y[f],j=0,M=B-1;(A!==0||j<T)&&M!==-1;M--,j++)A+=256*P[M]>>>0,P[M]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=j,f++}for(var q=B-T;q!==B&&P[q]===0;)q++;for(var pe=a.repeat(S);q<B;++q)pe+=t.charAt(P[q]);return pe}function h(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var S=0,T=0,f=0;y[S]===a;)T++,S++;for(var O=(y.length-S)*o+1>>>0,B=new Uint8Array(O);y[S];){var P=e[y.charCodeAt(S)];if(P===255)return;for(var A=0,j=O-1;(P!==0||A<f)&&j!==-1;j--,A++)P+=c*B[j]>>>0,B[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,S++}for(var M=O-f;M!==O&&B[M]===0;)M++;for(var q=new Uint8Array(T+(O-M)),pe=T;M!==O;)q[pe++]=B[M++];return q}function m(y){var S=h(y);if(S)return S;throw new Error("Non-base"+c+" character")}return{encode:u,decodeUnsafe:h,decode:m}}var dn=un;const ln=dn,fn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var gn=ln(fn);const ar=w.getDefaultExportFromCjs(gn),xe=t=>ar.encode(t),pt=t=>ar.decode(t);function ue(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}const Ze=8192;function Be(t){if(t.length<Ze)return btoa(String.fromCharCode(...t));let e="";for(var r=0;r<t.length;r+=Ze){const n=t.slice(r,r+Ze);e+=String.fromCharCode(...n)}return btoa(e)}function Je(t){var i;const e=t.startsWith("0x")?t.slice(2):t,n=((i=(e.length%2===0?e:`0${e}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function Ce(t){return t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}function yt(t){let e=[],r=0;if(t===0)return[0];for(;t>0;)e[r]=t&127,(t>>=7)&&(e[r]|=128),r+=1;return e}function hn(t){let e=0,r=0,n=0;for(;;){let i=t[n];if(n+=1,e|=(i&127)<<r,!(i&128))break;r+=7}return{value:e,length:n}}class or{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),n=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let e=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let e=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(e){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,e);return this.shift(e),n}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,e),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(e){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(e(this,i,r));return n}}function pn(t,e){switch(e){case"base58":return xe(t);case"base64":return Be(t);case"hex":return Ce(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function yn(t,e){switch(e){case"base58":return pt(t);case"base64":return ue(t);case"hex":return Je(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function mt(t,e=["<",">"]){const[r,n]=e,i=[];let s="",c=0;for(let a=0;a<t.length;a++){const o=t[a];if(o===r&&c++,o===n&&c--,c===0&&o===","){i.push(s.trim()),s="";continue}s+=o}return i.push(s.trim()),i}class cr{constructor({size:e=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=r||e,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const r=this.bytePosition+e;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Ye(BigInt(e),8).forEach(r=>this.write8(r)),this}write128(e){return Ye(BigInt(e),16).forEach(r=>this.write8(r)),this}write256(e){return Ye(BigInt(e),32).forEach(r=>this.write8(r)),this}writeULEB(e){return yt(e).forEach(r=>this.write8(r)),this}writeVec(e,r){return this.writeULEB(e.length),Array.from(e).forEach((n,i)=>r(this,n,i,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return pn(this.toBytes(),e)}}function Ye(t,e){let r=new Uint8Array(e),n=0;for(;t>0;)r[n]=Number(t%BigInt(256)),t=t/BigInt(256),n+=1;return r}var ur=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},X=(t,e,r)=>(ur(t,e,"read from private field"),r?r.call(t):e.get(t)),ze=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Fe=(t,e,r,n)=>(ur(t,e,"write to private field"),e.set(t,r),r),ye,Se,Me,ae;const dr=class{constructor(t){ze(this,ye,void 0),ze(this,Se,void 0),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Fe(this,ye,t.write),Fe(this,Se,t.serialize??((e,r)=>{const n=new cr({size:this.serializedSize(e)??void 0,...r});return X(this,ye).call(this,e,n),n.toBytes()})),this.validate=t.validate??(()=>{})}write(t,e){this.validate(t),X(this,ye).call(this,t,e)}serialize(t,e){return this.validate(t),new mn(this,X(this,Se).call(this,t,e))}parse(t){const e=new or(t);return this.read(e)}transform({name:t,input:e,output:r}){return new dr({name:t??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ye).call(this,e(n),i),serializedSize:n=>this.serializedSize(e(n)),serialize:(n,i)=>X(this,Se).call(this,e(n),i),validate:n=>this.validate(e(n))})}};let Z=dr;ye=new WeakMap;Se=new WeakMap;const lr=Symbol.for("@mysten/serialized-bcs");function wt(t){return!!t&&typeof t=="object"&&t[lr]===!0}class mn{constructor(e,r){ze(this,Me,void 0),ze(this,ae,void 0),Fe(this,Me,e),Fe(this,ae,r)}get[lr](){return!0}toBytes(){return X(this,ae)}toHex(){return Ce(X(this,ae))}toBase64(){return Be(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Ge({size:t,...e}){return new Z({...e,serializedSize:()=>t})}function Qe({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function et({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function wn({serialize:t,...e}){const r=new Z({...e,serialize:t,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function bn({toBytes:t,fromBytes:e,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return e(s)},write:(n,i)=>{const s=t(n);i.writeULEB(s.length);for(let c=0;c<s.length;c++)i.write8(s[c])},serialize:n=>{const i=t(n),s=yt(i.length),c=new Uint8Array(s.length+i.length);return c.set(s,0),c.set(i,s.length),c},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function Sn(t){let e=null;function r(){return e||(e=t()),e}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const l={u8(t){return Qe({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...t})},u16(t){return Qe({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...t})},u32(t){return Qe({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...t})},u64(t){return et({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...t})},u128(t){return et({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...t})},u256(t){return et({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...t})},bool(t){return Ge({name:"bool",size:1,read:e=>e.read8()===1,write:(e,r)=>r.write8(e?1:0),...t,validate:e=>{var r;if((r=t==null?void 0:t.validate)==null||r.call(t,e),typeof e!="boolean")throw new TypeError(`Expected boolean, found ${typeof e}`)}})},uleb128(t){return wn({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(yt(e)),...t})},bytes(t,e){return Ge({name:`bytes[${t}]`,size:t,read:r=>r.readBytes(t),write:(r,n)=>{for(let i=0;i<t;i++)n.write8(r[i]??0)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t)throw new TypeError(`Expected array of length ${t}, found ${r.length}`)}})},string(t){return bn({name:"string",toBytes:e=>new TextEncoder().encode(e),fromBytes:e=>new TextDecoder().decode(e),...t})},fixedArray(t,e,r){return new Z({name:`${e.name}[${t}]`,read:n=>{const i=new Array(t);for(let s=0;s<t;s++)i[s]=e.read(n);return i},write:(n,i)=>{for(const s of n)e.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==t)throw new TypeError(`Expected array of length ${t}, found ${n.length}`)}})},option(t){return l.enum(`Option<${t.name}>`,{None:null,Some:t}).transform({input:e=>e==null?{None:!0}:{Some:e},output:e=>"Some"in e?e.Some:null})},vector(t,e){return new Z({name:`vector<${t.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=t.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)t.write(i,n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(t,e){return new Z({name:`(${t.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<t.length;i++){const s=t[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of t)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<t.length;i++)t[i].write(r[i],n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t.length)throw new TypeError(`Expected array of length ${t.length}, found ${r.length}`)}})},struct(t,e,r){const n=Object.entries(e);return new Z({name:t,serializedSize:i=>{let s=0;for(const[c,a]of n){const o=a.serializedSize(i[c]);if(o==null)return null;s+=o}return s},read:i=>{const s={};for(const[c,a]of n)s[c]=a.read(i);return s},write:(i,s)=>{for(const[c,a]of n)a.write(i[c],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(t,e,r){const n=Object.entries(e);return new Z({name:t,read:i=>{const s=i.readULEB(),[c,a]=n[s];return{[c]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[c,a]=Object.entries(i)[0];for(let o=0;o<n.length;o++){const[d,u]=n[o];if(d===c){s.writeULEB(o),u==null||u.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[c]=s;if(!Object.hasOwn(e,c))throw new TypeError(`Invalid enum variant ${c}`)}})},map(t,e){return l.vector(l.tuple([t,e])).transform({name:`Map<${t.name}, ${e.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(t,e){return(...r)=>e(...r).transform({name:`${e.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(t){return Sn(t)}},Tn=32,Te=class{constructor(t){if(this.types=new Map,this.counter=0,t instanceof Te){this.schema=t.schema,this.types=new Map(t.types);return}if(this.schema=t,this.registerAddressType(Te.ADDRESS,t.addressLength,t.addressEncoding),this.registerVectorType(t.vectorType),t.types&&t.types.structs)for(let e of Object.keys(t.types.structs))this.registerStructType(e,t.types.structs[e]);if(t.types&&t.types.enums)for(let e of Object.keys(t.types.enums))this.registerEnumType(e,t.types.enums[e]);if(t.types&&t.types.aliases)for(let e of Object.keys(t.types.aliases))this.registerAlias(e,t.types.aliases[e]);t.withPrimitives!==!1&&vn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(t,e,r){if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).encode(this,e,r,i)}if(typeof t=="object"){const n=this.tempKey();return new Te(this).registerStructType(n,t).ser(n,e,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
|
|
1
|
+
"use strict";var xr=Object.defineProperty;var Br=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var D=(t,e,r)=>Br(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index-BBfGNpdz.js"),b=require("./sui-CDzPbVuH.js");require("./index-BXyAX-bb.js");const Ht=require("./unsignedTransaction-DzSLsK-p.js");class Cr extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...c}=e,{path:a}=e,o=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??o),s!=null&&(this.cause=o),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function $r(t){return K(t)&&typeof t[Symbol.iterator]=="function"}function K(t){return typeof t=="object"&&t!=null}function J(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Ur(t){const{done:e,value:r}=t.next();return e?void 0:r}function Pr(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:c}=r,{refinement:a,message:o=`Expected a value of type \`${c}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=t;return{value:n,type:c,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:o}}function*Lt(t,e,r,n){$r(t)||(t=[t]);for(const i of t){const s=Pr(i,e,r,n);s&&(yield s)}}function*lt(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:c=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),c&&e.type!=="type"&&K(e.schema)&&K(t)&&!Array.isArray(t)))for(const d in t)e.schema[d]===void 0&&delete t[d];let o="valid";for(const d of e.validator(t,a))d.explanation=r.message,o="not_valid",yield[d,void 0];for(let[d,u,h]of e.entries(t,a)){const m=lt(u,h,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,u],coerce:s,mask:c,message:r.message});for(const y of m)y[0]?(o=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(u=y[1],d===void 0?t=u:t instanceof Map?t.set(d,u):t instanceof Set?t.add(u):K(t)&&(u!==void 0||d in t)&&(t[d]=u))}if(o!=="not_valid")for(const d of e.refiner(t,a))d.explanation=r.message,o="not_refined",yield[d,void 0];o==="valid"&&(yield[void 0,t])}class te{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:c=o=>o,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=c,i?this.validator=(o,d)=>{const u=i(o,d);return Lt(u,d,this,o)}:this.validator=()=>[],s?this.refiner=(o,d)=>{const u=s(o,d);return Lt(u,d,this,o)}:this.refiner=()=>[]}assert(e,r){return nt(e,this,r)}create(e,r){return Xt(e,this,r)}is(e){return L(e,this)}mask(e,r){return Zt(e,this,r)}validate(e,r={}){return _e(e,this,r)}}function nt(t,e,r){const n=_e(t,e,{message:r});if(n[0])throw n[0]}function Xt(t,e,r){const n=_e(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Zt(t,e,r){const n=_e(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(t,e){return!_e(t,e)[0]}function _e(t,e,r={}){const n=lt(t,e,r),i=Ur(n);return i[0]?[new Cr(i[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function je(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Rr(n):p(n)}function W(t,e){return new te({type:t,schema:null,validator:e})}function it(){return W("any",()=>!0)}function E(t){return new te({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${J(e)}`}})}function Mr(){return W("bigint",t=>typeof t=="bigint")}function z(){return W("boolean",t=>typeof t=="boolean")}function ee(){return W("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${J(t)}`)}function k(t){const e=J(t),r=typeof t;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${J(n)}`}})}function Yt(){return W("never",()=>!1)}function $(t){return new te({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function ge(){return W("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${J(t)}`)}function p(t){const e=t?Object.keys(t):[],r=Yt();return new te({type:"object",schema:t||null,*entries(n){if(t&&K(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function v(t){return new te({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Q(t,e){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function g(){return W("string",t=>typeof t=="string"||`Expected a string, but received: ${J(t)}`)}function Qt(t){const e=Yt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(t){const e=Object.keys(t);return new te({type:"type",schema:t,*entries(r){if(K(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(t){const e=t.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...c]=lt(r,s,n),[a]=c;if(a[0])for(const[o]of c)o&&i.push(o);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${J(r)}`,...i]}})}function er(){return W("unknown",()=>!0)}const ft=U([p({AddressOwner:g()}),p({ObjectOwner:g()}),p({Shared:p({initial_shared_version:$(g())})}),k("Immutable")]);W("SuiJsonValue",()=>!0);const Nr=U([p({u32:g()}),p({u64:g()}),p({f64:g()})]);p({attributes:Q(g(),$(Nr)),featureFlags:Q(g(),z()),maxSupportedProtocolVersion:g(),minSupportedProtocolVersion:g(),protocolVersion:g()});U([g(),k("package")]);const ce=p({digest:g(),objectId:g(),version:U([ge(),g(),Mr()])});p({owner:ft,reference:ce});p({objectId:g(),sequenceNumber:g()});p({payment:E(ce),owner:g(),price:g(),budget:g()});const Dr=je(ce,p({type:g(),owner:ft,previousTransaction:g()})),Vr=Q(g(),it()),zr=Q(g(),er()),Fr=p({type:g(),fields:Vr,hasPublicTransfer:z()}),Gr=p({disassembled:zr}),Lr=U([je(Fr,p({dataType:k("moveObject")})),je(Gr,p({dataType:k("package")}))]),Wr=p({type:g(),hasPublicTransfer:z(),version:g(),bcsBytes:g()}),Kr=p({id:g(),moduleMap:Q(g(),g())}),Jr=U([je(Wr,p({dataType:k("moveObject")})),je(Kr,p({dataType:k("package")}))]);BigInt(1e9);const tr=p({code:g(),error:v(g()),object_id:v(g()),parent_object_id:v(g()),version:v(g()),digest:v(g())}),qr=p({data:$(v(Q(g(),g()))),error:$(v(tr))}),Hr=U([qr,v(Q(g(),g()))]),rr=p({objectId:g(),version:g(),digest:g(),type:$(v(g())),content:$(v(Lr)),bcs:$(v(Jr)),owner:$(v(ft)),previousTransaction:$(v(g())),storageRebate:$(v(g())),display:$(v(Hr))});p({showType:$(v(z())),showContent:$(v(z())),showBcs:$(v(z())),showOwner:$(v(z())),showPreviousTransaction:$(v(z())),showStorageRebate:$(v(z())),showDisplay:$(v(z()))});U([k("Exists"),k("notExists"),k("Deleted")]);E(Dr);const Xr=p({data:$(v(rr)),error:$(v(tr))});function Zr(t){return t.data}function Yr(t){if(t.error&&"object_id"in t.error&&"version"in t.error&&"digest"in t.error){const e=t.error;return{objectId:e.object_id,version:e.version,digest:e.digest}}}function Wt(t){if("reference"in t)return t.reference;const e=Zr(t);return e?{objectId:e.objectId,version:e.version,digest:e.digest}:Yr(t)}p({objectId:g(),atCheckpoint:v(ge())});p({data:E(Xr),nextCursor:v($(g())),hasNextPage:z()});U([p({details:rr,status:k("VersionFound")}),p({details:g(),status:k("ObjectNotExists")}),p({details:ce,status:k("ObjectDeleted")}),p({details:Qt([g(),ge()]),status:k("VersionNotFound")}),p({details:p({asked_version:ge(),latest_version:ge(),object_id:g()}),status:k("VersionTooHigh")})]);const Qr=U([g(),p({Object:g()})]);E(Qr);const en=p({address:g(),name:g()}),tn=U([k("Private"),k("Public"),k("Friend")]),gt=p({abilities:E(g())}),rn=p({constraints:gt,isPhantom:z()}),nn=p({TypeParameter:ge()}),Xe=Qt([p({module:g(),package:g(),function:g()}),g()]);p({rank3Days:E(Xe),rank7Days:E(Xe),rank30Days:E(Xe)});function nr(t){if(!t)return!1;if(typeof t=="string"||L(t,nn)||ir(t))return!0;if(typeof t!="object")return!1;const e=t;return!!(L(e.Reference,me)||L(e.MutableReference,me)||L(e.Vector,me))}const me=W("SuiMoveNormalizedType",nr);function ir(t){if(!t||typeof t!="object")return!1;const e=t;if(!e.Struct||typeof e.Struct!="object")return!1;const r=e.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>nr(n)))}W("SuiMoveNormalizedStructType",ir);const sn=p({visibility:tn,isEntry:z(),typeParameters:E(gt),parameters:E(me),return:E(me)}),an=p({name:g(),type:me}),on=p({abilities:gt,typeParameters:E(rn),fields:E(an)}),cn=p({fileFormatVersion:ge(),address:g(),name:g(),friends:E(en),structs:Q(g(),on),exposedFunctions:Q(g(),sn)});Q(g(),cn);function st(t){return typeof t=="object"&&"MutableReference"in t?t.MutableReference:void 0}function sr(t){return typeof t=="object"&&"Reference"in t?t.Reference:void 0}function ht(t){if(typeof t=="object"&&"Struct"in t)return t;const e=sr(t),r=st(t);if(typeof e=="object"&&"Struct"in e)return e;if(typeof r=="object"&&"Struct"in r)return r}function un(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var c=t.length,a=t.charAt(0),o=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var S=0,T=0,f=0,O=y.length;f!==O&&y[f]===0;)f++,S++;for(var B=(O-f)*d+1>>>0,P=new Uint8Array(B);f!==O;){for(var A=y[f],j=0,M=B-1;(A!==0||j<T)&&M!==-1;M--,j++)A+=256*P[M]>>>0,P[M]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=j,f++}for(var q=B-T;q!==B&&P[q]===0;)q++;for(var pe=a.repeat(S);q<B;++q)pe+=t.charAt(P[q]);return pe}function h(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var S=0,T=0,f=0;y[S]===a;)T++,S++;for(var O=(y.length-S)*o+1>>>0,B=new Uint8Array(O);y[S];){var P=e[y.charCodeAt(S)];if(P===255)return;for(var A=0,j=O-1;(P!==0||A<f)&&j!==-1;j--,A++)P+=c*B[j]>>>0,B[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,S++}for(var M=O-f;M!==O&&B[M]===0;)M++;for(var q=new Uint8Array(T+(O-M)),pe=T;M!==O;)q[pe++]=B[M++];return q}function m(y){var S=h(y);if(S)return S;throw new Error("Non-base"+c+" character")}return{encode:u,decodeUnsafe:h,decode:m}}var dn=un;const ln=dn,fn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var gn=ln(fn);const ar=w.getDefaultExportFromCjs(gn),xe=t=>ar.encode(t),pt=t=>ar.decode(t);function ue(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}const Ze=8192;function Be(t){if(t.length<Ze)return btoa(String.fromCharCode(...t));let e="";for(var r=0;r<t.length;r+=Ze){const n=t.slice(r,r+Ze);e+=String.fromCharCode(...n)}return btoa(e)}function Je(t){var i;const e=t.startsWith("0x")?t.slice(2):t,n=((i=(e.length%2===0?e:`0${e}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function Ce(t){return t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}function yt(t){let e=[],r=0;if(t===0)return[0];for(;t>0;)e[r]=t&127,(t>>=7)&&(e[r]|=128),r+=1;return e}function hn(t){let e=0,r=0,n=0;for(;;){let i=t[n];if(n+=1,e|=(i&127)<<r,!(i&128))break;r+=7}return{value:e,length:n}}class or{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),n=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let e=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let e=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(e){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,e);return this.shift(e),n}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,e),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(e){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(e(this,i,r));return n}}function pn(t,e){switch(e){case"base58":return xe(t);case"base64":return Be(t);case"hex":return Ce(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function yn(t,e){switch(e){case"base58":return pt(t);case"base64":return ue(t);case"hex":return Je(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function mt(t,e=["<",">"]){const[r,n]=e,i=[];let s="",c=0;for(let a=0;a<t.length;a++){const o=t[a];if(o===r&&c++,o===n&&c--,c===0&&o===","){i.push(s.trim()),s="";continue}s+=o}return i.push(s.trim()),i}class cr{constructor({size:e=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=r||e,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const r=this.bytePosition+e;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Ye(BigInt(e),8).forEach(r=>this.write8(r)),this}write128(e){return Ye(BigInt(e),16).forEach(r=>this.write8(r)),this}write256(e){return Ye(BigInt(e),32).forEach(r=>this.write8(r)),this}writeULEB(e){return yt(e).forEach(r=>this.write8(r)),this}writeVec(e,r){return this.writeULEB(e.length),Array.from(e).forEach((n,i)=>r(this,n,i,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return pn(this.toBytes(),e)}}function Ye(t,e){let r=new Uint8Array(e),n=0;for(;t>0;)r[n]=Number(t%BigInt(256)),t=t/BigInt(256),n+=1;return r}var ur=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},X=(t,e,r)=>(ur(t,e,"read from private field"),r?r.call(t):e.get(t)),ze=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Fe=(t,e,r,n)=>(ur(t,e,"write to private field"),e.set(t,r),r),ye,Se,Me,ae;const dr=class{constructor(t){ze(this,ye,void 0),ze(this,Se,void 0),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Fe(this,ye,t.write),Fe(this,Se,t.serialize??((e,r)=>{const n=new cr({size:this.serializedSize(e)??void 0,...r});return X(this,ye).call(this,e,n),n.toBytes()})),this.validate=t.validate??(()=>{})}write(t,e){this.validate(t),X(this,ye).call(this,t,e)}serialize(t,e){return this.validate(t),new mn(this,X(this,Se).call(this,t,e))}parse(t){const e=new or(t);return this.read(e)}transform({name:t,input:e,output:r}){return new dr({name:t??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ye).call(this,e(n),i),serializedSize:n=>this.serializedSize(e(n)),serialize:(n,i)=>X(this,Se).call(this,e(n),i),validate:n=>this.validate(e(n))})}};let Z=dr;ye=new WeakMap;Se=new WeakMap;const lr=Symbol.for("@mysten/serialized-bcs");function wt(t){return!!t&&typeof t=="object"&&t[lr]===!0}class mn{constructor(e,r){ze(this,Me,void 0),ze(this,ae,void 0),Fe(this,Me,e),Fe(this,ae,r)}get[lr](){return!0}toBytes(){return X(this,ae)}toHex(){return Ce(X(this,ae))}toBase64(){return Be(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Ge({size:t,...e}){return new Z({...e,serializedSize:()=>t})}function Qe({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function et({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function wn({serialize:t,...e}){const r=new Z({...e,serialize:t,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function bn({toBytes:t,fromBytes:e,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return e(s)},write:(n,i)=>{const s=t(n);i.writeULEB(s.length);for(let c=0;c<s.length;c++)i.write8(s[c])},serialize:n=>{const i=t(n),s=yt(i.length),c=new Uint8Array(s.length+i.length);return c.set(s,0),c.set(i,s.length),c},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function Sn(t){let e=null;function r(){return e||(e=t()),e}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const l={u8(t){return Qe({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...t})},u16(t){return Qe({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...t})},u32(t){return Qe({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...t})},u64(t){return et({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...t})},u128(t){return et({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...t})},u256(t){return et({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...t})},bool(t){return Ge({name:"bool",size:1,read:e=>e.read8()===1,write:(e,r)=>r.write8(e?1:0),...t,validate:e=>{var r;if((r=t==null?void 0:t.validate)==null||r.call(t,e),typeof e!="boolean")throw new TypeError(`Expected boolean, found ${typeof e}`)}})},uleb128(t){return wn({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(yt(e)),...t})},bytes(t,e){return Ge({name:`bytes[${t}]`,size:t,read:r=>r.readBytes(t),write:(r,n)=>{for(let i=0;i<t;i++)n.write8(r[i]??0)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t)throw new TypeError(`Expected array of length ${t}, found ${r.length}`)}})},string(t){return bn({name:"string",toBytes:e=>new TextEncoder().encode(e),fromBytes:e=>new TextDecoder().decode(e),...t})},fixedArray(t,e,r){return new Z({name:`${e.name}[${t}]`,read:n=>{const i=new Array(t);for(let s=0;s<t;s++)i[s]=e.read(n);return i},write:(n,i)=>{for(const s of n)e.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==t)throw new TypeError(`Expected array of length ${t}, found ${n.length}`)}})},option(t){return l.enum(`Option<${t.name}>`,{None:null,Some:t}).transform({input:e=>e==null?{None:!0}:{Some:e},output:e=>"Some"in e?e.Some:null})},vector(t,e){return new Z({name:`vector<${t.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=t.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)t.write(i,n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(t,e){return new Z({name:`(${t.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<t.length;i++){const s=t[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of t)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<t.length;i++)t[i].write(r[i],n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t.length)throw new TypeError(`Expected array of length ${t.length}, found ${r.length}`)}})},struct(t,e,r){const n=Object.entries(e);return new Z({name:t,serializedSize:i=>{let s=0;for(const[c,a]of n){const o=a.serializedSize(i[c]);if(o==null)return null;s+=o}return s},read:i=>{const s={};for(const[c,a]of n)s[c]=a.read(i);return s},write:(i,s)=>{for(const[c,a]of n)a.write(i[c],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(t,e,r){const n=Object.entries(e);return new Z({name:t,read:i=>{const s=i.readULEB(),[c,a]=n[s];return{[c]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[c,a]=Object.entries(i)[0];for(let o=0;o<n.length;o++){const[d,u]=n[o];if(d===c){s.writeULEB(o),u==null||u.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[c]=s;if(!Object.hasOwn(e,c))throw new TypeError(`Invalid enum variant ${c}`)}})},map(t,e){return l.vector(l.tuple([t,e])).transform({name:`Map<${t.name}, ${e.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(t,e){return(...r)=>e(...r).transform({name:`${e.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(t){return Sn(t)}},Tn=32,Te=class{constructor(t){if(this.types=new Map,this.counter=0,t instanceof Te){this.schema=t.schema,this.types=new Map(t.types);return}if(this.schema=t,this.registerAddressType(Te.ADDRESS,t.addressLength,t.addressEncoding),this.registerVectorType(t.vectorType),t.types&&t.types.structs)for(let e of Object.keys(t.types.structs))this.registerStructType(e,t.types.structs[e]);if(t.types&&t.types.enums)for(let e of Object.keys(t.types.enums))this.registerEnumType(e,t.types.enums[e]);if(t.types&&t.types.aliases)for(let e of Object.keys(t.types.aliases))this.registerAlias(e,t.types.aliases[e]);t.withPrimitives!==!1&&vn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(t,e,r){if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).encode(this,e,r,i)}if(typeof t=="object"){const n=this.tempKey();return new Te(this).registerStructType(n,t).ser(n,e,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
|
|
2
2
|
${JSON.stringify(t)}`)}de(t,e,r){if(typeof e=="string")if(r)e=yn(e,r);else throw new Error("To pass a string to `bcs.de`, specify encoding");if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).decode(this,e,i)}if(typeof t=="object"){const n=new Te(this),i=this.tempKey();return n.registerStructType(i,t).de(i,e,r)}throw new Error(`Incorrect type passed into the '.de()' function.
|
|
3
3
|
${JSON.stringify(t)}`)}hasType(t){return this.types.has(t)}registerAlias(t,e){return this.types.set(t,e),this}registerType(t,e,r,n=()=>!0){const{name:i,params:s}=this.parseTypeName(t);return this.types.set(i,{encode(c,a,o,d){const u=s.reduce((h,m,y)=>Object.assign(h,{[m]:d[y]}),{});return this._encodeRaw.call(c,new cr(o),a,d,u)},decode(c,a,o){const d=s.reduce((u,h,m)=>Object.assign(u,{[h]:o[m]}),{});return this._decodeRaw.call(c,new or(a),o,d)},_encodeRaw(c,a,o,d){if(n(a))return e.call(this,c,a,o,d);throw new Error(`Validation failed for type ${i}, data: ${a}`)},_decodeRaw(c,a,o){return r.call(this,c,a,o)}}),this}registerBcsType(t,e){return this.registerType(t,(r,n,i)=>{const s=i.map(c=>new Z({name:String(c),write:(a,o)=>{const{name:d,params:u}=this.parseTypeName(c),h=this.getTypeInterface(d),m=u.reduce((y,S,T)=>Object.assign(y,{[S]:i[T]}),{});return h._encodeRaw.call(this,o,a,u,m)},read:()=>{throw new Error("Not implemented")}}));return e(...s).write(n,r),r},(r,n)=>{const i=n.map(s=>new Z({name:String(s),write:(c,a)=>{throw new Error("Not implemented")},read:c=>{const{name:a,params:o}=this.parseTypeName(s),d=this.getTypeInterface(a),u=o.reduce((h,m,y)=>Object.assign(h,{[m]:n[y]}),{});return d._decodeRaw.call(this,c,o,u)}}));return e(...i).read(r)}),this}registerAddressType(t,e,r="hex"){switch(r){case"base64":return this.registerType(t,function(i,s){return ue(s).reduce((c,a)=>c.write8(a),i)},function(i){return Be(i.readBytes(e))});case"hex":return this.registerType(t,function(i,s){return Je(s).reduce((c,a)=>c.write8(a),i)},function(i){return Ce(i.readBytes(e))});default:throw new Error("Unsupported encoding! Use either hex or base64")}}registerVectorType(t){let{name:e,params:r}=this.parseTypeName(t);if(r.length>1)throw new Error("Vector can have only one type parameter; got "+e);return this.registerType(t,function(i,s,c,a){return i.writeVec(s,(o,d)=>{let u=c[0];if(!u)throw new Error(`Incorrect number of type parameters passed a to vector '${t}'`);let{name:h,params:m}=this.parseTypeName(u);if(this.hasType(h))return this.getTypeInterface(h)._encodeRaw.call(this,o,d,m,a);if(!(h in a))throw new Error(`Unable to find a matching type definition for ${h} in vector; make sure you passed a generic`);let{name:y,params:S}=this.parseTypeName(a[h]);return this.getTypeInterface(y)._encodeRaw.call(this,o,d,S,a)})},function(i,s,c){return i.readVec(a=>{let o=s[0];if(!o)throw new Error(`Incorrect number of type parameters passed to a vector '${t}'`);let{name:d,params:u}=this.parseTypeName(o);if(this.hasType(d))return this.getTypeInterface(d)._decodeRaw.call(this,a,u,c);if(!(d in c))throw new Error(`Unable to find a matching type definition for ${d} in vector; make sure you passed a generic`);let{name:h,params:m}=this.parseTypeName(c[d]);return this.getTypeInterface(h)._decodeRaw.call(this,a,m,c)})})}registerStructType(t,e){for(let c in e){let a=this.tempKey(),o=e[c];!Array.isArray(o)&&typeof o!="string"&&(e[c]=a,this.registerStructType(a,o))}let r=Object.freeze(e),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(t);return this.registerType(t,function(a,o,d,u){if(!o||o.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${o}`);if(d.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${d.length}`);for(let h of n){if(!(h in o))throw new Error(`Struct ${i} requires field ${h}:${r[h]}`);const{name:m,params:y}=this.parseTypeName(r[h]);if(!s.includes(m))this.getTypeInterface(m)._encodeRaw.call(this,a,o[h],y,u);else{const S=s.indexOf(m);let{name:T,params:f}=this.parseTypeName(d[S]);if(this.hasType(T)){this.getTypeInterface(T)._encodeRaw.call(this,a,o[h],f,u);continue}if(!(T in u))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:O,params:B}=this.parseTypeName(u[T]);this.getTypeInterface(O)._encodeRaw.call(this,a,o[h],B,u)}}return a},function(a,o,d){if(o.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${o.length}`);let u={};for(let h of n){const{name:m,params:y}=this.parseTypeName(r[h]);if(!s.includes(m))u[h]=this.getTypeInterface(m)._decodeRaw.call(this,a,y,d);else{const S=s.indexOf(m);let{name:T,params:f}=this.parseTypeName(o[S]);if(this.hasType(T)){u[h]=this.getTypeInterface(T)._decodeRaw.call(this,a,f,d);continue}if(!(T in d))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:O,params:B}=this.parseTypeName(d[T]);u[h]=this.getTypeInterface(O)._decodeRaw.call(this,a,B,d)}}return u})}registerEnumType(t,e){for(let c in e){let a=this.tempKey(),o=e[c];o!==null&&!Array.isArray(o)&&typeof o!="string"&&(e[c]=a,this.registerStructType(a,o))}let r=Object.freeze(e),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(t);return this.registerType(t,function(a,o,d,u){if(!o)throw new Error(`Unable to write enum "${i}", missing data.
|
|
4
4
|
Received: "${o}"`);if(typeof o!="object")throw new Error(`Incorrect data passed into enum "${i}", expected object with properties: "${n.join(" | ")}".
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aW as f, aX as s, aY as t, aZ as c, a_ as O, a$ as d, ac as o, b0 as A, b1 as p } from "./index-
|
|
2
|
-
import { b2 as h } from "./index-
|
|
1
|
+
import { aW as f, aX as s, aY as t, aZ as c, a_ as O, a$ as d, ac as o, b0 as A, b1 as p } from "./index-CttRUMXZ.mjs";
|
|
2
|
+
import { b2 as h } from "./index-CttRUMXZ.mjs";
|
|
3
3
|
class l extends Error {
|
|
4
4
|
constructor(r) {
|
|
5
5
|
super(r);
|