@uniswap/universal-router-sdk 5.10.0 → 5.11.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/README.md +12 -2
- package/dist/cjs/src/index.d.ts +2 -0
- package/dist/cjs/src/index.js +3 -1
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/swapRouter.d.ts +16 -3
- package/dist/cjs/src/swapRouter.js +28 -5
- package/dist/cjs/src/swapRouter.js.map +1 -1
- package/dist/cjs/src/types/encodeSwaps.d.ts +14 -1
- package/dist/cjs/src/utils/directTransfers.d.ts +14 -0
- package/dist/cjs/src/utils/directTransfers.js +264 -0
- package/dist/cjs/src/utils/directTransfers.js.map +1 -0
- package/dist/cjs/src/utils/encodeSwapStep.js +5 -5
- package/dist/cjs/src/utils/encodeSwapStep.js.map +1 -1
- package/dist/cjs/src/utils/encodeV4Action.js +2 -2
- package/dist/cjs/src/utils/encodeV4Action.js.map +1 -1
- package/dist/cjs/src/utils/normalizeEncodeSwapsSpec.js +3 -2
- package/dist/cjs/src/utils/normalizeEncodeSwapsSpec.js.map +1 -1
- package/dist/cjs/src/utils/validateEncodeSwaps.js +86 -24
- package/dist/cjs/src/utils/validateEncodeSwaps.js.map +1 -1
- package/dist/esm/src/index.d.ts +2 -0
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/swapRouter.d.ts +16 -3
- package/dist/esm/src/swapRouter.js +28 -5
- package/dist/esm/src/swapRouter.js.map +1 -1
- package/dist/esm/src/types/encodeSwaps.d.ts +14 -1
- package/dist/esm/src/utils/directTransfers.d.ts +14 -0
- package/dist/esm/src/utils/directTransfers.js +253 -0
- package/dist/esm/src/utils/directTransfers.js.map +1 -0
- package/dist/esm/src/utils/encodeSwapStep.js +5 -5
- package/dist/esm/src/utils/encodeSwapStep.js.map +1 -1
- package/dist/esm/src/utils/encodeV4Action.js +2 -2
- package/dist/esm/src/utils/encodeV4Action.js.map +1 -1
- package/dist/esm/src/utils/normalizeEncodeSwapsSpec.js +3 -2
- package/dist/esm/src/utils/normalizeEncodeSwapsSpec.js.map +1 -1
- package/dist/esm/src/utils/validateEncodeSwaps.js +86 -24
- package/dist/esm/src/utils/validateEncodeSwaps.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/swapRouter.d.ts +16 -3
- package/dist/types/src/types/encodeSwaps.d.ts +14 -1
- package/dist/types/src/utils/directTransfers.d.ts +14 -0
- package/package.json +6 -6
|
@@ -39,12 +39,20 @@ export type SwapSpecification = {
|
|
|
39
39
|
* Incompatible with native input, permit, and TokenTransferMode.ApproveProxy.
|
|
40
40
|
*/
|
|
41
41
|
nativeErc20Input?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Lets steps pull input straight from the user and pay output straight to `recipient`
|
|
44
|
+
* (instead of router custody), still validated so the user never pays more than
|
|
45
|
+
* `exactOrMaxAmountIn` or receives less than the minimum output. Default false.
|
|
46
|
+
* See `SwapRouter.encodeSwaps`.
|
|
47
|
+
*/
|
|
48
|
+
allowDirectTransfers?: boolean;
|
|
42
49
|
};
|
|
43
|
-
export type NormalizedSwapSpecification = Omit<SwapSpecification, 'recipient' | 'tokenTransferMode' | 'urVersion' | 'safeMode'> & {
|
|
50
|
+
export type NormalizedSwapSpecification = Omit<SwapSpecification, 'recipient' | 'tokenTransferMode' | 'urVersion' | 'safeMode' | 'allowDirectTransfers'> & {
|
|
44
51
|
recipient: string;
|
|
45
52
|
tokenTransferMode: TokenTransferMode;
|
|
46
53
|
urVersion: UniversalRouterVersion;
|
|
47
54
|
safeMode: boolean;
|
|
55
|
+
allowDirectTransfers: boolean;
|
|
48
56
|
};
|
|
49
57
|
export type V2SwapExactIn = {
|
|
50
58
|
type: 'V2_SWAP_EXACT_IN';
|
|
@@ -53,6 +61,7 @@ export type V2SwapExactIn = {
|
|
|
53
61
|
amountOutMin: BigNumberish;
|
|
54
62
|
path: string[];
|
|
55
63
|
minHopPriceX36?: BigNumberish[];
|
|
64
|
+
payerIsUser?: boolean;
|
|
56
65
|
};
|
|
57
66
|
export type V2SwapExactOut = {
|
|
58
67
|
type: 'V2_SWAP_EXACT_OUT';
|
|
@@ -61,6 +70,7 @@ export type V2SwapExactOut = {
|
|
|
61
70
|
amountInMax: BigNumberish;
|
|
62
71
|
path: string[];
|
|
63
72
|
minHopPriceX36?: BigNumberish[];
|
|
73
|
+
payerIsUser?: boolean;
|
|
64
74
|
};
|
|
65
75
|
export type V3SwapExactIn = {
|
|
66
76
|
type: 'V3_SWAP_EXACT_IN';
|
|
@@ -69,6 +79,7 @@ export type V3SwapExactIn = {
|
|
|
69
79
|
amountOutMin: BigNumberish;
|
|
70
80
|
path: string;
|
|
71
81
|
minHopPriceX36?: BigNumberish[];
|
|
82
|
+
payerIsUser?: boolean;
|
|
72
83
|
};
|
|
73
84
|
export type V3SwapExactOut = {
|
|
74
85
|
type: 'V3_SWAP_EXACT_OUT';
|
|
@@ -77,6 +88,7 @@ export type V3SwapExactOut = {
|
|
|
77
88
|
amountInMax: BigNumberish;
|
|
78
89
|
path: string;
|
|
79
90
|
minHopPriceX36?: BigNumberish[];
|
|
91
|
+
payerIsUser?: boolean;
|
|
80
92
|
};
|
|
81
93
|
export type V4Swap = {
|
|
82
94
|
type: 'V4_SWAP';
|
|
@@ -131,6 +143,7 @@ export type V4Settle = {
|
|
|
131
143
|
action: 'SETTLE';
|
|
132
144
|
currency: string;
|
|
133
145
|
amount: BigNumberish;
|
|
146
|
+
payerIsUser?: boolean;
|
|
134
147
|
};
|
|
135
148
|
export type V4SettleAll = {
|
|
136
149
|
action: 'SETTLE_ALL';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
import { NormalizedSwapSpecification, SwapStep } from '../types/encodeSwaps';
|
|
3
|
+
export type UserPaidPull = {
|
|
4
|
+
token: string | undefined;
|
|
5
|
+
maxAmount: BigNumber;
|
|
6
|
+
};
|
|
7
|
+
export declare function getV3HopCount(path: string): number | undefined;
|
|
8
|
+
export declare function v3PathFirstToken(path: string): string | undefined;
|
|
9
|
+
export declare function v3PathLastToken(path: string): string | undefined;
|
|
10
|
+
export declare function hasUserPaidFlag(step: SwapStep): boolean;
|
|
11
|
+
export declare function stepUserPaidPulls(step: SwapStep): UserPaidPull[];
|
|
12
|
+
export declare function sumUserPaidMax(steps: SwapStep[]): BigNumber;
|
|
13
|
+
export declare function sumDirectOutputMin(steps: SwapStep[], recipient: string, outputTokenAddress: string): BigNumber;
|
|
14
|
+
export declare function directTransferSweepFloor(spec: NormalizedSwapSpecification, netMin: BigNumber, swapSteps: SwapStep[], outputTokenAddress: string): BigNumber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniswap/universal-router-sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.1",
|
|
4
4
|
"description": "sdk for integrating with the Universal Router contracts",
|
|
5
5
|
"repository": "https://github.com/Uniswap/sdks.git",
|
|
6
6
|
"keywords": [
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"@ethersproject/abstract-signer": "^5.7.0",
|
|
45
45
|
"@openzeppelin/contracts": "4.7.0",
|
|
46
46
|
"@uniswap/permit2-sdk": "^1.4.0",
|
|
47
|
-
"@uniswap/router-sdk": "^2.11.
|
|
48
|
-
"@uniswap/sdk-core": "^7.
|
|
47
|
+
"@uniswap/router-sdk": "^2.11.1",
|
|
48
|
+
"@uniswap/sdk-core": "^7.19.0",
|
|
49
49
|
"@uniswap/universal-router": "2.1.0",
|
|
50
50
|
"@uniswap/v2-core": "^1.0.1",
|
|
51
|
-
"@uniswap/v2-sdk": "^4.21.
|
|
51
|
+
"@uniswap/v2-sdk": "^4.21.1",
|
|
52
52
|
"@uniswap/v3-core": "1.0.0",
|
|
53
|
-
"@uniswap/v3-sdk": "^3.31.
|
|
54
|
-
"@uniswap/v4-sdk": "^2.3.
|
|
53
|
+
"@uniswap/v3-sdk": "^3.31.1",
|
|
54
|
+
"@uniswap/v4-sdk": "^2.3.1",
|
|
55
55
|
"bignumber.js": "^9.0.2",
|
|
56
56
|
"ethers": "^5.7.0",
|
|
57
57
|
"jsbi": "^3.1.4",
|