Constructors

  • Constructs a new instance of the CheckoutModule class.

    Parameters

    Returns Checkout

Properties

fiatRampService: FiatRampService
availability: AvailabilityService
passport?: Passport

Methods

  • Checks if the given object is a WrappedBrowserProvider.

    Parameters

    Returns boolean

    • True if the object is a WrappedBrowserProvider, false otherwise.
  • Loads the widgets bundle and initiates the widgets factory.

    Parameters

    • init: WidgetsInit

      The initialisation parameters for loading the widgets bundle and applying configuration

    Returns Promise<WidgetsFactory>

    A promise that resolves to the widgets factory instance that can be used to create and manage widgets

    When the widgets script fails to load

  • Creates a provider using the given parameters.

    Parameters

    Returns Promise<CreateProviderResult>

    A promise that resolves to the created provider.

  • Returns a list of EIP-6963 injected providers and their metadata.

    Returns readonly EIP6963ProviderDetail[]

    A readonly array of injected providers and their metadata.

  • Finds an injected provider by its RDNS.

    Parameters

    • args: {
          rdns: string;
      }

      The parameters for finding the injected provider.

      • rdns: string

    Returns undefined | EIP6963ProviderDetail

    • The found provider and metadata or undefined.
  • Subscribes to changes in the injected providers.

    Parameters

    Returns (() => void)

    • A function to unsubscribe the listener.
      • (): void
      • Returns void

  • Clears all registered injected providers and their subscriptions.

    Returns void

    This method doesn't return a value

  • Checks if a wallet is connected to the specified provider.

    Parameters

    Returns Promise<CheckConnectionResult>

    • A promise that resolves to the result of the check.
  • Fetches the risk assessment for the given addresses.

    Parameters

    • addresses: string[]

      The addresses to assess.

    Returns Promise<AssessmentResult>

    • A promise that resolves to the risk assessment result.
  • Helper method that checks if given risk assessment results contain sanctioned addresses.

    Parameters

    • assessment: AssessmentResult

      Risk assessment to analyse.

    • Optionaladdress: string

      If defined, only sanctions for the given address will be checked.

    Returns boolean

    • Result of the check.
  • Connects to a blockchain network using the specified provider.

    Parameters

    • params: ConnectParams

      The parameters for connecting to the network.

    Returns Promise<ConnectResult>

    A promise that resolves to an object containing the provider and network information.

    If the provider is not valid or if there is an error connecting to the network.

  • Adds the network for the current wallet provider.

    Parameters

    • params: AddNetworkParams

      The parameters for adding the network.

    Returns Promise<any>

    • A promise that resolves to the result of adding the network.

    When the network cannot be added to the wallet

  • Switches the network for the current wallet provider.

    Parameters

    Returns Promise<SwitchNetworkResult>

    • A promise that resolves to the result of switching the network.
  • Retrieves the token information given the token address. This function makes RPC calls to ERC20 contracts to fetch the main contract information (e.g. symbol).

    Parameters

    Returns Promise<TokenInfo>

    • A promise that resolves to the token info request.
  • Retrieves the balance of a wallet address.

    Parameters

    Returns Promise<GetBalanceResult>

    • A promise that resolves to the balance result.
  • Retrieves the balances of all tokens for a given wallet address on a specific chain.

    Parameters

    Returns Promise<GetAllBalancesResult>

    • A promise that resolves to the result of retrieving the balances.
  • Retrieves the supported networks based on the provided parameters.

    Parameters

    Returns Promise<GetNetworkAllowListResult>

    • A promise that resolves to the network allow list result.
  • Retrieves the supported tokens based on the provided parameters.

    Parameters

    Returns Promise<GetTokenAllowListResult>

    • A promise that resolves to the token allow list result.
  • Retrieves the default supported wallets based on the provided parameters.

    Parameters

    Returns Promise<GetWalletAllowListResult>

    • A promise that resolves to the wallet allow list result.
  • Sends a transaction using the specified provider and transaction parameters.

    Parameters

    Returns Promise<SendTransactionResult>

    A promise that resolves to the result of the transaction.

  • Wraps a WrappedBrowserProvider call to validate the provider and handle errors.

    Type Parameters

    • T

    Parameters

    Returns Promise<T>

    Returns the result of the provided block param.

  • Retrieves network information using the specified provider.

    Parameters

    Returns Promise<NetworkInfo>

    A promise that resolves to the network information.

  • Determines the requirements for performing a buy.

    Parameters

    • params: BuyParams

      The parameters for the buy.

    Returns Promise<BuyResult>

    A promise that resolves to the buy transaction requirements

    Please use orderbook.fulfillOrder or orderbook.fulfillBulkOrders instead. The smartCheckout method can still be used to ensure the transaction requirements are met before preparing the order fulfillment

  • Determines the requirements for performing a sell.

    Parameters

    Returns Promise<SellResult>

    A promise that resolves to the sell transaction requirements Only currently actions the first order in the array until we support batch processing. Only currently actions the first fee in the fees array of each order until we support multiple fees.

    Please use orderbook.prepareListing or orderbook.prepareBulkListing instead. The smartCheckout method can still be used to ensure the transaction requirements are met before preparing the listing

  • Cancels a sell.

    Parameters

    Returns Promise<CancelResult>

    A promise that resolves to the cancel transaction result

    Please use orderbook.prepareOrderCancellations instead.

  • Determines the transaction requirements to complete a purchase. This includes checking token approvals, native currency balance, and calculating the optimal route for completing the transaction.

    Parameters

    Returns Promise<SmartCheckoutResult>

    A promise that resolves to the transaction requirements including:

    • Required token approvals
    • Required native currency balance
    • Suggested transaction route
    • Estimated gas costs

    When item requirements cannot be mapped or checkout validation fails

  • Creates and returns a URL for the fiat ramp widget.

    Parameters

    Returns Promise<string>

    • A promise that resolves to a string url.
  • Fetches fiat ramp fee estimations.

    Returns Promise<OnRampProviderFees>

    • A promise that resolves to OnRampProviderFees.
  • Fetches Swap widget availability.

    Returns Promise<boolean>

    • A promise that resolves to a boolean.
  • Fetches a quote and then performs the approval and swap transaction.

    Parameters

    • params: SwapParams

      The parameters for the swap.

    Returns Promise<SwapResult>

    • A promise that resolves to the swap result (swap tx, swap tx receipt, quote used in the swap).
  • Fetches a quote for the swap.

    Parameters

    • params: SwapParams

      The parameters for the swap.

    Returns Promise<SwapQuoteResult>

    • A promise that resolves to the swap quote result.
""