Merge branch 'list-tokens' of https://github.com/liftlearning/P2Pix-Front-End into list-tokens
This commit is contained in:
@@ -24,18 +24,18 @@ const tokenAmount = ref<number>();
|
||||
const lockTransactionHash = ref<string>("");
|
||||
const lockId = ref<string>("");
|
||||
const loadingRelease = ref<Boolean>(false);
|
||||
const lastWalletTransactions = ref<any[] | undefined>([]);
|
||||
const lastWalletReleaseTransactions = ref<any[] | undefined>([]);
|
||||
|
||||
const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
|
||||
// finish buy screen
|
||||
console.log(selectedDeposit);
|
||||
let depositDetail;
|
||||
// depositId is BigNumber type object
|
||||
const depositId = selectedDeposit["args"]["depositID"];
|
||||
await blockchain
|
||||
.mapDeposits(depositId)
|
||||
.then((deposit) => (depositDetail = deposit));
|
||||
tokenAmount.value = tokenValue;
|
||||
pixTarget.value = depositDetail?.pixTarget;
|
||||
pixTarget.value = String(depositDetail?.pixTarget);
|
||||
|
||||
// Makes lock with deposit ID and the Amount
|
||||
if (depositDetail) {
|
||||
@@ -61,35 +61,27 @@ const releaseTransaction = async ({ e2eId }: any) => {
|
||||
|
||||
const findLockId = locksAddedList.value.find((element) => {
|
||||
if (element.transactionHash === lockTransactionHash.value) {
|
||||
lockId.value = element.args.lockID;
|
||||
lockId.value = element.args.lockID; // BigNumber type
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (findLockId) {
|
||||
console.log(
|
||||
pixTarget.value,
|
||||
String(tokenAmount.value),
|
||||
Number(e2eId),
|
||||
lockId.value
|
||||
);
|
||||
|
||||
const release = await blockchain.releaseLock(
|
||||
pixTarget.value,
|
||||
String(tokenAmount.value),
|
||||
Number(e2eId),
|
||||
lockId.value
|
||||
pixTarget.value, // String
|
||||
tokenAmount.value ?? 0, // Number
|
||||
e2eId, // String
|
||||
lockId.value // String
|
||||
);
|
||||
release.wait();
|
||||
|
||||
lastWalletTransactions.value =
|
||||
await blockchain.listTransactionByWalletAddress(
|
||||
lastWalletReleaseTransactions.value =
|
||||
await blockchain.listReleaseTransactionByWalletAddress(
|
||||
walletAddress.value.toLowerCase()
|
||||
);
|
||||
|
||||
console.log(tokenAmount);
|
||||
|
||||
await blockchain.updateWalletStatus();
|
||||
loadingRelease.value = false;
|
||||
}
|
||||
};
|
||||
@@ -115,8 +107,9 @@ const releaseTransaction = async ({ e2eId }: any) => {
|
||||
<div v-if="flowStep == Step.List">
|
||||
<ListComponent
|
||||
v-if="!loadingRelease"
|
||||
:last-wallet-release-transactions="lastWalletReleaseTransactions"
|
||||
:tokenAmount="tokenAmount"
|
||||
:last-wallet-transactions="lastWalletTransactions"
|
||||
@make-another-transaction="flowStep = Step.Search"
|
||||
/>
|
||||
<ValidationComponent
|
||||
v-if="loadingRelease"
|
||||
|
||||
@@ -15,7 +15,7 @@ const depositValue = ref<Number>();
|
||||
const depositPixKey = ref<string>("");
|
||||
|
||||
// Split tokens between wallets in wallets.json
|
||||
const splitTokens = () => {
|
||||
const splitTokens = async () => {
|
||||
blockchain.splitTokens();
|
||||
};
|
||||
|
||||
@@ -40,13 +40,15 @@ const mockDeposit = () => {
|
||||
|
||||
// Get specific deposit data by its ID
|
||||
const mapDeposit = (depositId: BigNumber) => {
|
||||
blockchain.mapDeposits(depositId);
|
||||
const deposit = blockchain.mapDeposits(depositId);
|
||||
return deposit;
|
||||
};
|
||||
|
||||
// Lock methods
|
||||
// Get specific lock data by its ID
|
||||
const mapLock = (lockId: string) => {
|
||||
blockchain.mapLocks(lockId);
|
||||
const lock = blockchain.mapLocks(lockId);
|
||||
return lock;
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user