@fuel-ts/account 0.94.9 → 0.95.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.
@@ -28911,9 +28911,9 @@ spurious results.`);
28911
28911
  // ../versions/dist/index.mjs
28912
28912
  function getBuiltinVersions() {
28913
28913
  return {
28914
- FORC: "0.64.0",
28915
- FUEL_CORE: "0.37.0",
28916
- FUELS: "0.94.9"
28914
+ FORC: "0.65.2",
28915
+ FUEL_CORE: "0.38.0",
28916
+ FUELS: "0.95.0"
28917
28917
  };
28918
28918
  }
28919
28919
  function parseVersion(version) {
@@ -29097,21 +29097,6 @@ This unreleased fuel-core build may include features and updates not yet support
29097
29097
  var DEFAULT_PRECISION = 9;
29098
29098
  var DEFAULT_MIN_PRECISION = 3;
29099
29099
  var DEFAULT_DECIMAL_UNITS = 9;
29100
- function toFixed(value, options) {
29101
- const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
29102
- const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
29103
- const groupRegex = /(\d)(?=(\d{3})+\b)/g;
29104
- const units = valueUnits.replace(groupRegex, "$1,");
29105
- let decimals = valueDecimals.slice(0, precision);
29106
- if (minPrecision < precision) {
29107
- const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
29108
- const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
29109
- const keepChars = Math.max(minPrecision, lastNonZeroIndex);
29110
- decimals = decimals.slice(0, keepChars);
29111
- }
29112
- const decimalPortion = decimals ? `.${decimals}` : "";
29113
- return `${units}${decimalPortion}`;
29114
- }
29115
29100
  var BN = class extends import_bn.default {
29116
29101
  MAX_U64 = "0xFFFFFFFFFFFFFFFF";
29117
29102
  constructor(value, base, endian) {
@@ -29163,28 +29148,53 @@ This unreleased fuel-core build may include features and updates not yet support
29163
29148
  format(options) {
29164
29149
  const {
29165
29150
  units = DEFAULT_DECIMAL_UNITS,
29166
- precision = DEFAULT_PRECISION,
29167
- minPrecision = DEFAULT_MIN_PRECISION
29151
+ precision: initialPrecision = DEFAULT_PRECISION,
29152
+ minPrecision: initialMinPrecision = DEFAULT_MIN_PRECISION
29168
29153
  } = options || {};
29154
+ if (units === 0) {
29155
+ return this.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
29156
+ }
29157
+ const minPrecision = initialMinPrecision > initialPrecision ? initialPrecision : initialMinPrecision;
29158
+ const precision = initialPrecision > initialMinPrecision ? initialPrecision : initialMinPrecision;
29169
29159
  const formattedUnits = this.formatUnits(units);
29170
- const formattedFixed = toFixed(formattedUnits, { precision, minPrecision });
29171
- if (!parseFloat(formattedFixed)) {
29172
- const [, originalDecimals = "0"] = formattedUnits.split(".");
29173
- const firstNonZero = originalDecimals.match(/[1-9]/);
29174
- if (firstNonZero && firstNonZero.index && firstNonZero.index + 1 > precision) {
29175
- const [valueUnits = "0"] = formattedFixed.split(".");
29176
- return `${valueUnits}.${originalDecimals.slice(0, firstNonZero.index + 1)}`;
29160
+ const [integerPart, fractionalPart = ""] = formattedUnits.split(".");
29161
+ const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
29162
+ if (precision === 0) {
29163
+ return formattedInteger;
29164
+ }
29165
+ let formattedFractional = fractionalPart.replace(/0+$/, "");
29166
+ if (formattedFractional.length > precision) {
29167
+ if (integerPart === "0") {
29168
+ const firstNonZeroIndex = formattedFractional.search(/[1-9]/);
29169
+ if (firstNonZeroIndex >= 0 && firstNonZeroIndex < precision) {
29170
+ formattedFractional = formattedFractional.slice(0, precision);
29171
+ } else {
29172
+ formattedFractional = formattedFractional.slice(0, firstNonZeroIndex + 1);
29173
+ }
29174
+ } else {
29175
+ formattedFractional = formattedFractional.slice(0, precision);
29177
29176
  }
29177
+ } else {
29178
+ formattedFractional = formattedFractional.slice(0, precision);
29179
+ }
29180
+ if (formattedFractional.length < minPrecision) {
29181
+ formattedFractional = formattedFractional.padEnd(minPrecision, "0");
29178
29182
  }
29179
- return formattedFixed;
29183
+ if (formattedFractional === "" && minPrecision === 0) {
29184
+ return formattedInteger;
29185
+ }
29186
+ return formattedFractional ? `${formattedInteger}.${formattedFractional}` : formattedInteger;
29180
29187
  }
29181
29188
  formatUnits(units = DEFAULT_DECIMAL_UNITS) {
29182
- const valueUnits = this.toString().slice(0, units * -1);
29183
- const valueDecimals = this.toString().slice(units * -1);
29184
- const length = valueDecimals.length;
29185
- const defaultDecimals = Array.from({ length: units - length }).fill("0").join("");
29186
- const integerPortion = valueUnits ? `${valueUnits}.` : "0.";
29187
- return `${integerPortion}${defaultDecimals}${valueDecimals}`;
29189
+ const valueString = this.toString();
29190
+ const valueLength = valueString.length;
29191
+ if (valueLength <= units) {
29192
+ const paddedZeros = "0".repeat(units - valueLength);
29193
+ return `0.${paddedZeros}${valueString}`;
29194
+ }
29195
+ const integerPart = valueString.slice(0, valueLength - units);
29196
+ const fractionalPart = valueString.slice(valueLength - units);
29197
+ return `${integerPart}.${fractionalPart}`;
29188
29198
  }
29189
29199
  // END ANCHOR: HELPERS
29190
29200
  // ANCHOR: OVERRIDES to accept better inputs
@@ -32813,6 +32823,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
32813
32823
  );
32814
32824
  }
32815
32825
  }
32826
+ /**
32827
+ * Takes an B256 Address and returns back an checksum address.
32828
+ * The implementation follows the ERC-55 https://github.com/ethereum/ercs/blob/master/ERCS/erc-55.md.
32829
+ *
32830
+ * @returns A new `ChecksumAddress` instance
32831
+ */
32832
+ toChecksum() {
32833
+ return Address.toChecksum(this.toB256());
32834
+ }
32816
32835
  /**
32817
32836
  * Returns the `bech32Address` property
32818
32837
  *
@@ -32846,12 +32865,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
32846
32865
  return this.toB256();
32847
32866
  }
32848
32867
  /**
32849
- * Converts and returns the `bech32Address` property as a string
32868
+ * returns the address `checksum` as a string
32850
32869
  *
32851
32870
  * @returns The `bech32Address` property as a string
32852
32871
  */
32853
32872
  toString() {
32854
- return this.bech32Address;
32873
+ return this.toChecksum();
32855
32874
  }
32856
32875
  /**
32857
32876
  * Converts and returns the `bech32Address` property as a string
@@ -32883,12 +32902,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
32883
32902
  };
32884
32903
  }
32885
32904
  /**
32886
- * Returns the value of the `bech32Address` property
32905
+ * returns the address `checksum` as a string
32887
32906
  *
32888
32907
  * @returns The value of `bech32Address` property
32889
32908
  */
32890
32909
  valueOf() {
32891
- return this.bech32Address;
32910
+ return this.toChecksum();
32892
32911
  }
32893
32912
  /**
32894
32913
  * Compares this the `bech32Address` property to another for direct equality
@@ -32995,6 +33014,35 @@ If you are attempting to transform a hex value, please make sure it is being pas
32995
33014
  const paddedAddress = padFirst12BytesOfEvmAddress(evmAddress);
32996
33015
  return new Address(toBech32(paddedAddress));
32997
33016
  }
33017
+ /**
33018
+ * Takes an ChecksumAddress and validates if it is a valid checksum address.
33019
+ *
33020
+ * @returns A `boolean` instance indicating if the address is valid.
33021
+ */
33022
+ static isChecksumValid(address) {
33023
+ let addressParsed = address;
33024
+ if (!address.startsWith("0x")) {
33025
+ addressParsed = `0x${address}`;
33026
+ }
33027
+ if (addressParsed.trim().length !== 66) {
33028
+ return false;
33029
+ }
33030
+ return Address.toChecksum(hexlify(addressParsed)) === addressParsed;
33031
+ }
33032
+ /** @hidden */
33033
+ static toChecksum(address) {
33034
+ const addressHex = hexlify(address).toLowerCase().slice(2);
33035
+ const checksum = sha256(address);
33036
+ let ret2 = "0x";
33037
+ for (let i = 0; i < 32; ++i) {
33038
+ const byte = checksum[i];
33039
+ const ha = addressHex.charAt(i * 2);
33040
+ const hb = addressHex.charAt(i * 2 + 1);
33041
+ ret2 += (byte & 240) >= 128 ? ha.toUpperCase() : ha;
33042
+ ret2 += (byte & 15) >= 8 ? hb.toUpperCase() : hb;
33043
+ }
33044
+ return ret2;
33045
+ }
32998
33046
  };
32999
33047
 
33000
33048
  // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/utils.js
@@ -39849,6 +39897,26 @@ ${DryRunSuccessStatusFragmentDoc}`;
39849
39897
  }
39850
39898
  ${DryRunTransactionStatusFragmentDoc}
39851
39899
  ${ReceiptFragmentDoc}`;
39900
+ var BlockFragmentDoc = lib_default2`
39901
+ fragment blockFragment on Block {
39902
+ id
39903
+ height
39904
+ header {
39905
+ time
39906
+ daHeight
39907
+ stateTransitionBytecodeVersion
39908
+ transactionsCount
39909
+ transactionsRoot
39910
+ messageOutboxRoot
39911
+ eventInboxRoot
39912
+ prevRoot
39913
+ applicationHash
39914
+ }
39915
+ transactions {
39916
+ id
39917
+ }
39918
+ }
39919
+ `;
39852
39920
  var CoinFragmentDoc = lib_default2`
39853
39921
  fragment coinFragment on Coin {
39854
39922
  type: __typename
@@ -39928,33 +39996,6 @@ ${ReceiptFragmentDoc}`;
39928
39996
  nonce
39929
39997
  amount
39930
39998
  data
39931
- }
39932
- `;
39933
- var BalanceFragmentDoc = lib_default2`
39934
- fragment balanceFragment on Balance {
39935
- owner
39936
- amount
39937
- assetId
39938
- }
39939
- `;
39940
- var BlockFragmentDoc = lib_default2`
39941
- fragment blockFragment on Block {
39942
- id
39943
- height
39944
- header {
39945
- time
39946
- daHeight
39947
- stateTransitionBytecodeVersion
39948
- transactionsCount
39949
- transactionsRoot
39950
- messageOutboxRoot
39951
- eventInboxRoot
39952
- prevRoot
39953
- applicationHash
39954
- }
39955
- transactions {
39956
- id
39957
- }
39958
39999
  }
39959
40000
  `;
39960
40001
  var TxParametersFragmentDoc = lib_default2`
@@ -40014,167 +40055,6 @@ ${ReceiptFragmentDoc}`;
40014
40055
  `;
40015
40056
  var GasCostsFragmentDoc = lib_default2`
40016
40057
  fragment GasCostsFragment on GasCosts {
40017
- version
40018
- add
40019
- addi
40020
- aloc
40021
- and
40022
- andi
40023
- bal
40024
- bhei
40025
- bhsh
40026
- burn
40027
- cb
40028
- cfei
40029
- cfsi
40030
- div
40031
- divi
40032
- ecr1
40033
- eck1
40034
- ed19
40035
- eq
40036
- exp
40037
- expi
40038
- flag
40039
- gm
40040
- gt
40041
- gtf
40042
- ji
40043
- jmp
40044
- jne
40045
- jnei
40046
- jnzi
40047
- jmpf
40048
- jmpb
40049
- jnzf
40050
- jnzb
40051
- jnef
40052
- jneb
40053
- lb
40054
- log
40055
- lt
40056
- lw
40057
- mint
40058
- mlog
40059
- modOp
40060
- modi
40061
- moveOp
40062
- movi
40063
- mroo
40064
- mul
40065
- muli
40066
- mldv
40067
- noop
40068
- not
40069
- or
40070
- ori
40071
- poph
40072
- popl
40073
- pshh
40074
- pshl
40075
- ret
40076
- rvrt
40077
- sb
40078
- sll
40079
- slli
40080
- srl
40081
- srli
40082
- srw
40083
- sub
40084
- subi
40085
- sw
40086
- sww
40087
- time
40088
- tr
40089
- tro
40090
- wdcm
40091
- wqcm
40092
- wdop
40093
- wqop
40094
- wdml
40095
- wqml
40096
- wddv
40097
- wqdv
40098
- wdmd
40099
- wqmd
40100
- wdam
40101
- wqam
40102
- wdmm
40103
- wqmm
40104
- xor
40105
- xori
40106
- alocDependentCost {
40107
- ...DependentCostFragment
40108
- }
40109
- bldd {
40110
- ...DependentCostFragment
40111
- }
40112
- bsiz {
40113
- ...DependentCostFragment
40114
- }
40115
- cfe {
40116
- ...DependentCostFragment
40117
- }
40118
- cfeiDependentCost {
40119
- ...DependentCostFragment
40120
- }
40121
- call {
40122
- ...DependentCostFragment
40123
- }
40124
- ccp {
40125
- ...DependentCostFragment
40126
- }
40127
- croo {
40128
- ...DependentCostFragment
40129
- }
40130
- csiz {
40131
- ...DependentCostFragment
40132
- }
40133
- ed19DependentCost {
40134
- ...DependentCostFragment
40135
- }
40136
- k256 {
40137
- ...DependentCostFragment
40138
- }
40139
- ldc {
40140
- ...DependentCostFragment
40141
- }
40142
- logd {
40143
- ...DependentCostFragment
40144
- }
40145
- mcl {
40146
- ...DependentCostFragment
40147
- }
40148
- mcli {
40149
- ...DependentCostFragment
40150
- }
40151
- mcp {
40152
- ...DependentCostFragment
40153
- }
40154
- mcpi {
40155
- ...DependentCostFragment
40156
- }
40157
- meq {
40158
- ...DependentCostFragment
40159
- }
40160
- retd {
40161
- ...DependentCostFragment
40162
- }
40163
- s256 {
40164
- ...DependentCostFragment
40165
- }
40166
- scwq {
40167
- ...DependentCostFragment
40168
- }
40169
- smo {
40170
- ...DependentCostFragment
40171
- }
40172
- srwq {
40173
- ...DependentCostFragment
40174
- }
40175
- swwq {
40176
- ...DependentCostFragment
40177
- }
40178
40058
  contractRoot {
40179
40059
  ...DependentCostFragment
40180
40060
  }
@@ -40184,6 +40064,10 @@ ${ReceiptFragmentDoc}`;
40184
40064
  vmInitialization {
40185
40065
  ...DependentCostFragment
40186
40066
  }
40067
+ s256 {
40068
+ ...DependentCostFragment
40069
+ }
40070
+ ecr1
40187
40071
  newStoragePerByte
40188
40072
  }
40189
40073
  ${DependentCostFragmentDoc}`;
@@ -40220,16 +40104,12 @@ ${GasCostsFragmentDoc}`;
40220
40104
  var ChainInfoFragmentDoc = lib_default2`
40221
40105
  fragment chainInfoFragment on ChainInfo {
40222
40106
  name
40223
- latestBlock {
40224
- ...blockFragment
40225
- }
40226
40107
  daHeight
40227
40108
  consensusParameters {
40228
40109
  ...consensusParametersFragment
40229
40110
  }
40230
40111
  }
40231
- ${BlockFragmentDoc}
40232
- ${ConsensusParametersFragmentDoc}`;
40112
+ ${ConsensusParametersFragmentDoc}`;
40233
40113
  var ContractBalanceFragmentDoc = lib_default2`
40234
40114
  fragment contractBalanceFragment on ContractBalance {
40235
40115
  contract
@@ -40260,6 +40140,12 @@ ${ConsensusParametersFragmentDoc}`;
40260
40140
  blockHeight
40261
40141
  failure
40262
40142
  }
40143
+ }
40144
+ `;
40145
+ var TransactionRawPayloadFragmentDoc = lib_default2`
40146
+ fragment transactionRawPayload on Transaction {
40147
+ id
40148
+ rawPayload
40263
40149
  }
40264
40150
  `;
40265
40151
  var GetVersionDocument = lib_default2`
@@ -40283,6 +40169,17 @@ ${ConsensusParametersFragmentDoc}`;
40283
40169
  }
40284
40170
  }
40285
40171
  ${ChainInfoFragmentDoc}`;
40172
+ var GetChainAndNodeInfoDocument = lib_default2`
40173
+ query getChainAndNodeInfo {
40174
+ chain {
40175
+ ...chainInfoFragment
40176
+ }
40177
+ nodeInfo {
40178
+ ...nodeInfoFragment
40179
+ }
40180
+ }
40181
+ ${ChainInfoFragmentDoc}
40182
+ ${NodeInfoFragmentDoc}`;
40286
40183
  var GetTransactionDocument = lib_default2`
40287
40184
  query getTransaction($transactionId: TransactionId!) {
40288
40185
  transaction(id: $transactionId) {
@@ -40340,6 +40237,24 @@ ${TransactionFragmentDoc}`;
40340
40237
  }
40341
40238
  }
40342
40239
  ${TransactionEstimatePredicatesFragmentDoc}`;
40240
+ var GetLatestBlockDocument = lib_default2`
40241
+ query getLatestBlock {
40242
+ chain {
40243
+ latestBlock {
40244
+ ...blockFragment
40245
+ }
40246
+ }
40247
+ }
40248
+ ${BlockFragmentDoc}`;
40249
+ var GetLatestBlockHeightDocument = lib_default2`
40250
+ query getLatestBlockHeight {
40251
+ chain {
40252
+ latestBlock {
40253
+ height
40254
+ }
40255
+ }
40256
+ }
40257
+ `;
40343
40258
  var GetBlockDocument = lib_default2`
40344
40259
  query getBlock($blockId: BlockId, $height: U32) {
40345
40260
  block(id: $blockId, height: $height) {
@@ -40352,12 +40267,12 @@ ${TransactionFragmentDoc}`;
40352
40267
  block(id: $blockId, height: $blockHeight) {
40353
40268
  ...blockFragment
40354
40269
  transactions {
40355
- ...transactionFragment
40270
+ ...transactionRawPayload
40356
40271
  }
40357
40272
  }
40358
40273
  }
40359
40274
  ${BlockFragmentDoc}
40360
- ${TransactionFragmentDoc}`;
40275
+ ${TransactionRawPayloadFragmentDoc}`;
40361
40276
  var GetBlocksDocument = lib_default2`
40362
40277
  query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
40363
40278
  blocks(after: $after, before: $before, first: $first, last: $last) {
@@ -40432,10 +40347,10 @@ ${MessageCoinFragmentDoc}`;
40432
40347
  var GetBalanceDocument = lib_default2`
40433
40348
  query getBalance($owner: Address!, $assetId: AssetId!) {
40434
40349
  balance(owner: $owner, assetId: $assetId) {
40435
- ...balanceFragment
40350
+ amount
40436
40351
  }
40437
40352
  }
40438
- ${BalanceFragmentDoc}`;
40353
+ `;
40439
40354
  var GetLatestGasPriceDocument = lib_default2`
40440
40355
  query getLatestGasPrice {
40441
40356
  latestGasPrice {
@@ -40464,13 +40379,13 @@ ${MessageCoinFragmentDoc}`;
40464
40379
  }
40465
40380
  edges {
40466
40381
  node {
40467
- ...balanceFragment
40382
+ assetId
40383
+ amount
40468
40384
  }
40469
40385
  }
40470
40386
  }
40471
40387
  }
40472
- ${PageInfoFragmentDoc}
40473
- ${BalanceFragmentDoc}`;
40388
+ ${PageInfoFragmentDoc}`;
40474
40389
  var GetMessagesDocument = lib_default2`
40475
40390
  query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
40476
40391
  messages(
@@ -40551,6 +40466,19 @@ ${MessageFragmentDoc}`;
40551
40466
  }
40552
40467
  }
40553
40468
  ${MessageFragmentDoc}`;
40469
+ var IsUserAccountDocument = lib_default2`
40470
+ query isUserAccount($blobId: BlobId!, $contractId: ContractId!, $transactionId: TransactionId!) {
40471
+ blob(id: $blobId) {
40472
+ id
40473
+ }
40474
+ contract(id: $contractId) {
40475
+ id
40476
+ }
40477
+ transaction(id: $transactionId) {
40478
+ id
40479
+ }
40480
+ }
40481
+ `;
40554
40482
  var SubmitAndAwaitDocument = lib_default2`
40555
40483
  subscription submitAndAwait($encodedTransaction: HexString!) {
40556
40484
  submitAndAwait(tx: $encodedTransaction) {
@@ -40583,6 +40511,9 @@ ${MessageFragmentDoc}`;
40583
40511
  getChain(variables, options) {
40584
40512
  return requester(GetChainDocument, variables, options);
40585
40513
  },
40514
+ getChainAndNodeInfo(variables, options) {
40515
+ return requester(GetChainAndNodeInfoDocument, variables, options);
40516
+ },
40586
40517
  getTransaction(variables, options) {
40587
40518
  return requester(GetTransactionDocument, variables, options);
40588
40519
  },
@@ -40598,6 +40529,12 @@ ${MessageFragmentDoc}`;
40598
40529
  estimatePredicates(variables, options) {
40599
40530
  return requester(EstimatePredicatesDocument, variables, options);
40600
40531
  },
40532
+ getLatestBlock(variables, options) {
40533
+ return requester(GetLatestBlockDocument, variables, options);
40534
+ },
40535
+ getLatestBlockHeight(variables, options) {
40536
+ return requester(GetLatestBlockHeightDocument, variables, options);
40537
+ },
40601
40538
  getBlock(variables, options) {
40602
40539
  return requester(GetBlockDocument, variables, options);
40603
40540
  },
@@ -40658,6 +40595,9 @@ ${MessageFragmentDoc}`;
40658
40595
  getMessageByNonce(variables, options) {
40659
40596
  return requester(GetMessageByNonceDocument, variables, options);
40660
40597
  },
40598
+ isUserAccount(variables, options) {
40599
+ return requester(IsUserAccountDocument, variables, options);
40600
+ },
40661
40601
  submitAndAwait(variables, options) {
40662
40602
  return requester(SubmitAndAwaitDocument, variables, options);
40663
40603
  },
@@ -43802,10 +43742,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43802
43742
  // src/providers/provider.ts
43803
43743
  var MAX_RETRIES = 10;
43804
43744
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
43745
+ var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
43805
43746
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
43806
43747
  var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
43807
43748
  var processGqlChain = (chain) => {
43808
- const { name, daHeight, consensusParameters, latestBlock } = chain;
43749
+ const { name, daHeight, consensusParameters } = chain;
43809
43750
  const {
43810
43751
  contractParams,
43811
43752
  feeParams,
@@ -43856,14 +43797,6 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43856
43797
  maxScriptDataLength: bn(scriptParams.maxScriptDataLength)
43857
43798
  },
43858
43799
  gasCosts
43859
- },
43860
- latestBlock: {
43861
- id: latestBlock.id,
43862
- height: bn(latestBlock.height),
43863
- time: latestBlock.header.time,
43864
- transactions: latestBlock.transactions.map((i) => ({
43865
- id: i.id
43866
- }))
43867
43800
  }
43868
43801
  };
43869
43802
  };
@@ -43894,14 +43827,17 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43894
43827
  retryOptions: void 0,
43895
43828
  headers: void 0
43896
43829
  });
43897
- const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
43830
+ const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
43898
43831
  this.url = rawUrl;
43899
43832
  this.urlWithoutAuth = urlWithoutAuth;
43900
- this.options = { ...this.options, ...options };
43901
43833
  this.url = url;
43902
- if (headers) {
43903
- this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
43904
- }
43834
+ const { FUELS } = versions;
43835
+ const headers = { ...authHeaders, ...options.headers, Source: `ts-sdk-${FUELS}` };
43836
+ this.options = {
43837
+ ...this.options,
43838
+ ...options,
43839
+ headers
43840
+ };
43905
43841
  this.operations = this.createOperations();
43906
43842
  const { resourceCacheTTL } = this.options;
43907
43843
  if (isDefined(resourceCacheTTL)) {
@@ -44040,9 +43976,25 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44040
43976
  * @returns A promise that resolves to the Chain and NodeInfo.
44041
43977
  */
44042
43978
  async fetchChainAndNodeInfo() {
44043
- const nodeInfo = await this.fetchNode();
44044
- _Provider.ensureClientVersionIsSupported(nodeInfo);
44045
- const chain = await this.fetchChain();
43979
+ let nodeInfo;
43980
+ let chain;
43981
+ try {
43982
+ nodeInfo = this.getNode();
43983
+ chain = this.getChain();
43984
+ } catch (error) {
43985
+ const data = await this.operations.getChainAndNodeInfo();
43986
+ nodeInfo = {
43987
+ maxDepth: bn(data.nodeInfo.maxDepth),
43988
+ maxTx: bn(data.nodeInfo.maxTx),
43989
+ nodeVersion: data.nodeInfo.nodeVersion,
43990
+ utxoValidation: data.nodeInfo.utxoValidation,
43991
+ vmBacktrace: data.nodeInfo.vmBacktrace
43992
+ };
43993
+ _Provider.ensureClientVersionIsSupported(nodeInfo);
43994
+ chain = processGqlChain(data.chain);
43995
+ _Provider.chainInfoCache[this.urlWithoutAuth] = chain;
43996
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
43997
+ }
44046
43998
  return {
44047
43999
  chain,
44048
44000
  nodeInfo
@@ -44134,8 +44086,12 @@ Supported fuel-core version: ${supportedVersion}.`
44134
44086
  * @returns A promise that resolves to the latest block number.
44135
44087
  */
44136
44088
  async getBlockNumber() {
44137
- const { chain } = await this.operations.getChain();
44138
- return bn(chain.latestBlock.height, 10);
44089
+ const {
44090
+ chain: {
44091
+ latestBlock: { height }
44092
+ }
44093
+ } = await this.operations.getLatestBlockHeight();
44094
+ return bn(height);
44139
44095
  }
44140
44096
  /**
44141
44097
  * Returns the node information for the current provider network.
@@ -44682,17 +44638,18 @@ Supported fuel-core version: ${supportedVersion}.`
44682
44638
  * @returns A promise that resolves to the block or null.
44683
44639
  */
44684
44640
  async getBlock(idOrHeight) {
44685
- let variables;
44686
- if (typeof idOrHeight === "number") {
44687
- variables = { height: bn(idOrHeight).toString(10) };
44688
- } else if (idOrHeight === "latest") {
44689
- variables = { height: (await this.getBlockNumber()).toString(10) };
44690
- } else if (idOrHeight.length === 66) {
44691
- variables = { blockId: idOrHeight };
44641
+ let block2;
44642
+ if (idOrHeight === "latest") {
44643
+ const {
44644
+ chain: { latestBlock }
44645
+ } = await this.operations.getLatestBlock();
44646
+ block2 = latestBlock;
44692
44647
  } else {
44693
- variables = { blockId: bn(idOrHeight).toString(10) };
44648
+ const isblockId = typeof idOrHeight === "string" && idOrHeight.length === 66;
44649
+ const variables = isblockId ? { blockId: idOrHeight } : { height: bn(idOrHeight).toString(10) };
44650
+ const response = await this.operations.getBlock(variables);
44651
+ block2 = response.block;
44694
44652
  }
44695
- const { block: block2 } = await this.operations.getBlock(variables);
44696
44653
  if (!block2) {
44697
44654
  return null;
44698
44655
  }
@@ -44818,7 +44775,12 @@ Supported fuel-core version: ${supportedVersion}.`
44818
44775
  async getTransactions(paginationArgs) {
44819
44776
  const {
44820
44777
  transactions: { edges, pageInfo }
44821
- } = await this.operations.getTransactions(paginationArgs);
44778
+ } = await this.operations.getTransactions({
44779
+ ...this.validatePaginationArgs({
44780
+ inputArgs: paginationArgs,
44781
+ paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
44782
+ })
44783
+ });
44822
44784
  const coder = new TransactionCoder();
44823
44785
  const transactions = edges.map(({ node: { rawPayload } }) => {
44824
44786
  try {
@@ -45074,6 +45036,40 @@ Supported fuel-core version: ${supportedVersion}.`
45074
45036
  });
45075
45037
  return bn(latestBlockHeight);
45076
45038
  }
45039
+ /**
45040
+ * Check if the given ID is an account.
45041
+ *
45042
+ * @param id - The ID to check.
45043
+ * @returns A promise that resolves to the result of the check.
45044
+ */
45045
+ async isUserAccount(id) {
45046
+ const { contract, blob, transaction } = await this.operations.isUserAccount({
45047
+ blobId: id,
45048
+ contractId: id,
45049
+ transactionId: id
45050
+ });
45051
+ if (contract || blob || transaction) {
45052
+ return false;
45053
+ }
45054
+ return true;
45055
+ }
45056
+ async getAddressType(id) {
45057
+ const { contract, blob, transaction } = await this.operations.isUserAccount({
45058
+ blobId: id,
45059
+ contractId: id,
45060
+ transactionId: id
45061
+ });
45062
+ if (contract) {
45063
+ return "Contract";
45064
+ }
45065
+ if (blob) {
45066
+ return "Blob";
45067
+ }
45068
+ if (transaction) {
45069
+ return "Transaction";
45070
+ }
45071
+ return "Account";
45072
+ }
45077
45073
  /**
45078
45074
  * Get the transaction response for the given transaction ID.
45079
45075
  *