@pafi-dev/core 0.5.22 → 0.6.1
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/abi/index.cjs +3 -7
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.js +6 -10
- package/dist/chunk-3QDZFDEL.cjs +223 -0
- package/dist/chunk-3QDZFDEL.cjs.map +1 -0
- package/dist/{chunk-Y2MZ7MKJ.js → chunk-6CXTFOIH.js} +196 -2
- package/dist/chunk-6CXTFOIH.js.map +1 -0
- package/dist/{chunk-R6OFGVMP.cjs → chunk-Q6WCDZXI.cjs} +196 -2
- package/dist/chunk-Q6WCDZXI.cjs.map +1 -0
- package/dist/{chunk-TXA4GK5C.js → chunk-UOKI5GG6.js} +87 -7
- package/dist/chunk-UOKI5GG6.js.map +1 -0
- package/dist/eip712/index.cjs +2 -3
- package/dist/eip712/index.cjs.map +1 -1
- package/dist/eip712/index.js +1 -2
- package/dist/index.cjs +205 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -48
- package/dist/index.d.ts +105 -48
- package/dist/index.js +186 -148
- package/dist/index.js.map +1 -1
- package/package.json +1 -31
- package/dist/chunk-2PIXFXA2.js +0 -135
- package/dist/chunk-2PIXFXA2.js.map +0 -1
- package/dist/chunk-CL3QSI4O.cjs +0 -65
- package/dist/chunk-CL3QSI4O.cjs.map +0 -1
- package/dist/chunk-DX73FB4P.cjs +0 -143
- package/dist/chunk-DX73FB4P.cjs.map +0 -1
- package/dist/chunk-IPXARZ6F.cjs +0 -135
- package/dist/chunk-IPXARZ6F.cjs.map +0 -1
- package/dist/chunk-JJ2LGENO.cjs +0 -373
- package/dist/chunk-JJ2LGENO.cjs.map +0 -1
- package/dist/chunk-KFWZRL7I.js +0 -65
- package/dist/chunk-KFWZRL7I.js.map +0 -1
- package/dist/chunk-L5UHQQVC.cjs +0 -136
- package/dist/chunk-L5UHQQVC.cjs.map +0 -1
- package/dist/chunk-R6OFGVMP.cjs.map +0 -1
- package/dist/chunk-TXA4GK5C.js.map +0 -1
- package/dist/chunk-VG23GIWQ.js +0 -373
- package/dist/chunk-VG23GIWQ.js.map +0 -1
- package/dist/chunk-WAFUL62X.js +0 -136
- package/dist/chunk-WAFUL62X.js.map +0 -1
- package/dist/chunk-X2JZFK4C.cjs +0 -87
- package/dist/chunk-X2JZFK4C.cjs.map +0 -1
- package/dist/chunk-Y2MZ7MKJ.js.map +0 -1
- package/dist/chunk-Y3HMGOYW.js +0 -87
- package/dist/chunk-Y3HMGOYW.js.map +0 -1
- package/dist/index-3C_HdEIm.d.cts +0 -227
- package/dist/index-DKtVEoRC.d.ts +0 -227
- package/dist/quoting/index.cjs +0 -19
- package/dist/quoting/index.cjs.map +0 -1
- package/dist/quoting/index.d.cts +0 -59
- package/dist/quoting/index.d.ts +0 -59
- package/dist/quoting/index.js +0 -19
- package/dist/quoting/index.js.map +0 -1
- package/dist/swap/index.cjs +0 -31
- package/dist/swap/index.cjs.map +0 -1
- package/dist/swap/index.d.cts +0 -3
- package/dist/swap/index.d.ts +0 -3
- package/dist/swap/index.js +0 -31
- package/dist/swap/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { Address, Hex, TypedDataDomain, PublicClient, HttpTransport, WalletClient } 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
|
|
3
|
-
export { c as BurnRequest, I as Issuer, d as PathKey } from './types-JyuXUM8C.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-JyuXUM8C.cjs';
|
|
3
|
+
export { B as BestQuote, c as BurnRequest, I as Issuer, d as PathKey, Q as QuoteResult } from './types-JyuXUM8C.cjs';
|
|
4
4
|
export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.cjs';
|
|
5
5
|
export { 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
|
-
export { buildAllPaths, combineRoutes, findBestQuote, quoteBestRoute, quoteExactInput, quoteExactInputSingle } from './quoting/index.cjs';
|
|
8
|
-
import { P as PartialUserOperation, O as Operation, U as UserOperation, S as SwapSimulationResult } from './index-3C_HdEIm.cjs';
|
|
9
|
-
export { B as BuildSwapWithGasDeductionParams, a as PaymasterFields, b as SETTLE_ALL, c as SWAP_EXACT_IN, T as TAKE_ALL, d as UserOpReceipt, V as V4_SWAP, Z as ZERO_VALUE, e as buildErc20ApprovalCalldata, f as buildPermit2ApprovalCalldata, g as buildSwapFromQuote, h as buildSwapWithGasDeduction, i as buildUniversalRouterExecuteArgs, j as buildV4SwapInput, k as checkAllowance, s as simulateSwap } from './index-3C_HdEIm.cjs';
|
|
10
7
|
import { LoginMessageParams } from './auth/index.cjs';
|
|
11
8
|
export { BuildSponsorAuthParams, BuiltSponsorAuth, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, SponsorAuthPayload, SponsorAuthVerifyResult, VerifyLoginResult, buildAndSignSponsorAuth, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth } from './auth/index.cjs';
|
|
12
9
|
|
|
@@ -267,6 +264,68 @@ interface VaultDepositFE {
|
|
|
267
264
|
tokenAmount: bigint;
|
|
268
265
|
}
|
|
269
266
|
|
|
267
|
+
/**
|
|
268
|
+
* A single call inside a batch. `BatchExecutor.execute(Call[])` iterates
|
|
269
|
+
* and invokes each one. When the batch runs via EIP-7702 delegation,
|
|
270
|
+
* `msg.sender` for each call is the user's EOA.
|
|
271
|
+
*/
|
|
272
|
+
interface Operation {
|
|
273
|
+
target: Address;
|
|
274
|
+
value: bigint;
|
|
275
|
+
data: Hex;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Paymaster fields attached to a UserOperation. Populated by the
|
|
279
|
+
* PAFI sponsor-relayer (via PAFI Backend proxy) before the user signs.
|
|
280
|
+
*/
|
|
281
|
+
interface PaymasterFields {
|
|
282
|
+
paymaster: Address;
|
|
283
|
+
paymasterData: Hex;
|
|
284
|
+
paymasterVerificationGasLimit: bigint;
|
|
285
|
+
paymasterPostOpGasLimit: bigint;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Partial UserOp used during preparation — before paymaster fields are
|
|
289
|
+
* attached or the user signs.
|
|
290
|
+
*/
|
|
291
|
+
interface PartialUserOperation {
|
|
292
|
+
sender: Address;
|
|
293
|
+
nonce: bigint;
|
|
294
|
+
callData: Hex;
|
|
295
|
+
callGasLimit: bigint;
|
|
296
|
+
verificationGasLimit: bigint;
|
|
297
|
+
preVerificationGas: bigint;
|
|
298
|
+
maxFeePerGas: bigint;
|
|
299
|
+
maxPriorityFeePerGas: bigint;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Full ERC-4337 v0.7 UserOperation, ready for bundler submission.
|
|
303
|
+
*/
|
|
304
|
+
interface UserOperation extends PartialUserOperation {
|
|
305
|
+
paymaster: Address;
|
|
306
|
+
paymasterData: Hex;
|
|
307
|
+
paymasterVerificationGasLimit: bigint;
|
|
308
|
+
paymasterPostOpGasLimit: bigint;
|
|
309
|
+
signature: Hex;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Receipt returned by a bundler after a UserOp lands on-chain.
|
|
313
|
+
*/
|
|
314
|
+
interface UserOpReceipt {
|
|
315
|
+
userOpHash: Hex;
|
|
316
|
+
success: boolean;
|
|
317
|
+
txHash: Hex;
|
|
318
|
+
blockNumber: bigint;
|
|
319
|
+
gasUsed: bigint;
|
|
320
|
+
/** Effective gas cost paid (wei). */
|
|
321
|
+
actualGasCost: bigint;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Sentinel operation value used in tests + docs when `Operation.value`
|
|
325
|
+
* is irrelevant (ERC-20 transfers, for example).
|
|
326
|
+
*/
|
|
327
|
+
declare const ZERO_VALUE = 0n;
|
|
328
|
+
|
|
270
329
|
/**
|
|
271
330
|
* v1.5 — Scenario 3: deposit USDC from the user's wallet into the
|
|
272
331
|
* Orderly perp Vault on Base mainnet.
|
|
@@ -280,7 +339,7 @@ interface VaultDepositFE {
|
|
|
280
339
|
*
|
|
281
340
|
* ## ⚠️ Native ETH constraint
|
|
282
341
|
*
|
|
283
|
-
*
|
|
342
|
+
* PAFI sponsor-relayer sponsors GAS, **not `msg.value`**. The LayerZero
|
|
284
343
|
* cross-chain fee MUST come from the user's own native ETH balance on
|
|
285
344
|
* Base — even when the rest of the UserOp is sponsored.
|
|
286
345
|
*
|
|
@@ -759,7 +818,7 @@ declare function getDummySignatureFor7702(impl: DelegateImpl): Hex;
|
|
|
759
818
|
* PAFI-assigned issuer identity.
|
|
760
819
|
*
|
|
761
820
|
* v1.4 update: the paymaster endpoint is **PAFI Backend**, which proxies
|
|
762
|
-
* to
|
|
821
|
+
* to PAFI sponsor-relayer. See [SPONSORED_PATH_FLOW.md].
|
|
763
822
|
*/
|
|
764
823
|
interface PaymasterConfig {
|
|
765
824
|
/**
|
|
@@ -812,7 +871,7 @@ declare function isPaymasterConfigured(): boolean;
|
|
|
812
871
|
* - `normal`: initiator has enough ETH; submit via `walletClient.writeContract`
|
|
813
872
|
* or a plain `eth_sendRawTransaction`. No paymaster round-trip.
|
|
814
873
|
* - `paymaster`: initiator doesn't have enough ETH; wrap the batch as a
|
|
815
|
-
* UserOperation and route through PAFI Backend →
|
|
874
|
+
* UserOperation and route through PAFI Backend → PAFI sponsor-relayer
|
|
816
875
|
* → Bundler.
|
|
817
876
|
*/
|
|
818
877
|
type SubmissionPath = "normal" | "paymaster";
|
|
@@ -835,7 +894,7 @@ interface CheckEthAndBranchParams {
|
|
|
835
894
|
/**
|
|
836
895
|
* Step 3 of the Generalized Flow ([SPONSORED_PATH_FLOW.md §2]):
|
|
837
896
|
* choose between the normal path (initiator pays ETH directly) and the
|
|
838
|
-
* paymaster path (bundler +
|
|
897
|
+
* paymaster path (bundler + PAFI sponsor-relayer).
|
|
839
898
|
*
|
|
840
899
|
* Intentionally synchronous in spirit — the only network call is
|
|
841
900
|
* `getBalance`. Callers can parallelize it with other reads.
|
|
@@ -1188,6 +1247,42 @@ interface QuoteOperatorFeePtConfig {
|
|
|
1188
1247
|
fallbackPtPriceUsdt?: number;
|
|
1189
1248
|
fetchImpl?: typeof fetch;
|
|
1190
1249
|
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Subset of `QuoteOperatorFeePtConfig` that doesn't need the V4 pool
|
|
1252
|
+
* step — used by `quoteOperatorFeeUsdt` (FE cashout-preview / `/gas-fee`
|
|
1253
|
+
* replacement). No `pointTokenAddress`, no `subgraphUrl`, no PT-side
|
|
1254
|
+
* fallback.
|
|
1255
|
+
*/
|
|
1256
|
+
interface QuoteOperatorFeeUsdtConfig {
|
|
1257
|
+
provider: PublicClient;
|
|
1258
|
+
chainId: number;
|
|
1259
|
+
gasUnits?: bigint;
|
|
1260
|
+
premiumBps?: number;
|
|
1261
|
+
chainlinkFeedAddress?: Address;
|
|
1262
|
+
usdtDecimals?: number;
|
|
1263
|
+
fallbackEthPriceUsd?: number;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Operator fee quoted in USDT raw units (default 6 decimals). Returns
|
|
1267
|
+
* the same value the legacy `GET /gas-fee` endpoint produced —
|
|
1268
|
+
* `withPremium_wei × ethPrice / 10^(18 + 8 - usdtDecimals)`. Does NOT
|
|
1269
|
+
* convert to PT, so no V4 subgraph call needed; pure on-chain
|
|
1270
|
+
* Chainlink read + RPC `getGasPrice`.
|
|
1271
|
+
*
|
|
1272
|
+
* Use this on the FE for the cashout preview screen (or anywhere a
|
|
1273
|
+
* USDT-denominated estimate is wanted) instead of round-tripping the
|
|
1274
|
+
* issuer backend's `/gas-fee` endpoint.
|
|
1275
|
+
*
|
|
1276
|
+
* @example
|
|
1277
|
+
* ```ts
|
|
1278
|
+
* import { quoteOperatorFeeUsdt } from "@pafi-dev/core";
|
|
1279
|
+
* const gasFeeUsdt = await quoteOperatorFeeUsdt({
|
|
1280
|
+
* provider, chainId: 8453,
|
|
1281
|
+
* });
|
|
1282
|
+
* // gasFeeUsdt is a bigint in 6-decimal USDT raw units
|
|
1283
|
+
* ```
|
|
1284
|
+
*/
|
|
1285
|
+
declare function quoteOperatorFeeUsdt(config: QuoteOperatorFeeUsdtConfig): Promise<bigint>;
|
|
1191
1286
|
declare function quoteOperatorFeePt(config: QuoteOperatorFeePtConfig): Promise<bigint>;
|
|
1192
1287
|
|
|
1193
1288
|
declare const BATCH_EXECUTOR_ADDRESS_BASE_MAINNET: `0x${string}`;
|
|
@@ -1528,13 +1623,6 @@ declare class PafiSDK {
|
|
|
1528
1623
|
verify: PafiSDK["verifyReceiverConsent"];
|
|
1529
1624
|
getNonce: PafiSDK["getReceiverConsentNonce"];
|
|
1530
1625
|
};
|
|
1531
|
-
readonly swap: {
|
|
1532
|
-
buildFromQuote: PafiSDK["buildSwapFromQuote"];
|
|
1533
|
-
simulate: PafiSDK["simulateSwap"];
|
|
1534
|
-
};
|
|
1535
|
-
readonly quote: {
|
|
1536
|
-
findBest: PafiSDK["findBestQuote"];
|
|
1537
|
-
};
|
|
1538
1626
|
readonly auth: {
|
|
1539
1627
|
createLoginMessage: PafiSDK["createLoginMessage"];
|
|
1540
1628
|
signMessage: PafiSDK["signLoginMessage"];
|
|
@@ -1610,40 +1698,9 @@ declare class PafiSDK {
|
|
|
1610
1698
|
verifyReceiverConsent(message: ReceiverConsent, signature: Hex, expectedReceiver: Address): Promise<SignatureVerification>;
|
|
1611
1699
|
getMintRequestNonce(receiver: Address): Promise<bigint>;
|
|
1612
1700
|
getReceiverConsentNonce(receiver: Address): Promise<bigint>;
|
|
1613
|
-
/**
|
|
1614
|
-
* Find the best swap route from `tokenIn` to `tokenOut`.
|
|
1615
|
-
* Merges `pools` with COMMON_POOLS for the configured chain, builds all
|
|
1616
|
-
* paths, and quotes via a single multicall RPC call.
|
|
1617
|
-
*/
|
|
1618
|
-
findBestQuote(tokenIn: Address, tokenOut: Address, exactAmount: bigint, pools?: PoolKey[], quoterAddress?: Address, maxHops?: number): Promise<BestQuote>;
|
|
1619
|
-
/**
|
|
1620
|
-
* Build UniversalRouter execute args from a quote result.
|
|
1621
|
-
* The caller provides `minAmountOut` after applying their own slippage.
|
|
1622
|
-
*/
|
|
1623
|
-
buildSwapFromQuote(params: {
|
|
1624
|
-
quote: QuoteResult;
|
|
1625
|
-
currencyIn: Address;
|
|
1626
|
-
currencyOut: Address;
|
|
1627
|
-
amountIn: bigint;
|
|
1628
|
-
minAmountOut: bigint;
|
|
1629
|
-
}): {
|
|
1630
|
-
commands: Hex;
|
|
1631
|
-
inputs: Hex[];
|
|
1632
|
-
};
|
|
1633
|
-
/**
|
|
1634
|
-
* Simulate a UniversalRouter.execute swap call. Catches reverts (bad
|
|
1635
|
-
* approvals, insufficient balance, pool errors) before submitting.
|
|
1636
|
-
*
|
|
1637
|
-
* @param routerAddress - UniversalRouter contract address
|
|
1638
|
-
* @param commands - Packed command bytes (from buildSwapFromQuote)
|
|
1639
|
-
* @param inputs - Encoded inputs (from buildSwapFromQuote)
|
|
1640
|
-
* @param deadline - Unix timestamp
|
|
1641
|
-
* @param from - Address that will execute the swap
|
|
1642
|
-
*/
|
|
1643
|
-
simulateSwap(routerAddress: Address, commands: Hex, inputs: Hex[], deadline: bigint, from: Address): Promise<SwapSimulationResult>;
|
|
1644
1701
|
createLoginMessage(params: Omit<LoginMessageParams, "address" | "chainId">): Promise<string>;
|
|
1645
1702
|
/** Sign a login message string with the current signer (personal_sign) */
|
|
1646
1703
|
signLoginMessage(message: string): Promise<Hex>;
|
|
1647
1704
|
}
|
|
1648
1705
|
|
|
1649
|
-
export { ApiError, BATCH_EXECUTOR_7702_IMPL, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES,
|
|
1706
|
+
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 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, type OrderlyRelayDepositRequest, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PackedUserOperationMessage, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, 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 SendWithPaymasterFallbackParams, type SignatureStruct, SignatureVerification, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOpTypedData, type UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, ZERO_VALUE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildEip7702Authorization, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, detectDelegateImpl, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, 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,12 +1,9 @@
|
|
|
1
1
|
import { Address, Hex, TypedDataDomain, PublicClient, HttpTransport, WalletClient } 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
|
|
3
|
-
export { c as BurnRequest, I as Issuer, d as PathKey } from './types-JyuXUM8C.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-JyuXUM8C.js';
|
|
3
|
+
export { B as BestQuote, c as BurnRequest, I as Issuer, d as PathKey, Q as QuoteResult } from './types-JyuXUM8C.js';
|
|
4
4
|
export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.js';
|
|
5
5
|
export { 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
|
-
export { buildAllPaths, combineRoutes, findBestQuote, quoteBestRoute, quoteExactInput, quoteExactInputSingle } from './quoting/index.js';
|
|
8
|
-
import { P as PartialUserOperation, O as Operation, U as UserOperation, S as SwapSimulationResult } from './index-DKtVEoRC.js';
|
|
9
|
-
export { B as BuildSwapWithGasDeductionParams, a as PaymasterFields, b as SETTLE_ALL, c as SWAP_EXACT_IN, T as TAKE_ALL, d as UserOpReceipt, V as V4_SWAP, Z as ZERO_VALUE, e as buildErc20ApprovalCalldata, f as buildPermit2ApprovalCalldata, g as buildSwapFromQuote, h as buildSwapWithGasDeduction, i as buildUniversalRouterExecuteArgs, j as buildV4SwapInput, k as checkAllowance, s as simulateSwap } from './index-DKtVEoRC.js';
|
|
10
7
|
import { LoginMessageParams } from './auth/index.js';
|
|
11
8
|
export { BuildSponsorAuthParams, BuiltSponsorAuth, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, SponsorAuthPayload, SponsorAuthVerifyResult, VerifyLoginResult, buildAndSignSponsorAuth, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth } from './auth/index.js';
|
|
12
9
|
|
|
@@ -267,6 +264,68 @@ interface VaultDepositFE {
|
|
|
267
264
|
tokenAmount: bigint;
|
|
268
265
|
}
|
|
269
266
|
|
|
267
|
+
/**
|
|
268
|
+
* A single call inside a batch. `BatchExecutor.execute(Call[])` iterates
|
|
269
|
+
* and invokes each one. When the batch runs via EIP-7702 delegation,
|
|
270
|
+
* `msg.sender` for each call is the user's EOA.
|
|
271
|
+
*/
|
|
272
|
+
interface Operation {
|
|
273
|
+
target: Address;
|
|
274
|
+
value: bigint;
|
|
275
|
+
data: Hex;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Paymaster fields attached to a UserOperation. Populated by the
|
|
279
|
+
* PAFI sponsor-relayer (via PAFI Backend proxy) before the user signs.
|
|
280
|
+
*/
|
|
281
|
+
interface PaymasterFields {
|
|
282
|
+
paymaster: Address;
|
|
283
|
+
paymasterData: Hex;
|
|
284
|
+
paymasterVerificationGasLimit: bigint;
|
|
285
|
+
paymasterPostOpGasLimit: bigint;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Partial UserOp used during preparation — before paymaster fields are
|
|
289
|
+
* attached or the user signs.
|
|
290
|
+
*/
|
|
291
|
+
interface PartialUserOperation {
|
|
292
|
+
sender: Address;
|
|
293
|
+
nonce: bigint;
|
|
294
|
+
callData: Hex;
|
|
295
|
+
callGasLimit: bigint;
|
|
296
|
+
verificationGasLimit: bigint;
|
|
297
|
+
preVerificationGas: bigint;
|
|
298
|
+
maxFeePerGas: bigint;
|
|
299
|
+
maxPriorityFeePerGas: bigint;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Full ERC-4337 v0.7 UserOperation, ready for bundler submission.
|
|
303
|
+
*/
|
|
304
|
+
interface UserOperation extends PartialUserOperation {
|
|
305
|
+
paymaster: Address;
|
|
306
|
+
paymasterData: Hex;
|
|
307
|
+
paymasterVerificationGasLimit: bigint;
|
|
308
|
+
paymasterPostOpGasLimit: bigint;
|
|
309
|
+
signature: Hex;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Receipt returned by a bundler after a UserOp lands on-chain.
|
|
313
|
+
*/
|
|
314
|
+
interface UserOpReceipt {
|
|
315
|
+
userOpHash: Hex;
|
|
316
|
+
success: boolean;
|
|
317
|
+
txHash: Hex;
|
|
318
|
+
blockNumber: bigint;
|
|
319
|
+
gasUsed: bigint;
|
|
320
|
+
/** Effective gas cost paid (wei). */
|
|
321
|
+
actualGasCost: bigint;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Sentinel operation value used in tests + docs when `Operation.value`
|
|
325
|
+
* is irrelevant (ERC-20 transfers, for example).
|
|
326
|
+
*/
|
|
327
|
+
declare const ZERO_VALUE = 0n;
|
|
328
|
+
|
|
270
329
|
/**
|
|
271
330
|
* v1.5 — Scenario 3: deposit USDC from the user's wallet into the
|
|
272
331
|
* Orderly perp Vault on Base mainnet.
|
|
@@ -280,7 +339,7 @@ interface VaultDepositFE {
|
|
|
280
339
|
*
|
|
281
340
|
* ## ⚠️ Native ETH constraint
|
|
282
341
|
*
|
|
283
|
-
*
|
|
342
|
+
* PAFI sponsor-relayer sponsors GAS, **not `msg.value`**. The LayerZero
|
|
284
343
|
* cross-chain fee MUST come from the user's own native ETH balance on
|
|
285
344
|
* Base — even when the rest of the UserOp is sponsored.
|
|
286
345
|
*
|
|
@@ -759,7 +818,7 @@ declare function getDummySignatureFor7702(impl: DelegateImpl): Hex;
|
|
|
759
818
|
* PAFI-assigned issuer identity.
|
|
760
819
|
*
|
|
761
820
|
* v1.4 update: the paymaster endpoint is **PAFI Backend**, which proxies
|
|
762
|
-
* to
|
|
821
|
+
* to PAFI sponsor-relayer. See [SPONSORED_PATH_FLOW.md].
|
|
763
822
|
*/
|
|
764
823
|
interface PaymasterConfig {
|
|
765
824
|
/**
|
|
@@ -812,7 +871,7 @@ declare function isPaymasterConfigured(): boolean;
|
|
|
812
871
|
* - `normal`: initiator has enough ETH; submit via `walletClient.writeContract`
|
|
813
872
|
* or a plain `eth_sendRawTransaction`. No paymaster round-trip.
|
|
814
873
|
* - `paymaster`: initiator doesn't have enough ETH; wrap the batch as a
|
|
815
|
-
* UserOperation and route through PAFI Backend →
|
|
874
|
+
* UserOperation and route through PAFI Backend → PAFI sponsor-relayer
|
|
816
875
|
* → Bundler.
|
|
817
876
|
*/
|
|
818
877
|
type SubmissionPath = "normal" | "paymaster";
|
|
@@ -835,7 +894,7 @@ interface CheckEthAndBranchParams {
|
|
|
835
894
|
/**
|
|
836
895
|
* Step 3 of the Generalized Flow ([SPONSORED_PATH_FLOW.md §2]):
|
|
837
896
|
* choose between the normal path (initiator pays ETH directly) and the
|
|
838
|
-
* paymaster path (bundler +
|
|
897
|
+
* paymaster path (bundler + PAFI sponsor-relayer).
|
|
839
898
|
*
|
|
840
899
|
* Intentionally synchronous in spirit — the only network call is
|
|
841
900
|
* `getBalance`. Callers can parallelize it with other reads.
|
|
@@ -1188,6 +1247,42 @@ interface QuoteOperatorFeePtConfig {
|
|
|
1188
1247
|
fallbackPtPriceUsdt?: number;
|
|
1189
1248
|
fetchImpl?: typeof fetch;
|
|
1190
1249
|
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Subset of `QuoteOperatorFeePtConfig` that doesn't need the V4 pool
|
|
1252
|
+
* step — used by `quoteOperatorFeeUsdt` (FE cashout-preview / `/gas-fee`
|
|
1253
|
+
* replacement). No `pointTokenAddress`, no `subgraphUrl`, no PT-side
|
|
1254
|
+
* fallback.
|
|
1255
|
+
*/
|
|
1256
|
+
interface QuoteOperatorFeeUsdtConfig {
|
|
1257
|
+
provider: PublicClient;
|
|
1258
|
+
chainId: number;
|
|
1259
|
+
gasUnits?: bigint;
|
|
1260
|
+
premiumBps?: number;
|
|
1261
|
+
chainlinkFeedAddress?: Address;
|
|
1262
|
+
usdtDecimals?: number;
|
|
1263
|
+
fallbackEthPriceUsd?: number;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Operator fee quoted in USDT raw units (default 6 decimals). Returns
|
|
1267
|
+
* the same value the legacy `GET /gas-fee` endpoint produced —
|
|
1268
|
+
* `withPremium_wei × ethPrice / 10^(18 + 8 - usdtDecimals)`. Does NOT
|
|
1269
|
+
* convert to PT, so no V4 subgraph call needed; pure on-chain
|
|
1270
|
+
* Chainlink read + RPC `getGasPrice`.
|
|
1271
|
+
*
|
|
1272
|
+
* Use this on the FE for the cashout preview screen (or anywhere a
|
|
1273
|
+
* USDT-denominated estimate is wanted) instead of round-tripping the
|
|
1274
|
+
* issuer backend's `/gas-fee` endpoint.
|
|
1275
|
+
*
|
|
1276
|
+
* @example
|
|
1277
|
+
* ```ts
|
|
1278
|
+
* import { quoteOperatorFeeUsdt } from "@pafi-dev/core";
|
|
1279
|
+
* const gasFeeUsdt = await quoteOperatorFeeUsdt({
|
|
1280
|
+
* provider, chainId: 8453,
|
|
1281
|
+
* });
|
|
1282
|
+
* // gasFeeUsdt is a bigint in 6-decimal USDT raw units
|
|
1283
|
+
* ```
|
|
1284
|
+
*/
|
|
1285
|
+
declare function quoteOperatorFeeUsdt(config: QuoteOperatorFeeUsdtConfig): Promise<bigint>;
|
|
1191
1286
|
declare function quoteOperatorFeePt(config: QuoteOperatorFeePtConfig): Promise<bigint>;
|
|
1192
1287
|
|
|
1193
1288
|
declare const BATCH_EXECUTOR_ADDRESS_BASE_MAINNET: `0x${string}`;
|
|
@@ -1528,13 +1623,6 @@ declare class PafiSDK {
|
|
|
1528
1623
|
verify: PafiSDK["verifyReceiverConsent"];
|
|
1529
1624
|
getNonce: PafiSDK["getReceiverConsentNonce"];
|
|
1530
1625
|
};
|
|
1531
|
-
readonly swap: {
|
|
1532
|
-
buildFromQuote: PafiSDK["buildSwapFromQuote"];
|
|
1533
|
-
simulate: PafiSDK["simulateSwap"];
|
|
1534
|
-
};
|
|
1535
|
-
readonly quote: {
|
|
1536
|
-
findBest: PafiSDK["findBestQuote"];
|
|
1537
|
-
};
|
|
1538
1626
|
readonly auth: {
|
|
1539
1627
|
createLoginMessage: PafiSDK["createLoginMessage"];
|
|
1540
1628
|
signMessage: PafiSDK["signLoginMessage"];
|
|
@@ -1610,40 +1698,9 @@ declare class PafiSDK {
|
|
|
1610
1698
|
verifyReceiverConsent(message: ReceiverConsent, signature: Hex, expectedReceiver: Address): Promise<SignatureVerification>;
|
|
1611
1699
|
getMintRequestNonce(receiver: Address): Promise<bigint>;
|
|
1612
1700
|
getReceiverConsentNonce(receiver: Address): Promise<bigint>;
|
|
1613
|
-
/**
|
|
1614
|
-
* Find the best swap route from `tokenIn` to `tokenOut`.
|
|
1615
|
-
* Merges `pools` with COMMON_POOLS for the configured chain, builds all
|
|
1616
|
-
* paths, and quotes via a single multicall RPC call.
|
|
1617
|
-
*/
|
|
1618
|
-
findBestQuote(tokenIn: Address, tokenOut: Address, exactAmount: bigint, pools?: PoolKey[], quoterAddress?: Address, maxHops?: number): Promise<BestQuote>;
|
|
1619
|
-
/**
|
|
1620
|
-
* Build UniversalRouter execute args from a quote result.
|
|
1621
|
-
* The caller provides `minAmountOut` after applying their own slippage.
|
|
1622
|
-
*/
|
|
1623
|
-
buildSwapFromQuote(params: {
|
|
1624
|
-
quote: QuoteResult;
|
|
1625
|
-
currencyIn: Address;
|
|
1626
|
-
currencyOut: Address;
|
|
1627
|
-
amountIn: bigint;
|
|
1628
|
-
minAmountOut: bigint;
|
|
1629
|
-
}): {
|
|
1630
|
-
commands: Hex;
|
|
1631
|
-
inputs: Hex[];
|
|
1632
|
-
};
|
|
1633
|
-
/**
|
|
1634
|
-
* Simulate a UniversalRouter.execute swap call. Catches reverts (bad
|
|
1635
|
-
* approvals, insufficient balance, pool errors) before submitting.
|
|
1636
|
-
*
|
|
1637
|
-
* @param routerAddress - UniversalRouter contract address
|
|
1638
|
-
* @param commands - Packed command bytes (from buildSwapFromQuote)
|
|
1639
|
-
* @param inputs - Encoded inputs (from buildSwapFromQuote)
|
|
1640
|
-
* @param deadline - Unix timestamp
|
|
1641
|
-
* @param from - Address that will execute the swap
|
|
1642
|
-
*/
|
|
1643
|
-
simulateSwap(routerAddress: Address, commands: Hex, inputs: Hex[], deadline: bigint, from: Address): Promise<SwapSimulationResult>;
|
|
1644
1701
|
createLoginMessage(params: Omit<LoginMessageParams, "address" | "chainId">): Promise<string>;
|
|
1645
1702
|
/** Sign a login message string with the current signer (personal_sign) */
|
|
1646
1703
|
signLoginMessage(message: string): Promise<Hex>;
|
|
1647
1704
|
}
|
|
1648
1705
|
|
|
1649
|
-
export { ApiError, BATCH_EXECUTOR_7702_IMPL, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES,
|
|
1706
|
+
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 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, type OrderlyRelayDepositRequest, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PackedUserOperationMessage, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, 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 SendWithPaymasterFallbackParams, type SignatureStruct, SignatureVerification, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, type UserOpReceipt, type UserOpTypedData, type UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, ZERO_VALUE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildEip7702Authorization, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, detectDelegateImpl, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isDelegatedToTarget, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, quoteOperatorFeePt, quoteOperatorFeeUsdt, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, setPaymasterConfig, splitAuthorizationSig, webPopupAdapter };
|