diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index ac38b77..0000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Deploy FrontEnd - -on: - push: - branches: [ main, develop ] - -jobs: - deploy-staging: - if: github.ref == 'refs/heads/develop' - runs-on: ubuntu-latest - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_STAGING }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STAGING }} - ENV_VARIABLE: ${{ secrets.ENV_STAGING }} - - steps: - - name: π Setup repo - uses: actions/checkout@v3 - - - name: π Config .env - run: echo "$ENV_VARIABLE" > .env - - - name: π Install Vercel CLI - run: npm install --global vercel@latest - - - name: π Pull staging app from vercel environment - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: π¦ Build staging app artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: π¦ Deploy staging app artifacts to vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - deploy-production: - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - ENV_VARIABLE: ${{ secrets.ENV_PROD }} - - steps: - - name: π Setup repo - uses: actions/checkout@v3 - - - name: π Config .env - run: echo "$ENV_VARIABLE" > .env - - - name: π Install Vercel CLI - run: npm install --global vercel@latest - - - name: π Pull production vercel environment - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: π¦ Build app artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: π¦ Deploy app artifacts to vercel in production - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 01b910c..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: CI script - -on: - push: - branches: [ main, develop ] - pull_request: - branches: [ main, develop ] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: π Setup repo - uses: actions/checkout@v3 - - - name: π Setup node - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: 'yarn' - - - name: π Install dependencies - run: yarn - - - name: π¦ Lint with eslint - run: yarn lint - - build: - runs-on: ubuntu-latest - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_STAGING }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STAGING }} - steps: - - name: π Setup repo - uses: actions/checkout@v3 - - - name: π Install Vercel CLI - run: npm install --global vercel@latest - - - name: π Pull staging app from vercel environment - run: vercel pull --yes --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: π¦ Build staging app artifacts - run: vercel build --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - test-coverage: - name: SonarCloud - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: π Install dependencies - run: yarn - - - name: π¦ Test and coverage - run: yarn coverage - - - name: π¦ SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ipfs-release.yml b/.github/workflows/ipfs-release.yml new file mode 100644 index 0000000..fd65632 --- /dev/null +++ b/.github/workflows/ipfs-release.yml @@ -0,0 +1,70 @@ +name: Deploy to IPFS + +on: + push: + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install dependencies + run: npm ci + + - name: Build SPA + run: npm run build-only + + - name: Deploy via RSYNC + uses: up9cloud/action-rsync@master + env: + USER: ${{secrets.SSH_USER}} + HOST: ${{secrets.SSH_HOST}} + KEY: ${{secrets.SSH_KEY}} + SOURCE: dist/ + TARGET: ${{ gitea.ref_name }} + + - name: Deploy to IPFS + uses: ipshipyard/ipfs-deploy-action@v1 + id: deploy + with: + path-to-deploy: dist + set-github-status: false + set-pr-comment: false + kubo-api-url: ${{ secrets.KUBO_API_URL }} + kubo-api-auth: ${{ secrets.KUBO_API_AUTH }} + upload-car-artifact: false + + - name: Install Pinata CLI + if: secrets.PINATA_JWT != '' + shell: bash + run: curl -fsSL https://cli.pinata.cloud/install | bash + + - name: Authenticate Pinata CLI (write JWT to file) + if: secrets.PINATA_JWT != '' + env: + PINATA_JWT: ${{ secrets.PINATA_JWT }} + run: | + echo -n "$PINATA_JWT" > ~/.pinata-files-cli + + - name: Upload build output to Pinata + if: secrets.PINATA_JWT != '' + id: pinata_upload + run: | + export PATH="$HOME/.local/share/pinata/:$PATH" + VERSION=$(jq -r .version package.json) + UPLOAD_JSON=$(pinata upload --group "${{ secrets.PINATA_GROUP }}" --name "p2pix_${VERSION}" ./dist) + CID=$(echo "$UPLOAD_JSON" | jq -r .cid) + if [ -z "$CID" ] || [ "$CID" = "null" ]; then + echo "Error: Could not parse CID from Pinata upload output. Aborting." + echo "Upload output: $UPLOAD_JSON" + exit 1 + fi + echo "CID=$CID" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c122daf --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "p2pix-smart-contracts"] + path = p2pix-smart-contracts + url = https://git.p2pix.co/doiim/p2pix-smart-contracts diff --git a/package-lock.json b/package-lock.json index d59a94e..81b5971 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "p2pix-front-end", - "version": "0.1.0", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "p2pix-front-end", - "version": "0.1.0", + "version": "1.2.0", "dependencies": { "@floating-ui/vue": "^0.2.1", "@headlessui/vue": "^1.7.3", diff --git a/package.json b/package.json index 646d1ac..3c2ae62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p2pix-front-end", - "version": "1.1.0", + "version": "1.2.0", "scripts": { "start": "vite --host=0.0.0.0 --port 3000", "build": "run-p type-check build-only", diff --git a/src/App.vue b/src/App.vue index 3912542..763b817 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,7 +15,7 @@ const targetNetwork = ref(DEFAULT_NETWORK); const web3Onboard = init({ wallets: [injected], chains: Object.values(Networks).map((network) => ({ - id: network.id, + id: `0x${network.id.toString(16)}`, token: network.nativeCurrency.symbol, label: network.name, rpcUrl: network.rpcUrls.default.http[0], diff --git a/src/blockchain/events.ts b/src/blockchain/events.ts index c5c910a..1886533 100644 --- a/src/blockchain/events.ts +++ b/src/blockchain/events.ts @@ -94,6 +94,10 @@ const getValidDeposits = async ( // remove doubles from sellers list const depositData = await depositLogs.json(); + if (!depositData.data) { + console.error("Error fetching deposit logs"); + return []; + } const depositAddeds = depositData.data.depositAddeds; const uniqueSellers = depositAddeds.reduce( (acc: Record
, deposit: any) => { diff --git a/src/components/BuyerSteps/BuyerSearchComponent.vue b/src/components/BuyerSteps/BuyerSearchComponent.vue index 12cad5f..06d86bc 100644 --- a/src/components/BuyerSteps/BuyerSearchComponent.vue +++ b/src/components/BuyerSteps/BuyerSearchComponent.vue @@ -11,6 +11,9 @@ import { getTokenImage, getNetworkImage } from "@/utils/imagesPath"; import { onClickOutside } from "@vueuse/core"; import { Networks } from "@/config/networks"; import { TokenEnum } from "@/model/NetworkEnum"; +import { getContract } from "@/blockchain/provider"; +import { reputationAbi } from "@/blockchain/abi"; +import { type Address } from "viem"; // Store reference const user = useUser(); @@ -34,6 +37,8 @@ const hasLiquidity = ref