Skip to content

Commit

Permalink
🔀 Merge master into deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Feb 17, 2024
2 parents bda7fed + ac2ba71 commit 3b21001
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 37 deletions.
2 changes: 1 addition & 1 deletion components/EditableForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import { Vue, Component, Prop } from 'vue-property-decorator'
import logTrackerEvent from '~/utils/logger'
@Component
export default class UploadForm extends Vue {
export default class EditableForm extends Vue {
@Prop(Number) readonly step: number | undefined
@Prop(String) readonly placeholder: string | undefined
@Prop({ default: 256 }) readonly maxLength: number | undefined
Expand Down
2 changes: 1 addition & 1 deletion components/IconCoin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { Vue, Component, Prop } from 'vue-property-decorator'
@Component
export default class FormField extends Vue {
export default class IconCoin extends Vue {
// Type of the coin
@Prop(String) readonly type!: string | undefined
}
Expand Down
24 changes: 9 additions & 15 deletions components/IscnRegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1140,25 +1140,19 @@ export default class IscnRegisterForm extends Vue {
}
async fetchUserInfoByAddress(address: any) {
let userData: any = null;
try {
const { data } = await this.$axios.get(getUserInfoMinByAddress(address))
return {
name: data?.displayName || address,
wallet: [{ content: address, id: 1, type: 'like', isOpenOptions: false }],
url: [],
likerId: data?.user || '',
authorDescription: data?.description || 'Publisher',
}
({ data: userData } = await this.$axios.get(getUserInfoMinByAddress(address)))
} catch (error) {
// eslint-disable-next-line no-console
console.error(error)
return {
name: address,
wallet: [{ content: address, id: 1, type: 'like', isOpenOptions: false }],
url: [],
likerId: '',
authorDescription: 'Publisher',
}
}
return {
name: userData?.displayName || address,
wallet: [{ content: address, id: 1, type: 'like', isOpenOptions: false }],
url: [],
likerId: userData?.user || '',
authorDescription: userData?.description || 'Publisher',
}
}
Expand Down
36 changes: 18 additions & 18 deletions components/IscnUploadForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const MODE = {
}
@Component
export default class UploadForm extends Vue {
export default class IscnUploadForm extends Vue {
@Prop(Number) readonly step: number | undefined
@Prop({ default: MODE.REGISTER }) readonly mode: string | undefined
Expand Down Expand Up @@ -524,7 +524,7 @@ export default class UploadForm extends Vue {
Hash.of(Buffer.from(fileBytes)),
])
epubMetadata.ipfsHash = ipfsHash
epubMetadata.thumbnailIpfsHash = ipfsHash
const fileRecord: any = {
fileName: coverFile.name,
Expand Down Expand Up @@ -590,7 +590,7 @@ export default class UploadForm extends Vue {
const deletedFile = this.fileRecords[index];
this.fileRecords.splice(index, 1);
const indexToDelete = this.epubMetadataList.findIndex(item => item.ipfsHash === deletedFile.ipfsHashList);
const indexToDelete = this.epubMetadataList.findIndex(item => item.thumbnailIpfsHash === deletedFile.ipfsHashList);
if (indexToDelete !== -1) {
this.epubMetadataList.splice(indexToDelete, 1);
}
Expand Down Expand Up @@ -635,9 +635,9 @@ export default class UploadForm extends Vue {
}
if (arweaveId) {
this.sentArweaveTransactionInfo.set(ipfsHash, { transactionHash: '', arweaveId });
const metadata = this.epubMetadataList.find((data: any) => data.ipfsHash === ipfsHash)
const metadata = this.epubMetadataList.find((data: any) => data.thumbnailIpfsHash === ipfsHash)
if (metadata) {
metadata.thumbnailUrl = arweaveId;
metadata.thumbnailArweaveId = arweaveId;
}
}
if (!this.arweaveFeeTargetAddress) {
Expand All @@ -654,10 +654,10 @@ export default class UploadForm extends Vue {
}
}
async sendArweaveFeeTx(records: any): Promise<string> {
async sendArweaveFeeTx(record: any): Promise<string> {
logTrackerEvent(this, 'ISCNCreate', 'SendArFeeTx', '', 1);
if (this.sentArweaveTransactionInfo.has(records.ipfsHash)) {
const transactionInfo = this.sentArweaveTransactionInfo.get(records.ipfsHash);
if (this.sentArweaveTransactionInfo.has(record.ipfsHash)) {
const transactionInfo = this.sentArweaveTransactionInfo.get(record.ipfsHash);
if (transactionInfo && transactionInfo.transactionHash) {
return transactionInfo.transactionHash;
}
Expand All @@ -667,12 +667,12 @@ export default class UploadForm extends Vue {
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: records.ipfsHash, fileSize: records.fileBlob?.size || 0 });
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);
if (transactionHash) {
const existingData = this.sentArweaveTransactionInfo.get(records.ipfsHash) || {};
this.sentArweaveTransactionInfo.set(records.ipfsHash, { ...existingData, transactionHash });
const existingData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {};
this.sentArweaveTransactionInfo.set(record.ipfsHash, { ...existingData, transactionHash });
return transactionHash;
}
Expand All @@ -687,11 +687,11 @@ export default class UploadForm extends Vue {
return '';
}
async submitToArweave(records: any): Promise<void> {
const existingData = this.sentArweaveTransactionInfo.get(records.ipfsHash) || {};
async submitToArweave(record: any): Promise<void> {
const existingData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {};
const { transactionHash, arweaveId: uploadArweaveId } = existingData;
if (uploadArweaveId) return
const tempRecord = {...records}
const tempRecord = {...record}
logTrackerEvent(this, 'ISCNCreate', 'SubmitToArweave', '', 1);
if (!tempRecord.fileBlob) return;
this.isOpenSignDialog = true;
Expand All @@ -715,12 +715,12 @@ export default class UploadForm extends Vue {
txHash: tempRecord.transactionHash,
});
if (arweaveId) {
const uploadedData = this.sentArweaveTransactionInfo.get(records.ipfsHash) || {};
this.sentArweaveTransactionInfo.set(records.ipfsHash, { ...uploadedData, arweaveId });
const uploadedData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {};
this.sentArweaveTransactionInfo.set(record.ipfsHash, { ...uploadedData, arweaveId });
if (tempRecord.fileName.includes('cover.jpeg')) {
const metadata = this.epubMetadataList.find((file: any) => file.ipfsHash === records.ipfsHash)
const metadata = this.epubMetadataList.find((file: any) => file.thumbnailIpfsHash === record.ipfsHash)
if (metadata) {
metadata.thumbnailUrl = arweaveId
metadata.thumbnailArweaveId = arweaveId
}
}
this.$emit('arweaveUploaded', { arweaveId })
Expand Down
2 changes: 1 addition & 1 deletion components/NFTMint/Process.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export enum MintState {
@Component({
filters: { ellipsis }})
export default class UploadForm extends Vue {
export default class NFTMintProcess extends Vue {
@walletModule.Getter('getType') walletType!: string | null
@Prop(String) readonly iscnId!: string
Expand Down
2 changes: 1 addition & 1 deletion pages/nft/iscn/_iscnId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export enum MintState {
},
layout: 'wallet',
})
export default class NFTTestMintPage extends Vue {
export default class NFTMintPage extends Vue {
@iscnModule.Getter getISCNById!: (arg0: string) => ISCNRecordWithID
@iscnModule.Action fetchISCNById!: (arg0: string) => Promise<{
records: ISCNRecordWithID[]
Expand Down

0 comments on commit 3b21001

Please sign in to comment.