@uniswap/universal-router-sdk 4.19.3 → 4.19.4
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/{cjs/src/entities → entities}/Command.d.ts +12 -12
- package/dist/{types/src/entities → entities}/actions/index.d.ts +2 -2
- package/dist/{cjs/src/entities → entities}/actions/uniswap.d.ts +30 -30
- package/dist/{esm/src/entities → entities}/actions/unwrapWETH.d.ts +12 -12
- package/dist/{cjs/src/entities → entities}/index.d.ts +2 -2
- package/dist/{esm/src/index.d.ts → index.d.ts} +10 -10
- package/dist/index.js +8 -0
- package/dist/{esm/src/swapRouter.d.ts → swapRouter.d.ts} +37 -37
- package/dist/test/forge/writeInterop.d.ts +2 -0
- package/dist/test/utils/addresses.d.ts +5 -0
- package/dist/test/utils/hexToDecimalString.d.ts +2 -0
- package/dist/test/utils/permit2.d.ts +7 -0
- package/dist/test/utils/uniswapData.d.ts +24 -0
- package/dist/universal-router-sdk.cjs.development.js +1424 -0
- package/dist/universal-router-sdk.cjs.development.js.map +1 -0
- package/dist/universal-router-sdk.cjs.production.min.js +2 -0
- package/dist/universal-router-sdk.cjs.production.min.js.map +1 -0
- package/dist/universal-router-sdk.esm.js +1417 -0
- package/dist/universal-router-sdk.esm.js.map +1 -0
- package/dist/{esm/src/utils → utils}/commandParser.d.ts +34 -34
- package/dist/{types/src/utils → utils}/constants.d.ts +30 -30
- package/dist/{cjs/src/utils → utils}/getCurrencyAddress.d.ts +2 -2
- package/dist/{types/src/utils → utils}/inputTokens.d.ts +23 -23
- package/dist/{cjs/src/utils → utils}/numbers.d.ts +6 -6
- package/dist/{types/src/utils → utils}/pathCurrency.d.ts +3 -3
- package/dist/{cjs/src/utils → utils}/routerCommands.d.ts +64 -64
- package/dist/{types/src/utils → utils}/routerTradeAdapter.d.ts +73 -73
- package/package.json +10 -21
- package/dist/cjs/src/entities/Command.js +0 -9
- package/dist/cjs/src/entities/Command.js.map +0 -1
- package/dist/cjs/src/entities/actions/index.d.ts +0 -2
- package/dist/cjs/src/entities/actions/index.js +0 -6
- package/dist/cjs/src/entities/actions/index.js.map +0 -1
- package/dist/cjs/src/entities/actions/uniswap.js +0 -365
- package/dist/cjs/src/entities/actions/uniswap.js.map +0 -1
- package/dist/cjs/src/entities/actions/unwrapWETH.d.ts +0 -12
- package/dist/cjs/src/entities/actions/unwrapWETH.js +0 -33
- package/dist/cjs/src/entities/actions/unwrapWETH.js.map +0 -1
- package/dist/cjs/src/entities/index.js +0 -6
- package/dist/cjs/src/entities/index.js.map +0 -1
- package/dist/cjs/src/index.d.ts +0 -10
- package/dist/cjs/src/index.js +0 -24
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/cjs/src/swapRouter.d.ts +0 -37
- package/dist/cjs/src/swapRouter.js +0 -120
- package/dist/cjs/src/swapRouter.js.map +0 -1
- package/dist/cjs/src/utils/commandParser.d.ts +0 -34
- package/dist/cjs/src/utils/commandParser.js +0 -144
- package/dist/cjs/src/utils/commandParser.js.map +0 -1
- package/dist/cjs/src/utils/constants.d.ts +0 -30
- package/dist/cjs/src/utils/constants.js +0 -373
- package/dist/cjs/src/utils/constants.js.map +0 -1
- package/dist/cjs/src/utils/getCurrencyAddress.js +0 -9
- package/dist/cjs/src/utils/getCurrencyAddress.js.map +0 -1
- package/dist/cjs/src/utils/inputTokens.d.ts +0 -23
- package/dist/cjs/src/utils/inputTokens.js +0 -58
- package/dist/cjs/src/utils/inputTokens.js.map +0 -1
- package/dist/cjs/src/utils/numbers.js +0 -22
- package/dist/cjs/src/utils/numbers.js.map +0 -1
- package/dist/cjs/src/utils/pathCurrency.d.ts +0 -3
- package/dist/cjs/src/utils/pathCurrency.js +0 -27
- package/dist/cjs/src/utils/pathCurrency.js.map +0 -1
- package/dist/cjs/src/utils/routerCommands.js +0 -231
- package/dist/cjs/src/utils/routerCommands.js.map +0 -1
- package/dist/cjs/src/utils/routerTradeAdapter.d.ts +0 -73
- package/dist/cjs/src/utils/routerTradeAdapter.js +0 -139
- package/dist/cjs/src/utils/routerTradeAdapter.js.map +0 -1
- package/dist/esm/src/entities/Command.d.ts +0 -12
- package/dist/esm/src/entities/Command.js +0 -6
- package/dist/esm/src/entities/Command.js.map +0 -1
- package/dist/esm/src/entities/actions/index.d.ts +0 -2
- package/dist/esm/src/entities/actions/index.js +0 -3
- package/dist/esm/src/entities/actions/index.js.map +0 -1
- package/dist/esm/src/entities/actions/uniswap.d.ts +0 -30
- package/dist/esm/src/entities/actions/uniswap.js +0 -361
- package/dist/esm/src/entities/actions/uniswap.js.map +0 -1
- package/dist/esm/src/entities/actions/unwrapWETH.js +0 -28
- package/dist/esm/src/entities/actions/unwrapWETH.js.map +0 -1
- package/dist/esm/src/entities/index.d.ts +0 -2
- package/dist/esm/src/entities/index.js +0 -3
- package/dist/esm/src/entities/index.js.map +0 -1
- package/dist/esm/src/index.js +0 -7
- package/dist/esm/src/index.js.map +0 -1
- package/dist/esm/src/swapRouter.js +0 -115
- package/dist/esm/src/swapRouter.js.map +0 -1
- package/dist/esm/src/utils/commandParser.js +0 -137
- package/dist/esm/src/utils/commandParser.js.map +0 -1
- package/dist/esm/src/utils/constants.d.ts +0 -30
- package/dist/esm/src/utils/constants.js +0 -367
- package/dist/esm/src/utils/constants.js.map +0 -1
- package/dist/esm/src/utils/getCurrencyAddress.d.ts +0 -2
- package/dist/esm/src/utils/getCurrencyAddress.js +0 -5
- package/dist/esm/src/utils/getCurrencyAddress.js.map +0 -1
- package/dist/esm/src/utils/inputTokens.d.ts +0 -23
- package/dist/esm/src/utils/inputTokens.js +0 -51
- package/dist/esm/src/utils/inputTokens.js.map +0 -1
- package/dist/esm/src/utils/numbers.d.ts +0 -6
- package/dist/esm/src/utils/numbers.js +0 -15
- package/dist/esm/src/utils/numbers.js.map +0 -1
- package/dist/esm/src/utils/pathCurrency.d.ts +0 -3
- package/dist/esm/src/utils/pathCurrency.js +0 -23
- package/dist/esm/src/utils/pathCurrency.js.map +0 -1
- package/dist/esm/src/utils/routerCommands.d.ts +0 -64
- package/dist/esm/src/utils/routerCommands.js +0 -226
- package/dist/esm/src/utils/routerCommands.js.map +0 -1
- package/dist/esm/src/utils/routerTradeAdapter.d.ts +0 -73
- package/dist/esm/src/utils/routerTradeAdapter.js +0 -134
- package/dist/esm/src/utils/routerTradeAdapter.js.map +0 -1
- package/dist/types/src/entities/Command.d.ts +0 -12
- package/dist/types/src/entities/actions/uniswap.d.ts +0 -30
- package/dist/types/src/entities/actions/unwrapWETH.d.ts +0 -12
- package/dist/types/src/entities/index.d.ts +0 -2
- package/dist/types/src/index.d.ts +0 -10
- package/dist/types/src/swapRouter.d.ts +0 -37
- package/dist/types/src/utils/commandParser.d.ts +0 -34
- package/dist/types/src/utils/getCurrencyAddress.d.ts +0 -2
- package/dist/types/src/utils/numbers.d.ts +0 -6
- package/dist/types/src/utils/routerCommands.d.ts +0 -64
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { BigNumberish } from 'ethers';
|
|
3
|
-
import { MethodParameters, Position as V3Position, RemoveLiquidityOptions as V3RemoveLiquidityOptions } from '@uniswap/v3-sdk';
|
|
4
|
-
import { Position as V4Position, AddLiquidityOptions as V4AddLiquidityOptions } from '@uniswap/v4-sdk';
|
|
5
|
-
import { Trade as RouterTrade } from '@uniswap/router-sdk';
|
|
6
|
-
import { Currency, TradeType } from '@uniswap/sdk-core';
|
|
7
|
-
import { SwapOptions } from './entities/actions/uniswap';
|
|
8
|
-
export type SwapRouterConfig = {
|
|
9
|
-
sender?: string;
|
|
10
|
-
deadline?: BigNumberish;
|
|
11
|
-
};
|
|
12
|
-
export interface MigrateV3ToV4Options {
|
|
13
|
-
inputPosition: V3Position;
|
|
14
|
-
outputPosition: V4Position;
|
|
15
|
-
v3RemoveLiquidityOptions: V3RemoveLiquidityOptions;
|
|
16
|
-
v4AddLiquidityOptions: V4AddLiquidityOptions;
|
|
17
|
-
}
|
|
18
|
-
export declare abstract class SwapRouter {
|
|
19
|
-
static INTERFACE: Interface;
|
|
20
|
-
static swapCallParameters(trades: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions): MethodParameters;
|
|
21
|
-
/**
|
|
22
|
-
* Builds the call parameters for a migration from a V3 position to a V4 position.
|
|
23
|
-
* Some requirements of the parameters:
|
|
24
|
-
* - v3RemoveLiquidityOptions.collectOptions.recipient must equal v4PositionManager
|
|
25
|
-
* - v3RemoveLiquidityOptions.liquidityPercentage must be 100%
|
|
26
|
-
* - input pool and output pool must have the same tokens
|
|
27
|
-
* - V3 NFT must be approved, or valid inputV3NFTPermit must be provided with UR as spender
|
|
28
|
-
*/
|
|
29
|
-
static migrateV3ToV4CallParameters(options: MigrateV3ToV4Options, positionManagerOverride?: string): MethodParameters;
|
|
30
|
-
/**
|
|
31
|
-
* Encodes a planned route into a method name and parameters for the Router contract.
|
|
32
|
-
* @param planner the planned route
|
|
33
|
-
* @param nativeCurrencyValue the native currency value of the planned route
|
|
34
|
-
* @param config the router config
|
|
35
|
-
*/
|
|
36
|
-
private static encodePlan;
|
|
37
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { CommandType, CommandDefinition } from '../utils/routerCommands';
|
|
3
|
-
export type Param = {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly value: any;
|
|
6
|
-
};
|
|
7
|
-
export type UniversalRouterCommand = {
|
|
8
|
-
readonly commandName: string;
|
|
9
|
-
readonly commandType: CommandType;
|
|
10
|
-
readonly params: readonly Param[];
|
|
11
|
-
};
|
|
12
|
-
export type UniversalRouterCall = {
|
|
13
|
-
readonly commands: readonly UniversalRouterCommand[];
|
|
14
|
-
};
|
|
15
|
-
export type V3PathItem = {
|
|
16
|
-
readonly tokenIn: string;
|
|
17
|
-
readonly tokenOut: string;
|
|
18
|
-
readonly fee: number;
|
|
19
|
-
};
|
|
20
|
-
export interface CommandsDefinition {
|
|
21
|
-
[key: number]: CommandDefinition;
|
|
22
|
-
}
|
|
23
|
-
export declare abstract class CommandParser {
|
|
24
|
-
static INTERFACE: Interface;
|
|
25
|
-
static parseCalldata(calldata: string): UniversalRouterCall;
|
|
26
|
-
}
|
|
27
|
-
export declare class GenericCommandParser {
|
|
28
|
-
private readonly commandDefinition;
|
|
29
|
-
constructor(commandDefinition: CommandsDefinition);
|
|
30
|
-
parse(commands: string, inputs: string[]): UniversalRouterCall;
|
|
31
|
-
private static getCommands;
|
|
32
|
-
}
|
|
33
|
-
export declare function parseV3PathExactIn(path: string): readonly V3PathItem[];
|
|
34
|
-
export declare function parseV3PathExactOut(path: string): readonly V3PathItem[];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from 'ethers';
|
|
2
|
-
import JSBI from 'jsbi';
|
|
3
|
-
import { Percent } from '@uniswap/sdk-core';
|
|
4
|
-
export declare function expandTo18DecimalsBN(n: number): BigNumber;
|
|
5
|
-
export declare function expandTo18Decimals(n: number): JSBI;
|
|
6
|
-
export declare function encodeFeeBips(fee: Percent): string;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CommandTypes
|
|
3
|
-
* @description Flags that modify a command's execution
|
|
4
|
-
* @enum {number}
|
|
5
|
-
*/
|
|
6
|
-
export declare enum CommandType {
|
|
7
|
-
V3_SWAP_EXACT_IN = 0,
|
|
8
|
-
V3_SWAP_EXACT_OUT = 1,
|
|
9
|
-
PERMIT2_TRANSFER_FROM = 2,
|
|
10
|
-
PERMIT2_PERMIT_BATCH = 3,
|
|
11
|
-
SWEEP = 4,
|
|
12
|
-
TRANSFER = 5,
|
|
13
|
-
PAY_PORTION = 6,
|
|
14
|
-
V2_SWAP_EXACT_IN = 8,
|
|
15
|
-
V2_SWAP_EXACT_OUT = 9,
|
|
16
|
-
PERMIT2_PERMIT = 10,
|
|
17
|
-
WRAP_ETH = 11,
|
|
18
|
-
UNWRAP_WETH = 12,
|
|
19
|
-
PERMIT2_TRANSFER_FROM_BATCH = 13,
|
|
20
|
-
BALANCE_CHECK_ERC20 = 14,
|
|
21
|
-
V4_SWAP = 16,
|
|
22
|
-
V3_POSITION_MANAGER_PERMIT = 17,
|
|
23
|
-
V3_POSITION_MANAGER_CALL = 18,
|
|
24
|
-
V4_INITIALIZE_POOL = 19,
|
|
25
|
-
V4_POSITION_MANAGER_CALL = 20,
|
|
26
|
-
EXECUTE_SUB_PLAN = 33
|
|
27
|
-
}
|
|
28
|
-
export declare enum Subparser {
|
|
29
|
-
V3PathExactIn = 0,
|
|
30
|
-
V3PathExactOut = 1
|
|
31
|
-
}
|
|
32
|
-
export declare enum Parser {
|
|
33
|
-
Abi = 0,
|
|
34
|
-
V4Actions = 1,
|
|
35
|
-
V3Actions = 2
|
|
36
|
-
}
|
|
37
|
-
export type ParamType = {
|
|
38
|
-
readonly name: string;
|
|
39
|
-
readonly type: string;
|
|
40
|
-
readonly subparser?: Subparser;
|
|
41
|
-
};
|
|
42
|
-
export type CommandDefinition = {
|
|
43
|
-
parser: Parser.Abi;
|
|
44
|
-
params: ParamType[];
|
|
45
|
-
} | {
|
|
46
|
-
parser: Parser.V4Actions;
|
|
47
|
-
} | {
|
|
48
|
-
parser: Parser.V3Actions;
|
|
49
|
-
};
|
|
50
|
-
export declare const COMMAND_DEFINITION: {
|
|
51
|
-
[key in CommandType]: CommandDefinition;
|
|
52
|
-
};
|
|
53
|
-
export declare class RoutePlanner {
|
|
54
|
-
commands: string;
|
|
55
|
-
inputs: string[];
|
|
56
|
-
constructor();
|
|
57
|
-
addSubPlan(subplan: RoutePlanner): RoutePlanner;
|
|
58
|
-
addCommand(type: CommandType, parameters: any[], allowRevert?: boolean): RoutePlanner;
|
|
59
|
-
}
|
|
60
|
-
export type RouterCommand = {
|
|
61
|
-
type: CommandType;
|
|
62
|
-
encodedInput: string;
|
|
63
|
-
};
|
|
64
|
-
export declare function createCommand(type: CommandType, parameters: any[]): RouterCommand;
|