@fuel-ts/account 0.86.0 → 0.88.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/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.86.0"
29475
+ FUELS: "0.88.0"
29476
29476
  };
29477
29477
  }
29478
29478
  function parseVersion(version) {
@@ -30970,13 +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;
30995
+ #hasNestedOption;
30976
30996
  constructor(coder, length) {
30977
30997
  super("array", `[${coder.type}; ${length}]`, length * coder.encodedLength);
30978
30998
  this.coder = coder;
30979
30999
  this.length = length;
31000
+ this.#hasNestedOption = hasNestedOption([coder]);
30980
31001
  }
30981
31002
  encode(value) {
30982
31003
  if (!Array.isArray(value)) {
@@ -30988,7 +31009,7 @@ This unreleased fuel-core build may include features and updates not yet support
30988
31009
  return concat(Array.from(value).map((v) => this.coder.encode(v)));
30989
31010
  }
30990
31011
  decode(data, offset) {
30991
- if (data.length < this.encodedLength || data.length > MAX_BYTES) {
31012
+ if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
30992
31013
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid array data size.`);
30993
31014
  }
30994
31015
  let newOffset = offset;
@@ -31154,6 +31175,7 @@ This unreleased fuel-core build may include features and updates not yet support
31154
31175
  coders;
31155
31176
  #caseIndexCoder;
31156
31177
  #encodedValueSize;
31178
+ #hasNestedOption;
31157
31179
  constructor(name, coders) {
31158
31180
  const caseIndexCoder = new BigNumberCoder("u64");
31159
31181
  const encodedValueSize = Object.values(coders).reduce(
@@ -31165,6 +31187,7 @@ This unreleased fuel-core build may include features and updates not yet support
31165
31187
  this.coders = coders;
31166
31188
  this.#caseIndexCoder = caseIndexCoder;
31167
31189
  this.#encodedValueSize = encodedValueSize;
31190
+ this.#hasNestedOption = hasNestedOption(coders);
31168
31191
  }
31169
31192
  #encodeNativeEnum(value) {
31170
31193
  const valueCoder = this.coders[value];
@@ -31193,7 +31216,7 @@ This unreleased fuel-core build may include features and updates not yet support
31193
31216
  return [caseKey, newOffset];
31194
31217
  }
31195
31218
  decode(data, offset) {
31196
- if (data.length < this.#encodedValueSize) {
31219
+ if (!this.#hasNestedOption && data.length < this.#encodedValueSize) {
31197
31220
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
31198
31221
  }
31199
31222
  const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
@@ -31383,6 +31406,7 @@ This unreleased fuel-core build may include features and updates not yet support
31383
31406
  var StructCoder = class extends Coder {
31384
31407
  name;
31385
31408
  coders;
31409
+ #hasNestedOption;
31386
31410
  constructor(name, coders) {
31387
31411
  const encodedLength = Object.values(coders).reduce(
31388
31412
  (acc, coder) => acc + coder.encodedLength,
@@ -31391,6 +31415,7 @@ This unreleased fuel-core build may include features and updates not yet support
31391
31415
  super("struct", `struct ${name}`, encodedLength);
31392
31416
  this.name = name;
31393
31417
  this.coders = coders;
31418
+ this.#hasNestedOption = hasNestedOption(coders);
31394
31419
  }
31395
31420
  encode(value) {
31396
31421
  return concatBytes2(
@@ -31408,7 +31433,7 @@ This unreleased fuel-core build may include features and updates not yet support
31408
31433
  );
31409
31434
  }
31410
31435
  decode(data, offset) {
31411
- if (data.length < this.encodedLength) {
31436
+ if (!this.#hasNestedOption && data.length < this.encodedLength) {
31412
31437
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid struct data size.`);
31413
31438
  }
31414
31439
  let newOffset = offset;
@@ -31424,10 +31449,12 @@ This unreleased fuel-core build may include features and updates not yet support
31424
31449
  };
31425
31450
  var TupleCoder = class extends Coder {
31426
31451
  coders;
31452
+ #hasNestedOption;
31427
31453
  constructor(coders) {
31428
31454
  const encodedLength = coders.reduce((acc, coder) => acc + coder.encodedLength, 0);
31429
31455
  super("tuple", `(${coders.map((coder) => coder.type).join(", ")})`, encodedLength);
31430
31456
  this.coders = coders;
31457
+ this.#hasNestedOption = hasNestedOption(coders);
31431
31458
  }
31432
31459
  encode(value) {
31433
31460
  if (this.coders.length !== value.length) {
@@ -31436,7 +31463,7 @@ This unreleased fuel-core build may include features and updates not yet support
31436
31463
  return concatBytes2(this.coders.map((coder, i) => coder.encode(value[i])));
31437
31464
  }
31438
31465
  decode(data, offset) {
31439
- if (data.length < this.encodedLength) {
31466
+ if (!this.#hasNestedOption && data.length < this.encodedLength) {
31440
31467
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid tuple data size.`);
31441
31468
  }
31442
31469
  let newOffset = offset;
@@ -31448,14 +31475,13 @@ This unreleased fuel-core build may include features and updates not yet support
31448
31475
  return [decodedValue, newOffset];
31449
31476
  }
31450
31477
  };
31451
- var isUint8Array = (value) => value instanceof Uint8Array;
31452
31478
  var VecCoder = class extends Coder {
31453
31479
  coder;
31454
- #isOptionVec;
31480
+ #hasNestedOption;
31455
31481
  constructor(coder) {
31456
31482
  super("struct", `struct Vec`, coder.encodedLength + WORD_SIZE);
31457
31483
  this.coder = coder;
31458
- this.#isOptionVec = this.coder instanceof OptionCoder;
31484
+ this.#hasNestedOption = hasNestedOption([coder]);
31459
31485
  }
31460
31486
  encode(value) {
31461
31487
  if (!Array.isArray(value) && !isUint8Array(value)) {
@@ -31473,7 +31499,7 @@ This unreleased fuel-core build may include features and updates not yet support
31473
31499
  return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
31474
31500
  }
31475
31501
  decode(data, offset) {
31476
- if (!this.#isOptionVec && (data.length < this.encodedLength || data.length > MAX_BYTES)) {
31502
+ if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
31477
31503
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec data size.`);
31478
31504
  }
31479
31505
  const offsetAndLength = offset + WORD_SIZE;
@@ -31481,7 +31507,7 @@ This unreleased fuel-core build may include features and updates not yet support
31481
31507
  const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
31482
31508
  const dataLength = length * this.coder.encodedLength;
31483
31509
  const dataBytes = data.slice(offsetAndLength, offsetAndLength + dataLength);
31484
- if (!this.#isOptionVec && dataBytes.length !== dataLength) {
31510
+ if (!this.#hasNestedOption && dataBytes.length !== dataLength) {
31485
31511
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid vec byte data size.`);
31486
31512
  }
31487
31513
  let newOffset = offsetAndLength;
@@ -36790,6 +36816,7 @@ ${SqueezedOutStatusFragmentDoc}`;
36790
36816
  ${InputEstimatePredicatesFragmentDoc}`;
36791
36817
  var DryRunFailureStatusFragmentDoc = lib_default2`
36792
36818
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
36819
+ type: __typename
36793
36820
  totalGas
36794
36821
  totalFee
36795
36822
  reason
@@ -36801,6 +36828,7 @@ ${SqueezedOutStatusFragmentDoc}`;
36801
36828
  `;
36802
36829
  var DryRunSuccessStatusFragmentDoc = lib_default2`
36803
36830
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
36831
+ type: __typename
36804
36832
  totalGas
36805
36833
  totalFee
36806
36834
  programState {
@@ -38309,17 +38337,16 @@ ${MessageCoinFragmentDoc}`;
38309
38337
  }
38310
38338
 
38311
38339
  // src/providers/utils/extract-tx-error.ts
38312
- var assemblePanicError = (status) => {
38313
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
38314
- const reason = status.reason;
38315
- 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)) {
38316
38343
  errorMessage = `${errorMessage}
38317
38344
 
38318
38345
  You can read more about this error at:
38319
38346
 
38320
- ${PANIC_DOC_URL}#variant.${status.reason}`;
38347
+ ${PANIC_DOC_URL}#variant.${statusReason}`;
38321
38348
  }
38322
- return { errorMessage, reason };
38349
+ return { errorMessage, reason: statusReason };
38323
38350
  };
38324
38351
  var stringify = (obj) => JSON.stringify(obj, null, 2);
38325
38352
  var assembleRevertError = (receipts, logs) => {
@@ -38362,10 +38389,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
38362
38389
  return { errorMessage, reason };
38363
38390
  };
38364
38391
  var extractTxError = (params) => {
38365
- const { receipts, status, logs } = params;
38392
+ const { receipts, statusReason, logs } = params;
38366
38393
  const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
38367
38394
  const isRevert = receipts.some(({ type: type3 }) => type3 === ReceiptType.Revert);
38368
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
38395
+ const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
38369
38396
  const metadata = {
38370
38397
  logs,
38371
38398
  receipts,
@@ -40086,7 +40113,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40086
40113
  if (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log) {
40087
40114
  const interfaceToUse = new Interface(externalAbis[receipt.id] || mainAbi);
40088
40115
  const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
40089
- const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
40116
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString());
40090
40117
  logs.push(decodedLog);
40091
40118
  }
40092
40119
  return logs;
@@ -40244,14 +40271,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40244
40271
  );
40245
40272
  transactionResult.logs = logs;
40246
40273
  }
40247
- if (transactionResult.isStatusFailure) {
40248
- const {
40249
- receipts,
40250
- gqlTransaction: { status }
40251
- } = transactionResult;
40274
+ const { gqlTransaction, receipts } = transactionResult;
40275
+ if (gqlTransaction.status?.type === "FailureStatus") {
40276
+ const { reason } = gqlTransaction.status;
40252
40277
  throw extractTxError({
40253
40278
  receipts,
40254
- status,
40279
+ statusReason: reason,
40255
40280
  logs
40256
40281
  });
40257
40282
  }
@@ -40983,7 +41008,10 @@ Supported fuel-core version: ${supportedVersion}.`
40983
41008
  await signatureCallback(txRequestClone);
40984
41009
  }
40985
41010
  ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
40986
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
41011
+ if (dryRunStatus && "reason" in dryRunStatus) {
41012
+ throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
41013
+ }
41014
+ gasUsed = getGasUsedFromReceipts(receipts);
40987
41015
  txRequestClone.gasLimit = gasUsed;
40988
41016
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
40989
41017
  transactionRequest: txRequestClone,
@@ -41435,6 +41463,22 @@ Supported fuel-core version: ${supportedVersion}.`
41435
41463
  }
41436
41464
  return relayedTransactionStatus;
41437
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
+ }
41438
41482
  };
41439
41483
  var Provider = _Provider;
41440
41484
  _cacheInputs = new WeakSet();
@@ -41586,7 +41630,7 @@ Supported fuel-core version: ${supportedVersion}.`
41586
41630
  return CHAIN_IDS.eth.sepolia;
41587
41631
  }
41588
41632
  if (networkType === "fuel") {
41589
- return CHAIN_IDS.fuel.beta5;
41633
+ return CHAIN_IDS.fuel.devnet;
41590
41634
  }
41591
41635
  return void 0;
41592
41636
  };