SDK for liquidity mining contracts
A TypeScript SDK for interacting with liquidity mining contracts on Sui blockchain.
``bash`
npm install liquidity-mining-sdk@beta
`typescript
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...'
});
`
#### 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 marketType and reserveType must be complete TypeName format as stored on-chain (address::module::type)reserveType
- If the pool for the specified hasn't been initialized, the method will return empty arrays
Returns: Promisedeposit_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: Promisedeposit_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
`typescript
// 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;
}
`
Current version: 1.0.1-beta.5` (Beta)
MIT
paulwu0903