Skip to content

Commit

Permalink
✨ Support signing author as an object
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Dec 10, 2024
1 parent 644083a commit a3e8ed9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 4 additions & 3 deletions components/IscnRegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1043,12 +1043,13 @@ export default class IscnRegisterForm extends Vue {
numbersProtocolAssetId: [...this.numbersProtocolAssetIds.values()],
fileSHA256: this.fileRecords.map((file) => file.fileSHA256),
author: this.author.name,
authorDescription: this.author.authorDescription,
authorNames: this.authorNames,
authorDescriptions: this.authorDescriptions,
authorUrls: this.authorUrls,
authorWallets: this.authorWalletAddresses,
likerIds: this.likerIds,
likerIdsAddresses: this.likerIdsAddresses,
authorDescriptions: this.authorDescriptions,
contentFingerprints: this.contentFingerprintLinks,
inLanguage: this.language,
thumbnailUrl: this.thumbnailUrl,
Expand Down Expand Up @@ -1157,7 +1158,7 @@ export default class IscnRegisterForm extends Vue {
this.name = this.epubMetadata.title || ''
this.description = this.extractText(this.epubMetadata.description)
this.author.name = this.epubMetadata.author || ''
this.author.authorDescription = 'Author'
this.author.authorDescription = ''
this.tags = this.epubMetadata.tags || []
this.thumbnailUrl = this.formatArweave(
this.epubMetadata.thumbnailArweaveId,
Expand Down Expand Up @@ -1191,7 +1192,7 @@ export default class IscnRegisterForm extends Vue {
wallet: [{ content: address, id: 1, type: 'like', isOpenOptions: false }],
url: [],
likerId: userData?.user || '',
authorDescription: userData?.description || 'Publisher',
authorDescription: userData?.description || '',
}
}
Expand Down
1 change: 1 addition & 0 deletions utils/cosmos/iscn/iscn.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ISCNRegisterPayload {
type: string;
publisher?: string,
author: string;
authorDescription?: string;
authorNames: string[];
authorUrls: string[][];
authorWallets: any[][];
Expand Down
10 changes: 8 additions & 2 deletions utils/cosmos/iscn/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ export function formatISCNTxPayload(payload: ISCNRegisterPayload): ISCNSignPaylo
arweaveId,
fileSHA256,
author,
authorDescription,
authorNames,
authorDescriptions,
authorUrls,
authorWallets,
likerIds,
likerIdsAddresses,
authorDescriptions,
numbersProtocolAssetId,
contentFingerprints: contentFingerprintsInput = [],
stakeholders: stakeholdersInput = [],
Expand Down Expand Up @@ -135,10 +136,15 @@ export function formatISCNTxPayload(payload: ISCNRegisterPayload): ISCNSignPaylo
}
}

const authorEntity = (author && authorDescription) ? {
name: author,
description: authorDescription,
} : author

return {
...data,
publisher: publisherInput,
author,
author: authorEntity,
keywords: tagsString.split(','),
usageInfo: license,
contentFingerprints: [...new Set(contentFingerprints)],
Expand Down

0 comments on commit a3e8ed9

Please sign in to comment.