@wormhole-foundation/wormhole-connect 2.1.0-beta.4-development → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1 -1
- package/lib/{aptos-zuWdA6my.mjs → aptos-BqK7cMly.mjs} +2 -2
- package/lib/{aptos-otpuaKYt.js → aptos-C7pCAbUg.js} +2 -2
- package/lib/{aptos-CE1z5RIR.js → aptos-DYNyya4r.js} +1 -1
- package/lib/{aptos-7bfFeMdP.mjs → aptos-hNRlQB2L.mjs} +5 -5
- package/lib/{base64-k-Os5ldO.mjs → base64-BVPj2zYr.mjs} +1 -1
- package/lib/{base64-kjIpMcmW.js → base64-KSl9zI2U.js} +1 -1
- package/lib/{ccip-Bap8XFZB.mjs → ccip-B6vHFB5O.mjs} +1 -1
- package/lib/{ccip-BWC0vPMX.js → ccip-zobR3MWX.js} +1 -1
- package/lib/{chunk-IMTC3J2M-CpYue-QB.js → chunk-IMTC3J2M-Clcv-kNR.js} +1 -1
- package/lib/{chunk-IMTC3J2M-BXX6zaqr.mjs → chunk-IMTC3J2M-D7LWAYQa.mjs} +3 -3
- package/lib/{events-BYQcWm6S.mjs → events-FSoXRy3T.mjs} +1 -1
- package/lib/{events-CpvDCRB6.js → events-bGzCAvB8.js} +1 -1
- package/lib/{evm-BqioDqJQ.mjs → evm-BLO6Qv4a.mjs} +5 -5
- package/lib/{evm-CnzdN7DL.js → evm-CG-xuonQ.js} +3 -3
- package/lib/{evm-Mwom3m1b.mjs → evm-CN1iRHbr.mjs} +5 -5
- package/lib/{evm-D_gq6Vkl.js → evm-DYzdDx7h.js} +1 -1
- package/lib/{index-Y446HRy8.js → index--GEXYLpJ.js} +1 -1
- package/lib/{index-DXxwhxlz.mjs → index-0sRAi_-E.mjs} +23111 -23110
- package/lib/{index-C8kUlYxX.mjs → index-B4iVrVli.mjs} +2 -2
- package/lib/{index-WOTkpZNS.js → index-B5H5W-MP.js} +145 -145
- package/lib/{index-H9KqFgmp.js → index-BDTERphb.js} +1 -1
- package/lib/{index-BWUeb28M.mjs → index-BK9yAEqb.mjs} +2 -2
- package/lib/{index-qKiBJqxf.mjs → index-Ba7hi5Nv.mjs} +2 -2
- package/lib/{index-CPZPv8ma.js → index-Bb1cX9pM.js} +1 -1
- package/lib/{index-Ck2lgHfH.mjs → index-BdpPXZHn.mjs} +2 -2
- package/lib/{index-C8uhXGvb.js → index-BnZRt2Rd.js} +1 -1
- package/lib/{index-C5Z4SKFb.js → index-Bu6Mzk1B.js} +1 -1
- package/lib/{index-B9GJ0P2Y.js → index-BwcOlw60.js} +1 -1
- package/lib/{index-nmuj3_P0.mjs → index-BxEy7t5U.mjs} +2 -2
- package/lib/{index-D4D9pisy.mjs → index-BztaZVVL.mjs} +2 -2
- package/lib/{index-CsvfK_04.js → index-C-Fyx20B.js} +1 -1
- package/lib/{index-CQ-vXwWG.js → index-CEyJtiJA.js} +1 -1
- package/lib/{index-BNu2XU7B.js → index-CIr2v4IG.js} +1 -1
- package/lib/{index-BrLmYS1g.js → index-CtaGVEFZ.js} +1 -1
- package/lib/{index-BGh4lL9A.mjs → index-D1_1z7Wk.mjs} +1 -1
- package/lib/{index-LRbQsraN.js → index-D27hH8sY.js} +1 -1
- package/lib/{index-CpquIcpv.js → index-D75bWNLu.js} +1 -1
- package/lib/{index-CWeUuvwd.js → index-D8RCiuJ0.js} +1 -1
- package/lib/{index-BDfVMafv.js → index-DGrbzOIm.js} +1 -1
- package/lib/{index-CNrMl-ka.mjs → index-DI6kRBN0.mjs} +5 -5
- package/lib/{index-BNmhIn8v.mjs → index-DJMHyNjD.mjs} +2 -2
- package/lib/{index-DYSyjZam.mjs → index-DK3F1NhB.mjs} +4 -4
- package/lib/{index-DLMhM2Ah.mjs → index-DVHcJTqD.mjs} +1 -1
- package/lib/{index-iQUhiTbf.js → index-D_LeK8MJ.js} +1 -1
- package/lib/{index-CLjMuc-R.mjs → index-DcrVBUpc.mjs} +1 -1
- package/lib/{index-Bb7Z_dn3.mjs → index-DdL20a7t.mjs} +2 -2
- package/lib/{index-Dn17pEx3.js → index-DqmfSmiO.js} +1 -1
- package/lib/{index-DUMDc9-8.js → index-IzqkKy3R.js} +1 -1
- package/lib/{index-B_z7jrcA.mjs → index-O6PU89nP.mjs} +2 -2
- package/lib/{index-C2xA6weJ.mjs → index-QgCTXUa6.mjs} +3 -3
- package/lib/{index-BGk8Lib3.js → index-QtOAv51B.js} +1 -1
- package/lib/{index-is9vbRk6.js → index-gn107iCo.js} +1 -1
- package/lib/{index-DvaQAdrQ.mjs → index-grCrWNvp.mjs} +1 -1
- package/lib/{index-B887bVqe.js → index-iaMEYhF5.js} +1 -1
- package/lib/{index-Dv_PN2YS.mjs → index-nCiFssoC.mjs} +1 -1
- package/lib/{index-SpRjE-lR.mjs → index-xTX46Yw9.mjs} +1 -1
- package/lib/{index-D5xdeVYW.mjs → index-yt4URWzh.mjs} +1 -1
- package/lib/{index-CgLcGLhQ.mjs → index-zb82e-lE.mjs} +3 -3
- package/lib/{index.es-DaKST-Tu.js → index.es-DCYCSMuK.js} +2 -2
- package/lib/{index.es-XELuGQ1v.mjs → index.es-ffyJdlAz.mjs} +6 -6
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{signer-CBkcr0G7.mjs → signer-BBbBI9Ch.mjs} +1 -1
- package/lib/{signer-C8BdcDph.js → signer-C8bS-IbV.js} +1 -1
- package/lib/{solana-BT0u9BIk.mjs → solana-7uRxf9WX.mjs} +5 -5
- package/lib/{solana-Dp3nxJ5I.js → solana-BVyz5H3z.js} +1 -1
- package/lib/{solana-DZJoFr_V.mjs → solana-BfVL9dAW.mjs} +4 -4
- package/lib/solana-DPZR_Eze.js +1 -0
- package/lib/{solanaEmbed.esm-DyCdC9Bf.mjs → solanaEmbed.esm-BXeUQQ1f.mjs} +2 -2
- package/lib/{solanaEmbed.esm-Dmb33sr2.js → solanaEmbed.esm-BylLsCAU.js} +1 -1
- package/lib/{sui-CGplq_XL.js → sui-BcGOZHgb.js} +1 -1
- package/lib/{sui-Dn893IB9.mjs → sui-CBeaWzBm.mjs} +1 -1
- package/lib/{sui-B8eP92oc.mjs → sui-NQaMhA2C.mjs} +5 -5
- package/lib/{sui-K4_elpRl.js → sui-fKD7sV9G.js} +2 -2
- package/package.json +1 -1
- package/lib/solana-B4bIzZfk.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)},H={},F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(k=>{if(Object.getOwnPropertyDescriptor(w,k))return;const O=Reflect.get(n,k),M={value:O,enumerable:!0,configurable:!0};if(x.has(O))ne(O,!1);else if(O instanceof Promise)delete M.value,M.get=()=>I(O);else if(A.has(O)){const[b,q]=A.get(O);M.value=c(b,q(),I)}Object.defineProperty(w,k,M)}),Object.preventExtensions(w)},m=new WeakMap,p=[1,1],E=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=p[0];const v=new Set,w=(i,a=++p[0])=>{I!==a&&(I=a,v.forEach(o=>o(i,a)))};let k=p[1];const O=(i=++p[1])=>(k!==i&&!v.size&&(k=i,b.forEach(([a])=>{const o=a[1](i);o>I&&(I=o)})),I),M=i=>(a,o)=>{const h=[...a];h[1]=[i,...h[1]],w(h,o)},b=new Map,q=(i,a)=>{if((H?"production":void 0)!=="production"&&b.has(i))throw new Error("prop listener already exists");if(v.size){const o=a[3](M(i));b.set(i,[a,o])}else b.set(i,[a])},te=i=>{var a;const o=b.get(i);o&&(b.delete(i),(a=o[1])==null||a.call(o))},fe=i=>(v.add(i),v.size===1&&b.forEach(([o,h],_)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const T=o[3](M(_));b.set(_,[o,T])}),()=>{v.delete(i),v.size===0&&b.forEach(([o,h],_)=>{h&&(h(),b.set(_,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(i,a){const o=Reflect.get(i,a);te(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],o]),h},set(i,a,o,h){const _=Reflect.has(i,a),T=Reflect.get(i,a,h);if(_&&(e(T,o)||m.has(o)&&e(T,m.get(o))))return!0;te(a),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[a],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[a],C])});else{!A.has(o)&&s(o)&&(V=E(o));const C=!x.has(V)&&A.get(V);C&&q(a,C)}return Reflect.set(i,a,V,h),w(["set",[a],o,T]),!0}});m.set(n,$);const pe=[J,O,c,fe];return A.set($,pe),Reflect.ownKeys(n).forEach(i=>{const a=Object.getOwnPropertyDescriptor(n,i);"value"in a&&($[i]=n[i],delete a.value,delete a.writable),Object.defineProperty(J,i,a)}),$})=>[E,A,x,e,t,s,r,l,c,m,p],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let p=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,p&&t(c.splice(0))}))});return p=!0,()=>{p=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),f=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:f,subscribe(e){return D(f.events,()=>e(ve(f.events[f.events.length-1])))},initialize(){f.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(f.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){f.connectedWalletId=e},click(e){if(f.enabled){const t={type:"CLICK",name:e.name,userSessionId:f.userSessionId,timestamp:Date.now(),data:e};f.events.push(t)}},track(e){if(f.enabled){const t={type:"TRACK",name:e.name,userSessionId:f.userSessionId,timestamp:Date.now(),data:e};f.events.push(t)}},view(e){if(f.enabled){const t={type:"VIEW",name:e.name,userSessionId:f.userSessionId,timestamp:Date.now(),data:e};f.events.push(t)}}},L=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:L,subscribe(e){return D(L,()=>e(L))},setChains(e){L.chains=e},setWalletConnectUri(e){L.walletConnectUri=e},setIsCustomDesktop(e){L.isCustomDesktop=e},setIsCustomMobile(e){L.isCustomMobile=e},setIsDataLoaded(e){L.isDataLoaded=e},setIsUiLoaded(e){L.isUiLoaded=e},setIsAuth(e){L.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),S={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Oe=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))We.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Oe({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",S.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const U={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${S.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${S.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var Ee=Object.defineProperty,ae=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ie=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ie(e,s,t[s]);if(ae)for(var s of ae(t))Ae.call(t,s)&&ie(e,s,t[s]);return e};const le=u.isMobile(),W=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:W,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=S.state;if(e==="NONE"||t==="ALL"&&!e)return W.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await U.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const p=e.indexOf(c.id),E=e.indexOf(m.id);return p-E}),W.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:p}=le?await U.getMobileListings(m):await U.getDesktopListings(m);W.recomendedWallets=Object.values(p)}return W.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=S.state,{recomendedWallets:l}=W;if(r==="ALL")return W.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:p,total:E}=le?await U.getMobileListings(t):await U.getDesktopListings(t),n=Object.values(p),g=m?"search":"wallets";return W[g]={listings:[...W[g].listings,...n],total:E,page:c??1},{listings:n,total:E}},getWalletImageUrl(e){return U.getWalletImageUrl(e)},getAssetImageUrl(e){return U.getAssetImageUrl(e)},resetSearch(){W.search={listings:[],total:0,page:1}}},N=j({open:!1}),z={state:N,subscribe(e){return D(N,()=>e(N))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)N.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),N.open=!0,t())},200)}})},close(){N.open=!1}};var Ue=Object.defineProperty,ce=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Se.call(t,s)&&de(e,s,t[s]);return e};function ke(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:ke()?"dark":"light"}),Z={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=De({},s))}},P=j({open:!1,message:"",variant:"success"}),_e={state:P,subscribe(e){return D(P,()=>e(P))},openToast(e,t){P.open=!0,P.message=e,P.variant=t},closeToast(){P.open=!1}};class Ne{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),S.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-CpquIcpv.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Te=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Te;exports.ne=Z;exports.oe=_e;exports.p=y;exports.se=z;exports.te=Me;exports.y=S;
|
|
1
|
+
"use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)},H={},F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(k=>{if(Object.getOwnPropertyDescriptor(w,k))return;const O=Reflect.get(n,k),M={value:O,enumerable:!0,configurable:!0};if(x.has(O))ne(O,!1);else if(O instanceof Promise)delete M.value,M.get=()=>I(O);else if(A.has(O)){const[b,q]=A.get(O);M.value=c(b,q(),I)}Object.defineProperty(w,k,M)}),Object.preventExtensions(w)},m=new WeakMap,p=[1,1],E=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=p[0];const v=new Set,w=(i,a=++p[0])=>{I!==a&&(I=a,v.forEach(o=>o(i,a)))};let k=p[1];const O=(i=++p[1])=>(k!==i&&!v.size&&(k=i,b.forEach(([a])=>{const o=a[1](i);o>I&&(I=o)})),I),M=i=>(a,o)=>{const h=[...a];h[1]=[i,...h[1]],w(h,o)},b=new Map,q=(i,a)=>{if((H?"production":void 0)!=="production"&&b.has(i))throw new Error("prop listener already exists");if(v.size){const o=a[3](M(i));b.set(i,[a,o])}else b.set(i,[a])},te=i=>{var a;const o=b.get(i);o&&(b.delete(i),(a=o[1])==null||a.call(o))},fe=i=>(v.add(i),v.size===1&&b.forEach(([o,h],_)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const T=o[3](M(_));b.set(_,[o,T])}),()=>{v.delete(i),v.size===0&&b.forEach(([o,h],_)=>{h&&(h(),b.set(_,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(i,a){const o=Reflect.get(i,a);te(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],o]),h},set(i,a,o,h){const _=Reflect.has(i,a),T=Reflect.get(i,a,h);if(_&&(e(T,o)||m.has(o)&&e(T,m.get(o))))return!0;te(a),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[a],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[a],C])});else{!A.has(o)&&s(o)&&(V=E(o));const C=!x.has(V)&&A.get(V);C&&q(a,C)}return Reflect.set(i,a,V,h),w(["set",[a],o,T]),!0}});m.set(n,$);const pe=[J,O,c,fe];return A.set($,pe),Reflect.ownKeys(n).forEach(i=>{const a=Object.getOwnPropertyDescriptor(n,i);"value"in a&&($[i]=n[i],delete a.value,delete a.writable),Object.defineProperty(J,i,a)}),$})=>[E,A,x,e,t,s,r,l,c,m,p],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let p=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,p&&t(c.splice(0))}))});return p=!0,()=>{p=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),f=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:f,subscribe(e){return D(f.events,()=>e(ve(f.events[f.events.length-1])))},initialize(){f.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(f.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){f.connectedWalletId=e},click(e){if(f.enabled){const t={type:"CLICK",name:e.name,userSessionId:f.userSessionId,timestamp:Date.now(),data:e};f.events.push(t)}},track(e){if(f.enabled){const t={type:"TRACK",name:e.name,userSessionId:f.userSessionId,timestamp:Date.now(),data:e};f.events.push(t)}},view(e){if(f.enabled){const t={type:"VIEW",name:e.name,userSessionId:f.userSessionId,timestamp:Date.now(),data:e};f.events.push(t)}}},L=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:L,subscribe(e){return D(L,()=>e(L))},setChains(e){L.chains=e},setWalletConnectUri(e){L.walletConnectUri=e},setIsCustomDesktop(e){L.isCustomDesktop=e},setIsCustomMobile(e){L.isCustomMobile=e},setIsDataLoaded(e){L.isDataLoaded=e},setIsUiLoaded(e){L.isUiLoaded=e},setIsAuth(e){L.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),S={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Oe=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))We.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Oe({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",S.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const U={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${S.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${S.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var Ee=Object.defineProperty,ae=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ie=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ie(e,s,t[s]);if(ae)for(var s of ae(t))Ae.call(t,s)&&ie(e,s,t[s]);return e};const le=u.isMobile(),W=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:W,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=S.state;if(e==="NONE"||t==="ALL"&&!e)return W.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await U.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const p=e.indexOf(c.id),E=e.indexOf(m.id);return p-E}),W.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:p}=le?await U.getMobileListings(m):await U.getDesktopListings(m);W.recomendedWallets=Object.values(p)}return W.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=S.state,{recomendedWallets:l}=W;if(r==="ALL")return W.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:p,total:E}=le?await U.getMobileListings(t):await U.getDesktopListings(t),n=Object.values(p),g=m?"search":"wallets";return W[g]={listings:[...W[g].listings,...n],total:E,page:c??1},{listings:n,total:E}},getWalletImageUrl(e){return U.getWalletImageUrl(e)},getAssetImageUrl(e){return U.getAssetImageUrl(e)},resetSearch(){W.search={listings:[],total:0,page:1}}},N=j({open:!1}),z={state:N,subscribe(e){return D(N,()=>e(N))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)N.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),N.open=!0,t())},200)}})},close(){N.open=!1}};var Ue=Object.defineProperty,ce=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Se.call(t,s)&&de(e,s,t[s]);return e};function ke(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:ke()?"dark":"light"}),Z={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=De({},s))}},P=j({open:!1,message:"",variant:"success"}),_e={state:P,subscribe(e){return D(P,()=>e(P))},openToast(e,t){P.open=!0,P.message=e,P.variant=t},closeToast(){P.open=!1}};class Ne{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),S.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-D75bWNLu.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Te=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Te;exports.ne=Z;exports.oe=_e;exports.p=y;exports.se=z;exports.te=Me;exports.y=S;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
2
|
var b = (a, e, t) => e in a ? S(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
3
|
var i = (a, e, t) => b(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { cd as v, ce as f, cf as I, c9 as x, cg as A, b6 as w, bA as U, bd as $, bB as m, r as o, aC as k, p as c, m as h, ch as C, bG as T, V as E, bD as F, k as _, be as u, ci as W, bj as N } from "./index-
|
|
4
|
+
import { cd as v, ce as f, cf as I, c9 as x, cg as A, b6 as w, bA as U, bd as $, bB as m, r as o, aC as k, p as c, m as h, ch as C, bG as T, V as E, bD as F, k as _, be as u, ci as W, bj as N } from "./index-0sRAi_-E.mjs";
|
|
5
5
|
import { A as O } from "./unsignedTransaction-BDOQhqcZ.mjs";
|
|
6
|
-
import { A as Q } from "./aptos-
|
|
6
|
+
import { A as Q } from "./aptos-hNRlQB2L.mjs";
|
|
7
7
|
const R = [
|
|
8
8
|
{ name: "tokenBridgeAddress", ...f },
|
|
9
9
|
{ name: "chain", ...I() },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var z = Object.defineProperty;
|
|
2
2
|
var L = (p, e, t) => e in p ? z(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t;
|
|
3
3
|
var u = (p, e, t) => L(p, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { b5 as D, m as C, r as T, b6 as S, az as I, j as s, b7 as V, b8 as G, E as B, b as F, b9 as f, ba as h, bb as H, bc as l, bd as M, a4 as y, be as Y, bf as J, bg as K, bh as X, bi as Z, bj as tt, _ as et } from "./index-
|
|
5
|
-
import { EvmTokenBridge as nt } from "./index-
|
|
4
|
+
import { b5 as D, m as C, r as T, b6 as S, az as I, j as s, b7 as V, b8 as G, E as B, b as F, b9 as f, ba as h, bb as H, bc as l, bd as M, a4 as y, be as Y, bf as J, bg as K, bh as X, bi as Z, bj as tt, _ as et } from "./index-0sRAi_-E.mjs";
|
|
5
|
+
import { EvmTokenBridge as nt } from "./index-grCrWNvp.mjs";
|
|
6
6
|
const v = new D([
|
|
7
7
|
"function start((bytes32,address,address,address,address,address,uint256,uint256,uint256,uint256)) returns (address,uint16,uint64)",
|
|
8
8
|
"function receiveMessageAndSwap(bytes)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var y=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";var l=Object.defineProperty;var y=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-B5H5W-MP.js"),g=require("./unsignedTransaction-C1YeEl4G.js"),f=require("./aptos-C7pCAbUg.js"),w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],T=i=>s.serialize$1(w,i);class d{constructor(e,t,n,r){o(this,"network");o(this,"chain");o(this,"connection");o(this,"contracts");o(this,"chainId");o(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=n,this.contracts=r,this.chainId=s.toChainId(t);const a=r.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[n,r]=await f.AptosPlatform.chainFromRpc(e),a=t[r];if(a.network!==n)throw new Error("Network mismatch "+a.network+" !== "+n);return new d(n,r,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(s.APTOS_SEPARATOR),n=await this.connection.getAccountResource({accountAddress:t[0],resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`});if(!n)throw s.ErrNotWrapped(e.toString());const r=s.toChain(parseInt(n.token_chain.number)),a=new s.UniversalAddress(n.token_address.external_address);return{chain:r,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const n=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!n)throw new Error("Invalid asset address.");return new s.AptosAddress(n)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource({accountAddress:s.coalesceModuleAddress(t),resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`}),s.toNative(this.chain,t)}async isTransferCompleted(e){const n=(await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`})).consumed_vaas.elems.handle;try{return await this.connection.getTableItem({handle:n,data:{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const n={chain:this.chain,address:new s.AptosAddress(e)},r=await this.getAssetFullyQualifiedType(n);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,typeArguments:[r],functionArguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,typeArguments:[],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const n=await this.getAssetFullyQualifiedType(e.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,typeArguments:[n],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,n,r,a){const p=0n,c=0n,h=s.isNative(n)?s.APTOS_COIN:n.toString(),u=t.address.toUniversalAddress().toUint8Array(),A=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,typeArguments:[h],functionArguments:[r,A,u,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,typeArguments:[h],functionArguments:[r,A,u,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,n=!0){const r=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,typeArguments:[r],functionArguments:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`}),{handle:n}=t.native_infos,r=await this.connection.getTableItem({handle:n,data:{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}}});return r?[r.account_address,String.fromCharCode(...s.hex.decode(r.module_name)),String.fromCharCode(...s.hex.decode(r.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,n){if(s.isNative(n.address))throw new Error("Invalid token address");const r=T({chain:n.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:n.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(r),!0)}createUnsignedTx(e,t,n=!1){return new g.AptosUnsignedTransaction(e,this.network,this.chain,t,n)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Y = Object.defineProperty;
|
|
2
2
|
var Z = (n, f, e) => f in n ? Y(n, f, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[f] = e;
|
|
3
3
|
var d = (n, f, e) => Z(n, typeof f != "symbol" ? f + "" : f, e);
|
|
4
|
-
import { U as y, bk as f0, bl as W, bm as p, bn as e0, bo as a0, bp as t0, bq as _, br as b0, bs as n0, bt as d0, b8 as L, bu as O, E as v, b as C, bv as D, r as U, bc as u, bw as q, bf as c0, bx as N, bh as H, bi as j, b6 as s0, by as i0, bz as I, b5 as S, a4 as $, bj as V, _ as G } from "./index-
|
|
5
|
-
import "./index-
|
|
4
|
+
import { U as y, bk as f0, bl as W, bm as p, bn as e0, bo as a0, bp as t0, bq as _, br as b0, bs as n0, bt as d0, b8 as L, bu as O, E as v, b as C, bv as D, r as U, bc as u, bw as q, bf as c0, bx as N, bh as H, bi as j, b6 as s0, by as i0, bz as I, b5 as S, a4 as $, bj as V, _ as G } from "./index-0sRAi_-E.mjs";
|
|
5
|
+
import "./index-grCrWNvp.mjs";
|
|
6
6
|
const r0 = new RegExp("^bytes([0-9]+)$"), p0 = new RegExp("^(u?int)([0-9]*)$"), y0 = new RegExp("^(.*)\\[([0-9]*)\\]$");
|
|
7
7
|
function J(n, f, e) {
|
|
8
8
|
switch (n) {
|