@iexec/dataprotector
Version:
This product enables users to confidentially store data–such as mail address, documents, personal information ...
104 lines (91 loc) • 2.57 kB
text/typescript
import { Address, AddressOrENS } from './commonTypes.js';
import {
CollectionSubscription,
ProtectedDataInCollection,
} from './sharingTypes.js';
/***************************************************************************
* Subgraph Types *
***************************************************************************/
// ---------------------ProtectedData Types------------------------------------
export type OneProtectedData = {
id: Address;
name: string;
owner: { id: AddressOrENS };
schema: Array<Record<'id', string>>;
creationTimestamp: number;
multiaddr: string; // hex representation. Ex: "0xa50322122038d76d7059153e707cd0951cf2ff64d17f69352a285503800c7787c3af0c63dd"
};
export type ProtectedDatasGraphQLResponse = {
protectedDatas: OneProtectedData[];
};
export type ProtectedDatasInCollectionsGraphQLResponse = {
protectedDatas: ProtectedDataInCollection[];
};
export type ProtectedDataPricingParamsGraphQLResponse = {
protectedData?: {
id: Address;
name: string;
isRentable: boolean;
isIncludedInSubscription: boolean;
isForSale: boolean;
collection?: {
subscriptionParams?: {
price: number;
duration: number;
};
};
rentalParam?: {
price: number;
duration: number;
};
};
};
// ---------------------Collection Types------------------------------------
export type GetCollectionSubscriptionsGraphQLResponse = {
collectionSubscriptions: CollectionSubscription[];
};
export type GetCollectionOwnersGraphQLResponse = {
accounts: Array<{
id: Address;
collections: Array<{
subscriptions: Array<{
subscriber: {
id: Address;
};
endDate: number;
}>;
id: string;
creationTimestamp: number;
subscriptionParams: {
price: number;
duration: number;
};
}>;
}>;
};
// ---------------------Rental Types------------------------------------
export type GetRentalsGraphQLResponse = {
rentals: Array<{
id: string;
renter: Address;
protectedData: { id: AddressOrENS; name: string };
creationTimestamp: number;
endDate: number;
rentalParams: {
price: number;
duration: number;
};
}>;
};
// ---------------------AppWhitelist Types------------------------------------
export type GetUserAddOnlyAppWhitelistGraphQLResponse = {
addOnlyAppWhitelists: Array<{
id: string;
owner: {
id: string;
};
apps: Array<{
id: string;
}>;
}>;
};