# Client Interface

You will be able to find more info on our [apricot-client](https://github.com/Apricot-Finance/apricot-client) repo. The JS part is now replaced by the ts sdk and samples.

* [samples-ts](https://github.com/Apricot-Finance/apricot-client/tree/main/samples-ts)
* [sdk-ts](https://github.com/Apricot-Finance/apricot-client/tree/main/sdk-ts)
* [rust](https://github.com/Apricot-Finance/apricot-client/tree/main/rust)
* [samples-rust-client](https://github.com/Apricot-Finance/apricot-client/blob/main/samples-rust-client/src/main.rs)
* [samples-rust-contract](https://github.com/Apricot-Finance/apricot-client/blob/main/samples-rust-contract/src/lib.rs)

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](https://discord.gg/C6JrtqZF5U)!

## Specific pointers

### How to get UserInfo?

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());
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apricot.one/developer-docs/client-interface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
