forked from trent_larson/crowd-funder-for-time-pwa
start linking gives to projects
This commit is contained in:
@@ -46,6 +46,7 @@ export interface GiveVerifiableCredential {
|
||||
"@type": string;
|
||||
agent?: { identifier: string };
|
||||
description?: string;
|
||||
fulfills?: { "@type": string; identifier: string };
|
||||
identifier?: string;
|
||||
object?: { amountOfThisGood: number; unitCode: string };
|
||||
recipient: { identifier: string };
|
||||
@@ -95,7 +96,7 @@ export function didInfo(did, identifiers, contacts) {
|
||||
|
||||
/**
|
||||
* For result, see https://endorser.ch:3000/api-docs/#/claims/post_api_v2_claim
|
||||
|
||||
*
|
||||
* @param identity
|
||||
* @param fromDid may be null
|
||||
* @param toDid
|
||||
@@ -109,7 +110,8 @@ export async function createAndSubmitGive(
|
||||
fromDid: string,
|
||||
toDid: string,
|
||||
description: string,
|
||||
hours: number
|
||||
hours: number,
|
||||
fulfillsProjectHandleId: string
|
||||
): Promise<AxiosResponse<ClaimResult> | InternalError> {
|
||||
// Make a claim
|
||||
const vcClaim: GiveVerifiableCredential = {
|
||||
@@ -126,6 +128,12 @@ export async function createAndSubmitGive(
|
||||
if (hours) {
|
||||
vcClaim.object = { amountOfThisGood: hours, unitCode: "HUR" };
|
||||
}
|
||||
if (fulfillsProjectHandleId) {
|
||||
vcClaim.fulfills = {
|
||||
"@type": "PlanAction",
|
||||
identifier: fulfillsProjectHandleId,
|
||||
};
|
||||
}
|
||||
// Make a payload for the claim
|
||||
const vcPayload = {
|
||||
vc: {
|
||||
|
||||
Reference in New Issue
Block a user