From f5a0f8094673339eca5d39a1d588699a129de757 Mon Sep 17 00:00:00 2001 From: Jan Michek <15363559+janmichek@users.noreply.github.com> Date: Mon, 2 Sep 2024 18:37:13 +0200 Subject: [PATCH] feat: Contract read & write (#872) Co-authored-by: Michele F. Co-authored-by: Michele Franchi --- eslint.config.js => .eslintrc.js | 52 +++--- cypress.config.ts | 2 +- cypress/e2e/app/contractDetail.cy.js | 2 +- package.json | 3 +- src/assets/loader-small.svg | 67 ++++++++ src/assets/styles/main.css | 2 +- src/components/AccountDetailsPanel.vue | 3 +- src/components/AppAccordion.vue | 99 ++++++++++++ src/components/AppButton.vue | 4 +- src/components/AppDropdown.vue | 13 +- src/components/ChartControls.vue | 6 +- src/components/CodeEditor.vue | 1 - .../ContractEntrypointAccordion.vue | 89 ++++++++++ src/components/ContractReadPanel.vue | 47 ++++++ src/components/ContractWritePanel.vue | 69 ++++++++ src/components/LoaderIndicatorSmall.vue | 6 + src/components/TheHeader.vue | 2 +- ...Controls.vue => WalletAccountControls.vue} | 34 +++- src/components/WalletConnectionPanel.vue | 13 +- src/pages/contracts/[id].vue | 14 +- src/pages/wallet/index.vue | 13 +- src/plugins/sentry.js | 8 +- src/stores/aesdk.js | 4 +- src/stores/contractVerified.js | 86 +++++++++- src/stores/contracts.js | 1 - src/stores/recentBlocks.js | 50 +++--- src/stores/wallet.js | 15 +- src/utils/adapters.js | 15 ++ src/utils/format.js | 17 ++ src/utils/hints/contractVerifiedHints.js | 1 + yarn.lock | 153 +++++++++++++----- 31 files changed, 754 insertions(+), 137 deletions(-) rename eslint.config.js => .eslintrc.js (66%) create mode 100644 src/assets/loader-small.svg create mode 100644 src/components/AppAccordion.vue create mode 100644 src/components/ContractEntrypointAccordion.vue create mode 100644 src/components/ContractReadPanel.vue create mode 100644 src/components/ContractWritePanel.vue create mode 100644 src/components/LoaderIndicatorSmall.vue rename src/components/{TheWalletAccountControls.vue => WalletAccountControls.vue} (66%) diff --git a/eslint.config.js b/.eslintrc.js similarity index 66% rename from eslint.config.js rename to .eslintrc.js index 7b939dc58..213757099 100644 --- a/eslint.config.js +++ b/.eslintrc.js @@ -1,28 +1,28 @@ module.exports = { - files: ["src/*.ts", "src/*.js", "src/*.vue"], - // parser: 'vue-eslint-parser', - // parserOptions: { - // ecmaVersion: 2020, - // extraFileExtensions: ['.vue'], - // ecmaFeatures: { - // jsx: false, - // }, - // }, - // globals: { - // defineProps: 'readonly', - // defineEmits: 'readonly', - // defineExpose: 'readonly', - // withDefaults: 'readonly', - // }, - // extends: [ - // 'standard', - // 'plugin:vue/base', - // 'plugin:vue/vue3-recommended', - // 'plugin:import/recommended', - // 'eslint:recommended', - // '@nuxtjs/eslint-config-typescript', - // ], - // plugins: ['prettier'], + root: true, + parser: 'vue-eslint-parser', + parserOptions: { + ecmaVersion: 2020, + extraFileExtensions: ['.vue'], + ecmaFeatures: { + jsx: false, + }, + }, + globals: { + defineProps: 'readonly', + defineEmits: 'readonly', + defineExpose: 'readonly', + withDefaults: 'readonly', + }, + extends: [ + 'standard', + 'plugin:vue/base', + 'plugin:vue/vue3-recommended', + 'plugin:import/recommended', + 'eslint:recommended', + '@nuxtjs/eslint-config-typescript', + ], + plugins: ['prettier'], rules: { 'no-console': 'off', quotes: ['error', 'single'], @@ -64,7 +64,7 @@ module.exports = { }], 'vue/max-attributes-per-line': ['error', { singleline: 1, - multiline: {max: 1}, + multiline: { max: 1 }, }], 'vue/require-v-for-key': 'error', 'vue/no-v-html': 0, @@ -72,6 +72,6 @@ module.exports = { camelcase: ['error', { properties: 'never', }], - 'max-len': ['error', {code: 120, ignoreUrls: true, ignoreStrings: true, ignoreTemplateLiterals: true}], + 'max-len': ['error', { code: 120, ignoreUrls: true, ignoreStrings: true, ignoreTemplateLiterals: true }], }, } diff --git a/cypress.config.ts b/cypress.config.ts index 75ae8000f..f6758d7b2 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'cypress' +import {defineConfig} from 'cypress' export default defineConfig({ env: { diff --git a/cypress/e2e/app/contractDetail.cy.js b/cypress/e2e/app/contractDetail.cy.js index 4a52f8c46..adb62cb00 100644 --- a/cypress/e2e/app/contractDetail.cy.js +++ b/cypress/e2e/app/contractDetail.cy.js @@ -8,7 +8,7 @@ describe('contract detail', () => { cy.contains('.tabs__item', 'Events').click() cy.get('.contract-events-panel .paginated-content').should('be.visible') - cy.contains('.tabs__item', 'Contract').click() + cy.contains('.tabs__item', 'Verification').click() cy.get('.contract-verified-table').should('be.visible') cy.get('.code-editor').should('be.visible') }) diff --git a/package.json b/package.json index f4862c5cf..cdb15dafd 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "e2e:open": "cypress open" }, "dependencies": { - "@aeternity/aepp-sdk": "^13.3.2", + "@aeternity/aepp-sdk": "13.3.3", "@sentry/tracing": "^7.114.0", "@sentry/vite-plugin": "^2.21.1", "@sentry/vue": "^8.17.0", @@ -57,7 +57,6 @@ "devDependencies": { "@csstools/postcss-global-data": "^2.1.1", "@nuxtjs/eslint-config-typescript": "^12.1.0", - "@nuxtjs/partytown": "^1.5.0", "@nuxtjs/plausible": "^1.0.0", "@pinia/nuxt": "^0.5.1", "@vitejs/plugin-vue": "^5.0.5", diff --git a/src/assets/loader-small.svg b/src/assets/loader-small.svg new file mode 100644 index 000000000..b0ddea2de --- /dev/null +++ b/src/assets/loader-small.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/styles/main.css b/src/assets/styles/main.css index f3b5aa41b..92425cbc3 100644 --- a/src/assets/styles/main.css +++ b/src/assets/styles/main.css @@ -7,9 +7,9 @@ @import url("elements/_body.css"); @import url("elements/_dl.css"); @import url("elements/_h.css"); -@import url("elements/_input.css"); @import url("elements/_hr.css"); @import url("elements/_html.css"); +@import url("elements/_input.css"); @import url("elements/_p.css"); @import url("elements/_q.css"); @import url("elements/_table.css"); diff --git a/src/components/AccountDetailsPanel.vue b/src/components/AccountDetailsPanel.vue index 871efc6dc..f535eed8f 100644 --- a/src/components/AccountDetailsPanel.vue +++ b/src/components/AccountDetailsPanel.vue @@ -81,8 +81,7 @@ Is Generalized - + Generalized diff --git a/src/components/AppAccordion.vue b/src/components/AppAccordion.vue new file mode 100644 index 000000000..d2d49d1d1 --- /dev/null +++ b/src/components/AppAccordion.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/components/AppButton.vue b/src/components/AppButton.vue index df3169903..058e5cf1b 100644 --- a/src/components/AppButton.vue +++ b/src/components/AppButton.vue @@ -63,8 +63,8 @@ defineProps({ 'link', 'link-error', 'primary', - 'light'] - .includes(val), + 'light', + ].includes(val), }, type: { type: String, diff --git a/src/components/AppDropdown.vue b/src/components/AppDropdown.vue index 2c9aa4d6e..c1abac03b 100644 --- a/src/components/AppDropdown.vue +++ b/src/components/AppDropdown.vue @@ -1,5 +1,7 @@ + + diff --git a/src/components/ContractEntrypointAccordion.vue b/src/components/ContractEntrypointAccordion.vue new file mode 100644 index 000000000..ba97e852e --- /dev/null +++ b/src/components/ContractEntrypointAccordion.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/src/components/ContractReadPanel.vue b/src/components/ContractReadPanel.vue new file mode 100644 index 000000000..d20e3ac1d --- /dev/null +++ b/src/components/ContractReadPanel.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/components/ContractWritePanel.vue b/src/components/ContractWritePanel.vue new file mode 100644 index 000000000..def661edd --- /dev/null +++ b/src/components/ContractWritePanel.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/components/LoaderIndicatorSmall.vue b/src/components/LoaderIndicatorSmall.vue new file mode 100644 index 000000000..003b4216a --- /dev/null +++ b/src/components/LoaderIndicatorSmall.vue @@ -0,0 +1,6 @@ + diff --git a/src/components/TheHeader.vue b/src/components/TheHeader.vue index 0bbc686f1..4d367ed5a 100644 --- a/src/components/TheHeader.vue +++ b/src/components/TheHeader.vue @@ -38,7 +38,7 @@ 'header__network-select', { 'header__network-select--open': isMobileMenuOpen }]"/> - +
- + -