@uniswap/universal-router-sdk 3.0.3 → 3.0.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.
Files changed (34) hide show
  1. package/README.md +3 -77
  2. package/dist/entities/Command.d.ts +2 -3
  3. package/dist/entities/actions/index.d.ts +2 -0
  4. package/dist/entities/{protocols → actions}/uniswap.d.ts +2 -2
  5. package/dist/entities/{protocols → actions}/unwrapWETH.d.ts +2 -2
  6. package/dist/entities/index.d.ts +1 -2
  7. package/dist/swapRouter.d.ts +2 -20
  8. package/dist/universal-router-sdk.cjs.development.js +12 -10077
  9. package/dist/universal-router-sdk.cjs.development.js.map +1 -1
  10. package/dist/universal-router-sdk.cjs.production.min.js +1 -1
  11. package/dist/universal-router-sdk.cjs.production.min.js.map +1 -1
  12. package/dist/universal-router-sdk.esm.js +14 -10072
  13. package/dist/universal-router-sdk.esm.js.map +1 -1
  14. package/dist/utils/constants.d.ts +0 -2
  15. package/dist/utils/inputTokens.d.ts +0 -1
  16. package/dist/utils/routerCommands.d.ts +1 -17
  17. package/package.json +7 -5
  18. package/dist/entities/NFTTrade.d.ts +0 -44
  19. package/dist/entities/protocols/cryptopunk.d.ts +0 -16
  20. package/dist/entities/protocols/element-market.d.ts +0 -44
  21. package/dist/entities/protocols/foundation.d.ts +0 -19
  22. package/dist/entities/protocols/index.d.ts +0 -10
  23. package/dist/entities/protocols/looksRareV2.d.ts +0 -56
  24. package/dist/entities/protocols/nft20.d.ts +0 -21
  25. package/dist/entities/protocols/nftx.d.ts +0 -20
  26. package/dist/entities/protocols/seaport.d.ts +0 -69
  27. package/dist/entities/protocols/sudoswap.d.ts +0 -27
  28. package/dist/entities/protocols/x2y2.d.ts +0 -28
  29. package/dist/test/orders/element.d.ts +0 -7
  30. package/dist/test/orders/looksRareV2.d.ts +0 -2
  31. package/dist/test/orders/seaportV1_4.d.ts +0 -4
  32. package/dist/test/orders/seaportV1_5.d.ts +0 -4
  33. package/dist/test/orders/x2y2.d.ts +0 -6
  34. package/dist/utils/getNativeCurrencyValue.d.ts +0 -2
package/package.json CHANGED
@@ -19,22 +19,24 @@
19
19
  "build": "tsdx build",
20
20
  "docs": "typedoc",
21
21
  "forge:fix": "forge fmt",
22
- "install:ur": "cd node_modules/@uniswap/universal-router && forge install",
23
22
  "lint": "yarn prettier",
24
23
  "lint:fix": "yarn prettier:fix && yarn forge:fix",
25
24
  "prettier": "prettier --check '**/*.ts' && prettier --check '**/*.json'",
26
25
  "prettier:fix": "prettier --write '**/*.ts' && prettier --write '**/*.json'",
27
26
  "release": "semantic-release",
28
27
  "test": "yarn test:hardhat && yarn test:forge",
29
- "test:forge": "yarn install:ur && forge test",
28
+ "test:forge": "forge test",
30
29
  "test:hardhat": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' hardhat test"
31
30
  },
32
31
  "dependencies": {
32
+ "@openzeppelin/contracts": "4.7.0",
33
33
  "@uniswap/permit2-sdk": "^1.3.0",
34
- "@uniswap/router-sdk": "^1.10.0",
34
+ "@uniswap/router-sdk": "^1.11.0",
35
35
  "@uniswap/sdk-core": "^5.3.1",
36
- "@uniswap/universal-router": "1.6.0",
36
+ "@uniswap/universal-router": "2.0.0-beta.1",
37
+ "@uniswap/v2-core": "^1.0.1",
37
38
  "@uniswap/v2-sdk": "^4.4.1",
39
+ "@uniswap/v3-core": "1.0.0",
38
40
  "@uniswap/v3-sdk": "^3.13.1",
39
41
  "@uniswap/v4-sdk": "^1.0.0",
40
42
  "bignumber.js": "^9.0.2",
@@ -98,5 +100,5 @@
98
100
  "installConfig": {
99
101
  "hoistingLimits": "workspaces"
100
102
  },
101
- "version": "3.0.3"
103
+ "version": "3.0.4"
102
104
  }
@@ -1,44 +0,0 @@
1
- import { BigNumber, BigNumberish } from 'ethers';
2
- import { SeaportData } from './protocols/seaport';
3
- import { FoundationData } from './protocols/foundation';
4
- import { NFTXData } from './protocols/nftx';
5
- import { NFT20Data } from './protocols/nft20';
6
- import { RoutePlanner } from '../utils/routerCommands';
7
- import { Command, RouterTradeType, TradeConfig } from './Command';
8
- import { SudoswapData } from './protocols/sudoswap';
9
- import { CryptopunkData } from './protocols/cryptopunk';
10
- import { X2Y2Data } from './protocols/x2y2';
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;
14
- export declare abstract class NFTTrade<T> implements Command {
15
- readonly tradeType: RouterTradeType;
16
- readonly orders: T[];
17
- readonly market: Market;
18
- constructor(market: Market, orders: T[]);
19
- abstract encode(planner: RoutePlanner, config: TradeConfig): void;
20
- abstract getBuyItems(): BuyItem[];
21
- abstract getTotalPrice(token?: string): BigNumber;
22
- }
23
- export declare type BuyItem = {
24
- tokenAddress: string;
25
- tokenId: BigNumberish;
26
- tokenType: TokenType;
27
- amount?: BigNumberish;
28
- };
29
- export declare enum Market {
30
- Foundation = "foundation",
31
- LooksRareV2 = "looksrareV2",
32
- NFT20 = "nft20",
33
- NFTX = "nftx",
34
- Seaport = "seaport",
35
- Sudoswap = "Sudoswap",
36
- Cryptopunks = "cryptopunks",
37
- X2Y2 = "x2y2",
38
- Element = "element"
39
- }
40
- export declare enum TokenType {
41
- ERC721 = "ERC721",
42
- ERC1155 = "ERC1155",
43
- Cryptopunk = "Cryptopunk"
44
- }
@@ -1,16 +0,0 @@
1
- import { TradeConfig } from '../Command';
2
- import { NFTTrade, BuyItem } from '../NFTTrade';
3
- import { RoutePlanner } from '../../utils/routerCommands';
4
- import { BigNumber, BigNumberish } from 'ethers';
5
- export declare type CryptopunkData = {
6
- tokenId: BigNumberish;
7
- recipient: string;
8
- value: BigNumberish;
9
- };
10
- export declare class CryptopunkTrade extends NFTTrade<CryptopunkData> {
11
- static CRYPTOPUNK_ADDRESS: string;
12
- constructor(orders: CryptopunkData[]);
13
- encode(planner: RoutePlanner, config: TradeConfig): void;
14
- getBuyItems(): BuyItem[];
15
- getTotalPrice(): BigNumber;
16
- }
@@ -1,44 +0,0 @@
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 {};
@@ -1,19 +0,0 @@
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, BigNumberish } from 'ethers';
6
- export declare type FoundationData = {
7
- recipient: string;
8
- tokenAddress: string;
9
- tokenId: BigNumberish;
10
- price: BigNumberish;
11
- referrer: string;
12
- };
13
- export declare class FoundationTrade extends NFTTrade<FoundationData> {
14
- static INTERFACE: Interface;
15
- constructor(orders: FoundationData[]);
16
- encode(planner: RoutePlanner, config: TradeConfig): void;
17
- getBuyItems(): BuyItem[];
18
- getTotalPrice(): BigNumber;
19
- }
@@ -1,10 +0,0 @@
1
- export * from './cryptopunk';
2
- export * from './foundation';
3
- export * from './looksRareV2';
4
- export * from './nft20';
5
- export * from './nftx';
6
- export * from './seaport';
7
- export * from './uniswap';
8
- export * from './sudoswap';
9
- export * from './x2y2';
10
- export * from './unwrapWETH';
@@ -1,56 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { TradeConfig } from '../Command';
3
- import { NFTTrade, BuyItem } from '../NFTTrade';
4
- import { RoutePlanner } from '../../utils/routerCommands';
5
- import { BigNumber, BigNumberish } from 'ethers';
6
- export declare type NFT20Data = {
7
- tokenAddress: string;
8
- tokenIds: BigNumberish[];
9
- tokenAmounts: BigNumberish[];
10
- recipient: string;
11
- fee: BigNumberish;
12
- isV3: boolean;
13
- value: BigNumberish;
14
- };
15
- export declare class NFT20Trade extends NFTTrade<NFT20Data> {
16
- static INTERFACE: Interface;
17
- constructor(orders: NFT20Data[]);
18
- encode(planner: RoutePlanner, config: TradeConfig): void;
19
- getBuyItems(): BuyItem[];
20
- getTotalPrice(): BigNumber;
21
- }
@@ -1,20 +0,0 @@
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, BigNumberish } from 'ethers';
6
- export declare type NFTXData = {
7
- recipient: string;
8
- vaultId: BigNumberish;
9
- tokenAddress: string;
10
- tokenIds: BigNumberish[];
11
- value: BigNumber;
12
- swapCalldata: string;
13
- };
14
- export declare class NFTXTrade extends NFTTrade<NFTXData> {
15
- static INTERFACE: Interface;
16
- constructor(orders: NFTXData[]);
17
- encode(planner: RoutePlanner, config: TradeConfig): void;
18
- getBuyItems(): BuyItem[];
19
- getTotalPrice(): BigNumber;
20
- }
@@ -1,69 +0,0 @@
1
- import { BigNumber, BigNumberish } from 'ethers';
2
- import { Interface } from '@ethersproject/abi';
3
- import { BuyItem, NFTTrade } from '../NFTTrade';
4
- import { TradeConfig } from '../Command';
5
- import { RoutePlanner } from '../../utils/routerCommands';
6
- import { Permit2Permit } from '../../utils/inputTokens';
7
- export declare type SeaportData = {
8
- items: Order[];
9
- recipient: string;
10
- protocolAddress: string;
11
- inputTokenProcessing?: InputTokenProcessing[];
12
- };
13
- export declare type InputTokenProcessing = {
14
- token: string;
15
- permit2Permit?: Permit2Permit;
16
- protocolApproval: boolean;
17
- permit2TransferFrom: boolean;
18
- };
19
- export declare type FulfillmentComponent = {
20
- orderIndex: BigNumberish;
21
- itemIndex: BigNumberish;
22
- };
23
- export declare type OfferItem = {
24
- itemType: BigNumberish;
25
- token: string;
26
- identifierOrCriteria: BigNumberish;
27
- startAmount: BigNumberish;
28
- endAmount: BigNumberish;
29
- };
30
- export declare type ConsiderationItem = OfferItem & {
31
- recipient: string;
32
- };
33
- export declare type Order = {
34
- parameters: OrderParameters;
35
- signature: string;
36
- };
37
- declare type OrderParameters = {
38
- offerer: string;
39
- offer: OfferItem[];
40
- consideration: ConsiderationItem[];
41
- orderType: BigNumberish;
42
- startTime: BigNumberish;
43
- endTime: BigNumberish;
44
- zoneHash: string;
45
- zone: string;
46
- salt: BigNumberish;
47
- conduitKey: string;
48
- totalOriginalConsiderationItems: BigNumberish;
49
- };
50
- export declare type AdvancedOrder = Order & {
51
- numerator: BigNumber;
52
- denominator: BigNumber;
53
- extraData: string;
54
- };
55
- export declare class SeaportTrade extends NFTTrade<SeaportData> {
56
- static INTERFACE: Interface;
57
- static OPENSEA_CONDUIT_KEY: string;
58
- constructor(orders: SeaportData[]);
59
- encode(planner: RoutePlanner, config: TradeConfig): void;
60
- getBuyItems(): BuyItem[];
61
- getInputTokens(): Set<string>;
62
- getTotalOrderPrice(order: SeaportData, token?: string): BigNumber;
63
- getTotalPrice(token?: string): BigNumber;
64
- private commandMap;
65
- private getConsiderationFulfillments;
66
- private getAdvancedOrderParams;
67
- private calculateValue;
68
- }
69
- export {};
@@ -1,27 +0,0 @@
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, BigNumberish } from 'ethers';
6
- declare type PairSwap = {
7
- swapInfo: {
8
- pair: string;
9
- nftIds: BigNumberish[];
10
- };
11
- tokenAddress: string;
12
- maxCost: BigNumberish;
13
- };
14
- export declare type SudoswapData = {
15
- swaps: PairSwap[];
16
- nftRecipient: string;
17
- ethRecipient: string;
18
- deadline: BigNumberish;
19
- };
20
- export declare class SudoswapTrade extends NFTTrade<SudoswapData> {
21
- static INTERFACE: Interface;
22
- constructor(orders: SudoswapData[]);
23
- encode(planner: RoutePlanner, config: TradeConfig): void;
24
- getBuyItems(): BuyItem[];
25
- getTotalPrice(): BigNumber;
26
- }
27
- export {};
@@ -1,28 +0,0 @@
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 {};
@@ -1,7 +0,0 @@
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,2 +0,0 @@
1
- import { LRV2APIOrder } from '../../src/entities/protocols/looksRareV2';
2
- export declare const looksRareV2Orders: LRV2APIOrder[];
@@ -1,4 +0,0 @@
1
- import { SeaportData } from '../../src/entities/protocols/seaport';
2
- export declare const seaportV1_4DataETH: SeaportData;
3
- export declare const seaportV1_4DataETHRecent: SeaportData;
4
- export declare const seaportV1_4DataERC20: SeaportData;
@@ -1,4 +0,0 @@
1
- import { ConsiderationItem, SeaportData } from '../../src/entities/protocols/seaport';
2
- import { BigNumber } from 'ethers';
3
- export declare const seaportV1_5DataETH: SeaportData;
4
- export declare function calculateSeaportValue(considerations: ConsiderationItem[], token: string): BigNumber;
@@ -1,6 +0,0 @@
1
- export declare const x2y2Orders: {
2
- input: string;
3
- order_id: number;
4
- token_id: string;
5
- price: string;
6
- }[];
@@ -1,2 +0,0 @@
1
- import { Currency, CurrencyAmount } from '@uniswap/sdk-core';
2
- export declare function getNativeCurrencyValue(currencyValues: CurrencyAmount<Currency>[]): CurrencyAmount<Currency>;