@walletconnect/utils
Version:
Utilities for WalletConnect Protocol
12 lines (11 loc) • 40.6 kB
JavaScript
import{detect as en}from"detect-browser";import{FIVE_MINUTES as je,fromMiliseconds as tn,toMiliseconds as ie}from"@walletconnect/time";import{getLocation as Ce,getDocument as M,getNavigator as Pe}from"@walletconnect/window-getters";import{getWindowMetadata as nn}from"@walletconnect/window-metadata";import{keccak_256 as rn}from"@noble/hashes/sha3";import{Signature as on,Secp256k1 as sn}from"ox";import{sha512_256 as cn,sha256 as xe}from"@noble/hashes/sha2";import{blake2b as an}from"@noble/hashes/blake2";import{decode as un,encode as ln}from"@msgpack/msgpack";import{base58 as L,base32 as dn}from"@scure/base";import{concat as U,toString as m,fromString as h}from"uint8arrays";import{chacha20poly1305 as ke}from"@noble/ciphers/chacha";import{hkdf as fn}from"@noble/hashes/hkdf";import{randomBytes as J}from"@noble/hashes/utils";import{sha256 as z}from"@noble/hashes/sha256";import{x25519 as ce}from"@noble/curves/ed25519";import{p256 as pn}from"@noble/curves/p256";import{decodeJWT as mn}from"@walletconnect/relay-auth";import{RELAY_JSONRPC as hn}from"@walletconnect/relay-api";import{blake2b as gn}from"blakejs";import{generatePlatformLogger as yn}from"@walletconnect/logger";const G=":";function ae(e){const[t,n]=e.split(G);return{namespace:t,reference:n}}function _e(e){const{namespace:t,reference:n}=e;return[t,n].join(G)}function ue(e){const[t,n,r]=e.split(G);return{namespace:t,reference:n,address:r}}function De(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join(G)}function le(e,t){const n=[];return e.forEach(r=>{const o=t(r);n.includes(o)||n.push(o)}),n}function Ve(e){const{address:t}=ue(e);return t}function Me(e){const{namespace:t,reference:n}=ue(e);return _e({namespace:t,reference:n})}function En(e,t){const{namespace:n,reference:r}=ae(t);return De({namespace:n,reference:r,address:e})}function bn(e){return le(e,Ve)}function Le(e){return le(e,Me)}function wn(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...o.accounts)}),n}function Nn(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Le(o.accounts))}),n}function vn(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Y(r,o))}),n}function Y(e,t){return e.includes(":")?[e]:t.chains||[]}const Ke={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Fe={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function N(e,t){const{message:n,code:r}=Fe[e];return{message:t?`${n} ${t}`:n,code:r}}function $(e,t){const{message:n,code:r}=Ke[e];return{message:t?`${n} ${t}`:n,code:r}}const qe="ReactNative",g={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Q=" ",Sn=":",He="/",de=2,On=1e3,Be="js";function fe(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function A(){return!M()&&!!Pe()&&navigator.product===qe}function An(){return A()&&typeof global<"u"&&typeof global?.Platform<"u"&&global?.Platform.OS==="android"}function In(){return A()&&typeof global<"u"&&typeof global?.Platform<"u"&&global?.Platform.OS==="ios"}function x(){return!fe()&&!!Pe()&&!!M()}function j(){return A()?g.reactNative:fe()?g.node:x()?g.browser:g.unknown}function Tn(){try{return A()&&typeof global<"u"&&typeof global?.Application<"u"?global.Application?.applicationId:void 0}catch{return}}function We(e,t){const n=new URLSearchParams(e);return Object.entries(t).sort(([r],[o])=>r.localeCompare(o)).forEach(([r,o])=>{o!=null&&n.set(r,String(o))}),n.toString()}function Rn(e){const t=Je();try{return e?.url&&t.url&&new URL(e.url).host!==new URL(t.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${t.url}. This is probably unintended and can lead to issues.`),e.url=t.url),e?.icons?.length&&e.icons.length>0&&(e.icons=e.icons.filter(n=>n!=="")),{...t,...e,url:e?.url||t.url,name:e?.name||t.name,description:e?.description||t.description,icons:e?.icons?.length&&e.icons.length>0?e.icons:t.icons}}catch(n){return console.warn("Error populating app metadata",n),e||t}}function Je(){return nn()||{name:"",description:"",url:"",icons:[""]}}function Un(e,t){const n=j(),r={protocol:e,version:t,env:n};return n==="browser"&&(r.host=Ce()?.host||"unknown"),r}function ze(){if(j()===g.reactNative&&typeof global<"u"&&typeof global?.Platform<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const e=en();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Ge(){const e=j();return e===g.browser?[e,Ce()?.host||"unknown"].join(":"):e}function Ye(e,t,n){const r=ze(),o=Ge();return[[e,t].join("-"),[Be,n].join("-"),r,o].join("/")}function $n({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i,bundleId:a,packageName:l}){const c=n.split("?"),d=Ye(e,t,r),u={auth:o,ua:d,projectId:s,useOnCloseEvent:i||void 0,packageName:l||void 0,bundleId:a||void 0},p=We(c[1]||"",u);return c[0]+"?"+p}function jn(e){let t=(e.match(/^[^:]+(?=:\/\/)/gi)||[])[0];const n=typeof t<"u"?e.split("://")[1]:e;return t=t==="wss"?"https":"http",[t,n].join("://")}function Cn(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function Qe(e,t=de){return Xe(e.split(He),t)}function Pn(e){return Qe(e).join(Q)}function I(e,t){return e.filter(n=>t.includes(n)).length===e.length}function Xe(e,t=de){return e.slice(Math.max(e.length-t,0))}function xn(e){return Object.fromEntries(e.entries())}function kn(e){return new Map(Object.entries(e))}function _n(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const Dn=e=>e;function Ze(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function Vn(e){return e.split(Q).map(t=>Ze(t)).join(Q)}function Mn(e=je,t){const n=ie(e||je);let r,o,s,i;return{resolve:a=>{s&&r&&(clearTimeout(s),r(a),i=Promise.resolve(a))},reject:a=>{s&&o&&(clearTimeout(s),o(a))},done:()=>new Promise((a,l)=>{if(i)return a(i);s=setTimeout(()=>{const c=N("EXPIRED"),d=new Error(t||c.message);d.code=c.code,l(d)},n),r=a,o=l})}}function Ln(e,t,n){return new Promise(async(r,o)=>{const s=setTimeout(()=>o(new Error(n)),t);try{const i=await e;r(i)}catch(i){o(i)}clearTimeout(s)})}function pe(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Kn(e){return pe("topic",e)}function Fn(e){return pe("id",e)}function qn(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function Hn(e,t){return tn((t||Date.now())+ie(e))}function Bn(e){return Date.now()>=ie(e)}function Wn(e,t){return`${e}${t?`:${t}`:""}`}function w(e=[],t=[]){return[...new Set([...e,...t])]}async function Jn({id:e,topic:t,wcDeepLink:n}){try{if(!n)return;const r=(typeof n=="string"?JSON.parse(n):n)?.href;if(typeof r!="string")return;const o=et(r,e,t),s=j();if(s===g.browser){if(!M()?.hasFocus()){console.warn("Document does not have focus, skipping deeplink.");return}tt(o)}else s===g.reactNative&&typeof global?.Linking<"u"&&await global.Linking.openURL(o)}catch(r){console.error(r)}}function et(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){const s=e.includes("?")?"&startapp=":"?startapp=";o=`${o}${s}${ot(r,!0)}`}else o=`${o}/wc?${r}`;return o}function tt(e){let t="_self";rt()?t="_top":(nt()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function zn(e,t){let n="";try{if(x()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function me(e,t){return e.filter(n=>t.includes(n))}function Gn(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function Yn(){return typeof crypto<"u"&&crypto?.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Qn(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function nt(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function rt(){try{return window.self!==window.top}catch{return!1}}function ot(e,t=!1){const n=new TextEncoder().encode(e),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=String.fromCharCode(n[s]);const o=btoa(r.join(""));return t?o.replace(/[=]/g,""):o}function he(e){const t=e+"=".repeat((4-e.length%4)%4),n=atob(t),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return new TextDecoder().decode(r)}function Xn(e){return new Promise(t=>setTimeout(t,e))}class Zn{constructor({limit:t}){this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(t)}}has(t){return this.set.has(t)}}const er="https://rpc.walletconnect.org/v1";function k(e){const t=e+"=".repeat((4-e.length%4)%4),n=atob(t),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}function ge(e){const t=`Ethereum Signed Message:
${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+m(rn(n),"base16")}async function st(e,t,n,r,o,s){switch(n.t){case"eip191":return await it(e,t,n.s);case"eip1271":return await ct(e,t,n.s,r,o,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function it(e,t,n){const r=on.fromHex(n);return sn.recoverAddress({payload:ge(t),signature:r}).toLowerCase()===e.toLowerCase()}async function ct(e,t,n,r,o,s){const i=ae(r);if(!i.namespace||!i.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",c=n.substring(2),d=(c.length/2).toString(16).padStart(64,"0"),u=(t.startsWith("0x")?t:ge(t)).substring(2),p=a+u+l+d+c,b=await fetch(`${s||er}/?chainId=${r}&projectId=${o}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:tr(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:p},"latest"]})}),{result:f}=await b.json();return f?f.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function tr(){return Date.now()+Math.floor(Math.random()*1e3)}function nr(e){const t=k(e),n=t[0];if(n===0)throw new Error("No signatures found");const r=1+n*64;if(t.length<r)throw new Error("Transaction data too short for claimed signature count");if(t.length<100)throw new Error("Transaction too short");const o=t.slice(1,65);return L.encode(o)}function rr(e){const t=k(e),n=new TextEncoder().encode("TransactionData::"),r=new Uint8Array(n.length+t.length);r.set(n),r.set(t,n.length);const o=an(r,{dkLen:32});return L.encode(o)}function or(e){const t=new Uint8Array(xe(at(e)));return L.encode(t)}function at(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if(typeof e=="object"&&e?.data)return new Uint8Array(Object.values(e.data));if(typeof e=="object"&&e)return new Uint8Array(Object.values(e));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function sr(e){const t=k(e),n=un(t).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=ln(n),o=new TextEncoder().encode("TX"),s=U([o,new Uint8Array(r)]),i=cn(s);return dn.encode(i).replace(/=+$/,"")}function ye(e){const t=[];let n=BigInt(e);for(;n>=0x80n;)t.push(Number(n&0x7fn|0x80n)),n>>=7n;return t.push(Number(n)),new Uint8Array(t)}function ir(e){const t=k(e.signed.bodyBytes),n=k(e.signed.authInfoBytes),r=k(e.signature.signature),o=[];o.push(new Uint8Array([10])),o.push(ye(t.length)),o.push(t),o.push(new Uint8Array([18])),o.push(ye(n.length)),o.push(n),o.push(new Uint8Array([26])),o.push(ye(r.length)),o.push(r);const s=U(o),i=xe(s);return m(i,"base16").toUpperCase()}function cr(e){const t=[];try{if(typeof e=="string")return t.push(e),t;if(typeof e!="object")return t;e?.id&&t.push(e.id);const n=e?.capabilities?.caip345?.transactionHashes;n&&t.push(...n)}catch(n){console.warn("getWalletSendCallsHashes failed: ",n)}return t}const ut="did:pkh:",ar={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},ur=e=>e?ar[e]||e:"",K=e=>e?.split(":"),lt=e=>{const t=e&&K(e);if(t)return e.includes(ut)?t[3]:t[1]},dt=e=>{const t=e&&K(e);if(t)return e.includes(ut)?t[2]:t[0]},ft=e=>{const t=e&&K(e);if(t)return t[2]+":"+t[3]},Ee=e=>{const t=e&&K(e);if(t)return t.pop()};async function lr(e){const{cacao:t,projectId:n}=e,{s:r,p:o}=t,s=pt(o,o.iss),i=Ee(o.iss);return await st(i,s,r,ft(o.iss),n)}const pt=(e,t)=>{const n=dt(t);if(!n)throw new Error("Invalid issuer: "+t);const r=`${e.domain} wants you to sign in with your ${ur(n)} account:`,o=Ee(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,a=`Version: ${e.version}`,l=`Chain ID: ${lt(t)}`,c=`Nonce: ${e.nonce}`,d=`Issued At: ${e.iat}`,u=e.exp?`Expiration Time: ${e.exp}`:void 0,p=e.nbf?`Not Before: ${e.nbf}`:void 0,b=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map(V=>`
- ${V}`).join("")}`:void 0,O=Z(e.resources);if(O){const V=T(O);s=Ne(s,V)}return[r,o,"",s,"",i,a,l,c,d,u,p,b,f].filter(V=>V!=null).join(`
`)};function dr(e,t,n){return n.includes("did:pkh:")||(n=`did:pkh:${n}`),{h:{t:"caip122"},p:{iss:n,domain:e.domain,aud:e.aud,version:e.version,nonce:e.nonce,iat:e.iat,statement:e.statement,requestId:e.requestId,resources:e.resources,nbf:e.nbf,exp:e.exp},s:t}}function fr(e){const{authPayload:t,chains:n,methods:r}=e,o=t.statement||"";if(!n?.length)return t;const s=t.chains,i=me(s,n);if(!i?.length)throw new Error("No supported chains");const a=mt(t.resources);if(!a)return t;v(a);const l=ht(a,"eip155");let c=t?.resources||[];if(l?.length){const d=gt(l),u=me(d,r);if(!u?.length)throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(d)}, supported: ${JSON.stringify(r)}`);const p=be("request",u,{chains:i}),b=wt(a,"eip155",p);c=t?.resources?.slice(0,-1)||[],c.push(X(b))}return{...t,statement:vt(o,Z(c)),chains:i,resources:t?.resources||c.length>0?c:void 0}}function mt(e){const t=Z(e);if(t&&we(t))return T(t)}function pr(e,t){return e?.att?.hasOwnProperty(t)}function ht(e,t){return e?.att?.[t]?Object.keys(e?.att?.[t]):[]}function mr(e){return e?.map(t=>Object.keys(t))||[]}function gt(e){return e?.map(t=>t.split("/")?.[1])||[]}function yt(e){const t=JSON.stringify(e),n=new TextEncoder().encode(t),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=String.fromCharCode(n[o]);return btoa(r.join(""))}function Et(e){const t=e+"=".repeat((4-e.length%4)%4),n=atob(t),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return JSON.parse(new TextDecoder().decode(r))}function v(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!t?.length)throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(o=>{const s=r[o];if(!Array.isArray(s))throw new Error(`Ability limits ${o} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${o} is empty array, must be an array with objects`);s.forEach(i=>{if(typeof i!="object")throw new Error(`Ability limits (${o}) must be an array of objects, found: ${i}`)})})})}function bt(e,t,n,r={}){return n?.sort((o,s)=>o.localeCompare(s)),{att:{[e]:be(t,n,r)}}}function wt(e,t,n){e.att[t]={...n};const r=Object.keys(e.att)?.sort((s,i)=>s.localeCompare(i)),o={att:{}};return r.reduce((s,i)=>(s.att[i]=e.att[i],s),o)}function be(e,t,n={}){t=t?.sort((o,s)=>o.localeCompare(s));const r=t.map(o=>({[`${e}/${o}`]:[n]}));return Object.assign({},...r)}function X(e){return v(e),`urn:recap:${yt(e).replace(/=/g,"")}`}function T(e){const t=Et(e.replace("urn:recap:",""));return v(t),t}function hr(e,t,n){const r=bt(e,t,n);return X(r)}function we(e){return e&&e.includes("urn:recap:")}function gr(e,t){const n=T(e),r=T(t),o=Nt(n,r);return X(o)}function Nt(e,t){v(e),v(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((o,s)=>o.localeCompare(s)),r={att:{}};return n.forEach(o=>{Object.keys(e.att?.[o]||{}).concat(Object.keys(t.att?.[o]||{})).sort((s,i)=>s.localeCompare(i)).forEach(s=>{r.att[o]={...r.att[o],[s]:e.att[o]?.[s]||t.att[o]?.[s]}})}),r}function Ne(e="",t){v(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let o=0;Object.keys(t.att).forEach(a=>{const l=Object.keys(t.att[a]).map(u=>({ability:u.split("/")[0],action:u.split("/")[1]}));l.sort((u,p)=>u.action.localeCompare(p.action));const c={};l.forEach(u=>{c[u.ability]||(c[u.ability]=[]),c[u.ability].push(u.action)});const d=Object.keys(c).map(u=>(o++,`(${o}) '${u}': '${c[u].join("', '")}' for '${a}'.`));r.push(d.join(", ").replace(".,","."))});const s=r.join(" "),i=`${n}${s}`;return`${e?e+" ":""}${i}`}function yr(e){const t=T(e);v(t);const n=t.att?.eip155;return n?Object.keys(n).map(r=>r.split("/")[1]):[]}function Er(e){const t=T(e);v(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(o=>{o?.[0]?.chains&&n.push(o[0].chains)})}),[...new Set(n.flat())]}function vt(e,t){if(!t)return e;const n=T(t);return v(n),Ne(e,n)}function Z(e){if(!e)return;const t=e?.[e.length-1];return we(t)?t:void 0}const ve="base10",y="base16",S="base64pad",ee="base64url",_="utf8",Se=0,D=1,F=2,br=0,St=1,q=12,Oe=32;function wr(){const e=ce.utils.randomPrivateKey(),t=ce.getPublicKey(e);return{privateKey:m(e,y),publicKey:m(t,y)}}function Nr(){const e=J(Oe);return m(e,y)}function vr(e,t){const n=ce.getSharedSecret(h(e,y),h(t,y)),r=fn(z,n,void 0,void 0,Oe);return m(r,y)}function Sr(e){const t=z(h(e,y));return m(t,y)}function Or(e){const t=z(h(e,_));return m(t,y)}function Ae(e){return h(`${e}`,ve)}function C(e){return Number(m(e,ve))}function Ot(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function te(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4;return t+"=".repeat(n)}function Ar(e){const t=Ae(typeof e.type<"u"?e.type:Se);if(C(t)===D&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?h(e.senderPublicKey,y):void 0,r=typeof e.iv<"u"?h(e.iv,y):J(q),o=h(e.symKey,y),s=ke(o,r).encrypt(h(e.message,_)),i=Ie({type:t,sealed:s,iv:r,senderPublicKey:n});return e.encoding===ee?Ot(i):i}function Ir(e){const t=h(e.symKey,y),{sealed:n,iv:r}=ne({encoded:e.encoded,encoding:e.encoding}),o=ke(t,r).decrypt(n);if(o===null)throw new Error("Failed to decrypt");return m(o,_)}function Tr(e,t){const n=Ae(F),r=J(q),o=h(e,_),s=Ie({type:n,sealed:o,iv:r});return t===ee?Ot(s):s}function Rr(e,t){const{sealed:n}=ne({encoded:e,encoding:t});return m(n,_)}function Ie(e){if(C(e.type)===F)return m(U([e.type,e.sealed]),S);if(C(e.type)===D){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return m(U([e.type,e.senderPublicKey,e.iv,e.sealed]),S)}return m(U([e.type,e.iv,e.sealed]),S)}function ne(e){const t=(e.encoding||S)===ee?te(e.encoded):e.encoded,n=h(t,S),r=n.slice(br,St),o=St;if(C(r)===D){const l=o+Oe,c=l+q,d=n.slice(o,l),u=n.slice(l,c),p=n.slice(c);return{type:r,sealed:p,iv:u,senderPublicKey:d}}if(C(r)===F){const l=n.slice(o),c=J(q);return{type:r,sealed:l,iv:c}}const s=o+q,i=n.slice(o,s),a=n.slice(s);return{type:r,sealed:a,iv:i}}function Ur(e,t){const n=ne({encoded:e,encoding:t?.encoding});return At({type:C(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?m(n.senderPublicKey,y):void 0,receiverPublicKey:t?.receiverPublicKey})}function At(e){const t=e?.type||Se;if(t===D){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function $r(e){return e.type===D&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}function jr(e){return e.type===F}function It(e){const t=h(te(e.x),S),n=h(te(e.y),S);return U([new Uint8Array([4]),t,n])}function Cr(e,t){const[n,r,o]=e.split("."),s=h(te(o),S);if(s.length!==64)throw new Error("Invalid signature length");const i=s.slice(0,32),a=s.slice(32,64),l=`${n}.${r}`,c=z(l),d=It(t);if(!pn.verify(U([i,a]),c,d))throw new Error("Invalid signature");return mn(e).payload}const Tt="irn";function Pr(e){return e?.relay||{protocol:Tt}}function xr(e){const t=hn[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}function Rt(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(o=>{if(o.startsWith(r)){const s=o.replace(r,""),i=e[o];n[s]=i}}),n}function kr(e){if(!e.includes("wc:")){const c=he(e);c?.includes("wc:")&&(e=c)}e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),n=e.indexOf("?")!==-1?e.indexOf("?"):void 0,r=e.substring(0,t),o=e.substring(t+1,n).split("@"),s=typeof n<"u"?e.substring(n):"",i=new URLSearchParams(s),a=Object.fromEntries(i.entries()),l=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:r,topic:Ut(o[0]),version:parseInt(o[1],10),symKey:a.symKey,relay:Rt(a),methods:l,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Ut(e){return e.startsWith("//")?e.substring(2):e}function $t(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(o=>{const s=o,i=n+t+s;e[s]&&(r[i]=e[s])}),r}function _r(e){const t=new URLSearchParams,n={...$t(e.relay),symKey:e.symKey,...e.expiryTimestamp&&{expiryTimestamp:e.expiryTimestamp.toString()},...e.methods&&{methods:e.methods.join(",")}};return Object.entries(n).sort(([r],[o])=>r.localeCompare(o)).forEach(([r,o])=>{o!==void 0&&t.append(r,String(o))}),`${e.protocol}:${e.topic}@${e.version}?${t}`}function Dr(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}function P(e){const t=[];return e.forEach(n=>{const[r,o]=n.split(":");t.push(`${r}:${o}`)}),t}function jt(e){const t=[];return Object.values(e).forEach(n=>{t.push(...P(n.accounts))}),[...new Set(t)]}function Vr(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.methods)}),[...new Set(t)]}function Mr(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.events)}),[...new Set(t)]}function Ct(e,t){const n=[];return Object.values(e).forEach(r=>{P(r.accounts).includes(t)&&n.push(...r.methods)}),n}function Pt(e,t){const n=[];return Object.values(e).forEach(r=>{P(r.accounts).includes(t)&&n.push(...r.events)}),n}function Lr(e,t){const n=Ft(e,t);if(n)throw new Error(n.message);const r={};for(const[o,s]of Object.entries(e))r[o]={methods:s.methods,events:s.events,chains:s.accounts.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)};return r}function Kr(e){const{proposal:{requiredNamespaces:t,optionalNamespaces:n={}},supportedNamespaces:r}=e,o=H(t),s=H(n),i={};Object.keys(r).forEach(c=>{const d=r[c].chains,u=r[c].methods,p=r[c].events,b=r[c].accounts;d.forEach(f=>{if(!b.some(O=>O.includes(f)))throw new Error(`No accounts provided for chain ${f} in namespace ${c}`)}),i[c]={chains:d,methods:u,events:p,accounts:b}});const a=Ht(t,i,"approve()");if(a)throw new Error(a.message);const l={};if(!Object.keys(t).length&&!Object.keys(n).length)return i;Object.keys(o).forEach(c=>{const d=r[c].chains.filter(f=>o[c]?.chains?.includes(f)),u=r[c].methods.filter(f=>o[c]?.methods?.includes(f)),p=r[c].events.filter(f=>o[c]?.events?.includes(f)),b=d.map(f=>r[c].accounts.filter(O=>O.includes(`${f}:`))).flat();l[c]={chains:d,methods:u,events:p,accounts:b}}),Object.keys(s).forEach(c=>{if(!r[c])return;const d=s[c]?.chains?.filter(f=>r[c].chains.includes(f)),u=r[c].methods.filter(f=>s[c]?.methods?.includes(f)),p=r[c].events.filter(f=>s[c]?.events?.includes(f)),b=d?.map(f=>r[c].accounts.filter(O=>O.includes(`${f}:`))).flat();l[c]={chains:w(l[c]?.chains,d),methods:w(l[c]?.methods,u),events:w(l[c]?.events,p),accounts:w(l[c]?.accounts,b)}});for(const[c,d]of Object.entries(l))(d.accounts.length===0||d?.chains?.length===0)&&delete l[c];return l}function Te(e){return e.includes(":")}function xt(e){return Te(e)?e.split(":")[0]:e}function H(e){const t={};if(!re(e))return t;for(const[n,r]of Object.entries(e)){const o=Te(n)?[n]:r.chains,s=r.methods||[],i=r.events||[],a=xt(n);t[a]={...t[a],chains:w(o,t[a]?.chains),methods:w(s,t[a]?.methods),events:w(i,t[a]?.events)}}return t}function kt(e){const t={};return e?.forEach(n=>{const[r,o]=n.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[],methods:[]}),t[r].accounts.push(n),t[r].chains?.push(`${r}:${o}`)}),t}function Fr(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=kt(t);for(const[r,o]of Object.entries(n))o.methods?o.methods=w(o.methods,e):o.methods=e,o.events=["chainChanged","accountsChanged"];return n}function qr(e,t){const n=H(e),r=H(t),o={},s=Object.keys(n).concat(Object.keys(r));for(const i of s)o[i]={chains:w(n[i]?.chains,r[i]?.chains),methods:w(n[i]?.methods,r[i]?.methods),events:w(n[i]?.events,r[i]?.events)};return o}function B(e,t){return Array.isArray(e)?typeof t<"u"&&e.length?e.every(t):!0:!1}function re(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function R(e){return typeof e>"u"}function E(e,t){return t&&R(e)?!0:typeof e=="string"&&!!e.trim().length}function oe(e,t){return t&&R(e)?!0:typeof e=="number"&&!isNaN(e)}function Hr(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),o=Object.keys(n);let s=!0;return I(o,r)?(r.forEach(i=>{const{accounts:a,methods:l,events:c}=e.namespaces[i],d=P(a),u=n[i];(!I(Y(i,u),d)||!I(u.methods,l)||!I(u.events,c))&&(s=!1)}),s):!1}function W(e){return E(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function _t(e){if(E(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&W(n)}}return!1}function Br(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(E(e,!1)){if(t(e))return!0;const n=he(e);return t(n)}}catch{}return!1}function Wr(e){return e?.proposer?.publicKey}function Jr(e){return e?.topic}function zr(e,t){let n=null;return E(e?.publicKey,!1)||(n=N("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function Re(e){let t=!0;return B(e)?e.length&&(t=e.every(n=>E(n,!1))):t=!1,t}function Dt(e,t,n){let r=null;return B(t)&&t.length?t.forEach(o=>{r||W(o)||(r=$("UNSUPPORTED_CHAINS",`${n}, chain ${o} should be a string and conform to "namespace:chainId" format`))}):W(e)||(r=$("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function Vt(e,t,n){let r=null;return Object.entries(e).forEach(([o,s])=>{if(r)return;const i=Dt(o,Y(o,s),`${t} ${n}`);i&&(r=i)}),r}function Mt(e,t){let n=null;return B(e)?e.forEach(r=>{n||_t(r)||(n=$("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=$("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function Lt(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const o=Mt(r?.accounts,`${t} namespace`);o&&(n=o)}),n}function Kt(e,t){let n=null;return Re(e?.methods)?Re(e?.events)||(n=$("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=$("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function Ue(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const o=Kt(r,`${t}, namespace`);o&&(n=o)}),n}function Gr(e,t,n){let r=null;if(e&&re(e)){const o=Ue(e,t);o&&(r=o);const s=Vt(e,t,n);s&&(r=s)}else r=N("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function Ft(e,t){let n=null;if(e&&re(e)){const r=Ue(e,t);r&&(n=r);const o=Lt(e,t);o&&(n=o)}else n=N("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function qt(e){return E(e.protocol,!0)}function Yr(e,t){let n=!1;return t&&!e?n=!0:e&&B(e)&&e.length&&e.forEach(r=>{n=qt(r)}),n}function Qr(e){return typeof e=="number"}function Xr(e){return typeof e<"u"&&typeof e!==null}function Zr(e){return!(!e||typeof e!="object"||!e.code||!oe(e.code,!1)||!e.message||!E(e.message,!1))}function eo(e){return!(R(e)||!E(e.method,!1))}function to(e){return!(R(e)||R(e.result)&&R(e.error)||!oe(e.id,!1)||!E(e.jsonrpc,!1))}function no(e){return!(R(e)||!E(e.name,!1))}function ro(e,t){return!(!W(t)||!jt(e).includes(t))}function oo(e,t,n){return E(n,!1)?Ct(e,t).includes(n):!1}function so(e,t,n){return E(n,!1)?Pt(e,t).includes(n):!1}function Ht(e,t,n){let r=null;const o=io(e),s=co(t),i=Object.keys(o),a=Object.keys(s),l=Bt(Object.keys(e)),c=Bt(Object.keys(t)),d=l.filter(u=>!c.includes(u));return d.length&&(r=N("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.
Required: ${d.toString()}
Received: ${Object.keys(t).toString()}`)),I(i,a)||(r=N("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces.
Required: ${i.toString()}
Approved: ${a.toString()}`)),Object.keys(t).forEach(u=>{if(!u.includes(":")||r)return;const p=P(t[u].accounts);p.includes(u)||(r=N("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${u}
Required: ${u}
Approved: ${p.toString()}`))}),i.forEach(u=>{r||(I(o[u].methods,s[u].methods)?I(o[u].events,s[u].events)||(r=N("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${u}`)):r=N("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${u}`))}),r}function io(e){const t={};return Object.keys(e).forEach(n=>{n.includes(":")?t[n]=e[n]:e[n].chains?.forEach(r=>{t[r]={methods:e[n].methods,events:e[n].events}})}),t}function Bt(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}function co(e){const t={};return Object.keys(e).forEach(n=>{n.includes(":")?t[n]=e[n]:P(e[n].accounts)?.forEach(r=>{t[r]={accounts:e[n].accounts.filter(o=>o.includes(`${r}:`)),methods:e[n].methods,events:e[n].events}})}),t}function ao(e,t){return oe(e,!1)&&e<=t.max&&e>=t.min}function uo(){const e=j();return new Promise(t=>{switch(e){case g.browser:t(Wt());break;case g.reactNative:t(Jt());break;case g.node:t(zt());break;default:t(!0)}})}function Wt(){return x()&&navigator?.onLine}async function Jt(){return A()&&typeof global<"u"&&global?.NetInfo?(await global?.NetInfo.fetch())?.isConnected:!0}function zt(){return!0}function lo(e){switch(j()){case g.browser:Gt(e);break;case g.reactNative:Yt(e);break;case g.node:break}}function Gt(e){!A()&&x()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function Yt(e){A()&&typeof global<"u"&&global?.NetInfo&&global?.NetInfo.addEventListener(t=>e(t?.isConnected))}function fo(){return x()&&M()?M()?.visibilityState==="visible":!0}const $e={};class po{static get(t){return $e[t]}static set(t,n){$e[t]=n}static delete(t){delete $e[t]}}function Qt(e){const t=L.decode(e);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Xt({publicKey:e,signature:t,payload:n}){const r=se(n.method),o=128|parseInt(n.version?.toString()||"4"),s=ho(n.address),i=n.era==="00"?new Uint8Array([0]):se(n.era);if(i.length!==1&&i.length!==2)throw new Error("Invalid era length");const a=parseInt(n.nonce,16),l=new Uint8Array([a&255,a>>8&255]),c=BigInt(`0x${mo(n.tip)}`),d=yo(c),u=new Uint8Array([0,...e,s,...t,...i,...l,...d,...r]),p=go(u.length+1);return new Uint8Array([...p,o,...u])}function Zt(e){const t=se(e),n=gn(t,void 0,32);return"0x"+m(n,"base16")}function se(e){return new Uint8Array(e.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function mo(e){return e.startsWith("0x")?e.slice(2):e}function ho(e){const t=L.decode(e)[0];return t===42?0:t===60?2:1}function go(e){if(e<64)return new Uint8Array([e<<2]);if(e<16384){const t=e<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(e<1<<30){const t=e<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function yo(e){if(e<1n<<6n)return new Uint8Array([Number(e<<2n)]);if(e<1n<<14n){const t=e<<2n|0x01n;return new Uint8Array([Number(t&0xffn),Number(t>>8n&0xffn)])}else if(e<1n<<30n){const t=e<<2n|0x02n;return new Uint8Array([Number(t&0xffn),Number(t>>8n&0xffn),Number(t>>16n&0xffn),Number(t>>24n&0xffn)])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Eo(e){const t=se(e.signature),n=Qt(e.transaction.address),r=Xt({publicKey:n,signature:t,payload:e.transaction}),o=m(r,"base16");return Zt(o)}function bo({logger:e,name:t}){const n=typeof e=="string"?yn({opts:{level:e,name:t}}).logger:e;return n.level=typeof e=="string"?e:e.level,n}export{ve as BASE10,y as BASE16,S as BASE64,ee as BASE64URL,Sn as COLON,de as DEFAULT_DEPTH,Q as EMPTY_SPACE,g as ENV_MAP,Fe as INTERNAL_ERRORS,Zn as LimitedSet,po as MemoryStore,On as ONE_THOUSAND,qe as REACT_NATIVE_PRODUCT,Tt as RELAYER_DEFAULT_PROTOCOL,Ke as SDK_ERRORS,Be as SDK_TYPE,He as SLASH,Se as TYPE_0,D as TYPE_1,F as TYPE_2,_ as UTF8,wt as addResourceToRecap,Xt as addSignatureToExtrinsic,We as appendToQueryString,Cn as assertType,be as assignAbilityToActions,Et as base64Decode,yt as base64Encode,Kr as buildApprovedNamespaces,dr as buildAuthObject,Fr as buildNamespacesFromAuth,vt as buildRecapStatement,Eo as buildSignedExtrinsicHash,Hn as calcExpiry,Vn as capitalize,Ze as capitalizeWord,Mn as createDelayedPromise,hr as createEncodedRecap,Ln as createExpiringPromise,bo as createLogger,bt as createRecap,T as decodeRecap,C as decodeTypeByte,Rr as decodeTypeTwoEnvelope,Ir as decrypt,Zt as deriveExtrinsicHash,vr as deriveSymKey,ne as deserialize,X as encodeRecap,Ae as encodeTypeByte,Tr as encodeTypeTwoEnvelope,Ar as encrypt,Wn as engineEvent,Dn as enumify,nr as extractSolanaTransactionId,De as formatAccountId,En as formatAccountWithChain,_e as formatChainId,et as formatDeeplinkUrl,pe as formatExpirerTarget,Fn as formatIdTarget,pt as formatMessage,Pn as formatMessageContext,$t as formatRelayParams,$n as formatRelayRpcUrl,Ne as formatStatementFromRecap,Kn as formatTopicTarget,Ye as formatUA,_r as formatUri,he as fromBase64,wr as generateKeyPair,Nr as generateRandomBytes32,P as getAccountsChains,wn as getAccountsFromNamespaces,Ve as getAddressFromAccount,bn as getAddressesFromAccounts,sr as getAlgorandTransactionId,Tn as getAppId,Je as getAppMetadata,Wt as getBrowserOnlineStatus,Me as getChainFromAccount,Le as getChainsFromAccounts,Y as getChainsFromNamespace,Nn as getChainsFromNamespaces,Er as getChainsFromRecap,vn as getChainsFromRequiredNamespaces,me as getCommonValuesInArrays,It as getCryptoKeyFromKeyData,mt as getDecodedRecapFromResources,zn as getDeepLink,Ee as getDidAddress,dt as getDidAddressNamespace,K as getDidAddressSegments,lt as getDidChainId,j as getEnvironment,jn as getHttpUrl,N as getInternalError,Ge as getJavascriptID,ze as getJavascriptOS,Xe as getLastItems,Dr as getLinkModeURL,yr as getMethodsFromRecap,ft as getNamespacedDidChainId,jt as getNamespacesChains,Mr as getNamespacesEvents,Pt as getNamespacesEventsForChainId,kt as getNamespacesFromAccounts,Vr as getNamespacesMethods,Ct as getNamespacesMethodsForChainId,or as getNearTransactionIdFromSignedTransaction,at as getNearUint8ArrayFromBytes,zt as getNodeOnlineStatus,gt as getReCapActions,Jt as getReactNativeOnlineStatus,mr as getRecapAbilitiesFromResource,Z as getRecapFromResources,ht as getRecapResource,Un as getRelayClientMetadata,xr as getRelayProtocolApi,Pr as getRelayProtocolName,Lr as getRequiredNamespacesFromNamespaces,$ as getSdkError,Gn as getSearchParamFromURL,ir as getSignDirectHash,rr as getSuiDigest,le as getUniqueValues,cr as getWalletSendCallsHashes,Jn as handleDeeplinkRedirect,I as hasOverlap,ge as hashEthereumMessage,Sr as hashKey,Or as hashMessage,An as isAndroid,fo as isAppVisible,x as isBrowser,Te as isCaipNamespace,Ht as isConformingNamespaces,Bn as isExpired,rt as isIframe,In as isIos,fe as isNode,uo as isOnline,Wr as isProposalStruct,A as isReactNative,we as isRecap,Hr as isSessionCompatible,Jr as isSessionStruct,nt as isTelegram,Qn as isTestRun,$r as isTypeOneEnvelope,jr as isTypeTwoEnvelope,R as isUndefined,_t as isValidAccountId,Mt as isValidAccounts,Kt as isValidActions,B as isValidArray,W as isValidChainId,Dt as isValidChains,zr as isValidController,ct as isValidEip1271Signature,it as isValidEip191Signature,Zr as isValidErrorReason,no as isValidEvent,Qr as isValidId,Lt as isValidNamespaceAccounts,Ue as isValidNamespaceActions,Vt as isValidNamespaceChains,Re as isValidNamespaceMethodsOrEvents,Ft as isValidNamespaces,ro as isValidNamespacesChainId,so as isValidNamespacesEvent,oo as isValidNamespacesRequest,oe as isValidNumber,re as isValidObject,Xr as isValidParams,v as isValidRecap,qt as isValidRelay,Yr as isValidRelays,eo as isValidRequest,ao as isValidRequestExpiry,Gr as isValidRequiredNamespaces,to as isValidResponse,E as isValidString,Br as isValidUrl,_n as mapEntries,xn as mapToObj,w as mergeArrays,gr as mergeEncodedRecaps,Nt as mergeRecaps,qr as mergeRequiredAndOptionalNamespaces,H as normalizeNamespaces,kn as objToMap,tt as openDeeplink,ue as parseAccountId,ae as parseChainId,Qe as parseContextNames,qn as parseExpirerTarget,xt as parseNamespaceKey,Rt as parseRelayParams,Ut as parseTopic,kr as parseUri,Rn as populateAppMetadata,fr as populateAuthPayload,pr as recapHasResource,Ie as serialize,Xn as sleep,Qt as ss58AddressToPublicKey,Gt as subscribeToBrowserNetworkChange,lo as subscribeToNetworkChange,Yt as subscribeToReactNativeNetworkChange,ot as toBase64,Yn as uuidv4,Ur as validateDecoding,At as validateEncoding,lr as validateSignedCacao,Cr as verifyP256Jwt,st as verifySignature};
//# sourceMappingURL=index.js.map