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