add connect to ethers provider function and use pinia as ether params store

Co-authored-by: geovanne97 <geovannessaraiva97@gmail.com>
Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
RcleydsonR
2022-11-15 17:01:37 -03:00
parent a2acb72a1b
commit 91283305b9
7 changed files with 181 additions and 15 deletions

21
src/store/ether.ts Normal file
View File

@@ -0,0 +1,21 @@
import type { ethers } from "ethers";
import { defineStore } from "pinia";
export const useEtherStore = defineStore("ether", {
state: () => ({
walletAddress: "",
balance: 0,
provider: null as ethers.providers.Web3Provider | null,
}),
actions: {
setWalletAddress(walletAddress: string) {
this.walletAddress = walletAddress;
},
setBalance(balance: number) {
this.balance = balance;
},
setProvider(provider: ethers.providers.Web3Provider | null) {
this.provider = provider;
},
},
});