1+ import { PublishedDatasetorder } from 'iexec/IExecOrderbookModule' ;
2+ import { ZeroAddress } from 'ethers' ;
3+ import { IExec } from 'iexec' ;
14import { ANY_DATASET_ADDRESS } from '../config/config.js' ;
25import { handleIfProtocolError , WorkflowError } from '../utils/errors.js' ;
36import { autoPaginateRequest } from '../utils/paginate.js' ;
@@ -9,14 +12,13 @@ import {
912 isEnsTest ,
1013 throwIfMissing ,
1114} from '../utils/validators.js' ;
15+ import { Contact , FetchUserContactsParams } from './types.js' ;
1216import {
13- Contact ,
1417 DappAddressConsumer ,
1518 DappWhitelistAddressConsumer ,
16- FetchUserContactsParams ,
1719 IExecConsumer ,
1820 SubgraphConsumer ,
19- } from './types .js' ;
21+ } from './internalTypes .js' ;
2022
2123export const fetchUserContacts = async ( {
2224 graphQLClient = throwIfMissing ( ) ,
@@ -63,7 +65,7 @@ export const fetchUserContacts = async ({
6365 ] ) ;
6466
6567 const orders = dappOrders . concat ( whitelistOrders ) ;
66- const myContacts : Contact [ ] = [ ] ;
68+ const myContacts : Omit < Contact , 'name' > [ ] = [ ] ;
6769 let web3DappResolvedAddress = vDappAddressOrENS ;
6870 if ( isEnsTest ( vDappAddressOrENS ) ) {
6971 web3DappResolvedAddress = await iexec . ens . resolveName ( vDappAddressOrENS ) ;
@@ -78,7 +80,10 @@ export const fetchUserContacts = async ({
7880 const contact = {
7981 address : order . order . dataset . toLowerCase ( ) ,
8082 owner : order . signer . toLowerCase ( ) ,
83+ remainingAccess : order . remaining ,
84+ accessPrice : order . order . datasetprice ,
8185 accessGrantTimestamp : order . publicationTimestamp ,
86+ isUserStrict : order . order . requesterrestrict !== ZeroAddress ,
8287 } ;
8388 myContacts . push ( contact ) ;
8489 }
@@ -102,7 +107,12 @@ async function fetchAllOrdersByApp({
102107 userAddress,
103108 appAddress,
104109 isUserStrict,
105- } ) {
110+ } : {
111+ iexec : IExec ;
112+ userAddress : string ;
113+ appAddress : string ;
114+ isUserStrict : boolean ;
115+ } ) : Promise < PublishedDatasetorder [ ] > {
106116 const ordersFirstPage = iexec . orderbook . fetchDatasetOrderbook (
107117 ANY_DATASET_ADDRESS ,
108118 {
0 commit comments