├── vue ├── .gitignore ├── src │ ├── index.ts │ ├── shims-vue.d.ts │ └── uniswap │ │ └── internal-components │ │ ├── index.ts │ │ ├── token-icon.vue │ │ ├── loading.vue │ │ ├── approval.vue │ │ ├── swap-quote-info.vue │ │ └── token-modal.vue ├── dev │ ├── serve.js │ └── serve.vue ├── babel.config.js ├── tsconfig.json ├── rollup.config.js ├── LICENSE └── package.json ├── angular └── lib │ ├── projects │ ├── uniswap-angular-showcase │ │ ├── src │ │ │ ├── assets │ │ │ │ └── .gitkeep │ │ │ ├── environments │ │ │ │ ├── environment.prod.ts │ │ │ │ └── environment.ts │ │ │ ├── styles.scss │ │ │ ├── favicon.ico │ │ │ ├── app │ │ │ │ ├── app.component.html │ │ │ │ ├── app.module.ts │ │ │ │ ├── app.component.scss │ │ │ │ └── app.component.ts │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ ├── test.ts │ │ │ └── polyfills.ts │ │ ├── e2e │ │ │ ├── src │ │ │ │ ├── app.po.ts │ │ │ │ └── app.e2e-spec.ts │ │ │ ├── tsconfig.json │ │ │ └── protractor.conf.js │ │ ├── tslint.json │ │ ├── tsconfig.app.json │ │ ├── tsconfig.spec.json │ │ ├── .browserslistrc │ │ └── karma.conf.js │ └── uniswap-angular │ │ ├── src │ │ ├── lib │ │ │ ├── uniswap-angular-swapper │ │ │ │ ├── components │ │ │ │ │ ├── error │ │ │ │ │ │ ├── error.component.scss │ │ │ │ │ │ ├── error.component.html │ │ │ │ │ │ └── error.component.ts │ │ │ │ │ ├── header │ │ │ │ │ │ ├── header.component.scss │ │ │ │ │ │ └── header.component.ts │ │ │ │ │ ├── approval │ │ │ │ │ │ ├── approval.component.scss │ │ │ │ │ │ ├── approval.component.ts │ │ │ │ │ │ └── approval.component.html │ │ │ │ │ ├── loading │ │ │ │ │ │ ├── loading.component.scss │ │ │ │ │ │ ├── loading.component.ts │ │ │ │ │ │ └── loading.component.html │ │ │ │ │ ├── token-icon │ │ │ │ │ │ ├── token-icon.component.scss │ │ │ │ │ │ ├── token-icon.component.html │ │ │ │ │ │ └── token-icon.component.ts │ │ │ │ │ ├── tokens-modal │ │ │ │ │ │ ├── tokens-modal.component.scss │ │ │ │ │ │ ├── tokens-modal.component.ts │ │ │ │ │ │ └── tokens-modal.component.html │ │ │ │ │ ├── swap-quote-info │ │ │ │ │ │ ├── swap-quote-info.component.scss │ │ │ │ │ │ ├── swap-quote-info.component.ts │ │ │ │ │ │ └── swap-quote-info.component.html │ │ │ │ │ ├── confirm-swap-modal │ │ │ │ │ │ ├── confirm-swap-modal.component.scss │ │ │ │ │ │ └── confirm-swap-modal.component.ts │ │ │ │ │ └── transaction-modal │ │ │ │ │ │ ├── transaction-modal.component.scss │ │ │ │ │ │ └── transaction-modal.component.ts │ │ │ │ └── uniswap-angular-swapper.component.scss │ │ │ ├── pipes │ │ │ │ └── safe.pipe.ts │ │ │ └── uniswap.module.ts │ │ ├── public-api.ts │ │ └── test.ts │ │ ├── ng-package.json │ │ ├── tsconfig.lib.prod.json │ │ ├── tslint.json │ │ ├── tsconfig.spec.json │ │ ├── package-lock.json │ │ ├── tsconfig.lib.json │ │ ├── package.json │ │ └── karma.conf.js │ ├── .editorconfig │ ├── .gitignore │ ├── tsconfig.json │ ├── package.json │ └── tslint.json ├── integration-apps ├── uniswap-angular-test-integration-app │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── styles.scss │ │ ├── favicon.ico │ │ ├── app │ │ │ ├── app.component.html │ │ │ ├── app-routing.module.ts │ │ │ ├── app.component.scss │ │ │ ├── app.module.ts │ │ │ └── app.component.ts │ │ ├── index.html │ │ ├── main.ts │ │ ├── test.ts │ │ └── polyfills.ts │ ├── README.md │ ├── e2e │ │ ├── src │ │ │ ├── app.po.ts │ │ │ └── app.e2e-spec.ts │ │ ├── tsconfig.json │ │ └── protractor.conf.js │ ├── .editorconfig │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ ├── .browserslistrc │ ├── .gitignore │ ├── tsconfig.json │ ├── package.json │ ├── karma.conf.js │ ├── tslint.json │ └── angular.json ├── uniswap-vue-test-integration-app │ ├── .browserslistrc │ ├── babel.config.js │ ├── .editorconfig │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ ├── src │ │ ├── assets │ │ │ └── logo.png │ │ ├── main.js │ │ └── App.vue │ ├── .gitignore │ ├── .eslintrc.js │ ├── README.md │ └── package.json ├── uniswap-react-test-integration-app │ ├── src │ │ ├── react-app-env.d.ts │ │ ├── setupTests.ts │ │ ├── App.test.tsx │ │ ├── index.css │ │ ├── reportWebVitals.ts │ │ ├── App.css │ │ ├── index.tsx │ │ ├── logo.svg │ │ └── App.tsx │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── index.html │ ├── README.md │ ├── .gitignore │ ├── tsconfig.json │ └── package.json └── README.md ├── showcase ├── src │ ├── react-app-env.d.ts │ ├── index.css │ ├── setupTests.ts │ ├── App.test.tsx │ ├── reportWebVitals.ts │ ├── App.css │ ├── index.tsx │ ├── logo.svg │ └── App.tsx ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── manifest.json │ └── index.html ├── .gitignore ├── tsconfig.json ├── package.json └── README.md ├── react-package ├── uniswap-react-test-integration-app │ ├── src │ │ ├── react-app-env.d.ts │ │ ├── setupTests.ts │ │ ├── App.test.tsx │ │ ├── index.css │ │ ├── reportWebVitals.ts │ │ ├── App.css │ │ ├── index.tsx │ │ ├── logo.svg │ │ └── App.tsx │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── index.html │ ├── .gitignore │ ├── tsconfig.json │ ├── package.json │ └── README.md └── package │ ├── src │ └── components │ │ ├── loading.tsx │ │ ├── tokenIcon.tsx │ │ ├── approval.tsx │ │ └── swapQuoteInfo.tsx │ ├── tsconfig.json │ ├── .gitignore │ ├── LICENSE │ └── package.json ├── .prettierrc ├── shared ├── src │ ├── token │ │ └── models │ │ │ ├── token-image.ts │ │ │ ├── supported-token-result.ts │ │ │ ├── supported-token.ts │ │ │ ├── token-cached-image.ts │ │ │ ├── extended-token.ts │ │ │ └── supported-network-token.ts │ ├── theming │ │ ├── models │ │ │ ├── uniswap-theme-text-and-colour.ts │ │ │ └── uniswap-theming.ts │ │ └── index.ts │ ├── index.ts │ ├── models │ │ └── index.ts │ ├── utils.ts │ ├── coin-gecko.ts │ ├── chain │ │ └── index.ts │ └── ethereum-provider.ts ├── styles │ ├── compile-scss.js │ └── breakpoints.scss ├── README.md ├── .gitignore ├── tsconfig.json ├── LICENSE └── package.json ├── .prettierignore └── README.md /vue/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /showcase/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /showcase/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: 'Inter var', sans-serif; 4 | } 5 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/error/error.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/header/header.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /showcase/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/approval/approval.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/loading/loading.component.scss: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/token-icon/token-icon.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/tokens-modal/tokens-modal.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/swap-quote-info/swap-quote-info.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "singleQuote": true, 4 | "bracketSpacing": true, 5 | "printWidth": 80 6 | } 7 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/confirm-swap-modal/confirm-swap-modal.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/transaction-modal/transaction-modal.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /shared/src/token/models/token-image.ts: -------------------------------------------------------------------------------- 1 | export interface TokenImage { 2 | image: string; 3 | isSvg?: boolean | undefined; 4 | } 5 | -------------------------------------------------------------------------------- /showcase/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/showcase/public/favicon.ico -------------------------------------------------------------------------------- /integration-apps/README.md: -------------------------------------------------------------------------------- 1 | This just has angular, vue and react test apps using the published package from npm to make sure it all works. 2 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/uniswap-angular-swapper.component.scss: -------------------------------------------------------------------------------- 1 | @import '../../../../../../../shared/styles/uniswap.scss'; 2 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | margin: 0px; 4 | } 5 | -------------------------------------------------------------------------------- /vue/src/index.ts: -------------------------------------------------------------------------------- 1 | import UniswapVue from './uniswap/uniswap.vue'; 2 | 3 | export default { 4 | install(Vue) { 5 | Vue.component('uniswap-vue', UniswapVue); 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/README.md: -------------------------------------------------------------------------------- 1 | # Uniswap react test app 2 | 3 | This just shows you an example integration on an react app using `uniswap-react` package 4 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/README.md: -------------------------------------------------------------------------------- 1 | # Uniswap angular test app 2 | 3 | This just shows you an example integration on an angular app using `uniswap-angular` package 4 | -------------------------------------------------------------------------------- /shared/src/theming/models/uniswap-theme-text-and-colour.ts: -------------------------------------------------------------------------------- 1 | export interface UniswapThemeTextAndColor { 2 | textColor?: string | undefined; 3 | backgroundColor?: string | undefined; 4 | } 5 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: monospace; 4 | } 5 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/angular/lib/projects/uniswap-angular-showcase/src/favicon.ico -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/error/error.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{ error }} 4 |

5 |
6 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /shared/src/token/models/supported-token-result.ts: -------------------------------------------------------------------------------- 1 | import { ExtendedToken } from './extended-token'; 2 | 3 | export interface SupportedTokenResult extends ExtendedToken { 4 | canShow: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /shared/src/token/models/supported-token.ts: -------------------------------------------------------------------------------- 1 | import { TokenImage } from './token-image'; 2 | 3 | export interface SupportedToken { 4 | tokenImageContext?: TokenImage; 5 | contractAddress: string; 6 | } 7 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/react-package/uniswap-react-test-integration-app/public/favicon.ico -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/react-package/uniswap-react-test-integration-app/public/logo192.png -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/react-package/uniswap-react-test-integration-app/public/logo512.png -------------------------------------------------------------------------------- /vue/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.vue' { 3 | import type { DefineComponent } from 'vue' 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/integration-apps/uniswap-angular-test-integration-app/src/favicon.ico -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/integration-apps/uniswap-react-test-integration-app/public/favicon.ico -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/integration-apps/uniswap-react-test-integration-app/public/logo192.png -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/integration-apps/uniswap-react-test-integration-app/public/logo512.png -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/integration-apps/uniswap-vue-test-integration-app/public/favicon.ico -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshstevens19/uniswap-dapp-integration-monorepo/HEAD/integration-apps/uniswap-vue-test-integration-app/src/assets/logo.png -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | #Add files here to ignore them from prettier formatting 2 | wallet-app/src/libs/** 3 | wallet-app/src/json/** 4 | wallet-app/ABI/*.json 5 | integration-apps/uniswap-vue-test-integration-app/* 6 | vue/README.md -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/public-api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of uniswap 3 | */ 4 | 5 | export * from './lib/uniswap-angular-swapper/uniswap-angular-swapper.component'; 6 | export * from './lib/uniswap.module'; 7 | -------------------------------------------------------------------------------- /shared/src/token/models/token-cached-image.ts: -------------------------------------------------------------------------------- 1 | import { TokenImage } from './token-image'; 2 | 3 | export interface TokenCachedImage { 4 | tokenImageContext: TokenImage; 5 | contractAddress: string; 6 | chainId: number; 7 | } 8 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/uniswap-angular", 4 | "lib": { 5 | "entryFile": "src/public-api.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/src/main.js: -------------------------------------------------------------------------------- 1 | import UniswapVue from 'uniswap-vue' 2 | import { createApp } from 'vue' 3 | import App from './App.vue' 4 | 5 | const app = createApp(App) 6 | app.use(UniswapVue) 7 | 8 | app.mount('#app') 9 | -------------------------------------------------------------------------------- /showcase/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /shared/styles/compile-scss.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const nodeSass = require('node-sass'); 3 | 4 | const result = nodeSass.renderSync({ 5 | file: './uniswap.scss', 6 | outputStyle: 'compressed', 7 | }); 8 | 9 | fs.writeFileSync('./uniswap.css', result.css); 10 | console.log('Generated uniswap css'); 11 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.lib.json", 4 | "compilerOptions": { 5 | "declarationMap": false 6 | }, 7 | "angularCompilerOptions": { 8 | "enableIvy": false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /showcase/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, screen } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | render(); 7 | const linkElement = screen.getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /shared/src/token/models/extended-token.ts: -------------------------------------------------------------------------------- 1 | import { BigNumber } from 'bignumber.js'; 2 | import { Token } from 'simple-uniswap-sdk'; 3 | import { TokenImage } from './token-image'; 4 | 5 | export interface ExtendedToken extends Token { 6 | balance: BigNumber; 7 | fiatPrice: BigNumber | undefined; 8 | tokenImageContext: TokenImage; 9 | } 10 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /shared/src/theming/models/uniswap-theming.ts: -------------------------------------------------------------------------------- 1 | import { UniswapThemeTextAndColor } from './uniswap-theme-text-and-colour'; 2 | 3 | export interface UniswapTheming { 4 | backgroundColor?: string | undefined; 5 | textColor?: string | undefined; 6 | button?: UniswapThemeTextAndColor | undefined; 7 | panel?: UniswapThemeTextAndColor | undefined; 8 | } 9 | -------------------------------------------------------------------------------- /angular/lib/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "lib", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "lib", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forRoot(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AppRoutingModule { } 11 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/loading/loading.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'lib-loading', 5 | templateUrl: './loading.component.html', 6 | styleUrls: ['./loading.component.scss'], 7 | }) 8 | export class LoadingComponent { 9 | constructor() {} 10 | } 11 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/token-icon/token-icon.component.html: -------------------------------------------------------------------------------- 1 | 6 | 11 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, screen } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | render(); 7 | const linkElement = screen.getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, screen } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | render(); 7 | const linkElement = screen.getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /shared/src/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | ChainId, 3 | ErrorCodes, 4 | ETH, 5 | Token, 6 | TradeContext, 7 | TradeDirection, 8 | Transaction, 9 | UniswapSubscription, 10 | WETHContract, 11 | } from 'simple-uniswap-sdk'; 12 | export * from './models'; 13 | export { UniswapDappSharedLogic } from './uniswap-dapp-shared-logic'; 14 | export { Utils } from './utils'; 15 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/error/error.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'lib-error', 5 | templateUrl: './error.component.html', 6 | styleUrls: ['./error.component.scss'], 7 | }) 8 | export class ErrorComponent { 9 | @Input() public error!: string; 10 | constructor() {} 11 | } 12 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /shared/src/token/models/supported-network-token.ts: -------------------------------------------------------------------------------- 1 | import { ChainId } from 'simple-uniswap-sdk'; 2 | import { SupportedToken } from './supported-token'; 3 | 4 | export interface SupportedNetworkTokens { 5 | chainId: ChainId; 6 | defaultInputValue?: string | undefined; 7 | defaultInputToken?: string | undefined; 8 | defaultOutputToken?: string | undefined; 9 | supportedTokens: SupportedToken[]; 10 | } 11 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /showcase/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts" 12 | ], 13 | "include": [ 14 | "**/*.spec.ts", 15 | "**/*.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /vue/dev/serve.js: -------------------------------------------------------------------------------- 1 | // To register individual components where they are used (serve.vue) instead of using the 2 | // library as a whole, comment/remove this import and it's corresponding "app.use" call 3 | import { createApp } from 'vue'; 4 | import UniswapVue from '../lib/index.esm'; 5 | import Dev from './serve.vue'; 6 | 7 | const app = createApp(Dev); 8 | 9 | app.use(UniswapVue); 10 | console.log(UniswapVue); 11 | 12 | app.mount('#app'); 13 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uniswap Angular Showcase 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-angular", 3 | "version": "0.0.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "tslib": { 8 | "version": "2.3.0", 9 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", 10 | "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/pipes/safe.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; 3 | 4 | @Pipe({ name: 'safe' }) 5 | export class SafePipe implements PipeTransform { 6 | constructor(private sanitizer: DomSanitizer) {} 7 | 8 | public transform(html: string): SafeResourceUrl { 9 | return this.sanitizer.bypassSecurityTrustHtml(html); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uniswap Angular Test Integration App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: [ 7 | 'plugin:vue/vue3-essential', 8 | '@vue/standard' 9 | ], 10 | parserOptions: { 11 | parser: 'babel-eslint' 12 | }, 13 | rules: { 14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /vue/babel.config.js: -------------------------------------------------------------------------------- 1 | const devPresets = ['@vue/babel-preset-app']; 2 | const buildPresets = [ 3 | [ 4 | '@babel/preset-env', 5 | // Config for @babel/preset-env 6 | { 7 | // Example: Always transpile optional chaining/nullish coalescing 8 | // include: [ 9 | // /(optional-chaining|nullish-coalescing)/ 10 | // ], 11 | }, 12 | ], 13 | ]; 14 | module.exports = { 15 | presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets), 16 | }; 17 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/README.md: -------------------------------------------------------------------------------- 1 | # uniswap-vue-test-integration-app 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | npm run lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /showcase/src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/loading/loading.component.html: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /vue/src/uniswap/internal-components/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Approval } from './approval.vue'; 2 | export { default as ConfirmSwap } from './confirm-swap.vue'; 3 | export { default as Header } from './header.vue'; 4 | export { default as Loading } from './loading.vue'; 5 | export { default as SwapQuoteInfo } from './swap-quote-info.vue'; 6 | export { default as TokenIcon } from './token-icon.vue'; 7 | export { default as TokenModal } from './token-modal.vue'; 8 | export { default as TransactionModal } from './transaction-modal.vue'; 9 | -------------------------------------------------------------------------------- /showcase/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | display: flex; 3 | flex-direction: column; 4 | width: 100%; 5 | -webkit-box-align: center; 6 | align-items: center; 7 | flex: 1 1 0%; 8 | z-index: 1; 9 | } 10 | 11 | .uniswap-container { 12 | position: relative; 13 | max-width: 480px; 14 | width: 100%; 15 | background: rgb(255, 255, 255); 16 | box-shadow: rgb(0 0 0 / 1%) 0px 0px 1px, rgb(0 0 0 / 4%) 0px 4px 8px, 17 | rgb(0 0 0 / 4%) 0px 16px 24px, rgb(0 0 0 / 1%) 0px 24px 32px; 18 | border-radius: 24px; 19 | margin-top: 1rem; 20 | } 21 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /vue/src/uniswap/internal-components/token-icon.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 23 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { BrowserModule } from '@angular/platform-browser'; 4 | import { UniswapModule } from 'projects/uniswap-angular/src/public-api'; 5 | import { AppComponent } from './app.component'; 6 | 7 | @NgModule({ 8 | declarations: [AppComponent], 9 | imports: [BrowserModule, FormsModule, UniswapModule], 10 | providers: [], 11 | bootstrap: [AppComponent], 12 | }) 13 | export class AppModule {} 14 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/token-icon/token-icon.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { TokenImage } from 'uniswap-dapp-integration-shared'; 3 | 4 | @Component({ 5 | selector: 'lib-token-icon', 6 | templateUrl: './token-icon.component.html', 7 | styleUrls: ['./token-icon.component.scss'], 8 | }) 9 | export class TokenIconComponent { 10 | @Input() public classes!: string; 11 | @Input() public tokenImageContext!: TokenImage; 12 | 13 | constructor() {} 14 | } 15 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/swap-quote-info/swap-quote-info.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { UniswapDappSharedLogic } from 'uniswap-dapp-integration-shared'; 3 | 4 | @Component({ 5 | selector: 'lib-swap-quote-info', 6 | templateUrl: './swap-quote-info.component.html', 7 | styleUrls: ['./swap-quote-info.component.scss'], 8 | }) 9 | export class SwapQuoteInfoComponent { 10 | @Input() public uniswapDappSharedLogic!: UniswapDappSharedLogic; 11 | 12 | constructor() {} 13 | } 14 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | display: flex; 3 | flex-direction: column; 4 | width: 100%; 5 | -webkit-box-align: center; 6 | align-items: center; 7 | flex: 1 1 0%; 8 | z-index: 1; 9 | } 10 | 11 | .uniswap-container { 12 | position: relative; 13 | max-width: 480px; 14 | width: 100%; 15 | background: rgb(255, 255, 255); 16 | box-shadow: rgb(0 0 0 / 1%) 0px 0px 1px, rgb(0 0 0 / 4%) 0px 4px 8px, 17 | rgb(0 0 0 / 4%) 0px 16px 24px, rgb(0 0 0 / 1%) 0px 24px 32px; 18 | border-radius: 24px; 19 | margin-top: 1rem; 20 | } 21 | -------------------------------------------------------------------------------- /showcase/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | display: flex; 3 | flex-direction: column; 4 | width: 100%; 5 | -webkit-box-align: center; 6 | align-items: center; 7 | flex: 1 1 0%; 8 | z-index: 1; 9 | } 10 | 11 | .uniswap-container { 12 | position: relative; 13 | max-width: 480px; 14 | width: 100%; 15 | background: rgb(255, 255, 255); 16 | box-shadow: rgb(0 0 0 / 1%) 0px 0px 1px, rgb(0 0 0 / 4%) 0px 4px 8px, 17 | rgb(0 0 0 / 4%) 0px 16px 24px, rgb(0 0 0 / 1%) 0px 24px 32px; 18 | border-radius: 24px; 19 | margin-top: 1rem; 20 | } 21 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .app { 2 | display: flex; 3 | flex-direction: column; 4 | width: 100%; 5 | -webkit-box-align: center; 6 | align-items: center; 7 | flex: 1 1 0%; 8 | z-index: 1; 9 | } 10 | 11 | .uniswap-container { 12 | position: relative; 13 | max-width: 480px; 14 | width: 100%; 15 | background: rgb(255, 255, 255); 16 | box-shadow: rgb(0 0 0 / 1%) 0px 0px 1px, rgb(0 0 0 / 4%) 0px 4px 8px, 17 | rgb(0 0 0 / 4%) 0px 16px 24px, rgb(0 0 0 / 1%) 0px 24px 32px; 18 | border-radius: 24px; 19 | margin-top: 1rem; 20 | } 21 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .app { 2 | display: flex; 3 | flex-direction: column; 4 | width: 100%; 5 | -webkit-box-align: center; 6 | align-items: center; 7 | flex: 1 1 0%; 8 | z-index: 1; 9 | } 10 | 11 | .uniswap-container { 12 | position: relative; 13 | max-width: 480px; 14 | width: 100%; 15 | background: rgb(255, 255, 255); 16 | box-shadow: rgb(0 0 0 / 1%) 0px 0px 1px, rgb(0 0 0 / 4%) 0px 4px 8px, 17 | rgb(0 0 0 / 4%) 0px 16px 24px, rgb(0 0 0 / 1%) 0px 24px 32px; 18 | border-radius: 24px; 19 | margin-top: 1rem; 20 | } 21 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { BrowserModule } from '@angular/platform-browser'; 4 | import { UniswapModule } from 'uniswap-angular'; 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { AppComponent } from './app.component'; 7 | 8 | @NgModule({ 9 | declarations: [AppComponent], 10 | imports: [BrowserModule, AppRoutingModule, FormsModule, UniswapModule], 11 | providers: [], 12 | bootstrap: [AppComponent], 13 | }) 14 | export class AppModule {} 15 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/approval/approval.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { 3 | TransactionStatus, 4 | UniswapDappSharedLogic, 5 | } from 'uniswap-dapp-integration-shared'; 6 | 7 | @Component({ 8 | selector: 'lib-approval', 9 | templateUrl: './approval.component.html', 10 | styleUrls: ['./approval.component.scss'], 11 | }) 12 | export class ApprovalComponent { 13 | @Input() public uniswapDappSharedLogic!: UniswapDappSharedLogic; 14 | 15 | public transactionStatus = TransactionStatus; 16 | constructor() {} 17 | } 18 | -------------------------------------------------------------------------------- /showcase/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import './index.css'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root'), 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /showcase/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/confirm-swap-modal/confirm-swap-modal.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { 3 | UniswapDappSharedLogic, 4 | Utils as UniswapUtils, 5 | } from 'uniswap-dapp-integration-shared'; 6 | 7 | @Component({ 8 | selector: 'lib-confirm-swap-modal', 9 | templateUrl: './confirm-swap-modal.component.html', 10 | styleUrls: ['./confirm-swap-modal.component.scss'], 11 | }) 12 | export class ConfirmSwapModalComponent { 13 | @Input() public uniswapDappSharedLogic!: UniswapDappSharedLogic; 14 | 15 | public utils = UniswapUtils; 16 | constructor() {} 17 | } 18 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /vue/src/uniswap/internal-components/loading.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 27 | -------------------------------------------------------------------------------- /react-package/package/src/components/loading.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Loading = (): JSX.Element => ( 4 |
5 | 11 | 17 | 23 | 24 |
25 | ); 26 | 27 | export default Loading; 28 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../out-tsc/lib", 6 | "target": "es2015", 7 | "declaration": true, 8 | "declarationMap": true, 9 | "inlineSources": true, 10 | "types": [], 11 | "lib": [ 12 | "dom", 13 | "es2018" 14 | ] 15 | }, 16 | "angularCompilerOptions": { 17 | "skipTemplateCodegen": true, 18 | "strictMetadataEmit": true, 19 | "enableResourceInlining": true 20 | }, 21 | "exclude": [ 22 | "src/test.ts", 23 | "**/*.spec.ts" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /react-package/package/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "lib/esm", 4 | "module": "esnext", 5 | "target": "es5", 6 | "lib": ["es6", "dom", "es2016", "es2017"], 7 | "jsx": "react", 8 | "declaration": true, 9 | "moduleResolution": "node", 10 | "noUnusedLocals": true, 11 | "noUnusedParameters": true, 12 | "esModuleInterop": true, 13 | "noImplicitReturns": true, 14 | "noImplicitThis": true, 15 | "noImplicitAny": true, 16 | "strictNullChecks": true, 17 | "suppressImplicitAnyIndexErrors": true, 18 | "allowSyntheticDefaultImports": true, 19 | "sourceMap": false 20 | }, 21 | "include": ["src"], 22 | "exclude": ["node_modules", "lib"] 23 | } 24 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/transaction-modal/transaction-modal.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { 3 | TradeDirection, 4 | TransactionStatus, 5 | UniswapDappSharedLogic, 6 | } from 'uniswap-dapp-integration-shared'; 7 | 8 | @Component({ 9 | selector: 'lib-transaction-modal', 10 | templateUrl: './transaction-modal.component.html', 11 | styleUrls: ['./transaction-modal.component.scss'], 12 | }) 13 | export class TransactionModalComponent { 14 | @Input() public uniswapDappSharedLogic!: UniswapDappSharedLogic; 15 | 16 | public transactionStatus = TransactionStatus; 17 | public tradeDirection = TradeDirection; 18 | constructor() {} 19 | } 20 | -------------------------------------------------------------------------------- /react-package/package/src/components/tokenIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { TokenImage } from 'uniswap-dapp-integration-shared'; 3 | 4 | const TokenIcon = ({ 5 | classes, 6 | tokenImageContext, 7 | }: { 8 | classes: string; 9 | tokenImageContext: TokenImage; 10 | }): JSX.Element => ( 11 | 12 | {!tokenImageContext.isSvg && ( 13 | 14 | )} 15 | {tokenImageContext.isSvg && ( 16 | 17 | 22 | 23 | )} 24 | 25 | ); 26 | 27 | export default TokenIcon; 28 | -------------------------------------------------------------------------------- /shared/README.md: -------------------------------------------------------------------------------- 1 | # uniswap-dapp-integration-shared 2 | 3 | [![npm version](https://badge.fury.io/js/uniswap-dapp-integration-shared.svg)](https://badge.fury.io/js/uniswap-dapp-integration-shared) 4 | ![downloads](https://img.shields.io/npm/dw/uniswap-dapp-integration-shared) 5 | 6 | ## About 7 | 8 | This is the shared lib which `uniswap-angular`, `uniswap-react` and `uniswap-vue` uses to do all its shared logic. Even though this is used on the client interfaces it does expose nice easy to understand calls for you to build your own interface if you wish to. 9 | 10 | # Installing 11 | 12 | ## npm 13 | 14 | ```bash 15 | $ npm install uniswap-dapp-integration-shared 16 | ``` 17 | 18 | ## yarn 19 | 20 | ```bash 21 | $ yarn add uniswap-dapp-integration-shared 22 | ``` 23 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /vue/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2020", 5 | "strict": false, 6 | "importHelpers": true, 7 | "moduleResolution": "node", 8 | "experimentalDecorators": true, 9 | "skipLibCheck": true, 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "sourceMap": true, 13 | "baseUrl": ".", 14 | "declaration": true, 15 | "declarationDir": "lib", 16 | "types": ["jest"], 17 | "paths": { 18 | "@/*": ["src/*"] 19 | }, 20 | "lib": ["es2020", "dom", "dom.iterable", "scripthost"] 21 | }, 22 | "include": [ 23 | "src/**/*.ts", 24 | "src/**/*.tsx", 25 | "src/**/*.vue", 26 | "tests/**/*.ts", 27 | "tests/**/*.tsx", 28 | "src/index.ts" 29 | ], 30 | "exclude": ["node_modules"] 31 | } 32 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { browser, logging } from 'protractor'; 2 | import { AppPage } from './app.po'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('uniswap-angular-showcase app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /vue/rollup.config.js: -------------------------------------------------------------------------------- 1 | import commonjs from '@rollup/plugin-commonjs'; 2 | import resolve from '@rollup/plugin-node-resolve'; 3 | import peerDepsExternal from 'rollup-plugin-peer-deps-external'; 4 | import postcss from 'rollup-plugin-postcss'; 5 | import typescript from 'rollup-plugin-typescript2'; 6 | import vue from 'rollup-plugin-vue'; 7 | import packageJson from './package.json'; 8 | 9 | export default { 10 | input: 'src/index.ts', 11 | output: [ 12 | { 13 | format: 'cjs', 14 | file: packageJson.main, 15 | sourcemap: true, 16 | }, 17 | { 18 | format: 'esm', 19 | file: packageJson.module, 20 | sourcemap: true, 21 | }, 22 | ], 23 | plugins: [ 24 | peerDepsExternal(), 25 | resolve(), 26 | typescript(), 27 | vue(), 28 | commonjs(), 29 | postcss(), 30 | ], 31 | }; 32 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { browser, logging } from 'protractor'; 2 | import { AppPage } from './app.po'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('uniswap-angular-test-integration-app app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /shared/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /react-package/package/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /lib 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | README.md 10 | 11 | # dependencies 12 | /node_modules 13 | 14 | # profiling files 15 | chrome-profiler-events*.json 16 | speed-measure-plugin*.json 17 | 18 | # IDEs and editors 19 | /.idea 20 | .project 21 | .classpath 22 | .c9/ 23 | *.launch 24 | .settings/ 25 | *.sublime-workspace 26 | 27 | # IDE - VSCode 28 | .vscode/* 29 | !.vscode/settings.json 30 | !.vscode/tasks.json 31 | !.vscode/launch.json 32 | !.vscode/extensions.json 33 | .history/* 34 | 35 | # misc 36 | /.sass-cache 37 | /connect.lock 38 | /coverage 39 | /libpeerconnection.log 40 | npm-debug.log 41 | yarn-error.log 42 | testem.log 43 | /typings 44 | 45 | # System Files 46 | .DS_Store 47 | Thumbs.db 48 | -------------------------------------------------------------------------------- /shared/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["es6", "dom", "es2016", "es2017"], 5 | "module": "esnext", 6 | "declaration": true, 7 | "outDir": "./dist/esm", 8 | "rootDir": "./src", 9 | "strict": true, 10 | "moduleResolution": "node", 11 | "noUnusedLocals": true, 12 | "noUnusedParameters": true, 13 | "esModuleInterop": true, 14 | "noImplicitReturns": true, 15 | "noImplicitThis": true, 16 | "noImplicitAny": true, 17 | "strictNullChecks": true, 18 | "suppressImplicitAnyIndexErrors": true, 19 | "allowSyntheticDefaultImports": true, 20 | "sourceMap": false, 21 | /* Advanced Options */ 22 | "skipLibCheck": true /* Skip type checking of declaration files. */, 23 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /angular/lib/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | /projects/uniswap-angular/node_modules 13 | 14 | # profiling files 15 | chrome-profiler-events*.json 16 | speed-measure-plugin*.json 17 | 18 | # IDEs and editors 19 | /.idea 20 | .project 21 | .classpath 22 | .c9/ 23 | *.launch 24 | .settings/ 25 | *.sublime-workspace 26 | 27 | # IDE - VSCode 28 | .vscode/* 29 | !.vscode/settings.json 30 | !.vscode/tasks.json 31 | !.vscode/launch.json 32 | !.vscode/extensions.json 33 | .history/* 34 | 35 | # misc 36 | /.sass-cache 37 | /connect.lock 38 | /coverage 39 | /libpeerconnection.log 40 | npm-debug.log 41 | yarn-error.log 42 | testem.log 43 | /typings 44 | 45 | # System Files 46 | .DS_Store 47 | Thumbs.db 48 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone'; 4 | import 'zone.js/dist/zone-testing'; 5 | import { getTestBed } from '@angular/core/testing'; 6 | import { 7 | BrowserDynamicTestingModule, 8 | platformBrowserDynamicTesting 9 | } from '@angular/platform-browser-dynamic/testing'; 10 | 11 | declare const require: { 12 | context(path: string, deep?: boolean, filter?: RegExp): { 13 | keys(): string[]; 14 | (id: string): T; 15 | }; 16 | }; 17 | 18 | // First, initialize the Angular testing environment. 19 | getTestBed().initTestEnvironment( 20 | BrowserDynamicTestingModule, 21 | platformBrowserDynamicTesting() 22 | ); 23 | // Then we find all the tests. 24 | const context = require.context('./', true, /\.spec\.ts$/); 25 | // And load the modules. 26 | context.keys().map(context); 27 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-vue-test-integration-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "core-js": "^3.6.5", 12 | "uniswap-dapp-integration-shared": "^1.0.2", 13 | "uniswap-vue": "^1.0.5", 14 | "vue": "^3.0.0" 15 | }, 16 | "devDependencies": { 17 | "@vue/cli-plugin-babel": "~4.5.0", 18 | "@vue/cli-plugin-eslint": "~4.5.0", 19 | "@vue/cli-service": "~4.5.0", 20 | "@vue/compiler-sfc": "^3.0.0", 21 | "@vue/eslint-config-standard": "^5.1.2", 22 | "babel-eslint": "^10.1.0", 23 | "eslint": "^6.7.2", 24 | "eslint-plugin-import": "^2.20.2", 25 | "eslint-plugin-node": "^11.1.0", 26 | "eslint-plugin-promise": "^4.2.1", 27 | "eslint-plugin-standard": "^4.0.0", 28 | "eslint-plugin-vue": "^7.0.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | // remove this to see an error 6 | "allowSyntheticDefaultImports": true, 7 | "baseUrl": "./", 8 | "outDir": "./dist/out-tsc", 9 | "forceConsistentCasingInFileNames": true, 10 | "strict": true, 11 | "noImplicitReturns": true, 12 | "noFallthroughCasesInSwitch": true, 13 | "sourceMap": true, 14 | "declaration": false, 15 | "downlevelIteration": true, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "node", 18 | "importHelpers": true, 19 | "target": "es2015", 20 | "module": "es2020", 21 | "lib": ["es2018", "dom"] 22 | }, 23 | "angularCompilerOptions": { 24 | "enableI18nLegacyMessageIdFormat": false, 25 | "strictInjectionParameters": true, 26 | "strictInputAccessModifiers": true, 27 | "strictTemplates": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-angular", 3 | "version": "1.0.3", 4 | "description": "Integrating uniswap within your angular dApp with a couple of lines of code.", 5 | "peerDependencies": { 6 | "@angular/common": "^11.2.11", 7 | "@angular/core": "^11.2.11", 8 | "uniswap-dapp-integration-shared": "^1.0.0" 9 | }, 10 | "author": "joshstevens19@hotmail.co.uk", 11 | "license": "MIT", 12 | "scripts": { 13 | "build": "ng build --prod", 14 | "copy-readme": "cp ../../../README.md ../../dist/uniswap-angular", 15 | "publish": "npm run build && npm run copy-readme && cd ../../dist/uniswap-angular && npm publish --access public" 16 | }, 17 | "dependencies": { 18 | "tslib": "^2.0.0" 19 | }, 20 | "keywords": [ 21 | "ethereum", 22 | "blockchain", 23 | "uniswap", 24 | "angular" 25 | ], 26 | "bugs": { 27 | "url": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo/issues" 28 | }, 29 | "homepage": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo" 30 | } 31 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /angular/lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "sourceMap": true, 13 | "declaration": false, 14 | "downlevelIteration": true, 15 | "experimentalDecorators": true, 16 | "moduleResolution": "node", 17 | "importHelpers": true, 18 | "target": "es2015", 19 | "module": "es2020", 20 | "lib": ["es2018", "dom"], 21 | "paths": { 22 | "uniswap-angular": [ 23 | "dist/uniswap-angular/uniswap-angular", 24 | "dist/uniswap-angular" 25 | ] 26 | }, 27 | "skipLibCheck": true 28 | }, 29 | "angularCompilerOptions": { 30 | "enableI18nLegacyMessageIdFormat": false, 31 | "strictInjectionParameters": true, 32 | "strictInputAccessModifiers": true, 33 | "strictTemplates": true 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vue/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Josh Stevens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /shared/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Josh Stevens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /react-package/package/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Josh Stevens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /showcase/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "showcase", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.11.4", 7 | "@testing-library/react": "^11.1.0", 8 | "@testing-library/user-event": "^12.1.10", 9 | "@types/jest": "^26.0.15", 10 | "@types/node": "^12.0.0", 11 | "@types/react": "^17.0.0", 12 | "@types/react-dom": "^17.0.0", 13 | "react": "^17.0.2", 14 | "react-dom": "^17.0.2", 15 | "react-scripts": "4.0.3", 16 | "typescript": "^4.1.2", 17 | "uniswap-dapp-integration-shared": "^1.0.2", 18 | "uniswap-react": "^1.0.3", 19 | "web-vitals": "^1.0.1" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": [ 29 | "react-app", 30 | "react-app/jest" 31 | ] 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.2%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /shared/styles/breakpoints.scss: -------------------------------------------------------------------------------- 1 | // Small tablets and large smartphones (landscape view) 2 | $screen-xsm-min: 450px; 3 | 4 | // Small tablets and large smartphones (landscape view) 5 | $screen-sm-min: 576px; 6 | 7 | // Small tablets (portrait view) 8 | $screen-md-min: 768px; 9 | 10 | // Tablets and small desktops 11 | $screen-lg-min: 992px; 12 | 13 | // Large tablets and desktops 14 | $screen-xl-min: 1200px; 15 | 16 | // extra-small devices 17 | @mixin xsm { 18 | @media only screen and (max-width: #{$screen-xsm-min}) { 19 | @content; 20 | } 21 | } 22 | 23 | // Small devices 24 | @mixin sm { 25 | @media only screen and (max-width: #{$screen-sm-min}) { 26 | @content; 27 | } 28 | } 29 | 30 | // Medium devices 31 | @mixin md { 32 | @media only screen and (max-width: #{$screen-md-min}) { 33 | @content; 34 | } 35 | } 36 | 37 | // Large devices 38 | @mixin lg { 39 | @media only screen and (max-width: #{$screen-lg-min}) { 40 | @content; 41 | } 42 | } 43 | 44 | // Extra large devices 45 | @mixin xl { 46 | @media only screen and (max-width: #{$screen-xl-min}) { 47 | @content; 48 | } 49 | } 50 | 51 | // Custom devices 52 | @mixin rwd($screen) { 53 | @media only screen and (max-width: $screen+'px') { 54 | @content; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-react-test-integration-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.11.4", 7 | "@testing-library/react": "^11.1.0", 8 | "@testing-library/user-event": "^12.1.10", 9 | "@types/jest": "^26.0.15", 10 | "@types/node": "^12.0.0", 11 | "@types/react": "^17.0.13", 12 | "@types/react-dom": "^17.0.8", 13 | "react": "^17.0.2", 14 | "react-dom": "^17.0.2", 15 | "react-scripts": "4.0.3", 16 | "typescript": "^4.1.2", 17 | "web-vitals": "^1.0.1" 18 | }, 19 | "scripts": { 20 | "start": "react-scripts start", 21 | "build": "react-scripts build", 22 | "test": "react-scripts test", 23 | "eject": "react-scripts eject", 24 | "link": "npm link ../../shared && npm link ../package" 25 | }, 26 | "eslintConfig": { 27 | "extends": [ 28 | "react-app", 29 | "react-app/jest" 30 | ] 31 | }, 32 | "browserslist": { 33 | "production": [ 34 | ">0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-react-test-integration-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.11.4", 7 | "@testing-library/react": "^11.1.0", 8 | "@testing-library/user-event": "^12.1.10", 9 | "@types/jest": "^26.0.15", 10 | "@types/node": "^12.0.0", 11 | "@types/react": "^17.0.0", 12 | "@types/react-dom": "^17.0.0", 13 | "react": "^17.0.2", 14 | "react-dom": "^17.0.2", 15 | "react-scripts": "4.0.3", 16 | "typescript": "^4.1.2", 17 | "uniswap-dapp-integration-shared": "^1.0.2", 18 | "uniswap-react": "^1.0.3", 19 | "web-vitals": "^1.0.1" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": [ 29 | "react-app", 30 | "react-app/jest" 31 | ] 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.2%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /shared/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { UniswapPairSettings } from 'simple-uniswap-sdk'; 2 | import { UniswapTheming } from '../theming/models/uniswap-theming'; 3 | import { SupportedNetworkTokens } from '../token/models/supported-network-token'; 4 | export { ExtendedToken } from '../token/models/extended-token'; 5 | export { SupportedTokenResult } from '../token/models/supported-token-result'; 6 | export { TokenImage } from '../token/models/token-image'; 7 | export interface UniswapDappSharedLogicContext { 8 | supportedNetworkTokens: SupportedNetworkTokens[]; 9 | ethereumAddress: string; 10 | ethereumProvider: any; 11 | settings?: UniswapPairSettings | undefined; 12 | theming?: UniswapTheming; 13 | } 14 | 15 | export enum SelectTokenActionFrom { 16 | input = 'input', 17 | output = 'output', 18 | } 19 | 20 | export enum MiningAction { 21 | approval = 'approval', 22 | swap = 'swap', 23 | } 24 | 25 | export enum TransactionStatus { 26 | waitingForConfirmation = 'waitingForConfirmation', 27 | rejected = 'rejected', 28 | mining = 'mining', 29 | completed = 'completed', 30 | } 31 | export interface MiningTransaction { 32 | txHash?: string | undefined; 33 | status: TransactionStatus; 34 | miningAction: MiningAction; 35 | blockExplorerLink?: string | undefined; 36 | } 37 | 38 | export interface SwapSwitchResponse { 39 | outputValue: string; 40 | inputValue: string; 41 | } 42 | -------------------------------------------------------------------------------- /angular/lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "build": "ng build", 6 | "publish-angular-uniswap": "cd ./projects/uniswap-angular && npm run publish", 7 | "link": "npm link ../../shared" 8 | }, 9 | "private": true, 10 | "dependencies": { 11 | "@angular/animations": "~11.2.11", 12 | "@angular/common": "~11.2.11", 13 | "@angular/compiler": "~11.2.11", 14 | "@angular/core": "~11.2.11", 15 | "@angular/forms": "~11.2.11", 16 | "@angular/platform-browser": "~11.2.11", 17 | "@angular/platform-browser-dynamic": "~11.2.11", 18 | "@angular/router": "~11.2.11", 19 | "bignumber.js": "^9.0.1", 20 | "rxjs": "~6.6.0", 21 | "tslib": "^2.0.0", 22 | "zone.js": "~0.11.3" 23 | }, 24 | "devDependencies": { 25 | "@angular-devkit/build-angular": "~0.1102.10", 26 | "@angular/cli": "~11.2.10", 27 | "@angular/compiler-cli": "~11.2.11", 28 | "@types/jasmine": "~3.6.0", 29 | "@types/node": "^12.11.1", 30 | "codelyzer": "^6.0.0", 31 | "jasmine-core": "~3.6.0", 32 | "jasmine-spec-reporter": "~5.0.0", 33 | "karma": "~6.1.0", 34 | "karma-chrome-launcher": "~3.1.0", 35 | "karma-coverage": "~2.0.3", 36 | "karma-jasmine": "~4.0.0", 37 | "karma-jasmine-html-reporter": "^1.5.0", 38 | "ng-packagr": "^11.0.0", 39 | "protractor": "~7.0.0", 40 | "ts-node": "~8.3.0", 41 | "tslint": "~6.1.0", 42 | "typescript": "~4.1.5" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-angular-test-integration-app", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve --port 3789", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~11.2.11", 15 | "@angular/common": "~11.2.11", 16 | "@angular/compiler": "~11.2.11", 17 | "@angular/core": "~11.2.11", 18 | "@angular/forms": "~11.2.11", 19 | "@angular/platform-browser": "~11.2.11", 20 | "@angular/platform-browser-dynamic": "~11.2.11", 21 | "@angular/router": "~11.2.11", 22 | "rxjs": "~6.6.0", 23 | "tslib": "^2.0.0", 24 | "uniswap-angular": "^1.0.3", 25 | "uniswap-dapp-integration-shared": "^1.0.2", 26 | "zone.js": "~0.11.3" 27 | }, 28 | "devDependencies": { 29 | "@angular-devkit/build-angular": "~0.1102.10", 30 | "@angular/cli": "~11.2.10", 31 | "@angular/compiler-cli": "~11.2.11", 32 | "@types/jasmine": "~3.6.0", 33 | "@types/node": "^12.11.1", 34 | "codelyzer": "^6.0.0", 35 | "jasmine-core": "~3.6.0", 36 | "jasmine-spec-reporter": "~5.0.0", 37 | "karma": "~6.1.0", 38 | "karma-chrome-launcher": "~3.1.0", 39 | "karma-coverage": "~2.0.3", 40 | "karma-jasmine": "~4.0.0", 41 | "karma-jasmine-html-reporter": "^1.5.0", 42 | "protractor": "~7.0.0", 43 | "ts-node": "~8.3.0", 44 | "tslint": "~6.1.0", 45 | "typescript": "~4.1.5" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, '../../coverage/uniswap-angular'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-dapp-integration-shared", 3 | "version": "1.0.3", 4 | "description": "This is the shared lib which `uniswap-angular`, `uniswap-react` and `uniswap-vue` uses to do all its shared logic. Even though this is used on the client interfaces it does expose nice easy to understand calls for you to build your own interface if you wish to.", 5 | "main": "dist/cjs/index.js", 6 | "module": "./dist/esm/index.js", 7 | "types": "./dist/esm/index.d.ts", 8 | "scripts": { 9 | "build": "rm -rf ./dist && npm run compile-scss && npm run build:esm && npm run build:cjs", 10 | "compile-scss": "cd ./styles && node ./compile-scss", 11 | "build:esm": "tsc", 12 | "build:cjs": "tsc --module commonjs --outDir dist/cjs", 13 | "prepublishOnly": "npm run build" 14 | }, 15 | "author": "joshstevens19@hotmail.co.uk", 16 | "license": "MIT", 17 | "dependencies": { 18 | "bignumber.js": "^9.0.1", 19 | "ethers": "^5.4.0", 20 | "rxjs": "^7.1.0", 21 | "simple-uniswap-sdk": "^3.4.0" 22 | }, 23 | "devDependencies": { 24 | "node-sass": "^4.14.1", 25 | "typescript": "^4.3.5" 26 | }, 27 | "files": [ 28 | "dist", 29 | "package.json", 30 | "package-lock.json", 31 | "README.md", 32 | "styles/uniswap.scss", 33 | "styles/uniswap.css", 34 | "LICENSE" 35 | ], 36 | "keywords": [ 37 | "ethereum", 38 | "blockchain", 39 | "uniswap" 40 | ], 41 | "bugs": { 42 | "url": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo/issues" 43 | }, 44 | "homepage": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo" 45 | } 46 | -------------------------------------------------------------------------------- /react-package/package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-react", 3 | "version": "1.0.3", 4 | "description": "Integrating uniswap within your react dApp with a couple of lines of code.", 5 | "main": "./lib/cjs/index.js", 6 | "module": "./lib/esm/index.js", 7 | "types": "./lib/esm/index.d.ts", 8 | "scripts": { 9 | "build": "npm run build:esm && npm run build:cjs && npm run copy-readme", 10 | "copy-readme": "cp ../README.md ./", 11 | "build:esm": "tsc", 12 | "build:cjs": "tsc --module commonjs --outDir lib/cjs", 13 | "link": "npm link ../../shared", 14 | "prepublishOnly": "npm run build" 15 | }, 16 | "author": "joshstevens19@hotmail.co.uk", 17 | "license": "MIT", 18 | "devDependencies": { 19 | "@types/react": "^17.0.13", 20 | "@types/react-dom": "^17.0.8", 21 | "react": "^17.0.2", 22 | "react-dom": "^17.0.2", 23 | "typescript": "^4.3.5" 24 | }, 25 | "peerDependencies": { 26 | "react": "^16.8.0", 27 | "react-dom": "^16.8.0", 28 | "uniswap-dapp-integration-shared": "^1.0.0" 29 | }, 30 | "dependencies": { 31 | "bignumber.js": "^9.0.1", 32 | "rxjs": "~6.6.0", 33 | "uniswap-dapp-integration-shared": "^1.0.3" 34 | }, 35 | "files": [ 36 | "/lib", 37 | "package.json", 38 | "package-lock.json", 39 | "LICENSE", 40 | "README.md" 41 | ], 42 | "keywords": [ 43 | "ethereum", 44 | "blockchain", 45 | "uniswap", 46 | "react" 47 | ], 48 | "bugs": { 49 | "url": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo/issues" 50 | }, 51 | "homepage": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo" 52 | } 53 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, '../../coverage/uniswap-angular-showcase'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/uniswap-angular-test-integration-app'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/approval/approval.component.html: -------------------------------------------------------------------------------- 1 | 50 | -------------------------------------------------------------------------------- /shared/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { BigNumber } from 'bignumber.js'; 2 | 3 | export class Utils { 4 | /** 5 | * To precision 6 | */ 7 | public static toPrecision( 8 | value: string | number | BigNumber, 9 | significantDigits: number = 4, 10 | significantDigitsForDecimalOnly: boolean = true, 11 | ): string { 12 | const parsedValue = new BigNumber(value); 13 | if (significantDigitsForDecimalOnly) { 14 | const beforeDecimalsCount = parsedValue.toString().split('.')[0].length; 15 | return parsedValue 16 | .precision( 17 | beforeDecimalsCount + significantDigits, 18 | BigNumber.ROUND_DOWN, 19 | ) 20 | .toFixed(); 21 | } else { 22 | return parsedValue 23 | .precision(significantDigits, BigNumber.ROUND_DOWN) 24 | .toFixed(); 25 | } 26 | } 27 | 28 | /** 29 | * Format the currency 30 | * @value The value to format 31 | */ 32 | public static formatCurrency(value: string | number): string { 33 | return Number(value) 34 | .toFixed(2) 35 | .replace(/\d(?=(\d{3})+\.)/g, '$&,'); 36 | } 37 | 38 | /** 39 | * Deep clone a object 40 | * @param object The object 41 | */ 42 | public static deepClone(object: T): T { 43 | return JSON.parse(JSON.stringify(object)) as T; 44 | } 45 | 46 | /** 47 | * Check if something is zero 48 | * @param amount The amount 49 | */ 50 | public static isZero(amount: string | number): boolean { 51 | if (!amount || amount === '') { 52 | return true; 53 | } 54 | return new BigNumber(amount).eq(0); 55 | } 56 | 57 | /** 58 | * Generate random id 59 | */ 60 | public static randomId(): string { 61 | const randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26)); 62 | return randLetter + Date.now(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { BrowserModule } from '@angular/platform-browser'; 5 | import { UniswapAngularSwapperComponent } from './uniswap-angular-swapper/uniswap-angular-swapper.component'; 6 | import { LoadingComponent } from './uniswap-angular-swapper/components/loading/loading.component'; 7 | import { HeaderComponent } from './uniswap-angular-swapper/components/header/header.component'; 8 | import { ConfirmSwapModalComponent } from './uniswap-angular-swapper/components/confirm-swap-modal/confirm-swap-modal.component'; 9 | import { TransactionModalComponent } from './uniswap-angular-swapper/components/transaction-modal/transaction-modal.component'; 10 | import { ErrorComponent } from './uniswap-angular-swapper/components/error/error.component'; 11 | import { TokensModalComponent } from './uniswap-angular-swapper/components/tokens-modal/tokens-modal.component'; 12 | import { SwapQuoteInfoComponent } from './uniswap-angular-swapper/components/swap-quote-info/swap-quote-info.component'; 13 | import { ApprovalComponent } from './uniswap-angular-swapper/components/approval/approval.component'; 14 | import { SafePipe } from './pipes/safe.pipe'; 15 | import { TokenIconComponent } from './uniswap-angular-swapper/components/token-icon/token-icon.component'; 16 | 17 | @NgModule({ 18 | declarations: [UniswapAngularSwapperComponent, LoadingComponent, HeaderComponent, ConfirmSwapModalComponent, TransactionModalComponent, ErrorComponent, TokensModalComponent, SwapQuoteInfoComponent, ApprovalComponent, SafePipe, TokenIconComponent], 19 | imports: [CommonModule, FormsModule, BrowserModule], 20 | exports: [UniswapAngularSwapperComponent], 21 | }) 22 | export class UniswapModule {} 23 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/header/header.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, EventEmitter, Input, Output } from '@angular/core'; 2 | import { 3 | ErrorCodes, 4 | UniswapDappSharedLogic, 5 | } from 'uniswap-dapp-integration-shared'; 6 | 7 | @Component({ 8 | selector: 'lib-header', 9 | templateUrl: './header.component.html', 10 | styleUrls: ['./header.component.scss'], 11 | }) 12 | export class HeaderComponent { 13 | @Input() public uniswapDappSharedLogic!: UniswapDappSharedLogic; 14 | @Output() public disableMultihopsCompleted = new EventEmitter(); 15 | 16 | public slippageCustom: number | undefined; 17 | public transactionDeadline: number | undefined; 18 | 19 | constructor() {} 20 | 21 | /** 22 | * Set slippage from the choosen options 23 | */ 24 | public async setSlippage(value: number): Promise { 25 | this.slippageCustom = undefined; 26 | await this.uniswapDappSharedLogic.setSlippage(value); 27 | } 28 | 29 | /** 30 | * Set custom slippage 31 | */ 32 | public async setCustomSlippage(value: number): Promise { 33 | if (!value) { 34 | await this.uniswapDappSharedLogic.setSlippage(0.5); 35 | } else { 36 | await this.uniswapDappSharedLogic.setSlippage(value); 37 | } 38 | } 39 | 40 | /** 41 | * Set disable multihops 42 | * @params isDisabled - true or false 43 | */ 44 | public async setDisableMultihops(isDisabled: boolean): Promise { 45 | let noLiquidityFound = false; 46 | try { 47 | await this.uniswapDappSharedLogic.setDisableMultihops(isDisabled); 48 | } catch (error) { 49 | if (error?.code === ErrorCodes.noRoutesFound) { 50 | noLiquidityFound = true; 51 | } else { 52 | throw error; 53 | } 54 | } 55 | 56 | this.disableMultihopsCompleted.emit(noLiquidityFound); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /showcase/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | 24 | Uniswap dapp integration showcase 25 | 26 | 27 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /shared/src/coin-gecko.ts: -------------------------------------------------------------------------------- 1 | import { ChainId, removeEthFromContractAddress } from 'simple-uniswap-sdk'; 2 | import { Utils } from './utils'; 3 | 4 | export class CoinGecko { 5 | private _fiatPriceCache: 6 | | { 7 | cachedResponse: any; 8 | timestamp: number; 9 | } 10 | | undefined = undefined; 11 | // 90 seconds cache 12 | private _cacheMilliseconds = 90000; 13 | constructor() {} 14 | 15 | /** 16 | * Get the coin gecko fiat price 17 | * @param contractAddress The array of contract addresses 18 | * @param chainId The chain id 19 | */ 20 | public async getCoinGeckoFiatPrices( 21 | contractAddresses: string[], 22 | chainId: number, 23 | ): Promise { 24 | contractAddresses = contractAddresses.map((address) => 25 | removeEthFromContractAddress(address), 26 | ); 27 | if (chainId === ChainId.MAINNET) { 28 | if (this._fiatPriceCache) { 29 | const now = Date.now(); 30 | if ( 31 | Utils.deepClone(this._fiatPriceCache.timestamp) > 32 | now - this._cacheMilliseconds 33 | ) { 34 | return this._fiatPriceCache.cachedResponse; 35 | } 36 | } 37 | 38 | try { 39 | const response = await ( 40 | await fetch( 41 | `https://api.coingecko.com/api/v3/simple/token_price/ethereum?contract_addresses=${contractAddresses.join()}&vs_currencies=usd`, 42 | ) 43 | ).json(); 44 | 45 | this._fiatPriceCache = { 46 | cachedResponse: response, 47 | timestamp: Date.now(), 48 | }; 49 | 50 | return response; 51 | } catch (e) { 52 | // if coin gecko is down for any reason still allow the swapper to work 53 | if (this._fiatPriceCache) { 54 | return this._fiatPriceCache.cachedResponse; 55 | } 56 | 57 | return {}; 58 | } 59 | } else { 60 | return {}; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /shared/src/chain/index.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | import { ChainId } from 'simple-uniswap-sdk'; 3 | import { EthereumProvider } from '../ethereum-provider'; 4 | 5 | export class ChainService { 6 | public newBlock$ = new Subject(); 7 | constructor(private _ethereumProvider: EthereumProvider) { 8 | this.unwatch(); 9 | this.watchBlocks(); 10 | } 11 | 12 | /** 13 | * Get the block explorer for transaction hash 14 | * @param chainId The chain id 15 | * @param transactionHash The transaction hash 16 | */ 17 | public getBlockExplorerLinkForTransactionHash( 18 | chainId: ChainId, 19 | transactionHash: string, 20 | ): string { 21 | return `${this.getBlockExplorerForNetwork(chainId)}tx/${transactionHash}`; 22 | } 23 | 24 | /** 25 | * unwatch any block streams 26 | */ 27 | public unwatch(): void { 28 | this._ethereumProvider.provider.removeAllListeners('block'); 29 | } 30 | 31 | /** 32 | * Get block explorer link for network 33 | * @param network The network 34 | */ 35 | private getBlockExplorerForNetwork(chainId: ChainId): string { 36 | switch (chainId) { 37 | case ChainId.MAINNET: 38 | return 'https://etherscan.io/'; 39 | case ChainId.RINKEBY: 40 | return 'https://rinkeby.etherscan.io/'; 41 | case ChainId.ROPSTEN: 42 | return 'https://ropsten.etherscan.io/'; 43 | case ChainId.KOVAN: 44 | return 'https://kovan.etherscan.io/'; 45 | case ChainId.GÖRLI: 46 | return 'https://goerli.etherscan.io/'; 47 | default: 48 | throw new Error('Network is not defined'); 49 | } 50 | } 51 | 52 | /** 53 | * Watch blocks 54 | */ 55 | private watchBlocks(): void { 56 | this._ethereumProvider.provider.on('block', (block: number) => { 57 | this.handleNewBlock(block); 58 | }); 59 | } 60 | 61 | /** 62 | * Handle new block 63 | */ 64 | private handleNewBlock(block: number): void { 65 | this.newBlock$.next(block); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vue/src/uniswap/internal-components/approval.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | 71 | -------------------------------------------------------------------------------- /showcase/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `yarn start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `yarn test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `yarn build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `yarn eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | -------------------------------------------------------------------------------- /vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uniswap-vue", 3 | "version": "1.0.5", 4 | "description": "Integrating uniswap within your vue dApp with a couple of lines of code.", 5 | "main": "lib/index.js", 6 | "module": "lib/index.esm.js", 7 | "scripts": { 8 | "start": "vue-cli-service serve dev/serve.js", 9 | "build": "rollup -c", 10 | "prepublishOnly": "npm run build", 11 | "link": "npm link ../shared" 12 | }, 13 | "author": "joshstevens19@hotmail.co.uk", 14 | "license": "MIT", 15 | "peerDependencies": { 16 | "vue": "^3.0.0", 17 | "uniswap-dapp-integration-shared": "^1.0.0" 18 | }, 19 | "dependencies": { 20 | "bignumber.js": "^9.0.1", 21 | "rxjs": "~6.6.0" 22 | }, 23 | "devDependencies": { 24 | "@babel/core": "^7.13.10", 25 | "@rollup/plugin-commonjs": "^17.1.0", 26 | "@rollup/plugin-node-resolve": "^11.2.0", 27 | "@rollup/plugin-typescript": "^8.2.1", 28 | "@storybook/vue3": "^6.2.2", 29 | "@types/jest": "^24.9.1", 30 | "@typescript-eslint/eslint-plugin": "^2.33.0", 31 | "@typescript-eslint/parser": "^2.33.0", 32 | "@vue/cli-service": "^4.5.13", 33 | "@vue/compiler-sfc": "^3.0.11", 34 | "@vue/test-utils": "^2.0.0-0", 35 | "babel-loader": "^8.2.2", 36 | "eslint": "^6.7.2", 37 | "eslint-plugin-prettier": "^3.1.3", 38 | "eslint-plugin-vue": "^7.0.0-0", 39 | "postcss": "^8.1.9", 40 | "prettier": "^1.19.1", 41 | "rollup": "^2.41.2", 42 | "rollup-plugin-peer-deps-external": "^2.2.4", 43 | "rollup-plugin-postcss": "^4.0.0", 44 | "rollup-plugin-typescript2": "^0.30.0", 45 | "rollup-plugin-vue": "^6.0.0", 46 | "ts-jest": "^26.5.4", 47 | "typescript": "~3.9.3", 48 | "vue": "^3.0.0", 49 | "vue-class-component": "^8.0.0-0", 50 | "vue-jest": "^5.0.0-0", 51 | "vue-loader": "^16.2.0" 52 | }, 53 | "files": [ 54 | "lib", 55 | "package.json", 56 | "package-lock.json", 57 | "LICENSE", 58 | "README.md" 59 | ], 60 | "keywords": [ 61 | "ethereum", 62 | "blockchain", 63 | "uniswap", 64 | "vue" 65 | ], 66 | "bugs": { 67 | "url": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo/issues" 68 | }, 69 | "homepage": "https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo" 70 | } 71 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `yarn start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `yarn test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `yarn build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `yarn eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | ChainId, 4 | ETH, 5 | UniswapDappSharedLogicContext, 6 | } from 'uniswap-dapp-integration-shared'; 7 | 8 | @Component({ 9 | selector: 'app-root', 10 | templateUrl: './app.component.html', 11 | styleUrls: ['./app.component.scss'], 12 | }) 13 | export class AppComponent implements OnInit { 14 | public uniswapDappSharedLogicContext: 15 | | UniswapDappSharedLogicContext 16 | | undefined; 17 | 18 | /** 19 | * On load 20 | */ 21 | async ngOnInit(): Promise { 22 | // MetaMask 23 | const accounts = await (window as any).ethereum.request({ 24 | method: 'eth_requestAccounts', 25 | }); 26 | 27 | this.uniswapDappSharedLogicContext = { 28 | supportedNetworkTokens: [ 29 | { 30 | chainId: ChainId.MAINNET, 31 | defaultInputValue: '0.000001', 32 | defaultInputToken: ETH.MAINNET().contractAddress, 33 | defaultOutputToken: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f', 34 | supportedTokens: [ 35 | { contractAddress: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984' }, 36 | { contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7' }, 37 | { contractAddress: ETH.MAINNET().contractAddress }, 38 | { contractAddress: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9' }, 39 | { contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f' }, 40 | ], 41 | }, 42 | { 43 | chainId: ChainId.RINKEBY, 44 | defaultInputToken: ETH.RINKEBY().contractAddress, 45 | defaultOutputToken: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 46 | supportedTokens: [ 47 | { 48 | contractAddress: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 49 | }, 50 | ], 51 | }, 52 | ], 53 | ethereumAddress: accounts[0], 54 | ethereumProvider: (window as any).ethereum, 55 | // theming: { 56 | // backgroundColor: 'red', 57 | // button: { textColor: 'white', backgroundColor: 'blue' }, 58 | // panel: { textColor: 'black', backgroundColor: 'yellow' }, 59 | // textColor: 'orange', 60 | // }, 61 | }; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /shared/src/ethereum-provider.ts: -------------------------------------------------------------------------------- 1 | import { providers, utils } from 'ethers'; 2 | import { ETH, Transaction } from 'simple-uniswap-sdk'; 3 | import { SupportedNetworkTokens } from './token/models/supported-network-token'; 4 | 5 | export class EthereumProvider { 6 | private _ethersProvider: 7 | | providers.StaticJsonRpcProvider 8 | | providers.JsonRpcProvider 9 | | providers.InfuraProvider 10 | | providers.Web3Provider; 11 | 12 | constructor(private _address: string, provider: any) { 13 | if (provider._isProvider) { 14 | this._ethersProvider = provider; 15 | } else { 16 | this._ethersProvider = new providers.Web3Provider(provider); 17 | } 18 | } 19 | 20 | /** 21 | * Get the ethereum address 22 | */ 23 | public get address(): string { 24 | return utils.getAddress(this._address); 25 | } 26 | 27 | /** 28 | * Get the ethers provider 29 | */ 30 | public get provider(): 31 | | providers.StaticJsonRpcProvider 32 | | providers.JsonRpcProvider 33 | | providers.InfuraProvider 34 | | providers.Web3Provider { 35 | return this._ethersProvider; 36 | } 37 | 38 | /** 39 | * Send async 40 | * @param transaction The transaction 41 | */ 42 | public async sendAsync(transaction: Transaction): Promise { 43 | return await this.provider.send('eth_sendTransaction', [transaction]); 44 | } 45 | 46 | /** 47 | * Is support chain 48 | */ 49 | public isSupportedChain( 50 | chainId: number, 51 | supportedNetworkTokens: SupportedNetworkTokens[], 52 | ): boolean { 53 | try { 54 | ETH.info(chainId); 55 | 56 | return ( 57 | supportedNetworkTokens.find((t) => t.chainId === chainId) !== undefined 58 | ); 59 | } catch (error) { 60 | return false; 61 | } 62 | } 63 | 64 | /** 65 | * Update ethereum address 66 | * @param address The address 67 | */ 68 | public updateEthereumAddress(address: string): void { 69 | this._address = address; 70 | } 71 | 72 | // /** 73 | // * Send async 74 | // * @param transaction The transaction 75 | // */ 76 | // public async sendAsync(transaction: Transaction): Promise { 77 | // return await this._ethersInstance.provider.request!({ 78 | // method: 'eth_sendTransaction', 79 | // params: [transaction], 80 | // }); 81 | // } 82 | } 83 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | ChainId, 4 | ETH, 5 | UniswapDappSharedLogicContext, 6 | } from 'uniswap-dapp-integration-shared'; 7 | 8 | @Component({ 9 | selector: 'app-root', 10 | templateUrl: './app.component.html', 11 | // tslint:disable-next-line: object-literal-sort-keys 12 | styleUrls: ['./app.component.scss'], 13 | }) 14 | export class AppComponent implements OnInit { 15 | public uniswapDappSharedLogicContext: 16 | | UniswapDappSharedLogicContext 17 | | undefined; 18 | 19 | /** 20 | * On load 21 | */ 22 | public async ngOnInit(): Promise { 23 | // MetaMask 24 | const accounts = await (window as any).ethereum.request({ 25 | method: 'eth_requestAccounts', 26 | }); 27 | 28 | this.uniswapDappSharedLogicContext = { 29 | supportedNetworkTokens: [ 30 | { 31 | chainId: ChainId.MAINNET, 32 | defaultInputValue: '0.000001', 33 | // tslint:disable-next-line: object-literal-sort-keys 34 | defaultInputToken: ETH.MAINNET().contractAddress, 35 | defaultOutputToken: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f', 36 | supportedTokens: [ 37 | { contractAddress: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984' }, 38 | { contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7' }, 39 | { contractAddress: ETH.MAINNET().contractAddress }, 40 | { contractAddress: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9' }, 41 | { contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f' }, 42 | ], 43 | }, 44 | { 45 | chainId: ChainId.RINKEBY, 46 | defaultInputToken: ETH.RINKEBY().contractAddress, 47 | defaultOutputToken: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 48 | supportedTokens: [ 49 | { 50 | contractAddress: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 51 | }, 52 | ], 53 | }, 54 | ], 55 | // tslint:disable-next-line: object-literal-sort-keys 56 | ethereumAddress: accounts[0], 57 | ethereumProvider: (window as any).ethereum, 58 | // theming: { 59 | // backgroundColor: 'red', 60 | // button: { textColor: 'white', backgroundColor: 'blue' }, 61 | // panel: { textColor: 'black', backgroundColor: 'yellow' }, 62 | // textColor: 'orange', 63 | // }, 64 | }; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /integration-apps/uniswap-vue-test-integration-app/src/App.vue: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 61 | 62 | 84 | -------------------------------------------------------------------------------- /showcase/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /react-package/package/src/components/approval.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | MiningTransaction, 4 | TradeContext, 5 | TransactionStatus, 6 | UniswapDappSharedLogic, 7 | } from 'uniswap-dapp-integration-shared'; 8 | import TokenIcon from './tokenIcon'; 9 | 10 | const Approval = ({ 11 | uniswapDappSharedLogic, 12 | tradeContext, 13 | miningTransaction, 14 | miningTransactionStatus, 15 | }: { 16 | uniswapDappSharedLogic: UniswapDappSharedLogic; 17 | tradeContext: TradeContext | undefined; 18 | miningTransaction: MiningTransaction | undefined; 19 | miningTransactionStatus: TransactionStatus | undefined; 20 | }): JSX.Element => { 21 | const transactionStatus = TransactionStatus; 22 | 23 | return ( 24 |
25 | {tradeContext?.approvalTransaction && 26 | tradeContext?.fromBalance?.hasEnough && ( 27 | 68 | )} 69 |
70 | ); 71 | }; 72 | 73 | export default Approval; 74 | -------------------------------------------------------------------------------- /vue/dev/serve.vue: -------------------------------------------------------------------------------- 1 | 57 | 58 | 68 | 69 | 91 | -------------------------------------------------------------------------------- /react-package/uniswap-react-test-integration-app/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { 3 | ChainId, 4 | ETH, 5 | UniswapDappSharedLogicContext, 6 | } from 'uniswap-dapp-integration-shared'; 7 | import UniswapReact from 'uniswap-react'; 8 | import './App.css'; 9 | 10 | function App() { 11 | const [uniswapDappSharedLogicContext, setUniswapDappSharedLogicContext] = 12 | React.useState(undefined); 13 | 14 | useEffect(() => { 15 | (async () => { 16 | // MetaMask 17 | const accounts = await (window as any).ethereum.request({ 18 | method: 'eth_requestAccounts', 19 | }); 20 | 21 | const uniswapDappSharedLogicContext: UniswapDappSharedLogicContext = { 22 | supportedNetworkTokens: [ 23 | { 24 | chainId: ChainId.MAINNET, 25 | defaultInputValue: '0.000001', 26 | defaultInputToken: ETH.MAINNET().contractAddress, 27 | defaultOutputToken: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f', 28 | supportedTokens: [ 29 | { 30 | contractAddress: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', 31 | }, 32 | { 33 | contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7', 34 | }, 35 | { 36 | contractAddress: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', 37 | }, 38 | { 39 | contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f', 40 | }, 41 | ], 42 | }, 43 | { 44 | chainId: ChainId.RINKEBY, 45 | defaultInputToken: ETH.RINKEBY().contractAddress, 46 | defaultOutputToken: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 47 | supportedTokens: [ 48 | { 49 | contractAddress: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 50 | }, 51 | ], 52 | }, 53 | ], 54 | ethereumAddress: accounts[0], 55 | ethereumProvider: (window as any).ethereum, 56 | // theming: { 57 | // backgroundColor: 'red', 58 | // button: { textColor: 'white', backgroundColor: 'blue' }, 59 | // panel: { textColor: 'black', backgroundColor: 'yellow' }, 60 | // textColor: 'orange', 61 | // }, 62 | }; 63 | 64 | setUniswapDappSharedLogicContext(uniswapDappSharedLogicContext); 65 | })(); 66 | }, []); 67 | 68 | return ( 69 |
70 |
71 | {uniswapDappSharedLogicContext !== undefined && ( 72 | 75 | )} 76 |
77 |
78 | ); 79 | } 80 | 81 | export default App; 82 | -------------------------------------------------------------------------------- /integration-apps/uniswap-react-test-integration-app/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { 3 | ChainId, 4 | ETH, 5 | UniswapDappSharedLogicContext, 6 | } from 'uniswap-dapp-integration-shared'; 7 | import UniswapReact from 'uniswap-react'; 8 | import './App.css'; 9 | 10 | function App() { 11 | const [uniswapDappSharedLogicContext, setUniswapDappSharedLogicContext] = 12 | React.useState(undefined); 13 | 14 | useEffect(() => { 15 | (async () => { 16 | // MetaMask 17 | const accounts = await (window as any).ethereum.request({ 18 | method: 'eth_requestAccounts', 19 | }); 20 | 21 | const uniswapDappSharedLogicContext: UniswapDappSharedLogicContext = { 22 | supportedNetworkTokens: [ 23 | { 24 | chainId: ChainId.MAINNET, 25 | defaultInputValue: '0.000001', 26 | defaultInputToken: ETH.MAINNET().contractAddress, 27 | defaultOutputToken: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f', 28 | supportedTokens: [ 29 | { 30 | contractAddress: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', 31 | }, 32 | { 33 | contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7', 34 | }, 35 | { 36 | contractAddress: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', 37 | }, 38 | { 39 | contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f', 40 | }, 41 | ], 42 | }, 43 | { 44 | chainId: ChainId.RINKEBY, 45 | defaultInputToken: ETH.RINKEBY().contractAddress, 46 | defaultOutputToken: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 47 | supportedTokens: [ 48 | { 49 | contractAddress: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 50 | }, 51 | ], 52 | }, 53 | ], 54 | ethereumAddress: accounts[0], 55 | ethereumProvider: (window as any).ethereum, 56 | // theming: { 57 | // backgroundColor: 'red', 58 | // button: { textColor: 'white', backgroundColor: 'blue' }, 59 | // panel: { textColor: 'black', backgroundColor: 'yellow' }, 60 | // textColor: 'orange', 61 | // }, 62 | }; 63 | 64 | setUniswapDappSharedLogicContext(uniswapDappSharedLogicContext); 65 | })(); 66 | }, []); 67 | 68 | return ( 69 |
70 |
71 | {uniswapDappSharedLogicContext !== undefined && ( 72 | 75 | )} 76 |
77 |
78 | ); 79 | } 80 | 81 | export default App; 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # uniswap-dapp-integration-monorepo 2 | 3 | This repo holds the angular, react, vue uniswap integration packages. It also has the shared package they all use. This is powered by [uniswap-simple-sdk](https://github.com/uniswap-integration/simple-uniswap-sdk). This is funded by unigrants. 4 | 5 | ## What this repo solves 6 | 7 | Integrating uniswap within your dApp should be a simple thing but with all the complex stuff that goes into making it work, managing transaction status, calling the correct methods on the swap, maintaining the users balances, syncing the fiat prices, producing the token icons, handling all the UI making it work on every browser, i could keep going. On top of this you don't really want to pop a window for the user to swap using the uniswap widget, you want to keep the user experience consistent with your dApp. The idea of this library is to give you a really easy but fully flexible way you can integrate with uniswap with only a few lines of code. This has an angular package, vue package and react package so you can easily get running and create your own uniswap experience. You can customise mostly everything from what tokens you support to what colour you want it to be themed as! 8 | 9 | ## Features 🚀 10 | 11 | 🚀 Integrate it into your existing dApp with a few lines of code 12 |
13 | 🚀 Supports uniswap v2 and v3 prices together and returns the best price 14 |
15 | 🚀 Queries all the best routes and finds the best price for you 16 |
17 | 🚀 Reactive logic so when the price moves or your trade expiries it generates you a new one but alerts the user (queries new trades on every new block) 18 |
19 | 🚀 Reactive fiat price so users can see the amount the trade is in fiat, this updates as the price changes as well 20 |
21 | 🚀 Reactive balance syncing so the user can see their correct balance all the time (syncs on every new block) 22 |
23 | 🚀 Supports all major browsers 24 |
25 | 🚀 Is fully responsive 26 |
27 | 🚀 Fully customisable, style it as you want, support whatever tokens you want and much more 28 |
29 | 🚀 Uses the awesome [simple-uniswap-sdk](https://github.com/uniswap-integration/simple-uniswap-sdk) for all the uniswap on chain logic 30 |
31 | 🚀 Fully typescript supported with full generated typings 32 |
33 | 🚀 and much more!! 34 | 35 | ## Live demo 36 | 37 | You can view a live demo [here](https://uniswap-dapp-integration.netlify.app). You will need MetaMask installed. It only uses a few tokens just to show the demo working. 38 | 39 | ## Angular 40 | 41 | Full docs for the angular integration please go [here](https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo/tree/master/angular) 42 | 43 | ## React 44 | 45 | Full docs for the react integration please go [here](https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo/tree/master/react-package) 46 | 47 | ## VUE 48 | 49 | Full docs for the vue integration please go [here](https://github.com/uniswap-integration/uniswap-dapp-integration-monorepo/tree/master/vue) 50 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular-showcase/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /angular/lib/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": ["codelyzer"], 4 | "rules": { 5 | "align": { 6 | "options": ["parameters", "statements"] 7 | }, 8 | "array-type": false, 9 | "arrow-return-shorthand": true, 10 | "curly": true, 11 | "deprecation": { 12 | "severity": "warning" 13 | }, 14 | "eofline": true, 15 | "import-blacklist": [true, "rxjs/Rx"], 16 | "import-spacing": true, 17 | "indent": { 18 | "options": ["spaces"] 19 | }, 20 | "max-classes-per-file": false, 21 | "max-line-length": [true, 140], 22 | "member-ordering": [ 23 | true, 24 | { 25 | "order": [ 26 | "static-field", 27 | "instance-field", 28 | "static-method", 29 | "instance-method" 30 | ] 31 | } 32 | ], 33 | "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], 34 | "no-empty": false, 35 | "no-inferrable-types": [true, "ignore-params"], 36 | "no-non-null-assertion": false, 37 | "no-redundant-jsdoc": true, 38 | "no-switch-case-fall-through": true, 39 | "no-var-requires": false, 40 | "object-literal-key-quotes": [true, "as-needed"], 41 | "quotemark": [true, "single"], 42 | "semicolon": { 43 | "options": ["always"] 44 | }, 45 | "space-before-function-paren": { 46 | "options": { 47 | "anonymous": "never", 48 | "asyncArrow": "always", 49 | "constructor": "never", 50 | "method": "never", 51 | "named": "never" 52 | } 53 | }, 54 | "typedef": [true, "call-signature"], 55 | "typedef-whitespace": { 56 | "options": [ 57 | { 58 | "call-signature": "nospace", 59 | "index-signature": "nospace", 60 | "parameter": "nospace", 61 | "property-declaration": "nospace", 62 | "variable-declaration": "nospace" 63 | }, 64 | { 65 | "call-signature": "onespace", 66 | "index-signature": "onespace", 67 | "parameter": "onespace", 68 | "property-declaration": "onespace", 69 | "variable-declaration": "onespace" 70 | } 71 | ] 72 | }, 73 | "variable-name": false, 74 | "whitespace": { 75 | "options": [ 76 | "check-branch", 77 | "check-decl", 78 | "check-operator", 79 | "check-separator", 80 | "check-type", 81 | "check-typecast" 82 | ] 83 | }, 84 | "component-class-suffix": true, 85 | "contextual-lifecycle": true, 86 | "directive-class-suffix": true, 87 | "no-conflicting-lifecycle": true, 88 | "no-host-metadata-property": true, 89 | "no-input-rename": true, 90 | "no-inputs-metadata-property": true, 91 | "no-output-native": true, 92 | "no-output-on-prefix": true, 93 | "no-output-rename": true, 94 | "no-outputs-metadata-property": true, 95 | "template-banana-in-box": true, 96 | "template-no-negated-async": true, 97 | "use-lifecycle-interface": true, 98 | "use-pipe-transform-interface": true 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/tokens-modal/tokens-modal.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, EventEmitter, Input, Output } from '@angular/core'; 2 | import { 3 | ErrorCodes, 4 | SelectTokenActionFrom, 5 | SwapSwitchResponse, 6 | UniswapDappSharedLogic, 7 | Utils as UniswapUtils, 8 | } from 'uniswap-dapp-integration-shared'; 9 | 10 | @Component({ 11 | selector: 'lib-tokens-modal', 12 | templateUrl: './tokens-modal.component.html', 13 | styleUrls: ['./tokens-modal.component.scss'], 14 | }) 15 | export class TokensModalComponent { 16 | @Input() public uniswapDappSharedLogic!: UniswapDappSharedLogic; 17 | @Output() public switchSwapCompleted = new EventEmitter(); 18 | @Output() public changedTokenCompleted = new EventEmitter(); 19 | 20 | public utils = UniswapUtils; 21 | public searchToken: string | undefined; 22 | constructor() {} 23 | 24 | /** 25 | * Change select token 26 | * @param contractAddress The contractAddress 27 | */ 28 | public async changeSelectToken(contractAddress: string): Promise { 29 | switch (this.uniswapDappSharedLogic.selectorOpenFrom) { 30 | case SelectTokenActionFrom.input: 31 | if ( 32 | this.uniswapDappSharedLogic.inputToken.contractAddress === 33 | contractAddress 34 | ) { 35 | this.uniswapDappSharedLogic.hideTokenSelector(); 36 | return; 37 | } 38 | 39 | if ( 40 | this.uniswapDappSharedLogic.outputToken?.contractAddress === 41 | contractAddress 42 | ) { 43 | const swapResponse = await this.uniswapDappSharedLogic.swapSwitch(); 44 | this.switchSwapCompleted.emit(swapResponse); 45 | this.uniswapDappSharedLogic.hideTokenSelector(); 46 | return; 47 | } 48 | 49 | await this.changeToken(contractAddress); 50 | return; 51 | case SelectTokenActionFrom.output: 52 | if ( 53 | this.uniswapDappSharedLogic.outputToken?.contractAddress === 54 | contractAddress 55 | ) { 56 | this.uniswapDappSharedLogic.hideTokenSelector(); 57 | return; 58 | } 59 | 60 | if ( 61 | this.uniswapDappSharedLogic.inputToken.contractAddress === 62 | contractAddress 63 | ) { 64 | const swapResponse = await this.uniswapDappSharedLogic.swapSwitch(); 65 | this.switchSwapCompleted.emit(swapResponse); 66 | this.uniswapDappSharedLogic.hideTokenSelector(); 67 | return; 68 | } 69 | 70 | await this.changeToken(contractAddress); 71 | return; 72 | } 73 | } 74 | 75 | /** 76 | * Change token handler 77 | * @param contractAddress The contractAddress 78 | */ 79 | private async changeToken(contractAddress: string): Promise { 80 | try { 81 | await this.uniswapDappSharedLogic.changeToken(contractAddress); 82 | } catch (error) { 83 | if (error?.code === ErrorCodes.noRoutesFound) { 84 | this.changedTokenCompleted.emit(true); 85 | return; 86 | } else { 87 | throw error; 88 | } 89 | } 90 | 91 | this.changedTokenCompleted.emit(false); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": ["codelyzer"], 4 | "rules": { 5 | "align": { 6 | "options": ["parameters", "statements"] 7 | }, 8 | "array-type": false, 9 | "arrow-return-shorthand": true, 10 | "curly": true, 11 | "deprecation": { 12 | "severity": "warning" 13 | }, 14 | "eofline": true, 15 | "import-blacklist": [true, "rxjs/Rx"], 16 | "import-spacing": true, 17 | "indent": { 18 | "options": ["spaces"] 19 | }, 20 | "max-classes-per-file": false, 21 | "max-line-length": [true, 140], 22 | "member-ordering": [ 23 | true, 24 | { 25 | "order": [ 26 | "static-field", 27 | "instance-field", 28 | "static-method", 29 | "instance-method" 30 | ] 31 | } 32 | ], 33 | "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], 34 | "no-empty": false, 35 | "no-inferrable-types": [true, "ignore-params"], 36 | "no-non-null-assertion": false, 37 | "no-redundant-jsdoc": true, 38 | "no-switch-case-fall-through": true, 39 | "no-var-requires": false, 40 | "object-literal-key-quotes": [true, "as-needed"], 41 | "quotemark": [true, "single"], 42 | "semicolon": { 43 | "options": ["always"] 44 | }, 45 | "space-before-function-paren": { 46 | "options": { 47 | "anonymous": "never", 48 | "asyncArrow": "always", 49 | "constructor": "never", 50 | "method": "never", 51 | "named": "never" 52 | } 53 | }, 54 | "typedef": [true, "call-signature"], 55 | "typedef-whitespace": { 56 | "options": [ 57 | { 58 | "call-signature": "nospace", 59 | "index-signature": "nospace", 60 | "parameter": "nospace", 61 | "property-declaration": "nospace", 62 | "variable-declaration": "nospace" 63 | }, 64 | { 65 | "call-signature": "onespace", 66 | "index-signature": "onespace", 67 | "parameter": "onespace", 68 | "property-declaration": "onespace", 69 | "variable-declaration": "onespace" 70 | } 71 | ] 72 | }, 73 | "unified-signatures": true, 74 | "variable-name": false, 75 | "whitespace": { 76 | "options": [ 77 | "check-branch", 78 | "check-decl", 79 | "check-operator", 80 | "check-separator", 81 | "check-type", 82 | "check-typecast" 83 | ] 84 | }, 85 | "component-class-suffix": true, 86 | "contextual-lifecycle": true, 87 | "directive-class-suffix": true, 88 | "no-conflicting-lifecycle": true, 89 | "no-host-metadata-property": true, 90 | "no-input-rename": true, 91 | "no-inputs-metadata-property": true, 92 | "no-output-native": true, 93 | "no-output-on-prefix": true, 94 | "no-output-rename": true, 95 | "no-outputs-metadata-property": true, 96 | "template-banana-in-box": true, 97 | "template-no-negated-async": true, 98 | "use-lifecycle-interface": true, 99 | "use-pipe-transform-interface": true, 100 | "directive-selector": [true, "attribute", "app", "camelCase"], 101 | "component-selector": [true, "element", "app", "kebab-case"] 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/tokens-modal/tokens-modal.component.html: -------------------------------------------------------------------------------- 1 |
6 |
9 | × 14 |

Select a token

15 | 25 | 26 |
27 |
28 |
38 |
39 |
55 |
56 | 60 | 61 |
62 |
63 | {{ token.symbol }} 64 |
65 |
66 | {{ token.name }} 67 |
68 |
69 | 70 |
71 |
72 | {{ utils.toPrecision(token.balance) }} 73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | -------------------------------------------------------------------------------- /integration-apps/uniswap-angular-test-integration-app/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "uniswap-angular-test-integration-app": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | }, 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "@angular-devkit/build-angular:browser", 22 | "options": { 23 | "outputPath": "dist/uniswap-angular-test-integration-app", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "aot": true, 29 | "assets": ["src/favicon.ico", "src/assets"], 30 | "styles": ["src/styles.scss"], 31 | "scripts": [] 32 | }, 33 | "configurations": { 34 | "production": { 35 | "fileReplacements": [ 36 | { 37 | "replace": "src/environments/environment.ts", 38 | "with": "src/environments/environment.prod.ts" 39 | } 40 | ], 41 | "optimization": true, 42 | "outputHashing": "all", 43 | "sourceMap": false, 44 | "namedChunks": false, 45 | "extractLicenses": true, 46 | "vendorChunk": false, 47 | "buildOptimizer": true, 48 | "budgets": [ 49 | { 50 | "type": "initial", 51 | "maximumWarning": "500kb", 52 | "maximumError": "1mb" 53 | }, 54 | { 55 | "type": "anyComponentStyle", 56 | "maximumWarning": "2kb", 57 | "maximumError": "4kb" 58 | } 59 | ] 60 | } 61 | } 62 | }, 63 | "serve": { 64 | "builder": "@angular-devkit/build-angular:dev-server", 65 | "options": { 66 | "browserTarget": "uniswap-angular-test-integration-app:build" 67 | }, 68 | "configurations": { 69 | "production": { 70 | "browserTarget": "uniswap-angular-test-integration-app:build:production" 71 | } 72 | } 73 | }, 74 | "extract-i18n": { 75 | "builder": "@angular-devkit/build-angular:extract-i18n", 76 | "options": { 77 | "browserTarget": "uniswap-angular-test-integration-app:build" 78 | } 79 | }, 80 | "test": { 81 | "builder": "@angular-devkit/build-angular:karma", 82 | "options": { 83 | "main": "src/test.ts", 84 | "polyfills": "src/polyfills.ts", 85 | "tsConfig": "tsconfig.spec.json", 86 | "karmaConfig": "karma.conf.js", 87 | "assets": ["src/favicon.ico", "src/assets"], 88 | "styles": ["src/styles.scss"], 89 | "scripts": [] 90 | } 91 | }, 92 | "lint": { 93 | "builder": "@angular-devkit/build-angular:tslint", 94 | "options": { 95 | "tsConfig": [ 96 | "tsconfig.app.json", 97 | "tsconfig.spec.json", 98 | "e2e/tsconfig.json" 99 | ], 100 | "exclude": ["**/node_modules/**"] 101 | } 102 | }, 103 | "e2e": { 104 | "builder": "@angular-devkit/build-angular:protractor", 105 | "options": { 106 | "protractorConfig": "e2e/protractor.conf.js", 107 | "devServerTarget": "uniswap-angular-test-integration-app:serve" 108 | }, 109 | "configurations": { 110 | "production": { 111 | "devServerTarget": "uniswap-angular-test-integration-app:serve:production" 112 | } 113 | } 114 | } 115 | } 116 | } 117 | }, 118 | "defaultProject": "uniswap-angular-test-integration-app" 119 | } 120 | -------------------------------------------------------------------------------- /vue/src/uniswap/internal-components/swap-quote-info.vue: -------------------------------------------------------------------------------- 1 | 113 | 114 | 121 | -------------------------------------------------------------------------------- /angular/lib/projects/uniswap-angular/src/lib/uniswap-angular-swapper/components/swap-quote-info/swap-quote-info.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | Best rate on 6 | {{ uniswapDappSharedLogic.tradeContext.uniswapVersion }} 7 |
8 |
17 | 1 {{ uniswapDappSharedLogic.tradeContext.fromToken.symbol }} = 19 | {{ uniswapDappSharedLogic.workOutOneEqualTo() }} 20 | {{ uniswapDappSharedLogic.tradeContext.toToken.symbol }} 21 | 22 |
23 |
24 | 35 | 36 | 37 | 38 | 39 |
40 | 41 |
42 |
43 |
44 |
45 |
46 |
47 | Liquidity Provider Fee 48 |
49 |
50 |
51 | {{ 52 | uniswapDappSharedLogic.tradeContext.liquidityProviderFee 53 | }} 54 | {{ uniswapDappSharedLogic.tradeContext.fromToken.symbol }} 55 |
56 |
57 |
58 |
59 |
60 | Route 61 |
62 |
63 |
64 | {{ uniswapDappSharedLogic.tradeContext.routeText }} 65 |
66 |
67 |
73 |
74 |
75 | Minimum received 76 |
77 |
78 |
79 | {{ 80 | uniswapDappSharedLogic.tradeContext.minAmountConvertQuote 81 | }} 82 | {{ uniswapDappSharedLogic.tradeContext.toToken.symbol }} 83 |
84 |
85 |
89 |
90 |
91 | Maximum sent 92 |
93 |
94 |
95 | {{ uniswapDappSharedLogic.tradeContext.maximumSent }} 96 | {{ uniswapDappSharedLogic.tradeContext.fromToken.symbol }} 97 |
98 |
99 |
100 |
101 |
102 | Slippage tolerance 103 |
104 |
105 |
106 | {{ 107 | uniswapDappSharedLogic.uniswapPairSettings.slippage * 100 108 | }}% 109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | -------------------------------------------------------------------------------- /showcase/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { 3 | ChainId, 4 | ETH, 5 | UniswapDappSharedLogicContext, 6 | } from 'uniswap-dapp-integration-shared'; 7 | import UniswapReact from 'uniswap-react'; 8 | import './App.css'; 9 | 10 | function App() { 11 | const [uniswapDappSharedLogicContext, setUniswapDappSharedLogicContext] = 12 | React.useState(undefined); 13 | 14 | const [metamaskInstalled, setMetamaskInstalled] = React.useState< 15 | undefined | boolean 16 | >(false); 17 | 18 | const [loading, setLoading] = React.useState(true); 19 | 20 | useEffect(() => { 21 | (async () => { 22 | async function getMetaMaskAccount(): Promise { 23 | try { 24 | const accounts = await (window as any).ethereum.request({ 25 | method: 'eth_requestAccounts', 26 | }); 27 | return accounts; 28 | } catch (error) { 29 | // keep trying if they reject the request! 30 | return getMetaMaskAccount(); 31 | } 32 | } 33 | 34 | const ethereum = (window as any).ethereum; 35 | if (!ethereum) { 36 | setMetamaskInstalled(false); 37 | setLoading(false); 38 | return; 39 | } 40 | 41 | setMetamaskInstalled(true); 42 | 43 | // MetaMask 44 | const accounts = await getMetaMaskAccount(); 45 | 46 | const uniswapDappSharedLogicContext: UniswapDappSharedLogicContext = { 47 | supportedNetworkTokens: [ 48 | { 49 | chainId: ChainId.MAINNET, 50 | defaultInputToken: ETH.MAINNET().contractAddress, 51 | defaultOutputToken: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', 52 | supportedTokens: [ 53 | { 54 | contractAddress: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', 55 | }, 56 | { 57 | contractAddress: ETH.MAINNET().contractAddress, 58 | }, 59 | { 60 | contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7', 61 | }, 62 | { 63 | contractAddress: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', 64 | }, 65 | { 66 | contractAddress: '0xde30da39c46104798bb5aa3fe8b9e0e1f348163f', 67 | }, 68 | { 69 | contractAddress: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', 70 | }, 71 | { 72 | contractAddress: '0x6b175474e89094c44da98b954eedeac495271d0f', 73 | }, 74 | { 75 | contractAddress: '0xc944e90c64b2c07662a292be6244bdf05cda44a7', 76 | }, 77 | { 78 | contractAddress: '0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e', 79 | }, 80 | { 81 | contractAddress: '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', 82 | }, 83 | ], 84 | }, 85 | { 86 | chainId: ChainId.RINKEBY, 87 | defaultInputToken: ETH.RINKEBY().contractAddress, 88 | defaultOutputToken: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 89 | supportedTokens: [ 90 | { 91 | contractAddress: '0xef0e839cf88e47be676e72d5a9cb6ced99fad1cf', 92 | }, 93 | ], 94 | }, 95 | ], 96 | ethereumAddress: accounts[0], 97 | ethereumProvider: ethereum, 98 | }; 99 | 100 | setUniswapDappSharedLogicContext(uniswapDappSharedLogicContext); 101 | setLoading(false); 102 | })(); 103 | }, []); 104 | 105 | return ( 106 |
107 | {loading && ( 108 |
109 | {metamaskInstalled && ( 110 |

Please approve account or login to MetaMask

111 | )} 112 | 113 |
114 | 120 | 126 | 132 | 133 |
134 |
135 | )} 136 | 137 | {!loading && ( 138 |
139 | {uniswapDappSharedLogicContext !== undefined && metamaskInstalled && ( 140 | 143 | )} 144 | {!metamaskInstalled && ( 145 |

This showcase only supports MetaMask please install it.

146 | )} 147 |
148 | )} 149 |
150 | ); 151 | } 152 | 153 | export default App; 154 | -------------------------------------------------------------------------------- /shared/src/theming/index.ts: -------------------------------------------------------------------------------- 1 | import { UniswapTheming } from './models/uniswap-theming'; 2 | 3 | export class Theming { 4 | private readonly WIDGET_ID = 'uniswap__716283642843643826'; 5 | constructor(private _theming?: UniswapTheming) {} 6 | 7 | /** 8 | * Theme component 9 | */ 10 | public apply(): void { 11 | let css = '