@pafi-dev/core 0.5.21 → 0.6.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/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 +215 -166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -48
- package/dist/index.d.ts +116 -48
- package/dist/index.js +197 -148
- package/dist/index.js.map +1 -1
- package/package.json +1 -31
- package/dist/chunk-2PIXFXA2.js +0 -135
- package/dist/chunk-2PIXFXA2.js.map +0 -1
- package/dist/chunk-CL3QSI4O.cjs +0 -65
- package/dist/chunk-CL3QSI4O.cjs.map +0 -1
- package/dist/chunk-DX73FB4P.cjs +0 -143
- package/dist/chunk-DX73FB4P.cjs.map +0 -1
- package/dist/chunk-IPXARZ6F.cjs +0 -135
- package/dist/chunk-IPXARZ6F.cjs.map +0 -1
- package/dist/chunk-JJ2LGENO.cjs +0 -373
- package/dist/chunk-JJ2LGENO.cjs.map +0 -1
- package/dist/chunk-KFWZRL7I.js +0 -65
- package/dist/chunk-KFWZRL7I.js.map +0 -1
- package/dist/chunk-L5UHQQVC.cjs +0 -136
- package/dist/chunk-L5UHQQVC.cjs.map +0 -1
- package/dist/chunk-R6OFGVMP.cjs.map +0 -1
- package/dist/chunk-TXA4GK5C.js.map +0 -1
- package/dist/chunk-VG23GIWQ.js +0 -373
- package/dist/chunk-VG23GIWQ.js.map +0 -1
- package/dist/chunk-WAFUL62X.js +0 -136
- package/dist/chunk-WAFUL62X.js.map +0 -1
- package/dist/chunk-X2JZFK4C.cjs +0 -87
- package/dist/chunk-X2JZFK4C.cjs.map +0 -1
- package/dist/chunk-Y2MZ7MKJ.js.map +0 -1
- package/dist/chunk-Y3HMGOYW.js +0 -87
- package/dist/chunk-Y3HMGOYW.js.map +0 -1
- package/dist/index-3C_HdEIm.d.cts +0 -227
- package/dist/index-DKtVEoRC.d.ts +0 -227
- package/dist/quoting/index.cjs +0 -19
- package/dist/quoting/index.cjs.map +0 -1
- package/dist/quoting/index.d.cts +0 -59
- package/dist/quoting/index.d.ts +0 -59
- package/dist/quoting/index.js +0 -19
- package/dist/quoting/index.js.map +0 -1
- package/dist/swap/index.cjs +0 -31
- package/dist/swap/index.cjs.map +0 -1
- package/dist/swap/index.d.cts +0 -3
- package/dist/swap/index.d.ts +0 -3
- package/dist/swap/index.js +0 -31
- package/dist/swap/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
erc20Abi,
|
|
3
|
+
permit2Abi,
|
|
4
|
+
pointTokenFactoryAbi,
|
|
5
|
+
universalRouterAbi,
|
|
6
|
+
v4QuoterAbi
|
|
7
|
+
} from "./chunk-6CXTFOIH.js";
|
|
4
8
|
import {
|
|
5
9
|
SPONSOR_AUTH_DOMAIN_NAME,
|
|
6
10
|
SPONSOR_AUTH_TYPES,
|
|
@@ -33,62 +37,6 @@ import {
|
|
|
33
37
|
mintingOracleAbi,
|
|
34
38
|
pointTokenAbi
|
|
35
39
|
} from "./chunk-5JZOJIBT.js";
|
|
36
|
-
import {
|
|
37
|
-
buildBurnRequestTypedData,
|
|
38
|
-
buildDomain,
|
|
39
|
-
buildMintRequestTypedData,
|
|
40
|
-
buildReceiverConsentTypedData,
|
|
41
|
-
signBurnRequest,
|
|
42
|
-
signMintRequest,
|
|
43
|
-
signReceiverConsent,
|
|
44
|
-
verifyBurnRequest,
|
|
45
|
-
verifyMintRequest,
|
|
46
|
-
verifyReceiverConsent
|
|
47
|
-
} from "./chunk-TXA4GK5C.js";
|
|
48
|
-
import {
|
|
49
|
-
buildAllPaths,
|
|
50
|
-
combineRoutes,
|
|
51
|
-
findBestQuote,
|
|
52
|
-
quoteBestRoute,
|
|
53
|
-
quoteExactInput,
|
|
54
|
-
quoteExactInputSingle
|
|
55
|
-
} from "./chunk-WAFUL62X.js";
|
|
56
|
-
import {
|
|
57
|
-
v4QuoterAbi
|
|
58
|
-
} from "./chunk-KFWZRL7I.js";
|
|
59
|
-
import {
|
|
60
|
-
ApiError,
|
|
61
|
-
BATCH_EXECUTOR_ABI,
|
|
62
|
-
ConfigurationError,
|
|
63
|
-
PafiSDKError,
|
|
64
|
-
SETTLE_ALL,
|
|
65
|
-
SWAP_EXACT_IN,
|
|
66
|
-
SigningError,
|
|
67
|
-
SimulationError,
|
|
68
|
-
TAKE_ALL,
|
|
69
|
-
V4_SWAP,
|
|
70
|
-
assembleUserOperation,
|
|
71
|
-
buildErc20ApprovalCalldata,
|
|
72
|
-
buildPartialUserOperation,
|
|
73
|
-
buildPermit2ApprovalCalldata,
|
|
74
|
-
buildSwapFromQuote,
|
|
75
|
-
buildSwapWithGasDeduction,
|
|
76
|
-
buildUniversalRouterExecuteArgs,
|
|
77
|
-
buildV4SwapInput,
|
|
78
|
-
checkAllowance,
|
|
79
|
-
decodeBatchExecuteCalls,
|
|
80
|
-
encodeBatchExecute,
|
|
81
|
-
erc20ApproveOp,
|
|
82
|
-
erc20BurnOp,
|
|
83
|
-
erc20TransferOp,
|
|
84
|
-
rawCallOp,
|
|
85
|
-
simulateSwap
|
|
86
|
-
} from "./chunk-VG23GIWQ.js";
|
|
87
|
-
import {
|
|
88
|
-
erc20Abi,
|
|
89
|
-
permit2Abi,
|
|
90
|
-
universalRouterAbi
|
|
91
|
-
} from "./chunk-2PIXFXA2.js";
|
|
92
40
|
import {
|
|
93
41
|
COMMON_POOLS,
|
|
94
42
|
COMMON_TOKENS,
|
|
@@ -99,16 +47,64 @@ import {
|
|
|
99
47
|
SUPPORTED_CHAINS,
|
|
100
48
|
UNIVERSAL_ROUTER_ADDRESSES,
|
|
101
49
|
V4_QUOTER_ADDRESSES,
|
|
50
|
+
buildBurnRequestTypedData,
|
|
51
|
+
buildDomain,
|
|
52
|
+
buildMintRequestTypedData,
|
|
53
|
+
buildReceiverConsentTypedData,
|
|
102
54
|
burnRequestTypes,
|
|
103
55
|
mintRequestTypes,
|
|
104
|
-
receiverConsentTypes
|
|
105
|
-
|
|
56
|
+
receiverConsentTypes,
|
|
57
|
+
signBurnRequest,
|
|
58
|
+
signMintRequest,
|
|
59
|
+
signReceiverConsent,
|
|
60
|
+
verifyBurnRequest,
|
|
61
|
+
verifyMintRequest,
|
|
62
|
+
verifyReceiverConsent
|
|
63
|
+
} from "./chunk-UOKI5GG6.js";
|
|
106
64
|
|
|
107
65
|
// src/index.ts
|
|
108
66
|
import { createPublicClient, http as http2 } from "viem";
|
|
109
67
|
|
|
68
|
+
// src/errors.ts
|
|
69
|
+
var PafiSDKError = class extends Error {
|
|
70
|
+
constructor(message) {
|
|
71
|
+
super(message);
|
|
72
|
+
this.name = "PafiSDKError";
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var ConfigurationError = class extends PafiSDKError {
|
|
76
|
+
constructor(message) {
|
|
77
|
+
super(message);
|
|
78
|
+
this.name = "ConfigurationError";
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var SigningError = class extends PafiSDKError {
|
|
82
|
+
constructor(message) {
|
|
83
|
+
super(message);
|
|
84
|
+
this.name = "SigningError";
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var SimulationError = class extends PafiSDKError {
|
|
88
|
+
constructor(operation, reason) {
|
|
89
|
+
super(`Simulation failed for ${operation}: ${reason}`);
|
|
90
|
+
this.operation = operation;
|
|
91
|
+
this.reason = reason;
|
|
92
|
+
this.name = "SimulationError";
|
|
93
|
+
}
|
|
94
|
+
operation;
|
|
95
|
+
reason;
|
|
96
|
+
};
|
|
97
|
+
var ApiError = class extends PafiSDKError {
|
|
98
|
+
constructor(message, status) {
|
|
99
|
+
super(message);
|
|
100
|
+
this.status = status;
|
|
101
|
+
this.name = "ApiError";
|
|
102
|
+
}
|
|
103
|
+
status;
|
|
104
|
+
};
|
|
105
|
+
|
|
110
106
|
// src/perp/buildPerpDepositWithGasDeduction.ts
|
|
111
|
-
import { encodeFunctionData } from "viem";
|
|
107
|
+
import { encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
112
108
|
|
|
113
109
|
// src/contracts/real/orderlyVault.ts
|
|
114
110
|
import { keccak256, encodePacked, encodeAbiParameters } from "viem";
|
|
@@ -199,6 +195,106 @@ var ORDERLY_VAULT_ABI = [
|
|
|
199
195
|
}
|
|
200
196
|
];
|
|
201
197
|
|
|
198
|
+
// src/userop/operations.ts
|
|
199
|
+
import { encodeFunctionData, erc20Abi as erc20Abi2, parseAbi } from "viem";
|
|
200
|
+
var ERC20_BURNABLE_ABI = parseAbi(["function burn(uint256 amount)"]);
|
|
201
|
+
function erc20TransferOp(token, to, amount) {
|
|
202
|
+
return {
|
|
203
|
+
target: token,
|
|
204
|
+
value: 0n,
|
|
205
|
+
data: encodeFunctionData({
|
|
206
|
+
abi: erc20Abi2,
|
|
207
|
+
functionName: "transfer",
|
|
208
|
+
args: [to, amount]
|
|
209
|
+
})
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function erc20ApproveOp(token, spender, amount) {
|
|
213
|
+
return {
|
|
214
|
+
target: token,
|
|
215
|
+
value: 0n,
|
|
216
|
+
data: encodeFunctionData({
|
|
217
|
+
abi: erc20Abi2,
|
|
218
|
+
functionName: "approve",
|
|
219
|
+
args: [spender, amount]
|
|
220
|
+
})
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function erc20BurnOp(token, amount) {
|
|
224
|
+
return {
|
|
225
|
+
target: token,
|
|
226
|
+
value: 0n,
|
|
227
|
+
data: encodeFunctionData({
|
|
228
|
+
abi: ERC20_BURNABLE_ABI,
|
|
229
|
+
functionName: "burn",
|
|
230
|
+
args: [amount]
|
|
231
|
+
})
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function rawCallOp(target, data, value = 0n) {
|
|
235
|
+
return { target, value, data };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/userop/batchExecute.ts
|
|
239
|
+
import { decodeFunctionData, encodeFunctionData as encodeFunctionData2, parseAbi as parseAbi2 } from "viem";
|
|
240
|
+
var BATCH_EXECUTOR_ABI = parseAbi2([
|
|
241
|
+
"function executeBatch((address target, uint256 value, bytes data)[] calls)"
|
|
242
|
+
]);
|
|
243
|
+
function encodeBatchExecute(operations) {
|
|
244
|
+
if (operations.length === 0) {
|
|
245
|
+
throw new Error("encodeBatchExecute: operations array must not be empty");
|
|
246
|
+
}
|
|
247
|
+
return encodeFunctionData2({
|
|
248
|
+
abi: BATCH_EXECUTOR_ABI,
|
|
249
|
+
functionName: "executeBatch",
|
|
250
|
+
args: [
|
|
251
|
+
operations.map((op) => ({
|
|
252
|
+
target: op.target,
|
|
253
|
+
value: op.value,
|
|
254
|
+
data: op.data
|
|
255
|
+
}))
|
|
256
|
+
]
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function decodeBatchExecuteCalls(callData) {
|
|
260
|
+
const { args } = decodeFunctionData({
|
|
261
|
+
abi: BATCH_EXECUTOR_ABI,
|
|
262
|
+
data: callData
|
|
263
|
+
});
|
|
264
|
+
return args[0].map((c) => ({
|
|
265
|
+
to: c.target,
|
|
266
|
+
data: c.data,
|
|
267
|
+
value: c.value.toString()
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// src/userop/buildUserOperation.ts
|
|
272
|
+
var DEFAULT_CALL_GAS_LIMIT = 500000n;
|
|
273
|
+
var DEFAULT_VERIFICATION_GAS_LIMIT = 150000n;
|
|
274
|
+
var DEFAULT_PRE_VERIFICATION_GAS = 50000n;
|
|
275
|
+
function buildPartialUserOperation(params) {
|
|
276
|
+
return {
|
|
277
|
+
sender: params.sender,
|
|
278
|
+
nonce: params.nonce,
|
|
279
|
+
callData: encodeBatchExecute(params.operations),
|
|
280
|
+
callGasLimit: params.gasLimits?.callGasLimit ?? DEFAULT_CALL_GAS_LIMIT,
|
|
281
|
+
verificationGasLimit: params.gasLimits?.verificationGasLimit ?? DEFAULT_VERIFICATION_GAS_LIMIT,
|
|
282
|
+
preVerificationGas: params.gasLimits?.preVerificationGas ?? DEFAULT_PRE_VERIFICATION_GAS,
|
|
283
|
+
maxFeePerGas: params.feeOverrides?.maxFeePerGas ?? 0n,
|
|
284
|
+
maxPriorityFeePerGas: params.feeOverrides?.maxPriorityFeePerGas ?? 0n
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function assembleUserOperation(partial, paymaster, signature) {
|
|
288
|
+
return {
|
|
289
|
+
...partial,
|
|
290
|
+
paymaster: paymaster.paymaster,
|
|
291
|
+
paymasterData: paymaster.paymasterData,
|
|
292
|
+
paymasterVerificationGasLimit: paymaster.paymasterVerificationGasLimit,
|
|
293
|
+
paymasterPostOpGasLimit: paymaster.paymasterPostOpGasLimit,
|
|
294
|
+
signature
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
202
298
|
// src/perp/buildPerpDepositWithGasDeduction.ts
|
|
203
299
|
function buildPerpDepositWithGasDeduction(params) {
|
|
204
300
|
if (params.amount <= 0n) {
|
|
@@ -220,7 +316,7 @@ function buildPerpDepositWithGasDeduction(params) {
|
|
|
220
316
|
`buildPerpDepositWithGasDeduction: no Orderly Vault address for chainId ${params.chainId}`
|
|
221
317
|
);
|
|
222
318
|
}
|
|
223
|
-
const depositCallData =
|
|
319
|
+
const depositCallData = encodeFunctionData3({
|
|
224
320
|
abi: ORDERLY_VAULT_ABI,
|
|
225
321
|
functionName: "deposit",
|
|
226
322
|
args: [params.depositData]
|
|
@@ -248,7 +344,7 @@ function buildPerpDepositWithGasDeduction(params) {
|
|
|
248
344
|
}
|
|
249
345
|
|
|
250
346
|
// src/perp/buildPerpDepositViaRelay.ts
|
|
251
|
-
import { encodeFunctionData as
|
|
347
|
+
import { encodeFunctionData as encodeFunctionData4, erc20Abi as erc20Abi3 } from "viem";
|
|
252
348
|
var ORDERLY_RELAY_ABI = [
|
|
253
349
|
{
|
|
254
350
|
type: "function",
|
|
@@ -314,8 +410,8 @@ function buildPerpDepositViaRelay(params) {
|
|
|
314
410
|
operations.push({
|
|
315
411
|
target: params.pointTokenAddress,
|
|
316
412
|
value: 0n,
|
|
317
|
-
data:
|
|
318
|
-
abi:
|
|
413
|
+
data: encodeFunctionData4({
|
|
414
|
+
abi: erc20Abi3,
|
|
319
415
|
functionName: "transfer",
|
|
320
416
|
args: [params.gasFeePtRecipient, params.gasFeePt]
|
|
321
417
|
})
|
|
@@ -328,7 +424,7 @@ function buildPerpDepositViaRelay(params) {
|
|
|
328
424
|
params.request.totalAmount
|
|
329
425
|
)
|
|
330
426
|
);
|
|
331
|
-
const depositCallData =
|
|
427
|
+
const depositCallData = encodeFunctionData4({
|
|
332
428
|
abi: ORDERLY_RELAY_ABI,
|
|
333
429
|
functionName: "deposit",
|
|
334
430
|
args: [
|
|
@@ -586,6 +682,37 @@ function toMinimalHex(n) {
|
|
|
586
682
|
return `0x${hex.length % 2 === 0 ? hex : "0" + hex}`;
|
|
587
683
|
}
|
|
588
684
|
|
|
685
|
+
// src/delegation/eip7702Authorization.ts
|
|
686
|
+
function splitAuthorizationSig(authSig) {
|
|
687
|
+
const raw = authSig.startsWith("0x") ? authSig.slice(2) : authSig;
|
|
688
|
+
if (raw.length !== 130) {
|
|
689
|
+
throw new Error(
|
|
690
|
+
`splitAuthorizationSig: expected 65-byte signature (130 hex chars), got ${raw.length}`
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
const r = `0x${raw.slice(0, 64)}`;
|
|
694
|
+
const s = `0x${raw.slice(64, 128)}`;
|
|
695
|
+
const v = parseInt(raw.slice(128, 130), 16);
|
|
696
|
+
const yParity = v === 27 ? 0 : v === 28 ? 1 : v;
|
|
697
|
+
if (yParity !== 0 && yParity !== 1) {
|
|
698
|
+
throw new Error(
|
|
699
|
+
`splitAuthorizationSig: invalid recovery byte ${v} (expected 0/1/27/28)`
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
return { r, s, yParity };
|
|
703
|
+
}
|
|
704
|
+
function buildEip7702Authorization(params) {
|
|
705
|
+
const { r, s, yParity } = splitAuthorizationSig(params.authSig);
|
|
706
|
+
return {
|
|
707
|
+
chainId: `0x${params.chainId.toString(16)}`,
|
|
708
|
+
address: params.address,
|
|
709
|
+
nonce: `0x${params.nonce.toString(16)}`,
|
|
710
|
+
r,
|
|
711
|
+
s,
|
|
712
|
+
yParity: `0x${yParity}`
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
|
|
589
716
|
// src/transport/proxyTransport.ts
|
|
590
717
|
import { http } from "viem";
|
|
591
718
|
function createPafiProxyTransport(params) {
|
|
@@ -626,7 +753,7 @@ async function sendWithPaymasterFallback(params) {
|
|
|
626
753
|
}
|
|
627
754
|
|
|
628
755
|
// src/fee/operatorFeeQuoter.ts
|
|
629
|
-
import { parseAbi } from "viem";
|
|
756
|
+
import { parseAbi as parseAbi3 } from "viem";
|
|
630
757
|
|
|
631
758
|
// src/subgraph/pools.ts
|
|
632
759
|
import { isAddress } from "viem";
|
|
@@ -753,7 +880,7 @@ function getContractAddresses(chainId) {
|
|
|
753
880
|
}
|
|
754
881
|
|
|
755
882
|
// src/fee/operatorFeeQuoter.ts
|
|
756
|
-
var CHAINLINK_ABI =
|
|
883
|
+
var CHAINLINK_ABI = parseAbi3([
|
|
757
884
|
"function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80)"
|
|
758
885
|
]);
|
|
759
886
|
var CHAINLINK_MAX_AGE_S = 3600n;
|
|
@@ -1004,8 +1131,6 @@ var PafiSDK = class {
|
|
|
1004
1131
|
// -------------------------------------------------------------------------
|
|
1005
1132
|
mint;
|
|
1006
1133
|
consent;
|
|
1007
|
-
swap;
|
|
1008
|
-
quote;
|
|
1009
1134
|
auth;
|
|
1010
1135
|
constructor(config) {
|
|
1011
1136
|
this._pointTokenAddress = config.pointTokenAddress;
|
|
@@ -1030,13 +1155,6 @@ var PafiSDK = class {
|
|
|
1030
1155
|
verify: this.verifyReceiverConsent.bind(this),
|
|
1031
1156
|
getNonce: this.getReceiverConsentNonce.bind(this)
|
|
1032
1157
|
};
|
|
1033
|
-
this.swap = {
|
|
1034
|
-
buildFromQuote: this.buildSwapFromQuote.bind(this),
|
|
1035
|
-
simulate: this.simulateSwap.bind(this)
|
|
1036
|
-
};
|
|
1037
|
-
this.quote = {
|
|
1038
|
-
findBest: this.findBestQuote.bind(this)
|
|
1039
|
-
};
|
|
1040
1158
|
this.auth = {
|
|
1041
1159
|
createLoginMessage: this.createLoginMessage.bind(this),
|
|
1042
1160
|
signMessage: this.signLoginMessage.bind(this)
|
|
@@ -1136,59 +1254,6 @@ var PafiSDK = class {
|
|
|
1136
1254
|
);
|
|
1137
1255
|
}
|
|
1138
1256
|
// -------------------------------------------------------------------------
|
|
1139
|
-
// Quoting — delegates to pure functions
|
|
1140
|
-
// -------------------------------------------------------------------------
|
|
1141
|
-
/**
|
|
1142
|
-
* Find the best swap route from `tokenIn` to `tokenOut`.
|
|
1143
|
-
* Merges `pools` with COMMON_POOLS for the configured chain, builds all
|
|
1144
|
-
* paths, and quotes via a single multicall RPC call.
|
|
1145
|
-
*/
|
|
1146
|
-
async findBestQuote(tokenIn, tokenOut, exactAmount, pools = [], quoterAddress, maxHops) {
|
|
1147
|
-
return findBestQuote(
|
|
1148
|
-
this.requireProvider(),
|
|
1149
|
-
this.requireChainId(),
|
|
1150
|
-
tokenIn,
|
|
1151
|
-
tokenOut,
|
|
1152
|
-
exactAmount,
|
|
1153
|
-
pools,
|
|
1154
|
-
quoterAddress,
|
|
1155
|
-
maxHops
|
|
1156
|
-
);
|
|
1157
|
-
}
|
|
1158
|
-
// -------------------------------------------------------------------------
|
|
1159
|
-
// Swap building — delegates to pure functions
|
|
1160
|
-
// -------------------------------------------------------------------------
|
|
1161
|
-
/**
|
|
1162
|
-
* Build UniversalRouter execute args from a quote result.
|
|
1163
|
-
* The caller provides `minAmountOut` after applying their own slippage.
|
|
1164
|
-
*/
|
|
1165
|
-
buildSwapFromQuote(params) {
|
|
1166
|
-
return buildSwapFromQuote(params);
|
|
1167
|
-
}
|
|
1168
|
-
// -------------------------------------------------------------------------
|
|
1169
|
-
// Simulation — dry-run via eth_call (no gas spent)
|
|
1170
|
-
// -------------------------------------------------------------------------
|
|
1171
|
-
/**
|
|
1172
|
-
* Simulate a UniversalRouter.execute swap call. Catches reverts (bad
|
|
1173
|
-
* approvals, insufficient balance, pool errors) before submitting.
|
|
1174
|
-
*
|
|
1175
|
-
* @param routerAddress - UniversalRouter contract address
|
|
1176
|
-
* @param commands - Packed command bytes (from buildSwapFromQuote)
|
|
1177
|
-
* @param inputs - Encoded inputs (from buildSwapFromQuote)
|
|
1178
|
-
* @param deadline - Unix timestamp
|
|
1179
|
-
* @param from - Address that will execute the swap
|
|
1180
|
-
*/
|
|
1181
|
-
async simulateSwap(routerAddress, commands, inputs, deadline, from) {
|
|
1182
|
-
return simulateSwap(
|
|
1183
|
-
this.requireProvider(),
|
|
1184
|
-
routerAddress,
|
|
1185
|
-
commands,
|
|
1186
|
-
inputs,
|
|
1187
|
-
deadline,
|
|
1188
|
-
from
|
|
1189
|
-
);
|
|
1190
|
-
}
|
|
1191
|
-
// -------------------------------------------------------------------------
|
|
1192
1257
|
// Auth — EIP-4361 login helpers (offline, stateless)
|
|
1193
1258
|
// -------------------------------------------------------------------------
|
|
1194
1259
|
async createLoginMessage(params) {
|
|
@@ -1236,46 +1301,34 @@ export {
|
|
|
1236
1301
|
pointTokenAbi as POINT_TOKEN_V2_ABI,
|
|
1237
1302
|
PafiSDK,
|
|
1238
1303
|
PafiSDKError,
|
|
1239
|
-
SETTLE_ALL,
|
|
1240
1304
|
SIMPLE_7702_IMPL_BASE_MAINNET,
|
|
1241
1305
|
SPONSOR_AUTH_DOMAIN_NAME,
|
|
1242
1306
|
SPONSOR_AUTH_TYPES,
|
|
1243
1307
|
SUPPORTED_CHAINS,
|
|
1244
|
-
SWAP_EXACT_IN,
|
|
1245
1308
|
SigningError,
|
|
1246
1309
|
SimulationError,
|
|
1247
|
-
TAKE_ALL,
|
|
1248
1310
|
TOKEN_HASHES,
|
|
1249
1311
|
UNIVERSAL_ROUTER_ADDRESSES,
|
|
1250
1312
|
V4_QUOTER_ADDRESSES,
|
|
1251
|
-
V4_SWAP,
|
|
1252
1313
|
ZERO_VALUE,
|
|
1253
1314
|
_resetPaymasterConfigForTests,
|
|
1254
1315
|
assembleUserOperation,
|
|
1255
|
-
buildAllPaths,
|
|
1256
1316
|
buildAndSignSponsorAuth,
|
|
1257
1317
|
buildBurnRequestTypedData,
|
|
1258
1318
|
buildDelegationUserOp,
|
|
1259
1319
|
buildDomain,
|
|
1260
|
-
|
|
1320
|
+
buildEip7702Authorization,
|
|
1261
1321
|
buildMintRequestTypedData,
|
|
1262
1322
|
buildPartialUserOperation,
|
|
1263
|
-
buildPermit2ApprovalCalldata,
|
|
1264
1323
|
buildPerpDepositViaRelay,
|
|
1265
1324
|
buildPerpDepositWithGasDeduction,
|
|
1266
1325
|
buildReceiverConsentTypedData,
|
|
1267
1326
|
buildSponsorAuthDomain,
|
|
1268
1327
|
buildSponsorAuthTypedData,
|
|
1269
|
-
buildSwapFromQuote,
|
|
1270
|
-
buildSwapWithGasDeduction,
|
|
1271
|
-
buildUniversalRouterExecuteArgs,
|
|
1272
1328
|
buildUserOpTypedData,
|
|
1273
|
-
buildV4SwapInput,
|
|
1274
1329
|
burnRequestTypes,
|
|
1275
|
-
checkAllowance,
|
|
1276
1330
|
checkDelegation,
|
|
1277
1331
|
checkEthAndBranch,
|
|
1278
|
-
combineRoutes,
|
|
1279
1332
|
computeAccountId,
|
|
1280
1333
|
computeAuthorizationHash,
|
|
1281
1334
|
computeCallDataHash,
|
|
@@ -1290,7 +1343,6 @@ export {
|
|
|
1290
1343
|
erc20BurnOp,
|
|
1291
1344
|
erc20TransferOp,
|
|
1292
1345
|
fetchPafiPools,
|
|
1293
|
-
findBestQuote,
|
|
1294
1346
|
getAaNonce,
|
|
1295
1347
|
getBurnRequestNonce,
|
|
1296
1348
|
getContractAddresses,
|
|
@@ -1321,9 +1373,6 @@ export {
|
|
|
1321
1373
|
permit2Abi,
|
|
1322
1374
|
pointTokenAbi,
|
|
1323
1375
|
pointTokenFactoryAbi,
|
|
1324
|
-
quoteBestRoute,
|
|
1325
|
-
quoteExactInput,
|
|
1326
|
-
quoteExactInputSingle,
|
|
1327
1376
|
quoteOperatorFeePt,
|
|
1328
1377
|
rawCallOp,
|
|
1329
1378
|
receiverConsentTypes,
|
|
@@ -1335,7 +1384,7 @@ export {
|
|
|
1335
1384
|
signMintRequest,
|
|
1336
1385
|
signReceiverConsent,
|
|
1337
1386
|
signSponsorAuth,
|
|
1338
|
-
|
|
1387
|
+
splitAuthorizationSig,
|
|
1339
1388
|
universalRouterAbi,
|
|
1340
1389
|
v4QuoterAbi,
|
|
1341
1390
|
verifyBurnRequest,
|