@uniswap/universal-router-sdk 1.4.4 → 1.5.0-beta.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/dist/entities/NFTTrade.d.ts +7 -5
- package/dist/entities/protocols/element-market.d.ts +44 -0
- package/dist/entities/protocols/index.d.ts +1 -1
- package/dist/entities/protocols/looksRareV2.d.ts +56 -0
- package/dist/entities/protocols/nftx.d.ts +1 -1
- package/dist/entities/protocols/seaport.d.ts +11 -7
- package/dist/entities/protocols/uniswap.d.ts +1 -1
- package/dist/entities/protocols/unwrapWETH.d.ts +1 -2
- package/dist/test/orders/element.d.ts +7 -0
- package/dist/test/orders/looksRareV2.d.ts +2 -0
- package/dist/test/orders/seaport.d.ts +4 -3
- package/dist/test/orders/seaportV1_4.d.ts +2 -3
- package/dist/test/utils/addresses.d.ts +5 -0
- package/dist/test/utils/permit2.d.ts +1 -1
- package/dist/test/utils/uniswapData.d.ts +0 -1
- package/dist/universal-router-sdk.cjs.development.js +1744 -740
- 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 +1745 -742
- package/dist/universal-router-sdk.esm.js.map +1 -1
- package/dist/utils/constants.d.ts +5 -0
- package/dist/utils/inputTokens.d.ts +21 -0
- package/dist/utils/routerCommands.d.ts +11 -5
- package/package.json +6 -4
- package/dist/entities/protocols/looksRare.d.ts +0 -44
- package/dist/test/orders/looksRare.d.ts +0 -12
- package/dist/utils/permit2.d.ts +0 -6
|
@@ -5,11 +5,12 @@ import { NFTXData } from './protocols/nftx';
|
|
|
5
5
|
import { NFT20Data } from './protocols/nft20';
|
|
6
6
|
import { RoutePlanner } from '../utils/routerCommands';
|
|
7
7
|
import { Command, RouterTradeType, TradeConfig } from './Command';
|
|
8
|
-
import { LooksRareData } from './protocols/looksRare';
|
|
9
8
|
import { SudoswapData } from './protocols/sudoswap';
|
|
10
9
|
import { CryptopunkData } from './protocols/cryptopunk';
|
|
11
10
|
import { X2Y2Data } from './protocols/x2y2';
|
|
12
|
-
|
|
11
|
+
import { ElementData } from './protocols/element-market';
|
|
12
|
+
import { LooksRareV2Data } from './protocols/looksRareV2';
|
|
13
|
+
export declare type SupportedProtocolsData = SeaportData | FoundationData | NFTXData | LooksRareV2Data | X2Y2Data | CryptopunkData | NFT20Data | SudoswapData | ElementData;
|
|
13
14
|
export declare abstract class NFTTrade<T> implements Command {
|
|
14
15
|
readonly tradeType: RouterTradeType;
|
|
15
16
|
readonly orders: T[];
|
|
@@ -17,7 +18,7 @@ export declare abstract class NFTTrade<T> implements Command {
|
|
|
17
18
|
constructor(market: Market, orders: T[]);
|
|
18
19
|
abstract encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
19
20
|
abstract getBuyItems(): BuyItem[];
|
|
20
|
-
abstract getTotalPrice(): BigNumber;
|
|
21
|
+
abstract getTotalPrice(token?: string): BigNumber;
|
|
21
22
|
}
|
|
22
23
|
export declare type BuyItem = {
|
|
23
24
|
tokenAddress: string;
|
|
@@ -27,13 +28,14 @@ export declare type BuyItem = {
|
|
|
27
28
|
};
|
|
28
29
|
export declare enum Market {
|
|
29
30
|
Foundation = "foundation",
|
|
30
|
-
|
|
31
|
+
LooksRareV2 = "looksrareV2",
|
|
31
32
|
NFT20 = "nft20",
|
|
32
33
|
NFTX = "nftx",
|
|
33
34
|
Seaport = "seaport",
|
|
34
35
|
Sudoswap = "Sudoswap",
|
|
35
36
|
Cryptopunks = "cryptopunks",
|
|
36
|
-
X2Y2 = "x2y2"
|
|
37
|
+
X2Y2 = "x2y2",
|
|
38
|
+
Element = "element"
|
|
37
39
|
}
|
|
38
40
|
export declare enum TokenType {
|
|
39
41
|
ERC721 = "ERC721",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BuyItem, NFTTrade } from '../NFTTrade';
|
|
3
|
+
import { TradeConfig } from '../Command';
|
|
4
|
+
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
+
import { BigNumber } from 'ethers';
|
|
6
|
+
export interface Fee {
|
|
7
|
+
recipient: string;
|
|
8
|
+
amount: string;
|
|
9
|
+
feeData: string;
|
|
10
|
+
}
|
|
11
|
+
declare type ElementPartialData = {
|
|
12
|
+
maker: string;
|
|
13
|
+
taker: string;
|
|
14
|
+
expiry: string;
|
|
15
|
+
nonce: string;
|
|
16
|
+
erc20Token: string;
|
|
17
|
+
erc20TokenAmount: string;
|
|
18
|
+
fees: Fee[];
|
|
19
|
+
};
|
|
20
|
+
export declare type ERC721SellOrder = ElementPartialData & {
|
|
21
|
+
nft: string;
|
|
22
|
+
nftId: string;
|
|
23
|
+
};
|
|
24
|
+
export declare type OrderSignature = {
|
|
25
|
+
signatureType: number;
|
|
26
|
+
v: number;
|
|
27
|
+
r: string;
|
|
28
|
+
s: string;
|
|
29
|
+
};
|
|
30
|
+
export declare type ElementData = {
|
|
31
|
+
order: ERC721SellOrder;
|
|
32
|
+
signature: OrderSignature;
|
|
33
|
+
recipient: string;
|
|
34
|
+
};
|
|
35
|
+
export declare class ElementTrade extends NFTTrade<ElementData> {
|
|
36
|
+
private static ETH_ADDRESS;
|
|
37
|
+
static INTERFACE: Interface;
|
|
38
|
+
constructor(orders: ElementData[]);
|
|
39
|
+
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
40
|
+
getBuyItems(): BuyItem[];
|
|
41
|
+
getTotalPrice(): BigNumber;
|
|
42
|
+
getOrderPriceIncludingFees(order: ERC721SellOrder): BigNumber;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BuyItem, NFTTrade } from '../NFTTrade';
|
|
3
|
+
import { TradeConfig } from '../Command';
|
|
4
|
+
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
+
import { BigNumber } from 'ethers';
|
|
6
|
+
export declare type MakerOrder = {
|
|
7
|
+
quoteType: number;
|
|
8
|
+
globalNonce: string;
|
|
9
|
+
subsetNonce: string;
|
|
10
|
+
orderNonce: string;
|
|
11
|
+
strategyId: number;
|
|
12
|
+
collectionType: number;
|
|
13
|
+
collection: string;
|
|
14
|
+
currency: string;
|
|
15
|
+
signer: string;
|
|
16
|
+
startTime: number;
|
|
17
|
+
endTime: number;
|
|
18
|
+
price: string;
|
|
19
|
+
itemIds: string[];
|
|
20
|
+
amounts: string[];
|
|
21
|
+
additionalParameters: string;
|
|
22
|
+
};
|
|
23
|
+
export declare type TakerOrder = {
|
|
24
|
+
recipient: string;
|
|
25
|
+
additionalParameters: string;
|
|
26
|
+
};
|
|
27
|
+
export declare type MerkleProof = {
|
|
28
|
+
value: string;
|
|
29
|
+
position: number;
|
|
30
|
+
};
|
|
31
|
+
export declare type MerkleTree = {
|
|
32
|
+
root: string;
|
|
33
|
+
proof: MerkleProof[];
|
|
34
|
+
};
|
|
35
|
+
export declare type LRV2APIOrder = MakerOrder & {
|
|
36
|
+
id: string;
|
|
37
|
+
hash: string;
|
|
38
|
+
signature: string;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
merkleRoot: string;
|
|
41
|
+
merkleProof: MerkleProof[];
|
|
42
|
+
status: string;
|
|
43
|
+
};
|
|
44
|
+
export declare type LooksRareV2Data = {
|
|
45
|
+
apiOrder: LRV2APIOrder;
|
|
46
|
+
taker: string;
|
|
47
|
+
};
|
|
48
|
+
export declare class LooksRareV2Trade extends NFTTrade<LooksRareV2Data> {
|
|
49
|
+
static INTERFACE: Interface;
|
|
50
|
+
private static ERC721_ORDER;
|
|
51
|
+
constructor(orders: LooksRareV2Data[]);
|
|
52
|
+
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
53
|
+
getBuyItems(): BuyItem[];
|
|
54
|
+
getTotalPrice(): BigNumber;
|
|
55
|
+
private refactorAPIData;
|
|
56
|
+
}
|
|
@@ -5,11 +5,11 @@ import { RoutePlanner } from '../../utils/routerCommands';
|
|
|
5
5
|
import { BigNumber, BigNumberish } from 'ethers';
|
|
6
6
|
export declare type NFTXData = {
|
|
7
7
|
recipient: string;
|
|
8
|
-
vaultAddress: string;
|
|
9
8
|
vaultId: BigNumberish;
|
|
10
9
|
tokenAddress: string;
|
|
11
10
|
tokenIds: BigNumberish[];
|
|
12
11
|
value: BigNumber;
|
|
12
|
+
swapCalldata: string;
|
|
13
13
|
};
|
|
14
14
|
export declare class NFTXTrade extends NFTTrade<NFTXData> {
|
|
15
15
|
static INTERFACE: Interface;
|
|
@@ -3,14 +3,18 @@ import { Interface } from '@ethersproject/abi';
|
|
|
3
3
|
import { BuyItem, NFTTrade } from '../NFTTrade';
|
|
4
4
|
import { TradeConfig } from '../Command';
|
|
5
5
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
6
|
-
|
|
7
|
-
V1_1 = 0,
|
|
8
|
-
V1_4 = 1
|
|
9
|
-
}
|
|
6
|
+
import { Permit2Permit } from '../../utils/inputTokens';
|
|
10
7
|
export declare type SeaportData = {
|
|
11
8
|
items: Order[];
|
|
12
9
|
recipient: string;
|
|
13
|
-
|
|
10
|
+
protocolAddress: string;
|
|
11
|
+
inputTokenProcessing?: InputTokenProcessing[];
|
|
12
|
+
};
|
|
13
|
+
export declare type InputTokenProcessing = {
|
|
14
|
+
token: string;
|
|
15
|
+
permit2Permit?: Permit2Permit;
|
|
16
|
+
protocolApproval: boolean;
|
|
17
|
+
permit2TransferFrom: boolean;
|
|
14
18
|
};
|
|
15
19
|
export declare type FulfillmentComponent = {
|
|
16
20
|
orderIndex: BigNumberish;
|
|
@@ -54,8 +58,8 @@ export declare class SeaportTrade extends NFTTrade<SeaportData> {
|
|
|
54
58
|
constructor(orders: SeaportData[]);
|
|
55
59
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
56
60
|
getBuyItems(): BuyItem[];
|
|
57
|
-
getTotalOrderPrice(order: SeaportData): BigNumber;
|
|
58
|
-
getTotalPrice(): BigNumber;
|
|
61
|
+
getTotalOrderPrice(order: SeaportData, token?: string): BigNumber;
|
|
62
|
+
getTotalPrice(token?: string): BigNumber;
|
|
59
63
|
private commandMap;
|
|
60
64
|
private getConsiderationFulfillments;
|
|
61
65
|
private getAdvancedOrderParams;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
2
2
|
import { Trade as RouterTrade, SwapOptions as RouterSwapOptions } from '@uniswap/router-sdk';
|
|
3
|
-
import { Permit2Permit } from '../../utils/
|
|
3
|
+
import { Permit2Permit } from '../../utils/inputTokens';
|
|
4
4
|
import { Currency, TradeType } from '@uniswap/sdk-core';
|
|
5
5
|
import { Command, RouterTradeType, TradeConfig } from '../Command';
|
|
6
6
|
export declare type SwapOptions = Omit<RouterSwapOptions, 'inputTokenPermit'> & {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { BigNumberish } from 'ethers';
|
|
2
2
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
3
|
-
import { Permit2Permit } from '../../utils/
|
|
3
|
+
import { Permit2Permit } from '../../utils/inputTokens';
|
|
4
4
|
import { Command, RouterTradeType, TradeConfig } from '../Command';
|
|
5
5
|
export declare class UnwrapWETH implements Command {
|
|
6
6
|
readonly tradeType: RouterTradeType;
|
|
7
7
|
readonly permit2Data: Permit2Permit;
|
|
8
8
|
readonly wethAddress: string;
|
|
9
|
-
readonly routerAddress: string;
|
|
10
9
|
readonly amount: BigNumberish;
|
|
11
10
|
constructor(amount: BigNumberish, chainId: number, permit2?: Permit2Permit);
|
|
12
11
|
encode(planner: RoutePlanner, _: TradeConfig): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ElementData, OrderSignature, ERC721SellOrder } from '../../src/entities/protocols/element-market';
|
|
2
|
+
export declare const elementOrderETH: ERC721SellOrder;
|
|
3
|
+
export declare const elementSignatureETH: OrderSignature;
|
|
4
|
+
export declare const elementOrderETH_WithFees: ERC721SellOrder;
|
|
5
|
+
export declare const elementOrderETH_WithFees_Signature: OrderSignature;
|
|
6
|
+
export declare const elementDataETH: ElementData;
|
|
7
|
+
export declare const elementDataETH_WithFees: ElementData;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SeaportData } from '../../src/entities/protocols/seaport';
|
|
1
|
+
import { ConsiderationItem, SeaportData } from '../../src/entities/protocols/seaport';
|
|
2
2
|
import { BigNumber } from 'ethers';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const seaportDataETH: SeaportData;
|
|
4
|
+
export declare const seaportDataERC20: SeaportData;
|
|
5
|
+
export declare function calculateSeaportValue(considerations: ConsiderationItem[], token: string): BigNumber;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { SeaportData } from '../../src/entities/protocols/seaport';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const seaportV1_4Value: BigNumber;
|
|
2
|
+
export declare const seaportV1_4DataETH: SeaportData;
|
|
3
|
+
export declare const seaportV1_4DataETHRecent: SeaportData;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
export declare const MAINNET_ROUTER_ADDRESS: string;
|
|
2
|
+
export declare const FORGE_ROUTER_ADDRESS = "0xe808c1cfeebb6cb36b537b82fa7c9eef31415a05";
|
|
3
|
+
export declare const FORGE_PERMIT2_ADDRESS = "0x4a873bdd49f7f9cc0a5458416a12973fab208f8d";
|
|
4
|
+
export declare const FORGE_SENDER_ADDRESS = "0xcf03dd0a894ef79cb5b601a43c4b25e3ae4c67ed";
|
|
5
|
+
export declare const TEST_RECIPIENT_ADDRESS = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
1
6
|
export declare const PERMIT2_ADDRESS: string;
|
|
2
7
|
export declare const ROUTER_ADDRESS: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
2
|
import { PermitSingle } from '@uniswap/permit2-sdk';
|
|
3
|
-
import { Permit2Permit } from '../../src/utils/
|
|
3
|
+
import { Permit2Permit } from '../../src/utils/inputTokens';
|
|
4
4
|
export declare function generatePermitSignature(permit: PermitSingle, signer: Wallet, chainId: number, permitAddress?: string): Promise<string>;
|
|
5
5
|
export declare function generateEip2098PermitSignature(permit: PermitSingle, signer: Wallet, chainId: number, permitAddress?: string): Promise<string>;
|
|
6
6
|
export declare function toInputPermit(signature: string, permit: PermitSingle): Permit2Permit;
|
|
@@ -4,7 +4,6 @@ import { Trade as V3Trade, Pool, FeeAmount } from '@uniswap/v3-sdk';
|
|
|
4
4
|
import { SwapOptions } from '../../src';
|
|
5
5
|
import { TradeType, Ether, Token, Currency } from '@uniswap/sdk-core';
|
|
6
6
|
export declare const ETHER: Ether;
|
|
7
|
-
export declare const RECIPIENT = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
8
7
|
export declare const WETH: Token;
|
|
9
8
|
export declare const DAI: Token;
|
|
10
9
|
export declare const USDC: Token;
|