Trustblock
Search
K
Comment on page
🏷

Labels widget

Trustblock labels are visual gateways to display the security state of a project on a website.

Setup

  1. 1.
    Import the script to your website entry HTML file, as follows:
<script src="https://widget.trustblock.run/audit-label.js" defer />
  1. 2.
    Start adding labels anywhere you want on your website:
<div
data-tb-audit-label
data-tb-contractaddress="0xabcde..."
data-tb-chainid="1"
/>

Parameters

Each label div must have the data-tb-audit-label attribute. Then depending on your use case, It must have either data-tb-auditid or data-tb-contractaddress along with data-tb-chainid .

Use Case #1: Static context

If you already know the project you want to display the label for and are not in a dynamic context, then you should use data-tb-auditid.
  1. 1.
    Head to the project's audit on Trustblock's app, go to the corresponding audit, and get the id from the URL. Eg. https://beta.trustblock.run/audit/7b9a2b01-bb84-42ca-ac0e-8b70c86debe3 , here 7b9a2b01-bb84-42ca-ac0e-8b70c86debe3 is the audit id.
  2. 2.
    Then declare your div as follows:
<div
data-tb-audit-label
data-tb-auditid="7b9a2b01-bb84-42ca-ac0e-8b70c86debe3"
/>

Use Case #2: Dynamic context

If you don't know the project you want to display the label for and are in a dynamic context, then you should use data-tb-contractaddress along with data-tb-chainid .
  1. 1.
    Declare your div as follows:
<div
data-tb-audit-label
data-tb-contractaddress="0xabdcde"
data-tb-chainid="1"
/>
  • data-tb-contractaddress : is the address of the contract.
  • data-tb-chainid : is the chain id of the contract. Below is the list of possible values for data-tb-chainid :
    • 1 : Ethereum
    • 137: Polygon
    • 43113: Avalanche
    • 56: Bnb Chain

Optionally, you can add the following attributes with hexadecimal color values to customize the render:
  • data-tb-colortext
  • data-tb-colorbackground
  • data-tb-colorborder
  • data-tb-mode
  • data-tb-size

Try it out!

Get the audit label with a filter

Now it's showing "Not audited" because the filter was set to an address that has not upvoted the auditor who audited this contract.