mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
fix simulation
This commit is contained in:
parent
645bf1ecbf
commit
41597bc02f
|
@ -28,15 +28,19 @@ export function useDSA() {
|
|||
}
|
||||
});
|
||||
|
||||
watch(dsa, async () => {
|
||||
if (dsa.value) {
|
||||
accounts.value = await dsa.value.getAccounts();
|
||||
const refreshAccounts = async () => {
|
||||
accounts.value = await dsa.value.getAccounts(account.value);
|
||||
|
||||
if (accounts.value.length > 0) {
|
||||
activeAccount.value = accounts.value[0];
|
||||
} else {
|
||||
activeAccount.value = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
watch(dsa, async () => {
|
||||
if (dsa.value) {
|
||||
refreshAccounts()
|
||||
}
|
||||
//@ts-ignore
|
||||
window.dsa = dsa.value;
|
||||
|
@ -161,6 +165,7 @@ export function useDSA() {
|
|||
|
||||
return {
|
||||
dsa,
|
||||
refreshAccounts,
|
||||
activeAccount: readonly(activeAccount),
|
||||
accounts,
|
||||
createAccount,
|
||||
|
|
|
@ -9,7 +9,7 @@ const forkId = ref(null);
|
|||
export function useTenderly() {
|
||||
const { $config } = useContext();
|
||||
const { setWeb3, refreshWeb3 } = useWeb3();
|
||||
const { accounts } = useDSA();
|
||||
const { accounts, refreshAccounts } = useDSA();
|
||||
const canSimulate = computed(
|
||||
() => $config.TENDERLY_FORK_PATH && $config.TENDERLY_KEY
|
||||
);
|
||||
|
@ -40,12 +40,13 @@ export function useTenderly() {
|
|||
})
|
||||
});
|
||||
|
||||
setForkId(data?.simulation_fork?.id);
|
||||
await setForkId(data?.simulation_fork?.id);
|
||||
if (data?.simulation_fork?.id) {
|
||||
addBalance();
|
||||
await addBalance();
|
||||
await refreshAccounts();
|
||||
}
|
||||
} catch (error) {
|
||||
stopSimulation();
|
||||
await stopSimulation();
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
|
@ -65,7 +66,7 @@ export function useTenderly() {
|
|||
|
||||
forkId.value = null;
|
||||
window.localStorage.removeItem("forkId");
|
||||
refreshWeb3();
|
||||
await refreshWeb3();
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user