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:
21
src/store/ether.ts
Normal file
21
src/store/ether.ts
Normal 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;
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user