From 6ae86c35199882b22b9f378f06d2c40033819bb4 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 28 Aug 2023 06:14:45 +0200 Subject: [PATCH 1/2] wails --- ui/.gitignore | 32 +-- ui/.svelte-kit/ambient.d.ts | 146 ++++++++--- ui/.svelte-kit/generated/server/internal.js | 2 +- ui/README.md | 57 +---- ui/app.go | 27 ++ ui/frontend/.gitignore | 33 +++ ui/{ => frontend}/index.html | 0 ui/{ => frontend}/package.json | 4 +- ui/frontend/package.json.md5 | 1 + ui/{ => frontend}/playwright.config.ts | 0 ui/{ => frontend}/postcss.config.cjs | 0 ui/{ => frontend}/public/favicon.png | Bin ui/{ => frontend}/public/global.css | 0 ui/{ => frontend}/public/iosevka-regular.ttf | Bin ui/{ => frontend}/public/vite.svg | 0 ui/{ => frontend}/src/App.svelte | 0 ui/{ => frontend}/src/app.d.ts | 0 ui/{ => frontend}/src/app.html | 0 ui/{ => frontend}/src/app.postcss | 0 .../src/assets/coins/1inch@2x.png | Bin .../src/assets/coins/aave@2x.png | Bin ui/{ => frontend}/src/assets/coins/ada@2x.png | Bin .../src/assets/coins/algo@2x.png | Bin ui/{ => frontend}/src/assets/coins/amp@2x.png | Bin .../src/assets/coins/ampl@2x.png | Bin .../src/assets/coins/ankr@2x.png | Bin ui/{ => frontend}/src/assets/coins/ant@2x.png | Bin ui/{ => frontend}/src/assets/coins/ape@2x.png | Bin .../src/assets/coins/atom@2x.png | Bin .../src/assets/coins/avax@2x.png | Bin ui/{ => frontend}/src/assets/coins/bat@2x.png | Bin ui/{ => frontend}/src/assets/coins/bch@2x.png | Bin ui/{ => frontend}/src/assets/coins/bnb@2x.png | Bin ui/{ => frontend}/src/assets/coins/bsv@2x.png | Bin ui/{ => frontend}/src/assets/coins/btc@2x.png | Bin ui/{ => frontend}/src/assets/coins/btg@2x.png | Bin ui/{ => frontend}/src/assets/coins/btt@2x.png | Bin ui/{ => frontend}/src/assets/coins/chz@2x.png | Bin .../src/assets/coins/comp@2x.png | Bin ui/{ => frontend}/src/assets/coins/crv@2x.png | Bin ui/{ => frontend}/src/assets/coins/dai@2x.png | Bin .../src/assets/coins/dash@2x.png | Bin ui/{ => frontend}/src/assets/coins/dcr@2x.png | Bin ui/{ => frontend}/src/assets/coins/dgb@2x.png | Bin .../src/assets/coins/doge@2x.png | Bin ui/{ => frontend}/src/assets/coins/dot@2x.png | Bin ui/{ => frontend}/src/assets/coins/enj@2x.png | Bin ui/{ => frontend}/src/assets/coins/eos@2x.png | Bin ui/{ => frontend}/src/assets/coins/etc@2x.png | Bin ui/{ => frontend}/src/assets/coins/eth.png | Bin ui/{ => frontend}/src/assets/coins/eth@2x.png | Bin ui/{ => frontend}/src/assets/coins/eur@2x.png | Bin ui/{ => frontend}/src/assets/coins/fil@2x.png | Bin .../src/assets/coins/flux@2x.png | Bin .../src/assets/coins/gold@2x.png | Bin ui/{ => frontend}/src/assets/coins/grt@2x.png | Bin ui/{ => frontend}/src/assets/coins/mkr@2x.png | Bin ui/{ => frontend}/src/assets/coins/neo@2x.png | Bin .../src/assets/coins/nexo@2x.png | Bin ui/{ => frontend}/src/assets/coins/ont@2x.png | Bin ui/{ => frontend}/src/assets/coins/ox@2x.png | Bin ui/{ => frontend}/src/assets/coins/pax@2x.png | Bin .../src/assets/coins/paxg@2x.png | Bin ui/{ => frontend}/src/assets/coins/qnt@2x.png | Bin .../src/assets/coins/qtum@2x.png | Bin ui/{ => frontend}/src/assets/coins/rvn@2x.png | Bin .../src/assets/coins/sand@2x.png | Bin ui/{ => frontend}/src/assets/coins/sc@2x.png | Bin ui/{ => frontend}/src/assets/coins/snt@2x.png | Bin ui/{ => frontend}/src/assets/coins/snx@2x.png | Bin ui/{ => frontend}/src/assets/coins/sol@2x.png | Bin .../src/assets/coins/steem@2x.png | Bin .../src/assets/coins/storj@2x.png | Bin ui/{ => frontend}/src/assets/coins/stx@2x.png | Bin .../src/assets/coins/sushi@2x.png | Bin .../src/assets/coins/theta@2x.png | Bin .../src/assets/coins/tomo@2x.png | Bin ui/{ => frontend}/src/assets/coins/trx@2x.png | Bin .../src/assets/coins/tusd@2x.png | Bin ui/{ => frontend}/src/assets/coins/uni@2x.png | Bin .../src/assets/coins/unknown.svg | 0 ui/{ => frontend}/src/assets/coins/usd@2x.png | Bin .../src/assets/coins/usdc@2x.png | Bin .../src/assets/coins/usdt@2x.png | Bin ui/{ => frontend}/src/assets/coins/vet@2x.png | Bin .../src/assets/coins/waves@2x.png | Bin ui/{ => frontend}/src/assets/coins/wax@2x.png | Bin .../src/assets/coins/wbtc@2x.png | Bin ui/{ => frontend}/src/assets/coins/xem@2x.png | Bin ui/{ => frontend}/src/assets/coins/xlm@2x.png | Bin ui/{ => frontend}/src/assets/coins/xmr.png | Bin ui/{ => frontend}/src/assets/coins/xmr@2x.png | Bin ui/{ => frontend}/src/assets/coins/xrp@2x.png | Bin ui/{ => frontend}/src/assets/coins/xtz@2x.png | Bin ui/{ => frontend}/src/assets/coins/yfi@2x.png | Bin ui/{ => frontend}/src/assets/coins/zec@2x.png | Bin ui/{ => frontend}/src/assets/coins/zil@2x.png | Bin ui/frontend/src/assets/icons/bookmark.svg | 4 + ui/frontend/src/assets/icons/check-circle.svg | 5 + ui/frontend/src/assets/icons/circle.svg | 5 + ui/frontend/src/assets/icons/close-circle.svg | 5 + ui/frontend/src/assets/icons/network.svg | 9 + ui/frontend/src/assets/icons/transfer.svg | 5 + ui/frontend/src/assets/icons/wallet.svg | 5 + .../src/assets/iosevka-regular.ttf | Bin ui/{ => frontend}/src/assets/logo.svg | 0 ui/{ => frontend}/src/assets/svelte.svg | 0 ui/{ => frontend}/src/lib/Identicon.svelte | 0 ui/{ => frontend}/src/lib/Loader.svelte | 0 ui/{ => frontend}/src/lib/Navbar.svelte | 2 +- ui/{ => frontend}/src/lib/OffersTable.svelte | 8 +- ui/frontend/src/lib/Sidebar.svelte | 71 ++++++ ui/frontend/src/lib/StatusBar.svelte | 40 +++ .../src/lib/TakeDealDialog.svelte | 11 +- ui/{ => frontend}/src/lib/TokenIcon.svelte | 13 +- ui/frontend/src/lib/wailsjs/go/main/App.d.ts | 4 + ui/frontend/src/lib/wailsjs/go/main/App.js | 7 + .../src/lib/wailsjs/runtime/package.json | 24 ++ .../src/lib/wailsjs/runtime/runtime.d.ts | 235 ++++++++++++++++++ .../src/lib/wailsjs/runtime/runtime.js | 202 +++++++++++++++ ui/{ => frontend}/src/main.js | 0 ui/frontend/src/routes/+layout.svelte | 16 ++ ui/{ => frontend}/src/routes/+page.svelte | 27 +- .../src/routes/offers/[token]/+page.svelte | 4 +- .../src/routes/offers/[token]/+page.ts | 0 ui/frontend/src/routes/peers/+page.svelte | 47 ++++ ui/{ => frontend}/src/stores/metamask.ts | 0 ui/{ => frontend}/src/stores/offerStore.ts | 0 ui/{ => frontend}/src/stores/pairStore.ts | 3 +- ui/frontend/src/stores/peerStore.ts | 20 ++ ui/{ => frontend}/src/types/Cancel.ts | 0 .../src/types/NetAddressResult.ts | 0 .../src/types/NetDiscoverResults.ts | 0 ui/{ => frontend}/src/types/NetPairResults.ts | 2 +- .../src/types/NetQueryPeerResults.ts | 0 .../src/types/NetTakeOfferSync.ts | 0 .../src/types/PersonalTokenInfoResult.ts | 2 +- ui/{ => frontend}/src/types/index.ts | 2 +- .../src/utils/getCorrespondingToken.ts | 0 ui/{ => frontend}/src/utils/getTokenInfo.ts | 2 +- ui/{ => frontend}/src/utils/index.ts | 0 ui/{ => frontend}/src/utils/intToHexString.ts | 0 ui/{ => frontend}/src/utils/rpcApi.ts | 0 ui/{ => frontend}/src/vite-env.d.ts | 0 ui/frontend/svelte.config.js | 13 + ui/{ => frontend}/tailwind.config.cjs | 0 ui/{ => frontend}/tsconfig.json | 13 +- ui/{ => frontend}/vite.config.ts | 2 +- ui/frontend/wailsjs/go/main/App.d.ts | 4 + ui/frontend/wailsjs/go/main/App.js | 7 + ui/frontend/wailsjs/runtime/package.json | 24 ++ ui/frontend/wailsjs/runtime/runtime.d.ts | 235 ++++++++++++++++++ ui/frontend/wailsjs/runtime/runtime.js | 202 +++++++++++++++ ui/{ => frontend}/yarn.lock | 10 + ui/go.mod | 33 +++ ui/go.sum | 77 ++++++ ui/main.go | 69 +++++ ui/src/routes/+layout.svelte | 12 - ui/src/stores/peerStore.ts | 18 -- ui/src/theme/_smui-theme.scss | 38 --- ui/src/theme/dark/_smui-theme.scss | 25 -- ui/svelte.config.js | 18 -- ui/wails.json | 13 + 163 files changed, 1634 insertions(+), 261 deletions(-) create mode 100644 ui/app.go create mode 100644 ui/frontend/.gitignore rename ui/{ => frontend}/index.html (100%) rename ui/{ => frontend}/package.json (92%) create mode 100755 ui/frontend/package.json.md5 rename ui/{ => frontend}/playwright.config.ts (100%) rename ui/{ => frontend}/postcss.config.cjs (100%) rename ui/{ => frontend}/public/favicon.png (100%) rename ui/{ => frontend}/public/global.css (100%) rename ui/{ => frontend}/public/iosevka-regular.ttf (100%) rename ui/{ => frontend}/public/vite.svg (100%) rename ui/{ => frontend}/src/App.svelte (100%) rename ui/{ => frontend}/src/app.d.ts (100%) rename ui/{ => frontend}/src/app.html (100%) rename ui/{ => frontend}/src/app.postcss (100%) rename ui/{ => frontend}/src/assets/coins/1inch@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/aave@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/ada@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/algo@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/amp@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/ampl@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/ankr@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/ant@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/ape@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/atom@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/avax@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/bat@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/bch@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/bnb@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/bsv@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/btc@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/btg@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/btt@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/chz@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/comp@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/crv@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/dai@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/dash@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/dcr@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/dgb@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/doge@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/dot@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/enj@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/eos@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/etc@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/eth.png (100%) rename ui/{ => frontend}/src/assets/coins/eth@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/eur@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/fil@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/flux@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/gold@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/grt@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/mkr@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/neo@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/nexo@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/ont@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/ox@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/pax@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/paxg@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/qnt@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/qtum@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/rvn@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/sand@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/sc@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/snt@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/snx@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/sol@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/steem@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/storj@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/stx@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/sushi@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/theta@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/tomo@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/trx@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/tusd@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/uni@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/unknown.svg (100%) rename ui/{ => frontend}/src/assets/coins/usd@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/usdc@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/usdt@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/vet@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/waves@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/wax@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/wbtc@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/xem@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/xlm@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/xmr.png (100%) rename ui/{ => frontend}/src/assets/coins/xmr@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/xrp@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/xtz@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/yfi@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/zec@2x.png (100%) rename ui/{ => frontend}/src/assets/coins/zil@2x.png (100%) create mode 100644 ui/frontend/src/assets/icons/bookmark.svg create mode 100644 ui/frontend/src/assets/icons/check-circle.svg create mode 100644 ui/frontend/src/assets/icons/circle.svg create mode 100644 ui/frontend/src/assets/icons/close-circle.svg create mode 100644 ui/frontend/src/assets/icons/network.svg create mode 100644 ui/frontend/src/assets/icons/transfer.svg create mode 100644 ui/frontend/src/assets/icons/wallet.svg rename ui/{ => frontend}/src/assets/iosevka-regular.ttf (100%) rename ui/{ => frontend}/src/assets/logo.svg (100%) rename ui/{ => frontend}/src/assets/svelte.svg (100%) rename ui/{ => frontend}/src/lib/Identicon.svelte (100%) rename ui/{ => frontend}/src/lib/Loader.svelte (100%) rename ui/{ => frontend}/src/lib/Navbar.svelte (98%) rename ui/{ => frontend}/src/lib/OffersTable.svelte (95%) create mode 100644 ui/frontend/src/lib/Sidebar.svelte create mode 100644 ui/frontend/src/lib/StatusBar.svelte rename ui/{ => frontend}/src/lib/TakeDealDialog.svelte (95%) rename ui/{ => frontend}/src/lib/TokenIcon.svelte (50%) create mode 100755 ui/frontend/src/lib/wailsjs/go/main/App.d.ts create mode 100755 ui/frontend/src/lib/wailsjs/go/main/App.js create mode 100644 ui/frontend/src/lib/wailsjs/runtime/package.json create mode 100644 ui/frontend/src/lib/wailsjs/runtime/runtime.d.ts create mode 100644 ui/frontend/src/lib/wailsjs/runtime/runtime.js rename ui/{ => frontend}/src/main.js (100%) create mode 100644 ui/frontend/src/routes/+layout.svelte rename ui/{ => frontend}/src/routes/+page.svelte (87%) rename ui/{ => frontend}/src/routes/offers/[token]/+page.svelte (92%) rename ui/{ => frontend}/src/routes/offers/[token]/+page.ts (100%) create mode 100644 ui/frontend/src/routes/peers/+page.svelte rename ui/{ => frontend}/src/stores/metamask.ts (100%) rename ui/{ => frontend}/src/stores/offerStore.ts (100%) rename ui/{ => frontend}/src/stores/pairStore.ts (94%) create mode 100644 ui/frontend/src/stores/peerStore.ts rename ui/{ => frontend}/src/types/Cancel.ts (100%) rename ui/{ => frontend}/src/types/NetAddressResult.ts (100%) rename ui/{ => frontend}/src/types/NetDiscoverResults.ts (100%) rename ui/{ => frontend}/src/types/NetPairResults.ts (99%) rename ui/{ => frontend}/src/types/NetQueryPeerResults.ts (100%) rename ui/{ => frontend}/src/types/NetTakeOfferSync.ts (100%) rename ui/{ => frontend}/src/types/PersonalTokenInfoResult.ts (98%) rename ui/{ => frontend}/src/types/index.ts (99%) rename ui/{ => frontend}/src/utils/getCorrespondingToken.ts (100%) rename ui/{ => frontend}/src/utils/getTokenInfo.ts (99%) rename ui/{ => frontend}/src/utils/index.ts (100%) rename ui/{ => frontend}/src/utils/intToHexString.ts (100%) rename ui/{ => frontend}/src/utils/rpcApi.ts (100%) rename ui/{ => frontend}/src/vite-env.d.ts (100%) create mode 100644 ui/frontend/svelte.config.js rename ui/{ => frontend}/tailwind.config.cjs (100%) rename ui/{ => frontend}/tsconfig.json (53%) rename ui/{ => frontend}/vite.config.ts (78%) create mode 100755 ui/frontend/wailsjs/go/main/App.d.ts create mode 100755 ui/frontend/wailsjs/go/main/App.js create mode 100644 ui/frontend/wailsjs/runtime/package.json create mode 100644 ui/frontend/wailsjs/runtime/runtime.d.ts create mode 100644 ui/frontend/wailsjs/runtime/runtime.js rename ui/{ => frontend}/yarn.lock (99%) create mode 100644 ui/go.mod create mode 100644 ui/go.sum create mode 100644 ui/main.go delete mode 100644 ui/src/routes/+layout.svelte delete mode 100644 ui/src/stores/peerStore.ts delete mode 100644 ui/src/theme/_smui-theme.scss delete mode 100644 ui/src/theme/dark/_smui-theme.scss delete mode 100644 ui/svelte.config.js create mode 100644 ui/wails.json diff --git a/ui/.gitignore b/ui/.gitignore index 5e5d5e0f2..4173f6939 100644 --- a/ui/.gitignore +++ b/ui/.gitignore @@ -1,33 +1,3 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? - /build /.svelte-kit -/package -.env -.env.* -!.env.example -vite.config.js.timestamp-* -vite.config.ts.timestamp-* +/node_modules \ No newline at end of file diff --git a/ui/.svelte-kit/ambient.d.ts b/ui/.svelte-kit/ambient.d.ts index 574677aae..f9558bf78 100644 --- a/ui/.svelte-kit/ambient.d.ts +++ b/ui/.svelte-kit/ambient.d.ts @@ -27,76 +27,119 @@ */ declare module '$env/static/private' { export const SHELL: string; - export const npm_command: string; export const LSCOLORS: string; export const WINDOWID: string; - export const npm_config_userconfig: string; export const COLORTERM: string; - export const npm_config_cache: string; export const LESS: string; export const NVM_INC: string; export const CONDA_EXE: string; export const _CE_M: string; + export const npm_package_dependencies_ethers: string; + export const npm_package_dependencies_flowbite: string; export const I3SOCK: string; export const NODE: string; - export const COLOR: string; - export const npm_config_local_prefix: string; + export const npm_package_devDependencies_tslib: string; + export const npm_config_ignore_scripts: string; + export const npm_package_devDependencies_autoprefixer: string; + export const npm_package_devDependencies_tailwindcss: string; + export const npm_package_scripts_check_watch: string; + export const npm_package_dependencies__popperjs_core: string; + export const npm_package_private: string; + export const npm_package_devDependencies_svelte_heros_v2: string; + export const npm_config_argv: string; + export const npm_config_bin_links: string; export const KITTY_PID: string; - export const npm_config_globalconfig: string; - export const EDITOR: string; + export const npm_package_scripts_test_unit: string; + export const npm_package_dependencies_classnames: string; export const GTK_MODULES: string; export const XDG_SEAT: string; + export const npm_package_dependencies_axios: string; export const PWD: string; + export const npm_config_save_prefix: string; + export const npm_package_devDependencies_vite: string; export const LOGNAME: string; export const XDG_SESSION_TYPE: string; - export const npm_config_init_module: string; + export const npm_package_readmeFilename: string; + export const npm_package_dependencies_svelte_awesome_icons: string; + export const npm_package_scripts_build: string; export const _: string; export const XAUTHORITY: string; export const DESKTOP_STARTUP_ID: string; + export const npm_package_devDependencies_prettier: string; export const KITTY_PUBLIC_KEY: string; export const MOTD_SHOWN: string; export const HOME: string; + export const npm_config_version_git_tag: string; export const LANG: string; + export const npm_package_devDependencies_typescript: string; export const LS_COLORS: string; + export const npm_config_init_license: string; export const npm_package_version: string; + export const npm_config_version_commit_hooks: string; export const KITTY_WINDOW_ID: string; + export const npm_package_scripts_test_integration: string; + export const npm_package_devDependencies_prettier_plugin_svelte: string; export const INIT_CWD: string; + export const npm_package_scripts_format: string; + export const npm_package_scripts_preview: string; export const npm_lifecycle_script: string; + export const npm_package_description: string; export const NVM_DIR: string; + export const npm_config_version_tag_prefix: string; + export const npm_package_devDependencies__sveltejs_vite_plugin_svelte: string; + export const YARN_WRAP_OUTPUT: string; + export const npm_package_devDependencies_svelte_check: string; export const XDG_SESSION_CLASS: string; - export const TERMINFO: string; export const TERM: string; + export const TERMINFO: string; export const npm_package_name: string; export const ZSH: string; export const _CE_CONDA: string; - export const npm_config_prefix: string; + export const npm_package_type: string; export const USER: string; + export const npm_package_devDependencies_vitest: string; + export const npm_package_dependencies_flowbite_svelte: string; export const CONDA_SHLVL: string; export const DISPLAY: string; export const npm_lifecycle_event: string; export const SHLVL: string; + export const npm_config_version_git_sign: string; export const NVM_CD_FLAGS: string; + export const npm_config_version_git_message: string; export const PAGER: string; export const XDG_VTNR: string; + export const UBUNTU_MENUPROXY: string; export const XDG_SESSION_ID: string; export const npm_config_user_agent: string; + export const npm_package_scripts_lint: string; export const npm_execpath: string; export const CONDA_PYTHON_EXE: string; + export const npm_package_devDependencies__sveltejs_adapter_auto: string; + export const npm_package_devDependencies_svelte: string; + export const npm_package_scripts_test: string; export const XDG_RUNTIME_DIR: string; + export const npm_package_devDependencies_svelte_preprocess: string; + export const npm_config_strict_ssl: string; export const DEBUGINFOD_URLS: string; - export const npm_package_json: string; - export const npm_config_noproxy: string; + export const npm_package_scripts_dev: string; + export const npm_package_scripts_check: string; export const PATH: string; - export const npm_config_metrics_registry: string; export const npm_config_node_gyp: string; + export const npm_package_devDependencies__sveltejs_kit: string; + export const npm_package_dependencies_identicon_js: string; export const DBUS_SESSION_BUS_ADDRESS: string; - export const npm_config_global_prefix: string; - export const NVM_BIN: string; + export const npm_package_devDependencies__playwright_test: string; export const MAIL: string; + export const NVM_BIN: string; + export const npm_config_registry: string; + export const npm_config_ignore_optional: string; export const npm_config_scripts_prepend_node_path: string; + export const npm_package_devDependencies_postcss: string; export const KITTY_INSTALLATION_DIR: string; export const npm_node_execpath: string; + export const npm_package_devDependencies_postcss_load_config: string; export const OLDPWD: string; + export const npm_config_init_version: string; export const NODE_ENV: string; } @@ -128,76 +171,119 @@ declare module '$env/static/public' { declare module '$env/dynamic/private' { export const env: { SHELL: string; - npm_command: string; LSCOLORS: string; WINDOWID: string; - npm_config_userconfig: string; COLORTERM: string; - npm_config_cache: string; LESS: string; NVM_INC: string; CONDA_EXE: string; _CE_M: string; + npm_package_dependencies_ethers: string; + npm_package_dependencies_flowbite: string; I3SOCK: string; NODE: string; - COLOR: string; - npm_config_local_prefix: string; + npm_package_devDependencies_tslib: string; + npm_config_ignore_scripts: string; + npm_package_devDependencies_autoprefixer: string; + npm_package_devDependencies_tailwindcss: string; + npm_package_scripts_check_watch: string; + npm_package_dependencies__popperjs_core: string; + npm_package_private: string; + npm_package_devDependencies_svelte_heros_v2: string; + npm_config_argv: string; + npm_config_bin_links: string; KITTY_PID: string; - npm_config_globalconfig: string; - EDITOR: string; + npm_package_scripts_test_unit: string; + npm_package_dependencies_classnames: string; GTK_MODULES: string; XDG_SEAT: string; + npm_package_dependencies_axios: string; PWD: string; + npm_config_save_prefix: string; + npm_package_devDependencies_vite: string; LOGNAME: string; XDG_SESSION_TYPE: string; - npm_config_init_module: string; + npm_package_readmeFilename: string; + npm_package_dependencies_svelte_awesome_icons: string; + npm_package_scripts_build: string; _: string; XAUTHORITY: string; DESKTOP_STARTUP_ID: string; + npm_package_devDependencies_prettier: string; KITTY_PUBLIC_KEY: string; MOTD_SHOWN: string; HOME: string; + npm_config_version_git_tag: string; LANG: string; + npm_package_devDependencies_typescript: string; LS_COLORS: string; + npm_config_init_license: string; npm_package_version: string; + npm_config_version_commit_hooks: string; KITTY_WINDOW_ID: string; + npm_package_scripts_test_integration: string; + npm_package_devDependencies_prettier_plugin_svelte: string; INIT_CWD: string; + npm_package_scripts_format: string; + npm_package_scripts_preview: string; npm_lifecycle_script: string; + npm_package_description: string; NVM_DIR: string; + npm_config_version_tag_prefix: string; + npm_package_devDependencies__sveltejs_vite_plugin_svelte: string; + YARN_WRAP_OUTPUT: string; + npm_package_devDependencies_svelte_check: string; XDG_SESSION_CLASS: string; - TERMINFO: string; TERM: string; + TERMINFO: string; npm_package_name: string; ZSH: string; _CE_CONDA: string; - npm_config_prefix: string; + npm_package_type: string; USER: string; + npm_package_devDependencies_vitest: string; + npm_package_dependencies_flowbite_svelte: string; CONDA_SHLVL: string; DISPLAY: string; npm_lifecycle_event: string; SHLVL: string; + npm_config_version_git_sign: string; NVM_CD_FLAGS: string; + npm_config_version_git_message: string; PAGER: string; XDG_VTNR: string; + UBUNTU_MENUPROXY: string; XDG_SESSION_ID: string; npm_config_user_agent: string; + npm_package_scripts_lint: string; npm_execpath: string; CONDA_PYTHON_EXE: string; + npm_package_devDependencies__sveltejs_adapter_auto: string; + npm_package_devDependencies_svelte: string; + npm_package_scripts_test: string; XDG_RUNTIME_DIR: string; + npm_package_devDependencies_svelte_preprocess: string; + npm_config_strict_ssl: string; DEBUGINFOD_URLS: string; - npm_package_json: string; - npm_config_noproxy: string; + npm_package_scripts_dev: string; + npm_package_scripts_check: string; PATH: string; - npm_config_metrics_registry: string; npm_config_node_gyp: string; + npm_package_devDependencies__sveltejs_kit: string; + npm_package_dependencies_identicon_js: string; DBUS_SESSION_BUS_ADDRESS: string; - npm_config_global_prefix: string; - NVM_BIN: string; + npm_package_devDependencies__playwright_test: string; MAIL: string; + NVM_BIN: string; + npm_config_registry: string; + npm_config_ignore_optional: string; npm_config_scripts_prepend_node_path: string; + npm_package_devDependencies_postcss: string; KITTY_INSTALLATION_DIR: string; npm_node_execpath: string; + npm_package_devDependencies_postcss_load_config: string; OLDPWD: string; + npm_config_init_version: string; NODE_ENV: string; [key: `PUBLIC_${string}`]: undefined; [key: `${string}`]: string | undefined; diff --git a/ui/.svelte-kit/generated/server/internal.js b/ui/.svelte-kit/generated/server/internal.js index 8487449e8..280bb5f3c 100644 --- a/ui/.svelte-kit/generated/server/internal.js +++ b/ui/.svelte-kit/generated/server/internal.js @@ -20,7 +20,7 @@ export const options = { app: ({ head, body, assets, nonce, env }) => "\n\n\t\n\t\t\n\t\t\n\t\t\n\t\t" + head + "\n\t\n\t\n\t\t
" + body + "
\n\t\n\n", error: ({ status, message }) => "\n\n\t\n\t\t\n\t\t" + message + "\n\n\t\t\n\t\n\t\n\t\t
\n\t\t\t" + status + "\n\t\t\t
\n\t\t\t\t

" + message + "

\n\t\t\t
\n\t\t
\n\t\n\n" }, - version_hash: "cgqvn8" + version_hash: "1vj7znf" }; export function get_hooks() { diff --git a/ui/README.md b/ui/README.md index 0afdffe88..55ae9bf57 100644 --- a/ui/README.md +++ b/ui/README.md @@ -1,53 +1,14 @@ -# Svelte + Vite +# ETH-XMR atomic swap UI -This template should help get you started developing with Svelte in Vite. +UI for ETH-XMR atomic swap -## Dev - -```yarn``` -```yarn dev``` +## Live Development +To run in live development mode, run `wails dev` in the project directory. This will run a Vite development +server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser +and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect +to this in your browser, and you can call your Go code from devtools. -## Recommended IDE Setup +## Building -[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). - -## Need an official Svelte framework? - -Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more. - -## Technical considerations - -**Why use this over SvelteKit?** - -- It brings its own routing solution which might not be preferable for some users. -- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app. - -This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project. - -Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate. - -**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?** - -Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information. - -**Why include `.vscode/extensions.json`?** - -Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project. - -**Why enable `checkJs` in the JS template?** - -It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate. This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of JavaScript, it is trivial to change the configuration. - -**Why is HMR not preserving my local component state?** - -HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/sveltejs/svelte-hmr/tree/master/packages/svelte-hmr#preservation-of-local-state). - -If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR. - -```js -// store.js -// An extremely simple external store -import { writable } from 'svelte/store' -export default writable(0) -``` +To build a redistributable, production mode package, use `wails build`. diff --git a/ui/app.go b/ui/app.go new file mode 100644 index 000000000..af53038a1 --- /dev/null +++ b/ui/app.go @@ -0,0 +1,27 @@ +package main + +import ( + "context" + "fmt" +) + +// App struct +type App struct { + ctx context.Context +} + +// NewApp creates a new App application struct +func NewApp() *App { + return &App{} +} + +// startup is called when the app starts. The context is saved +// so we can call the runtime methods +func (a *App) startup(ctx context.Context) { + a.ctx = ctx +} + +// Greet returns a greeting for the given name +func (a *App) Greet(name string) string { + return fmt.Sprintf("Hello %s, It's show time!", name) +} diff --git a/ui/frontend/.gitignore b/ui/frontend/.gitignore new file mode 100644 index 000000000..5e5d5e0f2 --- /dev/null +++ b/ui/frontend/.gitignore @@ -0,0 +1,33 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +/build +/.svelte-kit +/package +.env +.env.* +!.env.example +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/ui/index.html b/ui/frontend/index.html similarity index 100% rename from ui/index.html rename to ui/frontend/index.html diff --git a/ui/package.json b/ui/frontend/package.json similarity index 92% rename from ui/package.json rename to ui/frontend/package.json index dead283f1..688c3d402 100644 --- a/ui/package.json +++ b/ui/frontend/package.json @@ -43,6 +43,8 @@ "flowbite": "^1.6.5", "flowbite-svelte": "^0.34.12", "identicon.js": "^2.3.3", - "svelte-awesome-icons": "^0.4.4" + "@sveltejs/adapter-static": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.14", + "dotenv": "^16.0.3" } } diff --git a/ui/frontend/package.json.md5 b/ui/frontend/package.json.md5 new file mode 100755 index 000000000..66370b90f --- /dev/null +++ b/ui/frontend/package.json.md5 @@ -0,0 +1 @@ +2fab2e75a14f189e06737abd1445f599 \ No newline at end of file diff --git a/ui/playwright.config.ts b/ui/frontend/playwright.config.ts similarity index 100% rename from ui/playwright.config.ts rename to ui/frontend/playwright.config.ts diff --git a/ui/postcss.config.cjs b/ui/frontend/postcss.config.cjs similarity index 100% rename from ui/postcss.config.cjs rename to ui/frontend/postcss.config.cjs diff --git a/ui/public/favicon.png b/ui/frontend/public/favicon.png similarity index 100% rename from ui/public/favicon.png rename to ui/frontend/public/favicon.png diff --git a/ui/public/global.css b/ui/frontend/public/global.css similarity index 100% rename from ui/public/global.css rename to ui/frontend/public/global.css diff --git a/ui/public/iosevka-regular.ttf b/ui/frontend/public/iosevka-regular.ttf similarity index 100% rename from ui/public/iosevka-regular.ttf rename to ui/frontend/public/iosevka-regular.ttf diff --git a/ui/public/vite.svg b/ui/frontend/public/vite.svg similarity index 100% rename from ui/public/vite.svg rename to ui/frontend/public/vite.svg diff --git a/ui/src/App.svelte b/ui/frontend/src/App.svelte similarity index 100% rename from ui/src/App.svelte rename to ui/frontend/src/App.svelte diff --git a/ui/src/app.d.ts b/ui/frontend/src/app.d.ts similarity index 100% rename from ui/src/app.d.ts rename to ui/frontend/src/app.d.ts diff --git a/ui/src/app.html b/ui/frontend/src/app.html similarity index 100% rename from ui/src/app.html rename to ui/frontend/src/app.html diff --git a/ui/src/app.postcss b/ui/frontend/src/app.postcss similarity index 100% rename from ui/src/app.postcss rename to ui/frontend/src/app.postcss diff --git a/ui/src/assets/coins/1inch@2x.png b/ui/frontend/src/assets/coins/1inch@2x.png similarity index 100% rename from ui/src/assets/coins/1inch@2x.png rename to ui/frontend/src/assets/coins/1inch@2x.png diff --git a/ui/src/assets/coins/aave@2x.png b/ui/frontend/src/assets/coins/aave@2x.png similarity index 100% rename from ui/src/assets/coins/aave@2x.png rename to ui/frontend/src/assets/coins/aave@2x.png diff --git a/ui/src/assets/coins/ada@2x.png b/ui/frontend/src/assets/coins/ada@2x.png similarity index 100% rename from ui/src/assets/coins/ada@2x.png rename to ui/frontend/src/assets/coins/ada@2x.png diff --git a/ui/src/assets/coins/algo@2x.png b/ui/frontend/src/assets/coins/algo@2x.png similarity index 100% rename from ui/src/assets/coins/algo@2x.png rename to ui/frontend/src/assets/coins/algo@2x.png diff --git a/ui/src/assets/coins/amp@2x.png b/ui/frontend/src/assets/coins/amp@2x.png similarity index 100% rename from ui/src/assets/coins/amp@2x.png rename to ui/frontend/src/assets/coins/amp@2x.png diff --git a/ui/src/assets/coins/ampl@2x.png b/ui/frontend/src/assets/coins/ampl@2x.png similarity index 100% rename from ui/src/assets/coins/ampl@2x.png rename to ui/frontend/src/assets/coins/ampl@2x.png diff --git a/ui/src/assets/coins/ankr@2x.png b/ui/frontend/src/assets/coins/ankr@2x.png similarity index 100% rename from ui/src/assets/coins/ankr@2x.png rename to ui/frontend/src/assets/coins/ankr@2x.png diff --git a/ui/src/assets/coins/ant@2x.png b/ui/frontend/src/assets/coins/ant@2x.png similarity index 100% rename from ui/src/assets/coins/ant@2x.png rename to ui/frontend/src/assets/coins/ant@2x.png diff --git a/ui/src/assets/coins/ape@2x.png b/ui/frontend/src/assets/coins/ape@2x.png similarity index 100% rename from ui/src/assets/coins/ape@2x.png rename to ui/frontend/src/assets/coins/ape@2x.png diff --git a/ui/src/assets/coins/atom@2x.png b/ui/frontend/src/assets/coins/atom@2x.png similarity index 100% rename from ui/src/assets/coins/atom@2x.png rename to ui/frontend/src/assets/coins/atom@2x.png diff --git a/ui/src/assets/coins/avax@2x.png b/ui/frontend/src/assets/coins/avax@2x.png similarity index 100% rename from ui/src/assets/coins/avax@2x.png rename to ui/frontend/src/assets/coins/avax@2x.png diff --git a/ui/src/assets/coins/bat@2x.png b/ui/frontend/src/assets/coins/bat@2x.png similarity index 100% rename from ui/src/assets/coins/bat@2x.png rename to ui/frontend/src/assets/coins/bat@2x.png diff --git a/ui/src/assets/coins/bch@2x.png b/ui/frontend/src/assets/coins/bch@2x.png similarity index 100% rename from ui/src/assets/coins/bch@2x.png rename to ui/frontend/src/assets/coins/bch@2x.png diff --git a/ui/src/assets/coins/bnb@2x.png b/ui/frontend/src/assets/coins/bnb@2x.png similarity index 100% rename from ui/src/assets/coins/bnb@2x.png rename to ui/frontend/src/assets/coins/bnb@2x.png diff --git a/ui/src/assets/coins/bsv@2x.png b/ui/frontend/src/assets/coins/bsv@2x.png similarity index 100% rename from ui/src/assets/coins/bsv@2x.png rename to ui/frontend/src/assets/coins/bsv@2x.png diff --git a/ui/src/assets/coins/btc@2x.png b/ui/frontend/src/assets/coins/btc@2x.png similarity index 100% rename from ui/src/assets/coins/btc@2x.png rename to ui/frontend/src/assets/coins/btc@2x.png diff --git a/ui/src/assets/coins/btg@2x.png b/ui/frontend/src/assets/coins/btg@2x.png similarity index 100% rename from ui/src/assets/coins/btg@2x.png rename to ui/frontend/src/assets/coins/btg@2x.png diff --git a/ui/src/assets/coins/btt@2x.png b/ui/frontend/src/assets/coins/btt@2x.png similarity index 100% rename from ui/src/assets/coins/btt@2x.png rename to ui/frontend/src/assets/coins/btt@2x.png diff --git a/ui/src/assets/coins/chz@2x.png b/ui/frontend/src/assets/coins/chz@2x.png similarity index 100% rename from ui/src/assets/coins/chz@2x.png rename to ui/frontend/src/assets/coins/chz@2x.png diff --git a/ui/src/assets/coins/comp@2x.png b/ui/frontend/src/assets/coins/comp@2x.png similarity index 100% rename from ui/src/assets/coins/comp@2x.png rename to ui/frontend/src/assets/coins/comp@2x.png diff --git a/ui/src/assets/coins/crv@2x.png b/ui/frontend/src/assets/coins/crv@2x.png similarity index 100% rename from ui/src/assets/coins/crv@2x.png rename to ui/frontend/src/assets/coins/crv@2x.png diff --git a/ui/src/assets/coins/dai@2x.png b/ui/frontend/src/assets/coins/dai@2x.png similarity index 100% rename from ui/src/assets/coins/dai@2x.png rename to ui/frontend/src/assets/coins/dai@2x.png diff --git a/ui/src/assets/coins/dash@2x.png b/ui/frontend/src/assets/coins/dash@2x.png similarity index 100% rename from ui/src/assets/coins/dash@2x.png rename to ui/frontend/src/assets/coins/dash@2x.png diff --git a/ui/src/assets/coins/dcr@2x.png b/ui/frontend/src/assets/coins/dcr@2x.png similarity index 100% rename from ui/src/assets/coins/dcr@2x.png rename to ui/frontend/src/assets/coins/dcr@2x.png diff --git a/ui/src/assets/coins/dgb@2x.png b/ui/frontend/src/assets/coins/dgb@2x.png similarity index 100% rename from ui/src/assets/coins/dgb@2x.png rename to ui/frontend/src/assets/coins/dgb@2x.png diff --git a/ui/src/assets/coins/doge@2x.png b/ui/frontend/src/assets/coins/doge@2x.png similarity index 100% rename from ui/src/assets/coins/doge@2x.png rename to ui/frontend/src/assets/coins/doge@2x.png diff --git a/ui/src/assets/coins/dot@2x.png b/ui/frontend/src/assets/coins/dot@2x.png similarity index 100% rename from ui/src/assets/coins/dot@2x.png rename to ui/frontend/src/assets/coins/dot@2x.png diff --git a/ui/src/assets/coins/enj@2x.png b/ui/frontend/src/assets/coins/enj@2x.png similarity index 100% rename from ui/src/assets/coins/enj@2x.png rename to ui/frontend/src/assets/coins/enj@2x.png diff --git a/ui/src/assets/coins/eos@2x.png b/ui/frontend/src/assets/coins/eos@2x.png similarity index 100% rename from ui/src/assets/coins/eos@2x.png rename to ui/frontend/src/assets/coins/eos@2x.png diff --git a/ui/src/assets/coins/etc@2x.png b/ui/frontend/src/assets/coins/etc@2x.png similarity index 100% rename from ui/src/assets/coins/etc@2x.png rename to ui/frontend/src/assets/coins/etc@2x.png diff --git a/ui/src/assets/coins/eth.png b/ui/frontend/src/assets/coins/eth.png similarity index 100% rename from ui/src/assets/coins/eth.png rename to ui/frontend/src/assets/coins/eth.png diff --git a/ui/src/assets/coins/eth@2x.png b/ui/frontend/src/assets/coins/eth@2x.png similarity index 100% rename from ui/src/assets/coins/eth@2x.png rename to ui/frontend/src/assets/coins/eth@2x.png diff --git a/ui/src/assets/coins/eur@2x.png b/ui/frontend/src/assets/coins/eur@2x.png similarity index 100% rename from ui/src/assets/coins/eur@2x.png rename to ui/frontend/src/assets/coins/eur@2x.png diff --git a/ui/src/assets/coins/fil@2x.png b/ui/frontend/src/assets/coins/fil@2x.png similarity index 100% rename from ui/src/assets/coins/fil@2x.png rename to ui/frontend/src/assets/coins/fil@2x.png diff --git a/ui/src/assets/coins/flux@2x.png b/ui/frontend/src/assets/coins/flux@2x.png similarity index 100% rename from ui/src/assets/coins/flux@2x.png rename to ui/frontend/src/assets/coins/flux@2x.png diff --git a/ui/src/assets/coins/gold@2x.png b/ui/frontend/src/assets/coins/gold@2x.png similarity index 100% rename from ui/src/assets/coins/gold@2x.png rename to ui/frontend/src/assets/coins/gold@2x.png diff --git a/ui/src/assets/coins/grt@2x.png b/ui/frontend/src/assets/coins/grt@2x.png similarity index 100% rename from ui/src/assets/coins/grt@2x.png rename to ui/frontend/src/assets/coins/grt@2x.png diff --git a/ui/src/assets/coins/mkr@2x.png b/ui/frontend/src/assets/coins/mkr@2x.png similarity index 100% rename from ui/src/assets/coins/mkr@2x.png rename to ui/frontend/src/assets/coins/mkr@2x.png diff --git a/ui/src/assets/coins/neo@2x.png b/ui/frontend/src/assets/coins/neo@2x.png similarity index 100% rename from ui/src/assets/coins/neo@2x.png rename to ui/frontend/src/assets/coins/neo@2x.png diff --git a/ui/src/assets/coins/nexo@2x.png b/ui/frontend/src/assets/coins/nexo@2x.png similarity index 100% rename from ui/src/assets/coins/nexo@2x.png rename to ui/frontend/src/assets/coins/nexo@2x.png diff --git a/ui/src/assets/coins/ont@2x.png b/ui/frontend/src/assets/coins/ont@2x.png similarity index 100% rename from ui/src/assets/coins/ont@2x.png rename to ui/frontend/src/assets/coins/ont@2x.png diff --git a/ui/src/assets/coins/ox@2x.png b/ui/frontend/src/assets/coins/ox@2x.png similarity index 100% rename from ui/src/assets/coins/ox@2x.png rename to ui/frontend/src/assets/coins/ox@2x.png diff --git a/ui/src/assets/coins/pax@2x.png b/ui/frontend/src/assets/coins/pax@2x.png similarity index 100% rename from ui/src/assets/coins/pax@2x.png rename to ui/frontend/src/assets/coins/pax@2x.png diff --git a/ui/src/assets/coins/paxg@2x.png b/ui/frontend/src/assets/coins/paxg@2x.png similarity index 100% rename from ui/src/assets/coins/paxg@2x.png rename to ui/frontend/src/assets/coins/paxg@2x.png diff --git a/ui/src/assets/coins/qnt@2x.png b/ui/frontend/src/assets/coins/qnt@2x.png similarity index 100% rename from ui/src/assets/coins/qnt@2x.png rename to ui/frontend/src/assets/coins/qnt@2x.png diff --git a/ui/src/assets/coins/qtum@2x.png b/ui/frontend/src/assets/coins/qtum@2x.png similarity index 100% rename from ui/src/assets/coins/qtum@2x.png rename to ui/frontend/src/assets/coins/qtum@2x.png diff --git a/ui/src/assets/coins/rvn@2x.png b/ui/frontend/src/assets/coins/rvn@2x.png similarity index 100% rename from ui/src/assets/coins/rvn@2x.png rename to ui/frontend/src/assets/coins/rvn@2x.png diff --git a/ui/src/assets/coins/sand@2x.png b/ui/frontend/src/assets/coins/sand@2x.png similarity index 100% rename from ui/src/assets/coins/sand@2x.png rename to ui/frontend/src/assets/coins/sand@2x.png diff --git a/ui/src/assets/coins/sc@2x.png b/ui/frontend/src/assets/coins/sc@2x.png similarity index 100% rename from ui/src/assets/coins/sc@2x.png rename to ui/frontend/src/assets/coins/sc@2x.png diff --git a/ui/src/assets/coins/snt@2x.png b/ui/frontend/src/assets/coins/snt@2x.png similarity index 100% rename from ui/src/assets/coins/snt@2x.png rename to ui/frontend/src/assets/coins/snt@2x.png diff --git a/ui/src/assets/coins/snx@2x.png b/ui/frontend/src/assets/coins/snx@2x.png similarity index 100% rename from ui/src/assets/coins/snx@2x.png rename to ui/frontend/src/assets/coins/snx@2x.png diff --git a/ui/src/assets/coins/sol@2x.png b/ui/frontend/src/assets/coins/sol@2x.png similarity index 100% rename from ui/src/assets/coins/sol@2x.png rename to ui/frontend/src/assets/coins/sol@2x.png diff --git a/ui/src/assets/coins/steem@2x.png b/ui/frontend/src/assets/coins/steem@2x.png similarity index 100% rename from ui/src/assets/coins/steem@2x.png rename to ui/frontend/src/assets/coins/steem@2x.png diff --git a/ui/src/assets/coins/storj@2x.png b/ui/frontend/src/assets/coins/storj@2x.png similarity index 100% rename from ui/src/assets/coins/storj@2x.png rename to ui/frontend/src/assets/coins/storj@2x.png diff --git a/ui/src/assets/coins/stx@2x.png b/ui/frontend/src/assets/coins/stx@2x.png similarity index 100% rename from ui/src/assets/coins/stx@2x.png rename to ui/frontend/src/assets/coins/stx@2x.png diff --git a/ui/src/assets/coins/sushi@2x.png b/ui/frontend/src/assets/coins/sushi@2x.png similarity index 100% rename from ui/src/assets/coins/sushi@2x.png rename to ui/frontend/src/assets/coins/sushi@2x.png diff --git a/ui/src/assets/coins/theta@2x.png b/ui/frontend/src/assets/coins/theta@2x.png similarity index 100% rename from ui/src/assets/coins/theta@2x.png rename to ui/frontend/src/assets/coins/theta@2x.png diff --git a/ui/src/assets/coins/tomo@2x.png b/ui/frontend/src/assets/coins/tomo@2x.png similarity index 100% rename from ui/src/assets/coins/tomo@2x.png rename to ui/frontend/src/assets/coins/tomo@2x.png diff --git a/ui/src/assets/coins/trx@2x.png b/ui/frontend/src/assets/coins/trx@2x.png similarity index 100% rename from ui/src/assets/coins/trx@2x.png rename to ui/frontend/src/assets/coins/trx@2x.png diff --git a/ui/src/assets/coins/tusd@2x.png b/ui/frontend/src/assets/coins/tusd@2x.png similarity index 100% rename from ui/src/assets/coins/tusd@2x.png rename to ui/frontend/src/assets/coins/tusd@2x.png diff --git a/ui/src/assets/coins/uni@2x.png b/ui/frontend/src/assets/coins/uni@2x.png similarity index 100% rename from ui/src/assets/coins/uni@2x.png rename to ui/frontend/src/assets/coins/uni@2x.png diff --git a/ui/src/assets/coins/unknown.svg b/ui/frontend/src/assets/coins/unknown.svg similarity index 100% rename from ui/src/assets/coins/unknown.svg rename to ui/frontend/src/assets/coins/unknown.svg diff --git a/ui/src/assets/coins/usd@2x.png b/ui/frontend/src/assets/coins/usd@2x.png similarity index 100% rename from ui/src/assets/coins/usd@2x.png rename to ui/frontend/src/assets/coins/usd@2x.png diff --git a/ui/src/assets/coins/usdc@2x.png b/ui/frontend/src/assets/coins/usdc@2x.png similarity index 100% rename from ui/src/assets/coins/usdc@2x.png rename to ui/frontend/src/assets/coins/usdc@2x.png diff --git a/ui/src/assets/coins/usdt@2x.png b/ui/frontend/src/assets/coins/usdt@2x.png similarity index 100% rename from ui/src/assets/coins/usdt@2x.png rename to ui/frontend/src/assets/coins/usdt@2x.png diff --git a/ui/src/assets/coins/vet@2x.png b/ui/frontend/src/assets/coins/vet@2x.png similarity index 100% rename from ui/src/assets/coins/vet@2x.png rename to ui/frontend/src/assets/coins/vet@2x.png diff --git a/ui/src/assets/coins/waves@2x.png b/ui/frontend/src/assets/coins/waves@2x.png similarity index 100% rename from ui/src/assets/coins/waves@2x.png rename to ui/frontend/src/assets/coins/waves@2x.png diff --git a/ui/src/assets/coins/wax@2x.png b/ui/frontend/src/assets/coins/wax@2x.png similarity index 100% rename from ui/src/assets/coins/wax@2x.png rename to ui/frontend/src/assets/coins/wax@2x.png diff --git a/ui/src/assets/coins/wbtc@2x.png b/ui/frontend/src/assets/coins/wbtc@2x.png similarity index 100% rename from ui/src/assets/coins/wbtc@2x.png rename to ui/frontend/src/assets/coins/wbtc@2x.png diff --git a/ui/src/assets/coins/xem@2x.png b/ui/frontend/src/assets/coins/xem@2x.png similarity index 100% rename from ui/src/assets/coins/xem@2x.png rename to ui/frontend/src/assets/coins/xem@2x.png diff --git a/ui/src/assets/coins/xlm@2x.png b/ui/frontend/src/assets/coins/xlm@2x.png similarity index 100% rename from ui/src/assets/coins/xlm@2x.png rename to ui/frontend/src/assets/coins/xlm@2x.png diff --git a/ui/src/assets/coins/xmr.png b/ui/frontend/src/assets/coins/xmr.png similarity index 100% rename from ui/src/assets/coins/xmr.png rename to ui/frontend/src/assets/coins/xmr.png diff --git a/ui/src/assets/coins/xmr@2x.png b/ui/frontend/src/assets/coins/xmr@2x.png similarity index 100% rename from ui/src/assets/coins/xmr@2x.png rename to ui/frontend/src/assets/coins/xmr@2x.png diff --git a/ui/src/assets/coins/xrp@2x.png b/ui/frontend/src/assets/coins/xrp@2x.png similarity index 100% rename from ui/src/assets/coins/xrp@2x.png rename to ui/frontend/src/assets/coins/xrp@2x.png diff --git a/ui/src/assets/coins/xtz@2x.png b/ui/frontend/src/assets/coins/xtz@2x.png similarity index 100% rename from ui/src/assets/coins/xtz@2x.png rename to ui/frontend/src/assets/coins/xtz@2x.png diff --git a/ui/src/assets/coins/yfi@2x.png b/ui/frontend/src/assets/coins/yfi@2x.png similarity index 100% rename from ui/src/assets/coins/yfi@2x.png rename to ui/frontend/src/assets/coins/yfi@2x.png diff --git a/ui/src/assets/coins/zec@2x.png b/ui/frontend/src/assets/coins/zec@2x.png similarity index 100% rename from ui/src/assets/coins/zec@2x.png rename to ui/frontend/src/assets/coins/zec@2x.png diff --git a/ui/src/assets/coins/zil@2x.png b/ui/frontend/src/assets/coins/zil@2x.png similarity index 100% rename from ui/src/assets/coins/zil@2x.png rename to ui/frontend/src/assets/coins/zil@2x.png diff --git a/ui/frontend/src/assets/icons/bookmark.svg b/ui/frontend/src/assets/icons/bookmark.svg new file mode 100644 index 000000000..79aa235a0 --- /dev/null +++ b/ui/frontend/src/assets/icons/bookmark.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ui/frontend/src/assets/icons/check-circle.svg b/ui/frontend/src/assets/icons/check-circle.svg new file mode 100644 index 000000000..8540f7ae8 --- /dev/null +++ b/ui/frontend/src/assets/icons/check-circle.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ui/frontend/src/assets/icons/circle.svg b/ui/frontend/src/assets/icons/circle.svg new file mode 100644 index 000000000..fbb62cc13 --- /dev/null +++ b/ui/frontend/src/assets/icons/circle.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ui/frontend/src/assets/icons/close-circle.svg b/ui/frontend/src/assets/icons/close-circle.svg new file mode 100644 index 000000000..c594ba3c2 --- /dev/null +++ b/ui/frontend/src/assets/icons/close-circle.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ui/frontend/src/assets/icons/network.svg b/ui/frontend/src/assets/icons/network.svg new file mode 100644 index 000000000..d3361a631 --- /dev/null +++ b/ui/frontend/src/assets/icons/network.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ui/frontend/src/assets/icons/transfer.svg b/ui/frontend/src/assets/icons/transfer.svg new file mode 100644 index 000000000..ef05d7c5d --- /dev/null +++ b/ui/frontend/src/assets/icons/transfer.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ui/frontend/src/assets/icons/wallet.svg b/ui/frontend/src/assets/icons/wallet.svg new file mode 100644 index 000000000..83231a708 --- /dev/null +++ b/ui/frontend/src/assets/icons/wallet.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ui/src/assets/iosevka-regular.ttf b/ui/frontend/src/assets/iosevka-regular.ttf similarity index 100% rename from ui/src/assets/iosevka-regular.ttf rename to ui/frontend/src/assets/iosevka-regular.ttf diff --git a/ui/src/assets/logo.svg b/ui/frontend/src/assets/logo.svg similarity index 100% rename from ui/src/assets/logo.svg rename to ui/frontend/src/assets/logo.svg diff --git a/ui/src/assets/svelte.svg b/ui/frontend/src/assets/svelte.svg similarity index 100% rename from ui/src/assets/svelte.svg rename to ui/frontend/src/assets/svelte.svg diff --git a/ui/src/lib/Identicon.svelte b/ui/frontend/src/lib/Identicon.svelte similarity index 100% rename from ui/src/lib/Identicon.svelte rename to ui/frontend/src/lib/Identicon.svelte diff --git a/ui/src/lib/Loader.svelte b/ui/frontend/src/lib/Loader.svelte similarity index 100% rename from ui/src/lib/Loader.svelte rename to ui/frontend/src/lib/Loader.svelte diff --git a/ui/src/lib/Navbar.svelte b/ui/frontend/src/lib/Navbar.svelte similarity index 98% rename from ui/src/lib/Navbar.svelte rename to ui/frontend/src/lib/Navbar.svelte index 8c9216fa9..fc45ab2f7 100644 --- a/ui/src/lib/Navbar.svelte +++ b/ui/frontend/src/lib/Navbar.svelte @@ -31,7 +31,7 @@ - {#if $peers.length > 0} +{#if $peers.length > 0} {$peers.length.toString()} Peers diff --git a/ui/src/lib/OffersTable.svelte b/ui/frontend/src/lib/OffersTable.svelte similarity index 95% rename from ui/src/lib/OffersTable.svelte rename to ui/frontend/src/lib/OffersTable.svelte index f03065daf..a2f000fd1 100644 --- a/ui/src/lib/OffersTable.svelte +++ b/ui/frontend/src/lib/OffersTable.svelte @@ -22,7 +22,7 @@ -
+
@@ -41,7 +41,7 @@
{#if sortedOffers.length > 0} - +
Peer Offer Id @@ -79,8 +79,8 @@ .offers { max-width: 650px; margin: auto; - margin-top: 60px; - margin-bottom: 40px; + margin-top: 20px; + margin-bottom: 30px; } :global(.identicon > canvas) { border-radius: 50%; diff --git a/ui/frontend/src/lib/Sidebar.svelte b/ui/frontend/src/lib/Sidebar.svelte new file mode 100644 index 000000000..314fbfbf1 --- /dev/null +++ b/ui/frontend/src/lib/Sidebar.svelte @@ -0,0 +1,71 @@ + + + + + + logo + + + trade + + + + + swaps + + + + 0 + + + + + + wallet + + + + + network + + + {#if $peers.length > 0} + + {$peers.length.toString()} + + {:else} + + {$peers.length.toString()} + + {/if} + + + + + + + + \ No newline at end of file diff --git a/ui/frontend/src/lib/StatusBar.svelte b/ui/frontend/src/lib/StatusBar.svelte new file mode 100644 index 000000000..9354ada6a --- /dev/null +++ b/ui/frontend/src/lib/StatusBar.svelte @@ -0,0 +1,40 @@ + + + +
+
+ + + +
+ + + clearnet + + + {#if $peers.length > 0} + + {$peers.length.toString()} Peers + + {:else} + + {$peers.length.toString()} Peers + + {/if} +
+ + \ No newline at end of file diff --git a/ui/src/lib/TakeDealDialog.svelte b/ui/frontend/src/lib/TakeDealDialog.svelte similarity index 95% rename from ui/src/lib/TakeDealDialog.svelte rename to ui/frontend/src/lib/TakeDealDialog.svelte index 348dd527a..f1067b6dc 100644 --- a/ui/src/lib/TakeDealDialog.svelte +++ b/ui/frontend/src/lib/TakeDealDialog.svelte @@ -2,17 +2,18 @@ import type { CancelResult } from '../types/Cancel' import type { NetTakeOfferSyncResult } from '../types/NetTakeOfferSync' import { getCorrespondingToken, rpcRequest, getPort } from '../utils' - import type { TokenInfo } from '../types' import { selectedOffer } from '../stores/offerStore' import { getPeers } from '../stores/peerStore' //import { currentAccount, sign } from '../stores/metamask' import Loader from './Loader.svelte' + import type { TokenInfo } from '../types' + import TokenIcon from '$lib/TokenIcon.svelte'; import { Button, Modal } from 'flowbite-svelte' import { Badge, Label, Input, Helper, InputAddon, ButtonGroup, Spinner } from 'flowbite-svelte' - import { CheckSolid, XmarkSolid } from 'svelte-awesome-icons'; - import TokenIcon from '$lib/TokenIcon.svelte'; + import checkmark from '../assets/icons/check-circle.svg' + import failed from '../assets/icons/close-circle.svg' import eth from '../assets/coins/eth.png' @@ -130,14 +131,14 @@ {:else if isSuccess}
- + checkmark

You received {willReceive} {$selectedOffer.provides}

{:else if !!swapError}
- + failed

{swapError}

diff --git a/ui/src/lib/TokenIcon.svelte b/ui/frontend/src/lib/TokenIcon.svelte similarity index 50% rename from ui/src/lib/TokenIcon.svelte rename to ui/frontend/src/lib/TokenIcon.svelte index 57d8557a3..b19c97c95 100644 --- a/ui/src/lib/TokenIcon.svelte +++ b/ui/frontend/src/lib/TokenIcon.svelte @@ -7,17 +7,14 @@ $: url = unknown async function load() { - if (ticker) { - try { - const path = await import(`../assets/coins/${ticker.toLowerCase()}@2x.png`) - url = path.default - } catch (e) {} - } + try { + const path = await import(`../assets/coins/${ticker.toLowerCase()}@2x.png`) + url = path.default + } catch (e) {} } - -token-icon +token-icon diff --git a/ui/src/routes/+page.svelte b/ui/frontend/src/routes/+page.svelte similarity index 87% rename from ui/src/routes/+page.svelte rename to ui/frontend/src/routes/+page.svelte index 0035fae50..47ca8991e 100644 --- a/ui/src/routes/+page.svelte +++ b/ui/frontend/src/routes/+page.svelte @@ -12,7 +12,8 @@ ); -
+{#if filteredPairs.length > 0} +
@@ -24,21 +25,21 @@
- +
Pairs

{$pairs.length} Pairs

- +
Reported Liquidity

{$liquidity} XMR

- +
Offers

{$offers} @@ -46,15 +47,14 @@

- {#if filteredPairs.length > 0} -
+
Ticker Reported Liquidity Offers - + {#each filteredPairs as pair (pair.token.symbol)} @@ -81,16 +81,19 @@ {/each}
- {:else} +
+{:else} +

No pairs found.

- {/if}
+{/if} diff --git a/ui/src/routes/offers/[token]/+page.svelte b/ui/frontend/src/routes/offers/[token]/+page.svelte similarity index 92% rename from ui/src/routes/offers/[token]/+page.svelte rename to ui/frontend/src/routes/offers/[token]/+page.svelte index 413755203..c91426c50 100644 --- a/ui/src/routes/offers/[token]/+page.svelte +++ b/ui/frontend/src/routes/offers/[token]/+page.svelte @@ -7,6 +7,8 @@ import type { TokenInfo } from '../../../types/PersonalTokenInfoResult' export let data: PageData + $: filteredOffers = $offers.filter(off => off.ethAsset === data.token) + const getToken = async (): Promise => { if (data.token.toLowerCase() === 'eth') return EthTokenInfo return getTokenInfo(data.token) || EthTokenInfo @@ -15,7 +17,7 @@ $: filteredOffers = $offers.filter(off => off.ethAsset.toLowerCase() === data.token.toLowerCase()) -
+
{#if offers } {#await tokenInfoPromise} diff --git a/ui/src/routes/offers/[token]/+page.ts b/ui/frontend/src/routes/offers/[token]/+page.ts similarity index 100% rename from ui/src/routes/offers/[token]/+page.ts rename to ui/frontend/src/routes/offers/[token]/+page.ts diff --git a/ui/frontend/src/routes/peers/+page.svelte b/ui/frontend/src/routes/peers/+page.svelte new file mode 100644 index 000000000..f13f8fbce --- /dev/null +++ b/ui/frontend/src/routes/peers/+page.svelte @@ -0,0 +1,47 @@ + + +
+

{$peers.length} Peers

+
+ + + Id + Offers + + + {#each $peers as peerID} + + + + {peerID} + + ? + + {/each} + +
+
+ + \ No newline at end of file diff --git a/ui/src/stores/metamask.ts b/ui/frontend/src/stores/metamask.ts similarity index 100% rename from ui/src/stores/metamask.ts rename to ui/frontend/src/stores/metamask.ts diff --git a/ui/src/stores/offerStore.ts b/ui/frontend/src/stores/offerStore.ts similarity index 100% rename from ui/src/stores/offerStore.ts rename to ui/frontend/src/stores/offerStore.ts diff --git a/ui/src/stores/pairStore.ts b/ui/frontend/src/stores/pairStore.ts similarity index 94% rename from ui/src/stores/pairStore.ts rename to ui/frontend/src/stores/pairStore.ts index 4292f9ea1..3f7887eef 100644 --- a/ui/src/stores/pairStore.ts +++ b/ui/frontend/src/stores/pairStore.ts @@ -16,10 +16,11 @@ export const getPairs = () => { .then(({ result }) => { pairs.set(result.Pairs) liquidity.set(result.Pairs.reduce((acc, a) => acc += Number(a.reportedLiquidityXmr), 0)) + console.log(result, liquidity) offers.set(result.Pairs.reduce((acc, a) => acc += a.offers, 0)) }) .catch(console.error) .finally(() => { isLoadingPairs.set(false) }) -} +} \ No newline at end of file diff --git a/ui/frontend/src/stores/peerStore.ts b/ui/frontend/src/stores/peerStore.ts new file mode 100644 index 000000000..c1612f119 --- /dev/null +++ b/ui/frontend/src/stores/peerStore.ts @@ -0,0 +1,20 @@ +import { rpcRequest } from '../utils'; +import { writable } from 'svelte/store'; +import type { NetDiscoverResult } from '../types/NetDiscoverResults'; + +export const isLoadingPeers = writable(false) +export const peers = writable([], () => { + getPeers() +}); + +export const getPeers = async () => { + try { + isLoadingPeers.set(true) + const resp = await rpcRequest('net_discover', { searchTime: 3 }) + peers.set([...new Set(resp.result.peerIDs)]) + } catch (e) { + console.error(e) + } finally { + isLoadingPeers.set(false) + } +} \ No newline at end of file diff --git a/ui/src/types/Cancel.ts b/ui/frontend/src/types/Cancel.ts similarity index 100% rename from ui/src/types/Cancel.ts rename to ui/frontend/src/types/Cancel.ts diff --git a/ui/src/types/NetAddressResult.ts b/ui/frontend/src/types/NetAddressResult.ts similarity index 100% rename from ui/src/types/NetAddressResult.ts rename to ui/frontend/src/types/NetAddressResult.ts diff --git a/ui/src/types/NetDiscoverResults.ts b/ui/frontend/src/types/NetDiscoverResults.ts similarity index 100% rename from ui/src/types/NetDiscoverResults.ts rename to ui/frontend/src/types/NetDiscoverResults.ts diff --git a/ui/src/types/NetPairResults.ts b/ui/frontend/src/types/NetPairResults.ts similarity index 99% rename from ui/src/types/NetPairResults.ts rename to ui/frontend/src/types/NetPairResults.ts index deb29a10c..27211393e 100644 --- a/ui/src/types/NetPairResults.ts +++ b/ui/frontend/src/types/NetPairResults.ts @@ -13,4 +13,4 @@ export interface Pair { export interface NetPairResults { Pairs: Pair[] -} +} \ No newline at end of file diff --git a/ui/src/types/NetQueryPeerResults.ts b/ui/frontend/src/types/NetQueryPeerResults.ts similarity index 100% rename from ui/src/types/NetQueryPeerResults.ts rename to ui/frontend/src/types/NetQueryPeerResults.ts diff --git a/ui/src/types/NetTakeOfferSync.ts b/ui/frontend/src/types/NetTakeOfferSync.ts similarity index 100% rename from ui/src/types/NetTakeOfferSync.ts rename to ui/frontend/src/types/NetTakeOfferSync.ts diff --git a/ui/src/types/PersonalTokenInfoResult.ts b/ui/frontend/src/types/PersonalTokenInfoResult.ts similarity index 98% rename from ui/src/types/PersonalTokenInfoResult.ts rename to ui/frontend/src/types/PersonalTokenInfoResult.ts index 08b501ada..351dfbff3 100644 --- a/ui/src/types/PersonalTokenInfoResult.ts +++ b/ui/frontend/src/types/PersonalTokenInfoResult.ts @@ -3,4 +3,4 @@ export interface TokenInfo { decimals: Number name: String symbol: String -} +} \ No newline at end of file diff --git a/ui/src/types/index.ts b/ui/frontend/src/types/index.ts similarity index 99% rename from ui/src/types/index.ts rename to ui/frontend/src/types/index.ts index 36ae4f289..6c94fcd4d 100644 --- a/ui/src/types/index.ts +++ b/ui/frontend/src/types/index.ts @@ -15,4 +15,4 @@ export interface Offer { version: String ethAsset: Currency nonce: Number -} +} \ No newline at end of file diff --git a/ui/src/utils/getCorrespondingToken.ts b/ui/frontend/src/utils/getCorrespondingToken.ts similarity index 100% rename from ui/src/utils/getCorrespondingToken.ts rename to ui/frontend/src/utils/getCorrespondingToken.ts diff --git a/ui/src/utils/getTokenInfo.ts b/ui/frontend/src/utils/getTokenInfo.ts similarity index 99% rename from ui/src/utils/getTokenInfo.ts rename to ui/frontend/src/utils/getTokenInfo.ts index 4e2a85ba8..b2fc808ba 100644 --- a/ui/src/utils/getTokenInfo.ts +++ b/ui/frontend/src/utils/getTokenInfo.ts @@ -7,4 +7,4 @@ export const getTokenInfo = async (address: String): Promise; diff --git a/ui/frontend/wailsjs/go/main/App.js b/ui/frontend/wailsjs/go/main/App.js new file mode 100755 index 000000000..c71ae77cb --- /dev/null +++ b/ui/frontend/wailsjs/go/main/App.js @@ -0,0 +1,7 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export function Greet(arg1) { + return window['go']['main']['App']['Greet'](arg1); +} diff --git a/ui/frontend/wailsjs/runtime/package.json b/ui/frontend/wailsjs/runtime/package.json new file mode 100644 index 000000000..1e7c8a5d7 --- /dev/null +++ b/ui/frontend/wailsjs/runtime/package.json @@ -0,0 +1,24 @@ +{ + "name": "@wailsapp/runtime", + "version": "2.0.0", + "description": "Wails Javascript runtime library", + "main": "runtime.js", + "types": "runtime.d.ts", + "scripts": { + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wailsapp/wails.git" + }, + "keywords": [ + "Wails", + "Javascript", + "Go" + ], + "author": "Lea Anthony ", + "license": "MIT", + "bugs": { + "url": "https://github.com/wailsapp/wails/issues" + }, + "homepage": "https://github.com/wailsapp/wails#readme" +} diff --git a/ui/frontend/wailsjs/runtime/runtime.d.ts b/ui/frontend/wailsjs/runtime/runtime.d.ts new file mode 100644 index 000000000..a3723f94b --- /dev/null +++ b/ui/frontend/wailsjs/runtime/runtime.d.ts @@ -0,0 +1,235 @@ +/* + _ __ _ __ +| | / /___ _(_) /____ +| | /| / / __ `/ / / ___/ +| |/ |/ / /_/ / / (__ ) +|__/|__/\__,_/_/_/____/ +The electron alternative for Go +(c) Lea Anthony 2019-present +*/ + +export interface Position { + x: number; + y: number; +} + +export interface Size { + w: number; + h: number; +} + +export interface Screen { + isCurrent: boolean; + isPrimary: boolean; + width : number + height : number +} + +// Environment information such as platform, buildtype, ... +export interface EnvironmentInfo { + buildType: string; + platform: string; + arch: string; +} + +// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit) +// emits the given event. Optional data may be passed with the event. +// This will trigger any event listeners. +export function EventsEmit(eventName: string, ...data: any): void; + +// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name. +export function EventsOn(eventName: string, callback: (...data: any) => void): () => void; + +// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple) +// sets up a listener for the given event name, but will only trigger a given number times. +export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void; + +// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce) +// sets up a listener for the given event name, but will only trigger once. +export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void; + +// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff) +// unregisters the listener for the given event name. +export function EventsOff(eventName: string, ...additionalEventNames: string[]): void; + +// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall) +// unregisters all listeners. +export function EventsOffAll(): void; + +// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint) +// logs the given message as a raw message +export function LogPrint(message: string): void; + +// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace) +// logs the given message at the `trace` log level. +export function LogTrace(message: string): void; + +// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug) +// logs the given message at the `debug` log level. +export function LogDebug(message: string): void; + +// [LogError](https://wails.io/docs/reference/runtime/log#logerror) +// logs the given message at the `error` log level. +export function LogError(message: string): void; + +// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal) +// logs the given message at the `fatal` log level. +// The application will quit after calling this method. +export function LogFatal(message: string): void; + +// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo) +// logs the given message at the `info` log level. +export function LogInfo(message: string): void; + +// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning) +// logs the given message at the `warning` log level. +export function LogWarning(message: string): void; + +// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload) +// Forces a reload by the main application as well as connected browsers. +export function WindowReload(): void; + +// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp) +// Reloads the application frontend. +export function WindowReloadApp(): void; + +// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop) +// Sets the window AlwaysOnTop or not on top. +export function WindowSetAlwaysOnTop(b: boolean): void; + +// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme) +// *Windows only* +// Sets window theme to system default (dark/light). +export function WindowSetSystemDefaultTheme(): void; + +// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme) +// *Windows only* +// Sets window to light theme. +export function WindowSetLightTheme(): void; + +// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme) +// *Windows only* +// Sets window to dark theme. +export function WindowSetDarkTheme(): void; + +// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter) +// Centers the window on the monitor the window is currently on. +export function WindowCenter(): void; + +// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle) +// Sets the text in the window title bar. +export function WindowSetTitle(title: string): void; + +// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen) +// Makes the window full screen. +export function WindowFullscreen(): void; + +// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen) +// Restores the previous window dimensions and position prior to full screen. +export function WindowUnfullscreen(): void; + +// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen) +// Returns the state of the window, i.e. whether the window is in full screen mode or not. +export function WindowIsFullscreen(): Promise; + +// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize) +// Sets the width and height of the window. +export function WindowSetSize(width: number, height: number): Promise; + +// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize) +// Gets the width and height of the window. +export function WindowGetSize(): Promise; + +// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize) +// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions. +// Setting a size of 0,0 will disable this constraint. +export function WindowSetMaxSize(width: number, height: number): void; + +// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize) +// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions. +// Setting a size of 0,0 will disable this constraint. +export function WindowSetMinSize(width: number, height: number): void; + +// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition) +// Sets the window position relative to the monitor the window is currently on. +export function WindowSetPosition(x: number, y: number): void; + +// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition) +// Gets the window position relative to the monitor the window is currently on. +export function WindowGetPosition(): Promise; + +// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide) +// Hides the window. +export function WindowHide(): void; + +// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow) +// Shows the window, if it is currently hidden. +export function WindowShow(): void; + +// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise) +// Maximises the window to fill the screen. +export function WindowMaximise(): void; + +// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise) +// Toggles between Maximised and UnMaximised. +export function WindowToggleMaximise(): void; + +// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise) +// Restores the window to the dimensions and position prior to maximising. +export function WindowUnmaximise(): void; + +// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised) +// Returns the state of the window, i.e. whether the window is maximised or not. +export function WindowIsMaximised(): Promise; + +// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise) +// Minimises the window. +export function WindowMinimise(): void; + +// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise) +// Restores the window to the dimensions and position prior to minimising. +export function WindowUnminimise(): void; + +// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised) +// Returns the state of the window, i.e. whether the window is minimised or not. +export function WindowIsMinimised(): Promise; + +// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal) +// Returns the state of the window, i.e. whether the window is normal or not. +export function WindowIsNormal(): Promise; + +// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour) +// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels. +export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void; + +// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall) +// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system. +export function ScreenGetAll(): Promise; + +// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl) +// Opens the given URL in the system browser. +export function BrowserOpenURL(url: string): void; + +// [Environment](https://wails.io/docs/reference/runtime/intro#environment) +// Returns information about the environment +export function Environment(): Promise; + +// [Quit](https://wails.io/docs/reference/runtime/intro#quit) +// Quits the application. +export function Quit(): void; + +// [Hide](https://wails.io/docs/reference/runtime/intro#hide) +// Hides the application. +export function Hide(): void; + +// [Show](https://wails.io/docs/reference/runtime/intro#show) +// Shows the application. +export function Show(): void; + +// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext) +// Returns the current text stored on clipboard +export function ClipboardGetText(): Promise; + +// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext) +// Sets a text on the clipboard +export function ClipboardSetText(text: string): Promise; diff --git a/ui/frontend/wailsjs/runtime/runtime.js b/ui/frontend/wailsjs/runtime/runtime.js new file mode 100644 index 000000000..bd4f371ae --- /dev/null +++ b/ui/frontend/wailsjs/runtime/runtime.js @@ -0,0 +1,202 @@ +/* + _ __ _ __ +| | / /___ _(_) /____ +| | /| / / __ `/ / / ___/ +| |/ |/ / /_/ / / (__ ) +|__/|__/\__,_/_/_/____/ +The electron alternative for Go +(c) Lea Anthony 2019-present +*/ + +export function LogPrint(message) { + window.runtime.LogPrint(message); +} + +export function LogTrace(message) { + window.runtime.LogTrace(message); +} + +export function LogDebug(message) { + window.runtime.LogDebug(message); +} + +export function LogInfo(message) { + window.runtime.LogInfo(message); +} + +export function LogWarning(message) { + window.runtime.LogWarning(message); +} + +export function LogError(message) { + window.runtime.LogError(message); +} + +export function LogFatal(message) { + window.runtime.LogFatal(message); +} + +export function EventsOnMultiple(eventName, callback, maxCallbacks) { + return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks); +} + +export function EventsOn(eventName, callback) { + return EventsOnMultiple(eventName, callback, -1); +} + +export function EventsOff(eventName, ...additionalEventNames) { + return window.runtime.EventsOff(eventName, ...additionalEventNames); +} + +export function EventsOnce(eventName, callback) { + return EventsOnMultiple(eventName, callback, 1); +} + +export function EventsEmit(eventName) { + let args = [eventName].slice.call(arguments); + return window.runtime.EventsEmit.apply(null, args); +} + +export function WindowReload() { + window.runtime.WindowReload(); +} + +export function WindowReloadApp() { + window.runtime.WindowReloadApp(); +} + +export function WindowSetAlwaysOnTop(b) { + window.runtime.WindowSetAlwaysOnTop(b); +} + +export function WindowSetSystemDefaultTheme() { + window.runtime.WindowSetSystemDefaultTheme(); +} + +export function WindowSetLightTheme() { + window.runtime.WindowSetLightTheme(); +} + +export function WindowSetDarkTheme() { + window.runtime.WindowSetDarkTheme(); +} + +export function WindowCenter() { + window.runtime.WindowCenter(); +} + +export function WindowSetTitle(title) { + window.runtime.WindowSetTitle(title); +} + +export function WindowFullscreen() { + window.runtime.WindowFullscreen(); +} + +export function WindowUnfullscreen() { + window.runtime.WindowUnfullscreen(); +} + +export function WindowIsFullscreen() { + return window.runtime.WindowIsFullscreen(); +} + +export function WindowGetSize() { + return window.runtime.WindowGetSize(); +} + +export function WindowSetSize(width, height) { + window.runtime.WindowSetSize(width, height); +} + +export function WindowSetMaxSize(width, height) { + window.runtime.WindowSetMaxSize(width, height); +} + +export function WindowSetMinSize(width, height) { + window.runtime.WindowSetMinSize(width, height); +} + +export function WindowSetPosition(x, y) { + window.runtime.WindowSetPosition(x, y); +} + +export function WindowGetPosition() { + return window.runtime.WindowGetPosition(); +} + +export function WindowHide() { + window.runtime.WindowHide(); +} + +export function WindowShow() { + window.runtime.WindowShow(); +} + +export function WindowMaximise() { + window.runtime.WindowMaximise(); +} + +export function WindowToggleMaximise() { + window.runtime.WindowToggleMaximise(); +} + +export function WindowUnmaximise() { + window.runtime.WindowUnmaximise(); +} + +export function WindowIsMaximised() { + return window.runtime.WindowIsMaximised(); +} + +export function WindowMinimise() { + window.runtime.WindowMinimise(); +} + +export function WindowUnminimise() { + window.runtime.WindowUnminimise(); +} + +export function WindowSetBackgroundColour(R, G, B, A) { + window.runtime.WindowSetBackgroundColour(R, G, B, A); +} + +export function ScreenGetAll() { + return window.runtime.ScreenGetAll(); +} + +export function WindowIsMinimised() { + return window.runtime.WindowIsMinimised(); +} + +export function WindowIsNormal() { + return window.runtime.WindowIsNormal(); +} + +export function BrowserOpenURL(url) { + window.runtime.BrowserOpenURL(url); +} + +export function Environment() { + return window.runtime.Environment(); +} + +export function Quit() { + window.runtime.Quit(); +} + +export function Hide() { + window.runtime.Hide(); +} + +export function Show() { + window.runtime.Show(); +} + +export function ClipboardGetText() { + return window.runtime.ClipboardGetText(); +} + +export function ClipboardSetText(text) { + return window.runtime.ClipboardSetText(text); +} \ No newline at end of file diff --git a/ui/yarn.lock b/ui/frontend/yarn.lock similarity index 99% rename from ui/yarn.lock rename to ui/frontend/yarn.lock index 92f93e309..47245c05b 100644 --- a/ui/yarn.lock +++ b/ui/frontend/yarn.lock @@ -383,6 +383,11 @@ dependencies: import-meta-resolve "^3.0.0" +"@sveltejs/adapter-static@^1.0.0": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@sveltejs/adapter-static/-/adapter-static-1.0.6.tgz#897c0a1e7b929be8dc1871d28cab7746afa7bf72" + integrity sha512-gTus2jW6bEQAZoT1MdmPHWZZmcb6dfLWc0r6dFHnbzSDZ68kifqQ1E+dZDOMF7aXeRV91sgnPuAn2MtpinVdlA== + "@sveltejs/kit@^1.20.4": version "1.22.1" resolved "https://registry.yarnpkg.com/@sveltejs/kit/-/kit-1.22.1.tgz#1429ae67f4cfe725adc25dad47e2271a39a0bab5" @@ -816,6 +821,11 @@ dlv@^1.1.3: resolved "https://registry.yarnpkg.com/dlv/-/dlv-1.1.3.tgz#5c198a8a11453596e751494d49874bc7732f2e79" integrity sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA== +dotenv@^16.0.3: + version "16.3.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== + electron-to-chromium@^1.4.284: version "1.4.394" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.394.tgz#989abe104a40366755648876cde2cdeda9f31133" diff --git a/ui/go.mod b/ui/go.mod new file mode 100644 index 000000000..e9d8b6b0d --- /dev/null +++ b/ui/go.mod @@ -0,0 +1,33 @@ +module changeme + +go 1.18 + +require github.com/wailsapp/wails/v2 v2.5.1 + +require ( + github.com/bep/debounce v1.2.1 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/google/uuid v1.1.2 // indirect + github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect + github.com/labstack/echo/v4 v4.9.0 // indirect + github.com/labstack/gommon v0.3.1 // indirect + github.com/leaanthony/go-ansi-parser v1.0.1 // indirect + github.com/leaanthony/gosod v1.0.3 // indirect + github.com/leaanthony/slicer v1.5.0 // indirect + github.com/mattn/go-colorable v0.1.11 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/samber/lo v1.27.1 // indirect + github.com/tkrajina/go-reflector v0.5.5 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.2.1 // indirect + github.com/wailsapp/mimetype v1.4.1 // indirect + golang.org/x/crypto v0.1.0 // indirect + golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect +) + +// replace github.com/wailsapp/wails/v2 v2.2.0 => /home/plihelix/go/pkg/mod diff --git a/ui/go.sum b/ui/go.sum new file mode 100644 index 000000000..aac88038b --- /dev/null +++ b/ui/go.sum @@ -0,0 +1,77 @@ +github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY= +github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck= +github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs= +github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY= +github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= +github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= +github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc= +github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA= +github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4= +github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM= +github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ= +github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4= +github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0HtY= +github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY= +github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= +github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= +github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 h1:acNfDZXmm28D2Yg/c3ALnZStzNaZMSagpbr96vY6Zjc= +github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/samber/lo v1.27.1 h1:sTXwkRiIFIQG+G0HeAvOEnGjqWeWtI9cg5/n51KrxPg= +github.com/samber/lo v1.27.1/go.mod h1:it33p9UtPMS7z72fP4gw/EIfQB2eI8ke7GR2wc6+Rhg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= +github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ= +github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= +github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= +github.com/wailsapp/wails/v2 v2.5.1 h1:mfG+2kWqQXYOwdgI43HEILjOZDXbk5woPYI3jP2b+js= +github.com/wailsapp/wails/v2 v2.5.1/go.mod h1:jbOZbcr/zm79PxXxAjP8UoVlDd9wLW3uDs+isIthDfs= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= +golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/ui/main.go b/ui/main.go new file mode 100644 index 000000000..3fceb9a2d --- /dev/null +++ b/ui/main.go @@ -0,0 +1,69 @@ +package main + +import ( + "embed" + "fmt" + "github.com/wailsapp/wails/v2" + "github.com/wailsapp/wails/v2/pkg/options" + "github.com/wailsapp/wails/v2/pkg/options/assetserver" + "net/http" + "os" + "strings" +) + +// 'wails dev' should properly launch vite to serve the site +// for live development without needing to seperately launch +// 'npm run dev' or your flavor such as pnpm in the frontend +// directory seperately. + +// The comment below chooses what gets packaged with +// the application. + +//go:embed all:frontend/build +var assets embed.FS + +type FileLoader struct { + http.Handler +} + +func NewFileLoader() *FileLoader { + return &FileLoader{} +} + +func (h *FileLoader) ServeHTTP(res http.ResponseWriter, req *http.Request) { + var err error + requestedFilename := strings.TrimPrefix(req.URL.Path, "/") + println("Requesting file:", requestedFilename) + fileData, err := os.ReadFile(requestedFilename) + if err != nil { + res.WriteHeader(http.StatusBadRequest) + res.Write([]byte(fmt.Sprintf("Could not load file %s", requestedFilename))) + } + + res.Write(fileData) +} + +func main() { + // Create an instance of the app structure + app := NewApp() + + // Create application with options + err := wails.Run(&options.App{ + Title: "AtomicSwap", + Width: 1024, + Height: 768, + AssetServer: &assetserver.Options{ + Assets: assets, + Handler: NewFileLoader(), + }, + BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1}, + OnStartup: app.startup, + Bind: []interface{}{ + app, + }, + }) + + if err != nil { + println("Error:", err.Error()) + } +} diff --git a/ui/src/routes/+layout.svelte b/ui/src/routes/+layout.svelte deleted file mode 100644 index a015cff7a..000000000 --- a/ui/src/routes/+layout.svelte +++ /dev/null @@ -1,12 +0,0 @@ - - -
- - -
- - diff --git a/ui/src/stores/peerStore.ts b/ui/src/stores/peerStore.ts deleted file mode 100644 index e3cfef516..000000000 --- a/ui/src/stores/peerStore.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { rpcRequest } from '../utils'; -import { writable } from 'svelte/store'; -import type { NetDiscoverResult } from '../types/NetDiscoverResults'; - -export const isLoadingPeers = writable(false) -export const peers = writable([], () => { - getPeers() -}); - -export const getPeers = () => { - isLoadingPeers.set(true) - return rpcRequest('net_discover', { searchTime: 3 }) - .then(({ result }) => { peers.set([...new Set(result.peerIDs)]) }) - .catch(console.error) - .finally(() => { - isLoadingPeers.set(false) - }) -} \ No newline at end of file diff --git a/ui/src/theme/_smui-theme.scss b/ui/src/theme/_smui-theme.scss deleted file mode 100644 index 7373188de..000000000 --- a/ui/src/theme/_smui-theme.scss +++ /dev/null @@ -1,38 +0,0 @@ -@use 'sass:color'; - -@use '@material/theme/color-palette'; - -// Svelte Colors! -@use '@material/theme/index' as theme with ( - $primary: #ff3e00, - $on-primary: #222, - $secondary: #676778, - $surface: #fcfcfc, - $on-surface: #222, - $background: #fff, - $error: color-palette.$red-900, -); - -html, -body { - background-color: theme.$surface; - color: theme.$on-surface; - padding: 0; -} - -a { - color: #40b3ff; -} -a:visited { - color: color.scale(#40b3ff, $lightness: -35%); -} - - -.topappbar { - background: #fff; -} -.mdc-top-app-bar { - background: transparent -} - -// Import the mixins. diff --git a/ui/src/theme/dark/_smui-theme.scss b/ui/src/theme/dark/_smui-theme.scss deleted file mode 100644 index f52ecbf90..000000000 --- a/ui/src/theme/dark/_smui-theme.scss +++ /dev/null @@ -1,25 +0,0 @@ -@use 'sass:color'; - -@use '@material/theme/color-palette'; - -// Svelte Colors! (Dark Theme) -@use '@material/theme/index' as theme with ( - $primary: #ff3e00, - $secondary: color.scale(#676778, $whiteness: -10%), - $surface: color.adjust(color-palette.$grey-900, $blue: +4), - $background: #000, - $error: color-palette.$red-700 -); - -html, -body { - background-color: #000; - color: theme.$on-surface; -} - -a { - color: #40b3ff; -} -a:visited { - color: color.scale(#40b3ff, $lightness: -35%); -} diff --git a/ui/svelte.config.js b/ui/svelte.config.js deleted file mode 100644 index db566e90c..000000000 --- a/ui/svelte.config.js +++ /dev/null @@ -1,18 +0,0 @@ -import adapter from '@sveltejs/adapter-auto'; -import { vitePreprocess } from '@sveltejs/kit/vite'; - -/** @type {import('@sveltejs/kit').Config} */ -const config = { - // Consult https://kit.svelte.dev/docs/integrations#preprocessors - // for more information about preprocessors - preprocess: vitePreprocess(), - - kit: { - // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. - // If your environment is not supported or you settled on a specific environment, switch out the adapter. - // See https://kit.svelte.dev/docs/adapters for more information about adapters. - adapter: adapter() - } -}; - -export default config; \ No newline at end of file diff --git a/ui/wails.json b/ui/wails.json new file mode 100644 index 000000000..4aa609648 --- /dev/null +++ b/ui/wails.json @@ -0,0 +1,13 @@ +{ + "name": "AtomicSwap", + "outputfilename": "swap", + "frontend:install": "npm install", + "frontend:build": "npm run build --base=./", + "frontend:dev:watcher": "npm run dev", + "frontend:dev:serverUrl": "auto", + "wailsjsdir": "./frontend/src/lib", + "author": { + "name": "Matt", + "email": "stubbrn@protonmail.com" + } +} From 74b21e038d71c3c20baa4faa3d1d1369b2f544ca Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 28 Aug 2023 07:35:58 +0200 Subject: [PATCH 2/2] linter --- ui/main.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ui/main.go b/ui/main.go index 3fceb9a2d..f94f94a2c 100644 --- a/ui/main.go +++ b/ui/main.go @@ -1,20 +1,23 @@ +// main package main import ( "embed" "fmt" - "github.com/wailsapp/wails/v2" - "github.com/wailsapp/wails/v2/pkg/options" - "github.com/wailsapp/wails/v2/pkg/options/assetserver" "net/http" "os" + "path/filepath" "strings" + + "github.com/wailsapp/wails/v2" + "github.com/wailsapp/wails/v2/pkg/options" + "github.com/wailsapp/wails/v2/pkg/options/assetserver" ) // 'wails dev' should properly launch vite to serve the site -// for live development without needing to seperately launch +// for live development without needing to separately launch // 'npm run dev' or your flavor such as pnpm in the frontend -// directory seperately. +// directory separatelye // The comment below chooses what gets packaged with // the application. @@ -22,10 +25,12 @@ import ( //go:embed all:frontend/build var assets embed.FS +// FileLoader ... type FileLoader struct { http.Handler } +// NewFileLoader ... func NewFileLoader() *FileLoader { return &FileLoader{} } @@ -34,13 +39,13 @@ func (h *FileLoader) ServeHTTP(res http.ResponseWriter, req *http.Request) { var err error requestedFilename := strings.TrimPrefix(req.URL.Path, "/") println("Requesting file:", requestedFilename) - fileData, err := os.ReadFile(requestedFilename) + fileData, err := os.ReadFile(filepath.Clean(requestedFilename)) if err != nil { res.WriteHeader(http.StatusBadRequest) - res.Write([]byte(fmt.Sprintf("Could not load file %s", requestedFilename))) + _, _ = res.Write([]byte(fmt.Sprintf("Could not load file %s", requestedFilename))) } - res.Write(fileData) + _, _ = res.Write(fileData) } func main() {