@pafi-dev/core 0.3.0-beta.9 → 0.4.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.
@@ -155,9 +155,97 @@ function optionalDate(fields, key) {
155
155
  return new Date(raw);
156
156
  }
157
157
 
158
+ // src/auth/sponsorAuth.ts
159
+ import { keccak256, recoverTypedDataAddress } from "viem";
160
+ var SPONSOR_AUTH_DOMAIN_NAME = "PafiSponsorAuth";
161
+ var SPONSOR_AUTH_TYPES = {
162
+ SponsorAuth: [
163
+ { name: "chainId", type: "uint256" },
164
+ { name: "sender", type: "address" },
165
+ { name: "callDataHash", type: "bytes32" },
166
+ { name: "nonce", type: "uint256" },
167
+ { name: "expiresAt", type: "uint256" },
168
+ { name: "scenario", type: "string" },
169
+ { name: "issuerId", type: "string" }
170
+ ]
171
+ };
172
+ function buildSponsorAuthDomain(chainId) {
173
+ return {
174
+ name: SPONSOR_AUTH_DOMAIN_NAME,
175
+ version: "1",
176
+ chainId,
177
+ verifyingContract: "0x0000000000000000000000000000000000000000"
178
+ };
179
+ }
180
+ function buildMessage(payload) {
181
+ return {
182
+ chainId: BigInt(payload.chainId),
183
+ sender: payload.sender,
184
+ callDataHash: payload.callDataHash,
185
+ nonce: payload.nonce,
186
+ expiresAt: BigInt(payload.expiresAt),
187
+ scenario: payload.scenario,
188
+ issuerId: payload.issuerId
189
+ };
190
+ }
191
+ function buildSponsorAuthTypedData(payload) {
192
+ return {
193
+ domain: buildSponsorAuthDomain(payload.chainId),
194
+ types: SPONSOR_AUTH_TYPES,
195
+ primaryType: "SponsorAuth",
196
+ message: buildMessage(payload)
197
+ };
198
+ }
199
+ function computeCallDataHash(callData) {
200
+ return keccak256(callData);
201
+ }
202
+ async function signSponsorAuth(wallet, payload) {
203
+ const { domain, types, primaryType, message } = buildSponsorAuthTypedData(payload);
204
+ return wallet.signTypedData({
205
+ account: wallet.account,
206
+ domain,
207
+ types,
208
+ primaryType,
209
+ message
210
+ });
211
+ }
212
+ async function verifySponsorAuth(payload, signature, expectedSigner) {
213
+ const nowSec = Math.floor(Date.now() / 1e3);
214
+ if (payload.expiresAt < nowSec) {
215
+ return { ok: false, reason: "EXPIRED" };
216
+ }
217
+ if (signature.length < 132) {
218
+ return { ok: false, reason: "INVALID_SIGNATURE_FORMAT" };
219
+ }
220
+ let recovered;
221
+ try {
222
+ const { domain, types, primaryType, message } = buildSponsorAuthTypedData(payload);
223
+ recovered = await recoverTypedDataAddress({
224
+ domain,
225
+ types,
226
+ primaryType,
227
+ message,
228
+ signature
229
+ });
230
+ } catch {
231
+ return { ok: false, reason: "INVALID_SIGNATURE_FORMAT" };
232
+ }
233
+ if (recovered.toLowerCase() !== expectedSigner.toLowerCase()) {
234
+ return { ok: false, reason: "INVALID_SIGNER", recoveredAddress: recovered };
235
+ }
236
+ return { ok: true, recoveredAddress: recovered };
237
+ }
238
+
158
239
  export {
159
240
  createLoginMessage,
160
241
  parseLoginMessage,
161
- verifyLoginMessage
242
+ verifyLoginMessage,
243
+ SPONSOR_AUTH_DOMAIN_NAME,
244
+ SPONSOR_AUTH_TYPES,
245
+ buildSponsorAuthDomain,
246
+ buildSponsorAuthTypedData,
247
+ computeCallDataHash,
248
+ signSponsorAuth,
249
+ verifySponsorAuth
162
250
  };
163
- //# sourceMappingURL=chunk-O4SMTUOY.js.map
251
+ //# sourceMappingURL=chunk-W6VULMCO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/auth/loginMessage.ts","../src/auth/sponsorAuth.ts"],"sourcesContent":["import { getAddress, verifyMessage, recoverMessageAddress } from \"viem\";\nimport type { Address, Hex } from \"viem\";\nimport type { LoginMessageParams, VerifyLoginResult } from \"./types\";\n\nconst DEFAULT_VERSION = \"1\";\nconst DEFAULT_STATEMENT = \"Sign in with Ethereum to PAFI.\";\n\n/**\n * Build an EIP-4361 login message string.\n *\n * The output is a deterministic plain-text message that the wallet signs via\n * `personal_sign`. The same message can be parsed back with\n * {@link parseLoginMessage} and verified with {@link verifyLoginMessage}.\n */\nexport function createLoginMessage(params: LoginMessageParams): string {\n const {\n domain,\n address,\n chainId,\n nonce,\n uri,\n statement = DEFAULT_STATEMENT,\n version = DEFAULT_VERSION,\n issuedAt = new Date(),\n expirationTime,\n notBefore,\n requestId,\n } = params;\n\n if (!domain) throw new Error(\"createLoginMessage: domain required\");\n if (!nonce) throw new Error(\"createLoginMessage: nonce required\");\n if (!uri) throw new Error(\"createLoginMessage: uri required\");\n\n const checksummed = getAddress(address);\n\n const lines: string[] = [];\n lines.push(`${domain} wants you to sign in with your Ethereum account:`);\n lines.push(checksummed);\n lines.push(\"\");\n if (statement) {\n lines.push(statement);\n lines.push(\"\");\n }\n lines.push(`URI: ${uri}`);\n lines.push(`Version: ${version}`);\n lines.push(`Chain ID: ${chainId}`);\n lines.push(`Nonce: ${nonce}`);\n lines.push(`Issued At: ${issuedAt.toISOString()}`);\n if (expirationTime) {\n lines.push(`Expiration Time: ${expirationTime.toISOString()}`);\n }\n if (notBefore) {\n lines.push(`Not Before: ${notBefore.toISOString()}`);\n }\n if (requestId) {\n lines.push(`Request ID: ${requestId}`);\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Parse a login message string built by {@link createLoginMessage} back into\n * its structured fields. Throws if the message does not match the expected\n * EIP-4361 layout.\n */\nexport function parseLoginMessage(message: string): LoginMessageParams {\n const lines = message.split(\"\\n\");\n if (lines.length < 7) {\n throw new Error(\"parseLoginMessage: message too short\");\n }\n\n const headerLine = lines[0] ?? \"\";\n const headerMatch = headerLine.match(\n /^(?<domain>.+) wants you to sign in with your Ethereum account:$/,\n );\n if (!headerMatch || !headerMatch.groups) {\n throw new Error(\"parseLoginMessage: invalid header line\");\n }\n const domain = headerMatch.groups[\"domain\"]!;\n\n const addressLine = lines[1] ?? \"\";\n if (!/^0x[0-9a-fA-F]{40}$/.test(addressLine)) {\n throw new Error(\"parseLoginMessage: invalid address line\");\n }\n const address = getAddress(addressLine);\n\n // After address: blank line, optional statement + blank line, then key:value lines.\n let cursor = 2;\n if (lines[cursor] !== \"\") {\n throw new Error(\"parseLoginMessage: missing blank line after address\");\n }\n cursor++;\n\n let statement: string | undefined;\n // Statement is present if the next line is not a known key.\n if (cursor < lines.length && !looksLikeKeyValue(lines[cursor]!)) {\n statement = lines[cursor];\n cursor++;\n if (lines[cursor] !== \"\") {\n throw new Error(\"parseLoginMessage: missing blank line after statement\");\n }\n cursor++;\n }\n\n const fields = new Map<string, string>();\n for (; cursor < lines.length; cursor++) {\n const line = lines[cursor]!;\n if (line === \"\") continue;\n const idx = line.indexOf(\": \");\n if (idx === -1) {\n throw new Error(`parseLoginMessage: malformed field line: \"${line}\"`);\n }\n const key = line.slice(0, idx);\n const value = line.slice(idx + 2);\n fields.set(key, value);\n }\n\n const uri = requireField(fields, \"URI\");\n const version = requireField(fields, \"Version\");\n const chainId = Number(requireField(fields, \"Chain ID\"));\n if (!Number.isInteger(chainId)) {\n throw new Error(\"parseLoginMessage: Chain ID is not an integer\");\n }\n const nonce = requireField(fields, \"Nonce\");\n const issuedAt = new Date(requireField(fields, \"Issued At\"));\n const expirationTime = optionalDate(fields, \"Expiration Time\");\n const notBefore = optionalDate(fields, \"Not Before\");\n const requestId = fields.get(\"Request ID\");\n\n const result: LoginMessageParams = {\n domain,\n address,\n chainId,\n nonce,\n uri,\n version,\n issuedAt,\n };\n if (statement !== undefined) result.statement = statement;\n if (expirationTime !== undefined) result.expirationTime = expirationTime;\n if (notBefore !== undefined) result.notBefore = notBefore;\n if (requestId !== undefined) result.requestId = requestId;\n return result;\n}\n\n/**\n * Verify that a login message was signed by the address embedded in the\n * message. Returns `{ valid, address }` where `address` is the recovered\n * signer (checksummed). Does NOT check expiration / not-before / nonce\n * consumption — those are the AuthService's responsibility.\n */\nexport async function verifyLoginMessage(\n message: string,\n signature: Hex,\n): Promise<VerifyLoginResult> {\n const parsed = parseLoginMessage(message);\n const valid = await verifyMessage({\n address: parsed.address,\n message,\n signature,\n });\n if (valid) {\n return { valid: true, address: parsed.address };\n }\n // Recover anyway so callers can log the mismatch.\n const recovered = await recoverMessageAddress({ message, signature });\n return { valid: false, address: getAddress(recovered) as Address };\n}\n\n// -------------------------------------------------------------------------\n// helpers\n// -------------------------------------------------------------------------\n\nconst KNOWN_KEYS = new Set([\n \"URI\",\n \"Version\",\n \"Chain ID\",\n \"Nonce\",\n \"Issued At\",\n \"Expiration Time\",\n \"Not Before\",\n \"Request ID\",\n]);\n\nfunction looksLikeKeyValue(line: string): boolean {\n const idx = line.indexOf(\": \");\n if (idx === -1) return false;\n return KNOWN_KEYS.has(line.slice(0, idx));\n}\n\nfunction requireField(fields: Map<string, string>, key: string): string {\n const value = fields.get(key);\n if (value === undefined) {\n throw new Error(`parseLoginMessage: missing required field \"${key}\"`);\n }\n return value;\n}\n\nfunction optionalDate(\n fields: Map<string, string>,\n key: string,\n): Date | undefined {\n const raw = fields.get(key);\n if (raw === undefined) return undefined;\n return new Date(raw);\n}\n","import { keccak256, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\n\nexport const SPONSOR_AUTH_DOMAIN_NAME = \"PafiSponsorAuth\";\n\nexport const SPONSOR_AUTH_TYPES = {\n SponsorAuth: [\n { name: \"chainId\", type: \"uint256\" },\n { name: \"sender\", type: \"address\" },\n { name: \"callDataHash\", type: \"bytes32\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"expiresAt\", type: \"uint256\" },\n { name: \"scenario\", type: \"string\" },\n { name: \"issuerId\", type: \"string\" },\n ],\n} as const;\n\nexport interface SponsorAuthPayload {\n chainId: number;\n sender: Address;\n callDataHash: Hex;\n nonce: bigint;\n expiresAt: number;\n scenario: string;\n issuerId: string;\n}\n\nexport interface SponsorAuthVerifyResult {\n ok: boolean;\n recoveredAddress?: Address;\n reason?: \"EXPIRED\" | \"INVALID_SIGNER\" | \"INVALID_SIGNATURE_FORMAT\";\n}\n\nexport function buildSponsorAuthDomain(chainId: number) {\n return {\n name: SPONSOR_AUTH_DOMAIN_NAME,\n version: \"1\",\n chainId,\n verifyingContract: \"0x0000000000000000000000000000000000000000\" as Address,\n };\n}\n\nfunction buildMessage(payload: SponsorAuthPayload) {\n return {\n chainId: BigInt(payload.chainId),\n sender: payload.sender,\n callDataHash: payload.callDataHash,\n nonce: payload.nonce,\n expiresAt: BigInt(payload.expiresAt),\n scenario: payload.scenario,\n issuerId: payload.issuerId,\n };\n}\n\nexport function buildSponsorAuthTypedData(payload: SponsorAuthPayload) {\n return {\n domain: buildSponsorAuthDomain(payload.chainId),\n types: SPONSOR_AUTH_TYPES,\n primaryType: \"SponsorAuth\" as const,\n message: buildMessage(payload),\n };\n}\n\nexport function computeCallDataHash(callData: Hex): Hex {\n return keccak256(callData);\n}\n\nexport async function signSponsorAuth(\n wallet: WalletClient,\n payload: SponsorAuthPayload,\n): Promise<Hex> {\n const { domain, types, primaryType, message } =\n buildSponsorAuthTypedData(payload);\n return wallet.signTypedData({\n account: wallet.account!,\n domain,\n types,\n primaryType,\n message,\n });\n}\n\nexport async function verifySponsorAuth(\n payload: SponsorAuthPayload,\n signature: Hex,\n expectedSigner: Address,\n): Promise<SponsorAuthVerifyResult> {\n const nowSec = Math.floor(Date.now() / 1000);\n if (payload.expiresAt < nowSec) {\n return { ok: false, reason: \"EXPIRED\" };\n }\n\n if (signature.length < 132) {\n return { ok: false, reason: \"INVALID_SIGNATURE_FORMAT\" };\n }\n\n let recovered: Address;\n try {\n const { domain, types, primaryType, message } =\n buildSponsorAuthTypedData(payload);\n recovered = await recoverTypedDataAddress({\n domain,\n types,\n primaryType,\n message,\n signature,\n });\n } catch {\n return { ok: false, reason: \"INVALID_SIGNATURE_FORMAT\" };\n }\n\n if (recovered.toLowerCase() !== expectedSigner.toLowerCase()) {\n return { ok: false, reason: \"INVALID_SIGNER\", recoveredAddress: recovered };\n }\n\n return { ok: true, recoveredAddress: recovered };\n}\n"],"mappings":";AAAA,SAAS,YAAY,eAAe,6BAA6B;AAIjE,IAAM,kBAAkB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d,QAAM,EAAE,QAAQ,OAAO,aAAa,QAAQ,IAC1C,0BAA0B,OAAO;AACnC,SAAO,OAAO,cAAc;AAAA,IAC1B,SAAS,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEA,eAAsB,kBACpB,SACA,WACA,gBACkC;AAClC,QAAM,SAAS,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;AAC3C,MAAI,QAAQ,YAAY,QAAQ;AAC9B,WAAO,EAAE,IAAI,OAAO,QAAQ,UAAU;AAAA,EACxC;AAEA,MAAI,UAAU,SAAS,KAAK;AAC1B,WAAO,EAAE,IAAI,OAAO,QAAQ,2BAA2B;AAAA,EACzD;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,EAAE,QAAQ,OAAO,aAAa,QAAQ,IAC1C,0BAA0B,OAAO;AACnC,gBAAY,MAAM,wBAAwB;AAAA,MACxC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,QAAQ;AACN,WAAO,EAAE,IAAI,OAAO,QAAQ,2BAA2B;AAAA,EACzD;AAEA,MAAI,UAAU,YAAY,MAAM,eAAe,YAAY,GAAG;AAC5D,WAAO,EAAE,IAAI,OAAO,QAAQ,kBAAkB,kBAAkB,UAAU;AAAA,EAC5E;AAEA,SAAO,EAAE,IAAI,MAAM,kBAAkB,UAAU;AACjD;","names":[]}
@@ -150,35 +150,32 @@ interface UserOpReceipt {
150
150
  declare const ZERO_VALUE = 0n;
151
151
 
152
152
  /**
153
- * v1.5 — Scenario 4: Swap PT → USDT on PAFI Web with **gas fee
154
- * deducted in PT** from the user's balance.
153
+ * v1.5 — Scenario 4: Swap PT → USDT on PAFI Web with gas fee
154
+ * deducted in PT from the user's balance.
155
155
  *
156
- * Builds an unsigned `PartialUserOperation` that packages three inner
157
- * calls into a single `BatchExecutor.execute(calls[])`:
156
+ * Builds an unsigned `PartialUserOperation` that packages up to four
157
+ * inner calls into a single `BatchExecutor.execute(calls[])`:
158
158
  *
159
- * 1. `PT.approve(UniversalRouter, amountIn)` — let the router pull
160
- * `amountIn` PT for the swap
161
- * 2. `UniversalRouter.execute(commands, inputs, deadline)` V4 swap
162
- * PT USDT, user receives `minAmountOut` USDT
163
- * 3. `PT.transfer(feeRecipient, gasFeePt)` pay the operator back
164
- * for sponsoring the gas, in PT (application-level recovery —
165
- * no custom paymaster contract needed)
159
+ * 1. `PT.approve(Permit2, amountIn)` — grant Permit2 ERC-20 allowance
160
+ * 2. `Permit2.approve(PT, router, amountIn, deadline)` authorize
161
+ * the UniversalRouter to pull PT via Permit2
162
+ * 3. `UniversalRouter.execute(commands, inputs, deadline)` V4 swap
163
+ * PT USDT; user receives `minAmountOut` USDT
164
+ * 4. `PT.transfer(feeRecipient, gasFeePt)` pay the operator back
165
+ * for sponsoring the gas, in PT (omitted when `gasFeePt` is 0)
166
166
  *
167
- * The user's wallet must hold `amountIn + gasFeePt` PT **before** the
168
- * UserOp runs. The three inner calls execute atomically via
169
- * EIP-7702 delegation (`msg.sender = user`), so a reverting swap
170
- * unwinds the approve + fee transfer too.
167
+ * The user's wallet must hold `amountIn + gasFeePt` PT before the
168
+ * UserOp runs. All inner calls execute atomically via EIP-7702
169
+ * delegation (`msg.sender = user`), so a reverting swap unwinds
170
+ * the approvals and fee transfer too.
171
171
  *
172
172
  * ## Fee model
173
173
  *
174
- * Exact-out on the **USDT side** is not attempted here. The user
175
- * specifies `amountIn` PT for the swap; the minimum USDT out comes
176
- * from a separate quote (not this function). The gas fee is a
177
- * separate `transfer` call — it does NOT come out of the swap's USDT
178
- * output, because that output goes straight to the user's wallet with
179
- * no intermediate hook to skim from.
174
+ * The gas fee is a separate `transfer` after the swap — it does NOT
175
+ * come out of the USDT output, because that output goes straight to
176
+ * the user's wallet with no intermediate hook.
180
177
  *
181
- * If the FE wants "user receives exactly X USDT after gas", it should:
178
+ * If the FE wants "user receives exactly X USDT after gas":
182
179
  * 1. Quote PT→USDT for candidate `amountIn` values
183
180
  * 2. Pick an `amountIn` where `minAmountOut ≈ X`
184
181
  * 3. Separately compute `gasFeePt` from the operator's rate
@@ -186,11 +183,8 @@ declare const ZERO_VALUE = 0n;
186
183
  *
187
184
  * ## Order of operations
188
185
  *
189
- * Approve swap fee transfer. The fee transfer comes **last** so
190
- * if the swap reverts, the user is also refunded the fee (atomic
191
- * batch revert). Doing fee transfer first would still unwind on
192
- * revert, but ordering it last matches the intuitive "only charge
193
- * gas on success" semantics.
186
+ * Fee transfer is last so a reverting swap also refunds the fee
187
+ * (atomic batch revert semantics).
194
188
  */
195
189
  interface BuildSwapWithGasDeductionParams {
196
190
  /** User's EOA (with EIP-7702 delegation to BatchExecutor). */
@@ -218,12 +212,7 @@ interface BuildSwapWithGasDeductionParams {
218
212
  gasFeePt: bigint;
219
213
  /** Where the gas fee lands — typically the operator or fee collector. */
220
214
  feeRecipient: Address;
221
- /**
222
- * Optional — pre-signed Permit2 / EIP-2612 approval. If omitted, a
223
- * standard `approve()` call is appended as the first batch op.
224
- * Future work: support Permit2 so the approve is part of the swap
225
- * input rather than a separate call.
226
- */
215
+ /** Override ERC-4337 gas estimates. Defaults are conservative; tune down for cheaper UserOps. */
227
216
  gasLimits?: {
228
217
  callGasLimit?: bigint;
229
218
  verificationGasLimit?: bigint;
@@ -150,35 +150,32 @@ interface UserOpReceipt {
150
150
  declare const ZERO_VALUE = 0n;
151
151
 
152
152
  /**
153
- * v1.5 — Scenario 4: Swap PT → USDT on PAFI Web with **gas fee
154
- * deducted in PT** from the user's balance.
153
+ * v1.5 — Scenario 4: Swap PT → USDT on PAFI Web with gas fee
154
+ * deducted in PT from the user's balance.
155
155
  *
156
- * Builds an unsigned `PartialUserOperation` that packages three inner
157
- * calls into a single `BatchExecutor.execute(calls[])`:
156
+ * Builds an unsigned `PartialUserOperation` that packages up to four
157
+ * inner calls into a single `BatchExecutor.execute(calls[])`:
158
158
  *
159
- * 1. `PT.approve(UniversalRouter, amountIn)` — let the router pull
160
- * `amountIn` PT for the swap
161
- * 2. `UniversalRouter.execute(commands, inputs, deadline)` V4 swap
162
- * PT USDT, user receives `minAmountOut` USDT
163
- * 3. `PT.transfer(feeRecipient, gasFeePt)` pay the operator back
164
- * for sponsoring the gas, in PT (application-level recovery —
165
- * no custom paymaster contract needed)
159
+ * 1. `PT.approve(Permit2, amountIn)` — grant Permit2 ERC-20 allowance
160
+ * 2. `Permit2.approve(PT, router, amountIn, deadline)` authorize
161
+ * the UniversalRouter to pull PT via Permit2
162
+ * 3. `UniversalRouter.execute(commands, inputs, deadline)` V4 swap
163
+ * PT USDT; user receives `minAmountOut` USDT
164
+ * 4. `PT.transfer(feeRecipient, gasFeePt)` pay the operator back
165
+ * for sponsoring the gas, in PT (omitted when `gasFeePt` is 0)
166
166
  *
167
- * The user's wallet must hold `amountIn + gasFeePt` PT **before** the
168
- * UserOp runs. The three inner calls execute atomically via
169
- * EIP-7702 delegation (`msg.sender = user`), so a reverting swap
170
- * unwinds the approve + fee transfer too.
167
+ * The user's wallet must hold `amountIn + gasFeePt` PT before the
168
+ * UserOp runs. All inner calls execute atomically via EIP-7702
169
+ * delegation (`msg.sender = user`), so a reverting swap unwinds
170
+ * the approvals and fee transfer too.
171
171
  *
172
172
  * ## Fee model
173
173
  *
174
- * Exact-out on the **USDT side** is not attempted here. The user
175
- * specifies `amountIn` PT for the swap; the minimum USDT out comes
176
- * from a separate quote (not this function). The gas fee is a
177
- * separate `transfer` call — it does NOT come out of the swap's USDT
178
- * output, because that output goes straight to the user's wallet with
179
- * no intermediate hook to skim from.
174
+ * The gas fee is a separate `transfer` after the swap — it does NOT
175
+ * come out of the USDT output, because that output goes straight to
176
+ * the user's wallet with no intermediate hook.
180
177
  *
181
- * If the FE wants "user receives exactly X USDT after gas", it should:
178
+ * If the FE wants "user receives exactly X USDT after gas":
182
179
  * 1. Quote PT→USDT for candidate `amountIn` values
183
180
  * 2. Pick an `amountIn` where `minAmountOut ≈ X`
184
181
  * 3. Separately compute `gasFeePt` from the operator's rate
@@ -186,11 +183,8 @@ declare const ZERO_VALUE = 0n;
186
183
  *
187
184
  * ## Order of operations
188
185
  *
189
- * Approve swap fee transfer. The fee transfer comes **last** so
190
- * if the swap reverts, the user is also refunded the fee (atomic
191
- * batch revert). Doing fee transfer first would still unwind on
192
- * revert, but ordering it last matches the intuitive "only charge
193
- * gas on success" semantics.
186
+ * Fee transfer is last so a reverting swap also refunds the fee
187
+ * (atomic batch revert semantics).
194
188
  */
195
189
  interface BuildSwapWithGasDeductionParams {
196
190
  /** User's EOA (with EIP-7702 delegation to BatchExecutor). */
@@ -218,12 +212,7 @@ interface BuildSwapWithGasDeductionParams {
218
212
  gasFeePt: bigint;
219
213
  /** Where the gas fee lands — typically the operator or fee collector. */
220
214
  feeRecipient: Address;
221
- /**
222
- * Optional — pre-signed Permit2 / EIP-2612 approval. If omitted, a
223
- * standard `approve()` call is appended as the first batch op.
224
- * Future work: support Permit2 so the approve is part of the swap
225
- * input rather than a separate call.
226
- */
215
+ /** Override ERC-4337 gas estimates. Defaults are conservative; tune down for cheaper UserOps. */
227
216
  gasLimits?: {
228
217
  callGasLimit?: bigint;
229
218
  verificationGasLimit?: bigint;
package/dist/index.cjs CHANGED
@@ -5,7 +5,14 @@ var _chunkALCWYDVGcjs = require('./chunk-ALCWYDVG.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkGWLEEXM4cjs = require('./chunk-GWLEEXM4.cjs');
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ var _chunkFNJZUNK3cjs = require('./chunk-FNJZUNK3.cjs');
9
16
 
10
17
 
11
18
 
@@ -83,7 +90,7 @@ var _chunkDMW67WBUcjs = require('./chunk-DMW67WBU.cjs');
83
90
 
84
91
 
85
92
 
86
- var _chunkEDR5SFJNcjs = require('./chunk-EDR5SFJN.cjs');
93
+ var _chunkTYIEMGMYcjs = require('./chunk-TYIEMGMY.cjs');
87
94
 
88
95
 
89
96
 
@@ -98,7 +105,7 @@ var _viem = require('viem');
98
105
 
99
106
  // src/contracts/real/orderlyVault.ts
100
107
 
101
- var ORDERLY_VAULT_BASE_MAINNET = "0xDe5cE5DD048596e46Ff671b13317aCC3C5B59b01";
108
+ var ORDERLY_VAULT_BASE_MAINNET = "0x816f722424B49Cf1275cc86DA9840Fbd5a6167e9";
102
109
  var ORDERLY_VAULT_ADDRESSES = {
103
110
  8453: ORDERLY_VAULT_BASE_MAINNET
104
111
  };
@@ -212,16 +219,16 @@ function buildPerpDepositWithGasDeduction(params) {
212
219
  args: [params.depositData]
213
220
  });
214
221
  const operations = [
215
- _chunkEDR5SFJNcjs.erc20ApproveOp.call(void 0, params.usdcAddress, vault, params.amount),
222
+ _chunkTYIEMGMYcjs.erc20ApproveOp.call(void 0, params.usdcAddress, vault, params.amount),
216
223
  {
217
- ..._chunkEDR5SFJNcjs.rawCallOp.call(void 0, vault, depositCallData),
224
+ ..._chunkTYIEMGMYcjs.rawCallOp.call(void 0, vault, depositCallData),
218
225
  // BatchExecutor passes `value` from the inner call along; this
219
226
  // becomes the LayerZero fee. The aggregated `msg.value` for the
220
227
  // top-level UserOp must equal the sum of inner `value`s.
221
228
  value: params.layerZeroFee
222
229
  }
223
230
  ];
224
- return _chunkEDR5SFJNcjs.buildPartialUserOperation.call(void 0, {
231
+ return _chunkTYIEMGMYcjs.buildPartialUserOperation.call(void 0, {
225
232
  sender: params.userAddress,
226
233
  nonce: params.aaNonce,
227
234
  operations,
@@ -280,6 +287,93 @@ async function checkEthAndBranch(params) {
280
287
  return balance >= required ? "normal" : "paymaster";
281
288
  }
282
289
 
290
+ // src/delegation/checkDelegation.ts
291
+ var EIP7702_MAGIC = "0xef0100";
292
+ function parseEip7702DelegatedAddress(code) {
293
+ if (!code || code === "0x" || code === "0x0") return null;
294
+ const normalized = code.toLowerCase();
295
+ const magic = EIP7702_MAGIC.toLowerCase();
296
+ const idx = normalized.indexOf(magic);
297
+ if (idx === -1) return null;
298
+ const raw = normalized.slice(idx + magic.length, idx + magic.length + 40);
299
+ if (raw.length !== 40) return null;
300
+ return `0x${raw}`;
301
+ }
302
+ async function checkDelegation(client, address) {
303
+ const code = await client.getCode({ address });
304
+ return parseEip7702DelegatedAddress(code);
305
+ }
306
+ async function isDelegatedTo(client, address, target) {
307
+ const impl = await checkDelegation(client, address);
308
+ if (!impl) return false;
309
+ return impl.toLowerCase() === target.toLowerCase();
310
+ }
311
+
312
+ // src/delegation/buildDelegationUserOp.ts
313
+ function buildDelegationUserOp(params) {
314
+ return _chunkTYIEMGMYcjs.buildPartialUserOperation.call(void 0, {
315
+ sender: params.userAddress,
316
+ nonce: params.aaNonce,
317
+ operations: [
318
+ {
319
+ // Self-call with no data — triggers EIP-7702 delegation without
320
+ // executing any inner logic. The BatchExecutor.execute([]) call with
321
+ // an empty array would revert, so we target the EOA itself (which
322
+ // forwards to BatchExecutor that then no-ops on empty input).
323
+ target: params.userAddress,
324
+ value: 0n,
325
+ data: "0x"
326
+ }
327
+ ],
328
+ gasLimits: {
329
+ callGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _7 => _7.gasLimits, 'optionalAccess', _8 => _8.callGasLimit]), () => ( 50000n)),
330
+ verificationGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _9 => _9.gasLimits, 'optionalAccess', _10 => _10.verificationGasLimit]), () => ( 150000n)),
331
+ preVerificationGas: _nullishCoalesce(_optionalChain([params, 'access', _11 => _11.gasLimits, 'optionalAccess', _12 => _12.preVerificationGas]), () => ( 50000n))
332
+ }
333
+ });
334
+ }
335
+ async function getAaNonce(client, userAddress) {
336
+ const ENTRY_POINT = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
337
+ const NONCE_ABI = [
338
+ {
339
+ inputs: [
340
+ { name: "sender", type: "address" },
341
+ { name: "key", type: "uint192" }
342
+ ],
343
+ name: "getNonce",
344
+ outputs: [{ name: "nonce", type: "uint256" }],
345
+ stateMutability: "view",
346
+ type: "function"
347
+ }
348
+ ];
349
+ return client.readContract({
350
+ address: ENTRY_POINT,
351
+ abi: NONCE_ABI,
352
+ functionName: "getNonce",
353
+ args: [userAddress, 0n]
354
+ });
355
+ }
356
+
357
+ // src/transport/proxyTransport.ts
358
+
359
+ function createPafiProxyTransport(params) {
360
+ const { proxyUrl, getIdentityToken, issuerId } = params;
361
+ return _viem.http.call(void 0, proxyUrl, {
362
+ fetchOptions: {},
363
+ // fetchFn intercepts every fetch call the viem http transport makes,
364
+ // injecting the auth headers before the request leaves the browser.
365
+ fetchFn: (input, init) => {
366
+ const headers = new Headers(_optionalChain([init, 'optionalAccess', _13 => _13.headers]));
367
+ const token = getIdentityToken();
368
+ if (token) {
369
+ headers.set("authorization", `Bearer ${token}`);
370
+ }
371
+ headers.set("x-issuer-id", issuerId);
372
+ return fetch(input, { ...init, headers });
373
+ }
374
+ });
375
+ }
376
+
283
377
  // src/contracts/real/pointToken.ts
284
378
 
285
379
  var POINT_TOKEN_ABI = _viem.parseAbi.call(void 0, [
@@ -391,8 +485,8 @@ function openWebPopup(url, options = {}) {
391
485
  const width = _nullishCoalesce(options.width, () => ( DEFAULT_WIDTH));
392
486
  const height = _nullishCoalesce(options.height, () => ( DEFAULT_HEIGHT));
393
487
  const name = _nullishCoalesce(options.windowName, () => ( DEFAULT_NAME));
394
- const screenW = _nullishCoalesce(_optionalChain([window, 'access', _7 => _7.screen, 'optionalAccess', _8 => _8.availWidth]), () => ( window.innerWidth));
395
- const screenH = _nullishCoalesce(_optionalChain([window, 'access', _9 => _9.screen, 'optionalAccess', _10 => _10.availHeight]), () => ( window.innerHeight));
488
+ const screenW = _nullishCoalesce(_optionalChain([window, 'access', _14 => _14.screen, 'optionalAccess', _15 => _15.availWidth]), () => ( window.innerWidth));
489
+ const screenH = _nullishCoalesce(_optionalChain([window, 'access', _16 => _16.screen, 'optionalAccess', _17 => _17.availHeight]), () => ( window.innerHeight));
396
490
  const left = Math.max(0, Math.floor((screenW - width) / 2));
397
491
  const top = Math.max(0, Math.floor((screenH - height) / 2));
398
492
  const features = [
@@ -425,7 +519,7 @@ function openWebPopup(url, options = {}) {
425
519
  window.removeEventListener("message", messageListener);
426
520
  messageListener = null;
427
521
  }
428
- _optionalChain([options, 'access', _11 => _11.onClose, 'optionalCall', _12 => _12()]);
522
+ _optionalChain([options, 'access', _18 => _18.onClose, 'optionalCall', _19 => _19()]);
429
523
  };
430
524
  pollId = setInterval(() => {
431
525
  if (popup.closed) {
@@ -534,25 +628,25 @@ var PafiSDK = class {
534
628
  // -------------------------------------------------------------------------
535
629
  requirePointToken() {
536
630
  if (!this._pointTokenAddress) {
537
- throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("pointTokenAddress not set");
631
+ throw new (0, _chunkTYIEMGMYcjs.ConfigurationError)("pointTokenAddress not set");
538
632
  }
539
633
  return this._pointTokenAddress;
540
634
  }
541
635
  requireProvider() {
542
636
  if (!this._provider) {
543
- throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("provider not set");
637
+ throw new (0, _chunkTYIEMGMYcjs.ConfigurationError)("provider not set");
544
638
  }
545
639
  return this._provider;
546
640
  }
547
641
  requireSigner() {
548
642
  if (!this._signer) {
549
- throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("signer not set");
643
+ throw new (0, _chunkTYIEMGMYcjs.ConfigurationError)("signer not set");
550
644
  }
551
645
  return this._signer;
552
646
  }
553
647
  requireChainId() {
554
648
  if (this._chainId === void 0) {
555
- throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("chainId not set");
649
+ throw new (0, _chunkTYIEMGMYcjs.ConfigurationError)("chainId not set");
556
650
  }
557
651
  return this._chainId;
558
652
  }
@@ -638,7 +732,7 @@ var PafiSDK = class {
638
732
  * The caller provides `minAmountOut` after applying their own slippage.
639
733
  */
640
734
  buildSwapFromQuote(params) {
641
- return _chunkEDR5SFJNcjs.buildSwapFromQuote.call(void 0, params);
735
+ return _chunkTYIEMGMYcjs.buildSwapFromQuote.call(void 0, params);
642
736
  }
643
737
  // -------------------------------------------------------------------------
644
738
  // Simulation — dry-run via eth_call (no gas spent)
@@ -654,7 +748,7 @@ var PafiSDK = class {
654
748
  * @param from - Address that will execute the swap
655
749
  */
656
750
  async simulateSwap(routerAddress, commands, inputs, deadline, from) {
657
- return _chunkEDR5SFJNcjs.simulateSwap.call(void 0,
751
+ return _chunkTYIEMGMYcjs.simulateSwap.call(void 0,
658
752
  this.requireProvider(),
659
753
  routerAddress,
660
754
  commands,
@@ -671,16 +765,16 @@ var PafiSDK = class {
671
765
  const chainId = this.requireChainId();
672
766
  const account = signer.account;
673
767
  if (!account) {
674
- throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("signer has no account attached");
768
+ throw new (0, _chunkTYIEMGMYcjs.ConfigurationError)("signer has no account attached");
675
769
  }
676
- return _chunkGWLEEXM4cjs.createLoginMessage.call(void 0, { ...params, address: account.address, chainId });
770
+ return _chunkFNJZUNK3cjs.createLoginMessage.call(void 0, { ...params, address: account.address, chainId });
677
771
  }
678
772
  /** Sign a login message string with the current signer (personal_sign) */
679
773
  async signLoginMessage(message) {
680
774
  const signer = this.requireSigner();
681
775
  const account = signer.account;
682
776
  if (!account) {
683
- throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("signer has no account attached");
777
+ throw new (0, _chunkTYIEMGMYcjs.ConfigurationError)("signer has no account attached");
684
778
  }
685
779
  return signer.signMessage({ account, message });
686
780
  }
@@ -784,5 +878,18 @@ var PafiSDK = class {
784
878
 
785
879
 
786
880
 
787
- exports.ApiError = _chunkEDR5SFJNcjs.ApiError; exports.BATCH_EXECUTOR_ABI = _chunkEDR5SFJNcjs.BATCH_EXECUTOR_ABI; exports.BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = BATCH_EXECUTOR_ADDRESS_BASE_MAINNET; exports.BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA; exports.BROKER_HASHES = BROKER_HASHES; exports.COMMON_POOLS = _chunkDMW67WBUcjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunkDMW67WBUcjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = _chunkEDR5SFJNcjs.ConfigurationError; exports.ENTRY_POINT_V07 = ENTRY_POINT_V07; exports.ORDERLY_VAULT_ABI = ORDERLY_VAULT_ABI; exports.ORDERLY_VAULT_ADDRESSES = ORDERLY_VAULT_ADDRESSES; exports.ORDERLY_VAULT_BASE_MAINNET = ORDERLY_VAULT_BASE_MAINNET; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_POOLS = _chunkDMW67WBUcjs.POINT_TOKEN_POOLS; exports.POINT_TOKEN_V2_ABI = POINT_TOKEN_ABI; exports.PafiSDK = PafiSDK; exports.PafiSDKError = _chunkEDR5SFJNcjs.PafiSDKError; exports.SETTLE_ALL = _chunkEDR5SFJNcjs.SETTLE_ALL; exports.SUPPORTED_CHAINS = _chunkDMW67WBUcjs.SUPPORTED_CHAINS; exports.SWAP_EXACT_IN = _chunkEDR5SFJNcjs.SWAP_EXACT_IN; exports.SigningError = _chunkEDR5SFJNcjs.SigningError; exports.SimulationError = _chunkEDR5SFJNcjs.SimulationError; exports.TAKE_ALL = _chunkEDR5SFJNcjs.TAKE_ALL; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunkDMW67WBUcjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V4_QUOTER_ADDRESSES = _chunkDMW67WBUcjs.V4_QUOTER_ADDRESSES; exports.V4_SWAP = _chunkEDR5SFJNcjs.V4_SWAP; exports.ZERO_VALUE = ZERO_VALUE; exports._resetPaymasterConfigForTests = _resetPaymasterConfigForTests; exports.assembleUserOperation = _chunkEDR5SFJNcjs.assembleUserOperation; exports.buildAllPaths = _chunkZ2V525IScjs.buildAllPaths; exports.buildBurnRequestTypedData = _chunkKJKDLD7Ncjs.buildBurnRequestTypedData; exports.buildDomain = _chunkKJKDLD7Ncjs.buildDomain; exports.buildErc20ApprovalCalldata = _chunkEDR5SFJNcjs.buildErc20ApprovalCalldata; exports.buildMintRequestTypedData = _chunkKJKDLD7Ncjs.buildMintRequestTypedData; exports.buildPartialUserOperation = _chunkEDR5SFJNcjs.buildPartialUserOperation; exports.buildPermit2ApprovalCalldata = _chunkEDR5SFJNcjs.buildPermit2ApprovalCalldata; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildReceiverConsentTypedData = _chunkKJKDLD7Ncjs.buildReceiverConsentTypedData; exports.buildSwapFromQuote = _chunkEDR5SFJNcjs.buildSwapFromQuote; exports.buildSwapWithGasDeduction = _chunkEDR5SFJNcjs.buildSwapWithGasDeduction; exports.buildUniversalRouterExecuteArgs = _chunkEDR5SFJNcjs.buildUniversalRouterExecuteArgs; exports.buildV4SwapInput = _chunkEDR5SFJNcjs.buildV4SwapInput; exports.burnRequestTypes = _chunkDMW67WBUcjs.burnRequestTypes; exports.checkAllowance = _chunkEDR5SFJNcjs.checkAllowance; exports.checkEthAndBranch = checkEthAndBranch; exports.combineRoutes = _chunkZ2V525IScjs.combineRoutes; exports.computeAccountId = computeAccountId; exports.createLoginMessage = _chunkGWLEEXM4cjs.createLoginMessage; exports.encodeBatchExecute = _chunkEDR5SFJNcjs.encodeBatchExecute; exports.erc20Abi = _chunkIPXARZ6Fcjs.erc20Abi; exports.erc20ApproveOp = _chunkEDR5SFJNcjs.erc20ApproveOp; exports.erc20BurnOp = _chunkEDR5SFJNcjs.erc20BurnOp; exports.erc20TransferOp = _chunkEDR5SFJNcjs.erc20TransferOp; exports.findBestQuote = _chunkZ2V525IScjs.findBestQuote; exports.getContractAddresses = getContractAddresses; exports.getIssuer = _chunkCQCSQPWGcjs.getIssuer2; exports.getMintRequestNonce = _chunkCQCSQPWGcjs.getMintRequestNonce; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPaymasterConfig = getPaymasterConfig; exports.getPointTokenBalance = _chunkCQCSQPWGcjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkCQCSQPWGcjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkCQCSQPWGcjs.getIssuer; exports.getReceiverConsentNonce = _chunkCQCSQPWGcjs.getReceiverConsentNonce; exports.getTokenName = _chunkCQCSQPWGcjs.getTokenName; exports.isActiveIssuer = _chunkCQCSQPWGcjs.isActiveIssuer; exports.isMinter = _chunkCQCSQPWGcjs.isMinter; exports.isPaymasterConfigured = isPaymasterConfigured; exports.issuerRegistryAbi = _chunkS2XRFFP3cjs.issuerRegistryAbi; exports.mintRequestTypes = _chunkDMW67WBUcjs.mintRequestTypes; exports.mintingOracleAbi = _chunkS2XRFFP3cjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseLoginMessage = _chunkGWLEEXM4cjs.parseLoginMessage; exports.permit2Abi = _chunkIPXARZ6Fcjs.permit2Abi; exports.pointTokenAbi = _chunkS2XRFFP3cjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunkALCWYDVGcjs.pointTokenFactoryAbi; exports.quoteBestRoute = _chunkZ2V525IScjs.quoteBestRoute; exports.quoteExactInput = _chunkZ2V525IScjs.quoteExactInput; exports.quoteExactInputSingle = _chunkZ2V525IScjs.quoteExactInputSingle; exports.rawCallOp = _chunkEDR5SFJNcjs.rawCallOp; exports.receiverConsentTypes = _chunkDMW67WBUcjs.receiverConsentTypes; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.setPaymasterConfig = setPaymasterConfig; exports.signBurnRequest = _chunkKJKDLD7Ncjs.signBurnRequest; exports.signMintRequest = _chunkKJKDLD7Ncjs.signMintRequest; exports.signReceiverConsent = _chunkKJKDLD7Ncjs.signReceiverConsent; exports.simulateSwap = _chunkEDR5SFJNcjs.simulateSwap; exports.universalRouterAbi = _chunkIPXARZ6Fcjs.universalRouterAbi; exports.v4QuoterAbi = _chunkCL3QSI4Ocjs.v4QuoterAbi; exports.verifyBurnRequest = _chunkKJKDLD7Ncjs.verifyBurnRequest; exports.verifyLoginMessage = _chunkGWLEEXM4cjs.verifyLoginMessage; exports.verifyMintCap = _chunkCQCSQPWGcjs.verifyMintCap; exports.verifyMintRequest = _chunkKJKDLD7Ncjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkKJKDLD7Ncjs.verifyReceiverConsent; exports.webPopupAdapter = webPopupAdapter;
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+
889
+
890
+
891
+
892
+
893
+
894
+ exports.ApiError = _chunkTYIEMGMYcjs.ApiError; exports.BATCH_EXECUTOR_ABI = _chunkTYIEMGMYcjs.BATCH_EXECUTOR_ABI; exports.BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = BATCH_EXECUTOR_ADDRESS_BASE_MAINNET; exports.BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA; exports.BROKER_HASHES = BROKER_HASHES; exports.COMMON_POOLS = _chunkDMW67WBUcjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunkDMW67WBUcjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = _chunkTYIEMGMYcjs.ConfigurationError; exports.ENTRY_POINT_V07 = ENTRY_POINT_V07; exports.ORDERLY_VAULT_ABI = ORDERLY_VAULT_ABI; exports.ORDERLY_VAULT_ADDRESSES = ORDERLY_VAULT_ADDRESSES; exports.ORDERLY_VAULT_BASE_MAINNET = ORDERLY_VAULT_BASE_MAINNET; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_POOLS = _chunkDMW67WBUcjs.POINT_TOKEN_POOLS; exports.POINT_TOKEN_V2_ABI = POINT_TOKEN_ABI; exports.PafiSDK = PafiSDK; exports.PafiSDKError = _chunkTYIEMGMYcjs.PafiSDKError; exports.SETTLE_ALL = _chunkTYIEMGMYcjs.SETTLE_ALL; exports.SPONSOR_AUTH_DOMAIN_NAME = _chunkFNJZUNK3cjs.SPONSOR_AUTH_DOMAIN_NAME; exports.SPONSOR_AUTH_TYPES = _chunkFNJZUNK3cjs.SPONSOR_AUTH_TYPES; exports.SUPPORTED_CHAINS = _chunkDMW67WBUcjs.SUPPORTED_CHAINS; exports.SWAP_EXACT_IN = _chunkTYIEMGMYcjs.SWAP_EXACT_IN; exports.SigningError = _chunkTYIEMGMYcjs.SigningError; exports.SimulationError = _chunkTYIEMGMYcjs.SimulationError; exports.TAKE_ALL = _chunkTYIEMGMYcjs.TAKE_ALL; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunkDMW67WBUcjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V4_QUOTER_ADDRESSES = _chunkDMW67WBUcjs.V4_QUOTER_ADDRESSES; exports.V4_SWAP = _chunkTYIEMGMYcjs.V4_SWAP; exports.ZERO_VALUE = ZERO_VALUE; exports._resetPaymasterConfigForTests = _resetPaymasterConfigForTests; exports.assembleUserOperation = _chunkTYIEMGMYcjs.assembleUserOperation; exports.buildAllPaths = _chunkZ2V525IScjs.buildAllPaths; exports.buildBurnRequestTypedData = _chunkKJKDLD7Ncjs.buildBurnRequestTypedData; exports.buildDelegationUserOp = buildDelegationUserOp; exports.buildDomain = _chunkKJKDLD7Ncjs.buildDomain; exports.buildErc20ApprovalCalldata = _chunkTYIEMGMYcjs.buildErc20ApprovalCalldata; exports.buildMintRequestTypedData = _chunkKJKDLD7Ncjs.buildMintRequestTypedData; exports.buildPartialUserOperation = _chunkTYIEMGMYcjs.buildPartialUserOperation; exports.buildPermit2ApprovalCalldata = _chunkTYIEMGMYcjs.buildPermit2ApprovalCalldata; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildReceiverConsentTypedData = _chunkKJKDLD7Ncjs.buildReceiverConsentTypedData; exports.buildSponsorAuthDomain = _chunkFNJZUNK3cjs.buildSponsorAuthDomain; exports.buildSponsorAuthTypedData = _chunkFNJZUNK3cjs.buildSponsorAuthTypedData; exports.buildSwapFromQuote = _chunkTYIEMGMYcjs.buildSwapFromQuote; exports.buildSwapWithGasDeduction = _chunkTYIEMGMYcjs.buildSwapWithGasDeduction; exports.buildUniversalRouterExecuteArgs = _chunkTYIEMGMYcjs.buildUniversalRouterExecuteArgs; exports.buildV4SwapInput = _chunkTYIEMGMYcjs.buildV4SwapInput; exports.burnRequestTypes = _chunkDMW67WBUcjs.burnRequestTypes; exports.checkAllowance = _chunkTYIEMGMYcjs.checkAllowance; exports.checkDelegation = checkDelegation; exports.checkEthAndBranch = checkEthAndBranch; exports.combineRoutes = _chunkZ2V525IScjs.combineRoutes; exports.computeAccountId = computeAccountId; exports.computeCallDataHash = _chunkFNJZUNK3cjs.computeCallDataHash; exports.createLoginMessage = _chunkFNJZUNK3cjs.createLoginMessage; exports.createPafiProxyTransport = createPafiProxyTransport; exports.encodeBatchExecute = _chunkTYIEMGMYcjs.encodeBatchExecute; exports.erc20Abi = _chunkIPXARZ6Fcjs.erc20Abi; exports.erc20ApproveOp = _chunkTYIEMGMYcjs.erc20ApproveOp; exports.erc20BurnOp = _chunkTYIEMGMYcjs.erc20BurnOp; exports.erc20TransferOp = _chunkTYIEMGMYcjs.erc20TransferOp; exports.findBestQuote = _chunkZ2V525IScjs.findBestQuote; exports.getAaNonce = getAaNonce; exports.getContractAddresses = getContractAddresses; exports.getIssuer = _chunkCQCSQPWGcjs.getIssuer2; exports.getMintRequestNonce = _chunkCQCSQPWGcjs.getMintRequestNonce; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPaymasterConfig = getPaymasterConfig; exports.getPointTokenBalance = _chunkCQCSQPWGcjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkCQCSQPWGcjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkCQCSQPWGcjs.getIssuer; exports.getReceiverConsentNonce = _chunkCQCSQPWGcjs.getReceiverConsentNonce; exports.getTokenName = _chunkCQCSQPWGcjs.getTokenName; exports.isActiveIssuer = _chunkCQCSQPWGcjs.isActiveIssuer; exports.isDelegatedTo = isDelegatedTo; exports.isMinter = _chunkCQCSQPWGcjs.isMinter; exports.isPaymasterConfigured = isPaymasterConfigured; exports.issuerRegistryAbi = _chunkS2XRFFP3cjs.issuerRegistryAbi; exports.mintRequestTypes = _chunkDMW67WBUcjs.mintRequestTypes; exports.mintingOracleAbi = _chunkS2XRFFP3cjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseEip7702DelegatedAddress = parseEip7702DelegatedAddress; exports.parseLoginMessage = _chunkFNJZUNK3cjs.parseLoginMessage; exports.permit2Abi = _chunkIPXARZ6Fcjs.permit2Abi; exports.pointTokenAbi = _chunkS2XRFFP3cjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunkALCWYDVGcjs.pointTokenFactoryAbi; exports.quoteBestRoute = _chunkZ2V525IScjs.quoteBestRoute; exports.quoteExactInput = _chunkZ2V525IScjs.quoteExactInput; exports.quoteExactInputSingle = _chunkZ2V525IScjs.quoteExactInputSingle; exports.rawCallOp = _chunkTYIEMGMYcjs.rawCallOp; exports.receiverConsentTypes = _chunkDMW67WBUcjs.receiverConsentTypes; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.setPaymasterConfig = setPaymasterConfig; exports.signBurnRequest = _chunkKJKDLD7Ncjs.signBurnRequest; exports.signMintRequest = _chunkKJKDLD7Ncjs.signMintRequest; exports.signReceiverConsent = _chunkKJKDLD7Ncjs.signReceiverConsent; exports.signSponsorAuth = _chunkFNJZUNK3cjs.signSponsorAuth; exports.simulateSwap = _chunkTYIEMGMYcjs.simulateSwap; exports.universalRouterAbi = _chunkIPXARZ6Fcjs.universalRouterAbi; exports.v4QuoterAbi = _chunkCL3QSI4Ocjs.v4QuoterAbi; exports.verifyBurnRequest = _chunkKJKDLD7Ncjs.verifyBurnRequest; exports.verifyLoginMessage = _chunkFNJZUNK3cjs.verifyLoginMessage; exports.verifyMintCap = _chunkCQCSQPWGcjs.verifyMintCap; exports.verifyMintRequest = _chunkKJKDLD7Ncjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkKJKDLD7Ncjs.verifyReceiverConsent; exports.verifySponsorAuth = _chunkFNJZUNK3cjs.verifySponsorAuth; exports.webPopupAdapter = webPopupAdapter;
788
895
  //# sourceMappingURL=index.cjs.map