From 135cea866600f90fe9cca99973ac952f13c4503d Mon Sep 17 00:00:00 2001 From: William Chong Date: Thu, 22 Feb 2024 00:37:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20total=20arweave=20fee=20wa?= =?UTF-8?q?s=20sent=20as=20per=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnUploadForm.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/IscnUploadForm.vue b/components/IscnUploadForm.vue index 5abb5400..9fac9854 100644 --- a/components/IscnUploadForm.vue +++ b/components/IscnUploadForm.vue @@ -286,6 +286,7 @@ export default class IscnUploadForm extends Vue { uploadStatus: UploadStatus = ''; arweaveFeeTargetAddress: string = '' arweaveFee = new BigNumber(0) + arweaveFeeMap: Record = {} sentArweaveTransactionInfo = new Map< string, { transactionHash?: string, arweaveId?: string } >() @@ -632,6 +633,7 @@ export default class IscnUploadForm extends Vue { const { address, arweaveId, LIKE, ipfsHash } = result; if (LIKE) { totalFee = totalFee.plus(new BigNumber(LIKE)); + this.arweaveFeeMap[ipfsHash] = LIKE; } if (arweaveId) { this.sentArweaveTransactionInfo.set(ipfsHash, { transactionHash: '', arweaveId }); @@ -666,10 +668,11 @@ export default class IscnUploadForm extends Vue { await this.initIfNecessary() if (!this.signer) throw new Error('SIGNER_NOT_INITED'); if (!this.arweaveFeeTargetAddress) throw new Error('TARGET_ADDRESS_NOT_SET'); + if (!this.arweaveFeeMap[record.ipfsHash]) throw new Error('ARWEAVE_FEE_NOT_SET'); this.uploadStatus = 'signing'; const memo = JSON.stringify({ ipfs: record.ipfsHash, fileSize: record.fileBlob?.size || 0 }); try { - const { transactionHash } = await sendLIKE(this.address, this.arweaveFeeTargetAddress, this.arweaveFee.toFixed(), this.signer, memo); + const { transactionHash } = await sendLIKE(this.address, this.arweaveFeeTargetAddress, this.arweaveFeeMap[record.ipfsHash], this.signer, memo); if (transactionHash) { const existingData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {}; this.sentArweaveTransactionInfo.set(record.ipfsHash, { ...existingData, transactionHash });