@panoptic-eng/sdk 1.0.74 → 1.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cow/index.d.ts +7 -0
- package/dist/cow/index.d.ts.map +1 -1
- package/dist/cow/index.js.map +1 -1
- package/dist/{cow-DRZqTpih.js → cow-12OtZc7G.js} +1 -1
- package/dist/index.d.ts +24 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/{irm-BwOG1LRv.js → irm-BntFNP1P.js} +2 -2
- package/dist/panoptic/v2/index.d.ts +14 -0
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +53 -3
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +14 -0
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +53 -3
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{rates-B9HaWnEM.js → rates-c9XVKm3m.js} +1 -1
- package/dist/{router-KwjvMN_z.js → router-lUA1kp8A.js} +1 -1
- package/dist/uniswap/index.d.ts +7 -0
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-DlmRqBju.js → v2-C0vQkjxc.js} +4 -4
- package/dist/{writes-CeRXSZwj.js → writes-CDTpO4OY.js} +54 -4
- package/dist/zodiac/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -17326,6 +17326,55 @@ const multicallAbi$1 = [{
|
|
|
17326
17326
|
}],
|
|
17327
17327
|
stateMutability: "nonpayable"
|
|
17328
17328
|
}, ...panopticErrorsAbi];
|
|
17329
|
+
const collateralTrackersByClient = new WeakMap();
|
|
17330
|
+
const readCollateralTrackers = (client, poolAddress) => {
|
|
17331
|
+
const collateralTrackersByPool = collateralTrackersByClient.get(client) ?? new Map();
|
|
17332
|
+
collateralTrackersByClient.set(client, collateralTrackersByPool);
|
|
17333
|
+
const cached = collateralTrackersByPool.get(poolAddress);
|
|
17334
|
+
if (cached) return cached;
|
|
17335
|
+
const trackers = client.multicall({
|
|
17336
|
+
contracts: [{
|
|
17337
|
+
address: poolAddress,
|
|
17338
|
+
abi: panopticPoolV2Abi,
|
|
17339
|
+
functionName: "collateralToken0"
|
|
17340
|
+
}, {
|
|
17341
|
+
address: poolAddress,
|
|
17342
|
+
abi: panopticPoolV2Abi,
|
|
17343
|
+
functionName: "collateralToken1"
|
|
17344
|
+
}],
|
|
17345
|
+
allowFailure: false
|
|
17346
|
+
});
|
|
17347
|
+
collateralTrackersByPool.set(poolAddress, trackers);
|
|
17348
|
+
trackers.catch(() => collateralTrackersByPool.delete(poolAddress));
|
|
17349
|
+
return trackers;
|
|
17350
|
+
};
|
|
17351
|
+
const readInterestOwed = async (client, poolAddress, user, blockNumber) => {
|
|
17352
|
+
try {
|
|
17353
|
+
const [tracker0, tracker1] = await readCollateralTrackers(client, poolAddress);
|
|
17354
|
+
const read = {
|
|
17355
|
+
abi: collateralTrackerV2Abi,
|
|
17356
|
+
functionName: "owedInterest",
|
|
17357
|
+
args: [user]
|
|
17358
|
+
};
|
|
17359
|
+
const [interestOwed0, interestOwed1] = await client.multicall({
|
|
17360
|
+
contracts: [{
|
|
17361
|
+
...read,
|
|
17362
|
+
address: tracker0
|
|
17363
|
+
}, {
|
|
17364
|
+
...read,
|
|
17365
|
+
address: tracker1
|
|
17366
|
+
}],
|
|
17367
|
+
allowFailure: false,
|
|
17368
|
+
blockNumber
|
|
17369
|
+
});
|
|
17370
|
+
return {
|
|
17371
|
+
interestOwed0,
|
|
17372
|
+
interestOwed1
|
|
17373
|
+
};
|
|
17374
|
+
} catch {
|
|
17375
|
+
return void 0;
|
|
17376
|
+
}
|
|
17377
|
+
};
|
|
17329
17378
|
/**
|
|
17330
17379
|
* Simulate a contract call and measure token flow using PanopticPool.multicall.
|
|
17331
17380
|
*
|
|
@@ -17391,14 +17440,14 @@ async function simulateWithTokenFlow(params) {
|
|
|
17391
17440
|
...postCallData ?? []
|
|
17392
17441
|
];
|
|
17393
17442
|
try {
|
|
17394
|
-
const { result } = await client.simulateContract({
|
|
17443
|
+
const [{ result }, interestOwed] = await Promise.all([client.simulateContract({
|
|
17395
17444
|
address: poolAddress,
|
|
17396
17445
|
abi: multicallAbi$1,
|
|
17397
17446
|
functionName: "multicall",
|
|
17398
17447
|
args: [multicallData],
|
|
17399
17448
|
account: user,
|
|
17400
17449
|
blockNumber
|
|
17401
|
-
});
|
|
17450
|
+
}), readInterestOwed(client, poolAddress, user, blockNumber)]);
|
|
17402
17451
|
const decodeAssets = (data) => {
|
|
17403
17452
|
const decoded = decodeFunctionResult({
|
|
17404
17453
|
abi: getAssetsOfAbi,
|
|
@@ -17444,7 +17493,8 @@ async function simulateWithTokenFlow(params) {
|
|
|
17444
17493
|
balanceAfter0: assetsAfter.assets0,
|
|
17445
17494
|
balanceAfter1: assetsAfter.assets1,
|
|
17446
17495
|
tickBefore,
|
|
17447
|
-
tickAfter
|
|
17496
|
+
tickAfter,
|
|
17497
|
+
...interestOwed
|
|
17448
17498
|
},
|
|
17449
17499
|
gasEstimate,
|
|
17450
17500
|
postCallResults,
|