@pafi-dev/core 0.9.4 → 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/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDoma
3
3
  export { B as BestQuote, c as BlackoutWindow, d as BurnRequest, e as ExactOutputBestQuote, f as ExactOutputQuoteResult, I as Issuer, g as PathKey, Q as QuoteResult, h as Recipient, i as RedemptionDecision, j as RedemptionDenial, k as RedemptionDenialCode, l as RedemptionPolicy, m as RedemptionPolicySource, n as RedemptionPreview, T as TokenCap } from './types-DWLZNgcw.cjs';
4
4
  export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintFeeWrapperAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.cjs';
5
5
  export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent } from './eip712/index.cjs';
6
- export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap } from './contract/index.cjs';
6
+ export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap } from './contract/index.cjs';
7
7
  import { LoginMessageParams } from './auth/index.cjs';
8
8
  export { BuildSponsorAuthParams, BuiltSponsorAuth, SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, SponsorAuthPayload, SponsorAuthVerifyResult, VerifyLoginResult, buildAndSignSponsorAuth, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, generateSponsorAuthNonce, getSponsorAuthDomainAnchor, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth } from './auth/index.cjs';
9
9
 
@@ -1968,8 +1968,17 @@ declare function getPafiWebModalAdapter(): PafiWebModalAdapter | null;
1968
1968
  */
1969
1969
  declare function openPafiWebModal(url: string, options?: ModalOpenOptions): Promise<PafiWebModalHandle>;
1970
1970
 
1971
- /** PAFI-hosted subgraph endpoint — single source of truth across all SDK packages. */
1972
- declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v2";
1971
+ /**
1972
+ * PAFI-hosted subgraph endpoint — single source of truth across all SDK packages.
1973
+ *
1974
+ * v3 (deployed 2026-05-08) indexes the v1.6 contract redeploy starting at
1975
+ * block 45683465 — IssuerRegistry/PointTokenFactory/MintingOracle/MintFeeWrapper
1976
+ * (single global wrapper instance, replaces v1.5 PAFIHook). Schema additions:
1977
+ * `MintFeeWrapper`, `MintFeeConfig`, `FeeRecipient`, `MintWithFeeEvent`,
1978
+ * `FeeDistribution`. v2 endpoint is kept live as rollback for ~1 week before
1979
+ * removal.
1980
+ */
1981
+ declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v3";
1973
1982
  /**
1974
1983
  * Fetch the Uniswap V4 pool(s) for a PAFI PointToken from the subgraph.
1975
1984
  *
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDoma
3
3
  export { B as BestQuote, c as BlackoutWindow, d as BurnRequest, e as ExactOutputBestQuote, f as ExactOutputQuoteResult, I as Issuer, g as PathKey, Q as QuoteResult, h as Recipient, i as RedemptionDecision, j as RedemptionDenial, k as RedemptionDenialCode, l as RedemptionPolicy, m as RedemptionPolicySource, n as RedemptionPreview, T as TokenCap } from './types-DWLZNgcw.js';
4
4
  export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintFeeWrapperAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.js';
5
5
  export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent } from './eip712/index.js';
6
- export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap } from './contract/index.js';
6
+ export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenCap, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap } from './contract/index.js';
7
7
  import { LoginMessageParams } from './auth/index.js';
8
8
  export { BuildSponsorAuthParams, BuiltSponsorAuth, SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, SponsorAuthPayload, SponsorAuthVerifyResult, VerifyLoginResult, buildAndSignSponsorAuth, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, generateSponsorAuthNonce, getSponsorAuthDomainAnchor, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth } from './auth/index.js';
9
9
 
@@ -1968,8 +1968,17 @@ declare function getPafiWebModalAdapter(): PafiWebModalAdapter | null;
1968
1968
  */
1969
1969
  declare function openPafiWebModal(url: string, options?: ModalOpenOptions): Promise<PafiWebModalHandle>;
1970
1970
 
1971
- /** PAFI-hosted subgraph endpoint — single source of truth across all SDK packages. */
1972
- declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v2";
1971
+ /**
1972
+ * PAFI-hosted subgraph endpoint — single source of truth across all SDK packages.
1973
+ *
1974
+ * v3 (deployed 2026-05-08) indexes the v1.6 contract redeploy starting at
1975
+ * block 45683465 — IssuerRegistry/PointTokenFactory/MintingOracle/MintFeeWrapper
1976
+ * (single global wrapper instance, replaces v1.5 PAFIHook). Schema additions:
1977
+ * `MintFeeWrapper`, `MintFeeConfig`, `FeeRecipient`, `MintWithFeeEvent`,
1978
+ * `FeeDistribution`. v2 endpoint is kept live as rollback for ~1 week before
1979
+ * removal.
1980
+ */
1981
+ declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v3";
1973
1982
  /**
1974
1983
  * Fetch the Uniswap V4 pool(s) for a PAFI PointToken from the subgraph.
1975
1984
  *
package/dist/index.js CHANGED
@@ -31,12 +31,13 @@ import {
31
31
  getPointTokenBalance,
32
32
  getPointTokenIssuer,
33
33
  getReceiverConsentNonce,
34
+ getTokenCap,
34
35
  getTokenName,
35
36
  isActiveIssuer,
36
37
  isMinter,
37
38
  issuerRegistryGetIssuerFlatAbi,
38
39
  verifyMintCap
39
- } from "./chunk-RFKS5BHE.js";
40
+ } from "./chunk-Y5EYH2SQ.js";
40
41
  import {
41
42
  issuerRegistryAbi,
42
43
  mintFeeWrapperAbi,
@@ -67,7 +68,7 @@ import {
67
68
  verifyBurnRequest,
68
69
  verifyMintRequest,
69
70
  verifyReceiverConsent
70
- } from "./chunk-XNVVZVK6.js";
71
+ } from "./chunk-HJYHGCMT.js";
71
72
  import {
72
73
  pointTokenAbi
73
74
  } from "./chunk-UCO5DXD6.js";
@@ -1008,7 +1009,7 @@ import { parseAbi as parseAbi3 } from "viem";
1008
1009
 
1009
1010
  // src/subgraph/pools.ts
1010
1011
  import { isAddress } from "viem";
1011
- var PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v2";
1012
+ var PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v3";
1012
1013
  var POOL_QUERY = `
1013
1014
  query GetPoolForPointToken($id: ID!) {
1014
1015
  pafiToken(id: $id) {
@@ -1209,15 +1210,24 @@ async function getPtPerUsdt18dec(fetchImpl, subgraphUrl, pointTokenAddress, fall
1209
1210
  const pool = json.data?.pafiToken?.pool;
1210
1211
  if (!pool) throw new Error("pafiToken or pool not found");
1211
1212
  const isPtToken0 = pool.token0.id.toLowerCase() === pointTokenAddress.toLowerCase();
1212
- const priceStr = isPtToken0 ? pool.token0Price : pool.token1Price;
1213
- if (!priceStr || Number(priceStr) <= 0) {
1214
- throw new Error(`invalid pool price from subgraph: ${priceStr}`);
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
+ }
1215
1225
  }
1216
- const raw = parseBigDecimalTo18(priceStr);
1217
- if (raw === 0n) {
1218
- throw new Error(`pool price parsed to zero: ${priceStr}`);
1226
+ const ptPerUsdt18dec = parseBigDecimalTo18(ptPerUsdtHumanStr);
1227
+ if (ptPerUsdt18dec === 0n) {
1228
+ throw new Error(`pool price parsed to zero: ${ptPerUsdtHumanStr}`);
1219
1229
  }
1220
- return 10n ** 24n / raw;
1230
+ return ptPerUsdt18dec;
1221
1231
  } catch (err) {
1222
1232
  const reason = err instanceof Error ? err.message : String(err);
1223
1233
  if (fallbackPtPriceUsdt === null) {
@@ -1651,6 +1661,7 @@ export {
1651
1661
  getIssuer as getPointTokenIssuerAddress,
1652
1662
  getReceiverConsentNonce,
1653
1663
  getSponsorAuthDomainAnchor,
1664
+ getTokenCap,
1654
1665
  getTokenName,
1655
1666
  isActiveIssuer,
1656
1667
  isDelegatedTo,