# Can you provide more detailed examples of contract calls

**URL:** <https://forum.fuel.network/t/can-you-provide-more-detailed-examples-of-contract-calls/5130>\
**Category:** Rust SDK\
**Created:** [April 20, 2024, 9:28am UTC](https://forum.fuel.network/t/can-you-provide-more-detailed-examples-of-contract-calls/5130 "2024-04-20T09:28:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![2575169674](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/2575169674/32/2772_2.png) [@2575169674](https://forum.fuel.network/u/2575169674)\
**Post date:** [April 20, 2024, 9:28am UTC](https://forum.fuel.network/t/can-you-provide-more-detailed-examples-of-contract-calls/5130/1 "2024-04-20T09:28:28Z")

</div>

```rust
use fuels::prelude::abigen;

abigen!(Contract(abi = "abi.json", name = "Briged"));

```

```error
proc macro panicked
message: called `Result::unwrap()` on an `Err` value: "invalid type: map, expected a sequence at line 2 column 4"

```

I want to know why. I’m sorry, I’m not very familiar with Rust

---

<div class="post-metadata">

**Author:** ![calldelegation](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/calldelegation/32/1484_2.png) [@calldelegation](https://forum.fuel.network/u/calldelegation)\
**Post date:** [April 22, 2024, 3:07am UTC](https://forum.fuel.network/t/can-you-provide-more-detailed-examples-of-contract-calls/5130/2 "2024-04-22T03:07:09Z")

</div>

> [@2575169674](#):
>
> ```auto
> use fuels::prelude::abigen;
> 
> abigen!(Contract(abi = "abi.json", name = "Briged"));
> 
> ```

Hey @2575169674! Nice to see you in the Fuel community! I would highly recommend our Introduction to Sway for Javascript developers tutorial. The rust testing section specifically should be very useful to you.

> **[Rust Testing | Fuel Docs](https://docs.fuel.network/guides/intro-to-sway/rust-sdk/#setting-owner)**
>
> Guides for the Fuel Network

Steps to replicate should goes as follows

1. Once you have written and built your sway contract you should have your ABI json file within this path  
“out/debug/contract-abi.json” of your project
2. Using the ABI generated with forc build you can then load it into your rust file similar to the line above.

```auto
abigen!(Contract(name="SwayStore", abi="out/debug/contract-abi.json"));

```

1. You just need to create an instance using the loaded abi within your Rust code like so

```auto
    let instance = SwayStore::new(id.clone(), wallet);

```

1. Finally you can reference your contract instance and make contract calls like this

```auto
    let (instance, _id, wallets) = get_contract_instance().await;
 
    // get access to a test wallet
    let wallet_1 = wallets.get(0).unwrap();
 
    // initialize wallet_1 as the owner
    let owner_result = instance
        .with_account(wallet_1.clone())
        .unwrap()
        .methods()
        .initialize_owner()
        .call()
        .await
        .unwrap();

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [May 29, 2024, 7:38pm UTC](https://forum.fuel.network/t/can-you-provide-more-detailed-examples-of-contract-calls/5130/3 "2024-05-29T19:38:00Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
