@pafi-dev/issuer 0.20.0 → 0.22.0

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/README.md CHANGED
@@ -14,20 +14,61 @@ interfaces. Don't bundle into a browser app — use
14
14
 
15
15
  ---
16
16
 
17
- ## v0.15.0Uniswap V3 migration (breaking)
18
-
19
- - `createSubgraphPoolsProvider` now returns the V3 `PoolKey` shape (`{ token0, token1, fee }`) instead of the V4 shape (`{ currency0, currency1, fee, tickSpacing, hooks }`). Pulls through from `@pafi-dev/core`.
17
+ ## v0.20.xBundler-driven gas estimate
18
+
19
+ **v0.20.0** operator fee gasUnits now come from a Pimlico bundler
20
+ estimate cached server-side at PAFI's sponsor-relayer
21
+ (`POST /v1/estimate-gas-fee`). Eliminates the hardcoded
22
+ `SCENARIO_GAS_UNITS` table at the consumer layer.
23
+
24
+ - **New**: `FeeManagerConfig.bundlerClient?: BundlerEstimatorClient`. When
25
+ set, `feeManager.estimateGasFee({ partialUserOp, scenario,
26
+ contractAddress })` fetches gas units from the wired estimator
27
+ instead of running the legacy `gasUnits × premium` math.
28
+ Backwards-compatible — omit `bundlerClient` and the legacy hardcoded
29
+ path runs.
30
+ - **New**: `createPafiEstimatorClient({ baseUrl, apiKey, issuerId })`
31
+ HTTP adapter — POSTs to PAFI sponsor-relayer's
32
+ `/v1/estimate-gas-fee`. Pimlico key never touches issuer infra; the
33
+ bundler call happens server-side at PAFI.
34
+ - **New**: `RelayService.previewMintUserOp` / `previewBurnUserOp` —
35
+ build a dummy partial UserOp (placeholder 65-byte sig, no HSM call)
36
+ for the bundler estimate. `PTClaimHandler` / `PTRedeemHandler` wire
37
+ these automatically.
38
+ - **Changed**: `DEFAULT_PREMIUM_BPS` 12_000 → 10_000 (100%, no
39
+ double-pad). PAFI sponsor-relayer applies its own 110% premium
40
+ upstream; adding another SDK-side pad would over-charge users by
41
+ ~21% vs. actual gas.
42
+ - **Changed**: `PTClaimHandler` now passes the FeeManager-computed
43
+ `feeAmount` explicitly into `RelayService.prepareMint`, so the
44
+ in-batch PT transfer matches the value returned in the response.
45
+ Pre-v0.20 the handler relied on `RelayService.resolveFee` falling
46
+ back to `quoteOperatorFeePt` (which uses the legacy 120% premium) —
47
+ causing a ~20% mismatch between displayed fee and actual transfer.
48
+
49
+ **v0.21.0** — bug fix follow-up to v0.20: closes the resolveFee
50
+ mismatch in `PTClaimHandler` (above). Strongly recommended over
51
+ v0.20.0 for any new consumer wiring.
52
+
53
+ ## v0.15.x — Uniswap V3 migration (breaking)
54
+
55
+ **v0.15.0** — initial V3 migration:
56
+ - `createSubgraphPoolsProvider` returns the Uniswap V3 `PoolKey` shape (`{ token0, token1, fee }`) — sourced from `@pafi-dev/core`. Any consumer typed against an older shape with extra fields will see compile-time type errors and must be updated.
20
57
  - New `onError?: (err: Error) => void` option — forward recoverable errors (network, GraphQL, parse) to your observability stack. Throws inside the callback are swallowed so the provider stays total.
21
58
  - `feeTier` is range-checked (uint24, < 1_000_000) before building the `PoolKey`; invalid values are skipped with a console.error + `onError` invocation.
22
- - Subgraph endpoint default → `…/pafi-subgraph-v4` (PAFI V3-fork DEX + extensions); see `@pafi-dev/core` for the constant.
59
+ - Subgraph endpoint default → `…/pafi-subgraph-v4` (the active PAFI Base-mainnet subgraph; see `@pafi-dev/core` for the constant).
23
60
  - Bumps peer-deps on `@pafi-dev/core` to `^0.13.0` (V3 types + ABIs).
24
61
 
62
+ **v0.15.1** — documentation-only cleanup: refreshed JSDoc comments in `nativePtQuoter`, `feeManager`, `relayService` to match the V3 implementation. No behavior change.
63
+
64
+ **v0.15.2** — `POINT_TOKEN_V2_ABI` → `POINT_TOKEN_ABI` rename across core+issuer (canonical name, no version suffix). Breaking export name change; the back-compat alias was removed. Requires `@pafi-dev/core` `^0.14.0`.
65
+
25
66
  ## Requirements
26
67
 
27
68
  - Node.js ≥ 18
28
69
  - TypeScript ≥ 5.0
29
70
  - `viem` ^2.0.0 (peer)
30
- - `@pafi-dev/core` ^0.13.0 (transitive — re-exported)
71
+ - `@pafi-dev/core` ^0.14.0 (transitive — re-exported)
31
72
 
32
73
  ## Installation
33
74
 
@@ -156,7 +197,7 @@ export const issuerApiAdapterProvider: Provider = {
156
197
  provide: ISSUER_API_ADAPTER,
157
198
  useFactory: (issuerService, provider, walletClient, dataSource, config) => {
158
199
  const ledger = new PostgresPointLedger(dataSource);
159
- const { issuerRegistry, batchExecutor } = getContractAddresses(8453);
200
+ const { issuerRegistry, batchExecutor, usdc } = getContractAddresses(8453);
160
201
  const chainId = config.get<number>("CHAIN_ID");
161
202
  const pointToken = config.get<`0x${string}`>("POINT_TOKEN_ADDRESS");
162
203
 
@@ -369,7 +410,7 @@ All SDK errors inherit `PafiSdkError`. Subclasses + HTTP mapping:
369
410
  ## References
370
411
 
371
412
  - Architecture: [`ARCHITECTURE.md`](../../ARCHITECTURE.md) at SDK root
372
- - Fee flow & math: [`docs/FEE_FLOW.md`](../../../docs/FEE_FLOW.md)
413
+ - Fee flow & math: see [`@pafi-dev/core` README — Operator fee quoter](../core/README.md#operator-fee-quoter)
373
414
 
374
415
  ## License
375
416