SRA Element

Fork me on GitHub

Rendered

Live demos require a web3 client. We recommend installing Metamask. Live demos require an unlocked web3 client. Please unlock your client.

<or-sra sra="#SRA_ENDPOINT#" feeRecipient="#FEE_RECIPIENT_ADDRESS#">
  Your content goes here
</or-sra>

Installation

yarn add @openrelay/sra-element

Description

The <or-sra> element extends the <or-web3> element with properties specific to 0x trading. The <or-sra> element includes all of the functionality of the <or-web3> tag, so you do not need both at the same time. Certain widgets will require an <or-sra> as an ancestor, but widgets that require an <or-web3> ancestor can have that need met by an <or-sra> ancestor.

The <or-sra> tag provides its children with information about the 0x Relayer and the 0x Exchange contract. Any time those properties change, they will be automatically propagated to their children.

API

HTML Attributes
  • sra [default=https://api.openrelay.xyz] — The Standard Relayer API endpoint.
  • feeRecipient [default=0xfaec02c3474b1a1c553eddf3df27946643cc7122] — The feeRecipient address to associcate with orders.
  • sender [default=0x0000000000000000000000000000000000000000] — The sender who must submit orders to be filled.
Events

See the <or-web3> element for additional events.

Incoming Events
  • sra-child — An event emitted when a child element is registered. The event must include an attribute e.detail.element indicating the newly added element. The <or-sra> element will respond with a sra-ready event, and will notify the registered element on future sra changes.
Outgoing Events

None of the following events are emitted directly from the <or-sra> tag. Instead, the <or-sra> tag triggers them directly on one or more registered child elements.

  • sra-ready — Fired when SRA details are confirmed and available. The event includes the following details:
    • sra: The standard relayer API endpoint to use
    • feeRecipient: The fee recipient address to use for new orders
    • exchangeAddress: The exchange address to use for new orders
    • feeTokenAddress: The ZRX token address for this network
    • erc20ProxyAddress: The ERC20 token transfer proxy for this exchange
    • wethAddress: The wrapped ether contract address for this networks
    • epoch: The epoch for the connected user.