@pafi-dev/core 0.5.22 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abi/index.cjs +3 -7
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.js +6 -10
- package/dist/chunk-3QDZFDEL.cjs +223 -0
- package/dist/chunk-3QDZFDEL.cjs.map +1 -0
- package/dist/{chunk-Y2MZ7MKJ.js → chunk-6CXTFOIH.js} +196 -2
- package/dist/chunk-6CXTFOIH.js.map +1 -0
- package/dist/{chunk-R6OFGVMP.cjs → chunk-Q6WCDZXI.cjs} +196 -2
- package/dist/chunk-Q6WCDZXI.cjs.map +1 -0
- package/dist/{chunk-TXA4GK5C.js → chunk-UOKI5GG6.js} +87 -7
- package/dist/chunk-UOKI5GG6.js.map +1 -0
- package/dist/eip712/index.cjs +2 -3
- package/dist/eip712/index.cjs.map +1 -1
- package/dist/eip712/index.js +1 -2
- package/dist/index.cjs +205 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -48
- package/dist/index.d.ts +105 -48
- package/dist/index.js +186 -148
- package/dist/index.js.map +1 -1
- package/package.json +1 -31
- package/dist/chunk-2PIXFXA2.js +0 -135
- package/dist/chunk-2PIXFXA2.js.map +0 -1
- package/dist/chunk-CL3QSI4O.cjs +0 -65
- package/dist/chunk-CL3QSI4O.cjs.map +0 -1
- package/dist/chunk-DX73FB4P.cjs +0 -143
- package/dist/chunk-DX73FB4P.cjs.map +0 -1
- package/dist/chunk-IPXARZ6F.cjs +0 -135
- package/dist/chunk-IPXARZ6F.cjs.map +0 -1
- package/dist/chunk-JJ2LGENO.cjs +0 -373
- package/dist/chunk-JJ2LGENO.cjs.map +0 -1
- package/dist/chunk-KFWZRL7I.js +0 -65
- package/dist/chunk-KFWZRL7I.js.map +0 -1
- package/dist/chunk-L5UHQQVC.cjs +0 -136
- package/dist/chunk-L5UHQQVC.cjs.map +0 -1
- package/dist/chunk-R6OFGVMP.cjs.map +0 -1
- package/dist/chunk-TXA4GK5C.js.map +0 -1
- package/dist/chunk-VG23GIWQ.js +0 -373
- package/dist/chunk-VG23GIWQ.js.map +0 -1
- package/dist/chunk-WAFUL62X.js +0 -136
- package/dist/chunk-WAFUL62X.js.map +0 -1
- package/dist/chunk-X2JZFK4C.cjs +0 -87
- package/dist/chunk-X2JZFK4C.cjs.map +0 -1
- package/dist/chunk-Y2MZ7MKJ.js.map +0 -1
- package/dist/chunk-Y3HMGOYW.js +0 -87
- package/dist/chunk-Y3HMGOYW.js.map +0 -1
- package/dist/index-3C_HdEIm.d.cts +0 -227
- package/dist/index-DKtVEoRC.d.ts +0 -227
- package/dist/quoting/index.cjs +0 -19
- package/dist/quoting/index.cjs.map +0 -1
- package/dist/quoting/index.d.cts +0 -59
- package/dist/quoting/index.d.ts +0 -59
- package/dist/quoting/index.js +0 -19
- package/dist/quoting/index.js.map +0 -1
- package/dist/swap/index.cjs +0 -31
- package/dist/swap/index.cjs.map +0 -1
- package/dist/swap/index.d.cts +0 -3
- package/dist/swap/index.d.ts +0 -3
- package/dist/swap/index.js +0 -31
- package/dist/swap/index.js.map +0 -1
package/dist/chunk-WAFUL62X.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
v4QuoterAbi
|
|
3
|
-
} from "./chunk-KFWZRL7I.js";
|
|
4
|
-
import {
|
|
5
|
-
COMMON_POOLS,
|
|
6
|
-
POINT_TOKEN_POOLS,
|
|
7
|
-
V4_QUOTER_ADDRESSES
|
|
8
|
-
} from "./chunk-Y3HMGOYW.js";
|
|
9
|
-
|
|
10
|
-
// src/quoting/routes.ts
|
|
11
|
-
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
12
|
-
function combineRoutes(chainId, pointTokenAddress) {
|
|
13
|
-
const commonPools = COMMON_POOLS[chainId] ?? [];
|
|
14
|
-
const pointPools = POINT_TOKEN_POOLS[chainId]?.[pointTokenAddress] ?? [];
|
|
15
|
-
return [...pointPools, ...commonPools];
|
|
16
|
-
}
|
|
17
|
-
function buildAllPaths(pools, tokenIn, tokenOut, maxHops = 3) {
|
|
18
|
-
const results = [];
|
|
19
|
-
function dfs(currentToken, currentPath, usedPoolIndices) {
|
|
20
|
-
if (currentPath.length > maxHops) return;
|
|
21
|
-
if (currentPath.length > 0 && currentToken.toLowerCase() === tokenOut.toLowerCase()) {
|
|
22
|
-
results.push([...currentPath]);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
for (let i = 0; i < pools.length; i++) {
|
|
26
|
-
if (usedPoolIndices.has(i)) continue;
|
|
27
|
-
const pool = pools[i];
|
|
28
|
-
const c0 = pool.currency0.toLowerCase();
|
|
29
|
-
const c1 = pool.currency1.toLowerCase();
|
|
30
|
-
const curr = currentToken.toLowerCase();
|
|
31
|
-
let nextToken = null;
|
|
32
|
-
if (curr === c0) {
|
|
33
|
-
nextToken = pool.currency1;
|
|
34
|
-
} else if (curr === c1) {
|
|
35
|
-
nextToken = pool.currency0;
|
|
36
|
-
}
|
|
37
|
-
if (!nextToken) continue;
|
|
38
|
-
const hop = {
|
|
39
|
-
intermediateCurrency: nextToken,
|
|
40
|
-
fee: pool.fee,
|
|
41
|
-
tickSpacing: pool.tickSpacing,
|
|
42
|
-
hooks: pool.hooks ?? ZERO_ADDRESS,
|
|
43
|
-
hookData: "0x"
|
|
44
|
-
};
|
|
45
|
-
usedPoolIndices.add(i);
|
|
46
|
-
currentPath.push(hop);
|
|
47
|
-
dfs(nextToken, currentPath, usedPoolIndices);
|
|
48
|
-
currentPath.pop();
|
|
49
|
-
usedPoolIndices.delete(i);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
dfs(tokenIn, [], /* @__PURE__ */ new Set());
|
|
53
|
-
return results;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// src/quoting/quote.ts
|
|
57
|
-
async function quoteExactInput(client, quoterAddress, exactCurrency, path, exactAmount) {
|
|
58
|
-
const [amountOut, gasEstimate] = await client.readContract({
|
|
59
|
-
address: quoterAddress,
|
|
60
|
-
abi: v4QuoterAbi,
|
|
61
|
-
functionName: "quoteExactInput",
|
|
62
|
-
args: [{ exactCurrency, path, exactAmount: BigInt(exactAmount) }]
|
|
63
|
-
});
|
|
64
|
-
return { amountOut, gasEstimate, path };
|
|
65
|
-
}
|
|
66
|
-
async function quoteExactInputSingle(client, quoterAddress, poolKey, zeroForOne, exactAmount, hookData) {
|
|
67
|
-
const [amountOut, gasEstimate] = await client.readContract({
|
|
68
|
-
address: quoterAddress,
|
|
69
|
-
abi: v4QuoterAbi,
|
|
70
|
-
functionName: "quoteExactInputSingle",
|
|
71
|
-
args: [
|
|
72
|
-
{
|
|
73
|
-
poolKey,
|
|
74
|
-
zeroForOne,
|
|
75
|
-
exactAmount: BigInt(exactAmount),
|
|
76
|
-
hookData
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
});
|
|
80
|
-
return { amountOut, gasEstimate };
|
|
81
|
-
}
|
|
82
|
-
async function quoteBestRoute(client, quoterAddress, exactCurrency, routes, exactAmount) {
|
|
83
|
-
const results = await client.multicall({
|
|
84
|
-
contracts: routes.map((path) => ({
|
|
85
|
-
address: quoterAddress,
|
|
86
|
-
abi: v4QuoterAbi,
|
|
87
|
-
functionName: "quoteExactInput",
|
|
88
|
-
args: [
|
|
89
|
-
{
|
|
90
|
-
exactCurrency,
|
|
91
|
-
path,
|
|
92
|
-
exactAmount: BigInt(exactAmount)
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
})),
|
|
96
|
-
allowFailure: true
|
|
97
|
-
});
|
|
98
|
-
const allRoutes = [];
|
|
99
|
-
for (let i = 0; i < results.length; i++) {
|
|
100
|
-
const r = results[i];
|
|
101
|
-
if (r.status === "success") {
|
|
102
|
-
const [amountOut, gasEstimate] = r.result;
|
|
103
|
-
allRoutes.push({ amountOut, gasEstimate, path: routes[i] });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (allRoutes.length === 0) {
|
|
107
|
-
throw new Error("No valid routes found");
|
|
108
|
-
}
|
|
109
|
-
const bestRoute = allRoutes.reduce(
|
|
110
|
-
(best, current) => current.amountOut > best.amountOut ? current : best
|
|
111
|
-
);
|
|
112
|
-
return { bestRoute, allRoutes };
|
|
113
|
-
}
|
|
114
|
-
async function findBestQuote(client, chainId, tokenIn, tokenOut, exactAmount, pools = [], quoterAddress, maxHops = 3) {
|
|
115
|
-
const quoter = quoterAddress ?? V4_QUOTER_ADDRESSES[chainId];
|
|
116
|
-
if (!quoter) {
|
|
117
|
-
throw new Error(`No V4 Quoter address configured for chain ${chainId}`);
|
|
118
|
-
}
|
|
119
|
-
const commonPools = COMMON_POOLS[chainId] ?? [];
|
|
120
|
-
const allPools = [...pools, ...commonPools];
|
|
121
|
-
const paths = buildAllPaths(allPools, tokenIn, tokenOut, maxHops);
|
|
122
|
-
if (paths.length === 0) {
|
|
123
|
-
throw new Error(`No paths found from ${tokenIn} to ${tokenOut}`);
|
|
124
|
-
}
|
|
125
|
-
return quoteBestRoute(client, quoter, tokenIn, paths, exactAmount);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export {
|
|
129
|
-
combineRoutes,
|
|
130
|
-
buildAllPaths,
|
|
131
|
-
quoteExactInput,
|
|
132
|
-
quoteExactInputSingle,
|
|
133
|
-
quoteBestRoute,
|
|
134
|
-
findBestQuote
|
|
135
|
-
};
|
|
136
|
-
//# sourceMappingURL=chunk-WAFUL62X.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/quoting/routes.ts","../src/quoting/quote.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { PathKey, PoolKey } from \"../types\";\nimport { COMMON_POOLS, POINT_TOKEN_POOLS } from \"../constants\";\n\nconst ZERO_ADDRESS = \"0x0000000000000000000000000000000000000000\" as Address;\n\n/**\n * Combine point-token-specific pools and common pools for a given chain.\n * Point token pools are listed first so callers can prioritise them.\n */\nexport function combineRoutes(\n chainId: number,\n pointTokenAddress: Address,\n): PoolKey[] {\n const commonPools = COMMON_POOLS[chainId] ?? [];\n const pointPools = POINT_TOKEN_POOLS[chainId]?.[pointTokenAddress] ?? [];\n return [...pointPools, ...commonPools];\n}\n\n/**\n * Build all possible swap paths from `tokenIn` to `tokenOut` using the given\n * pools. Returns an array of PathKey[] routes (each up to `maxHops` hops).\n *\n * Supports both direct single-hop routes and multi-hop routes through\n * intermediate tokens. Each pool is used at most once per path.\n *\n * @param pools - Available pools to route through\n * @param tokenIn - Input token address\n * @param tokenOut - Desired output token address\n * @param maxHops - Maximum number of hops (default 3)\n */\nexport function buildAllPaths(\n pools: PoolKey[],\n tokenIn: Address,\n tokenOut: Address,\n maxHops = 3,\n): PathKey[][] {\n const results: PathKey[][] = [];\n\n function dfs(\n currentToken: Address,\n currentPath: PathKey[],\n usedPoolIndices: Set<number>,\n ) {\n if (currentPath.length > maxHops) return;\n\n // Check if we've reached the destination\n if (\n currentPath.length > 0 &&\n currentToken.toLowerCase() === tokenOut.toLowerCase()\n ) {\n results.push([...currentPath]);\n return;\n }\n\n for (let i = 0; i < pools.length; i++) {\n if (usedPoolIndices.has(i)) continue;\n\n const pool = pools[i]!;\n const c0 = pool.currency0.toLowerCase();\n const c1 = pool.currency1.toLowerCase();\n const curr = currentToken.toLowerCase();\n\n let nextToken: Address | null = null;\n if (curr === c0) {\n nextToken = pool.currency1 as Address;\n } else if (curr === c1) {\n nextToken = pool.currency0 as Address;\n }\n\n if (!nextToken) continue;\n\n const hop: PathKey = {\n intermediateCurrency: nextToken,\n fee: pool.fee,\n tickSpacing: pool.tickSpacing,\n hooks: pool.hooks ?? ZERO_ADDRESS,\n hookData: \"0x\",\n };\n\n usedPoolIndices.add(i);\n currentPath.push(hop);\n dfs(nextToken, currentPath, usedPoolIndices);\n currentPath.pop();\n usedPoolIndices.delete(i);\n }\n }\n\n dfs(tokenIn, [], new Set());\n return results;\n}\n","import type { Address, PublicClient } from \"viem\";\nimport type { BestQuote, PathKey, PoolKey, QuoteResult } from \"../types\";\nimport { v4QuoterAbi } from \"../abi/v4Quoter\";\nimport { buildAllPaths } from \"./routes\";\nimport { COMMON_POOLS, V4_QUOTER_ADDRESSES } from \"../constants\";\n\n/**\n * Quote exact-input for a multi-hop path.\n */\nexport async function quoteExactInput(\n client: PublicClient,\n quoterAddress: Address,\n exactCurrency: Address,\n path: PathKey[],\n exactAmount: bigint,\n): Promise<QuoteResult> {\n const [amountOut, gasEstimate] = await client.readContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInput\",\n args: [{ exactCurrency, path, exactAmount: BigInt(exactAmount) as unknown as number }],\n }) as [bigint, bigint];\n\n return { amountOut, gasEstimate, path };\n}\n\n/**\n * Quote exact-input for a single-hop swap, given an explicit PoolKey and direction.\n */\nexport async function quoteExactInputSingle(\n client: PublicClient,\n quoterAddress: Address,\n poolKey: PoolKey,\n zeroForOne: boolean,\n exactAmount: bigint,\n hookData: `0x${string}`,\n): Promise<{ amountOut: bigint; gasEstimate: bigint }> {\n const [amountOut, gasEstimate] = await client.readContract({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInputSingle\",\n args: [\n {\n poolKey,\n zeroForOne,\n exactAmount: BigInt(exactAmount) as unknown as number,\n hookData,\n },\n ],\n }) as [bigint, bigint];\n\n return { amountOut, gasEstimate };\n}\n\n/**\n * Try multiple PathKey[] routes and return the best quote plus all results.\n * Routes that fail (e.g. pool does not exist) are silently skipped.\n *\n * Uses viem multicall to batch all quotes into a single RPC call for speed.\n */\nexport async function quoteBestRoute(\n client: PublicClient,\n quoterAddress: Address,\n exactCurrency: Address,\n routes: PathKey[][],\n exactAmount: bigint,\n): Promise<BestQuote> {\n const results = await client.multicall({\n contracts: routes.map((path) => ({\n address: quoterAddress,\n abi: v4QuoterAbi,\n functionName: \"quoteExactInput\" as const,\n args: [\n {\n exactCurrency,\n path,\n exactAmount: BigInt(exactAmount) as unknown as number,\n },\n ],\n })),\n allowFailure: true,\n });\n\n const allRoutes: QuoteResult[] = [];\n for (let i = 0; i < results.length; i++) {\n const r = results[i]!;\n if (r.status === \"success\") {\n const [amountOut, gasEstimate] = r.result as unknown as [bigint, bigint];\n allRoutes.push({ amountOut, gasEstimate, path: routes[i]! });\n }\n }\n\n if (allRoutes.length === 0) {\n throw new Error(\"No valid routes found\");\n }\n\n const bestRoute = allRoutes.reduce((best, current) =>\n current.amountOut > best.amountOut ? current : best,\n );\n\n return { bestRoute, allRoutes };\n}\n\n/**\n * Find and quote the best swap route from `tokenIn` to `tokenOut`.\n *\n * Combines the caller's `pools` with `COMMON_POOLS[chainId]`, builds all\n * possible paths (up to `maxHops`), then quotes them all via a single\n * multicall and returns the best result.\n *\n * @param client - viem PublicClient\n * @param chainId - Chain ID (used to look up COMMON_POOLS and V4_QUOTER_ADDRESSES)\n * @param tokenIn - Input token address\n * @param tokenOut - Desired output token address\n * @param exactAmount - Exact input amount\n * @param pools - Additional pools to consider (e.g. point-token-specific)\n * @param quoterAddress - Override the default V4 Quoter address for this chain\n * @param maxHops - Maximum number of hops per path (default 3)\n */\nexport async function findBestQuote(\n client: PublicClient,\n chainId: number,\n tokenIn: Address,\n tokenOut: Address,\n exactAmount: bigint,\n pools: PoolKey[] = [],\n quoterAddress?: Address,\n maxHops = 3,\n): Promise<BestQuote> {\n const quoter = quoterAddress ?? V4_QUOTER_ADDRESSES[chainId];\n if (!quoter) {\n throw new Error(`No V4 Quoter address configured for chain ${chainId}`);\n }\n\n const commonPools = COMMON_POOLS[chainId] ?? [];\n const allPools = [...pools, ...commonPools];\n const paths = buildAllPaths(allPools, tokenIn, tokenOut, maxHops);\n\n if (paths.length === 0) {\n throw new Error(`No paths found from ${tokenIn} to ${tokenOut}`);\n }\n\n return quoteBestRoute(client, quoter, tokenIn, paths, exactAmount);\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAM,eAAe;AAMd,SAAS,cACd,SACA,mBACW;AACX,QAAM,cAAc,aAAa,O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AAY,KAAK,YAAY,UAAU;AAAA,EACjD;AAEA,SAAO,EAAE,WAAW,UAAU;AAChC;AAkBA,eAAsB,cACpB,QACA,SACA,SACA,UACA,aACA,QAAmB,CAAC,GACpB,eACA,UAAU,GACU;AACpB,QAAM,SAAS,iBAAiB,oBAAoB,OAAO;AAC3D,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,6CAA6C,OAAO,EAAE;AAAA,EACxE;AAEA,QAAM,cAAc,aAAa,OAAO,KAAK,CAAC;AAC9C,QAAM,WAAW,CAAC,GAAG,OAAO,GAAG,WAAW;AAC1C,QAAM,QAAQ,cAAc,UAAU,SAAS,UAAU,OAAO;AAEhE,MAAI,MAAM,WAAW,GAAG;AACtB,UAAM,IAAI,MAAM,uBAAuB,OAAO,OAAO,QAAQ,EAAE;AAAA,EACjE;AAEA,SAAO,eAAe,QAAQ,QAAQ,SAAS,OAAO,WAAW;AACnE;","names":[]}
|
package/dist/chunk-X2JZFK4C.cjs
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/constants.ts
|
|
2
|
-
var mintRequestTypes = {
|
|
3
|
-
MintRequest: [
|
|
4
|
-
{ name: "to", type: "address" },
|
|
5
|
-
{ name: "amount", type: "uint256" },
|
|
6
|
-
{ name: "nonce", type: "uint256" },
|
|
7
|
-
{ name: "deadline", type: "uint256" }
|
|
8
|
-
]
|
|
9
|
-
};
|
|
10
|
-
var burnRequestTypes = {
|
|
11
|
-
BurnRequest: [
|
|
12
|
-
{ name: "from", type: "address" },
|
|
13
|
-
{ name: "amount", type: "uint256" },
|
|
14
|
-
{ name: "nonce", type: "uint256" },
|
|
15
|
-
{ name: "deadline", type: "uint256" }
|
|
16
|
-
]
|
|
17
|
-
};
|
|
18
|
-
var receiverConsentTypes = {
|
|
19
|
-
ReceiverConsent: [
|
|
20
|
-
{ name: "onBehalfOf", type: "address" },
|
|
21
|
-
{ name: "originalReceiver", type: "address" },
|
|
22
|
-
{ name: "amount", type: "uint256" },
|
|
23
|
-
{ name: "nonce", type: "uint256" },
|
|
24
|
-
{ name: "deadline", type: "uint256" },
|
|
25
|
-
{ name: "extData", type: "bytes" }
|
|
26
|
-
]
|
|
27
|
-
};
|
|
28
|
-
var SUPPORTED_CHAINS = {
|
|
29
|
-
8453: { name: "Base" }
|
|
30
|
-
};
|
|
31
|
-
var V4_QUOTER_ADDRESSES = {
|
|
32
|
-
8453: "0x0d5e0f971ed27fbff6c2837bf31316121532048d"
|
|
33
|
-
};
|
|
34
|
-
var UNIVERSAL_ROUTER_ADDRESSES = {
|
|
35
|
-
8453: "0x6ff5693b99212da76ad316178a184ab56d299b43"
|
|
36
|
-
};
|
|
37
|
-
var COMMON_TOKENS = {
|
|
38
|
-
// Base
|
|
39
|
-
8453: {
|
|
40
|
-
WETH: "0x4200000000000000000000000000000000000006",
|
|
41
|
-
USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
42
|
-
USDT: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2"
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var COMMON_POOLS = {
|
|
46
|
-
// Base — existing Uniswap V4 pools
|
|
47
|
-
8453: [
|
|
48
|
-
// WETH/USDC 0.3%
|
|
49
|
-
{
|
|
50
|
-
currency0: "0x4200000000000000000000000000000000000006",
|
|
51
|
-
currency1: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
52
|
-
fee: 3e3,
|
|
53
|
-
tickSpacing: 60,
|
|
54
|
-
hooks: "0x0000000000000000000000000000000000000000"
|
|
55
|
-
},
|
|
56
|
-
// WETH/USDC 0.05%
|
|
57
|
-
{
|
|
58
|
-
currency0: "0x4200000000000000000000000000000000000006",
|
|
59
|
-
currency1: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
60
|
-
fee: 500,
|
|
61
|
-
tickSpacing: 10,
|
|
62
|
-
hooks: "0x0000000000000000000000000000000000000000"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
};
|
|
66
|
-
var POINT_TOKEN_POOLS = {
|
|
67
|
-
// chainId → pointTokenAddress → PoolKey[]
|
|
68
|
-
};
|
|
69
|
-
var ENTRY_POINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
70
|
-
var ENTRY_POINT_V08 = "0x4337084d9e255ff0702461cf8895ce9e3b5ff108";
|
|
71
|
-
var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
exports.mintRequestTypes = mintRequestTypes; exports.burnRequestTypes = burnRequestTypes; exports.receiverConsentTypes = receiverConsentTypes; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.V4_QUOTER_ADDRESSES = V4_QUOTER_ADDRESSES; exports.UNIVERSAL_ROUTER_ADDRESSES = UNIVERSAL_ROUTER_ADDRESSES; 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;
|
|
87
|
-
//# sourceMappingURL=chunk-X2JZFK4C.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-X2JZFK4C.cjs","../src/constants.ts"],"names":[],"mappings":"AAAA;ACOO,IAAM,iBAAA,EAAmB;AAAA,EAC9B,WAAA,EAAa;AAAA,IACX,EAAE,IAAA,EAAM,IAAA,EAAM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,IAAA,EAAM;AACR,CAAA;AAEO,IAAM,cAAA,EAAyD;AAAA;AAAA,EAEpE,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM,4CAAA;AAAA,IACN,IAAA,EAAM;AAAA,EACR;AACF,CAAA;AAEO,IAAM,aAAA,EAA0C;AAAA;AAAA,EAErD,IAAA,EAAM;AAAA;AAAA,IAEJ;AAAA,MACE,SAAA,EAAW,4CAAA;AAAA,MACX,SAAA,EAAW,4CAAA;AAAA,MACX,GAAA,EAAK,GAAA;AAAA,MACL,WAAA,EAAa,EAAA;AAAA,MACb,KAAA,EAAO;AAAA,IACT,CAAA;AAAA;AAAA,IAEA;AAAA,MACE,SAAA,EAAW,4CAAA;AAAA,MACX,SAAA,EAAW,4CAAA;AAAA,MACX,GAAA,EAAK,GAAA;AAAA,MACL,WAAA,EAAa,EAAA;AAAA,MACb,KAAA,EAAO;AAAA,IACT;AAAA,EACF;AACF,CAAA;AAEO,IAAM,kBAAA,EAAgE;AAAA;AAE7E,CAAA;AAOO,IAAM,gBAAA,EAA2B,4CAAA;AAcjC,IAAM,gBAAA,EAA2B,4CAAA;AAGjC,IAAM,gBAAA,EAA2B,4CAAA;ADtCxC;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,2iBAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-X2JZFK4C.cjs","sourcesContent":[null,"import type { Address } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\nexport const mintRequestTypes = {\n MintRequest: [\n { name: \"to\", 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\nexport const receiverConsentTypes = {\n ReceiverConsent: [\n { name: \"onBehalfOf\", type: \"address\" },\n { name: \"originalReceiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n { name: \"extData\", type: \"bytes\" },\n ],\n} as const;\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\nexport const V4_QUOTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x0d5e0f971ed27fbff6c2837bf31316121532048d\",\n};\n\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x6ff5693b99212da76ad316178a184ab56d299b43\",\n};\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 — existing Uniswap V4 pools\n 8453: [\n // WETH/USDC 0.3%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n tickSpacing: 60,\n hooks: \"0x0000000000000000000000000000000000000000\",\n },\n // WETH/USDC 0.05%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n tickSpacing: 10,\n hooks: \"0x0000000000000000000000000000000000000000\",\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/abi/pointTokenFactory.ts"],"sourcesContent":["/** ABI for PointTokenFactory (EIP-1167 proxy cloning, UUPS upgradeable) — auto-generated from Foundry artifacts, do not edit */\nexport const pointTokenFactoryAbi = [\n {\n \"type\": \"constructor\",\n \"inputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"UPGRADE_INTERFACE_VERSION\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"acceptOwnership\",\n \"inputs\": [],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"createToken\",\n \"inputs\": [\n {\n \"name\": \"tokenOwner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"issuer\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"signerAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"name\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n },\n {\n \"name\": \"symbol\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"token\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"initialize\",\n \"inputs\": [\n {\n \"name\": \"initialOwner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_issuerRegistry\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_mintingOracle\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_tokenImplementation\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"issuerRegistry\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"mintingOracle\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"owner\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"pendingOwner\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"proxiableUUID\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bytes32\",\n \"internalType\": \"bytes32\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"renounceOwnership\",\n \"inputs\": [],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"setMintingOracle\",\n \"inputs\": [\n {\n \"name\": \"_mintingOracle\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"setTokenImplementationAddress\",\n \"inputs\": [\n {\n \"name\": \"impl\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"tokenImplementation\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"transferOwnership\",\n \"inputs\": [\n {\n \"name\": \"newOwner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"upgradeToAndCall\",\n \"inputs\": [\n {\n \"name\": \"newImplementation\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"data\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"payable\"\n },\n {\n \"type\": \"event\",\n \"name\": \"Initialized\",\n \"inputs\": [\n {\n \"name\": \"version\",\n \"type\": \"uint64\",\n \"indexed\": false,\n \"internalType\": \"uint64\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"MintingOracleUpdated\",\n \"inputs\": [\n {\n \"name\": \"mintingOracle\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"OwnershipTransferStarted\",\n \"inputs\": [\n {\n \"name\": \"previousOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"newOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"OwnershipTransferred\",\n \"inputs\": [\n {\n \"name\": \"previousOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"newOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"TokenCreated\",\n \"inputs\": [\n {\n \"name\": \"issuer\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"token\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"TokenImplementationAddressUpdated\",\n \"inputs\": [\n {\n \"name\": \"tokenImplementation\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"Upgraded\",\n \"inputs\": [\n {\n \"name\": \"implementation\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"error\",\n \"name\": \"AddressEmptyCode\",\n \"inputs\": [\n {\n \"name\": \"target\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"ERC1967InvalidImplementation\",\n \"inputs\": [\n {\n \"name\": \"implementation\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"ERC1967NonPayable\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"FailedCall\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"FailedDeployment\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"ImplementationNotSet\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"InsufficientBalance\",\n \"inputs\": [\n {\n \"name\": \"balance\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n },\n {\n \"name\": \"needed\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"InvalidInitialization\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"MintingOracleNotSet\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"NotInitializing\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"OnlyIssuerRegistry\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"OwnableInvalidOwner\",\n \"inputs\": [\n {\n \"name\": \"owner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"OwnableUnauthorizedAccount\",\n \"inputs\": [\n {\n \"name\": \"account\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"UUPSUnauthorizedCallContext\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"UUPSUnsupportedProxiableUUID\",\n \"inputs\": [\n {\n \"name\": \"slot\",\n \"type\": \"bytes32\",\n \"internalType\": \"bytes32\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"ZeroAddress\",\n \"inputs\": []\n }\n] as const;\n"],"mappings":";AACO,IAAM,uBAAuB;AAAA,EAClC;AAAA,IACE,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,IACX,mBAAmB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,IACX,WAAW;AAAA,MACT;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,IACX,WAAW,CAAC;AAAA,IACZ,mBAAmB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,MACR;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,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QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,EACb;AACF;","names":[]}
|
package/dist/chunk-Y3HMGOYW.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// src/constants.ts
|
|
2
|
-
var mintRequestTypes = {
|
|
3
|
-
MintRequest: [
|
|
4
|
-
{ name: "to", type: "address" },
|
|
5
|
-
{ name: "amount", type: "uint256" },
|
|
6
|
-
{ name: "nonce", type: "uint256" },
|
|
7
|
-
{ name: "deadline", type: "uint256" }
|
|
8
|
-
]
|
|
9
|
-
};
|
|
10
|
-
var burnRequestTypes = {
|
|
11
|
-
BurnRequest: [
|
|
12
|
-
{ name: "from", type: "address" },
|
|
13
|
-
{ name: "amount", type: "uint256" },
|
|
14
|
-
{ name: "nonce", type: "uint256" },
|
|
15
|
-
{ name: "deadline", type: "uint256" }
|
|
16
|
-
]
|
|
17
|
-
};
|
|
18
|
-
var receiverConsentTypes = {
|
|
19
|
-
ReceiverConsent: [
|
|
20
|
-
{ name: "onBehalfOf", type: "address" },
|
|
21
|
-
{ name: "originalReceiver", type: "address" },
|
|
22
|
-
{ name: "amount", type: "uint256" },
|
|
23
|
-
{ name: "nonce", type: "uint256" },
|
|
24
|
-
{ name: "deadline", type: "uint256" },
|
|
25
|
-
{ name: "extData", type: "bytes" }
|
|
26
|
-
]
|
|
27
|
-
};
|
|
28
|
-
var SUPPORTED_CHAINS = {
|
|
29
|
-
8453: { name: "Base" }
|
|
30
|
-
};
|
|
31
|
-
var V4_QUOTER_ADDRESSES = {
|
|
32
|
-
8453: "0x0d5e0f971ed27fbff6c2837bf31316121532048d"
|
|
33
|
-
};
|
|
34
|
-
var UNIVERSAL_ROUTER_ADDRESSES = {
|
|
35
|
-
8453: "0x6ff5693b99212da76ad316178a184ab56d299b43"
|
|
36
|
-
};
|
|
37
|
-
var COMMON_TOKENS = {
|
|
38
|
-
// Base
|
|
39
|
-
8453: {
|
|
40
|
-
WETH: "0x4200000000000000000000000000000000000006",
|
|
41
|
-
USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
42
|
-
USDT: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2"
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var COMMON_POOLS = {
|
|
46
|
-
// Base — existing Uniswap V4 pools
|
|
47
|
-
8453: [
|
|
48
|
-
// WETH/USDC 0.3%
|
|
49
|
-
{
|
|
50
|
-
currency0: "0x4200000000000000000000000000000000000006",
|
|
51
|
-
currency1: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
52
|
-
fee: 3e3,
|
|
53
|
-
tickSpacing: 60,
|
|
54
|
-
hooks: "0x0000000000000000000000000000000000000000"
|
|
55
|
-
},
|
|
56
|
-
// WETH/USDC 0.05%
|
|
57
|
-
{
|
|
58
|
-
currency0: "0x4200000000000000000000000000000000000006",
|
|
59
|
-
currency1: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
60
|
-
fee: 500,
|
|
61
|
-
tickSpacing: 10,
|
|
62
|
-
hooks: "0x0000000000000000000000000000000000000000"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
};
|
|
66
|
-
var POINT_TOKEN_POOLS = {
|
|
67
|
-
// chainId → pointTokenAddress → PoolKey[]
|
|
68
|
-
};
|
|
69
|
-
var ENTRY_POINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
70
|
-
var ENTRY_POINT_V08 = "0x4337084d9e255ff0702461cf8895ce9e3b5ff108";
|
|
71
|
-
var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
mintRequestTypes,
|
|
75
|
-
burnRequestTypes,
|
|
76
|
-
receiverConsentTypes,
|
|
77
|
-
SUPPORTED_CHAINS,
|
|
78
|
-
V4_QUOTER_ADDRESSES,
|
|
79
|
-
UNIVERSAL_ROUTER_ADDRESSES,
|
|
80
|
-
COMMON_TOKENS,
|
|
81
|
-
COMMON_POOLS,
|
|
82
|
-
POINT_TOKEN_POOLS,
|
|
83
|
-
ENTRY_POINT_V07,
|
|
84
|
-
ENTRY_POINT_V08,
|
|
85
|
-
PERMIT2_ADDRESS
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=chunk-Y3HMGOYW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\nexport const mintRequestTypes = {\n MintRequest: [\n { name: \"to\", 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\nexport const receiverConsentTypes = {\n ReceiverConsent: [\n { name: \"onBehalfOf\", type: \"address\" },\n { name: \"originalReceiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n { name: \"extData\", type: \"bytes\" },\n ],\n} as const;\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\nexport const V4_QUOTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x0d5e0f971ed27fbff6c2837bf31316121532048d\",\n};\n\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x6ff5693b99212da76ad316178a184ab56d299b43\",\n};\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 — existing Uniswap V4 pools\n 8453: [\n // WETH/USDC 0.3%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n tickSpacing: 60,\n hooks: \"0x0000000000000000000000000000000000000000\",\n },\n // WETH/USDC 0.05%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n tickSpacing: 10,\n hooks: \"0x0000000000000000000000000000000000000000\",\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"],"mappings":";AAOO,IAAM,mBAAmB;AAAA,EAC9B,aAAa;AAAA,IACX,EAAE,MAAM,MAAM,MAAM,UAAU;AAAA,IAC9B,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAClC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AACF;AAEO,IAAM,mBAAmB;AAAA,EAC9B,aAAa;AAAA,IACX,EAAE,MAAM,QAAQ,MAAM,UAAU;AAAA,IAChC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAClC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AACF;AAEO,IAAM,uBAAuB;AAAA,EAClC,iBAAiB;AAAA,IACf,EAAE,MAAM,cAAc,MAAM,UAAU;AAAA,IACtC,EAAE,MAAM,oBAAoB,MAAM,UAAU;AAAA,IAC5C,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAClC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACjC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,IACpC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,EACnC;AACF;AAMO,IAAM,mBAAgD;AAAA,EAC3D,MAAM,EAAE,MAAM,OAAO;AACvB;AAEO,IAAM,sBAA+C;AAAA,EAC1D,MAAM;AACR;AAEO,IAAM,6BAAsD;AAAA,EACjE,MAAM;AACR;AAEO,IAAM,gBAAyD;AAAA;AAAA,EAEpE,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAEO,IAAM,eAA0C;AAAA;AAAA,EAErD,MAAM;AAAA;AAAA,IAEJ;AAAA,MACE,WAAW;AAAA,MACX,WAAW;AAAA,MACX,KAAK;AAAA,MACL,aAAa;AAAA,MACb,OAAO;AAAA,IACT;AAAA;AAAA,IAEA;AAAA,MACE,WAAW;AAAA,MACX,WAAW;AAAA,MACX,KAAK;AAAA,MACL,aAAa;AAAA,MACb,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,IAAM,oBAAgE;AAAA;AAE7E;AAOO,IAAM,kBAA2B;AAcjC,IAAM,kBAA2B;AAGjC,IAAM,kBAA2B;","names":[]}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { Address, Hex, PublicClient } from 'viem';
|
|
2
|
-
import { Q as QuoteResult, d as PathKey } from './types-JyuXUM8C.cjs';
|
|
3
|
-
|
|
4
|
-
declare function checkAllowance(client: PublicClient, token: Address, owner: Address, spender: Address): Promise<bigint>;
|
|
5
|
-
/**
|
|
6
|
-
* Encode an ERC-20 approve(spender, amount) call.
|
|
7
|
-
*/
|
|
8
|
-
declare function buildErc20ApprovalCalldata(spender: Address, amount: bigint): Hex;
|
|
9
|
-
/**
|
|
10
|
-
* Encode a Permit2 approve(token, spender, amount, expiration) call.
|
|
11
|
-
*/
|
|
12
|
-
declare function buildPermit2ApprovalCalldata(token: Address, spender: Address, amount: bigint, expiration: number): Hex;
|
|
13
|
-
|
|
14
|
-
/** UniversalRouter command byte for V4 swap */
|
|
15
|
-
declare const V4_SWAP: 16;
|
|
16
|
-
declare const SWAP_EXACT_IN: 7;
|
|
17
|
-
declare const SETTLE_ALL: 12;
|
|
18
|
-
declare const TAKE_ALL: 15;
|
|
19
|
-
/**
|
|
20
|
-
* Build the calldata inputs[0] (the V4_SWAP command payload) for
|
|
21
|
-
* UniversalRouter.execute.
|
|
22
|
-
*
|
|
23
|
-
* Actions encoded: SWAP_EXACT_IN → SETTLE_ALL → TAKE_ALL
|
|
24
|
-
*
|
|
25
|
-
* Encoding matches the Uniswap V4 SDK's V4Planner — each action's params
|
|
26
|
-
* are individually ABI-encoded, then wrapped together with the action bytes.
|
|
27
|
-
*/
|
|
28
|
-
declare function buildV4SwapInput(currencyIn: Address, path: PathKey[], amountIn: bigint, minAmountOut: bigint, outputCurrency: Address): Hex;
|
|
29
|
-
/**
|
|
30
|
-
* Build the full commands + inputs args for UniversalRouter.execute.
|
|
31
|
-
*/
|
|
32
|
-
declare function buildUniversalRouterExecuteArgs(currencyIn: Address, path: PathKey[], amountIn: bigint, minAmountOut: bigint, outputCurrency: Address): {
|
|
33
|
-
commands: Hex;
|
|
34
|
-
inputs: Hex[];
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Build UniversalRouter execute args from a quote result.
|
|
38
|
-
*
|
|
39
|
-
* Takes the output of `findBestQuote` / `quoteBestRoute` and produces
|
|
40
|
-
* ready-to-use `{ commands, inputs }` for `UniversalRouter.execute`.
|
|
41
|
-
*
|
|
42
|
-
* @param quote - Quote result containing the path
|
|
43
|
-
* @param currencyIn - Input token address
|
|
44
|
-
* @param currencyOut - Output token address
|
|
45
|
-
* @param amountIn - Exact input amount (same value passed to the quoter)
|
|
46
|
-
* @param minAmountOut - Minimum acceptable output (caller applies slippage)
|
|
47
|
-
*
|
|
48
|
-
* @deprecated Since v1.4 — the Issuer App no longer handles swaps.
|
|
49
|
-
* For the new PT→USDT batch call on PAFI Web (Scenario 4 with
|
|
50
|
-
* EIP-7702 gas deduction), use `buildSwapWithGasDeduction()` (v1.5).
|
|
51
|
-
* This helper is kept for legacy v0.2.x consumers; will be removed in v2.0.
|
|
52
|
-
*/
|
|
53
|
-
declare function buildSwapFromQuote(params: {
|
|
54
|
-
quote: QuoteResult;
|
|
55
|
-
currencyIn: Address;
|
|
56
|
-
currencyOut: Address;
|
|
57
|
-
amountIn: bigint;
|
|
58
|
-
minAmountOut: bigint;
|
|
59
|
-
}): {
|
|
60
|
-
commands: Hex;
|
|
61
|
-
inputs: Hex[];
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
interface SwapSimulationResult {
|
|
65
|
-
success: boolean;
|
|
66
|
-
gasEstimate: bigint;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Simulate a UniversalRouter.execute swap call via eth_call (no gas spent).
|
|
70
|
-
*
|
|
71
|
-
* Runs the full V4 swap flow — token transfer via Permit2, swap via
|
|
72
|
-
* PoolManager, output settlement — without submitting a transaction.
|
|
73
|
-
* If the simulation reverts, throws a `SimulationError` with the reason.
|
|
74
|
-
*
|
|
75
|
-
* @param client - viem PublicClient
|
|
76
|
-
* @param routerAddress - UniversalRouter contract address
|
|
77
|
-
* @param commands - Packed command bytes (from buildSwapFromQuote)
|
|
78
|
-
* @param inputs - Encoded inputs per command (from buildSwapFromQuote)
|
|
79
|
-
* @param deadline - Unix timestamp after which the tx expires
|
|
80
|
-
* @param from - Address that will execute the swap
|
|
81
|
-
*/
|
|
82
|
-
declare function simulateSwap(client: PublicClient, routerAddress: Address, commands: Hex, inputs: Hex[], deadline: bigint, from: Address): Promise<SwapSimulationResult>;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* A single call inside a batch. `BatchExecutor.execute(Call[])` iterates
|
|
86
|
-
* and invokes each one. When the batch runs via EIP-7702 delegation,
|
|
87
|
-
* `msg.sender` for each call is the user's EOA.
|
|
88
|
-
*/
|
|
89
|
-
interface Operation {
|
|
90
|
-
target: Address;
|
|
91
|
-
value: bigint;
|
|
92
|
-
data: Hex;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Paymaster fields attached to a UserOperation. Populated by the
|
|
96
|
-
* Coinbase Paymaster (via PAFI Backend proxy) before the user signs.
|
|
97
|
-
*/
|
|
98
|
-
interface PaymasterFields {
|
|
99
|
-
paymaster: Address;
|
|
100
|
-
paymasterData: Hex;
|
|
101
|
-
paymasterVerificationGasLimit: bigint;
|
|
102
|
-
paymasterPostOpGasLimit: bigint;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Partial UserOp used during preparation — before paymaster fields are
|
|
106
|
-
* attached or the user signs.
|
|
107
|
-
*/
|
|
108
|
-
interface PartialUserOperation {
|
|
109
|
-
sender: Address;
|
|
110
|
-
nonce: bigint;
|
|
111
|
-
callData: Hex;
|
|
112
|
-
callGasLimit: bigint;
|
|
113
|
-
verificationGasLimit: bigint;
|
|
114
|
-
preVerificationGas: bigint;
|
|
115
|
-
maxFeePerGas: bigint;
|
|
116
|
-
maxPriorityFeePerGas: bigint;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Full ERC-4337 v0.7 UserOperation, ready for bundler submission.
|
|
120
|
-
*/
|
|
121
|
-
interface UserOperation extends PartialUserOperation {
|
|
122
|
-
paymaster: Address;
|
|
123
|
-
paymasterData: Hex;
|
|
124
|
-
paymasterVerificationGasLimit: bigint;
|
|
125
|
-
paymasterPostOpGasLimit: bigint;
|
|
126
|
-
signature: Hex;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Receipt returned by a bundler after a UserOp lands on-chain.
|
|
130
|
-
*/
|
|
131
|
-
interface UserOpReceipt {
|
|
132
|
-
userOpHash: Hex;
|
|
133
|
-
success: boolean;
|
|
134
|
-
txHash: Hex;
|
|
135
|
-
blockNumber: bigint;
|
|
136
|
-
gasUsed: bigint;
|
|
137
|
-
/** Effective gas cost paid (wei). */
|
|
138
|
-
actualGasCost: bigint;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Sentinel operation value used in tests + docs when `Operation.value`
|
|
142
|
-
* is irrelevant (ERC-20 transfers, for example).
|
|
143
|
-
*/
|
|
144
|
-
declare const ZERO_VALUE = 0n;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* v1.5 — Scenario 4: Swap PT → USDT on PAFI Web with gas fee
|
|
148
|
-
* deducted in PT from the user's balance.
|
|
149
|
-
*
|
|
150
|
-
* Builds an unsigned `PartialUserOperation` that packages up to four
|
|
151
|
-
* inner calls into a single `BatchExecutor.execute(calls[])`:
|
|
152
|
-
*
|
|
153
|
-
* 1. `PT.approve(Permit2, amountIn)` — grant Permit2 ERC-20 allowance
|
|
154
|
-
* 2. `Permit2.approve(PT, router, amountIn, deadline)` — authorize
|
|
155
|
-
* the UniversalRouter to pull PT via Permit2
|
|
156
|
-
* 3. `UniversalRouter.execute(commands, inputs, deadline)` — V4 swap
|
|
157
|
-
* PT → USDT; user receives ≥ `minAmountOut` USDT
|
|
158
|
-
* 4. `PT.transfer(feeRecipient, gasFeePt)` — pay the operator back
|
|
159
|
-
* for sponsoring the gas, in PT (omitted when `gasFeePt` is 0)
|
|
160
|
-
*
|
|
161
|
-
* The user's wallet must hold `amountIn + gasFeePt` PT before the
|
|
162
|
-
* UserOp runs. All inner calls execute atomically via EIP-7702
|
|
163
|
-
* delegation (`msg.sender = user`), so a reverting swap unwinds
|
|
164
|
-
* the approvals and fee transfer too.
|
|
165
|
-
*
|
|
166
|
-
* ## Fee model
|
|
167
|
-
*
|
|
168
|
-
* The gas fee is a separate `transfer` after the swap — it does NOT
|
|
169
|
-
* come out of the USDT output, because that output goes straight to
|
|
170
|
-
* the user's wallet with no intermediate hook.
|
|
171
|
-
*
|
|
172
|
-
* If the FE wants "user receives exactly X USDT after gas":
|
|
173
|
-
* 1. Quote PT→USDT for candidate `amountIn` values
|
|
174
|
-
* 2. Pick an `amountIn` where `minAmountOut ≈ X`
|
|
175
|
-
* 3. Separately compute `gasFeePt` from the operator's rate
|
|
176
|
-
* 4. Ensure user's PT balance ≥ `amountIn + gasFeePt`
|
|
177
|
-
*
|
|
178
|
-
* ## Order of operations
|
|
179
|
-
*
|
|
180
|
-
* Fee transfer is last so a reverting swap also refunds the fee
|
|
181
|
-
* (atomic batch revert semantics).
|
|
182
|
-
*/
|
|
183
|
-
interface BuildSwapWithGasDeductionParams {
|
|
184
|
-
/** User's EOA (with EIP-7702 delegation to BatchExecutor). */
|
|
185
|
-
userAddress: Address;
|
|
186
|
-
/** ERC-4337 account nonce — fetched from EntryPoint by the caller. */
|
|
187
|
-
aaNonce: bigint;
|
|
188
|
-
/** PT token address being swapped. */
|
|
189
|
-
pointTokenAddress: Address;
|
|
190
|
-
/** Destination currency (typically USDT). */
|
|
191
|
-
outputTokenAddress: Address;
|
|
192
|
-
/** UniversalRouter contract address (chain-specific). */
|
|
193
|
-
universalRouterAddress: Address;
|
|
194
|
-
/** PT units to swap. User's balance must be ≥ `amountIn + gasFeePt`. */
|
|
195
|
-
amountIn: bigint;
|
|
196
|
-
/**
|
|
197
|
-
* Minimum USDT to accept out of the swap. Caller applies slippage
|
|
198
|
-
* (typically ~0.5-1%) against a fresh quote. Sub-minimum swap reverts.
|
|
199
|
-
*/
|
|
200
|
-
minAmountOut: bigint;
|
|
201
|
-
/** V4 pool path for the swap. Single-hop = 1 PathKey. */
|
|
202
|
-
swapPath: PathKey[];
|
|
203
|
-
/** Unix seconds. After this, the router rejects the swap. */
|
|
204
|
-
deadline: bigint;
|
|
205
|
-
/** PT amount transferred to `feeRecipient` as gas fee recovery. */
|
|
206
|
-
gasFeePt: bigint;
|
|
207
|
-
/** Where the gas fee lands — typically the operator or fee collector. */
|
|
208
|
-
feeRecipient: Address;
|
|
209
|
-
/** Override ERC-4337 gas estimates. Defaults are conservative; tune down for cheaper UserOps. */
|
|
210
|
-
gasLimits?: {
|
|
211
|
-
callGasLimit?: bigint;
|
|
212
|
-
verificationGasLimit?: bigint;
|
|
213
|
-
preVerificationGas?: bigint;
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Build an unsigned UserOp for Scenario 4. Returns a
|
|
218
|
-
* `PartialUserOperation` — caller attaches paymaster sponsorship (via
|
|
219
|
-
* `POST /api/paymaster/sponsor`), adds the user's UserOp-hash
|
|
220
|
-
* signature, and submits to the Bundler.
|
|
221
|
-
*
|
|
222
|
-
* @throws when `amountIn` or `gasFeePt` is not positive, or when
|
|
223
|
-
* `swapPath` is empty (at least one PathKey required).
|
|
224
|
-
*/
|
|
225
|
-
declare function buildSwapWithGasDeduction(params: BuildSwapWithGasDeductionParams): PartialUserOperation;
|
|
226
|
-
|
|
227
|
-
export { type BuildSwapWithGasDeductionParams as B, type Operation as O, type PartialUserOperation as P, type SwapSimulationResult as S, TAKE_ALL as T, type UserOperation as U, V4_SWAP as V, ZERO_VALUE as Z, type PaymasterFields as a, SETTLE_ALL as b, SWAP_EXACT_IN as c, type UserOpReceipt as d, buildErc20ApprovalCalldata as e, buildPermit2ApprovalCalldata as f, buildSwapFromQuote as g, buildSwapWithGasDeduction as h, buildUniversalRouterExecuteArgs as i, buildV4SwapInput as j, checkAllowance as k, simulateSwap as s };
|