From 63351d5b2d10294dfc3377012cdc1f4f73e0e8c3 Mon Sep 17 00:00:00 2001 From: Konsta Purtsi Date: Sun, 18 Aug 2024 14:34:08 +0300 Subject: [PATCH] feat: add rust build & test action --- .env.example | 5 + .github/workflows/astro.yml | 21 ++ .github/workflows/clippy.yml | 7 +- .github/workflows/rust.yml | 20 ++ .github/workflows/rustfmt.yml | 7 +- .prettierrc.mjs | 22 ++ biome.json | 12 + package-lock.json | 292 +++++++++++++++++- package.json | 10 +- src/components/Card.astro | 100 +++--- src/components/ConnectFreighter.astro | 98 +++--- src/components/Nav.tsx | 38 +-- src/components/borrowing.astro | 375 +++++++++++------------ src/components/lending.astro | 426 +++++++++++++------------- src/contracts/util.ts | 6 +- src/env.d.ts | 6 +- src/layouts/Layout.astro | 26 +- src/pages/borrow.astro | 130 ++++---- src/pages/index.astro | 132 ++++---- src/pages/lend.astro | 130 ++++---- src/pages/liquidate.astro | 22 +- 21 files changed, 1116 insertions(+), 769 deletions(-) create mode 100644 .env.example create mode 100644 .github/workflows/astro.yml create mode 100644 .github/workflows/rust.yml create mode 100644 .prettierrc.mjs create mode 100644 biome.json diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..d8256e4c --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +PUBLIC_SOROBAN_NETWORK_PASSPHRASE="Test SDF Network ; September 2015" +PUBLIC_SOROBAN_RPC_URL="https://soroban-testnet.stellar.org/" + +SOROBAN_ACCOUNT="alice" +SOROBAN_NETWORK="testnet" diff --git a/.github/workflows/astro.yml b/.github/workflows/astro.yml new file mode 100644 index 00000000..a257f160 --- /dev/null +++ b/.github/workflows/astro.yml @@ -0,0 +1,21 @@ +name: "Astro: build" + +on: + push: + branches: + - "**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout your repository using git + uses: actions/checkout@v4 + - name: Install and build the webapp + uses: withastro/action@v2 + with: + node-version: 22.6.0 + - name: Check linting & formatting + runs: + - npm run biome:check + - npm run prettier:check diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 7274bb9a..fe18455c 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -1,10 +1,9 @@ -name: Rust Clippy Check +name: "Rust: Clippy Check" on: push: - branches: [main] - pull_request: - branches: [main] + branches: + - "**" jobs: clippy: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 00000000..6d2b6ae7 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,20 @@ +name: "Rust: Build & test" + +on: + push: + branches: + - "**" + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index c2429c38..371752e5 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -1,10 +1,9 @@ -name: Rust Format Check +name: "Rust: Format Check" on: push: - branches: [main] - pull_request: - branches: [main] + branches: + - "**" jobs: rustfmt: diff --git a/.prettierrc.mjs b/.prettierrc.mjs new file mode 100644 index 00000000..8e7305ed --- /dev/null +++ b/.prettierrc.mjs @@ -0,0 +1,22 @@ +// .prettierrc.mjs +/** @type {import("prettier").Config} */ +const config = { + plugins: ['prettier-plugin-astro'], + overrides: [ + { + files: '*.astro', + options: { + parser: 'astro', + }, + }, + ], + tabWidth: 2, + useTabs: false, + printWidth: 120, + singleQuote: true, + jsxSingleQuote: false, + bracketSpacing: true, + semi: true +} + +export default config; diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..7176377e --- /dev/null +++ b/biome.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "formatter": { + "enabled": false + }, + "linter": { + "enabled": true + }, + "organizeImports": { + "enabled": true + } +} diff --git a/package-lock.json b/package-lock.json index 719ee3d6..fa93767e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,9 @@ "devDependencies": { "@biomejs/biome": "1.8.3", "@vitejs/plugin-basic-ssl": "^1.1.0", - "dotenv": "^16.4.1" + "dotenv": "^16.4.1", + "prettier": "^3.3.3", + "prettier-plugin-astro": "^0.14.1" } }, "node_modules/@albedo-link/intent": { @@ -78,9 +80,10 @@ } }, "node_modules/@astrojs/compiler": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.5.1.tgz", - "integrity": "sha512-o2hKiFJXZOm1Gov+RGXSWnKlnb/UF7KRTx/Y2uazYe3+MrLY+sqLN+yB4EH2bElc0l1K9cDb4mZSejuq563rGQ==" + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.10.3.tgz", + "integrity": "sha512-bL/O7YBxsFt55YHU021oL+xz+B/9HvGNId3F9xURN16aeqDK9juHGktdkCSXz+U4nqFACq6ZFvWomOzhV+zfPw==", + "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { "version": "0.2.1", @@ -1970,6 +1973,44 @@ "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-2.0.0.tgz", "integrity": "sha512-j/R7MLPL8S3QhwOEdAxSl7MgWBTXWlOXQKQyXR8mPk1JMKKR4tF8e4U+Fs9TPQH0HZoYqfVDvLOOUrTMMY058Q==" }, + "node_modules/@stellar/js-xdr": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@stellar/js-xdr/-/js-xdr-3.1.2.tgz", + "integrity": "sha512-VVolPL5goVEIsvuGqDc5uiKxV03lzfWdvYg1KikvwheDmTBO68CKDji3bAZ/kppZrx5iTA8z3Ld5yuytcvhvOQ==", + "license": "Apache-2.0" + }, + "node_modules/@stellar/stellar-base": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@stellar/stellar-base/-/stellar-base-12.1.0.tgz", + "integrity": "sha512-pWwn+XWP5NotmIteZNuJzHeNn9DYSqH3lsYbtFUoSYy1QegzZdi9D8dK6fJ2fpBAnf/rcDjHgHOw3gtHaQFVbg==", + "license": "Apache-2.0", + "dependencies": { + "@stellar/js-xdr": "^3.1.2", + "base32.js": "^0.1.0", + "bignumber.js": "^9.1.2", + "buffer": "^6.0.3", + "sha.js": "^2.3.6", + "tweetnacl": "^1.0.3" + }, + "optionalDependencies": { + "sodium-native": "^4.1.1" + } + }, + "node_modules/@stellar/stellar-sdk": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-12.1.0.tgz", + "integrity": "sha512-Va0hu9SaPezmMbO5eMwL5D15Wrx1AGWRtxayUDRWV2Fr3ynY58mvCZS1vsgNQ4kE8MZe3nBVKv6T9Kzqwgx1PQ==", + "license": "Apache-2.0", + "dependencies": { + "@stellar/stellar-base": "^12.0.1", + "axios": "^1.7.2", + "bignumber.js": "^9.1.2", + "eventsource": "^2.0.2", + "randombytes": "^2.1.0", + "toml": "^3.0.0", + "urijs": "^1.19.1" + } + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -2736,6 +2777,12 @@ "sharp": "^0.32.6" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, "node_modules/atomic-sleep": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", @@ -2780,6 +2827,17 @@ "postcss": "^8.1.0" } }, + "node_modules/axios": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/axobject-query": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz", @@ -2813,6 +2871,15 @@ "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==" }, + "node_modules/base32.js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base32.js/-/base32.js-0.1.0.tgz", + "integrity": "sha512-n3TkB02ixgBOhTvANakDb4xaMXnYUVkNoRFJjQflcqMQhyEKxEHdj3E6N8t8sUQ0mjH/3/JxzlXuz3ul/J90pQ==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -2832,6 +2899,15 @@ } ] }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -3324,6 +3400,18 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "optional": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/comma-separated-tokens": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", @@ -3492,6 +3580,15 @@ "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==" }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -3740,6 +3837,15 @@ "node": ">=0.8.x" } }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/execa": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", @@ -3787,6 +3893,10 @@ "node": ">=0.10.0" } }, + "node_modules/factory": { + "resolved": "packages/factory", + "link": true + }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -3875,6 +3985,26 @@ "node": ">=8" } }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", @@ -3890,6 +4020,20 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fraction.js": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", @@ -4768,6 +4912,10 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/loan_pool": { + "resolved": "packages/loan_pool", + "link": true + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -5658,6 +5806,27 @@ "node": ">=10.0.0" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", @@ -5884,6 +6053,18 @@ "node": ">= 6.13.0" } }, + "node_modules/node-gyp-build": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz", + "integrity": "sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==", + "license": "MIT", + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-releases": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", @@ -6609,9 +6790,8 @@ "version": "3.3.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "devOptional": true, "license": "MIT", - "optional": true, - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -6622,6 +6802,21 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-astro": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.14.1.tgz", + "integrity": "sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@astrojs/compiler": "^2.9.1", + "prettier": "^3.0.0", + "sass-formatter": "^0.7.6" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + } + }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", @@ -6679,6 +6874,12 @@ "resolved": "https://registry.npmjs.org/proxy-compare/-/proxy-compare-2.5.1.tgz", "integrity": "sha512-oyfc0Tx87Cpwva5ZXezSp5V9vht1c7dZBhvuV/y3ctkgMVUmiAGDVeeB0dKhGSyT0v1ZTEQYpe/RXlBVBNuCLA==" }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -6942,6 +7143,15 @@ "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz", "integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==" }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -7664,6 +7874,13 @@ "tslib": "^2.1.0" } }, + "node_modules/s.color": { + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/s.color/-/s.color-0.0.15.tgz", + "integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -7696,6 +7913,16 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/sass-formatter": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/sass-formatter/-/sass-formatter-0.7.9.tgz", + "integrity": "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "suf-log": "^2.5.3" + } + }, "node_modules/sax": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", @@ -7761,6 +7988,19 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, "node_modules/sharp": { "version": "0.32.6", "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.6.tgz", @@ -7886,6 +8126,17 @@ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==" }, + "node_modules/sodium-native": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.1.1.tgz", + "integrity": "sha512-LXkAfRd4FHtkQS4X6g+nRcVaN7mWVNepV06phIsC6+IZFvGh1voW5TNQiQp2twVaMf05gZqQjuS+uWLM6gHhNQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-gyp-build": "^4.8.0" + } + }, "node_modules/sonic-boom": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.8.0.tgz", @@ -8161,6 +8412,16 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/suf-log": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz", + "integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "s.color": "0.0.15" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -8317,6 +8578,12 @@ "node": ">=8.0" } }, + "node_modules/toml": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", + "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==", + "license": "MIT" + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -8717,6 +8984,16 @@ "resolved": "https://registry.npmjs.org/uqr/-/uqr-0.1.2.tgz", "integrity": "sha512-MJu7ypHq6QasgF5YRTjqscSzQp/W11zoUk6kvmlH+fmWEs63Y0Eib13hYFwAzagRJcVY8WVnlV+eBDUGMJ5IbA==" }, + "node_modules/urijs": { + "version": "1.19.11", + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", + "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==", + "license": "MIT" + }, + "node_modules/usdc_pool": { + "resolved": "packages/usdc_pool", + "link": true + }, "node_modules/use-sync-external-store": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", @@ -9414,7 +9691,6 @@ }, "packages/factory": { "version": "0.0.0", - "extraneous": true, "dependencies": { "@stellar/stellar-sdk": "12.1.0", "buffer": "6.0.3" @@ -9437,7 +9713,6 @@ }, "packages/loan_pool": { "version": "0.0.0", - "extraneous": true, "dependencies": { "@stellar/stellar-sdk": "12.1.0", "buffer": "6.0.3" @@ -9556,7 +9831,6 @@ }, "packages/usdc_pool": { "version": "0.0.0", - "extraneous": true, "dependencies": { "@stellar/stellar-sdk": "12.1.0", "buffer": "6.0.3" diff --git a/package.json b/package.json index 72ed66b1..faa34b25 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,11 @@ "typescript": "^5.3.3" }, "devDependencies": { + "@biomejs/biome": "1.8.3", "@vitejs/plugin-basic-ssl": "^1.1.0", - "dotenv": "^16.4.1" + "dotenv": "^16.4.1", + "prettier": "^3.3.3", + "prettier-plugin-astro": "^0.14.1" }, "name": "sorobanathon", "scripts": { @@ -27,8 +30,9 @@ "preview": "astro preview", "start": "npm run init && astro dev", "continue": "astro dev", - "lint": "npx @biomejs/biome check --write ./src", - "format": "npx @biomejs/biome format --write ./src" + "lint": "biome check --write ./src", + "format": "prettier --write ./src", + "prettier:check": "prettier --check ./src" }, "type": "module", "version": "0.0.1", diff --git a/src/components/Card.astro b/src/components/Card.astro index bd6d5971..4924058d 100644 --- a/src/components/Card.astro +++ b/src/components/Card.astro @@ -1,61 +1,61 @@ --- interface Props { - title: string; - body: string; - href: string; + title: string; + body: string; + href: string; } const { href, title, body } = Astro.props; --- diff --git a/src/components/ConnectFreighter.astro b/src/components/ConnectFreighter.astro index 07903823..3f244f15 100644 --- a/src/components/ConnectFreighter.astro +++ b/src/components/ConnectFreighter.astro @@ -1,52 +1,52 @@
-
- -
+
+
- - - - \ No newline at end of file + await setLoggedIn(publicKey); + }); + } + diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index 8e17f42a..248f7e47 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -1,24 +1,24 @@ -import logo from "/public/laina_v3_shrinked.png"; +import logo from '/public/laina_v3_shrinked.png'; export default function Nav() { - return ( - + ); } diff --git a/src/components/borrowing.astro b/src/components/borrowing.astro index f47f2011..6e99715d 100644 --- a/src/components/borrowing.astro +++ b/src/components/borrowing.astro @@ -1,195 +1,190 @@
-

Borrow Assets

+

Borrow Assets

+
+ +
+
+ Stellar lumens logo +
+ +
+ Stellar Lumens +

XLM

+
+ +
+

Total available

+ ??? +

$30.82

+
+ +
+

Borrow APY

+ 1.45%
- -
-
- Stellar lumens logo -
- -
- Stellar Lumens -

XLM

-
- -
-

Total available

- ??? -

$30.82

-
- -
-

Borrow APY

- 1.45% -
- - - + + +
+ +
+
+ USD Coin logo +
+
+ USD Coin +

USDC

- -
-
- USD Coin logo -
-
- USD Coin -

USDC

-
- -
-

Total available

- 5.82M -

$5.82M

-
- -
-

Borrow APY

- 12.34% -
- - - + +
+

Total available

+ 5.82M +

$5.82M

- - - - - \ No newline at end of file + +
+

Borrow APY

+ 12.34% +
+ + +
+ + + + diff --git a/src/components/lending.astro b/src/components/lending.astro index d5ba851f..96740ee3 100644 --- a/src/components/lending.astro +++ b/src/components/lending.astro @@ -2,9 +2,9 @@

Lend Assets

-
+
- Stellar lumens logo + Stellar lumens logo
@@ -13,24 +13,23 @@
-

Total supplied

+

Total supplied

???

$30.82

-

Supply APY

+

Supply APY

1.45%
- + -
- USD Coin logo + USD Coin logo
USD Coin @@ -38,252 +37,251 @@
-

Total supplied

+

Total supplied

???

$5.82M

-

Supply APY

+

Supply APY

12.34%
- + -
+ // Ensure that getPublicKey and signTransaction are defined and available + // Call the async function + withdrawFromLoanPool(); + + xlm_button_withdraw!.disabled = false; + xlm_button_withdraw!.classList.remove('loading'); + }); + + usdc_button_deposit.addEventListener('click', async () => { + usdc_button_deposit.disabled = true; + usdc_button_deposit.classList.add('loading'); + + // Ensure that getPublicKey and signTransaction are defined and available + // Call the async function + depositToUsdcPool(); + + usdc_button_deposit.disabled = false; + usdc_button_deposit.classList.remove('loading'); + }); + + usdc_button_withdraw.addEventListener('click', async () => { + usdc_button_withdraw.disabled = true; + usdc_button_withdraw.classList.add('loading'); + + // Ensure that getPublicKey and signTransaction are defined and available + // Call the async function + withdrawFromUsdcPool(); + + usdc_button_withdraw.disabled = false; + usdc_button_withdraw.classList.remove('loading'); + }); + diff --git a/src/contracts/util.ts b/src/contracts/util.ts index b2ac8083..09c2ba57 100644 --- a/src/contracts/util.ts +++ b/src/contracts/util.ts @@ -1,5 +1,3 @@ -export const rpcUrl = - import.meta.env.PUBLIC_SOROBAN_RPC_URL ?? "http://localhost:8000/rpc"; +export const rpcUrl = import.meta.env.PUBLIC_SOROBAN_RPC_URL ?? 'http://localhost:8000/rpc'; export const networkPassphrase = - import.meta.env.PUBLIC_SOROBAN_NETWORK_PASSPHRASE ?? - "Standalone Network ; February 2017"; + import.meta.env.PUBLIC_SOROBAN_NETWORK_PASSPHRASE ?? 'Standalone Network ; February 2017'; diff --git a/src/env.d.ts b/src/env.d.ts index c4c60ab4..d617e091 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1,7 +1,7 @@ /// interface ImportMetaEnv { - readonly SOROBAN_NETWORK_PASSPHRASE: string; - readonly SOROBAN_RPC_URL: string; - readonly SOROBAN_SOURCE_ACCOUNT: string; + readonly SOROBAN_NETWORK_PASSPHRASE: string; + readonly SOROBAN_RPC_URL: string; + readonly SOROBAN_SOURCE_ACCOUNT: string; } diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index b13a66ff..bbcf34d4 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -1,26 +1,26 @@ --- interface Props { - title: string; + title: string; } const { title } = Astro.props; -import Nav from "../components/Nav"; +import Nav from '../components/Nav'; --- - - - - - - - {title} - - + + + + + + + {title} + +