@pafi-dev/core 0.7.10 → 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.
Files changed (53) hide show
  1. package/dist/abi/index.cjs +6 -4
  2. package/dist/abi/index.cjs.map +1 -1
  3. package/dist/abi/index.d.cts +1066 -136
  4. package/dist/abi/index.d.ts +1066 -136
  5. package/dist/abi/index.js +5 -3
  6. package/dist/{chunk-JEWSN7Q3.cjs → chunk-57KR35JW.cjs} +474 -72
  7. package/dist/chunk-57KR35JW.cjs.map +1 -0
  8. package/dist/{chunk-B2NDSIAI.js → chunk-FHFZ2F34.js} +474 -72
  9. package/dist/chunk-FHFZ2F34.js.map +1 -0
  10. package/dist/chunk-G7NS4TS3.cjs +1353 -0
  11. package/dist/chunk-G7NS4TS3.cjs.map +1 -0
  12. package/dist/{chunk-REUEMYWB.cjs → chunk-JH6XFHES.cjs} +15 -15
  13. package/dist/chunk-JH6XFHES.cjs.map +1 -0
  14. package/dist/chunk-JWZTY5UL.js +1353 -0
  15. package/dist/chunk-JWZTY5UL.js.map +1 -0
  16. package/dist/{chunk-6WWSKC3Z.cjs → chunk-KRHGFUDI.cjs} +65 -7
  17. package/dist/chunk-KRHGFUDI.cjs.map +1 -0
  18. package/dist/{chunk-AEYEFV5G.js → chunk-PWQWNHGI.js} +5 -5
  19. package/dist/{chunk-AEYEFV5G.js.map → chunk-PWQWNHGI.js.map} +1 -1
  20. package/dist/{chunk-SZMSKZHY.js → chunk-UCO5DXD6.js} +65 -7
  21. package/dist/chunk-UCO5DXD6.js.map +1 -0
  22. package/dist/{chunk-4QRHSZZQ.cjs → chunk-UTG2UT54.cjs} +10 -8
  23. package/dist/chunk-UTG2UT54.cjs.map +1 -0
  24. package/dist/{chunk-QL5COJQI.js → chunk-XNVVZVK6.js} +9 -7
  25. package/dist/chunk-XNVVZVK6.js.map +1 -0
  26. package/dist/contract/index.cjs +4 -4
  27. package/dist/contract/index.d.cts +7 -2
  28. package/dist/contract/index.d.ts +7 -2
  29. package/dist/contract/index.js +3 -3
  30. package/dist/eip712/index.cjs +3 -3
  31. package/dist/eip712/index.d.cts +16 -5
  32. package/dist/eip712/index.d.ts +16 -5
  33. package/dist/eip712/index.js +2 -2
  34. package/dist/index.cjs +89 -45
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +62 -10
  37. package/dist/index.d.ts +62 -10
  38. package/dist/index.js +51 -7
  39. package/dist/index.js.map +1 -1
  40. package/dist/{types-CCvAk-ma.d.ts → types-DWLZNgcw.d.cts} +39 -15
  41. package/dist/{types-CCvAk-ma.d.cts → types-DWLZNgcw.d.ts} +39 -15
  42. package/package.json +1 -1
  43. package/dist/chunk-4QRHSZZQ.cjs.map +0 -1
  44. package/dist/chunk-6CXTFOIH.js +0 -671
  45. package/dist/chunk-6CXTFOIH.js.map +0 -1
  46. package/dist/chunk-6WWSKC3Z.cjs.map +0 -1
  47. package/dist/chunk-B2NDSIAI.js.map +0 -1
  48. package/dist/chunk-JEWSN7Q3.cjs.map +0 -1
  49. package/dist/chunk-Q6WCDZXI.cjs +0 -671
  50. package/dist/chunk-Q6WCDZXI.cjs.map +0 -1
  51. package/dist/chunk-QL5COJQI.js.map +0 -1
  52. package/dist/chunk-REUEMYWB.cjs.map +0 -1
  53. package/dist/chunk-SZMSKZHY.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,15 +1,30 @@
1
1
  import { Address, Hex, TypedDataDomain, PublicClient, WalletClient, TransactionReceipt, HttpTransport } from 'viem';
2
- import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDomainConfig, M as MintRequest, R as ReceiverConsent, E as EIP712Signature, S as SignatureVerification } from './types-CCvAk-ma.cjs';
3
- export { B as BestQuote, c as BlackoutWindow, d as BurnRequest, I as Issuer, e as PathKey, Q as QuoteResult, f as RedemptionDecision, g as RedemptionDenial, h as RedemptionDenialCode, i as RedemptionPolicy, j as RedemptionPolicySource, k as RedemptionPreview } from './types-CCvAk-ma.cjs';
4
- export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.cjs';
2
+ import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDomainConfig, M as MintRequest, R as ReceiverConsent, E as EIP712Signature, S as SignatureVerification } from './types-DWLZNgcw.cjs';
3
+ export { B as BestQuote, c as BlackoutWindow, d as BurnRequest, e as ExactOutputBestQuote, f as ExactOutputQuoteResult, I as Issuer, g as PathKey, Q as QuoteResult, h as Recipient, i as RedemptionDecision, j as RedemptionDenial, k as RedemptionDenialCode, l as RedemptionPolicy, m as RedemptionPolicySource, n as RedemptionPreview, T as TokenCap } from './types-DWLZNgcw.cjs';
4
+ export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintFeeWrapperAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.cjs';
5
5
  export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent } from './eip712/index.cjs';
6
6
  export { getBurnRequestNonce, getIssuer, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap } from './contract/index.cjs';
7
7
  import { LoginMessageParams } from './auth/index.cjs';
8
8
  export { BuildSponsorAuthParams, BuiltSponsorAuth, SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, SponsorAuthPayload, SponsorAuthVerifyResult, VerifyLoginResult, buildAndSignSponsorAuth, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, generateSponsorAuthNonce, getSponsorAuthDomainAnchor, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth } from './auth/index.cjs';
9
9
 
10
+ /**
11
+ * EIP-712 typed data for the v1.6 sig-gated mint path.
12
+ *
13
+ * Contract enforces:
14
+ * - msg.sender == receiver (the on-chain caller of `mint`)
15
+ * - nonce == mintRequestNonces[user] (per-user nonce stream)
16
+ *
17
+ * `user` is the off-chain spender (whose nonce advances), `receiver` is
18
+ * the on-chain mint recipient. For direct mints `user == receiver` (user
19
+ * calls PointToken.mint themselves). For wrapper-mediated mints `user ==
20
+ * end-user`, `receiver == wrapper address`.
21
+ */
10
22
  declare const mintRequestTypes: {
11
- readonly MintRequest: readonly [{
12
- readonly name: "to";
23
+ readonly MintForRequest: readonly [{
24
+ readonly name: "user";
25
+ readonly type: "address";
26
+ }, {
27
+ readonly name: "receiver";
13
28
  readonly type: "address";
14
29
  }, {
15
30
  readonly name: "amount";
@@ -92,6 +107,16 @@ declare const PERMIT2_ADDRESS: Address;
92
107
  * still becomes 500.
93
108
  */
94
109
  type SdkErrorHttpStatus = "not_found" | "forbidden" | "unprocessable" | "service_unavailable";
110
+ /**
111
+ * Stripe-style error taxonomy. The SDK emits one of these on every
112
+ * error so consumers can branch UI behavior on `type` (toast vs modal
113
+ * vs retry banner) without whitelisting individual `code` values.
114
+ */
115
+ type PafiErrorType = "validation_error" | "authentication_error" | "authorization_error" | "not_found_error" | "business_logic_error" | "rate_limit_error" | "server_error" | "service_unavailable_error";
116
+ /** Numeric HTTP status implied by an `SdkErrorHttpStatus` slot. */
117
+ declare const SDK_ERROR_HTTP_STATUS_CODE: Record<SdkErrorHttpStatus, number>;
118
+ /** Default `type` slot for a numeric HTTP status. */
119
+ declare function defaultErrorTypeForStatus(status: number): PafiErrorType;
95
120
  declare abstract class PafiSdkError extends Error {
96
121
  abstract readonly code: string;
97
122
  /**
@@ -101,6 +126,24 @@ declare abstract class PafiSdkError extends Error {
101
126
  readonly safeToRetry: boolean;
102
127
  readonly details?: unknown;
103
128
  abstract readonly httpStatus: SdkErrorHttpStatus;
129
+ /**
130
+ * Optional Stripe-style taxonomy override. Defaults to the type
131
+ * implied by `httpStatus` (forbidden→authorization_error,
132
+ * unprocessable→business_logic_error, etc).
133
+ */
134
+ readonly type?: PafiErrorType;
135
+ /**
136
+ * Optional name of the request field that triggered the error (e.g.
137
+ * `"amount"`, `"chainId"`). Surfaced on validation failures so the
138
+ * client can highlight the offending field.
139
+ */
140
+ readonly param?: string;
141
+ /**
142
+ * Optional structured context (e.g. `{ available, requested }` for a
143
+ * cap denial). Distinct from `details` — `metadata` is meant for
144
+ * UI consumption; `details` carries raw debug info.
145
+ */
146
+ readonly metadata?: Record<string, unknown>;
104
147
  constructor(message: string);
105
148
  }
106
149
  /**
@@ -154,9 +197,15 @@ declare class OracleStaleError extends PafiSdkError {
154
197
  */
155
198
  declare class ValidationError extends PafiSdkError {
156
199
  readonly httpStatus: "unprocessable";
200
+ readonly type: "validation_error";
157
201
  readonly code: string;
158
202
  readonly details?: Record<string, unknown>;
159
- constructor(code: string, message: string, details?: Record<string, unknown>);
203
+ readonly param?: string;
204
+ readonly metadata?: Record<string, unknown>;
205
+ constructor(code: string, message: string, details?: Record<string, unknown>, options?: {
206
+ param?: string;
207
+ metadata?: Record<string, unknown>;
208
+ });
160
209
  }
161
210
 
162
211
  /**
@@ -1959,8 +2008,11 @@ declare class PafiSDK {
1959
2008
  verifyingContract: `0x${string}`;
1960
2009
  };
1961
2010
  types: {
1962
- readonly MintRequest: readonly [{
1963
- readonly name: "to";
2011
+ readonly MintForRequest: readonly [{
2012
+ readonly name: "user";
2013
+ readonly type: "address";
2014
+ }, {
2015
+ readonly name: "receiver";
1964
2016
  readonly type: "address";
1965
2017
  }, {
1966
2018
  readonly name: "amount";
@@ -1973,7 +2025,7 @@ declare class PafiSDK {
1973
2025
  readonly type: "uint256";
1974
2026
  }];
1975
2027
  };
1976
- primaryType: "MintRequest";
2028
+ primaryType: "MintForRequest";
1977
2029
  message: MintRequest;
1978
2030
  }>;
1979
2031
  buildReceiverConsentTypedData(message: ReceiverConsent): Promise<{
@@ -2018,4 +2070,4 @@ declare class PafiSDK {
2018
2070
  signLoginMessage(message: string): Promise<Hex>;
2019
2071
  }
2020
2072
 
2021
- export { ApiError, BATCH_EXECUTOR_7702_IMPL, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PackedUserOperationMessage, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, ReceiverConsent, SIMPLE_7702_IMPL_BASE_MAINNET, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOpTypedData, type UserOperation, V4_QUOTER_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildEip7702Authorization, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, delegateDirect, detectDelegateImpl, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isDelegatedToTarget, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, setPaymasterConfig, splitAuthorizationSig, webPopupAdapter };
2073
+ export { ApiError, BATCH_EXECUTOR_7702_IMPL, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PackedUserOperationMessage, type PafiErrorType, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, ReceiverConsent, SDK_ERROR_HTTP_STATUS_CODE, SIMPLE_7702_IMPL_BASE_MAINNET, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOpTypedData, type UserOperation, V4_QUOTER_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildEip7702Authorization, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, defaultErrorTypeForStatus, delegateDirect, detectDelegateImpl, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isDelegatedToTarget, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, setPaymasterConfig, splitAuthorizationSig, webPopupAdapter };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,30 @@
1
1
  import { Address, Hex, TypedDataDomain, PublicClient, WalletClient, TransactionReceipt, HttpTransport } from 'viem';
2
- import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDomainConfig, M as MintRequest, R as ReceiverConsent, E as EIP712Signature, S as SignatureVerification } from './types-CCvAk-ma.js';
3
- export { B as BestQuote, c as BlackoutWindow, d as BurnRequest, I as Issuer, e as PathKey, Q as QuoteResult, f as RedemptionDecision, g as RedemptionDenial, h as RedemptionDenialCode, i as RedemptionPolicy, j as RedemptionPolicySource, k as RedemptionPreview } from './types-CCvAk-ma.js';
4
- export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.js';
2
+ import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDomainConfig, M as MintRequest, R as ReceiverConsent, E as EIP712Signature, S as SignatureVerification } from './types-DWLZNgcw.js';
3
+ export { B as BestQuote, c as BlackoutWindow, d as BurnRequest, e as ExactOutputBestQuote, f as ExactOutputQuoteResult, I as Issuer, g as PathKey, Q as QuoteResult, h as Recipient, i as RedemptionDecision, j as RedemptionDenial, k as RedemptionDenialCode, l as RedemptionPolicy, m as RedemptionPolicySource, n as RedemptionPreview, T as TokenCap } from './types-DWLZNgcw.js';
4
+ export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintFeeWrapperAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.js';
5
5
  export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, buildReceiverConsentTypedData, signBurnRequest, signMintRequest, signReceiverConsent, verifyBurnRequest, verifyMintRequest, verifyReceiverConsent } from './eip712/index.js';
6
6
  export { getBurnRequestNonce, getIssuer, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, issuerRegistryGetIssuerFlatAbi, verifyMintCap } from './contract/index.js';
7
7
  import { LoginMessageParams } from './auth/index.js';
8
8
  export { BuildSponsorAuthParams, BuiltSponsorAuth, SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, SponsorAuthPayload, SponsorAuthVerifyResult, VerifyLoginResult, buildAndSignSponsorAuth, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, generateSponsorAuthNonce, getSponsorAuthDomainAnchor, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth } from './auth/index.js';
9
9
 
10
+ /**
11
+ * EIP-712 typed data for the v1.6 sig-gated mint path.
12
+ *
13
+ * Contract enforces:
14
+ * - msg.sender == receiver (the on-chain caller of `mint`)
15
+ * - nonce == mintRequestNonces[user] (per-user nonce stream)
16
+ *
17
+ * `user` is the off-chain spender (whose nonce advances), `receiver` is
18
+ * the on-chain mint recipient. For direct mints `user == receiver` (user
19
+ * calls PointToken.mint themselves). For wrapper-mediated mints `user ==
20
+ * end-user`, `receiver == wrapper address`.
21
+ */
10
22
  declare const mintRequestTypes: {
11
- readonly MintRequest: readonly [{
12
- readonly name: "to";
23
+ readonly MintForRequest: readonly [{
24
+ readonly name: "user";
25
+ readonly type: "address";
26
+ }, {
27
+ readonly name: "receiver";
13
28
  readonly type: "address";
14
29
  }, {
15
30
  readonly name: "amount";
@@ -92,6 +107,16 @@ declare const PERMIT2_ADDRESS: Address;
92
107
  * still becomes 500.
93
108
  */
94
109
  type SdkErrorHttpStatus = "not_found" | "forbidden" | "unprocessable" | "service_unavailable";
110
+ /**
111
+ * Stripe-style error taxonomy. The SDK emits one of these on every
112
+ * error so consumers can branch UI behavior on `type` (toast vs modal
113
+ * vs retry banner) without whitelisting individual `code` values.
114
+ */
115
+ type PafiErrorType = "validation_error" | "authentication_error" | "authorization_error" | "not_found_error" | "business_logic_error" | "rate_limit_error" | "server_error" | "service_unavailable_error";
116
+ /** Numeric HTTP status implied by an `SdkErrorHttpStatus` slot. */
117
+ declare const SDK_ERROR_HTTP_STATUS_CODE: Record<SdkErrorHttpStatus, number>;
118
+ /** Default `type` slot for a numeric HTTP status. */
119
+ declare function defaultErrorTypeForStatus(status: number): PafiErrorType;
95
120
  declare abstract class PafiSdkError extends Error {
96
121
  abstract readonly code: string;
97
122
  /**
@@ -101,6 +126,24 @@ declare abstract class PafiSdkError extends Error {
101
126
  readonly safeToRetry: boolean;
102
127
  readonly details?: unknown;
103
128
  abstract readonly httpStatus: SdkErrorHttpStatus;
129
+ /**
130
+ * Optional Stripe-style taxonomy override. Defaults to the type
131
+ * implied by `httpStatus` (forbidden→authorization_error,
132
+ * unprocessable→business_logic_error, etc).
133
+ */
134
+ readonly type?: PafiErrorType;
135
+ /**
136
+ * Optional name of the request field that triggered the error (e.g.
137
+ * `"amount"`, `"chainId"`). Surfaced on validation failures so the
138
+ * client can highlight the offending field.
139
+ */
140
+ readonly param?: string;
141
+ /**
142
+ * Optional structured context (e.g. `{ available, requested }` for a
143
+ * cap denial). Distinct from `details` — `metadata` is meant for
144
+ * UI consumption; `details` carries raw debug info.
145
+ */
146
+ readonly metadata?: Record<string, unknown>;
104
147
  constructor(message: string);
105
148
  }
106
149
  /**
@@ -154,9 +197,15 @@ declare class OracleStaleError extends PafiSdkError {
154
197
  */
155
198
  declare class ValidationError extends PafiSdkError {
156
199
  readonly httpStatus: "unprocessable";
200
+ readonly type: "validation_error";
157
201
  readonly code: string;
158
202
  readonly details?: Record<string, unknown>;
159
- constructor(code: string, message: string, details?: Record<string, unknown>);
203
+ readonly param?: string;
204
+ readonly metadata?: Record<string, unknown>;
205
+ constructor(code: string, message: string, details?: Record<string, unknown>, options?: {
206
+ param?: string;
207
+ metadata?: Record<string, unknown>;
208
+ });
160
209
  }
161
210
 
162
211
  /**
@@ -1959,8 +2008,11 @@ declare class PafiSDK {
1959
2008
  verifyingContract: `0x${string}`;
1960
2009
  };
1961
2010
  types: {
1962
- readonly MintRequest: readonly [{
1963
- readonly name: "to";
2011
+ readonly MintForRequest: readonly [{
2012
+ readonly name: "user";
2013
+ readonly type: "address";
2014
+ }, {
2015
+ readonly name: "receiver";
1964
2016
  readonly type: "address";
1965
2017
  }, {
1966
2018
  readonly name: "amount";
@@ -1973,7 +2025,7 @@ declare class PafiSDK {
1973
2025
  readonly type: "uint256";
1974
2026
  }];
1975
2027
  };
1976
- primaryType: "MintRequest";
2028
+ primaryType: "MintForRequest";
1977
2029
  message: MintRequest;
1978
2030
  }>;
1979
2031
  buildReceiverConsentTypedData(message: ReceiverConsent): Promise<{
@@ -2018,4 +2070,4 @@ declare class PafiSDK {
2018
2070
  signLoginMessage(message: string): Promise<Hex>;
2019
2071
  }
2020
2072
 
2021
- export { ApiError, BATCH_EXECUTOR_7702_IMPL, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PackedUserOperationMessage, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, ReceiverConsent, SIMPLE_7702_IMPL_BASE_MAINNET, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOpTypedData, type UserOperation, V4_QUOTER_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildEip7702Authorization, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, delegateDirect, detectDelegateImpl, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isDelegatedToTarget, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, setPaymasterConfig, splitAuthorizationSig, webPopupAdapter };
2073
+ export { ApiError, BATCH_EXECUTOR_7702_IMPL, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateDirectParams, type DelegateDirectResult, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, ENTRY_POINT_V08, type Eip7702AuthorizationJsonRpc, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, type Operation, OracleStaleError, type OrderlyRelayDepositRequest, PAFI_SERVICE_URLS, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PackedUserOperationMessage, type PafiErrorType, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, PafiSdkError, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, ReceiverConsent, SDK_ERROR_HTTP_STATUS_CODE, SIMPLE_7702_IMPL_BASE_MAINNET, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOpTypedData, type UserOperation, V4_QUOTER_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildEip7702Authorization, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, defaultErrorTypeForStatus, delegateDirect, detectDelegateImpl, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isDelegatedToTarget, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, setPaymasterConfig, splitAuthorizationSig, webPopupAdapter };
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  erc20Abi,
3
+ mintFeeWrapperAbi,
3
4
  permit2Abi,
4
5
  pointTokenFactoryAbi,
5
6
  universalRouterAbi,
6
7
  v4QuoterAbi
7
- } from "./chunk-6CXTFOIH.js";
8
+ } from "./chunk-JWZTY5UL.js";
8
9
  import {
9
10
  SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET,
10
11
  SPONSOR_AUTH_DOMAIN_NAME,
@@ -34,11 +35,11 @@ import {
34
35
  isMinter,
35
36
  issuerRegistryGetIssuerFlatAbi,
36
37
  verifyMintCap
37
- } from "./chunk-AEYEFV5G.js";
38
+ } from "./chunk-PWQWNHGI.js";
38
39
  import {
39
40
  issuerRegistryAbi,
40
41
  mintingOracleAbi
41
- } from "./chunk-B2NDSIAI.js";
42
+ } from "./chunk-FHFZ2F34.js";
42
43
  import {
43
44
  COMMON_POOLS,
44
45
  COMMON_TOKENS,
@@ -64,16 +65,32 @@ import {
64
65
  verifyBurnRequest,
65
66
  verifyMintRequest,
66
67
  verifyReceiverConsent
67
- } from "./chunk-QL5COJQI.js";
68
+ } from "./chunk-XNVVZVK6.js";
68
69
  import {
69
70
  pointTokenAbi
70
- } from "./chunk-SZMSKZHY.js";
71
+ } from "./chunk-UCO5DXD6.js";
71
72
  import "./chunk-DGUM43GV.js";
72
73
 
73
74
  // src/index.ts
74
75
  import { createPublicClient, http as http2 } from "viem";
75
76
 
76
77
  // src/errors.ts
78
+ var SDK_ERROR_HTTP_STATUS_CODE = {
79
+ not_found: 404,
80
+ forbidden: 403,
81
+ unprocessable: 422,
82
+ service_unavailable: 503
83
+ };
84
+ function defaultErrorTypeForStatus(status) {
85
+ if (status === 400) return "validation_error";
86
+ if (status === 401) return "authentication_error";
87
+ if (status === 403) return "authorization_error";
88
+ if (status === 404) return "not_found_error";
89
+ if (status === 422) return "business_logic_error";
90
+ if (status === 429) return "rate_limit_error";
91
+ if (status === 503) return "service_unavailable_error";
92
+ return "server_error";
93
+ }
77
94
  var PafiSdkError = class extends Error {
78
95
  /**
79
96
  * `true` when the FE should consider a retry safe — typically because
@@ -81,6 +98,24 @@ var PafiSdkError = class extends Error {
81
98
  */
82
99
  safeToRetry = false;
83
100
  details;
101
+ /**
102
+ * Optional Stripe-style taxonomy override. Defaults to the type
103
+ * implied by `httpStatus` (forbidden→authorization_error,
104
+ * unprocessable→business_logic_error, etc).
105
+ */
106
+ type;
107
+ /**
108
+ * Optional name of the request field that triggered the error (e.g.
109
+ * `"amount"`, `"chainId"`). Surfaced on validation failures so the
110
+ * client can highlight the offending field.
111
+ */
112
+ param;
113
+ /**
114
+ * Optional structured context (e.g. `{ available, requested }` for a
115
+ * cap denial). Distinct from `details` — `metadata` is meant for
116
+ * UI consumption; `details` carries raw debug info.
117
+ */
118
+ metadata;
84
119
  constructor(message) {
85
120
  super(message);
86
121
  this.name = new.target.name;
@@ -135,12 +170,18 @@ var OracleStaleError = class extends PafiSdkError {
135
170
  };
136
171
  var ValidationError = class extends PafiSdkError {
137
172
  httpStatus = "unprocessable";
173
+ type = "validation_error";
138
174
  code;
139
- details;
140
- constructor(code, message, details) {
175
+ constructor(code, message, details, options) {
141
176
  super(message);
142
177
  this.code = code;
143
178
  this.details = details;
179
+ if (options?.param) {
180
+ this.param = options.param;
181
+ }
182
+ if (options?.metadata) {
183
+ this.metadata = options.metadata;
184
+ }
144
185
  }
145
186
  };
146
187
 
@@ -1542,6 +1583,7 @@ export {
1542
1583
  PafiSDK,
1543
1584
  PafiSDKError,
1544
1585
  PafiSdkError,
1586
+ SDK_ERROR_HTTP_STATUS_CODE,
1545
1587
  SIMPLE_7702_IMPL_BASE_MAINNET,
1546
1588
  SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET,
1547
1589
  SPONSOR_AUTH_DOMAIN_NAME,
@@ -1580,6 +1622,7 @@ export {
1580
1622
  createLoginMessage,
1581
1623
  createPafiProxyTransport,
1582
1624
  decodeBatchExecuteCalls,
1625
+ defaultErrorTypeForStatus,
1583
1626
  delegateDirect,
1584
1627
  detectDelegateImpl,
1585
1628
  encodeBatchExecute,
@@ -1612,6 +1655,7 @@ export {
1612
1655
  isPaymasterError,
1613
1656
  issuerRegistryAbi,
1614
1657
  issuerRegistryGetIssuerFlatAbi,
1658
+ mintFeeWrapperAbi,
1615
1659
  mintRequestTypes,
1616
1660
  mintingOracleAbi,
1617
1661
  openPafiWebModal,