Skip to content

Commit bb82fb7

Browse files
authored
filter locks - only show user's locks (#544)
1 parent ea9b244 commit bb82fb7

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/lib/use-escrow-data.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ export const useEscrowData = (): UseEscrowDataReturn => {
7373
return Promise.all(
7474
allAuthorizations.map(async (authorizations) => {
7575
const spender = authorizations.payee;
76-
const locks = await ocean.getLocks(token.address, account.address!, spender);
76+
// Contract getLocks filters payer/token with OR, so it leaks other payers' locks and
77+
// other tokens. Narrow to this user's locks for this token client-side.
78+
const allLocks = await ocean.getLocks(token.address, account.address!, spender);
79+
const locks = allLocks.filter(
80+
(lock) =>
81+
lock.payer.toLowerCase() === account.address!.toLowerCase() &&
82+
lock.token.toLowerCase() === token.address.toLowerCase()
83+
);
7784
return {
7885
tokenSymbol: token.symbol,
7986
tokenAddress: token.address,

0 commit comments

Comments
 (0)