@pafi-dev/issuer 0.8.0 → 0.9.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/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
- import { PafiSdkError, SdkErrorHttpStatus, PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, RedemptionPolicy, RedemptionPolicySource, RedemptionPreview, RedemptionDecision, RedemptionDenialCode, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
2
- export { PAFI_SUBGRAPH_URL, PafiSdkError, SdkErrorHttpStatus, ValidationError } from '@pafi-dev/core';
1
+ import { PafiSdkError, SdkErrorHttpStatus, PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, RedemptionPolicy, RedemptionPolicySource, RedemptionPreview, RedemptionDecision, RedemptionDenialCode, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, PafiErrorType, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
2
+ export { PAFI_SUBGRAPH_URL, PafiErrorType, PafiSdkError, SDK_ERROR_HTTP_STATUS_CODE, SdkErrorHttpStatus, ValidationError, defaultErrorTypeForStatus } from '@pafi-dev/core';
3
+ export { GenericHttpExceptionDescriptor, NormalizeContext, PafiErrorEnvelope, PafiErrorPayload, buildErrorEnvelope, payloadFromGenericError, payloadFromHttpException, payloadFromPafiSdkError } from './http/index.cjs';
3
4
  import { Address, Hex, PublicClient, WalletClient } from 'viem';
4
5
 
5
6
  /**
@@ -2367,13 +2368,36 @@ declare function handleDelegateSubmit(params: HandleDelegateSubmitParams): Promi
2367
2368
  type SdkErrorStatus = SdkErrorHttpStatus;
2368
2369
  /**
2369
2370
  * Structured body the issuer controller passes to its
2370
- * framework-specific exception class. Mirrors the shape every PAFI
2371
- * issuer surfaces over HTTP today.
2371
+ * framework-specific exception class. Stripe-style envelope:
2372
+ *
2373
+ * ```json
2374
+ * {
2375
+ * "type": "business_logic_error",
2376
+ * "code": "REDEMPTION_POLICY_DENIED",
2377
+ * "message": "...",
2378
+ * "param": null,
2379
+ * "metadata": { "policyDenialCode": "PER_TX_MIN" },
2380
+ * "safeToRetry": false
2381
+ * }
2382
+ * ```
2383
+ *
2384
+ * Carries enough fields for the global HTTP filter to emit the final
2385
+ * envelope without losing any SDK-side context.
2372
2386
  */
2373
2387
  interface SdkErrorBody {
2388
+ /** Stripe-style taxonomy slot — drives UI branching. */
2389
+ type: PafiErrorType;
2390
+ /** Machine-readable code, e.g. `"REDEMPTION_POLICY_DENIED"`. */
2374
2391
  code: string;
2392
+ /** Human-readable message. */
2375
2393
  message: string;
2394
+ /** Field name that triggered the error, when applicable. */
2395
+ param?: string;
2396
+ /** UI-facing structured context. */
2397
+ metadata?: Record<string, unknown>;
2398
+ /** Raw debug context. */
2376
2399
  details?: unknown;
2400
+ /** True when retry is safe (no side effects yet). */
2377
2401
  safeToRetry: boolean;
2378
2402
  }
2379
2403
  /**
@@ -2389,6 +2413,12 @@ interface SdkErrorMapperFactories {
2389
2413
  unprocessable: (body: SdkErrorBody) => Error;
2390
2414
  serviceUnavailable: (body: SdkErrorBody) => Error;
2391
2415
  }
2416
+ /**
2417
+ * Build the Stripe-style body from any `PafiSdkError`. Exposed for
2418
+ * frameworks that don't fit the four-factory shape (e.g. a Hono error
2419
+ * handler that builds its own response object).
2420
+ */
2421
+ declare function buildSdkErrorBody(err: PafiSdkError): SdkErrorBody;
2392
2422
  /**
2393
2423
  * Build a single error-mapping function that converts any `PafiSdkError`
2394
2424
  * into the issuer's framework-specific HTTP exception. Status, code,
@@ -3315,4 +3345,4 @@ declare class MemoryRedemptionHistoryStore implements IRedemptionHistoryStore {
3315
3345
 
3316
3346
  declare const PAFI_ISSUER_SDK_VERSION: string;
3317
3347
 
3318
- export { AdapterMisconfiguredError, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedemptionEvaluateRequest, type ApiRedemptionEvaluateResponse, type ApiRedemptionPreviewRequest, type ApiRedemptionPreviewResponse, 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, DEFAULT_REDEMPTION_POLICY, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, type EvaluateInput, FeeManager, type FeeManagerConfig, type FetchFailureReason, type FetchResult, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type IRateLimiter, type IRedemptionHistoryStore, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemoryRateLimiter, MemoryRedemptionHistoryStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, type NativePtQuoterConfig, NonceManager, NoopRateLimiter, 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, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, PolicyProvider, type PolicyProviderConfig, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, REDEMPTION_HISTORY_WINDOW_SEC, type RateLimitAction, type RateLimiterConfig, type RedeemDto, type RedeemPrepareDto, RedemptionService, type RedemptionServiceConfig, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type ResolvedPolicy, type RetryConfig, type SdkErrorBody, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, SettlementClient, type SettlementClientConfig, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, type UserHistory, authenticateRequest, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, defaultPolicyFor, evaluateRedemption, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
3348
+ export { AdapterMisconfiguredError, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedemptionEvaluateRequest, type ApiRedemptionEvaluateResponse, type ApiRedemptionPreviewRequest, type ApiRedemptionPreviewResponse, 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, DEFAULT_REDEMPTION_POLICY, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, type EvaluateInput, FeeManager, type FeeManagerConfig, type FetchFailureReason, type FetchResult, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type IRateLimiter, type IRedemptionHistoryStore, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemoryRateLimiter, MemoryRedemptionHistoryStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, type NativePtQuoterConfig, NonceManager, NoopRateLimiter, 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, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, PolicyProvider, type PolicyProviderConfig, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, REDEMPTION_HISTORY_WINDOW_SEC, type RateLimitAction, type RateLimiterConfig, type RedeemDto, type RedeemPrepareDto, RedemptionService, type RedemptionServiceConfig, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type ResolvedPolicy, type RetryConfig, type SdkErrorBody, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, SettlementClient, type SettlementClientConfig, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, type UserHistory, authenticateRequest, buildSdkErrorBody, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, defaultPolicyFor, evaluateRedemption, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { PafiSdkError, SdkErrorHttpStatus, PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, RedemptionPolicy, RedemptionPolicySource, RedemptionPreview, RedemptionDecision, RedemptionDenialCode, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
2
- export { PAFI_SUBGRAPH_URL, PafiSdkError, SdkErrorHttpStatus, ValidationError } from '@pafi-dev/core';
1
+ import { PafiSdkError, SdkErrorHttpStatus, PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, RedemptionPolicy, RedemptionPolicySource, RedemptionPreview, RedemptionDecision, RedemptionDenialCode, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, PafiErrorType, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
2
+ export { PAFI_SUBGRAPH_URL, PafiErrorType, PafiSdkError, SDK_ERROR_HTTP_STATUS_CODE, SdkErrorHttpStatus, ValidationError, defaultErrorTypeForStatus } from '@pafi-dev/core';
3
+ export { GenericHttpExceptionDescriptor, NormalizeContext, PafiErrorEnvelope, PafiErrorPayload, buildErrorEnvelope, payloadFromGenericError, payloadFromHttpException, payloadFromPafiSdkError } from './http/index.js';
3
4
  import { Address, Hex, PublicClient, WalletClient } from 'viem';
4
5
 
5
6
  /**
@@ -2367,13 +2368,36 @@ declare function handleDelegateSubmit(params: HandleDelegateSubmitParams): Promi
2367
2368
  type SdkErrorStatus = SdkErrorHttpStatus;
2368
2369
  /**
2369
2370
  * Structured body the issuer controller passes to its
2370
- * framework-specific exception class. Mirrors the shape every PAFI
2371
- * issuer surfaces over HTTP today.
2371
+ * framework-specific exception class. Stripe-style envelope:
2372
+ *
2373
+ * ```json
2374
+ * {
2375
+ * "type": "business_logic_error",
2376
+ * "code": "REDEMPTION_POLICY_DENIED",
2377
+ * "message": "...",
2378
+ * "param": null,
2379
+ * "metadata": { "policyDenialCode": "PER_TX_MIN" },
2380
+ * "safeToRetry": false
2381
+ * }
2382
+ * ```
2383
+ *
2384
+ * Carries enough fields for the global HTTP filter to emit the final
2385
+ * envelope without losing any SDK-side context.
2372
2386
  */
2373
2387
  interface SdkErrorBody {
2388
+ /** Stripe-style taxonomy slot — drives UI branching. */
2389
+ type: PafiErrorType;
2390
+ /** Machine-readable code, e.g. `"REDEMPTION_POLICY_DENIED"`. */
2374
2391
  code: string;
2392
+ /** Human-readable message. */
2375
2393
  message: string;
2394
+ /** Field name that triggered the error, when applicable. */
2395
+ param?: string;
2396
+ /** UI-facing structured context. */
2397
+ metadata?: Record<string, unknown>;
2398
+ /** Raw debug context. */
2376
2399
  details?: unknown;
2400
+ /** True when retry is safe (no side effects yet). */
2377
2401
  safeToRetry: boolean;
2378
2402
  }
2379
2403
  /**
@@ -2389,6 +2413,12 @@ interface SdkErrorMapperFactories {
2389
2413
  unprocessable: (body: SdkErrorBody) => Error;
2390
2414
  serviceUnavailable: (body: SdkErrorBody) => Error;
2391
2415
  }
2416
+ /**
2417
+ * Build the Stripe-style body from any `PafiSdkError`. Exposed for
2418
+ * frameworks that don't fit the four-factory shape (e.g. a Hono error
2419
+ * handler that builds its own response object).
2420
+ */
2421
+ declare function buildSdkErrorBody(err: PafiSdkError): SdkErrorBody;
2392
2422
  /**
2393
2423
  * Build a single error-mapping function that converts any `PafiSdkError`
2394
2424
  * into the issuer's framework-specific HTTP exception. Status, code,
@@ -3315,4 +3345,4 @@ declare class MemoryRedemptionHistoryStore implements IRedemptionHistoryStore {
3315
3345
 
3316
3346
  declare const PAFI_ISSUER_SDK_VERSION: string;
3317
3347
 
3318
- export { AdapterMisconfiguredError, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedemptionEvaluateRequest, type ApiRedemptionEvaluateResponse, type ApiRedemptionPreviewRequest, type ApiRedemptionPreviewResponse, 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, DEFAULT_REDEMPTION_POLICY, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, type EvaluateInput, FeeManager, type FeeManagerConfig, type FetchFailureReason, type FetchResult, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type IRateLimiter, type IRedemptionHistoryStore, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemoryRateLimiter, MemoryRedemptionHistoryStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, type NativePtQuoterConfig, NonceManager, NoopRateLimiter, 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, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, PolicyProvider, type PolicyProviderConfig, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, REDEMPTION_HISTORY_WINDOW_SEC, type RateLimitAction, type RateLimiterConfig, type RedeemDto, type RedeemPrepareDto, RedemptionService, type RedemptionServiceConfig, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type ResolvedPolicy, type RetryConfig, type SdkErrorBody, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, SettlementClient, type SettlementClientConfig, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, type UserHistory, authenticateRequest, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, defaultPolicyFor, evaluateRedemption, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
3348
+ export { AdapterMisconfiguredError, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedemptionEvaluateRequest, type ApiRedemptionEvaluateResponse, type ApiRedemptionPreviewRequest, type ApiRedemptionPreviewResponse, 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, DEFAULT_REDEMPTION_POLICY, type DecodedCallDto, DefaultPolicyEngine, type DefaultPolicyEngineOptions, type DelegatePrepareDto, type DelegateStatusDto, type EvaluateInput, FeeManager, type FeeManagerConfig, type FetchFailureReason, type FetchResult, type GasFeeDto, type HandleDelegateSubmitParams, type HandleDelegateSubmitResult, type HandleMobilePrepareParams, type HandleMobilePrepareResult, type HandleMobileSubmitParams, type IIndexerCursorStore, type IPendingUserOpStore, type IPointLedger, type IPolicyEngine, type IRateLimiter, type IRedemptionHistoryStore, type ISessionStore, InMemoryCursorStore, IssuerApiAdapter, type IssuerApiAdapterConfig, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerRegistryRecord, type IssuerService, type IssuerServiceConfig, IssuerStateError, IssuerStateValidator, LockNotFoundError, type LockedMintRequest, type LoginResult, MemoryPendingUserOpStore, MemoryRateLimiter, MemoryRedemptionHistoryStore, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintStatusParams, type MintStatusResponse, type MintingStatus, type MobilePrepareDto, type MobileSubmitDto, type NativePtQuoterConfig, NonceManager, NoopRateLimiter, 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, PendingUserOpForbiddenError, PendingUserOpNotFoundError, type PerpDepositDto, PerpDepositError, PerpDepositHandler, type PerpDepositHandlerConfig, type PerpDepositRequest, type PerpDepositResponse, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, PolicyProvider, type PolicyProviderConfig, type PoolsDto, type PoolsProvider, type PreValidateMintResult, type PrepareBurnParams, type PrepareMintParams, type PrepareMobileUserOpParams, type PrepareMobileUserOpResult, type PreparedUserOp, REDEMPTION_HISTORY_WINDOW_SEC, type RateLimitAction, type RateLimiterConfig, type RedeemDto, type RedeemPrepareDto, RedemptionService, type RedemptionServiceConfig, RelayError, type RelayErrorCode, RelayService, type RelayUserOpParams, type RelayUserOpRequest, type RelayUserOpResponse, type RequestPaymasterParams, type ResolvedPolicy, type RetryConfig, type SdkErrorBody, type SdkErrorMapperFactories, type SdkErrorStatus, type SerializedUserOpTypedData, type Session, SettlementClient, type SettlementClientConfig, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, type UserDto, type UserHistory, authenticateRequest, buildSdkErrorBody, createIssuerService, createNativePtQuoter, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, defaultPolicyFor, evaluateRedemption, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
package/dist/index.js CHANGED
@@ -1,19 +1,17 @@
1
- // src/errors.ts
1
+ import "./chunk-R4FYJZ2N.js";
2
2
  import {
3
- PafiSdkError
4
- } from "@pafi-dev/core";
5
- import { PafiSdkError as PafiSdkError2 } from "@pafi-dev/core";
6
- import { ValidationError } from "@pafi-dev/core";
7
- var ConfigurationError = class extends PafiSdkError2 {
8
- httpStatus = "service_unavailable";
9
- code;
10
- details;
11
- constructor(code, message, details) {
12
- super(message);
13
- this.code = code;
14
- this.details = details;
15
- }
16
- };
3
+ ConfigurationError,
4
+ PafiSdkError,
5
+ SDK_ERROR_HTTP_STATUS_CODE,
6
+ ValidationError,
7
+ buildErrorEnvelope,
8
+ buildSdkErrorBody,
9
+ createSdkErrorMapper,
10
+ defaultErrorTypeForStatus,
11
+ payloadFromGenericError,
12
+ payloadFromHttpException,
13
+ payloadFromPafiSdkError
14
+ } from "./chunk-U3WMORJG.js";
17
15
 
18
16
  // src/policy/defaultPolicy.ts
19
17
  var DefaultPolicyEngine = class {
@@ -2742,31 +2740,6 @@ async function handleDelegateSubmit(params) {
2742
2740
  return { userOpHash: result.userOpHash };
2743
2741
  }
2744
2742
 
2745
- // src/api/errorMapper.ts
2746
- function createSdkErrorMapper(factories) {
2747
- return (err) => {
2748
- if (!(err instanceof PafiSdkError)) {
2749
- throw err;
2750
- }
2751
- const body = {
2752
- code: err.code,
2753
- message: err.message,
2754
- details: err.details,
2755
- safeToRetry: err.safeToRetry
2756
- };
2757
- switch (err.httpStatus) {
2758
- case "not_found":
2759
- throw factories.notFound(body);
2760
- case "forbidden":
2761
- throw factories.forbidden(body);
2762
- case "unprocessable":
2763
- throw factories.unprocessable(body);
2764
- case "service_unavailable":
2765
- throw factories.serviceUnavailable(body);
2766
- }
2767
- };
2768
- }
2769
-
2770
2743
  // src/api/issuerApiAdapter.ts
2771
2744
  import { randomUUID } from "crypto";
2772
2745
  import { getAddress as getAddress10 } from "viem";
@@ -4418,7 +4391,7 @@ var MemoryRedemptionHistoryStore = class {
4418
4391
  };
4419
4392
 
4420
4393
  // src/index.ts
4421
- var PAFI_ISSUER_SDK_VERSION = true ? "0.8.0" : "dev";
4394
+ var PAFI_ISSUER_SDK_VERSION = true ? "0.9.0" : "dev";
4422
4395
  export {
4423
4396
  AdapterMisconfiguredError,
4424
4397
  AuthError,
@@ -4462,14 +4435,18 @@ export {
4462
4435
  RedemptionService,
4463
4436
  RelayError,
4464
4437
  RelayService,
4438
+ SDK_ERROR_HTTP_STATUS_CODE,
4465
4439
  SettlementClient,
4466
4440
  ValidationError,
4467
4441
  authenticateRequest,
4442
+ buildErrorEnvelope,
4443
+ buildSdkErrorBody,
4468
4444
  createIssuerService,
4469
4445
  createNativePtQuoter,
4470
4446
  createSdkErrorMapper,
4471
4447
  createSubgraphNativeUsdtQuoter,
4472
4448
  createSubgraphPoolsProvider,
4449
+ defaultErrorTypeForStatus,
4473
4450
  defaultPolicyFor,
4474
4451
  evaluateRedemption,
4475
4452
  handleClaimStatus,
@@ -4478,6 +4455,9 @@ export {
4478
4455
  handleMobileSubmit,
4479
4456
  handleRedeemStatus,
4480
4457
  mergePaymasterFields,
4458
+ payloadFromGenericError,
4459
+ payloadFromHttpException,
4460
+ payloadFromPafiSdkError,
4481
4461
  prepareMobileUserOp,
4482
4462
  relayUserOp,
4483
4463
  requestPaymaster,