@pafi-dev/issuer 0.6.1 → 0.7.1

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
@@ -35,6 +35,36 @@ declare abstract class PafiSdkError extends Error {
35
35
  abstract readonly httpStatus: SdkErrorHttpStatus;
36
36
  constructor(message: string);
37
37
  }
38
+ /**
39
+ * Generic validation failure for routine 4xx-class request errors —
40
+ * unsupported chainId, missing field, address checksum mismatch,
41
+ * out-of-range amount, etc. Replaces ~12 raw `throw new Error(...)`
42
+ * call sites in `IssuerApiHandlers` that previously leaked as 500s
43
+ * via `createSdkErrorMapper`'s "non-PafiSdkError → rethrow" path.
44
+ *
45
+ * v0.7.1 — added per SDK_ISSUER_AUDIT.md H1.
46
+ */
47
+ declare class ValidationError extends PafiSdkError {
48
+ readonly httpStatus: "unprocessable";
49
+ readonly code: string;
50
+ readonly details?: Record<string, unknown>;
51
+ constructor(code: string, message: string, details?: Record<string, unknown>);
52
+ }
53
+ /**
54
+ * Issuer wired the SDK without a dependency the requested endpoint
55
+ * needs (e.g. `/gas-fee` called but `feeManager` not configured;
56
+ * `/pools` called but `poolsProvider` not configured). 503 because
57
+ * the endpoint genuinely can't serve the request — caller's payload
58
+ * is fine, the issuer's deployment is incomplete.
59
+ *
60
+ * v0.7.1 — added per SDK_ISSUER_AUDIT.md H1.
61
+ */
62
+ declare class ConfigurationError extends PafiSdkError {
63
+ readonly httpStatus: "service_unavailable";
64
+ readonly code: string;
65
+ readonly details?: Record<string, unknown>;
66
+ constructor(code: string, message: string, details?: Record<string, unknown>);
67
+ }
38
68
 
39
69
  /**
40
70
  * Lifecycle of a minting request as tracked by the issuer's point ledger.
@@ -427,8 +457,15 @@ declare function authenticateRequest(authHeader: string | undefined, authService
427
457
  * `err.code` to translate into framework-specific HTTP responses.
428
458
  */
429
459
  type AuthErrorCode = "INVALID_MESSAGE" | "DOMAIN_MISMATCH" | "CHAIN_MISMATCH" | "NONCE_INVALID" | "MESSAGE_EXPIRED" | "MESSAGE_NOT_YET_VALID" | "SIGNATURE_INVALID" | "MISSING_TOKEN" | "MALFORMED_TOKEN" | "TOKEN_INVALID" | "TOKEN_EXPIRED" | "SESSION_REVOKED";
430
- declare class AuthError extends Error {
460
+ /**
461
+ * v0.7.1 — extends `PafiSdkError` so issuer controllers can route auth
462
+ * failures through the same `createSdkErrorMapper` as everything else.
463
+ * Previously caller had to wire `instanceof AuthError` separately. See
464
+ * SDK_ISSUER_AUDIT.md H2.
465
+ */
466
+ declare class AuthError extends PafiSdkError {
431
467
  readonly code: AuthErrorCode;
468
+ readonly httpStatus: SdkErrorHttpStatus;
432
469
  constructor(code: AuthErrorCode, message: string);
433
470
  }
434
471
 
@@ -440,11 +477,14 @@ declare class AuthError extends Error {
440
477
  * no longer broadcasts transactions, so `SUBMIT_FAILED`, `TX_REVERTED`,
441
478
  * `SIMULATION_FAILED`, and `TIMEOUT` all went away with the operator
442
479
  * wallet. Paymaster/Bundler errors surface out-of-band on the FE.
480
+ *
481
+ * v0.7.1 — extends `PafiSdkError` so `createSdkErrorMapper` routes it
482
+ * to 422 instead of leaking as a 500. See SDK_ISSUER_AUDIT.md C2.
443
483
  */
444
- type RelayErrorCode = "NOT_CONFIGURED" | "ENCODE_FAILED";
445
- declare class RelayError extends Error {
484
+ type RelayErrorCode = "ENCODE_FAILED";
485
+ declare class RelayError extends PafiSdkError {
486
+ readonly httpStatus: "unprocessable";
446
487
  readonly code: RelayErrorCode;
447
- readonly cause?: unknown;
448
488
  constructor(code: RelayErrorCode, message: string, cause?: unknown);
449
489
  }
450
490
 
@@ -1894,14 +1934,19 @@ type DecodedCall = ReturnType<typeof decodeBatchExecuteCalls>[number];
1894
1934
  * quotes the Relay's USDC fee (covers LayerZero msg.value out of the
1895
1935
  * Relay's ETH reserve), then builds two UserOps:
1896
1936
  *
1897
- * - **sponsored** — PT.transfer(fee, PAFI) + USDC.approve(relay,
1898
- * total) + Relay.deposit(req). User reimburses gas in PT.
1937
+ * - **sponsored** — USDC.transfer(fee, PAFI) + USDC.approve(relay,
1938
+ * total) + Relay.deposit(req). User reimburses gas in USDC
1939
+ * (input-token rule — user holds USDC at start of batch).
1899
1940
  * - **fallback** — USDC.approve + Relay.deposit only. User pays
1900
1941
  * ERC-4337 gas in ETH. Built only when `feeAmount > 0`.
1901
1942
  *
1902
1943
  * `maxFee` is set to `quote × 1.5` — slippage cap on the Relay's
1903
1944
  * USD-pricing during the inclusion window. If the actual fee at
1904
1945
  * execution exceeds maxFee the Relay reverts (`FeeExceedsMax`).
1946
+ *
1947
+ * v0.7 — Switched gas fee from PT (output-side, mixed token UX) to
1948
+ * USDC (input-side, single token UX). User now only needs USDC to
1949
+ * complete the deposit, no separate PT balance required.
1905
1950
  */
1906
1951
  type PerpDepositErrorCode = "PERP_DEPOSIT_UNAVAILABLE" | "BROKER_NOT_WHITELISTED" | "RELAY_FEE_EXCEEDS_AMOUNT" | "FEE_EXCEEDS_AMOUNT" | "INVALID_AMOUNT";
1907
1952
  declare class PerpDepositError extends PafiSdkError {
@@ -1912,16 +1957,20 @@ declare class PerpDepositError extends PafiSdkError {
1912
1957
  }
1913
1958
  interface PerpDepositHandlerConfig {
1914
1959
  provider: PublicClient;
1915
- /** Optional — when wired, used to estimate the PT gas-reimbursement fee. */
1916
- feeService?: FeeManager;
1917
- /** PointToken address used for the sponsored PT.transfer. */
1918
- pointTokenAddress: Address;
1919
1960
  /**
1920
1961
  * Slippage premium applied on top of the Relay quote when computing
1921
1962
  * `maxFee`. Default 50% (factor 150). The Relay reverts if actual fee
1922
1963
  * exceeds `maxFee` so a generous cap reduces re-quote churn.
1923
1964
  */
1924
1965
  maxFeePremiumBps?: number;
1966
+ /**
1967
+ * Gas units used by `quoteOperatorFeeUsdt` to size the USDC gas
1968
+ * reimbursement. Default 500_000 (covers approve + Relay.deposit
1969
+ * + LayerZero call). Pass a tighter Pimlico estimate if available.
1970
+ */
1971
+ gasUnits?: bigint;
1972
+ /** Premium bps for `quoteOperatorFeeUsdt`. Default 12_000 (1.2×). */
1973
+ gasPremiumBps?: number;
1925
1974
  }
1926
1975
  interface PerpDepositRequest {
1927
1976
  userAddress: Address;
@@ -2294,6 +2343,18 @@ interface DelegatePrepareDto {
2294
2343
  batchExecutorAddress: Address;
2295
2344
  chainId: number;
2296
2345
  }
2346
+ /**
2347
+ * Thrown by `IssuerApiAdapter` constructor when the wired ledger does
2348
+ * not implement the optional methods required by the configured
2349
+ * handlers. Surfaces at boot, not at first request — issuer can't
2350
+ * silently ship a partial ledger and discover the gap in production.
2351
+ *
2352
+ * v0.7.1 — added per SDK_ISSUER_AUDIT.md C4.
2353
+ */
2354
+ declare class AdapterMisconfiguredError extends Error {
2355
+ readonly code: "ADAPTER_MISCONFIGURED";
2356
+ constructor(message: string);
2357
+ }
2297
2358
  declare class IssuerApiAdapter {
2298
2359
  private readonly cfg;
2299
2360
  constructor(config: IssuerApiAdapterConfig);
@@ -2363,6 +2424,11 @@ declare class IssuerApiAdapter {
2363
2424
  /**
2364
2425
  * Build + sign a SponsorAuth payload. Returns `undefined` when no
2365
2426
  * issuer id is configured, so the controller can skip the field.
2427
+ *
2428
+ * v0.7.1 — `scenario` typed as `SponsorshipScenario` (was `string`).
2429
+ * Previously a typo (`"perp_deposit"` vs `"perp-deposit"`) compiled
2430
+ * fine but rejected at L1 by sponsor-relayer's IntentValidator. See
2431
+ * SDK_ISSUER_AUDIT.md N5.
2366
2432
  */
2367
2433
  private buildSponsorAuth;
2368
2434
  private runMobilePrepare;
@@ -2784,7 +2850,6 @@ declare class IssuerStateValidator {
2784
2850
  private fetchIssuerState;
2785
2851
  }
2786
2852
 
2787
- /** SDK package version — bumped on every release */
2788
- declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
2853
+ declare const PAFI_ISSUER_SDK_VERSION: string;
2789
2854
 
2790
- export { type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, 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 ClaimDto, type CombinedBalance, type ConfigDto, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, FeeManager, type FeeManagerConfig, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, 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, PafiSdkError, type PendingCredit, type PendingUserOpEntry, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, type RedeemDto, type RedeemPrepareDto, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SdkErrorBody, type SdkErrorHttpStatus, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, authenticateRequest, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
2855
+ export { AdapterMisconfiguredError, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, 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 ClaimDto, type CombinedBalance, type ConfigDto, ConfigurationError, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, FeeManager, type FeeManagerConfig, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, 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, PafiSdkError, type PendingCredit, type PendingUserOpEntry, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, type RedeemDto, type RedeemPrepareDto, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SdkErrorBody, type SdkErrorHttpStatus, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, ValidationError, authenticateRequest, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
package/dist/index.d.ts CHANGED
@@ -35,6 +35,36 @@ declare abstract class PafiSdkError extends Error {
35
35
  abstract readonly httpStatus: SdkErrorHttpStatus;
36
36
  constructor(message: string);
37
37
  }
38
+ /**
39
+ * Generic validation failure for routine 4xx-class request errors —
40
+ * unsupported chainId, missing field, address checksum mismatch,
41
+ * out-of-range amount, etc. Replaces ~12 raw `throw new Error(...)`
42
+ * call sites in `IssuerApiHandlers` that previously leaked as 500s
43
+ * via `createSdkErrorMapper`'s "non-PafiSdkError → rethrow" path.
44
+ *
45
+ * v0.7.1 — added per SDK_ISSUER_AUDIT.md H1.
46
+ */
47
+ declare class ValidationError extends PafiSdkError {
48
+ readonly httpStatus: "unprocessable";
49
+ readonly code: string;
50
+ readonly details?: Record<string, unknown>;
51
+ constructor(code: string, message: string, details?: Record<string, unknown>);
52
+ }
53
+ /**
54
+ * Issuer wired the SDK without a dependency the requested endpoint
55
+ * needs (e.g. `/gas-fee` called but `feeManager` not configured;
56
+ * `/pools` called but `poolsProvider` not configured). 503 because
57
+ * the endpoint genuinely can't serve the request — caller's payload
58
+ * is fine, the issuer's deployment is incomplete.
59
+ *
60
+ * v0.7.1 — added per SDK_ISSUER_AUDIT.md H1.
61
+ */
62
+ declare class ConfigurationError extends PafiSdkError {
63
+ readonly httpStatus: "service_unavailable";
64
+ readonly code: string;
65
+ readonly details?: Record<string, unknown>;
66
+ constructor(code: string, message: string, details?: Record<string, unknown>);
67
+ }
38
68
 
39
69
  /**
40
70
  * Lifecycle of a minting request as tracked by the issuer's point ledger.
@@ -427,8 +457,15 @@ declare function authenticateRequest(authHeader: string | undefined, authService
427
457
  * `err.code` to translate into framework-specific HTTP responses.
428
458
  */
429
459
  type AuthErrorCode = "INVALID_MESSAGE" | "DOMAIN_MISMATCH" | "CHAIN_MISMATCH" | "NONCE_INVALID" | "MESSAGE_EXPIRED" | "MESSAGE_NOT_YET_VALID" | "SIGNATURE_INVALID" | "MISSING_TOKEN" | "MALFORMED_TOKEN" | "TOKEN_INVALID" | "TOKEN_EXPIRED" | "SESSION_REVOKED";
430
- declare class AuthError extends Error {
460
+ /**
461
+ * v0.7.1 — extends `PafiSdkError` so issuer controllers can route auth
462
+ * failures through the same `createSdkErrorMapper` as everything else.
463
+ * Previously caller had to wire `instanceof AuthError` separately. See
464
+ * SDK_ISSUER_AUDIT.md H2.
465
+ */
466
+ declare class AuthError extends PafiSdkError {
431
467
  readonly code: AuthErrorCode;
468
+ readonly httpStatus: SdkErrorHttpStatus;
432
469
  constructor(code: AuthErrorCode, message: string);
433
470
  }
434
471
 
@@ -440,11 +477,14 @@ declare class AuthError extends Error {
440
477
  * no longer broadcasts transactions, so `SUBMIT_FAILED`, `TX_REVERTED`,
441
478
  * `SIMULATION_FAILED`, and `TIMEOUT` all went away with the operator
442
479
  * wallet. Paymaster/Bundler errors surface out-of-band on the FE.
480
+ *
481
+ * v0.7.1 — extends `PafiSdkError` so `createSdkErrorMapper` routes it
482
+ * to 422 instead of leaking as a 500. See SDK_ISSUER_AUDIT.md C2.
443
483
  */
444
- type RelayErrorCode = "NOT_CONFIGURED" | "ENCODE_FAILED";
445
- declare class RelayError extends Error {
484
+ type RelayErrorCode = "ENCODE_FAILED";
485
+ declare class RelayError extends PafiSdkError {
486
+ readonly httpStatus: "unprocessable";
446
487
  readonly code: RelayErrorCode;
447
- readonly cause?: unknown;
448
488
  constructor(code: RelayErrorCode, message: string, cause?: unknown);
449
489
  }
450
490
 
@@ -1894,14 +1934,19 @@ type DecodedCall = ReturnType<typeof decodeBatchExecuteCalls>[number];
1894
1934
  * quotes the Relay's USDC fee (covers LayerZero msg.value out of the
1895
1935
  * Relay's ETH reserve), then builds two UserOps:
1896
1936
  *
1897
- * - **sponsored** — PT.transfer(fee, PAFI) + USDC.approve(relay,
1898
- * total) + Relay.deposit(req). User reimburses gas in PT.
1937
+ * - **sponsored** — USDC.transfer(fee, PAFI) + USDC.approve(relay,
1938
+ * total) + Relay.deposit(req). User reimburses gas in USDC
1939
+ * (input-token rule — user holds USDC at start of batch).
1899
1940
  * - **fallback** — USDC.approve + Relay.deposit only. User pays
1900
1941
  * ERC-4337 gas in ETH. Built only when `feeAmount > 0`.
1901
1942
  *
1902
1943
  * `maxFee` is set to `quote × 1.5` — slippage cap on the Relay's
1903
1944
  * USD-pricing during the inclusion window. If the actual fee at
1904
1945
  * execution exceeds maxFee the Relay reverts (`FeeExceedsMax`).
1946
+ *
1947
+ * v0.7 — Switched gas fee from PT (output-side, mixed token UX) to
1948
+ * USDC (input-side, single token UX). User now only needs USDC to
1949
+ * complete the deposit, no separate PT balance required.
1905
1950
  */
1906
1951
  type PerpDepositErrorCode = "PERP_DEPOSIT_UNAVAILABLE" | "BROKER_NOT_WHITELISTED" | "RELAY_FEE_EXCEEDS_AMOUNT" | "FEE_EXCEEDS_AMOUNT" | "INVALID_AMOUNT";
1907
1952
  declare class PerpDepositError extends PafiSdkError {
@@ -1912,16 +1957,20 @@ declare class PerpDepositError extends PafiSdkError {
1912
1957
  }
1913
1958
  interface PerpDepositHandlerConfig {
1914
1959
  provider: PublicClient;
1915
- /** Optional — when wired, used to estimate the PT gas-reimbursement fee. */
1916
- feeService?: FeeManager;
1917
- /** PointToken address used for the sponsored PT.transfer. */
1918
- pointTokenAddress: Address;
1919
1960
  /**
1920
1961
  * Slippage premium applied on top of the Relay quote when computing
1921
1962
  * `maxFee`. Default 50% (factor 150). The Relay reverts if actual fee
1922
1963
  * exceeds `maxFee` so a generous cap reduces re-quote churn.
1923
1964
  */
1924
1965
  maxFeePremiumBps?: number;
1966
+ /**
1967
+ * Gas units used by `quoteOperatorFeeUsdt` to size the USDC gas
1968
+ * reimbursement. Default 500_000 (covers approve + Relay.deposit
1969
+ * + LayerZero call). Pass a tighter Pimlico estimate if available.
1970
+ */
1971
+ gasUnits?: bigint;
1972
+ /** Premium bps for `quoteOperatorFeeUsdt`. Default 12_000 (1.2×). */
1973
+ gasPremiumBps?: number;
1925
1974
  }
1926
1975
  interface PerpDepositRequest {
1927
1976
  userAddress: Address;
@@ -2294,6 +2343,18 @@ interface DelegatePrepareDto {
2294
2343
  batchExecutorAddress: Address;
2295
2344
  chainId: number;
2296
2345
  }
2346
+ /**
2347
+ * Thrown by `IssuerApiAdapter` constructor when the wired ledger does
2348
+ * not implement the optional methods required by the configured
2349
+ * handlers. Surfaces at boot, not at first request — issuer can't
2350
+ * silently ship a partial ledger and discover the gap in production.
2351
+ *
2352
+ * v0.7.1 — added per SDK_ISSUER_AUDIT.md C4.
2353
+ */
2354
+ declare class AdapterMisconfiguredError extends Error {
2355
+ readonly code: "ADAPTER_MISCONFIGURED";
2356
+ constructor(message: string);
2357
+ }
2297
2358
  declare class IssuerApiAdapter {
2298
2359
  private readonly cfg;
2299
2360
  constructor(config: IssuerApiAdapterConfig);
@@ -2363,6 +2424,11 @@ declare class IssuerApiAdapter {
2363
2424
  /**
2364
2425
  * Build + sign a SponsorAuth payload. Returns `undefined` when no
2365
2426
  * issuer id is configured, so the controller can skip the field.
2427
+ *
2428
+ * v0.7.1 — `scenario` typed as `SponsorshipScenario` (was `string`).
2429
+ * Previously a typo (`"perp_deposit"` vs `"perp-deposit"`) compiled
2430
+ * fine but rejected at L1 by sponsor-relayer's IntentValidator. See
2431
+ * SDK_ISSUER_AUDIT.md N5.
2366
2432
  */
2367
2433
  private buildSponsorAuth;
2368
2434
  private runMobilePrepare;
@@ -2784,7 +2850,6 @@ declare class IssuerStateValidator {
2784
2850
  private fetchIssuerState;
2785
2851
  }
2786
2852
 
2787
- /** SDK package version — bumped on every release */
2788
- declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
2853
+ declare const PAFI_ISSUER_SDK_VERSION: string;
2789
2854
 
2790
- export { type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, 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 ClaimDto, type CombinedBalance, type ConfigDto, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, FeeManager, type FeeManagerConfig, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, 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, PafiSdkError, type PendingCredit, type PendingUserOpEntry, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, type RedeemDto, type RedeemPrepareDto, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SdkErrorBody, type SdkErrorHttpStatus, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, authenticateRequest, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
2855
+ export { AdapterMisconfiguredError, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, 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 ClaimDto, type CombinedBalance, type ConfigDto, ConfigurationError, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, FeeManager, type FeeManagerConfig, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, 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, PafiSdkError, type PendingCredit, type PendingUserOpEntry, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, type RedeemDto, type RedeemPrepareDto, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type RetryConfig, type SdkErrorBody, type SdkErrorHttpStatus, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, ValidationError, authenticateRequest, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };