# Error decoding contract log using fuels-ts 0.94.6

**URL:** <https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696>\
**Category:** TypeScript SDK\
**Created:** [September 25, 2024, 10:14am UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696 "2024-09-25T10:14:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulZhemanov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/paulzhemanov/32/2401_2.png) [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Post date:** [September 25, 2024, 10:14am UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/1 "2024-09-25T10:14:25Z")

</div>

Hi fuel team! i deployed contract using

```auto
forc="0.63.6"
fuel-core = "0.36.0"

```

> <https://github.com/compolabs/orderbook-contract/blob/master/spark-market/out/release/spark-market-abi.json>

I got this error tryin [decode event log](https://github.com/PaulZhemanov/abi-checker/blob/main/src/index.ts)

```auto
 _FuelError: Log type with logId '12590297951544648000' doesn't exist in the ABI.
      at Interface.decodeLog (/Users/master/abi-checker/node_modules/@fuel-ts/abi-coder/src/Interface.ts:66:13)

```

logId ‘12590297951544648000’ is indeed not in contract abi, but there is a logid 12590297951544646752 and we can see it in explorer

 ![image](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/1/14d5082c3a2bd9872132359bde354c9c65ca0f18.png)

Please help me solve this problem!

---

<div class="post-metadata">

**Author:** ![Torres-ssf](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/torres-ssf/32/1380_2.png) [@Torres-ssf](https://forum.fuel.network/u/Torres-ssf)\
**Post date:** [September 25, 2024, 12:16pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/2 "2024-09-25T12:16:13Z")

</div>

Hi @PaulZhemanov, sorry for the inconvenience. We’re currently investigating the issue.

Is the contract deployed on the testnet? If so, could you confirm that its ID is `0xc24ecaddd54cb04b88fb657da41da54e805aa2789654101dac7ede7716923e54`?

Additionally, which function from the spark-market contract is triggering the log decode error?

---

<div class="post-metadata">

**Author:** ![PaulZhemanov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/paulzhemanov/32/2401_2.png) [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Post date:** [September 25, 2024, 12:35pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/3 "2024-09-25T12:35:03Z")

</div>

@Torres-ssf hi!

> <https://github.com/compolabs/orderbook-contract/blob/event-updates-0.4.0/spark-market/src/events.sw#L11>

we log deposit event

I think we need more memory store for this event on fuels-ts side

 ![image](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/c/c36897e62ea11ea25c857e44f7ff0a3f001375a8.png)

you can check this

> [@Error decoding contract event deployed with forc 0.63.5, fuel-core 0.35.0](https://forum.fuel.network/t/error-decoding-contract-event-deployed-with-forc-0-63-5-fuel-core-0-35-0/6639/16):
>
> @p.s I’ve removed the fields on the indexer side that use balance: before debuggin: let event = new DepositEvent({ id: receipt.receiptId, user: getIdentity(log.user), amount: BigInt(log.amount.toString()), baseAmount: BigInt(log.balance.liquid.base.toString()), quoteAmount: BigInt(log.balance.liquid.quote.toString()), asset: log.asset.bits, txId: receipt.txId, timestamp: tai64ToDate(receipt.time).toISOString(), }) after: let event = new DepositEvent({ id: receipt.receip…

thanks!

---

<div class="post-metadata">

**Author:** ![Torres-ssf](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/torres-ssf/32/1380_2.png) [@Torres-ssf](https://forum.fuel.network/u/Torres-ssf)\
**Post date:** [September 25, 2024, 2:31pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/4 "2024-09-25T14:31:01Z")

</div>

@PaulZhemanov, it seems the issue is due to using the latest contract ABI with an older deployed contract.

I encountered the same error you’re experiencing when executing the `deposit` function:

```auto
FuelError: Invalid u64 byte data size.

```

After analyzing the logged data, which is the `DepositEvent` struct, I noticed that the last modifications to this struct were made in this commit: [ba9f781](https://github.com/compolabs/orderbook-contract/commit/ba9f781fcdf741cc93b2644927eb6c492b959eef#diff-8ff0d5206f7a00d6ac6e057fa74ac12f71d68ddba391618a945ca947e057f273L25).

I built an earlier version of the Spark Market contract, prior to these changes, and used its ABI to connect to the deployed contract you’re working with. This allowed me to successfully execute the `deposit` call and decode its logs. Here’s the decoded data:

```ts
{
  amount: <BN: 0x2710>,
  asset: {
    bits: '0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07'
  },
  user: { Address: [Object] },
  liquid_base: <BN: 0x7596>, // from the old `DepositEvent` version
  liquid_quote: <BN: 0x0> // from the old `DepositEvent` version
}

```

The fields `liquid_base` and `liquid_quote` indicate that this struct belongs to the previous `DepositEvent` version. Which was modified to [this](https://github.com/compolabs/orderbook-contract/blob/cc5a18182c6583c7163356e8c627cb27d8a1e73b/spark-market/src/events.sw#L11-L16)

To resolve the issue, you need to redeploy the latest version of the Spark Market contract.

---

<div class="post-metadata">

**Author:** ![PaulZhemanov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/paulzhemanov/32/2401_2.png) [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Post date:** [September 25, 2024, 2:45pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/5 "2024-09-25T14:45:43Z")

</div>

@Torres-ssf  
i use new deployed contract with struct balance and new generated abi of this contract

---

<div class="post-metadata">

**Author:** ![Torres-ssf](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/torres-ssf/32/1380_2.png) [@Torres-ssf](https://forum.fuel.network/u/Torres-ssf)\
**Post date:** [September 25, 2024, 2:50pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/6 "2024-09-25T14:50:06Z")

</div>

@PaulZhemanov Can you confirm for me what is the ID of the current contract that you are using?

It is `0xc24ecaddd54cb04b88fb657da41da54e805aa2789654101dac7ede7716923e54` ?

---

<div class="post-metadata">

**Author:** ![PaulZhemanov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/paulzhemanov/32/2401_2.png) [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Post date:** [September 25, 2024, 2:59pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/7 "2024-09-25T14:59:20Z")

</div>

@Torres-ssf yes, i use this contract

abi for this contract

> <https://github.com/compolabs/orderbook-contract/blob/event-updates-0.4.0/spark-market/out/release/spark-market-abi.json>

and you can see i use the same abi here

> <https://github.com/PaulZhemanov/abi-checker/blob/main/src/abi.ts>

---

<div class="post-metadata">

**Author:** ![Torres-ssf](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/torres-ssf/32/1380_2.png) [@Torres-ssf](https://forum.fuel.network/u/Torres-ssf)\
**Post date:** [September 25, 2024, 3:50pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/8 "2024-09-25T15:50:49Z")

</div>

@PaulZhemanov I’ve created a [repository](https://github.com/Torres-ssf/call-deposit-fn) that demonstrates the issue. It’s straightforward to set up and run the tests to verify that calling `deposit` with the old JSON ABI functions correctly.

The repository includes three tests:

1. **Old JSON ABI Test** : Connects to the contract using the old JSON ABI and validates that the call works as expected, with the log being properly decoded.
2. **New JSON ABI Test** : Connects to the contract using the new JSON ABI and verifies that the call fails with the error: `FuelError: Invalid u64 byte data size.`
3. **ABI Comparison Test** : Fetches the most recent JSON ABI from the Spark Mark contract, compares it with the new JSON ABI used in Test 2, and confirms they are identical.

I am using the same contract ID as the one shown in the receipt you provided [here](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/1/14d5082c3a2bd9872132359bde354c9c65ca0f18.png), which is informed at the field `id`.

---

<div class="post-metadata">

**Author:** ![PaulZhemanov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/paulzhemanov/32/2401_2.png) [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Post date:** [September 25, 2024, 4:25pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/9 "2024-09-25T16:25:45Z")

</div>

@Torres-ssf you are not using the new json abi

link to new json abi at the link above(1777 lines of code)

---

<div class="post-metadata">

**Author:** ![p.s](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/p.s/32/2491_2.png) [@p.s](https://forum.fuel.network/u/p.s)\
**Post date:** [October 1, 2024, 2:53pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/10 "2024-10-01T14:53:45Z")

</div>

@PaulZhemanov Has this been resolved now?

Could you mark the solution if so - thanks.

---

<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:** [October 22, 2024, 10:53am UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696/11 "2024-10-22T10:53:55Z")

</div>

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