Issues with `get_free_collateral` Function Call in TypeScript and Rust SDKs

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:

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:

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:

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!

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

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 :slight_smile:

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

so it would look something like

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