@pafi-dev/issuer 0.5.35 → 0.5.37
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.cjs +153 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +187 -91
- package/dist/index.d.ts +187 -91
- package/dist/index.js +150 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
2
|
+
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, Eip7702AuthorizationJsonRpc, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
3
3
|
export { PAFI_SUBGRAPH_URL } from '@pafi-dev/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1847,98 +1847,17 @@ declare function handleMobileSubmit(params: HandleMobileSubmitParams): Promise<{
|
|
|
1847
1847
|
userOpHash: Hex;
|
|
1848
1848
|
}>;
|
|
1849
1849
|
|
|
1850
|
-
|
|
1851
|
-
issuerAddress: Address;
|
|
1852
|
-
signerAddress: Address;
|
|
1853
|
-
name: string;
|
|
1854
|
-
symbol: string;
|
|
1855
|
-
declaredTotalSupply: bigint;
|
|
1856
|
-
capBasisPoints: number;
|
|
1857
|
-
active: boolean;
|
|
1858
|
-
pointToken: Address;
|
|
1859
|
-
mintingOracle: Address;
|
|
1860
|
-
}
|
|
1861
|
-
interface PreValidateMintResult {
|
|
1862
|
-
/** Registry record read at pre-validation time. */
|
|
1863
|
-
issuer: IssuerRegistryRecord;
|
|
1864
|
-
/** Current on-chain PointToken.totalSupply(). */
|
|
1865
|
-
totalSupply: bigint;
|
|
1866
|
-
/** declaredTotalSupply × capBasisPoints / 10000. */
|
|
1867
|
-
hardCap: bigint;
|
|
1868
|
-
/** hardCap − totalSupply (clamped to 0). */
|
|
1869
|
-
remaining: bigint;
|
|
1870
|
-
}
|
|
1871
|
-
/**
|
|
1872
|
-
* Thrown by `IssuerStateValidator.preValidateMint()`.
|
|
1873
|
-
* `code` maps 1:1 to the HTTP error the issuer API surfaces to clients.
|
|
1874
|
-
*/
|
|
1875
|
-
declare class IssuerStateError extends Error {
|
|
1876
|
-
readonly code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED";
|
|
1877
|
-
readonly details?: Record<string, unknown> | undefined;
|
|
1878
|
-
constructor(code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED", message: string, details?: Record<string, unknown> | undefined);
|
|
1879
|
-
}
|
|
1850
|
+
type DecodedCall$2 = ReturnType<typeof decodeBatchExecuteCalls>[number];
|
|
1880
1851
|
|
|
1881
1852
|
/**
|
|
1882
|
-
*
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1886
|
-
* off-chain lets issuers fail fast with a clear error rather than
|
|
1887
|
-
* wasting gas on a revert.
|
|
1888
|
-
*
|
|
1889
|
-
* Caching:
|
|
1890
|
-
* - `PointToken.issuer()` — memoized for the process lifetime (immutable)
|
|
1891
|
-
* - Full state (registry + totalSupply) — 30s TTL per PointToken
|
|
1892
|
-
* - Burst calls while a fetch is in-flight share the same Promise
|
|
1893
|
-
* (thundering-herd protection)
|
|
1894
|
-
*
|
|
1895
|
-
* Usage in NestJS: wrap this in an `@Injectable()` service; pass
|
|
1896
|
-
* `PublicClient` and `registryAddress` from your DI container.
|
|
1853
|
+
* Structural shape — accepts both the raw `IssuerStateValidator` from
|
|
1854
|
+
* `@pafi-dev/issuer/issuer-state` and any host-framework wrapper (e.g.
|
|
1855
|
+
* a NestJS Injectable that delegates to it). Only `preValidateMint`
|
|
1856
|
+
* is needed on this surface.
|
|
1897
1857
|
*/
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
private readonly registryAddress;
|
|
1901
|
-
private readonly pointTokenIssuerCache;
|
|
1902
|
-
private readonly stateCache;
|
|
1903
|
-
private readonly inflight;
|
|
1904
|
-
constructor(provider: PublicClient, registryAddress: Address);
|
|
1905
|
-
/**
|
|
1906
|
-
* Convenience factory — reads `registryAddress` from the SDK
|
|
1907
|
-
* `CONTRACT_ADDRESSES` map for the given chain.
|
|
1908
|
-
*/
|
|
1909
|
-
static forChain(provider: PublicClient, chainId: number): IssuerStateValidator;
|
|
1910
|
-
/**
|
|
1911
|
-
* Invalidate cached state for one PointToken, or everything if omitted.
|
|
1912
|
-
* Call after admin txs that change registry or cap settings.
|
|
1913
|
-
*/
|
|
1914
|
-
invalidate(pointToken?: Address): void;
|
|
1915
|
-
/**
|
|
1916
|
-
* Resolve `PointToken.issuer()` once per token and memoize.
|
|
1917
|
-
* The issuer field is set at `initialize()` and never changes.
|
|
1918
|
-
*/
|
|
1919
|
-
getIssuerAddressForPointToken(pointToken: Address): Promise<Address>;
|
|
1920
|
-
/**
|
|
1921
|
-
* Read registry record + totalSupply, with 30s cache and in-flight
|
|
1922
|
-
* deduplication. Does NOT throw on inactive/missing — returns raw state.
|
|
1923
|
-
*/
|
|
1924
|
-
getIssuerState(pointToken: Address): Promise<PreValidateMintResult>;
|
|
1925
|
-
/**
|
|
1926
|
-
* Validate that `amount` PT can be minted on `pointToken` right now.
|
|
1927
|
-
*
|
|
1928
|
-
* Throws `IssuerStateError` with:
|
|
1929
|
-
* - `ISSUER_NOT_REGISTERED` — registry has no record for this issuer
|
|
1930
|
-
* - `ISSUER_INACTIVE` — issuer.active is false
|
|
1931
|
-
* - `MINT_CAP_EXCEEDED` — totalSupply + amount would exceed hardCap
|
|
1932
|
-
*
|
|
1933
|
-
* Returns the fetched state on success so callers can log without a
|
|
1934
|
-
* second RPC round-trip.
|
|
1935
|
-
*/
|
|
1936
|
-
preValidateMint(pointToken: Address, amount: bigint): Promise<PreValidateMintResult>;
|
|
1937
|
-
private fetchIssuerState;
|
|
1858
|
+
interface IssuerStateValidatorLike {
|
|
1859
|
+
preValidateMint(pointToken: Address, amount: bigint): Promise<unknown>;
|
|
1938
1860
|
}
|
|
1939
|
-
|
|
1940
|
-
type DecodedCall$2 = ReturnType<typeof decodeBatchExecuteCalls>[number];
|
|
1941
|
-
|
|
1942
1861
|
/**
|
|
1943
1862
|
* v1.4 sig-gated mint handler — mirrors `PTRedeemHandler` on the mint side.
|
|
1944
1863
|
*
|
|
@@ -1971,7 +1890,7 @@ interface PTClaimHandlerConfig {
|
|
|
1971
1890
|
/** Optional — when wired, used to estimate the PT gas-reimbursement fee. */
|
|
1972
1891
|
feeService?: FeeManager;
|
|
1973
1892
|
/** Optional — pre-validates issuer status + cap before locking balance. */
|
|
1974
|
-
issuerStateValidator?:
|
|
1893
|
+
issuerStateValidator?: IssuerStateValidatorLike;
|
|
1975
1894
|
/** How long the off-chain balance lock survives if the mint never lands. Default 15 min. */
|
|
1976
1895
|
lockDurationMs?: number;
|
|
1977
1896
|
/** How far ahead of `now` to set the MintRequest deadline. Default 15 min. */
|
|
@@ -2150,6 +2069,93 @@ declare class PerpDepositHandler {
|
|
|
2150
2069
|
handle(request: PerpDepositRequest): Promise<PerpDepositResponse>;
|
|
2151
2070
|
}
|
|
2152
2071
|
|
|
2072
|
+
/**
|
|
2073
|
+
* Pure mechanics for the EIP-7702 delegation submit flow. Builds the
|
|
2074
|
+
* empty-batch UserOp, attaches paymaster sponsorship, splits the user's
|
|
2075
|
+
* authorization signature into the JSON-RPC tuple, and relays via the
|
|
2076
|
+
* PAFI sponsor-relayer.
|
|
2077
|
+
*
|
|
2078
|
+
* The UserOp itself is a no-op — `BatchExecutor.execute([])` does
|
|
2079
|
+
* nothing. The work is in the `eip7702Auth` object: the bundler picks
|
|
2080
|
+
* it up, runs the EIP-7702 path, and installs the delegation on the
|
|
2081
|
+
* user's EOA atomically with the (empty) UserOp.
|
|
2082
|
+
*
|
|
2083
|
+
* Throws the same `BundlerNotConfiguredError` / `BundlerRejectedError`
|
|
2084
|
+
* as other relay paths so issuer controllers can use one error mapper.
|
|
2085
|
+
*/
|
|
2086
|
+
interface HandleDelegateSubmitParams {
|
|
2087
|
+
userAddress: Address;
|
|
2088
|
+
chainId: number;
|
|
2089
|
+
/** Account nonce read at `delegate/prepare` time and signed by the user. */
|
|
2090
|
+
delegationNonce: bigint;
|
|
2091
|
+
/** ERC-4337 account nonce. Caller fetches via EntryPoint.getNonce. */
|
|
2092
|
+
aaNonce: bigint;
|
|
2093
|
+
/** 65-byte secp256k1 signature over the EIP-7702 authorization hash. */
|
|
2094
|
+
authSig: Hex | string;
|
|
2095
|
+
/** EIP-1559 fees from `provider.estimateFeesPerGas()` (or RPC equivalent). */
|
|
2096
|
+
fees: {
|
|
2097
|
+
maxFeePerGas?: bigint;
|
|
2098
|
+
maxPriorityFeePerGas?: bigint;
|
|
2099
|
+
};
|
|
2100
|
+
pafiBackendClient?: PafiBackendClient | null;
|
|
2101
|
+
onWarning?: (msg: string) => void;
|
|
2102
|
+
/** Override gas limits for the empty-batch UserOp. */
|
|
2103
|
+
gasLimits?: {
|
|
2104
|
+
callGasLimit?: bigint;
|
|
2105
|
+
verificationGasLimit?: bigint;
|
|
2106
|
+
preVerificationGas?: bigint;
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
interface HandleDelegateSubmitResult {
|
|
2110
|
+
userOpHash: Hex;
|
|
2111
|
+
/** True when paymaster sponsorship was applied (gas is free). */
|
|
2112
|
+
isSponsored: boolean;
|
|
2113
|
+
/** The authorization tuple actually sent to the bundler. */
|
|
2114
|
+
authorization: Eip7702AuthorizationJsonRpc;
|
|
2115
|
+
}
|
|
2116
|
+
declare function handleDelegateSubmit(params: HandleDelegateSubmitParams): Promise<HandleDelegateSubmitResult>;
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Quote PT → USDT for the cashout preview screen.
|
|
2120
|
+
*
|
|
2121
|
+
* Three branches the FE needs distinct handling for:
|
|
2122
|
+
* - `pointAmount = 0` → all zeros, no RPC call.
|
|
2123
|
+
* - no pool / no path → `quoteError: 'QUOTE_UNAVAILABLE'`.
|
|
2124
|
+
* - amountOut < gas reimbursement → `quoteError: 'AMOUNT_TOO_SMALL_FOR_GAS'`.
|
|
2125
|
+
*
|
|
2126
|
+
* Returns derived `netUsdtOut`, `exchangeRate`, and a `suggestedDeadline`
|
|
2127
|
+
* so callers don't need to compute those locally.
|
|
2128
|
+
*
|
|
2129
|
+
* Replaces ~50 LoC of inline quote-handling in issuer controllers.
|
|
2130
|
+
*/
|
|
2131
|
+
interface QuotePointTokenToUsdtParams {
|
|
2132
|
+
provider: PublicClient;
|
|
2133
|
+
chainId: number;
|
|
2134
|
+
pointTokenAddress: Address;
|
|
2135
|
+
pointAmount: bigint;
|
|
2136
|
+
pools: PoolKey[];
|
|
2137
|
+
/** Operator gas-reimbursement quoted in USDT (subtracted from output). */
|
|
2138
|
+
gasFeeUsdt: bigint;
|
|
2139
|
+
/** Override deadline window; default 300 seconds. */
|
|
2140
|
+
deadlineSeconds?: number;
|
|
2141
|
+
now?: () => number;
|
|
2142
|
+
}
|
|
2143
|
+
interface QuotePointTokenToUsdtResult {
|
|
2144
|
+
/** Raw V4 quote on the full point amount, before gas deduction. */
|
|
2145
|
+
estimatedUsdtOut: bigint;
|
|
2146
|
+
/** `estimatedUsdtOut - gasFeeUsdt`, clamped to 0. */
|
|
2147
|
+
netUsdtOut: bigint;
|
|
2148
|
+
/** USDT per 1.0 PT (1e18 raw units), formatted to 8 decimal places. */
|
|
2149
|
+
exchangeRate: string;
|
|
2150
|
+
/** V4 Quoter's gas estimate for the swap — informational. */
|
|
2151
|
+
gasEstimate: bigint;
|
|
2152
|
+
/** Unix seconds — `now + deadlineSeconds`. */
|
|
2153
|
+
suggestedDeadline: number;
|
|
2154
|
+
/** When set, the FE should hide the CTA / show "increase amount". */
|
|
2155
|
+
quoteError?: "QUOTE_UNAVAILABLE" | "AMOUNT_TOO_SMALL_FOR_GAS";
|
|
2156
|
+
}
|
|
2157
|
+
declare function quotePointTokenToUsdt(params: QuotePointTokenToUsdtParams): Promise<QuotePointTokenToUsdtResult>;
|
|
2158
|
+
|
|
2153
2159
|
/**
|
|
2154
2160
|
* Config for `createSubgraphPoolsProvider`.
|
|
2155
2161
|
*/
|
|
@@ -2581,7 +2587,97 @@ interface IssuerService {
|
|
|
2581
2587
|
*/
|
|
2582
2588
|
declare function createIssuerService(config: IssuerServiceConfig): IssuerService;
|
|
2583
2589
|
|
|
2590
|
+
interface IssuerRegistryRecord {
|
|
2591
|
+
issuerAddress: Address;
|
|
2592
|
+
signerAddress: Address;
|
|
2593
|
+
name: string;
|
|
2594
|
+
symbol: string;
|
|
2595
|
+
declaredTotalSupply: bigint;
|
|
2596
|
+
capBasisPoints: number;
|
|
2597
|
+
active: boolean;
|
|
2598
|
+
pointToken: Address;
|
|
2599
|
+
mintingOracle: Address;
|
|
2600
|
+
}
|
|
2601
|
+
interface PreValidateMintResult {
|
|
2602
|
+
/** Registry record read at pre-validation time. */
|
|
2603
|
+
issuer: IssuerRegistryRecord;
|
|
2604
|
+
/** Current on-chain PointToken.totalSupply(). */
|
|
2605
|
+
totalSupply: bigint;
|
|
2606
|
+
/** declaredTotalSupply × capBasisPoints / 10000. */
|
|
2607
|
+
hardCap: bigint;
|
|
2608
|
+
/** hardCap − totalSupply (clamped to 0). */
|
|
2609
|
+
remaining: bigint;
|
|
2610
|
+
}
|
|
2611
|
+
/**
|
|
2612
|
+
* Thrown by `IssuerStateValidator.preValidateMint()`.
|
|
2613
|
+
* `code` maps 1:1 to the HTTP error the issuer API surfaces to clients.
|
|
2614
|
+
*/
|
|
2615
|
+
declare class IssuerStateError extends Error {
|
|
2616
|
+
readonly code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED";
|
|
2617
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
2618
|
+
constructor(code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED", message: string, details?: Record<string, unknown> | undefined);
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* Pure (framework-agnostic) validator for issuer state.
|
|
2623
|
+
*
|
|
2624
|
+
* Reads IssuerRegistry + PointToken on-chain state and pre-validates
|
|
2625
|
+
* mint requests before the user submits a UserOp. Catching these
|
|
2626
|
+
* off-chain lets issuers fail fast with a clear error rather than
|
|
2627
|
+
* wasting gas on a revert.
|
|
2628
|
+
*
|
|
2629
|
+
* Caching:
|
|
2630
|
+
* - `PointToken.issuer()` — memoized for the process lifetime (immutable)
|
|
2631
|
+
* - Full state (registry + totalSupply) — 30s TTL per PointToken
|
|
2632
|
+
* - Burst calls while a fetch is in-flight share the same Promise
|
|
2633
|
+
* (thundering-herd protection)
|
|
2634
|
+
*
|
|
2635
|
+
* Usage in NestJS: wrap this in an `@Injectable()` service; pass
|
|
2636
|
+
* `PublicClient` and `registryAddress` from your DI container.
|
|
2637
|
+
*/
|
|
2638
|
+
declare class IssuerStateValidator {
|
|
2639
|
+
private readonly provider;
|
|
2640
|
+
private readonly registryAddress;
|
|
2641
|
+
private readonly pointTokenIssuerCache;
|
|
2642
|
+
private readonly stateCache;
|
|
2643
|
+
private readonly inflight;
|
|
2644
|
+
constructor(provider: PublicClient, registryAddress: Address);
|
|
2645
|
+
/**
|
|
2646
|
+
* Convenience factory — reads `registryAddress` from the SDK
|
|
2647
|
+
* `CONTRACT_ADDRESSES` map for the given chain.
|
|
2648
|
+
*/
|
|
2649
|
+
static forChain(provider: PublicClient, chainId: number): IssuerStateValidator;
|
|
2650
|
+
/**
|
|
2651
|
+
* Invalidate cached state for one PointToken, or everything if omitted.
|
|
2652
|
+
* Call after admin txs that change registry or cap settings.
|
|
2653
|
+
*/
|
|
2654
|
+
invalidate(pointToken?: Address): void;
|
|
2655
|
+
/**
|
|
2656
|
+
* Resolve `PointToken.issuer()` once per token and memoize.
|
|
2657
|
+
* The issuer field is set at `initialize()` and never changes.
|
|
2658
|
+
*/
|
|
2659
|
+
getIssuerAddressForPointToken(pointToken: Address): Promise<Address>;
|
|
2660
|
+
/**
|
|
2661
|
+
* Read registry record + totalSupply, with 30s cache and in-flight
|
|
2662
|
+
* deduplication. Does NOT throw on inactive/missing — returns raw state.
|
|
2663
|
+
*/
|
|
2664
|
+
getIssuerState(pointToken: Address): Promise<PreValidateMintResult>;
|
|
2665
|
+
/**
|
|
2666
|
+
* Validate that `amount` PT can be minted on `pointToken` right now.
|
|
2667
|
+
*
|
|
2668
|
+
* Throws `IssuerStateError` with:
|
|
2669
|
+
* - `ISSUER_NOT_REGISTERED` — registry has no record for this issuer
|
|
2670
|
+
* - `ISSUER_INACTIVE` — issuer.active is false
|
|
2671
|
+
* - `MINT_CAP_EXCEEDED` — totalSupply + amount would exceed hardCap
|
|
2672
|
+
*
|
|
2673
|
+
* Returns the fetched state on success so callers can log without a
|
|
2674
|
+
* second RPC round-trip.
|
|
2675
|
+
*/
|
|
2676
|
+
preValidateMint(pointToken: Address, amount: bigint): Promise<PreValidateMintResult>;
|
|
2677
|
+
private fetchIssuerState;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2584
2680
|
/** SDK package version — bumped on every release */
|
|
2585
2681
|
declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
|
|
2586
2682
|
|
|
2587
|
-
export { type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedeemRequest, type ApiRedeemResponse, type ApiTopUpRequest, type ApiTopUpResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, BundlerNotConfiguredError, BundlerRejectedError, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type BurnStatusParams, type BurnStatusResponse, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type NativePtQuoterConfig, NonceManager, PAFI_ISSUER_SDK_VERSION, PTClaimError, PTClaimHandler, type PTClaimHandlerConfig, type PTClaimRequest, type PTClaimResponse, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, type PendingCredit, type PendingUserOpEntry, PendingUserOpNotFoundError, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PreValidateMintResult, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, SwapError, SwapHandler, type SwapHandlerConfig, type SwapRequest, type SwapResponse, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createNativePtQuoter, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
|
|
2683
|
+
export { type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedeemRequest, type ApiRedeemResponse, type ApiTopUpRequest, type ApiTopUpResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, BundlerNotConfiguredError, BundlerRejectedError, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type BurnStatusParams, type BurnStatusResponse, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type NativePtQuoterConfig, NonceManager, PAFI_ISSUER_SDK_VERSION, PTClaimError, PTClaimHandler, type PTClaimHandlerConfig, type PTClaimRequest, type PTClaimResponse, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, type PendingCredit, type PendingUserOpEntry, PendingUserOpNotFoundError, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PreValidateMintResult, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, type QuotePointTokenToUsdtParams, type QuotePointTokenToUsdtResult, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, SwapError, SwapHandler, type SwapHandlerConfig, type SwapRequest, type SwapResponse, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createNativePtQuoter, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, quotePointTokenToUsdt, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
2
|
+
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, Eip7702AuthorizationJsonRpc, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
3
3
|
export { PAFI_SUBGRAPH_URL } from '@pafi-dev/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1847,98 +1847,17 @@ declare function handleMobileSubmit(params: HandleMobileSubmitParams): Promise<{
|
|
|
1847
1847
|
userOpHash: Hex;
|
|
1848
1848
|
}>;
|
|
1849
1849
|
|
|
1850
|
-
|
|
1851
|
-
issuerAddress: Address;
|
|
1852
|
-
signerAddress: Address;
|
|
1853
|
-
name: string;
|
|
1854
|
-
symbol: string;
|
|
1855
|
-
declaredTotalSupply: bigint;
|
|
1856
|
-
capBasisPoints: number;
|
|
1857
|
-
active: boolean;
|
|
1858
|
-
pointToken: Address;
|
|
1859
|
-
mintingOracle: Address;
|
|
1860
|
-
}
|
|
1861
|
-
interface PreValidateMintResult {
|
|
1862
|
-
/** Registry record read at pre-validation time. */
|
|
1863
|
-
issuer: IssuerRegistryRecord;
|
|
1864
|
-
/** Current on-chain PointToken.totalSupply(). */
|
|
1865
|
-
totalSupply: bigint;
|
|
1866
|
-
/** declaredTotalSupply × capBasisPoints / 10000. */
|
|
1867
|
-
hardCap: bigint;
|
|
1868
|
-
/** hardCap − totalSupply (clamped to 0). */
|
|
1869
|
-
remaining: bigint;
|
|
1870
|
-
}
|
|
1871
|
-
/**
|
|
1872
|
-
* Thrown by `IssuerStateValidator.preValidateMint()`.
|
|
1873
|
-
* `code` maps 1:1 to the HTTP error the issuer API surfaces to clients.
|
|
1874
|
-
*/
|
|
1875
|
-
declare class IssuerStateError extends Error {
|
|
1876
|
-
readonly code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED";
|
|
1877
|
-
readonly details?: Record<string, unknown> | undefined;
|
|
1878
|
-
constructor(code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED", message: string, details?: Record<string, unknown> | undefined);
|
|
1879
|
-
}
|
|
1850
|
+
type DecodedCall$2 = ReturnType<typeof decodeBatchExecuteCalls>[number];
|
|
1880
1851
|
|
|
1881
1852
|
/**
|
|
1882
|
-
*
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1886
|
-
* off-chain lets issuers fail fast with a clear error rather than
|
|
1887
|
-
* wasting gas on a revert.
|
|
1888
|
-
*
|
|
1889
|
-
* Caching:
|
|
1890
|
-
* - `PointToken.issuer()` — memoized for the process lifetime (immutable)
|
|
1891
|
-
* - Full state (registry + totalSupply) — 30s TTL per PointToken
|
|
1892
|
-
* - Burst calls while a fetch is in-flight share the same Promise
|
|
1893
|
-
* (thundering-herd protection)
|
|
1894
|
-
*
|
|
1895
|
-
* Usage in NestJS: wrap this in an `@Injectable()` service; pass
|
|
1896
|
-
* `PublicClient` and `registryAddress` from your DI container.
|
|
1853
|
+
* Structural shape — accepts both the raw `IssuerStateValidator` from
|
|
1854
|
+
* `@pafi-dev/issuer/issuer-state` and any host-framework wrapper (e.g.
|
|
1855
|
+
* a NestJS Injectable that delegates to it). Only `preValidateMint`
|
|
1856
|
+
* is needed on this surface.
|
|
1897
1857
|
*/
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
private readonly registryAddress;
|
|
1901
|
-
private readonly pointTokenIssuerCache;
|
|
1902
|
-
private readonly stateCache;
|
|
1903
|
-
private readonly inflight;
|
|
1904
|
-
constructor(provider: PublicClient, registryAddress: Address);
|
|
1905
|
-
/**
|
|
1906
|
-
* Convenience factory — reads `registryAddress` from the SDK
|
|
1907
|
-
* `CONTRACT_ADDRESSES` map for the given chain.
|
|
1908
|
-
*/
|
|
1909
|
-
static forChain(provider: PublicClient, chainId: number): IssuerStateValidator;
|
|
1910
|
-
/**
|
|
1911
|
-
* Invalidate cached state for one PointToken, or everything if omitted.
|
|
1912
|
-
* Call after admin txs that change registry or cap settings.
|
|
1913
|
-
*/
|
|
1914
|
-
invalidate(pointToken?: Address): void;
|
|
1915
|
-
/**
|
|
1916
|
-
* Resolve `PointToken.issuer()` once per token and memoize.
|
|
1917
|
-
* The issuer field is set at `initialize()` and never changes.
|
|
1918
|
-
*/
|
|
1919
|
-
getIssuerAddressForPointToken(pointToken: Address): Promise<Address>;
|
|
1920
|
-
/**
|
|
1921
|
-
* Read registry record + totalSupply, with 30s cache and in-flight
|
|
1922
|
-
* deduplication. Does NOT throw on inactive/missing — returns raw state.
|
|
1923
|
-
*/
|
|
1924
|
-
getIssuerState(pointToken: Address): Promise<PreValidateMintResult>;
|
|
1925
|
-
/**
|
|
1926
|
-
* Validate that `amount` PT can be minted on `pointToken` right now.
|
|
1927
|
-
*
|
|
1928
|
-
* Throws `IssuerStateError` with:
|
|
1929
|
-
* - `ISSUER_NOT_REGISTERED` — registry has no record for this issuer
|
|
1930
|
-
* - `ISSUER_INACTIVE` — issuer.active is false
|
|
1931
|
-
* - `MINT_CAP_EXCEEDED` — totalSupply + amount would exceed hardCap
|
|
1932
|
-
*
|
|
1933
|
-
* Returns the fetched state on success so callers can log without a
|
|
1934
|
-
* second RPC round-trip.
|
|
1935
|
-
*/
|
|
1936
|
-
preValidateMint(pointToken: Address, amount: bigint): Promise<PreValidateMintResult>;
|
|
1937
|
-
private fetchIssuerState;
|
|
1858
|
+
interface IssuerStateValidatorLike {
|
|
1859
|
+
preValidateMint(pointToken: Address, amount: bigint): Promise<unknown>;
|
|
1938
1860
|
}
|
|
1939
|
-
|
|
1940
|
-
type DecodedCall$2 = ReturnType<typeof decodeBatchExecuteCalls>[number];
|
|
1941
|
-
|
|
1942
1861
|
/**
|
|
1943
1862
|
* v1.4 sig-gated mint handler — mirrors `PTRedeemHandler` on the mint side.
|
|
1944
1863
|
*
|
|
@@ -1971,7 +1890,7 @@ interface PTClaimHandlerConfig {
|
|
|
1971
1890
|
/** Optional — when wired, used to estimate the PT gas-reimbursement fee. */
|
|
1972
1891
|
feeService?: FeeManager;
|
|
1973
1892
|
/** Optional — pre-validates issuer status + cap before locking balance. */
|
|
1974
|
-
issuerStateValidator?:
|
|
1893
|
+
issuerStateValidator?: IssuerStateValidatorLike;
|
|
1975
1894
|
/** How long the off-chain balance lock survives if the mint never lands. Default 15 min. */
|
|
1976
1895
|
lockDurationMs?: number;
|
|
1977
1896
|
/** How far ahead of `now` to set the MintRequest deadline. Default 15 min. */
|
|
@@ -2150,6 +2069,93 @@ declare class PerpDepositHandler {
|
|
|
2150
2069
|
handle(request: PerpDepositRequest): Promise<PerpDepositResponse>;
|
|
2151
2070
|
}
|
|
2152
2071
|
|
|
2072
|
+
/**
|
|
2073
|
+
* Pure mechanics for the EIP-7702 delegation submit flow. Builds the
|
|
2074
|
+
* empty-batch UserOp, attaches paymaster sponsorship, splits the user's
|
|
2075
|
+
* authorization signature into the JSON-RPC tuple, and relays via the
|
|
2076
|
+
* PAFI sponsor-relayer.
|
|
2077
|
+
*
|
|
2078
|
+
* The UserOp itself is a no-op — `BatchExecutor.execute([])` does
|
|
2079
|
+
* nothing. The work is in the `eip7702Auth` object: the bundler picks
|
|
2080
|
+
* it up, runs the EIP-7702 path, and installs the delegation on the
|
|
2081
|
+
* user's EOA atomically with the (empty) UserOp.
|
|
2082
|
+
*
|
|
2083
|
+
* Throws the same `BundlerNotConfiguredError` / `BundlerRejectedError`
|
|
2084
|
+
* as other relay paths so issuer controllers can use one error mapper.
|
|
2085
|
+
*/
|
|
2086
|
+
interface HandleDelegateSubmitParams {
|
|
2087
|
+
userAddress: Address;
|
|
2088
|
+
chainId: number;
|
|
2089
|
+
/** Account nonce read at `delegate/prepare` time and signed by the user. */
|
|
2090
|
+
delegationNonce: bigint;
|
|
2091
|
+
/** ERC-4337 account nonce. Caller fetches via EntryPoint.getNonce. */
|
|
2092
|
+
aaNonce: bigint;
|
|
2093
|
+
/** 65-byte secp256k1 signature over the EIP-7702 authorization hash. */
|
|
2094
|
+
authSig: Hex | string;
|
|
2095
|
+
/** EIP-1559 fees from `provider.estimateFeesPerGas()` (or RPC equivalent). */
|
|
2096
|
+
fees: {
|
|
2097
|
+
maxFeePerGas?: bigint;
|
|
2098
|
+
maxPriorityFeePerGas?: bigint;
|
|
2099
|
+
};
|
|
2100
|
+
pafiBackendClient?: PafiBackendClient | null;
|
|
2101
|
+
onWarning?: (msg: string) => void;
|
|
2102
|
+
/** Override gas limits for the empty-batch UserOp. */
|
|
2103
|
+
gasLimits?: {
|
|
2104
|
+
callGasLimit?: bigint;
|
|
2105
|
+
verificationGasLimit?: bigint;
|
|
2106
|
+
preVerificationGas?: bigint;
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
interface HandleDelegateSubmitResult {
|
|
2110
|
+
userOpHash: Hex;
|
|
2111
|
+
/** True when paymaster sponsorship was applied (gas is free). */
|
|
2112
|
+
isSponsored: boolean;
|
|
2113
|
+
/** The authorization tuple actually sent to the bundler. */
|
|
2114
|
+
authorization: Eip7702AuthorizationJsonRpc;
|
|
2115
|
+
}
|
|
2116
|
+
declare function handleDelegateSubmit(params: HandleDelegateSubmitParams): Promise<HandleDelegateSubmitResult>;
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Quote PT → USDT for the cashout preview screen.
|
|
2120
|
+
*
|
|
2121
|
+
* Three branches the FE needs distinct handling for:
|
|
2122
|
+
* - `pointAmount = 0` → all zeros, no RPC call.
|
|
2123
|
+
* - no pool / no path → `quoteError: 'QUOTE_UNAVAILABLE'`.
|
|
2124
|
+
* - amountOut < gas reimbursement → `quoteError: 'AMOUNT_TOO_SMALL_FOR_GAS'`.
|
|
2125
|
+
*
|
|
2126
|
+
* Returns derived `netUsdtOut`, `exchangeRate`, and a `suggestedDeadline`
|
|
2127
|
+
* so callers don't need to compute those locally.
|
|
2128
|
+
*
|
|
2129
|
+
* Replaces ~50 LoC of inline quote-handling in issuer controllers.
|
|
2130
|
+
*/
|
|
2131
|
+
interface QuotePointTokenToUsdtParams {
|
|
2132
|
+
provider: PublicClient;
|
|
2133
|
+
chainId: number;
|
|
2134
|
+
pointTokenAddress: Address;
|
|
2135
|
+
pointAmount: bigint;
|
|
2136
|
+
pools: PoolKey[];
|
|
2137
|
+
/** Operator gas-reimbursement quoted in USDT (subtracted from output). */
|
|
2138
|
+
gasFeeUsdt: bigint;
|
|
2139
|
+
/** Override deadline window; default 300 seconds. */
|
|
2140
|
+
deadlineSeconds?: number;
|
|
2141
|
+
now?: () => number;
|
|
2142
|
+
}
|
|
2143
|
+
interface QuotePointTokenToUsdtResult {
|
|
2144
|
+
/** Raw V4 quote on the full point amount, before gas deduction. */
|
|
2145
|
+
estimatedUsdtOut: bigint;
|
|
2146
|
+
/** `estimatedUsdtOut - gasFeeUsdt`, clamped to 0. */
|
|
2147
|
+
netUsdtOut: bigint;
|
|
2148
|
+
/** USDT per 1.0 PT (1e18 raw units), formatted to 8 decimal places. */
|
|
2149
|
+
exchangeRate: string;
|
|
2150
|
+
/** V4 Quoter's gas estimate for the swap — informational. */
|
|
2151
|
+
gasEstimate: bigint;
|
|
2152
|
+
/** Unix seconds — `now + deadlineSeconds`. */
|
|
2153
|
+
suggestedDeadline: number;
|
|
2154
|
+
/** When set, the FE should hide the CTA / show "increase amount". */
|
|
2155
|
+
quoteError?: "QUOTE_UNAVAILABLE" | "AMOUNT_TOO_SMALL_FOR_GAS";
|
|
2156
|
+
}
|
|
2157
|
+
declare function quotePointTokenToUsdt(params: QuotePointTokenToUsdtParams): Promise<QuotePointTokenToUsdtResult>;
|
|
2158
|
+
|
|
2153
2159
|
/**
|
|
2154
2160
|
* Config for `createSubgraphPoolsProvider`.
|
|
2155
2161
|
*/
|
|
@@ -2581,7 +2587,97 @@ interface IssuerService {
|
|
|
2581
2587
|
*/
|
|
2582
2588
|
declare function createIssuerService(config: IssuerServiceConfig): IssuerService;
|
|
2583
2589
|
|
|
2590
|
+
interface IssuerRegistryRecord {
|
|
2591
|
+
issuerAddress: Address;
|
|
2592
|
+
signerAddress: Address;
|
|
2593
|
+
name: string;
|
|
2594
|
+
symbol: string;
|
|
2595
|
+
declaredTotalSupply: bigint;
|
|
2596
|
+
capBasisPoints: number;
|
|
2597
|
+
active: boolean;
|
|
2598
|
+
pointToken: Address;
|
|
2599
|
+
mintingOracle: Address;
|
|
2600
|
+
}
|
|
2601
|
+
interface PreValidateMintResult {
|
|
2602
|
+
/** Registry record read at pre-validation time. */
|
|
2603
|
+
issuer: IssuerRegistryRecord;
|
|
2604
|
+
/** Current on-chain PointToken.totalSupply(). */
|
|
2605
|
+
totalSupply: bigint;
|
|
2606
|
+
/** declaredTotalSupply × capBasisPoints / 10000. */
|
|
2607
|
+
hardCap: bigint;
|
|
2608
|
+
/** hardCap − totalSupply (clamped to 0). */
|
|
2609
|
+
remaining: bigint;
|
|
2610
|
+
}
|
|
2611
|
+
/**
|
|
2612
|
+
* Thrown by `IssuerStateValidator.preValidateMint()`.
|
|
2613
|
+
* `code` maps 1:1 to the HTTP error the issuer API surfaces to clients.
|
|
2614
|
+
*/
|
|
2615
|
+
declare class IssuerStateError extends Error {
|
|
2616
|
+
readonly code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED";
|
|
2617
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
2618
|
+
constructor(code: "ISSUER_NOT_REGISTERED" | "ISSUER_INACTIVE" | "MINT_CAP_EXCEEDED", message: string, details?: Record<string, unknown> | undefined);
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* Pure (framework-agnostic) validator for issuer state.
|
|
2623
|
+
*
|
|
2624
|
+
* Reads IssuerRegistry + PointToken on-chain state and pre-validates
|
|
2625
|
+
* mint requests before the user submits a UserOp. Catching these
|
|
2626
|
+
* off-chain lets issuers fail fast with a clear error rather than
|
|
2627
|
+
* wasting gas on a revert.
|
|
2628
|
+
*
|
|
2629
|
+
* Caching:
|
|
2630
|
+
* - `PointToken.issuer()` — memoized for the process lifetime (immutable)
|
|
2631
|
+
* - Full state (registry + totalSupply) — 30s TTL per PointToken
|
|
2632
|
+
* - Burst calls while a fetch is in-flight share the same Promise
|
|
2633
|
+
* (thundering-herd protection)
|
|
2634
|
+
*
|
|
2635
|
+
* Usage in NestJS: wrap this in an `@Injectable()` service; pass
|
|
2636
|
+
* `PublicClient` and `registryAddress` from your DI container.
|
|
2637
|
+
*/
|
|
2638
|
+
declare class IssuerStateValidator {
|
|
2639
|
+
private readonly provider;
|
|
2640
|
+
private readonly registryAddress;
|
|
2641
|
+
private readonly pointTokenIssuerCache;
|
|
2642
|
+
private readonly stateCache;
|
|
2643
|
+
private readonly inflight;
|
|
2644
|
+
constructor(provider: PublicClient, registryAddress: Address);
|
|
2645
|
+
/**
|
|
2646
|
+
* Convenience factory — reads `registryAddress` from the SDK
|
|
2647
|
+
* `CONTRACT_ADDRESSES` map for the given chain.
|
|
2648
|
+
*/
|
|
2649
|
+
static forChain(provider: PublicClient, chainId: number): IssuerStateValidator;
|
|
2650
|
+
/**
|
|
2651
|
+
* Invalidate cached state for one PointToken, or everything if omitted.
|
|
2652
|
+
* Call after admin txs that change registry or cap settings.
|
|
2653
|
+
*/
|
|
2654
|
+
invalidate(pointToken?: Address): void;
|
|
2655
|
+
/**
|
|
2656
|
+
* Resolve `PointToken.issuer()` once per token and memoize.
|
|
2657
|
+
* The issuer field is set at `initialize()` and never changes.
|
|
2658
|
+
*/
|
|
2659
|
+
getIssuerAddressForPointToken(pointToken: Address): Promise<Address>;
|
|
2660
|
+
/**
|
|
2661
|
+
* Read registry record + totalSupply, with 30s cache and in-flight
|
|
2662
|
+
* deduplication. Does NOT throw on inactive/missing — returns raw state.
|
|
2663
|
+
*/
|
|
2664
|
+
getIssuerState(pointToken: Address): Promise<PreValidateMintResult>;
|
|
2665
|
+
/**
|
|
2666
|
+
* Validate that `amount` PT can be minted on `pointToken` right now.
|
|
2667
|
+
*
|
|
2668
|
+
* Throws `IssuerStateError` with:
|
|
2669
|
+
* - `ISSUER_NOT_REGISTERED` — registry has no record for this issuer
|
|
2670
|
+
* - `ISSUER_INACTIVE` — issuer.active is false
|
|
2671
|
+
* - `MINT_CAP_EXCEEDED` — totalSupply + amount would exceed hardCap
|
|
2672
|
+
*
|
|
2673
|
+
* Returns the fetched state on success so callers can log without a
|
|
2674
|
+
* second RPC round-trip.
|
|
2675
|
+
*/
|
|
2676
|
+
preValidateMint(pointToken: Address, amount: bigint): Promise<PreValidateMintResult>;
|
|
2677
|
+
private fetchIssuerState;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2584
2680
|
/** SDK package version — bumped on every release */
|
|
2585
2681
|
declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
|
|
2586
2682
|
|
|
2587
|
-
export { type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedeemRequest, type ApiRedeemResponse, type ApiTopUpRequest, type ApiTopUpResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, BundlerNotConfiguredError, BundlerRejectedError, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type BurnStatusParams, type BurnStatusResponse, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type NativePtQuoterConfig, NonceManager, PAFI_ISSUER_SDK_VERSION, PTClaimError, PTClaimHandler, type PTClaimHandlerConfig, type PTClaimRequest, type PTClaimResponse, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, type PendingCredit, type PendingUserOpEntry, PendingUserOpNotFoundError, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PreValidateMintResult, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, SwapError, SwapHandler, type SwapHandlerConfig, type SwapRequest, type SwapResponse, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createNativePtQuoter, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
|
|
2683
|
+
export { type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedeemRequest, type ApiRedeemResponse, type ApiTopUpRequest, type ApiTopUpResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, BundlerNotConfiguredError, BundlerRejectedError, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type BurnStatusParams, type BurnStatusResponse, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type NativePtQuoterConfig, NonceManager, PAFI_ISSUER_SDK_VERSION, PTClaimError, PTClaimHandler, type PTClaimHandlerConfig, type PTClaimRequest, type PTClaimResponse, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, type PendingCredit, type PendingUserOpEntry, PendingUserOpNotFoundError, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PreValidateMintResult, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, type QuotePointTokenToUsdtParams, type QuotePointTokenToUsdtResult, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, SwapError, SwapHandler, type SwapHandlerConfig, type SwapRequest, type SwapResponse, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createNativePtQuoter, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, quotePointTokenToUsdt, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
|