@pafi-dev/core 0.9.6 → 0.13.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/README.md +146 -188
- package/dist/abi/index.cjs +2 -2
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.d.cts +58 -106
- package/dist/abi/index.d.ts +58 -106
- package/dist/abi/index.js +3 -3
- package/dist/{chunk-Y5EYH2SQ.js → chunk-H3X3FYUU.js} +1 -10
- package/dist/chunk-H3X3FYUU.js.map +1 -0
- package/dist/{chunk-5NEAI2BH.cjs → chunk-NT2ZPF72.cjs} +50 -72
- package/dist/chunk-NT2ZPF72.cjs.map +1 -0
- package/dist/{chunk-BNO5SM25.cjs → chunk-TRYGIC2I.cjs} +2 -11
- package/dist/chunk-TRYGIC2I.cjs.map +1 -0
- package/dist/{chunk-HJYHGCMT.js → chunk-UEO4YN6T.js} +53 -75
- package/dist/chunk-UEO4YN6T.js.map +1 -0
- package/dist/{chunk-MIQA46E3.cjs → chunk-XXLIIWIF.cjs} +45 -53
- package/dist/chunk-XXLIIWIF.cjs.map +1 -0
- package/dist/{chunk-CWH4KOUW.js → chunk-ZJXXCG5P.js} +45 -53
- package/dist/chunk-ZJXXCG5P.js.map +1 -0
- package/dist/contract/index.cjs +2 -4
- package/dist/contract/index.cjs.map +1 -1
- package/dist/contract/index.d.cts +5 -15
- package/dist/contract/index.d.ts +5 -15
- package/dist/contract/index.js +1 -3
- package/dist/eip712/index.cjs +2 -8
- package/dist/eip712/index.cjs.map +1 -1
- package/dist/eip712/index.d.cts +29 -43
- package/dist/eip712/index.d.ts +29 -43
- package/dist/eip712/index.js +3 -9
- package/dist/index.cjs +141 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +201 -182
- package/dist/index.d.ts +201 -182
- package/dist/index.js +135 -152
- package/dist/index.js.map +1 -1
- package/dist/{types-DWLZNgcw.d.cts → types-C17pznGz.d.cts} +72 -30
- package/dist/{types-DWLZNgcw.d.ts → types-C17pznGz.d.ts} +72 -30
- package/package.json +15 -5
- package/dist/chunk-5NEAI2BH.cjs.map +0 -1
- package/dist/chunk-BNO5SM25.cjs.map +0 -1
- package/dist/chunk-CWH4KOUW.js.map +0 -1
- package/dist/chunk-HJYHGCMT.js.map +0 -1
- package/dist/chunk-MIQA46E3.cjs.map +0 -1
- package/dist/chunk-Y5EYH2SQ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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,
|
|
3
|
-
export { B as BestQuote,
|
|
4
|
-
export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintFeeWrapperAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi,
|
|
5
|
-
export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData,
|
|
6
|
-
export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress,
|
|
2
|
+
import { P as PoolKey, C as ChainConfig, V as V3Path, a as PafiSDKConfig, b as PointTokenDomainConfig, M as MintRequest, E as EIP712Signature, S as SignatureVerifyOptions, c as SignatureVerification } from './types-C17pznGz.js';
|
|
3
|
+
export { B as BestQuote, d as BlackoutWindow, e as BurnRequest, f as ExactOutputBestQuote, g as ExactOutputQuoteResult, I as Issuer, Q as QuoteResult, R as Recipient, h as RedemptionDecision, i as RedemptionDenial, j as RedemptionDenialCode, k as RedemptionPolicy, l as RedemptionPolicySource, m as RedemptionPreview, n as SignatureVerificationFailReason, T as TokenCap } from './types-C17pznGz.js';
|
|
4
|
+
export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintFeeWrapperAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v3QuoterV2Abi } from './abi/index.js';
|
|
5
|
+
export { Eip712DomainMismatchError, assertDomainMatchesContract, buildBurnRequestTypedData, buildDomain, buildMintRequestTypedData, signBurnRequest, signMintRequest, verifyBurnRequest, verifyMintRequest } from './eip712/index.js';
|
|
6
|
+
export { getBurnRequestNonce, getIssuer, getMintFeeBps, getMintFeeRecipients, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getPointTokenIssuerAddress, getTokenCap, 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
10
|
/**
|
|
11
|
-
* EIP-712 typed data for the
|
|
11
|
+
* EIP-712 typed data for the sig-gated mint path.
|
|
12
12
|
*
|
|
13
13
|
* Contract enforces:
|
|
14
14
|
* - msg.sender == receiver (the on-chain caller of `mint`)
|
|
@@ -52,30 +52,36 @@ declare const burnRequestTypes: {
|
|
|
52
52
|
readonly type: "uint256";
|
|
53
53
|
}];
|
|
54
54
|
};
|
|
55
|
-
declare const receiverConsentTypes: {
|
|
56
|
-
readonly ReceiverConsent: readonly [{
|
|
57
|
-
readonly name: "onBehalfOf";
|
|
58
|
-
readonly type: "address";
|
|
59
|
-
}, {
|
|
60
|
-
readonly name: "originalReceiver";
|
|
61
|
-
readonly type: "address";
|
|
62
|
-
}, {
|
|
63
|
-
readonly name: "amount";
|
|
64
|
-
readonly type: "uint256";
|
|
65
|
-
}, {
|
|
66
|
-
readonly name: "nonce";
|
|
67
|
-
readonly type: "uint256";
|
|
68
|
-
}, {
|
|
69
|
-
readonly name: "deadline";
|
|
70
|
-
readonly type: "uint256";
|
|
71
|
-
}, {
|
|
72
|
-
readonly name: "extData";
|
|
73
|
-
readonly type: "bytes";
|
|
74
|
-
}];
|
|
75
|
-
};
|
|
76
55
|
declare const SUPPORTED_CHAINS: Record<number, ChainConfig>;
|
|
77
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Uniswap V3 QuoterV2 — used by `findBestQuote` / `quoteExactInput` etc.
|
|
58
|
+
* QuoterV2 (vs V1) reverts cleanly inside multicall and returns a 4-tuple
|
|
59
|
+
* `(amountOut, sqrtPriceX96AfterList, initializedTicksCrossedList, gasEstimate)`.
|
|
60
|
+
*/
|
|
61
|
+
declare const QUOTER_V2_ADDRESSES: Record<number, Address>;
|
|
62
|
+
/**
|
|
63
|
+
* Uniswap UniversalRouter — used for AA/batched swaps via PT delegated
|
|
64
|
+
* accounts. Speaks V3 commands (`V3_SWAP_EXACT_IN = 0x00`,
|
|
65
|
+
* `V3_SWAP_EXACT_OUT = 0x01`).
|
|
66
|
+
*/
|
|
78
67
|
declare const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address>;
|
|
68
|
+
/**
|
|
69
|
+
* Uniswap V3 SwapRouter — used by `swapDirect`-style flows that bypass
|
|
70
|
+
* the UniversalRouter. Takes `exactInput` / `exactOutput` with packed-bytes
|
|
71
|
+
* paths directly.
|
|
72
|
+
*/
|
|
73
|
+
declare const V3_SWAP_ROUTER_ADDRESSES: Record<number, Address>;
|
|
74
|
+
/**
|
|
75
|
+
* PAFI's Uniswap V3 factory — used together with `V3_POOL_INIT_CODE_HASH`
|
|
76
|
+
* to derive pool addresses deterministically (`computeV3PoolAddress`).
|
|
77
|
+
*/
|
|
78
|
+
declare const V3_FACTORY_ADDRESSES: Record<number, Address>;
|
|
79
|
+
/**
|
|
80
|
+
* Pool-init code hash for PAFI's V3 deployment. Combined with the factory
|
|
81
|
+
* address + sorted tokens + fee, deterministically yields a pool's
|
|
82
|
+
* address via the standard Uniswap V3 CREATE2 derivation.
|
|
83
|
+
*/
|
|
84
|
+
declare const V3_POOL_INIT_CODE_HASH: Hex;
|
|
79
85
|
declare const COMMON_TOKENS: Record<number, Record<string, Address>>;
|
|
80
86
|
declare const COMMON_POOLS: Record<number, PoolKey[]>;
|
|
81
87
|
declare const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>>;
|
|
@@ -147,29 +153,67 @@ declare abstract class PafiSdkError extends Error {
|
|
|
147
153
|
constructor(message: string);
|
|
148
154
|
}
|
|
149
155
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
156
|
+
* SDK-level misconfiguration — required input missing on the
|
|
157
|
+
* `PafiSDK` class or a helper that needs a provider/signer/chainId.
|
|
158
|
+
* The SDK can't service the request until the deployment is fixed,
|
|
159
|
+
* so this routes to **503** in `createSdkErrorMapper`.
|
|
160
|
+
*
|
|
161
|
+
* Note: `@pafi-dev/issuer` has a separate `ConfigurationError` with
|
|
162
|
+
* the same name but a different shape (carries a caller-supplied
|
|
163
|
+
* `code`). Both extend `PafiSdkError`; pick based on which package
|
|
164
|
+
* raised the error.
|
|
155
165
|
*/
|
|
156
|
-
declare class
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
declare class ConfigurationError extends PafiSdkError {
|
|
167
|
+
readonly httpStatus: "service_unavailable";
|
|
168
|
+
readonly code: "CONFIGURATION_ERROR";
|
|
169
|
+
readonly type: "server_error";
|
|
160
170
|
constructor(message: string);
|
|
161
171
|
}
|
|
162
|
-
|
|
172
|
+
/**
|
|
173
|
+
* EIP-712 / EIP-7702 signing failed inside the SDK — typically the
|
|
174
|
+
* signer wallet rejected, the KMS was unreachable, or a signature
|
|
175
|
+
* post-condition (recover-to-expected-address) didn't hold.
|
|
176
|
+
*
|
|
177
|
+
* Routes to **503** because the most common cause is transient signer
|
|
178
|
+
* infrastructure (KMS hiccup); retry is often safe. Set
|
|
179
|
+
* `safeToRetry = true` from the call site if you can prove it.
|
|
180
|
+
*/
|
|
181
|
+
declare class SigningError extends PafiSdkError {
|
|
182
|
+
readonly httpStatus: "service_unavailable";
|
|
183
|
+
readonly code: "SIGNING_FAILED";
|
|
184
|
+
readonly type: "server_error";
|
|
163
185
|
constructor(message: string);
|
|
164
186
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
187
|
+
/**
|
|
188
|
+
* `eth_call` dry-run reverted. The on-chain tx would also revert —
|
|
189
|
+
* caller's params are bad (slippage, insufficient balance, expired
|
|
190
|
+
* deadline). Routes to **422** as a business-logic failure.
|
|
191
|
+
*
|
|
192
|
+
* `operation` is a short tag (`"swap"`, `"perp-deposit"`, etc.) for
|
|
193
|
+
* log-grouping; `reason` carries the raw revert string surfaced by
|
|
194
|
+
* the simulator.
|
|
195
|
+
*/
|
|
196
|
+
declare class SimulationError extends PafiSdkError {
|
|
197
|
+
readonly httpStatus: "unprocessable";
|
|
198
|
+
readonly code: "SIMULATION_FAILED";
|
|
199
|
+
readonly type: "business_logic_error";
|
|
200
|
+
readonly operation: string;
|
|
201
|
+
readonly reason: string;
|
|
168
202
|
constructor(operation: string, reason: string);
|
|
169
203
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
204
|
+
/**
|
|
205
|
+
* External HTTP call (Pimlico bundler, PAFI sponsor-relayer, PAFI
|
|
206
|
+
* issuer-api) failed. Routes to **503**. `upstreamStatus` carries the
|
|
207
|
+
* remote HTTP status when known (e.g. 502 from Pimlico for a bundler
|
|
208
|
+
* outage) — useful for log-grouping but distinct from `httpStatus`
|
|
209
|
+
* which is the status PAFI returns to its OWN caller.
|
|
210
|
+
*/
|
|
211
|
+
declare class ApiError extends PafiSdkError {
|
|
212
|
+
readonly httpStatus: "service_unavailable";
|
|
213
|
+
readonly code: "API_ERROR";
|
|
214
|
+
readonly type: "service_unavailable_error";
|
|
215
|
+
readonly upstreamStatus?: number;
|
|
216
|
+
constructor(message: string, upstreamStatus?: number);
|
|
173
217
|
}
|
|
174
218
|
/**
|
|
175
219
|
* Thrown by `quoteOperatorFee*` when an upstream price source
|
|
@@ -434,8 +478,8 @@ interface UserOpReceipt {
|
|
|
434
478
|
declare const ZERO_VALUE = 0n;
|
|
435
479
|
|
|
436
480
|
/**
|
|
437
|
-
*
|
|
438
|
-
*
|
|
481
|
+
* Deposit USDC from the user's wallet into the Orderly perp Vault on
|
|
482
|
+
* Base mainnet.
|
|
439
483
|
*
|
|
440
484
|
* Builds a `PartialUserOperation` packaging the 2 inner calls:
|
|
441
485
|
*
|
|
@@ -619,10 +663,8 @@ interface BuildPerpDepositViaRelayParams {
|
|
|
619
663
|
* flows (PAFI gas reimbursement). Pass `0n` / `undefined` for the
|
|
620
664
|
* fallback path where the user pays ERC-4337 gas in ETH directly.
|
|
621
665
|
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
* `gasFeePt` / `gasFeePtRecipient` / `pointTokenAddress` triple from
|
|
625
|
-
* v0.6.
|
|
666
|
+
* Input-token fee position rule: user holds USDC BEFORE deposit
|
|
667
|
+
* (token-availability), so charge there.
|
|
626
668
|
*/
|
|
627
669
|
gasFeeUsdc?: bigint;
|
|
628
670
|
gasFeeUsdcRecipient?: Address;
|
|
@@ -680,12 +722,11 @@ declare function rawCallOp(target: Address, data: `0x${string}`, value?: bigint)
|
|
|
680
722
|
* and invokes each one in sequence, reverting all if any fail.
|
|
681
723
|
*
|
|
682
724
|
* Function name is `executeBatch` (selector `0x34fcd5be`) to match
|
|
683
|
-
* Pimlico's `Simple7702Account`
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
* with "account: not from EntryPoint" (AA23).
|
|
725
|
+
* Pimlico's `Simple7702Account` — the EIP-7702 delegate impl PAFI
|
|
726
|
+
* pins on Base mainnet. The shorter `execute(Call[])` (selector
|
|
727
|
+
* `0x3f707e6b`) only exists on standalone batch executor contracts;
|
|
728
|
+
* calling it on a 7702 delegated EOA falls through to the fallback
|
|
729
|
+
* function and reverts with "account: not from EntryPoint" (AA23).
|
|
689
730
|
*/
|
|
690
731
|
declare const BATCH_EXECUTOR_ABI: readonly [{
|
|
691
732
|
readonly name: "executeBatch";
|
|
@@ -708,20 +749,21 @@ declare const BATCH_EXECUTOR_ABI: readonly [{
|
|
|
708
749
|
readonly outputs: readonly [];
|
|
709
750
|
}];
|
|
710
751
|
/**
|
|
711
|
-
* Encode a batch of operations into calldata for
|
|
712
|
-
*
|
|
752
|
+
* Encode a batch of operations into calldata for
|
|
753
|
+
* `BatchExecutor.executeBatch((address,uint256,bytes)[])`. The
|
|
754
|
+
* resulting calldata goes into `UserOperation.callData`.
|
|
713
755
|
*
|
|
714
756
|
* When the EOA has an EIP-7702 delegation to a BatchExecutor, calling
|
|
715
757
|
* this calldata against the EOA runs all operations with
|
|
716
758
|
* `msg.sender = EOA` for each inner call.
|
|
717
759
|
*
|
|
718
760
|
* @param operations batch of calls, in execution order
|
|
719
|
-
* @returns calldata bytes for `
|
|
761
|
+
* @returns calldata bytes for `executeBatch((address,uint256,bytes)[])`
|
|
720
762
|
*/
|
|
721
763
|
declare function encodeBatchExecute(operations: Operation[]): Hex;
|
|
722
764
|
/**
|
|
723
|
-
* Decode `BatchExecutor.
|
|
724
|
-
* `{ to, data, value }` objects.
|
|
765
|
+
* Decode `BatchExecutor.executeBatch(calls[])` callData back into
|
|
766
|
+
* individual `{ to, data, value }` objects.
|
|
725
767
|
*
|
|
726
768
|
* Used by issuer backends to convert a `PartialUserOperation.callData`
|
|
727
769
|
* into the `calls[]` array returned to web/FE clients (which submit via
|
|
@@ -882,20 +924,29 @@ declare function computeUserOpHash(userOp: Parameters<typeof buildUserOpTypedDat
|
|
|
882
924
|
|
|
883
925
|
/**
|
|
884
926
|
* EIP-7702 delegate impls supported by the PAFI mobile prepare/submit
|
|
885
|
-
* flow. Each impl exposes `
|
|
886
|
-
* selector `0x34fcd5be
|
|
887
|
-
*
|
|
888
|
-
*
|
|
927
|
+
* flow. Each impl exposes `executeBatch((address,uint256,bytes)[])`
|
|
928
|
+
* (selector `0x34fcd5be`) so callData encoding is identical, but each
|
|
929
|
+
* may use a slightly different dummy-signature pattern that Pimlico's
|
|
930
|
+
* `pm_sponsorUserOperation` simulation accepts.
|
|
931
|
+
*
|
|
932
|
+
* Current primary impl is `simple7702` (Pimlico's `Simple7702Account`).
|
|
933
|
+
* `batchExecutor` is retained for back-compat with EOAs that delegated
|
|
934
|
+
* to an earlier Coinbase Smart Wallet v2 BatchExecutor — Pimlico is
|
|
935
|
+
* the canonical impl now (the Coinbase SignatureWrapper format caused
|
|
936
|
+
* AA23 0x3c10b94e during validateUserOp).
|
|
889
937
|
*/
|
|
890
938
|
type DelegateImpl = "simple7702" | "batchExecutor" | "unknown";
|
|
891
939
|
/**
|
|
892
|
-
* Pimlico's `Simple7702Account` implementation address on Base mainnet
|
|
893
|
-
* Used by
|
|
940
|
+
* Pimlico's `Simple7702Account` implementation address on Base mainnet —
|
|
941
|
+
* the canonical PAFI delegation target. Used by
|
|
942
|
+
* `permissionless.to7702SimpleSmartAccount`.
|
|
894
943
|
*/
|
|
895
944
|
declare const SIMPLE_7702_IMPL_BASE_MAINNET: Address;
|
|
896
945
|
/**
|
|
897
|
-
* Coinbase Smart Wallet v2 BatchExecutor —
|
|
898
|
-
* target. Same on Base mainnet + Base Sepolia.
|
|
946
|
+
* Legacy Coinbase Smart Wallet v2 BatchExecutor — an earlier PAFI
|
|
947
|
+
* delegation target. Same on Base mainnet + Base Sepolia. Detected here
|
|
948
|
+
* so EOAs that delegated to this address still pass the impl check;
|
|
949
|
+
* new delegations should target {@link SIMPLE_7702_IMPL_BASE_MAINNET}.
|
|
899
950
|
*/
|
|
900
951
|
declare const BATCH_EXECUTOR_7702_IMPL: Address;
|
|
901
952
|
/**
|
|
@@ -931,11 +982,11 @@ declare function getDummySignatureFor7702(impl: DelegateImpl): Hex;
|
|
|
931
982
|
|
|
932
983
|
/**
|
|
933
984
|
* Module-level paymaster config shared by all batch builders and the
|
|
934
|
-
* `@pafi/issuer` RelayService. Holds the fee recipient address and the
|
|
985
|
+
* `@pafi-dev/issuer` RelayService. Holds the fee recipient address and the
|
|
935
986
|
* PAFI-assigned issuer identity.
|
|
936
987
|
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
988
|
+
* The paymaster endpoint is **PAFI Backend**, which proxies to PAFI
|
|
989
|
+
* sponsor-relayer. See [SPONSORED_PATH_FLOW.md].
|
|
939
990
|
*/
|
|
940
991
|
interface PaymasterConfig {
|
|
941
992
|
/**
|
|
@@ -965,23 +1016,6 @@ interface PaymasterConfig {
|
|
|
965
1016
|
*/
|
|
966
1017
|
type SponsorshipScenario = "mint" | "burn" | "swap" | "perp-deposit" | "delegate";
|
|
967
1018
|
|
|
968
|
-
/**
|
|
969
|
-
* @deprecated v0.7.1 — see file comment.
|
|
970
|
-
*
|
|
971
|
-
* Set the application-wide paymaster config. Safe to call multiple
|
|
972
|
-
* times (later calls override earlier). Throws if required fields
|
|
973
|
-
* are missing.
|
|
974
|
-
*/
|
|
975
|
-
declare function setPaymasterConfig(config: PaymasterConfig): void;
|
|
976
|
-
/**
|
|
977
|
-
* @deprecated v0.7.1 — see file comment.
|
|
978
|
-
*/
|
|
979
|
-
declare function getPaymasterConfig(): PaymasterConfig;
|
|
980
|
-
/** Test helper — clear the singleton. */
|
|
981
|
-
declare function _resetPaymasterConfigForTests(): void;
|
|
982
|
-
/** Check whether paymaster config has been initialized. */
|
|
983
|
-
declare function isPaymasterConfigured(): boolean;
|
|
984
|
-
|
|
985
1019
|
/**
|
|
986
1020
|
* Submission path chosen by `checkEthAndBranch`.
|
|
987
1021
|
* - `normal`: initiator has enough ETH; submit via `walletClient.writeContract`
|
|
@@ -1017,6 +1051,42 @@ interface CheckEthAndBranchParams {
|
|
|
1017
1051
|
*/
|
|
1018
1052
|
declare function checkEthAndBranch(params: CheckEthAndBranchParams): Promise<SubmissionPath>;
|
|
1019
1053
|
|
|
1054
|
+
/**
|
|
1055
|
+
* Encode a V3 swap path as packed bytes, oriented input→output:
|
|
1056
|
+
* `tokens[0] ‖ fees[0] ‖ tokens[1] ‖ fees[1] ‖ … ‖ tokens[N]`
|
|
1057
|
+
*
|
|
1058
|
+
* Each address is 20 bytes; each fee is uint24 (3 bytes). For an N-hop
|
|
1059
|
+
* swap the result is `(N + 1) * 20 + N * 3` bytes.
|
|
1060
|
+
*
|
|
1061
|
+
* For exact-output quoting the Quoter walks the path output→input —
|
|
1062
|
+
* reverse the underlying `tokens` and `fees` arrays before calling this
|
|
1063
|
+
* encoder (or use `encodeV3PathReversed`).
|
|
1064
|
+
*
|
|
1065
|
+
* @throws if `tokens.length !== fees.length + 1` or any input is malformed.
|
|
1066
|
+
*/
|
|
1067
|
+
declare function encodeV3Path(path: V3Path): Hex;
|
|
1068
|
+
/**
|
|
1069
|
+
* Encode the same path reversed (output→input). Convenience used by
|
|
1070
|
+
* exact-output quoting and exact-output swap-builder paths.
|
|
1071
|
+
*/
|
|
1072
|
+
declare function encodeV3PathReversed(path: V3Path): Hex;
|
|
1073
|
+
/**
|
|
1074
|
+
* Compute a V3 pool address deterministically from factory + initCodeHash.
|
|
1075
|
+
*
|
|
1076
|
+
* Uses the standard Uniswap V3 derivation:
|
|
1077
|
+
* `keccak256(0xff ‖ factory ‖ keccak256(abi.encode(token0, token1, fee)) ‖ initCodeHash)`
|
|
1078
|
+
*
|
|
1079
|
+
* Tokens are sorted ascending — the helper accepts them in any order.
|
|
1080
|
+
* Returns a checksummed address.
|
|
1081
|
+
*/
|
|
1082
|
+
declare function computeV3PoolAddress(params: {
|
|
1083
|
+
factory: Address;
|
|
1084
|
+
tokenA: Address;
|
|
1085
|
+
tokenB: Address;
|
|
1086
|
+
fee: number;
|
|
1087
|
+
initCodeHash: Hex;
|
|
1088
|
+
}): Address;
|
|
1089
|
+
|
|
1020
1090
|
/**
|
|
1021
1091
|
* Parse the implementation address out of an EIP-7702 delegation designator.
|
|
1022
1092
|
*
|
|
@@ -1617,57 +1687,44 @@ declare const BATCH_EXECUTOR_ADDRESS_BASE_MAINNET: `0x${string}`;
|
|
|
1617
1687
|
declare const BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA: `0x${string}`;
|
|
1618
1688
|
|
|
1619
1689
|
/**
|
|
1620
|
-
* Per-chain deployed contract addresses
|
|
1621
|
-
*
|
|
1622
|
-
* ## Status (2026-05-07)
|
|
1690
|
+
* Per-chain deployed contract addresses.
|
|
1623
1691
|
*
|
|
1624
|
-
* Base mainnet (8453):
|
|
1625
|
-
*
|
|
1626
|
-
* `pafiHook` field kept as placeholder for back-compat with consumers that
|
|
1627
|
-
* still reference it; set to a deterministic dead address to make misuse
|
|
1628
|
-
* obvious.
|
|
1692
|
+
* Base mainnet (8453): live deployment. Fee on mint happens via
|
|
1693
|
+
* `MintFeeWrapper` (single global instance, multi-PT).
|
|
1629
1694
|
*
|
|
1630
1695
|
* Base Sepolia (84532): entire row is placeholder — not in active use.
|
|
1631
1696
|
*
|
|
1632
1697
|
* ## What lives where
|
|
1633
1698
|
*
|
|
1634
|
-
* pointToken — DEAD legacy field (per-issuer, not chain-level).
|
|
1635
|
-
* Each issuer's clone is configured via env or
|
|
1636
|
-
* resolved from PointTokenFactory at runtime. Set
|
|
1637
|
-
* to a deterministic dead address so misuse fails
|
|
1638
|
-
* loudly. Will be removed when downstream consumers
|
|
1639
|
-
* stop referencing it.
|
|
1640
1699
|
* batchExecutor — EIP-7702 delegation target (Pimlico Simple7702Account)
|
|
1641
|
-
* usdt —
|
|
1700
|
+
* usdt — Stablecoin used by Uniswap pools
|
|
1642
1701
|
* issuerRegistry — registry of all issuers on this chain
|
|
1643
|
-
* mintingOracle — per-token mint cap enforcer
|
|
1644
|
-
* mintFeeWrapper —
|
|
1645
|
-
*
|
|
1702
|
+
* mintingOracle — per-token mint cap enforcer
|
|
1703
|
+
* mintFeeWrapper — mint-time fee splitter (single global instance)
|
|
1704
|
+
* chainlinkEthUsd — ETH/USD price feed used by FeeManager
|
|
1705
|
+
* orderlyRelay — Orderly perp-deposit Relay
|
|
1706
|
+
* pafiFeeRecipient — PAFI-controlled fee recipient (sponsored gas reimbursement)
|
|
1707
|
+
* universalRouter — Uniswap V4 swap entry point
|
|
1708
|
+
*
|
|
1709
|
+
* PointToken addresses are per-issuer and resolved from the issuer's
|
|
1710
|
+
* config (env / DB / PointTokenFactory readout). PointTokenFactory and
|
|
1711
|
+
* the PointToken implementation live in separate exports below.
|
|
1646
1712
|
*
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
* observability time, not in the hot mint/burn path, so excluded from
|
|
1650
|
-
* the per-chain bundle.
|
|
1713
|
+
* Fee logic lives in `MintFeeWrapper` on the mint path; swaps are
|
|
1714
|
+
* hook-free (`hooks = address(0)`).
|
|
1651
1715
|
*/
|
|
1652
1716
|
interface ContractAddresses {
|
|
1653
|
-
pointToken: Address;
|
|
1654
1717
|
batchExecutor: Address;
|
|
1655
1718
|
usdt: Address;
|
|
1656
1719
|
issuerRegistry: Address;
|
|
1657
1720
|
mintingOracle: Address;
|
|
1658
1721
|
/**
|
|
1659
|
-
*
|
|
1660
|
-
*
|
|
1661
|
-
*
|
|
1662
|
-
*
|
|
1722
|
+
* Single-instance MintFeeWrapper that skims a fee on every sig-gated
|
|
1723
|
+
* mint and distributes across the registered recipient list for the
|
|
1724
|
+
* target PointToken. Issuers route mints through this by passing
|
|
1725
|
+
* `mintFeeWrapperAddress` to `prepareMint`.
|
|
1663
1726
|
*/
|
|
1664
1727
|
mintFeeWrapper: Address;
|
|
1665
|
-
/**
|
|
1666
|
-
* @deprecated v1.5 PAFIHook (10% PT→USDT swap fee) was removed in
|
|
1667
|
-
* v1.6. Field kept as a dead placeholder so older consumers don't
|
|
1668
|
-
* crash on missing-property errors; do not use for new code.
|
|
1669
|
-
*/
|
|
1670
|
-
pafiHook: Address;
|
|
1671
1728
|
/** Chainlink ETH/USD price feed — used by FeeManager to convert gas cost to USDT. */
|
|
1672
1729
|
chainlinkEthUsd: Address;
|
|
1673
1730
|
/**
|
|
@@ -1751,14 +1808,14 @@ declare function getPafiServiceUrls(chainId: number): PafiServiceUrls;
|
|
|
1751
1808
|
* `./eip712/` and are re-exported from the package root — not duplicated
|
|
1752
1809
|
* here.
|
|
1753
1810
|
*
|
|
1754
|
-
* ##
|
|
1811
|
+
* ## Sig-gated mint / burn (no Relayer contract)
|
|
1755
1812
|
*
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1761
|
-
*
|
|
1813
|
+
* Users call `PointToken.mint(to, amount, deadline, minterSig)`
|
|
1814
|
+
* directly via an EIP-7702 delegated UserOp — `msg.sender == user
|
|
1815
|
+
* == to`. `minterSig` is an EIP-712 `MintRequest` signed off-chain
|
|
1816
|
+
* by the issuer's minter signer (HSM/KMS). Mirror structure on the
|
|
1817
|
+
* burn side with `BurnRequest` + `burn(from, amount, deadline,
|
|
1818
|
+
* burnerSig)`.
|
|
1762
1819
|
*
|
|
1763
1820
|
* Exports:
|
|
1764
1821
|
* - `POINT_TOKEN_V2_ABI` — full mint + burn + admin surface
|
|
@@ -1776,8 +1833,8 @@ declare function getPafiServiceUrls(chainId: number): PafiServiceUrls;
|
|
|
1776
1833
|
|
|
1777
1834
|
/**
|
|
1778
1835
|
* Signature struct — kept for consumers that want the tuple form.
|
|
1779
|
-
*
|
|
1780
|
-
* contract; this struct is only needed if you're manually splitting
|
|
1836
|
+
* The canonical paths pass `bytes` (serialized signature) directly to
|
|
1837
|
+
* the contract; this struct is only needed if you're manually splitting
|
|
1781
1838
|
* for other on-chain verifiers.
|
|
1782
1839
|
*/
|
|
1783
1840
|
interface SignatureStruct {
|
|
@@ -1969,23 +2026,25 @@ declare function getPafiWebModalAdapter(): PafiWebModalAdapter | null;
|
|
|
1969
2026
|
declare function openPafiWebModal(url: string, options?: ModalOpenOptions): Promise<PafiWebModalHandle>;
|
|
1970
2027
|
|
|
1971
2028
|
/**
|
|
1972
|
-
* PAFI-hosted subgraph endpoint — single source of truth across all
|
|
2029
|
+
* PAFI-hosted subgraph endpoint — single source of truth across all
|
|
2030
|
+
* SDK packages.
|
|
1973
2031
|
*
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1976
|
-
*
|
|
1977
|
-
* `MintFeeWrapper`, `MintFeeConfig`, `FeeRecipient`, `MintWithFeeEvent`,
|
|
1978
|
-
* `FeeDistribution`. v2 endpoint is kept live as rollback for ~1 week before
|
|
1979
|
-
* removal.
|
|
2032
|
+
* Indexes IssuerRegistry, PointTokenFactory, MintingOracle, and
|
|
2033
|
+
* MintFeeWrapper. Schema entities: `MintFeeWrapper`, `MintFeeConfig`,
|
|
2034
|
+
* `FeeRecipient`, `MintWithFeeEvent`, `FeeDistribution`.
|
|
1980
2035
|
*/
|
|
1981
|
-
declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-
|
|
2036
|
+
declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v4";
|
|
1982
2037
|
/**
|
|
1983
|
-
* Fetch the Uniswap
|
|
2038
|
+
* Fetch the Uniswap V3 pool(s) for a PAFI PointToken from the subgraph.
|
|
1984
2039
|
*
|
|
1985
2040
|
* Browser and Node compatible — uses globalThis.fetch. Returns an empty
|
|
1986
2041
|
* array (never throws) when the token has no pool yet or the subgraph is
|
|
1987
2042
|
* unreachable, so callers can show "quote unavailable" without crashing.
|
|
1988
2043
|
*
|
|
2044
|
+
* Tolerates subgraph responses still carrying the V4-era `tickSpacing`
|
|
2045
|
+
* and `hooks` fields — those are silently ignored. Subgraph migration
|
|
2046
|
+
* can land independently of the SDK migration.
|
|
2047
|
+
*
|
|
1989
2048
|
* @param chainId - Chain ID (reserved for multi-subgraph routing; currently unused)
|
|
1990
2049
|
* @param pointTokenAddress - The PointToken contract address
|
|
1991
2050
|
* @param subgraphUrl - Override the default PAFI subgraph URL
|
|
@@ -2003,12 +2062,6 @@ declare class PafiSDK {
|
|
|
2003
2062
|
verify: PafiSDK["verifyMintRequest"];
|
|
2004
2063
|
getNonce: PafiSDK["getMintRequestNonce"];
|
|
2005
2064
|
};
|
|
2006
|
-
readonly consent: {
|
|
2007
|
-
buildTypedData: PafiSDK["buildReceiverConsentTypedData"];
|
|
2008
|
-
sign: PafiSDK["signReceiverConsent"];
|
|
2009
|
-
verify: PafiSDK["verifyReceiverConsent"];
|
|
2010
|
-
getNonce: PafiSDK["getReceiverConsentNonce"];
|
|
2011
|
-
};
|
|
2012
2065
|
readonly auth: {
|
|
2013
2066
|
createLoginMessage: PafiSDK["createLoginMessage"];
|
|
2014
2067
|
signMessage: PafiSDK["signLoginMessage"];
|
|
@@ -2050,46 +2103,12 @@ declare class PafiSDK {
|
|
|
2050
2103
|
primaryType: "MintForRequest";
|
|
2051
2104
|
message: MintRequest;
|
|
2052
2105
|
}>;
|
|
2053
|
-
buildReceiverConsentTypedData(message: ReceiverConsent): Promise<{
|
|
2054
|
-
domain: {
|
|
2055
|
-
name: string;
|
|
2056
|
-
version: string;
|
|
2057
|
-
chainId: number;
|
|
2058
|
-
verifyingContract: `0x${string}`;
|
|
2059
|
-
};
|
|
2060
|
-
types: {
|
|
2061
|
-
readonly ReceiverConsent: readonly [{
|
|
2062
|
-
readonly name: "onBehalfOf";
|
|
2063
|
-
readonly type: "address";
|
|
2064
|
-
}, {
|
|
2065
|
-
readonly name: "originalReceiver";
|
|
2066
|
-
readonly type: "address";
|
|
2067
|
-
}, {
|
|
2068
|
-
readonly name: "amount";
|
|
2069
|
-
readonly type: "uint256";
|
|
2070
|
-
}, {
|
|
2071
|
-
readonly name: "nonce";
|
|
2072
|
-
readonly type: "uint256";
|
|
2073
|
-
}, {
|
|
2074
|
-
readonly name: "deadline";
|
|
2075
|
-
readonly type: "uint256";
|
|
2076
|
-
}, {
|
|
2077
|
-
readonly name: "extData";
|
|
2078
|
-
readonly type: "bytes";
|
|
2079
|
-
}];
|
|
2080
|
-
};
|
|
2081
|
-
primaryType: "ReceiverConsent";
|
|
2082
|
-
message: ReceiverConsent;
|
|
2083
|
-
}>;
|
|
2084
2106
|
signMintRequest(message: MintRequest): Promise<EIP712Signature>;
|
|
2085
|
-
verifyMintRequest(message: MintRequest, signature: Hex, expectedMinter: Address): Promise<SignatureVerification>;
|
|
2086
|
-
signReceiverConsent(message: ReceiverConsent): Promise<EIP712Signature>;
|
|
2087
|
-
verifyReceiverConsent(message: ReceiverConsent, signature: Hex, expectedReceiver: Address): Promise<SignatureVerification>;
|
|
2107
|
+
verifyMintRequest(message: MintRequest, signature: Hex, expectedMinter: Address, options?: SignatureVerifyOptions): Promise<SignatureVerification>;
|
|
2088
2108
|
getMintRequestNonce(receiver: Address): Promise<bigint>;
|
|
2089
|
-
getReceiverConsentNonce(receiver: Address): Promise<bigint>;
|
|
2090
2109
|
createLoginMessage(params: Omit<LoginMessageParams, "address" | "chainId">): Promise<string>;
|
|
2091
2110
|
/** Sign a login message string with the current signer (personal_sign) */
|
|
2092
2111
|
signLoginMessage(message: string): Promise<Hex>;
|
|
2093
2112
|
}
|
|
2094
2113
|
|
|
2095
|
-
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,
|
|
2114
|
+
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, type PafiServiceUrls, type PafiWebModalAdapter, type PafiWebModalHandle, type PartialUserOperation, type PaymasterConfig, type PaymasterFields, PointTokenDomainConfig, PoolKey, QUOTER_V2_ADDRESSES, type QuoteOperatorFeePtConfig, type QuoteOperatorFeeUsdtConfig, SDK_ERROR_HTTP_STATUS_CODE, SIMPLE_7702_IMPL_BASE_MAINNET, SUPPORTED_CHAINS, type SdkErrorHttpStatus, type SendWithPaymasterFallbackParams, type SignAuthorizationFn, type SignatureStruct, SignatureVerification, SignatureVerifyOptions, type SignedAuthorization, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOpTypedData, type UserOperation, V3Path, V3_FACTORY_ADDRESSES, V3_POOL_INIT_CODE_HASH, V3_SWAP_ROUTER_ADDRESSES, ValidationError, type VaultDepositFE, ZERO_VALUE, assembleUserOperation, buildDelegationUserOp, buildEip7702Authorization, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, computeV3PoolAddress, createPafiProxyTransport, decodeBatchExecuteCalls, defaultErrorTypeForStatus, delegateDirect, detectDelegateImpl, encodeBatchExecute, encodeV3Path, encodeV3PathReversed, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiServiceUrls, getPafiWebModalAdapter, isDelegatedTo, isDelegatedToTarget, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, splitAuthorizationSig, webPopupAdapter };
|