@fuel-ts/account 0.94.9 → 0.96.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.96.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,38 @@ 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
+ if (!isB256(address)) {
33035
+ throw new Error("Invalid B256 Address");
33036
+ }
33037
+ const addressHex = hexlify(address).toLowerCase().slice(2);
33038
+ const checksum = sha256(addressHex);
33039
+ let ret2 = "0x";
33040
+ for (let i = 0; i < 32; ++i) {
33041
+ const byte = checksum[i];
33042
+ const ha = addressHex.charAt(i * 2);
33043
+ const hb = addressHex.charAt(i * 2 + 1);
33044
+ ret2 += (byte & 240) >= 128 ? ha.toUpperCase() : ha;
33045
+ ret2 += (byte & 15) >= 8 ? hb.toUpperCase() : hb;
33046
+ }
33047
+ return ret2;
33048
+ }
32998
33049
  };
32999
33050
 
33000
33051
  // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/utils.js
@@ -39849,6 +39900,26 @@ ${DryRunSuccessStatusFragmentDoc}`;
39849
39900
  }
39850
39901
  ${DryRunTransactionStatusFragmentDoc}
39851
39902
  ${ReceiptFragmentDoc}`;
39903
+ var BlockFragmentDoc = lib_default2`
39904
+ fragment blockFragment on Block {
39905
+ id
39906
+ height
39907
+ header {
39908
+ time
39909
+ daHeight
39910
+ stateTransitionBytecodeVersion
39911
+ transactionsCount
39912
+ transactionsRoot
39913
+ messageOutboxRoot
39914
+ eventInboxRoot
39915
+ prevRoot
39916
+ applicationHash
39917
+ }
39918
+ transactions {
39919
+ id
39920
+ }
39921
+ }
39922
+ `;
39852
39923
  var CoinFragmentDoc = lib_default2`
39853
39924
  fragment coinFragment on Coin {
39854
39925
  type: __typename
@@ -39928,33 +39999,6 @@ ${ReceiptFragmentDoc}`;
39928
39999
  nonce
39929
40000
  amount
39930
40001
  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
40002
  }
39959
40003
  `;
39960
40004
  var TxParametersFragmentDoc = lib_default2`
@@ -40014,167 +40058,6 @@ ${ReceiptFragmentDoc}`;
40014
40058
  `;
40015
40059
  var GasCostsFragmentDoc = lib_default2`
40016
40060
  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
40061
  contractRoot {
40179
40062
  ...DependentCostFragment
40180
40063
  }
@@ -40184,6 +40067,10 @@ ${ReceiptFragmentDoc}`;
40184
40067
  vmInitialization {
40185
40068
  ...DependentCostFragment
40186
40069
  }
40070
+ s256 {
40071
+ ...DependentCostFragment
40072
+ }
40073
+ ecr1
40187
40074
  newStoragePerByte
40188
40075
  }
40189
40076
  ${DependentCostFragmentDoc}`;
@@ -40220,16 +40107,12 @@ ${GasCostsFragmentDoc}`;
40220
40107
  var ChainInfoFragmentDoc = lib_default2`
40221
40108
  fragment chainInfoFragment on ChainInfo {
40222
40109
  name
40223
- latestBlock {
40224
- ...blockFragment
40225
- }
40226
40110
  daHeight
40227
40111
  consensusParameters {
40228
40112
  ...consensusParametersFragment
40229
40113
  }
40230
40114
  }
40231
- ${BlockFragmentDoc}
40232
- ${ConsensusParametersFragmentDoc}`;
40115
+ ${ConsensusParametersFragmentDoc}`;
40233
40116
  var ContractBalanceFragmentDoc = lib_default2`
40234
40117
  fragment contractBalanceFragment on ContractBalance {
40235
40118
  contract
@@ -40260,6 +40143,12 @@ ${ConsensusParametersFragmentDoc}`;
40260
40143
  blockHeight
40261
40144
  failure
40262
40145
  }
40146
+ }
40147
+ `;
40148
+ var TransactionRawPayloadFragmentDoc = lib_default2`
40149
+ fragment transactionRawPayload on Transaction {
40150
+ id
40151
+ rawPayload
40263
40152
  }
40264
40153
  `;
40265
40154
  var GetVersionDocument = lib_default2`
@@ -40283,6 +40172,17 @@ ${ConsensusParametersFragmentDoc}`;
40283
40172
  }
40284
40173
  }
40285
40174
  ${ChainInfoFragmentDoc}`;
40175
+ var GetChainAndNodeInfoDocument = lib_default2`
40176
+ query getChainAndNodeInfo {
40177
+ chain {
40178
+ ...chainInfoFragment
40179
+ }
40180
+ nodeInfo {
40181
+ ...nodeInfoFragment
40182
+ }
40183
+ }
40184
+ ${ChainInfoFragmentDoc}
40185
+ ${NodeInfoFragmentDoc}`;
40286
40186
  var GetTransactionDocument = lib_default2`
40287
40187
  query getTransaction($transactionId: TransactionId!) {
40288
40188
  transaction(id: $transactionId) {
@@ -40340,6 +40240,24 @@ ${TransactionFragmentDoc}`;
40340
40240
  }
40341
40241
  }
40342
40242
  ${TransactionEstimatePredicatesFragmentDoc}`;
40243
+ var GetLatestBlockDocument = lib_default2`
40244
+ query getLatestBlock {
40245
+ chain {
40246
+ latestBlock {
40247
+ ...blockFragment
40248
+ }
40249
+ }
40250
+ }
40251
+ ${BlockFragmentDoc}`;
40252
+ var GetLatestBlockHeightDocument = lib_default2`
40253
+ query getLatestBlockHeight {
40254
+ chain {
40255
+ latestBlock {
40256
+ height
40257
+ }
40258
+ }
40259
+ }
40260
+ `;
40343
40261
  var GetBlockDocument = lib_default2`
40344
40262
  query getBlock($blockId: BlockId, $height: U32) {
40345
40263
  block(id: $blockId, height: $height) {
@@ -40352,12 +40270,12 @@ ${TransactionFragmentDoc}`;
40352
40270
  block(id: $blockId, height: $blockHeight) {
40353
40271
  ...blockFragment
40354
40272
  transactions {
40355
- ...transactionFragment
40273
+ ...transactionRawPayload
40356
40274
  }
40357
40275
  }
40358
40276
  }
40359
40277
  ${BlockFragmentDoc}
40360
- ${TransactionFragmentDoc}`;
40278
+ ${TransactionRawPayloadFragmentDoc}`;
40361
40279
  var GetBlocksDocument = lib_default2`
40362
40280
  query getBlocks($after: String, $before: String, $first: Int, $last: Int) {
40363
40281
  blocks(after: $after, before: $before, first: $first, last: $last) {
@@ -40432,10 +40350,10 @@ ${MessageCoinFragmentDoc}`;
40432
40350
  var GetBalanceDocument = lib_default2`
40433
40351
  query getBalance($owner: Address!, $assetId: AssetId!) {
40434
40352
  balance(owner: $owner, assetId: $assetId) {
40435
- ...balanceFragment
40353
+ amount
40436
40354
  }
40437
40355
  }
40438
- ${BalanceFragmentDoc}`;
40356
+ `;
40439
40357
  var GetLatestGasPriceDocument = lib_default2`
40440
40358
  query getLatestGasPrice {
40441
40359
  latestGasPrice {
@@ -40464,13 +40382,13 @@ ${MessageCoinFragmentDoc}`;
40464
40382
  }
40465
40383
  edges {
40466
40384
  node {
40467
- ...balanceFragment
40385
+ assetId
40386
+ amount
40468
40387
  }
40469
40388
  }
40470
40389
  }
40471
40390
  }
40472
- ${PageInfoFragmentDoc}
40473
- ${BalanceFragmentDoc}`;
40391
+ ${PageInfoFragmentDoc}`;
40474
40392
  var GetMessagesDocument = lib_default2`
40475
40393
  query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
40476
40394
  messages(
@@ -40551,6 +40469,19 @@ ${MessageFragmentDoc}`;
40551
40469
  }
40552
40470
  }
40553
40471
  ${MessageFragmentDoc}`;
40472
+ var IsUserAccountDocument = lib_default2`
40473
+ query isUserAccount($blobId: BlobId!, $contractId: ContractId!, $transactionId: TransactionId!) {
40474
+ blob(id: $blobId) {
40475
+ id
40476
+ }
40477
+ contract(id: $contractId) {
40478
+ id
40479
+ }
40480
+ transaction(id: $transactionId) {
40481
+ id
40482
+ }
40483
+ }
40484
+ `;
40554
40485
  var SubmitAndAwaitDocument = lib_default2`
40555
40486
  subscription submitAndAwait($encodedTransaction: HexString!) {
40556
40487
  submitAndAwait(tx: $encodedTransaction) {
@@ -40583,6 +40514,9 @@ ${MessageFragmentDoc}`;
40583
40514
  getChain(variables, options) {
40584
40515
  return requester(GetChainDocument, variables, options);
40585
40516
  },
40517
+ getChainAndNodeInfo(variables, options) {
40518
+ return requester(GetChainAndNodeInfoDocument, variables, options);
40519
+ },
40586
40520
  getTransaction(variables, options) {
40587
40521
  return requester(GetTransactionDocument, variables, options);
40588
40522
  },
@@ -40598,6 +40532,12 @@ ${MessageFragmentDoc}`;
40598
40532
  estimatePredicates(variables, options) {
40599
40533
  return requester(EstimatePredicatesDocument, variables, options);
40600
40534
  },
40535
+ getLatestBlock(variables, options) {
40536
+ return requester(GetLatestBlockDocument, variables, options);
40537
+ },
40538
+ getLatestBlockHeight(variables, options) {
40539
+ return requester(GetLatestBlockHeightDocument, variables, options);
40540
+ },
40601
40541
  getBlock(variables, options) {
40602
40542
  return requester(GetBlockDocument, variables, options);
40603
40543
  },
@@ -40658,6 +40598,9 @@ ${MessageFragmentDoc}`;
40658
40598
  getMessageByNonce(variables, options) {
40659
40599
  return requester(GetMessageByNonceDocument, variables, options);
40660
40600
  },
40601
+ isUserAccount(variables, options) {
40602
+ return requester(IsUserAccountDocument, variables, options);
40603
+ },
40661
40604
  submitAndAwait(variables, options) {
40662
40605
  return requester(SubmitAndAwaitDocument, variables, options);
40663
40606
  },
@@ -43802,10 +43745,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43802
43745
  // src/providers/provider.ts
43803
43746
  var MAX_RETRIES = 10;
43804
43747
  var RESOURCES_PAGE_SIZE_LIMIT = 512;
43748
+ var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
43805
43749
  var BLOCKS_PAGE_SIZE_LIMIT = 5;
43806
43750
  var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
43807
43751
  var processGqlChain = (chain) => {
43808
- const { name, daHeight, consensusParameters, latestBlock } = chain;
43752
+ const { name, daHeight, consensusParameters } = chain;
43809
43753
  const {
43810
43754
  contractParams,
43811
43755
  feeParams,
@@ -43856,14 +43800,6 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43856
43800
  maxScriptDataLength: bn(scriptParams.maxScriptDataLength)
43857
43801
  },
43858
43802
  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
43803
  }
43868
43804
  };
43869
43805
  };
@@ -43894,14 +43830,17 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
43894
43830
  retryOptions: void 0,
43895
43831
  headers: void 0
43896
43832
  });
43897
- const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
43833
+ const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
43898
43834
  this.url = rawUrl;
43899
43835
  this.urlWithoutAuth = urlWithoutAuth;
43900
- this.options = { ...this.options, ...options };
43901
43836
  this.url = url;
43902
- if (headers) {
43903
- this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
43904
- }
43837
+ const { FUELS } = versions;
43838
+ const headers = { ...authHeaders, ...options.headers, Source: `ts-sdk-${FUELS}` };
43839
+ this.options = {
43840
+ ...this.options,
43841
+ ...options,
43842
+ headers
43843
+ };
43905
43844
  this.operations = this.createOperations();
43906
43845
  const { resourceCacheTTL } = this.options;
43907
43846
  if (isDefined(resourceCacheTTL)) {
@@ -44040,9 +43979,25 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44040
43979
  * @returns A promise that resolves to the Chain and NodeInfo.
44041
43980
  */
44042
43981
  async fetchChainAndNodeInfo() {
44043
- const nodeInfo = await this.fetchNode();
44044
- _Provider.ensureClientVersionIsSupported(nodeInfo);
44045
- const chain = await this.fetchChain();
43982
+ let nodeInfo;
43983
+ let chain;
43984
+ try {
43985
+ nodeInfo = this.getNode();
43986
+ chain = this.getChain();
43987
+ } catch (error) {
43988
+ const data = await this.operations.getChainAndNodeInfo();
43989
+ nodeInfo = {
43990
+ maxDepth: bn(data.nodeInfo.maxDepth),
43991
+ maxTx: bn(data.nodeInfo.maxTx),
43992
+ nodeVersion: data.nodeInfo.nodeVersion,
43993
+ utxoValidation: data.nodeInfo.utxoValidation,
43994
+ vmBacktrace: data.nodeInfo.vmBacktrace
43995
+ };
43996
+ _Provider.ensureClientVersionIsSupported(nodeInfo);
43997
+ chain = processGqlChain(data.chain);
43998
+ _Provider.chainInfoCache[this.urlWithoutAuth] = chain;
43999
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
44000
+ }
44046
44001
  return {
44047
44002
  chain,
44048
44003
  nodeInfo
@@ -44134,8 +44089,12 @@ Supported fuel-core version: ${supportedVersion}.`
44134
44089
  * @returns A promise that resolves to the latest block number.
44135
44090
  */
44136
44091
  async getBlockNumber() {
44137
- const { chain } = await this.operations.getChain();
44138
- return bn(chain.latestBlock.height, 10);
44092
+ const {
44093
+ chain: {
44094
+ latestBlock: { height }
44095
+ }
44096
+ } = await this.operations.getLatestBlockHeight();
44097
+ return bn(height);
44139
44098
  }
44140
44099
  /**
44141
44100
  * Returns the node information for the current provider network.
@@ -44682,17 +44641,18 @@ Supported fuel-core version: ${supportedVersion}.`
44682
44641
  * @returns A promise that resolves to the block or null.
44683
44642
  */
44684
44643
  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 };
44644
+ let block2;
44645
+ if (idOrHeight === "latest") {
44646
+ const {
44647
+ chain: { latestBlock }
44648
+ } = await this.operations.getLatestBlock();
44649
+ block2 = latestBlock;
44692
44650
  } else {
44693
- variables = { blockId: bn(idOrHeight).toString(10) };
44651
+ const isblockId = typeof idOrHeight === "string" && idOrHeight.length === 66;
44652
+ const variables = isblockId ? { blockId: idOrHeight } : { height: bn(idOrHeight).toString(10) };
44653
+ const response = await this.operations.getBlock(variables);
44654
+ block2 = response.block;
44694
44655
  }
44695
- const { block: block2 } = await this.operations.getBlock(variables);
44696
44656
  if (!block2) {
44697
44657
  return null;
44698
44658
  }
@@ -44818,7 +44778,12 @@ Supported fuel-core version: ${supportedVersion}.`
44818
44778
  async getTransactions(paginationArgs) {
44819
44779
  const {
44820
44780
  transactions: { edges, pageInfo }
44821
- } = await this.operations.getTransactions(paginationArgs);
44781
+ } = await this.operations.getTransactions({
44782
+ ...this.validatePaginationArgs({
44783
+ inputArgs: paginationArgs,
44784
+ paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
44785
+ })
44786
+ });
44822
44787
  const coder = new TransactionCoder();
44823
44788
  const transactions = edges.map(({ node: { rawPayload } }) => {
44824
44789
  try {
@@ -45074,6 +45039,40 @@ Supported fuel-core version: ${supportedVersion}.`
45074
45039
  });
45075
45040
  return bn(latestBlockHeight);
45076
45041
  }
45042
+ /**
45043
+ * Check if the given ID is an account.
45044
+ *
45045
+ * @param id - The ID to check.
45046
+ * @returns A promise that resolves to the result of the check.
45047
+ */
45048
+ async isUserAccount(id) {
45049
+ const { contract, blob, transaction } = await this.operations.isUserAccount({
45050
+ blobId: id,
45051
+ contractId: id,
45052
+ transactionId: id
45053
+ });
45054
+ if (contract || blob || transaction) {
45055
+ return false;
45056
+ }
45057
+ return true;
45058
+ }
45059
+ async getAddressType(id) {
45060
+ const { contract, blob, transaction } = await this.operations.isUserAccount({
45061
+ blobId: id,
45062
+ contractId: id,
45063
+ transactionId: id
45064
+ });
45065
+ if (contract) {
45066
+ return "Contract";
45067
+ }
45068
+ if (blob) {
45069
+ return "Blob";
45070
+ }
45071
+ if (transaction) {
45072
+ return "Transaction";
45073
+ }
45074
+ return "Account";
45075
+ }
45077
45076
  /**
45078
45077
  * Get the transaction response for the given transaction ID.
45079
45078
  *