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!

Specific pointers

How to get UserInfo?

rust:
1
// taken from apricot-client/samples-rust-client/main.rs
2
#[allow(unaligned_references)]
3
{
4
let user_info_key = consts::get_user_info_k(user_wallet);
5
let data = conn.get_account_data(&user_info_key).unwrap();
6
let user_info = utils::cast::<state::UserInfo>(&data[..]);
7
println!("Showing user with {} assets:", user_info.num_assets);
8
for i in 0 .. user_info.num_assets as usize {
9
println!("=============================");
10
println!("Asset PoolID: {}", user_info.user_asset_info[i].pool_id);
11
println!("Asset borrow amount: {}", user_info.user_asset_info[i].borrow_amount.to_native_amount());
12
println!("Asset deposit amount: {}", user_info.user_asset_info[i].deposit_amount.to_native_amount());
13
println!("Asset borrow interests: {}", user_info.user_asset_info[i].borrow_interests);
14
println!("Asset deposit interests: {}", user_info.user_asset_info[i].deposit_interests);
15
}
16
}
17
Copied!
ts:
1
// taken from apricot-client/samples-ts/src/samplePortfolio.ts
2
let portfolioLoader = createPortfolioLoader(walletKey, getConnection());
3
await portfolioLoader.refreshPortfolio();
4
console.log(await portfolioLoader.getUserInfoAddress());
5
console.log(await portfolioLoader.getUserAssetInfoList());
6
console.log(await portfolioLoader.getBorrowPowerInfo());
Copied!