Getting Info Polygon
The get
namespace contains methods used for getting info. The unique methods to the get
namespace are:
getReward(address)
: Gets the user's reward balance in tokens.getTotalDelegate(address)
: Gets the user's delegate balance in tokens.getUnbond(address)
: Gets the user's unbond balance in tokens.
Getting Info Code Example
ts
// Import SDK
import { Polygon } from '@everstake/wallet-sdk';
// User wallet address.
const address = '0x4D3F0BF20Dd5DA8C6800c5cA17d721131E366651';
// Gets the user's reward balance in tokens.
const getReward = await Polygon.getReward(address);
console.log(getReward); // { result: 3.34036438662955358 } (MATIC)
// Gets the user's delegate balance in tokens.
const getTotalDelegate = await Polygon.getTotalDelegate(address);
console.log(getTotalDelegate); // { result: 20.5000000000000000 } (MATIC)
// Gets the user's unbond balance in tokens.
const getUnbond = await Polygon.getUnbond(address);
console.log(getUnbond); // { result: 2.2000000000000000 } (MATIC)