@fuel-ts/account 0.0.0-rc-2037-20240417234504 → 0.0.0-rc-1976-20240418110250

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.

Files changed (45) hide show
  1. package/dist/account.d.ts.map +1 -1
  2. package/dist/index.global.js +101 -125
  3. package/dist/index.global.js.map +1 -1
  4. package/dist/index.js +241 -280
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +126 -159
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/predicate/predicate.d.ts +2 -11
  9. package/dist/predicate/predicate.d.ts.map +1 -1
  10. package/dist/providers/coin-quantity.d.ts +2 -2
  11. package/dist/providers/coin-quantity.d.ts.map +1 -1
  12. package/dist/providers/coin.d.ts +1 -2
  13. package/dist/providers/coin.d.ts.map +1 -1
  14. package/dist/providers/message.d.ts +0 -1
  15. package/dist/providers/message.d.ts.map +1 -1
  16. package/dist/providers/provider.d.ts +7 -0
  17. package/dist/providers/provider.d.ts.map +1 -1
  18. package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
  19. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  20. package/dist/providers/transaction-request/index.d.ts +0 -1
  21. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  22. package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -1
  23. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  24. package/dist/providers/transaction-request/transaction-request.d.ts +25 -6
  25. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  26. package/dist/test-utils/index.d.ts +0 -1
  27. package/dist/test-utils/index.d.ts.map +1 -1
  28. package/dist/test-utils/launchNode.d.ts.map +1 -1
  29. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  30. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  31. package/dist/test-utils.global.js +106 -105
  32. package/dist/test-utils.global.js.map +1 -1
  33. package/dist/test-utils.js +238 -253
  34. package/dist/test-utils.js.map +1 -1
  35. package/dist/test-utils.mjs +129 -141
  36. package/dist/test-utils.mjs.map +1 -1
  37. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  38. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  39. package/package.json +15 -15
  40. package/dist/providers/transaction-request/helpers.d.ts +0 -10
  41. package/dist/providers/transaction-request/helpers.d.ts.map +0 -1
  42. package/dist/test-utils/resources.d.ts +0 -4
  43. package/dist/test-utils/resources.d.ts.map +0 -1
  44. package/dist/test-utils/transactionRequest.d.ts +0 -5
  45. package/dist/test-utils/transactionRequest.d.ts.map +0 -1
@@ -31916,7 +31916,7 @@ spurious results.`);
31916
31916
  return {
31917
31917
  FORC: "0.49.3",
31918
31918
  FUEL_CORE: "0.22.1",
31919
- FUELS: "0.80.0"
31919
+ FUELS: "0.81.0"
31920
31920
  };
31921
31921
  }
31922
31922
  function parseVersion(version2) {
@@ -32486,7 +32486,8 @@ This unreleased fuel-core build may include features and updates not yet support
32486
32486
  fee_params: {
32487
32487
  gas_price_factor: 92,
32488
32488
  gas_per_byte: 4
32489
- }
32489
+ },
32490
+ base_asset_id: "0x0000000000000000000000000000000000000000000000000000000000000000"
32490
32491
  },
32491
32492
  gas_costs: {
32492
32493
  add: 1,
@@ -34755,10 +34756,6 @@ This unreleased fuel-core build may include features and updates not yet support
34755
34756
  }
34756
34757
  };
34757
34758
 
34758
- // ../address/dist/configs.mjs
34759
- var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
34760
- var BaseAssetId = ZeroBytes32;
34761
-
34762
34759
  // ../math/dist/index.mjs
34763
34760
  var import_bn = __toESM(require_bn(), 1);
34764
34761
  var DEFAULT_PRECISION = 9;
@@ -34989,11 +34986,11 @@ This unreleased fuel-core build may include features and updates not yet support
34989
34986
  let max2;
34990
34987
  if (Array.isArray(coinQuantityLike)) {
34991
34988
  amount = coinQuantityLike[0];
34992
- assetId = coinQuantityLike[1] ?? BaseAssetId;
34993
- max2 = coinQuantityLike[2] ?? void 0;
34989
+ assetId = coinQuantityLike[1];
34990
+ max2 = coinQuantityLike[2];
34994
34991
  } else {
34995
34992
  amount = coinQuantityLike.amount;
34996
- assetId = coinQuantityLike.assetId ?? BaseAssetId;
34993
+ assetId = coinQuantityLike.assetId;
34997
34994
  max2 = coinQuantityLike.max ?? void 0;
34998
34995
  }
34999
34996
  const bnAmount = bn(amount);
@@ -42339,6 +42336,9 @@ ${MessageCoinFragmentFragmentDoc}`;
42339
42336
  }
42340
42337
  };
42341
42338
 
42339
+ // ../address/dist/configs.mjs
42340
+ var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
42341
+
42342
42342
  // src/providers/transaction-request/input.ts
42343
42343
  var inputify = (value) => {
42344
42344
  const { type: type3 } = value;
@@ -42914,11 +42914,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42914
42914
  name = "NoWitnessAtIndexError";
42915
42915
  };
42916
42916
 
42917
- // src/providers/transaction-request/helpers.ts
42918
- var isRequestInputCoin = (input) => input.type === InputType.Coin;
42919
- var isRequestInputMessage = (input) => input.type === InputType.Message;
42920
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
42921
-
42922
42917
  // src/providers/transaction-request/witness.ts
42923
42918
  var witnessify = (value) => {
42924
42919
  const data = arrayify(value);
@@ -42944,6 +42939,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42944
42939
  outputs = [];
42945
42940
  /** List of witnesses */
42946
42941
  witnesses = [];
42942
+ /** Base asset ID - should be fetched from the chain */
42943
+ baseAssetId;
42947
42944
  /**
42948
42945
  * Constructor for initializing a base transaction request.
42949
42946
  *
@@ -42956,8 +42953,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42956
42953
  witnessLimit,
42957
42954
  inputs,
42958
42955
  outputs,
42959
- witnesses
42960
- } = {}) {
42956
+ witnesses,
42957
+ baseAssetId
42958
+ }) {
42961
42959
  this.gasPrice = bn(gasPrice);
42962
42960
  this.maturity = maturity ?? 0;
42963
42961
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
@@ -42965,6 +42963,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42965
42963
  this.inputs = inputs ?? [];
42966
42964
  this.outputs = outputs ?? [];
42967
42965
  this.witnesses = witnesses ?? [];
42966
+ this.baseAssetId = baseAssetId;
42968
42967
  }
42969
42968
  static getPolicyMeta(req) {
42970
42969
  let policyTypes = 0;
@@ -43158,8 +43157,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43158
43157
  * @param predicate - Predicate bytes.
43159
43158
  * @param predicateData - Predicate data bytes.
43160
43159
  */
43161
- addCoinInput(coin) {
43162
- const { assetId, owner, amount, id, predicate } = coin;
43160
+ addCoinInput(coin, predicate) {
43161
+ const { assetId, owner, amount } = coin;
43163
43162
  let witnessIndex;
43164
43163
  if (predicate) {
43165
43164
  witnessIndex = 0;
@@ -43170,14 +43169,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43170
43169
  }
43171
43170
  }
43172
43171
  const input = {
43173
- id,
43172
+ ...coin,
43174
43173
  type: InputType.Coin,
43175
43174
  owner: owner.toB256(),
43176
43175
  amount,
43177
43176
  assetId,
43178
43177
  txPointer: "0x00000000000000000000000000000000",
43179
43178
  witnessIndex,
43180
- predicate
43179
+ predicate: predicate?.bytes
43181
43180
  };
43182
43181
  this.pushInput(input);
43183
43182
  this.addChangeOutput(owner, assetId);
@@ -43188,11 +43187,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43188
43187
  *
43189
43188
  * @param message - Message resource.
43190
43189
  * @param predicate - Predicate bytes.
43191
- * @param predicateData - Predicate data bytes.
43192
43190
  */
43193
- addMessageInput(message) {
43194
- const { recipient, sender, amount, predicate, nonce } = message;
43195
- const assetId = BaseAssetId;
43191
+ addMessageInput(message, predicate) {
43192
+ const { recipient, sender, amount } = message;
43196
43193
  let witnessIndex;
43197
43194
  if (predicate) {
43198
43195
  witnessIndex = 0;
@@ -43203,16 +43200,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43203
43200
  }
43204
43201
  }
43205
43202
  const input = {
43206
- nonce,
43203
+ ...message,
43207
43204
  type: InputType.Message,
43208
43205
  sender: sender.toB256(),
43209
43206
  recipient: recipient.toB256(),
43210
43207
  amount,
43211
43208
  witnessIndex,
43212
- predicate
43209
+ predicate: predicate?.bytes
43213
43210
  };
43214
43211
  this.pushInput(input);
43215
- this.addChangeOutput(recipient, assetId);
43212
+ this.addChangeOutput(recipient, this.baseAssetId);
43216
43213
  }
43217
43214
  /**
43218
43215
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -43240,6 +43237,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43240
43237
  resources.forEach((resource) => this.addResource(resource));
43241
43238
  return this;
43242
43239
  }
43240
+ /**
43241
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
43242
+ * outputs from the related assetIds.
43243
+ *
43244
+ * @param resources - The resources to add.
43245
+ * @returns This transaction.
43246
+ */
43247
+ addPredicateResource(resource, predicate) {
43248
+ if (isCoin(resource)) {
43249
+ this.addCoinInput(resource, predicate);
43250
+ } else {
43251
+ this.addMessageInput(resource, predicate);
43252
+ }
43253
+ return this;
43254
+ }
43255
+ /**
43256
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
43257
+ * from the related assetIds.
43258
+ *
43259
+ * @param resources - The resources to add.
43260
+ * @returns This transaction.
43261
+ */
43262
+ addPredicateResources(resources, predicate) {
43263
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
43264
+ return this;
43265
+ }
43243
43266
  /**
43244
43267
  * Adds a coin output to the transaction.
43245
43268
  *
@@ -43247,12 +43270,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43247
43270
  * @param amount - Amount of coin.
43248
43271
  * @param assetId - Asset ID of coin.
43249
43272
  */
43250
- addCoinOutput(to, amount, assetId = BaseAssetId) {
43273
+ addCoinOutput(to, amount, assetId) {
43251
43274
  this.pushOutput({
43252
43275
  type: OutputType.Coin,
43253
43276
  to: addressify(to).toB256(),
43254
43277
  amount,
43255
- assetId
43278
+ assetId: assetId ?? this.baseAssetId
43256
43279
  });
43257
43280
  return this;
43258
43281
  }
@@ -43279,7 +43302,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43279
43302
  * @param to - Address of the owner.
43280
43303
  * @param assetId - Asset ID of coin.
43281
43304
  */
43282
- addChangeOutput(to, assetId = BaseAssetId) {
43305
+ addChangeOutput(to, assetId) {
43283
43306
  const changeOutput = this.getChangeOutputs().find(
43284
43307
  (output3) => hexlify(output3.assetId) === assetId
43285
43308
  );
@@ -43287,7 +43310,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43287
43310
  this.pushOutput({
43288
43311
  type: OutputType.Change,
43289
43312
  to: addressify(to).toB256(),
43290
- assetId
43313
+ assetId: assetId ?? this.baseAssetId
43291
43314
  });
43292
43315
  }
43293
43316
  }
@@ -43363,7 +43386,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43363
43386
  ]);
43364
43387
  }
43365
43388
  };
43366
- updateAssetInput(BaseAssetId, bn(1e11));
43389
+ updateAssetInput(this.baseAssetId, bn(1e11));
43367
43390
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
43368
43391
  }
43369
43392
  /**
@@ -43388,10 +43411,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43388
43411
  toJSON() {
43389
43412
  return normalizeJSON(this);
43390
43413
  }
43391
- removeWitness(index) {
43392
- this.witnesses.splice(index, 1);
43393
- this.adjustWitnessIndexes(index);
43394
- }
43395
43414
  updatePredicateInputs(inputs) {
43396
43415
  this.inputs.forEach((i) => {
43397
43416
  let correspondingInput;
@@ -43414,13 +43433,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43414
43433
  }
43415
43434
  });
43416
43435
  }
43417
- adjustWitnessIndexes(removedIndex) {
43418
- this.inputs.filter(isRequestInputResource).forEach((input) => {
43419
- if (input.witnessIndex > removedIndex) {
43420
- input.witnessIndex -= 1;
43421
- }
43422
- });
43423
- }
43424
43436
  };
43425
43437
 
43426
43438
  // src/providers/transaction-request/hash-transaction.ts
@@ -43531,12 +43543,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43531
43543
  *
43532
43544
  * @param createTransactionRequestLike - The initial values for the instance
43533
43545
  */
43534
- constructor({
43535
- bytecodeWitnessIndex,
43536
- salt,
43537
- storageSlots,
43538
- ...rest
43539
- } = {}) {
43546
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
43540
43547
  super(rest);
43541
43548
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
43542
43549
  this.salt = hexlify(salt ?? ZeroBytes32);
@@ -43651,7 +43658,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43651
43658
  *
43652
43659
  * @param scriptTransactionRequestLike - The initial values for the instance.
43653
43660
  */
43654
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
43661
+ constructor({ script, scriptData, gasLimit, ...rest }) {
43655
43662
  super(rest);
43656
43663
  this.gasLimit = bn(gasLimit);
43657
43664
  this.script = arrayify(script ?? returnZeroScript.bytes);
@@ -44750,6 +44757,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44750
44757
  gasPerByte: bn(feeParams.gasPerByte),
44751
44758
  maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
44752
44759
  chainId: bn(consensusParameters.chainId),
44760
+ baseAssetId: consensusParameters.baseAssetId,
44753
44761
  gasCosts
44754
44762
  },
44755
44763
  gasCosts,
@@ -44992,6 +45000,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44992
45000
  } = this.getChain();
44993
45001
  return chainId.toNumber();
44994
45002
  }
45003
+ /**
45004
+ * Returns the base asset ID
45005
+ *
45006
+ * @returns A promise that resolves to the base asset ID
45007
+ */
45008
+ getBaseAssetId() {
45009
+ const {
45010
+ consensusParameters: { baseAssetId }
45011
+ } = this.getChain();
45012
+ return baseAssetId;
45013
+ }
44995
45014
  /**
44996
45015
  * Submits a transaction to the chain to be executed.
44997
45016
  *
@@ -45880,8 +45899,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45880
45899
  * @param assetId - The asset ID to check the balance for.
45881
45900
  * @returns A promise that resolves to the balance amount.
45882
45901
  */
45883
- async getBalance(assetId = BaseAssetId) {
45884
- const amount = await this.provider.getBalance(this.address, assetId);
45902
+ async getBalance(assetId) {
45903
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
45904
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
45885
45905
  return amount;
45886
45906
  }
45887
45907
  /**
@@ -45919,9 +45939,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45919
45939
  * @returns A promise that resolves when the resources are added to the transaction.
45920
45940
  */
45921
45941
  async fund(request, coinQuantities, fee) {
45942
+ const baseAssetId = this.provider.getBaseAssetId();
45922
45943
  const updatedQuantities = addAmountToAsset({
45923
45944
  amount: bn(fee),
45924
- assetId: BaseAssetId,
45945
+ assetId: baseAssetId,
45925
45946
  coinQuantities
45926
45947
  });
45927
45948
  const quantitiesDict = {};
@@ -45945,8 +45966,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45945
45966
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
45946
45967
  cachedUtxos.push(input.id);
45947
45968
  }
45948
- } else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
45949
- quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
45969
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
45970
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
45950
45971
  cachedMessages.push(input.nonce);
45951
45972
  }
45952
45973
  }
@@ -45978,11 +45999,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45978
45999
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
45979
46000
  * @returns A promise that resolves to the prepared transaction request.
45980
46001
  */
45981
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
46002
+ async createTransfer(destination, amount, assetId, txParams = {}) {
45982
46003
  const { minGasPrice } = this.provider.getGasConfig();
45983
- const params = { gasPrice: minGasPrice, ...txParams };
46004
+ const baseAssetId = this.provider.getBaseAssetId();
46005
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
46006
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
45984
46007
  const request = new ScriptTransactionRequest(params);
45985
- request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
46008
+ request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
45986
46009
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
45987
46010
  estimateTxDependencies: true,
45988
46011
  resourcesOwner: this
@@ -46008,14 +46031,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46008
46031
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
46009
46032
  * @returns A promise that resolves to the transaction response.
46010
46033
  */
46011
- async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
46034
+ async transfer(destination, amount, assetId, txParams = {}) {
46012
46035
  if (bn(amount).lte(0)) {
46013
46036
  throw new FuelError(
46014
46037
  ErrorCode.INVALID_TRANSFER_AMOUNT,
46015
46038
  "Transfer amount must be a positive number."
46016
46039
  );
46017
46040
  }
46018
- const request = await this.createTransfer(destination, amount, assetId, txParams);
46041
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
46042
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
46019
46043
  return this.sendTransaction(request, { estimateTxDependencies: false });
46020
46044
  }
46021
46045
  /**
@@ -46027,7 +46051,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46027
46051
  * @param txParams - The optional transaction parameters.
46028
46052
  * @returns A promise that resolves to the transaction response.
46029
46053
  */
46030
- async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
46054
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
46031
46055
  if (bn(amount).lte(0)) {
46032
46056
  throw new FuelError(
46033
46057
  ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -46036,11 +46060,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46036
46060
  }
46037
46061
  const contractAddress = Address.fromAddressOrString(contractId);
46038
46062
  const { minGasPrice } = this.provider.getGasConfig();
46039
- const params = { gasPrice: minGasPrice, ...txParams };
46063
+ const baseAssetId = this.provider.getBaseAssetId();
46064
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
46065
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
46040
46066
  const { script, scriptData } = await assembleTransferToContractScript({
46041
46067
  hexlifiedContractId: contractAddress.toB256(),
46042
46068
  amountToTransfer: bn(amount),
46043
- assetId
46069
+ assetId: assetIdToTransfer
46044
46070
  });
46045
46071
  const request = new ScriptTransactionRequest({
46046
46072
  ...params,
@@ -46050,7 +46076,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46050
46076
  request.addContractInputAndOutput(contractAddress);
46051
46077
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
46052
46078
  request,
46053
- [{ amount: bn(amount), assetId: String(assetId) }]
46079
+ [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
46054
46080
  );
46055
46081
  request.gasLimit = bn(params.gasLimit ?? gasUsed);
46056
46082
  this.validateGas({
@@ -46072,6 +46098,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46072
46098
  */
46073
46099
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
46074
46100
  const { minGasPrice } = this.provider.getGasConfig();
46101
+ const baseAssetId = this.provider.getBaseAssetId();
46075
46102
  const recipientAddress = Address.fromAddressOrString(recipient);
46076
46103
  const recipientDataArray = arrayify(
46077
46104
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -46084,9 +46111,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46084
46111
  ...recipientDataArray,
46085
46112
  ...amountDataArray
46086
46113
  ]);
46087
- const params = { script, gasPrice: minGasPrice, ...txParams };
46114
+ const params = {
46115
+ script,
46116
+ gasPrice: minGasPrice,
46117
+ baseAssetId,
46118
+ ...txParams
46119
+ };
46088
46120
  const request = new ScriptTransactionRequest(params);
46089
- const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
46121
+ const forwardingQuantities = [{ amount: bn(amount), assetId: baseAssetId }];
46090
46122
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
46091
46123
  request,
46092
46124
  forwardingQuantities
@@ -50511,26 +50543,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50511
50543
  __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
50512
50544
 
50513
50545
  // src/test-utils/seedTestWallet.ts
50514
- var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
50515
- const toFundAccounts = Array.isArray(wallet) ? wallet : [wallet];
50546
+ var seedTestWallet = async (wallet, quantities) => {
50516
50547
  const genesisWallet = new WalletUnlocked(
50517
50548
  process.env.GENESIS_SECRET || randomBytes22(32),
50518
- toFundAccounts[0].provider
50549
+ wallet.provider
50519
50550
  );
50520
50551
  const resources = await genesisWallet.getResourcesToSpend(quantities);
50521
50552
  const { minGasPrice } = genesisWallet.provider.getGasConfig();
50553
+ const baseAssetId = genesisWallet.provider.getBaseAssetId();
50522
50554
  const request = new ScriptTransactionRequest({
50555
+ baseAssetId,
50523
50556
  gasLimit: 1e4,
50524
50557
  gasPrice: minGasPrice
50525
50558
  });
50526
50559
  request.addResources(resources);
50527
- quantities.map(coinQuantityfy).forEach(
50528
- ({ amount, assetId }) => toFundAccounts.forEach(({ address }) => {
50529
- for (let i = 0; i < utxosAmount; i++) {
50530
- request.addCoinOutput(address, amount.div(utxosAmount), assetId);
50531
- }
50532
- })
50533
- );
50560
+ quantities.map(coinQuantityfy).forEach(({ amount, assetId }) => request.addCoinOutput(wallet.address, amount, assetId));
50534
50561
  await genesisWallet.sendTransaction(request, { awaitExecution: true });
50535
50562
  };
50536
50563
 
@@ -50655,7 +50682,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50655
50682
  {
50656
50683
  owner: signer.address.toHexString(),
50657
50684
  amount: toHex(1e9),
50658
- asset_id: BaseAssetId
50685
+ asset_id: defaultChainConfig?.consensus_parameters?.base_asset_id ?? ZeroBytes32
50659
50686
  }
50660
50687
  ]
50661
50688
  }
@@ -50721,9 +50748,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50721
50748
  })
50722
50749
  );
50723
50750
  var generateWallets = async (count, provider) => {
50751
+ const baseAssetId = provider.getBaseAssetId();
50724
50752
  const wallets = [];
50725
50753
  for (let i = 0; i < count; i += 1) {
50726
- const wallet = await generateTestWallet(provider, [[1e3, BaseAssetId]]);
50754
+ const wallet = await generateTestWallet(provider, [[1e3, baseAssetId]]);
50727
50755
  wallets.push(wallet);
50728
50756
  }
50729
50757
  return wallets;
@@ -50740,33 +50768,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50740
50768
  };
50741
50769
  return { wallets, stop: cleanup, provider };
50742
50770
  };
50743
-
50744
- // src/test-utils/transactionRequest.ts
50745
- var generateFakeRequestInputCoin = (partial = {}) => ({
50746
- id: hexlify(randomBytes22(UTXO_ID_LEN)),
50747
- type: InputType.Coin,
50748
- owner: getRandomB256(),
50749
- amount: bn(100),
50750
- assetId: ZeroBytes32,
50751
- txPointer: "0x00000000000000000000000000000000",
50752
- witnessIndex: 0,
50753
- ...partial
50754
- });
50755
- var generateFakeRequestInputMessage = (partial = {}) => ({
50756
- nonce: getRandomB256(),
50757
- type: InputType.Message,
50758
- sender: getRandomB256(),
50759
- recipient: getRandomB256(),
50760
- amount: bn(100),
50761
- witnessIndex: 0,
50762
- ...partial
50763
- });
50764
- var generateFakeRequestInputContract = (partial = {}) => ({
50765
- contractId: getRandomB256(),
50766
- type: InputType.Contract,
50767
- txPointer: "0x00000000000000000000000000000000",
50768
- ...partial
50769
- });
50770
50771
  })();
50771
50772
  /*! Bundled license information:
50772
50773