@pafi-dev/issuer 0.5.37 → 0.5.38
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 +46 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2156,6 +2156,68 @@ interface QuotePointTokenToUsdtResult {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
declare function quotePointTokenToUsdt(params: QuotePointTokenToUsdtParams): Promise<QuotePointTokenToUsdtResult>;
|
|
2158
2158
|
|
|
2159
|
+
/**
|
|
2160
|
+
* Normalized HTTP status the issuer controller should surface for a
|
|
2161
|
+
* given SDK error. Kept to the three statuses every issuer needs —
|
|
2162
|
+
* `400/500/etc.` are not used because every SDK error already maps
|
|
2163
|
+
* cleanly into one of these three buckets.
|
|
2164
|
+
*/
|
|
2165
|
+
type SdkErrorStatus = "not_found" | "unprocessable" | "service_unavailable";
|
|
2166
|
+
/**
|
|
2167
|
+
* Structured body the issuer controller passes to its
|
|
2168
|
+
* framework-specific exception class. Mirrors the shape every PAFI
|
|
2169
|
+
* issuer surfaces over HTTP today.
|
|
2170
|
+
*/
|
|
2171
|
+
interface SdkErrorBody {
|
|
2172
|
+
code: string;
|
|
2173
|
+
message: string;
|
|
2174
|
+
details?: unknown;
|
|
2175
|
+
safeToRetry: boolean;
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Per-status exception factories. The issuer's controller wires one
|
|
2179
|
+
* factory per status to its preferred framework's exception class
|
|
2180
|
+
* (NestJS `UnprocessableEntityException`, Fastify `httpErrors.badData`,
|
|
2181
|
+
* etc). The factory must throw or return an Error — `createSdkErrorMapper`
|
|
2182
|
+
* uses `throw factory(body)` so either form is fine.
|
|
2183
|
+
*/
|
|
2184
|
+
interface SdkErrorMapperFactories {
|
|
2185
|
+
notFound: (body: SdkErrorBody) => Error;
|
|
2186
|
+
unprocessable: (body: SdkErrorBody) => Error;
|
|
2187
|
+
serviceUnavailable: (body: SdkErrorBody) => Error;
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Build a single error-mapping function that converts any typed SDK
|
|
2191
|
+
* error into the issuer's framework-specific HTTP exception.
|
|
2192
|
+
*
|
|
2193
|
+
* - `PendingUserOpNotFoundError` → 404 (lock expired / already submitted)
|
|
2194
|
+
* - `BundlerNotConfiguredError` → 503 (PAFI backend client missing)
|
|
2195
|
+
* - `IssuerStateError` → 422 (cap exceeded / inactive)
|
|
2196
|
+
* - `PerpDepositError` → 422 (Orderly relay quote / broker)
|
|
2197
|
+
* - `PTClaimError`, `PTRedeemError`, `SwapError`, `BundlerRejectedError` → 422
|
|
2198
|
+
* - any other error → re-thrown as-is
|
|
2199
|
+
*
|
|
2200
|
+
* `safeToRetry` is `true` only for transient cases:
|
|
2201
|
+
* - `MINT_CAP_EXCEEDED` (cap may free up between requests)
|
|
2202
|
+
* - `RELAY_FEE_EXCEEDS_AMOUNT` (Orderly fee may drop)
|
|
2203
|
+
*
|
|
2204
|
+
* Usage (NestJS):
|
|
2205
|
+
*
|
|
2206
|
+
* ```ts
|
|
2207
|
+
* const mapSdkError = createSdkErrorMapper({
|
|
2208
|
+
* notFound: (body) => new NotFoundException(body),
|
|
2209
|
+
* unprocessable: (body) => new UnprocessableEntityException(body),
|
|
2210
|
+
* serviceUnavailable: (body) => new ServiceUnavailableException(body),
|
|
2211
|
+
* });
|
|
2212
|
+
*
|
|
2213
|
+
* try { ... } catch (err) { mapSdkError(err); }
|
|
2214
|
+
* ```
|
|
2215
|
+
*
|
|
2216
|
+
* Returns `never` so call sites in `try/catch` propagate the throw
|
|
2217
|
+
* without a redundant `throw` keyword.
|
|
2218
|
+
*/
|
|
2219
|
+
declare function createSdkErrorMapper(factories: SdkErrorMapperFactories): (err: unknown) => never;
|
|
2220
|
+
|
|
2159
2221
|
/**
|
|
2160
2222
|
* Config for `createSubgraphPoolsProvider`.
|
|
2161
2223
|
*/
|
|
@@ -2680,4 +2742,4 @@ declare class IssuerStateValidator {
|
|
|
2680
2742
|
/** SDK package version — bumped on every release */
|
|
2681
2743
|
declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
|
|
2682
2744
|
|
|
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 };
|
|
2745
|
+
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 SdkErrorBody, type SdkErrorMapperFactories, type SdkErrorStatus, 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, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, quotePointTokenToUsdt, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
|
package/dist/index.d.ts
CHANGED
|
@@ -2156,6 +2156,68 @@ interface QuotePointTokenToUsdtResult {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
declare function quotePointTokenToUsdt(params: QuotePointTokenToUsdtParams): Promise<QuotePointTokenToUsdtResult>;
|
|
2158
2158
|
|
|
2159
|
+
/**
|
|
2160
|
+
* Normalized HTTP status the issuer controller should surface for a
|
|
2161
|
+
* given SDK error. Kept to the three statuses every issuer needs —
|
|
2162
|
+
* `400/500/etc.` are not used because every SDK error already maps
|
|
2163
|
+
* cleanly into one of these three buckets.
|
|
2164
|
+
*/
|
|
2165
|
+
type SdkErrorStatus = "not_found" | "unprocessable" | "service_unavailable";
|
|
2166
|
+
/**
|
|
2167
|
+
* Structured body the issuer controller passes to its
|
|
2168
|
+
* framework-specific exception class. Mirrors the shape every PAFI
|
|
2169
|
+
* issuer surfaces over HTTP today.
|
|
2170
|
+
*/
|
|
2171
|
+
interface SdkErrorBody {
|
|
2172
|
+
code: string;
|
|
2173
|
+
message: string;
|
|
2174
|
+
details?: unknown;
|
|
2175
|
+
safeToRetry: boolean;
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Per-status exception factories. The issuer's controller wires one
|
|
2179
|
+
* factory per status to its preferred framework's exception class
|
|
2180
|
+
* (NestJS `UnprocessableEntityException`, Fastify `httpErrors.badData`,
|
|
2181
|
+
* etc). The factory must throw or return an Error — `createSdkErrorMapper`
|
|
2182
|
+
* uses `throw factory(body)` so either form is fine.
|
|
2183
|
+
*/
|
|
2184
|
+
interface SdkErrorMapperFactories {
|
|
2185
|
+
notFound: (body: SdkErrorBody) => Error;
|
|
2186
|
+
unprocessable: (body: SdkErrorBody) => Error;
|
|
2187
|
+
serviceUnavailable: (body: SdkErrorBody) => Error;
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Build a single error-mapping function that converts any typed SDK
|
|
2191
|
+
* error into the issuer's framework-specific HTTP exception.
|
|
2192
|
+
*
|
|
2193
|
+
* - `PendingUserOpNotFoundError` → 404 (lock expired / already submitted)
|
|
2194
|
+
* - `BundlerNotConfiguredError` → 503 (PAFI backend client missing)
|
|
2195
|
+
* - `IssuerStateError` → 422 (cap exceeded / inactive)
|
|
2196
|
+
* - `PerpDepositError` → 422 (Orderly relay quote / broker)
|
|
2197
|
+
* - `PTClaimError`, `PTRedeemError`, `SwapError`, `BundlerRejectedError` → 422
|
|
2198
|
+
* - any other error → re-thrown as-is
|
|
2199
|
+
*
|
|
2200
|
+
* `safeToRetry` is `true` only for transient cases:
|
|
2201
|
+
* - `MINT_CAP_EXCEEDED` (cap may free up between requests)
|
|
2202
|
+
* - `RELAY_FEE_EXCEEDS_AMOUNT` (Orderly fee may drop)
|
|
2203
|
+
*
|
|
2204
|
+
* Usage (NestJS):
|
|
2205
|
+
*
|
|
2206
|
+
* ```ts
|
|
2207
|
+
* const mapSdkError = createSdkErrorMapper({
|
|
2208
|
+
* notFound: (body) => new NotFoundException(body),
|
|
2209
|
+
* unprocessable: (body) => new UnprocessableEntityException(body),
|
|
2210
|
+
* serviceUnavailable: (body) => new ServiceUnavailableException(body),
|
|
2211
|
+
* });
|
|
2212
|
+
*
|
|
2213
|
+
* try { ... } catch (err) { mapSdkError(err); }
|
|
2214
|
+
* ```
|
|
2215
|
+
*
|
|
2216
|
+
* Returns `never` so call sites in `try/catch` propagate the throw
|
|
2217
|
+
* without a redundant `throw` keyword.
|
|
2218
|
+
*/
|
|
2219
|
+
declare function createSdkErrorMapper(factories: SdkErrorMapperFactories): (err: unknown) => never;
|
|
2220
|
+
|
|
2159
2221
|
/**
|
|
2160
2222
|
* Config for `createSubgraphPoolsProvider`.
|
|
2161
2223
|
*/
|
|
@@ -2680,4 +2742,4 @@ declare class IssuerStateValidator {
|
|
|
2680
2742
|
/** SDK package version — bumped on every release */
|
|
2681
2743
|
declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
|
|
2682
2744
|
|
|
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 };
|
|
2745
|
+
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 SdkErrorBody, type SdkErrorMapperFactories, type SdkErrorStatus, 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, createSdkErrorMapper, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider, handleClaimStatus, handleDelegateSubmit, handleMobilePrepare, handleMobileSubmit, handleRedeemStatus, mergePaymasterFields, prepareMobileUserOp, quotePointTokenToUsdt, relayUserOp, requestPaymaster, serializeEntryToJsonRpc, serializeUserOpTypedData };
|
package/dist/index.js
CHANGED
|
@@ -2519,6 +2519,50 @@ async function quotePointTokenToUsdt(params) {
|
|
|
2519
2519
|
};
|
|
2520
2520
|
}
|
|
2521
2521
|
|
|
2522
|
+
// src/api/errorMapper.ts
|
|
2523
|
+
function createSdkErrorMapper(factories) {
|
|
2524
|
+
return (err) => {
|
|
2525
|
+
if (err instanceof PendingUserOpNotFoundError) {
|
|
2526
|
+
throw factories.notFound({
|
|
2527
|
+
code: err.code,
|
|
2528
|
+
message: err.message,
|
|
2529
|
+
safeToRetry: false
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2532
|
+
if (err instanceof BundlerNotConfiguredError) {
|
|
2533
|
+
throw factories.serviceUnavailable({
|
|
2534
|
+
code: err.code,
|
|
2535
|
+
message: err.message,
|
|
2536
|
+
safeToRetry: false
|
|
2537
|
+
});
|
|
2538
|
+
}
|
|
2539
|
+
if (err instanceof IssuerStateError) {
|
|
2540
|
+
throw factories.unprocessable({
|
|
2541
|
+
code: err.code,
|
|
2542
|
+
message: err.message,
|
|
2543
|
+
details: err.details,
|
|
2544
|
+
safeToRetry: err.code === "MINT_CAP_EXCEEDED"
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
if (err instanceof PerpDepositError) {
|
|
2548
|
+
throw factories.unprocessable({
|
|
2549
|
+
code: err.code,
|
|
2550
|
+
message: err.message,
|
|
2551
|
+
safeToRetry: err.code === "RELAY_FEE_EXCEEDS_AMOUNT"
|
|
2552
|
+
});
|
|
2553
|
+
}
|
|
2554
|
+
if (err instanceof PTClaimError || err instanceof PTRedeemError || err instanceof SwapError || err instanceof BundlerRejectedError) {
|
|
2555
|
+
throw factories.unprocessable({
|
|
2556
|
+
code: err.code,
|
|
2557
|
+
message: err.message,
|
|
2558
|
+
details: "details" in err ? err.details : void 0,
|
|
2559
|
+
safeToRetry: false
|
|
2560
|
+
});
|
|
2561
|
+
}
|
|
2562
|
+
throw err;
|
|
2563
|
+
};
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2522
2566
|
// src/pools/subgraphPoolsProvider.ts
|
|
2523
2567
|
import { isAddress } from "viem";
|
|
2524
2568
|
import { PAFI_SUBGRAPH_URL } from "@pafi-dev/core";
|
|
@@ -3454,6 +3498,7 @@ export {
|
|
|
3454
3498
|
authenticateRequest,
|
|
3455
3499
|
createIssuerService,
|
|
3456
3500
|
createNativePtQuoter,
|
|
3501
|
+
createSdkErrorMapper,
|
|
3457
3502
|
createSubgraphNativeUsdtQuoter,
|
|
3458
3503
|
createSubgraphPoolsProvider,
|
|
3459
3504
|
handleClaimStatus,
|