commit db5125314c1a0e59c749ea01a3784f89b7dc291a Author: Matthew Raymer Date: Fri Jun 30 19:27:52 2023 +0800 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e4e5f6c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ae76eef --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# endorser-types \ No newline at end of file diff --git a/endorser.d.ts b/endorser.d.ts new file mode 100644 index 0000000..24b167f --- /dev/null +++ b/endorser.d.ts @@ -0,0 +1,57 @@ + +export interface AgreeVerifiableCredential { + "@context": string; + "@type": string; + // "any" because arbitrary objects can be subject of agreement + // eslint-disable-next-line @typescript-eslint/no-explicit-any + object: Record; +} + +export interface ClaimResult { + success: { claimId: string; handleId: string }; + error: { code: string; message: string }; +} + +export interface GenericClaim { + "@context": string; + "@type": string; + issuedAt: string; + // "any" because arbitrary objects can be subject of agreement + // eslint-disable-next-line @typescript-eslint/no-explicit-any + claim: Record; +} + +export interface GiveServerRecord { + agentDid: string; + amount: number; + amountConfirmed: number; + description: string; + fullClaim: GiveVerifiableCredential; + handleId: string; + issuedAt: string; + recipientDid: string; + unit: string; +} + +export interface GiveVerifiableCredential { + "@context"?: string; // optional when embedded, eg. in an Agree + "@type": string; + agent?: { identifier: string }; + description?: string; + identifier?: string; + object?: { amountOfThisGood: number; unitCode: string }; + recipient: { identifier: string }; +} + +export interface RegisterVerifiableCredential { + "@context": string; + "@type": string; + agent: { identifier: string }; + object: string; + recipient: { identifier: string }; +} + +export interface InternalError { + error: string; // for system logging + userMessage?: string; // for user display +}