Skip to content

Commit

Permalink
added seperated logs for getting position info
Browse files Browse the repository at this point in the history
  • Loading branch information
mlguys committed Dec 21, 2023
1 parent 9577734 commit b1484e1
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/connectors/uniswap/uniswap.lp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,27 @@ export class UniswapLP extends UniswapLPHelper implements UniswapLPish {

async getPosition(tokenId: number): Promise<PositionInfo> {
const contract = this.getContract('nft', this.ethereum.provider);
const requests = [
contract.positions(tokenId),
this.collectFees(this.ethereum.provider, tokenId), // static call to calculate earned fees
];

const positionsPromise = contract.positions(tokenId)
.catch((error: any) => {
console.error('Error in contract.positions:', error);
// Handle or rethrow error
logger.error(`Error in contract.positions: ${error}`);
});

const collectFeesPromise = this.collectFees(this.ethereum.provider, tokenId)
.catch((error: any) => {
console.error('Error in collectFees:', error);
// Handle or rethrow error
logger.error(`Error in collectFees: ${error}`);
});

const requests = [positionsPromise, collectFeesPromise];

// const requests = [
// contract.positions(tokenId),
// this.collectFees(this.ethereum.provider, tokenId), // static call to calculate earned fees
// ];
const positionInfoReq = await Promise.allSettled(requests);
const rejected = positionInfoReq.filter(
(r) => r.status === 'rejected'
Expand Down

0 comments on commit b1484e1

Please sign in to comment.