Ante
Ante v0.5
Ante v0.5
  • Welcome to Ante v0.5
  • How Ante works
  • Why use Ante?
    • How is Ante different?
    • What does Ante cost to use?
  • What's in Ante v0.5?
  • Using the Ante App
    • Navigating Ante
    • How to Stake
    • How to Challenge & Check Tests
    • The Decentralized Trust Score
      • Decentralized Trust Tiers
    • Deposit Limits
  • For Developers
    • Writing an Ante Test
      • Coming up with an invariant
      • Explaining IAnteTest.sol and AnteTest.sol
      • Ante Test Examples
      • Writing and Testing an Ante Test
      • Test an Ante Test Offline
      • Adding an Ante Test to Ante Github
      • Development FAQs
    • Integrating Ante
      • Integrate Ante using React
      • Integrate Ante using HTML
    • Deploying an Ante Test
      • Deploy an Ante Test
      • Create an Ante Pool
      • Verifying an Ante Pool
    • Contracts
  • About Ante
    • FAQs
    • Glossary
    • Security
    • Possible Future Work
    • Changelog
    • Terms of Service
Powered by GitBook
On this page
  • Install ante-widget-react
  • Build
  • Using AnteWidget
  • Example of usage
  1. For Developers
  2. Integrating Ante

Integrate Ante using React

PreviousIntegrating AnteNextIntegrate Ante using HTML

Last updated 2 years ago

The Ante widget has been published as an npm package:

Install ante-widget-react

npm: npm i @antefinance/ante-widget-react

yarn: yarn add @antefinance/ante-widget-react

Build

npm i
npm run build

Using AnteWidget

Import AnteWidget from the ante-widget-react package:

import AnteWidget from '@antefinance/ante-widget-react';
import '@antefinance/ante-widget/dist/widget.css'; // This will import the styles

Then add the appropriate AnteWidget component where desired on your app:

function Example() {
  ...
  return (
    <div>
      // To show the overall trust tier of a protocol
      <AnteWidget.Protocol name='PROTOCOL_NAME' />
      
      // To show the trust score on a specific Ante Test
      <AnteWidget.Test address='ANTE_TEST_ADDRESS' chain='0x1' />
    </div>
  );
}

Example of usage

The following code will generate badges for the Ante protocol as well as one of the Ante Tests that tests the ante protocol:

<AnteWidget.Protocol name='Ante' />
<AnteWidget.Test address='0x2EdC35B39BFBca6A52eA35612C2684D3D7654763' chain='0x1'>

Note: the protocol name string is case sensitive. If in doubt, check how the protocol name is spelled in the Ante app. Chain IDs can be looked up at .

https://chainlist.org/
Logonpm: @antefinance/ante-widget-reactnpm