Skip to content

Commit 596edb3

Browse files
feat: add bulkOnly parameter to fetchMyContacts and fetchUserContacts
- Add bulkOnly optional parameter to filter contacts with bulk access - Pass bulkOnly parameter to fetchDatasetOrderbook calls - Support filtering orders by bulk access capability - Default value is false (returns all contacts)
1 parent 7a20180 commit 596edb3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/web3telegram/fetchMyContacts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const fetchMyContacts = async ({
1616
dappAddressOrENS = throwIfMissing(),
1717
dappWhitelistAddress = throwIfMissing(),
1818
isUserStrict = false,
19+
bulkOnly = false,
1920
}: IExecConsumer &
2021
SubgraphConsumer &
2122
DappAddressConsumer &
@@ -33,5 +34,6 @@ export const fetchMyContacts = async ({
3334
dappWhitelistAddress,
3435
userAddress,
3536
isUserStrict: vIsUserStrict,
37+
bulkOnly,
3638
});
3739
};

src/web3telegram/fetchUserContacts.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const fetchUserContacts = async ({
2727
dappWhitelistAddress = throwIfMissing(),
2828
userAddress,
2929
isUserStrict = false,
30+
bulkOnly = false,
3031
}: IExecConsumer &
3132
SubgraphConsumer &
3233
DappAddressConsumer &
@@ -48,19 +49,22 @@ export const fetchUserContacts = async ({
4849
const vIsUserStrict = booleanSchema()
4950
.label('isUserStrict')
5051
.validateSync(isUserStrict);
52+
const vBulkOnly = booleanSchema().label('bulkOnly').validateSync(bulkOnly);
5153

5254
const [dappOrders, whitelistOrders] = await Promise.all([
5355
fetchAllOrdersByApp({
5456
iexec,
5557
userAddress: vUserAddress,
5658
appAddress: vDappAddressOrENS,
5759
isUserStrict: vIsUserStrict,
60+
bulkOnly: vBulkOnly,
5861
}),
5962
fetchAllOrdersByApp({
6063
iexec,
6164
userAddress: vUserAddress,
6265
appAddress: vDappWhitelistAddress,
6366
isUserStrict: vIsUserStrict,
67+
bulkOnly: vBulkOnly,
6468
}),
6569
]);
6670
const orders = dappOrders.concat(whitelistOrders);
@@ -117,18 +121,21 @@ async function fetchAllOrdersByApp({
117121
userAddress,
118122
appAddress,
119123
isUserStrict,
124+
bulkOnly,
120125
}: {
121126
iexec: IExec;
122127
userAddress: string;
123128
appAddress: string;
124129
isUserStrict: boolean;
130+
bulkOnly?: boolean;
125131
}): Promise<PublishedDatasetorder[]> {
126132
const ordersFirstPage = iexec.orderbook.fetchDatasetOrderbook({
127133
dataset: ANY_DATASET_ADDRESS,
128134
app: appAddress,
129135
requester: userAddress,
130136
isAppStrict: true,
131137
isRequesterStrict: isUserStrict,
138+
bulkOnly,
132139
// Use maxPageSize here to avoid too many round-trips (we want everything anyway)
133140
pageSize: 1000,
134141
});

0 commit comments

Comments
 (0)