@fuel-ts/account 0.87.0 → 0.88.1

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/configs.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const FUEL_NETWORK_URL: string;
2
- export declare const FUEL_BETA_5_NETWORK_URL: string;
2
+ export declare const FUEL_TESTNET_NETWORK_URL: string;
3
3
  //# sourceMappingURL=configs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAE,MAGS,CAAC;AAEzC,eAAO,MAAM,uBAAuB,EAAE,MAA8C,CAAC"}
1
+ {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAE,MAGS,CAAC;AAEzC,eAAO,MAAM,wBAAwB,EAAE,MAAiD,CAAC"}
@@ -2,6 +2,6 @@
2
2
  (() => {
3
3
  // src/configs.ts
4
4
  var FUEL_NETWORK_URL = typeof process !== "undefined" ? process?.env?.FUEL_NETWORK_URL || "http://127.0.0.1:4000/v1/graphql" : "http://127.0.0.1:4000/v1/graphql";
5
- var FUEL_BETA_5_NETWORK_URL = "https://beta-5.fuel.network/graphql";
5
+ var FUEL_TESTNET_NETWORK_URL = "https://devnet.fuel.network/v1/graphql";
6
6
  })();
7
7
  //# sourceMappingURL=configs.global.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configs.ts"],"sourcesContent":["export const FUEL_NETWORK_URL: string =\n typeof process !== 'undefined'\n ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql'\n : 'http://127.0.0.1:4000/v1/graphql';\n\nexport const FUEL_BETA_5_NETWORK_URL: string = 'https://beta-5.fuel.network/graphql';\n"],"mappings":";;;AAAO,MAAM,mBACX,OAAO,YAAY,cACf,SAAS,KAAK,oBAAoB,qCAClC;AAEC,MAAM,0BAAkC;","names":[]}
1
+ {"version":3,"sources":["../src/configs.ts"],"sourcesContent":["export const FUEL_NETWORK_URL: string =\n typeof process !== 'undefined'\n ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql'\n : 'http://127.0.0.1:4000/v1/graphql';\n\nexport const FUEL_TESTNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql';\n"],"mappings":";;;AAAO,MAAM,mBACX,OAAO,YAAY,cACf,SAAS,KAAK,oBAAoB,qCAClC;AAEC,MAAM,2BAAmC;","names":[]}
package/dist/configs.js CHANGED
@@ -20,15 +20,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/configs.ts
21
21
  var configs_exports = {};
22
22
  __export(configs_exports, {
23
- FUEL_BETA_5_NETWORK_URL: () => FUEL_BETA_5_NETWORK_URL,
24
- FUEL_NETWORK_URL: () => FUEL_NETWORK_URL
23
+ FUEL_NETWORK_URL: () => FUEL_NETWORK_URL,
24
+ FUEL_TESTNET_NETWORK_URL: () => FUEL_TESTNET_NETWORK_URL
25
25
  });
26
26
  module.exports = __toCommonJS(configs_exports);
27
27
  var FUEL_NETWORK_URL = typeof process !== "undefined" ? process?.env?.FUEL_NETWORK_URL || "http://127.0.0.1:4000/v1/graphql" : "http://127.0.0.1:4000/v1/graphql";
28
- var FUEL_BETA_5_NETWORK_URL = "https://beta-5.fuel.network/graphql";
28
+ var FUEL_TESTNET_NETWORK_URL = "https://devnet.fuel.network/v1/graphql";
29
29
  // Annotate the CommonJS export names for ESM import in node:
30
30
  0 && (module.exports = {
31
- FUEL_BETA_5_NETWORK_URL,
32
- FUEL_NETWORK_URL
31
+ FUEL_NETWORK_URL,
32
+ FUEL_TESTNET_NETWORK_URL
33
33
  });
34
34
  //# sourceMappingURL=configs.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configs.ts"],"sourcesContent":["export const FUEL_NETWORK_URL: string =\n typeof process !== 'undefined'\n ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql'\n : 'http://127.0.0.1:4000/v1/graphql';\n\nexport const FUEL_BETA_5_NETWORK_URL: string = 'https://beta-5.fuel.network/graphql';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,mBACX,OAAO,YAAY,cACf,SAAS,KAAK,oBAAoB,qCAClC;AAEC,IAAM,0BAAkC;","names":[]}
1
+ {"version":3,"sources":["../src/configs.ts"],"sourcesContent":["export const FUEL_NETWORK_URL: string =\n typeof process !== 'undefined'\n ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql'\n : 'http://127.0.0.1:4000/v1/graphql';\n\nexport const FUEL_TESTNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,mBACX,OAAO,YAAY,cACf,SAAS,KAAK,oBAAoB,qCAClC;AAEC,IAAM,2BAAmC;","names":[]}
package/dist/configs.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  // src/configs.ts
2
2
  var FUEL_NETWORK_URL = typeof process !== "undefined" ? process?.env?.FUEL_NETWORK_URL || "http://127.0.0.1:4000/v1/graphql" : "http://127.0.0.1:4000/v1/graphql";
3
- var FUEL_BETA_5_NETWORK_URL = "https://beta-5.fuel.network/graphql";
3
+ var FUEL_TESTNET_NETWORK_URL = "https://devnet.fuel.network/v1/graphql";
4
4
  export {
5
- FUEL_BETA_5_NETWORK_URL,
6
- FUEL_NETWORK_URL
5
+ FUEL_NETWORK_URL,
6
+ FUEL_TESTNET_NETWORK_URL
7
7
  };
8
8
  //# sourceMappingURL=configs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configs.ts"],"sourcesContent":["export const FUEL_NETWORK_URL: string =\n typeof process !== 'undefined'\n ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql'\n : 'http://127.0.0.1:4000/v1/graphql';\n\nexport const FUEL_BETA_5_NETWORK_URL: string = 'https://beta-5.fuel.network/graphql';\n"],"mappings":";AAAO,IAAM,mBACX,OAAO,YAAY,cACf,SAAS,KAAK,oBAAoB,qCAClC;AAEC,IAAM,0BAAkC;","names":[]}
1
+ {"version":3,"sources":["../src/configs.ts"],"sourcesContent":["export const FUEL_NETWORK_URL: string =\n typeof process !== 'undefined'\n ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql'\n : 'http://127.0.0.1:4000/v1/graphql';\n\nexport const FUEL_TESTNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql';\n"],"mappings":";AAAO,IAAM,mBACX,OAAO,YAAY,cACf,SAAS,KAAK,oBAAoB,qCAClC;AAEC,IAAM,2BAAmC;","names":[]}
@@ -29470,9 +29470,9 @@ spurious results.`);
29470
29470
  // ../versions/dist/index.mjs
29471
29471
  function getBuiltinVersions() {
29472
29472
  return {
29473
- FORC: "0.58.0",
29473
+ FORC: "0.59.0",
29474
29474
  FUEL_CORE: "0.26.0",
29475
- FUELS: "0.87.0"
29475
+ FUELS: "0.88.1"
29476
29476
  };
29477
29477
  }
29478
29478
  function parseVersion(version) {
@@ -30970,16 +30970,34 @@ This unreleased fuel-core build may include features and updates not yet support
30970
30970
  WORD_SIZE + // Predicate size
30971
30971
  WORD_SIZE + // Predicate data size
30972
30972
  WORD_SIZE;
30973
+ var isUint8Array = (value) => value instanceof Uint8Array;
30974
+ var hasNestedOption = (coders) => {
30975
+ const array = Array.isArray(coders) ? coders : Object.values(coders);
30976
+ for (const node of array) {
30977
+ if (node.type === OPTION_CODER_TYPE) {
30978
+ return true;
30979
+ }
30980
+ if ("coder" in node && node.coder.type === OPTION_CODER_TYPE) {
30981
+ return true;
30982
+ }
30983
+ if ("coders" in node) {
30984
+ const child = hasNestedOption(node.coders);
30985
+ if (child) {
30986
+ return true;
30987
+ }
30988
+ }
30989
+ }
30990
+ return false;
30991
+ };
30973
30992
  var ArrayCoder = class extends Coder {
30974
30993
  coder;
30975
30994
  length;
30976
30995
  #hasNestedOption;
30977
30996
  constructor(coder, length) {
30978
- const hasNestedOption = coder.type === OPTION_CODER_TYPE;
30979
30997
  super("array", `[${coder.type}; ${length}]`, length * coder.encodedLength);
30980
30998
  this.coder = coder;
30981
30999
  this.length = length;
30982
- this.#hasNestedOption = hasNestedOption;
31000
+ this.#hasNestedOption = hasNestedOption([coder]);
30983
31001
  }
30984
31002
  encode(value) {
30985
31003
  if (!Array.isArray(value)) {
@@ -31157,9 +31175,8 @@ This unreleased fuel-core build may include features and updates not yet support
31157
31175
  coders;
31158
31176
  #caseIndexCoder;
31159
31177
  #encodedValueSize;
31160
- #hasNestedOption;
31178
+ #shouldValidateLength;
31161
31179
  constructor(name, coders) {
31162
- const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
31163
31180
  const caseIndexCoder = new BigNumberCoder("u64");
31164
31181
  const encodedValueSize = Object.values(coders).reduce(
31165
31182
  (max, coder) => Math.max(max, coder.encodedLength),
@@ -31170,7 +31187,7 @@ This unreleased fuel-core build may include features and updates not yet support
31170
31187
  this.coders = coders;
31171
31188
  this.#caseIndexCoder = caseIndexCoder;
31172
31189
  this.#encodedValueSize = encodedValueSize;
31173
- this.#hasNestedOption = hasNestedOption;
31190
+ this.#shouldValidateLength = !(this.type === OPTION_CODER_TYPE || hasNestedOption(coders));
31174
31191
  }
31175
31192
  #encodeNativeEnum(value) {
31176
31193
  const valueCoder = this.coders[value];
@@ -31199,7 +31216,7 @@ This unreleased fuel-core build may include features and updates not yet support
31199
31216
  return [caseKey, newOffset];
31200
31217
  }
31201
31218
  decode(data, offset) {
31202
- if (!this.#hasNestedOption && data.length < this.#encodedValueSize) {
31219
+ if (this.#shouldValidateLength && data.length < this.#encodedValueSize) {
31203
31220
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
31204
31221
  }
31205
31222
  const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
@@ -31391,7 +31408,6 @@ This unreleased fuel-core build may include features and updates not yet support
31391
31408
  coders;
31392
31409
  #hasNestedOption;
31393
31410
  constructor(name, coders) {
31394
- const hasNestedOption = Object.values(coders).some((coder) => coder.type === OPTION_CODER_TYPE);
31395
31411
  const encodedLength = Object.values(coders).reduce(
31396
31412
  (acc, coder) => acc + coder.encodedLength,
31397
31413
  0
@@ -31399,7 +31415,7 @@ This unreleased fuel-core build may include features and updates not yet support
31399
31415
  super("struct", `struct ${name}`, encodedLength);
31400
31416
  this.name = name;
31401
31417
  this.coders = coders;
31402
- this.#hasNestedOption = hasNestedOption;
31418
+ this.#hasNestedOption = hasNestedOption(coders);
31403
31419
  }
31404
31420
  encode(value) {
31405
31421
  return concatBytes2(
@@ -31435,11 +31451,10 @@ This unreleased fuel-core build may include features and updates not yet support
31435
31451
  coders;
31436
31452
  #hasNestedOption;
31437
31453
  constructor(coders) {
31438
- const hasNestedOption = coders.some((coder) => coder.type === OPTION_CODER_TYPE);
31439
31454
  const encodedLength = coders.reduce((acc, coder) => acc + coder.encodedLength, 0);
31440
31455
  super("tuple", `(${coders.map((coder) => coder.type).join(", ")})`, encodedLength);
31441
31456
  this.coders = coders;
31442
- this.#hasNestedOption = hasNestedOption;
31457
+ this.#hasNestedOption = hasNestedOption(coders);
31443
31458
  }
31444
31459
  encode(value) {
31445
31460
  if (this.coders.length !== value.length) {
@@ -31460,14 +31475,13 @@ This unreleased fuel-core build may include features and updates not yet support
31460
31475
  return [decodedValue, newOffset];
31461
31476
  }
31462
31477
  };
31463
- var isUint8Array = (value) => value instanceof Uint8Array;
31464
31478
  var VecCoder = class extends Coder {
31465
31479
  coder;
31466
31480
  #hasNestedOption;
31467
31481
  constructor(coder) {
31468
31482
  super("struct", `struct Vec`, coder.encodedLength + WORD_SIZE);
31469
31483
  this.coder = coder;
31470
- this.#hasNestedOption = coder.type === OPTION_CODER_TYPE;
31484
+ this.#hasNestedOption = hasNestedOption([coder]);
31471
31485
  }
31472
31486
  encode(value) {
31473
31487
  if (!Array.isArray(value) && !isUint8Array(value)) {
@@ -36802,6 +36816,7 @@ ${SqueezedOutStatusFragmentDoc}`;
36802
36816
  ${InputEstimatePredicatesFragmentDoc}`;
36803
36817
  var DryRunFailureStatusFragmentDoc = lib_default2`
36804
36818
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
36819
+ type: __typename
36805
36820
  totalGas
36806
36821
  totalFee
36807
36822
  reason
@@ -36813,6 +36828,7 @@ ${SqueezedOutStatusFragmentDoc}`;
36813
36828
  `;
36814
36829
  var DryRunSuccessStatusFragmentDoc = lib_default2`
36815
36830
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
36831
+ type: __typename
36816
36832
  totalGas
36817
36833
  totalFee
36818
36834
  programState {
@@ -38321,17 +38337,16 @@ ${MessageCoinFragmentDoc}`;
38321
38337
  }
38322
38338
 
38323
38339
  // src/providers/utils/extract-tx-error.ts
38324
- var assemblePanicError = (status) => {
38325
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
38326
- const reason = status.reason;
38327
- if (PANIC_REASONS.includes(status.reason)) {
38340
+ var assemblePanicError = (statusReason) => {
38341
+ let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
38342
+ if (PANIC_REASONS.includes(statusReason)) {
38328
38343
  errorMessage = `${errorMessage}
38329
38344
 
38330
38345
  You can read more about this error at:
38331
38346
 
38332
- ${PANIC_DOC_URL}#variant.${status.reason}`;
38347
+ ${PANIC_DOC_URL}#variant.${statusReason}`;
38333
38348
  }
38334
- return { errorMessage, reason };
38349
+ return { errorMessage, reason: statusReason };
38335
38350
  };
38336
38351
  var stringify = (obj) => JSON.stringify(obj, null, 2);
38337
38352
  var assembleRevertError = (receipts, logs) => {
@@ -38374,10 +38389,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
38374
38389
  return { errorMessage, reason };
38375
38390
  };
38376
38391
  var extractTxError = (params) => {
38377
- const { receipts, status, logs } = params;
38392
+ const { receipts, statusReason, logs } = params;
38378
38393
  const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
38379
38394
  const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
38380
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
38395
+ const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
38381
38396
  const metadata = {
38382
38397
  logs,
38383
38398
  receipts,
@@ -40098,7 +40113,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40098
40113
  if (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log) {
40099
40114
  const interfaceToUse = new Interface(externalAbis[receipt.id] || mainAbi);
40100
40115
  const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
40101
- const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
40116
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString());
40102
40117
  logs.push(decodedLog);
40103
40118
  }
40104
40119
  return logs;
@@ -40256,14 +40271,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40256
40271
  );
40257
40272
  transactionResult.logs = logs;
40258
40273
  }
40259
- if (transactionResult.isStatusFailure) {
40260
- const {
40261
- receipts,
40262
- gqlTransaction: { status }
40263
- } = transactionResult;
40274
+ const { gqlTransaction, receipts } = transactionResult;
40275
+ if (gqlTransaction.status?.type === "FailureStatus") {
40276
+ const { reason } = gqlTransaction.status;
40264
40277
  throw extractTxError({
40265
40278
  receipts,
40266
- status,
40279
+ statusReason: reason,
40267
40280
  logs
40268
40281
  });
40269
40282
  }
@@ -40995,7 +41008,10 @@ Supported fuel-core version: ${supportedVersion}.`
40995
41008
  await signatureCallback(txRequestClone);
40996
41009
  }
40997
41010
  ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
40998
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
41011
+ if (dryRunStatus && "reason" in dryRunStatus) {
41012
+ throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
41013
+ }
41014
+ gasUsed = getGasUsedFromReceipts(receipts);
40999
41015
  txRequestClone.gasLimit = gasUsed;
41000
41016
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
41001
41017
  transactionRequest: txRequestClone,
@@ -41447,6 +41463,22 @@ Supported fuel-core version: ${supportedVersion}.`
41447
41463
  }
41448
41464
  return relayedTransactionStatus;
41449
41465
  }
41466
+ extractDryRunError(transactionRequest, receipts, dryRunStatus) {
41467
+ const status = dryRunStatus;
41468
+ let logs = [];
41469
+ if (transactionRequest.abis) {
41470
+ logs = getDecodedLogs(
41471
+ receipts,
41472
+ transactionRequest.abis.main,
41473
+ transactionRequest.abis.otherContractsAbis
41474
+ );
41475
+ }
41476
+ return extractTxError({
41477
+ logs,
41478
+ receipts,
41479
+ statusReason: status.reason
41480
+ });
41481
+ }
41450
41482
  };
41451
41483
  var Provider = _Provider;
41452
41484
  _cacheInputs = new WeakSet();
@@ -41598,7 +41630,7 @@ Supported fuel-core version: ${supportedVersion}.`
41598
41630
  return CHAIN_IDS.eth.sepolia;
41599
41631
  }
41600
41632
  if (networkType === "fuel") {
41601
- return CHAIN_IDS.fuel.beta5;
41633
+ return CHAIN_IDS.fuel.devnet;
41602
41634
  }
41603
41635
  return void 0;
41604
41636
  };