@lidofinance/polygon-sdk-banner
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

Lido on Polygon - Frontend SDK

About us

Lido on Polygon is a DAO governed liquid staking protocol for Polygon PoS chain. It allows users to stake their ERC20 MATIC tokens on Ethereum mainnet and immediately get the representation of their share in the form of stMATIC token without maintaining staking infrastructure. Users will get staking rewards and still be able to control their stMATIC tokens MATIC tokens will be delegated across validators that are registered and accepted by the DAO inside Lido on Polygon protocol.

  • Node operators don't have direct access over the delegated assets.
  • They are just providing infrastructure and getting rewards in return.
  • Assets are controlled by Lido on Polygon contracts exclusively.

The goal is to help with Polygon decentralization and integrate stMATIC with the variety of protocols and DeFi applications on Ethereum mainnet and Polygon PoS chain.

About the SDK

This SDK helps you integrate with Lido on Polygon, using two methods:

  • Using React banner (simplest).
  • Supporting a UI widget in your project (We provide js functions for staking, unstaking, statistics and transaction info).

Contents:

Installation

$ npm install @lidofinance/polygon-sdk
$ yarn add @lidofinance/polygon-sdk

Using Banner

Installation

$ npm install @lidofinance/polygon-sdk-banner
$ yarn add @lidofinance/polygon-sdk-banner
import PolidoStakeBanner from '@lidofinance/polygon-sdk-banner';

<PolidoStakeBanner direction="horizontal" />

Using SDK

Installation

$ npm install @lidofinance/polygon-sdk
$ yarn add @lidofinance/polygon-sdk
import { PolidoSDK } from '@lidofinance/polygon-sdk';
import {CHAINS} from "@lido-sdk/constants";
import {useSDK} from "@lido-sdk/react";

try {
  const { providerWeb3 } = useSDK();
  const polidoSDK = new PolidoSDK(CHAINS.Mainnet, providerWeb3);

  // First Approve Tokens for Staking by calling the unlockTokens method
  const { amount } = await polidoSDK.unlockTokens({
    amount: '20', // The amount of MATIC to approve
    // Optional callback for getting information about transaction stage
    onTxStageChange: txStageChangeCallback,
  });

  // Then, call the Stake method
  const { transactionHash, stAmount } = await polidoSDK.stake({
    amount: '20', // The amount of MATIC to stake
    // Optional callback for getting information about transaction stage
    onTxStageChange: txStageChangeCallback,
  });
} catch (e) {
  // Handle Errors
}

See SDK Staking for details

Learn more

Readme

Keywords

Package Sidebar

Install

npm i @lidofinance/polygon-sdk-banner

Weekly Downloads

2

Version

0.5.0

License

ISC

Unpacked Size

812 kB

Total Files

24

Last publish

Collaborators

  • lidofinance-on-polygon