FuelError: Invalid u64

I am trying to make a contract call in TS.
Fuels TS:- 0.94.0

fuel-toolchain.toml
forc = “0.63.1”
fuel-core = “0.33.0”

My TS call:-

    const provider = await getProvider();
    const contract = await getContract();
    const latestBlock = await provider.getBlock("latest");
    if (latestBlock) {
      const duration = 60 * 60 * 1000;
      console.log(latestBlock.time);
      const start = +latestBlock.time;
      const end = start + duration;
      console.log(start);
      console.log(end);

      const poolId =
        "0x0000000000000000000000000000000000000000000000000000000000000009";

      const call = await contract.functions
        .create_pool(poolId, start, end)
        .txParams({ gasLimit: 200000 })
        .call();
      const res = await call.waitForResult();
      console.log("res: ", res);
    }
  };```

My sway function

```#[storage(read, write)]
    fn create_pool(pool_id: b256, start_time: u64, end_time: u64) {
        only_owner();
        require(
            storage.pool_data.get(pool_id).try_read().is_none(),
            PoolError::PoolExist,
        );
        let data = PoolData {
            start_time: start_time,
            end_time: end_time,
            pool_amount: 0,
            status: PoolStatus::Active
        };

        storage.pool_data.insert(pool_id, data);
    }```

Error:- 
```index.mjs:273 Uncaught (in promise) FuelError: Invalid u64.
    at BigNumberCoder.encode (index.mjs:273:13)
    at eval (index.mjs:692:108)
    at Array.map (<anonymous>)
    at TupleCoder.encode (index.mjs:692:84)
    at FunctionFragment.encodeArguments (index.mjs:1159:35)
    at createContractCall (index.mjs:462:21)
    at eval (index.mjs:509:61)
    at Array.map (<anonymous>)
    at get calls (index.mjs:509:42)
    at FunctionInvocationScope.updateContractInputAndOutput (index.mjs:528:24)
    at FunctionInvocationScope.addCalls (index.mjs:586:10)
    at FunctionInvocationScope.addCall (index.mjs:575:10)
    at new FunctionInvocationScope (index.mjs:864:11)
    at Object.funcInvocationScopeCreator (index.mjs:1008:55)
    at create_pool (page.tsx:94:10)
encode @ index.mjs:273
eval @ index.mjs:692
encode @ index.mjs:692
encodeArguments @ index.mjs:1159
createContractCall @ index.mjs:462
eval @ index.mjs:509
get calls @ index.mjs:509
updateContractInputAndOutput @ index.mjs:528
addCalls @ index.mjs:586
addCall @ index.mjs:575
FunctionInvocationScope @ index.mjs:864
funcInvocationScopeCreator @ index.mjs:1008
create_pool @ page.tsx:94
await in create_pool
callCallback @ react-dom.development.js:20565
invokeGuardedCallbackImpl @ react-dom.development.js:20614
invokeGuardedCallback @ react-dom.development.js:20689
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:20703
executeDispatch @ react-dom.development.js:32128
processDispatchQueueItemsInOrder @ react-dom.development.js:32160
processDispatchQueue @ react-dom.development.js:32173
dispatchEventsForPlugins @ react-dom.development.js:32184
eval @ react-dom.development.js:32374
batchedUpdates$1 @ react-dom.development.js:24953
batchedUpdates @ react-dom.development.js:28844
dispatchEventForPluginEventSystem @ react-dom.development.js:32373
dispatchEvent @ react-dom.development.js:30141
dispatchDiscreteEvent @ react-dom.development.js:30112
Show 26 more frames
Show less

For more info , this is timestamp I am getting 4611686020151801000, which in inside the u64 type.

Hey @chappie1998, could you try implementing the BigNumbers library from fuels and test the same again:

import { bn } from 'fuels';

const provider = await getProvider();
const contract = await getContract();
const latestBlock = await provider.getBlock("latest");

if (latestBlock) {
  const duration = 60 * 60 * 1000;
  console.log(latestBlock.time);
  const start = bn(latestBlock.time);
  const end = start.add(bn(duration));
  console.log(start.toString());
  console.log(end.toString());

  const poolId = "0x0000000000000000000000000000000000000000000000000000000000000009";

  const call = await contract.functions
    .create_pool(poolId, start, end)
    .txParams({ gasLimit: 200000 })
    .call();
  const res = await call.waitForResult();
  console.log("res: ", res);
}