# Issues with \`get\_free\_collateral\` Function Call in TypeScript and Rust SDKs

**URL:** https://forum.fuel.network/t/issues-with-get-free-collateral-function-call-in-typescript-and-rust-sdks/4088
**Category:** Rust SDK
**Created:** [January 29, 2024, 7:03pm UTC](https://forum.fuel.network/t/issues-with-get-free-collateral-function-call-in-typescript-and-rust-sdks/4088 "2024-01-29T19:03:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sway](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/sway/32/103_2.png) [@sway](https://forum.fuel.network/u/sway)
#### Post date: [January 29, 2024, 7:03pm UTC](https://forum.fuel.network/t/issues-with-get-free-collateral-function-call-in-typescript-and-rust-sdks/4088/1 "2024-01-29T19:03:36Z")

</div>

Hello Fuel Community,

I’m currently facing a challenge while working with the `get_free_collateral` function in both the TypeScript and Rust SDKs for Fuel. I’m reaching out for assistance or insights into the errors I’m encountering.

**1. TypeScript SDK Issue:**  
When attempting to call `get_free_collateral` using the TypeScript SDK, I receive an error that doesn’t provide much information about what went wrong:

```typescript
The script call result does not contain a 'returnReceipt'.

Receipts:
[
  {
    "type": "Panic",
    "id": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "reason": "0x2724028a0000000",
    "pc": "0x2860",
    "is": "0x2860",
    "contractId": "0x0000000000000000000000000000000000000000000000000000000000000000"
  },
  {
    "type": "ScriptResult",
    "result": "0x2",
    "gasUsed": "0x0"
  }
]

```

**2. Rust SDK Issue:**  
In the Rust SDK, when calling the same function, I encounter an ‘OutOfGas’ error, despite having sufficient ETH in the accounts used for these calls:

```rust
thread 'testnet_actions::open_order::open_order_action' panicked at tests/testnet_actions/open_order.rs:81:10:
called `Result::unwrap()` on an `Err` value: RevertTransactionError { reason: "OutOfGas", revert_id: 0, receipts: [Panic { id: 0000000000000000000000000000000000000000000000000000000000000000, reason: PanicInstruction { reason: OutOfGas, instruction: CALL { target_struct: 0x10, fwd_coins: 0x11, asset_id_addr: 0x12, fwd_gas: 0xa } (bytes: 2d 41 14 8a) }, pc: 10352, is: 10336, contract_id: None }, ScriptResult { result: Panic, gas_used: 10000 }] }
stack backtrace:

```

**Contract Addresses:**  
Below are the contract addresses involved:

```typescript
export const CONTRACT_ADDRESSES = {
    spotMarket: "0xc99fa347474ccd17a9f6304d0978b42f844fd974bfac9df2f2899cb89db1bc84",
    tokenFactory: "0x6bd9643c9279204b474a778dea7f923226060cb94a4c61c5aae015cf96b5aad2",
    pyth: "0xff68e1eb542bb2b3f1af03ff2741e82c16471f78ee1fa39d8967d0b1def3e0c8",
    proxy: "0xbceda7cdc09bfdc85e1b00f64f204ec92b91508666619e616328d17fe99f5746",
    accountBalance: "0xcc62c081c254b83b0b080f21e7b1d8ea556dac997a790173d15914d7e17ab586",
    clearingHouse: "0x23d6c1181dae01ac64e68a58357e30358cb4940bd3f833440d518fc29b4f88e4",
    insuranceFund: "0xb2e776d0892e08c26a09b0154bfe1bfd743e8691a13e56c03f30ce809315c753",
    perpMarket: "0xb8e47ccb8967de6971b463488ccf75f7cf06f46eeb022f91f5aeb62663285230",
    vault: "0x8b89705ce1c2e4e29d327d2f8dfad80b823a435e8a0e1d128751983bf6fbaac0",
};

```

I have double-checked the contract addresses and the function parameters, and everything seems to be in order. I’m unsure why these errors are occurring, and any help in resolving them would be greatly appreciated. If additional information is needed, I’m happy to provide it.

Thank you for your assistance!

---

<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: [January 30, 2024, 6:46pm UTC](https://forum.fuel.network/t/issues-with-get-free-collateral-function-call-in-typescript-and-rust-sdks/4088/2 "2024-01-30T18:46:10Z")

</div>

Hey @sway we’re currently looking into your issue here as well.

---

<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: [January 31, 2024, 11:04am UTC](https://forum.fuel.network/t/issues-with-get-free-collateral-function-call-in-typescript-and-rust-sdks/4088/3 "2024-01-31T11:04:35Z")

</div>

Hey @sway for #1 can you include transaction parameters `gasPrice` and `gasLimit` to your contract call? I was getting the same issue and this resolved it 🙂

```auto
.txParams({
    gasPrice: 1,
    gasLimit: 100_000,
})

```

so it would look something like

```auto
let resp = await contract.functions
    .get_item(i)
    .txParams({
        gasPrice: 1,
        gasLimit: 100_000,
    })
    .simulate();

```

---

<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:41pm UTC](https://forum.fuel.network/t/issues-with-get-free-collateral-function-call-in-typescript-and-rust-sdks/4088/4 "2024-05-29T19:41:00Z")

</div>

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