@fuel-ts/account 0.0.0-rc-2021-20240422173414 → 0.0.0-rc-2045-20240422223402
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/README.md +1 -1
- package/dist/account.d.ts +4 -5
- package/dist/account.d.ts.map +1 -1
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js +1 -1
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js +1 -1
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs +1 -1
- package/dist/configs.mjs.map +1 -1
- package/dist/index.global.js +550 -798
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +509 -761
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +390 -641
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +2 -10
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +329 -911
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +2 -4
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +1 -7
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +27 -37
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +2 -2
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +25 -8
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -3
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +0 -2
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +2 -3
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +2 -8
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +1062 -1548
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +505 -739
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +399 -633
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +16 -16
package/dist/index.mjs
CHANGED
@@ -32,9 +32,8 @@ import { Address as Address3 } from "@fuel-ts/address";
|
|
32
32
|
import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
|
33
33
|
import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
|
34
34
|
import { AbstractAccount } from "@fuel-ts/interfaces";
|
35
|
-
import { bn as
|
35
|
+
import { bn as bn17 } from "@fuel-ts/math";
|
36
36
|
import { arrayify as arrayify14 } from "@fuel-ts/utils";
|
37
|
-
import { clone as clone4 } from "ramda";
|
38
37
|
|
39
38
|
// src/providers/coin-quantity.ts
|
40
39
|
import { BaseAssetId } from "@fuel-ts/address/configs";
|
@@ -43,24 +42,24 @@ import { hexlify } from "@fuel-ts/utils";
|
|
43
42
|
var coinQuantityfy = (coinQuantityLike) => {
|
44
43
|
let assetId;
|
45
44
|
let amount;
|
46
|
-
let
|
45
|
+
let max2;
|
47
46
|
if (Array.isArray(coinQuantityLike)) {
|
48
47
|
amount = coinQuantityLike[0];
|
49
48
|
assetId = coinQuantityLike[1] ?? BaseAssetId;
|
50
|
-
|
49
|
+
max2 = coinQuantityLike[2] ?? void 0;
|
51
50
|
} else {
|
52
51
|
amount = coinQuantityLike.amount;
|
53
52
|
assetId = coinQuantityLike.assetId ?? BaseAssetId;
|
54
|
-
|
53
|
+
max2 = coinQuantityLike.max ?? void 0;
|
55
54
|
}
|
56
55
|
const bnAmount = bn(amount);
|
57
56
|
return {
|
58
57
|
assetId: hexlify(assetId),
|
59
58
|
amount: bnAmount.lt(1) ? bn(1) : bnAmount,
|
60
|
-
max:
|
59
|
+
max: max2 ? bn(max2) : void 0
|
61
60
|
};
|
62
61
|
};
|
63
|
-
var
|
62
|
+
var addAmountToAsset = (params) => {
|
64
63
|
const { amount, assetId } = params;
|
65
64
|
const coinQuantities = [...params.coinQuantities];
|
66
65
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -75,9 +74,9 @@ var addAmountToCoinQuantities = (params) => {
|
|
75
74
|
// src/providers/provider.ts
|
76
75
|
import { Address as Address2 } from "@fuel-ts/address";
|
77
76
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
78
|
-
import { BN, bn as
|
77
|
+
import { BN, bn as bn15, max } from "@fuel-ts/math";
|
79
78
|
import {
|
80
|
-
InputType as
|
79
|
+
InputType as InputType6,
|
81
80
|
TransactionType as TransactionType8,
|
82
81
|
InputMessageCoder,
|
83
82
|
TransactionCoder as TransactionCoder5
|
@@ -93,10 +92,14 @@ import { clone as clone3 } from "ramda";
|
|
93
92
|
import gql from "graphql-tag";
|
94
93
|
var ReceiptFragmentFragmentDoc = gql`
|
95
94
|
fragment receiptFragment on Receipt {
|
96
|
-
|
95
|
+
contract {
|
96
|
+
id
|
97
|
+
}
|
97
98
|
pc
|
98
99
|
is
|
99
|
-
to
|
100
|
+
to {
|
101
|
+
id
|
102
|
+
}
|
100
103
|
toAddress
|
101
104
|
amount
|
102
105
|
assetId
|
@@ -134,16 +137,10 @@ var TransactionStatusFragmentFragmentDoc = gql`
|
|
134
137
|
id
|
135
138
|
}
|
136
139
|
time
|
137
|
-
receipts {
|
138
|
-
...receiptFragment
|
139
|
-
}
|
140
140
|
programState {
|
141
141
|
returnType
|
142
142
|
data
|
143
143
|
}
|
144
|
-
receipts {
|
145
|
-
...receiptFragment
|
146
|
-
}
|
147
144
|
}
|
148
145
|
... on FailureStatus {
|
149
146
|
block {
|
@@ -151,24 +148,26 @@ var TransactionStatusFragmentFragmentDoc = gql`
|
|
151
148
|
}
|
152
149
|
time
|
153
150
|
reason
|
154
|
-
receipts {
|
155
|
-
...receiptFragment
|
156
|
-
}
|
157
151
|
}
|
158
152
|
... on SqueezedOutStatus {
|
159
153
|
reason
|
160
154
|
}
|
161
155
|
}
|
162
|
-
|
156
|
+
`;
|
163
157
|
var TransactionFragmentFragmentDoc = gql`
|
164
158
|
fragment transactionFragment on Transaction {
|
165
159
|
id
|
166
160
|
rawPayload
|
161
|
+
gasPrice
|
162
|
+
receipts {
|
163
|
+
...receiptFragment
|
164
|
+
}
|
167
165
|
status {
|
168
166
|
...transactionStatusFragment
|
169
167
|
}
|
170
168
|
}
|
171
|
-
${
|
169
|
+
${ReceiptFragmentFragmentDoc}
|
170
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
172
171
|
var InputEstimatePredicatesFragmentFragmentDoc = gql`
|
173
172
|
fragment inputEstimatePredicatesFragment on Input {
|
174
173
|
... on InputCoin {
|
@@ -186,46 +185,6 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
|
|
186
185
|
}
|
187
186
|
}
|
188
187
|
${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
188
|
var CoinFragmentFragmentDoc = gql`
|
230
189
|
fragment coinFragment on Coin {
|
231
190
|
__typename
|
@@ -233,6 +192,7 @@ var CoinFragmentFragmentDoc = gql`
|
|
233
192
|
owner
|
234
193
|
amount
|
235
194
|
assetId
|
195
|
+
maturity
|
236
196
|
blockCreated
|
237
197
|
txCreatedIdx
|
238
198
|
}
|
@@ -271,32 +231,26 @@ var MessageProofFragmentFragmentDoc = gql`
|
|
271
231
|
messageBlockHeader {
|
272
232
|
id
|
273
233
|
daHeight
|
274
|
-
consensusParametersVersion
|
275
|
-
stateTransitionBytecodeVersion
|
276
234
|
transactionsCount
|
277
|
-
messageReceiptCount
|
278
235
|
transactionsRoot
|
279
|
-
messageOutboxRoot
|
280
|
-
eventInboxRoot
|
281
236
|
height
|
282
237
|
prevRoot
|
283
238
|
time
|
284
239
|
applicationHash
|
240
|
+
messageReceiptRoot
|
241
|
+
messageReceiptCount
|
285
242
|
}
|
286
243
|
commitBlockHeader {
|
287
244
|
id
|
288
245
|
daHeight
|
289
|
-
consensusParametersVersion
|
290
|
-
stateTransitionBytecodeVersion
|
291
246
|
transactionsCount
|
292
|
-
messageReceiptCount
|
293
247
|
transactionsRoot
|
294
|
-
messageOutboxRoot
|
295
|
-
eventInboxRoot
|
296
248
|
height
|
297
249
|
prevRoot
|
298
250
|
time
|
299
251
|
applicationHash
|
252
|
+
messageReceiptRoot
|
253
|
+
messageReceiptCount
|
300
254
|
}
|
301
255
|
sender
|
302
256
|
recipient
|
@@ -315,8 +269,8 @@ var BalanceFragmentFragmentDoc = gql`
|
|
315
269
|
var BlockFragmentFragmentDoc = gql`
|
316
270
|
fragment blockFragment on Block {
|
317
271
|
id
|
318
|
-
height
|
319
272
|
header {
|
273
|
+
height
|
320
274
|
time
|
321
275
|
}
|
322
276
|
transactions {
|
@@ -374,11 +328,6 @@ var DependentCostFragmentFragmentDoc = gql`
|
|
374
328
|
`;
|
375
329
|
var GasCostsFragmentFragmentDoc = gql`
|
376
330
|
fragment GasCostsFragment on GasCosts {
|
377
|
-
version {
|
378
|
-
... on Version {
|
379
|
-
value
|
380
|
-
}
|
381
|
-
}
|
382
331
|
add
|
383
332
|
addi
|
384
333
|
aloc
|
@@ -391,6 +340,7 @@ var GasCostsFragmentFragmentDoc = gql`
|
|
391
340
|
cb
|
392
341
|
cfei
|
393
342
|
cfsi
|
343
|
+
croo
|
394
344
|
div
|
395
345
|
divi
|
396
346
|
ecr1
|
@@ -473,9 +423,6 @@ var GasCostsFragmentFragmentDoc = gql`
|
|
473
423
|
ccp {
|
474
424
|
...DependentCostFragment
|
475
425
|
}
|
476
|
-
croo {
|
477
|
-
...DependentCostFragment
|
478
|
-
}
|
479
426
|
csiz {
|
480
427
|
...DependentCostFragment
|
481
428
|
}
|
@@ -535,11 +482,6 @@ var GasCostsFragmentFragmentDoc = gql`
|
|
535
482
|
${DependentCostFragmentFragmentDoc}`;
|
536
483
|
var ConsensusParametersFragmentFragmentDoc = gql`
|
537
484
|
fragment consensusParametersFragment on ConsensusParameters {
|
538
|
-
version {
|
539
|
-
... on Version {
|
540
|
-
value
|
541
|
-
}
|
542
|
-
}
|
543
485
|
txParams {
|
544
486
|
...TxParametersFragment
|
545
487
|
}
|
@@ -599,9 +541,18 @@ var NodeInfoFragmentFragmentDoc = gql`
|
|
599
541
|
fragment nodeInfoFragment on NodeInfo {
|
600
542
|
utxoValidation
|
601
543
|
vmBacktrace
|
544
|
+
minGasPrice
|
602
545
|
maxTx
|
603
546
|
maxDepth
|
604
547
|
nodeVersion
|
548
|
+
peers {
|
549
|
+
id
|
550
|
+
addresses
|
551
|
+
clientVersion
|
552
|
+
blockHeight
|
553
|
+
lastHeartbeatMs
|
554
|
+
appScore
|
555
|
+
}
|
605
556
|
}
|
606
557
|
`;
|
607
558
|
var GetVersionDocument = gql`
|
@@ -636,9 +587,13 @@ var GetTransactionWithReceiptsDocument = gql`
|
|
636
587
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
637
588
|
transaction(id: $transactionId) {
|
638
589
|
...transactionFragment
|
590
|
+
receipts {
|
591
|
+
...receiptFragment
|
592
|
+
}
|
639
593
|
}
|
640
594
|
}
|
641
|
-
${TransactionFragmentFragmentDoc}
|
595
|
+
${TransactionFragmentFragmentDoc}
|
596
|
+
${ReceiptFragmentFragmentDoc}`;
|
642
597
|
var GetTransactionsDocument = gql`
|
643
598
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
644
599
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -766,20 +721,6 @@ var GetBalanceDocument = gql`
|
|
766
721
|
}
|
767
722
|
}
|
768
723
|
${BalanceFragmentFragmentDoc}`;
|
769
|
-
var GetLatestGasPriceDocument = gql`
|
770
|
-
query getLatestGasPrice {
|
771
|
-
latestGasPrice {
|
772
|
-
gasPrice
|
773
|
-
}
|
774
|
-
}
|
775
|
-
`;
|
776
|
-
var EstimateGasPriceDocument = gql`
|
777
|
-
query estimateGasPrice($blockHorizon: U32!) {
|
778
|
-
estimateGasPrice(blockHorizon: $blockHorizon) {
|
779
|
-
gasPrice
|
780
|
-
}
|
781
|
-
}
|
782
|
-
`;
|
783
724
|
var GetBalancesDocument = gql`
|
784
725
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
785
726
|
balances(
|
@@ -834,12 +775,12 @@ var GetMessageStatusDocument = gql`
|
|
834
775
|
}
|
835
776
|
`;
|
836
777
|
var DryRunDocument = gql`
|
837
|
-
mutation dryRun($
|
838
|
-
dryRun(
|
839
|
-
...
|
778
|
+
mutation dryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
|
779
|
+
dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
|
780
|
+
...receiptFragment
|
840
781
|
}
|
841
782
|
}
|
842
|
-
${
|
783
|
+
${ReceiptFragmentFragmentDoc}`;
|
843
784
|
var SubmitDocument = gql`
|
844
785
|
mutation submit($encodedTransaction: HexString!) {
|
845
786
|
submit(tx: $encodedTransaction) {
|
@@ -922,12 +863,6 @@ function getSdk(requester) {
|
|
922
863
|
getBalance(variables, options) {
|
923
864
|
return requester(GetBalanceDocument, variables, options);
|
924
865
|
},
|
925
|
-
getLatestGasPrice(variables, options) {
|
926
|
-
return requester(GetLatestGasPriceDocument, variables, options);
|
927
|
-
},
|
928
|
-
estimateGasPrice(variables, options) {
|
929
|
-
return requester(EstimateGasPriceDocument, variables, options);
|
930
|
-
},
|
931
866
|
getBalances(variables, options) {
|
932
867
|
return requester(GetBalancesDocument, variables, options);
|
933
868
|
},
|
@@ -1121,9 +1056,10 @@ var inputify = (value) => {
|
|
1121
1056
|
txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
|
1122
1057
|
},
|
1123
1058
|
witnessIndex: value.witnessIndex,
|
1059
|
+
maturity: value.maturity ?? 0,
|
1124
1060
|
predicateGasUsed: bn2(value.predicateGasUsed),
|
1125
|
-
predicateLength:
|
1126
|
-
predicateDataLength:
|
1061
|
+
predicateLength: predicate.length,
|
1062
|
+
predicateDataLength: predicateData.length,
|
1127
1063
|
predicate: hexlify3(predicate),
|
1128
1064
|
predicateData: hexlify3(predicateData)
|
1129
1065
|
};
|
@@ -1154,8 +1090,8 @@ var inputify = (value) => {
|
|
1154
1090
|
nonce: hexlify3(value.nonce),
|
1155
1091
|
witnessIndex: value.witnessIndex,
|
1156
1092
|
predicateGasUsed: bn2(value.predicateGasUsed),
|
1157
|
-
predicateLength:
|
1158
|
-
predicateDataLength:
|
1093
|
+
predicateLength: predicate.length,
|
1094
|
+
predicateDataLength: predicateData.length,
|
1159
1095
|
predicate: hexlify3(predicate),
|
1160
1096
|
predicateData: hexlify3(predicateData),
|
1161
1097
|
data: hexlify3(data),
|
@@ -1285,8 +1221,8 @@ function assembleReceiptByType(receipt) {
|
|
1285
1221
|
case "CALL" /* Call */: {
|
1286
1222
|
const callReceipt = {
|
1287
1223
|
type: ReceiptType.Call,
|
1288
|
-
from: hexOrZero(receipt.id
|
1289
|
-
to: hexOrZero(receipt?.to),
|
1224
|
+
from: hexOrZero(receipt.contract?.id),
|
1225
|
+
to: hexOrZero(receipt?.to?.id),
|
1290
1226
|
amount: bn4(receipt.amount),
|
1291
1227
|
assetId: hexOrZero(receipt.assetId),
|
1292
1228
|
gas: bn4(receipt.gas),
|
@@ -1300,7 +1236,7 @@ function assembleReceiptByType(receipt) {
|
|
1300
1236
|
case "RETURN" /* Return */: {
|
1301
1237
|
const returnReceipt = {
|
1302
1238
|
type: ReceiptType.Return,
|
1303
|
-
id: hexOrZero(receipt.id
|
1239
|
+
id: hexOrZero(receipt.contract?.id),
|
1304
1240
|
val: bn4(receipt.val),
|
1305
1241
|
pc: bn4(receipt.pc),
|
1306
1242
|
is: bn4(receipt.is)
|
@@ -1310,7 +1246,7 @@ function assembleReceiptByType(receipt) {
|
|
1310
1246
|
case "RETURN_DATA" /* ReturnData */: {
|
1311
1247
|
const returnDataReceipt = {
|
1312
1248
|
type: ReceiptType.ReturnData,
|
1313
|
-
id: hexOrZero(receipt.id
|
1249
|
+
id: hexOrZero(receipt.contract?.id),
|
1314
1250
|
ptr: bn4(receipt.ptr),
|
1315
1251
|
len: bn4(receipt.len),
|
1316
1252
|
digest: hexOrZero(receipt.digest),
|
@@ -1322,7 +1258,7 @@ function assembleReceiptByType(receipt) {
|
|
1322
1258
|
case "PANIC" /* Panic */: {
|
1323
1259
|
const panicReceipt = {
|
1324
1260
|
type: ReceiptType.Panic,
|
1325
|
-
id: hexOrZero(receipt.id),
|
1261
|
+
id: hexOrZero(receipt.contract?.id),
|
1326
1262
|
reason: bn4(receipt.reason),
|
1327
1263
|
pc: bn4(receipt.pc),
|
1328
1264
|
is: bn4(receipt.is),
|
@@ -1333,7 +1269,7 @@ function assembleReceiptByType(receipt) {
|
|
1333
1269
|
case "REVERT" /* Revert */: {
|
1334
1270
|
const revertReceipt = {
|
1335
1271
|
type: ReceiptType.Revert,
|
1336
|
-
id: hexOrZero(receipt.id
|
1272
|
+
id: hexOrZero(receipt.contract?.id),
|
1337
1273
|
val: bn4(receipt.ra),
|
1338
1274
|
pc: bn4(receipt.pc),
|
1339
1275
|
is: bn4(receipt.is)
|
@@ -1343,7 +1279,7 @@ function assembleReceiptByType(receipt) {
|
|
1343
1279
|
case "LOG" /* Log */: {
|
1344
1280
|
const logReceipt = {
|
1345
1281
|
type: ReceiptType.Log,
|
1346
|
-
id: hexOrZero(receipt.id
|
1282
|
+
id: hexOrZero(receipt.contract?.id),
|
1347
1283
|
val0: bn4(receipt.ra),
|
1348
1284
|
val1: bn4(receipt.rb),
|
1349
1285
|
val2: bn4(receipt.rc),
|
@@ -1356,7 +1292,7 @@ function assembleReceiptByType(receipt) {
|
|
1356
1292
|
case "LOG_DATA" /* LogData */: {
|
1357
1293
|
const logDataReceipt = {
|
1358
1294
|
type: ReceiptType.LogData,
|
1359
|
-
id: hexOrZero(receipt.id
|
1295
|
+
id: hexOrZero(receipt.contract?.id),
|
1360
1296
|
val0: bn4(receipt.ra),
|
1361
1297
|
val1: bn4(receipt.rb),
|
1362
1298
|
ptr: bn4(receipt.ptr),
|
@@ -1370,8 +1306,8 @@ function assembleReceiptByType(receipt) {
|
|
1370
1306
|
case "TRANSFER" /* Transfer */: {
|
1371
1307
|
const transferReceipt = {
|
1372
1308
|
type: ReceiptType.Transfer,
|
1373
|
-
from: hexOrZero(receipt.id
|
1374
|
-
to: hexOrZero(receipt.toAddress || receipt?.to),
|
1309
|
+
from: hexOrZero(receipt.contract?.id),
|
1310
|
+
to: hexOrZero(receipt.toAddress || receipt?.to?.id),
|
1375
1311
|
amount: bn4(receipt.amount),
|
1376
1312
|
assetId: hexOrZero(receipt.assetId),
|
1377
1313
|
pc: bn4(receipt.pc),
|
@@ -1382,8 +1318,8 @@ function assembleReceiptByType(receipt) {
|
|
1382
1318
|
case "TRANSFER_OUT" /* TransferOut */: {
|
1383
1319
|
const transferOutReceipt = {
|
1384
1320
|
type: ReceiptType.TransferOut,
|
1385
|
-
from: hexOrZero(receipt.id
|
1386
|
-
to: hexOrZero(receipt.toAddress || receipt.to),
|
1321
|
+
from: hexOrZero(receipt.contract?.id),
|
1322
|
+
to: hexOrZero(receipt.toAddress || receipt.to?.id),
|
1387
1323
|
amount: bn4(receipt.amount),
|
1388
1324
|
assetId: hexOrZero(receipt.assetId),
|
1389
1325
|
pc: bn4(receipt.pc),
|
@@ -1426,7 +1362,7 @@ function assembleReceiptByType(receipt) {
|
|
1426
1362
|
return receiptMessageOut;
|
1427
1363
|
}
|
1428
1364
|
case "MINT" /* Mint */: {
|
1429
|
-
const contractId = hexOrZero(receipt.id
|
1365
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
1430
1366
|
const subId = hexOrZero(receipt.subId);
|
1431
1367
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
1432
1368
|
const mintReceipt = {
|
@@ -1441,7 +1377,7 @@ function assembleReceiptByType(receipt) {
|
|
1441
1377
|
return mintReceipt;
|
1442
1378
|
}
|
1443
1379
|
case "BURN" /* Burn */: {
|
1444
|
-
const contractId = hexOrZero(receipt.id
|
1380
|
+
const contractId = hexOrZero(receipt.contract?.id);
|
1445
1381
|
const subId = hexOrZero(receipt.subId);
|
1446
1382
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
1447
1383
|
const burnReceipt = {
|
@@ -1526,6 +1462,7 @@ var buildBlockExplorerUrl = (options = {}) => {
|
|
1526
1462
|
import { bn as bn5 } from "@fuel-ts/math";
|
1527
1463
|
import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
|
1528
1464
|
import { arrayify as arrayify3 } from "@fuel-ts/utils";
|
1465
|
+
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn5(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
1529
1466
|
var getGasUsedFromReceipts = (receipts) => {
|
1530
1467
|
const scriptResult = receipts.filter(
|
1531
1468
|
(receipt) => receipt.type === ReceiptType2.ScriptResult
|
@@ -1546,28 +1483,18 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
|
|
1546
1483
|
}
|
1547
1484
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
1548
1485
|
const witnessCache = [];
|
1549
|
-
const
|
1550
|
-
const isCoinOrMessage = "owner" in input || "sender" in input;
|
1551
|
-
if (isCoinOrMessage) {
|
1552
|
-
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
1553
|
-
return true;
|
1554
|
-
}
|
1555
|
-
if (!witnessCache.includes(input.witnessIndex)) {
|
1556
|
-
witnessCache.push(input.witnessIndex);
|
1557
|
-
return true;
|
1558
|
-
}
|
1559
|
-
}
|
1560
|
-
return false;
|
1561
|
-
});
|
1562
|
-
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
1563
|
-
const totalGas = chargeableInputs.reduce((total, input) => {
|
1486
|
+
const totalGas = inputs.reduce((total, input) => {
|
1564
1487
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
1565
1488
|
return total.add(
|
1566
|
-
|
1489
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
|
1567
1490
|
);
|
1568
1491
|
}
|
1569
|
-
|
1570
|
-
|
1492
|
+
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
1493
|
+
witnessCache.push(input.witnessIndex);
|
1494
|
+
return total.add(gasCosts.ecr1);
|
1495
|
+
}
|
1496
|
+
return total;
|
1497
|
+
}, bn5());
|
1571
1498
|
return totalGas;
|
1572
1499
|
}
|
1573
1500
|
function getMinGas(params) {
|
@@ -1579,20 +1506,12 @@ function getMinGas(params) {
|
|
1579
1506
|
return minGas;
|
1580
1507
|
}
|
1581
1508
|
function getMaxGas(params) {
|
1582
|
-
const {
|
1583
|
-
gasPerByte,
|
1584
|
-
witnessesLength,
|
1585
|
-
witnessLimit,
|
1586
|
-
minGas,
|
1587
|
-
gasLimit = bn5(0),
|
1588
|
-
maxGasPerTx
|
1589
|
-
} = params;
|
1509
|
+
const { gasPerByte, witnessesLength, witnessLimit, minGas, gasLimit = bn5(0) } = params;
|
1590
1510
|
let remainingAllowedWitnessGas = bn5(0);
|
1591
1511
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
1592
1512
|
remainingAllowedWitnessGas = bn5(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
1593
1513
|
}
|
1594
|
-
|
1595
|
-
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
1514
|
+
return remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
1596
1515
|
}
|
1597
1516
|
function calculateMetadataGasForTxCreate({
|
1598
1517
|
gasCosts,
|
@@ -1614,10 +1533,6 @@ function calculateMetadataGasForTxScript({
|
|
1614
1533
|
}) {
|
1615
1534
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
1616
1535
|
}
|
1617
|
-
var calculateGasFee = (params) => {
|
1618
|
-
const { gas, gasPrice, priceFactor, tip } = params;
|
1619
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
1620
|
-
};
|
1621
1536
|
|
1622
1537
|
// src/providers/utils/json.ts
|
1623
1538
|
import { hexlify as hexlify5 } from "@fuel-ts/utils";
|
@@ -1774,7 +1689,7 @@ var witnessify = (value) => {
|
|
1774
1689
|
// src/providers/transaction-request/transaction-request.ts
|
1775
1690
|
var BaseTransactionRequest = class {
|
1776
1691
|
/** Gas price for transaction */
|
1777
|
-
|
1692
|
+
gasPrice;
|
1778
1693
|
/** Block until which tx cannot be included */
|
1779
1694
|
maturity;
|
1780
1695
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -1793,7 +1708,7 @@ var BaseTransactionRequest = class {
|
|
1793
1708
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
1794
1709
|
*/
|
1795
1710
|
constructor({
|
1796
|
-
|
1711
|
+
gasPrice,
|
1797
1712
|
maturity,
|
1798
1713
|
maxFee,
|
1799
1714
|
witnessLimit,
|
@@ -1801,7 +1716,7 @@ var BaseTransactionRequest = class {
|
|
1801
1716
|
outputs,
|
1802
1717
|
witnesses
|
1803
1718
|
} = {}) {
|
1804
|
-
this.
|
1719
|
+
this.gasPrice = bn7(gasPrice);
|
1805
1720
|
this.maturity = maturity ?? 0;
|
1806
1721
|
this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
|
1807
1722
|
this.maxFee = maxFee ? bn7(maxFee) : void 0;
|
@@ -1812,9 +1727,9 @@ var BaseTransactionRequest = class {
|
|
1812
1727
|
static getPolicyMeta(req) {
|
1813
1728
|
let policyTypes = 0;
|
1814
1729
|
const policies = [];
|
1815
|
-
if (req.
|
1816
|
-
policyTypes += PolicyType.
|
1817
|
-
policies.push({ data: req.
|
1730
|
+
if (req.gasPrice) {
|
1731
|
+
policyTypes += PolicyType.GasPrice;
|
1732
|
+
policies.push({ data: req.gasPrice, type: PolicyType.GasPrice });
|
1818
1733
|
}
|
1819
1734
|
if (req.witnessLimit) {
|
1820
1735
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -2001,10 +1916,10 @@ var BaseTransactionRequest = class {
|
|
2001
1916
|
* @param predicate - Predicate bytes.
|
2002
1917
|
* @param predicateData - Predicate data bytes.
|
2003
1918
|
*/
|
2004
|
-
addCoinInput(coin) {
|
1919
|
+
addCoinInput(coin, predicate) {
|
2005
1920
|
const { assetId, owner, amount } = coin;
|
2006
1921
|
let witnessIndex;
|
2007
|
-
if (
|
1922
|
+
if (predicate) {
|
2008
1923
|
witnessIndex = 0;
|
2009
1924
|
} else {
|
2010
1925
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -2019,7 +1934,8 @@ var BaseTransactionRequest = class {
|
|
2019
1934
|
amount,
|
2020
1935
|
assetId,
|
2021
1936
|
txPointer: "0x00000000000000000000000000000000",
|
2022
|
-
witnessIndex
|
1937
|
+
witnessIndex,
|
1938
|
+
predicate: predicate?.bytes
|
2023
1939
|
};
|
2024
1940
|
this.pushInput(input);
|
2025
1941
|
this.addChangeOutput(owner, assetId);
|
@@ -2032,11 +1948,11 @@ var BaseTransactionRequest = class {
|
|
2032
1948
|
* @param predicate - Predicate bytes.
|
2033
1949
|
* @param predicateData - Predicate data bytes.
|
2034
1950
|
*/
|
2035
|
-
addMessageInput(message) {
|
1951
|
+
addMessageInput(message, predicate) {
|
2036
1952
|
const { recipient, sender, amount } = message;
|
2037
1953
|
const assetId = BaseAssetId2;
|
2038
1954
|
let witnessIndex;
|
2039
|
-
if (
|
1955
|
+
if (predicate) {
|
2040
1956
|
witnessIndex = 0;
|
2041
1957
|
} else {
|
2042
1958
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -2050,7 +1966,8 @@ var BaseTransactionRequest = class {
|
|
2050
1966
|
sender: sender.toB256(),
|
2051
1967
|
recipient: recipient.toB256(),
|
2052
1968
|
amount,
|
2053
|
-
witnessIndex
|
1969
|
+
witnessIndex,
|
1970
|
+
predicate: predicate?.bytes
|
2054
1971
|
};
|
2055
1972
|
this.pushInput(input);
|
2056
1973
|
this.addChangeOutput(recipient, assetId);
|
@@ -2081,6 +1998,32 @@ var BaseTransactionRequest = class {
|
|
2081
1998
|
resources.forEach((resource) => this.addResource(resource));
|
2082
1999
|
return this;
|
2083
2000
|
}
|
2001
|
+
/**
|
2002
|
+
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
2003
|
+
* outputs from the related assetIds.
|
2004
|
+
*
|
2005
|
+
* @param resources - The resources to add.
|
2006
|
+
* @returns This transaction.
|
2007
|
+
*/
|
2008
|
+
addPredicateResource(resource, predicate) {
|
2009
|
+
if (isCoin(resource)) {
|
2010
|
+
this.addCoinInput(resource, predicate);
|
2011
|
+
} else {
|
2012
|
+
this.addMessageInput(resource, predicate);
|
2013
|
+
}
|
2014
|
+
return this;
|
2015
|
+
}
|
2016
|
+
/**
|
2017
|
+
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
2018
|
+
* from the related assetIds.
|
2019
|
+
*
|
2020
|
+
* @param resources - The resources to add.
|
2021
|
+
* @returns This transaction.
|
2022
|
+
*/
|
2023
|
+
addPredicateResources(resources, predicate) {
|
2024
|
+
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
2025
|
+
return this;
|
2026
|
+
}
|
2084
2027
|
/**
|
2085
2028
|
* Adds a coin output to the transaction.
|
2086
2029
|
*
|
@@ -2160,7 +2103,7 @@ var BaseTransactionRequest = class {
|
|
2160
2103
|
}
|
2161
2104
|
calculateMaxGas(chainInfo, minGas) {
|
2162
2105
|
const { consensusParameters } = chainInfo;
|
2163
|
-
const { gasPerByte
|
2106
|
+
const { gasPerByte } = consensusParameters;
|
2164
2107
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2165
2108
|
(acc, wit) => acc + wit.dataLength,
|
2166
2109
|
0
|
@@ -2169,8 +2112,7 @@ var BaseTransactionRequest = class {
|
|
2169
2112
|
gasPerByte,
|
2170
2113
|
minGas,
|
2171
2114
|
witnessesLength,
|
2172
|
-
witnessLimit: this.witnessLimit
|
2173
|
-
maxGasPerTx
|
2115
|
+
witnessLimit: this.witnessLimit
|
2174
2116
|
});
|
2175
2117
|
}
|
2176
2118
|
/**
|
@@ -2188,20 +2130,17 @@ var BaseTransactionRequest = class {
|
|
2188
2130
|
});
|
2189
2131
|
const updateAssetInput = (assetId, quantity) => {
|
2190
2132
|
const assetInput = findAssetInput(assetId);
|
2191
|
-
let usedQuantity = quantity;
|
2192
|
-
if (assetId === BaseAssetId2) {
|
2193
|
-
usedQuantity = bn7("1000000000000000000");
|
2194
|
-
}
|
2195
2133
|
if (assetInput && "assetId" in assetInput) {
|
2196
2134
|
assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
|
2197
|
-
assetInput.amount =
|
2135
|
+
assetInput.amount = quantity;
|
2198
2136
|
} else {
|
2199
2137
|
this.addResources([
|
2200
2138
|
{
|
2201
2139
|
id: hexlify7(randomBytes(UTXO_ID_LEN2)),
|
2202
|
-
amount:
|
2140
|
+
amount: quantity,
|
2203
2141
|
assetId,
|
2204
2142
|
owner: resourcesOwner || Address.fromRandom(),
|
2143
|
+
maturity: 0,
|
2205
2144
|
blockCreated: bn7(1),
|
2206
2145
|
txCreatedIdx: bn7(1)
|
2207
2146
|
}
|
@@ -2233,7 +2172,7 @@ var BaseTransactionRequest = class {
|
|
2233
2172
|
toJSON() {
|
2234
2173
|
return normalizeJSON(this);
|
2235
2174
|
}
|
2236
|
-
|
2175
|
+
updatePredicateInputs(inputs) {
|
2237
2176
|
this.inputs.forEach((i) => {
|
2238
2177
|
let correspondingInput;
|
2239
2178
|
switch (i.type) {
|
@@ -2255,15 +2194,6 @@ var BaseTransactionRequest = class {
|
|
2255
2194
|
}
|
2256
2195
|
});
|
2257
2196
|
}
|
2258
|
-
shiftPredicateData() {
|
2259
|
-
this.inputs.forEach((input) => {
|
2260
|
-
if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
|
2261
|
-
input.predicateData = input.paddPredicateData(
|
2262
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
2263
|
-
);
|
2264
|
-
}
|
2265
|
-
});
|
2266
|
-
}
|
2267
2197
|
};
|
2268
2198
|
|
2269
2199
|
// src/providers/transaction-request/create-transaction-request.ts
|
@@ -2410,8 +2340,9 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2410
2340
|
return {
|
2411
2341
|
type: TransactionType3.Create,
|
2412
2342
|
...baseTransaction,
|
2343
|
+
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
2413
2344
|
bytecodeWitnessIndex,
|
2414
|
-
storageSlotsCount:
|
2345
|
+
storageSlotsCount: storageSlots.length,
|
2415
2346
|
salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
|
2416
2347
|
storageSlots
|
2417
2348
|
};
|
@@ -2534,8 +2465,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2534
2465
|
type: TransactionType4.Script,
|
2535
2466
|
scriptGasLimit: this.gasLimit,
|
2536
2467
|
...super.getBaseTransaction(),
|
2537
|
-
scriptLength:
|
2538
|
-
scriptDataLength:
|
2468
|
+
scriptLength: script.length,
|
2469
|
+
scriptDataLength: scriptData.length,
|
2539
2470
|
receiptsRoot: ZeroBytes327,
|
2540
2471
|
script: hexlify10(script),
|
2541
2472
|
scriptData: hexlify10(scriptData)
|
@@ -2599,7 +2530,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2599
2530
|
}
|
2600
2531
|
calculateMaxGas(chainInfo, minGas) {
|
2601
2532
|
const { consensusParameters } = chainInfo;
|
2602
|
-
const { gasPerByte
|
2533
|
+
const { gasPerByte } = consensusParameters;
|
2603
2534
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2604
2535
|
(acc, wit) => acc + wit.dataLength,
|
2605
2536
|
0
|
@@ -2609,8 +2540,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2609
2540
|
minGas,
|
2610
2541
|
witnessesLength,
|
2611
2542
|
witnessLimit: this.witnessLimit,
|
2612
|
-
gasLimit: this.gasLimit
|
2613
|
-
maxGasPerTx
|
2543
|
+
gasLimit: this.gasLimit
|
2614
2544
|
});
|
2615
2545
|
}
|
2616
2546
|
/**
|
@@ -2667,7 +2597,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2667
2597
|
|
2668
2598
|
// src/providers/transaction-request/utils.ts
|
2669
2599
|
import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
|
2670
|
-
import { TransactionType as TransactionType5
|
2600
|
+
import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
|
2671
2601
|
var transactionRequestify = (obj) => {
|
2672
2602
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
|
2673
2603
|
return obj;
|
@@ -2685,31 +2615,14 @@ var transactionRequestify = (obj) => {
|
|
2685
2615
|
}
|
2686
2616
|
}
|
2687
2617
|
};
|
2688
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
2689
|
-
(acc, input) => {
|
2690
|
-
if (input.type === InputType5.Coin && input.owner === owner) {
|
2691
|
-
acc.utxos.push(input.id);
|
2692
|
-
}
|
2693
|
-
if (input.type === InputType5.Message && input.recipient === owner) {
|
2694
|
-
acc.messages.push(input.nonce);
|
2695
|
-
}
|
2696
|
-
return acc;
|
2697
|
-
},
|
2698
|
-
{
|
2699
|
-
utxos: [],
|
2700
|
-
messages: []
|
2701
|
-
}
|
2702
|
-
);
|
2703
2618
|
|
2704
2619
|
// src/providers/transaction-response/transaction-response.ts
|
2705
2620
|
import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
|
2706
|
-
import { bn as
|
2621
|
+
import { bn as bn14 } from "@fuel-ts/math";
|
2707
2622
|
import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
|
2708
2623
|
import { arrayify as arrayify10 } from "@fuel-ts/utils";
|
2709
2624
|
|
2710
2625
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2711
|
-
import { bn as bn14 } from "@fuel-ts/math";
|
2712
|
-
import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
|
2713
2626
|
import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
|
2714
2627
|
|
2715
2628
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
@@ -2718,10 +2631,9 @@ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, Trans
|
|
2718
2631
|
import { arrayify as arrayify9 } from "@fuel-ts/utils";
|
2719
2632
|
var calculateTransactionFee = (params) => {
|
2720
2633
|
const {
|
2721
|
-
|
2634
|
+
gasUsed,
|
2722
2635
|
rawPayload,
|
2723
|
-
|
2724
|
-
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
2636
|
+
consensusParameters: { gasCosts, feeParams }
|
2725
2637
|
} = params;
|
2726
2638
|
const gasPerByte = bn11(feeParams.gasPerByte);
|
2727
2639
|
const gasPriceFactor = bn11(feeParams.gasPriceFactor);
|
@@ -2731,7 +2643,8 @@ var calculateTransactionFee = (params) => {
|
|
2731
2643
|
return {
|
2732
2644
|
fee: bn11(0),
|
2733
2645
|
minFee: bn11(0),
|
2734
|
-
maxFee: bn11(0)
|
2646
|
+
maxFee: bn11(0),
|
2647
|
+
feeFromGasUsed: bn11(0)
|
2735
2648
|
};
|
2736
2649
|
}
|
2737
2650
|
const { type, witnesses, inputs, policies } = transaction;
|
@@ -2763,6 +2676,7 @@ var calculateTransactionFee = (params) => {
|
|
2763
2676
|
metadataGas,
|
2764
2677
|
txBytesSize: transactionBytes.length
|
2765
2678
|
});
|
2679
|
+
const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
|
2766
2680
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
|
2767
2681
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
2768
2682
|
const maxGas = getMaxGas({
|
@@ -2770,25 +2684,17 @@ var calculateTransactionFee = (params) => {
|
|
2770
2684
|
minGas,
|
2771
2685
|
witnessesLength,
|
2772
2686
|
gasLimit,
|
2773
|
-
witnessLimit
|
2774
|
-
maxGasPerTx
|
2775
|
-
});
|
2776
|
-
const minFee = calculateGasFee({
|
2777
|
-
gasPrice,
|
2778
|
-
gas: minGas,
|
2779
|
-
priceFactor: gasPriceFactor,
|
2780
|
-
tip
|
2781
|
-
});
|
2782
|
-
const maxFee = calculateGasFee({
|
2783
|
-
gasPrice,
|
2784
|
-
gas: maxGas,
|
2785
|
-
priceFactor: gasPriceFactor,
|
2786
|
-
tip
|
2687
|
+
witnessLimit
|
2787
2688
|
});
|
2689
|
+
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
2690
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
2691
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
2692
|
+
const fee = minFee.add(feeFromGasUsed);
|
2788
2693
|
return {
|
2694
|
+
fee,
|
2789
2695
|
minFee,
|
2790
2696
|
maxFee,
|
2791
|
-
|
2697
|
+
feeFromGasUsed
|
2792
2698
|
};
|
2793
2699
|
};
|
2794
2700
|
|
@@ -2844,7 +2750,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
|
2844
2750
|
|
2845
2751
|
// src/providers/transaction-summary/input.ts
|
2846
2752
|
import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
|
2847
|
-
import { InputType as
|
2753
|
+
import { InputType as InputType5 } from "@fuel-ts/transactions";
|
2848
2754
|
function getInputsByTypes(inputs, types) {
|
2849
2755
|
return inputs.filter((i) => types.includes(i.type));
|
2850
2756
|
}
|
@@ -2852,16 +2758,16 @@ function getInputsByType(inputs, type) {
|
|
2852
2758
|
return inputs.filter((i) => i.type === type);
|
2853
2759
|
}
|
2854
2760
|
function getInputsCoin(inputs) {
|
2855
|
-
return getInputsByType(inputs,
|
2761
|
+
return getInputsByType(inputs, InputType5.Coin);
|
2856
2762
|
}
|
2857
2763
|
function getInputsMessage(inputs) {
|
2858
|
-
return getInputsByType(inputs,
|
2764
|
+
return getInputsByType(inputs, InputType5.Message);
|
2859
2765
|
}
|
2860
2766
|
function getInputsCoinAndMessage(inputs) {
|
2861
|
-
return getInputsByTypes(inputs, [
|
2767
|
+
return getInputsByTypes(inputs, [InputType5.Coin, InputType5.Message]);
|
2862
2768
|
}
|
2863
2769
|
function getInputsContract(inputs) {
|
2864
|
-
return getInputsByType(inputs,
|
2770
|
+
return getInputsByType(inputs, InputType5.Contract);
|
2865
2771
|
}
|
2866
2772
|
function getInputFromAssetId(inputs, assetId) {
|
2867
2773
|
const coinInputs = getInputsCoin(inputs);
|
@@ -2880,7 +2786,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2880
2786
|
if (!contractInput) {
|
2881
2787
|
return void 0;
|
2882
2788
|
}
|
2883
|
-
if (contractInput.type !==
|
2789
|
+
if (contractInput.type !== InputType5.Contract) {
|
2884
2790
|
throw new FuelError9(
|
2885
2791
|
ErrorCode9.INVALID_TRANSACTION_INPUT,
|
2886
2792
|
`Contract input should be of type 'contract'.`
|
@@ -2889,10 +2795,10 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2889
2795
|
return contractInput;
|
2890
2796
|
}
|
2891
2797
|
function getInputAccountAddress(input) {
|
2892
|
-
if (input.type ===
|
2798
|
+
if (input.type === InputType5.Coin) {
|
2893
2799
|
return input.owner.toString();
|
2894
2800
|
}
|
2895
|
-
if (input.type ===
|
2801
|
+
if (input.type === InputType5.Message) {
|
2896
2802
|
return input.recipient.toString();
|
2897
2803
|
}
|
2898
2804
|
return "";
|
@@ -3402,9 +3308,7 @@ function assembleTransactionSummary(params) {
|
|
3402
3308
|
gqlTransactionStatus,
|
3403
3309
|
abiMap = {},
|
3404
3310
|
maxInputs,
|
3405
|
-
gasCosts
|
3406
|
-
maxGasPerTx,
|
3407
|
-
gasPrice
|
3311
|
+
gasCosts
|
3408
3312
|
} = params;
|
3409
3313
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
3410
3314
|
const rawPayload = hexlify11(transactionBytes);
|
@@ -3418,14 +3322,11 @@ function assembleTransactionSummary(params) {
|
|
3418
3322
|
maxInputs
|
3419
3323
|
});
|
3420
3324
|
const typeName = getTransactionTypeName(transaction.type);
|
3421
|
-
const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
|
3422
3325
|
const { fee } = calculateTransactionFee({
|
3423
|
-
|
3326
|
+
gasUsed,
|
3424
3327
|
rawPayload,
|
3425
|
-
tip,
|
3426
3328
|
consensusParameters: {
|
3427
3329
|
gasCosts,
|
3428
|
-
maxGasPerTx,
|
3429
3330
|
feeParams: {
|
3430
3331
|
gasPerByte,
|
3431
3332
|
gasPriceFactor
|
@@ -3485,7 +3386,7 @@ var TransactionResponse = class {
|
|
3485
3386
|
/** Current provider */
|
3486
3387
|
provider;
|
3487
3388
|
/** Gas used on the transaction */
|
3488
|
-
gasUsed =
|
3389
|
+
gasUsed = bn14(0);
|
3489
3390
|
/** The graphql Transaction with receipts object. */
|
3490
3391
|
gqlTransaction;
|
3491
3392
|
abis;
|
@@ -3563,13 +3464,8 @@ var TransactionResponse = class {
|
|
3563
3464
|
const decodedTransaction = this.decodeTransaction(
|
3564
3465
|
transaction
|
3565
3466
|
);
|
3566
|
-
|
3567
|
-
|
3568
|
-
txReceipts = transaction.status.receipts;
|
3569
|
-
}
|
3570
|
-
const receipts = txReceipts.map(processGqlReceipt) || [];
|
3571
|
-
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
3572
|
-
const gasPrice = await this.provider.getLatestGasPrice();
|
3467
|
+
const receipts = transaction.receipts?.map(processGqlReceipt) || [];
|
3468
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = this.provider.getGasConfig();
|
3573
3469
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
3574
3470
|
const transactionSummary = assembleTransactionSummary({
|
3575
3471
|
id: this.id,
|
@@ -3581,9 +3477,7 @@ var TransactionResponse = class {
|
|
3581
3477
|
gasPriceFactor,
|
3582
3478
|
abiMap: contractsAbiMap,
|
3583
3479
|
maxInputs,
|
3584
|
-
gasCosts
|
3585
|
-
maxGasPerTx,
|
3586
|
-
gasPrice
|
3480
|
+
gasCosts
|
3587
3481
|
});
|
3588
3482
|
return transactionSummary;
|
3589
3483
|
}
|
@@ -3710,29 +3604,29 @@ var processGqlChain = (chain) => {
|
|
3710
3604
|
const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
|
3711
3605
|
return {
|
3712
3606
|
name,
|
3713
|
-
baseChainHeight:
|
3607
|
+
baseChainHeight: bn15(daHeight),
|
3714
3608
|
consensusParameters: {
|
3715
|
-
contractMaxSize:
|
3716
|
-
maxInputs:
|
3717
|
-
maxOutputs:
|
3718
|
-
maxWitnesses:
|
3719
|
-
maxGasPerTx:
|
3720
|
-
maxScriptLength:
|
3721
|
-
maxScriptDataLength:
|
3722
|
-
maxStorageSlots:
|
3723
|
-
maxPredicateLength:
|
3724
|
-
maxPredicateDataLength:
|
3725
|
-
maxGasPerPredicate:
|
3726
|
-
gasPriceFactor:
|
3727
|
-
gasPerByte:
|
3728
|
-
maxMessageDataLength:
|
3729
|
-
chainId:
|
3609
|
+
contractMaxSize: bn15(contractParams.contractMaxSize),
|
3610
|
+
maxInputs: bn15(txParams.maxInputs),
|
3611
|
+
maxOutputs: bn15(txParams.maxOutputs),
|
3612
|
+
maxWitnesses: bn15(txParams.maxWitnesses),
|
3613
|
+
maxGasPerTx: bn15(txParams.maxGasPerTx),
|
3614
|
+
maxScriptLength: bn15(scriptParams.maxScriptLength),
|
3615
|
+
maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
|
3616
|
+
maxStorageSlots: bn15(contractParams.maxStorageSlots),
|
3617
|
+
maxPredicateLength: bn15(predicateParams.maxPredicateLength),
|
3618
|
+
maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
|
3619
|
+
maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
|
3620
|
+
gasPriceFactor: bn15(feeParams.gasPriceFactor),
|
3621
|
+
gasPerByte: bn15(feeParams.gasPerByte),
|
3622
|
+
maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
|
3623
|
+
chainId: bn15(consensusParameters.chainId),
|
3730
3624
|
gasCosts
|
3731
3625
|
},
|
3732
3626
|
gasCosts,
|
3733
3627
|
latestBlock: {
|
3734
3628
|
id: latestBlock.id,
|
3735
|
-
height:
|
3629
|
+
height: bn15(latestBlock.header.height),
|
3736
3630
|
time: latestBlock.header.time,
|
3737
3631
|
transactions: latestBlock.transactions.map((i) => ({
|
3738
3632
|
id: i.id
|
@@ -3826,8 +3720,10 @@ var _Provider = class {
|
|
3826
3720
|
* Returns some helpful parameters related to gas fees.
|
3827
3721
|
*/
|
3828
3722
|
getGasConfig() {
|
3723
|
+
const { minGasPrice } = this.getNode();
|
3829
3724
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
3830
3725
|
return {
|
3726
|
+
minGasPrice,
|
3831
3727
|
maxGasPerTx,
|
3832
3728
|
maxGasPerPredicate,
|
3833
3729
|
gasPriceFactor,
|
@@ -3925,7 +3821,7 @@ var _Provider = class {
|
|
3925
3821
|
*/
|
3926
3822
|
async getBlockNumber() {
|
3927
3823
|
const { chain } = await this.operations.getChain();
|
3928
|
-
return
|
3824
|
+
return bn15(chain.latestBlock.header.height, 10);
|
3929
3825
|
}
|
3930
3826
|
/**
|
3931
3827
|
* Returns the chain information.
|
@@ -3935,11 +3831,13 @@ var _Provider = class {
|
|
3935
3831
|
async fetchNode() {
|
3936
3832
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
3937
3833
|
const processedNodeInfo = {
|
3938
|
-
maxDepth:
|
3939
|
-
maxTx:
|
3834
|
+
maxDepth: bn15(nodeInfo.maxDepth),
|
3835
|
+
maxTx: bn15(nodeInfo.maxTx),
|
3836
|
+
minGasPrice: bn15(nodeInfo.minGasPrice),
|
3940
3837
|
nodeVersion: nodeInfo.nodeVersion,
|
3941
3838
|
utxoValidation: nodeInfo.utxoValidation,
|
3942
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
3839
|
+
vmBacktrace: nodeInfo.vmBacktrace,
|
3840
|
+
peers: nodeInfo.peers
|
3943
3841
|
};
|
3944
3842
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
3945
3843
|
return processedNodeInfo;
|
@@ -4025,13 +3923,14 @@ var _Provider = class {
|
|
4025
3923
|
return this.estimateTxDependencies(transactionRequest);
|
4026
3924
|
}
|
4027
3925
|
const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
|
4028
|
-
const { dryRun:
|
4029
|
-
|
3926
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
3927
|
+
encodedTransaction,
|
4030
3928
|
utxoValidation: utxoValidation || false
|
4031
3929
|
});
|
4032
|
-
const
|
4033
|
-
|
4034
|
-
|
3930
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
3931
|
+
return {
|
3932
|
+
receipts
|
3933
|
+
};
|
4035
3934
|
}
|
4036
3935
|
/**
|
4037
3936
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -4057,7 +3956,7 @@ var _Provider = class {
|
|
4057
3956
|
} = response;
|
4058
3957
|
if (inputs) {
|
4059
3958
|
inputs.forEach((input, index) => {
|
4060
|
-
if ("predicateGasUsed" in input &&
|
3959
|
+
if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
|
4061
3960
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
4062
3961
|
}
|
4063
3962
|
});
|
@@ -4070,6 +3969,9 @@ var _Provider = class {
|
|
4070
3969
|
* If there are missing variable outputs,
|
4071
3970
|
* `addVariableOutputs` is called on the transaction.
|
4072
3971
|
*
|
3972
|
+
* @privateRemarks
|
3973
|
+
* TODO: Investigate support for missing contract IDs
|
3974
|
+
* TODO: Add support for missing output messages
|
4073
3975
|
*
|
4074
3976
|
* @param transactionRequest - The transaction request object.
|
4075
3977
|
* @returns A promise.
|
@@ -4082,19 +3984,16 @@ var _Provider = class {
|
|
4082
3984
|
missingContractIds: []
|
4083
3985
|
};
|
4084
3986
|
}
|
3987
|
+
await this.estimatePredicates(transactionRequest);
|
4085
3988
|
let receipts = [];
|
4086
3989
|
const missingContractIds = [];
|
4087
3990
|
let outputVariables = 0;
|
4088
|
-
let dryrunStatus;
|
4089
3991
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
4090
|
-
const {
|
4091
|
-
|
4092
|
-
} = await this.operations.dryRun({
|
4093
|
-
encodedTransactions: [hexlify12(transactionRequest.toTransactionBytes())],
|
3992
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
3993
|
+
encodedTransaction: hexlify12(transactionRequest.toTransactionBytes()),
|
4094
3994
|
utxoValidation: false
|
4095
3995
|
});
|
4096
|
-
receipts =
|
4097
|
-
dryrunStatus = status;
|
3996
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
4098
3997
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
4099
3998
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
4100
3999
|
if (hasMissingOutputs) {
|
@@ -4104,10 +4003,6 @@ var _Provider = class {
|
|
4104
4003
|
transactionRequest.addContractInputAndOutput(Address2.fromString(contractId));
|
4105
4004
|
missingContractIds.push(contractId);
|
4106
4005
|
});
|
4107
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
4108
|
-
transactionRequest
|
4109
|
-
});
|
4110
|
-
transactionRequest.maxFee = maxFee;
|
4111
4006
|
} else {
|
4112
4007
|
break;
|
4113
4008
|
}
|
@@ -4115,139 +4010,37 @@ var _Provider = class {
|
|
4115
4010
|
return {
|
4116
4011
|
receipts,
|
4117
4012
|
outputVariables,
|
4118
|
-
missingContractIds
|
4119
|
-
dryrunStatus
|
4013
|
+
missingContractIds
|
4120
4014
|
};
|
4121
4015
|
}
|
4122
|
-
/**
|
4123
|
-
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
4124
|
-
*
|
4125
|
-
* Transactions are dry run in batches. After each dry run, transactions requiring
|
4126
|
-
* further modifications are identified. The method iteratively updates these transactions
|
4127
|
-
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
4128
|
-
*
|
4129
|
-
* @param transactionRequests - Array of transaction request objects.
|
4130
|
-
* @returns A promise that resolves to an array of results for each transaction.
|
4131
|
-
*/
|
4132
|
-
async estimateMultipleTxDependencies(transactionRequests) {
|
4133
|
-
const results = transactionRequests.map(() => ({
|
4134
|
-
receipts: [],
|
4135
|
-
outputVariables: 0,
|
4136
|
-
missingContractIds: [],
|
4137
|
-
dryrunStatus: void 0
|
4138
|
-
}));
|
4139
|
-
const allRequests = clone3(transactionRequests);
|
4140
|
-
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
4141
|
-
allRequests.forEach((req, index) => {
|
4142
|
-
if (req.type === TransactionType8.Script) {
|
4143
|
-
serializedTransactionsMap.set(index, hexlify12(req.toTransactionBytes()));
|
4144
|
-
}
|
4145
|
-
});
|
4146
|
-
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
4147
|
-
let attempt = 0;
|
4148
|
-
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
4149
|
-
const encodedTransactions = transactionsToProcess.map(
|
4150
|
-
(index) => serializedTransactionsMap.get(index)
|
4151
|
-
);
|
4152
|
-
const dryRunResults = await this.operations.dryRun({
|
4153
|
-
encodedTransactions,
|
4154
|
-
utxoValidation: false
|
4155
|
-
});
|
4156
|
-
const nextRoundTransactions = [];
|
4157
|
-
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
4158
|
-
const currentResultIndex = transactionsToProcess[i];
|
4159
|
-
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
4160
|
-
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
4161
|
-
results[currentResultIndex].dryrunStatus = status;
|
4162
|
-
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
4163
|
-
results[currentResultIndex].receipts
|
4164
|
-
);
|
4165
|
-
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
4166
|
-
const requestToProcess = allRequests[currentResultIndex];
|
4167
|
-
if (hasMissingOutputs && requestToProcess?.type === TransactionType8.Script) {
|
4168
|
-
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
4169
|
-
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
4170
|
-
missingOutputContractIds.forEach(({ contractId }) => {
|
4171
|
-
requestToProcess.addContractInputAndOutput(Address2.fromString(contractId));
|
4172
|
-
results[currentResultIndex].missingContractIds.push(contractId);
|
4173
|
-
});
|
4174
|
-
const { maxFee } = await this.estimateTxGasAndFee({
|
4175
|
-
transactionRequest: requestToProcess
|
4176
|
-
});
|
4177
|
-
requestToProcess.maxFee = maxFee;
|
4178
|
-
serializedTransactionsMap.set(
|
4179
|
-
currentResultIndex,
|
4180
|
-
hexlify12(requestToProcess.toTransactionBytes())
|
4181
|
-
);
|
4182
|
-
nextRoundTransactions.push(currentResultIndex);
|
4183
|
-
allRequests[currentResultIndex] = requestToProcess;
|
4184
|
-
}
|
4185
|
-
}
|
4186
|
-
transactionsToProcess = nextRoundTransactions;
|
4187
|
-
attempt += 1;
|
4188
|
-
}
|
4189
|
-
return results;
|
4190
|
-
}
|
4191
|
-
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
4192
|
-
if (estimateTxDependencies) {
|
4193
|
-
return this.estimateMultipleTxDependencies(transactionRequests);
|
4194
|
-
}
|
4195
|
-
const encodedTransactions = transactionRequests.map((tx) => hexlify12(tx.toTransactionBytes()));
|
4196
|
-
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
4197
|
-
encodedTransactions,
|
4198
|
-
utxoValidation: utxoValidation || false
|
4199
|
-
});
|
4200
|
-
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
4201
|
-
const receipts = rawReceipts.map(processGqlReceipt);
|
4202
|
-
return { receipts, dryrunStatus: status };
|
4203
|
-
});
|
4204
|
-
return results;
|
4205
|
-
}
|
4206
4016
|
/**
|
4207
4017
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
4208
4018
|
* @param transactionRequest - The transaction request object.
|
4209
4019
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
4210
4020
|
*/
|
4211
|
-
|
4021
|
+
estimateTxGasAndFee(params) {
|
4212
4022
|
const { transactionRequest } = params;
|
4213
|
-
|
4023
|
+
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
4214
4024
|
const chainInfo = this.getChain();
|
4215
|
-
const
|
4025
|
+
const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
|
4026
|
+
transactionRequest.gasPrice = gasPrice;
|
4216
4027
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
4217
|
-
|
4218
|
-
gasPrice = await this.estimateGasPrice(10);
|
4219
|
-
}
|
4220
|
-
const minFee = calculateGasFee({
|
4221
|
-
gasPrice: bn16(gasPrice),
|
4222
|
-
gas: minGas,
|
4223
|
-
priceFactor: gasPriceFactor,
|
4224
|
-
tip: transactionRequest.tip
|
4225
|
-
}).add(1);
|
4226
|
-
let gasLimit = bn16(0);
|
4028
|
+
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
4227
4029
|
if (transactionRequest.type === TransactionType8.Script) {
|
4228
|
-
gasLimit = transactionRequest.gasLimit;
|
4229
4030
|
if (transactionRequest.gasLimit.eq(0)) {
|
4230
4031
|
transactionRequest.gasLimit = minGas;
|
4231
4032
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
4232
4033
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
4233
4034
|
);
|
4234
|
-
gasLimit = transactionRequest.gasLimit;
|
4235
4035
|
}
|
4236
4036
|
}
|
4237
4037
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4238
|
-
const maxFee =
|
4239
|
-
gasPrice: bn16(gasPrice),
|
4240
|
-
gas: maxGas,
|
4241
|
-
priceFactor: gasPriceFactor,
|
4242
|
-
tip: transactionRequest.tip
|
4243
|
-
}).add(1);
|
4038
|
+
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
|
4244
4039
|
return {
|
4245
4040
|
minGas,
|
4246
4041
|
minFee,
|
4247
4042
|
maxGas,
|
4248
|
-
maxFee
|
4249
|
-
gasPrice,
|
4250
|
-
gasLimit
|
4043
|
+
maxFee
|
4251
4044
|
};
|
4252
4045
|
}
|
4253
4046
|
/**
|
@@ -4265,17 +4058,15 @@ var _Provider = class {
|
|
4265
4058
|
if (estimateTxDependencies) {
|
4266
4059
|
return this.estimateTxDependencies(transactionRequest);
|
4267
4060
|
}
|
4268
|
-
const
|
4269
|
-
const { dryRun:
|
4270
|
-
|
4061
|
+
const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
|
4062
|
+
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
4063
|
+
encodedTransaction,
|
4271
4064
|
utxoValidation: true
|
4272
4065
|
});
|
4273
|
-
const
|
4274
|
-
|
4275
|
-
|
4276
|
-
|
4277
|
-
});
|
4278
|
-
return { receipts: callResult[0].receipts };
|
4066
|
+
const receipts = gqlReceipts.map(processGqlReceipt);
|
4067
|
+
return {
|
4068
|
+
receipts
|
4069
|
+
};
|
4279
4070
|
}
|
4280
4071
|
/**
|
4281
4072
|
* Returns a transaction cost to enable user
|
@@ -4292,79 +4083,77 @@ var _Provider = class {
|
|
4292
4083
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
4293
4084
|
* @returns A promise that resolves to the transaction cost object.
|
4294
4085
|
*/
|
4295
|
-
async getTransactionCost(transactionRequestLike,
|
4086
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
4087
|
+
estimateTxDependencies = true,
|
4088
|
+
estimatePredicates = true,
|
4089
|
+
resourcesOwner,
|
4090
|
+
signatureCallback
|
4091
|
+
} = {}) {
|
4296
4092
|
const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
|
4093
|
+
const { minGasPrice } = this.getGasConfig();
|
4094
|
+
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
4297
4095
|
const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
|
4298
4096
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
4299
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
4097
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
4300
4098
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
4301
|
-
txRequestClone.maxFee = bn16(0);
|
4302
4099
|
if (isScriptTransaction) {
|
4303
|
-
txRequestClone.gasLimit =
|
4100
|
+
txRequestClone.gasLimit = bn15(0);
|
4304
4101
|
}
|
4305
|
-
if (
|
4306
|
-
resourcesOwner
|
4102
|
+
if (estimatePredicates) {
|
4103
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4104
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
4105
|
+
}
|
4106
|
+
await this.estimatePredicates(txRequestClone);
|
4307
4107
|
}
|
4308
|
-
const signedRequest = clone3(txRequestClone);
|
4309
|
-
let addedSignatures = 0;
|
4310
4108
|
if (signatureCallback && isScriptTransaction) {
|
4311
|
-
|
4312
|
-
await signatureCallback(signedRequest);
|
4313
|
-
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
4109
|
+
await signatureCallback(txRequestClone);
|
4314
4110
|
}
|
4315
|
-
|
4316
|
-
|
4317
|
-
transactionRequest: signedRequest
|
4111
|
+
let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
4112
|
+
transactionRequest: txRequestClone
|
4318
4113
|
});
|
4319
4114
|
let receipts = [];
|
4320
4115
|
let missingContractIds = [];
|
4321
4116
|
let outputVariables = 0;
|
4322
|
-
let gasUsed =
|
4323
|
-
|
4324
|
-
|
4325
|
-
if (isScriptTransaction) {
|
4326
|
-
txRequestClone.gasLimit = gasLimit;
|
4327
|
-
if (signatureCallback) {
|
4328
|
-
await signatureCallback(txRequestClone);
|
4329
|
-
}
|
4117
|
+
let gasUsed = bn15(0);
|
4118
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
4119
|
+
txRequestClone.gasPrice = bn15(0);
|
4330
4120
|
const result = await this.estimateTxDependencies(txRequestClone);
|
4331
4121
|
receipts = result.receipts;
|
4332
4122
|
outputVariables = result.outputVariables;
|
4333
4123
|
missingContractIds = result.missingContractIds;
|
4334
4124
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
4335
4125
|
txRequestClone.gasLimit = gasUsed;
|
4336
|
-
|
4337
|
-
|
4338
|
-
|
4126
|
+
txRequestClone.gasPrice = setGasPrice;
|
4127
|
+
({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
|
4128
|
+
transactionRequest: txRequestClone
|
4339
4129
|
}));
|
4340
4130
|
}
|
4341
4131
|
return {
|
4342
4132
|
requiredQuantities: allQuantities,
|
4343
4133
|
receipts,
|
4344
4134
|
gasUsed,
|
4345
|
-
|
4135
|
+
minGasPrice,
|
4136
|
+
gasPrice: setGasPrice,
|
4346
4137
|
minGas,
|
4347
4138
|
maxGas,
|
4348
4139
|
minFee,
|
4349
4140
|
maxFee,
|
4141
|
+
estimatedInputs: txRequestClone.inputs,
|
4350
4142
|
outputVariables,
|
4351
|
-
missingContractIds
|
4352
|
-
addedSignatures,
|
4353
|
-
estimatedPredicates: txRequestClone.inputs
|
4143
|
+
missingContractIds
|
4354
4144
|
};
|
4355
4145
|
}
|
4356
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
4146
|
+
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
4357
4147
|
const ownerAddress = Address2.fromAddressOrString(owner);
|
4358
4148
|
const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
|
4359
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
4360
|
-
quantitiesToContract
|
4361
|
-
});
|
4149
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, forwardingQuantities);
|
4362
4150
|
transactionRequest.addResources(
|
4363
4151
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
4364
4152
|
);
|
4365
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
4366
|
-
|
4367
|
-
|
4153
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
4154
|
+
transactionRequest,
|
4155
|
+
forwardingQuantities
|
4156
|
+
);
|
4368
4157
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
4369
4158
|
return {
|
4370
4159
|
resources,
|
@@ -4386,10 +4175,11 @@ var _Provider = class {
|
|
4386
4175
|
return coins.map((coin) => ({
|
4387
4176
|
id: coin.utxoId,
|
4388
4177
|
assetId: coin.assetId,
|
4389
|
-
amount:
|
4178
|
+
amount: bn15(coin.amount),
|
4390
4179
|
owner: Address2.fromAddressOrString(coin.owner),
|
4391
|
-
|
4392
|
-
|
4180
|
+
maturity: bn15(coin.maturity).toNumber(),
|
4181
|
+
blockCreated: bn15(coin.blockCreated),
|
4182
|
+
txCreatedIdx: bn15(coin.txCreatedIdx)
|
4393
4183
|
}));
|
4394
4184
|
}
|
4395
4185
|
/**
|
@@ -4426,9 +4216,9 @@ var _Provider = class {
|
|
4426
4216
|
switch (coin.__typename) {
|
4427
4217
|
case "MessageCoin":
|
4428
4218
|
return {
|
4429
|
-
amount:
|
4219
|
+
amount: bn15(coin.amount),
|
4430
4220
|
assetId: coin.assetId,
|
4431
|
-
daHeight:
|
4221
|
+
daHeight: bn15(coin.daHeight),
|
4432
4222
|
sender: Address2.fromAddressOrString(coin.sender),
|
4433
4223
|
recipient: Address2.fromAddressOrString(coin.recipient),
|
4434
4224
|
nonce: coin.nonce
|
@@ -4436,11 +4226,12 @@ var _Provider = class {
|
|
4436
4226
|
case "Coin":
|
4437
4227
|
return {
|
4438
4228
|
id: coin.utxoId,
|
4439
|
-
amount:
|
4229
|
+
amount: bn15(coin.amount),
|
4440
4230
|
assetId: coin.assetId,
|
4441
4231
|
owner: Address2.fromAddressOrString(coin.owner),
|
4442
|
-
|
4443
|
-
|
4232
|
+
maturity: bn15(coin.maturity).toNumber(),
|
4233
|
+
blockCreated: bn15(coin.blockCreated),
|
4234
|
+
txCreatedIdx: bn15(coin.txCreatedIdx)
|
4444
4235
|
};
|
4445
4236
|
default:
|
4446
4237
|
return null;
|
@@ -4457,13 +4248,13 @@ var _Provider = class {
|
|
4457
4248
|
async getBlock(idOrHeight) {
|
4458
4249
|
let variables;
|
4459
4250
|
if (typeof idOrHeight === "number") {
|
4460
|
-
variables = { height:
|
4251
|
+
variables = { height: bn15(idOrHeight).toString(10) };
|
4461
4252
|
} else if (idOrHeight === "latest") {
|
4462
4253
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4463
4254
|
} else if (idOrHeight.length === 66) {
|
4464
4255
|
variables = { blockId: idOrHeight };
|
4465
4256
|
} else {
|
4466
|
-
variables = { blockId:
|
4257
|
+
variables = { blockId: bn15(idOrHeight).toString(10) };
|
4467
4258
|
}
|
4468
4259
|
const { block } = await this.operations.getBlock(variables);
|
4469
4260
|
if (!block) {
|
@@ -4471,7 +4262,7 @@ var _Provider = class {
|
|
4471
4262
|
}
|
4472
4263
|
return {
|
4473
4264
|
id: block.id,
|
4474
|
-
height:
|
4265
|
+
height: bn15(block.header.height),
|
4475
4266
|
time: block.header.time,
|
4476
4267
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4477
4268
|
};
|
@@ -4486,7 +4277,7 @@ var _Provider = class {
|
|
4486
4277
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4487
4278
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4488
4279
|
id: block.id,
|
4489
|
-
height:
|
4280
|
+
height: bn15(block.header.height),
|
4490
4281
|
time: block.header.time,
|
4491
4282
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4492
4283
|
}));
|
@@ -4501,7 +4292,7 @@ var _Provider = class {
|
|
4501
4292
|
async getBlockWithTransactions(idOrHeight) {
|
4502
4293
|
let variables;
|
4503
4294
|
if (typeof idOrHeight === "number") {
|
4504
|
-
variables = { blockHeight:
|
4295
|
+
variables = { blockHeight: bn15(idOrHeight).toString(10) };
|
4505
4296
|
} else if (idOrHeight === "latest") {
|
4506
4297
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4507
4298
|
} else {
|
@@ -4513,7 +4304,7 @@ var _Provider = class {
|
|
4513
4304
|
}
|
4514
4305
|
return {
|
4515
4306
|
id: block.id,
|
4516
|
-
height:
|
4307
|
+
height: bn15(block.header.height, 10),
|
4517
4308
|
time: block.header.time,
|
4518
4309
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4519
4310
|
transactions: block.transactions.map(
|
@@ -4562,7 +4353,7 @@ var _Provider = class {
|
|
4562
4353
|
contract: Address2.fromAddressOrString(contractId).toB256(),
|
4563
4354
|
asset: hexlify12(assetId)
|
4564
4355
|
});
|
4565
|
-
return
|
4356
|
+
return bn15(contractBalance.amount, 10);
|
4566
4357
|
}
|
4567
4358
|
/**
|
4568
4359
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4576,7 +4367,7 @@ var _Provider = class {
|
|
4576
4367
|
owner: Address2.fromAddressOrString(owner).toB256(),
|
4577
4368
|
assetId: hexlify12(assetId)
|
4578
4369
|
});
|
4579
|
-
return
|
4370
|
+
return bn15(balance.amount, 10);
|
4580
4371
|
}
|
4581
4372
|
/**
|
4582
4373
|
* Returns balances for the given owner.
|
@@ -4594,7 +4385,7 @@ var _Provider = class {
|
|
4594
4385
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4595
4386
|
return balances.map((balance) => ({
|
4596
4387
|
assetId: balance.assetId,
|
4597
|
-
amount:
|
4388
|
+
amount: bn15(balance.amount)
|
4598
4389
|
}));
|
4599
4390
|
}
|
4600
4391
|
/**
|
@@ -4616,15 +4407,15 @@ var _Provider = class {
|
|
4616
4407
|
sender: message.sender,
|
4617
4408
|
recipient: message.recipient,
|
4618
4409
|
nonce: message.nonce,
|
4619
|
-
amount:
|
4410
|
+
amount: bn15(message.amount),
|
4620
4411
|
data: message.data
|
4621
4412
|
}),
|
4622
4413
|
sender: Address2.fromAddressOrString(message.sender),
|
4623
4414
|
recipient: Address2.fromAddressOrString(message.recipient),
|
4624
4415
|
nonce: message.nonce,
|
4625
|
-
amount:
|
4416
|
+
amount: bn15(message.amount),
|
4626
4417
|
data: InputMessageCoder.decodeData(message.data),
|
4627
|
-
daHeight:
|
4418
|
+
daHeight: bn15(message.daHeight)
|
4628
4419
|
}));
|
4629
4420
|
}
|
4630
4421
|
/**
|
@@ -4677,60 +4468,44 @@ var _Provider = class {
|
|
4677
4468
|
} = result.messageProof;
|
4678
4469
|
return {
|
4679
4470
|
messageProof: {
|
4680
|
-
proofIndex:
|
4471
|
+
proofIndex: bn15(messageProof.proofIndex),
|
4681
4472
|
proofSet: messageProof.proofSet
|
4682
4473
|
},
|
4683
4474
|
blockProof: {
|
4684
|
-
proofIndex:
|
4475
|
+
proofIndex: bn15(blockProof.proofIndex),
|
4685
4476
|
proofSet: blockProof.proofSet
|
4686
4477
|
},
|
4687
4478
|
messageBlockHeader: {
|
4688
4479
|
id: messageBlockHeader.id,
|
4689
|
-
daHeight:
|
4690
|
-
transactionsCount:
|
4480
|
+
daHeight: bn15(messageBlockHeader.daHeight),
|
4481
|
+
transactionsCount: bn15(messageBlockHeader.transactionsCount),
|
4691
4482
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4692
|
-
height:
|
4483
|
+
height: bn15(messageBlockHeader.height),
|
4693
4484
|
prevRoot: messageBlockHeader.prevRoot,
|
4694
4485
|
time: messageBlockHeader.time,
|
4695
4486
|
applicationHash: messageBlockHeader.applicationHash,
|
4696
|
-
|
4697
|
-
|
4698
|
-
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
4699
|
-
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
4700
|
-
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
4487
|
+
messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
|
4488
|
+
messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
|
4701
4489
|
},
|
4702
4490
|
commitBlockHeader: {
|
4703
4491
|
id: commitBlockHeader.id,
|
4704
|
-
daHeight:
|
4705
|
-
transactionsCount:
|
4492
|
+
daHeight: bn15(commitBlockHeader.daHeight),
|
4493
|
+
transactionsCount: bn15(commitBlockHeader.transactionsCount),
|
4706
4494
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
4707
|
-
height:
|
4495
|
+
height: bn15(commitBlockHeader.height),
|
4708
4496
|
prevRoot: commitBlockHeader.prevRoot,
|
4709
4497
|
time: commitBlockHeader.time,
|
4710
4498
|
applicationHash: commitBlockHeader.applicationHash,
|
4711
|
-
|
4712
|
-
|
4713
|
-
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
4714
|
-
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
4715
|
-
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
4499
|
+
messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
|
4500
|
+
messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
|
4716
4501
|
},
|
4717
4502
|
sender: Address2.fromAddressOrString(sender),
|
4718
4503
|
recipient: Address2.fromAddressOrString(recipient),
|
4719
4504
|
nonce,
|
4720
|
-
amount:
|
4505
|
+
amount: bn15(amount),
|
4721
4506
|
data
|
4722
4507
|
};
|
4723
4508
|
}
|
4724
|
-
async getLatestGasPrice() {
|
4725
|
-
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4726
|
-
return bn16(latestGasPrice.gasPrice);
|
4727
|
-
}
|
4728
|
-
async estimateGasPrice(blockHorizon) {
|
4729
|
-
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4730
|
-
blockHorizon: String(blockHorizon)
|
4731
|
-
});
|
4732
|
-
return bn16(estimateGasPrice.gasPrice);
|
4733
|
-
}
|
4734
4509
|
/**
|
4735
4510
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
4736
4511
|
*
|
@@ -4750,10 +4525,10 @@ var _Provider = class {
|
|
4750
4525
|
*/
|
4751
4526
|
async produceBlocks(amount, startTime) {
|
4752
4527
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4753
|
-
blocksToProduce:
|
4528
|
+
blocksToProduce: bn15(amount).toString(10),
|
4754
4529
|
startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4755
4530
|
});
|
4756
|
-
return
|
4531
|
+
return bn15(latestBlockHeight);
|
4757
4532
|
}
|
4758
4533
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4759
4534
|
async getTransactionResponse(transactionId) {
|
@@ -4767,7 +4542,7 @@ cacheInputs_fn = function(inputs) {
|
|
4767
4542
|
return;
|
4768
4543
|
}
|
4769
4544
|
inputs.forEach((input) => {
|
4770
|
-
if (input.type ===
|
4545
|
+
if (input.type === InputType6.Coin) {
|
4771
4546
|
this.cache?.set(input.id);
|
4772
4547
|
}
|
4773
4548
|
});
|
@@ -4777,7 +4552,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4777
4552
|
|
4778
4553
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4779
4554
|
import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
|
4780
|
-
import { bn as
|
4555
|
+
import { bn as bn16 } from "@fuel-ts/math";
|
4781
4556
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
4782
4557
|
import { arrayify as arrayify12 } from "@fuel-ts/utils";
|
4783
4558
|
async function getTransactionSummary(params) {
|
@@ -4795,28 +4570,21 @@ async function getTransactionSummary(params) {
|
|
4795
4570
|
arrayify12(gqlTransaction.rawPayload),
|
4796
4571
|
0
|
4797
4572
|
);
|
4798
|
-
|
4799
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
4800
|
-
txReceipts = gqlTransaction.status.receipts;
|
4801
|
-
}
|
4802
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
4573
|
+
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
4803
4574
|
const {
|
4804
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
4575
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
4805
4576
|
} = provider.getChain();
|
4806
|
-
const gasPrice = await provider.getLatestGasPrice();
|
4807
4577
|
const transactionInfo = assembleTransactionSummary({
|
4808
4578
|
id: gqlTransaction.id,
|
4809
4579
|
receipts,
|
4810
4580
|
transaction: decodedTransaction,
|
4811
4581
|
transactionBytes: arrayify12(gqlTransaction.rawPayload),
|
4812
4582
|
gqlTransactionStatus: gqlTransaction.status,
|
4813
|
-
gasPerByte:
|
4814
|
-
gasPriceFactor:
|
4583
|
+
gasPerByte: bn16(gasPerByte),
|
4584
|
+
gasPriceFactor: bn16(gasPriceFactor),
|
4815
4585
|
abiMap,
|
4816
4586
|
maxInputs,
|
4817
|
-
gasCosts
|
4818
|
-
maxGasPerTx,
|
4819
|
-
gasPrice
|
4587
|
+
gasCosts
|
4820
4588
|
});
|
4821
4589
|
return {
|
4822
4590
|
gqlTransaction,
|
@@ -4826,11 +4594,10 @@ async function getTransactionSummary(params) {
|
|
4826
4594
|
async function getTransactionSummaryFromRequest(params) {
|
4827
4595
|
const { provider, transactionRequest, abiMap } = params;
|
4828
4596
|
const { receipts } = await provider.call(transactionRequest);
|
4829
|
-
const { gasPerByte, gasPriceFactor, gasCosts
|
4597
|
+
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
4830
4598
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
4831
4599
|
const transaction = transactionRequest.toTransaction();
|
4832
4600
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
4833
|
-
const gasPrice = await provider.getLatestGasPrice();
|
4834
4601
|
const transactionSummary = assembleTransactionSummary({
|
4835
4602
|
receipts,
|
4836
4603
|
transaction,
|
@@ -4839,9 +4606,7 @@ async function getTransactionSummaryFromRequest(params) {
|
|
4839
4606
|
gasPerByte,
|
4840
4607
|
gasPriceFactor,
|
4841
4608
|
maxInputs,
|
4842
|
-
gasCosts
|
4843
|
-
maxGasPerTx,
|
4844
|
-
gasPrice
|
4609
|
+
gasCosts
|
4845
4610
|
});
|
4846
4611
|
return transactionSummary;
|
4847
4612
|
}
|
@@ -4850,18 +4615,13 @@ async function getTransactionsSummaries(params) {
|
|
4850
4615
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
4851
4616
|
const { edges, pageInfo } = transactionsByOwner;
|
4852
4617
|
const {
|
4853
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts
|
4618
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
4854
4619
|
} = provider.getChain();
|
4855
|
-
const gasPrice = await provider.getLatestGasPrice();
|
4856
4620
|
const transactions = edges.map((edge) => {
|
4857
4621
|
const { node: gqlTransaction } = edge;
|
4858
|
-
const { id, rawPayload, status } = gqlTransaction;
|
4622
|
+
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
4859
4623
|
const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
|
4860
|
-
|
4861
|
-
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
4862
|
-
txReceipts = gqlTransaction.status.receipts;
|
4863
|
-
}
|
4864
|
-
const receipts = txReceipts.map(processGqlReceipt);
|
4624
|
+
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
4865
4625
|
const transactionSummary = assembleTransactionSummary({
|
4866
4626
|
id,
|
4867
4627
|
receipts,
|
@@ -4872,9 +4632,7 @@ async function getTransactionsSummaries(params) {
|
|
4872
4632
|
gasPerByte,
|
4873
4633
|
gasPriceFactor,
|
4874
4634
|
maxInputs,
|
4875
|
-
gasCosts
|
4876
|
-
maxGasPerTx,
|
4877
|
-
gasPrice
|
4635
|
+
gasCosts
|
4878
4636
|
});
|
4879
4637
|
const output = {
|
4880
4638
|
gqlTransaction,
|
@@ -5206,33 +4964,36 @@ var Account = class extends AbstractAccount {
|
|
5206
4964
|
* @param fee - The estimated transaction fee.
|
5207
4965
|
* @returns A promise that resolves when the resources are added to the transaction.
|
5208
4966
|
*/
|
5209
|
-
async fund(request,
|
5210
|
-
const
|
5211
|
-
|
5212
|
-
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
5213
|
-
amount: bn18(fee),
|
4967
|
+
async fund(request, coinQuantities, fee) {
|
4968
|
+
const updatedQuantities = addAmountToAsset({
|
4969
|
+
amount: bn17(fee),
|
5214
4970
|
assetId: BaseAssetId3,
|
5215
|
-
coinQuantities
|
4971
|
+
coinQuantities
|
5216
4972
|
});
|
5217
4973
|
const quantitiesDict = {};
|
5218
|
-
|
4974
|
+
updatedQuantities.forEach(({ amount, assetId }) => {
|
5219
4975
|
quantitiesDict[assetId] = {
|
5220
4976
|
required: amount,
|
5221
|
-
owned:
|
4977
|
+
owned: bn17(0)
|
5222
4978
|
};
|
5223
4979
|
});
|
5224
|
-
|
4980
|
+
const cachedUtxos = [];
|
4981
|
+
const cachedMessages = [];
|
4982
|
+
const owner = this.address.toB256();
|
4983
|
+
request.inputs.forEach((input) => {
|
5225
4984
|
const isResource = "amount" in input;
|
5226
4985
|
if (isResource) {
|
5227
4986
|
const isCoin2 = "owner" in input;
|
5228
4987
|
if (isCoin2) {
|
5229
4988
|
const assetId = String(input.assetId);
|
5230
|
-
if (quantitiesDict[assetId]) {
|
5231
|
-
const amount =
|
4989
|
+
if (input.owner === owner && quantitiesDict[assetId]) {
|
4990
|
+
const amount = bn17(input.amount);
|
5232
4991
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
4992
|
+
cachedUtxos.push(input.id);
|
5233
4993
|
}
|
5234
|
-
} else if (input.amount && quantitiesDict[BaseAssetId3]) {
|
4994
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId3]) {
|
5235
4995
|
quantitiesDict[BaseAssetId3].owned = quantitiesDict[BaseAssetId3].owned.add(input.amount);
|
4996
|
+
cachedMessages.push(input.nonce);
|
5236
4997
|
}
|
5237
4998
|
}
|
5238
4999
|
});
|
@@ -5247,23 +5008,12 @@ var Account = class extends AbstractAccount {
|
|
5247
5008
|
});
|
5248
5009
|
const needsToBeFunded = missingQuantities.length;
|
5249
5010
|
if (needsToBeFunded) {
|
5250
|
-
const
|
5251
|
-
|
5252
|
-
|
5253
|
-
|
5254
|
-
|
5255
|
-
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
5256
|
-
const requestToBeReEstimate = clone4(txRequest);
|
5257
|
-
if (addedSignatures) {
|
5258
|
-
Array.from({ length: addedSignatures }).forEach(
|
5259
|
-
() => requestToBeReEstimate.addEmptyWitness()
|
5260
|
-
);
|
5011
|
+
const resources = await this.getResourcesToSpend(missingQuantities, {
|
5012
|
+
messages: cachedMessages,
|
5013
|
+
utxos: cachedUtxos
|
5014
|
+
});
|
5015
|
+
request.addResources(resources);
|
5261
5016
|
}
|
5262
|
-
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
5263
|
-
transactionRequest: requestToBeReEstimate
|
5264
|
-
});
|
5265
|
-
txRequest.maxFee = maxFee;
|
5266
|
-
return txRequest;
|
5267
5017
|
}
|
5268
5018
|
/**
|
5269
5019
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -5271,25 +5021,28 @@ var Account = class extends AbstractAccount {
|
|
5271
5021
|
* @param destination - The address of the destination.
|
5272
5022
|
* @param amount - The amount of coins to transfer.
|
5273
5023
|
* @param assetId - The asset ID of the coins to transfer.
|
5274
|
-
* @param txParams - The transaction parameters (gasLimit,
|
5024
|
+
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
5275
5025
|
* @returns A promise that resolves to the prepared transaction request.
|
5276
5026
|
*/
|
5277
5027
|
async createTransfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
|
5278
|
-
const
|
5028
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
5029
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
5030
|
+
const request = new ScriptTransactionRequest(params);
|
5279
5031
|
request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetId);
|
5280
|
-
const
|
5032
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
5281
5033
|
estimateTxDependencies: true,
|
5282
5034
|
resourcesOwner: this
|
5283
5035
|
});
|
5284
|
-
|
5285
|
-
|
5286
|
-
|
5287
|
-
|
5288
|
-
|
5289
|
-
|
5290
|
-
|
5291
|
-
|
5292
|
-
await this.fund(request,
|
5036
|
+
request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
|
5037
|
+
request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
|
5038
|
+
this.validateGas({
|
5039
|
+
gasUsed,
|
5040
|
+
gasPrice: request.gasPrice,
|
5041
|
+
gasLimit: request.gasLimit,
|
5042
|
+
minGasPrice
|
5043
|
+
});
|
5044
|
+
await this.fund(request, requiredQuantities, maxFee);
|
5045
|
+
request.updatePredicateInputs(estimatedInputs);
|
5293
5046
|
return request;
|
5294
5047
|
}
|
5295
5048
|
/**
|
@@ -5302,7 +5055,7 @@ var Account = class extends AbstractAccount {
|
|
5302
5055
|
* @returns A promise that resolves to the transaction response.
|
5303
5056
|
*/
|
5304
5057
|
async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
|
5305
|
-
if (
|
5058
|
+
if (bn17(amount).lte(0)) {
|
5306
5059
|
throw new FuelError15(
|
5307
5060
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5308
5061
|
"Transfer amount must be a positive number."
|
@@ -5321,37 +5074,38 @@ var Account = class extends AbstractAccount {
|
|
5321
5074
|
* @returns A promise that resolves to the transaction response.
|
5322
5075
|
*/
|
5323
5076
|
async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
|
5324
|
-
if (
|
5077
|
+
if (bn17(amount).lte(0)) {
|
5325
5078
|
throw new FuelError15(
|
5326
5079
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5327
5080
|
"Transfer amount must be a positive number."
|
5328
5081
|
);
|
5329
5082
|
}
|
5330
5083
|
const contractAddress = Address3.fromAddressOrString(contractId);
|
5084
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
5085
|
+
const params = { gasPrice: minGasPrice, ...txParams };
|
5331
5086
|
const { script, scriptData } = await assembleTransferToContractScript({
|
5332
5087
|
hexlifiedContractId: contractAddress.toB256(),
|
5333
|
-
amountToTransfer:
|
5088
|
+
amountToTransfer: bn17(amount),
|
5334
5089
|
assetId
|
5335
5090
|
});
|
5336
5091
|
const request = new ScriptTransactionRequest({
|
5337
|
-
...
|
5092
|
+
...params,
|
5338
5093
|
script,
|
5339
5094
|
scriptData
|
5340
5095
|
});
|
5341
5096
|
request.addContractInputAndOutput(contractAddress);
|
5342
|
-
const
|
5343
|
-
|
5344
|
-
|
5097
|
+
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
|
5098
|
+
request,
|
5099
|
+
[{ amount: bn17(amount), assetId: String(assetId) }]
|
5100
|
+
);
|
5101
|
+
request.gasLimit = bn17(params.gasLimit ?? gasUsed);
|
5102
|
+
this.validateGas({
|
5103
|
+
gasUsed,
|
5104
|
+
gasPrice: request.gasPrice,
|
5105
|
+
gasLimit: request.gasLimit,
|
5106
|
+
minGasPrice
|
5345
5107
|
});
|
5346
|
-
|
5347
|
-
this.validateGas({
|
5348
|
-
gasUsed: txCost.gasUsed,
|
5349
|
-
gasLimit: request.gasLimit
|
5350
|
-
});
|
5351
|
-
}
|
5352
|
-
request.gasLimit = txCost.gasUsed;
|
5353
|
-
request.maxFee = txCost.maxFee;
|
5354
|
-
await this.fund(request, txCost);
|
5108
|
+
await this.fund(request, requiredQuantities, maxFee);
|
5355
5109
|
return this.sendTransaction(request);
|
5356
5110
|
}
|
5357
5111
|
/**
|
@@ -5363,31 +5117,34 @@ var Account = class extends AbstractAccount {
|
|
5363
5117
|
* @returns A promise that resolves to the transaction response.
|
5364
5118
|
*/
|
5365
5119
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
5120
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
5366
5121
|
const recipientAddress = Address3.fromAddressOrString(recipient);
|
5367
5122
|
const recipientDataArray = arrayify14(
|
5368
5123
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5369
5124
|
);
|
5370
5125
|
const amountDataArray = arrayify14(
|
5371
|
-
"0x".concat(
|
5126
|
+
"0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
|
5372
5127
|
);
|
5373
5128
|
const script = new Uint8Array([
|
5374
5129
|
...arrayify14(withdrawScript.bytes),
|
5375
5130
|
...recipientDataArray,
|
5376
5131
|
...amountDataArray
|
5377
5132
|
]);
|
5378
|
-
const params = { script, ...txParams };
|
5133
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
5379
5134
|
const request = new ScriptTransactionRequest(params);
|
5380
|
-
const
|
5381
|
-
const
|
5382
|
-
|
5383
|
-
|
5384
|
-
|
5385
|
-
|
5386
|
-
|
5387
|
-
|
5388
|
-
|
5389
|
-
|
5390
|
-
|
5135
|
+
const forwardingQuantities = [{ amount: bn17(amount), assetId: BaseAssetId3 }];
|
5136
|
+
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
5137
|
+
request,
|
5138
|
+
forwardingQuantities
|
5139
|
+
);
|
5140
|
+
request.gasLimit = bn17(params.gasLimit ?? gasUsed);
|
5141
|
+
this.validateGas({
|
5142
|
+
gasUsed,
|
5143
|
+
gasPrice: request.gasPrice,
|
5144
|
+
gasLimit: request.gasLimit,
|
5145
|
+
minGasPrice
|
5146
|
+
});
|
5147
|
+
await this.fund(request, requiredQuantities, maxFee);
|
5391
5148
|
return this.sendTransaction(request);
|
5392
5149
|
}
|
5393
5150
|
async signMessage(message) {
|
@@ -5445,7 +5202,18 @@ var Account = class extends AbstractAccount {
|
|
5445
5202
|
}
|
5446
5203
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
5447
5204
|
}
|
5448
|
-
validateGas({
|
5205
|
+
validateGas({
|
5206
|
+
gasUsed,
|
5207
|
+
gasPrice,
|
5208
|
+
gasLimit,
|
5209
|
+
minGasPrice
|
5210
|
+
}) {
|
5211
|
+
if (minGasPrice.gt(gasPrice)) {
|
5212
|
+
throw new FuelError15(
|
5213
|
+
ErrorCode15.GAS_PRICE_TOO_LOW,
|
5214
|
+
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
5215
|
+
);
|
5216
|
+
}
|
5449
5217
|
if (gasUsed.gt(gasLimit)) {
|
5450
5218
|
throw new FuelError15(
|
5451
5219
|
ErrorCode15.GAS_LIMIT_TOO_LOW,
|
@@ -5741,7 +5509,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5741
5509
|
* @param transactionRequestLike - The transaction request to send.
|
5742
5510
|
* @returns A promise that resolves to the TransactionResponse object.
|
5743
5511
|
*/
|
5744
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
5512
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
5745
5513
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
5746
5514
|
if (estimateTxDependencies) {
|
5747
5515
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -5782,7 +5550,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
5782
5550
|
// src/hdwallet/hdwallet.ts
|
5783
5551
|
import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
|
5784
5552
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
5785
|
-
import { bn as
|
5553
|
+
import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
5786
5554
|
import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
|
5787
5555
|
import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
|
5788
5556
|
|
@@ -8254,7 +8022,7 @@ var HDWallet = class {
|
|
8254
8022
|
const IR = bytes.slice(32);
|
8255
8023
|
if (privateKey) {
|
8256
8024
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
8257
|
-
const ki =
|
8025
|
+
const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
|
8258
8026
|
return new HDWallet({
|
8259
8027
|
privateKey: ki,
|
8260
8028
|
chainCode: IR,
|
@@ -8943,7 +8711,7 @@ import {
|
|
8943
8711
|
import { Address as Address9 } from "@fuel-ts/address";
|
8944
8712
|
import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
|
8945
8713
|
import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
|
8946
|
-
import { ByteArrayCoder, InputType as
|
8714
|
+
import { ByteArrayCoder, InputType as InputType7 } from "@fuel-ts/transactions";
|
8947
8715
|
import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
|
8948
8716
|
|
8949
8717
|
// src/predicate/utils/getPredicateRoot.ts
|
@@ -9003,9 +8771,9 @@ var Predicate = class extends Account {
|
|
9003
8771
|
const request = transactionRequestify(transactionRequestLike);
|
9004
8772
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
9005
8773
|
request.inputs?.forEach((input) => {
|
9006
|
-
if (input.type ===
|
9007
|
-
input.predicate =
|
9008
|
-
input.predicateData =
|
8774
|
+
if (input.type === InputType7.Coin && hexlify19(input.owner) === this.address.toB256()) {
|
8775
|
+
input.predicate = this.bytes;
|
8776
|
+
input.predicateData = this.getPredicateData(policies.length);
|
9009
8777
|
}
|
9010
8778
|
});
|
9011
8779
|
return request;
|
@@ -9020,7 +8788,8 @@ var Predicate = class extends Account {
|
|
9020
8788
|
* @returns A promise that resolves to the prepared transaction request.
|
9021
8789
|
*/
|
9022
8790
|
async createTransfer(destination, amount, assetId = BaseAssetId4, txParams = {}) {
|
9023
|
-
|
8791
|
+
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
8792
|
+
return this.populateTransactionPredicateData(request);
|
9024
8793
|
}
|
9025
8794
|
/**
|
9026
8795
|
* Sends a transaction with the populated predicate data.
|
@@ -9028,9 +8797,9 @@ var Predicate = class extends Account {
|
|
9028
8797
|
* @param transactionRequestLike - The transaction request-like object.
|
9029
8798
|
* @returns A promise that resolves to the transaction response.
|
9030
8799
|
*/
|
9031
|
-
sendTransaction(transactionRequestLike) {
|
9032
|
-
const transactionRequest =
|
9033
|
-
return super.sendTransaction(transactionRequest,
|
8800
|
+
sendTransaction(transactionRequestLike, options) {
|
8801
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
8802
|
+
return super.sendTransaction(transactionRequest, options);
|
9034
8803
|
}
|
9035
8804
|
/**
|
9036
8805
|
* Simulates a transaction with the populated predicate data.
|
@@ -9039,8 +8808,8 @@ var Predicate = class extends Account {
|
|
9039
8808
|
* @returns A promise that resolves to the call result.
|
9040
8809
|
*/
|
9041
8810
|
simulateTransaction(transactionRequestLike) {
|
9042
|
-
const transactionRequest =
|
9043
|
-
return super.simulateTransaction(transactionRequest
|
8811
|
+
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
8812
|
+
return super.simulateTransaction(transactionRequest);
|
9044
8813
|
}
|
9045
8814
|
getPredicateData(policiesLength) {
|
9046
8815
|
if (!this.predicateData.length) {
|
@@ -9086,25 +8855,6 @@ var Predicate = class extends Account {
|
|
9086
8855
|
predicateInterface: abiInterface
|
9087
8856
|
};
|
9088
8857
|
}
|
9089
|
-
/**
|
9090
|
-
* Retrieves resources satisfying the spend query for the account.
|
9091
|
-
*
|
9092
|
-
* @param quantities - IDs of coins to exclude.
|
9093
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
9094
|
-
* @returns A promise that resolves to an array of Resources.
|
9095
|
-
*/
|
9096
|
-
async getResourcesToSpend(quantities, excludedIds) {
|
9097
|
-
const resources = await this.provider.getResourcesToSpend(
|
9098
|
-
this.address,
|
9099
|
-
quantities,
|
9100
|
-
excludedIds
|
9101
|
-
);
|
9102
|
-
return resources.map((resource) => ({
|
9103
|
-
...resource,
|
9104
|
-
predicate: hexlify19(this.bytes),
|
9105
|
-
paddPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
|
9106
|
-
}));
|
9107
|
-
}
|
9108
8858
|
/**
|
9109
8859
|
* Sets the configurable constants for the predicate.
|
9110
8860
|
*
|
@@ -9853,7 +9603,7 @@ export {
|
|
9853
9603
|
WalletLocked,
|
9854
9604
|
WalletManager,
|
9855
9605
|
WalletUnlocked,
|
9856
|
-
|
9606
|
+
addAmountToAsset,
|
9857
9607
|
addOperation,
|
9858
9608
|
assemblePanicError,
|
9859
9609
|
assembleReceiptByType,
|
@@ -9862,10 +9612,9 @@ export {
|
|
9862
9612
|
assets,
|
9863
9613
|
buildBlockExplorerUrl,
|
9864
9614
|
cacheFor,
|
9865
|
-
cacheTxInputsFromOwner,
|
9866
|
-
calculateGasFee,
|
9867
9615
|
calculateMetadataGasForTxCreate,
|
9868
9616
|
calculateMetadataGasForTxScript,
|
9617
|
+
calculatePriceWithFactor,
|
9869
9618
|
calculateTransactionFee,
|
9870
9619
|
coinQuantityfy,
|
9871
9620
|
deferPromise,
|