@fuel-ts/account 0.0.0-rc-2037-20240430094729 → 0.0.0-rc-2143-20240430130957

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 (35) hide show
  1. package/dist/index.global.js +8 -69
  2. package/dist/index.global.js.map +1 -1
  3. package/dist/index.js +118 -192
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +39 -107
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/predicate/predicate.d.ts +2 -9
  8. package/dist/predicate/predicate.d.ts.map +1 -1
  9. package/dist/providers/provider.d.ts +1 -1
  10. package/dist/providers/provider.d.ts.map +1 -1
  11. package/dist/providers/transaction-request/index.d.ts +0 -1
  12. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  13. package/dist/providers/transaction-request/transaction-request.d.ts +0 -2
  14. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  15. package/dist/test-utils/index.d.ts +0 -1
  16. package/dist/test-utils/index.d.ts.map +1 -1
  17. package/dist/test-utils/launchNode.d.ts +4 -2
  18. package/dist/test-utils/launchNode.d.ts.map +1 -1
  19. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  20. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  21. package/dist/test-utils.global.js +14 -63
  22. package/dist/test-utils.global.js.map +1 -1
  23. package/dist/test-utils.js +117 -180
  24. package/dist/test-utils.js.map +1 -1
  25. package/dist/test-utils.mjs +44 -104
  26. package/dist/test-utils.mjs.map +1 -1
  27. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  28. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  29. package/package.json +15 -15
  30. package/dist/providers/transaction-request/helpers.d.ts +0 -10
  31. package/dist/providers/transaction-request/helpers.d.ts.map +0 -1
  32. package/dist/test-utils/resources.d.ts +0 -4
  33. package/dist/test-utils/resources.d.ts.map +0 -1
  34. package/dist/test-utils/transactionRequest.d.ts +0 -5
  35. package/dist/test-utils/transactionRequest.d.ts.map +0 -1
@@ -38776,27 +38776,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
38776
38776
  name = "NoWitnessByOwnerError";
38777
38777
  };
38778
38778
 
38779
- // src/providers/transaction-request/helpers.ts
38780
- var isRequestInputCoin = (input) => input.type === InputType.Coin;
38781
- var isRequestInputMessage = (input) => input.type === InputType.Message;
38782
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
38783
- var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
38784
- var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
38785
- var cacheResources = (resources) => resources.reduce(
38786
- (cache2, resource) => {
38787
- if (isCoin(resource)) {
38788
- cache2.utxos.push(resource.id);
38789
- } else {
38790
- cache2.messages.push(resource.nonce);
38791
- }
38792
- return cache2;
38793
- },
38794
- {
38795
- utxos: [],
38796
- messages: []
38797
- }
38798
- );
38799
-
38800
38779
  // src/providers/transaction-request/witness.ts
38801
38780
  var witnessify = (value) => {
38802
38781
  const data = arrayify(value);
@@ -39035,7 +39014,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39035
39014
  * @param coin - Coin resource.
39036
39015
  */
39037
39016
  addCoinInput(coin) {
39038
- const { assetId, owner, amount, id, predicate } = coin;
39017
+ const { assetId, owner, amount } = coin;
39039
39018
  let witnessIndex;
39040
39019
  if (coin.predicate) {
39041
39020
  witnessIndex = 0;
@@ -39046,14 +39025,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39046
39025
  }
39047
39026
  }
39048
39027
  const input = {
39049
- id,
39028
+ ...coin,
39050
39029
  type: InputType.Coin,
39051
39030
  owner: owner.toB256(),
39052
39031
  amount,
39053
39032
  assetId,
39054
39033
  txPointer: "0x00000000000000000000000000000000",
39055
- witnessIndex,
39056
- predicate
39034
+ witnessIndex
39057
39035
  };
39058
39036
  this.pushInput(input);
39059
39037
  this.addChangeOutput(owner, assetId);
@@ -39065,7 +39043,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39065
39043
  * @param message - Message resource.
39066
39044
  */
39067
39045
  addMessageInput(message) {
39068
- const { recipient, sender, amount, predicate, nonce, assetId } = message;
39046
+ const { recipient, sender, amount, assetId } = message;
39069
39047
  let witnessIndex;
39070
39048
  if (message.predicate) {
39071
39049
  witnessIndex = 0;
@@ -39076,13 +39054,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39076
39054
  }
39077
39055
  }
39078
39056
  const input = {
39079
- nonce,
39057
+ ...message,
39080
39058
  type: InputType.Message,
39081
39059
  sender: sender.toB256(),
39082
39060
  recipient: recipient.toB256(),
39083
39061
  amount,
39084
- witnessIndex,
39085
- predicate
39062
+ witnessIndex
39086
39063
  };
39087
39064
  this.pushInput(input);
39088
39065
  this.addChangeOutput(recipient, assetId);
@@ -39266,17 +39243,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39266
39243
  toJSON() {
39267
39244
  return normalizeJSON(this);
39268
39245
  }
39269
- removeWitness(index) {
39270
- this.witnesses.splice(index, 1);
39271
- this.adjustWitnessIndexes(index);
39272
- }
39273
- adjustWitnessIndexes(removedIndex) {
39274
- this.inputs.filter(isRequestInputResource).forEach((input) => {
39275
- if (input.witnessIndex > removedIndex) {
39276
- input.witnessIndex -= 1;
39277
- }
39278
- });
39279
- }
39280
39246
  updatePredicateGasUsed(inputs) {
39281
39247
  this.inputs.forEach((i) => {
39282
39248
  let correspondingInput;
@@ -47303,15 +47269,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47303
47269
  populateTransactionPredicateData(transactionRequestLike) {
47304
47270
  const request = transactionRequestify(transactionRequestLike);
47305
47271
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
47306
- const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
47307
- if (placeholderIndex !== -1) {
47308
- request.removeWitness(placeholderIndex);
47309
- }
47310
- request.inputs.filter(isRequestInputResource).forEach((input) => {
47311
- if (isRequestInputResourceFromOwner(input, this.address)) {
47272
+ request.inputs?.forEach((input) => {
47273
+ if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
47312
47274
  input.predicate = hexlify(this.bytes);
47313
47275
  input.predicateData = hexlify(this.getPredicateData(policies.length));
47314
- input.witnessIndex = 0;
47315
47276
  }
47316
47277
  });
47317
47278
  return request;
@@ -47434,28 +47395,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47434
47395
  }
47435
47396
  return mutatedBytes;
47436
47397
  }
47437
- /**
47438
- * Returns the index of the witness placeholder that was added to this predicate.
47439
- * If no witness placeholder was added, it returns -1.
47440
- * @param request - The transaction request.
47441
- * @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
47442
- */
47443
- getIndexFromPlaceholderWitness(request) {
47444
- const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
47445
- let index = -1;
47446
- const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
47447
- if (hasEmptyPredicateInputs) {
47448
- index = hasEmptyPredicateInputs.witnessIndex;
47449
- const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
47450
- if (!allInputsAreEmpty) {
47451
- const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
47452
- if (wasFilledInputAddedFirst) {
47453
- index = -1;
47454
- }
47455
- }
47456
- }
47457
- return index;
47458
- }
47459
47398
  };
47460
47399
 
47461
47400
  // src/connectors/fuel-connector.ts