Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OpenSeaSDK

Example setup:

import * as Web3 from 'web3' import { OpenSeaPort, Network } from 'opensea-js' const provider = new Web3.providers.HttpProvider('https://mainnet.infura.io') const client = new OpenSeaPort(provider, { networkName: Network.Main })

Hierarchy

  • OpenSeaSDK

Index

Constructors

Properties

Methods

Constructors

constructor

  • new OpenSeaSDK(provider: provider, apiConfig?: OpenSeaAPIConfig, logger?: (arg: string) => void): OpenSeaSDK
  • 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')

    • apiConfig: OpenSeaAPIConfig = {}

      configuration options, including networkName

    • Optional logger: (arg: string) => void

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

        • (arg: string): void
        • Parameters

          • arg: string

          Returns void

    Returns OpenSeaSDK

Properties

Private _emitter

_emitter: EventEmitter

Private _networkName

_networkName: Network

Private _uniswapFactoryAddress

_uniswapFactoryAddress: string

Private _wrappedNFTFactoryAddress

_wrappedNFTFactoryAddress: string

Private _wrappedNFTLiquidationProxyAddress

_wrappedNFTLiquidationProxyAddress: string

Private Optional _wyvernConfigOverride

_wyvernConfigOverride?: WyvernConfig

Private _wyvernProtocol

_wyvernProtocol: WyvernProtocol

Private _wyvernProtocolReadOnly

_wyvernProtocolReadOnly: WyvernProtocol

Readonly api

ethersProvider

ethersProvider: Web3Provider

gasIncreaseFactor

gasIncreaseFactor: number = DEFAULT_GAS_INCREASE_FACTOR

gasPriceAddition

gasPriceAddition: BigNumber = ...

logger

logger: (arg: string) => void

Type declaration

    • (arg: string): void
    • Parameters

      • arg: string

      Returns void

seaport

seaport: Seaport

web3

web3: default

web3ReadOnly

web3ReadOnly: default

Methods

_approveAll

  • _approveAll(__namedParameters: { accountAddress: string; proxyAddress?: string; schemaNames: WyvernSchemaName[]; wyAssets: WyvernAsset[] }): Promise<(null | string)[]>
  • Parameters

    • __namedParameters: { accountAddress: string; proxyAddress?: string; schemaNames: WyvernSchemaName[]; wyAssets: WyvernAsset[] }
      • accountAddress: string
      • Optional proxyAddress?: string
      • schemaNames: WyvernSchemaName[]
      • wyAssets: WyvernAsset[]

    Returns Promise<(null | string)[]>

Private _atomicMatch

  • _atomicMatch(__namedParameters: { accountAddress: string; buy: Order; metadata?: string; sell: Order }): Promise<string>
  • Parameters

    • __namedParameters: { accountAddress: string; buy: Order; metadata?: string; sell: Order }
      • accountAddress: string
      • buy: Order
      • Optional metadata?: string
      • sell: Order

    Returns Promise<string>

_buyOrderValidationAndApprovals

  • _buyOrderValidationAndApprovals(__namedParameters: { accountAddress: string; counterOrder?: Order; order: UnhashedOrder }): Promise<void>
  • Parameters

    • __namedParameters: { accountAddress: string; counterOrder?: Order; order: UnhashedOrder }
      • accountAddress: string
      • Optional counterOrder?: Order
      • order: UnhashedOrder

    Returns Promise<void>

_computeGasPrice

  • _computeGasPrice(): Promise<BigNumber>

Private _confirmTransaction

  • _confirmTransaction(transactionHash: string, event: EventType, description: string, testForSuccess?: () => Promise<boolean>): Promise<void>
  • Parameters

    • transactionHash: string
    • event: EventType
    • description: string
    • Optional testForSuccess: () => Promise<boolean>
        • (): Promise<boolean>
        • Returns Promise<boolean>

    Returns Promise<void>

_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: { buyerEmail: string; order: UnhashedOrder }): Promise<void>
  • Parameters

    • __namedParameters: { buyerEmail: string; order: UnhashedOrder }
      • buyerEmail: string
      • order: UnhashedOrder

    Returns Promise<void>

Private _dispatch

_estimateGasForMatch

  • _estimateGasForMatch(__namedParameters: { accountAddress: string; buy: Order; metadata?: string; sell: Order }, retries?: number): Promise<undefined | number>
  • Estimate the gas needed to match two orders. Returns undefined if tx errors

    Parameters

    • __namedParameters: { accountAddress: string; buy: Order; metadata?: string; sell: Order }
      • accountAddress: string
      • buy: Order
      • Optional metadata?: string
      • sell: Order
    • retries: number = 1

      Number of times to retry if false

    Returns Promise<undefined | number>

_estimateGasForTransfer

  • _estimateGasForTransfer(__namedParameters: { assets: Asset[]; fromAddress: string; schemaName?: WyvernSchemaName; toAddress: string }): Promise<number>
  • Estimate the gas needed to transfer assets in bulk Used for tests

    Parameters

    • __namedParameters: { assets: Asset[]; fromAddress: string; schemaName?: WyvernSchemaName; toAddress: string }
      • assets: Asset[]
      • fromAddress: string
      • Optional schemaName?: WyvernSchemaName
      • toAddress: string

    Returns Promise<number>

_getApprovedTokenCount

  • _getApprovedTokenCount(__namedParameters: { accountAddress: string; proxyAddress?: string; tokenAddress?: string }): 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: { accountAddress: string; proxyAddress?: string; tokenAddress?: string }
      • accountAddress: string
      • Optional proxyAddress?: string
      • Optional tokenAddress?: string

    Returns Promise<BigNumber>

_getBuyFeeParameters

  • _getBuyFeeParameters(totalBuyerFeeBasisPoints: number, totalSellerFeeBasisPoints: number, sellOrder?: UnhashedOrder): { feeMethod: FeeMethod; feeRecipient: string; makerProtocolFee: BigNumber; makerReferrerFee: BigNumber; makerRelayerFee: BigNumber; takerProtocolFee: BigNumber; takerRelayerFee: BigNumber }
  • Parameters

    • totalBuyerFeeBasisPoints: number
    • totalSellerFeeBasisPoints: number
    • Optional sellOrder: UnhashedOrder

    Returns { feeMethod: FeeMethod; feeRecipient: string; makerProtocolFee: BigNumber; makerReferrerFee: BigNumber; makerRelayerFee: BigNumber; takerProtocolFee: BigNumber; takerRelayerFee: BigNumber }

    • feeMethod: FeeMethod
    • feeRecipient: string
    • makerProtocolFee: BigNumber
    • makerReferrerFee: BigNumber
    • makerRelayerFee: BigNumber
    • takerProtocolFee: BigNumber
    • takerRelayerFee: BigNumber

Private _getClientsForRead

  • _getClientsForRead(__namedParameters: { retries: number }): { web3: default; wyvernProtocol: WyvernProtocol }
  • Get the clients to use for a read call

    Parameters

    • __namedParameters: { retries: number }
      • retries: number

    Returns { web3: default; wyvernProtocol: WyvernProtocol }

Private _getMetadata

  • _getMetadata(order: Order, referrerAddress?: string): undefined | string
  • Parameters

    • order: Order
    • Optional referrerAddress: string

    Returns undefined | string

Private _getPriceParameters

  • _getPriceParameters(orderSide: OrderSide, tokenAddress: string, expirationTime: BigNumber, startAmount: BigNumber, endAmount?: BigNumber, waitingForBestCounterOrder?: boolean, englishAuctionReservePrice?: BigNumber): Promise<{ basePrice: BigNumber; endPrice: undefined | BigNumber; extra: BigNumber; paymentToken: string; reservePrice: undefined | BigNumber }>
  • Compute the basePrice and extra parameters to be used to price an order. Also validates the expiration time and auction type.

    Parameters

    • orderSide: OrderSide
    • tokenAddress: string

      Address of the ERC-20 token to use for trading. Use the null address for ETH

    • expirationTime: BigNumber

      When the auction expires, or 0 if never.

    • startAmount: BigNumber

      The base value for the order, in the token's main units (e.g. ETH instead of wei)

    • Optional endAmount: BigNumber

      The end value for the order, in the token's main units (e.g. ETH instead of wei). If unspecified, the order's extra attribute will be 0

    • waitingForBestCounterOrder: boolean = false
    • Optional englishAuctionReservePrice: BigNumber

    Returns Promise<{ basePrice: BigNumber; endPrice: undefined | BigNumber; extra: BigNumber; paymentToken: string; reservePrice: undefined | BigNumber }>

_getProxy

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

    Parameters

    • accountAddress: string

      The user's wallet address

    • retries: number = 0

      Optional number of retries to do

    Returns Promise<null | string>

Private _getRequiredAmountForTakingSellOrder

  • _getRequiredAmountForTakingSellOrder(sell: Order): Promise<BigNumber>

Private _getSchema

  • _getSchema(schemaName?: WyvernSchemaName): Schema<WyvernAsset>
  • Parameters

    • Optional schemaName: WyvernSchemaName

    Returns Schema<WyvernAsset>

Private _getSchemaName

  • _getSchemaName(asset: Asset | OpenSeaAsset): undefined | WyvernSchemaName
  • Parameters

    • asset: Asset | OpenSeaAsset

    Returns undefined | WyvernSchemaName

Private _getTimeParameters

  • _getTimeParameters(__namedParameters: { expirationTimestamp?: number; isMatchingOrder?: boolean; listingTimestamp?: number; waitingForBestCounterOrder?: boolean }): { expirationTime: BigNumber; listingTime: BigNumber }
  • Get the listing and expiration time parameters for a new order

    Parameters

    • __namedParameters: { expirationTimestamp?: number; isMatchingOrder?: boolean; listingTimestamp?: number; waitingForBestCounterOrder?: boolean }
      • Optional expirationTimestamp?: number
      • Optional isMatchingOrder?: boolean
      • Optional listingTimestamp?: number
      • Optional waitingForBestCounterOrder?: boolean

    Returns { expirationTime: BigNumber; listingTime: BigNumber }

    • expirationTime: BigNumber
    • listingTime: BigNumber

_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>

_makeMatchingOrder

  • _makeMatchingOrder(__namedParameters: { accountAddress: string; order: UnsignedOrder; recipientAddress: string }): UnsignedOrder
  • Parameters

    • __namedParameters: { accountAddress: string; order: UnsignedOrder; recipientAddress: string }
      • accountAddress: string
      • order: UnsignedOrder
      • recipientAddress: string

    Returns UnsignedOrder

_ownsAssetOnChain

  • _ownsAssetOnChain(__namedParameters: { accountAddress: string; proxyAddress?: null | string; schemaName: WyvernSchemaName; wyAsset: WyvernAsset }): Promise<boolean>
  • Check if an account, or its proxy, owns an asset on-chain

    Parameters

    • __namedParameters: { accountAddress: string; proxyAddress?: null | string; schemaName: WyvernSchemaName; wyAsset: WyvernAsset }
      • accountAddress: string
      • Optional proxyAddress?: null | string
      • schemaName: WyvernSchemaName
      • wyAsset: WyvernAsset

    Returns Promise<boolean>

Private _pollCallbackForConfirmation

  • _pollCallbackForConfirmation(event: EventType, description: string, testForSuccess: () => Promise<boolean>): Promise<void>
  • Parameters

    • event: EventType
    • description: string
    • testForSuccess: () => Promise<boolean>
        • (): Promise<boolean>
        • Returns Promise<boolean>

    Returns Promise<void>

_sellOrderValidationAndApprovals

  • _sellOrderValidationAndApprovals(__namedParameters: { accountAddress: string; order: UnhashedOrder }): Promise<void>
  • Parameters

    • __namedParameters: { accountAddress: string; order: UnhashedOrder }
      • accountAddress: string
      • order: UnhashedOrder

    Returns Promise<void>

Private _validateFees

  • _validateFees(totalBuyerFeeBasisPoints: number, totalSellerFeeBasisPoints: number): void
  • Validate fee parameters

    Parameters

    • totalBuyerFeeBasisPoints: number

      Total buyer fees

    • totalSellerFeeBasisPoints: number

      Total seller fees

    Returns void

_validateMatch

  • _validateMatch(__namedParameters: { accountAddress: string; buy: Order; sell: Order; shouldValidateBuy?: boolean; shouldValidateSell?: boolean }, retries?: number): Promise<boolean>
  • Validate against Wyvern that a buy and sell order can match

    Parameters

    • __namedParameters: { accountAddress: string; buy: Order; sell: Order; shouldValidateBuy?: boolean; shouldValidateSell?: boolean }
      • accountAddress: string
      • buy: Order
      • sell: Order
      • Optional shouldValidateBuy?: boolean
      • Optional shouldValidateSell?: boolean
    • 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: (data: EventData) => void, once?: boolean): EventSubscription
  • Add a listener to a marketplace event

    Parameters

    • event: EventType

      An event to listen for

    • listener: (data: EventData) => void

      A callback that will accept an object with event data

    • once: boolean = false

      Whether the listener should only be called once

    Returns EventSubscription

approveFungibleToken

  • approveFungibleToken(__namedParameters: { accountAddress: string; minimumAmount?: BigNumber; proxyAddress?: string; tokenAddress: string }): Promise<null | string>
  • 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: { accountAddress: string; minimumAmount?: BigNumber; proxyAddress?: string; tokenAddress: string }
      • accountAddress: string
      • Optional minimumAmount?: BigNumber
      • Optional proxyAddress?: string
      • tokenAddress: string

    Returns Promise<null | string>

    Transaction hash if a new transaction occurred, otherwise null

approveOrder

  • approveOrder(order: OrderV2, domain?: string): Promise<string>
  • Instead of signing an off-chain order, you can approve an order with on on-chain transaction using this method

    Parameters

    • order: OrderV2

      Order to approve

    • Optional domain: string

      An optional domain to be hashed and included at the end of fulfillment calldata

    Returns Promise<string>

    Transaction hash of the approval transaction

approveOrderLegacyWyvern

  • approveOrderLegacyWyvern(order: UnsignedOrder): Promise<string>
  • Instead of signing an off-chain order, you can approve an order with on on-chain transaction using this method

    Parameters

    • order: UnsignedOrder

      Order to approve

    Returns Promise<string>

    Transaction hash of the approval transaction

approveSemiOrNonFungibleToken

  • approveSemiOrNonFungibleToken(__namedParameters: { accountAddress: string; proxyAddress?: string; schemaName?: WyvernSchemaName; skipApproveAllIfTokenAddressIn?: Set<string>; tokenAbi?: PartialReadonlyContractAbi; tokenAddress: string; tokenId: string }): Promise<null | string>
  • 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: { accountAddress: string; proxyAddress?: string; schemaName?: WyvernSchemaName; skipApproveAllIfTokenAddressIn?: Set<string>; tokenAbi?: PartialReadonlyContractAbi; tokenAddress: string; tokenId: string }
      • accountAddress: string
      • Optional proxyAddress?: string
      • Optional schemaName?: WyvernSchemaName
      • Optional skipApproveAllIfTokenAddressIn?: Set<string>
      • Optional tokenAbi?: PartialReadonlyContractAbi
      • tokenAddress: string
      • tokenId: string

    Returns Promise<null | string>

    Transaction hash if a new transaction was created, otherwise null

authorizeOrder

  • authorizeOrder(order: UnsignedOrder): Promise<null | (ECSignature & { nonce?: number })>
  • Generate the signature for authorizing an order

    Parameters

    • order: UnsignedOrder

      Unsigned wyvern order

    Returns Promise<null | (ECSignature & { nonce?: number })>

    order signature in the form of v, r, s, also an optional nonce

bulkCancelExistingOrdersLegacyWyvern

  • bulkCancelExistingOrdersLegacyWyvern(__namedParameters: { accountAddress: string }): Promise<void>
  • Cancel all existing orders with a lower nonce on-chain, preventing them from ever being fulfilled.

    Parameters

    • __namedParameters: { accountAddress: string }
      • accountAddress: string

    Returns Promise<void>

cancelOrder

  • cancelOrder(__namedParameters: { accountAddress: string; domain?: string; order: OrderV2 }): Promise<void>
  • Cancel an order on-chain, preventing it from ever being fulfilled.

    Parameters

    • __namedParameters: { accountAddress: string; domain?: string; order: OrderV2 }
      • accountAddress: string
      • Optional domain?: string
      • order: OrderV2

    Returns Promise<void>

cancelOrderLegacyWyvern

  • cancelOrderLegacyWyvern(__namedParameters: { accountAddress: string; order: Order }): Promise<void>
  • Cancel an order on-chain, preventing it from ever being fulfilled.

    Parameters

    • __namedParameters: { accountAddress: string; order: Order }
      • accountAddress: string
      • order: Order

    Returns Promise<void>

Private cancelSeaportOrders

  • cancelSeaportOrders(__namedParameters: { accountAddress: string; domain?: string; orders: OrderComponents[] }): Promise<string>
  • Parameters

    • __namedParameters: { accountAddress: string; domain?: string; orders: OrderComponents[] }
      • accountAddress: string
      • Optional domain?: string
      • orders: OrderComponents[]

    Returns Promise<string>

computeFees

  • computeFees(__namedParameters: { accountAddress?: string; asset?: OpenSeaAsset; extraBountyBasisPoints?: number; side: OrderSide }): Promise<ComputedFees>
  • Compute the fees for an order

    Parameters

    • __namedParameters: { accountAddress?: string; asset?: OpenSeaAsset; extraBountyBasisPoints?: number; side: OrderSide }
      • Optional accountAddress?: string
      • Optional asset?: OpenSeaAsset
      • Optional extraBountyBasisPoints?: number
      • side: OrderSide

    Returns Promise<ComputedFees>

createBuyOrder

  • createBuyOrder(options: { accountAddress: string; asset: Asset; domain?: string; expirationTime?: BigNumberInput; paymentTokenAddress?: string; quantity?: BigNumberInput; salt?: string; startAmount: BigNumberInput }): Promise<OrderV2>
  • Create a buy order to make an offer on an asset.

    Parameters

    • options: { accountAddress: string; asset: Asset; domain?: string; expirationTime?: BigNumberInput; paymentTokenAddress?: string; quantity?: BigNumberInput; salt?: string; startAmount: BigNumberInput }

      Options for creating the buy order

      • accountAddress: string

        Address of the maker's wallet

      • asset: Asset

        The asset to trade

      • Optional domain?: string

        An optional domain to be hashed and included in the first four bytes of the random salt.

      • Optional expirationTime?: BigNumberInput

        Expiration time for the order, in seconds

      • Optional paymentTokenAddress?: string

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

      • Optional quantity?: BigNumberInput

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

      • Optional salt?: string

        Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.

      • startAmount: BigNumberInput

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

    Returns Promise<OrderV2>

createSellOrder

  • createSellOrder(options: { accountAddress: string; asset: Asset; buyerAddress?: string; domain?: string; endAmount?: BigNumberInput; expirationTime?: BigNumberInput; listingTime?: string; paymentTokenAddress?: string; quantity?: BigNumberInput; salt?: string; startAmount: BigNumberInput }): Promise<OrderV2>
  • Create a sell order to auction an asset.

    Parameters

    • options: { accountAddress: string; asset: Asset; buyerAddress?: string; domain?: string; endAmount?: BigNumberInput; expirationTime?: BigNumberInput; listingTime?: string; paymentTokenAddress?: string; quantity?: BigNumberInput; salt?: string; startAmount: BigNumberInput }

      Options for creating the sell order

      • accountAddress: string

        Address of the maker's wallet

      • asset: Asset

        The asset to trade

      • Optional buyerAddress?: 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.

      • Optional domain?: string

        An optional domain to be hashed and included in the first four bytes of the random salt.

      • Optional endAmount?: BigNumberInput

        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.

      • Optional expirationTime?: BigNumberInput

        Expiration time for the order, in UTC seconds.

      • Optional listingTime?: string

        Optional time when the order will become fulfillable, in UTC seconds. Undefined means it will start now.

      • Optional paymentTokenAddress?: string

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

      • Optional quantity?: BigNumberInput

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

      • Optional salt?: string

        Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty.

      • startAmount: BigNumberInput

        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.

    Returns Promise<OrderV2>

fulfillOrder

  • fulfillOrder(options: { accountAddress: string; domain?: string; order: OrderV2; recipientAddress?: string }): Promise<string>
  • Fullfill or "take" an order for an asset, either a buy or sell order

    Parameters

    • options: { accountAddress: string; domain?: string; order: OrderV2; recipientAddress?: string }

      fullfillment options

      • accountAddress: string

        The taker's wallet address

      • Optional domain?: string

        An optional domain to be hashed and included at the end of fulfillment calldata

      • order: OrderV2

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

      • Optional recipientAddress?: string

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

    Returns Promise<string>

    Transaction hash for fulfilling the order

fulfillOrderLegacyWyvern

  • fulfillOrderLegacyWyvern(__namedParameters: { accountAddress: string; order: Order; recipientAddress?: string; referrerAddress?: string }): Promise<string>
  • Fullfill or "take" an order for an asset, either a buy or sell order

    Parameters

    • __namedParameters: { accountAddress: string; order: Order; recipientAddress?: string; referrerAddress?: string }
      • accountAddress: string
      • order: Order
      • Optional recipientAddress?: string
      • Optional referrerAddress?: string

    Returns Promise<string>

    Transaction hash for fulfilling the order

Private fulfillPrivateOrder

  • fulfillPrivateOrder(__namedParameters: { accountAddress: string; domain?: string; order: OrderV2 }): Promise<string>
  • Parameters

    • __namedParameters: { accountAddress: string; domain?: string; order: OrderV2 }
      • accountAddress: string
      • Optional domain?: string
      • order: OrderV2

    Returns Promise<string>

Private getAmountWithBasisPointsApplied

  • getAmountWithBasisPointsApplied(amount: BigNumber, basisPoints: number): string
  • Parameters

    • amount: BigNumber
    • basisPoints: number

    Returns string

getAssetBalance

  • getAssetBalance(__namedParameters: { accountAddress: string; asset: Asset }, retries?: number): Promise<BigNumber>
  • Get an account's balance of any Asset.

    Parameters

    • __namedParameters: { accountAddress: string; asset: Asset }
      • accountAddress: string
      • asset: Asset
    • retries: number = 1

      How many times to retry if balance is 0

    Returns Promise<BigNumber>

Private getAssetItems

  • getAssetItems(assets: Asset[], quantities?: BigNumber[], fallbackSchema?: WyvernSchemaName): CreateInputItem[]
  • Parameters

    • assets: Asset[]
    • quantities: BigNumber[] = []
    • Optional fallbackSchema: WyvernSchemaName

    Returns CreateInputItem[]

getCurrentPrice

  • getCurrentPrice(__namedParameters: { order: OrderV2 }): Promise<BigNumber>
  • Gets the current price for the order.

    Parameters

    • __namedParameters: { order: OrderV2 }
      • order: OrderV2

    Returns Promise<BigNumber>

getCurrentPriceLegacyWyvern

  • getCurrentPriceLegacyWyvern(order: Order): Promise<BigNumber>
  • Gets the price for the order using the contract

    Parameters

    • order: Order

      The order to calculate the price for

    Returns Promise<BigNumber>

getDomain

  • getDomain(tag: string, index: number): Promise<string>
  • Get the domain for a specific tag at a given index.

    Parameters

    • tag: string

      The tag to look up.

    • index: number

      The index of the domain to return.

    Returns Promise<string>

    Domain

getDomains

  • getDomains(tag: string): Promise<string[]>
  • Get the full array of domains for a specific tag.

    Parameters

    • tag: string

      The tag to look up.

    Returns Promise<string[]>

    Array of domains

Private getFees

  • getFees(__namedParameters: { endAmount?: BigNumber; openseaAsset: OpenSeaAsset; paymentTokenAddress: string; startAmount: BigNumber }): Promise<{ collectionSellerFees: ConsiderationInputItem[]; openseaSellerFee: ConsiderationInputItem; sellerFee: ConsiderationInputItem }>
  • Parameters

    • __namedParameters: { endAmount?: BigNumber; openseaAsset: OpenSeaAsset; paymentTokenAddress: string; startAmount: BigNumber }
      • Optional endAmount?: BigNumber
      • openseaAsset: OpenSeaAsset
      • paymentTokenAddress: string
      • startAmount: BigNumber

    Returns Promise<{ collectionSellerFees: ConsiderationInputItem[]; openseaSellerFee: ConsiderationInputItem; sellerFee: ConsiderationInputItem }>

getFungibleTokens

  • getFungibleTokens(__namedParameters?: { address?: string; name?: string; symbol?: string }): Promise<OpenSeaFungibleToken[]>
  • Get known payment tokens (ERC-20) that match your filters.

    Parameters

    • __namedParameters: { address?: string; name?: string; symbol?: string } = {}
      • Optional address?: string
      • Optional name?: string
      • Optional symbol?: string

    Returns Promise<OpenSeaFungibleToken[]>

getNonce

  • getNonce(accountAddress: string): Promise<BigNumber>
  • Gets the current order nonce for an account

    Parameters

    • accountAddress: string

      account to check the nonce for

    Returns Promise<BigNumber>

    nonce

getNumberOfDomains

  • getNumberOfDomains(tag: string): Promise<BigNumber>
  • Get the number of registered domains for a specific tag.

    Parameters

    • tag: string

      The tag to look up.

    Returns Promise<BigNumber>

    Number of registered domains for input tag.

getQuoteFromUniswap

  • getQuoteFromUniswap(__namedParameters: { contractAddress: string; isBuying: boolean; numTokens: number }): Promise<number>
  • Gets the estimated cost or payout of either buying or selling NFTs to Uniswap using either purchaseAssts() or liquidateAssets()

    Parameters

    • __namedParameters: { contractAddress: string; isBuying: boolean; numTokens: number }
      • contractAddress: string
      • isBuying: boolean
      • numTokens: number

    Returns Promise<number>

getTokenBalance

  • getTokenBalance(__namedParameters: { accountAddress: string; schemaName?: WyvernSchemaName; tokenAddress: string }, retries?: number): Promise<BigNumber>
  • Get the balance of a fungible token. Convenience method for getAssetBalance for fungibles

    Parameters

    • __namedParameters: { accountAddress: string; schemaName?: WyvernSchemaName; tokenAddress: string }
      • accountAddress: string
      • Optional schemaName?: WyvernSchemaName
      • tokenAddress: string
    • retries: number = 1

      Number of times to retry if balance is undefined

    Returns Promise<BigNumber>

isAssetTransferrable

  • isAssetTransferrable(__namedParameters: { asset: Asset; fromAddress: string; quantity?: number | BigNumber; toAddress: string; useProxy?: boolean }, 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: { asset: Asset; fromAddress: string; quantity?: number | BigNumber; toAddress: string; useProxy?: boolean }
      • asset: Asset
      • fromAddress: string
      • Optional quantity?: number | BigNumber
      • toAddress: string
      • Optional useProxy?: boolean
    • retries: number = 1

      How many times to retry if false

    Returns Promise<boolean>

isAuthenticatedProxyRevoked

  • isAuthenticatedProxyRevoked(accountAddress: string): Promise<boolean>
  • Returns whether or not an authenticated proxy is revoked for a specific account address

    Parameters

    • accountAddress: string

    Returns Promise<boolean>

isOrderFulfillable

  • isOrderFulfillable(__namedParameters: { accountAddress: string; order: OrderV2 }): 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: { accountAddress: string; order: OrderV2 }
      • accountAddress: string
      • order: OrderV2

    Returns Promise<boolean>

isOrderFulfillableLegacyWyvern

  • isOrderFulfillableLegacyWyvern(__namedParameters: { accountAddress: string; order: Order; recipientAddress?: string; referrerAddress?: string }): 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: { accountAddress: string; order: Order; recipientAddress?: string; referrerAddress?: string }
      • accountAddress: string
      • order: Order
      • Optional recipientAddress?: string
      • Optional referrerAddress?: string

    Returns Promise<boolean>

liquidateAssets

  • liquidateAssets(__namedParameters: { accountAddress: string; assets: Asset[]; uniswapSlippageAllowedInBasisPoints: number }): Promise<void>
  • Liquidates an arbitrary 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: { accountAddress: string; assets: Asset[]; uniswapSlippageAllowedInBasisPoints: number }
      • accountAddress: string
      • assets: Asset[]
      • uniswapSlippageAllowedInBasisPoints: number

    Returns Promise<void>

purchaseAssets

  • purchaseAssets(__namedParameters: { accountAddress: string; amount: BigNumber; contractAddress: string; numTokensToBuy: number }): 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: { accountAddress: string; amount: BigNumber; contractAddress: string; numTokensToBuy: number }
      • accountAddress: string
      • amount: BigNumber
      • contractAddress: string
      • numTokensToBuy: number

    Returns Promise<void>

removeAllListeners

  • 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

revokeAuthenticatedProxyAccess

  • revokeAuthenticatedProxyAccess(accountAddress: string): Promise<string>
  • Revokes an authenticated proxy's access i.e. for freezing listings

    Parameters

    • accountAddress: string

    Returns Promise<string>

    transaction hash

setDomain

  • setDomain(domain: string): Promise<string>
  • Register a domain on the Domain Registry contract.

    Parameters

    • domain: string

      The string domain to be hashed and registered on the Registry.

    Returns Promise<string>

    Transaction hash

transfer

  • transfer(__namedParameters: { asset: Asset; fromAddress: string; quantity?: number | BigNumber; toAddress: string }): Promise<string>
  • Transfer a fungible or non-fungible asset to another address

    Parameters

    • __namedParameters: { asset: Asset; fromAddress: string; quantity?: number | BigNumber; toAddress: string }
      • asset: Asset
      • fromAddress: string
      • Optional quantity?: number | BigNumber
      • toAddress: string

    Returns Promise<string>

    Transaction hash

transferAll

  • transferAll(__namedParameters: { assets: Asset[]; fromAddress: string; schemaName?: WyvernSchemaName; toAddress: string }): Promise<string>
  • Transfer one or more assets to another address. ERC-721 and ERC-1155 assets are supported

    Parameters

    • __namedParameters: { assets: Asset[]; fromAddress: string; schemaName?: WyvernSchemaName; toAddress: string }
      • assets: Asset[]
      • fromAddress: string
      • Optional schemaName?: WyvernSchemaName
      • toAddress: string

    Returns Promise<string>

    Transaction hash

unapproveFungibleToken

  • unapproveFungibleToken(__namedParameters: { accountAddress: string; proxyAddress?: string; tokenAddress: string }): Promise<string>
  • Un-approve a fungible token (e.g. W-ETH) for use in trades. Called internally, but exposed for dev flexibility. Useful for old ERC20s that require a 0 approval count before changing the count

    Parameters

    • __namedParameters: { accountAddress: string; proxyAddress?: string; tokenAddress: string }
      • accountAddress: string
      • Optional proxyAddress?: string
      • tokenAddress: string

    Returns Promise<string>

    Transaction hash

unrevokeAuthenticatedProxyAccess

  • unrevokeAuthenticatedProxyAccess(accountAddress: string): Promise<string>
  • Unrevokes an authenticated proxy's access i.e. for unfreezing listings

    Parameters

    • accountAddress: string

    Returns Promise<string>

    transaction hash

unwrapAssets

  • unwrapAssets(__namedParameters: { accountAddress: string; assets: Asset[]; destinationAddresses: string[] }): Promise<void>
  • Unwraps an arbitrary group of NFTs from their corresponding WrappedNFT ERC20 tokens back into ERC721 tokens. Emits the UnwrapAssets event when the transaction is prompted.

    Parameters

    • __namedParameters: { accountAddress: string; assets: Asset[]; destinationAddresses: string[] }
      • accountAddress: string
      • assets: Asset[]
      • destinationAddresses: string[]

    Returns Promise<void>

unwrapWeth

  • unwrapWeth(__namedParameters: { accountAddress: string; amountInEth: number }): Promise<void>
  • Unwrap W-ETH into ETH. Emits the UnwrapWeth event when the transaction is prompted.

    Parameters

    • __namedParameters: { accountAddress: string; amountInEth: number }
      • accountAddress: string
      • amountInEth: number

    Returns Promise<void>

wrapAssets

  • wrapAssets(__namedParameters: { accountAddress: string; assets: Asset[] }): Promise<void>
  • Wraps an arbitrary group of NFTs into their corresponding WrappedNFT ERC20 tokens. Emits the WrapAssets event when the transaction is prompted.

    Parameters

    • __namedParameters: { accountAddress: string; assets: Asset[] }
      • accountAddress: string
      • assets: Asset[]

    Returns Promise<void>

wrapEth

  • wrapEth(__namedParameters: { accountAddress: string; amountInEth: number }): 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: { accountAddress: string; amountInEth: number }
      • accountAddress: string
      • amountInEth: number

    Returns Promise<void>

Generated using TypeDoc