@fuel-ts/account 0.0.0-rc-2021-20240409152935 → 0.0.0-rc-1976-20240410103621

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 (54) hide show
  1. package/README.md +1 -1
  2. package/dist/account.d.ts +4 -5
  3. package/dist/account.d.ts.map +1 -1
  4. package/dist/configs.d.ts.map +1 -1
  5. package/dist/configs.global.js +1 -1
  6. package/dist/configs.global.js.map +1 -1
  7. package/dist/configs.js +1 -1
  8. package/dist/configs.js.map +1 -1
  9. package/dist/configs.mjs +1 -1
  10. package/dist/configs.mjs.map +1 -1
  11. package/dist/index.global.js +678 -946
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +611 -850
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +454 -692
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/predicate/predicate.d.ts +2 -10
  18. package/dist/predicate/predicate.d.ts.map +1 -1
  19. package/dist/providers/__generated__/operations.d.ts +328 -894
  20. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  21. package/dist/providers/coin-quantity.d.ts +3 -3
  22. package/dist/providers/coin-quantity.d.ts.map +1 -1
  23. package/dist/providers/coin.d.ts +2 -4
  24. package/dist/providers/coin.d.ts.map +1 -1
  25. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  26. package/dist/providers/message.d.ts +1 -3
  27. package/dist/providers/message.d.ts.map +1 -1
  28. package/dist/providers/provider.d.ts +34 -45
  29. package/dist/providers/provider.d.ts.map +1 -1
  30. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
  31. package/dist/providers/transaction-request/input.d.ts +2 -2
  32. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  33. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
  34. package/dist/providers/transaction-request/transaction-request.d.ts +29 -9
  35. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  36. package/dist/providers/transaction-request/utils.d.ts +0 -3
  37. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  38. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  39. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
  40. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
  41. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
  42. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
  43. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
  44. package/dist/providers/utils/gas.d.ts +2 -8
  45. package/dist/providers/utils/gas.d.ts.map +1 -1
  46. package/dist/test-utils/launchNode.d.ts.map +1 -1
  47. package/dist/test-utils.global.js +1179 -1661
  48. package/dist/test-utils.global.js.map +1 -1
  49. package/dist/test-utils.js +608 -826
  50. package/dist/test-utils.js.map +1 -1
  51. package/dist/test-utils.mjs +466 -684
  52. package/dist/test-utils.mjs.map +1 -1
  53. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  54. package/package.json +17 -17
package/dist/index.mjs CHANGED
@@ -29,38 +29,35 @@ var __privateMethod = (obj, member, method) => {
29
29
 
30
30
  // src/account.ts
31
31
  import { Address as Address3 } from "@fuel-ts/address";
32
- import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
33
32
  import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
34
33
  import { AbstractAccount } from "@fuel-ts/interfaces";
35
- import { bn as bn18 } from "@fuel-ts/math";
34
+ import { bn as bn17 } from "@fuel-ts/math";
36
35
  import { arrayify as arrayify14 } from "@fuel-ts/utils";
37
- import { clone as clone4 } from "ramda";
38
36
 
39
37
  // src/providers/coin-quantity.ts
40
- import { BaseAssetId } from "@fuel-ts/address/configs";
41
38
  import { bn } from "@fuel-ts/math";
42
39
  import { hexlify } from "@fuel-ts/utils";
43
40
  var coinQuantityfy = (coinQuantityLike) => {
44
41
  let assetId;
45
42
  let amount;
46
- let max;
43
+ let max2;
47
44
  if (Array.isArray(coinQuantityLike)) {
48
45
  amount = coinQuantityLike[0];
49
- assetId = coinQuantityLike[1] ?? BaseAssetId;
50
- max = coinQuantityLike[2] ?? void 0;
46
+ assetId = coinQuantityLike[1];
47
+ max2 = coinQuantityLike[2];
51
48
  } else {
52
49
  amount = coinQuantityLike.amount;
53
- assetId = coinQuantityLike.assetId ?? BaseAssetId;
54
- max = coinQuantityLike.max ?? void 0;
50
+ assetId = coinQuantityLike.assetId;
51
+ max2 = coinQuantityLike.max ?? void 0;
55
52
  }
56
53
  const bnAmount = bn(amount);
57
54
  return {
58
55
  assetId: hexlify(assetId),
59
56
  amount: bnAmount.lt(1) ? bn(1) : bnAmount,
60
- max: max ? bn(max) : void 0
57
+ max: max2 ? bn(max2) : void 0
61
58
  };
62
59
  };
63
- var addAmountToCoinQuantities = (params) => {
60
+ var addAmountToAsset = (params) => {
64
61
  const { amount, assetId } = params;
65
62
  const coinQuantities = [...params.coinQuantities];
66
63
  const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
@@ -75,9 +72,9 @@ var addAmountToCoinQuantities = (params) => {
75
72
  // src/providers/provider.ts
76
73
  import { Address as Address2 } from "@fuel-ts/address";
77
74
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
78
- import { BN, bn as bn16 } from "@fuel-ts/math";
75
+ import { BN, bn as bn15, max } from "@fuel-ts/math";
79
76
  import {
80
- InputType as InputType7,
77
+ InputType as InputType6,
81
78
  TransactionType as TransactionType8,
82
79
  InputMessageCoder,
83
80
  TransactionCoder as TransactionCoder5
@@ -93,10 +90,14 @@ import { clone as clone3 } from "ramda";
93
90
  import gql from "graphql-tag";
94
91
  var ReceiptFragmentFragmentDoc = gql`
95
92
  fragment receiptFragment on Receipt {
96
- id
93
+ contract {
94
+ id
95
+ }
97
96
  pc
98
97
  is
99
- to
98
+ to {
99
+ id
100
+ }
100
101
  toAddress
101
102
  amount
102
103
  assetId
@@ -134,16 +135,10 @@ var TransactionStatusFragmentFragmentDoc = gql`
134
135
  id
135
136
  }
136
137
  time
137
- receipts {
138
- ...receiptFragment
139
- }
140
138
  programState {
141
139
  returnType
142
140
  data
143
141
  }
144
- receipts {
145
- ...receiptFragment
146
- }
147
142
  }
148
143
  ... on FailureStatus {
149
144
  block {
@@ -151,24 +146,26 @@ var TransactionStatusFragmentFragmentDoc = gql`
151
146
  }
152
147
  time
153
148
  reason
154
- receipts {
155
- ...receiptFragment
156
- }
157
149
  }
158
150
  ... on SqueezedOutStatus {
159
151
  reason
160
152
  }
161
153
  }
162
- ${ReceiptFragmentFragmentDoc}`;
154
+ `;
163
155
  var TransactionFragmentFragmentDoc = gql`
164
156
  fragment transactionFragment on Transaction {
165
157
  id
166
158
  rawPayload
159
+ gasPrice
160
+ receipts {
161
+ ...receiptFragment
162
+ }
167
163
  status {
168
164
  ...transactionStatusFragment
169
165
  }
170
166
  }
171
- ${TransactionStatusFragmentFragmentDoc}`;
167
+ ${ReceiptFragmentFragmentDoc}
168
+ ${TransactionStatusFragmentFragmentDoc}`;
172
169
  var InputEstimatePredicatesFragmentFragmentDoc = gql`
173
170
  fragment inputEstimatePredicatesFragment on Input {
174
171
  ... on InputCoin {
@@ -186,46 +183,6 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
186
183
  }
187
184
  }
188
185
  ${InputEstimatePredicatesFragmentFragmentDoc}`;
189
- var DryRunFailureStatusFragmentFragmentDoc = gql`
190
- fragment dryRunFailureStatusFragment on DryRunFailureStatus {
191
- reason
192
- programState {
193
- returnType
194
- data
195
- }
196
- }
197
- `;
198
- var DryRunSuccessStatusFragmentFragmentDoc = gql`
199
- fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
200
- programState {
201
- returnType
202
- data
203
- }
204
- }
205
- `;
206
- var DryRunTransactionStatusFragmentFragmentDoc = gql`
207
- fragment dryRunTransactionStatusFragment on DryRunTransactionStatus {
208
- ... on DryRunFailureStatus {
209
- ...dryRunFailureStatusFragment
210
- }
211
- ... on DryRunSuccessStatus {
212
- ...dryRunSuccessStatusFragment
213
- }
214
- }
215
- ${DryRunFailureStatusFragmentFragmentDoc}
216
- ${DryRunSuccessStatusFragmentFragmentDoc}`;
217
- var DryRunTransactionExecutionStatusFragmentFragmentDoc = gql`
218
- fragment dryRunTransactionExecutionStatusFragment on DryRunTransactionExecutionStatus {
219
- id
220
- status {
221
- ...dryRunTransactionStatusFragment
222
- }
223
- receipts {
224
- ...receiptFragment
225
- }
226
- }
227
- ${DryRunTransactionStatusFragmentFragmentDoc}
228
- ${ReceiptFragmentFragmentDoc}`;
229
186
  var CoinFragmentFragmentDoc = gql`
230
187
  fragment coinFragment on Coin {
231
188
  __typename
@@ -233,6 +190,7 @@ var CoinFragmentFragmentDoc = gql`
233
190
  owner
234
191
  amount
235
192
  assetId
193
+ maturity
236
194
  blockCreated
237
195
  txCreatedIdx
238
196
  }
@@ -277,6 +235,7 @@ var MessageProofFragmentFragmentDoc = gql`
277
235
  prevRoot
278
236
  time
279
237
  applicationHash
238
+ messageReceiptRoot
280
239
  messageReceiptCount
281
240
  }
282
241
  commitBlockHeader {
@@ -288,6 +247,7 @@ var MessageProofFragmentFragmentDoc = gql`
288
247
  prevRoot
289
248
  time
290
249
  applicationHash
250
+ messageReceiptRoot
291
251
  messageReceiptCount
292
252
  }
293
253
  sender
@@ -307,8 +267,8 @@ var BalanceFragmentFragmentDoc = gql`
307
267
  var BlockFragmentFragmentDoc = gql`
308
268
  fragment blockFragment on Block {
309
269
  id
310
- height
311
270
  header {
271
+ height
312
272
  time
313
273
  }
314
274
  transactions {
@@ -366,11 +326,6 @@ var DependentCostFragmentFragmentDoc = gql`
366
326
  `;
367
327
  var GasCostsFragmentFragmentDoc = gql`
368
328
  fragment GasCostsFragment on GasCosts {
369
- version {
370
- ... on Version {
371
- value
372
- }
373
- }
374
329
  add
375
330
  addi
376
331
  aloc
@@ -383,6 +338,7 @@ var GasCostsFragmentFragmentDoc = gql`
383
338
  cb
384
339
  cfei
385
340
  cfsi
341
+ croo
386
342
  div
387
343
  divi
388
344
  ecr1
@@ -465,9 +421,6 @@ var GasCostsFragmentFragmentDoc = gql`
465
421
  ccp {
466
422
  ...DependentCostFragment
467
423
  }
468
- croo {
469
- ...DependentCostFragment
470
- }
471
424
  csiz {
472
425
  ...DependentCostFragment
473
426
  }
@@ -527,11 +480,6 @@ var GasCostsFragmentFragmentDoc = gql`
527
480
  ${DependentCostFragmentFragmentDoc}`;
528
481
  var ConsensusParametersFragmentFragmentDoc = gql`
529
482
  fragment consensusParametersFragment on ConsensusParameters {
530
- version {
531
- ... on Version {
532
- value
533
- }
534
- }
535
483
  txParams {
536
484
  ...TxParametersFragment
537
485
  }
@@ -591,9 +539,18 @@ var NodeInfoFragmentFragmentDoc = gql`
591
539
  fragment nodeInfoFragment on NodeInfo {
592
540
  utxoValidation
593
541
  vmBacktrace
542
+ minGasPrice
594
543
  maxTx
595
544
  maxDepth
596
545
  nodeVersion
546
+ peers {
547
+ id
548
+ addresses
549
+ clientVersion
550
+ blockHeight
551
+ lastHeartbeatMs
552
+ appScore
553
+ }
597
554
  }
598
555
  `;
599
556
  var GetVersionDocument = gql`
@@ -628,9 +585,13 @@ var GetTransactionWithReceiptsDocument = gql`
628
585
  query getTransactionWithReceipts($transactionId: TransactionId!) {
629
586
  transaction(id: $transactionId) {
630
587
  ...transactionFragment
588
+ receipts {
589
+ ...receiptFragment
590
+ }
631
591
  }
632
592
  }
633
- ${TransactionFragmentFragmentDoc}`;
593
+ ${TransactionFragmentFragmentDoc}
594
+ ${ReceiptFragmentFragmentDoc}`;
634
595
  var GetTransactionsDocument = gql`
635
596
  query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
636
597
  transactions(after: $after, before: $before, first: $first, last: $last) {
@@ -758,20 +719,6 @@ var GetBalanceDocument = gql`
758
719
  }
759
720
  }
760
721
  ${BalanceFragmentFragmentDoc}`;
761
- var GetLatestGasPriceDocument = gql`
762
- query getLatestGasPrice {
763
- latestGasPrice {
764
- gasPrice
765
- }
766
- }
767
- `;
768
- var EstimateGasPriceDocument = gql`
769
- query estimateGasPrice($blockHorizon: U32!) {
770
- estimateGasPrice(blockHorizon: $blockHorizon) {
771
- gasPrice
772
- }
773
- }
774
- `;
775
722
  var GetBalancesDocument = gql`
776
723
  query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
777
724
  balances(
@@ -826,12 +773,12 @@ var GetMessageStatusDocument = gql`
826
773
  }
827
774
  `;
828
775
  var DryRunDocument = gql`
829
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
830
- dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
831
- ...dryRunTransactionExecutionStatusFragment
776
+ mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
777
+ dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
778
+ ...receiptFragment
832
779
  }
833
780
  }
834
- ${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
781
+ ${ReceiptFragmentFragmentDoc}`;
835
782
  var SubmitDocument = gql`
836
783
  mutation submit($encodedTransaction: HexString!) {
837
784
  submit(tx: $encodedTransaction) {
@@ -914,12 +861,6 @@ function getSdk(requester) {
914
861
  getBalance(variables, options) {
915
862
  return requester(GetBalanceDocument, variables, options);
916
863
  },
917
- getLatestGasPrice(variables, options) {
918
- return requester(GetLatestGasPriceDocument, variables, options);
919
- },
920
- estimateGasPrice(variables, options) {
921
- return requester(EstimateGasPriceDocument, variables, options);
922
- },
923
864
  getBalances(variables, options) {
924
865
  return requester(GetBalancesDocument, variables, options);
925
866
  },
@@ -989,14 +930,11 @@ var _FuelGraphqlSubscriber = class {
989
930
  let data;
990
931
  let errors;
991
932
  try {
992
- const sanitizedText = text.replace(/\s/g, "");
993
- ({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
933
+ ({ data, errors } = JSON.parse(text.replace(/^data:/, "")));
994
934
  } catch (e) {
995
935
  throw new FuelError(
996
936
  ErrorCode.STREAM_PARSING_ERROR,
997
- `Error while parsing stream data response: ${text}
998
-
999
- Thrown error: ${e}`
937
+ `Error while parsing stream data response: ${text}`
1000
938
  );
1001
939
  }
1002
940
  if (Array.isArray(errors)) {
@@ -1097,7 +1035,7 @@ var inputify = (value) => {
1097
1035
  return {
1098
1036
  type: InputType.Coin,
1099
1037
  txID: hexlify3(arrayify(value.id).slice(0, 32)),
1100
- outputIndex: toNumber(arrayify(value.id).slice(32, 34)),
1038
+ outputIndex: arrayify(value.id)[32],
1101
1039
  owner: hexlify3(value.owner),
1102
1040
  amount: bn2(value.amount),
1103
1041
  assetId: hexlify3(value.assetId),
@@ -1106,9 +1044,10 @@ var inputify = (value) => {
1106
1044
  txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
1107
1045
  },
1108
1046
  witnessIndex: value.witnessIndex,
1047
+ maturity: value.maturity ?? 0,
1109
1048
  predicateGasUsed: bn2(value.predicateGasUsed),
1110
- predicateLength: bn2(predicate.length),
1111
- predicateDataLength: bn2(predicateData.length),
1049
+ predicateLength: predicate.length,
1050
+ predicateDataLength: predicateData.length,
1112
1051
  predicate: hexlify3(predicate),
1113
1052
  predicateData: hexlify3(predicateData)
1114
1053
  };
@@ -1139,8 +1078,8 @@ var inputify = (value) => {
1139
1078
  nonce: hexlify3(value.nonce),
1140
1079
  witnessIndex: value.witnessIndex,
1141
1080
  predicateGasUsed: bn2(value.predicateGasUsed),
1142
- predicateLength: bn2(predicate.length),
1143
- predicateDataLength: bn2(predicateData.length),
1081
+ predicateLength: predicate.length,
1082
+ predicateDataLength: predicateData.length,
1144
1083
  predicate: hexlify3(predicate),
1145
1084
  predicateData: hexlify3(predicateData),
1146
1085
  data: hexlify3(data),
@@ -1215,7 +1154,7 @@ var outputify = (value) => {
1215
1154
 
1216
1155
  // src/providers/transaction-request/transaction-request.ts
1217
1156
  import { Address, addressify } from "@fuel-ts/address";
1218
- import { BaseAssetId as BaseAssetId2, ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1157
+ import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1219
1158
  import { bn as bn7 } from "@fuel-ts/math";
1220
1159
  import {
1221
1160
  PolicyType,
@@ -1225,7 +1164,6 @@ import {
1225
1164
  TransactionType
1226
1165
  } from "@fuel-ts/transactions";
1227
1166
  import { concat, hexlify as hexlify7 } from "@fuel-ts/utils";
1228
- import { randomBytes } from "ethers";
1229
1167
 
1230
1168
  // src/providers/resource.ts
1231
1169
  var isRawCoin = (resource) => "utxoId" in resource;
@@ -1269,8 +1207,8 @@ function assembleReceiptByType(receipt) {
1269
1207
  case "CALL" /* Call */: {
1270
1208
  const callReceipt = {
1271
1209
  type: ReceiptType.Call,
1272
- from: hexOrZero(receipt.id || receipt.contractId),
1273
- to: hexOrZero(receipt?.to),
1210
+ from: hexOrZero(receipt.contract?.id),
1211
+ to: hexOrZero(receipt?.to?.id),
1274
1212
  amount: bn4(receipt.amount),
1275
1213
  assetId: hexOrZero(receipt.assetId),
1276
1214
  gas: bn4(receipt.gas),
@@ -1284,7 +1222,7 @@ function assembleReceiptByType(receipt) {
1284
1222
  case "RETURN" /* Return */: {
1285
1223
  const returnReceipt = {
1286
1224
  type: ReceiptType.Return,
1287
- id: hexOrZero(receipt.id || receipt.contractId),
1225
+ id: hexOrZero(receipt.contract?.id),
1288
1226
  val: bn4(receipt.val),
1289
1227
  pc: bn4(receipt.pc),
1290
1228
  is: bn4(receipt.is)
@@ -1294,7 +1232,7 @@ function assembleReceiptByType(receipt) {
1294
1232
  case "RETURN_DATA" /* ReturnData */: {
1295
1233
  const returnDataReceipt = {
1296
1234
  type: ReceiptType.ReturnData,
1297
- id: hexOrZero(receipt.id || receipt.contractId),
1235
+ id: hexOrZero(receipt.contract?.id),
1298
1236
  ptr: bn4(receipt.ptr),
1299
1237
  len: bn4(receipt.len),
1300
1238
  digest: hexOrZero(receipt.digest),
@@ -1306,7 +1244,7 @@ function assembleReceiptByType(receipt) {
1306
1244
  case "PANIC" /* Panic */: {
1307
1245
  const panicReceipt = {
1308
1246
  type: ReceiptType.Panic,
1309
- id: hexOrZero(receipt.id),
1247
+ id: hexOrZero(receipt.contract?.id),
1310
1248
  reason: bn4(receipt.reason),
1311
1249
  pc: bn4(receipt.pc),
1312
1250
  is: bn4(receipt.is),
@@ -1317,7 +1255,7 @@ function assembleReceiptByType(receipt) {
1317
1255
  case "REVERT" /* Revert */: {
1318
1256
  const revertReceipt = {
1319
1257
  type: ReceiptType.Revert,
1320
- id: hexOrZero(receipt.id || receipt.contractId),
1258
+ id: hexOrZero(receipt.contract?.id),
1321
1259
  val: bn4(receipt.ra),
1322
1260
  pc: bn4(receipt.pc),
1323
1261
  is: bn4(receipt.is)
@@ -1327,7 +1265,7 @@ function assembleReceiptByType(receipt) {
1327
1265
  case "LOG" /* Log */: {
1328
1266
  const logReceipt = {
1329
1267
  type: ReceiptType.Log,
1330
- id: hexOrZero(receipt.id || receipt.contractId),
1268
+ id: hexOrZero(receipt.contract?.id),
1331
1269
  val0: bn4(receipt.ra),
1332
1270
  val1: bn4(receipt.rb),
1333
1271
  val2: bn4(receipt.rc),
@@ -1340,7 +1278,7 @@ function assembleReceiptByType(receipt) {
1340
1278
  case "LOG_DATA" /* LogData */: {
1341
1279
  const logDataReceipt = {
1342
1280
  type: ReceiptType.LogData,
1343
- id: hexOrZero(receipt.id || receipt.contractId),
1281
+ id: hexOrZero(receipt.contract?.id),
1344
1282
  val0: bn4(receipt.ra),
1345
1283
  val1: bn4(receipt.rb),
1346
1284
  ptr: bn4(receipt.ptr),
@@ -1354,8 +1292,8 @@ function assembleReceiptByType(receipt) {
1354
1292
  case "TRANSFER" /* Transfer */: {
1355
1293
  const transferReceipt = {
1356
1294
  type: ReceiptType.Transfer,
1357
- from: hexOrZero(receipt.id || receipt.contractId),
1358
- to: hexOrZero(receipt.toAddress || receipt?.to),
1295
+ from: hexOrZero(receipt.contract?.id),
1296
+ to: hexOrZero(receipt.toAddress || receipt?.to?.id),
1359
1297
  amount: bn4(receipt.amount),
1360
1298
  assetId: hexOrZero(receipt.assetId),
1361
1299
  pc: bn4(receipt.pc),
@@ -1366,8 +1304,8 @@ function assembleReceiptByType(receipt) {
1366
1304
  case "TRANSFER_OUT" /* TransferOut */: {
1367
1305
  const transferOutReceipt = {
1368
1306
  type: ReceiptType.TransferOut,
1369
- from: hexOrZero(receipt.id || receipt.contractId),
1370
- to: hexOrZero(receipt.toAddress || receipt.to),
1307
+ from: hexOrZero(receipt.contract?.id),
1308
+ to: hexOrZero(receipt.toAddress || receipt.to?.id),
1371
1309
  amount: bn4(receipt.amount),
1372
1310
  assetId: hexOrZero(receipt.assetId),
1373
1311
  pc: bn4(receipt.pc),
@@ -1410,7 +1348,7 @@ function assembleReceiptByType(receipt) {
1410
1348
  return receiptMessageOut;
1411
1349
  }
1412
1350
  case "MINT" /* Mint */: {
1413
- const contractId = hexOrZero(receipt.id || receipt.contractId);
1351
+ const contractId = hexOrZero(receipt.contract?.id);
1414
1352
  const subId = hexOrZero(receipt.subId);
1415
1353
  const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
1416
1354
  const mintReceipt = {
@@ -1425,7 +1363,7 @@ function assembleReceiptByType(receipt) {
1425
1363
  return mintReceipt;
1426
1364
  }
1427
1365
  case "BURN" /* Burn */: {
1428
- const contractId = hexOrZero(receipt.id || receipt.contractId);
1366
+ const contractId = hexOrZero(receipt.contract?.id);
1429
1367
  const subId = hexOrZero(receipt.subId);
1430
1368
  const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
1431
1369
  const burnReceipt = {
@@ -1510,6 +1448,7 @@ var buildBlockExplorerUrl = (options = {}) => {
1510
1448
  import { bn as bn5 } from "@fuel-ts/math";
1511
1449
  import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
1512
1450
  import { arrayify as arrayify3 } from "@fuel-ts/utils";
1451
+ var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn5(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
1513
1452
  var getGasUsedFromReceipts = (receipts) => {
1514
1453
  const scriptResult = receipts.filter(
1515
1454
  (receipt) => receipt.type === ReceiptType2.ScriptResult
@@ -1530,28 +1469,18 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
1530
1469
  }
1531
1470
  function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
1532
1471
  const witnessCache = [];
1533
- const chargeableInputs = inputs.filter((input) => {
1534
- const isCoinOrMessage = "owner" in input || "sender" in input;
1535
- if (isCoinOrMessage) {
1536
- if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1537
- return true;
1538
- }
1539
- if (!witnessCache.includes(input.witnessIndex)) {
1540
- witnessCache.push(input.witnessIndex);
1541
- return true;
1542
- }
1543
- }
1544
- return false;
1545
- });
1546
- const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
1547
- const totalGas = chargeableInputs.reduce((total, input) => {
1472
+ const totalGas = inputs.reduce((total, input) => {
1548
1473
  if ("predicate" in input && input.predicate && input.predicate !== "0x") {
1549
1474
  return total.add(
1550
- vmInitializationCost.add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1475
+ resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
1551
1476
  );
1552
1477
  }
1553
- return total.add(gasCosts.ecr1);
1554
- }, bn5(0));
1478
+ if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
1479
+ witnessCache.push(input.witnessIndex);
1480
+ return total.add(gasCosts.ecr1);
1481
+ }
1482
+ return total;
1483
+ }, bn5());
1555
1484
  return totalGas;
1556
1485
  }
1557
1486
  function getMinGas(params) {
@@ -1563,20 +1492,12 @@ function getMinGas(params) {
1563
1492
  return minGas;
1564
1493
  }
1565
1494
  function getMaxGas(params) {
1566
- const {
1567
- gasPerByte,
1568
- witnessesLength,
1569
- witnessLimit,
1570
- minGas,
1571
- gasLimit = bn5(0),
1572
- maxGasPerTx
1573
- } = params;
1495
+ const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn5(0) } = params;
1574
1496
  let remainingAllowedWitnessGas = bn5(0);
1575
1497
  if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
1576
1498
  remainingAllowedWitnessGas = bn5(witnessLimit).sub(witnessesLength).mul(gasPerByte);
1577
1499
  }
1578
- const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
1579
- return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
1500
+ return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
1580
1501
  }
1581
1502
  function calculateMetadataGasForTxCreate({
1582
1503
  gasCosts,
@@ -1598,10 +1519,6 @@ function calculateMetadataGasForTxScript({
1598
1519
  }) {
1599
1520
  return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
1600
1521
  }
1601
- var calculateGasFee = (params) => {
1602
- const { gas, gasPrice, priceFactor, tip } = params;
1603
- return gas.mul(gasPrice).div(priceFactor).add(tip);
1604
- };
1605
1522
 
1606
1523
  // src/providers/utils/json.ts
1607
1524
  import { hexlify as hexlify5 } from "@fuel-ts/utils";
@@ -1758,7 +1675,7 @@ var witnessify = (value) => {
1758
1675
  // src/providers/transaction-request/transaction-request.ts
1759
1676
  var BaseTransactionRequest = class {
1760
1677
  /** Gas price for transaction */
1761
- tip;
1678
+ gasPrice;
1762
1679
  /** Block until which tx cannot be included */
1763
1680
  maturity;
1764
1681
  /** The maximum fee payable by this transaction using BASE_ASSET. */
@@ -1771,34 +1688,38 @@ var BaseTransactionRequest = class {
1771
1688
  outputs = [];
1772
1689
  /** List of witnesses */
1773
1690
  witnesses = [];
1691
+ /** Base asset ID - should be fetched from the chain */
1692
+ baseAssetId = ZeroBytes324;
1774
1693
  /**
1775
1694
  * Constructor for initializing a base transaction request.
1776
1695
  *
1777
1696
  * @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
1778
1697
  */
1779
1698
  constructor({
1780
- tip,
1699
+ gasPrice,
1781
1700
  maturity,
1782
1701
  maxFee,
1783
1702
  witnessLimit,
1784
1703
  inputs,
1785
1704
  outputs,
1786
- witnesses
1705
+ witnesses,
1706
+ baseAssetId
1787
1707
  } = {}) {
1788
- this.tip = bn7(tip);
1708
+ this.gasPrice = bn7(gasPrice);
1789
1709
  this.maturity = maturity ?? 0;
1790
1710
  this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1791
1711
  this.maxFee = maxFee ? bn7(maxFee) : void 0;
1792
1712
  this.inputs = inputs ?? [];
1793
1713
  this.outputs = outputs ?? [];
1794
1714
  this.witnesses = witnesses ?? [];
1715
+ this.baseAssetId = baseAssetId ?? ZeroBytes324;
1795
1716
  }
1796
1717
  static getPolicyMeta(req) {
1797
1718
  let policyTypes = 0;
1798
1719
  const policies = [];
1799
- if (req.tip) {
1800
- policyTypes += PolicyType.Tip;
1801
- policies.push({ data: req.tip, type: PolicyType.Tip });
1720
+ if (req.gasPrice) {
1721
+ policyTypes += PolicyType.GasPrice;
1722
+ policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
1802
1723
  }
1803
1724
  if (req.witnessLimit) {
1804
1725
  policyTypes += PolicyType.WitnessLimit;
@@ -1985,10 +1906,10 @@ var BaseTransactionRequest = class {
1985
1906
  * @param predicate - Predicate bytes.
1986
1907
  * @param predicateData - Predicate data bytes.
1987
1908
  */
1988
- addCoinInput(coin) {
1909
+ addCoinInput(coin, predicate) {
1989
1910
  const { assetId, owner, amount } = coin;
1990
1911
  let witnessIndex;
1991
- if (coin.predicate) {
1912
+ if (predicate) {
1992
1913
  witnessIndex = 0;
1993
1914
  } else {
1994
1915
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
@@ -2003,7 +1924,9 @@ var BaseTransactionRequest = class {
2003
1924
  amount,
2004
1925
  assetId,
2005
1926
  txPointer: "0x00000000000000000000000000000000",
2006
- witnessIndex
1927
+ witnessIndex,
1928
+ predicate: predicate?.bytes,
1929
+ predicateData: predicate?.predicateDataBytes
2007
1930
  };
2008
1931
  this.pushInput(input);
2009
1932
  this.addChangeOutput(owner, assetId);
@@ -2014,13 +1937,11 @@ var BaseTransactionRequest = class {
2014
1937
  *
2015
1938
  * @param message - Message resource.
2016
1939
  * @param predicate - Predicate bytes.
2017
- * @param predicateData - Predicate data bytes.
2018
1940
  */
2019
- addMessageInput(message) {
1941
+ addMessageInput(message, predicate) {
2020
1942
  const { recipient, sender, amount } = message;
2021
- const assetId = BaseAssetId2;
2022
1943
  let witnessIndex;
2023
- if (message.predicate) {
1944
+ if (predicate) {
2024
1945
  witnessIndex = 0;
2025
1946
  } else {
2026
1947
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
@@ -2034,10 +1955,12 @@ var BaseTransactionRequest = class {
2034
1955
  sender: sender.toB256(),
2035
1956
  recipient: recipient.toB256(),
2036
1957
  amount,
2037
- witnessIndex
1958
+ witnessIndex,
1959
+ predicate: predicate?.bytes,
1960
+ predicateData: predicate?.predicateDataBytes
2038
1961
  };
2039
1962
  this.pushInput(input);
2040
- this.addChangeOutput(recipient, assetId);
1963
+ this.addChangeOutput(recipient, this.baseAssetId);
2041
1964
  }
2042
1965
  /**
2043
1966
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -2065,6 +1988,32 @@ var BaseTransactionRequest = class {
2065
1988
  resources.forEach((resource) => this.addResource(resource));
2066
1989
  return this;
2067
1990
  }
1991
+ /**
1992
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
1993
+ * outputs from the related assetIds.
1994
+ *
1995
+ * @param resources - The resources to add.
1996
+ * @returns This transaction.
1997
+ */
1998
+ addPredicateResource(resource, predicate) {
1999
+ if (isCoin(resource)) {
2000
+ this.addCoinInput(resource, predicate);
2001
+ } else {
2002
+ this.addMessageInput(resource, predicate);
2003
+ }
2004
+ return this;
2005
+ }
2006
+ /**
2007
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
2008
+ * from the related assetIds.
2009
+ *
2010
+ * @param resources - The resources to add.
2011
+ * @returns This transaction.
2012
+ */
2013
+ addPredicateResources(resources, predicate) {
2014
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
2015
+ return this;
2016
+ }
2068
2017
  /**
2069
2018
  * Adds a coin output to the transaction.
2070
2019
  *
@@ -2072,12 +2021,12 @@ var BaseTransactionRequest = class {
2072
2021
  * @param amount - Amount of coin.
2073
2022
  * @param assetId - Asset ID of coin.
2074
2023
  */
2075
- addCoinOutput(to, amount, assetId = BaseAssetId2) {
2024
+ addCoinOutput(to, amount, assetId) {
2076
2025
  this.pushOutput({
2077
2026
  type: OutputType2.Coin,
2078
2027
  to: addressify(to).toB256(),
2079
2028
  amount,
2080
- assetId
2029
+ assetId: assetId ?? this.baseAssetId
2081
2030
  });
2082
2031
  return this;
2083
2032
  }
@@ -2104,7 +2053,7 @@ var BaseTransactionRequest = class {
2104
2053
  * @param to - Address of the owner.
2105
2054
  * @param assetId - Asset ID of coin.
2106
2055
  */
2107
- addChangeOutput(to, assetId = BaseAssetId2) {
2056
+ addChangeOutput(to, assetId) {
2108
2057
  const changeOutput = this.getChangeOutputs().find(
2109
2058
  (output) => hexlify7(output.assetId) === assetId
2110
2059
  );
@@ -2112,7 +2061,7 @@ var BaseTransactionRequest = class {
2112
2061
  this.pushOutput({
2113
2062
  type: OutputType2.Change,
2114
2063
  to: addressify(to).toB256(),
2115
- assetId
2064
+ assetId: assetId ?? this.baseAssetId
2116
2065
  });
2117
2066
  }
2118
2067
  }
@@ -2144,7 +2093,7 @@ var BaseTransactionRequest = class {
2144
2093
  }
2145
2094
  calculateMaxGas(chainInfo, minGas) {
2146
2095
  const { consensusParameters } = chainInfo;
2147
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2096
+ const { gasPerByte } = consensusParameters;
2148
2097
  const witnessesLength = this.toTransaction().witnesses.reduce(
2149
2098
  (acc, wit) => acc + wit.dataLength,
2150
2099
  0
@@ -2153,8 +2102,7 @@ var BaseTransactionRequest = class {
2153
2102
  gasPerByte,
2154
2103
  minGas,
2155
2104
  witnessesLength,
2156
- witnessLimit: this.witnessLimit,
2157
- maxGasPerTx
2105
+ witnessLimit: this.witnessLimit
2158
2106
  });
2159
2107
  }
2160
2108
  /**
@@ -2164,6 +2112,12 @@ var BaseTransactionRequest = class {
2164
2112
  * @param quantities - CoinQuantity Array.
2165
2113
  */
2166
2114
  fundWithFakeUtxos(quantities, resourcesOwner) {
2115
+ let idCounter = 0;
2116
+ const generateId = () => {
2117
+ const counterString = String(idCounter++);
2118
+ const id = ZeroBytes324.slice(0, -counterString.length).concat(counterString);
2119
+ return id;
2120
+ };
2167
2121
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2168
2122
  if ("assetId" in input) {
2169
2123
  return input.assetId === assetId;
@@ -2172,27 +2126,24 @@ var BaseTransactionRequest = class {
2172
2126
  });
2173
2127
  const updateAssetInput = (assetId, quantity) => {
2174
2128
  const assetInput = findAssetInput(assetId);
2175
- let usedQuantity = quantity;
2176
- if (assetId === BaseAssetId2) {
2177
- usedQuantity = bn7("1000000000000000000");
2178
- }
2179
2129
  if (assetInput && "assetId" in assetInput) {
2180
- assetInput.id = hexlify7(randomBytes(34));
2181
- assetInput.amount = usedQuantity;
2130
+ assetInput.id = generateId();
2131
+ assetInput.amount = quantity;
2182
2132
  } else {
2183
2133
  this.addResources([
2184
2134
  {
2185
- id: hexlify7(randomBytes(34)),
2186
- amount: usedQuantity,
2135
+ id: generateId(),
2136
+ amount: quantity,
2187
2137
  assetId,
2188
2138
  owner: resourcesOwner || Address.fromRandom(),
2139
+ maturity: 0,
2189
2140
  blockCreated: bn7(1),
2190
2141
  txCreatedIdx: bn7(1)
2191
2142
  }
2192
2143
  ]);
2193
2144
  }
2194
2145
  };
2195
- updateAssetInput(BaseAssetId2, bn7(1e11));
2146
+ updateAssetInput(this.baseAssetId, bn7(1e11));
2196
2147
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2197
2148
  }
2198
2149
  /**
@@ -2217,7 +2168,7 @@ var BaseTransactionRequest = class {
2217
2168
  toJSON() {
2218
2169
  return normalizeJSON(this);
2219
2170
  }
2220
- updatePredicateGasUsed(inputs) {
2171
+ updatePredicateInputs(inputs) {
2221
2172
  this.inputs.forEach((i) => {
2222
2173
  let correspondingInput;
2223
2174
  switch (i.type) {
@@ -2239,15 +2190,6 @@ var BaseTransactionRequest = class {
2239
2190
  }
2240
2191
  });
2241
2192
  }
2242
- shiftPredicateData() {
2243
- this.inputs.forEach((input) => {
2244
- if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
2245
- input.predicateData = input.paddPredicateData(
2246
- BaseTransactionRequest.getPolicyMeta(this).policies.length
2247
- );
2248
- }
2249
- });
2250
- }
2251
2193
  };
2252
2194
 
2253
2195
  // src/providers/transaction-request/create-transaction-request.ts
@@ -2394,8 +2336,9 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2394
2336
  return {
2395
2337
  type: TransactionType3.Create,
2396
2338
  ...baseTransaction,
2339
+ bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2397
2340
  bytecodeWitnessIndex,
2398
- storageSlotsCount: bn9(storageSlots.length),
2341
+ storageSlotsCount: storageSlots.length,
2399
2342
  salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
2400
2343
  storageSlots
2401
2344
  };
@@ -2518,8 +2461,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2518
2461
  type: TransactionType4.Script,
2519
2462
  scriptGasLimit: this.gasLimit,
2520
2463
  ...super.getBaseTransaction(),
2521
- scriptLength: bn10(script.length),
2522
- scriptDataLength: bn10(scriptData.length),
2464
+ scriptLength: script.length,
2465
+ scriptDataLength: scriptData.length,
2523
2466
  receiptsRoot: ZeroBytes327,
2524
2467
  script: hexlify10(script),
2525
2468
  scriptData: hexlify10(scriptData)
@@ -2583,7 +2526,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2583
2526
  }
2584
2527
  calculateMaxGas(chainInfo, minGas) {
2585
2528
  const { consensusParameters } = chainInfo;
2586
- const { gasPerByte, maxGasPerTx } = consensusParameters;
2529
+ const { gasPerByte } = consensusParameters;
2587
2530
  const witnessesLength = this.toTransaction().witnesses.reduce(
2588
2531
  (acc, wit) => acc + wit.dataLength,
2589
2532
  0
@@ -2593,8 +2536,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2593
2536
  minGas,
2594
2537
  witnessesLength,
2595
2538
  witnessLimit: this.witnessLimit,
2596
- gasLimit: this.gasLimit,
2597
- maxGasPerTx
2539
+ gasLimit: this.gasLimit
2598
2540
  });
2599
2541
  }
2600
2542
  /**
@@ -2651,7 +2593,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2651
2593
 
2652
2594
  // src/providers/transaction-request/utils.ts
2653
2595
  import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2654
- import { TransactionType as TransactionType5, InputType as InputType5 } from "@fuel-ts/transactions";
2596
+ import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2655
2597
  var transactionRequestify = (obj) => {
2656
2598
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2657
2599
  return obj;
@@ -2669,31 +2611,14 @@ var transactionRequestify = (obj) => {
2669
2611
  }
2670
2612
  }
2671
2613
  };
2672
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2673
- (acc, input) => {
2674
- if (input.type === InputType5.Coin && input.owner === owner) {
2675
- acc.utxos.push(input.id);
2676
- }
2677
- if (input.type === InputType5.Message && input.recipient === owner) {
2678
- acc.messages.push(input.nonce);
2679
- }
2680
- return acc;
2681
- },
2682
- {
2683
- utxos: [],
2684
- messages: []
2685
- }
2686
- );
2687
2614
 
2688
2615
  // src/providers/transaction-response/transaction-response.ts
2689
2616
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2690
- import { bn as bn15 } from "@fuel-ts/math";
2617
+ import { bn as bn14 } from "@fuel-ts/math";
2691
2618
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2692
2619
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2693
2620
 
2694
2621
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2695
- import { bn as bn14 } from "@fuel-ts/math";
2696
- import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2697
2622
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2698
2623
 
2699
2624
  // src/providers/transaction-summary/calculate-transaction-fee.ts
@@ -2702,10 +2627,9 @@ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, Trans
2702
2627
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2703
2628
  var calculateTransactionFee = (params) => {
2704
2629
  const {
2705
- gasPrice,
2630
+ gasUsed,
2706
2631
  rawPayload,
2707
- tip,
2708
- consensusParameters: { gasCosts, feeParams, maxGasPerTx }
2632
+ consensusParameters: { gasCosts, feeParams }
2709
2633
  } = params;
2710
2634
  const gasPerByte = bn11(feeParams.gasPerByte);
2711
2635
  const gasPriceFactor = bn11(feeParams.gasPriceFactor);
@@ -2715,7 +2639,8 @@ var calculateTransactionFee = (params) => {
2715
2639
  return {
2716
2640
  fee: bn11(0),
2717
2641
  minFee: bn11(0),
2718
- maxFee: bn11(0)
2642
+ maxFee: bn11(0),
2643
+ feeFromGasUsed: bn11(0)
2719
2644
  };
2720
2645
  }
2721
2646
  const { type, witnesses, inputs, policies } = transaction;
@@ -2747,6 +2672,7 @@ var calculateTransactionFee = (params) => {
2747
2672
  metadataGas,
2748
2673
  txBytesSize: transactionBytes.length
2749
2674
  });
2675
+ const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2750
2676
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2751
2677
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2752
2678
  const maxGas = getMaxGas({
@@ -2754,25 +2680,17 @@ var calculateTransactionFee = (params) => {
2754
2680
  minGas,
2755
2681
  witnessesLength,
2756
2682
  gasLimit,
2757
- witnessLimit,
2758
- maxGasPerTx
2759
- });
2760
- const minFee = calculateGasFee({
2761
- gasPrice,
2762
- gas: minGas,
2763
- priceFactor: gasPriceFactor,
2764
- tip
2765
- });
2766
- const maxFee = calculateGasFee({
2767
- gasPrice,
2768
- gas: maxGas,
2769
- priceFactor: gasPriceFactor,
2770
- tip
2683
+ witnessLimit
2771
2684
  });
2685
+ const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
2686
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
2687
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
2688
+ const fee = minFee.add(feeFromGasUsed);
2772
2689
  return {
2690
+ fee,
2773
2691
  minFee,
2774
2692
  maxFee,
2775
- fee: maxFee
2693
+ feeFromGasUsed
2776
2694
  };
2777
2695
  };
2778
2696
 
@@ -2828,7 +2746,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2828
2746
 
2829
2747
  // src/providers/transaction-summary/input.ts
2830
2748
  import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2831
- import { InputType as InputType6 } from "@fuel-ts/transactions";
2749
+ import { InputType as InputType5 } from "@fuel-ts/transactions";
2832
2750
  function getInputsByTypes(inputs, types) {
2833
2751
  return inputs.filter((i) => types.includes(i.type));
2834
2752
  }
@@ -2836,16 +2754,16 @@ function getInputsByType(inputs, type) {
2836
2754
  return inputs.filter((i) => i.type === type);
2837
2755
  }
2838
2756
  function getInputsCoin(inputs) {
2839
- return getInputsByType(inputs, InputType6.Coin);
2757
+ return getInputsByType(inputs, InputType5.Coin);
2840
2758
  }
2841
2759
  function getInputsMessage(inputs) {
2842
- return getInputsByType(inputs, InputType6.Message);
2760
+ return getInputsByType(inputs, InputType5.Message);
2843
2761
  }
2844
2762
  function getInputsCoinAndMessage(inputs) {
2845
- return getInputsByTypes(inputs, [InputType6.Coin, InputType6.Message]);
2763
+ return getInputsByTypes(inputs, [InputType5.Coin, InputType5.Message]);
2846
2764
  }
2847
2765
  function getInputsContract(inputs) {
2848
- return getInputsByType(inputs, InputType6.Contract);
2766
+ return getInputsByType(inputs, InputType5.Contract);
2849
2767
  }
2850
2768
  function getInputFromAssetId(inputs, assetId) {
2851
2769
  const coinInputs = getInputsCoin(inputs);
@@ -2864,7 +2782,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
2864
2782
  if (!contractInput) {
2865
2783
  return void 0;
2866
2784
  }
2867
- if (contractInput.type !== InputType6.Contract) {
2785
+ if (contractInput.type !== InputType5.Contract) {
2868
2786
  throw new FuelError9(
2869
2787
  ErrorCode9.INVALID_TRANSACTION_INPUT,
2870
2788
  `Contract input should be of type 'contract'.`
@@ -2873,10 +2791,10 @@ function getInputContractFromIndex(inputs, inputIndex) {
2873
2791
  return contractInput;
2874
2792
  }
2875
2793
  function getInputAccountAddress(input) {
2876
- if (input.type === InputType6.Coin) {
2794
+ if (input.type === InputType5.Coin) {
2877
2795
  return input.owner.toString();
2878
2796
  }
2879
- if (input.type === InputType6.Message) {
2797
+ if (input.type === InputType5.Message) {
2880
2798
  return input.recipient.toString();
2881
2799
  }
2882
2800
  return "";
@@ -3386,9 +3304,7 @@ function assembleTransactionSummary(params) {
3386
3304
  gqlTransactionStatus,
3387
3305
  abiMap = {},
3388
3306
  maxInputs,
3389
- gasCosts,
3390
- maxGasPerTx,
3391
- gasPrice
3307
+ gasCosts
3392
3308
  } = params;
3393
3309
  const gasUsed = getGasUsedFromReceipts(receipts);
3394
3310
  const rawPayload = hexlify11(transactionBytes);
@@ -3402,14 +3318,11 @@ function assembleTransactionSummary(params) {
3402
3318
  maxInputs
3403
3319
  });
3404
3320
  const typeName = getTransactionTypeName(transaction.type);
3405
- const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3406
3321
  const { fee } = calculateTransactionFee({
3407
- gasPrice,
3322
+ gasUsed,
3408
3323
  rawPayload,
3409
- tip,
3410
3324
  consensusParameters: {
3411
3325
  gasCosts,
3412
- maxGasPerTx,
3413
3326
  feeParams: {
3414
3327
  gasPerByte,
3415
3328
  gasPriceFactor
@@ -3469,7 +3382,7 @@ var TransactionResponse = class {
3469
3382
  /** Current provider */
3470
3383
  provider;
3471
3384
  /** Gas used on the transaction */
3472
- gasUsed = bn15(0);
3385
+ gasUsed = bn14(0);
3473
3386
  /** The graphql Transaction with receipts object. */
3474
3387
  gqlTransaction;
3475
3388
  abis;
@@ -3547,13 +3460,8 @@ var TransactionResponse = class {
3547
3460
  const decodedTransaction = this.decodeTransaction(
3548
3461
  transaction
3549
3462
  );
3550
- let txReceipts = [];
3551
- if (transaction?.status && "receipts" in transaction.status) {
3552
- txReceipts = transaction.status.receipts;
3553
- }
3554
- const receipts = txReceipts.map(processGqlReceipt) || [];
3555
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
3556
- const gasPrice = await this.provider.getLatestGasPrice();
3463
+ const receipts = transaction.receipts?.map(processGqlReceipt) || [];
3464
+ const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
3557
3465
  const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
3558
3466
  const transactionSummary = assembleTransactionSummary({
3559
3467
  id: this.id,
@@ -3565,9 +3473,7 @@ var TransactionResponse = class {
3565
3473
  gasPriceFactor,
3566
3474
  abiMap: contractsAbiMap,
3567
3475
  maxInputs,
3568
- gasCosts,
3569
- maxGasPerTx,
3570
- gasPrice
3476
+ gasCosts
3571
3477
  });
3572
3478
  return transactionSummary;
3573
3479
  }
@@ -3694,29 +3600,30 @@ var processGqlChain = (chain) => {
3694
3600
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3695
3601
  return {
3696
3602
  name,
3697
- baseChainHeight: bn16(daHeight),
3603
+ baseChainHeight: bn15(daHeight),
3698
3604
  consensusParameters: {
3699
- contractMaxSize: bn16(contractParams.contractMaxSize),
3700
- maxInputs: bn16(txParams.maxInputs),
3701
- maxOutputs: bn16(txParams.maxOutputs),
3702
- maxWitnesses: bn16(txParams.maxWitnesses),
3703
- maxGasPerTx: bn16(txParams.maxGasPerTx),
3704
- maxScriptLength: bn16(scriptParams.maxScriptLength),
3705
- maxScriptDataLength: bn16(scriptParams.maxScriptDataLength),
3706
- maxStorageSlots: bn16(contractParams.maxStorageSlots),
3707
- maxPredicateLength: bn16(predicateParams.maxPredicateLength),
3708
- maxPredicateDataLength: bn16(predicateParams.maxPredicateDataLength),
3709
- maxGasPerPredicate: bn16(predicateParams.maxGasPerPredicate),
3710
- gasPriceFactor: bn16(feeParams.gasPriceFactor),
3711
- gasPerByte: bn16(feeParams.gasPerByte),
3712
- maxMessageDataLength: bn16(predicateParams.maxMessageDataLength),
3713
- chainId: bn16(consensusParameters.chainId),
3605
+ contractMaxSize: bn15(contractParams.contractMaxSize),
3606
+ maxInputs: bn15(txParams.maxInputs),
3607
+ maxOutputs: bn15(txParams.maxOutputs),
3608
+ maxWitnesses: bn15(txParams.maxWitnesses),
3609
+ maxGasPerTx: bn15(txParams.maxGasPerTx),
3610
+ maxScriptLength: bn15(scriptParams.maxScriptLength),
3611
+ maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3612
+ maxStorageSlots: bn15(contractParams.maxStorageSlots),
3613
+ maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3614
+ maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3615
+ maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3616
+ gasPriceFactor: bn15(feeParams.gasPriceFactor),
3617
+ gasPerByte: bn15(feeParams.gasPerByte),
3618
+ maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3619
+ chainId: bn15(consensusParameters.chainId),
3620
+ baseAssetId: consensusParameters.baseAssetId,
3714
3621
  gasCosts
3715
3622
  },
3716
3623
  gasCosts,
3717
3624
  latestBlock: {
3718
3625
  id: latestBlock.id,
3719
- height: bn16(latestBlock.height),
3626
+ height: bn15(latestBlock.header.height),
3720
3627
  time: latestBlock.header.time,
3721
3628
  transactions: latestBlock.transactions.map((i) => ({
3722
3629
  id: i.id
@@ -3810,8 +3717,10 @@ var _Provider = class {
3810
3717
  * Returns some helpful parameters related to gas fees.
3811
3718
  */
3812
3719
  getGasConfig() {
3720
+ const { minGasPrice } = this.getNode();
3813
3721
  const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
3814
3722
  return {
3723
+ minGasPrice,
3815
3724
  maxGasPerTx,
3816
3725
  maxGasPerPredicate,
3817
3726
  gasPriceFactor,
@@ -3909,7 +3818,7 @@ var _Provider = class {
3909
3818
  */
3910
3819
  async getBlockNumber() {
3911
3820
  const { chain } = await this.operations.getChain();
3912
- return bn16(chain.latestBlock.height, 10);
3821
+ return bn15(chain.latestBlock.header.height, 10);
3913
3822
  }
3914
3823
  /**
3915
3824
  * Returns the chain information.
@@ -3919,11 +3828,13 @@ var _Provider = class {
3919
3828
  async fetchNode() {
3920
3829
  const { nodeInfo } = await this.operations.getNodeInfo();
3921
3830
  const processedNodeInfo = {
3922
- maxDepth: bn16(nodeInfo.maxDepth),
3923
- maxTx: bn16(nodeInfo.maxTx),
3831
+ maxDepth: bn15(nodeInfo.maxDepth),
3832
+ maxTx: bn15(nodeInfo.maxTx),
3833
+ minGasPrice: bn15(nodeInfo.minGasPrice),
3924
3834
  nodeVersion: nodeInfo.nodeVersion,
3925
3835
  utxoValidation: nodeInfo.utxoValidation,
3926
- vmBacktrace: nodeInfo.vmBacktrace
3836
+ vmBacktrace: nodeInfo.vmBacktrace,
3837
+ peers: nodeInfo.peers
3927
3838
  };
3928
3839
  _Provider.nodeInfoCache[this.url] = processedNodeInfo;
3929
3840
  return processedNodeInfo;
@@ -3949,6 +3860,17 @@ var _Provider = class {
3949
3860
  } = this.getChain();
3950
3861
  return chainId.toNumber();
3951
3862
  }
3863
+ /**
3864
+ * Returns the base asset ID
3865
+ *
3866
+ * @returns A promise that resolves to the base asset ID
3867
+ */
3868
+ getBaseAssetId() {
3869
+ const {
3870
+ consensusParameters: { baseAssetId }
3871
+ } = this.getChain();
3872
+ return baseAssetId;
3873
+ }
3952
3874
  /**
3953
3875
  * Submits a transaction to the chain to be executed.
3954
3876
  *
@@ -4009,13 +3931,14 @@ var _Provider = class {
4009
3931
  return this.estimateTxDependencies(transactionRequest);
4010
3932
  }
4011
3933
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4012
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4013
- encodedTransactions: encodedTransaction,
3934
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
3935
+ encodedTransaction,
4014
3936
  utxoValidation: utxoValidation || false
4015
3937
  });
4016
- const [{ receipts: rawReceipts, status }] = dryRunStatuses;
4017
- const receipts = rawReceipts.map(processGqlReceipt);
4018
- return { receipts, dryrunStatus: status };
3938
+ const receipts = gqlReceipts.map(processGqlReceipt);
3939
+ return {
3940
+ receipts
3941
+ };
4019
3942
  }
4020
3943
  /**
4021
3944
  * Verifies whether enough gas is available to complete transaction.
@@ -4041,7 +3964,7 @@ var _Provider = class {
4041
3964
  } = response;
4042
3965
  if (inputs) {
4043
3966
  inputs.forEach((input, index) => {
4044
- if ("predicateGasUsed" in input && bn16(input.predicateGasUsed).gt(0)) {
3967
+ if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
4045
3968
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4046
3969
  }
4047
3970
  });
@@ -4054,6 +3977,9 @@ var _Provider = class {
4054
3977
  * If there are missing variable outputs,
4055
3978
  * `addVariableOutputs` is called on the transaction.
4056
3979
  *
3980
+ * @privateRemarks
3981
+ * TODO: Investigate support for missing contract IDs
3982
+ * TODO: Add support for missing output messages
4057
3983
  *
4058
3984
  * @param transactionRequest - The transaction request object.
4059
3985
  * @returns A promise.
@@ -4066,19 +3992,16 @@ var _Provider = class {
4066
3992
  missingContractIds: []
4067
3993
  };
4068
3994
  }
3995
+ await this.estimatePredicates(transactionRequest);
4069
3996
  let receipts = [];
4070
3997
  const missingContractIds = [];
4071
3998
  let outputVariables = 0;
4072
- let dryrunStatus;
4073
3999
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
4074
- const {
4075
- dryRun: [{ receipts: rawReceipts, status }]
4076
- } = await this.operations.dryRun({
4077
- encodedTransactions: [hexlify12(transactionRequest.toTransactionBytes())],
4000
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
4001
+ encodedTransaction: hexlify12(transactionRequest.toTransactionBytes()),
4078
4002
  utxoValidation: false
4079
4003
  });
4080
- receipts = rawReceipts.map(processGqlReceipt);
4081
- dryrunStatus = status;
4004
+ receipts = gqlReceipts.map(processGqlReceipt);
4082
4005
  const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
4083
4006
  const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
4084
4007
  if (hasMissingOutputs) {
@@ -4088,11 +4011,6 @@ var _Provider = class {
4088
4011
  transactionRequest.addContractInputAndOutput(Address2.fromString(contractId));
4089
4012
  missingContractIds.push(contractId);
4090
4013
  });
4091
- const { maxFee } = await this.estimateTxGasAndFee({
4092
- transactionRequest,
4093
- optimizeGas: false
4094
- });
4095
- transactionRequest.maxFee = maxFee;
4096
4014
  } else {
4097
4015
  break;
4098
4016
  }
@@ -4100,133 +4018,7 @@ var _Provider = class {
4100
4018
  return {
4101
4019
  receipts,
4102
4020
  outputVariables,
4103
- missingContractIds,
4104
- dryrunStatus
4105
- };
4106
- }
4107
- /**
4108
- * Dry runs multiple transactions and checks for missing dependencies in batches.
4109
- *
4110
- * Transactions are dry run in batches. After each dry run, transactions requiring
4111
- * further modifications are identified. The method iteratively updates these transactions
4112
- * and performs subsequent dry runs until all dependencies for each transaction are satisfied.
4113
- *
4114
- * @param transactionRequests - Array of transaction request objects.
4115
- * @returns A promise that resolves to an array of results for each transaction.
4116
- */
4117
- async estimateMultipleTxDependencies(transactionRequests) {
4118
- const results = transactionRequests.map(() => ({
4119
- receipts: [],
4120
- outputVariables: 0,
4121
- missingContractIds: [],
4122
- dryrunStatus: void 0
4123
- }));
4124
- const allRequests = clone3(transactionRequests);
4125
- const serializedTransactionsMap = /* @__PURE__ */ new Map();
4126
- allRequests.forEach((req, index) => {
4127
- if (req.type === TransactionType8.Script) {
4128
- serializedTransactionsMap.set(index, hexlify12(req.toTransactionBytes()));
4129
- }
4130
- });
4131
- let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
4132
- let attempt = 0;
4133
- while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
4134
- const encodedTransactions = transactionsToProcess.map(
4135
- (index) => serializedTransactionsMap.get(index)
4136
- );
4137
- const dryRunResults = await this.operations.dryRun({
4138
- encodedTransactions,
4139
- utxoValidation: false
4140
- });
4141
- const nextRoundTransactions = [];
4142
- for (let i = 0; i < dryRunResults.dryRun.length; i++) {
4143
- const currentResultIndex = transactionsToProcess[i];
4144
- const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
4145
- results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
4146
- results[currentResultIndex].dryrunStatus = status;
4147
- const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
4148
- results[currentResultIndex].receipts
4149
- );
4150
- const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
4151
- const requestToProcess = allRequests[currentResultIndex];
4152
- if (hasMissingOutputs && requestToProcess?.type === TransactionType8.Script) {
4153
- results[currentResultIndex].outputVariables += missingOutputVariables.length;
4154
- requestToProcess.addVariableOutputs(missingOutputVariables.length);
4155
- missingOutputContractIds.forEach(({ contractId }) => {
4156
- requestToProcess.addContractInputAndOutput(Address2.fromString(contractId));
4157
- results[currentResultIndex].missingContractIds.push(contractId);
4158
- });
4159
- const { maxFee } = await this.estimateTxGasAndFee({
4160
- transactionRequest: requestToProcess,
4161
- optimizeGas: false
4162
- });
4163
- requestToProcess.maxFee = maxFee;
4164
- serializedTransactionsMap.set(
4165
- currentResultIndex,
4166
- hexlify12(requestToProcess.toTransactionBytes())
4167
- );
4168
- nextRoundTransactions.push(currentResultIndex);
4169
- allRequests[currentResultIndex] = requestToProcess;
4170
- }
4171
- }
4172
- transactionsToProcess = nextRoundTransactions;
4173
- attempt += 1;
4174
- }
4175
- return results;
4176
- }
4177
- async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
4178
- if (estimateTxDependencies) {
4179
- return this.estimateMultipleTxDependencies(transactionRequests);
4180
- }
4181
- const encodedTransactions = transactionRequests.map((tx) => hexlify12(tx.toTransactionBytes()));
4182
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4183
- encodedTransactions,
4184
- utxoValidation: utxoValidation || false
4185
- });
4186
- const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
4187
- const receipts = rawReceipts.map(processGqlReceipt);
4188
- return { receipts, dryrunStatus: status };
4189
- });
4190
- return results;
4191
- }
4192
- async estimateTxGasAndFee(params) {
4193
- const { transactionRequest, optimizeGas = true } = params;
4194
- let { gasPrice } = params;
4195
- const chainInfo = this.getChain();
4196
- const { gasPriceFactor } = this.getGasConfig();
4197
- const minGas = transactionRequest.calculateMinGas(chainInfo);
4198
- if (!gasPrice) {
4199
- gasPrice = await this.estimateGasPrice(10);
4200
- }
4201
- const minFee = calculateGasFee({
4202
- gasPrice: bn16(gasPrice),
4203
- gas: minGas,
4204
- priceFactor: gasPriceFactor,
4205
- tip: transactionRequest.tip
4206
- }).add(1);
4207
- let gasLimit = bn16(0);
4208
- if (transactionRequest.type === TransactionType8.Script) {
4209
- gasLimit = transactionRequest.gasLimit;
4210
- if (!optimizeGas) {
4211
- transactionRequest.gasLimit = minGas;
4212
- gasLimit = transactionRequest.calculateMaxGas(chainInfo, minGas);
4213
- transactionRequest.gasLimit = gasLimit;
4214
- }
4215
- }
4216
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4217
- const maxFee = calculateGasFee({
4218
- gasPrice: bn16(gasPrice),
4219
- gas: maxGas,
4220
- priceFactor: gasPriceFactor,
4221
- tip: transactionRequest.tip
4222
- }).add(1);
4223
- return {
4224
- minGas,
4225
- minFee,
4226
- maxGas,
4227
- maxFee,
4228
- gasPrice,
4229
- gasLimit
4021
+ missingContractIds
4230
4022
  };
4231
4023
  }
4232
4024
  /**
@@ -4244,17 +4036,15 @@ var _Provider = class {
4244
4036
  if (estimateTxDependencies) {
4245
4037
  return this.estimateTxDependencies(transactionRequest);
4246
4038
  }
4247
- const encodedTransactions = [hexlify12(transactionRequest.toTransactionBytes())];
4248
- const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4249
- encodedTransactions,
4039
+ const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
4040
+ const { dryRun: gqlReceipts } = await this.operations.dryRun({
4041
+ encodedTransaction,
4250
4042
  utxoValidation: true
4251
4043
  });
4252
- const callResult = dryRunStatuses.map((dryRunStatus) => {
4253
- const { id, receipts, status } = dryRunStatus;
4254
- const processedReceipts = receipts.map(processGqlReceipt);
4255
- return { id, receipts: processedReceipts, status };
4256
- });
4257
- return { receipts: callResult[0].receipts };
4044
+ const receipts = gqlReceipts.map(processGqlReceipt);
4045
+ return {
4046
+ receipts
4047
+ };
4258
4048
  }
4259
4049
  /**
4260
4050
  * Returns a transaction cost to enable user
@@ -4271,80 +4061,80 @@ var _Provider = class {
4271
4061
  * @param tolerance - The tolerance to add on top of the gasUsed.
4272
4062
  * @returns A promise that resolves to the transaction cost object.
4273
4063
  */
4274
- async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
4064
+ async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
4065
+ estimateTxDependencies = true,
4066
+ estimatePredicates = true,
4067
+ resourcesOwner,
4068
+ signatureCallback
4069
+ } = {}) {
4275
4070
  const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
4071
+ const chainInfo = this.getChain();
4072
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4073
+ const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
4276
4074
  const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
4277
4075
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4278
- const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4076
+ const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4279
4077
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4280
- txRequestClone.maxFee = bn16(0);
4281
- if (isScriptTransaction) {
4282
- txRequestClone.gasLimit = bn16(0);
4283
- }
4284
- if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4285
- resourcesOwner.populateTransactionPredicateData(txRequestClone);
4078
+ if (estimatePredicates) {
4079
+ if (isScriptTransaction) {
4080
+ txRequestClone.gasLimit = bn15(0);
4081
+ }
4082
+ if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4083
+ resourcesOwner.populateTransactionPredicateData(txRequestClone);
4084
+ }
4085
+ await this.estimatePredicates(txRequestClone);
4286
4086
  }
4287
- const signedRequest = clone3(txRequestClone);
4288
- let addedSignatures = 0;
4289
4087
  if (signatureCallback && isScriptTransaction) {
4290
- const lengthBefore = signedRequest.witnesses.length;
4291
- await signatureCallback(signedRequest);
4292
- addedSignatures = signedRequest.witnesses.length - lengthBefore;
4293
- }
4294
- await this.estimatePredicates(signedRequest);
4295
- let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
4296
- transactionRequest: signedRequest,
4297
- optimizeGas: false
4298
- });
4299
- txRequestClone.maxFee = maxFee;
4088
+ await signatureCallback(txRequestClone);
4089
+ }
4090
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
4091
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
4300
4092
  let receipts = [];
4301
4093
  let missingContractIds = [];
4302
4094
  let outputVariables = 0;
4303
- let gasUsed = bn16(0);
4304
- txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
4305
- if (isScriptTransaction) {
4306
- if (signatureCallback) {
4307
- await signatureCallback(txRequestClone);
4308
- }
4309
- txRequestClone.gasLimit = gasLimit;
4095
+ if (isScriptTransaction && estimateTxDependencies) {
4096
+ txRequestClone.gasPrice = bn15(0);
4097
+ txRequestClone.gasLimit = bn15(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4310
4098
  const result = await this.estimateTxDependencies(txRequestClone);
4311
4099
  receipts = result.receipts;
4312
4100
  outputVariables = result.outputVariables;
4313
4101
  missingContractIds = result.missingContractIds;
4314
- gasUsed = getGasUsedFromReceipts(receipts);
4315
- txRequestClone.gasLimit = gasUsed;
4316
- ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
4317
- transactionRequest: txRequestClone,
4318
- gasPrice
4319
- }));
4320
4102
  }
4103
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
4104
+ const usedFee = calculatePriceWithFactor(
4105
+ gasUsed,
4106
+ gasPrice,
4107
+ gasPriceFactor
4108
+ ).normalizeZeroToOne();
4109
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4110
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4321
4111
  return {
4322
4112
  requiredQuantities: allQuantities,
4323
4113
  receipts,
4324
4114
  gasUsed,
4115
+ minGasPrice,
4325
4116
  gasPrice,
4326
4117
  minGas,
4327
4118
  maxGas,
4119
+ usedFee,
4328
4120
  minFee,
4329
4121
  maxFee,
4122
+ estimatedInputs: txRequestClone.inputs,
4330
4123
  outputVariables,
4331
- missingContractIds,
4332
- addedSignatures,
4333
- estimatedPredicates: txRequestClone.inputs
4124
+ missingContractIds
4334
4125
  };
4335
4126
  }
4336
- async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
4127
+ async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
4337
4128
  const ownerAddress = Address2.fromAddressOrString(owner);
4338
4129
  const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
4339
- const transactionCost = await this.getTransactionCost(transactionRequest, {
4340
- quantitiesToContract
4341
- });
4130
+ const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
4342
4131
  transactionRequest.addResources(
4343
4132
  await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
4344
4133
  );
4345
- const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
4346
- quantitiesToContract
4347
- });
4134
+ const { requiredQuantities, ...txCost } = await this.getTransactionCost(
4135
+ transactionRequest,
4136
+ forwardingQuantities
4137
+ );
4348
4138
  const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
4349
4139
  return {
4350
4140
  resources,
@@ -4366,10 +4156,11 @@ var _Provider = class {
4366
4156
  return coins.map((coin) => ({
4367
4157
  id: coin.utxoId,
4368
4158
  assetId: coin.assetId,
4369
- amount: bn16(coin.amount),
4159
+ amount: bn15(coin.amount),
4370
4160
  owner: Address2.fromAddressOrString(coin.owner),
4371
- blockCreated: bn16(coin.blockCreated),
4372
- txCreatedIdx: bn16(coin.txCreatedIdx)
4161
+ maturity: bn15(coin.maturity).toNumber(),
4162
+ blockCreated: bn15(coin.blockCreated),
4163
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4373
4164
  }));
4374
4165
  }
4375
4166
  /**
@@ -4406,9 +4197,9 @@ var _Provider = class {
4406
4197
  switch (coin.__typename) {
4407
4198
  case "MessageCoin":
4408
4199
  return {
4409
- amount: bn16(coin.amount),
4200
+ amount: bn15(coin.amount),
4410
4201
  assetId: coin.assetId,
4411
- daHeight: bn16(coin.daHeight),
4202
+ daHeight: bn15(coin.daHeight),
4412
4203
  sender: Address2.fromAddressOrString(coin.sender),
4413
4204
  recipient: Address2.fromAddressOrString(coin.recipient),
4414
4205
  nonce: coin.nonce
@@ -4416,11 +4207,12 @@ var _Provider = class {
4416
4207
  case "Coin":
4417
4208
  return {
4418
4209
  id: coin.utxoId,
4419
- amount: bn16(coin.amount),
4210
+ amount: bn15(coin.amount),
4420
4211
  assetId: coin.assetId,
4421
4212
  owner: Address2.fromAddressOrString(coin.owner),
4422
- blockCreated: bn16(coin.blockCreated),
4423
- txCreatedIdx: bn16(coin.txCreatedIdx)
4213
+ maturity: bn15(coin.maturity).toNumber(),
4214
+ blockCreated: bn15(coin.blockCreated),
4215
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4424
4216
  };
4425
4217
  default:
4426
4218
  return null;
@@ -4437,13 +4229,13 @@ var _Provider = class {
4437
4229
  async getBlock(idOrHeight) {
4438
4230
  let variables;
4439
4231
  if (typeof idOrHeight === "number") {
4440
- variables = { height: bn16(idOrHeight).toString(10) };
4232
+ variables = { height: bn15(idOrHeight).toString(10) };
4441
4233
  } else if (idOrHeight === "latest") {
4442
4234
  variables = { height: (await this.getBlockNumber()).toString(10) };
4443
4235
  } else if (idOrHeight.length === 66) {
4444
4236
  variables = { blockId: idOrHeight };
4445
4237
  } else {
4446
- variables = { blockId: bn16(idOrHeight).toString(10) };
4238
+ variables = { blockId: bn15(idOrHeight).toString(10) };
4447
4239
  }
4448
4240
  const { block } = await this.operations.getBlock(variables);
4449
4241
  if (!block) {
@@ -4451,7 +4243,7 @@ var _Provider = class {
4451
4243
  }
4452
4244
  return {
4453
4245
  id: block.id,
4454
- height: bn16(block.height),
4246
+ height: bn15(block.header.height),
4455
4247
  time: block.header.time,
4456
4248
  transactionIds: block.transactions.map((tx) => tx.id)
4457
4249
  };
@@ -4466,7 +4258,7 @@ var _Provider = class {
4466
4258
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4467
4259
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4468
4260
  id: block.id,
4469
- height: bn16(block.height),
4261
+ height: bn15(block.header.height),
4470
4262
  time: block.header.time,
4471
4263
  transactionIds: block.transactions.map((tx) => tx.id)
4472
4264
  }));
@@ -4481,7 +4273,7 @@ var _Provider = class {
4481
4273
  async getBlockWithTransactions(idOrHeight) {
4482
4274
  let variables;
4483
4275
  if (typeof idOrHeight === "number") {
4484
- variables = { blockHeight: bn16(idOrHeight).toString(10) };
4276
+ variables = { blockHeight: bn15(idOrHeight).toString(10) };
4485
4277
  } else if (idOrHeight === "latest") {
4486
4278
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4487
4279
  } else {
@@ -4493,7 +4285,7 @@ var _Provider = class {
4493
4285
  }
4494
4286
  return {
4495
4287
  id: block.id,
4496
- height: bn16(block.height, 10),
4288
+ height: bn15(block.header.height, 10),
4497
4289
  time: block.header.time,
4498
4290
  transactionIds: block.transactions.map((tx) => tx.id),
4499
4291
  transactions: block.transactions.map(
@@ -4542,7 +4334,7 @@ var _Provider = class {
4542
4334
  contract: Address2.fromAddressOrString(contractId).toB256(),
4543
4335
  asset: hexlify12(assetId)
4544
4336
  });
4545
- return bn16(contractBalance.amount, 10);
4337
+ return bn15(contractBalance.amount, 10);
4546
4338
  }
4547
4339
  /**
4548
4340
  * Returns the balance for the given owner for the given asset ID.
@@ -4556,7 +4348,7 @@ var _Provider = class {
4556
4348
  owner: Address2.fromAddressOrString(owner).toB256(),
4557
4349
  assetId: hexlify12(assetId)
4558
4350
  });
4559
- return bn16(balance.amount, 10);
4351
+ return bn15(balance.amount, 10);
4560
4352
  }
4561
4353
  /**
4562
4354
  * Returns balances for the given owner.
@@ -4574,7 +4366,7 @@ var _Provider = class {
4574
4366
  const balances = result.balances.edges.map((edge) => edge.node);
4575
4367
  return balances.map((balance) => ({
4576
4368
  assetId: balance.assetId,
4577
- amount: bn16(balance.amount)
4369
+ amount: bn15(balance.amount)
4578
4370
  }));
4579
4371
  }
4580
4372
  /**
@@ -4596,15 +4388,15 @@ var _Provider = class {
4596
4388
  sender: message.sender,
4597
4389
  recipient: message.recipient,
4598
4390
  nonce: message.nonce,
4599
- amount: bn16(message.amount),
4391
+ amount: bn15(message.amount),
4600
4392
  data: message.data
4601
4393
  }),
4602
4394
  sender: Address2.fromAddressOrString(message.sender),
4603
4395
  recipient: Address2.fromAddressOrString(message.recipient),
4604
4396
  nonce: message.nonce,
4605
- amount: bn16(message.amount),
4397
+ amount: bn15(message.amount),
4606
4398
  data: InputMessageCoder.decodeData(message.data),
4607
- daHeight: bn16(message.daHeight)
4399
+ daHeight: bn15(message.daHeight)
4608
4400
  }));
4609
4401
  }
4610
4402
  /**
@@ -4657,52 +4449,44 @@ var _Provider = class {
4657
4449
  } = result.messageProof;
4658
4450
  return {
4659
4451
  messageProof: {
4660
- proofIndex: bn16(messageProof.proofIndex),
4452
+ proofIndex: bn15(messageProof.proofIndex),
4661
4453
  proofSet: messageProof.proofSet
4662
4454
  },
4663
4455
  blockProof: {
4664
- proofIndex: bn16(blockProof.proofIndex),
4456
+ proofIndex: bn15(blockProof.proofIndex),
4665
4457
  proofSet: blockProof.proofSet
4666
4458
  },
4667
4459
  messageBlockHeader: {
4668
4460
  id: messageBlockHeader.id,
4669
- daHeight: bn16(messageBlockHeader.daHeight),
4670
- transactionsCount: bn16(messageBlockHeader.transactionsCount),
4461
+ daHeight: bn15(messageBlockHeader.daHeight),
4462
+ transactionsCount: bn15(messageBlockHeader.transactionsCount),
4671
4463
  transactionsRoot: messageBlockHeader.transactionsRoot,
4672
- height: bn16(messageBlockHeader.height),
4464
+ height: bn15(messageBlockHeader.height),
4673
4465
  prevRoot: messageBlockHeader.prevRoot,
4674
4466
  time: messageBlockHeader.time,
4675
4467
  applicationHash: messageBlockHeader.applicationHash,
4676
- messageReceiptCount: bn16(messageBlockHeader.messageReceiptCount)
4468
+ messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4469
+ messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4677
4470
  },
4678
4471
  commitBlockHeader: {
4679
4472
  id: commitBlockHeader.id,
4680
- daHeight: bn16(commitBlockHeader.daHeight),
4681
- transactionsCount: bn16(commitBlockHeader.transactionsCount),
4473
+ daHeight: bn15(commitBlockHeader.daHeight),
4474
+ transactionsCount: bn15(commitBlockHeader.transactionsCount),
4682
4475
  transactionsRoot: commitBlockHeader.transactionsRoot,
4683
- height: bn16(commitBlockHeader.height),
4476
+ height: bn15(commitBlockHeader.height),
4684
4477
  prevRoot: commitBlockHeader.prevRoot,
4685
4478
  time: commitBlockHeader.time,
4686
4479
  applicationHash: commitBlockHeader.applicationHash,
4687
- messageReceiptCount: bn16(commitBlockHeader.messageReceiptCount)
4480
+ messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4481
+ messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4688
4482
  },
4689
4483
  sender: Address2.fromAddressOrString(sender),
4690
4484
  recipient: Address2.fromAddressOrString(recipient),
4691
4485
  nonce,
4692
- amount: bn16(amount),
4486
+ amount: bn15(amount),
4693
4487
  data
4694
4488
  };
4695
4489
  }
4696
- async getLatestGasPrice() {
4697
- const { latestGasPrice } = await this.operations.getLatestGasPrice();
4698
- return bn16(latestGasPrice.gasPrice);
4699
- }
4700
- async estimateGasPrice(blockHorizon) {
4701
- const { estimateGasPrice } = await this.operations.estimateGasPrice({
4702
- blockHorizon: String(blockHorizon)
4703
- });
4704
- return bn16(estimateGasPrice.gasPrice);
4705
- }
4706
4490
  /**
4707
4491
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
4708
4492
  *
@@ -4722,10 +4506,10 @@ var _Provider = class {
4722
4506
  */
4723
4507
  async produceBlocks(amount, startTime) {
4724
4508
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4725
- blocksToProduce: bn16(amount).toString(10),
4509
+ blocksToProduce: bn15(amount).toString(10),
4726
4510
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4727
4511
  });
4728
- return bn16(latestBlockHeight);
4512
+ return bn15(latestBlockHeight);
4729
4513
  }
4730
4514
  // eslint-disable-next-line @typescript-eslint/require-await
4731
4515
  async getTransactionResponse(transactionId) {
@@ -4739,7 +4523,7 @@ cacheInputs_fn = function(inputs) {
4739
4523
  return;
4740
4524
  }
4741
4525
  inputs.forEach((input) => {
4742
- if (input.type === InputType7.Coin) {
4526
+ if (input.type === InputType6.Coin) {
4743
4527
  this.cache?.set(input.id);
4744
4528
  }
4745
4529
  });
@@ -4749,7 +4533,7 @@ __publicField(Provider, "nodeInfoCache", {});
4749
4533
 
4750
4534
  // src/providers/transaction-summary/get-transaction-summary.ts
4751
4535
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4752
- import { bn as bn17 } from "@fuel-ts/math";
4536
+ import { bn as bn16 } from "@fuel-ts/math";
4753
4537
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4754
4538
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4755
4539
  async function getTransactionSummary(params) {
@@ -4767,28 +4551,21 @@ async function getTransactionSummary(params) {
4767
4551
  arrayify12(gqlTransaction.rawPayload),
4768
4552
  0
4769
4553
  );
4770
- let txReceipts = [];
4771
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
4772
- txReceipts = gqlTransaction.status.receipts;
4773
- }
4774
- const receipts = txReceipts.map(processGqlReceipt);
4554
+ const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
4775
4555
  const {
4776
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4556
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
4777
4557
  } = provider.getChain();
4778
- const gasPrice = await provider.getLatestGasPrice();
4779
4558
  const transactionInfo = assembleTransactionSummary({
4780
4559
  id: gqlTransaction.id,
4781
4560
  receipts,
4782
4561
  transaction: decodedTransaction,
4783
4562
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4784
4563
  gqlTransactionStatus: gqlTransaction.status,
4785
- gasPerByte: bn17(gasPerByte),
4786
- gasPriceFactor: bn17(gasPriceFactor),
4564
+ gasPerByte: bn16(gasPerByte),
4565
+ gasPriceFactor: bn16(gasPriceFactor),
4787
4566
  abiMap,
4788
4567
  maxInputs,
4789
- gasCosts,
4790
- maxGasPerTx,
4791
- gasPrice
4568
+ gasCosts
4792
4569
  });
4793
4570
  return {
4794
4571
  gqlTransaction,
@@ -4798,11 +4575,10 @@ async function getTransactionSummary(params) {
4798
4575
  async function getTransactionSummaryFromRequest(params) {
4799
4576
  const { provider, transactionRequest, abiMap } = params;
4800
4577
  const { receipts } = await provider.call(transactionRequest);
4801
- const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
4578
+ const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
4802
4579
  const maxInputs = provider.getChain().consensusParameters.maxInputs;
4803
4580
  const transaction = transactionRequest.toTransaction();
4804
4581
  const transactionBytes = transactionRequest.toTransactionBytes();
4805
- const gasPrice = await provider.getLatestGasPrice();
4806
4582
  const transactionSummary = assembleTransactionSummary({
4807
4583
  receipts,
4808
4584
  transaction,
@@ -4811,9 +4587,7 @@ async function getTransactionSummaryFromRequest(params) {
4811
4587
  gasPerByte,
4812
4588
  gasPriceFactor,
4813
4589
  maxInputs,
4814
- gasCosts,
4815
- maxGasPerTx,
4816
- gasPrice
4590
+ gasCosts
4817
4591
  });
4818
4592
  return transactionSummary;
4819
4593
  }
@@ -4822,18 +4596,13 @@ async function getTransactionsSummaries(params) {
4822
4596
  const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
4823
4597
  const { edges, pageInfo } = transactionsByOwner;
4824
4598
  const {
4825
- consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
4599
+ consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
4826
4600
  } = provider.getChain();
4827
- const gasPrice = await provider.getLatestGasPrice();
4828
4601
  const transactions = edges.map((edge) => {
4829
4602
  const { node: gqlTransaction } = edge;
4830
- const { id, rawPayload, status } = gqlTransaction;
4603
+ const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
4831
4604
  const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
4832
- let txReceipts = [];
4833
- if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
4834
- txReceipts = gqlTransaction.status.receipts;
4835
- }
4836
- const receipts = txReceipts.map(processGqlReceipt);
4605
+ const receipts = gqlReceipts?.map(processGqlReceipt) || [];
4837
4606
  const transactionSummary = assembleTransactionSummary({
4838
4607
  id,
4839
4608
  receipts,
@@ -4844,9 +4613,7 @@ async function getTransactionsSummaries(params) {
4844
4613
  gasPerByte,
4845
4614
  gasPriceFactor,
4846
4615
  maxInputs,
4847
- gasCosts,
4848
- maxGasPerTx,
4849
- gasPrice
4616
+ gasCosts
4850
4617
  });
4851
4618
  const output = {
4852
4619
  gqlTransaction,
@@ -5140,8 +4907,9 @@ var Account = class extends AbstractAccount {
5140
4907
  * @param assetId - The asset ID to check the balance for.
5141
4908
  * @returns A promise that resolves to the balance amount.
5142
4909
  */
5143
- async getBalance(assetId = BaseAssetId3) {
5144
- const amount = await this.provider.getBalance(this.address, assetId);
4910
+ async getBalance(assetId) {
4911
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
4912
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
5145
4913
  return amount;
5146
4914
  }
5147
4915
  /**
@@ -5178,33 +4946,37 @@ var Account = class extends AbstractAccount {
5178
4946
  * @param fee - The estimated transaction fee.
5179
4947
  * @returns A promise that resolves when the resources are added to the transaction.
5180
4948
  */
5181
- async fund(request, params) {
5182
- const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
5183
- const txRequest = request;
5184
- const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5185
- amount: bn18(fee),
5186
- assetId: BaseAssetId3,
5187
- coinQuantities: requiredQuantities
4949
+ async fund(request, coinQuantities, fee) {
4950
+ const baseAssetId = this.provider.getBaseAssetId();
4951
+ const updatedQuantities = addAmountToAsset({
4952
+ amount: bn17(fee),
4953
+ assetId: baseAssetId,
4954
+ coinQuantities
5188
4955
  });
5189
4956
  const quantitiesDict = {};
5190
- requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
4957
+ updatedQuantities.forEach(({ amount, assetId }) => {
5191
4958
  quantitiesDict[assetId] = {
5192
4959
  required: amount,
5193
- owned: bn18(0)
4960
+ owned: bn17(0)
5194
4961
  };
5195
4962
  });
5196
- txRequest.inputs.forEach((input) => {
4963
+ const cachedUtxos = [];
4964
+ const cachedMessages = [];
4965
+ const owner = this.address.toB256();
4966
+ request.inputs.forEach((input) => {
5197
4967
  const isResource = "amount" in input;
5198
4968
  if (isResource) {
5199
4969
  const isCoin2 = "owner" in input;
5200
4970
  if (isCoin2) {
5201
4971
  const assetId = String(input.assetId);
5202
- if (quantitiesDict[assetId]) {
5203
- const amount = bn18(input.amount);
4972
+ if (input.owner === owner && quantitiesDict[assetId]) {
4973
+ const amount = bn17(input.amount);
5204
4974
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4975
+ cachedUtxos.push(input.id);
5205
4976
  }
5206
- } else if (input.amount && quantitiesDict[BaseAssetId3]) {
5207
- quantitiesDict[BaseAssetId3].owned = quantitiesDict[BaseAssetId3].owned.add(input.amount);
4977
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
4978
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
4979
+ cachedMessages.push(input.nonce);
5208
4980
  }
5209
4981
  }
5210
4982
  });
@@ -5219,23 +4991,12 @@ var Account = class extends AbstractAccount {
5219
4991
  });
5220
4992
  const needsToBeFunded = missingQuantities.length;
5221
4993
  if (needsToBeFunded) {
5222
- const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
5223
- const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
5224
- txRequest.addResources(resources);
5225
- }
5226
- txRequest.shiftPredicateData();
5227
- txRequest.updatePredicateGasUsed(estimatedPredicates);
5228
- const requestToBeReEstimate = clone4(txRequest);
5229
- if (addedSignatures) {
5230
- Array.from({ length: addedSignatures }).forEach(
5231
- () => requestToBeReEstimate.addEmptyWitness()
5232
- );
4994
+ const resources = await this.getResourcesToSpend(missingQuantities, {
4995
+ messages: cachedMessages,
4996
+ utxos: cachedUtxos
4997
+ });
4998
+ request.addResources(resources);
5233
4999
  }
5234
- const { maxFee } = await this.provider.estimateTxGasAndFee({
5235
- transactionRequest: requestToBeReEstimate
5236
- });
5237
- txRequest.maxFee = maxFee;
5238
- return txRequest;
5239
5000
  }
5240
5001
  /**
5241
5002
  * A helper that creates a transfer transaction request and returns it.
@@ -5243,25 +5004,29 @@ var Account = class extends AbstractAccount {
5243
5004
  * @param destination - The address of the destination.
5244
5005
  * @param amount - The amount of coins to transfer.
5245
5006
  * @param assetId - The asset ID of the coins to transfer.
5246
- * @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
5007
+ * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5247
5008
  * @returns A promise that resolves to the prepared transaction request.
5248
5009
  */
5249
- async createTransfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
5250
- const request = new ScriptTransactionRequest(txParams);
5251
- request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetId);
5252
- const txCost = await this.provider.getTransactionCost(request, {
5010
+ async createTransfer(destination, amount, assetId, txParams = {}) {
5011
+ const { minGasPrice } = this.provider.getGasConfig();
5012
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5013
+ const params = { gasPrice: minGasPrice, ...txParams };
5014
+ const request = new ScriptTransactionRequest(params);
5015
+ request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetIdToTransfer);
5016
+ const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
5253
5017
  estimateTxDependencies: true,
5254
5018
  resourcesOwner: this
5255
5019
  });
5256
- if ("gasLimit" in txParams) {
5257
- this.validateGas({
5258
- gasUsed: txCost.gasUsed,
5259
- gasLimit: request.gasLimit
5260
- });
5261
- }
5262
- request.gasLimit = txCost.gasUsed;
5263
- request.maxFee = txCost.maxFee;
5264
- await this.fund(request, txCost);
5020
+ request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
5021
+ request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
5022
+ this.validateGas({
5023
+ gasUsed,
5024
+ gasPrice: request.gasPrice,
5025
+ gasLimit: request.gasLimit,
5026
+ minGasPrice
5027
+ });
5028
+ await this.fund(request, requiredQuantities, maxFee);
5029
+ request.updatePredicateInputs(estimatedInputs);
5265
5030
  return request;
5266
5031
  }
5267
5032
  /**
@@ -5273,14 +5038,15 @@ var Account = class extends AbstractAccount {
5273
5038
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5274
5039
  * @returns A promise that resolves to the transaction response.
5275
5040
  */
5276
- async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
5277
- if (bn18(amount).lte(0)) {
5041
+ async transfer(destination, amount, assetId, txParams = {}) {
5042
+ if (bn17(amount).lte(0)) {
5278
5043
  throw new FuelError15(
5279
5044
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5280
5045
  "Transfer amount must be a positive number."
5281
5046
  );
5282
5047
  }
5283
- const request = await this.createTransfer(destination, amount, assetId, txParams);
5048
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5049
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
5284
5050
  return this.sendTransaction(request, { estimateTxDependencies: false });
5285
5051
  }
5286
5052
  /**
@@ -5292,38 +5058,40 @@ var Account = class extends AbstractAccount {
5292
5058
  * @param txParams - The optional transaction parameters.
5293
5059
  * @returns A promise that resolves to the transaction response.
5294
5060
  */
5295
- async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
5296
- if (bn18(amount).lte(0)) {
5061
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
5062
+ if (bn17(amount).lte(0)) {
5297
5063
  throw new FuelError15(
5298
5064
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5299
5065
  "Transfer amount must be a positive number."
5300
5066
  );
5301
5067
  }
5302
5068
  const contractAddress = Address3.fromAddressOrString(contractId);
5069
+ const { minGasPrice } = this.provider.getGasConfig();
5070
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5071
+ const params = { gasPrice: minGasPrice, ...txParams };
5303
5072
  const { script, scriptData } = await assembleTransferToContractScript({
5304
5073
  hexlifiedContractId: contractAddress.toB256(),
5305
- amountToTransfer: bn18(amount),
5306
- assetId
5074
+ amountToTransfer: bn17(amount),
5075
+ assetId: assetIdToTransfer
5307
5076
  });
5308
5077
  const request = new ScriptTransactionRequest({
5309
- ...txParams,
5078
+ ...params,
5310
5079
  script,
5311
5080
  scriptData
5312
5081
  });
5313
5082
  request.addContractInputAndOutput(contractAddress);
5314
- const txCost = await this.provider.getTransactionCost(request, {
5315
- resourcesOwner: this,
5316
- quantitiesToContract: [{ amount: bn18(amount), assetId: String(assetId) }]
5083
+ const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5084
+ request,
5085
+ [{ amount: bn17(amount), assetId: String(assetIdToTransfer) }]
5086
+ );
5087
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5088
+ this.validateGas({
5089
+ gasUsed,
5090
+ gasPrice: request.gasPrice,
5091
+ gasLimit: request.gasLimit,
5092
+ minGasPrice
5317
5093
  });
5318
- if (txParams.gasLimit) {
5319
- this.validateGas({
5320
- gasUsed: txCost.gasUsed,
5321
- gasLimit: request.gasLimit
5322
- });
5323
- }
5324
- request.gasLimit = txCost.gasUsed;
5325
- request.maxFee = txCost.maxFee;
5326
- await this.fund(request, txCost);
5094
+ await this.fund(request, requiredQuantities, maxFee);
5327
5095
  return this.sendTransaction(request);
5328
5096
  }
5329
5097
  /**
@@ -5335,31 +5103,35 @@ var Account = class extends AbstractAccount {
5335
5103
  * @returns A promise that resolves to the transaction response.
5336
5104
  */
5337
5105
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5106
+ const { minGasPrice } = this.provider.getGasConfig();
5107
+ const baseAssetId = this.provider.getBaseAssetId();
5338
5108
  const recipientAddress = Address3.fromAddressOrString(recipient);
5339
5109
  const recipientDataArray = arrayify14(
5340
5110
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5341
5111
  );
5342
5112
  const amountDataArray = arrayify14(
5343
- "0x".concat(bn18(amount).toHex().substring(2).padStart(16, "0"))
5113
+ "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
5344
5114
  );
5345
5115
  const script = new Uint8Array([
5346
5116
  ...arrayify14(withdrawScript.bytes),
5347
5117
  ...recipientDataArray,
5348
5118
  ...amountDataArray
5349
5119
  ]);
5350
- const params = { script, ...txParams };
5120
+ const params = { script, gasPrice: minGasPrice, ...txParams };
5351
5121
  const request = new ScriptTransactionRequest(params);
5352
- const quantitiesToContract = [{ amount: bn18(amount), assetId: BaseAssetId3 }];
5353
- const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5354
- if (txParams.gasLimit) {
5355
- this.validateGas({
5356
- gasUsed: txCost.gasUsed,
5357
- gasLimit: request.gasLimit
5358
- });
5359
- }
5360
- request.maxFee = txCost.maxFee;
5361
- request.gasLimit = txCost.gasUsed;
5362
- await this.fund(request, txCost);
5122
+ const forwardingQuantities = [{ amount: bn17(amount), assetId: baseAssetId }];
5123
+ const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5124
+ request,
5125
+ forwardingQuantities
5126
+ );
5127
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5128
+ this.validateGas({
5129
+ gasUsed,
5130
+ gasPrice: request.gasPrice,
5131
+ gasLimit: request.gasLimit,
5132
+ minGasPrice
5133
+ });
5134
+ await this.fund(request, requiredQuantities, maxFee);
5363
5135
  return this.sendTransaction(request);
5364
5136
  }
5365
5137
  async signMessage(message) {
@@ -5417,7 +5189,18 @@ var Account = class extends AbstractAccount {
5417
5189
  }
5418
5190
  return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
5419
5191
  }
5420
- validateGas({ gasUsed, gasLimit }) {
5192
+ validateGas({
5193
+ gasUsed,
5194
+ gasPrice,
5195
+ gasLimit,
5196
+ minGasPrice
5197
+ }) {
5198
+ if (minGasPrice.gt(gasPrice)) {
5199
+ throw new FuelError15(
5200
+ ErrorCode15.GAS_PRICE_TOO_LOW,
5201
+ `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
5202
+ );
5203
+ }
5421
5204
  if (gasUsed.gt(gasLimit)) {
5422
5205
  throw new FuelError15(
5423
5206
  ErrorCode15.GAS_LIMIT_TOO_LOW,
@@ -5433,7 +5216,7 @@ import { hexlify as hexlify15 } from "@fuel-ts/utils";
5433
5216
 
5434
5217
  // src/signer/signer.ts
5435
5218
  import { Address as Address4 } from "@fuel-ts/address";
5436
- import { randomBytes as randomBytes2 } from "@fuel-ts/crypto";
5219
+ import { randomBytes } from "@fuel-ts/crypto";
5437
5220
  import { hash } from "@fuel-ts/hasher";
5438
5221
  import { toBytes } from "@fuel-ts/math";
5439
5222
  import { hexlify as hexlify13, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
@@ -5526,7 +5309,7 @@ var Signer = class {
5526
5309
  * @returns random 32-byte hashed
5527
5310
  */
5528
5311
  static generatePrivateKey(entropy) {
5529
- return entropy ? hash(concat3([randomBytes2(32), arrayify15(entropy)])) : randomBytes2(32);
5312
+ return entropy ? hash(concat3([randomBytes(32), arrayify15(entropy)])) : randomBytes(32);
5530
5313
  }
5531
5314
  /**
5532
5315
  * Extended publicKey from a compact publicKey
@@ -5545,7 +5328,7 @@ import { Address as Address5 } from "@fuel-ts/address";
5545
5328
  import {
5546
5329
  bufferFromString,
5547
5330
  keccak256,
5548
- randomBytes as randomBytes3,
5331
+ randomBytes as randomBytes2,
5549
5332
  scrypt,
5550
5333
  stringFromBuffer,
5551
5334
  decryptJsonWalletData,
@@ -5568,7 +5351,7 @@ var removeHexPrefix = (hexString) => {
5568
5351
  async function encryptKeystoreWallet(privateKey, address, password) {
5569
5352
  const privateKeyBuffer = bufferFromString(removeHexPrefix(privateKey), "hex");
5570
5353
  const ownerAddress = Address5.fromAddressOrString(address);
5571
- const salt = randomBytes3(DEFAULT_KEY_SIZE);
5354
+ const salt = randomBytes2(DEFAULT_KEY_SIZE);
5572
5355
  const key = scrypt({
5573
5356
  password: bufferFromString(password),
5574
5357
  salt,
@@ -5577,7 +5360,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
5577
5360
  r: DEFAULT_KDF_PARAMS_R,
5578
5361
  p: DEFAULT_KDF_PARAMS_P
5579
5362
  });
5580
- const iv = randomBytes3(DEFAULT_IV_SIZE);
5363
+ const iv = randomBytes2(DEFAULT_IV_SIZE);
5581
5364
  const ciphertext = await encryptJsonWalletData(privateKeyBuffer, key, iv);
5582
5365
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
5583
5366
  const macHashUint8Array = keccak256(data);
@@ -5713,7 +5496,7 @@ var BaseWalletUnlocked = class extends Account {
5713
5496
  * @param transactionRequestLike - The transaction request to send.
5714
5497
  * @returns A promise that resolves to the TransactionResponse object.
5715
5498
  */
5716
- async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
5499
+ async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
5717
5500
  const transactionRequest = transactionRequestify(transactionRequestLike);
5718
5501
  if (estimateTxDependencies) {
5719
5502
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -5754,12 +5537,12 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5754
5537
  // src/hdwallet/hdwallet.ts
5755
5538
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5756
5539
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5757
- import { bn as bn19, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5540
+ import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5758
5541
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5759
5542
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5760
5543
 
5761
5544
  // src/mnemonic/mnemonic.ts
5762
- import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
5545
+ import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
5763
5546
  import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5764
5547
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5765
5548
  import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
@@ -8120,7 +7903,7 @@ var Mnemonic = class {
8120
7903
  * @returns A randomly generated mnemonic
8121
7904
  */
8122
7905
  static generate(size = 32, extraEntropy = "") {
8123
- const entropy = extraEntropy ? sha2563(concat4([randomBytes4(size), arrayify17(extraEntropy)])) : randomBytes4(size);
7906
+ const entropy = extraEntropy ? sha2563(concat4([randomBytes3(size), arrayify17(extraEntropy)])) : randomBytes3(size);
8124
7907
  return Mnemonic.entropyToMnemonic(entropy);
8125
7908
  }
8126
7909
  };
@@ -8226,7 +8009,7 @@ var HDWallet = class {
8226
8009
  const IR = bytes.slice(32);
8227
8010
  if (privateKey) {
8228
8011
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8229
- const ki = bn19(IL).add(privateKey).mod(N).toBytes(32);
8012
+ const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
8230
8013
  return new HDWallet({
8231
8014
  privateKey: ki,
8232
8015
  chainCode: IR,
@@ -8913,9 +8696,8 @@ import {
8913
8696
  SCRIPT_FIXED_SIZE
8914
8697
  } from "@fuel-ts/abi-coder";
8915
8698
  import { Address as Address9 } from "@fuel-ts/address";
8916
- import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
8917
8699
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8918
- import { ByteArrayCoder, InputType as InputType8 } from "@fuel-ts/transactions";
8700
+ import { ByteArrayCoder, InputType as InputType7 } from "@fuel-ts/transactions";
8919
8701
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8920
8702
 
8921
8703
  // src/predicate/utils/getPredicateRoot.ts
@@ -8964,7 +8746,6 @@ var Predicate = class extends Account {
8964
8746
  this.interface = predicateInterface;
8965
8747
  if (inputData !== void 0 && inputData.length > 0) {
8966
8748
  this.predicateData = inputData;
8967
- this.predicateDataBytes = this.getPredicateData(0);
8968
8749
  }
8969
8750
  }
8970
8751
  /**
@@ -8977,9 +8758,9 @@ var Predicate = class extends Account {
8977
8758
  const request = transactionRequestify(transactionRequestLike);
8978
8759
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
8979
8760
  request.inputs?.forEach((input) => {
8980
- if (input.type === InputType8.Coin && hexlify19(input.owner) === this.address.toB256()) {
8981
- input.predicate = hexlify19(this.bytes);
8982
- input.predicateData = hexlify19(this.getPredicateData(policies.length));
8761
+ if (input.type === InputType7.Coin && hexlify19(input.owner) === this.address.toB256()) {
8762
+ input.predicate = this.bytes;
8763
+ input.predicateData = this.getPredicateData(policies.length);
8983
8764
  }
8984
8765
  });
8985
8766
  return request;
@@ -8993,8 +8774,10 @@ var Predicate = class extends Account {
8993
8774
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8994
8775
  * @returns A promise that resolves to the prepared transaction request.
8995
8776
  */
8996
- async createTransfer(destination, amount, assetId = BaseAssetId4, txParams = {}) {
8997
- return super.createTransfer(destination, amount, assetId, txParams);
8777
+ async createTransfer(destination, amount, assetId, txParams = {}) {
8778
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
8779
+ const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
8780
+ return this.populateTransactionPredicateData(request);
8998
8781
  }
8999
8782
  /**
9000
8783
  * Sends a transaction with the populated predicate data.
@@ -9002,9 +8785,9 @@ var Predicate = class extends Account {
9002
8785
  * @param transactionRequestLike - The transaction request-like object.
9003
8786
  * @returns A promise that resolves to the transaction response.
9004
8787
  */
9005
- sendTransaction(transactionRequestLike) {
9006
- const transactionRequest = transactionRequestify(transactionRequestLike);
9007
- return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
8788
+ sendTransaction(transactionRequestLike, options) {
8789
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
8790
+ return super.sendTransaction(transactionRequest, options);
9008
8791
  }
9009
8792
  /**
9010
8793
  * Simulates a transaction with the populated predicate data.
@@ -9013,8 +8796,8 @@ var Predicate = class extends Account {
9013
8796
  * @returns A promise that resolves to the call result.
9014
8797
  */
9015
8798
  simulateTransaction(transactionRequestLike) {
9016
- const transactionRequest = transactionRequestify(transactionRequestLike);
9017
- return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
8799
+ const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
8800
+ return super.simulateTransaction(transactionRequest);
9018
8801
  }
9019
8802
  getPredicateData(policiesLength) {
9020
8803
  if (!this.predicateData.length) {
@@ -9060,26 +8843,6 @@ var Predicate = class extends Account {
9060
8843
  predicateInterface: abiInterface
9061
8844
  };
9062
8845
  }
9063
- /**
9064
- * Retrieves resources satisfying the spend query for the account.
9065
- *
9066
- * @param quantities - IDs of coins to exclude.
9067
- * @param excludedIds - IDs of resources to be excluded from the query.
9068
- * @returns A promise that resolves to an array of Resources.
9069
- */
9070
- async getResourcesToSpend(quantities, excludedIds) {
9071
- const resources = await this.provider.getResourcesToSpend(
9072
- this.address,
9073
- quantities,
9074
- excludedIds
9075
- );
9076
- return resources.map((resource) => ({
9077
- ...resource,
9078
- predicate: hexlify19(this.bytes),
9079
- predicateData: hexlify19(this.predicateDataBytes),
9080
- paddPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
9081
- }));
9082
- }
9083
8846
  /**
9084
8847
  * Sets the configurable constants for the predicate.
9085
8848
  *
@@ -9828,7 +9591,7 @@ export {
9828
9591
  WalletLocked,
9829
9592
  WalletManager,
9830
9593
  WalletUnlocked,
9831
- addAmountToCoinQuantities,
9594
+ addAmountToAsset,
9832
9595
  addOperation,
9833
9596
  assemblePanicError,
9834
9597
  assembleReceiptByType,
@@ -9837,10 +9600,9 @@ export {
9837
9600
  assets,
9838
9601
  buildBlockExplorerUrl,
9839
9602
  cacheFor,
9840
- cacheTxInputsFromOwner,
9841
- calculateGasFee,
9842
9603
  calculateMetadataGasForTxCreate,
9843
9604
  calculateMetadataGasForTxScript,
9605
+ calculatePriceWithFactor,
9844
9606
  calculateTransactionFee,
9845
9607
  coinQuantityfy,
9846
9608
  deferPromise,