@pafi-dev/core 0.13.1 → 0.15.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 +1 -1
- package/dist/{chunk-UEO4YN6T.js → chunk-4TNHRZ4X.js} +2 -2
- package/dist/{chunk-UEO4YN6T.js.map → chunk-4TNHRZ4X.js.map} +1 -1
- package/dist/{chunk-NT2ZPF72.cjs → chunk-UZUDJXKE.cjs} +2 -2
- package/dist/{chunk-NT2ZPF72.cjs.map → chunk-UZUDJXKE.cjs.map} +1 -1
- package/dist/eip712/index.cjs +2 -2
- package/dist/eip712/index.js +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Core ships **data + primitives** only. Higher-level orchestration in siblings:
|
|
|
62
62
|
| `PoolKey` (`{ token0, token1, fee }`), `V3Path` (`{ tokens, fees }`), `QuoteResult` | Uniswap V3 routing types used by `@pafi-dev/trading` |
|
|
63
63
|
| `encodeV3Path`, `encodeV3PathReversed`, `computeV3PoolAddress` | V3 packed-bytes path encoding + CREATE2 pool-address derivation |
|
|
64
64
|
| `V3_FACTORY_ADDRESSES`, `V3_SWAP_ROUTER_ADDRESSES`, `QUOTER_V2_ADDRESSES`, `V3_POOL_INIT_CODE_HASH` | PAFI's V3-fork deployment (Base mainnet) |
|
|
65
|
-
| `pointTokenAbi
|
|
65
|
+
| `pointTokenAbi`, `issuerRegistryAbi`, `mintingOracleAbi`, `mintFeeWrapperAbi`, `pointTokenFactoryAbi`, `erc20Abi`, `permit2Abi`, `universalRouterAbi`, `v3QuoterV2Abi` | Contract ABIs (regenerated from Foundry artifacts) |
|
|
66
66
|
| `createLoginMessage` | EIP-4361 SIWE login builder |
|
|
67
67
|
|
|
68
68
|
---
|
|
@@ -125,7 +125,7 @@ var POINT_TOKEN_POOLS = {
|
|
|
125
125
|
};
|
|
126
126
|
var ENTRY_POINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
127
127
|
var ENTRY_POINT_V08 = "0x4337084d9e255ff0702461cf8895ce9e3b5ff108";
|
|
128
|
-
var PERMIT2_ADDRESS = "
|
|
128
|
+
var PERMIT2_ADDRESS = "0xEB450d21ae68D3303Cf5775A54Cc84EE7c3fC8eC";
|
|
129
129
|
|
|
130
130
|
// src/eip712/verifyDeadline.ts
|
|
131
131
|
function assertValidCurrentTimeSec(currentTimeSec) {
|
|
@@ -252,4 +252,4 @@ export {
|
|
|
252
252
|
signBurnRequest,
|
|
253
253
|
verifyBurnRequest
|
|
254
254
|
};
|
|
255
|
-
//# sourceMappingURL=chunk-
|
|
255
|
+
//# sourceMappingURL=chunk-4TNHRZ4X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/verifyDeadline.ts","../src/eip712/burnRequest.ts"],"sourcesContent":["import type { Address, PublicClient } from \"viem\";\nimport type { PointTokenDomainConfig } from \"../types\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\n/**\n * Build the EIP-712 domain struct from a PointToken config. Uses\n * `config.version` when supplied; defaults to `\"1\"` for back-compat.\n */\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: config.version ?? \"1\",\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n\n/**\n * Domain mismatch error thrown by `assertDomainMatchesContract`.\n */\nexport class Eip712DomainMismatchError extends Error {\n constructor(\n public readonly field: \"name\" | \"version\" | \"chainId\" | \"verifyingContract\",\n public readonly expected: string,\n public readonly actual: string,\n ) {\n super(\n `EIP-712 domain mismatch on field \"${field}\": expected ${expected}, got ${actual}. ` +\n `Local SDK config is out of sync with deployed PointToken — signatures will be rejected on-chain. ` +\n `Update SDK config or contract before producing more signatures.`,\n );\n this.name = \"Eip712DomainMismatchError\";\n }\n}\n\n/**\n * One-RPC health check that the local EIP-712 domain config matches\n * what the deployed `PointToken` reports via `eip712Domain()`. If the\n * contract has bumped `version` from `\"1\"` to `\"2\"` (or any field\n * differs), every signature produced with the stale config will be\n * silently rejected on-chain (`ECDSA: invalid signature` — opaque to\n * the user).\n *\n * Recommended: call once at issuer-startup health check, not on every\n * mint. Throws `Eip712DomainMismatchError` describing the diverged\n * field.\n *\n * @example\n * ```ts\n * import { assertDomainMatchesContract, buildDomain } from \"@pafi-dev/core\";\n *\n * const expected = buildDomain({\n * name: \"PointToken\",\n * chainId: 8453,\n * verifyingContract: \"0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22\",\n * });\n *\n * await assertDomainMatchesContract(publicClient, expected);\n * // → throws Eip712DomainMismatchError if version on-chain has bumped\n * ```\n */\nexport async function assertDomainMatchesContract(\n client: PublicClient,\n expected: ReturnType<typeof buildDomain>,\n): Promise<void> {\n const onChain = (await client.readContract({\n address: expected.verifyingContract as Address,\n abi: pointTokenAbi,\n functionName: \"eip712Domain\",\n })) as readonly [\n `0x${string}`, // fields (bytes1)\n string, // name\n string, // version\n bigint, // chainId\n Address, // verifyingContract\n `0x${string}`, // salt\n readonly bigint[], // extensions\n ];\n\n const [, name, version, chainId, verifyingContract] = onChain;\n\n if (name !== expected.name) {\n throw new Eip712DomainMismatchError(\"name\", expected.name, name);\n }\n if (version !== expected.version) {\n throw new Eip712DomainMismatchError(\n \"version\",\n expected.version,\n version,\n );\n }\n if (chainId !== BigInt(expected.chainId)) {\n throw new Eip712DomainMismatchError(\n \"chainId\",\n String(expected.chainId),\n chainId.toString(),\n );\n }\n if (\n verifyingContract.toLowerCase() !==\n expected.verifyingContract.toLowerCase()\n ) {\n throw new Eip712DomainMismatchError(\n \"verifyingContract\",\n expected.verifyingContract,\n verifyingContract,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type {\n EIP712Signature,\n MintRequest,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a MintForRequest.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildMintRequestTypedData(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n };\n}\n\n/**\n * Sign a MintForRequest. Caller passes the full 5-field message:\n * - user = off-chain spender (drives nonce stream)\n * - receiver = on-chain caller (= msg.sender of `mint()`; wrapper or user)\n * - amount = PT amount\n * - nonce = pointToken.mintRequestNonces(user)\n * - deadline = unix seconds\n */\nexport async function signMintRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: MintRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a MintForRequest signature. Always recovers the signer and\n * compares against `expectedMinter`. Pass `options.currentTimeSec`\n * (unix seconds) to additionally enforce the request's `deadline` —\n * the on-chain contract enforces `block.timestamp <= deadline`, so\n * a stale-but-cryptographically-valid sig will only revert\n * on-submission unless the caller pre-flights here.\n *\n * Result shape:\n * - `{ isValid: true, recoveredAddress }` — sig matches and (if\n * deadline check requested) deadline has not elapsed.\n * - `{ isValid: false, recoveredAddress, reason: 'INVALID_SIGNER' }`\n * — sig does not recover to `expectedMinter`.\n * - `{ isValid: false, recoveredAddress, reason: 'DEADLINE_PASSED' }`\n * — sig is valid but `deadline < currentTimeSec`.\n *\n * Throws (synchronous Promise rejection):\n * - When `options.currentTimeSec` is provided but not a finite,\n * non-negative number. Misusing the API should fail loudly.\n */\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedMinter)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n","import type { Address, Hex } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\n/**\n * EIP-712 typed data for the sig-gated mint path.\n *\n * Contract enforces:\n * - msg.sender == receiver (the on-chain caller of `mint`)\n * - nonce == mintRequestNonces[user] (per-user nonce stream)\n *\n * `user` is the off-chain spender (whose nonce advances), `receiver` is\n * the on-chain mint recipient. For direct mints `user == receiver` (user\n * calls PointToken.mint themselves). For wrapper-mediated mints `user ==\n * end-user`, `receiver == wrapper address`.\n */\nexport const mintRequestTypes = {\n MintForRequest: [\n { name: \"user\", type: \"address\" },\n { name: \"receiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n// Sponsored mints are implemented at the relayer layer (sponsor-relayer\n// pays gas for the sig-gated `MintForRequest`); the deployed PointToken\n// contract has no separate `ReceiverConsent` path, no extra EIP-712 type,\n// and no separate on-chain nonce mapping.\n\n// -------------------------------------------------------------------------\n// Chain-indexed constants — add entries here as new chains are supported\n// -------------------------------------------------------------------------\n\nexport const SUPPORTED_CHAINS: Record<number, ChainConfig> = {\n 8453: { name: \"Base\" },\n};\n\n/**\n * Uniswap V3 QuoterV2 — used by `findBestQuote` / `quoteExactInput` etc.\n * QuoterV2 (vs V1) reverts cleanly inside multicall and returns a 4-tuple\n * `(amountOut, sqrtPriceX96AfterList, initializedTicksCrossedList, gasEstimate)`.\n */\nexport const QUOTER_V2_ADDRESSES: Record<number, Address> = {\n 8453: \"0xa0765363D9EA1347Afcff6Ae21D6D7B9d36490D0\",\n};\n\n/**\n * Uniswap UniversalRouter — used for AA/batched swaps via PT delegated\n * accounts. Speaks V3 commands (`V3_SWAP_EXACT_IN = 0x00`,\n * `V3_SWAP_EXACT_OUT = 0x01`).\n */\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x008887C992A5bDC24097E717Bfb71CE89483c5A2\",\n};\n\n/**\n * Uniswap V3 SwapRouter — used by `swapDirect`-style flows that bypass\n * the UniversalRouter. Takes `exactInput` / `exactOutput` with packed-bytes\n * paths directly.\n */\nexport const V3_SWAP_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0xca937aC69708b00B72cc3247440211d8DbDAaFF8\",\n};\n\n/**\n * PAFI's Uniswap V3 factory — used together with `V3_POOL_INIT_CODE_HASH`\n * to derive pool addresses deterministically (`computeV3PoolAddress`).\n */\nexport const V3_FACTORY_ADDRESSES: Record<number, Address> = {\n 8453: \"0x154bAFC6C311f3909080f28438294Cd5184c2924\",\n};\n\n/**\n * Pool-init code hash for PAFI's V3 deployment. Combined with the factory\n * address + sorted tokens + fee, deterministically yields a pool's\n * address via the standard Uniswap V3 CREATE2 derivation.\n */\nexport const V3_POOL_INIT_CODE_HASH: Hex =\n \"0x15380e4800aaa7f219c07d4e07d86cc0e3df225c6a518a1f14f8565f6d9c57c3\";\n\nexport const COMMON_TOKENS: Record<number, Record<string, Address>> = {\n // Base\n 8453: {\n WETH: \"0x4200000000000000000000000000000000000006\",\n USDC: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n USDT: \"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2\",\n },\n};\n\nexport const COMMON_POOLS: Record<number, PoolKey[]> = {\n // Base — Uniswap V3 pools (PAFI deployment)\n 8453: [\n // WETH/USDC 0.3%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n },\n // WETH/USDC 0.05%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n },\n ],\n};\n\nexport const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>> = {\n // chainId → pointTokenAddress → PoolKey[]\n};\n\n// -------------------------------------------------------------------------\n// Protocol constants — chain-agnostic (same address on every EVM chain)\n// -------------------------------------------------------------------------\n\n/** ERC-4337 v0.7 EntryPoint — deployed deterministically across all EVM chains. */\nexport const ENTRY_POINT_V07: Address = \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n\n/**\n * ERC-4337 v0.8 EntryPoint — used by Pimlico's `Simple7702Account` impl\n * (`0xe6Cae83BdE06E4c305530e199D7217f42808555B`) and by permissionless's\n * `to7702SimpleSmartAccount`. EIP-7702 delegated EOAs in PAFI's flow\n * point at this EntryPoint, NOT v0.7.\n *\n * Why this matters: account.validateUserOp does\n * `require(msg.sender == entryPoint(), \"account: not from EntryPoint\")`.\n * If the bundler/paymaster sim runs against a different EntryPoint than\n * what the account's `entryPoint()` returns, the require fails and you\n * see `AA23 reverted account: not from EntryPoint`.\n */\nexport const ENTRY_POINT_V08: Address = \"0x4337084d9e255ff0702461cf8895ce9e3b5ff108\";\n\n/** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */\nexport const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\n","/**\n * Shared input validator for `verifyMintRequest` /\n * `verifyBurnRequest`'s `options.currentTimeSec`. Centralised so both\n * helpers fail in the same way on bad input — a quiet skip on\n * `NaN` / negative values would defeat the purpose of opting into\n * deadline checking.\n *\n * No-op when `currentTimeSec` is undefined: the caller did not opt in\n * to deadline checking.\n */\nexport function assertValidCurrentTimeSec(\n currentTimeSec: number | undefined,\n): void {\n if (currentTimeSec === undefined) return;\n if (!Number.isFinite(currentTimeSec) || currentTimeSec < 0) {\n throw new Error(\n `verifyDeadline: currentTimeSec must be a finite non-negative number (got ${String(\n currentTimeSec,\n )})`,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { burnRequestTypes } from \"../constants\";\nimport type {\n BurnRequest,\n EIP712Signature,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\n/**\n * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn\n * path on `PointToken`:\n *\n * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n *\n * Solidity type hash:\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Issuer backend signs with its burner signer (HSM/KMS). On-chain\n * `msg.sender` must equal `from`, and the recovered signer must be in\n * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is\n * auto-incremented on success.\n */\nexport function buildBurnRequestTypedData(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\" as const,\n message,\n };\n}\n\nexport async function signBurnRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a BurnRequest signature. Symmetric with `verifyMintRequest`:\n * always recovers the signer; opt-in deadline check via\n * `options.currentTimeSec`. See that helper for the full contract.\n */\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedBurner)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n"],"mappings":";;;;;AAQO,SAAS,YAAY,QAAgC;AAC1D,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,SAAS,OAAO,WAAW;AAAA,IAC3B,SAAS,OAAO;AAAA,IAChB,mBAAmB,OAAO;AAAA,EAC5B;AACF;AAKO,IAAM,4BAAN,cAAwC,MAAM;AAAA,EACnD,YACkB,OACA,UACA,QAChB;AACA;AAAA,MACE,qCAAqC,KAAK,eAAe,QAAQ,SAAS,MAAM;AAAA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AG,OAAO,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAOA,eAAsB,kBACpB,QACA,SACA,WACA,gBACA,SACgC;AAChC,4BAA0B,SAAS,cAAc;AAEjD,QAAM,mBAAmB,MAAMC,yBAAwB;AAAA,IACrD,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAIC,YAAW,gBAAgB,MAAMA,YAAW,cAAc,GAAG;AAC/D,WAAO,EAAE,SAAS,OAAO,kBAAkB,QAAQ,iBAAiB;AAAA,EACtE;AAEA,MACE,SAAS,mBAAmB,UAC5B,QAAQ,WAAW,OAAO,QAAQ,cAAc,GAChD;AACA,WAAO,EAAE,SAAS,OAAO,kBAAkB,QAAQ,kBAAkB;AAAA,EACvE;AAEA,SAAO,EAAE,SAAS,MAAM,iBAAiB;AAC3C;","names":["getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress"]}
|
|
1
|
+
{"version":3,"sources":["../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/verifyDeadline.ts","../src/eip712/burnRequest.ts"],"sourcesContent":["import type { Address, PublicClient } from \"viem\";\nimport type { PointTokenDomainConfig } from \"../types\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\n/**\n * Build the EIP-712 domain struct from a PointToken config. Uses\n * `config.version` when supplied; defaults to `\"1\"` for back-compat.\n */\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: config.version ?? \"1\",\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n\n/**\n * Domain mismatch error thrown by `assertDomainMatchesContract`.\n */\nexport class Eip712DomainMismatchError extends Error {\n constructor(\n public readonly field: \"name\" | \"version\" | \"chainId\" | \"verifyingContract\",\n public readonly expected: string,\n public readonly actual: string,\n ) {\n super(\n `EIP-712 domain mismatch on field \"${field}\": expected ${expected}, got ${actual}. ` +\n `Local SDK config is out of sync with deployed PointToken — signatures will be rejected on-chain. ` +\n `Update SDK config or contract before producing more signatures.`,\n );\n this.name = \"Eip712DomainMismatchError\";\n }\n}\n\n/**\n * One-RPC health check that the local EIP-712 domain config matches\n * what the deployed `PointToken` reports via `eip712Domain()`. If the\n * contract has bumped `version` from `\"1\"` to `\"2\"` (or any field\n * differs), every signature produced with the stale config will be\n * silently rejected on-chain (`ECDSA: invalid signature` — opaque to\n * the user).\n *\n * Recommended: call once at issuer-startup health check, not on every\n * mint. Throws `Eip712DomainMismatchError` describing the diverged\n * field.\n *\n * @example\n * ```ts\n * import { assertDomainMatchesContract, buildDomain } from \"@pafi-dev/core\";\n *\n * const expected = buildDomain({\n * name: \"PointToken\",\n * chainId: 8453,\n * verifyingContract: \"0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22\",\n * });\n *\n * await assertDomainMatchesContract(publicClient, expected);\n * // → throws Eip712DomainMismatchError if version on-chain has bumped\n * ```\n */\nexport async function assertDomainMatchesContract(\n client: PublicClient,\n expected: ReturnType<typeof buildDomain>,\n): Promise<void> {\n const onChain = (await client.readContract({\n address: expected.verifyingContract as Address,\n abi: pointTokenAbi,\n functionName: \"eip712Domain\",\n })) as readonly [\n `0x${string}`, // fields (bytes1)\n string, // name\n string, // version\n bigint, // chainId\n Address, // verifyingContract\n `0x${string}`, // salt\n readonly bigint[], // extensions\n ];\n\n const [, name, version, chainId, verifyingContract] = onChain;\n\n if (name !== expected.name) {\n throw new Eip712DomainMismatchError(\"name\", expected.name, name);\n }\n if (version !== expected.version) {\n throw new Eip712DomainMismatchError(\n \"version\",\n expected.version,\n version,\n );\n }\n if (chainId !== BigInt(expected.chainId)) {\n throw new Eip712DomainMismatchError(\n \"chainId\",\n String(expected.chainId),\n chainId.toString(),\n );\n }\n if (\n verifyingContract.toLowerCase() !==\n expected.verifyingContract.toLowerCase()\n ) {\n throw new Eip712DomainMismatchError(\n \"verifyingContract\",\n expected.verifyingContract,\n verifyingContract,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type {\n EIP712Signature,\n MintRequest,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a MintForRequest.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildMintRequestTypedData(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n };\n}\n\n/**\n * Sign a MintForRequest. Caller passes the full 5-field message:\n * - user = off-chain spender (drives nonce stream)\n * - receiver = on-chain caller (= msg.sender of `mint()`; wrapper or user)\n * - amount = PT amount\n * - nonce = pointToken.mintRequestNonces(user)\n * - deadline = unix seconds\n */\nexport async function signMintRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: MintRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a MintForRequest signature. Always recovers the signer and\n * compares against `expectedMinter`. Pass `options.currentTimeSec`\n * (unix seconds) to additionally enforce the request's `deadline` —\n * the on-chain contract enforces `block.timestamp <= deadline`, so\n * a stale-but-cryptographically-valid sig will only revert\n * on-submission unless the caller pre-flights here.\n *\n * Result shape:\n * - `{ isValid: true, recoveredAddress }` — sig matches and (if\n * deadline check requested) deadline has not elapsed.\n * - `{ isValid: false, recoveredAddress, reason: 'INVALID_SIGNER' }`\n * — sig does not recover to `expectedMinter`.\n * - `{ isValid: false, recoveredAddress, reason: 'DEADLINE_PASSED' }`\n * — sig is valid but `deadline < currentTimeSec`.\n *\n * Throws (synchronous Promise rejection):\n * - When `options.currentTimeSec` is provided but not a finite,\n * non-negative number. Misusing the API should fail loudly.\n */\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedMinter)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n","import type { Address, Hex } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\n/**\n * EIP-712 typed data for the sig-gated mint path.\n *\n * Contract enforces:\n * - msg.sender == receiver (the on-chain caller of `mint`)\n * - nonce == mintRequestNonces[user] (per-user nonce stream)\n *\n * `user` is the off-chain spender (whose nonce advances), `receiver` is\n * the on-chain mint recipient. For direct mints `user == receiver` (user\n * calls PointToken.mint themselves). For wrapper-mediated mints `user ==\n * end-user`, `receiver == wrapper address`.\n */\nexport const mintRequestTypes = {\n MintForRequest: [\n { name: \"user\", type: \"address\" },\n { name: \"receiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n// Sponsored mints are implemented at the relayer layer (sponsor-relayer\n// pays gas for the sig-gated `MintForRequest`); the deployed PointToken\n// contract has no separate `ReceiverConsent` path, no extra EIP-712 type,\n// and no separate on-chain nonce mapping.\n\n// -------------------------------------------------------------------------\n// Chain-indexed constants — add entries here as new chains are supported\n// -------------------------------------------------------------------------\n\nexport const SUPPORTED_CHAINS: Record<number, ChainConfig> = {\n 8453: { name: \"Base\" },\n};\n\n/**\n * Uniswap V3 QuoterV2 — used by `findBestQuote` / `quoteExactInput` etc.\n * QuoterV2 (vs V1) reverts cleanly inside multicall and returns a 4-tuple\n * `(amountOut, sqrtPriceX96AfterList, initializedTicksCrossedList, gasEstimate)`.\n */\nexport const QUOTER_V2_ADDRESSES: Record<number, Address> = {\n 8453: \"0xa0765363D9EA1347Afcff6Ae21D6D7B9d36490D0\",\n};\n\n/**\n * Uniswap UniversalRouter — used for AA/batched swaps via PT delegated\n * accounts. Speaks V3 commands (`V3_SWAP_EXACT_IN = 0x00`,\n * `V3_SWAP_EXACT_OUT = 0x01`).\n */\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x008887C992A5bDC24097E717Bfb71CE89483c5A2\",\n};\n\n/**\n * Uniswap V3 SwapRouter — used by `swapDirect`-style flows that bypass\n * the UniversalRouter. Takes `exactInput` / `exactOutput` with packed-bytes\n * paths directly.\n */\nexport const V3_SWAP_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0xca937aC69708b00B72cc3247440211d8DbDAaFF8\",\n};\n\n/**\n * PAFI's Uniswap V3 factory — used together with `V3_POOL_INIT_CODE_HASH`\n * to derive pool addresses deterministically (`computeV3PoolAddress`).\n */\nexport const V3_FACTORY_ADDRESSES: Record<number, Address> = {\n 8453: \"0x154bAFC6C311f3909080f28438294Cd5184c2924\",\n};\n\n/**\n * Pool-init code hash for PAFI's V3 deployment. Combined with the factory\n * address + sorted tokens + fee, deterministically yields a pool's\n * address via the standard Uniswap V3 CREATE2 derivation.\n */\nexport const V3_POOL_INIT_CODE_HASH: Hex =\n \"0x15380e4800aaa7f219c07d4e07d86cc0e3df225c6a518a1f14f8565f6d9c57c3\";\n\nexport const COMMON_TOKENS: Record<number, Record<string, Address>> = {\n // Base\n 8453: {\n WETH: \"0x4200000000000000000000000000000000000006\",\n USDC: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n USDT: \"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2\",\n },\n};\n\nexport const COMMON_POOLS: Record<number, PoolKey[]> = {\n // Base — Uniswap V3 pools (PAFI deployment)\n 8453: [\n // WETH/USDC 0.3%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n },\n // WETH/USDC 0.05%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n },\n ],\n};\n\nexport const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>> = {\n // chainId → pointTokenAddress → PoolKey[]\n};\n\n// -------------------------------------------------------------------------\n// Protocol constants — chain-agnostic (same address on every EVM chain)\n// -------------------------------------------------------------------------\n\n/** ERC-4337 v0.7 EntryPoint — deployed deterministically across all EVM chains. */\nexport const ENTRY_POINT_V07: Address = \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n\n/**\n * ERC-4337 v0.8 EntryPoint — used by Pimlico's `Simple7702Account` impl\n * (`0xe6Cae83BdE06E4c305530e199D7217f42808555B`) and by permissionless's\n * `to7702SimpleSmartAccount`. EIP-7702 delegated EOAs in PAFI's flow\n * point at this EntryPoint, NOT v0.7.\n *\n * Why this matters: account.validateUserOp does\n * `require(msg.sender == entryPoint(), \"account: not from EntryPoint\")`.\n * If the bundler/paymaster sim runs against a different EntryPoint than\n * what the account's `entryPoint()` returns, the require fails and you\n * see `AA23 reverted account: not from EntryPoint`.\n */\nexport const ENTRY_POINT_V08: Address = \"0x4337084d9e255ff0702461cf8895ce9e3b5ff108\";\n\n/** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */\n// export const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\n/**\n * Permit2 — PAFI's deployed instance. PAFI ships its own forked deployment.\n */\nexport const PERMIT2_ADDRESS: Address = \"0xEB450d21ae68D3303Cf5775A54Cc84EE7c3fC8eC\";","/**\n * Shared input validator for `verifyMintRequest` /\n * `verifyBurnRequest`'s `options.currentTimeSec`. Centralised so both\n * helpers fail in the same way on bad input — a quiet skip on\n * `NaN` / negative values would defeat the purpose of opting into\n * deadline checking.\n *\n * No-op when `currentTimeSec` is undefined: the caller did not opt in\n * to deadline checking.\n */\nexport function assertValidCurrentTimeSec(\n currentTimeSec: number | undefined,\n): void {\n if (currentTimeSec === undefined) return;\n if (!Number.isFinite(currentTimeSec) || currentTimeSec < 0) {\n throw new Error(\n `verifyDeadline: currentTimeSec must be a finite non-negative number (got ${String(\n currentTimeSec,\n )})`,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { burnRequestTypes } from \"../constants\";\nimport type {\n BurnRequest,\n EIP712Signature,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\n/**\n * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn\n * path on `PointToken`:\n *\n * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n *\n * Solidity type hash:\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Issuer backend signs with its burner signer (HSM/KMS). On-chain\n * `msg.sender` must equal `from`, and the recovered signer must be in\n * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is\n * auto-incremented on success.\n */\nexport function buildBurnRequestTypedData(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\" as const,\n message,\n };\n}\n\nexport async function signBurnRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a BurnRequest signature. Symmetric with `verifyMintRequest`:\n * always recovers the signer; opt-in deadline check via\n * `options.currentTimeSec`. See that helper for the full contract.\n */\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedBurner)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n"],"mappings":";;;;;AAQO,SAAS,YAAY,QAAgC;AAC1D,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,SAAS,OAAO,WAAW;AAAA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D,SAAS,aAAa;AAAA,IACtB,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,EACF,CAAC;AAED,QAAM,EAAE,GAAG,GAAG,EAAE,IAAIC,gBAAe,UAAU;AAE7C,SAAO;AAAA,IACL,GAAG,OAAO,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAOA,eAAsB,kBACpB,QACA,SACA,WACA,gBACA,SACgC;AAChC,4BAA0B,SAAS,cAAc;AAEjD,QAAM,mBAAmB,MAAMC,yBAAwB;AAAA,IACrD,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAIC,YAAW,gBAAgB,MAAMA,YAAW,cAAc,GAAG;AAC/D,WAAO,EAAE,SAAS,OAAO,kBAAkB,QAAQ,iBAAiB;AAAA,EACtE;AAEA,MACE,SAAS,mBAAmB,UAC5B,QAAQ,WAAW,OAAO,QAAQ,cAAc,GAChD;AACA,WAAO,EAAE,SAAS,OAAO,kBAAkB,QAAQ,kBAAkB;AAAA,EACvE;AAEA,SAAO,EAAE,SAAS,MAAM,iBAAiB;AAC3C;","names":["getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress"]}
|
|
@@ -125,7 +125,7 @@ var POINT_TOKEN_POOLS = {
|
|
|
125
125
|
};
|
|
126
126
|
var ENTRY_POINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
127
127
|
var ENTRY_POINT_V08 = "0x4337084d9e255ff0702461cf8895ce9e3b5ff108";
|
|
128
|
-
var PERMIT2_ADDRESS = "
|
|
128
|
+
var PERMIT2_ADDRESS = "0xEB450d21ae68D3303Cf5775A54Cc84EE7c3fC8eC";
|
|
129
129
|
|
|
130
130
|
// src/eip712/verifyDeadline.ts
|
|
131
131
|
function assertValidCurrentTimeSec(currentTimeSec) {
|
|
@@ -252,4 +252,4 @@ async function verifyBurnRequest(domain, message, signature, expectedBurner, opt
|
|
|
252
252
|
|
|
253
253
|
|
|
254
254
|
exports.mintRequestTypes = mintRequestTypes; exports.burnRequestTypes = burnRequestTypes; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.QUOTER_V2_ADDRESSES = QUOTER_V2_ADDRESSES; exports.UNIVERSAL_ROUTER_ADDRESSES = UNIVERSAL_ROUTER_ADDRESSES; exports.V3_SWAP_ROUTER_ADDRESSES = V3_SWAP_ROUTER_ADDRESSES; exports.V3_FACTORY_ADDRESSES = V3_FACTORY_ADDRESSES; exports.V3_POOL_INIT_CODE_HASH = V3_POOL_INIT_CODE_HASH; exports.COMMON_TOKENS = COMMON_TOKENS; exports.COMMON_POOLS = COMMON_POOLS; exports.POINT_TOKEN_POOLS = POINT_TOKEN_POOLS; exports.ENTRY_POINT_V07 = ENTRY_POINT_V07; exports.ENTRY_POINT_V08 = ENTRY_POINT_V08; exports.PERMIT2_ADDRESS = PERMIT2_ADDRESS; exports.buildDomain = buildDomain; exports.Eip712DomainMismatchError = Eip712DomainMismatchError; exports.assertDomainMatchesContract = assertDomainMatchesContract; exports.buildMintRequestTypedData = buildMintRequestTypedData; exports.signMintRequest = signMintRequest; exports.verifyMintRequest = verifyMintRequest; exports.buildBurnRequestTypedData = buildBurnRequestTypedData; exports.signBurnRequest = signBurnRequest; exports.verifyBurnRequest = verifyBurnRequest;
|
|
255
|
-
//# sourceMappingURL=chunk-
|
|
255
|
+
//# sourceMappingURL=chunk-UZUDJXKE.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-NT2ZPF72.cjs","../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/verifyDeadline.ts","../src/eip712/burnRequest.ts"],"names":["parseSignature","recoverTypedDataAddress","getAddress"],"mappings":"AAAA;AACE;AACF,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afi-backend/pafi-sdk/packages/core/dist/chunk-NT2ZPF72.cjs","sourcesContent":[null,"import type { Address, PublicClient } from \"viem\";\nimport type { PointTokenDomainConfig } from \"../types\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\n/**\n * Build the EIP-712 domain struct from a PointToken config. Uses\n * `config.version` when supplied; defaults to `\"1\"` for back-compat.\n */\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: config.version ?? \"1\",\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n\n/**\n * Domain mismatch error thrown by `assertDomainMatchesContract`.\n */\nexport class Eip712DomainMismatchError extends Error {\n constructor(\n public readonly field: \"name\" | \"version\" | \"chainId\" | \"verifyingContract\",\n public readonly expected: string,\n public readonly actual: string,\n ) {\n super(\n `EIP-712 domain mismatch on field \"${field}\": expected ${expected}, got ${actual}. ` +\n `Local SDK config is out of sync with deployed PointToken — signatures will be rejected on-chain. ` +\n `Update SDK config or contract before producing more signatures.`,\n );\n this.name = \"Eip712DomainMismatchError\";\n }\n}\n\n/**\n * One-RPC health check that the local EIP-712 domain config matches\n * what the deployed `PointToken` reports via `eip712Domain()`. If the\n * contract has bumped `version` from `\"1\"` to `\"2\"` (or any field\n * differs), every signature produced with the stale config will be\n * silently rejected on-chain (`ECDSA: invalid signature` — opaque to\n * the user).\n *\n * Recommended: call once at issuer-startup health check, not on every\n * mint. Throws `Eip712DomainMismatchError` describing the diverged\n * field.\n *\n * @example\n * ```ts\n * import { assertDomainMatchesContract, buildDomain } from \"@pafi-dev/core\";\n *\n * const expected = buildDomain({\n * name: \"PointToken\",\n * chainId: 8453,\n * verifyingContract: \"0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22\",\n * });\n *\n * await assertDomainMatchesContract(publicClient, expected);\n * // → throws Eip712DomainMismatchError if version on-chain has bumped\n * ```\n */\nexport async function assertDomainMatchesContract(\n client: PublicClient,\n expected: ReturnType<typeof buildDomain>,\n): Promise<void> {\n const onChain = (await client.readContract({\n address: expected.verifyingContract as Address,\n abi: pointTokenAbi,\n functionName: \"eip712Domain\",\n })) as readonly [\n `0x${string}`, // fields (bytes1)\n string, // name\n string, // version\n bigint, // chainId\n Address, // verifyingContract\n `0x${string}`, // salt\n readonly bigint[], // extensions\n ];\n\n const [, name, version, chainId, verifyingContract] = onChain;\n\n if (name !== expected.name) {\n throw new Eip712DomainMismatchError(\"name\", expected.name, name);\n }\n if (version !== expected.version) {\n throw new Eip712DomainMismatchError(\n \"version\",\n expected.version,\n version,\n );\n }\n if (chainId !== BigInt(expected.chainId)) {\n throw new Eip712DomainMismatchError(\n \"chainId\",\n String(expected.chainId),\n chainId.toString(),\n );\n }\n if (\n verifyingContract.toLowerCase() !==\n expected.verifyingContract.toLowerCase()\n ) {\n throw new Eip712DomainMismatchError(\n \"verifyingContract\",\n expected.verifyingContract,\n verifyingContract,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type {\n EIP712Signature,\n MintRequest,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a MintForRequest.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildMintRequestTypedData(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n };\n}\n\n/**\n * Sign a MintForRequest. Caller passes the full 5-field message:\n * - user = off-chain spender (drives nonce stream)\n * - receiver = on-chain caller (= msg.sender of `mint()`; wrapper or user)\n * - amount = PT amount\n * - nonce = pointToken.mintRequestNonces(user)\n * - deadline = unix seconds\n */\nexport async function signMintRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: MintRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a MintForRequest signature. Always recovers the signer and\n * compares against `expectedMinter`. Pass `options.currentTimeSec`\n * (unix seconds) to additionally enforce the request's `deadline` —\n * the on-chain contract enforces `block.timestamp <= deadline`, so\n * a stale-but-cryptographically-valid sig will only revert\n * on-submission unless the caller pre-flights here.\n *\n * Result shape:\n * - `{ isValid: true, recoveredAddress }` — sig matches and (if\n * deadline check requested) deadline has not elapsed.\n * - `{ isValid: false, recoveredAddress, reason: 'INVALID_SIGNER' }`\n * — sig does not recover to `expectedMinter`.\n * - `{ isValid: false, recoveredAddress, reason: 'DEADLINE_PASSED' }`\n * — sig is valid but `deadline < currentTimeSec`.\n *\n * Throws (synchronous Promise rejection):\n * - When `options.currentTimeSec` is provided but not a finite,\n * non-negative number. Misusing the API should fail loudly.\n */\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedMinter)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n","import type { Address, Hex } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\n/**\n * EIP-712 typed data for the sig-gated mint path.\n *\n * Contract enforces:\n * - msg.sender == receiver (the on-chain caller of `mint`)\n * - nonce == mintRequestNonces[user] (per-user nonce stream)\n *\n * `user` is the off-chain spender (whose nonce advances), `receiver` is\n * the on-chain mint recipient. For direct mints `user == receiver` (user\n * calls PointToken.mint themselves). For wrapper-mediated mints `user ==\n * end-user`, `receiver == wrapper address`.\n */\nexport const mintRequestTypes = {\n MintForRequest: [\n { name: \"user\", type: \"address\" },\n { name: \"receiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n// Sponsored mints are implemented at the relayer layer (sponsor-relayer\n// pays gas for the sig-gated `MintForRequest`); the deployed PointToken\n// contract has no separate `ReceiverConsent` path, no extra EIP-712 type,\n// and no separate on-chain nonce mapping.\n\n// -------------------------------------------------------------------------\n// Chain-indexed constants — add entries here as new chains are supported\n// -------------------------------------------------------------------------\n\nexport const SUPPORTED_CHAINS: Record<number, ChainConfig> = {\n 8453: { name: \"Base\" },\n};\n\n/**\n * Uniswap V3 QuoterV2 — used by `findBestQuote` / `quoteExactInput` etc.\n * QuoterV2 (vs V1) reverts cleanly inside multicall and returns a 4-tuple\n * `(amountOut, sqrtPriceX96AfterList, initializedTicksCrossedList, gasEstimate)`.\n */\nexport const QUOTER_V2_ADDRESSES: Record<number, Address> = {\n 8453: \"0xa0765363D9EA1347Afcff6Ae21D6D7B9d36490D0\",\n};\n\n/**\n * Uniswap UniversalRouter — used for AA/batched swaps via PT delegated\n * accounts. Speaks V3 commands (`V3_SWAP_EXACT_IN = 0x00`,\n * `V3_SWAP_EXACT_OUT = 0x01`).\n */\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x008887C992A5bDC24097E717Bfb71CE89483c5A2\",\n};\n\n/**\n * Uniswap V3 SwapRouter — used by `swapDirect`-style flows that bypass\n * the UniversalRouter. Takes `exactInput` / `exactOutput` with packed-bytes\n * paths directly.\n */\nexport const V3_SWAP_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0xca937aC69708b00B72cc3247440211d8DbDAaFF8\",\n};\n\n/**\n * PAFI's Uniswap V3 factory — used together with `V3_POOL_INIT_CODE_HASH`\n * to derive pool addresses deterministically (`computeV3PoolAddress`).\n */\nexport const V3_FACTORY_ADDRESSES: Record<number, Address> = {\n 8453: \"0x154bAFC6C311f3909080f28438294Cd5184c2924\",\n};\n\n/**\n * Pool-init code hash for PAFI's V3 deployment. Combined with the factory\n * address + sorted tokens + fee, deterministically yields a pool's\n * address via the standard Uniswap V3 CREATE2 derivation.\n */\nexport const V3_POOL_INIT_CODE_HASH: Hex =\n \"0x15380e4800aaa7f219c07d4e07d86cc0e3df225c6a518a1f14f8565f6d9c57c3\";\n\nexport const COMMON_TOKENS: Record<number, Record<string, Address>> = {\n // Base\n 8453: {\n WETH: \"0x4200000000000000000000000000000000000006\",\n USDC: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n USDT: \"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2\",\n },\n};\n\nexport const COMMON_POOLS: Record<number, PoolKey[]> = {\n // Base — Uniswap V3 pools (PAFI deployment)\n 8453: [\n // WETH/USDC 0.3%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n },\n // WETH/USDC 0.05%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n },\n ],\n};\n\nexport const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>> = {\n // chainId → pointTokenAddress → PoolKey[]\n};\n\n// -------------------------------------------------------------------------\n// Protocol constants — chain-agnostic (same address on every EVM chain)\n// -------------------------------------------------------------------------\n\n/** ERC-4337 v0.7 EntryPoint — deployed deterministically across all EVM chains. */\nexport const ENTRY_POINT_V07: Address = \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n\n/**\n * ERC-4337 v0.8 EntryPoint — used by Pimlico's `Simple7702Account` impl\n * (`0xe6Cae83BdE06E4c305530e199D7217f42808555B`) and by permissionless's\n * `to7702SimpleSmartAccount`. EIP-7702 delegated EOAs in PAFI's flow\n * point at this EntryPoint, NOT v0.7.\n *\n * Why this matters: account.validateUserOp does\n * `require(msg.sender == entryPoint(), \"account: not from EntryPoint\")`.\n * If the bundler/paymaster sim runs against a different EntryPoint than\n * what the account's `entryPoint()` returns, the require fails and you\n * see `AA23 reverted account: not from EntryPoint`.\n */\nexport const ENTRY_POINT_V08: Address = \"0x4337084d9e255ff0702461cf8895ce9e3b5ff108\";\n\n/** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */\nexport const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\n","/**\n * Shared input validator for `verifyMintRequest` /\n * `verifyBurnRequest`'s `options.currentTimeSec`. Centralised so both\n * helpers fail in the same way on bad input — a quiet skip on\n * `NaN` / negative values would defeat the purpose of opting into\n * deadline checking.\n *\n * No-op when `currentTimeSec` is undefined: the caller did not opt in\n * to deadline checking.\n */\nexport function assertValidCurrentTimeSec(\n currentTimeSec: number | undefined,\n): void {\n if (currentTimeSec === undefined) return;\n if (!Number.isFinite(currentTimeSec) || currentTimeSec < 0) {\n throw new Error(\n `verifyDeadline: currentTimeSec must be a finite non-negative number (got ${String(\n currentTimeSec,\n )})`,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { burnRequestTypes } from \"../constants\";\nimport type {\n BurnRequest,\n EIP712Signature,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\n/**\n * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn\n * path on `PointToken`:\n *\n * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n *\n * Solidity type hash:\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Issuer backend signs with its burner signer (HSM/KMS). On-chain\n * `msg.sender` must equal `from`, and the recovered signer must be in\n * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is\n * auto-incremented on success.\n */\nexport function buildBurnRequestTypedData(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\" as const,\n message,\n };\n}\n\nexport async function signBurnRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a BurnRequest signature. Symmetric with `verifyMintRequest`:\n * always recovers the signer; opt-in deadline check via\n * `options.currentTimeSec`. See that helper for the full contract.\n */\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedBurner)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-UZUDJXKE.cjs","../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/verifyDeadline.ts","../src/eip712/burnRequest.ts"],"names":["parseSignature","recoverTypedDataAddress","getAddress"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACIO,SAAS,WAAA,CAAY,MAAA,EAAgC;AAC1D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA,CAAO,IAAA;AAAA,IACb,OAAA,mBAAS,MAAA,CAAO,OAAA,UAAW,KAAA;AAAA,IAC3B,OAAA,EAAS,MAAA,CAAO,OAAA;AAAA,IAChB,iBAAA,EAAmB,MAAA,CAAO;AAAA,EAC5B,CAAA;AACF;AAKO,IAAM,0BAAA,EAAN,MAAA,QAAwC,MAAM;AAAA,EACnD,WAAA,CACkB,KAAA,EACA,QAAA,EACA,MAAA,EAChB;AACA,IAAA,KAAA;AAAA,MACE,CAAA,kCAAA,EAAqC,KAAK,CAAA,YAAA,EAAe,QAAQ,CAAA,MAAA,EAAS,MAAM,CAAA,uKAAA;AAAA,IAGlF,CAAA;AARgB,IAAA,IAAA,CAAA,MAAA,EAAA,KAAA;AACA,IAAA,IAAA,CAAA,SAAA,EAAA,QAAA;AACA,IAAA,IAAA,CAAA,OAAA,EAAA,MAAA;AAOhB,IAAA,IAAA,CAAK,KAAA,EAAO,2BAAA;AAAA,EACd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KAAA,EAAO,gBAAA,EAAkB,MAAA,EAAQ,iBAAiB,CAAA;AAAA,EACtE;AAEA,EAAA,GAAA,iBACE,OAAA,6BAAS,iBAAA,IAAmB,KAAA,EAAA,GAC5B,OAAA,CAAQ,SAAA,EAAW,MAAA,CAAO,OAAA,CAAQ,cAAc,CAAA,EAChD;AACA,IAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,gBAAA,EAAkB,MAAA,EAAQ,kBAAkB,CAAA;AAAA,EACvE;AAEA,EAAA,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,iBAAiB,CAAA;AAC3C;ALoIA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wnCAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-UZUDJXKE.cjs","sourcesContent":[null,"import type { Address, PublicClient } from \"viem\";\nimport type { PointTokenDomainConfig } from \"../types\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\n/**\n * Build the EIP-712 domain struct from a PointToken config. Uses\n * `config.version` when supplied; defaults to `\"1\"` for back-compat.\n */\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: config.version ?? \"1\",\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n\n/**\n * Domain mismatch error thrown by `assertDomainMatchesContract`.\n */\nexport class Eip712DomainMismatchError extends Error {\n constructor(\n public readonly field: \"name\" | \"version\" | \"chainId\" | \"verifyingContract\",\n public readonly expected: string,\n public readonly actual: string,\n ) {\n super(\n `EIP-712 domain mismatch on field \"${field}\": expected ${expected}, got ${actual}. ` +\n `Local SDK config is out of sync with deployed PointToken — signatures will be rejected on-chain. ` +\n `Update SDK config or contract before producing more signatures.`,\n );\n this.name = \"Eip712DomainMismatchError\";\n }\n}\n\n/**\n * One-RPC health check that the local EIP-712 domain config matches\n * what the deployed `PointToken` reports via `eip712Domain()`. If the\n * contract has bumped `version` from `\"1\"` to `\"2\"` (or any field\n * differs), every signature produced with the stale config will be\n * silently rejected on-chain (`ECDSA: invalid signature` — opaque to\n * the user).\n *\n * Recommended: call once at issuer-startup health check, not on every\n * mint. Throws `Eip712DomainMismatchError` describing the diverged\n * field.\n *\n * @example\n * ```ts\n * import { assertDomainMatchesContract, buildDomain } from \"@pafi-dev/core\";\n *\n * const expected = buildDomain({\n * name: \"PointToken\",\n * chainId: 8453,\n * verifyingContract: \"0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22\",\n * });\n *\n * await assertDomainMatchesContract(publicClient, expected);\n * // → throws Eip712DomainMismatchError if version on-chain has bumped\n * ```\n */\nexport async function assertDomainMatchesContract(\n client: PublicClient,\n expected: ReturnType<typeof buildDomain>,\n): Promise<void> {\n const onChain = (await client.readContract({\n address: expected.verifyingContract as Address,\n abi: pointTokenAbi,\n functionName: \"eip712Domain\",\n })) as readonly [\n `0x${string}`, // fields (bytes1)\n string, // name\n string, // version\n bigint, // chainId\n Address, // verifyingContract\n `0x${string}`, // salt\n readonly bigint[], // extensions\n ];\n\n const [, name, version, chainId, verifyingContract] = onChain;\n\n if (name !== expected.name) {\n throw new Eip712DomainMismatchError(\"name\", expected.name, name);\n }\n if (version !== expected.version) {\n throw new Eip712DomainMismatchError(\n \"version\",\n expected.version,\n version,\n );\n }\n if (chainId !== BigInt(expected.chainId)) {\n throw new Eip712DomainMismatchError(\n \"chainId\",\n String(expected.chainId),\n chainId.toString(),\n );\n }\n if (\n verifyingContract.toLowerCase() !==\n expected.verifyingContract.toLowerCase()\n ) {\n throw new Eip712DomainMismatchError(\n \"verifyingContract\",\n expected.verifyingContract,\n verifyingContract,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type {\n EIP712Signature,\n MintRequest,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a MintForRequest.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildMintRequestTypedData(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n };\n}\n\n/**\n * Sign a MintForRequest. Caller passes the full 5-field message:\n * - user = off-chain spender (drives nonce stream)\n * - receiver = on-chain caller (= msg.sender of `mint()`; wrapper or user)\n * - amount = PT amount\n * - nonce = pointToken.mintRequestNonces(user)\n * - deadline = unix seconds\n */\nexport async function signMintRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: MintRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a MintForRequest signature. Always recovers the signer and\n * compares against `expectedMinter`. Pass `options.currentTimeSec`\n * (unix seconds) to additionally enforce the request's `deadline` —\n * the on-chain contract enforces `block.timestamp <= deadline`, so\n * a stale-but-cryptographically-valid sig will only revert\n * on-submission unless the caller pre-flights here.\n *\n * Result shape:\n * - `{ isValid: true, recoveredAddress }` — sig matches and (if\n * deadline check requested) deadline has not elapsed.\n * - `{ isValid: false, recoveredAddress, reason: 'INVALID_SIGNER' }`\n * — sig does not recover to `expectedMinter`.\n * - `{ isValid: false, recoveredAddress, reason: 'DEADLINE_PASSED' }`\n * — sig is valid but `deadline < currentTimeSec`.\n *\n * Throws (synchronous Promise rejection):\n * - When `options.currentTimeSec` is provided but not a finite,\n * non-negative number. Misusing the API should fail loudly.\n */\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedMinter)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n","import type { Address, Hex } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\n/**\n * EIP-712 typed data for the sig-gated mint path.\n *\n * Contract enforces:\n * - msg.sender == receiver (the on-chain caller of `mint`)\n * - nonce == mintRequestNonces[user] (per-user nonce stream)\n *\n * `user` is the off-chain spender (whose nonce advances), `receiver` is\n * the on-chain mint recipient. For direct mints `user == receiver` (user\n * calls PointToken.mint themselves). For wrapper-mediated mints `user ==\n * end-user`, `receiver == wrapper address`.\n */\nexport const mintRequestTypes = {\n MintForRequest: [\n { name: \"user\", type: \"address\" },\n { name: \"receiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n// Sponsored mints are implemented at the relayer layer (sponsor-relayer\n// pays gas for the sig-gated `MintForRequest`); the deployed PointToken\n// contract has no separate `ReceiverConsent` path, no extra EIP-712 type,\n// and no separate on-chain nonce mapping.\n\n// -------------------------------------------------------------------------\n// Chain-indexed constants — add entries here as new chains are supported\n// -------------------------------------------------------------------------\n\nexport const SUPPORTED_CHAINS: Record<number, ChainConfig> = {\n 8453: { name: \"Base\" },\n};\n\n/**\n * Uniswap V3 QuoterV2 — used by `findBestQuote` / `quoteExactInput` etc.\n * QuoterV2 (vs V1) reverts cleanly inside multicall and returns a 4-tuple\n * `(amountOut, sqrtPriceX96AfterList, initializedTicksCrossedList, gasEstimate)`.\n */\nexport const QUOTER_V2_ADDRESSES: Record<number, Address> = {\n 8453: \"0xa0765363D9EA1347Afcff6Ae21D6D7B9d36490D0\",\n};\n\n/**\n * Uniswap UniversalRouter — used for AA/batched swaps via PT delegated\n * accounts. Speaks V3 commands (`V3_SWAP_EXACT_IN = 0x00`,\n * `V3_SWAP_EXACT_OUT = 0x01`).\n */\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x008887C992A5bDC24097E717Bfb71CE89483c5A2\",\n};\n\n/**\n * Uniswap V3 SwapRouter — used by `swapDirect`-style flows that bypass\n * the UniversalRouter. Takes `exactInput` / `exactOutput` with packed-bytes\n * paths directly.\n */\nexport const V3_SWAP_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0xca937aC69708b00B72cc3247440211d8DbDAaFF8\",\n};\n\n/**\n * PAFI's Uniswap V3 factory — used together with `V3_POOL_INIT_CODE_HASH`\n * to derive pool addresses deterministically (`computeV3PoolAddress`).\n */\nexport const V3_FACTORY_ADDRESSES: Record<number, Address> = {\n 8453: \"0x154bAFC6C311f3909080f28438294Cd5184c2924\",\n};\n\n/**\n * Pool-init code hash for PAFI's V3 deployment. Combined with the factory\n * address + sorted tokens + fee, deterministically yields a pool's\n * address via the standard Uniswap V3 CREATE2 derivation.\n */\nexport const V3_POOL_INIT_CODE_HASH: Hex =\n \"0x15380e4800aaa7f219c07d4e07d86cc0e3df225c6a518a1f14f8565f6d9c57c3\";\n\nexport const COMMON_TOKENS: Record<number, Record<string, Address>> = {\n // Base\n 8453: {\n WETH: \"0x4200000000000000000000000000000000000006\",\n USDC: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n USDT: \"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2\",\n },\n};\n\nexport const COMMON_POOLS: Record<number, PoolKey[]> = {\n // Base — Uniswap V3 pools (PAFI deployment)\n 8453: [\n // WETH/USDC 0.3%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n },\n // WETH/USDC 0.05%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n },\n ],\n};\n\nexport const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>> = {\n // chainId → pointTokenAddress → PoolKey[]\n};\n\n// -------------------------------------------------------------------------\n// Protocol constants — chain-agnostic (same address on every EVM chain)\n// -------------------------------------------------------------------------\n\n/** ERC-4337 v0.7 EntryPoint — deployed deterministically across all EVM chains. */\nexport const ENTRY_POINT_V07: Address = \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n\n/**\n * ERC-4337 v0.8 EntryPoint — used by Pimlico's `Simple7702Account` impl\n * (`0xe6Cae83BdE06E4c305530e199D7217f42808555B`) and by permissionless's\n * `to7702SimpleSmartAccount`. EIP-7702 delegated EOAs in PAFI's flow\n * point at this EntryPoint, NOT v0.7.\n *\n * Why this matters: account.validateUserOp does\n * `require(msg.sender == entryPoint(), \"account: not from EntryPoint\")`.\n * If the bundler/paymaster sim runs against a different EntryPoint than\n * what the account's `entryPoint()` returns, the require fails and you\n * see `AA23 reverted account: not from EntryPoint`.\n */\nexport const ENTRY_POINT_V08: Address = \"0x4337084d9e255ff0702461cf8895ce9e3b5ff108\";\n\n/** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */\n// export const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\n/**\n * Permit2 — PAFI's deployed instance. PAFI ships its own forked deployment.\n */\nexport const PERMIT2_ADDRESS: Address = \"0xEB450d21ae68D3303Cf5775A54Cc84EE7c3fC8eC\";","/**\n * Shared input validator for `verifyMintRequest` /\n * `verifyBurnRequest`'s `options.currentTimeSec`. Centralised so both\n * helpers fail in the same way on bad input — a quiet skip on\n * `NaN` / negative values would defeat the purpose of opting into\n * deadline checking.\n *\n * No-op when `currentTimeSec` is undefined: the caller did not opt in\n * to deadline checking.\n */\nexport function assertValidCurrentTimeSec(\n currentTimeSec: number | undefined,\n): void {\n if (currentTimeSec === undefined) return;\n if (!Number.isFinite(currentTimeSec) || currentTimeSec < 0) {\n throw new Error(\n `verifyDeadline: currentTimeSec must be a finite non-negative number (got ${String(\n currentTimeSec,\n )})`,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { burnRequestTypes } from \"../constants\";\nimport type {\n BurnRequest,\n EIP712Signature,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\n/**\n * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn\n * path on `PointToken`:\n *\n * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n *\n * Solidity type hash:\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Issuer backend signs with its burner signer (HSM/KMS). On-chain\n * `msg.sender` must equal `from`, and the recovered signer must be in\n * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is\n * auto-incremented on success.\n */\nexport function buildBurnRequestTypedData(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\" as const,\n message,\n };\n}\n\nexport async function signBurnRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a BurnRequest signature. Symmetric with `verifyMintRequest`:\n * always recovers the signer; opt-in deadline check via\n * `options.currentTimeSec`. See that helper for the full contract.\n */\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedBurner)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n"]}
|
package/dist/eip712/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkUZUDJXKEcjs = require('../chunk-UZUDJXKE.cjs');
|
|
12
12
|
require('../chunk-KRHGFUDI.cjs');
|
|
13
13
|
require('../chunk-JEQ2X3Z6.cjs');
|
|
14
14
|
|
|
@@ -21,5 +21,5 @@ require('../chunk-JEQ2X3Z6.cjs');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.Eip712DomainMismatchError =
|
|
24
|
+
exports.Eip712DomainMismatchError = _chunkUZUDJXKEcjs.Eip712DomainMismatchError; exports.assertDomainMatchesContract = _chunkUZUDJXKEcjs.assertDomainMatchesContract; exports.buildBurnRequestTypedData = _chunkUZUDJXKEcjs.buildBurnRequestTypedData; exports.buildDomain = _chunkUZUDJXKEcjs.buildDomain; exports.buildMintRequestTypedData = _chunkUZUDJXKEcjs.buildMintRequestTypedData; exports.signBurnRequest = _chunkUZUDJXKEcjs.signBurnRequest; exports.signMintRequest = _chunkUZUDJXKEcjs.signMintRequest; exports.verifyBurnRequest = _chunkUZUDJXKEcjs.verifyBurnRequest; exports.verifyMintRequest = _chunkUZUDJXKEcjs.verifyMintRequest;
|
|
25
25
|
//# sourceMappingURL=index.cjs.map
|
package/dist/eip712/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -66,7 +66,7 @@ var _chunkC7VB6WTLcjs = require('./chunk-C7VB6WTL.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var
|
|
69
|
+
var _chunkUZUDJXKEcjs = require('./chunk-UZUDJXKE.cjs');
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
var _chunkKRHGFUDIcjs = require('./chunk-KRHGFUDI.cjs');
|
|
@@ -589,7 +589,7 @@ function buildUserOpTypedData(userOp, chainId) {
|
|
|
589
589
|
name: "ERC4337",
|
|
590
590
|
version: "1",
|
|
591
591
|
chainId,
|
|
592
|
-
verifyingContract:
|
|
592
|
+
verifyingContract: _chunkUZUDJXKEcjs.ENTRY_POINT_V08
|
|
593
593
|
},
|
|
594
594
|
types: PACKED_USER_OPERATION_TYPES,
|
|
595
595
|
primaryType: "PackedUserOperation",
|
|
@@ -762,7 +762,7 @@ async function getAaNonce(client, userAddress) {
|
|
|
762
762
|
}
|
|
763
763
|
];
|
|
764
764
|
return client.readContract({
|
|
765
|
-
address:
|
|
765
|
+
address: _chunkUZUDJXKEcjs.ENTRY_POINT_V08,
|
|
766
766
|
abi: NONCE_ABI,
|
|
767
767
|
functionName: "getNonce",
|
|
768
768
|
args: [userAddress, 0n]
|
|
@@ -828,6 +828,7 @@ var CONTRACT_ADDRESSES = {
|
|
|
828
828
|
8453: {
|
|
829
829
|
batchExecutor: "0xe6Cae83BdE06E4c305530e199D7217f42808555B",
|
|
830
830
|
usdt: "0x3F7e71B150e97316Bb9f363A32c19CcD36ac2382",
|
|
831
|
+
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
831
832
|
issuerRegistry: "0xAB1d1e117c41636f30bb10194Fe6B774B6Da9E01",
|
|
832
833
|
mintingOracle: "0x2f4cf8C5F8b41efC970c5b46a5d905CeA1f871a0",
|
|
833
834
|
mintFeeWrapper: "0xD324EE2e3220B23d1b1BfbB85f5bC1EF2E917B93",
|
|
@@ -1505,15 +1506,15 @@ var PafiSDK = class {
|
|
|
1505
1506
|
// -------------------------------------------------------------------------
|
|
1506
1507
|
async buildMintRequestTypedData(message) {
|
|
1507
1508
|
const domain = await this.getDomain();
|
|
1508
|
-
return
|
|
1509
|
+
return _chunkUZUDJXKEcjs.buildMintRequestTypedData.call(void 0, domain, message);
|
|
1509
1510
|
}
|
|
1510
1511
|
async signMintRequest(message) {
|
|
1511
1512
|
const domain = await this.getDomain();
|
|
1512
|
-
return
|
|
1513
|
+
return _chunkUZUDJXKEcjs.signMintRequest.call(void 0, this.requireSigner(), domain, message);
|
|
1513
1514
|
}
|
|
1514
1515
|
async verifyMintRequest(message, signature, expectedMinter, options) {
|
|
1515
1516
|
const domain = await this.getDomain();
|
|
1516
|
-
return
|
|
1517
|
+
return _chunkUZUDJXKEcjs.verifyMintRequest.call(void 0,
|
|
1517
1518
|
domain,
|
|
1518
1519
|
message,
|
|
1519
1520
|
signature,
|
|
@@ -1686,6 +1687,5 @@ var PafiSDK = class {
|
|
|
1686
1687
|
|
|
1687
1688
|
|
|
1688
1689
|
|
|
1689
|
-
|
|
1690
|
-
exports.ApiError = ApiError; exports.BATCH_EXECUTOR_7702_IMPL = BATCH_EXECUTOR_7702_IMPL; exports.BATCH_EXECUTOR_ABI = 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 = _chunkNT2ZPF72cjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunkNT2ZPF72cjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = ConfigurationError; exports.DUMMY_SIGNATURE_V07 = DUMMY_SIGNATURE_V07; exports.ENTRY_POINT_V07 = _chunkNT2ZPF72cjs.ENTRY_POINT_V07; exports.ENTRY_POINT_V08 = _chunkNT2ZPF72cjs.ENTRY_POINT_V08; exports.Eip712DomainMismatchError = _chunkNT2ZPF72cjs.Eip712DomainMismatchError; exports.ORDERLY_RELAY_ABI = ORDERLY_RELAY_ABI; exports.ORDERLY_VAULT_ABI = ORDERLY_VAULT_ABI; exports.ORDERLY_VAULT_ADDRESSES = ORDERLY_VAULT_ADDRESSES; exports.ORDERLY_VAULT_BASE_MAINNET = ORDERLY_VAULT_BASE_MAINNET; exports.OracleStaleError = OracleStaleError; exports.PAFI_SERVICE_URLS = PAFI_SERVICE_URLS; exports.PAFI_SUBGRAPH_URL = PAFI_SUBGRAPH_URL; exports.PERMIT2_ADDRESS = _chunkNT2ZPF72cjs.PERMIT2_ADDRESS; exports.POINT_TOKEN_ABI = _chunkKRHGFUDIcjs.pointTokenAbi; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_POOLS = _chunkNT2ZPF72cjs.POINT_TOKEN_POOLS; exports.POINT_TOKEN_V2_ABI = _chunkKRHGFUDIcjs.pointTokenAbi; exports.PafiSDK = PafiSDK; exports.PafiSdkError = PafiSdkError; exports.QUOTER_V2_ADDRESSES = _chunkNT2ZPF72cjs.QUOTER_V2_ADDRESSES; exports.SDK_ERROR_HTTP_STATUS_CODE = SDK_ERROR_HTTP_STATUS_CODE; exports.SIMPLE_7702_IMPL_BASE_MAINNET = SIMPLE_7702_IMPL_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET = _chunk75JWR5SAcjs.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_NAME = _chunk75JWR5SAcjs.SPONSOR_AUTH_DOMAIN_NAME; exports.SPONSOR_AUTH_TYPES = _chunk75JWR5SAcjs.SPONSOR_AUTH_TYPES; exports.SUPPORTED_CHAINS = _chunkNT2ZPF72cjs.SUPPORTED_CHAINS; exports.SigningError = SigningError; exports.SimulationError = SimulationError; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunkNT2ZPF72cjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V3_FACTORY_ADDRESSES = _chunkNT2ZPF72cjs.V3_FACTORY_ADDRESSES; exports.V3_POOL_INIT_CODE_HASH = _chunkNT2ZPF72cjs.V3_POOL_INIT_CODE_HASH; exports.V3_SWAP_ROUTER_ADDRESSES = _chunkNT2ZPF72cjs.V3_SWAP_ROUTER_ADDRESSES; exports.ValidationError = ValidationError; exports.ZERO_VALUE = ZERO_VALUE; exports.assembleUserOperation = assembleUserOperation; exports.assertDomainMatchesContract = _chunkNT2ZPF72cjs.assertDomainMatchesContract; exports.buildAndSignSponsorAuth = _chunk75JWR5SAcjs.buildAndSignSponsorAuth; exports.buildBurnRequestTypedData = _chunkNT2ZPF72cjs.buildBurnRequestTypedData; exports.buildDelegationUserOp = buildDelegationUserOp; exports.buildDomain = _chunkNT2ZPF72cjs.buildDomain; exports.buildEip7702Authorization = buildEip7702Authorization; exports.buildMintRequestTypedData = _chunkNT2ZPF72cjs.buildMintRequestTypedData; exports.buildPartialUserOperation = buildPartialUserOperation; exports.buildPerpDepositViaRelay = buildPerpDepositViaRelay; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildSponsorAuthDomain = _chunk75JWR5SAcjs.buildSponsorAuthDomain; exports.buildSponsorAuthTypedData = _chunk75JWR5SAcjs.buildSponsorAuthTypedData; exports.buildUserOpTypedData = buildUserOpTypedData; exports.burnRequestTypes = _chunkNT2ZPF72cjs.burnRequestTypes; exports.checkDelegation = checkDelegation; exports.checkEthAndBranch = checkEthAndBranch; exports.computeAccountId = computeAccountId; exports.computeAuthorizationHash = computeAuthorizationHash; exports.computeCallDataHash = _chunk75JWR5SAcjs.computeCallDataHash; exports.computeUserOpHash = computeUserOpHash; exports.computeV3PoolAddress = computeV3PoolAddress; exports.createLoginMessage = _chunk75JWR5SAcjs.createLoginMessage; exports.createPafiProxyTransport = createPafiProxyTransport; exports.decodeBatchExecuteCalls = decodeBatchExecuteCalls; exports.defaultErrorTypeForStatus = defaultErrorTypeForStatus; exports.delegateDirect = delegateDirect; exports.detectDelegateImpl = detectDelegateImpl; exports.encodeBatchExecute = encodeBatchExecute; exports.encodeV3Path = encodeV3Path; exports.encodeV3PathReversed = encodeV3PathReversed; exports.erc20Abi = _chunkXXLIIWIFcjs.erc20Abi; exports.erc20ApproveOp = erc20ApproveOp; exports.erc20BurnOp = erc20BurnOp; exports.erc20TransferOp = erc20TransferOp; exports.fetchPafiPools = fetchPafiPools; exports.generateSponsorAuthNonce = _chunk75JWR5SAcjs.generateSponsorAuthNonce; exports.getAaNonce = getAaNonce; exports.getBurnRequestNonce = _chunkTRYGIC2Icjs.getBurnRequestNonce; exports.getContractAddresses = getContractAddresses; exports.getDummySignatureFor7702 = getDummySignatureFor7702; exports.getIssuer = _chunkTRYGIC2Icjs.getIssuer2; exports.getMintFeeBps = _chunkTRYGIC2Icjs.getMintFeeBps; exports.getMintFeeRecipients = _chunkTRYGIC2Icjs.getMintFeeRecipients; exports.getMintRequestNonce = _chunkTRYGIC2Icjs.getMintRequestNonce; exports.getPafiServiceUrls = getPafiServiceUrls; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPointTokenBalance = _chunkTRYGIC2Icjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkTRYGIC2Icjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkTRYGIC2Icjs.getIssuer; exports.getSponsorAuthDomainAnchor = _chunk75JWR5SAcjs.getSponsorAuthDomainAnchor; exports.getTokenCap = _chunkTRYGIC2Icjs.getTokenCap; exports.getTokenName = _chunkTRYGIC2Icjs.getTokenName; exports.isActiveIssuer = _chunkTRYGIC2Icjs.isActiveIssuer; exports.isDelegatedTo = isDelegatedTo; exports.isDelegatedToTarget = isDelegatedToTarget; exports.isMinter = _chunkTRYGIC2Icjs.isMinter; exports.isPaymasterError = isPaymasterError; exports.issuerRegistryAbi = _chunkC7VB6WTLcjs.issuerRegistryAbi; exports.issuerRegistryGetIssuerFlatAbi = _chunkTRYGIC2Icjs.issuerRegistryGetIssuerFlatAbi; exports.mintFeeWrapperAbi = _chunkC7VB6WTLcjs.mintFeeWrapperAbi; exports.mintRequestTypes = _chunkNT2ZPF72cjs.mintRequestTypes; exports.mintingOracleAbi = _chunkC7VB6WTLcjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseEip7702DelegatedAddress = parseEip7702DelegatedAddress; exports.parseLoginMessage = _chunk75JWR5SAcjs.parseLoginMessage; exports.permit2Abi = _chunkXXLIIWIFcjs.permit2Abi; exports.pointTokenAbi = _chunkKRHGFUDIcjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunkXXLIIWIFcjs.pointTokenFactoryAbi; exports.quoteOperatorFeePt = quoteOperatorFeePt; exports.quoteOperatorFeeUsdt = quoteOperatorFeeUsdt; exports.rawCallOp = rawCallOp; exports.sendWithPaymasterFallback = sendWithPaymasterFallback; exports.serializeUserOpToJsonRpc = serializeUserOpToJsonRpc; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.signBurnRequest = _chunkNT2ZPF72cjs.signBurnRequest; exports.signMintRequest = _chunkNT2ZPF72cjs.signMintRequest; exports.signSponsorAuth = _chunk75JWR5SAcjs.signSponsorAuth; exports.splitAuthorizationSig = splitAuthorizationSig; exports.universalRouterAbi = _chunkXXLIIWIFcjs.universalRouterAbi; exports.v3QuoterV2Abi = _chunkXXLIIWIFcjs.v3QuoterV2Abi; exports.verifyBurnRequest = _chunkNT2ZPF72cjs.verifyBurnRequest; exports.verifyLoginMessage = _chunk75JWR5SAcjs.verifyLoginMessage; exports.verifyMintCap = _chunkTRYGIC2Icjs.verifyMintCap; exports.verifyMintRequest = _chunkNT2ZPF72cjs.verifyMintRequest; exports.verifySponsorAuth = _chunk75JWR5SAcjs.verifySponsorAuth; exports.webPopupAdapter = webPopupAdapter;
|
|
1690
|
+
exports.ApiError = ApiError; exports.BATCH_EXECUTOR_7702_IMPL = BATCH_EXECUTOR_7702_IMPL; exports.BATCH_EXECUTOR_ABI = 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 = _chunkUZUDJXKEcjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunkUZUDJXKEcjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = ConfigurationError; exports.DUMMY_SIGNATURE_V07 = DUMMY_SIGNATURE_V07; exports.ENTRY_POINT_V07 = _chunkUZUDJXKEcjs.ENTRY_POINT_V07; exports.ENTRY_POINT_V08 = _chunkUZUDJXKEcjs.ENTRY_POINT_V08; exports.Eip712DomainMismatchError = _chunkUZUDJXKEcjs.Eip712DomainMismatchError; exports.ORDERLY_RELAY_ABI = ORDERLY_RELAY_ABI; exports.ORDERLY_VAULT_ABI = ORDERLY_VAULT_ABI; exports.ORDERLY_VAULT_ADDRESSES = ORDERLY_VAULT_ADDRESSES; exports.ORDERLY_VAULT_BASE_MAINNET = ORDERLY_VAULT_BASE_MAINNET; exports.OracleStaleError = OracleStaleError; exports.PAFI_SERVICE_URLS = PAFI_SERVICE_URLS; exports.PAFI_SUBGRAPH_URL = PAFI_SUBGRAPH_URL; exports.PERMIT2_ADDRESS = _chunkUZUDJXKEcjs.PERMIT2_ADDRESS; exports.POINT_TOKEN_ABI = _chunkKRHGFUDIcjs.pointTokenAbi; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_POOLS = _chunkUZUDJXKEcjs.POINT_TOKEN_POOLS; exports.PafiSDK = PafiSDK; exports.PafiSdkError = PafiSdkError; exports.QUOTER_V2_ADDRESSES = _chunkUZUDJXKEcjs.QUOTER_V2_ADDRESSES; exports.SDK_ERROR_HTTP_STATUS_CODE = SDK_ERROR_HTTP_STATUS_CODE; exports.SIMPLE_7702_IMPL_BASE_MAINNET = SIMPLE_7702_IMPL_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET = _chunk75JWR5SAcjs.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_NAME = _chunk75JWR5SAcjs.SPONSOR_AUTH_DOMAIN_NAME; exports.SPONSOR_AUTH_TYPES = _chunk75JWR5SAcjs.SPONSOR_AUTH_TYPES; exports.SUPPORTED_CHAINS = _chunkUZUDJXKEcjs.SUPPORTED_CHAINS; exports.SigningError = SigningError; exports.SimulationError = SimulationError; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunkUZUDJXKEcjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V3_FACTORY_ADDRESSES = _chunkUZUDJXKEcjs.V3_FACTORY_ADDRESSES; exports.V3_POOL_INIT_CODE_HASH = _chunkUZUDJXKEcjs.V3_POOL_INIT_CODE_HASH; exports.V3_SWAP_ROUTER_ADDRESSES = _chunkUZUDJXKEcjs.V3_SWAP_ROUTER_ADDRESSES; exports.ValidationError = ValidationError; exports.ZERO_VALUE = ZERO_VALUE; exports.assembleUserOperation = assembleUserOperation; exports.assertDomainMatchesContract = _chunkUZUDJXKEcjs.assertDomainMatchesContract; exports.buildAndSignSponsorAuth = _chunk75JWR5SAcjs.buildAndSignSponsorAuth; exports.buildBurnRequestTypedData = _chunkUZUDJXKEcjs.buildBurnRequestTypedData; exports.buildDelegationUserOp = buildDelegationUserOp; exports.buildDomain = _chunkUZUDJXKEcjs.buildDomain; exports.buildEip7702Authorization = buildEip7702Authorization; exports.buildMintRequestTypedData = _chunkUZUDJXKEcjs.buildMintRequestTypedData; exports.buildPartialUserOperation = buildPartialUserOperation; exports.buildPerpDepositViaRelay = buildPerpDepositViaRelay; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildSponsorAuthDomain = _chunk75JWR5SAcjs.buildSponsorAuthDomain; exports.buildSponsorAuthTypedData = _chunk75JWR5SAcjs.buildSponsorAuthTypedData; exports.buildUserOpTypedData = buildUserOpTypedData; exports.burnRequestTypes = _chunkUZUDJXKEcjs.burnRequestTypes; exports.checkDelegation = checkDelegation; exports.checkEthAndBranch = checkEthAndBranch; exports.computeAccountId = computeAccountId; exports.computeAuthorizationHash = computeAuthorizationHash; exports.computeCallDataHash = _chunk75JWR5SAcjs.computeCallDataHash; exports.computeUserOpHash = computeUserOpHash; exports.computeV3PoolAddress = computeV3PoolAddress; exports.createLoginMessage = _chunk75JWR5SAcjs.createLoginMessage; exports.createPafiProxyTransport = createPafiProxyTransport; exports.decodeBatchExecuteCalls = decodeBatchExecuteCalls; exports.defaultErrorTypeForStatus = defaultErrorTypeForStatus; exports.delegateDirect = delegateDirect; exports.detectDelegateImpl = detectDelegateImpl; exports.encodeBatchExecute = encodeBatchExecute; exports.encodeV3Path = encodeV3Path; exports.encodeV3PathReversed = encodeV3PathReversed; exports.erc20Abi = _chunkXXLIIWIFcjs.erc20Abi; exports.erc20ApproveOp = erc20ApproveOp; exports.erc20BurnOp = erc20BurnOp; exports.erc20TransferOp = erc20TransferOp; exports.fetchPafiPools = fetchPafiPools; exports.generateSponsorAuthNonce = _chunk75JWR5SAcjs.generateSponsorAuthNonce; exports.getAaNonce = getAaNonce; exports.getBurnRequestNonce = _chunkTRYGIC2Icjs.getBurnRequestNonce; exports.getContractAddresses = getContractAddresses; exports.getDummySignatureFor7702 = getDummySignatureFor7702; exports.getIssuer = _chunkTRYGIC2Icjs.getIssuer2; exports.getMintFeeBps = _chunkTRYGIC2Icjs.getMintFeeBps; exports.getMintFeeRecipients = _chunkTRYGIC2Icjs.getMintFeeRecipients; exports.getMintRequestNonce = _chunkTRYGIC2Icjs.getMintRequestNonce; exports.getPafiServiceUrls = getPafiServiceUrls; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPointTokenBalance = _chunkTRYGIC2Icjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkTRYGIC2Icjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkTRYGIC2Icjs.getIssuer; exports.getSponsorAuthDomainAnchor = _chunk75JWR5SAcjs.getSponsorAuthDomainAnchor; exports.getTokenCap = _chunkTRYGIC2Icjs.getTokenCap; exports.getTokenName = _chunkTRYGIC2Icjs.getTokenName; exports.isActiveIssuer = _chunkTRYGIC2Icjs.isActiveIssuer; exports.isDelegatedTo = isDelegatedTo; exports.isDelegatedToTarget = isDelegatedToTarget; exports.isMinter = _chunkTRYGIC2Icjs.isMinter; exports.isPaymasterError = isPaymasterError; exports.issuerRegistryAbi = _chunkC7VB6WTLcjs.issuerRegistryAbi; exports.issuerRegistryGetIssuerFlatAbi = _chunkTRYGIC2Icjs.issuerRegistryGetIssuerFlatAbi; exports.mintFeeWrapperAbi = _chunkC7VB6WTLcjs.mintFeeWrapperAbi; exports.mintRequestTypes = _chunkUZUDJXKEcjs.mintRequestTypes; exports.mintingOracleAbi = _chunkC7VB6WTLcjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseEip7702DelegatedAddress = parseEip7702DelegatedAddress; exports.parseLoginMessage = _chunk75JWR5SAcjs.parseLoginMessage; exports.permit2Abi = _chunkXXLIIWIFcjs.permit2Abi; exports.pointTokenAbi = _chunkKRHGFUDIcjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunkXXLIIWIFcjs.pointTokenFactoryAbi; exports.quoteOperatorFeePt = quoteOperatorFeePt; exports.quoteOperatorFeeUsdt = quoteOperatorFeeUsdt; exports.rawCallOp = rawCallOp; exports.sendWithPaymasterFallback = sendWithPaymasterFallback; exports.serializeUserOpToJsonRpc = serializeUserOpToJsonRpc; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.signBurnRequest = _chunkUZUDJXKEcjs.signBurnRequest; exports.signMintRequest = _chunkUZUDJXKEcjs.signMintRequest; exports.signSponsorAuth = _chunk75JWR5SAcjs.signSponsorAuth; exports.splitAuthorizationSig = splitAuthorizationSig; exports.universalRouterAbi = _chunkXXLIIWIFcjs.universalRouterAbi; exports.v3QuoterV2Abi = _chunkXXLIIWIFcjs.v3QuoterV2Abi; exports.verifyBurnRequest = _chunkUZUDJXKEcjs.verifyBurnRequest; exports.verifyLoginMessage = _chunk75JWR5SAcjs.verifyLoginMessage; exports.verifyMintCap = _chunkTRYGIC2Icjs.verifyMintCap; exports.verifyMintRequest = _chunkUZUDJXKEcjs.verifyMintRequest; exports.verifySponsorAuth = _chunk75JWR5SAcjs.verifySponsorAuth; exports.webPopupAdapter = webPopupAdapter;
|
|
1691
1691
|
//# sourceMappingURL=index.cjs.map
|