@uniswap/universal-router-sdk 4.19.3 → 4.19.5

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.
Files changed (118) hide show
  1. package/dist/{cjs/src/entities → entities}/Command.d.ts +12 -12
  2. package/dist/{types/src/entities → entities}/actions/index.d.ts +2 -2
  3. package/dist/{cjs/src/entities → entities}/actions/uniswap.d.ts +30 -30
  4. package/dist/{esm/src/entities → entities}/actions/unwrapWETH.d.ts +12 -12
  5. package/dist/{cjs/src/entities → entities}/index.d.ts +2 -2
  6. package/dist/{esm/src/index.d.ts → index.d.ts} +10 -10
  7. package/dist/index.js +8 -0
  8. package/dist/{esm/src/swapRouter.d.ts → swapRouter.d.ts} +37 -37
  9. package/dist/test/forge/writeInterop.d.ts +2 -0
  10. package/dist/test/utils/addresses.d.ts +5 -0
  11. package/dist/test/utils/hexToDecimalString.d.ts +2 -0
  12. package/dist/test/utils/permit2.d.ts +7 -0
  13. package/dist/test/utils/uniswapData.d.ts +24 -0
  14. package/dist/universal-router-sdk.cjs.development.js +1424 -0
  15. package/dist/universal-router-sdk.cjs.development.js.map +1 -0
  16. package/dist/universal-router-sdk.cjs.production.min.js +2 -0
  17. package/dist/universal-router-sdk.cjs.production.min.js.map +1 -0
  18. package/dist/universal-router-sdk.esm.js +1417 -0
  19. package/dist/universal-router-sdk.esm.js.map +1 -0
  20. package/dist/{esm/src/utils → utils}/commandParser.d.ts +34 -34
  21. package/dist/{types/src/utils → utils}/constants.d.ts +30 -30
  22. package/dist/{cjs/src/utils → utils}/getCurrencyAddress.d.ts +2 -2
  23. package/dist/{types/src/utils → utils}/inputTokens.d.ts +23 -23
  24. package/dist/{cjs/src/utils → utils}/numbers.d.ts +6 -6
  25. package/dist/{types/src/utils → utils}/pathCurrency.d.ts +3 -3
  26. package/dist/{cjs/src/utils → utils}/routerCommands.d.ts +64 -64
  27. package/dist/{types/src/utils → utils}/routerTradeAdapter.d.ts +73 -73
  28. package/package.json +10 -21
  29. package/dist/cjs/src/entities/Command.js +0 -9
  30. package/dist/cjs/src/entities/Command.js.map +0 -1
  31. package/dist/cjs/src/entities/actions/index.d.ts +0 -2
  32. package/dist/cjs/src/entities/actions/index.js +0 -6
  33. package/dist/cjs/src/entities/actions/index.js.map +0 -1
  34. package/dist/cjs/src/entities/actions/uniswap.js +0 -365
  35. package/dist/cjs/src/entities/actions/uniswap.js.map +0 -1
  36. package/dist/cjs/src/entities/actions/unwrapWETH.d.ts +0 -12
  37. package/dist/cjs/src/entities/actions/unwrapWETH.js +0 -33
  38. package/dist/cjs/src/entities/actions/unwrapWETH.js.map +0 -1
  39. package/dist/cjs/src/entities/index.js +0 -6
  40. package/dist/cjs/src/entities/index.js.map +0 -1
  41. package/dist/cjs/src/index.d.ts +0 -10
  42. package/dist/cjs/src/index.js +0 -24
  43. package/dist/cjs/src/index.js.map +0 -1
  44. package/dist/cjs/src/swapRouter.d.ts +0 -37
  45. package/dist/cjs/src/swapRouter.js +0 -120
  46. package/dist/cjs/src/swapRouter.js.map +0 -1
  47. package/dist/cjs/src/utils/commandParser.d.ts +0 -34
  48. package/dist/cjs/src/utils/commandParser.js +0 -144
  49. package/dist/cjs/src/utils/commandParser.js.map +0 -1
  50. package/dist/cjs/src/utils/constants.d.ts +0 -30
  51. package/dist/cjs/src/utils/constants.js +0 -373
  52. package/dist/cjs/src/utils/constants.js.map +0 -1
  53. package/dist/cjs/src/utils/getCurrencyAddress.js +0 -9
  54. package/dist/cjs/src/utils/getCurrencyAddress.js.map +0 -1
  55. package/dist/cjs/src/utils/inputTokens.d.ts +0 -23
  56. package/dist/cjs/src/utils/inputTokens.js +0 -58
  57. package/dist/cjs/src/utils/inputTokens.js.map +0 -1
  58. package/dist/cjs/src/utils/numbers.js +0 -22
  59. package/dist/cjs/src/utils/numbers.js.map +0 -1
  60. package/dist/cjs/src/utils/pathCurrency.d.ts +0 -3
  61. package/dist/cjs/src/utils/pathCurrency.js +0 -27
  62. package/dist/cjs/src/utils/pathCurrency.js.map +0 -1
  63. package/dist/cjs/src/utils/routerCommands.js +0 -231
  64. package/dist/cjs/src/utils/routerCommands.js.map +0 -1
  65. package/dist/cjs/src/utils/routerTradeAdapter.d.ts +0 -73
  66. package/dist/cjs/src/utils/routerTradeAdapter.js +0 -139
  67. package/dist/cjs/src/utils/routerTradeAdapter.js.map +0 -1
  68. package/dist/esm/src/entities/Command.d.ts +0 -12
  69. package/dist/esm/src/entities/Command.js +0 -6
  70. package/dist/esm/src/entities/Command.js.map +0 -1
  71. package/dist/esm/src/entities/actions/index.d.ts +0 -2
  72. package/dist/esm/src/entities/actions/index.js +0 -3
  73. package/dist/esm/src/entities/actions/index.js.map +0 -1
  74. package/dist/esm/src/entities/actions/uniswap.d.ts +0 -30
  75. package/dist/esm/src/entities/actions/uniswap.js +0 -361
  76. package/dist/esm/src/entities/actions/uniswap.js.map +0 -1
  77. package/dist/esm/src/entities/actions/unwrapWETH.js +0 -28
  78. package/dist/esm/src/entities/actions/unwrapWETH.js.map +0 -1
  79. package/dist/esm/src/entities/index.d.ts +0 -2
  80. package/dist/esm/src/entities/index.js +0 -3
  81. package/dist/esm/src/entities/index.js.map +0 -1
  82. package/dist/esm/src/index.js +0 -7
  83. package/dist/esm/src/index.js.map +0 -1
  84. package/dist/esm/src/swapRouter.js +0 -115
  85. package/dist/esm/src/swapRouter.js.map +0 -1
  86. package/dist/esm/src/utils/commandParser.js +0 -137
  87. package/dist/esm/src/utils/commandParser.js.map +0 -1
  88. package/dist/esm/src/utils/constants.d.ts +0 -30
  89. package/dist/esm/src/utils/constants.js +0 -367
  90. package/dist/esm/src/utils/constants.js.map +0 -1
  91. package/dist/esm/src/utils/getCurrencyAddress.d.ts +0 -2
  92. package/dist/esm/src/utils/getCurrencyAddress.js +0 -5
  93. package/dist/esm/src/utils/getCurrencyAddress.js.map +0 -1
  94. package/dist/esm/src/utils/inputTokens.d.ts +0 -23
  95. package/dist/esm/src/utils/inputTokens.js +0 -51
  96. package/dist/esm/src/utils/inputTokens.js.map +0 -1
  97. package/dist/esm/src/utils/numbers.d.ts +0 -6
  98. package/dist/esm/src/utils/numbers.js +0 -15
  99. package/dist/esm/src/utils/numbers.js.map +0 -1
  100. package/dist/esm/src/utils/pathCurrency.d.ts +0 -3
  101. package/dist/esm/src/utils/pathCurrency.js +0 -23
  102. package/dist/esm/src/utils/pathCurrency.js.map +0 -1
  103. package/dist/esm/src/utils/routerCommands.d.ts +0 -64
  104. package/dist/esm/src/utils/routerCommands.js +0 -226
  105. package/dist/esm/src/utils/routerCommands.js.map +0 -1
  106. package/dist/esm/src/utils/routerTradeAdapter.d.ts +0 -73
  107. package/dist/esm/src/utils/routerTradeAdapter.js +0 -134
  108. package/dist/esm/src/utils/routerTradeAdapter.js.map +0 -1
  109. package/dist/types/src/entities/Command.d.ts +0 -12
  110. package/dist/types/src/entities/actions/uniswap.d.ts +0 -30
  111. package/dist/types/src/entities/actions/unwrapWETH.d.ts +0 -12
  112. package/dist/types/src/entities/index.d.ts +0 -2
  113. package/dist/types/src/index.d.ts +0 -10
  114. package/dist/types/src/swapRouter.d.ts +0 -37
  115. package/dist/types/src/utils/commandParser.d.ts +0 -34
  116. package/dist/types/src/utils/getCurrencyAddress.d.ts +0 -2
  117. package/dist/types/src/utils/numbers.d.ts +0 -6
  118. 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,2 +0,0 @@
1
- import { Currency } from '@uniswap/sdk-core';
2
- export declare function getCurrencyAddress(currency: Currency): string;
@@ -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;