@pafi-dev/core 0.9.5 → 0.9.6
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/{chunk-UTG2UT54.cjs → chunk-5NEAI2BH.cjs} +1 -1
- package/dist/{chunk-UTG2UT54.cjs.map → chunk-5NEAI2BH.cjs.map} +1 -1
- package/dist/{chunk-XNVVZVK6.js → chunk-HJYHGCMT.js} +1 -1
- package/dist/{chunk-XNVVZVK6.js.map → chunk-HJYHGCMT.js.map} +1 -1
- package/dist/eip712/index.cjs +2 -2
- package/dist/eip712/index.d.cts +1 -1
- package/dist/eip712/index.d.ts +1 -1
- package/dist/eip712/index.js +1 -1
- package/dist/index.cjs +26 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
verifyBurnRequest,
|
|
69
69
|
verifyMintRequest,
|
|
70
70
|
verifyReceiverConsent
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-HJYHGCMT.js";
|
|
72
72
|
import {
|
|
73
73
|
pointTokenAbi
|
|
74
74
|
} from "./chunk-UCO5DXD6.js";
|
|
@@ -1210,15 +1210,24 @@ async function getPtPerUsdt18dec(fetchImpl, subgraphUrl, pointTokenAddress, fall
|
|
|
1210
1210
|
const pool = json.data?.pafiToken?.pool;
|
|
1211
1211
|
if (!pool) throw new Error("pafiToken or pool not found");
|
|
1212
1212
|
const isPtToken0 = pool.token0.id.toLowerCase() === pointTokenAddress.toLowerCase();
|
|
1213
|
-
|
|
1214
|
-
if (
|
|
1215
|
-
|
|
1213
|
+
let ptPerUsdtHumanStr;
|
|
1214
|
+
if (isPtToken0) {
|
|
1215
|
+
const usdtPerPtHuman = Number(pool.token0Price);
|
|
1216
|
+
if (!Number.isFinite(usdtPerPtHuman) || usdtPerPtHuman <= 0) {
|
|
1217
|
+
throw new Error(`invalid pool token0Price from subgraph: ${pool.token0Price}`);
|
|
1218
|
+
}
|
|
1219
|
+
ptPerUsdtHumanStr = (1 / usdtPerPtHuman).toFixed(18);
|
|
1220
|
+
} else {
|
|
1221
|
+
ptPerUsdtHumanStr = pool.token1Price;
|
|
1222
|
+
if (!ptPerUsdtHumanStr || Number(ptPerUsdtHumanStr) <= 0) {
|
|
1223
|
+
throw new Error(`invalid pool token1Price from subgraph: ${ptPerUsdtHumanStr}`);
|
|
1224
|
+
}
|
|
1216
1225
|
}
|
|
1217
|
-
const
|
|
1218
|
-
if (
|
|
1219
|
-
throw new Error(`pool price parsed to zero: ${
|
|
1226
|
+
const ptPerUsdt18dec = parseBigDecimalTo18(ptPerUsdtHumanStr);
|
|
1227
|
+
if (ptPerUsdt18dec === 0n) {
|
|
1228
|
+
throw new Error(`pool price parsed to zero: ${ptPerUsdtHumanStr}`);
|
|
1220
1229
|
}
|
|
1221
|
-
return
|
|
1230
|
+
return ptPerUsdt18dec;
|
|
1222
1231
|
} catch (err) {
|
|
1223
1232
|
const reason = err instanceof Error ? err.message : String(err);
|
|
1224
1233
|
if (fallbackPtPriceUsdt === null) {
|