import { BigNumber, providers, BigNumberish, ContractTransaction, Overrides } from "ethers"; import { TypedDataDomain } from "@ethersproject/abstract-signer"; import { Addresses, Maker, Taker, ChainId, Signer, CreateMakerInput, CreateMakerAskOutput, CreateMakerBidOutput, CreateMakerCollectionOfferInput, CreateMakerCollectionOfferWithProofInput, MerkleTree, ContractMethods, OrderValidatorCode, BatchTransferItem, SignMerkleTreeOrdersOutput, StrategyType, StrategyInfo } from "./types"; /** * LooksRare * This class provides helpers to interact with the LooksRare V2 contracts */ export declare class LooksRare { /** Current app chain ID */ readonly chainId: ChainId; /** Mapping of LooksRare protocol addresses for the current chain */ readonly addresses: Addresses; /** * Ethers signer * @see {@link https://docs.ethers.io/v5/api/signer/ Ethers signer doc} */ readonly signer?: Signer; /** * Ethers multicall provider * @see {@link https://docs.ethers.io/v5/api/providers/ Ethers providers doc} * @see {@link https://github.com/0xsequence/sequence.js/tree/master/packages/multicall 0xsequence multicall doc} */ readonly provider: providers.Provider; /** * LooksRare protocol main class * @param chainId Current app chain id * @param provider Ethers provider * @param signer Ethers signer * @param override Overrides contract addresses for hardhat setup */ constructor(chainId: ChainId, provider: providers.Provider, signer?: Signer, override?: Addresses); /** * Return the signer it it's set, throw an exception otherwise * @returns Signer */ private getSigner; /** * Validate a timestamp format (seconds) * @param timestamp * @returns boolean */ private isTimestampValid; /** * Retrieve EIP-712 domain * @returns TypedDataDomain */ getTypedDataDomain(): TypedDataDomain; /** * Create a maker ask object ready to be signed * @param CreateMakerInput * @returns the maker object, isTransferManagerApproved, and isTransferManagerApproved */ createMakerAsk({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts, currency, startTime, additionalParameters, }: CreateMakerInput): Promise; /** * Create a maker bid object ready to be signed * @param CreateMakerInput * @returns the maker object, isCurrencyApproved, and isBalanceSufficient */ createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts, currency, startTime, additionalParameters, }: CreateMakerInput): Promise; /** * Create a maker bid for collection offer. * @see this.createMakerBid * @param orderInputs Order data * @returns CreateMakerBidOutput */ createMakerCollectionOffer(orderInputs: CreateMakerCollectionOfferInput): Promise; /** * Create a maker bid for collection, with a list of item id that can be used for the taker order * @see this.createMakerBid * @param orderInputs Order data * @returns CreateMakerBidOutput */ createMakerCollectionOfferWithProof(orderInputs: CreateMakerCollectionOfferWithProofInput): Promise; /** * Create a taker ask ready to be executed against a maker bid * @param maker Maker order that will be used as counterparty for the taker * @param recipient Recipient address of the taker (if none, it will use the sender) * @param additionalParameters Additional parameters used to support complex orders * @returns Taker object */ createTaker(maker: Maker, recipient?: string, additionalParameters?: any[]): Taker; /** * Create a taker ask order for collection order. * @see this.createTaker * @see this.createMakerCollectionOffer * @param makerBid Maker bid that will be used as counterparty for the taker * @param itemId Token id to use as a counterparty for the collection order * @param recipient Recipient address of the taker (if none, it will use the sender) * @returns Taker object */ createTakerCollectionOffer(maker: Maker, itemId: BigNumberish, recipient?: string): Taker; /** * Create a taker ask to fulfill a collection order (maker bid) created with a whitelist of item ids * @see this.createTaker * @see this.createMakerCollectionOfferWithMerkleTree * @param makerBid Maker bid that will be used as counterparty for the taker * @param itemId Token id to use as a counterparty for the collection order * @param itemIds List of token ids used during the maker creation * @param recipient Recipient address of the taker (if none, it will use the sender) * @returns Taker object */ createTakerCollectionOfferWithProof(maker: Maker, itemId: BigNumberish, itemIds: BigNumberish[], recipient?: string): Taker; /** * Sign a maker order using the signer provided in the constructor * @param maker Order to be signed by the user * @returns Signature */ signMakerOrder(maker: Maker): Promise; /** * Sign multiple maker orders with a single signature * /!\ Use this function for UI implementation only * @param makerOrders Array of maker orders * @returns Signature, proofs, and Merkletree object */ signMultipleMakerOrders(makerOrders: Maker[]): Promise; /** * Execute a trade * @param makerBid Maker order * @param taker Taker order * @param signature Signature of the maker order * @param merkleTree If the maker has been signed with a merkle tree * @param affiliate Affiliate address if applicable * @returns ContractMethods */ executeOrder(maker: Maker, taker: Taker, signature: string, merkleTree?: MerkleTree, affiliate?: string, overrides?: Overrides): ContractMethods; /** * Execute several orders * @param orders List of orders data * @param isAtomic Should the transaction revert or not if a trade fails * @param affiliate Affiliate address * @param overrides Call overrides * @returns ContractMethods */ executeMultipleOrders(orders: { maker: Maker; taker: Taker; signature: string; merkleTree?: MerkleTree; }[], isAtomic: boolean, affiliate?: string, overrides?: Overrides): { call: (additionalOverrides?: import("ethers").PayableOverrides | undefined) => Promise; estimateGas: (additionalOverrides?: import("ethers").PayableOverrides | undefined) => Promise; callStatic: (additionalOverrides?: import("ethers").PayableOverrides | undefined) => Promise; }; /** * Cancell all maker bid and/or ask orders for the current user * @param bid Cancel all bids * @param ask Cancel all asks * @returns ContractMethods */ cancelAllOrders(bid: boolean, ask: boolean, overrides?: Overrides): ContractMethods; /** * Cancel a list of specific orders * @param nonces List of nonces to be cancelled * @returns ContractMethods */ cancelOrders(nonces: BigNumberish[], overrides?: Overrides): ContractMethods; /** * Cancel a list of specific subset orders * @param nonces List of nonces to be cancelled * @returns ContractMethods */ cancelSubsetOrders(nonces: BigNumberish[], overrides?: Overrides): ContractMethods; /** * Approve all the items of a collection, to eventually be traded on LooksRare * The spender is the TransferManager. * @param collectionAddress Address of the collection to be approved. * @param approved true to approve, false to revoke the approval (default to true) * @returns ContractTransaction */ approveAllCollectionItems(collectionAddress: string, approved?: boolean, overrides?: Overrides): Promise; /** * Approve an ERC20 to be used as a currency on LooksRare. * The spender is the LooksRareProtocol contract. * @param tokenAddress Address of the ERC20 to approve * @param amount Amount to be approved (default to MaxUint256) * @returns ContractTransaction */ approveErc20(tokenAddress: string, amount?: BigNumber, overrides?: Overrides): Promise; /** * Check whether or not an operator has been approved by the user * @param operator Operator address (default to the exchange address) * @returns true if the operator is approved, false otherwise */ isTransferManagerApproved(operator?: string, overrides?: Overrides): Promise; /** * Grant a list of operators the rights to transfer user's assets using the transfer manager * @param operators List of operators (default to the exchange address) * @defaultValue Exchange address * @returns ContractMethods */ grantTransferManagerApproval(operators?: string[], overrides?: Overrides): ContractMethods; /** * Revoke a list of operators the rights to transfer user's assets using the transfer manager * @param operators List of operators * @defaultValue Exchange address * @returns ContractMethods */ revokeTransferManagerApproval(operators?: string[], overrides?: Overrides): ContractMethods; /** * Transfer a list of items across different collections * @param to Recipient address * @param collectionItems Each object in the array represent a list of items for a specific collection * @returns ContractMethods */ transferItemsAcrossCollection(to: string, collectionItems: BatchTransferItem[], overrides?: Overrides): Promise; /** * Verify if a set of orders can be executed (i.e are valid) * @param makerOrders List of maker orders * @param signatures List of signatures * @param merkleTrees List of merkle trees (optional) * @returns A list of OrderValidatorCode for each order (code 0 being valid) */ verifyMakerOrders(makerOrders: Maker[], signatures: string[], merkleTrees?: MerkleTree[], overrides?: Overrides): Promise; /** * Retrieve strategy info * @param strategyId use the enum StrategyType * @returns StrategyInfo */ strategyInfo(strategyId: StrategyType, overrides?: Overrides): Promise; }