@uniswap/universal-router-sdk 1.1.1 → 1.1.2

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.
@@ -1,7 +1,7 @@
1
- import { RoutePlanner } from '../utils/routerCommands'
2
- export declare type TradeConfig = {
3
- allowRevert: boolean
4
- }
5
- export interface Command {
6
- encode(planner: RoutePlanner, config: TradeConfig): void
7
- }
1
+ import { RoutePlanner } from '../utils/routerCommands';
2
+ export declare type TradeConfig = {
3
+ allowRevert: boolean;
4
+ };
5
+ export interface Command {
6
+ encode(planner: RoutePlanner, config: TradeConfig): void;
7
+ }
@@ -1,49 +1,41 @@
1
- import { 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, TradeConfig } from './Command'
8
- import { LooksRareData } from './protocols/looksRare'
9
- import { SudoswapData } from './protocols/sudoswap'
10
- import { CryptopunkData } from './protocols/cryptopunk'
11
- import { X2Y2Data } from './protocols/x2y2'
12
- export declare type SupportedProtocolsData =
13
- | SeaportData
14
- | FoundationData
15
- | NFTXData
16
- | LooksRareData
17
- | X2Y2Data
18
- | CryptopunkData
19
- | NFT20Data
20
- | SudoswapData
21
- export declare abstract class NFTTrade<T> implements Command {
22
- readonly orders: T[]
23
- readonly market: Market
24
- constructor(market: Market, orders: T[])
25
- abstract encode(planner: RoutePlanner, config: TradeConfig): void
26
- abstract getBuyItems(): BuyItem[]
27
- abstract getTotalPrice(): BigNumberish
28
- }
29
- export declare type BuyItem = {
30
- tokenAddress: string
31
- tokenId: BigNumberish
32
- tokenType: TokenType
33
- amount?: BigNumberish
34
- }
35
- export declare enum Market {
36
- Foundation = 'foundation',
37
- LooksRare = 'looksrare',
38
- NFT20 = 'nft20',
39
- NFTX = 'nftx',
40
- Seaport = 'seaport',
41
- Sudoswap = 'Sudoswap',
42
- Cryptopunks = 'cryptopunks',
43
- X2Y2 = 'x2y2',
44
- }
45
- export declare enum TokenType {
46
- ERC721 = 'ERC721',
47
- ERC1155 = 'ERC1155',
48
- Cryptopunk = 'Cryptopunk',
49
- }
1
+ import { 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, TradeConfig } from './Command';
8
+ import { LooksRareData } from './protocols/looksRare';
9
+ import { SudoswapData } from './protocols/sudoswap';
10
+ import { CryptopunkData } from './protocols/cryptopunk';
11
+ import { X2Y2Data } from './protocols/x2y2';
12
+ export declare type SupportedProtocolsData = SeaportData | FoundationData | NFTXData | LooksRareData | X2Y2Data | CryptopunkData | NFT20Data | SudoswapData;
13
+ export declare abstract class NFTTrade<T> implements Command {
14
+ readonly orders: T[];
15
+ readonly market: Market;
16
+ constructor(market: Market, orders: T[]);
17
+ abstract encode(planner: RoutePlanner, config: TradeConfig): void;
18
+ abstract getBuyItems(): BuyItem[];
19
+ abstract getTotalPrice(): BigNumberish;
20
+ }
21
+ export declare type BuyItem = {
22
+ tokenAddress: string;
23
+ tokenId: BigNumberish;
24
+ tokenType: TokenType;
25
+ amount?: BigNumberish;
26
+ };
27
+ export declare enum Market {
28
+ Foundation = "foundation",
29
+ LooksRare = "looksrare",
30
+ NFT20 = "nft20",
31
+ NFTX = "nftx",
32
+ Seaport = "seaport",
33
+ Sudoswap = "Sudoswap",
34
+ Cryptopunks = "cryptopunks",
35
+ X2Y2 = "x2y2"
36
+ }
37
+ export declare enum TokenType {
38
+ ERC721 = "ERC721",
39
+ ERC1155 = "ERC1155",
40
+ Cryptopunk = "Cryptopunk"
41
+ }
@@ -1,2 +1,2 @@
1
- export * from './protocols'
2
- export * from './NFTTrade'
1
+ export * from './protocols';
2
+ export * from './NFTTrade';
@@ -1,16 +1,16 @@
1
- import { TradeConfig } from '../Command'
2
- import { NFTTrade, BuyItem } from '../NFTTrade'
3
- import { RoutePlanner } from '../../utils/routerCommands'
4
- import { 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(): BigNumberish
16
- }
1
+ import { TradeConfig } from '../Command';
2
+ import { NFTTrade, BuyItem } from '../NFTTrade';
3
+ import { RoutePlanner } from '../../utils/routerCommands';
4
+ import { 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(): BigNumberish;
16
+ }
@@ -1,19 +1,19 @@
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 { 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(): BigNumberish
19
- }
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 { 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(): BigNumberish;
19
+ }
@@ -1,9 +1,9 @@
1
- export * from './cryptopunk'
2
- export * from './foundation'
3
- export * from './looksRare'
4
- export * from './nft20'
5
- export * from './nftx'
6
- export * from './seaport'
7
- export * from './uniswap'
8
- export * from './sudoswap'
9
- export * from './x2y2'
1
+ export * from './cryptopunk';
2
+ export * from './foundation';
3
+ export * from './looksRare';
4
+ export * from './nft20';
5
+ export * from './nftx';
6
+ export * from './seaport';
7
+ export * from './uniswap';
8
+ export * from './sudoswap';
9
+ export * from './x2y2';
@@ -1,44 +1,44 @@
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 { BigNumberish } from 'ethers'
6
- export declare type MakerOrder = {
7
- collection: string
8
- tokenId: BigNumberish
9
- isOrderAsk: true
10
- signer: string
11
- strategy: string
12
- currency: string
13
- amount: BigNumberish
14
- price: BigNumberish
15
- minPercentageToAsk: BigNumberish
16
- nonce: BigNumberish
17
- startTime: BigNumberish
18
- endTime: BigNumberish
19
- v: BigNumberish
20
- r: string
21
- s: string
22
- params: string
23
- }
24
- export declare type TakerOrder = {
25
- minPercentageToAsk: BigNumberish
26
- price: BigNumberish
27
- taker: string
28
- tokenId: BigNumberish
29
- isOrderAsk: boolean
30
- params: string
31
- }
32
- export declare type LooksRareData = {
33
- makerOrder: MakerOrder
34
- takerOrder: TakerOrder
35
- recipient: string
36
- tokenType: TokenType
37
- }
38
- export declare class LooksRareTrade extends NFTTrade<LooksRareData> {
39
- static INTERFACE: Interface
40
- constructor(orders: LooksRareData[])
41
- encode(planner: RoutePlanner, config: TradeConfig): void
42
- getBuyItems(): BuyItem[]
43
- getTotalPrice(): BigNumberish
44
- }
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 { BigNumberish } from 'ethers';
6
+ export declare type MakerOrder = {
7
+ collection: string;
8
+ tokenId: BigNumberish;
9
+ isOrderAsk: true;
10
+ signer: string;
11
+ strategy: string;
12
+ currency: string;
13
+ amount: BigNumberish;
14
+ price: BigNumberish;
15
+ minPercentageToAsk: BigNumberish;
16
+ nonce: BigNumberish;
17
+ startTime: BigNumberish;
18
+ endTime: BigNumberish;
19
+ v: BigNumberish;
20
+ r: string;
21
+ s: string;
22
+ params: string;
23
+ };
24
+ export declare type TakerOrder = {
25
+ minPercentageToAsk: BigNumberish;
26
+ price: BigNumberish;
27
+ taker: string;
28
+ tokenId: BigNumberish;
29
+ isOrderAsk: boolean;
30
+ params: string;
31
+ };
32
+ export declare type LooksRareData = {
33
+ makerOrder: MakerOrder;
34
+ takerOrder: TakerOrder;
35
+ recipient: string;
36
+ tokenType: TokenType;
37
+ };
38
+ export declare class LooksRareTrade extends NFTTrade<LooksRareData> {
39
+ static INTERFACE: Interface;
40
+ constructor(orders: LooksRareData[]);
41
+ encode(planner: RoutePlanner, config: TradeConfig): void;
42
+ getBuyItems(): BuyItem[];
43
+ getTotalPrice(): BigNumberish;
44
+ }
@@ -1,21 +1,21 @@
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 { 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(): BigNumberish
21
- }
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 { 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(): BigNumberish;
21
+ }
@@ -1,20 +1,20 @@
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
- vaultAddress: string
9
- vaultId: BigNumberish
10
- tokenAddress: string
11
- tokenIds: BigNumberish[]
12
- value: BigNumber
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(): BigNumberish
20
- }
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
+ vaultAddress: string;
9
+ vaultId: BigNumberish;
10
+ tokenAddress: string;
11
+ tokenIds: BigNumberish[];
12
+ value: BigNumber;
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(): BigNumberish;
20
+ }
@@ -1,57 +1,57 @@
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
- export declare type SeaportData = {
7
- items: Order[]
8
- recipient: string
9
- }
10
- export declare type FulfillmentComponent = {
11
- orderIndex: BigNumberish
12
- itemIndex: BigNumberish
13
- }
14
- export declare type OfferItem = {
15
- itemType: BigNumberish
16
- token: string
17
- identifierOrCriteria: BigNumberish
18
- startAmount: BigNumberish
19
- endAmount: BigNumberish
20
- }
21
- export declare type ConsiderationItem = OfferItem & {
22
- recipient: string
23
- }
24
- export declare type Order = {
25
- parameters: OrderParameters
26
- signature: string
27
- }
28
- declare type OrderParameters = {
29
- offerer: string
30
- offer: OfferItem[]
31
- consideration: ConsiderationItem[]
32
- orderType: BigNumberish
33
- startTime: BigNumberish
34
- endTime: BigNumberish
35
- zoneHash: string
36
- zone: string
37
- salt: BigNumberish
38
- conduitKey: string
39
- totalOriginalConsiderationItems: BigNumberish
40
- }
41
- export declare type AdvancedOrder = Order & {
42
- numerator: BigNumber
43
- denominator: BigNumber
44
- extraData: string
45
- }
46
- export declare class SeaportTrade extends NFTTrade<SeaportData> {
47
- static INTERFACE: Interface
48
- static OPENSEA_CONDUIT_KEY: string
49
- constructor(orders: SeaportData[])
50
- encode(planner: RoutePlanner, config: TradeConfig): void
51
- getBuyItems(): BuyItem[]
52
- getTotalPrice(): BigNumber
53
- private getConsiderationFulfillments
54
- private getAdvancedOrderParams
55
- private calculateValue
56
- }
57
- export {}
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
+ export declare type SeaportData = {
7
+ items: Order[];
8
+ recipient: string;
9
+ };
10
+ export declare type FulfillmentComponent = {
11
+ orderIndex: BigNumberish;
12
+ itemIndex: BigNumberish;
13
+ };
14
+ export declare type OfferItem = {
15
+ itemType: BigNumberish;
16
+ token: string;
17
+ identifierOrCriteria: BigNumberish;
18
+ startAmount: BigNumberish;
19
+ endAmount: BigNumberish;
20
+ };
21
+ export declare type ConsiderationItem = OfferItem & {
22
+ recipient: string;
23
+ };
24
+ export declare type Order = {
25
+ parameters: OrderParameters;
26
+ signature: string;
27
+ };
28
+ declare type OrderParameters = {
29
+ offerer: string;
30
+ offer: OfferItem[];
31
+ consideration: ConsiderationItem[];
32
+ orderType: BigNumberish;
33
+ startTime: BigNumberish;
34
+ endTime: BigNumberish;
35
+ zoneHash: string;
36
+ zone: string;
37
+ salt: BigNumberish;
38
+ conduitKey: string;
39
+ totalOriginalConsiderationItems: BigNumberish;
40
+ };
41
+ export declare type AdvancedOrder = Order & {
42
+ numerator: BigNumber;
43
+ denominator: BigNumber;
44
+ extraData: string;
45
+ };
46
+ export declare class SeaportTrade extends NFTTrade<SeaportData> {
47
+ static INTERFACE: Interface;
48
+ static OPENSEA_CONDUIT_KEY: string;
49
+ constructor(orders: SeaportData[]);
50
+ encode(planner: RoutePlanner, config: TradeConfig): void;
51
+ getBuyItems(): BuyItem[];
52
+ getTotalPrice(): BigNumber;
53
+ private getConsiderationFulfillments;
54
+ private getAdvancedOrderParams;
55
+ private calculateValue;
56
+ }
57
+ export {};
@@ -1,27 +1,27 @@
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 { 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(): BigNumberish
26
- }
27
- export {}
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 { 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(): BigNumberish;
26
+ }
27
+ export {};
@@ -1,14 +1,14 @@
1
- import { RoutePlanner } from '../../utils/routerCommands'
2
- import { Trade as RouterTrade, SwapOptions as RouterSwapOptions } from '@uniswap/router-sdk'
3
- import { Permit2Permit } from '../../utils/permit2'
4
- import { Currency, TradeType } from '@uniswap/sdk-core'
5
- import { Command, TradeConfig } from '../Command'
6
- export declare type SwapOptions = Omit<RouterSwapOptions, 'inputTokenPermit'> & {
7
- inputTokenPermit?: Permit2Permit
8
- }
9
- export declare class UniswapTrade implements Command {
10
- trade: RouterTrade<Currency, Currency, TradeType>
11
- options: SwapOptions
12
- constructor(trade: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions)
13
- encode(planner: RoutePlanner, _config: TradeConfig): void
14
- }
1
+ import { RoutePlanner } from '../../utils/routerCommands';
2
+ import { Trade as RouterTrade, SwapOptions as RouterSwapOptions } from '@uniswap/router-sdk';
3
+ import { Permit2Permit } from '../../utils/permit2';
4
+ import { Currency, TradeType } from '@uniswap/sdk-core';
5
+ import { Command, TradeConfig } from '../Command';
6
+ export declare type SwapOptions = Omit<RouterSwapOptions, 'inputTokenPermit'> & {
7
+ inputTokenPermit?: Permit2Permit;
8
+ };
9
+ export declare class UniswapTrade implements Command {
10
+ trade: RouterTrade<Currency, Currency, TradeType>;
11
+ options: SwapOptions;
12
+ constructor(trade: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions);
13
+ encode(planner: RoutePlanner, _config: TradeConfig): void;
14
+ }
@@ -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 { 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(): BigNumberish
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 { 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(): BigNumberish;
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 } from './utils/constants'
1
+ export { SwapRouter } from './swapRouter';
2
+ export * from './entities';
3
+ export { UNIVERSAL_ROUTER_ADDRESS, PERMIT2_ADDRESS } from './utils/constants';
@@ -1,35 +1,32 @@
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 { NFTTrade, SupportedProtocolsData } from './entities/NFTTrade'
7
- import { SwapOptions } from './entities/protocols/uniswap'
8
- export declare type SwapRouterConfig = {
9
- sender?: string
10
- deadline?: BigNumberish
11
- }
12
- export declare abstract class SwapRouter {
13
- static INTERFACE: Interface
14
- /**
15
- * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given swap.
16
- * @param trades to produce call parameters for
17
- */
18
- static swapNFTCallParameters(trades: NFTTrade<SupportedProtocolsData>[], config: SwapRouterConfig): MethodParameters
19
- /**
20
- * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
21
- * @param trades to produce call parameters for
22
- * @param options options for the call parameters
23
- */
24
- static swapERC20CallParameters(
25
- trades: RouterTrade<Currency, Currency, TradeType>,
26
- options: SwapOptions
27
- ): MethodParameters
28
- /**
29
- * Encodes a planned route into a method name and parameters for the Router contract.
30
- * @param planner the planned route
31
- * @param nativeCurrencyValue the native currency value of the planned route
32
- * @param config the router config
33
- */
34
- private static encodePlan
35
- }
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 { NFTTrade, SupportedProtocolsData } from './entities/NFTTrade';
7
+ import { SwapOptions } from './entities/protocols/uniswap';
8
+ export declare type SwapRouterConfig = {
9
+ sender?: string;
10
+ deadline?: BigNumberish;
11
+ };
12
+ export declare abstract class SwapRouter {
13
+ static INTERFACE: Interface;
14
+ /**
15
+ * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given swap.
16
+ * @param trades to produce call parameters for
17
+ */
18
+ static swapNFTCallParameters(trades: NFTTrade<SupportedProtocolsData>[], config: SwapRouterConfig): MethodParameters;
19
+ /**
20
+ * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
21
+ * @param trades to produce call parameters for
22
+ * @param options options for the call parameters
23
+ */
24
+ static swapERC20CallParameters(trades: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions): MethodParameters;
25
+ /**
26
+ * Encodes a planned route into a method name and parameters for the Router contract.
27
+ * @param planner the planned route
28
+ * @param nativeCurrencyValue the native currency value of the planned route
29
+ * @param config the router config
30
+ */
31
+ private static encodePlan;
32
+ }
@@ -1,7 +1,7 @@
1
- import { BigNumber } from 'ethers'
2
- export declare const UNIVERSAL_ROUTER_ADDRESS: (chainId: number) => string
3
- export declare const PERMIT2_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3'
4
- export declare const CONTRACT_BALANCE: BigNumber
5
- export declare const ETH_ADDRESS = '0x0000000000000000000000000000000000000000'
6
- export declare const MSG_SENDER = '0x0000000000000000000000000000000000000001'
7
- export declare const ADDRESS_THIS = '0x0000000000000000000000000000000000000002'
1
+ import { BigNumber } from 'ethers';
2
+ export declare const UNIVERSAL_ROUTER_ADDRESS: (chainId: number) => string;
3
+ export declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
4
+ export declare const CONTRACT_BALANCE: BigNumber;
5
+ export declare const ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
6
+ export declare const MSG_SENDER = "0x0000000000000000000000000000000000000001";
7
+ export declare const ADDRESS_THIS = "0x0000000000000000000000000000000000000002";
@@ -1,4 +1,4 @@
1
- import { BigNumber } from 'ethers'
2
- import JSBI from 'jsbi'
3
- export declare function expandTo18DecimalsBN(n: number): BigNumber
4
- export declare function expandTo18Decimals(n: number): JSBI
1
+ import { BigNumber } from 'ethers';
2
+ import JSBI from 'jsbi';
3
+ export declare function expandTo18DecimalsBN(n: number): BigNumber;
4
+ export declare function expandTo18Decimals(n: number): JSBI;
@@ -1,2 +1,2 @@
1
- import { Currency, CurrencyAmount } from '@uniswap/sdk-core'
2
- export declare function getNativeCurrencyValue(currencyValues: CurrencyAmount<Currency>[]): CurrencyAmount<Currency>
1
+ import { Currency, CurrencyAmount } from '@uniswap/sdk-core';
2
+ export declare function getNativeCurrencyValue(currencyValues: CurrencyAmount<Currency>[]): CurrencyAmount<Currency>;
@@ -1,6 +1,6 @@
1
- import { PermitSingle } from '@uniswap/permit2-sdk'
2
- import { RoutePlanner } from './routerCommands'
3
- export interface Permit2Permit extends PermitSingle {
4
- signature: string
5
- }
6
- export declare function encodePermit(planner: RoutePlanner, permit: Permit2Permit): void
1
+ import { PermitSingle } from '@uniswap/permit2-sdk';
2
+ import { RoutePlanner } from './routerCommands';
3
+ export interface Permit2Permit extends PermitSingle {
4
+ signature: string;
5
+ }
6
+ export declare function encodePermit(planner: RoutePlanner, permit: Permit2Permit): void;
@@ -1,43 +1,43 @@
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
- PERMIT = 10,
17
- WRAP_ETH = 11,
18
- UNWRAP_WETH = 12,
19
- PERMIT2_TRANSFER_FROM_BATCH = 13,
20
- SEAPORT = 16,
21
- LOOKS_RARE_721 = 17,
22
- NFTX = 18,
23
- CRYPTOPUNKS = 19,
24
- LOOKS_RARE_1155 = 20,
25
- OWNER_CHECK_721 = 21,
26
- OWNER_CHECK_1155 = 22,
27
- X2Y2_721 = 24,
28
- SUDOSWAP = 25,
29
- NFT20 = 26,
30
- X2Y2_1155 = 27,
31
- FOUNDATION = 28,
32
- }
33
- export declare class RoutePlanner {
34
- commands: string
35
- inputs: string[]
36
- constructor()
37
- addCommand(type: CommandType, parameters: any[], allowRevert?: boolean): void
38
- }
39
- export declare type RouterCommand = {
40
- type: CommandType
41
- encodedInput: string
42
- }
43
- export declare function createCommand(type: CommandType, parameters: any[]): RouterCommand
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
+ PERMIT = 10,
17
+ WRAP_ETH = 11,
18
+ UNWRAP_WETH = 12,
19
+ PERMIT2_TRANSFER_FROM_BATCH = 13,
20
+ SEAPORT = 16,
21
+ LOOKS_RARE_721 = 17,
22
+ NFTX = 18,
23
+ CRYPTOPUNKS = 19,
24
+ LOOKS_RARE_1155 = 20,
25
+ OWNER_CHECK_721 = 21,
26
+ OWNER_CHECK_1155 = 22,
27
+ X2Y2_721 = 24,
28
+ SUDOSWAP = 25,
29
+ NFT20 = 26,
30
+ X2Y2_1155 = 27,
31
+ FOUNDATION = 28
32
+ }
33
+ export declare class RoutePlanner {
34
+ commands: string;
35
+ inputs: string[];
36
+ constructor();
37
+ addCommand(type: CommandType, parameters: any[], allowRevert?: boolean): void;
38
+ }
39
+ export declare type RouterCommand = {
40
+ type: CommandType;
41
+ encodedInput: string;
42
+ };
43
+ export declare function createCommand(type: CommandType, parameters: any[]): RouterCommand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniswap/universal-router-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "sdk for integrating with the Universal Router contracts",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -48,7 +48,7 @@
48
48
  "typescript": "^4.3.3"
49
49
  },
50
50
  "dependencies": {
51
- "@uniswap/universal-router": "1.0.1",
51
+ "@uniswap/universal-router": "1.1.1",
52
52
  "@uniswap/permit2-sdk": "^0.4.0",
53
53
  "@uniswap/router-sdk": "^1.4.0",
54
54
  "@uniswap/sdk-core": "^3.1.0",