@uniswap/universal-router-sdk 1.4.2 → 1.4.3
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/entities/Command.d.ts +13 -13
- package/dist/entities/NFTTrade.d.ts +42 -50
- package/dist/entities/index.d.ts +3 -3
- package/dist/entities/protocols/cryptopunk.d.ts +16 -16
- package/dist/entities/protocols/foundation.d.ts +19 -19
- package/dist/entities/protocols/index.d.ts +10 -10
- package/dist/entities/protocols/looksRare.d.ts +44 -44
- package/dist/entities/protocols/nft20.d.ts +21 -21
- package/dist/entities/protocols/nftx.d.ts +20 -20
- package/dist/entities/protocols/seaport.d.ts +64 -63
- package/dist/entities/protocols/sudoswap.d.ts +27 -27
- package/dist/entities/protocols/uniswap.d.ts +15 -15
- package/dist/entities/protocols/unwrapWETH.d.ts +13 -13
- package/dist/entities/protocols/x2y2.d.ts +28 -28
- package/dist/index.d.ts +3 -3
- package/dist/swapRouter.d.ts +38 -41
- package/dist/test/forge/writeInterop.d.ts +1 -1
- package/dist/test/orders/looksRare.d.ts +12 -15
- package/dist/test/orders/seaport.d.ts +4 -4
- package/dist/test/orders/seaportV1_4.d.ts +4 -4
- package/dist/test/orders/x2y2.d.ts +6 -6
- package/dist/test/utils/addresses.d.ts +2 -2
- package/dist/test/utils/hexToDecimalString.d.ts +2 -2
- package/dist/test/utils/permit2.d.ts +7 -17
- package/dist/test/utils/uniswapData.d.ts +24 -30
- package/dist/universal-router-sdk.cjs.development.js +13 -5
- 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 +13 -5
- package/dist/universal-router-sdk.esm.js.map +1 -1
- package/dist/utils/constants.d.ts +8 -8
- package/dist/utils/expandTo18Decimals.d.ts +4 -4
- package/dist/utils/getNativeCurrencyValue.d.ts +2 -2
- package/dist/utils/permit2.d.ts +6 -6
- package/dist/utils/routerCommands.d.ts +44 -44
- package/package.json +1 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi'
|
|
2
|
-
import { BuyItem, NFTTrade, TokenType } from '../NFTTrade'
|
|
3
|
-
import { TradeConfig } from '../Command'
|
|
4
|
-
import { RoutePlanner } from '../../utils/routerCommands'
|
|
5
|
-
import { BigNumber, BigNumberish } from 'ethers'
|
|
6
|
-
declare type X2Y2PartialData = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
export declare type X2Y2_721_Data = X2Y2PartialData & {
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
export declare type X2Y2_1155_Data = X2Y2PartialData & {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
export declare type X2Y2Data = X2Y2_721_Data | X2Y2_1155_Data
|
|
21
|
-
export declare class X2Y2Trade extends NFTTrade<X2Y2Data> {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
export {}
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BuyItem, NFTTrade, TokenType } from '../NFTTrade';
|
|
3
|
+
import { TradeConfig } from '../Command';
|
|
4
|
+
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
6
|
+
declare type X2Y2PartialData = {
|
|
7
|
+
signedInput: string;
|
|
8
|
+
recipient: string;
|
|
9
|
+
tokenAddress: string;
|
|
10
|
+
tokenId: BigNumberish;
|
|
11
|
+
price: BigNumberish;
|
|
12
|
+
};
|
|
13
|
+
export declare type X2Y2_721_Data = X2Y2PartialData & {
|
|
14
|
+
tokenType: TokenType.ERC721;
|
|
15
|
+
};
|
|
16
|
+
export declare type X2Y2_1155_Data = X2Y2PartialData & {
|
|
17
|
+
tokenType: TokenType.ERC1155;
|
|
18
|
+
tokenAmount: BigNumberish;
|
|
19
|
+
};
|
|
20
|
+
export declare type X2Y2Data = X2Y2_721_Data | X2Y2_1155_Data;
|
|
21
|
+
export declare class X2Y2Trade extends NFTTrade<X2Y2Data> {
|
|
22
|
+
static INTERFACE: Interface;
|
|
23
|
+
constructor(orders: X2Y2Data[]);
|
|
24
|
+
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
25
|
+
getBuyItems(): BuyItem[];
|
|
26
|
+
getTotalPrice(): BigNumber;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { SwapRouter } from './swapRouter'
|
|
2
|
-
export * from './entities'
|
|
3
|
-
export { UNIVERSAL_ROUTER_ADDRESS, PERMIT2_ADDRESS, ROUTER_AS_RECIPIENT, WETH_ADDRESS } from './utils/constants'
|
|
1
|
+
export { SwapRouter } from './swapRouter';
|
|
2
|
+
export * from './entities';
|
|
3
|
+
export { UNIVERSAL_ROUTER_ADDRESS, PERMIT2_ADDRESS, ROUTER_AS_RECIPIENT, WETH_ADDRESS } from './utils/constants';
|
package/dist/swapRouter.d.ts
CHANGED
|
@@ -1,41 +1,38 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi'
|
|
2
|
-
import { BigNumberish } from 'ethers'
|
|
3
|
-
import { MethodParameters } from '@uniswap/v3-sdk'
|
|
4
|
-
import { Trade as RouterTrade } from '@uniswap/router-sdk'
|
|
5
|
-
import { Currency, TradeType } from '@uniswap/sdk-core'
|
|
6
|
-
import { Command } from './entities/Command'
|
|
7
|
-
import { NFTTrade, SupportedProtocolsData } from './entities/NFTTrade'
|
|
8
|
-
import { SwapOptions } from './entities/protocols/uniswap'
|
|
9
|
-
export declare type SwapRouterConfig = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
declare type SupportedNFTTrade = NFTTrade<SupportedProtocolsData
|
|
14
|
-
export declare abstract class SwapRouter {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
private static encodePlan
|
|
40
|
-
}
|
|
41
|
-
export {}
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BigNumberish } from 'ethers';
|
|
3
|
+
import { MethodParameters } from '@uniswap/v3-sdk';
|
|
4
|
+
import { Trade as RouterTrade } from '@uniswap/router-sdk';
|
|
5
|
+
import { Currency, TradeType } from '@uniswap/sdk-core';
|
|
6
|
+
import { Command } from './entities/Command';
|
|
7
|
+
import { NFTTrade, SupportedProtocolsData } from './entities/NFTTrade';
|
|
8
|
+
import { SwapOptions } from './entities/protocols/uniswap';
|
|
9
|
+
export declare type SwapRouterConfig = {
|
|
10
|
+
sender?: string;
|
|
11
|
+
deadline?: BigNumberish;
|
|
12
|
+
};
|
|
13
|
+
declare type SupportedNFTTrade = NFTTrade<SupportedProtocolsData>;
|
|
14
|
+
export declare abstract class SwapRouter {
|
|
15
|
+
static INTERFACE: Interface;
|
|
16
|
+
static swapCallParameters(trades: Command[] | Command, config?: SwapRouterConfig): MethodParameters;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated in favor of swapCallParameters. Update before next major version 2.0.0
|
|
19
|
+
* Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given swap.
|
|
20
|
+
* @param trades to produce call parameters for
|
|
21
|
+
*/
|
|
22
|
+
static swapNFTCallParameters(trades: SupportedNFTTrade[], config?: SwapRouterConfig): MethodParameters;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated in favor of swapCallParameters. Update before next major version 2.0.0
|
|
25
|
+
* Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
|
|
26
|
+
* @param trades to produce call parameters for
|
|
27
|
+
* @param options options for the call parameters
|
|
28
|
+
*/
|
|
29
|
+
static swapERC20CallParameters(trades: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions): 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
|
+
}
|
|
38
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function registerFixture(key: string, data: any): void
|
|
1
|
+
export declare function registerFixture(key: string, data: any): void;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { MakerOrder, TakerOrder } from '../../src/entities/protocols/looksRare'
|
|
2
|
-
import { BigNumber } from 'ethers'
|
|
3
|
-
export declare type APIOrder = Omit<MakerOrder, 'collection' | 'currency'> & {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export declare function createLooksRareOrders(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
value: BigNumber
|
|
14
|
-
}
|
|
15
|
-
export declare const looksRareOrders: APIOrder[]
|
|
1
|
+
import { MakerOrder, TakerOrder } from '../../src/entities/protocols/looksRare';
|
|
2
|
+
import { BigNumber } from 'ethers';
|
|
3
|
+
export declare type APIOrder = Omit<MakerOrder, 'collection' | 'currency'> & {
|
|
4
|
+
collectionAddress: string;
|
|
5
|
+
currencyAddress: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createLooksRareOrders(apiOrder: APIOrder, taker: string): {
|
|
8
|
+
makerOrder: MakerOrder;
|
|
9
|
+
takerOrder: TakerOrder;
|
|
10
|
+
value: BigNumber;
|
|
11
|
+
};
|
|
12
|
+
export declare const looksRareOrders: APIOrder[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SeaportData } from '../../src/entities/protocols/seaport'
|
|
2
|
-
import { BigNumber } from 'ethers'
|
|
3
|
-
export declare const seaportData2Covens: SeaportData
|
|
4
|
-
export declare const seaportValue: BigNumber
|
|
1
|
+
import { SeaportData } from '../../src/entities/protocols/seaport';
|
|
2
|
+
import { BigNumber } from 'ethers';
|
|
3
|
+
export declare const seaportData2Covens: SeaportData;
|
|
4
|
+
export declare const seaportValue: BigNumber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SeaportData } from '../../src/entities/protocols/seaport'
|
|
2
|
-
import { BigNumber } from 'ethers'
|
|
3
|
-
export declare const seaportV1_4Data: SeaportData
|
|
4
|
-
export declare const seaportV1_4Value: BigNumber
|
|
1
|
+
import { SeaportData } from '../../src/entities/protocols/seaport';
|
|
2
|
+
import { BigNumber } from 'ethers';
|
|
3
|
+
export declare const seaportV1_4Data: SeaportData;
|
|
4
|
+
export declare const seaportV1_4Value: BigNumber;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const x2y2Orders: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}[]
|
|
1
|
+
export declare const x2y2Orders: {
|
|
2
|
+
input: string;
|
|
3
|
+
order_id: number;
|
|
4
|
+
token_id: string;
|
|
5
|
+
price: string;
|
|
6
|
+
}[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PERMIT2_ADDRESS: string
|
|
2
|
-
export declare const ROUTER_ADDRESS: string
|
|
1
|
+
export declare const PERMIT2_ADDRESS: string;
|
|
2
|
+
export declare const ROUTER_ADDRESS: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BigNumberish } from 'ethers'
|
|
2
|
-
export declare function hexToDecimalString(hex: BigNumberish): string
|
|
1
|
+
import { BigNumberish } from 'ethers';
|
|
2
|
+
export declare function hexToDecimalString(hex: BigNumberish): string;
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import { Wallet } from 'ethers'
|
|
2
|
-
import { PermitSingle } from '@uniswap/permit2-sdk'
|
|
3
|
-
import { Permit2Permit } from '../../src/utils/permit2'
|
|
4
|
-
export declare function generatePermitSignature(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
permitAddress?: string
|
|
9
|
-
): Promise<string>
|
|
10
|
-
export declare function generateEip2098PermitSignature(
|
|
11
|
-
permit: PermitSingle,
|
|
12
|
-
signer: Wallet,
|
|
13
|
-
chainId: number,
|
|
14
|
-
permitAddress?: string
|
|
15
|
-
): Promise<string>
|
|
16
|
-
export declare function toInputPermit(signature: string, permit: PermitSingle): Permit2Permit
|
|
17
|
-
export declare function makePermit(token: string, amount?: string, nonce?: string, routerAddress?: string): PermitSingle
|
|
1
|
+
import { Wallet } from 'ethers';
|
|
2
|
+
import { PermitSingle } from '@uniswap/permit2-sdk';
|
|
3
|
+
import { Permit2Permit } from '../../src/utils/permit2';
|
|
4
|
+
export declare function generatePermitSignature(permit: PermitSingle, signer: Wallet, chainId: number, permitAddress?: string): Promise<string>;
|
|
5
|
+
export declare function generateEip2098PermitSignature(permit: PermitSingle, signer: Wallet, chainId: number, permitAddress?: string): Promise<string>;
|
|
6
|
+
export declare function toInputPermit(signature: string, permit: PermitSingle): Permit2Permit;
|
|
7
|
+
export declare function makePermit(token: string, amount?: string, nonce?: string, routerAddress?: string): PermitSingle;
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import { MixedRouteTrade, Trade as RouterTrade } from '@uniswap/router-sdk'
|
|
2
|
-
import { Trade as V2Trade, Pair } from '@uniswap/v2-sdk'
|
|
3
|
-
import { Trade as V3Trade, Pool, FeeAmount } from '@uniswap/v3-sdk'
|
|
4
|
-
import { SwapOptions } from '../../src'
|
|
5
|
-
import { TradeType, Ether, Token, Currency } from '@uniswap/sdk-core'
|
|
6
|
-
export declare const ETHER: Ether
|
|
7
|
-
export declare const RECIPIENT =
|
|
8
|
-
export declare const WETH: Token
|
|
9
|
-
export declare const DAI: Token
|
|
10
|
-
export declare const USDC: Token
|
|
11
|
-
export declare const FEE_AMOUNT = FeeAmount.MEDIUM
|
|
12
|
-
declare type UniswapPools = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
export declare function getUniswapPools(forkBlock?: number): Promise<UniswapPools
|
|
20
|
-
export declare function getPair(tokenA: Token, tokenB: Token, blockNumber: number): Promise<Pair
|
|
21
|
-
export declare function getPool(tokenA: Token, tokenB: Token, feeAmount: FeeAmount, blockNumber: number): Promise<Pool
|
|
22
|
-
export declare function swapOptions(options: Partial<SwapOptions>): SwapOptions
|
|
23
|
-
export declare function buildTrade(
|
|
24
|
-
|
|
25
|
-
| V2Trade<Currency, Currency, TradeType>
|
|
26
|
-
| V3Trade<Currency, Currency, TradeType>
|
|
27
|
-
| MixedRouteTrade<Currency, Currency, TradeType>
|
|
28
|
-
)[]
|
|
29
|
-
): RouterTrade<Currency, Currency, TradeType>
|
|
30
|
-
export {}
|
|
1
|
+
import { MixedRouteTrade, Trade as RouterTrade } from '@uniswap/router-sdk';
|
|
2
|
+
import { Trade as V2Trade, Pair } from '@uniswap/v2-sdk';
|
|
3
|
+
import { Trade as V3Trade, Pool, FeeAmount } from '@uniswap/v3-sdk';
|
|
4
|
+
import { SwapOptions } from '../../src';
|
|
5
|
+
import { TradeType, Ether, Token, Currency } from '@uniswap/sdk-core';
|
|
6
|
+
export declare const ETHER: Ether;
|
|
7
|
+
export declare const RECIPIENT = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
8
|
+
export declare const WETH: Token;
|
|
9
|
+
export declare const DAI: Token;
|
|
10
|
+
export declare const USDC: Token;
|
|
11
|
+
export declare const FEE_AMOUNT = FeeAmount.MEDIUM;
|
|
12
|
+
declare type UniswapPools = {
|
|
13
|
+
WETH_USDC_V2: Pair;
|
|
14
|
+
USDC_DAI_V2: Pair;
|
|
15
|
+
WETH_USDC_V3: Pool;
|
|
16
|
+
WETH_USDC_V3_LOW_FEE: Pool;
|
|
17
|
+
USDC_DAI_V3: Pool;
|
|
18
|
+
};
|
|
19
|
+
export declare function getUniswapPools(forkBlock?: number): Promise<UniswapPools>;
|
|
20
|
+
export declare function getPair(tokenA: Token, tokenB: Token, blockNumber: number): Promise<Pair>;
|
|
21
|
+
export declare function getPool(tokenA: Token, tokenB: Token, feeAmount: FeeAmount, blockNumber: number): Promise<Pool>;
|
|
22
|
+
export declare function swapOptions(options: Partial<SwapOptions>): SwapOptions;
|
|
23
|
+
export declare function buildTrade(trades: (V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType>)[]): RouterTrade<Currency, Currency, TradeType>;
|
|
24
|
+
export {};
|
|
@@ -7019,7 +7019,7 @@ var SeaportTrade = /*#__PURE__*/function (_NFTTrade) {
|
|
|
7019
7019
|
} else {
|
|
7020
7020
|
calldata = SeaportTrade.INTERFACE.encodeFunctionData('fulfillAvailableAdvancedOrders', [advancedOrders, [], orderFulfillments, considerationFulFillments, SeaportTrade.OPENSEA_CONDUIT_KEY, order.recipient, 100]);
|
|
7021
7021
|
}
|
|
7022
|
-
planner.addCommand(this.commandMap(order.version), [this.
|
|
7022
|
+
planner.addCommand(this.commandMap(order.version), [this.getTotalOrderPrice(order).toString(), calldata], config.allowRevert);
|
|
7023
7023
|
}
|
|
7024
7024
|
};
|
|
7025
7025
|
_proto.getBuyItems = function getBuyItems() {
|
|
@@ -7040,12 +7040,20 @@ var SeaportTrade = /*#__PURE__*/function (_NFTTrade) {
|
|
|
7040
7040
|
}
|
|
7041
7041
|
return buyItems;
|
|
7042
7042
|
};
|
|
7043
|
+
_proto.getTotalOrderPrice = function getTotalOrderPrice(order) {
|
|
7044
|
+
var totalOrderPrice = ethers.BigNumber.from(0);
|
|
7045
|
+
for (var _iterator6 = _createForOfIteratorHelperLoose(order.items), _step6; !(_step6 = _iterator6()).done;) {
|
|
7046
|
+
var item = _step6.value;
|
|
7047
|
+
totalOrderPrice = totalOrderPrice.add(this.calculateValue(item.parameters.consideration));
|
|
7048
|
+
}
|
|
7049
|
+
return totalOrderPrice;
|
|
7050
|
+
};
|
|
7043
7051
|
_proto.getTotalPrice = function getTotalPrice() {
|
|
7044
7052
|
var totalPrice = ethers.BigNumber.from(0);
|
|
7045
|
-
for (var
|
|
7046
|
-
var order =
|
|
7047
|
-
for (var
|
|
7048
|
-
var item =
|
|
7053
|
+
for (var _iterator7 = _createForOfIteratorHelperLoose(this.orders), _step7; !(_step7 = _iterator7()).done;) {
|
|
7054
|
+
var order = _step7.value;
|
|
7055
|
+
for (var _iterator8 = _createForOfIteratorHelperLoose(order.items), _step8; !(_step8 = _iterator8()).done;) {
|
|
7056
|
+
var item = _step8.value;
|
|
7049
7057
|
totalPrice = totalPrice.add(this.calculateValue(item.parameters.consideration));
|
|
7050
7058
|
}
|
|
7051
7059
|
}
|