From 290ecde14d71e84301fdbc6470e9fa7f03849671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gor=20Sternat?= Date: Mon, 5 Aug 2024 21:50:48 +0200 Subject: [PATCH 01/18] feat(package.json): adding vuex dependencie --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index eb113d9..dc24d42 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "axios": "^1.7.2", "crypto-ts": "^1.0.2", "viem": "^2.14.2", - "vue": "^3.4.21" + "vue": "^3.4.21", + "vuex": "^4.1.0" }, "devDependencies": { "@rushstack/eslint-patch": "^1.8.0", From 888d5a25d4e73d51a04e89709d60d8cde3b931d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gor=20Sternat?= Date: Mon, 5 Aug 2024 21:51:16 +0200 Subject: [PATCH 02/18] feat: remove loading page and adding vuex store --- src/main.ts | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/main.ts b/src/main.ts index 37fb68a..82541ea 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,21 +9,16 @@ import { createApp, nextTick } from 'vue' import App from './App.vue' import { createPublicClient, createWalletClient, http, custom } from 'viem' import { sepolia } from 'viem/chains' -import axios from 'axios'; +import axios from 'axios' +import store from './store' const pub_client = createPublicClient({ chain: sepolia, transport: http(), }) -const wal_client = createWalletClient({ - chain: sepolia, - transport: custom(window.ethereum!), -}) - const apiKey = import.meta.env.VITE_ALCHEMY_API_KEY const baseURL = `https://eth-sepolia.g.alchemy.com/v2/${apiKey}`; -//const axiosURL = `${baseURL}`; const ax = axios.create({ baseURL: baseURL, @@ -32,16 +27,28 @@ const ax = axios.create({ }, }); -const accounts = await wal_client.requestAddresses() -console.log(accounts) - export const pubClient = pub_client; -export const walClient = wal_client; -export const account = accounts[0]; export const x = ax; -createApp(App).mount('#app') +const app = createApp(App) +app.use(store) +app.mount('#app') nextTick().then(() => { loading.unmount() -}) \ No newline at end of file +}) + +export async function connectWallet() { + const wal_client = createWalletClient({ + chain: sepolia, + transport: custom(window.ethereum!), + }) + + const accounts = await wal_client.requestAddresses() + console.log(accounts) + + store.dispatch('addAccount', { + address: accounts[0], + walletClient: wal_client, + }) +} From 729564f5b015f25367fc4868ac8200c8abe96cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gor=20Sternat?= Date: Mon, 5 Aug 2024 21:51:58 +0200 Subject: [PATCH 03/18] refactor: component take adress from vuex store now --- src/components/main/ERC/NFT/NFT.vue | 43 +-- src/components/main/user-info/UserInfos.vue | 24 +- src/components/main/user-info/UserProfile.vue | 96 +++--- src/components/transaction/transaction.vue | 286 +++++++++--------- .../transaction/transactions_container.vue | 222 +++++++------- src/components/wallet/verticalNavbar.vue | 94 +++--- src/sendTransaction.ts | 19 +- 7 files changed, 415 insertions(+), 369 deletions(-) diff --git a/src/components/main/ERC/NFT/NFT.vue b/src/components/main/ERC/NFT/NFT.vue index 7059b02..1b092e6 100644 --- a/src/components/main/ERC/NFT/NFT.vue +++ b/src/components/main/ERC/NFT/NFT.vue @@ -1,27 +1,34 @@ From 8e81bb197b42dc4d9db4a954a57f296d4865527e Mon Sep 17 00:00:00 2001 From: Lucas Leclerc Date: Wed, 14 Aug 2024 18:41:17 +0200 Subject: [PATCH 18/18] [FIX] fix icone not found --- {src/components/icons => public/img}/question.png | Bin src/components/main/ERC/token/ButtonBalance.vue | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename {src/components/icons => public/img}/question.png (100%) diff --git a/src/components/icons/question.png b/public/img/question.png similarity index 100% rename from src/components/icons/question.png rename to public/img/question.png diff --git a/src/components/main/ERC/token/ButtonBalance.vue b/src/components/main/ERC/token/ButtonBalance.vue index 96d12ef..22e7c3a 100644 --- a/src/components/main/ERC/token/ButtonBalance.vue +++ b/src/components/main/ERC/token/ButtonBalance.vue @@ -10,7 +10,7 @@
  • - + {{ balance.name }}