@fuel-ts/account 0.0.0-rc-1832-20240404143349 → 0.0.0-rc-1976-20240404170833

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.

@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAItD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AASrB,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,4BAA4B,EAC5B,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,cAAc,CACjE,CAAC;AAEF;;GAEG;AACH,qBAAa,OAAQ,SAAQ,eAAe;IAC1C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC;;OAEG;IACH,SAAS,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC;IAE/B,SAAS,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;IAErC;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,aAAa;IAO7F;;;;;;OAMG;IACH,IAAI,QAAQ,IAAI,QAA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GAAG,OAAO,CAAC,MAAM,CAAC;IAOnD;;;;;OAKG;IACG,eAAe,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAUtF;;;;;OAKG;IACG,eAAe,CACnB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,cAAc,EAAE,GAAE,oBAAyB,GAC3E,OAAO,CAAC,mBAAmB,CAAC;IAgB/B;;;;;OAKG;IACG,mBAAmB,CACvB,sBAAsB,EAAE,sBAAsB,EAC9C,EAAE,sBAA6B,EAAE,GAAE,yBAA8B,GAChE,OAAO,CAAC,UAAU,CAAC;IAQtB,OAAO,CAAC,WAAW;CAyBpB"}
@@ -31271,10 +31271,6 @@ This unreleased fuel-core build may include features and updates not yet support
31271
31271
  }
31272
31272
  };
31273
31273
 
31274
- // ../address/dist/configs.mjs
31275
- var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
31276
- var BaseAssetId = ZeroBytes32;
31277
-
31278
31274
  // ../math/dist/index.mjs
31279
31275
  var import_bn = __toESM(require_bn(), 1);
31280
31276
  var DEFAULT_PRECISION = 9;
@@ -31505,11 +31501,11 @@ This unreleased fuel-core build may include features and updates not yet support
31505
31501
  let max2;
31506
31502
  if (Array.isArray(coinQuantityLike)) {
31507
31503
  amount = coinQuantityLike[0];
31508
- assetId = coinQuantityLike[1] ?? BaseAssetId;
31509
- max2 = coinQuantityLike[2] ?? void 0;
31504
+ assetId = coinQuantityLike[1];
31505
+ max2 = coinQuantityLike[2];
31510
31506
  } else {
31511
31507
  amount = coinQuantityLike.amount;
31512
- assetId = coinQuantityLike.assetId ?? BaseAssetId;
31508
+ assetId = coinQuantityLike.assetId;
31513
31509
  max2 = coinQuantityLike.max ?? void 0;
31514
31510
  }
31515
31511
  const bnAmount = bn(amount);
@@ -38865,6 +38861,9 @@ ${MessageCoinFragmentFragmentDoc}`;
38865
38861
  }
38866
38862
  };
38867
38863
 
38864
+ // ../address/dist/configs.mjs
38865
+ var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
38866
+
38868
38867
  // src/providers/transaction-request/input.ts
38869
38868
  var inputify = (value) => {
38870
38869
  const { type: type3 } = value;
@@ -39541,6 +39540,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39541
39540
  outputs = [];
39542
39541
  /** List of witnesses */
39543
39542
  witnesses = [];
39543
+ /** Base asset ID - should be fetched from the chain */
39544
+ baseAssetId = ZeroBytes32;
39544
39545
  /**
39545
39546
  * Constructor for initializing a base transaction request.
39546
39547
  *
@@ -39553,7 +39554,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39553
39554
  witnessLimit,
39554
39555
  inputs,
39555
39556
  outputs,
39556
- witnesses
39557
+ witnesses,
39558
+ baseAssetId
39557
39559
  } = {}) {
39558
39560
  this.gasPrice = bn(gasPrice);
39559
39561
  this.maturity = maturity ?? 0;
@@ -39562,6 +39564,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39562
39564
  this.inputs = inputs ?? [];
39563
39565
  this.outputs = outputs ?? [];
39564
39566
  this.witnesses = witnesses ?? [];
39567
+ this.baseAssetId = baseAssetId ?? ZeroBytes32;
39565
39568
  }
39566
39569
  static getPolicyMeta(req) {
39567
39570
  let policyTypes = 0;
@@ -39786,11 +39789,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39786
39789
  *
39787
39790
  * @param message - Message resource.
39788
39791
  * @param predicate - Predicate bytes.
39789
- * @param predicateData - Predicate data bytes.
39790
39792
  */
39791
39793
  addMessageInput(message, predicate) {
39792
39794
  const { recipient, sender, amount } = message;
39793
- const assetId = BaseAssetId;
39794
39795
  let witnessIndex;
39795
39796
  if (predicate) {
39796
39797
  witnessIndex = 0;
@@ -39811,7 +39812,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39811
39812
  predicateData: predicate?.predicateDataBytes
39812
39813
  };
39813
39814
  this.pushInput(input);
39814
- this.addChangeOutput(recipient, assetId);
39815
+ this.addChangeOutput(recipient, this.baseAssetId);
39815
39816
  }
39816
39817
  /**
39817
39818
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -39872,12 +39873,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39872
39873
  * @param amount - Amount of coin.
39873
39874
  * @param assetId - Asset ID of coin.
39874
39875
  */
39875
- addCoinOutput(to, amount, assetId = BaseAssetId) {
39876
+ addCoinOutput(to, amount, assetId) {
39876
39877
  this.pushOutput({
39877
39878
  type: OutputType.Coin,
39878
39879
  to: addressify(to).toB256(),
39879
39880
  amount,
39880
- assetId
39881
+ assetId: assetId ?? this.baseAssetId
39881
39882
  });
39882
39883
  return this;
39883
39884
  }
@@ -39904,7 +39905,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39904
39905
  * @param to - Address of the owner.
39905
39906
  * @param assetId - Asset ID of coin.
39906
39907
  */
39907
- addChangeOutput(to, assetId = BaseAssetId) {
39908
+ addChangeOutput(to, assetId) {
39908
39909
  const changeOutput = this.getChangeOutputs().find(
39909
39910
  (output3) => hexlify(output3.assetId) === assetId
39910
39911
  );
@@ -39912,7 +39913,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39912
39913
  this.pushOutput({
39913
39914
  type: OutputType.Change,
39914
39915
  to: addressify(to).toB256(),
39915
- assetId
39916
+ assetId: assetId ?? this.baseAssetId
39916
39917
  });
39917
39918
  }
39918
39919
  }
@@ -39994,7 +39995,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39994
39995
  ]);
39995
39996
  }
39996
39997
  };
39997
- updateAssetInput(BaseAssetId, bn(1e11));
39998
+ updateAssetInput(this.baseAssetId, bn(1e11));
39998
39999
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
39999
40000
  }
40000
40001
  /**
@@ -41417,6 +41418,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41417
41418
  gasPerByte: bn(feeParams.gasPerByte),
41418
41419
  maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
41419
41420
  chainId: bn(consensusParameters.chainId),
41421
+ baseAssetId: consensusParameters.baseAssetId,
41420
41422
  gasCosts
41421
41423
  },
41422
41424
  gasCosts,
@@ -41659,6 +41661,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41659
41661
  } = this.getChain();
41660
41662
  return chainId.toNumber();
41661
41663
  }
41664
+ /**
41665
+ * Returns the base asset ID
41666
+ *
41667
+ * @returns A promise that resolves to the base asset ID
41668
+ */
41669
+ getBaseAssetId() {
41670
+ const {
41671
+ consensusParameters: { baseAssetId }
41672
+ } = this.getChain();
41673
+ return baseAssetId;
41674
+ }
41662
41675
  /**
41663
41676
  * Submits a transaction to the chain to be executed.
41664
41677
  *
@@ -42688,8 +42701,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42688
42701
  * @param assetId - The asset ID to check the balance for.
42689
42702
  * @returns A promise that resolves to the balance amount.
42690
42703
  */
42691
- async getBalance(assetId = BaseAssetId) {
42692
- const amount = await this.provider.getBalance(this.address, assetId);
42704
+ async getBalance(assetId) {
42705
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
42706
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
42693
42707
  return amount;
42694
42708
  }
42695
42709
  /**
@@ -42727,9 +42741,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42727
42741
  * @returns A promise that resolves when the resources are added to the transaction.
42728
42742
  */
42729
42743
  async fund(request, coinQuantities, fee) {
42744
+ const baseAssetId = this.provider.getBaseAssetId();
42730
42745
  const updatedQuantities = addAmountToAsset({
42731
42746
  amount: bn(fee),
42732
- assetId: BaseAssetId,
42747
+ assetId: baseAssetId,
42733
42748
  coinQuantities
42734
42749
  });
42735
42750
  const quantitiesDict = {};
@@ -42753,8 +42768,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42753
42768
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
42754
42769
  cachedUtxos.push(input.id);
42755
42770
  }
42756
- } else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
42757
- quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
42771
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
42772
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
42758
42773
  cachedMessages.push(input.nonce);
42759
42774
  }
42760
42775
  }
@@ -42786,11 +42801,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42786
42801
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
42787
42802
  * @returns A promise that resolves to the prepared transaction request.
42788
42803
  */
42789
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
42804
+ async createTransfer(destination, amount, assetId, txParams = {}) {
42790
42805
  const { minGasPrice } = this.provider.getGasConfig();
42806
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42791
42807
  const params = { gasPrice: minGasPrice, ...txParams };
42792
42808
  const request = new ScriptTransactionRequest(params);
42793
- request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
42809
+ request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
42794
42810
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
42795
42811
  estimateTxDependencies: true,
42796
42812
  resourcesOwner: this
@@ -42816,14 +42832,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42816
42832
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
42817
42833
  * @returns A promise that resolves to the transaction response.
42818
42834
  */
42819
- async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
42835
+ async transfer(destination, amount, assetId, txParams = {}) {
42820
42836
  if (bn(amount).lte(0)) {
42821
42837
  throw new FuelError(
42822
42838
  ErrorCode.INVALID_TRANSFER_AMOUNT,
42823
42839
  "Transfer amount must be a positive number."
42824
42840
  );
42825
42841
  }
42826
- const request = await this.createTransfer(destination, amount, assetId, txParams);
42842
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42843
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
42827
42844
  return this.sendTransaction(request, { estimateTxDependencies: false });
42828
42845
  }
42829
42846
  /**
@@ -42835,7 +42852,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42835
42852
  * @param txParams - The optional transaction parameters.
42836
42853
  * @returns A promise that resolves to the transaction response.
42837
42854
  */
42838
- async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
42855
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
42839
42856
  if (bn(amount).lte(0)) {
42840
42857
  throw new FuelError(
42841
42858
  ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -42844,11 +42861,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42844
42861
  }
42845
42862
  const contractAddress = Address.fromAddressOrString(contractId);
42846
42863
  const { minGasPrice } = this.provider.getGasConfig();
42864
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
42847
42865
  const params = { gasPrice: minGasPrice, ...txParams };
42848
42866
  const { script, scriptData } = await assembleTransferToContractScript({
42849
42867
  hexlifiedContractId: contractAddress.toB256(),
42850
42868
  amountToTransfer: bn(amount),
42851
- assetId
42869
+ assetId: assetIdToTransfer
42852
42870
  });
42853
42871
  const request = new ScriptTransactionRequest({
42854
42872
  ...params,
@@ -42858,7 +42876,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42858
42876
  request.addContractInputAndOutput(contractAddress);
42859
42877
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
42860
42878
  request,
42861
- [{ amount: bn(amount), assetId: String(assetId) }]
42879
+ [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
42862
42880
  );
42863
42881
  request.gasLimit = bn(params.gasLimit ?? gasUsed);
42864
42882
  this.validateGas({
@@ -42880,6 +42898,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42880
42898
  */
42881
42899
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
42882
42900
  const { minGasPrice } = this.provider.getGasConfig();
42901
+ const baseAssetId = this.provider.getBaseAssetId();
42883
42902
  const recipientAddress = Address.fromAddressOrString(recipient);
42884
42903
  const recipientDataArray = arrayify(
42885
42904
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -42894,7 +42913,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42894
42913
  ]);
42895
42914
  const params = { script, gasPrice: minGasPrice, ...txParams };
42896
42915
  const request = new ScriptTransactionRequest(params);
42897
- const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
42916
+ const forwardingQuantities = [{ amount: bn(amount), assetId: baseAssetId }];
42898
42917
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
42899
42918
  request,
42900
42919
  forwardingQuantities
@@ -47858,8 +47877,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47858
47877
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
47859
47878
  * @returns A promise that resolves to the prepared transaction request.
47860
47879
  */
47861
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
47862
- const request = await super.createTransfer(destination, amount, assetId, txParams);
47880
+ async createTransfer(destination, amount, assetId, txParams = {}) {
47881
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
47882
+ const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
47863
47883
  return this.populateTransactionPredicateData(request);
47864
47884
  }
47865
47885
  /**