Add correct etherscan url
Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
parent
3c4a629ed7
commit
bb6be691af
@ -6,12 +6,12 @@ import { getP2PixAddress } from "./addresses";
|
|||||||
import p2pix from "../utils/smart_contract_files/P2PIX.json";
|
import p2pix from "../utils/smart_contract_files/P2PIX.json";
|
||||||
|
|
||||||
import { BigNumber, ethers } from "ethers";
|
import { BigNumber, ethers } from "ethers";
|
||||||
import { formatEther, parseEther } from "ethers/lib/utils";
|
import { parseEther } from "ethers/lib/utils";
|
||||||
|
|
||||||
// Buyer Flow methods //
|
const addLock = async (
|
||||||
|
depositId: BigNumber,
|
||||||
// Make lock
|
amount: number
|
||||||
const addLock = async (depositId: BigNumber, amount: number): Promise<any> => {
|
): Promise<string> => {
|
||||||
const etherStore = useEtherStore();
|
const etherStore = useEtherStore();
|
||||||
|
|
||||||
const provider = getProvider();
|
const provider = getProvider();
|
||||||
@ -34,7 +34,6 @@ const addLock = async (depositId: BigNumber, amount: number): Promise<any> => {
|
|||||||
return t.args.lockID;
|
return t.args.lockID;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Release lock
|
|
||||||
const releaseLock = async (
|
const releaseLock = async (
|
||||||
pixKey: string,
|
pixKey: string,
|
||||||
amount: number,
|
amount: number,
|
||||||
@ -83,8 +82,6 @@ const cancelDeposit = async (depositId: BigNumber): Promise<boolean> => {
|
|||||||
const contract = new ethers.Contract(getP2PixAddress(), p2pix.abi, signer);
|
const contract = new ethers.Contract(getP2PixAddress(), p2pix.abi, signer);
|
||||||
await contract.cancelDeposit(depositId);
|
await contract.cancelDeposit(depositId);
|
||||||
|
|
||||||
// await updateWalletBalance();
|
|
||||||
// await updateValidDeposits();
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,11 +94,7 @@ const withdrawDeposit = async (depositId: BigNumber): Promise<boolean> => {
|
|||||||
const contract = new ethers.Contract(getP2PixAddress(), p2pix.abi, signer);
|
const contract = new ethers.Contract(getP2PixAddress(), p2pix.abi, signer);
|
||||||
await contract.withdraw(depositId, []);
|
await contract.withdraw(depositId, []);
|
||||||
|
|
||||||
// // await updateWalletBalance();
|
|
||||||
// await updateValidDeposits();
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Releases lock by specific ID and other additional data
|
|
||||||
|
|
||||||
export { cancelDeposit, withdrawDeposit, addLock, releaseLock };
|
export { cancelDeposit, withdrawDeposit, addLock, releaseLock };
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { NetworkEnum } from "@/model/NetworkEnum";
|
||||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||||
|
import { useEtherStore } from "@/store/ether";
|
||||||
import { formatEther } from "@ethersproject/units";
|
import { formatEther } from "@ethersproject/units";
|
||||||
import type { Event } from "ethers";
|
import type { Event } from "ethers";
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
@ -10,6 +12,8 @@ const props = defineProps<{
|
|||||||
isManageMode: boolean;
|
isManageMode: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const etherStore = useEtherStore();
|
||||||
|
|
||||||
const itemsToShow = ref<(Event | ValidDeposit)[]>([]);
|
const itemsToShow = ref<(Event | ValidDeposit)[]>([]);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
@ -23,7 +27,12 @@ const showInitialItems = (): void => {
|
|||||||
itemsToShow.value = props.walletTransactions.slice(0, 3);
|
itemsToShow.value = props.walletTransactions.slice(0, 3);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openEtherscanUrl = (url: string): void => {
|
const openEtherscanUrl = (transactionHash: string): void => {
|
||||||
|
const networkUrl =
|
||||||
|
etherStore.networkName == NetworkEnum.ethereum
|
||||||
|
? "goerli.etherscan.io"
|
||||||
|
: "mumbai.polygonscan.com";
|
||||||
|
const url = `https://${networkUrl}/tx/${transactionHash}`;
|
||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -130,11 +139,7 @@ showInitialItems();
|
|||||||
<div
|
<div
|
||||||
v-if="!props.isManageMode"
|
v-if="!props.isManageMode"
|
||||||
class="flex gap-2 cursor-pointer items-center justify-self-center"
|
class="flex gap-2 cursor-pointer items-center justify-self-center"
|
||||||
@click="
|
@click="openEtherscanUrl((item as Event)?.transactionHash)"
|
||||||
openEtherscanUrl(
|
|
||||||
`https://etherscan.io/tx/${(item as Event)?.transactionHash}`
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<span class="last-release-info">Etherscan</span>
|
<span class="last-release-info">Etherscan</span>
|
||||||
<img alt="Redirect image" src="@/assets/redirect.svg" />
|
<img alt="Redirect image" src="@/assets/redirect.svg" />
|
||||||
|
@ -24,7 +24,7 @@ const etherStore = useEtherStore();
|
|||||||
etherStore.setSellerView(false);
|
etherStore.setSellerView(false);
|
||||||
|
|
||||||
// States
|
// States
|
||||||
const { loadingLock, walletAddress, locksAddedList } = storeToRefs(etherStore);
|
const { loadingLock, walletAddress } = storeToRefs(etherStore);
|
||||||
const flowStep = ref<Step>(Step.Search);
|
const flowStep = ref<Step>(Step.Search);
|
||||||
const pixTarget = ref<string>("");
|
const pixTarget = ref<string>("");
|
||||||
const tokenAmount = ref<number>();
|
const tokenAmount = ref<number>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user