1.2.5 • Published 1 year ago

@ankr.com/staking-sdk v1.2.5

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

staking-sdk

Install

# yarn
yarn add @ankr.com/staking-sdk reselect
# npm
npm i @ankr.com/staking-sdk reselect

To choose testsnet contracts use REACT_APP_API_ENV=staging environment variable. For mainnet - use REACT_APP_API_ENV=prod.

Examples of usage:

Here is a codesandbox sample how to get balance using @ankr.com/staking-sdk https://codesandbox.io/s/ankr-staking-sdk-e1jvvi

// stake aMATICc token
import { PolygonOnEthereumSDK } from '@ankr.com/staking-sdk';

const sdk = await PolygonOnEthereumSDK.getInstance();

const { txHash } = await sdk.stake(new BigNumber(1_200), 'aMATICc');
// unstake aMATICc token
import { PolygonOnEthereumSDK } from '@ankr.com/staking-sdk';

const sdk = await PolygonOnEthereumSDK.getInstance();

await sdk.unstake(new BigNumber(1_200), 'aMATICc');
// switch aMATICb and aMATICc
import { PolygonOnEthereumSDK } from '@ankr.com/staking-sdk';

const sdk = await PolygonOnEthereumSDK.getInstance();

const lockResponse = await sdk.lockShares({ amount: new BigNumber(2.65) });

const unlockResponse = await sdk.unlockShares({ amount: new BigNumber(1.98) });
// Get MATIC transaction history
import { PolygonOnEthereumSDK } from '@ankr.com/staking-sdk';

const sdk = await PolygonOnEthereumSDK.getInstance();

const history = await sdk.getTxEventsHistory();
// stake aBNBc token
import { BinanceSDK } from '@ankr.com/staking-sdk';

const sdk = await BinanceSDK.getInstance();

const { txHash } = await sdk.stake(new BigNumber(1_200), 'aBNBc');
// unstake aBNBc token
import { BinanceSDK } from '@ankr.com/staking-sdk';

const sdk = await BinanceSDK.getInstance();

await sdk.unstake(new BigNumber(1_200), 'aBNBc');
// switch aBNBb and aBNBc
import { BinanceSDK } from '@ankr.com/staking-sdk';

const sdk = await BinanceSDK.getInstance();

const lockResponse = await sdk.lockShares({ amount: new BigNumber(2.65) });

const unlockResponse = await sdk.unlockShares({ amount: new BigNumber(1.98) });
// Get BNB transaction history
import { BinanceSDK } from '@ankr.com/staking-sdk';

const sdk = await BinanceSDK.getInstance();

const history = await sdk.getTxEventsHistory();
// stake aETHc token
import { EthereumSDK } from '@ankr.com/staking-sdk';

const sdk = await EthereumSDK.getInstance();

const { txHash } = await sdk.stake(new BigNumber(1_200), 'aETHc');
// switch aETHc and aETHb
import { EthereumSDK } from '@ankr.com/staking-sdk';

const sdk = await EthereumSDK.getInstance();

const lockResponse = await sdk.lockShares({ amount: new BigNumber(2.65) });

const unlockResponse = await sdk.unlockShares({ amount: new BigNumber(1.98) });
// User defined providers
import { PolygonOnEthereumSDK, Web3KeyReadProvider, Web3KeyWriteProvider } from '@ankr.com/staking-sdk';

const readProvider: Web3KeyReadProvider = { ... };
const writeProvider: Web3KeyWriteProvider = { ... };
const sdk = await PolygonOnEthereumSDK.getInstance({ readProvider, writeProvider });

const { txHash } = await sdk.stake(new BigNumber(1_200), 'aMATICc');
1.2.5

1 year ago

1.2.4

1 year ago

1.2.0

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.2

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0-build.6

2 years ago

0.2.0-build.4

2 years ago

0.2.0-build.3

2 years ago

0.2.0-build.2

2 years ago

0.2.0-build.1

2 years ago

0.2.0-build.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago