SRA Fees

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#">
  <or-sra-fee></or-sra-fee>
</or-sra>

Installation

yarn add @openrelay/sra-fee-element

Description

The <or-sra-fee> element provides a slider to enable the user to allocate fees between the maker and the taker. OpenRelay allows makers to allocate fees between the maker and the taker, so long as the total fee adds up to the specified fees. If you are using this widget library with a different Relayer, make sure you understand their requirements with respect to fee allocation.

API

HTML Attributes
  • totalFee [default=provided by relayer] — By default, the fee widget will query the relayer to get the totalFee required. Applications can set this value higher than the relayer specifies, but not lower.
  • makerAssetAddress — Relayers may adjust the required fee based on the asset being traded. Specify the maker token address for more accurate fee requirements.
  • takerAssetAddress — Relayers may adjust the required fee based on the asset being traded. Specify the taker token address for more accurate fee requirements.
  • account [default=web3.eth.accounts[0]] — The maker account associated with these fees. By default, it will be the account associated with the web3 object, but that can be overridden.
  • disabled [default=false] — Prevents the user from changing the value.
JavaScript Properties
  • value — The percentage of the fee to be paid by the taker, as an integer between 0 and 100.
  • makerFee — A BigNumber indicating the number of base units of ZRX to be paid by the maker.
  • takerFee — A BigNumber indicating the number of base units of ZRX to be paid by the taker.
Events
Outgoing Events
  • change — Fired when the user changes the token. The event.details object includes:
    • feeRecipient: The fee recipient address to be used for the order
    • makerFee: A BigNumber indicating the number of base units of ZRX to be paid by the maker.
    • takerFee: A BigNumber indicating the number of base units of ZRX to be paid by the taker.