1
+ import { PublishedDatasetorder } from 'iexec/IExecOrderbookModule' ;
2
+ import { ZeroAddress } from 'ethers' ;
3
+ import { IExec } from 'iexec' ;
1
4
import { ANY_DATASET_ADDRESS } from '../config/config.js' ;
2
5
import { handleIfProtocolError , WorkflowError } from '../utils/errors.js' ;
3
6
import { autoPaginateRequest } from '../utils/paginate.js' ;
@@ -9,14 +12,13 @@ import {
9
12
isEnsTest ,
10
13
throwIfMissing ,
11
14
} from '../utils/validators.js' ;
15
+ import { Contact , FetchUserContactsParams } from './types.js' ;
12
16
import {
13
- Contact ,
14
17
DappAddressConsumer ,
15
18
DappWhitelistAddressConsumer ,
16
- FetchUserContactsParams ,
17
19
IExecConsumer ,
18
20
SubgraphConsumer ,
19
- } from './types .js' ;
21
+ } from './internalTypes .js' ;
20
22
21
23
export const fetchUserContacts = async ( {
22
24
graphQLClient = throwIfMissing ( ) ,
@@ -63,7 +65,7 @@ export const fetchUserContacts = async ({
63
65
] ) ;
64
66
65
67
const orders = dappOrders . concat ( whitelistOrders ) ;
66
- const myContacts : Contact [ ] = [ ] ;
68
+ const myContacts : Omit < Contact , 'name' > [ ] = [ ] ;
67
69
let web3DappResolvedAddress = vDappAddressOrENS ;
68
70
if ( isEnsTest ( vDappAddressOrENS ) ) {
69
71
web3DappResolvedAddress = await iexec . ens . resolveName ( vDappAddressOrENS ) ;
@@ -78,7 +80,10 @@ export const fetchUserContacts = async ({
78
80
const contact = {
79
81
address : order . order . dataset . toLowerCase ( ) ,
80
82
owner : order . signer . toLowerCase ( ) ,
83
+ remainingAccess : order . remaining ,
84
+ accessPrice : order . order . datasetprice ,
81
85
accessGrantTimestamp : order . publicationTimestamp ,
86
+ isUserStrict : order . order . requesterrestrict !== ZeroAddress ,
82
87
} ;
83
88
myContacts . push ( contact ) ;
84
89
}
@@ -102,7 +107,12 @@ async function fetchAllOrdersByApp({
102
107
userAddress,
103
108
appAddress,
104
109
isUserStrict,
105
- } ) {
110
+ } : {
111
+ iexec : IExec ;
112
+ userAddress : string ;
113
+ appAddress : string ;
114
+ isUserStrict : boolean ;
115
+ } ) : Promise < PublishedDatasetorder [ ] > {
106
116
const ordersFirstPage = iexec . orderbook . fetchDatasetOrderbook (
107
117
ANY_DATASET_ADDRESS ,
108
118
{
0 commit comments