@mercurial-finance/farming-sdk
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"name": "@mercurial-finance/farming-sdk", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -25,11 +25,11 @@ # Meteora Pool Farm SDK | ||
``` | ||
npm i @mercurial-finance/farming-sdk @project-serum/anchor @solana/web3.js @solana/spl-token @solana/spl-token-registry | ||
npm i @mercurial-finance/farming-sdk @coral-xyz/anchor @solana/web3.js @solana/spl-token @solana/spl-token-registry | ||
``` | ||
2. Initialize AmmImpl instance | ||
2. Initialize PoolFarmImpl instance | ||
```ts | ||
import PoolFarmImpl from "@mercurial-finance/farming-sdk"; | ||
import { PublicKey } from "@solana/web3.js"; | ||
import { Wallet, AnchorProvider } from "@project-serum/anchor"; | ||
import { PoolFarmImpl } from "@mercurial-finance/farming-sdk"; | ||
import { Wallet, AnchorProvider } from "@coral-xyz/anchor"; | ||
import { Connection, PublicKey, Keypair } from "@solana/web3.js"; | ||
@@ -44,8 +44,15 @@ // Connection, Wallet, and AnchorProvider to interact with the network | ||
const USDC_acUSDC_POOL = new PublicKey( | ||
"6ZLKLjMd2KzH7PPHCXUPgbMAtdTT37VgTtdeXWLoJppr" | ||
); // Pool Address can get from https://docs.meteora.ag/dynamic-pools-integration/dynamic-pool-api/pool-info | ||
const farmingPools = await PoolFarmImpl.getFarmAddressesByPoolAddress( | ||
MAINNET_POOL.USDC_USDT // Pool Address can get from https://docs.meteora.ag/dynamic-pools-integration/dynamic-pool-api/pool-info | ||
USDC_acUSDC_POOL | ||
); | ||
// farmingPools is an array (A pool can have multiple farms) | ||
const farmingPool = farmingPools[0]; | ||
const farm = await PoolFarmImpl.create(connection, farmingPool); | ||
const farm = await PoolFarmImpl.create( | ||
mainnetConnection, | ||
farmingPool.farmAddress | ||
); | ||
``` | ||
@@ -76,2 +83,9 @@ | ||
- Claim | ||
```ts | ||
const claimTx = await farm.claim(mockWallet.publicKey); // Web3 Transaction Object | ||
const claimResult = await provider.sendAndConfirm(claimTx); // Transaction hash | ||
``` | ||
- Unstake | ||
@@ -78,0 +92,0 @@ |
240958
94