@fuel-ts/account 0.0.0-rc-2034-20240410172045 → 0.0.0-rc-2037-20240411020051

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @fuel-ts/account might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -1187,7 +1187,7 @@ var inputify = (value) => {
1187
1187
  return {
1188
1188
  type: import_transactions.InputType.Coin,
1189
1189
  txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
1190
- outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(32, 33)),
1190
+ outputIndex: (0, import_utils3.arrayify)(value.id)[32],
1191
1191
  owner: (0, import_utils3.hexlify)(value.owner),
1192
1192
  amount: (0, import_math2.bn)(value.amount),
1193
1193
  assetId: (0, import_utils3.hexlify)(value.assetId),
@@ -1307,7 +1307,6 @@ var outputify = (value) => {
1307
1307
  // src/providers/transaction-request/transaction-request.ts
1308
1308
  var import_address = require("@fuel-ts/address");
1309
1309
  var import_configs7 = require("@fuel-ts/address/configs");
1310
- var import_crypto = require("@fuel-ts/crypto");
1311
1310
  var import_math7 = require("@fuel-ts/math");
1312
1311
  var import_transactions6 = require("@fuel-ts/transactions");
1313
1312
  var import_utils9 = require("@fuel-ts/utils");
@@ -2036,8 +2035,8 @@ var BaseTransactionRequest = class {
2036
2035
  * @param predicate - Predicate bytes.
2037
2036
  * @param predicateData - Predicate data bytes.
2038
2037
  */
2039
- addCoinInput(coin, predicate) {
2040
- const { assetId, owner, amount } = coin;
2038
+ addCoinInput(coin) {
2039
+ const { assetId, owner, amount, id, predicate } = coin;
2041
2040
  let witnessIndex;
2042
2041
  if (predicate) {
2043
2042
  witnessIndex = 0;
@@ -2048,14 +2047,14 @@ var BaseTransactionRequest = class {
2048
2047
  }
2049
2048
  }
2050
2049
  const input = {
2051
- ...coin,
2050
+ id,
2052
2051
  type: import_transactions6.InputType.Coin,
2053
2052
  owner: owner.toB256(),
2054
2053
  amount,
2055
2054
  assetId,
2056
2055
  txPointer: "0x00000000000000000000000000000000",
2057
2056
  witnessIndex,
2058
- predicate: predicate?.bytes
2057
+ predicate
2059
2058
  };
2060
2059
  this.pushInput(input);
2061
2060
  this.addChangeOutput(owner, assetId);
@@ -2068,8 +2067,8 @@ var BaseTransactionRequest = class {
2068
2067
  * @param predicate - Predicate bytes.
2069
2068
  * @param predicateData - Predicate data bytes.
2070
2069
  */
2071
- addMessageInput(message, predicate) {
2072
- const { recipient, sender, amount } = message;
2070
+ addMessageInput(message) {
2071
+ const { recipient, sender, amount, predicate, nonce } = message;
2073
2072
  const assetId = import_configs7.BaseAssetId;
2074
2073
  let witnessIndex;
2075
2074
  if (predicate) {
@@ -2081,13 +2080,13 @@ var BaseTransactionRequest = class {
2081
2080
  }
2082
2081
  }
2083
2082
  const input = {
2084
- ...message,
2083
+ nonce,
2085
2084
  type: import_transactions6.InputType.Message,
2086
2085
  sender: sender.toB256(),
2087
2086
  recipient: recipient.toB256(),
2088
2087
  amount,
2089
2088
  witnessIndex,
2090
- predicate: predicate?.bytes
2089
+ predicate
2091
2090
  };
2092
2091
  this.pushInput(input);
2093
2092
  this.addChangeOutput(recipient, assetId);
@@ -2118,32 +2117,6 @@ var BaseTransactionRequest = class {
2118
2117
  resources.forEach((resource) => this.addResource(resource));
2119
2118
  return this;
2120
2119
  }
2121
- /**
2122
- * Adds multiple resources to the transaction by adding coin/message inputs and change
2123
- * outputs from the related assetIds.
2124
- *
2125
- * @param resources - The resources to add.
2126
- * @returns This transaction.
2127
- */
2128
- addPredicateResource(resource, predicate) {
2129
- if (isCoin(resource)) {
2130
- this.addCoinInput(resource, predicate);
2131
- } else {
2132
- this.addMessageInput(resource, predicate);
2133
- }
2134
- return this;
2135
- }
2136
- /**
2137
- * Adds multiple predicate coin/message inputs to the transaction and change outputs
2138
- * from the related assetIds.
2139
- *
2140
- * @param resources - The resources to add.
2141
- * @returns This transaction.
2142
- */
2143
- addPredicateResources(resources, predicate) {
2144
- resources.forEach((resource) => this.addPredicateResource(resource, predicate));
2145
- return this;
2146
- }
2147
2120
  /**
2148
2121
  * Adds a coin output to the transaction.
2149
2122
  *
@@ -2242,6 +2215,12 @@ var BaseTransactionRequest = class {
2242
2215
  * @param quantities - CoinQuantity Array.
2243
2216
  */
2244
2217
  fundWithFakeUtxos(quantities, resourcesOwner) {
2218
+ let idCounter = 0;
2219
+ const generateId = () => {
2220
+ const counterString = String(idCounter++);
2221
+ const id = import_configs7.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2222
+ return id;
2223
+ };
2245
2224
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2246
2225
  if ("assetId" in input) {
2247
2226
  return input.assetId === assetId;
@@ -2251,12 +2230,12 @@ var BaseTransactionRequest = class {
2251
2230
  const updateAssetInput = (assetId, quantity) => {
2252
2231
  const assetInput = findAssetInput(assetId);
2253
2232
  if (assetInput && "assetId" in assetInput) {
2254
- assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(33));
2233
+ assetInput.id = generateId();
2255
2234
  assetInput.amount = quantity;
2256
2235
  } else {
2257
2236
  this.addResources([
2258
2237
  {
2259
- id: (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(33)),
2238
+ id: generateId(),
2260
2239
  amount: quantity,
2261
2240
  assetId,
2262
2241
  owner: resourcesOwner || import_address.Address.fromRandom(),
@@ -4133,36 +4112,6 @@ var _Provider = class {
4133
4112
  missingContractIds
4134
4113
  };
4135
4114
  }
4136
- /**
4137
- * Estimates the transaction gas and fee based on the provided transaction request.
4138
- * @param transactionRequest - The transaction request object.
4139
- * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
4140
- */
4141
- estimateTxGasAndFee(params) {
4142
- const { transactionRequest } = params;
4143
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4144
- const chainInfo = this.getChain();
4145
- const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
4146
- transactionRequest.gasPrice = gasPrice;
4147
- const minGas = transactionRequest.calculateMinGas(chainInfo);
4148
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4149
- if (transactionRequest.type === import_transactions18.TransactionType.Script) {
4150
- if (transactionRequest.gasLimit.eq(0)) {
4151
- transactionRequest.gasLimit = minGas;
4152
- transactionRequest.gasLimit = maxGasPerTx.sub(
4153
- transactionRequest.calculateMaxGas(chainInfo, minGas)
4154
- );
4155
- }
4156
- }
4157
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4158
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4159
- return {
4160
- minGas,
4161
- minFee,
4162
- maxGas,
4163
- maxFee
4164
- };
4165
- }
4166
4115
  /**
4167
4116
  * Executes a signed transaction without applying the states changes
4168
4117
  * on the chain.
@@ -4210,16 +4159,17 @@ var _Provider = class {
4210
4159
  signatureCallback
4211
4160
  } = {}) {
4212
4161
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4213
- const { minGasPrice } = this.getGasConfig();
4214
- const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4162
+ const chainInfo = this.getChain();
4163
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4164
+ const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4215
4165
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
4216
4166
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4217
4167
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4218
4168
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4219
- if (isScriptTransaction) {
4220
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
4221
- }
4222
4169
  if (estimatePredicates) {
4170
+ if (isScriptTransaction) {
4171
+ txRequestClone.gasLimit = (0, import_math15.bn)(0);
4172
+ }
4223
4173
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4224
4174
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
4225
4175
  }
@@ -4228,34 +4178,36 @@ var _Provider = class {
4228
4178
  if (signatureCallback && isScriptTransaction) {
4229
4179
  await signatureCallback(txRequestClone);
4230
4180
  }
4231
- let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4232
- transactionRequest: txRequestClone
4233
- });
4181
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
4182
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
4234
4183
  let receipts = [];
4235
4184
  let missingContractIds = [];
4236
4185
  let outputVariables = 0;
4237
- let gasUsed = (0, import_math15.bn)(0);
4238
4186
  if (isScriptTransaction && estimateTxDependencies) {
4239
4187
  txRequestClone.gasPrice = (0, import_math15.bn)(0);
4188
+ txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4240
4189
  const result = await this.estimateTxDependencies(txRequestClone);
4241
4190
  receipts = result.receipts;
4242
4191
  outputVariables = result.outputVariables;
4243
4192
  missingContractIds = result.missingContractIds;
4244
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4245
- txRequestClone.gasLimit = gasUsed;
4246
- txRequestClone.gasPrice = setGasPrice;
4247
- ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4248
- transactionRequest: txRequestClone
4249
- }));
4250
4193
  }
4194
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
4195
+ const usedFee = calculatePriceWithFactor(
4196
+ gasUsed,
4197
+ gasPrice,
4198
+ gasPriceFactor
4199
+ ).normalizeZeroToOne();
4200
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4201
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4251
4202
  return {
4252
4203
  requiredQuantities: allQuantities,
4253
4204
  receipts,
4254
4205
  gasUsed,
4255
4206
  minGasPrice,
4256
- gasPrice: setGasPrice,
4207
+ gasPrice,
4257
4208
  minGas,
4258
4209
  maxGas,
4210
+ usedFee,
4259
4211
  minFee,
4260
4212
  maxFee,
4261
4213
  estimatedInputs: txRequestClone.inputs,
@@ -5349,7 +5301,7 @@ var import_utils31 = require("@fuel-ts/utils");
5349
5301
 
5350
5302
  // src/signer/signer.ts
5351
5303
  var import_address5 = require("@fuel-ts/address");
5352
- var import_crypto2 = require("@fuel-ts/crypto");
5304
+ var import_crypto = require("@fuel-ts/crypto");
5353
5305
  var import_hasher2 = require("@fuel-ts/hasher");
5354
5306
  var import_math19 = require("@fuel-ts/math");
5355
5307
  var import_utils29 = require("@fuel-ts/utils");
@@ -5442,7 +5394,7 @@ var Signer = class {
5442
5394
  * @returns random 32-byte hashed
5443
5395
  */
5444
5396
  static generatePrivateKey(entropy) {
5445
- return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
5397
+ return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
5446
5398
  }
5447
5399
  /**
5448
5400
  * Extended publicKey from a compact publicKey
@@ -5458,7 +5410,7 @@ var Signer = class {
5458
5410
 
5459
5411
  // src/wallet/keystore-wallet.ts
5460
5412
  var import_address6 = require("@fuel-ts/address");
5461
- var import_crypto3 = require("@fuel-ts/crypto");
5413
+ var import_crypto2 = require("@fuel-ts/crypto");
5462
5414
  var import_errors17 = require("@fuel-ts/errors");
5463
5415
  var import_utils30 = require("@fuel-ts/utils");
5464
5416
  var import_uuid = require("uuid");
@@ -5474,22 +5426,22 @@ var removeHexPrefix = (hexString) => {
5474
5426
  return hexString;
5475
5427
  };
5476
5428
  async function encryptKeystoreWallet(privateKey, address, password) {
5477
- const privateKeyBuffer = (0, import_crypto3.bufferFromString)(removeHexPrefix(privateKey), "hex");
5429
+ const privateKeyBuffer = (0, import_crypto2.bufferFromString)(removeHexPrefix(privateKey), "hex");
5478
5430
  const ownerAddress = import_address6.Address.fromAddressOrString(address);
5479
- const salt = (0, import_crypto3.randomBytes)(DEFAULT_KEY_SIZE);
5480
- const key = (0, import_crypto3.scrypt)({
5481
- password: (0, import_crypto3.bufferFromString)(password),
5431
+ const salt = (0, import_crypto2.randomBytes)(DEFAULT_KEY_SIZE);
5432
+ const key = (0, import_crypto2.scrypt)({
5433
+ password: (0, import_crypto2.bufferFromString)(password),
5482
5434
  salt,
5483
5435
  dklen: DEFAULT_KEY_SIZE,
5484
5436
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
5485
5437
  r: DEFAULT_KDF_PARAMS_R,
5486
5438
  p: DEFAULT_KDF_PARAMS_P
5487
5439
  });
5488
- const iv = (0, import_crypto3.randomBytes)(DEFAULT_IV_SIZE);
5489
- const ciphertext = await (0, import_crypto3.encryptJsonWalletData)(privateKeyBuffer, key, iv);
5440
+ const iv = (0, import_crypto2.randomBytes)(DEFAULT_IV_SIZE);
5441
+ const ciphertext = await (0, import_crypto2.encryptJsonWalletData)(privateKeyBuffer, key, iv);
5490
5442
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
5491
- const macHashUint8Array = (0, import_crypto3.keccak256)(data);
5492
- const mac = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
5443
+ const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5444
+ const mac = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5493
5445
  const keystore = {
5494
5446
  id: (0, import_uuid.v4)(),
5495
5447
  version: 3,
@@ -5497,15 +5449,15 @@ async function encryptKeystoreWallet(privateKey, address, password) {
5497
5449
  crypto: {
5498
5450
  cipher: "aes-128-ctr",
5499
5451
  mac,
5500
- cipherparams: { iv: (0, import_crypto3.stringFromBuffer)(iv, "hex") },
5501
- ciphertext: (0, import_crypto3.stringFromBuffer)(ciphertext, "hex"),
5452
+ cipherparams: { iv: (0, import_crypto2.stringFromBuffer)(iv, "hex") },
5453
+ ciphertext: (0, import_crypto2.stringFromBuffer)(ciphertext, "hex"),
5502
5454
  kdf: "scrypt",
5503
5455
  kdfparams: {
5504
5456
  dklen: DEFAULT_KEY_SIZE,
5505
5457
  n: 2 ** DEFAULT_KDF_PARAMS_LOG_N,
5506
5458
  p: DEFAULT_KDF_PARAMS_P,
5507
5459
  r: DEFAULT_KDF_PARAMS_R,
5508
- salt: (0, import_crypto3.stringFromBuffer)(salt, "hex")
5460
+ salt: (0, import_crypto2.stringFromBuffer)(salt, "hex")
5509
5461
  }
5510
5462
  }
5511
5463
  };
@@ -5521,11 +5473,11 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5521
5473
  kdfparams: { dklen, n, r, p, salt }
5522
5474
  }
5523
5475
  } = keystoreWallet;
5524
- const ciphertextBuffer = (0, import_crypto3.bufferFromString)(ciphertext, "hex");
5525
- const ivBuffer = (0, import_crypto3.bufferFromString)(iv, "hex");
5526
- const saltBuffer = (0, import_crypto3.bufferFromString)(salt, "hex");
5527
- const passwordBuffer = (0, import_crypto3.bufferFromString)(password);
5528
- const key = (0, import_crypto3.scrypt)({
5476
+ const ciphertextBuffer = (0, import_crypto2.bufferFromString)(ciphertext, "hex");
5477
+ const ivBuffer = (0, import_crypto2.bufferFromString)(iv, "hex");
5478
+ const saltBuffer = (0, import_crypto2.bufferFromString)(salt, "hex");
5479
+ const passwordBuffer = (0, import_crypto2.bufferFromString)(password);
5480
+ const key = (0, import_crypto2.scrypt)({
5529
5481
  password: passwordBuffer,
5530
5482
  salt: saltBuffer,
5531
5483
  n,
@@ -5534,15 +5486,15 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5534
5486
  dklen
5535
5487
  });
5536
5488
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertextBuffer]);
5537
- const macHashUint8Array = (0, import_crypto3.keccak256)(data);
5538
- const macHash = (0, import_crypto3.stringFromBuffer)(macHashUint8Array, "hex");
5489
+ const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5490
+ const macHash = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5539
5491
  if (mac !== macHash) {
5540
5492
  throw new import_errors17.FuelError(
5541
5493
  import_errors17.ErrorCode.INVALID_PASSWORD,
5542
5494
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5543
5495
  );
5544
5496
  }
5545
- const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5497
+ const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5546
5498
  const privateKey = (0, import_utils30.hexlify)(buffer);
5547
5499
  return privateKey;
5548
5500
  }
@@ -5667,7 +5619,7 @@ var import_utils35 = require("@fuel-ts/utils");
5667
5619
  var import_ethers3 = require("ethers");
5668
5620
 
5669
5621
  // src/mnemonic/mnemonic.ts
5670
- var import_crypto4 = require("@fuel-ts/crypto");
5622
+ var import_crypto3 = require("@fuel-ts/crypto");
5671
5623
  var import_errors19 = require("@fuel-ts/errors");
5672
5624
  var import_hasher5 = require("@fuel-ts/hasher");
5673
5625
  var import_utils33 = require("@fuel-ts/utils");
@@ -8028,7 +7980,7 @@ var Mnemonic = class {
8028
7980
  * @returns A randomly generated mnemonic
8029
7981
  */
8030
7982
  static generate(size = 32, extraEntropy = "") {
8031
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
7983
+ const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
8032
7984
  return Mnemonic.entropyToMnemonic(entropy);
8033
7985
  }
8034
7986
  };
@@ -8400,7 +8352,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8400
8352
 
8401
8353
  // src/wallet-manager/wallet-manager.ts
8402
8354
  var import_address9 = require("@fuel-ts/address");
8403
- var import_crypto5 = require("@fuel-ts/crypto");
8355
+ var import_crypto4 = require("@fuel-ts/crypto");
8404
8356
  var import_errors23 = require("@fuel-ts/errors");
8405
8357
  var import_events = require("events");
8406
8358
 
@@ -8728,7 +8680,7 @@ var _WalletManager = class extends import_events.EventEmitter {
8728
8680
  await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
8729
8681
  const data = await this.storage.getItem(this.STORAGE_KEY);
8730
8682
  if (data) {
8731
- const state = await (0, import_crypto5.decrypt)(__privateGet(this, _passphrase), JSON.parse(data));
8683
+ const state = await (0, import_crypto4.decrypt)(__privateGet(this, _passphrase), JSON.parse(data));
8732
8684
  __privateSet(this, _vaults, __privateMethod(this, _deserializeVaults, deserializeVaults_fn).call(this, state.vaults));
8733
8685
  }
8734
8686
  }
@@ -8737,7 +8689,7 @@ var _WalletManager = class extends import_events.EventEmitter {
8737
8689
  */
8738
8690
  async saveState() {
8739
8691
  await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
8740
- const encryptedData = await (0, import_crypto5.encrypt)(__privateGet(this, _passphrase), {
8692
+ const encryptedData = await (0, import_crypto4.encrypt)(__privateGet(this, _passphrase), {
8741
8693
  vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
8742
8694
  });
8743
8695
  await this.storage.setItem(this.STORAGE_KEY, JSON.stringify(encryptedData));
@@ -8880,6 +8832,7 @@ var Predicate = class extends Account {
8880
8832
  if (input.type === import_transactions20.InputType.Coin && (0, import_utils37.hexlify)(input.owner) === this.address.toB256()) {
8881
8833
  input.predicate = this.bytes;
8882
8834
  input.predicateData = this.getPredicateData(policies.length);
8835
+ input.witnessIndex = 0;
8883
8836
  }
8884
8837
  });
8885
8838
  return request;
@@ -8917,6 +8870,20 @@ var Predicate = class extends Account {
8917
8870
  const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
8918
8871
  return super.simulateTransaction(transactionRequest);
8919
8872
  }
8873
+ /**
8874
+ * Retrieves resources satisfying the spend query for the account.
8875
+ *
8876
+ * @param quantities - IDs of coins to exclude.
8877
+ * @param excludedIds - IDs of resources to be excluded from the query.
8878
+ * @returns A promise that resolves to an array of Resources.
8879
+ */
8880
+ async getResourcesToSpend(quantities, excludedIds) {
8881
+ const resources = await super.getResourcesToSpend(quantities, excludedIds);
8882
+ return resources.map((resource) => ({
8883
+ ...resource,
8884
+ predicate: (0, import_utils37.hexlify)(this.bytes)
8885
+ }));
8886
+ }
8920
8887
  getPredicateData(policiesLength) {
8921
8888
  if (!this.predicateData.length) {
8922
8889
  return new Uint8Array();