Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,42 @@ rsync -av --remove-source-files ./build/ ../
cd ..
rm -rf unifactory
```

# Wallet Apps Bridge (MCW iframe mode)

If this DEX is opened inside MultiCurrencyWallet `#/apps`, add bridge mode via URL:

- `https://<your-dex-domain>/?walletBridge=swaponline`

Bridge adapter file added in this repo:

- `wallet-apps-bridge-client.js`

and loaded in `index.html` before app bootstrap.

Optional host origin allowlist config:

```html
<script>
window.SO_DefinanceBridgeConfig = {
allowedHostOrigins: ['https://wallet.example', 'https://wallet2.example'],
allowAnyHostOrigin: true
}
</script>
```

Also supported:
- `window.SO_WalletAppsAllowedOrigins = ['https://wallet.example']`
- query param: `walletBridgeAllowedOrigins=https://wallet.example,https://wallet2.example`

Default behavior in this repo is **allowAnyHostOrigin enabled** (for faster QA on many wallet domains).
To enforce strict allowlist, set:

```html
<script>
window.SO_DefinanceBridgeConfig = {
allowAnyHostOrigin: false,
allowedHostOrigins: ['https://wallet.example']
}
</script>
```
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" id="favicon" type="image/png" href="./favicon.png"/><link rel="apple-touch-icon" sizes="192x192" href="./images/192x192_App_Icon.png"/><link rel="apple-touch-icon" sizes="512x512" href="./images/512x512_App_Icon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000"/><meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"/><link rel="manifest" href="./manifest.json"/><title>Exchange</title><script>const{hostname:hostname,protocol:protocol,href:href}=window.location,domain=hostname||document.location.host,DOMAIN_TITLES={"internethedgefund.com":"IHF Swap","eeecex.net":"eeecEx"};if(DOMAIN_TITLES[domain]&&(document.title=DOMAIN_TITLES[domain]),window.location.search){const o=window.location.search.split("?ref=")[1];o&&localStorage.setItem("ref",o)}"localhost"!==hostname&&"https:"!==protocol&&location.replace("https:"+href.substring(protocol.length));let favicon=document.getElementById("favicon");favicon||(favicon=document.createElement("link"),favicon.rel="shortcut icon",favicon.id="favicon",favicon.type="image/png",document.getElementsByTagName("head")[0].appendChild(favicon));const faviconUrl=localStorage.getItem("faviconUrl");faviconUrl&&(favicon.href=faviconUrl)</script><link href="./static/css/3.chunk.css" rel="stylesheet"><link href="./static/css/main.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={2:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+".chunk.js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="./",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpunifactory=this.webpackJsonpunifactory||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([])</script><script src="./static/js/3.chunk.js"></script><script src="./static/js/main.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" id="favicon" type="image/png" href="./favicon.png"/><link rel="apple-touch-icon" sizes="192x192" href="./images/192x192_App_Icon.png"/><link rel="apple-touch-icon" sizes="512x512" href="./images/512x512_App_Icon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000"/><meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"/><link rel="manifest" href="./manifest.json"/><title>Exchange</title><script>const{hostname:hostname,protocol:protocol,href:href}=window.location,domain=hostname||document.location.host,DOMAIN_TITLES={"internethedgefund.com":"IHF Swap","eeecex.net":"eeecEx"};if(DOMAIN_TITLES[domain]&&(document.title=DOMAIN_TITLES[domain]),window.location.search){const o=window.location.search.split("?ref=")[1];o&&localStorage.setItem("ref",o)}"localhost"!==hostname&&"https:"!==protocol&&location.replace("https:"+href.substring(protocol.length));let favicon=document.getElementById("favicon");favicon||(favicon=document.createElement("link"),favicon.rel="shortcut icon",favicon.id="favicon",favicon.type="image/png",document.getElementsByTagName("head")[0].appendChild(favicon));const faviconUrl=localStorage.getItem("faviconUrl");faviconUrl&&(favicon.href=faviconUrl)</script><link href="./static/css/3.chunk.css" rel="stylesheet"><link href="./static/css/main.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="./wallet-apps-bridge-client.js"></script><script>!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={2:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+".chunk.js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="./",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpunifactory=this.webpackJsonpunifactory||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([])</script><script src="./static/js/3.chunk.js"></script><script src="./static/js/main.chunk.js"></script></body></html>
Loading