@pafi-dev/issuer 0.7.2 → 0.7.4
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 +121 -139
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -80
- package/dist/index.d.ts +23 -80
- package/dist/index.js +24 -40
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,55 +1,18 @@
|
|
|
1
|
+
import { PafiSdkError, SdkErrorHttpStatus, PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, Eip7702AuthorizationJsonRpc, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
2
|
+
export { PAFI_SUBGRAPH_URL, PafiSdkError, SdkErrorHttpStatus, ValidationError } from '@pafi-dev/core';
|
|
1
3
|
import { Address, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, Eip7702AuthorizationJsonRpc, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
3
|
-
export { PAFI_SUBGRAPH_URL } from '@pafi-dev/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* v0.7.4 — `PafiSdkError` + `SdkErrorHttpStatus` were moved to
|
|
7
|
+
* `@pafi-dev/core/errors` so core-level errors (e.g. `OracleStaleError`)
|
|
8
|
+
* can extend the same base. Issuer re-exports the canonical types
|
|
9
|
+
* here for back-compat. See SDK_CORE_TRADING_AUDIT.md H3.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `details` is `unknown` so subclasses can attach structured context
|
|
16
|
-
* (offending value, on-chain state snapshot, etc.) without locking
|
|
17
|
-
* the base shape.
|
|
18
|
-
*
|
|
19
|
-
* `httpStatus` is the recommended HTTP status the issuer's HTTP layer
|
|
20
|
-
* should surface. Kept on the SDK side because the SDK already knows
|
|
21
|
-
* the right status (e.g. `IssuerStateError` is always 422); leaving it
|
|
22
|
-
* to issuer controllers means each one re-implements the same mapping.
|
|
11
|
+
* Effect: `instanceof PafiSdkError` from EITHER package now catches
|
|
12
|
+
* errors thrown from EITHER package — no more silent fall-through to
|
|
13
|
+
* 500 for core-thrown errors.
|
|
23
14
|
*/
|
|
24
|
-
|
|
25
|
-
declare abstract class PafiSdkError extends Error {
|
|
26
|
-
abstract readonly code: string;
|
|
27
|
-
/**
|
|
28
|
-
* `true` when the FE should consider a retry safe — typically because
|
|
29
|
-
* the failure is transient (`MINT_CAP_EXCEEDED` may free up,
|
|
30
|
-
* `RELAY_FEE_EXCEEDS_AMOUNT` may drop on next quote). Defaults to
|
|
31
|
-
* `false` — subclasses opt in per-code.
|
|
32
|
-
*/
|
|
33
|
-
readonly safeToRetry: boolean;
|
|
34
|
-
readonly details?: unknown;
|
|
35
|
-
abstract readonly httpStatus: SdkErrorHttpStatus;
|
|
36
|
-
constructor(message: string);
|
|
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
|
-
}
|
|
15
|
+
|
|
53
16
|
/**
|
|
54
17
|
* Issuer wired the SDK without a dependency the requested endpoint
|
|
55
18
|
* needs (e.g. `/gas-fee` called but `feeManager` not configured;
|
|
@@ -469,18 +432,6 @@ declare class AuthError extends PafiSdkError {
|
|
|
469
432
|
constructor(code: AuthErrorCode, message: string);
|
|
470
433
|
}
|
|
471
434
|
|
|
472
|
-
/**
|
|
473
|
-
* Errors raised by RelayService carry a `code` so callers (handlers /
|
|
474
|
-
* gateway-less HTTP wrappers) can decide how to map them to HTTP status.
|
|
475
|
-
*
|
|
476
|
-
* v1.4 trimmed the error space to just encoding failures — the service
|
|
477
|
-
* no longer broadcasts transactions, so `SUBMIT_FAILED`, `TX_REVERTED`,
|
|
478
|
-
* `SIMULATION_FAILED`, and `TIMEOUT` all went away with the operator
|
|
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.
|
|
483
|
-
*/
|
|
484
435
|
type RelayErrorCode = "ENCODE_FAILED";
|
|
485
436
|
declare class RelayError extends PafiSdkError {
|
|
486
437
|
readonly httpStatus: "unprocessable";
|
|
@@ -2002,14 +1953,19 @@ declare class PerpDepositHandler {
|
|
|
2002
1953
|
|
|
2003
1954
|
/**
|
|
2004
1955
|
* Pure mechanics for the EIP-7702 delegation submit flow. Builds the
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
1956
|
+
* delegation-anchor UserOp via `buildDelegationUserOp` (self-call EOA
|
|
1957
|
+
* with empty calldata), attaches paymaster sponsorship, splits the
|
|
1958
|
+
* user's authorization signature into the JSON-RPC tuple, and relays
|
|
1959
|
+
* via the PAFI sponsor-relayer.
|
|
1960
|
+
*
|
|
1961
|
+
* The UserOp itself is a no-op — a self-call to the user's EOA with
|
|
1962
|
+
* `data: "0x"`. The work is in the `eip7702Auth` object: the bundler
|
|
1963
|
+
* picks it up, runs the EIP-7702 path, and installs the delegation on
|
|
1964
|
+
* the user's EOA atomically with the (no-op) UserOp.
|
|
2008
1965
|
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
* user's EOA atomically with the (empty) UserOp.
|
|
1966
|
+
* v0.7.1 — switched from `encodeBatchExecute([])` (which throws
|
|
1967
|
+
* "operations array must not be empty") to `buildDelegationUserOp`
|
|
1968
|
+
* (self-call pattern). See SDK_CORE_TRADING_AUDIT.md C1.
|
|
2013
1969
|
*
|
|
2014
1970
|
* Throws the same `BundlerNotConfiguredError` / `BundlerRejectedError`
|
|
2015
1971
|
* as other relay paths so issuer controllers can use one error mapper.
|
|
@@ -2343,14 +2299,6 @@ interface DelegatePrepareDto {
|
|
|
2343
2299
|
batchExecutorAddress: Address;
|
|
2344
2300
|
chainId: number;
|
|
2345
2301
|
}
|
|
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
2302
|
declare class AdapterMisconfiguredError extends Error {
|
|
2355
2303
|
readonly code: "ADAPTER_MISCONFIGURED";
|
|
2356
2304
|
constructor(message: string);
|
|
@@ -2424,11 +2372,6 @@ declare class IssuerApiAdapter {
|
|
|
2424
2372
|
/**
|
|
2425
2373
|
* Build + sign a SponsorAuth payload. Returns `undefined` when no
|
|
2426
2374
|
* 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.
|
|
2432
2375
|
*/
|
|
2433
2376
|
private buildSponsorAuth;
|
|
2434
2377
|
private runMobilePrepare;
|
|
@@ -2852,4 +2795,4 @@ declare class IssuerStateValidator {
|
|
|
2852
2795
|
|
|
2853
2796
|
declare const PAFI_ISSUER_SDK_VERSION: string;
|
|
2854
2797
|
|
|
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,
|
|
2798
|
+
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, 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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,55 +1,18 @@
|
|
|
1
|
+
import { PafiSdkError, SdkErrorHttpStatus, PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, Eip7702AuthorizationJsonRpc, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
2
|
+
export { PAFI_SUBGRAPH_URL, PafiSdkError, SdkErrorHttpStatus, ValidationError } from '@pafi-dev/core';
|
|
1
3
|
import { Address, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey, UserOpTypedData, decodeBatchExecuteCalls, BROKER_HASHES, Eip7702AuthorizationJsonRpc, BuiltSponsorAuth, ENTRY_POINT_V08 } from '@pafi-dev/core';
|
|
3
|
-
export { PAFI_SUBGRAPH_URL } from '@pafi-dev/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* v0.7.4 — `PafiSdkError` + `SdkErrorHttpStatus` were moved to
|
|
7
|
+
* `@pafi-dev/core/errors` so core-level errors (e.g. `OracleStaleError`)
|
|
8
|
+
* can extend the same base. Issuer re-exports the canonical types
|
|
9
|
+
* here for back-compat. See SDK_CORE_TRADING_AUDIT.md H3.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `details` is `unknown` so subclasses can attach structured context
|
|
16
|
-
* (offending value, on-chain state snapshot, etc.) without locking
|
|
17
|
-
* the base shape.
|
|
18
|
-
*
|
|
19
|
-
* `httpStatus` is the recommended HTTP status the issuer's HTTP layer
|
|
20
|
-
* should surface. Kept on the SDK side because the SDK already knows
|
|
21
|
-
* the right status (e.g. `IssuerStateError` is always 422); leaving it
|
|
22
|
-
* to issuer controllers means each one re-implements the same mapping.
|
|
11
|
+
* Effect: `instanceof PafiSdkError` from EITHER package now catches
|
|
12
|
+
* errors thrown from EITHER package — no more silent fall-through to
|
|
13
|
+
* 500 for core-thrown errors.
|
|
23
14
|
*/
|
|
24
|
-
|
|
25
|
-
declare abstract class PafiSdkError extends Error {
|
|
26
|
-
abstract readonly code: string;
|
|
27
|
-
/**
|
|
28
|
-
* `true` when the FE should consider a retry safe — typically because
|
|
29
|
-
* the failure is transient (`MINT_CAP_EXCEEDED` may free up,
|
|
30
|
-
* `RELAY_FEE_EXCEEDS_AMOUNT` may drop on next quote). Defaults to
|
|
31
|
-
* `false` — subclasses opt in per-code.
|
|
32
|
-
*/
|
|
33
|
-
readonly safeToRetry: boolean;
|
|
34
|
-
readonly details?: unknown;
|
|
35
|
-
abstract readonly httpStatus: SdkErrorHttpStatus;
|
|
36
|
-
constructor(message: string);
|
|
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
|
-
}
|
|
15
|
+
|
|
53
16
|
/**
|
|
54
17
|
* Issuer wired the SDK without a dependency the requested endpoint
|
|
55
18
|
* needs (e.g. `/gas-fee` called but `feeManager` not configured;
|
|
@@ -469,18 +432,6 @@ declare class AuthError extends PafiSdkError {
|
|
|
469
432
|
constructor(code: AuthErrorCode, message: string);
|
|
470
433
|
}
|
|
471
434
|
|
|
472
|
-
/**
|
|
473
|
-
* Errors raised by RelayService carry a `code` so callers (handlers /
|
|
474
|
-
* gateway-less HTTP wrappers) can decide how to map them to HTTP status.
|
|
475
|
-
*
|
|
476
|
-
* v1.4 trimmed the error space to just encoding failures — the service
|
|
477
|
-
* no longer broadcasts transactions, so `SUBMIT_FAILED`, `TX_REVERTED`,
|
|
478
|
-
* `SIMULATION_FAILED`, and `TIMEOUT` all went away with the operator
|
|
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.
|
|
483
|
-
*/
|
|
484
435
|
type RelayErrorCode = "ENCODE_FAILED";
|
|
485
436
|
declare class RelayError extends PafiSdkError {
|
|
486
437
|
readonly httpStatus: "unprocessable";
|
|
@@ -2002,14 +1953,19 @@ declare class PerpDepositHandler {
|
|
|
2002
1953
|
|
|
2003
1954
|
/**
|
|
2004
1955
|
* Pure mechanics for the EIP-7702 delegation submit flow. Builds the
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
1956
|
+
* delegation-anchor UserOp via `buildDelegationUserOp` (self-call EOA
|
|
1957
|
+
* with empty calldata), attaches paymaster sponsorship, splits the
|
|
1958
|
+
* user's authorization signature into the JSON-RPC tuple, and relays
|
|
1959
|
+
* via the PAFI sponsor-relayer.
|
|
1960
|
+
*
|
|
1961
|
+
* The UserOp itself is a no-op — a self-call to the user's EOA with
|
|
1962
|
+
* `data: "0x"`. The work is in the `eip7702Auth` object: the bundler
|
|
1963
|
+
* picks it up, runs the EIP-7702 path, and installs the delegation on
|
|
1964
|
+
* the user's EOA atomically with the (no-op) UserOp.
|
|
2008
1965
|
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
* user's EOA atomically with the (empty) UserOp.
|
|
1966
|
+
* v0.7.1 — switched from `encodeBatchExecute([])` (which throws
|
|
1967
|
+
* "operations array must not be empty") to `buildDelegationUserOp`
|
|
1968
|
+
* (self-call pattern). See SDK_CORE_TRADING_AUDIT.md C1.
|
|
2013
1969
|
*
|
|
2014
1970
|
* Throws the same `BundlerNotConfiguredError` / `BundlerRejectedError`
|
|
2015
1971
|
* as other relay paths so issuer controllers can use one error mapper.
|
|
@@ -2343,14 +2299,6 @@ interface DelegatePrepareDto {
|
|
|
2343
2299
|
batchExecutorAddress: Address;
|
|
2344
2300
|
chainId: number;
|
|
2345
2301
|
}
|
|
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
2302
|
declare class AdapterMisconfiguredError extends Error {
|
|
2355
2303
|
readonly code: "ADAPTER_MISCONFIGURED";
|
|
2356
2304
|
constructor(message: string);
|
|
@@ -2424,11 +2372,6 @@ declare class IssuerApiAdapter {
|
|
|
2424
2372
|
/**
|
|
2425
2373
|
* Build + sign a SponsorAuth payload. Returns `undefined` when no
|
|
2426
2374
|
* 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.
|
|
2432
2375
|
*/
|
|
2433
2376
|
private buildSponsorAuth;
|
|
2434
2377
|
private runMobilePrepare;
|
|
@@ -2852,4 +2795,4 @@ declare class IssuerStateValidator {
|
|
|
2852
2795
|
|
|
2853
2796
|
declare const PAFI_ISSUER_SDK_VERSION: string;
|
|
2854
2797
|
|
|
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,
|
|
2798
|
+
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, 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 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
// src/errors.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
safeToRetry = false;
|
|
10
|
-
details;
|
|
11
|
-
constructor(message) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.name = new.target.name;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var ValidationError = class extends PafiSdkError {
|
|
17
|
-
httpStatus = "unprocessable";
|
|
18
|
-
code;
|
|
19
|
-
details;
|
|
20
|
-
constructor(code, message, details) {
|
|
21
|
-
super(message);
|
|
22
|
-
this.code = code;
|
|
23
|
-
this.details = details;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var ConfigurationError = class extends PafiSdkError {
|
|
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 {
|
|
27
8
|
httpStatus = "service_unavailable";
|
|
28
9
|
code;
|
|
29
10
|
details;
|
|
@@ -2299,8 +2280,8 @@ var PerpDepositHandler = class {
|
|
|
2299
2280
|
// src/api/delegateHandler.ts
|
|
2300
2281
|
import {
|
|
2301
2282
|
ENTRY_POINT_V08 as ENTRY_POINT_V082,
|
|
2283
|
+
buildDelegationUserOp,
|
|
2302
2284
|
buildEip7702Authorization,
|
|
2303
|
-
encodeBatchExecute,
|
|
2304
2285
|
getContractAddresses as getContractAddresses5,
|
|
2305
2286
|
serializeUserOpToJsonRpc as serializeUserOpToJsonRpc2
|
|
2306
2287
|
} from "@pafi-dev/core";
|
|
@@ -2311,14 +2292,22 @@ var DEFAULT_DELEGATE_GAS = {
|
|
|
2311
2292
|
};
|
|
2312
2293
|
async function handleDelegateSubmit(params) {
|
|
2313
2294
|
const { batchExecutor } = getContractAddresses5(params.chainId);
|
|
2314
|
-
const
|
|
2295
|
+
const partial = buildDelegationUserOp({
|
|
2296
|
+
userAddress: params.userAddress,
|
|
2297
|
+
aaNonce: params.aaNonce,
|
|
2298
|
+
gasLimits: {
|
|
2299
|
+
callGasLimit: params.gasLimits?.callGasLimit ?? DEFAULT_DELEGATE_GAS.callGasLimit,
|
|
2300
|
+
verificationGasLimit: params.gasLimits?.verificationGasLimit ?? DEFAULT_DELEGATE_GAS.verificationGasLimit,
|
|
2301
|
+
preVerificationGas: params.gasLimits?.preVerificationGas ?? DEFAULT_DELEGATE_GAS.preVerificationGas
|
|
2302
|
+
}
|
|
2303
|
+
});
|
|
2315
2304
|
const userOp = {
|
|
2316
|
-
sender:
|
|
2317
|
-
nonce:
|
|
2318
|
-
callData,
|
|
2319
|
-
callGasLimit:
|
|
2320
|
-
verificationGasLimit:
|
|
2321
|
-
preVerificationGas:
|
|
2305
|
+
sender: partial.sender,
|
|
2306
|
+
nonce: partial.nonce,
|
|
2307
|
+
callData: partial.callData,
|
|
2308
|
+
callGasLimit: partial.callGasLimit,
|
|
2309
|
+
verificationGasLimit: partial.verificationGasLimit,
|
|
2310
|
+
preVerificationGas: partial.preVerificationGas,
|
|
2322
2311
|
maxFeePerGas: params.fees.maxFeePerGas ?? 0n,
|
|
2323
2312
|
maxPriorityFeePerGas: params.fees.maxPriorityFeePerGas ?? 0n
|
|
2324
2313
|
};
|
|
@@ -2403,7 +2392,7 @@ import {
|
|
|
2403
2392
|
buildAndSignSponsorAuth,
|
|
2404
2393
|
computeAuthorizationHash,
|
|
2405
2394
|
decodeBatchExecuteCalls as decodeBatchExecuteCalls3,
|
|
2406
|
-
encodeBatchExecute
|
|
2395
|
+
encodeBatchExecute,
|
|
2407
2396
|
ENTRY_POINT_V08 as ENTRY_POINT_V083,
|
|
2408
2397
|
getContractAddresses as getContractAddresses6,
|
|
2409
2398
|
parseEip7702DelegatedAddress as parseEip7702DelegatedAddress2
|
|
@@ -2747,11 +2736,6 @@ var IssuerApiAdapter = class {
|
|
|
2747
2736
|
/**
|
|
2748
2737
|
* Build + sign a SponsorAuth payload. Returns `undefined` when no
|
|
2749
2738
|
* issuer id is configured, so the controller can skip the field.
|
|
2750
|
-
*
|
|
2751
|
-
* v0.7.1 — `scenario` typed as `SponsorshipScenario` (was `string`).
|
|
2752
|
-
* Previously a typo (`"perp_deposit"` vs `"perp-deposit"`) compiled
|
|
2753
|
-
* fine but rejected at L1 by sponsor-relayer's IntentValidator. See
|
|
2754
|
-
* SDK_ISSUER_AUDIT.md N5.
|
|
2755
2739
|
*/
|
|
2756
2740
|
async buildSponsorAuth(authenticatedAddress, callData, chainId, scenario) {
|
|
2757
2741
|
if (!this.cfg.pafiIssuerId) return void 0;
|
|
@@ -3656,7 +3640,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
|
|
|
3656
3640
|
};
|
|
3657
3641
|
|
|
3658
3642
|
// src/index.ts
|
|
3659
|
-
var PAFI_ISSUER_SDK_VERSION = true ? "0.7.
|
|
3643
|
+
var PAFI_ISSUER_SDK_VERSION = true ? "0.7.4" : "dev";
|
|
3660
3644
|
export {
|
|
3661
3645
|
AdapterMisconfiguredError,
|
|
3662
3646
|
AuthError,
|