alpha deployment

This commit is contained in:
Tim Olson
2023-11-16 17:36:44 -04:00
parent 0098d7f29f
commit 55591848be
10 changed files with 18 additions and 54 deletions

1
.env-alpha Normal file
View File

@@ -0,0 +1 @@
VITE_WS_URL=wss://ws.alpha.dexorder.trade

View File

@@ -1,5 +0,0 @@
FROM nginx:stable-alpine
RUN sed -i '1idaemon off;' /etc/nginx/nginx.conf
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
COPY dist /app
CMD ["nginx"]

View File

@@ -1,25 +0,0 @@
server {
listen 80 default_server;
gzip on;
gzip_min_length 1000;
gzip_types text/plain text/xml application/javascript text/css;
root /app;
# normal routes
# serve given url and default to index.html if not found
# e.g. /, /user and /foo/bar will return index.html
location / {
add_header Cache-Control "no-store";
try_files $uri $uri/index.html /index.html;
}
# files
# for all routes matching a dot, check for files and return 404 if not found
# e.g. /file.js returns a 404 if not found
location ~ \.(?!html) {
add_header Cache-Control "public, max-age=2678400";
try_files $uri =404;
}
}

View File

@@ -1,15 +0,0 @@
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: letsencrypt-prod
spec:
acme:
email: tim.olson.crypto@gmail.com
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: letsencrypt-privkey-prod
solvers:
- http01:
ingress:
class: nginx

View File

@@ -8,6 +8,9 @@ const uniswapV3Addresses = {
31337: {
factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
},
53261: {
factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
},
}
export function uniswapV3PoolAddress(chainId, tokenAddrA, tokenAddrB, fee) {

View File

@@ -44,11 +44,13 @@ function onAccountsChanged(accounts) {
changeAccounts(accounts);
}
export async function watchWallet() {
const chainId = (await new ethers.BrowserProvider(window.ethereum).getNetwork()).chainId
onChainChanged(chainId)
window.ethereum.on('chainChanged', onChainChanged);
window.ethereum.on('accountsChanged', onAccountsChanged);
export function detectChain() {
new ethers.BrowserProvider(window.ethereum).getNetwork().then((network)=>{
const chainId = network.chainId
onChainChanged(chainId)
window.ethereum.on('chainChanged', onChainChanged);
window.ethereum.on('accountsChanged', onAccountsChanged);
})
}

View File

@@ -40,7 +40,7 @@
<ul>
<li>Name: Dexorder Alpha</li>
<li>New RPC URL: https://rpc.alpha.dexorder.trade</li>
<li>Chain ID: 31337</li>
<li>Chain ID: 53261</li>
<li>Currency Symbol: TETH</li>
</ul>
</li>

View File

@@ -6,6 +6,7 @@
import {useStore} from "@/store/store";
import {subPrices, unsubPrices} from "@/blockchain/prices.js";
import {computed, onBeforeUnmount} from "vue";
import {FixedNumber} from "ethers";
const s = useStore()
@@ -23,7 +24,8 @@ const price = computed(()=>{
if( !p )
return ''
p = Number(p) // TODO: Temporary workaround. Better to fix reason for p being set to string.
console.log('pool price is',p)
console.log('pool price is',typeof p, p)
p = FixedNumber.fromString(p)
if( props.inverted )
p = 1/p
return p.toPrecision(props.precision)

View File

@@ -91,6 +91,7 @@ const arbitrumTokens = [
const _knownTokens = {
42161: arbitrumTokens,
31337: arbitrumTokens,
53261: [], // only show the two mock coins
};
for( const chainId in _knownTokens ) {

View File

@@ -13,7 +13,7 @@ import { createApp } from 'vue'
// Plugins
import { registerPlugins } from '@/plugins'
import '@/styles/style.scss'
import {watchWallet} from "@/blockchain/wallet.js";
import {detectChain} from "@/blockchain/wallet.js";
import "./socket.js"
BigInt.prototype.toJSON = function() { return this.toString() }
@@ -22,4 +22,4 @@ const app = createApp(App)
registerPlugins(app)
app.mount('#app')
await watchWallet()
detectChain()