Skip to content

Commit

Permalink
🚸 Store arweave payment tx hash in local state
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Oct 26, 2023
1 parent 566e913 commit 75a02fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/IscnRegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ export default class IscnRegisterForm extends Vue {
authorName: string = ''
authorUrl: string[] = []
authorWalletAddress: string[] = []
arweavePaymentTransactionHash: string = ''
uploadStatus: string = ''
uploadIpfsHash: string = this.ipfsHash || ''
uploadArweaveId: string = this.arweaveId || ''
Expand Down Expand Up @@ -1364,13 +1365,15 @@ export default class IscnRegisterForm extends Vue {
async sendArweaveFeeTx(): Promise<string> {
logTrackerEvent(this, 'ISCNCreate', 'SendArFeeTx', '', 1);
if (this.arweavePaymentTransactionHash) return this.arweavePaymentTransactionHash;
await this.initIfNecessary()
if (!this.signer) throw new Error('SIGNER_NOT_INITED');
if (!this.arweaveFeeTargetAddress) throw new Error('TARGET_ADDRESS_NOT_SET');
this.uploadStatus = 'signing';
const memo = JSON.stringify({ ipfs: this.ipfsHash, fileSize: this.fileByteSize });
try {
const { transactionHash } = await sendLIKE(this.address, this.arweaveFeeTargetAddress, this.arweaveFee.toFixed(), this.signer, memo);
if (transactionHash) this.arweavePaymentTransactionHash = transactionHash;
return transactionHash;
} catch (err) {
this.signDialogError = (err as Error).toString()
Expand All @@ -1389,7 +1392,10 @@ export default class IscnRegisterForm extends Vue {
if (!this.fileBlob) return;
this.isOpenSignDialog = true;
this.onOpenKeplr();
const transactionHash = await this.sendArweaveFeeTx();
let transactionHash = this.arweavePaymentTransactionHash
if (!transactionHash) {
transactionHash = await this.sendArweaveFeeTx();
}
// Register Numbers Protocol assets along with Arweave
if (this.isRegisterNumbersProtocolAsset) {
Expand Down

0 comments on commit 75a02fa

Please sign in to comment.