@fuel-ts/account 0.75.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @fuel-ts/account might be problematic. Click here for more details.

package/dist/index.mjs CHANGED
@@ -81,7 +81,7 @@ import {
81
81
  InputMessageCoder,
82
82
  TransactionCoder as TransactionCoder5
83
83
  } from "@fuel-ts/transactions";
84
- import { arrayify as arrayify11, hexlify as hexlify12 } from "@fuel-ts/utils";
84
+ import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
85
85
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
86
86
  import { equalBytes } from "@noble/curves/abstract/utils";
87
87
  import { Network } from "ethers";
@@ -1550,10 +1550,6 @@ function sleep(time) {
1550
1550
  });
1551
1551
  }
1552
1552
 
1553
- // src/providers/utils/time.ts
1554
- var fromTai64ToUnix = (tai64Timestamp) => Number(BigInt(tai64Timestamp) - BigInt(2 ** 62) - BigInt(10));
1555
- var fromUnixToTai64 = (unixTimestampMs) => (BigInt(unixTimestampMs) + BigInt(2 ** 62) + BigInt(10)).toString();
1556
-
1557
1553
  // src/providers/transaction-request/errors.ts
1558
1554
  var ChangeOutputCollisionError = class extends Error {
1559
1555
  name = "ChangeOutputCollisionError";
@@ -2501,7 +2497,7 @@ import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2501
2497
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2502
2498
 
2503
2499
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2504
- import { hexlify as hexlify11 } from "@fuel-ts/utils";
2500
+ import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2505
2501
 
2506
2502
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2507
2503
  import { bn as bn10 } from "@fuel-ts/math";
@@ -2576,14 +2572,6 @@ var calculateTransactionFee = (params) => {
2576
2572
  };
2577
2573
  };
2578
2574
 
2579
- // src/providers/transaction-summary/date.ts
2580
- import { TAI64 } from "tai64";
2581
- var fromTai64ToDate = (tai64Timestamp) => {
2582
- const timestamp = TAI64.fromString(tai64Timestamp, 10).toUnix();
2583
- return new Date(timestamp * 1e3);
2584
- };
2585
- var fromDateToTai64 = (date) => TAI64.fromUnix(Math.floor(date.getTime() / 1e3)).toString(10);
2586
-
2587
2575
  // src/providers/transaction-summary/operations.ts
2588
2576
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2589
2577
  import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/errors";
@@ -3224,7 +3212,7 @@ function assembleTransactionSummary(params) {
3224
3212
  const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
3225
3213
  let date;
3226
3214
  if (time) {
3227
- date = fromTai64ToDate(time);
3215
+ date = DateTime.fromTai64(time);
3228
3216
  }
3229
3217
  const transactionSummary = {
3230
3218
  id,
@@ -3397,7 +3385,7 @@ var TransactionResponse = class {
3397
3385
  };
3398
3386
 
3399
3387
  // src/providers/transaction-response/getDecodedLogs.ts
3400
- import { U64Coder } from "@fuel-ts/abi-coder";
3388
+ import { BigNumberCoder } from "@fuel-ts/abi-coder";
3401
3389
  import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3402
3390
  function getDecodedLogs(receipts, abiInterface) {
3403
3391
  return receipts.reduce((logs, r) => {
@@ -3405,7 +3393,9 @@ function getDecodedLogs(receipts, abiInterface) {
3405
3393
  logs.push(abiInterface.decodeLog(r.data, r.val1.toNumber(), r.id)[0]);
3406
3394
  }
3407
3395
  if (r.type === ReceiptType5.Log) {
3408
- logs.push(abiInterface.decodeLog(new U64Coder().encode(r.val0), r.val1.toNumber(), r.id)[0]);
3396
+ logs.push(
3397
+ abiInterface.decodeLog(new BigNumberCoder("u64").encode(r.val0), r.val1.toNumber(), r.id)[0]
3398
+ );
3409
3399
  }
3410
3400
  return logs;
3411
3401
  }, []);
@@ -4343,13 +4333,13 @@ var _Provider = class {
4343
4333
  * Lets you produce blocks with custom timestamps and the block number of the last block produced.
4344
4334
  *
4345
4335
  * @param amount - The amount of blocks to produce
4346
- * @param startTime - The UNIX timestamp to set for the first produced block
4336
+ * @param startTime - The UNIX timestamp (milliseconds) to set for the first produced block
4347
4337
  * @returns A promise that resolves to the block number of the last produced block.
4348
4338
  */
4349
4339
  async produceBlocks(amount, startTime) {
4350
4340
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4351
4341
  blocksToProduce: bn14(amount).toString(10),
4352
- startTimestamp: startTime ? fromUnixToTai64(startTime) : void 0
4342
+ startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4353
4343
  });
4354
4344
  return bn14(latestBlockHeight);
4355
4345
  }
@@ -4591,13 +4581,13 @@ var assets = [
4591
4581
  ];
4592
4582
 
4593
4583
  // src/utils/formatTransferToContractScriptData.ts
4594
- import { U64Coder as U64Coder2 } from "@fuel-ts/abi-coder";
4584
+ import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
4595
4585
  import { BN as BN2 } from "@fuel-ts/math";
4596
4586
  import { arrayify as arrayify13 } from "@fuel-ts/utils";
4597
4587
  import * as asm from "@fuels/vm-asm";
4598
4588
  var formatTransferToContractScriptData = (params) => {
4599
4589
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4600
- const numberCoder = new U64Coder2();
4590
+ const numberCoder = new BigNumberCoder2("u64");
4601
4591
  const encoded = numberCoder.encode(new BN2(amountToTransfer).toNumber());
4602
4592
  const scriptData = Uint8Array.from([
4603
4593
  ...arrayify13(hexlifiedContractId),
@@ -9411,10 +9401,6 @@ export {
9411
9401
  english,
9412
9402
  extractBurnedAssetsFromReceipts,
9413
9403
  extractMintedAssetsFromReceipts,
9414
- fromDateToTai64,
9415
- fromTai64ToDate,
9416
- fromTai64ToUnix,
9417
- fromUnixToTai64,
9418
9404
  gasUsedByInputs,
9419
9405
  getAssetEth,
9420
9406
  getAssetFuel,