@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
|
@@ -17329,6 +17329,55 @@ const multicallAbi$1 = [{
|
|
|
17329
17329
|
}],
|
|
17330
17330
|
stateMutability: "nonpayable"
|
|
17331
17331
|
}, ...panopticErrorsAbi];
|
|
17332
|
+
const collateralTrackersByClient = new WeakMap();
|
|
17333
|
+
const readCollateralTrackers = (client, poolAddress) => {
|
|
17334
|
+
const collateralTrackersByPool = collateralTrackersByClient.get(client) ?? new Map();
|
|
17335
|
+
collateralTrackersByClient.set(client, collateralTrackersByPool);
|
|
17336
|
+
const cached = collateralTrackersByPool.get(poolAddress);
|
|
17337
|
+
if (cached) return cached;
|
|
17338
|
+
const trackers = client.multicall({
|
|
17339
|
+
contracts: [{
|
|
17340
|
+
address: poolAddress,
|
|
17341
|
+
abi: panopticPoolV2Abi,
|
|
17342
|
+
functionName: "collateralToken0"
|
|
17343
|
+
}, {
|
|
17344
|
+
address: poolAddress,
|
|
17345
|
+
abi: panopticPoolV2Abi,
|
|
17346
|
+
functionName: "collateralToken1"
|
|
17347
|
+
}],
|
|
17348
|
+
allowFailure: false
|
|
17349
|
+
});
|
|
17350
|
+
collateralTrackersByPool.set(poolAddress, trackers);
|
|
17351
|
+
trackers.catch(() => collateralTrackersByPool.delete(poolAddress));
|
|
17352
|
+
return trackers;
|
|
17353
|
+
};
|
|
17354
|
+
const readInterestOwed = async (client, poolAddress, user, blockNumber) => {
|
|
17355
|
+
try {
|
|
17356
|
+
const [tracker0, tracker1] = await readCollateralTrackers(client, poolAddress);
|
|
17357
|
+
const read = {
|
|
17358
|
+
abi: collateralTrackerV2Abi,
|
|
17359
|
+
functionName: "owedInterest",
|
|
17360
|
+
args: [user]
|
|
17361
|
+
};
|
|
17362
|
+
const [interestOwed0, interestOwed1] = await client.multicall({
|
|
17363
|
+
contracts: [{
|
|
17364
|
+
...read,
|
|
17365
|
+
address: tracker0
|
|
17366
|
+
}, {
|
|
17367
|
+
...read,
|
|
17368
|
+
address: tracker1
|
|
17369
|
+
}],
|
|
17370
|
+
allowFailure: false,
|
|
17371
|
+
blockNumber
|
|
17372
|
+
});
|
|
17373
|
+
return {
|
|
17374
|
+
interestOwed0,
|
|
17375
|
+
interestOwed1
|
|
17376
|
+
};
|
|
17377
|
+
} catch {
|
|
17378
|
+
return void 0;
|
|
17379
|
+
}
|
|
17380
|
+
};
|
|
17332
17381
|
/**
|
|
17333
17382
|
* Simulate a contract call and measure token flow using PanopticPool.multicall.
|
|
17334
17383
|
*
|
|
@@ -17394,14 +17443,14 @@ async function simulateWithTokenFlow(params) {
|
|
|
17394
17443
|
...postCallData ?? []
|
|
17395
17444
|
];
|
|
17396
17445
|
try {
|
|
17397
|
-
const { result } = await client.simulateContract({
|
|
17446
|
+
const [{ result }, interestOwed] = await Promise.all([client.simulateContract({
|
|
17398
17447
|
address: poolAddress,
|
|
17399
17448
|
abi: multicallAbi$1,
|
|
17400
17449
|
functionName: "multicall",
|
|
17401
17450
|
args: [multicallData],
|
|
17402
17451
|
account: user,
|
|
17403
17452
|
blockNumber
|
|
17404
|
-
});
|
|
17453
|
+
}), readInterestOwed(client, poolAddress, user, blockNumber)]);
|
|
17405
17454
|
const decodeAssets = (data) => {
|
|
17406
17455
|
const decoded = decodeFunctionResult({
|
|
17407
17456
|
abi: getAssetsOfAbi,
|
|
@@ -17447,7 +17496,8 @@ async function simulateWithTokenFlow(params) {
|
|
|
17447
17496
|
balanceAfter0: assetsAfter.assets0,
|
|
17448
17497
|
balanceAfter1: assetsAfter.assets1,
|
|
17449
17498
|
tickBefore,
|
|
17450
|
-
tickAfter
|
|
17499
|
+
tickAfter,
|
|
17500
|
+
...interestOwed
|
|
17451
17501
|
},
|
|
17452
17502
|
gasEstimate,
|
|
17453
17503
|
postCallResults,
|