Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OpenSeaPort

Hierarchy

  • OpenSeaPort

Index

Constructors

constructor

  • Your very own seaport. Create a new instance of OpenSeaJS.

    Parameters

    • provider: Provider

      Web3 Provider to use for transactions. For example: const provider = new Web3.providers.HttpProvider('https://mainnet.infura.io')

    • Default value apiConfig: OpenSeaAPIConfig = {}

      configuration options, including networkName

    • Optional logger: undefined | function

      logger, optional, a function that will be called with debugging information

    Returns OpenSeaPort

Properties

api

gasIncreaseFactor

gasIncreaseFactor: number = DEFAULT_GAS_INCREASE_FACTOR

gasPriceAddition

gasPriceAddition: BigNumber = new BigNumber(3)

logger

logger: function

Type declaration

    • (arg: string): void
    • Parameters

      • arg: string

      Returns void

web3

web3: Web3

web3ReadOnly

web3ReadOnly: Web3

Methods

_approveAll

  • _approveAll(__namedParameters: object): Promise<(null | string)[]>
  • Parameters

    • __namedParameters: object

    Returns Promise<(null | string)[]>

_approveOrder

  • Instead of signing an off-chain order, you can approve an order with on on-chain transaction using this method

    Parameters

    Returns Promise<any>

    Transaction hash of the approval transaction

_buyOrderValidationAndApprovals

  • _buyOrderValidationAndApprovals(__namedParameters: object): Promise<void>

_computeGasPrice

  • _computeGasPrice(): Promise<BigNumber>
  • Compute the gas price for sending a txn, in wei Will be slightly above the mean to make it faster

    Returns Promise<BigNumber>

_correctGasAmount

  • _correctGasAmount(estimation: number): number
  • Compute the gas amount for sending a txn Will be slightly above the result of estimateGas to make it more reliable

    Parameters

    • estimation: number

      The result of estimateGas for a transaction

    Returns number

_createEmailWhitelistEntry

  • _createEmailWhitelistEntry(__namedParameters: object): Promise<void>

_estimateGasForMatch

  • _estimateGasForMatch(__namedParameters: object): Promise<number>
  • Estimate the gas needed to match two orders

    Parameters

    • __namedParameters: object
      • accountAddress: string

        The taker's wallet address

      • buy: Order

        The buy order to match

      • metadata: string

        Metadata bytes32 to send with the match

      • sell: Order

        The sell order to match

    Returns Promise<number>

_estimateGasForTransfer

  • _estimateGasForTransfer(__namedParameters: object): Promise<number>
  • Estimate the gas needed to transfer assets in bulk Used for tests

    Parameters

    • __namedParameters: object
      • assets: Asset[]

        An array of objects with the tokenId and tokenAddress of each of the assets to transfer.

      • fromAddress: string

        The owner's wallet address

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type

      • toAddress: string

        The recipient's wallet address

    Returns Promise<number>

_getApprovedTokenCount

  • _getApprovedTokenCount(__namedParameters: object): Promise<BigNumber>
  • For a fungible token to use in trades (like W-ETH), get the amount approved for use by the Wyvern transfer proxy. Internal method exposed for dev flexibility.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address for the user's wallet

      • tokenAddress: undefined | string

        Address for the token's contract

    Returns Promise<BigNumber>

_getProxy

  • _getProxy(accountAddress: string, retries?: number): Promise<string | null>
  • Get the proxy address for a user's wallet. Internal method exposed for dev flexibility.

    Parameters

    • accountAddress: string

      The user's wallet address

    • Default value retries: number = 0

      Optional number of retries to do

    Returns Promise<string | null>

_getStaticCallTargetAndExtraData

  • _getStaticCallTargetAndExtraData(__namedParameters: object): Promise<object>
  • Parameters

    • __namedParameters: object

    Returns Promise<object>

_initializeProxy

  • _initializeProxy(accountAddress: string): Promise<string>
  • Initialize the proxy for a user's wallet. Proxies are used to make trades on behalf of the order's maker so that trades can happen when the maker isn't online. Internal method exposed for dev flexibility.

    Parameters

    • accountAddress: string

      The user's wallet address

    Returns Promise<string>

_makeBundleBuyOrder

  • _makeBundleBuyOrder(__namedParameters: object): Promise<UnhashedOrder>
  • Parameters

    • __namedParameters: object
      • accountAddress: string
      • assets: Asset[]
      • expirationTime: number
      • extraBountyBasisPoints: number
      • paymentTokenAddress: string
      • referrerAddress: undefined | string
      • schemaName: WyvernSchemaName
      • sellOrder: undefined | UnhashedOrder
      • startAmount: number

    Returns Promise<UnhashedOrder>

_makeBundleSellOrder

  • _makeBundleSellOrder(__namedParameters: object): Promise<UnhashedOrder>
  • Parameters

    • __namedParameters: object
      • accountAddress: string
      • assets: Asset[]
      • bundleDescription: undefined | string
      • bundleExternalLink: undefined | string
      • bundleName: string
      • buyerAddress: string
      • endAmount: undefined | number
      • expirationTime: number
      • extraBountyBasisPoints: number
      • paymentTokenAddress: string
      • schemaName: WyvernSchemaName
      • startAmount: number
      • waitForHighestBid: boolean

    Returns Promise<UnhashedOrder>

_makeBuyOrder

  • _makeBuyOrder(__namedParameters: object): Promise<UnhashedOrder>
  • Parameters

    • __namedParameters: object
      • accountAddress: string
      • asset: Asset
      • expirationTime: number
      • extraBountyBasisPoints: number
      • paymentTokenAddress: string
      • quantity: number
      • referrerAddress: undefined | string
      • schemaName: WyvernSchemaName
      • sellOrder: undefined | UnhashedOrder
      • startAmount: number

    Returns Promise<UnhashedOrder>

_makeMatchingOrder

_makeSellOrder

  • _makeSellOrder(__namedParameters: object): Promise<UnhashedOrder>
  • Parameters

    • __namedParameters: object
      • accountAddress: string
      • asset: Asset
      • buyerAddress: string
      • endAmount: undefined | number
      • expirationTime: number
      • extraBountyBasisPoints: number
      • paymentTokenAddress: string
      • quantity: number
      • schemaName: WyvernSchemaName
      • startAmount: number
      • waitForHighestBid: boolean

    Returns Promise<UnhashedOrder>

_ownsAssetOnChain

  • _ownsAssetOnChain(__namedParameters: object, retries?: number): Promise<boolean>
  • Check if an account owns an asset on-chain

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Account address for the wallet

      • proxyAddress: undefined | null | string

        Proxy address for the account

      • schemaName: WyvernSchemaName

        WyvernSchemaName for the asset

      • wyAsset: WyvernNFTAsset | WyvernFTAsset

        Asset to check. If fungible, the quantity attribute will be the minimum amount to own

    • Default value retries: number = 1

    Returns Promise<boolean>

_sellOrderValidationAndApprovals

  • _sellOrderValidationAndApprovals(__namedParameters: object): Promise<void>

_validateMatch

  • _validateMatch(__namedParameters: object, retries?: number): Promise<boolean>
  • Validate against Wyvern that a buy and sell order can match

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address for the user's wallet

      • buy: Order

        The buy order to validate

      • sell: Order

        The sell order to validate

      • shouldValidateBuy: boolean

        Whether to validate the buy order individually.

      • shouldValidateSell: boolean

        Whether to validate the sell order individually.

    • Default value retries: number = 1

      How many times to retry if validation fails

    Returns Promise<boolean>

_validateOrder

  • _validateOrder(order: Order): Promise<boolean>

addListener

  • addListener(event: EventType, listener: function, once?: boolean): EventSubscription
  • Add a listener to a marketplace event

    Parameters

    • event: EventType

      An event to listen for

    • listener: function

      A callback that will accept an object with event data

    • Default value once: boolean = false

      Whether the listener should only be called once

    Returns EventSubscription

approveFungibleToken

  • approveFungibleToken(__namedParameters: object): Promise<string | null>
  • Approve a fungible token (e.g. W-ETH) for use in trades. Called internally, but exposed for dev flexibility. Checks to see if the minimum amount is already approved, first.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        The user's wallet address

      • minimumAmount: any

        The minimum amount needed to skip a transaction. Defaults to the max-integer.

      • tokenAddress: string

        The contract address of the token being approved

    Returns Promise<string | null>

    Transaction hash if a new transaction occurred, otherwise null

approveNonFungibleToken

  • approveNonFungibleToken(__namedParameters: object): Promise<string | null>
  • Approve a non-fungible token for use in trades. Requires an account to be initialized first. Called internally, but exposed for dev flexibility. Checks to see if already approved, first. Then tries different approval methods from best to worst.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        The user's wallet address

      • proxyAddress: null | string

        Address of the user's proxy contract. If not provided, will attempt to fetch it from Wyvern.

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type

      • skipApproveAllIfTokenAddressIn: string[]

        an optional list of token addresses that, if a token is approve-all type, will skip approval

      • tokenAbi: object[]

        ABI of the token's contract. Defaults to a flexible ERC-721 contract.

      • tokenAddress: string

        The contract address of the token being approved

      • tokenId: string

        Token id to approve, but only used if approve-all isn't supported by the token contract

    Returns Promise<string | null>

    Transaction hash if a new transaction was created, otherwise null

cancelOrder

  • cancelOrder(__namedParameters: object): Promise<void>
  • Cancel an order on-chain, preventing it from ever being fulfilled.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        The order maker's wallet address

      • order: Order

        The order to cancel

    Returns Promise<void>

computeFees

  • computeFees(__namedParameters: object): Promise<OpenSeaFees>
  • Compute the fees for an order

    Parameters

    • __namedParameters: object
      • accountAddress: undefined | string

        The account to check fees for (useful if fees differ by account, like transfer fees)

      • asset: null | OpenSeaAsset

        Addresses and id of asset (null if a bundle, unless all assets are from the same contract, then the first asset)

      • assetContract: undefined | OpenSeaAssetContract

        Optional prefetched asset contract (including fees) to use instead of assets

      • extraBountyBasisPoints: number

        The basis points to add for the bounty. Will throw if it exceeds the assets' contract's OpenSea fee.

      • isPrivate: boolean

        Whether the order is private or not (known taker)

      • side: OrderSide

        The side of the order (buy or sell)

    Returns Promise<OpenSeaFees>

createBundleBuyOrder

  • createBundleBuyOrder(__namedParameters: object): Promise<Order>
  • Create a buy order to make an offer on a bundle or group of assets. Will throw an 'Insufficient balance' error if the maker doesn't have enough W-ETH to make the offer. If the user hasn't approved W-ETH access yet, this will emit ApproveCurrency before asking for approval.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the maker's wallet

      • assets: Asset[]

        Array of Asset objects to bid on

      • expirationTime: number

        Expiration time for the order, in seconds. An expiration time of 0 means "never expire"

      • paymentTokenAddress: undefined | string

        Optional address for using an ERC-20 token in the order. If unspecified, defaults to W-ETH

      • referrerAddress: undefined | string

        The optional address that referred the order

      • schemaName: undefined | ERC20 | ERC721 | ERC1155 | LegacyEnjin | ENSShortNameAuction

        The Wyvern schema name corresponding to the asset type. Defaults to "ERC721"

      • sellOrder: undefined | Order

        Optional sell order (like an English auction) to ensure fee and schema compatibility

      • startAmount: number

        Value of the offer, in units of the payment token (or wrapped ETH if no payment token address specified)

      • tokenAddresses: undefined | string[]

        DEPRECATED: Addresses of the tokens' contracts. Use assets instead.

      • tokenIds: undefined | string[]

        DEPRECATED: Token IDs of the assets. Use assets instead.

    Returns Promise<Order>

createBundleSellOrder

  • createBundleSellOrder(__namedParameters: object): Promise<Order>
  • Create a sell order to auction a bundle of assets. Will throw a 'You do not own this asset' error if the maker doesn't have one of the assets. If the user hasn't approved access to any of the assets yet, this will emit ApproveAllAssets (or ApproveAsset if the contract doesn't support approve-all) before asking for approval for each asset.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        The address of the maker of the bundle and the owner of all the assets.

      • assets: Asset[]

        An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.

      • bundleDescription: undefined | string

        Optional description of the bundle. Markdown is allowed.

      • bundleExternalLink: undefined | string

        Optional link to a page that adds context to the bundle.

      • bundleName: string

        Name of the bundle

      • buyerAddress: undefined | string

        Optional address that's allowed to purchase this bundle. If specified, no other address will be able to take the order, unless it's the null address.

      • endAmount: undefined | number

        Optional price of the asset at the end of its expiration time. If not specified, will be set to startAmount.

      • expirationTime: number

        Expiration time for the order, in seconds. An expiration time of 0 means "never expire."

      • extraBountyBasisPoints: number

        Optional basis points (1/100th of a percent) to reward someone for referring the fulfillment of this order

      • paymentTokenAddress: undefined | string

        Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type

      • startAmount: number

        Price of the asset at the start of the auction, or minimum acceptable bid if it's an English auction.

      • waitForHighestBid: boolean

        If set to true, this becomes an English auction that increases in price for every bid. The highest bid wins when the auction expires, as long as it's at least startAmount. expirationTime must be > 0.

    Returns Promise<Order>

createBuyOrder

  • createBuyOrder(__namedParameters: object): Promise<Order>
  • Create a buy order to make an offer on an asset. Will throw an 'Insufficient balance' error if the maker doesn't have enough W-ETH to make the offer. If the user hasn't approved W-ETH access yet, this will emit ApproveCurrency before asking for approval.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the maker's wallet

      • asset: Asset

        The asset to trade

      • expirationTime: number

        Expiration time for the order, in seconds. An expiration time of 0 means "never expire"

      • paymentTokenAddress: undefined | string

        Optional address for using an ERC-20 token in the order. If unspecified, defaults to W-ETH

      • quantity: number

        The number of assets to bid for (if fungible or semi-fungible). Defaults to 1. In units, not base units, e.g. not wei.

      • referrerAddress: undefined | string

        The optional address that referred the order

      • schemaName: undefined | ERC20 | ERC721 | ERC1155 | LegacyEnjin | ENSShortNameAuction

        The Wyvern schema name corresponding to the asset type. Defaults to "ERC721"

      • sellOrder: undefined | Order

        Optional sell order (like an English auction) to ensure fee and schema compatibility

      • startAmount: number

        Value of the offer, in units of the payment token (or wrapped ETH if no payment token address specified)

      • tokenAddress: undefined | string

        DEPRECATED: Address of the token's contract. Use asset instead.

      • tokenId: undefined | string

        DEPRECATED: Token ID. Use asset instead.

    Returns Promise<Order>

createFactorySellOrders

  • createFactorySellOrders(__namedParameters: object): Promise<Order[]>
  • Create multiple sell orders in bulk to auction assets out of an asset factory. Will throw a 'You do not own this asset' error if the maker doesn't own the factory. Items will mint to users' wallets only when they buy them. See https://docs.opensea.io/docs/opensea-initial-item-sale-tutorial for more info. If the user hasn't approved access to the token yet, this will emit ApproveAllAssets (or ApproveAsset if the contract doesn't support approve-all) before asking for approval.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the factory owner's wallet

      • assetId: undefined | string

        Identifier for the asset, if you just want to post orders for one asset.

      • assetIds: undefined | string[]

        Identifiers for the assets, if you want to post orders for many assets at once.

      • buyerAddress: undefined | string

        Optional address that's allowed to purchase each item. If specified, no other address will be able to take each order.

      • buyerEmail: undefined | string

        Optional email of the user that's allowed to purchase each item. If specified, a user will have to verify this email before being able to take each order.

      • endAmount: undefined | number

        Optional price of the asset at the end of its expiration time. If not specified, will be set to startAmount. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.

      • expirationTime: number

        Expiration time for the order, in seconds. An expiration time of 0 means "never expire."

      • extraBountyBasisPoints: number

        Optional basis points (1/100th of a percent) to reward someone for referring the fulfillment of each order

      • factoryAddress: string

        Address of the factory contract

      • numberOfOrders: number

        Number of times to repeat creating the same order for each asset. If greater than 5, creates them in batches of 5. Requires an apiKey to be set during seaport initialization in order to not be throttled by the API.

      • paymentTokenAddress: undefined | string

        Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.

      • schemaName: WyvernSchemaName
      • startAmount: number

        Price of the asset at the start of the auction, or minimum acceptable bid if it's an English auction. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.

      • waitForHighestBid: boolean

        If set to true, this becomes an English auction that increases in price for every bid. The highest bid wins when the auction expires, as long as it's at least startAmount. expirationTime must be > 0.

    Returns Promise<Order[]>

createSellOrder

  • createSellOrder(__namedParameters: object): Promise<Order>
  • Create a sell order to auction an asset. Will throw a 'You do not own enough of this asset' error if the maker doesn't have the asset or not enough of it to sell the specific quantity. If the user hasn't approved access to the token yet, this will emit ApproveAllAssets (or ApproveAsset if the contract doesn't support approve-all) before asking for approval.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the maker's wallet

      • asset: Asset

        The asset to trade

      • buyerAddress: undefined | string

        Optional address that's allowed to purchase this item. If specified, no other address will be able to take the order, unless its value is the null address.

      • buyerEmail: undefined | string

        Optional email of the user that's allowed to purchase this item. If specified, a user will have to verify this email before being able to take the order.

      • endAmount: undefined | number

        Optional price of the asset at the end of its expiration time. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.

      • expirationTime: number

        Expiration time for the order, in seconds. An expiration time of 0 means "never expire."

      • extraBountyBasisPoints: number

        Optional basis points (1/100th of a percent) to reward someone for referring the fulfillment of this order

      • paymentTokenAddress: undefined | string

        Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.

      • quantity: number

        The number of assets to sell (if fungible or semi-fungible). Defaults to 1. In units, not base units, e.g. not wei.

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type

      • startAmount: number

        Price of the asset at the start of the auction. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.

      • tokenAddress: undefined | string

        DEPRECATED: Address of the token's contract. Use asset instead.

      • tokenId: undefined | string

        DEPRECATED: Token ID. Use asset instead.

      • waitForHighestBid: boolean

        If set to true, this becomes an English auction that increases in price for every bid. The highest bid wins when the auction expires, as long as it's at least startAmount. expirationTime must be > 0.

    Returns Promise<Order>

fulfillOrder

  • fulfillOrder(__namedParameters: object): Promise<void>
  • Fullfill or "take" an order for an asset, either a buy or sell order

    Parameters

    • __namedParameters: object
      • accountAddress: string

        The taker's wallet address

      • order: Order

        The order to fulfill, a.k.a. "take"

      • recipientAddress: undefined | string

        The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress.

      • referrerAddress: undefined | string

        The optional address that referred the order

    Returns Promise<void>

getCurrentPrice

  • getCurrentPrice(order: Order): Promise<any>
  • Gets the price for the order using the contract

    Parameters

    • order: Order

      The order to calculate the price for

    Returns Promise<any>

getFungibleTokens

  • Get known payment tokens (ERC-20) that match your filters.

    Parameters

    • Default value __namedParameters: object = {}
      • address: undefined | string

        Filter by the ERC-20 contract address for the token, e.g. "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359" for Dai

      • name: undefined | string

        Filter by the name of the ERC-20 contract. Not guaranteed to exist or be unique for each token type. e.g. '' for Dai and 'Decentraland' for MANA FUTURE: officiallySupported: Filter for tokens that are officially supported and shown on opensea.io

      • symbol: undefined | string

        Filter by the ERC-20 symbol for the token, e.g. "DAI" for Dai stablecoin

    Returns Promise<OpenSeaFungibleToken[]>

getQuoteFromUniswap

  • getQuoteFromUniswap(__namedParameters: object): Promise<number>
  • Gets the estimated cost or payout of either buying or selling NFTs to Uniswap using either purchaseAssts() or liquidateAssets()

    Parameters

    • __namedParameters: object
      • contractAddress: string

        Address of the corresponding NFT core contract for these NFTs.

      • isBuying: boolean

        A bool for whether the user is buying or selling

      • numTokens: number

        The number of WrappedNFT tokens to either purchase or sell

    Returns Promise<number>

getTokenBalance

  • getTokenBalance(__namedParameters: object): Promise<BigNumber>
  • Get the balance of a fungible token.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        User's account address

      • tokenAbi: object[]

        ABI for the token's contract. Defaults to ERC20

      • tokenAddress: undefined | string

        Optional address of the token's contract. Defaults to W-ETH

    Returns Promise<BigNumber>

isAssetTransferrable

  • isAssetTransferrable(__namedParameters: object, retries?: number): Promise<boolean>
  • Returns whether an asset is transferrable. An asset may not be transferrable if its transfer function is locked for some reason, e.g. an item is being rented within a game or trading has been locked for an item type.

    Parameters

    • __namedParameters: object
      • asset: Asset

        The asset to trade

      • fromAddress: string

        The account address that currently owns the asset

      • quantity: undefined | number | BigNumber

        The amount of the asset to transfer, if it's fungible (optional). In units (not base units), e.g. not wei.

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type

      • toAddress: string

        The account address that will be acquiring the asset

      • tokenAddress: undefined | string

        DEPRECATED: Address of the token's contract. Use asset instead.

      • tokenId: undefined | string

        DEPRECATED: Token ID. Use asset instead.

      • useProxy: boolean

        Use the fromAddress's proxy contract only if the fromAddress has already approved the asset for sale. Required if checking an ERC-721 v1 asset (like CryptoKitties) that doesn't check if the transferFrom caller is the owner of the asset (only allowing it if it's an approved address).

    • Default value retries: number = 1

      How many times to retry if false

    Returns Promise<boolean>

isOrderFulfillable

  • isOrderFulfillable(__namedParameters: object, retries?: number): Promise<boolean>
  • Returns whether an order is fulfillable. An order may not be fulfillable if a target item's transfer function is locked for some reason, e.g. an item is being rented within a game or trading has been locked for an item type.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        The account address that will be fulfilling the order

      • order: Order

        Order to check

      • recipientAddress: undefined | string

        The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress.

      • referrerAddress: undefined | string

        The optional address that referred the order

    • Default value retries: number = 1

      How many times to retry if false

    Returns Promise<boolean>

liquidateAssets

  • liquidateAssets(__namedParameters: object): Promise<void>
  • Liquidates an arbirary group of NFTs by atomically wrapping them into their corresponding WrappedNFT ERC20 tokens, and then immediately selling those ERC20 tokens on their corresponding Uniswap exchange. Emits the LiquidateAssets event when the transaction is prompted.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the user's wallet

      • assets: Asset[]

        An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.

      • uniswapSlippageAllowedInBasisPoints: number

        The amount of slippage that a user will tolerate in their Uniswap trade; if Uniswap cannot fulfill the order without more slippage, the whole function will revert.

    Returns Promise<void>

purchaseAssets

  • purchaseAssets(__namedParameters: object): Promise<void>
  • Purchases a bundle of WrappedNFT tokens from Uniswap and then unwraps them into ERC721 tokens. Emits the PurchaseAssets event when the transaction is prompted.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the user's wallet

      • amount: BigNumber

        The estimated cost in wei for tokens (probably some ratio above the minimum amount to avoid the transaction failing due to frontrunning, minimum amount is found by calling UniswapExchange(uniswapAddress).getEthToTokenOutputPrice(numTokensToBuy.mul(10**18));

      • contractAddress: string

        Address of the corresponding NFT core contract for these NFTs.

      • numTokensToBuy: number

        The number of WrappedNFT tokens to purchase and unwrap

    Returns Promise<void>

removeAllListeners

  • removeAllListeners(event?: EventType): void
  • Remove all event listeners. Good idea to call this when you're unmounting a component that listens to events to make UI updates

    Parameters

    • Optional event: EventType

      Optional EventType to remove listeners for

    Returns void

removeListener

  • removeListener(subscription: EventSubscription): void
  • Remove an event listener, included here for completeness. Simply calls .remove() on a subscription

    Parameters

    • subscription: EventSubscription

      The event subscription returned from addListener

    Returns void

transfer

  • transfer(__namedParameters: object): Promise<string>
  • Transfer a fungible or non-fungible asset to another address

    Parameters

    • __namedParameters: object
      • asset: Asset

        The fungible or non-fungible asset to transfer

      • fromAddress: string

        The owner's wallet address

      • quantity: number | BigNumber

        The amount of the asset to transfer, if it's fungible (optional). In units (not base units), e.g. not wei.

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type. Defaults to "ERC721" (non-fungible) assets, but can be ERC1155, ERC20, and others.

      • toAddress: string

        The recipient's wallet address

    Returns Promise<string>

    Transaction hash

transferAll

  • transferAll(__namedParameters: object): Promise<string>
  • Transfer one or more assets to another address. ERC-721 and ERC-1155 assets are supported

    Parameters

    • __namedParameters: object
      • assets: Asset[]

        An array of objects with the tokenId and tokenAddress of each of the assets to transfer.

      • fromAddress: string

        The owner's wallet address

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type

      • toAddress: string

        The recipient's wallet address

    Returns Promise<string>

    Transaction hash

transferOne

  • transferOne(__namedParameters: object): Promise<string>
  • DEPRECATED: use transfer instead, which works for more types of assets (including fungibles and old non-fungibles). Transfer an NFT asset to another address

    Parameters

    • __namedParameters: object
      • asset: WyvernNFTAsset | WyvernFTAsset | Asset

        The asset to transfer

      • fromAddress: string

        The owner's wallet address

      • isWyvernAsset: boolean

        Whether the passed asset is a generic WyvernAsset, for backwards compatibility

      • schemaName: WyvernSchemaName

        The Wyvern schema name corresponding to the asset type

      • toAddress: string

        The recipient's wallet address

    Returns Promise<string>

    Transaction hash

unwrapAssets

  • unwrapAssets(__namedParameters: object): Promise<void>
  • Unwraps an arbirary group of NFTs from their corresponding WrappedNFT ERC20 tokens back into ERC721 tokens. Emits the UnwrapAssets event when the transaction is prompted.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the user's wallet

      • assets: Asset[]

        An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.

      • destinationAddresses: string[]

        Addresses that each resulting ERC721 token will be sent to. Must be the same length as tokenIds. Each address corresponds with its respective token ID in the tokenIds array.

    Returns Promise<void>

unwrapWeth

  • unwrapWeth(__namedParameters: object): Promise<void>
  • Unwrap W-ETH into ETH. Emits the UnwrapWeth event when the transaction is prompted.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the user's wallet containing the W-ETH

      • amountInEth: number

        How much W-ETH to unwrap

    Returns Promise<void>

validateAndPostOrder

  • validateAndPostOrder(order: Order): Promise<Order>

wrapAssets

  • wrapAssets(__namedParameters: object): Promise<void>
  • Wraps an arbirary group of NFTs into their corresponding WrappedNFT ERC20 tokens. Emits the WrapAssets event when the transaction is prompted.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the user's wallet

      • assets: Asset[]

        An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.

    Returns Promise<void>

wrapEth

  • wrapEth(__namedParameters: object): Promise<void>
  • Wrap ETH into W-ETH. W-ETH is needed for placing buy orders (making offers). Emits the WrapEth event when the transaction is prompted.

    Parameters

    • __namedParameters: object
      • accountAddress: string

        Address of the user's wallet containing the ether

      • amountInEth: number

        How much ether to wrap

    Returns Promise<void>

Generated using TypeDoc