Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielparke committed Oct 27, 2020
1 parent 5350bc1 commit 2c09911
Show file tree
Hide file tree
Showing 49 changed files with 2,706 additions and 2,079 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
## ⚠️ Warning

Any content produced by Solana, or developer resources that Solana provides, are for educational and inspiration purposes only. Solana does not encourage, induce or sanction the deployment of any such applications in violation of applicable laws or regulations.
Any content produced by Solana, or developer resources that Solana provides, are for educational and inspiration purposes only. Solana does not encourage, induce or sanction the deployment of any such applications in violation of applicable laws or regulations.

## Deployment

App is using to enviroment variables that can be set before deployment:
* `SWAP_PROGRAM_OWNER_FEE_ADDRESS` used to distribute fees to owner of the pool program (Note: this varibale reuqires special version of token-swap program)
* `SWAP_HOST_FEE_ADDRESS` used to distribute fees to host of the application

- `SWAP_PROGRAM_OWNER_FEE_ADDRESS` used to distribute fees to owner of the pool program (Note: this varibale reuqires special version of token-swap program)
- `SWAP_HOST_FEE_ADDRESS` used to distribute fees to host of the application

To inject varibles to the app, set the SWAP_PROGRAM_OWNER_FEE_ADDRESS and/or SWAP_HOST_FEE_ADDRESS environment variables to the addresses of your SOL accounts.

You may want to put these in local environment files (e.g. .env.development.local, .env.production.local). See the documentation on environment variables for more information.

NOTE: remember to re-build your app before deploying for your referral addresses to be reflected.
NOTE: remember to re-build your app before deploying for your referral addresses to be reflected.
6 changes: 3 additions & 3 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const CracoLessPlugin = require('craco-less');
const CracoLessPlugin = require("craco-less");

module.exports = {
plugins: [
Expand All @@ -7,11 +7,11 @@ module.exports = {
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: { '@primary-color': '#2abdd2' },
modifyVars: { "@primary-color": "#2abdd2" },
javascriptEnabled: true,
},
},
},
},
],
};
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@types/react-dom": "^16.9.8",
"@types/recharts": "^1.8.16",
"arweave-deploy": "^1.9.1",
"gh-pages": "^3.1.0"
"gh-pages": "^3.1.0",
"prettier": "^2.1.2"
}
}
97 changes: 51 additions & 46 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Serum token swap on Solana" />
<!--
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Serum token swap on Solana" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -21,42 +20,45 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Swap | Serum</title>
<style type="text/css">
#root {
height: 100%;
}
<title>Swap | Serum</title>
<style type="text/css">
#root {
height: 100%;
}

#root::before {
content: "";
position: absolute;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
filter: grayscale(100%);
background-repeat: no-repeat;
background-size: cover;
}
#root::before {
content: "";
position: absolute;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
filter: grayscale(100%);
background-repeat: no-repeat;
background-size: cover;
}

.App {
position: relative;
height: 100%;
text-align: center;
min-width: 100%;
display: flex;
flex-direction: column;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA=="
crossorigin="anonymous" />
</head>
.App {
position: relative;
height: 100%;
text-align: center;
min-width: 100%;
display: flex;
flex-direction: column;
}
</style>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA=="
crossorigin="anonymous"
/>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand All @@ -67,7 +69,10 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->

<script async src="https://platform.twitter.com/widgets.js" charSet="utf-8"></script>
</body>

<script
async
src="https://platform.twitter.com/widgets.js"
charset="utf-8"
></script>
</body>
</html>
10 changes: 5 additions & 5 deletions src/App.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '~antd/dist/antd.dark.less';
@import './ant-custom.less';
@import "~antd/dist/antd.dark.less";
@import "./ant-custom.less";

.App-logo {
background-image: url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzMwMHB4JyB3aWR0aD0nMzAwcHgnICBmaWxsPSIjZDgzYWViIiB4bWxuczp4PSJodHRwOi8vbnMuYWRvYmUuY29tL0V4dGVuc2liaWxpdHkvMS4wLyIgeG1sbnM6aT0iaHR0cDovL25zLmFkb2JlLmNvbS9BZG9iZUlsbHVzdHJhdG9yLzEwLjAvIiB4bWxuczpncmFwaD0iaHR0cDovL25zLmFkb2JlLmNvbS9HcmFwaHMvMS4wLyIgeG1sbnM9Imh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MS44LTEyNS43LDI0Mi4zLTEyNC45LDI0Mi4zeiBNLTE0MS4zLDI4MC45bC0xMC43LTEwLjcgICAgYy0wLjctMC43LTEuOS0wLjctMi43LDBjLTAuNywwLjctMC43LDEuOSwwLDIuN2w3LjYsNy42aC0yNmMtMSwwLTEuOSwwLjgtMS45LDEuOXMwLjgsMS45LDEuOSwxLjloMjUuOGwtNy40LDcuNCAgICBjLTAuNywwLjctMC43LDEuOSwwLDIuN2MwLjQsMC40LDAuOSwwLjYsMS4zLDAuNnMxLTAuMiwxLjMtMC42bDEwLjctMTAuN2MwLjQtMC40LDAuNi0wLjksMC41LTEuNCAgICBDLTE0MC43LDI4MS44LTE0MC45LDI4MS4zLTE0MS4zLDI4MC45eiBNLTE3MSwyMzMuMWwxMC43LDEwLjdjMC40LDAuNCwwLjksMC42LDEuMywwLjZzMS0wLjIsMS4zLTAuNmMwLjctMC43LDAuNy0xLjksMC0yLjcgICAgbC03LjUtNy41aDI4LjJjMSwwLDEuOS0wLjgsMS45LTEuOXMtMC44LTEuOS0xLjktMS45aC0yOC4ybDcuNS03LjVjMC43LTAuNywwLjctMS45LDAtMi43Yy0wLjctMC43LTEuOS0wLjctMi43LDBsLTEwLjcsMTAuNyAgICBjLTAuNCwwLjQtMC42LDAuOS0wLjUsMS40Qy0xNzEuNiwyMzIuMi0xNzEuNCwyMzIuNy0xNzEsMjMzLjF6Ij48L3BhdGg+PC9nPjwvc3dpdGNoPjwvc3ZnPg==");
Expand Down Expand Up @@ -67,7 +67,7 @@

.discord {
font-size: 30px;
color: #7289DA;
color: #7289da;
}

.discord:hover {
Expand All @@ -81,11 +81,11 @@
border-radius: 30px;
display: flex;
width: 27px;
height: 27px;
height: 27px;
}

.telegram:hover {
color: #2789DE !important;
color: #2789de !important;
}

.App-header {
Expand Down
8 changes: 4 additions & 4 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
import React from "react";
import { render } from "@testing-library/react";
import App from "./App";

test('renders learn react link', () => {
test("renders learn react link", () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
Expand Down
24 changes: 15 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import './App.less';
import GitHubButton from 'react-github-btn'
import { Routes } from './routes';
import React from "react";
import "./App.less";
import GitHubButton from "react-github-btn";
import { Routes } from "./routes";

function App() {
return (
Expand All @@ -13,18 +13,24 @@ function App() {
</div>
<Routes />
<div className="social-buttons">
<GitHubButton href="https://github.com/project-serum/oyster-swap"
<GitHubButton
href="https://github.com/project-serum/oyster-swap"
data-color-scheme="no-preference: light; light: light; dark: light;"
data-icon="octicon-star"
data-size="large"
data-show-count={true}
aria-label="Star solana-labs/oyster-swap on GitHub">Star</GitHubButton>
<GitHubButton href="https://github.com/project-serum/oyster-swap/fork"
aria-label="Star solana-labs/oyster-swap on GitHub"
>
Star
</GitHubButton>
<GitHubButton
href="https://github.com/project-serum/oyster-swap/fork"
data-color-scheme="no-preference: light; light: light; dark: light;"
data-size="large"
aria-label="Fork project-serum/oyster-swap on GitHub">
aria-label="Fork project-serum/oyster-swap on GitHub"
>
Fork
</GitHubButton>
</GitHubButton>
</div>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/ant-custom.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '~antd/dist/antd.css';
@import '~antd/dist/antd.dark.less';
@import "~antd/dist/antd.css";
@import "~antd/dist/antd.dark.less";
@primary-color: #ff00a8;
@popover-background: #1a2029;
@popover-background: #1a2029;
14 changes: 7 additions & 7 deletions src/buffer-layout.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
declare module 'buffer-layout' {
const magic: any;
export = magic;
declare module "buffer-layout" {
const magic: any;
export = magic;
}

declare module 'jazzicon' {
const magic: any;
export = magic;
}
declare module "jazzicon" {
const magic: any;
export = magic;
}
43 changes: 25 additions & 18 deletions src/components/accountInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
import React from 'react';
import { useWallet } from './../utils/wallet';
import { shortenAddress } from './../utils/utils';
import { Identicon } from './identicon';
import { useNativeAccount } from './../utils/accounts';
import { LAMPORTS_PER_SOL } from '@solana/web3.js';
import React from "react";
import { useWallet } from "./../utils/wallet";
import { shortenAddress } from "./../utils/utils";
import { Identicon } from "./identicon";
import { useNativeAccount } from "./../utils/accounts";
import { LAMPORTS_PER_SOL } from "@solana/web3.js";

export const AccountInfo = (props: {}) => {
const { wallet } = useWallet();
const { account } = useNativeAccount();

if (!wallet || !wallet.publicKey) {
return null;
}

return <div className="wallet-wrapper">
<span>{((account?.lamports || 0) / LAMPORTS_PER_SOL).toFixed(2)} SOL</span>
const { wallet } = useWallet();
const { account } = useNativeAccount();

if (!wallet || !wallet.publicKey) {
return null;
}

return (
<div className="wallet-wrapper">
<span>
{((account?.lamports || 0) / LAMPORTS_PER_SOL).toFixed(2)} SOL
</span>
<div className="wallet-key">
{shortenAddress(`${wallet.publicKey}`)}
<Identicon address={wallet.publicKey.toBase58()} style={{ marginLeft: '0.5rem' }} />
<Identicon
address={wallet.publicKey.toBase58()}
style={{ marginLeft: "0.5rem" }}
/>
</div>
</div>;
}
</div>
);
};
Loading

0 comments on commit 2c09911

Please sign in to comment.