liquidity-mining-sdk
v1.0.1-beta.5
Published
SDK for liquidity mining contracts
Readme
Liquidity Mining SDK
A TypeScript SDK for interacting with liquidity mining contracts on Sui blockchain.
Installation
npm install liquidity-mining-sdk@betaQuick Start
import { LiquidityMiningSDK } from 'liquidity-mining-sdk';
// Initialize SDK
const sdk = new LiquidityMiningSDK('testnet'); // or 'mainnet', 'devnet'
// Query claimable rewards
const rewards = await sdk.getClaimableRewardsByObligationId({
marketType: '0x...::market::Market', // Market TypeName
reserveType: '0x...::usdc::USDC', // Full TypeName format
proxyId: '0x...',
obligationId: '0x...'
});
// Query reward indices
const indices = await sdk.getRewardIndices({
marketType: '0x...::market::Market', // Market TypeName
reserveType: '0x...8::usdc::USDC', // Full TypeName format
proxyId: '0x...',
obligationId: '0x...'
});API Reference
LiquidityMiningSDK
Constructor
new LiquidityMiningSDK(network: 'mainnet' | 'testnet' | 'devnet')
Methods
getClaimableRewardsByObligationId
Query claimable rewards for a specific obligation.
Parameters:
request: ClaimableRewardsRequestmarketType: string- Full TypeName of the market (e.g.,"0x...::market::Market")reserveType: string- Full TypeName of the reserve asset (e.g.,"0x...::usdc::USDC")proxyId: string- Proxy object IDobligationId: string- User's obligation object ID
Note:
- Both
marketTypeandreserveTypemust be complete TypeName format as stored on-chain (address::module::type) - If the pool for the specified
reserveTypehasn't been initialized, the method will return empty arrays
Returns: Promise<ClaimableRewardsResult>
deposit_pool: ClaimableReward[]- Claimable rewards from deposit poolborrow_pool: ClaimableReward[]- Claimable rewards from borrow poolflash_loan_pool: ClaimableReward[]- Claimable rewards from flash loan pool
getRewardIndices
Get available reward indices for all pool types.
Parameters:
request: ClaimableRewardsRequest- Same as above
Returns: Promise<RewardIndicesResult>
deposit_pool: RewardIndex[]- Available reward indices for deposit poolborrow_pool: RewardIndex[]- Available reward indices for borrow poolflash_loan_pool: RewardIndex[]- Available reward indices for flash loan pool
Types
// Request types
interface ClaimableRewardsRequest {
marketType: string;
reserveType: string;
proxyId: string;
obligationId: string;
}
// Result types
interface ClaimableRewardsResult {
deposit_pool: ClaimableReward[];
borrow_pool: ClaimableReward[];
flash_loan_pool: ClaimableReward[];
}
interface ClaimableReward {
coinType: string; // Full TypeName format (e.g., "0x...::usdc::USDC")
amount: bigint; // Claimable amount as BigInt (can be converted to string for JSON)
}
interface RewardIndicesResult {
deposit_pool: RewardIndex[];
borrow_pool: RewardIndex[];
flash_loan_pool: RewardIndex[];
}
interface RewardIndex {
index: number;
coinType: string;
}Version
Current version: 1.0.1-beta.5 (Beta)
License
MIT
Author
paulwu0903
