Client Interface
You will be able to find more info on our apricot-client repo. The JS part is now replaced by the ts sdk and samples.
We haven't updated the rust interface in a while, so some of the features might be broken. If you need help find us in our discord!

rust:
// taken from apricot-client/samples-rust-client/main.rs
#[allow(unaligned_references)]
{
let user_info_key = consts::get_user_info_k(user_wallet);
let data = conn.get_account_data(&user_info_key).unwrap();
let user_info = utils::cast::<state::UserInfo>(&data[..]);
println!("Showing user with {} assets:", user_info.num_assets);
for i in 0 .. user_info.num_assets as usize {
println!("=============================");
println!("Asset PoolID: {}", user_info.user_asset_info[i].pool_id);
println!("Asset borrow amount: {}", user_info.user_asset_info[i].borrow_amount.to_native_amount());
println!("Asset deposit amount: {}", user_info.user_asset_info[i].deposit_amount.to_native_amount());
println!("Asset borrow interests: {}", user_info.user_asset_info[i].borrow_interests);
println!("Asset deposit interests: {}", user_info.user_asset_info[i].deposit_interests);
}
}
ts:
// taken from apricot-client/samples-ts/src/samplePortfolio.ts
let portfolioLoader = createPortfolioLoader(walletKey, getConnection());
await portfolioLoader.refreshPortfolio();
console.log(await portfolioLoader.getUserInfoAddress());
console.log(await portfolioLoader.getUserAssetInfoList());
console.log(await portfolioLoader.getBorrowPowerInfo());
Copy link
On this page
Specific pointers
How to get UserInfo?