# How to get base asset in Rust SDK?

**URL:** <https://forum.fuel.network/t/how-to-get-base-asset-in-rust-sdk/5974>\
**Category:** Rust SDK\
**Tags:** feedback, faqs\
**Created:** [June 21, 2024, 1:49pm UTC](https://forum.fuel.network/t/how-to-get-base-asset-in-rust-sdk/5974 "2024-06-21T13:49:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 21, 2024, 1:49pm UTC](https://forum.fuel.network/t/how-to-get-base-asset-in-rust-sdk/5974/1 "2024-06-21T13:49:54Z")

</div>

How to get base asset using Rust SDK??

```auto
#[tokio::test]
async fn test_harness() {
    // Test code here
    let (instance, _id,wallets) = get_contract_instance().await;
    let wallet_1 = wallets.get(0).unwrap();
    let result= instance.methods().deposit().add_custom_asset(
        AssetId::base(),
        1,
        Some(wallet_1.clone()),
    )
    .call().await.unwrap().value;
    let result2 = instance.methods().test_deposit_asset_id_same_generated().call().await.unwrap().value;
    assert_eq!(result, result2);

}

```

This is the error:

```auto
error[E0599]: no function or associated item named `base` found for struct `fuels::types::AssetId` in the current scope
   --> tests/harness.rs:12:18
    |
12 | AssetId::base(),
    | ^^^^ function or associated item not found in `AssetId`

```

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 21, 2024, 1:54pm UTC](https://forum.fuel.network/t/how-to-get-base-asset-in-rust-sdk/5974/2 "2024-06-21T13:54:57Z")

</div>

If the function is payable:

```auto
    fn deposit() -> b256 {

        let owner = msg_sender().unwrap();
        let asset_id = msg_asset_id().bits();
        let address_from_b256: Address = Address::from(asset_id);
        asset_id
    }

```

Do you just call it with the following:

```auto
let result= instance.methods().deposit().call().await. Unwrap().

```

Why do we not need to add [add\_custom\_asset](https://docs.fuel.network/docs/fuels-rs/calling-contracts/custom-asset-transfer/)?

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/david/32/32_2.png) [@david](https://forum.fuel.network/u/david)\
**Post date:** [June 21, 2024, 2:26pm UTC](https://forum.fuel.network/t/how-to-get-base-asset-in-rust-sdk/5974/3 "2024-06-21T14:26:32Z")

</div>

You can get the base asset ID in Rust from the Provider, like this:

```rust
provider.base_asset_id()

```

Regarding calling payable functions, you can do a simple call as you described if you _don’t_ want to pass any funds, or if you’d like to include tokens in your call, [you can set them in the call parameters](https://docs.fuel.network/docs/fuels-rs/calling-contracts/call-params/).

`add_custom_asset` is used to append an unrelated token transfer to a call.

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 21, 2024, 2:32pm UTC](https://forum.fuel.network/t/how-to-get-base-asset-in-rust-sdk/5974/4 "2024-06-21T14:32:37Z")

</div>

Do take a look at this post where I followed the instruction

> [@Rust SDK Error: Calling payable functions fails in RustSDK doesn't work](https://forum.fuel.network/t/rust-sdk-error-calling-payable-functions-fails-in-rustsdk-doesnt-work/5975/2):
>
> Please anyone, I am getting cancer from this stuck_out_tongue
