UNPKG

@safient/core

Version:

JavaScript SDK to manage safes and interact with Safient protocol.

81 lines (80 loc) 2.91 kB
import { DatabaseType } from "../lib/enums"; import { Connection, RegisterStatus, Safe, User, UserMeta, UserResponse, Utils, SafeLink, DecShard } from "../lib/types"; /** * * @param databaseType - Type of database to be used * @param connectionObject - Connection object of the database selected * @returns */ export declare const init: (databaseType: DatabaseType, connectionObject: Connection) => Utils; /** * * @param email - Email of the user * @returns - The status of the user if he exists or not */ export declare const checkUser: (did: string) => Promise<RegisterStatus>; /** * * @param userData - The user data that is created on the database * @returns - Database ID of the created data */ export declare const createUser: (userData: User, did: string) => Promise<UserResponse>; /** * * @param did - Did of the user * @returns - User data if it exists */ export declare const getUser: (Obj: { email?: string; did?: string; }) => Promise<User | null>; /** * * @returns - All the users on the database */ export declare const getUsers: () => Promise<UserMeta[]>; /** * * @param email - Email of the user to be queried * @returns - Users basic information */ export declare const queryUserEmail: (email: string) => Promise<UserMeta | Boolean>; /** * * @param did - DID of the user being queried * @returns - User data for that did */ export declare const queryUserDid: (did: string) => Promise<User[]>; /** * * @param creatorDID - Did of the safe creator * @param beneficiaryDID - Did of the beneficiary * @returns - Array of guardians did */ export declare const generateRandomGuardians: (creatorDID: string | any, beneficiaryDID: string | any) => Promise<User[]>; /** * * @param safeData - Safe data * @returns - Database Id of the safe data */ export declare const createSafe: (safeData: Safe) => Promise<string[]>; /** * * @param safeId - Safe id * @returns - Safe data */ export declare const getSafeData: (safeId: string) => Promise<Safe>; /** * * @param safeId - Safe id of the safe being updated * @param claimStage - Claim stage being updated * @param safeStage - Safe stage being updated * @returns - Boolean value */ export declare const updateStage: (safeId: string, claimStage: number, safeStage: number) => Promise<boolean>; export declare const createMetaData: (safientContractAddress: string, address: string) => Promise<string>; export declare const createClaimEvidenceUri: (file: any, evidenceName: string, description: string) => Promise<any>; export declare const createIpfsSafeLink: (safeData: SafeLink) => Promise<string>; export declare const updateDecShard: (did: string, safeId: string, decShard: DecShard) => Promise<boolean>; export declare const deleteDecShard: (guardianDid: string[], safeId: string) => Promise<boolean>; export declare const getDecShards: (guardianDid: string[], safeId: string) => Promise<DecShard[]>;