@uniswap/universal-router-sdk 4.23.0 → 4.25.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 +282 -0
- package/dist/entities/actions/across.d.ts +21 -0
- package/dist/entities/actions/index.d.ts +1 -0
- package/dist/entities/actions/uniswap.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/swapRouter.d.ts +46 -2
- package/dist/universal-router-sdk.cjs.development.js +311 -17
- package/dist/universal-router-sdk.cjs.development.js.map +1 -1
- package/dist/universal-router-sdk.cjs.production.min.js +1 -1
- package/dist/universal-router-sdk.cjs.production.min.js.map +1 -1
- package/dist/universal-router-sdk.esm.js +307 -18
- package/dist/universal-router-sdk.esm.js.map +1 -1
- package/dist/utils/constants.d.ts +2 -1
- package/dist/utils/eip712.d.ts +17 -0
- package/dist/utils/routerCommands.d.ts +9 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -31,3 +31,285 @@ Run forge integration tests
|
|
|
31
31
|
forge install
|
|
32
32
|
yarn test:forge
|
|
33
33
|
```
|
|
34
|
+
|
|
35
|
+
## Per-Hop Slippage Protection (V4 Routes)
|
|
36
|
+
|
|
37
|
+
Universal Router v2.1 adds granular slippage protection for multi-hop V4 swaps. Additionally to checking slippage at the end of a route, you can now verify that each individual hop doesn't exceed a maximum price limit.
|
|
38
|
+
|
|
39
|
+
### How It Works
|
|
40
|
+
|
|
41
|
+
For V4 multi-hop swaps, you can provide a `maxHopSlippage` array in your swap options:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { SwapRouter } from '@uniswap/universal-router-sdk'
|
|
45
|
+
import { BigNumber } from 'ethers'
|
|
46
|
+
import { Percent } from '@uniswap/sdk-core'
|
|
47
|
+
|
|
48
|
+
const swapOptions = {
|
|
49
|
+
slippageTolerance: new Percent(50, 10000), // 0.5% overall slippage
|
|
50
|
+
recipient: '0x...',
|
|
51
|
+
deadline: Math.floor(Date.now() / 1000) + 60 * 20,
|
|
52
|
+
// Optional: per-hop slippage protection for V4 routes
|
|
53
|
+
maxHopSlippage: [
|
|
54
|
+
BigNumber.from('1010000000000000000'), // Hop 0: max price 1.01 (1% slippage)
|
|
55
|
+
BigNumber.from('2500000000000000000000'), // Hop 1: max price 2500
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const { calldata, value } = SwapRouter.swapCallParameters(trade, swapOptions)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Price Calculation
|
|
63
|
+
|
|
64
|
+
The slippage is expressed as a **price** with 18 decimals of precision:
|
|
65
|
+
- **For Exact Input**: `price = amountIn * 1e18 / amountOut`
|
|
66
|
+
- **For Exact Output**: `price = amountIn * 1e18 / amountOut`
|
|
67
|
+
|
|
68
|
+
If the calculated price exceeds `maxHopSlippage[i]`, the transaction will revert with:
|
|
69
|
+
- `V4TooLittleReceivedPerHop` for exact input swaps
|
|
70
|
+
- `V4TooMuchRequestedPerHop` for exact output swaps
|
|
71
|
+
|
|
72
|
+
### Example: USDC → DAI → WETH
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// 2-hop swap: USDC → DAI → WETH
|
|
76
|
+
const swapOptions = {
|
|
77
|
+
slippageTolerance: new Percent(100, 10000), // 1% overall
|
|
78
|
+
recipient: userAddress,
|
|
79
|
+
deadline,
|
|
80
|
+
maxHopSlippage: [
|
|
81
|
+
BigNumber.from('1010000000000000000'), // Hop 0: USDC→DAI, max 1% slippage
|
|
82
|
+
BigNumber.from('2500000000000000000000'), // Hop 1: DAI→WETH, max price 2500 DAI/WETH
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Benefits
|
|
88
|
+
|
|
89
|
+
1. **MEV Protection**: Prevents sandwich attacks on individual hops
|
|
90
|
+
2. **Route Quality**: Ensures each segment of a multi-hop route meets expectations
|
|
91
|
+
3. **Granular Control**: Different slippage tolerance for different pairs in a route
|
|
92
|
+
|
|
93
|
+
### Backward Compatibility
|
|
94
|
+
|
|
95
|
+
- If `maxHopSlippage` is not provided or is an empty array, only overall slippage is checked (backward compatible)
|
|
96
|
+
- The feature only applies to V4 routes; V2 and V3 routes ignore this parameter
|
|
97
|
+
- Mixed routes with V4 sections will apply per-hop checks only to the V4 portions
|
|
98
|
+
|
|
99
|
+
## Signed Routes (Universal Router v2.1)
|
|
100
|
+
|
|
101
|
+
Universal Router v2.1 supports EIP712-signed route execution, enabling gasless transactions and intent-based trading.
|
|
102
|
+
|
|
103
|
+
**Important**: The SDK does not perform signing. It provides utilities to prepare EIP712 payloads and encode signed calldata. You sign with your own mechanism (wallet, KMS, hardware, etc.).
|
|
104
|
+
|
|
105
|
+
### Basic Flow
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { SwapRouter, NONCE_SKIP_CHECK } from '@uniswap/universal-router-sdk'
|
|
109
|
+
import { Wallet } from '@ethersproject/wallet'
|
|
110
|
+
|
|
111
|
+
const wallet = new Wallet('0x...')
|
|
112
|
+
const chainId = 1
|
|
113
|
+
const routerAddress = '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD'
|
|
114
|
+
const deadline = Math.floor(Date.now() / 1000) + 60 * 20
|
|
115
|
+
|
|
116
|
+
// 1. Generate regular swap calldata
|
|
117
|
+
const { calldata, value } = SwapRouter.swapCallParameters(trade, {
|
|
118
|
+
slippageTolerance: new Percent(50, 10000),
|
|
119
|
+
recipient: wallet.address,
|
|
120
|
+
deadline,
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
// 2. Get EIP712 payload to sign
|
|
124
|
+
const payload = SwapRouter.getExecuteSignedPayload(
|
|
125
|
+
calldata,
|
|
126
|
+
{
|
|
127
|
+
intent: '0x' + '0'.repeat(64), // Application-specific intent
|
|
128
|
+
data: '0x' + '0'.repeat(64), // Application-specific data
|
|
129
|
+
sender: wallet.address, // Or address(0) to skip sender verification
|
|
130
|
+
},
|
|
131
|
+
deadline,
|
|
132
|
+
chainId,
|
|
133
|
+
routerAddress
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
// 3. Sign externally (wallet/KMS/hardware)
|
|
137
|
+
const signature = await wallet._signTypedData(payload.domain, payload.types, payload.value)
|
|
138
|
+
|
|
139
|
+
// 4. Encode for executeSigned()
|
|
140
|
+
const { calldata: signedCalldata, value: signedValue } = SwapRouter.encodeExecuteSigned(
|
|
141
|
+
calldata,
|
|
142
|
+
signature,
|
|
143
|
+
{
|
|
144
|
+
intent: payload.value.intent,
|
|
145
|
+
data: payload.value.data,
|
|
146
|
+
sender: payload.value.sender,
|
|
147
|
+
nonce: payload.value.nonce, // Must match what was signed
|
|
148
|
+
},
|
|
149
|
+
deadline,
|
|
150
|
+
BigNumber.from(value)
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
// 5. Submit transaction
|
|
154
|
+
await wallet.sendTransaction({
|
|
155
|
+
to: routerAddress,
|
|
156
|
+
data: signedCalldata,
|
|
157
|
+
value: signedValue,
|
|
158
|
+
})
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Nonce Management
|
|
162
|
+
|
|
163
|
+
- **Random nonce (default)**: Omit `nonce` parameter - SDK generates random nonce
|
|
164
|
+
- **Skip nonce check**: Use `NONCE_SKIP_CHECK` sentinel to allow signature reuse
|
|
165
|
+
- **Custom nonce**: Provide your own nonce for ordering
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
import { NONCE_SKIP_CHECK } from '@uniswap/universal-router-sdk'
|
|
169
|
+
|
|
170
|
+
// Reusable signature (no nonce check)
|
|
171
|
+
const payload = SwapRouter.getExecuteSignedPayload(
|
|
172
|
+
calldata,
|
|
173
|
+
{
|
|
174
|
+
intent: '0x...',
|
|
175
|
+
data: '0x...',
|
|
176
|
+
sender: '0x0000000000000000000000000000000000000000', // Skip sender verification too
|
|
177
|
+
nonce: NONCE_SKIP_CHECK, // Allow signature reuse
|
|
178
|
+
},
|
|
179
|
+
deadline,
|
|
180
|
+
chainId,
|
|
181
|
+
routerAddress
|
|
182
|
+
)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Sender Verification
|
|
186
|
+
|
|
187
|
+
- **Verify sender**: Pass the actual sender address (e.g., `wallet.address`)
|
|
188
|
+
- **Skip verification**: Pass `'0x0000000000000000000000000000000000000000'`
|
|
189
|
+
|
|
190
|
+
The SDK automatically sets `verifySender` based on whether sender is address(0).
|
|
191
|
+
|
|
192
|
+
## Cross-Chain Bridging with Across (Universal Router v2.1)
|
|
193
|
+
|
|
194
|
+
Universal Router v2.1 integrates with Across Protocol V3 to enable seamless cross-chain bridging after swaps. This allows you to swap tokens on one chain and automatically bridge them to another chain in a single transaction.
|
|
195
|
+
|
|
196
|
+
### Basic Usage
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { SwapRouter } from '@uniswap/universal-router-sdk'
|
|
200
|
+
import { BigNumber } from 'ethers'
|
|
201
|
+
|
|
202
|
+
// 1. Prepare your swap (e.g., USDC → WETH on mainnet)
|
|
203
|
+
const { calldata, value } = SwapRouter.swapCallParameters(
|
|
204
|
+
trade,
|
|
205
|
+
swapOptions,
|
|
206
|
+
[
|
|
207
|
+
{
|
|
208
|
+
// Bridge configuration
|
|
209
|
+
depositor: userAddress,
|
|
210
|
+
recipient: userAddress, // Recipient on destination chain
|
|
211
|
+
inputToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH mainnet
|
|
212
|
+
outputToken: '0x4200000000000000000000000000000000000006', // WETH optimism
|
|
213
|
+
inputAmount: BigNumber.from('1000000000000000000'), // 1 WETH
|
|
214
|
+
outputAmount: BigNumber.from('990000000000000000'), // 0.99 WETH (with fees)
|
|
215
|
+
destinationChainId: 10, // Optimism
|
|
216
|
+
exclusiveRelayer: '0x0000000000000000000000000000000000000000',
|
|
217
|
+
quoteTimestamp: Math.floor(Date.now() / 1000),
|
|
218
|
+
fillDeadline: Math.floor(Date.now() / 1000) + 3600,
|
|
219
|
+
exclusivityDeadline: 0,
|
|
220
|
+
message: '0x',
|
|
221
|
+
useNative: false,
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Swap + Bridge Example
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// Swap USDC to WETH, then bridge WETH to Optimism
|
|
231
|
+
const bridgeParams = {
|
|
232
|
+
depositor: userAddress,
|
|
233
|
+
recipient: userAddress, // Can be different address on destination
|
|
234
|
+
inputToken: WETH_MAINNET,
|
|
235
|
+
outputToken: WETH_OPTIMISM,
|
|
236
|
+
inputAmount: CONTRACT_BALANCE, // Use entire swap output
|
|
237
|
+
outputAmount: expectedOutputAmount,
|
|
238
|
+
destinationChainId: 10,
|
|
239
|
+
exclusiveRelayer: '0x0000000000000000000000000000000000000000',
|
|
240
|
+
quoteTimestamp: Math.floor(Date.now() / 1000),
|
|
241
|
+
fillDeadline: Math.floor(Date.now() / 1000) + 3600,
|
|
242
|
+
exclusivityDeadline: 0,
|
|
243
|
+
message: '0x', // Optional message to execute on destination
|
|
244
|
+
useNative: false, // Set to true to bridge native ETH
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const { calldata, value } = SwapRouter.swapCallParameters(
|
|
248
|
+
trade,
|
|
249
|
+
swapOptions,
|
|
250
|
+
[bridgeParams] // Array of bridge operations
|
|
251
|
+
)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Using CONTRACT_BALANCE
|
|
255
|
+
|
|
256
|
+
When bridging after a swap, you often don't know the exact output amount. Use `CONTRACT_BALANCE` to bridge the entire contract balance:
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
import { CONTRACT_BALANCE } from '@uniswap/universal-router-sdk'
|
|
260
|
+
|
|
261
|
+
const bridgeParams = {
|
|
262
|
+
// ... other params
|
|
263
|
+
inputAmount: CONTRACT_BALANCE, // Bridge entire balance after swap
|
|
264
|
+
// ... other params
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Multiple Bridge Operations
|
|
269
|
+
|
|
270
|
+
You can perform multiple bridge operations after a swap:
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
const { calldata, value } = SwapRouter.swapCallParameters(
|
|
274
|
+
trade,
|
|
275
|
+
swapOptions,
|
|
276
|
+
[
|
|
277
|
+
{
|
|
278
|
+
// Bridge 50% to Optimism
|
|
279
|
+
inputToken: WETH_MAINNET,
|
|
280
|
+
outputToken: WETH_OPTIMISM,
|
|
281
|
+
inputAmount: BigNumber.from('500000000000000000'),
|
|
282
|
+
destinationChainId: 10,
|
|
283
|
+
// ... other params
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
// Bridge remaining USDC to Arbitrum
|
|
287
|
+
inputToken: USDC_MAINNET,
|
|
288
|
+
outputToken: USDC_ARBITRUM,
|
|
289
|
+
inputAmount: CONTRACT_BALANCE,
|
|
290
|
+
destinationChainId: 42161,
|
|
291
|
+
// ... other params
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
)
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Native ETH Bridging
|
|
298
|
+
|
|
299
|
+
To bridge native ETH instead of WETH:
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
const bridgeParams = {
|
|
303
|
+
inputToken: WETH_ADDRESS, // Must be WETH address
|
|
304
|
+
outputToken: WETH_ON_DESTINATION,
|
|
305
|
+
useNative: true, // Bridge as native ETH
|
|
306
|
+
// ... other params
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Important Notes
|
|
311
|
+
|
|
312
|
+
1. **Across Quote**: Bridge parameters (especially `outputAmount`, `quoteTimestamp`, `fillDeadline`) should come from the Across API quote
|
|
313
|
+
2. **Recipient Address**: Can be different from the sender, allowing cross-chain transfers to other addresses
|
|
314
|
+
3. **Message Passing**: The `message` field allows executing arbitrary calls on the destination chain
|
|
315
|
+
4. **Slippage**: The `outputAmount` already accounts for bridge fees and slippage
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BigNumberish } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for Across V4 Deposit V3 command
|
|
4
|
+
* Used for cross-chain bridging via Across Protocol V3 SpokePool
|
|
5
|
+
*/
|
|
6
|
+
export declare type AcrossV4DepositV3Params = {
|
|
7
|
+
depositor: string;
|
|
8
|
+
recipient: string;
|
|
9
|
+
inputToken: string;
|
|
10
|
+
outputToken: string;
|
|
11
|
+
inputAmount: BigNumberish;
|
|
12
|
+
outputAmount: BigNumberish;
|
|
13
|
+
destinationChainId: number;
|
|
14
|
+
exclusiveRelayer: string;
|
|
15
|
+
quoteTimestamp: number;
|
|
16
|
+
fillDeadline: number;
|
|
17
|
+
exclusivityDeadline: number;
|
|
18
|
+
message: string;
|
|
19
|
+
useNative: boolean;
|
|
20
|
+
};
|
|
21
|
+
export { CONTRACT_BALANCE } from '../../utils/constants';
|
|
@@ -3,7 +3,7 @@ import { Trade as RouterTrade, SwapOptions as RouterSwapOptions } from '@uniswap
|
|
|
3
3
|
import { Permit2Permit } from '../../utils/inputTokens';
|
|
4
4
|
import { Currency, TradeType } from '@uniswap/sdk-core';
|
|
5
5
|
import { Command, RouterActionType, TradeConfig } from '../Command';
|
|
6
|
-
import { BigNumberish } from 'ethers';
|
|
6
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
7
7
|
export declare type FlatFeeOptions = {
|
|
8
8
|
amount: BigNumberish;
|
|
9
9
|
recipient: string;
|
|
@@ -13,6 +13,7 @@ export declare type SwapOptions = Omit<RouterSwapOptions, 'inputTokenPermit'> &
|
|
|
13
13
|
inputTokenPermit?: Permit2Permit;
|
|
14
14
|
flatFee?: FlatFeeOptions;
|
|
15
15
|
safeMode?: boolean;
|
|
16
|
+
maxHopSlippage?: BigNumber[];
|
|
16
17
|
};
|
|
17
18
|
export declare class UniswapTrade implements Command {
|
|
18
19
|
trade: RouterTrade<Currency, Currency, TradeType>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { SwapRouter } from './swapRouter';
|
|
2
|
-
export type { MigrateV3ToV4Options } from './swapRouter';
|
|
2
|
+
export type { MigrateV3ToV4Options, SignedRouteOptions, EIP712Payload } from './swapRouter';
|
|
3
3
|
export * from './entities';
|
|
4
4
|
export * from './utils/routerTradeAdapter';
|
|
5
5
|
export { RoutePlanner, CommandType, COMMAND_DEFINITION, Parser, Subparser } from './utils/routerCommands';
|
|
@@ -8,3 +8,4 @@ export { UNIVERSAL_ROUTER_CREATION_BLOCK, UNIVERSAL_ROUTER_ADDRESS, ROUTER_AS_RE
|
|
|
8
8
|
export { CommandParser, GenericCommandParser } from './utils/commandParser';
|
|
9
9
|
export type { UniversalRouterCommand, UniversalRouterCall, Param, CommandsDefinition } from './utils/commandParser';
|
|
10
10
|
export type { Permit2Permit } from './utils/inputTokens';
|
|
11
|
+
export { NONCE_SKIP_CHECK, generateNonce, EXECUTE_SIGNED_TYPES, getUniversalRouterDomain } from './utils/eip712';
|
package/dist/swapRouter.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { BigNumberish } from 'ethers';
|
|
2
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
3
3
|
import { MethodParameters, Position as V3Position, RemoveLiquidityOptions as V3RemoveLiquidityOptions } from '@uniswap/v3-sdk';
|
|
4
4
|
import { Position as V4Position, AddLiquidityOptions as V4AddLiquidityOptions } from '@uniswap/v4-sdk';
|
|
5
5
|
import { Trade as RouterTrade } from '@uniswap/router-sdk';
|
|
6
6
|
import { Currency, TradeType } from '@uniswap/sdk-core';
|
|
7
7
|
import { SwapOptions } from './entities/actions/uniswap';
|
|
8
|
+
import { AcrossV4DepositV3Params } from './entities/actions/across';
|
|
9
|
+
import { TypedDataDomain, TypedDataField } from '@ethersproject/abstract-signer';
|
|
8
10
|
export declare type SwapRouterConfig = {
|
|
9
11
|
sender?: string;
|
|
10
12
|
deadline?: BigNumberish;
|
|
@@ -15,9 +17,28 @@ export interface MigrateV3ToV4Options {
|
|
|
15
17
|
v3RemoveLiquidityOptions: V3RemoveLiquidityOptions;
|
|
16
18
|
v4AddLiquidityOptions: V4AddLiquidityOptions;
|
|
17
19
|
}
|
|
20
|
+
export declare type SignedRouteOptions = {
|
|
21
|
+
intent: string;
|
|
22
|
+
data: string;
|
|
23
|
+
sender: string;
|
|
24
|
+
nonce?: string;
|
|
25
|
+
};
|
|
26
|
+
export declare type EIP712Payload = {
|
|
27
|
+
domain: TypedDataDomain;
|
|
28
|
+
types: Record<string, TypedDataField[]>;
|
|
29
|
+
value: {
|
|
30
|
+
commands: string;
|
|
31
|
+
inputs: string[];
|
|
32
|
+
intent: string;
|
|
33
|
+
data: string;
|
|
34
|
+
sender: string;
|
|
35
|
+
nonce: string;
|
|
36
|
+
deadline: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
18
39
|
export declare abstract class SwapRouter {
|
|
19
40
|
static INTERFACE: Interface;
|
|
20
|
-
static swapCallParameters(trades: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions): MethodParameters;
|
|
41
|
+
static swapCallParameters(trades: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions, bridgeOptions?: AcrossV4DepositV3Params[]): MethodParameters;
|
|
21
42
|
/**
|
|
22
43
|
* Builds the call parameters for a migration from a V3 position to a V4 position.
|
|
23
44
|
* Some requirements of the parameters:
|
|
@@ -27,6 +48,29 @@ export declare abstract class SwapRouter {
|
|
|
27
48
|
* - V3 NFT must be approved, or valid inputV3NFTPermit must be provided with UR as spender
|
|
28
49
|
*/
|
|
29
50
|
static migrateV3ToV4CallParameters(options: MigrateV3ToV4Options, positionManagerOverride?: string): MethodParameters;
|
|
51
|
+
/**
|
|
52
|
+
* Generate EIP712 payload for signed execution (no signing performed)
|
|
53
|
+
* Decodes existing execute() calldata and prepares it for signing
|
|
54
|
+
*
|
|
55
|
+
* @param calldata The calldata from swapCallParameters() or similar
|
|
56
|
+
* @param signedOptions Options for signed execution (intent, data, sender, nonce)
|
|
57
|
+
* @param deadline The deadline timestamp
|
|
58
|
+
* @param chainId The chain ID
|
|
59
|
+
* @param routerAddress The Universal Router contract address
|
|
60
|
+
* @returns EIP712 payload ready to be signed externally
|
|
61
|
+
*/
|
|
62
|
+
static getExecuteSignedPayload(calldata: string, signedOptions: SignedRouteOptions, deadline: BigNumberish, chainId: number, routerAddress: string): EIP712Payload;
|
|
63
|
+
/**
|
|
64
|
+
* Encode executeSigned() call with signature
|
|
65
|
+
*
|
|
66
|
+
* @param calldata The original calldata from swapCallParameters()
|
|
67
|
+
* @param signature The signature obtained from external signing
|
|
68
|
+
* @param signedOptions The same options used in getExecuteSignedPayload()
|
|
69
|
+
* @param deadline The deadline timestamp
|
|
70
|
+
* @param nativeCurrencyValue The native currency value (ETH) to send
|
|
71
|
+
* @returns Method parameters for executeSigned()
|
|
72
|
+
*/
|
|
73
|
+
static encodeExecuteSigned(calldata: string, signature: string, signedOptions: SignedRouteOptions, deadline: BigNumberish, nativeCurrencyValue?: BigNumber): MethodParameters;
|
|
30
74
|
/**
|
|
31
75
|
* Encodes a planned route into a method name and parameters for the Router contract.
|
|
32
76
|
* @param planner the planned route
|