add image onto give claim, then display on feel (full round-trip, baby!)

This commit is contained in:
2024-03-09 19:37:14 -07:00
parent c58f012d2c
commit e4543457e2
5 changed files with 22 additions and 12 deletions

View File

@@ -67,6 +67,7 @@ export const BLANK_GENERIC_SERVER_RECORD: GenericServerRecord = {
issuer: "",
};
// a summary record; the VC is found the fullClaim field
export interface GiveServerRecord {
agentDid: string;
amount: number;
@@ -81,6 +82,7 @@ export interface GiveServerRecord {
unit: string;
}
// a summary record; the VC is found the fullClaim field
export interface OfferServerRecord {
amount: number;
amountGiven: number;
@@ -98,13 +100,14 @@ export interface OfferServerRecord {
validThrough: string;
}
// a summary record; the VC is not currently part of this record
export interface PlanServerRecord {
agentDid?: string; // optional, if the issuer wants someone else to manage as well
description: string;
endTime?: string;
fulfillsPlanHandleId: string;
issuerDid: string;
handleId: string;
issuerDid: string;
locLat?: number;
locLon?: number;
startTime?: string;
@@ -120,6 +123,7 @@ export interface GiveVerifiableCredential {
description?: string;
fulfills?: { "@type": string; identifier?: string; lastClaimId?: string }[];
identifier?: string;
image?: string;
object?: { amountOfThisGood: number; unitCode: string };
recipient?: { identifier: string };
}
@@ -434,6 +438,7 @@ export async function createAndSubmitGive(
fulfillsProjectHandleId?: string,
fulfillsOfferHandleId?: string,
isTrade: boolean = false,
imageUrl?: string,
): Promise<CreateAndSubmitClaimResult> {
const vcClaim: GiveVerifiableCredential = {
"@context": "https://schema.org",
@@ -460,6 +465,9 @@ export async function createAndSubmitGive(
identifier: fulfillsOfferHandleId,
});
}
if (imageUrl) {
vcClaim.image = imageUrl;
}
return createAndSubmitClaim(
vcClaim as GenericServerRecord,
identity,