Querying User's Portfolio
The portfolio gives a complete view of a wallet's positions in Scallop: supplied assets, staked assets, collaterals, borrowings and locked veSCA. ScallopQuery can read it with a single call.
import { ScallopQuery } from '@scallop-io/sui-scallop-sdk';
const scallopQuery = new ScallopQuery({
addressId: '695fcdc084f790c04eb068dc',
fullnodeUrl: 'https://fullnode.mainnet.sui.io:443',
walletAddress: '0x...',
});
await scallopQuery.init();Get User Portfolio
const portfolio = await scallopQuery.getUserPortfolio();
// Or for another wallet
const other = await scallopQuery.getUserPortfolio({ walletAddress: '0x...' });The portfolio combines the lending, obligation account and veSCA data of the wallet, including total values (USD) and totals across all positions.
Get Lending Positions
To read only the lending side, use getLendings. It returns the supplied and staked amounts, the supply APY and the amounts available to supply, withdraw, stake, unstake and claim.
Get Borrowing Positions
Borrowing positions are part of the obligation accounts. See Querying Obligation Accounts.
Get Wallet Balances
Get veSCA
Migrate Market Coins to sCoins
Users who still hold old market coins (and staked market coins in spool) can convert all of them into sCoins in one transaction. This is a write action, so it uses ScallopClient.
Was this helpful?