diff --git a/.github/workflows/app-e2e.yml b/.github/workflows/app-e2e.yml index 0e56d22699..31820cba13 100644 --- a/.github/workflows/app-e2e.yml +++ b/.github/workflows/app-e2e.yml @@ -123,14 +123,14 @@ jobs: name: allure-results path: packages/app/allure-results - - name: Upload test results to Allure reporter - if: always() - env: - ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }} - run: | - ./allurectl upload allure-results - echo "*Public report link: https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html" - echo "*Public report link will be available when the 'Allure Report' job will be succesfully executed." + # - name: Upload test results to Allure reporter + # if: always() + # env: + # ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }} + # run: | + # ./allurectl upload allure-results + # echo "*Public report link: https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html" + # echo "*Public report link will be available when the 'Allure Report' job will be succesfully executed." - if: failure() name: Save artifacts @@ -139,54 +139,54 @@ jobs: name: portal_e2e_${{ github.run_number }}_artifacts path: packages/app/tests/e2e/artifacts/* - publish: - name: Allure Report - runs-on: ubuntu-latest - permissions: - contents: write - needs: e2e - if: always() - steps: - - uses: actions/checkout@v3 - - - uses: actions/download-artifact@v2 - with: - name: allure-results - path: packages/app/allure-results - - - name: Get Allure history - uses: actions/checkout@v3 - if: always() - continue-on-error: true - with: - ref: gh-pages - path: gh-pages - - - name: Allure Report action from marketplace - uses: simple-elf/allure-report-action@v1.7 - if: always() - id: allure-report - with: - allure_results: packages/app/allure-results - gh_pages: gh-pages - allure_report: allure-report - allure_history: allure-history - keep_reports: 10 - - - name: Deploy report to Github Pages - if: always() - uses: peaceiris/actions-gh-pages@v2 - env: - PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PUBLISH_BRANCH: gh-pages - PUBLISH_DIR: allure-history - - - name: Prepare a link - run: | - echo "BASE64_SEARCH_REQUEST=$(echo '${{ env.ALLURE_SEARCH_REQUEST }}' | base64)" >> $GITHUB_ENV - - - name: Publish Allure link to GIT Summary - run: | - LINK1="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}" - LINK2="https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html" - echo "Allure [Private]($LINK1) and [Public]($LINK2) links:rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY + # publish: + # name: Allure Report + # runs-on: ubuntu-latest + # permissions: + # contents: write + # needs: e2e + # if: always() + # steps: + # - uses: actions/checkout@v3 + + # - uses: actions/download-artifact@v4 + # with: + # name: allure-results + # path: packages/app/allure-results + + # - name: Get Allure history + # uses: actions/checkout@v3 + # if: always() + # continue-on-error: true + # with: + # ref: gh-pages + # path: gh-pages + + # - name: Allure Report action from marketplace + # uses: simple-elf/allure-report-action@v1.7 + # if: always() + # id: allure-report + # with: + # allure_results: packages/app/allure-results + # gh_pages: gh-pages + # allure_report: allure-report + # allure_history: allure-history + # keep_reports: 10 + + # - name: Deploy report to Github Pages + # if: always() + # uses: peaceiris/actions-gh-pages@v2 + # env: + # PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # PUBLISH_BRANCH: gh-pages + # PUBLISH_DIR: allure-history + + # - name: Prepare a link + # run: | + # echo "BASE64_SEARCH_REQUEST=$(echo '${{ env.ALLURE_SEARCH_REQUEST }}' | base64)" >> $GITHUB_ENV + + # - name: Publish Allure link to GIT Summary + # run: | + # LINK1="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}" + # LINK2="https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html" + # echo "Allure [Private]($LINK1) and [Public]($LINK2) links:rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY diff --git a/packages/app/src/components/contract/interaction/FunctionForm.vue b/packages/app/src/components/contract/interaction/FunctionForm.vue index d2d9c13be5..e49b2aaafc 100644 --- a/packages/app/src/components/contract/interaction/FunctionForm.vue +++ b/packages/app/src/components/contract/interaction/FunctionForm.vue @@ -36,6 +36,8 @@ import { ethers } from "ethers"; import Input from "@/components/common/Input.vue"; import FunctionArrayParameter from "@/components/contract/interaction/FunctionArrayParameter.vue"; +import { PAYABLE_AMOUNT_PARAM_NAME } from "@/composables/useContractInteraction"; + import type { AbiFragment } from "@/composables/useAddress"; import { getRawFunctionType, getRequiredArrayLength, isArrayFunctionType } from "@/utils/helpers"; @@ -80,7 +82,7 @@ const inputs = computed(() => { ); if (props.abiFragment.stateMutability === "payable") { inputsArray.unshift({ - key: "value", + key: PAYABLE_AMOUNT_PARAM_NAME, type: "ether", label: "payableAmount (ether)", placeholder: "payableAmount (ether)", diff --git a/packages/app/src/composables/useContractInteraction.ts b/packages/app/src/composables/useContractInteraction.ts index d57c01e2b2..aa7a3b3306 100644 --- a/packages/app/src/composables/useContractInteraction.ts +++ b/packages/app/src/composables/useContractInteraction.ts @@ -9,6 +9,8 @@ import useContext from "@/composables/useContext"; import type { AbiFragment } from "./useAddress"; import type { WalletError } from "@matterlabs/composables"; +export const PAYABLE_AMOUNT_PARAM_NAME = "payable_function_payable_amount"; + export default (context = useContext()) => { const walletContext = { isReady: context.isReady, @@ -44,7 +46,7 @@ export default (context = useContext()) => { const contract = new ethers.Contract(address, [abiFragment], signer!); const method = contract[abiFragment.name]; const methodArguments = Object.entries(params) - .filter(([key]) => key !== "value") + .filter(([key]) => key !== PAYABLE_AMOUNT_PARAM_NAME) .map(([, inputValue]) => { if (inputValue === "true") { inputValue = true; @@ -54,8 +56,7 @@ export default (context = useContext()) => { return inputValue; }); const methodOptions = { - value: ethers.utils.parseEther((params.value as string) ?? "0"), - gasLimit: "10000000", + value: ethers.utils.parseEther((params[PAYABLE_AMOUNT_PARAM_NAME] as string) ?? "0"), }; const res = await method( ...[ diff --git a/packages/app/tests/composables/useContractInteraction.spec.ts b/packages/app/tests/composables/useContractInteraction.spec.ts index d5449d5b4b..a4cdc9bbe5 100644 --- a/packages/app/tests/composables/useContractInteraction.spec.ts +++ b/packages/app/tests/composables/useContractInteraction.spec.ts @@ -4,7 +4,7 @@ import { ethers } from "ethers"; import { useWalletMock } from "../mocks"; -import useContractInteraction from "@/composables/useContractInteraction"; +import useContractInteraction, { PAYABLE_AMOUNT_PARAM_NAME } from "@/composables/useContractInteraction"; import type { AbiFragment } from "@/composables/useAddress"; @@ -116,13 +116,13 @@ describe("useContractInteraction:", () => { stateMutability: "payable", }, { - value: "0.1", + [PAYABLE_AMOUNT_PARAM_NAME]: "0.1", address: ["0x0cc725e6ba24e7db79f62f22a7994a8ee33adc1b"], } ); expect(mock.mock.lastCall).toEqual([ ["0x0cc725e6ba24e7db79f62f22a7994a8ee33adc1b"], - { gasLimit: "10000000", value: ethers.utils.parseEther("0.1") }, + { value: ethers.utils.parseEther("0.1") }, ]); mock.mockRestore(); }); @@ -139,10 +139,10 @@ describe("useContractInteraction:", () => { stateMutability: "payable", }, { - value: "0.1", + [PAYABLE_AMOUNT_PARAM_NAME]: "0.1", } ); - expect(mock.mock.lastCall).toEqual([{ gasLimit: "10000000", value: ethers.utils.parseEther("0.1") }]); + expect(mock.mock.lastCall).toEqual([{ value: ethers.utils.parseEther("0.1") }]); mock.mockRestore(); }); it("change input to boolean type", async () => { @@ -158,11 +158,11 @@ describe("useContractInteraction:", () => { stateMutability: "payable", }, { - value: "0.1", + [PAYABLE_AMOUNT_PARAM_NAME]: "0.1", bool: "false", } ); - expect(mock.mock.lastCall).toEqual([false, { gasLimit: "10000000", value: ethers.utils.parseEther("0.1") }]); + expect(mock.mock.lastCall).toEqual([false, { value: ethers.utils.parseEther("0.1") }]); mock.mockRestore(); }); it("sets isRequestPending to true when request is pending", async () => {