@fuel-ts/account 0.0.0-rc-2034-20240415163000 → 0.0.0-rc-2021-20240415193305
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 +5 -4
- 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 +795 -544
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +762 -507
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +642 -388
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +10 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +906 -324
- 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 +4 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/message.d.ts +7 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +37 -27
- 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 +8 -25
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +3 -0
- 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 +2 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +3 -2
- 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 +8 -2
- 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 +1545 -1056
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +740 -503
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +634 -397
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +17 -17
package/dist/index.mjs
CHANGED
@@ -32,8 +32,9 @@ 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 bn18 } from "@fuel-ts/math";
|
36
36
|
import { arrayify as arrayify14 } from "@fuel-ts/utils";
|
37
|
+
import { clone as clone4 } from "ramda";
|
37
38
|
|
38
39
|
// src/providers/coin-quantity.ts
|
39
40
|
import { BaseAssetId } from "@fuel-ts/address/configs";
|
@@ -59,7 +60,7 @@ var coinQuantityfy = (coinQuantityLike) => {
|
|
59
60
|
max: max2 ? bn(max2) : void 0
|
60
61
|
};
|
61
62
|
};
|
62
|
-
var
|
63
|
+
var addAmountToCoinQuantities = (params) => {
|
63
64
|
const { amount, assetId } = params;
|
64
65
|
const coinQuantities = [...params.coinQuantities];
|
65
66
|
const assetIdx = coinQuantities.findIndex((coinQuantity) => coinQuantity.assetId === assetId);
|
@@ -74,9 +75,9 @@ var addAmountToAsset = (params) => {
|
|
74
75
|
// src/providers/provider.ts
|
75
76
|
import { Address as Address2 } from "@fuel-ts/address";
|
76
77
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
77
|
-
import { BN, bn as
|
78
|
+
import { BN, bn as bn16 } from "@fuel-ts/math";
|
78
79
|
import {
|
79
|
-
InputType as
|
80
|
+
InputType as InputType7,
|
80
81
|
TransactionType as TransactionType8,
|
81
82
|
InputMessageCoder,
|
82
83
|
TransactionCoder as TransactionCoder5
|
@@ -92,14 +93,10 @@ import { clone as clone3 } from "ramda";
|
|
92
93
|
import gql from "graphql-tag";
|
93
94
|
var ReceiptFragmentFragmentDoc = gql`
|
94
95
|
fragment receiptFragment on Receipt {
|
95
|
-
|
96
|
-
id
|
97
|
-
}
|
96
|
+
id
|
98
97
|
pc
|
99
98
|
is
|
100
|
-
to
|
101
|
-
id
|
102
|
-
}
|
99
|
+
to
|
103
100
|
toAddress
|
104
101
|
amount
|
105
102
|
assetId
|
@@ -137,10 +134,16 @@ var TransactionStatusFragmentFragmentDoc = gql`
|
|
137
134
|
id
|
138
135
|
}
|
139
136
|
time
|
137
|
+
receipts {
|
138
|
+
...receiptFragment
|
139
|
+
}
|
140
140
|
programState {
|
141
141
|
returnType
|
142
142
|
data
|
143
143
|
}
|
144
|
+
receipts {
|
145
|
+
...receiptFragment
|
146
|
+
}
|
144
147
|
}
|
145
148
|
... on FailureStatus {
|
146
149
|
block {
|
@@ -148,26 +151,24 @@ var TransactionStatusFragmentFragmentDoc = gql`
|
|
148
151
|
}
|
149
152
|
time
|
150
153
|
reason
|
154
|
+
receipts {
|
155
|
+
...receiptFragment
|
156
|
+
}
|
151
157
|
}
|
152
158
|
... on SqueezedOutStatus {
|
153
159
|
reason
|
154
160
|
}
|
155
161
|
}
|
156
|
-
`;
|
162
|
+
${ReceiptFragmentFragmentDoc}`;
|
157
163
|
var TransactionFragmentFragmentDoc = gql`
|
158
164
|
fragment transactionFragment on Transaction {
|
159
165
|
id
|
160
166
|
rawPayload
|
161
|
-
gasPrice
|
162
|
-
receipts {
|
163
|
-
...receiptFragment
|
164
|
-
}
|
165
167
|
status {
|
166
168
|
...transactionStatusFragment
|
167
169
|
}
|
168
170
|
}
|
169
|
-
${
|
170
|
-
${TransactionStatusFragmentFragmentDoc}`;
|
171
|
+
${TransactionStatusFragmentFragmentDoc}`;
|
171
172
|
var InputEstimatePredicatesFragmentFragmentDoc = gql`
|
172
173
|
fragment inputEstimatePredicatesFragment on Input {
|
173
174
|
... on InputCoin {
|
@@ -185,6 +186,46 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
|
|
185
186
|
}
|
186
187
|
}
|
187
188
|
${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}`;
|
188
229
|
var CoinFragmentFragmentDoc = gql`
|
189
230
|
fragment coinFragment on Coin {
|
190
231
|
__typename
|
@@ -192,7 +233,6 @@ var CoinFragmentFragmentDoc = gql`
|
|
192
233
|
owner
|
193
234
|
amount
|
194
235
|
assetId
|
195
|
-
maturity
|
196
236
|
blockCreated
|
197
237
|
txCreatedIdx
|
198
238
|
}
|
@@ -231,26 +271,32 @@ var MessageProofFragmentFragmentDoc = gql`
|
|
231
271
|
messageBlockHeader {
|
232
272
|
id
|
233
273
|
daHeight
|
274
|
+
consensusParametersVersion
|
275
|
+
stateTransitionBytecodeVersion
|
234
276
|
transactionsCount
|
277
|
+
messageReceiptCount
|
235
278
|
transactionsRoot
|
279
|
+
messageOutboxRoot
|
280
|
+
eventInboxRoot
|
236
281
|
height
|
237
282
|
prevRoot
|
238
283
|
time
|
239
284
|
applicationHash
|
240
|
-
messageReceiptRoot
|
241
|
-
messageReceiptCount
|
242
285
|
}
|
243
286
|
commitBlockHeader {
|
244
287
|
id
|
245
288
|
daHeight
|
289
|
+
consensusParametersVersion
|
290
|
+
stateTransitionBytecodeVersion
|
246
291
|
transactionsCount
|
292
|
+
messageReceiptCount
|
247
293
|
transactionsRoot
|
294
|
+
messageOutboxRoot
|
295
|
+
eventInboxRoot
|
248
296
|
height
|
249
297
|
prevRoot
|
250
298
|
time
|
251
299
|
applicationHash
|
252
|
-
messageReceiptRoot
|
253
|
-
messageReceiptCount
|
254
300
|
}
|
255
301
|
sender
|
256
302
|
recipient
|
@@ -269,8 +315,8 @@ var BalanceFragmentFragmentDoc = gql`
|
|
269
315
|
var BlockFragmentFragmentDoc = gql`
|
270
316
|
fragment blockFragment on Block {
|
271
317
|
id
|
318
|
+
height
|
272
319
|
header {
|
273
|
-
height
|
274
320
|
time
|
275
321
|
}
|
276
322
|
transactions {
|
@@ -328,6 +374,11 @@ var DependentCostFragmentFragmentDoc = gql`
|
|
328
374
|
`;
|
329
375
|
var GasCostsFragmentFragmentDoc = gql`
|
330
376
|
fragment GasCostsFragment on GasCosts {
|
377
|
+
version {
|
378
|
+
... on Version {
|
379
|
+
value
|
380
|
+
}
|
381
|
+
}
|
331
382
|
add
|
332
383
|
addi
|
333
384
|
aloc
|
@@ -340,7 +391,6 @@ var GasCostsFragmentFragmentDoc = gql`
|
|
340
391
|
cb
|
341
392
|
cfei
|
342
393
|
cfsi
|
343
|
-
croo
|
344
394
|
div
|
345
395
|
divi
|
346
396
|
ecr1
|
@@ -423,6 +473,9 @@ var GasCostsFragmentFragmentDoc = gql`
|
|
423
473
|
ccp {
|
424
474
|
...DependentCostFragment
|
425
475
|
}
|
476
|
+
croo {
|
477
|
+
...DependentCostFragment
|
478
|
+
}
|
426
479
|
csiz {
|
427
480
|
...DependentCostFragment
|
428
481
|
}
|
@@ -482,6 +535,11 @@ var GasCostsFragmentFragmentDoc = gql`
|
|
482
535
|
${DependentCostFragmentFragmentDoc}`;
|
483
536
|
var ConsensusParametersFragmentFragmentDoc = gql`
|
484
537
|
fragment consensusParametersFragment on ConsensusParameters {
|
538
|
+
version {
|
539
|
+
... on Version {
|
540
|
+
value
|
541
|
+
}
|
542
|
+
}
|
485
543
|
txParams {
|
486
544
|
...TxParametersFragment
|
487
545
|
}
|
@@ -541,18 +599,9 @@ var NodeInfoFragmentFragmentDoc = gql`
|
|
541
599
|
fragment nodeInfoFragment on NodeInfo {
|
542
600
|
utxoValidation
|
543
601
|
vmBacktrace
|
544
|
-
minGasPrice
|
545
602
|
maxTx
|
546
603
|
maxDepth
|
547
604
|
nodeVersion
|
548
|
-
peers {
|
549
|
-
id
|
550
|
-
addresses
|
551
|
-
clientVersion
|
552
|
-
blockHeight
|
553
|
-
lastHeartbeatMs
|
554
|
-
appScore
|
555
|
-
}
|
556
605
|
}
|
557
606
|
`;
|
558
607
|
var GetVersionDocument = gql`
|
@@ -587,13 +636,9 @@ var GetTransactionWithReceiptsDocument = gql`
|
|
587
636
|
query getTransactionWithReceipts($transactionId: TransactionId!) {
|
588
637
|
transaction(id: $transactionId) {
|
589
638
|
...transactionFragment
|
590
|
-
receipts {
|
591
|
-
...receiptFragment
|
592
|
-
}
|
593
639
|
}
|
594
640
|
}
|
595
|
-
${TransactionFragmentFragmentDoc}
|
596
|
-
${ReceiptFragmentFragmentDoc}`;
|
641
|
+
${TransactionFragmentFragmentDoc}`;
|
597
642
|
var GetTransactionsDocument = gql`
|
598
643
|
query getTransactions($after: String, $before: String, $first: Int, $last: Int) {
|
599
644
|
transactions(after: $after, before: $before, first: $first, last: $last) {
|
@@ -721,6 +766,20 @@ var GetBalanceDocument = gql`
|
|
721
766
|
}
|
722
767
|
}
|
723
768
|
${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
|
+
`;
|
724
783
|
var GetBalancesDocument = gql`
|
725
784
|
query getBalances($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
726
785
|
balances(
|
@@ -775,12 +834,12 @@ var GetMessageStatusDocument = gql`
|
|
775
834
|
}
|
776
835
|
`;
|
777
836
|
var DryRunDocument = gql`
|
778
|
-
mutation dryRun($
|
779
|
-
dryRun(
|
780
|
-
...
|
837
|
+
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
838
|
+
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
839
|
+
...dryRunTransactionExecutionStatusFragment
|
781
840
|
}
|
782
841
|
}
|
783
|
-
${
|
842
|
+
${DryRunTransactionExecutionStatusFragmentFragmentDoc}`;
|
784
843
|
var SubmitDocument = gql`
|
785
844
|
mutation submit($encodedTransaction: HexString!) {
|
786
845
|
submit(tx: $encodedTransaction) {
|
@@ -863,6 +922,12 @@ function getSdk(requester) {
|
|
863
922
|
getBalance(variables, options) {
|
864
923
|
return requester(GetBalanceDocument, variables, options);
|
865
924
|
},
|
925
|
+
getLatestGasPrice(variables, options) {
|
926
|
+
return requester(GetLatestGasPriceDocument, variables, options);
|
927
|
+
},
|
928
|
+
estimateGasPrice(variables, options) {
|
929
|
+
return requester(EstimateGasPriceDocument, variables, options);
|
930
|
+
},
|
866
931
|
getBalances(variables, options) {
|
867
932
|
return requester(GetBalancesDocument, variables, options);
|
868
933
|
},
|
@@ -932,11 +997,14 @@ var _FuelGraphqlSubscriber = class {
|
|
932
997
|
let data;
|
933
998
|
let errors;
|
934
999
|
try {
|
935
|
-
|
1000
|
+
const sanitizedText = text.replace(/\s/g, "");
|
1001
|
+
({ data, errors } = JSON.parse(sanitizedText.replace(/^data:/, "")));
|
936
1002
|
} catch (e) {
|
937
1003
|
throw new FuelError(
|
938
1004
|
ErrorCode.STREAM_PARSING_ERROR,
|
939
|
-
`Error while parsing stream data response: ${text}
|
1005
|
+
`Error while parsing stream data response: ${text}
|
1006
|
+
|
1007
|
+
Thrown error: ${e}`
|
940
1008
|
);
|
941
1009
|
}
|
942
1010
|
if (Array.isArray(errors)) {
|
@@ -1047,10 +1115,9 @@ var inputify = (value) => {
|
|
1047
1115
|
txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
|
1048
1116
|
},
|
1049
1117
|
witnessIndex: value.witnessIndex,
|
1050
|
-
maturity: value.maturity ?? 0,
|
1051
1118
|
predicateGasUsed: bn2(value.predicateGasUsed),
|
1052
|
-
predicateLength: predicate.length,
|
1053
|
-
predicateDataLength: predicateData.length,
|
1119
|
+
predicateLength: bn2(predicate.length),
|
1120
|
+
predicateDataLength: bn2(predicateData.length),
|
1054
1121
|
predicate: hexlify3(predicate),
|
1055
1122
|
predicateData: hexlify3(predicateData)
|
1056
1123
|
};
|
@@ -1081,8 +1148,8 @@ var inputify = (value) => {
|
|
1081
1148
|
nonce: hexlify3(value.nonce),
|
1082
1149
|
witnessIndex: value.witnessIndex,
|
1083
1150
|
predicateGasUsed: bn2(value.predicateGasUsed),
|
1084
|
-
predicateLength: predicate.length,
|
1085
|
-
predicateDataLength: predicateData.length,
|
1151
|
+
predicateLength: bn2(predicate.length),
|
1152
|
+
predicateDataLength: bn2(predicateData.length),
|
1086
1153
|
predicate: hexlify3(predicate),
|
1087
1154
|
predicateData: hexlify3(predicateData),
|
1088
1155
|
data: hexlify3(data),
|
@@ -1212,8 +1279,8 @@ function assembleReceiptByType(receipt) {
|
|
1212
1279
|
case "CALL" /* Call */: {
|
1213
1280
|
const callReceipt = {
|
1214
1281
|
type: ReceiptType.Call,
|
1215
|
-
from: hexOrZero(receipt.
|
1216
|
-
to: hexOrZero(receipt?.to
|
1282
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
1283
|
+
to: hexOrZero(receipt?.to),
|
1217
1284
|
amount: bn4(receipt.amount),
|
1218
1285
|
assetId: hexOrZero(receipt.assetId),
|
1219
1286
|
gas: bn4(receipt.gas),
|
@@ -1227,7 +1294,7 @@ function assembleReceiptByType(receipt) {
|
|
1227
1294
|
case "RETURN" /* Return */: {
|
1228
1295
|
const returnReceipt = {
|
1229
1296
|
type: ReceiptType.Return,
|
1230
|
-
id: hexOrZero(receipt.
|
1297
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
1231
1298
|
val: bn4(receipt.val),
|
1232
1299
|
pc: bn4(receipt.pc),
|
1233
1300
|
is: bn4(receipt.is)
|
@@ -1237,7 +1304,7 @@ function assembleReceiptByType(receipt) {
|
|
1237
1304
|
case "RETURN_DATA" /* ReturnData */: {
|
1238
1305
|
const returnDataReceipt = {
|
1239
1306
|
type: ReceiptType.ReturnData,
|
1240
|
-
id: hexOrZero(receipt.
|
1307
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
1241
1308
|
ptr: bn4(receipt.ptr),
|
1242
1309
|
len: bn4(receipt.len),
|
1243
1310
|
digest: hexOrZero(receipt.digest),
|
@@ -1249,7 +1316,7 @@ function assembleReceiptByType(receipt) {
|
|
1249
1316
|
case "PANIC" /* Panic */: {
|
1250
1317
|
const panicReceipt = {
|
1251
1318
|
type: ReceiptType.Panic,
|
1252
|
-
id: hexOrZero(receipt.
|
1319
|
+
id: hexOrZero(receipt.id),
|
1253
1320
|
reason: bn4(receipt.reason),
|
1254
1321
|
pc: bn4(receipt.pc),
|
1255
1322
|
is: bn4(receipt.is),
|
@@ -1260,7 +1327,7 @@ function assembleReceiptByType(receipt) {
|
|
1260
1327
|
case "REVERT" /* Revert */: {
|
1261
1328
|
const revertReceipt = {
|
1262
1329
|
type: ReceiptType.Revert,
|
1263
|
-
id: hexOrZero(receipt.
|
1330
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
1264
1331
|
val: bn4(receipt.ra),
|
1265
1332
|
pc: bn4(receipt.pc),
|
1266
1333
|
is: bn4(receipt.is)
|
@@ -1270,7 +1337,7 @@ function assembleReceiptByType(receipt) {
|
|
1270
1337
|
case "LOG" /* Log */: {
|
1271
1338
|
const logReceipt = {
|
1272
1339
|
type: ReceiptType.Log,
|
1273
|
-
id: hexOrZero(receipt.
|
1340
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
1274
1341
|
val0: bn4(receipt.ra),
|
1275
1342
|
val1: bn4(receipt.rb),
|
1276
1343
|
val2: bn4(receipt.rc),
|
@@ -1283,7 +1350,7 @@ function assembleReceiptByType(receipt) {
|
|
1283
1350
|
case "LOG_DATA" /* LogData */: {
|
1284
1351
|
const logDataReceipt = {
|
1285
1352
|
type: ReceiptType.LogData,
|
1286
|
-
id: hexOrZero(receipt.
|
1353
|
+
id: hexOrZero(receipt.id || receipt.contractId),
|
1287
1354
|
val0: bn4(receipt.ra),
|
1288
1355
|
val1: bn4(receipt.rb),
|
1289
1356
|
ptr: bn4(receipt.ptr),
|
@@ -1297,8 +1364,8 @@ function assembleReceiptByType(receipt) {
|
|
1297
1364
|
case "TRANSFER" /* Transfer */: {
|
1298
1365
|
const transferReceipt = {
|
1299
1366
|
type: ReceiptType.Transfer,
|
1300
|
-
from: hexOrZero(receipt.
|
1301
|
-
to: hexOrZero(receipt.toAddress || receipt?.to
|
1367
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
1368
|
+
to: hexOrZero(receipt.toAddress || receipt?.to),
|
1302
1369
|
amount: bn4(receipt.amount),
|
1303
1370
|
assetId: hexOrZero(receipt.assetId),
|
1304
1371
|
pc: bn4(receipt.pc),
|
@@ -1309,8 +1376,8 @@ function assembleReceiptByType(receipt) {
|
|
1309
1376
|
case "TRANSFER_OUT" /* TransferOut */: {
|
1310
1377
|
const transferOutReceipt = {
|
1311
1378
|
type: ReceiptType.TransferOut,
|
1312
|
-
from: hexOrZero(receipt.
|
1313
|
-
to: hexOrZero(receipt.toAddress || receipt.to
|
1379
|
+
from: hexOrZero(receipt.id || receipt.contractId),
|
1380
|
+
to: hexOrZero(receipt.toAddress || receipt.to),
|
1314
1381
|
amount: bn4(receipt.amount),
|
1315
1382
|
assetId: hexOrZero(receipt.assetId),
|
1316
1383
|
pc: bn4(receipt.pc),
|
@@ -1353,7 +1420,7 @@ function assembleReceiptByType(receipt) {
|
|
1353
1420
|
return receiptMessageOut;
|
1354
1421
|
}
|
1355
1422
|
case "MINT" /* Mint */: {
|
1356
|
-
const contractId = hexOrZero(receipt.
|
1423
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
1357
1424
|
const subId = hexOrZero(receipt.subId);
|
1358
1425
|
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
1359
1426
|
const mintReceipt = {
|
@@ -1368,7 +1435,7 @@ function assembleReceiptByType(receipt) {
|
|
1368
1435
|
return mintReceipt;
|
1369
1436
|
}
|
1370
1437
|
case "BURN" /* Burn */: {
|
1371
|
-
const contractId = hexOrZero(receipt.
|
1438
|
+
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
1372
1439
|
const subId = hexOrZero(receipt.subId);
|
1373
1440
|
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
|
1374
1441
|
const burnReceipt = {
|
@@ -1453,7 +1520,6 @@ var buildBlockExplorerUrl = (options = {}) => {
|
|
1453
1520
|
import { bn as bn5 } from "@fuel-ts/math";
|
1454
1521
|
import { ReceiptType as ReceiptType2 } from "@fuel-ts/transactions";
|
1455
1522
|
import { arrayify as arrayify3 } from "@fuel-ts/utils";
|
1456
|
-
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => bn5(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
1457
1523
|
var getGasUsedFromReceipts = (receipts) => {
|
1458
1524
|
const scriptResult = receipts.filter(
|
1459
1525
|
(receipt) => receipt.type === ReceiptType2.ScriptResult
|
@@ -1474,18 +1540,28 @@ function resolveGasDependentCosts(byteSize, gasDependentCost) {
|
|
1474
1540
|
}
|
1475
1541
|
function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
1476
1542
|
const witnessCache = [];
|
1477
|
-
const
|
1543
|
+
const chargeableInputs = inputs.filter((input) => {
|
1544
|
+
const isCoinOrMessage = "owner" in input || "sender" in input;
|
1545
|
+
if (isCoinOrMessage) {
|
1546
|
+
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
1547
|
+
return true;
|
1548
|
+
}
|
1549
|
+
if (!witnessCache.includes(input.witnessIndex)) {
|
1550
|
+
witnessCache.push(input.witnessIndex);
|
1551
|
+
return true;
|
1552
|
+
}
|
1553
|
+
}
|
1554
|
+
return false;
|
1555
|
+
});
|
1556
|
+
const vmInitializationCost = resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization);
|
1557
|
+
const totalGas = chargeableInputs.reduce((total, input) => {
|
1478
1558
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
1479
1559
|
return total.add(
|
1480
|
-
|
1560
|
+
vmInitializationCost.add(resolveGasDependentCosts(arrayify3(input.predicate).length, gasCosts.contractRoot)).add(bn5(input.predicateGasUsed))
|
1481
1561
|
);
|
1482
1562
|
}
|
1483
|
-
|
1484
|
-
|
1485
|
-
return total.add(gasCosts.ecr1);
|
1486
|
-
}
|
1487
|
-
return total;
|
1488
|
-
}, bn5());
|
1563
|
+
return total.add(gasCosts.ecr1);
|
1564
|
+
}, bn5(0));
|
1489
1565
|
return totalGas;
|
1490
1566
|
}
|
1491
1567
|
function getMinGas(params) {
|
@@ -1497,12 +1573,20 @@ function getMinGas(params) {
|
|
1497
1573
|
return minGas;
|
1498
1574
|
}
|
1499
1575
|
function getMaxGas(params) {
|
1500
|
-
const {
|
1576
|
+
const {
|
1577
|
+
gasPerByte,
|
1578
|
+
witnessesLength,
|
1579
|
+
witnessLimit,
|
1580
|
+
minGas,
|
1581
|
+
gasLimit = bn5(0),
|
1582
|
+
maxGasPerTx
|
1583
|
+
} = params;
|
1501
1584
|
let remainingAllowedWitnessGas = bn5(0);
|
1502
1585
|
if (witnessLimit?.gt(0) && witnessLimit.gte(witnessesLength)) {
|
1503
1586
|
remainingAllowedWitnessGas = bn5(witnessLimit).sub(witnessesLength).mul(gasPerByte);
|
1504
1587
|
}
|
1505
|
-
|
1588
|
+
const maxGas = remainingAllowedWitnessGas.add(minGas).add(gasLimit);
|
1589
|
+
return maxGas.gte(maxGasPerTx) ? maxGasPerTx : maxGas;
|
1506
1590
|
}
|
1507
1591
|
function calculateMetadataGasForTxCreate({
|
1508
1592
|
gasCosts,
|
@@ -1524,6 +1608,10 @@ function calculateMetadataGasForTxScript({
|
|
1524
1608
|
}) {
|
1525
1609
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
1526
1610
|
}
|
1611
|
+
var calculateGasFee = (params) => {
|
1612
|
+
const { gas, gasPrice, priceFactor, tip } = params;
|
1613
|
+
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
1614
|
+
};
|
1527
1615
|
|
1528
1616
|
// src/providers/utils/json.ts
|
1529
1617
|
import { hexlify as hexlify5 } from "@fuel-ts/utils";
|
@@ -1680,7 +1768,7 @@ var witnessify = (value) => {
|
|
1680
1768
|
// src/providers/transaction-request/transaction-request.ts
|
1681
1769
|
var BaseTransactionRequest = class {
|
1682
1770
|
/** Gas price for transaction */
|
1683
|
-
|
1771
|
+
tip;
|
1684
1772
|
/** Block until which tx cannot be included */
|
1685
1773
|
maturity;
|
1686
1774
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
@@ -1699,7 +1787,7 @@ var BaseTransactionRequest = class {
|
|
1699
1787
|
* @param baseTransactionRequest - Optional object containing properties to initialize the transaction request.
|
1700
1788
|
*/
|
1701
1789
|
constructor({
|
1702
|
-
|
1790
|
+
tip,
|
1703
1791
|
maturity,
|
1704
1792
|
maxFee,
|
1705
1793
|
witnessLimit,
|
@@ -1707,7 +1795,7 @@ var BaseTransactionRequest = class {
|
|
1707
1795
|
outputs,
|
1708
1796
|
witnesses
|
1709
1797
|
} = {}) {
|
1710
|
-
this.
|
1798
|
+
this.tip = bn7(tip);
|
1711
1799
|
this.maturity = maturity ?? 0;
|
1712
1800
|
this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
|
1713
1801
|
this.maxFee = maxFee ? bn7(maxFee) : void 0;
|
@@ -1718,9 +1806,9 @@ var BaseTransactionRequest = class {
|
|
1718
1806
|
static getPolicyMeta(req) {
|
1719
1807
|
let policyTypes = 0;
|
1720
1808
|
const policies = [];
|
1721
|
-
if (req.
|
1722
|
-
policyTypes += PolicyType.
|
1723
|
-
policies.push({ data: req.
|
1809
|
+
if (req.tip) {
|
1810
|
+
policyTypes += PolicyType.Tip;
|
1811
|
+
policies.push({ data: req.tip, type: PolicyType.Tip });
|
1724
1812
|
}
|
1725
1813
|
if (req.witnessLimit) {
|
1726
1814
|
policyTypes += PolicyType.WitnessLimit;
|
@@ -1907,10 +1995,10 @@ var BaseTransactionRequest = class {
|
|
1907
1995
|
* @param predicate - Predicate bytes.
|
1908
1996
|
* @param predicateData - Predicate data bytes.
|
1909
1997
|
*/
|
1910
|
-
addCoinInput(coin
|
1998
|
+
addCoinInput(coin) {
|
1911
1999
|
const { assetId, owner, amount } = coin;
|
1912
2000
|
let witnessIndex;
|
1913
|
-
if (predicate) {
|
2001
|
+
if (coin.predicate) {
|
1914
2002
|
witnessIndex = 0;
|
1915
2003
|
} else {
|
1916
2004
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
|
@@ -1925,8 +2013,7 @@ var BaseTransactionRequest = class {
|
|
1925
2013
|
amount,
|
1926
2014
|
assetId,
|
1927
2015
|
txPointer: "0x00000000000000000000000000000000",
|
1928
|
-
witnessIndex
|
1929
|
-
predicate: predicate?.bytes
|
2016
|
+
witnessIndex
|
1930
2017
|
};
|
1931
2018
|
this.pushInput(input);
|
1932
2019
|
this.addChangeOutput(owner, assetId);
|
@@ -1939,11 +2026,11 @@ var BaseTransactionRequest = class {
|
|
1939
2026
|
* @param predicate - Predicate bytes.
|
1940
2027
|
* @param predicateData - Predicate data bytes.
|
1941
2028
|
*/
|
1942
|
-
addMessageInput(message
|
2029
|
+
addMessageInput(message) {
|
1943
2030
|
const { recipient, sender, amount } = message;
|
1944
2031
|
const assetId = BaseAssetId2;
|
1945
2032
|
let witnessIndex;
|
1946
|
-
if (predicate) {
|
2033
|
+
if (message.predicate) {
|
1947
2034
|
witnessIndex = 0;
|
1948
2035
|
} else {
|
1949
2036
|
witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
|
@@ -1957,8 +2044,7 @@ var BaseTransactionRequest = class {
|
|
1957
2044
|
sender: sender.toB256(),
|
1958
2045
|
recipient: recipient.toB256(),
|
1959
2046
|
amount,
|
1960
|
-
witnessIndex
|
1961
|
-
predicate: predicate?.bytes
|
2047
|
+
witnessIndex
|
1962
2048
|
};
|
1963
2049
|
this.pushInput(input);
|
1964
2050
|
this.addChangeOutput(recipient, assetId);
|
@@ -1989,32 +2075,6 @@ var BaseTransactionRequest = class {
|
|
1989
2075
|
resources.forEach((resource) => this.addResource(resource));
|
1990
2076
|
return this;
|
1991
2077
|
}
|
1992
|
-
/**
|
1993
|
-
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
1994
|
-
* outputs from the related assetIds.
|
1995
|
-
*
|
1996
|
-
* @param resources - The resources to add.
|
1997
|
-
* @returns This transaction.
|
1998
|
-
*/
|
1999
|
-
addPredicateResource(resource, predicate) {
|
2000
|
-
if (isCoin(resource)) {
|
2001
|
-
this.addCoinInput(resource, predicate);
|
2002
|
-
} else {
|
2003
|
-
this.addMessageInput(resource, predicate);
|
2004
|
-
}
|
2005
|
-
return this;
|
2006
|
-
}
|
2007
|
-
/**
|
2008
|
-
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
2009
|
-
* from the related assetIds.
|
2010
|
-
*
|
2011
|
-
* @param resources - The resources to add.
|
2012
|
-
* @returns This transaction.
|
2013
|
-
*/
|
2014
|
-
addPredicateResources(resources, predicate) {
|
2015
|
-
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
2016
|
-
return this;
|
2017
|
-
}
|
2018
2078
|
/**
|
2019
2079
|
* Adds a coin output to the transaction.
|
2020
2080
|
*
|
@@ -2094,7 +2154,7 @@ var BaseTransactionRequest = class {
|
|
2094
2154
|
}
|
2095
2155
|
calculateMaxGas(chainInfo, minGas) {
|
2096
2156
|
const { consensusParameters } = chainInfo;
|
2097
|
-
const { gasPerByte } = consensusParameters;
|
2157
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
2098
2158
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2099
2159
|
(acc, wit) => acc + wit.dataLength,
|
2100
2160
|
0
|
@@ -2103,7 +2163,8 @@ var BaseTransactionRequest = class {
|
|
2103
2163
|
gasPerByte,
|
2104
2164
|
minGas,
|
2105
2165
|
witnessesLength,
|
2106
|
-
witnessLimit: this.witnessLimit
|
2166
|
+
witnessLimit: this.witnessLimit,
|
2167
|
+
maxGasPerTx
|
2107
2168
|
});
|
2108
2169
|
}
|
2109
2170
|
/**
|
@@ -2121,17 +2182,20 @@ var BaseTransactionRequest = class {
|
|
2121
2182
|
});
|
2122
2183
|
const updateAssetInput = (assetId, quantity) => {
|
2123
2184
|
const assetInput = findAssetInput(assetId);
|
2185
|
+
let usedQuantity = quantity;
|
2186
|
+
if (assetId === BaseAssetId2) {
|
2187
|
+
usedQuantity = bn7("1000000000000000000");
|
2188
|
+
}
|
2124
2189
|
if (assetInput && "assetId" in assetInput) {
|
2125
2190
|
assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
|
2126
|
-
assetInput.amount =
|
2191
|
+
assetInput.amount = usedQuantity;
|
2127
2192
|
} else {
|
2128
2193
|
this.addResources([
|
2129
2194
|
{
|
2130
2195
|
id: hexlify7(randomBytes(UTXO_ID_LEN2)),
|
2131
|
-
amount:
|
2196
|
+
amount: usedQuantity,
|
2132
2197
|
assetId,
|
2133
2198
|
owner: resourcesOwner || Address.fromRandom(),
|
2134
|
-
maturity: 0,
|
2135
2199
|
blockCreated: bn7(1),
|
2136
2200
|
txCreatedIdx: bn7(1)
|
2137
2201
|
}
|
@@ -2163,7 +2227,7 @@ var BaseTransactionRequest = class {
|
|
2163
2227
|
toJSON() {
|
2164
2228
|
return normalizeJSON(this);
|
2165
2229
|
}
|
2166
|
-
|
2230
|
+
updatePredicateGasUsed(inputs) {
|
2167
2231
|
this.inputs.forEach((i) => {
|
2168
2232
|
let correspondingInput;
|
2169
2233
|
switch (i.type) {
|
@@ -2185,6 +2249,15 @@ var BaseTransactionRequest = class {
|
|
2185
2249
|
}
|
2186
2250
|
});
|
2187
2251
|
}
|
2252
|
+
shiftPredicateData() {
|
2253
|
+
this.inputs.forEach((input) => {
|
2254
|
+
if ("predicateData" in input && "paddPredicateData" in input && typeof input.paddPredicateData === "function") {
|
2255
|
+
input.predicateData = input.paddPredicateData(
|
2256
|
+
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
2257
|
+
);
|
2258
|
+
}
|
2259
|
+
});
|
2260
|
+
}
|
2188
2261
|
};
|
2189
2262
|
|
2190
2263
|
// src/providers/transaction-request/create-transaction-request.ts
|
@@ -2331,9 +2404,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2331
2404
|
return {
|
2332
2405
|
type: TransactionType3.Create,
|
2333
2406
|
...baseTransaction,
|
2334
|
-
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
2335
2407
|
bytecodeWitnessIndex,
|
2336
|
-
storageSlotsCount: storageSlots.length,
|
2408
|
+
storageSlotsCount: bn9(storageSlots.length),
|
2337
2409
|
salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
|
2338
2410
|
storageSlots
|
2339
2411
|
};
|
@@ -2456,8 +2528,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2456
2528
|
type: TransactionType4.Script,
|
2457
2529
|
scriptGasLimit: this.gasLimit,
|
2458
2530
|
...super.getBaseTransaction(),
|
2459
|
-
scriptLength: script.length,
|
2460
|
-
scriptDataLength: scriptData.length,
|
2531
|
+
scriptLength: bn10(script.length),
|
2532
|
+
scriptDataLength: bn10(scriptData.length),
|
2461
2533
|
receiptsRoot: ZeroBytes327,
|
2462
2534
|
script: hexlify10(script),
|
2463
2535
|
scriptData: hexlify10(scriptData)
|
@@ -2521,7 +2593,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2521
2593
|
}
|
2522
2594
|
calculateMaxGas(chainInfo, minGas) {
|
2523
2595
|
const { consensusParameters } = chainInfo;
|
2524
|
-
const { gasPerByte } = consensusParameters;
|
2596
|
+
const { gasPerByte, maxGasPerTx } = consensusParameters;
|
2525
2597
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2526
2598
|
(acc, wit) => acc + wit.dataLength,
|
2527
2599
|
0
|
@@ -2531,7 +2603,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2531
2603
|
minGas,
|
2532
2604
|
witnessesLength,
|
2533
2605
|
witnessLimit: this.witnessLimit,
|
2534
|
-
gasLimit: this.gasLimit
|
2606
|
+
gasLimit: this.gasLimit,
|
2607
|
+
maxGasPerTx
|
2535
2608
|
});
|
2536
2609
|
}
|
2537
2610
|
/**
|
@@ -2588,7 +2661,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2588
2661
|
|
2589
2662
|
// src/providers/transaction-request/utils.ts
|
2590
2663
|
import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
|
2591
|
-
import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
|
2664
|
+
import { TransactionType as TransactionType5, InputType as InputType5 } from "@fuel-ts/transactions";
|
2592
2665
|
var transactionRequestify = (obj) => {
|
2593
2666
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
|
2594
2667
|
return obj;
|
@@ -2606,14 +2679,31 @@ var transactionRequestify = (obj) => {
|
|
2606
2679
|
}
|
2607
2680
|
}
|
2608
2681
|
};
|
2682
|
+
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
2683
|
+
(acc, input) => {
|
2684
|
+
if (input.type === InputType5.Coin && input.owner === owner) {
|
2685
|
+
acc.utxos.push(input.id);
|
2686
|
+
}
|
2687
|
+
if (input.type === InputType5.Message && input.recipient === owner) {
|
2688
|
+
acc.messages.push(input.nonce);
|
2689
|
+
}
|
2690
|
+
return acc;
|
2691
|
+
},
|
2692
|
+
{
|
2693
|
+
utxos: [],
|
2694
|
+
messages: []
|
2695
|
+
}
|
2696
|
+
);
|
2609
2697
|
|
2610
2698
|
// src/providers/transaction-response/transaction-response.ts
|
2611
2699
|
import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
|
2612
|
-
import { bn as
|
2700
|
+
import { bn as bn15 } from "@fuel-ts/math";
|
2613
2701
|
import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
|
2614
2702
|
import { arrayify as arrayify10 } from "@fuel-ts/utils";
|
2615
2703
|
|
2616
2704
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2705
|
+
import { bn as bn14 } from "@fuel-ts/math";
|
2706
|
+
import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
|
2617
2707
|
import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
|
2618
2708
|
|
2619
2709
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
@@ -2622,9 +2712,10 @@ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, Trans
|
|
2622
2712
|
import { arrayify as arrayify9 } from "@fuel-ts/utils";
|
2623
2713
|
var calculateTransactionFee = (params) => {
|
2624
2714
|
const {
|
2625
|
-
|
2715
|
+
gasPrice,
|
2626
2716
|
rawPayload,
|
2627
|
-
|
2717
|
+
tip,
|
2718
|
+
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
2628
2719
|
} = params;
|
2629
2720
|
const gasPerByte = bn11(feeParams.gasPerByte);
|
2630
2721
|
const gasPriceFactor = bn11(feeParams.gasPriceFactor);
|
@@ -2634,8 +2725,7 @@ var calculateTransactionFee = (params) => {
|
|
2634
2725
|
return {
|
2635
2726
|
fee: bn11(0),
|
2636
2727
|
minFee: bn11(0),
|
2637
|
-
maxFee: bn11(0)
|
2638
|
-
feeFromGasUsed: bn11(0)
|
2728
|
+
maxFee: bn11(0)
|
2639
2729
|
};
|
2640
2730
|
}
|
2641
2731
|
const { type, witnesses, inputs, policies } = transaction;
|
@@ -2667,7 +2757,6 @@ var calculateTransactionFee = (params) => {
|
|
2667
2757
|
metadataGas,
|
2668
2758
|
txBytesSize: transactionBytes.length
|
2669
2759
|
});
|
2670
|
-
const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
|
2671
2760
|
const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
|
2672
2761
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
2673
2762
|
const maxGas = getMaxGas({
|
@@ -2675,17 +2764,25 @@ var calculateTransactionFee = (params) => {
|
|
2675
2764
|
minGas,
|
2676
2765
|
witnessesLength,
|
2677
2766
|
gasLimit,
|
2678
|
-
witnessLimit
|
2767
|
+
witnessLimit,
|
2768
|
+
maxGasPerTx
|
2769
|
+
});
|
2770
|
+
const minFee = calculateGasFee({
|
2771
|
+
gasPrice,
|
2772
|
+
gas: minGas,
|
2773
|
+
priceFactor: gasPriceFactor,
|
2774
|
+
tip
|
2775
|
+
});
|
2776
|
+
const maxFee = calculateGasFee({
|
2777
|
+
gasPrice,
|
2778
|
+
gas: maxGas,
|
2779
|
+
priceFactor: gasPriceFactor,
|
2780
|
+
tip
|
2679
2781
|
});
|
2680
|
-
const feeFromGasUsed = calculatePriceWithFactor(gasUsed, gasPrice, gasPriceFactor);
|
2681
|
-
const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor);
|
2682
|
-
const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor);
|
2683
|
-
const fee = minFee.add(feeFromGasUsed);
|
2684
2782
|
return {
|
2685
|
-
fee,
|
2686
2783
|
minFee,
|
2687
2784
|
maxFee,
|
2688
|
-
|
2785
|
+
fee: maxFee
|
2689
2786
|
};
|
2690
2787
|
};
|
2691
2788
|
|
@@ -2741,7 +2838,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
|
2741
2838
|
|
2742
2839
|
// src/providers/transaction-summary/input.ts
|
2743
2840
|
import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
|
2744
|
-
import { InputType as
|
2841
|
+
import { InputType as InputType6 } from "@fuel-ts/transactions";
|
2745
2842
|
function getInputsByTypes(inputs, types) {
|
2746
2843
|
return inputs.filter((i) => types.includes(i.type));
|
2747
2844
|
}
|
@@ -2749,16 +2846,16 @@ function getInputsByType(inputs, type) {
|
|
2749
2846
|
return inputs.filter((i) => i.type === type);
|
2750
2847
|
}
|
2751
2848
|
function getInputsCoin(inputs) {
|
2752
|
-
return getInputsByType(inputs,
|
2849
|
+
return getInputsByType(inputs, InputType6.Coin);
|
2753
2850
|
}
|
2754
2851
|
function getInputsMessage(inputs) {
|
2755
|
-
return getInputsByType(inputs,
|
2852
|
+
return getInputsByType(inputs, InputType6.Message);
|
2756
2853
|
}
|
2757
2854
|
function getInputsCoinAndMessage(inputs) {
|
2758
|
-
return getInputsByTypes(inputs, [
|
2855
|
+
return getInputsByTypes(inputs, [InputType6.Coin, InputType6.Message]);
|
2759
2856
|
}
|
2760
2857
|
function getInputsContract(inputs) {
|
2761
|
-
return getInputsByType(inputs,
|
2858
|
+
return getInputsByType(inputs, InputType6.Contract);
|
2762
2859
|
}
|
2763
2860
|
function getInputFromAssetId(inputs, assetId) {
|
2764
2861
|
const coinInputs = getInputsCoin(inputs);
|
@@ -2777,7 +2874,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2777
2874
|
if (!contractInput) {
|
2778
2875
|
return void 0;
|
2779
2876
|
}
|
2780
|
-
if (contractInput.type !==
|
2877
|
+
if (contractInput.type !== InputType6.Contract) {
|
2781
2878
|
throw new FuelError9(
|
2782
2879
|
ErrorCode9.INVALID_TRANSACTION_INPUT,
|
2783
2880
|
`Contract input should be of type 'contract'.`
|
@@ -2786,10 +2883,10 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2786
2883
|
return contractInput;
|
2787
2884
|
}
|
2788
2885
|
function getInputAccountAddress(input) {
|
2789
|
-
if (input.type ===
|
2886
|
+
if (input.type === InputType6.Coin) {
|
2790
2887
|
return input.owner.toString();
|
2791
2888
|
}
|
2792
|
-
if (input.type ===
|
2889
|
+
if (input.type === InputType6.Message) {
|
2793
2890
|
return input.recipient.toString();
|
2794
2891
|
}
|
2795
2892
|
return "";
|
@@ -3299,7 +3396,9 @@ function assembleTransactionSummary(params) {
|
|
3299
3396
|
gqlTransactionStatus,
|
3300
3397
|
abiMap = {},
|
3301
3398
|
maxInputs,
|
3302
|
-
gasCosts
|
3399
|
+
gasCosts,
|
3400
|
+
maxGasPerTx,
|
3401
|
+
gasPrice
|
3303
3402
|
} = params;
|
3304
3403
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
3305
3404
|
const rawPayload = hexlify11(transactionBytes);
|
@@ -3313,11 +3412,14 @@ function assembleTransactionSummary(params) {
|
|
3313
3412
|
maxInputs
|
3314
3413
|
});
|
3315
3414
|
const typeName = getTransactionTypeName(transaction.type);
|
3415
|
+
const tip = bn14(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
|
3316
3416
|
const { fee } = calculateTransactionFee({
|
3317
|
-
|
3417
|
+
gasPrice,
|
3318
3418
|
rawPayload,
|
3419
|
+
tip,
|
3319
3420
|
consensusParameters: {
|
3320
3421
|
gasCosts,
|
3422
|
+
maxGasPerTx,
|
3321
3423
|
feeParams: {
|
3322
3424
|
gasPerByte,
|
3323
3425
|
gasPriceFactor
|
@@ -3377,7 +3479,7 @@ var TransactionResponse = class {
|
|
3377
3479
|
/** Current provider */
|
3378
3480
|
provider;
|
3379
3481
|
/** Gas used on the transaction */
|
3380
|
-
gasUsed =
|
3482
|
+
gasUsed = bn15(0);
|
3381
3483
|
/** The graphql Transaction with receipts object. */
|
3382
3484
|
gqlTransaction;
|
3383
3485
|
abis;
|
@@ -3455,8 +3557,13 @@ var TransactionResponse = class {
|
|
3455
3557
|
const decodedTransaction = this.decodeTransaction(
|
3456
3558
|
transaction
|
3457
3559
|
);
|
3458
|
-
|
3459
|
-
|
3560
|
+
let txReceipts = [];
|
3561
|
+
if (transaction?.status && "receipts" in transaction.status) {
|
3562
|
+
txReceipts = transaction.status.receipts;
|
3563
|
+
}
|
3564
|
+
const receipts = txReceipts.map(processGqlReceipt) || [];
|
3565
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
3566
|
+
const gasPrice = await this.provider.getLatestGasPrice();
|
3460
3567
|
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
3461
3568
|
const transactionSummary = assembleTransactionSummary({
|
3462
3569
|
id: this.id,
|
@@ -3468,7 +3575,9 @@ var TransactionResponse = class {
|
|
3468
3575
|
gasPriceFactor,
|
3469
3576
|
abiMap: contractsAbiMap,
|
3470
3577
|
maxInputs,
|
3471
|
-
gasCosts
|
3578
|
+
gasCosts,
|
3579
|
+
maxGasPerTx,
|
3580
|
+
gasPrice
|
3472
3581
|
});
|
3473
3582
|
return transactionSummary;
|
3474
3583
|
}
|
@@ -3595,29 +3704,29 @@ var processGqlChain = (chain) => {
|
|
3595
3704
|
const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
|
3596
3705
|
return {
|
3597
3706
|
name,
|
3598
|
-
baseChainHeight:
|
3707
|
+
baseChainHeight: bn16(daHeight),
|
3599
3708
|
consensusParameters: {
|
3600
|
-
contractMaxSize:
|
3601
|
-
maxInputs:
|
3602
|
-
maxOutputs:
|
3603
|
-
maxWitnesses:
|
3604
|
-
maxGasPerTx:
|
3605
|
-
maxScriptLength:
|
3606
|
-
maxScriptDataLength:
|
3607
|
-
maxStorageSlots:
|
3608
|
-
maxPredicateLength:
|
3609
|
-
maxPredicateDataLength:
|
3610
|
-
maxGasPerPredicate:
|
3611
|
-
gasPriceFactor:
|
3612
|
-
gasPerByte:
|
3613
|
-
maxMessageDataLength:
|
3614
|
-
chainId:
|
3709
|
+
contractMaxSize: bn16(contractParams.contractMaxSize),
|
3710
|
+
maxInputs: bn16(txParams.maxInputs),
|
3711
|
+
maxOutputs: bn16(txParams.maxOutputs),
|
3712
|
+
maxWitnesses: bn16(txParams.maxWitnesses),
|
3713
|
+
maxGasPerTx: bn16(txParams.maxGasPerTx),
|
3714
|
+
maxScriptLength: bn16(scriptParams.maxScriptLength),
|
3715
|
+
maxScriptDataLength: bn16(scriptParams.maxScriptDataLength),
|
3716
|
+
maxStorageSlots: bn16(contractParams.maxStorageSlots),
|
3717
|
+
maxPredicateLength: bn16(predicateParams.maxPredicateLength),
|
3718
|
+
maxPredicateDataLength: bn16(predicateParams.maxPredicateDataLength),
|
3719
|
+
maxGasPerPredicate: bn16(predicateParams.maxGasPerPredicate),
|
3720
|
+
gasPriceFactor: bn16(feeParams.gasPriceFactor),
|
3721
|
+
gasPerByte: bn16(feeParams.gasPerByte),
|
3722
|
+
maxMessageDataLength: bn16(predicateParams.maxMessageDataLength),
|
3723
|
+
chainId: bn16(consensusParameters.chainId),
|
3615
3724
|
gasCosts
|
3616
3725
|
},
|
3617
3726
|
gasCosts,
|
3618
3727
|
latestBlock: {
|
3619
3728
|
id: latestBlock.id,
|
3620
|
-
height:
|
3729
|
+
height: bn16(latestBlock.height),
|
3621
3730
|
time: latestBlock.header.time,
|
3622
3731
|
transactions: latestBlock.transactions.map((i) => ({
|
3623
3732
|
id: i.id
|
@@ -3711,10 +3820,8 @@ var _Provider = class {
|
|
3711
3820
|
* Returns some helpful parameters related to gas fees.
|
3712
3821
|
*/
|
3713
3822
|
getGasConfig() {
|
3714
|
-
const { minGasPrice } = this.getNode();
|
3715
3823
|
const { maxGasPerTx, maxGasPerPredicate, gasPriceFactor, gasPerByte, gasCosts } = this.getChain().consensusParameters;
|
3716
3824
|
return {
|
3717
|
-
minGasPrice,
|
3718
3825
|
maxGasPerTx,
|
3719
3826
|
maxGasPerPredicate,
|
3720
3827
|
gasPriceFactor,
|
@@ -3812,7 +3919,7 @@ var _Provider = class {
|
|
3812
3919
|
*/
|
3813
3920
|
async getBlockNumber() {
|
3814
3921
|
const { chain } = await this.operations.getChain();
|
3815
|
-
return
|
3922
|
+
return bn16(chain.latestBlock.height, 10);
|
3816
3923
|
}
|
3817
3924
|
/**
|
3818
3925
|
* Returns the chain information.
|
@@ -3822,13 +3929,11 @@ var _Provider = class {
|
|
3822
3929
|
async fetchNode() {
|
3823
3930
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
3824
3931
|
const processedNodeInfo = {
|
3825
|
-
maxDepth:
|
3826
|
-
maxTx:
|
3827
|
-
minGasPrice: bn15(nodeInfo.minGasPrice),
|
3932
|
+
maxDepth: bn16(nodeInfo.maxDepth),
|
3933
|
+
maxTx: bn16(nodeInfo.maxTx),
|
3828
3934
|
nodeVersion: nodeInfo.nodeVersion,
|
3829
3935
|
utxoValidation: nodeInfo.utxoValidation,
|
3830
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
3831
|
-
peers: nodeInfo.peers
|
3936
|
+
vmBacktrace: nodeInfo.vmBacktrace
|
3832
3937
|
};
|
3833
3938
|
_Provider.nodeInfoCache[this.url] = processedNodeInfo;
|
3834
3939
|
return processedNodeInfo;
|
@@ -3914,14 +4019,13 @@ var _Provider = class {
|
|
3914
4019
|
return this.estimateTxDependencies(transactionRequest);
|
3915
4020
|
}
|
3916
4021
|
const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
|
3917
|
-
const { dryRun:
|
3918
|
-
encodedTransaction,
|
4022
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
4023
|
+
encodedTransactions: encodedTransaction,
|
3919
4024
|
utxoValidation: utxoValidation || false
|
3920
4025
|
});
|
3921
|
-
const receipts =
|
3922
|
-
|
3923
|
-
|
3924
|
-
};
|
4026
|
+
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
4027
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
4028
|
+
return { receipts, dryrunStatus: status };
|
3925
4029
|
}
|
3926
4030
|
/**
|
3927
4031
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -3947,7 +4051,7 @@ var _Provider = class {
|
|
3947
4051
|
} = response;
|
3948
4052
|
if (inputs) {
|
3949
4053
|
inputs.forEach((input, index) => {
|
3950
|
-
if ("predicateGasUsed" in input &&
|
4054
|
+
if ("predicateGasUsed" in input && bn16(input.predicateGasUsed).gt(0)) {
|
3951
4055
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
3952
4056
|
}
|
3953
4057
|
});
|
@@ -3960,9 +4064,6 @@ var _Provider = class {
|
|
3960
4064
|
* If there are missing variable outputs,
|
3961
4065
|
* `addVariableOutputs` is called on the transaction.
|
3962
4066
|
*
|
3963
|
-
* @privateRemarks
|
3964
|
-
* TODO: Investigate support for missing contract IDs
|
3965
|
-
* TODO: Add support for missing output messages
|
3966
4067
|
*
|
3967
4068
|
* @param transactionRequest - The transaction request object.
|
3968
4069
|
* @returns A promise.
|
@@ -3975,16 +4076,19 @@ var _Provider = class {
|
|
3975
4076
|
missingContractIds: []
|
3976
4077
|
};
|
3977
4078
|
}
|
3978
|
-
await this.estimatePredicates(transactionRequest);
|
3979
4079
|
let receipts = [];
|
3980
4080
|
const missingContractIds = [];
|
3981
4081
|
let outputVariables = 0;
|
4082
|
+
let dryrunStatus;
|
3982
4083
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
3983
|
-
const {
|
3984
|
-
|
4084
|
+
const {
|
4085
|
+
dryRun: [{ receipts: rawReceipts, status }]
|
4086
|
+
} = await this.operations.dryRun({
|
4087
|
+
encodedTransactions: [hexlify12(transactionRequest.toTransactionBytes())],
|
3985
4088
|
utxoValidation: false
|
3986
4089
|
});
|
3987
|
-
receipts =
|
4090
|
+
receipts = rawReceipts.map(processGqlReceipt);
|
4091
|
+
dryrunStatus = status;
|
3988
4092
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
3989
4093
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
3990
4094
|
if (hasMissingOutputs) {
|
@@ -3994,6 +4098,10 @@ var _Provider = class {
|
|
3994
4098
|
transactionRequest.addContractInputAndOutput(Address2.fromString(contractId));
|
3995
4099
|
missingContractIds.push(contractId);
|
3996
4100
|
});
|
4101
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
4102
|
+
transactionRequest
|
4103
|
+
});
|
4104
|
+
transactionRequest.maxFee = maxFee;
|
3997
4105
|
} else {
|
3998
4106
|
break;
|
3999
4107
|
}
|
@@ -4001,37 +4109,139 @@ var _Provider = class {
|
|
4001
4109
|
return {
|
4002
4110
|
receipts,
|
4003
4111
|
outputVariables,
|
4004
|
-
missingContractIds
|
4112
|
+
missingContractIds,
|
4113
|
+
dryrunStatus
|
4005
4114
|
};
|
4006
4115
|
}
|
4116
|
+
/**
|
4117
|
+
* Dry runs multiple transactions and checks for missing dependencies in batches.
|
4118
|
+
*
|
4119
|
+
* Transactions are dry run in batches. After each dry run, transactions requiring
|
4120
|
+
* further modifications are identified. The method iteratively updates these transactions
|
4121
|
+
* and performs subsequent dry runs until all dependencies for each transaction are satisfied.
|
4122
|
+
*
|
4123
|
+
* @param transactionRequests - Array of transaction request objects.
|
4124
|
+
* @returns A promise that resolves to an array of results for each transaction.
|
4125
|
+
*/
|
4126
|
+
async estimateMultipleTxDependencies(transactionRequests) {
|
4127
|
+
const results = transactionRequests.map(() => ({
|
4128
|
+
receipts: [],
|
4129
|
+
outputVariables: 0,
|
4130
|
+
missingContractIds: [],
|
4131
|
+
dryrunStatus: void 0
|
4132
|
+
}));
|
4133
|
+
const allRequests = clone3(transactionRequests);
|
4134
|
+
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
4135
|
+
allRequests.forEach((req, index) => {
|
4136
|
+
if (req.type === TransactionType8.Script) {
|
4137
|
+
serializedTransactionsMap.set(index, hexlify12(req.toTransactionBytes()));
|
4138
|
+
}
|
4139
|
+
});
|
4140
|
+
let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
|
4141
|
+
let attempt = 0;
|
4142
|
+
while (transactionsToProcess.length > 0 && attempt < MAX_RETRIES) {
|
4143
|
+
const encodedTransactions = transactionsToProcess.map(
|
4144
|
+
(index) => serializedTransactionsMap.get(index)
|
4145
|
+
);
|
4146
|
+
const dryRunResults = await this.operations.dryRun({
|
4147
|
+
encodedTransactions,
|
4148
|
+
utxoValidation: false
|
4149
|
+
});
|
4150
|
+
const nextRoundTransactions = [];
|
4151
|
+
for (let i = 0; i < dryRunResults.dryRun.length; i++) {
|
4152
|
+
const currentResultIndex = transactionsToProcess[i];
|
4153
|
+
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
4154
|
+
results[currentResultIndex].receipts = rawReceipts.map(processGqlReceipt);
|
4155
|
+
results[currentResultIndex].dryrunStatus = status;
|
4156
|
+
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
4157
|
+
results[currentResultIndex].receipts
|
4158
|
+
);
|
4159
|
+
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
4160
|
+
const requestToProcess = allRequests[currentResultIndex];
|
4161
|
+
if (hasMissingOutputs && requestToProcess?.type === TransactionType8.Script) {
|
4162
|
+
results[currentResultIndex].outputVariables += missingOutputVariables.length;
|
4163
|
+
requestToProcess.addVariableOutputs(missingOutputVariables.length);
|
4164
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
4165
|
+
requestToProcess.addContractInputAndOutput(Address2.fromString(contractId));
|
4166
|
+
results[currentResultIndex].missingContractIds.push(contractId);
|
4167
|
+
});
|
4168
|
+
const { maxFee } = await this.estimateTxGasAndFee({
|
4169
|
+
transactionRequest: requestToProcess
|
4170
|
+
});
|
4171
|
+
requestToProcess.maxFee = maxFee;
|
4172
|
+
serializedTransactionsMap.set(
|
4173
|
+
currentResultIndex,
|
4174
|
+
hexlify12(requestToProcess.toTransactionBytes())
|
4175
|
+
);
|
4176
|
+
nextRoundTransactions.push(currentResultIndex);
|
4177
|
+
allRequests[currentResultIndex] = requestToProcess;
|
4178
|
+
}
|
4179
|
+
}
|
4180
|
+
transactionsToProcess = nextRoundTransactions;
|
4181
|
+
attempt += 1;
|
4182
|
+
}
|
4183
|
+
return results;
|
4184
|
+
}
|
4185
|
+
async dryRunMultipleTransactions(transactionRequests, { utxoValidation, estimateTxDependencies = true } = {}) {
|
4186
|
+
if (estimateTxDependencies) {
|
4187
|
+
return this.estimateMultipleTxDependencies(transactionRequests);
|
4188
|
+
}
|
4189
|
+
const encodedTransactions = transactionRequests.map((tx) => hexlify12(tx.toTransactionBytes()));
|
4190
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
4191
|
+
encodedTransactions,
|
4192
|
+
utxoValidation: utxoValidation || false
|
4193
|
+
});
|
4194
|
+
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
4195
|
+
const receipts = rawReceipts.map(processGqlReceipt);
|
4196
|
+
return { receipts, dryrunStatus: status };
|
4197
|
+
});
|
4198
|
+
return results;
|
4199
|
+
}
|
4007
4200
|
/**
|
4008
4201
|
* Estimates the transaction gas and fee based on the provided transaction request.
|
4009
4202
|
* @param transactionRequest - The transaction request object.
|
4010
4203
|
* @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
|
4011
4204
|
*/
|
4012
|
-
estimateTxGasAndFee(params) {
|
4205
|
+
async estimateTxGasAndFee(params) {
|
4013
4206
|
const { transactionRequest } = params;
|
4014
|
-
|
4207
|
+
let { gasPrice } = params;
|
4015
4208
|
const chainInfo = this.getChain();
|
4016
|
-
const
|
4017
|
-
transactionRequest.gasPrice = gasPrice;
|
4209
|
+
const { gasPriceFactor, maxGasPerTx } = this.getGasConfig();
|
4018
4210
|
const minGas = transactionRequest.calculateMinGas(chainInfo);
|
4019
|
-
|
4211
|
+
if (!gasPrice) {
|
4212
|
+
gasPrice = await this.estimateGasPrice(10);
|
4213
|
+
}
|
4214
|
+
const minFee = calculateGasFee({
|
4215
|
+
gasPrice: bn16(gasPrice),
|
4216
|
+
gas: minGas,
|
4217
|
+
priceFactor: gasPriceFactor,
|
4218
|
+
tip: transactionRequest.tip
|
4219
|
+
}).add(1);
|
4220
|
+
let gasLimit = bn16(0);
|
4020
4221
|
if (transactionRequest.type === TransactionType8.Script) {
|
4222
|
+
gasLimit = transactionRequest.gasLimit;
|
4021
4223
|
if (transactionRequest.gasLimit.eq(0)) {
|
4022
4224
|
transactionRequest.gasLimit = minGas;
|
4023
4225
|
transactionRequest.gasLimit = maxGasPerTx.sub(
|
4024
4226
|
transactionRequest.calculateMaxGas(chainInfo, minGas)
|
4025
4227
|
);
|
4228
|
+
gasLimit = transactionRequest.gasLimit;
|
4026
4229
|
}
|
4027
4230
|
}
|
4028
4231
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4029
|
-
const maxFee =
|
4232
|
+
const maxFee = calculateGasFee({
|
4233
|
+
gasPrice: bn16(gasPrice),
|
4234
|
+
gas: maxGas,
|
4235
|
+
priceFactor: gasPriceFactor,
|
4236
|
+
tip: transactionRequest.tip
|
4237
|
+
}).add(1);
|
4030
4238
|
return {
|
4031
4239
|
minGas,
|
4032
4240
|
minFee,
|
4033
4241
|
maxGas,
|
4034
|
-
maxFee
|
4242
|
+
maxFee,
|
4243
|
+
gasPrice,
|
4244
|
+
gasLimit
|
4035
4245
|
};
|
4036
4246
|
}
|
4037
4247
|
/**
|
@@ -4049,15 +4259,17 @@ var _Provider = class {
|
|
4049
4259
|
if (estimateTxDependencies) {
|
4050
4260
|
return this.estimateTxDependencies(transactionRequest);
|
4051
4261
|
}
|
4052
|
-
const
|
4053
|
-
const { dryRun:
|
4054
|
-
|
4262
|
+
const encodedTransactions = [hexlify12(transactionRequest.toTransactionBytes())];
|
4263
|
+
const { dryRun: dryRunStatuses } = await this.operations.dryRun({
|
4264
|
+
encodedTransactions,
|
4055
4265
|
utxoValidation: true
|
4056
4266
|
});
|
4057
|
-
const
|
4058
|
-
|
4059
|
-
receipts
|
4060
|
-
|
4267
|
+
const callResult = dryRunStatuses.map((dryRunStatus) => {
|
4268
|
+
const { id, receipts, status } = dryRunStatus;
|
4269
|
+
const processedReceipts = receipts.map(processGqlReceipt);
|
4270
|
+
return { id, receipts: processedReceipts, status };
|
4271
|
+
});
|
4272
|
+
return { receipts: callResult[0].receipts };
|
4061
4273
|
}
|
4062
4274
|
/**
|
4063
4275
|
* Returns a transaction cost to enable user
|
@@ -4074,77 +4286,79 @@ var _Provider = class {
|
|
4074
4286
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
4075
4287
|
* @returns A promise that resolves to the transaction cost object.
|
4076
4288
|
*/
|
4077
|
-
async getTransactionCost(transactionRequestLike,
|
4078
|
-
estimateTxDependencies = true,
|
4079
|
-
estimatePredicates = true,
|
4080
|
-
resourcesOwner,
|
4081
|
-
signatureCallback
|
4082
|
-
} = {}) {
|
4289
|
+
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
4083
4290
|
const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
|
4084
|
-
const { minGasPrice } = this.getGasConfig();
|
4085
|
-
const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
|
4086
4291
|
const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
|
4087
4292
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
4088
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities,
|
4293
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4089
4294
|
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
4295
|
+
txRequestClone.maxFee = bn16(0);
|
4090
4296
|
if (isScriptTransaction) {
|
4091
|
-
txRequestClone.gasLimit =
|
4297
|
+
txRequestClone.gasLimit = bn16(0);
|
4092
4298
|
}
|
4093
|
-
if (
|
4094
|
-
|
4095
|
-
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
4096
|
-
}
|
4097
|
-
await this.estimatePredicates(txRequestClone);
|
4299
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4300
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
4098
4301
|
}
|
4302
|
+
const signedRequest = clone3(txRequestClone);
|
4303
|
+
let addedSignatures = 0;
|
4099
4304
|
if (signatureCallback && isScriptTransaction) {
|
4100
|
-
|
4305
|
+
const lengthBefore = signedRequest.witnesses.length;
|
4306
|
+
await signatureCallback(signedRequest);
|
4307
|
+
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
4101
4308
|
}
|
4102
|
-
|
4103
|
-
|
4309
|
+
await this.estimatePredicates(signedRequest);
|
4310
|
+
let { maxFee, maxGas, minFee, minGas, gasPrice, gasLimit } = await this.estimateTxGasAndFee({
|
4311
|
+
transactionRequest: signedRequest
|
4104
4312
|
});
|
4105
4313
|
let receipts = [];
|
4106
4314
|
let missingContractIds = [];
|
4107
4315
|
let outputVariables = 0;
|
4108
|
-
let gasUsed =
|
4109
|
-
|
4110
|
-
|
4316
|
+
let gasUsed = bn16(0);
|
4317
|
+
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
4318
|
+
txRequestClone.maxFee = maxFee;
|
4319
|
+
if (isScriptTransaction) {
|
4320
|
+
txRequestClone.gasLimit = gasLimit;
|
4321
|
+
if (signatureCallback) {
|
4322
|
+
await signatureCallback(txRequestClone);
|
4323
|
+
}
|
4111
4324
|
const result = await this.estimateTxDependencies(txRequestClone);
|
4112
4325
|
receipts = result.receipts;
|
4113
4326
|
outputVariables = result.outputVariables;
|
4114
4327
|
missingContractIds = result.missingContractIds;
|
4115
4328
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
4116
4329
|
txRequestClone.gasLimit = gasUsed;
|
4117
|
-
|
4118
|
-
|
4119
|
-
|
4330
|
+
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
4331
|
+
transactionRequest: txRequestClone,
|
4332
|
+
gasPrice
|
4120
4333
|
}));
|
4121
4334
|
}
|
4122
4335
|
return {
|
4123
4336
|
requiredQuantities: allQuantities,
|
4124
4337
|
receipts,
|
4125
4338
|
gasUsed,
|
4126
|
-
|
4127
|
-
gasPrice: setGasPrice,
|
4339
|
+
gasPrice,
|
4128
4340
|
minGas,
|
4129
4341
|
maxGas,
|
4130
4342
|
minFee,
|
4131
4343
|
maxFee,
|
4132
|
-
estimatedInputs: txRequestClone.inputs,
|
4133
4344
|
outputVariables,
|
4134
|
-
missingContractIds
|
4345
|
+
missingContractIds,
|
4346
|
+
addedSignatures,
|
4347
|
+
estimatedPredicates: txRequestClone.inputs
|
4135
4348
|
};
|
4136
4349
|
}
|
4137
|
-
async getResourcesForTransaction(owner, transactionRequestLike,
|
4350
|
+
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
4138
4351
|
const ownerAddress = Address2.fromAddressOrString(owner);
|
4139
4352
|
const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
|
4140
|
-
const transactionCost = await this.getTransactionCost(transactionRequest,
|
4353
|
+
const transactionCost = await this.getTransactionCost(transactionRequest, {
|
4354
|
+
quantitiesToContract
|
4355
|
+
});
|
4141
4356
|
transactionRequest.addResources(
|
4142
4357
|
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
4143
4358
|
);
|
4144
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(
|
4145
|
-
|
4146
|
-
|
4147
|
-
);
|
4359
|
+
const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
|
4360
|
+
quantitiesToContract
|
4361
|
+
});
|
4148
4362
|
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
4149
4363
|
return {
|
4150
4364
|
resources,
|
@@ -4166,11 +4380,10 @@ var _Provider = class {
|
|
4166
4380
|
return coins.map((coin) => ({
|
4167
4381
|
id: coin.utxoId,
|
4168
4382
|
assetId: coin.assetId,
|
4169
|
-
amount:
|
4383
|
+
amount: bn16(coin.amount),
|
4170
4384
|
owner: Address2.fromAddressOrString(coin.owner),
|
4171
|
-
|
4172
|
-
|
4173
|
-
txCreatedIdx: bn15(coin.txCreatedIdx)
|
4385
|
+
blockCreated: bn16(coin.blockCreated),
|
4386
|
+
txCreatedIdx: bn16(coin.txCreatedIdx)
|
4174
4387
|
}));
|
4175
4388
|
}
|
4176
4389
|
/**
|
@@ -4207,9 +4420,9 @@ var _Provider = class {
|
|
4207
4420
|
switch (coin.__typename) {
|
4208
4421
|
case "MessageCoin":
|
4209
4422
|
return {
|
4210
|
-
amount:
|
4423
|
+
amount: bn16(coin.amount),
|
4211
4424
|
assetId: coin.assetId,
|
4212
|
-
daHeight:
|
4425
|
+
daHeight: bn16(coin.daHeight),
|
4213
4426
|
sender: Address2.fromAddressOrString(coin.sender),
|
4214
4427
|
recipient: Address2.fromAddressOrString(coin.recipient),
|
4215
4428
|
nonce: coin.nonce
|
@@ -4217,12 +4430,11 @@ var _Provider = class {
|
|
4217
4430
|
case "Coin":
|
4218
4431
|
return {
|
4219
4432
|
id: coin.utxoId,
|
4220
|
-
amount:
|
4433
|
+
amount: bn16(coin.amount),
|
4221
4434
|
assetId: coin.assetId,
|
4222
4435
|
owner: Address2.fromAddressOrString(coin.owner),
|
4223
|
-
|
4224
|
-
|
4225
|
-
txCreatedIdx: bn15(coin.txCreatedIdx)
|
4436
|
+
blockCreated: bn16(coin.blockCreated),
|
4437
|
+
txCreatedIdx: bn16(coin.txCreatedIdx)
|
4226
4438
|
};
|
4227
4439
|
default:
|
4228
4440
|
return null;
|
@@ -4239,13 +4451,13 @@ var _Provider = class {
|
|
4239
4451
|
async getBlock(idOrHeight) {
|
4240
4452
|
let variables;
|
4241
4453
|
if (typeof idOrHeight === "number") {
|
4242
|
-
variables = { height:
|
4454
|
+
variables = { height: bn16(idOrHeight).toString(10) };
|
4243
4455
|
} else if (idOrHeight === "latest") {
|
4244
4456
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4245
4457
|
} else if (idOrHeight.length === 66) {
|
4246
4458
|
variables = { blockId: idOrHeight };
|
4247
4459
|
} else {
|
4248
|
-
variables = { blockId:
|
4460
|
+
variables = { blockId: bn16(idOrHeight).toString(10) };
|
4249
4461
|
}
|
4250
4462
|
const { block } = await this.operations.getBlock(variables);
|
4251
4463
|
if (!block) {
|
@@ -4253,7 +4465,7 @@ var _Provider = class {
|
|
4253
4465
|
}
|
4254
4466
|
return {
|
4255
4467
|
id: block.id,
|
4256
|
-
height:
|
4468
|
+
height: bn16(block.height),
|
4257
4469
|
time: block.header.time,
|
4258
4470
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4259
4471
|
};
|
@@ -4268,7 +4480,7 @@ var _Provider = class {
|
|
4268
4480
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4269
4481
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4270
4482
|
id: block.id,
|
4271
|
-
height:
|
4483
|
+
height: bn16(block.height),
|
4272
4484
|
time: block.header.time,
|
4273
4485
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4274
4486
|
}));
|
@@ -4283,7 +4495,7 @@ var _Provider = class {
|
|
4283
4495
|
async getBlockWithTransactions(idOrHeight) {
|
4284
4496
|
let variables;
|
4285
4497
|
if (typeof idOrHeight === "number") {
|
4286
|
-
variables = { blockHeight:
|
4498
|
+
variables = { blockHeight: bn16(idOrHeight).toString(10) };
|
4287
4499
|
} else if (idOrHeight === "latest") {
|
4288
4500
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4289
4501
|
} else {
|
@@ -4295,7 +4507,7 @@ var _Provider = class {
|
|
4295
4507
|
}
|
4296
4508
|
return {
|
4297
4509
|
id: block.id,
|
4298
|
-
height:
|
4510
|
+
height: bn16(block.height, 10),
|
4299
4511
|
time: block.header.time,
|
4300
4512
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4301
4513
|
transactions: block.transactions.map(
|
@@ -4344,7 +4556,7 @@ var _Provider = class {
|
|
4344
4556
|
contract: Address2.fromAddressOrString(contractId).toB256(),
|
4345
4557
|
asset: hexlify12(assetId)
|
4346
4558
|
});
|
4347
|
-
return
|
4559
|
+
return bn16(contractBalance.amount, 10);
|
4348
4560
|
}
|
4349
4561
|
/**
|
4350
4562
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4358,7 +4570,7 @@ var _Provider = class {
|
|
4358
4570
|
owner: Address2.fromAddressOrString(owner).toB256(),
|
4359
4571
|
assetId: hexlify12(assetId)
|
4360
4572
|
});
|
4361
|
-
return
|
4573
|
+
return bn16(balance.amount, 10);
|
4362
4574
|
}
|
4363
4575
|
/**
|
4364
4576
|
* Returns balances for the given owner.
|
@@ -4376,7 +4588,7 @@ var _Provider = class {
|
|
4376
4588
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4377
4589
|
return balances.map((balance) => ({
|
4378
4590
|
assetId: balance.assetId,
|
4379
|
-
amount:
|
4591
|
+
amount: bn16(balance.amount)
|
4380
4592
|
}));
|
4381
4593
|
}
|
4382
4594
|
/**
|
@@ -4398,15 +4610,15 @@ var _Provider = class {
|
|
4398
4610
|
sender: message.sender,
|
4399
4611
|
recipient: message.recipient,
|
4400
4612
|
nonce: message.nonce,
|
4401
|
-
amount:
|
4613
|
+
amount: bn16(message.amount),
|
4402
4614
|
data: message.data
|
4403
4615
|
}),
|
4404
4616
|
sender: Address2.fromAddressOrString(message.sender),
|
4405
4617
|
recipient: Address2.fromAddressOrString(message.recipient),
|
4406
4618
|
nonce: message.nonce,
|
4407
|
-
amount:
|
4619
|
+
amount: bn16(message.amount),
|
4408
4620
|
data: InputMessageCoder.decodeData(message.data),
|
4409
|
-
daHeight:
|
4621
|
+
daHeight: bn16(message.daHeight)
|
4410
4622
|
}));
|
4411
4623
|
}
|
4412
4624
|
/**
|
@@ -4459,44 +4671,60 @@ var _Provider = class {
|
|
4459
4671
|
} = result.messageProof;
|
4460
4672
|
return {
|
4461
4673
|
messageProof: {
|
4462
|
-
proofIndex:
|
4674
|
+
proofIndex: bn16(messageProof.proofIndex),
|
4463
4675
|
proofSet: messageProof.proofSet
|
4464
4676
|
},
|
4465
4677
|
blockProof: {
|
4466
|
-
proofIndex:
|
4678
|
+
proofIndex: bn16(blockProof.proofIndex),
|
4467
4679
|
proofSet: blockProof.proofSet
|
4468
4680
|
},
|
4469
4681
|
messageBlockHeader: {
|
4470
4682
|
id: messageBlockHeader.id,
|
4471
|
-
daHeight:
|
4472
|
-
transactionsCount:
|
4683
|
+
daHeight: bn16(messageBlockHeader.daHeight),
|
4684
|
+
transactionsCount: bn16(messageBlockHeader.transactionsCount),
|
4473
4685
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4474
|
-
height:
|
4686
|
+
height: bn16(messageBlockHeader.height),
|
4475
4687
|
prevRoot: messageBlockHeader.prevRoot,
|
4476
4688
|
time: messageBlockHeader.time,
|
4477
4689
|
applicationHash: messageBlockHeader.applicationHash,
|
4478
|
-
|
4479
|
-
|
4690
|
+
messageReceiptCount: bn16(messageBlockHeader.messageReceiptCount),
|
4691
|
+
messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
|
4692
|
+
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
4693
|
+
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
4694
|
+
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
4480
4695
|
},
|
4481
4696
|
commitBlockHeader: {
|
4482
4697
|
id: commitBlockHeader.id,
|
4483
|
-
daHeight:
|
4484
|
-
transactionsCount:
|
4698
|
+
daHeight: bn16(commitBlockHeader.daHeight),
|
4699
|
+
transactionsCount: bn16(commitBlockHeader.transactionsCount),
|
4485
4700
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
4486
|
-
height:
|
4701
|
+
height: bn16(commitBlockHeader.height),
|
4487
4702
|
prevRoot: commitBlockHeader.prevRoot,
|
4488
4703
|
time: commitBlockHeader.time,
|
4489
4704
|
applicationHash: commitBlockHeader.applicationHash,
|
4490
|
-
|
4491
|
-
|
4705
|
+
messageReceiptCount: bn16(commitBlockHeader.messageReceiptCount),
|
4706
|
+
messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
|
4707
|
+
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
4708
|
+
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
4709
|
+
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
4492
4710
|
},
|
4493
4711
|
sender: Address2.fromAddressOrString(sender),
|
4494
4712
|
recipient: Address2.fromAddressOrString(recipient),
|
4495
4713
|
nonce,
|
4496
|
-
amount:
|
4714
|
+
amount: bn16(amount),
|
4497
4715
|
data
|
4498
4716
|
};
|
4499
4717
|
}
|
4718
|
+
async getLatestGasPrice() {
|
4719
|
+
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4720
|
+
return bn16(latestGasPrice.gasPrice);
|
4721
|
+
}
|
4722
|
+
async estimateGasPrice(blockHorizon) {
|
4723
|
+
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4724
|
+
blockHorizon: String(blockHorizon)
|
4725
|
+
});
|
4726
|
+
return bn16(estimateGasPrice.gasPrice);
|
4727
|
+
}
|
4500
4728
|
/**
|
4501
4729
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
4502
4730
|
*
|
@@ -4516,10 +4744,10 @@ var _Provider = class {
|
|
4516
4744
|
*/
|
4517
4745
|
async produceBlocks(amount, startTime) {
|
4518
4746
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4519
|
-
blocksToProduce:
|
4747
|
+
blocksToProduce: bn16(amount).toString(10),
|
4520
4748
|
startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4521
4749
|
});
|
4522
|
-
return
|
4750
|
+
return bn16(latestBlockHeight);
|
4523
4751
|
}
|
4524
4752
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4525
4753
|
async getTransactionResponse(transactionId) {
|
@@ -4533,7 +4761,7 @@ cacheInputs_fn = function(inputs) {
|
|
4533
4761
|
return;
|
4534
4762
|
}
|
4535
4763
|
inputs.forEach((input) => {
|
4536
|
-
if (input.type ===
|
4764
|
+
if (input.type === InputType7.Coin) {
|
4537
4765
|
this.cache?.set(input.id);
|
4538
4766
|
}
|
4539
4767
|
});
|
@@ -4543,7 +4771,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4543
4771
|
|
4544
4772
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4545
4773
|
import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
|
4546
|
-
import { bn as
|
4774
|
+
import { bn as bn17 } from "@fuel-ts/math";
|
4547
4775
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
4548
4776
|
import { arrayify as arrayify12 } from "@fuel-ts/utils";
|
4549
4777
|
async function getTransactionSummary(params) {
|
@@ -4561,21 +4789,28 @@ async function getTransactionSummary(params) {
|
|
4561
4789
|
arrayify12(gqlTransaction.rawPayload),
|
4562
4790
|
0
|
4563
4791
|
);
|
4564
|
-
|
4792
|
+
let txReceipts = [];
|
4793
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
4794
|
+
txReceipts = gqlTransaction.status.receipts;
|
4795
|
+
}
|
4796
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
4565
4797
|
const {
|
4566
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
4798
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
4567
4799
|
} = provider.getChain();
|
4800
|
+
const gasPrice = await provider.getLatestGasPrice();
|
4568
4801
|
const transactionInfo = assembleTransactionSummary({
|
4569
4802
|
id: gqlTransaction.id,
|
4570
4803
|
receipts,
|
4571
4804
|
transaction: decodedTransaction,
|
4572
4805
|
transactionBytes: arrayify12(gqlTransaction.rawPayload),
|
4573
4806
|
gqlTransactionStatus: gqlTransaction.status,
|
4574
|
-
gasPerByte:
|
4575
|
-
gasPriceFactor:
|
4807
|
+
gasPerByte: bn17(gasPerByte),
|
4808
|
+
gasPriceFactor: bn17(gasPriceFactor),
|
4576
4809
|
abiMap,
|
4577
4810
|
maxInputs,
|
4578
|
-
gasCosts
|
4811
|
+
gasCosts,
|
4812
|
+
maxGasPerTx,
|
4813
|
+
gasPrice
|
4579
4814
|
});
|
4580
4815
|
return {
|
4581
4816
|
gqlTransaction,
|
@@ -4585,10 +4820,11 @@ async function getTransactionSummary(params) {
|
|
4585
4820
|
async function getTransactionSummaryFromRequest(params) {
|
4586
4821
|
const { provider, transactionRequest, abiMap } = params;
|
4587
4822
|
const { receipts } = await provider.call(transactionRequest);
|
4588
|
-
const { gasPerByte, gasPriceFactor, gasCosts } = provider.getGasConfig();
|
4823
|
+
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = provider.getGasConfig();
|
4589
4824
|
const maxInputs = provider.getChain().consensusParameters.maxInputs;
|
4590
4825
|
const transaction = transactionRequest.toTransaction();
|
4591
4826
|
const transactionBytes = transactionRequest.toTransactionBytes();
|
4827
|
+
const gasPrice = await provider.getLatestGasPrice();
|
4592
4828
|
const transactionSummary = assembleTransactionSummary({
|
4593
4829
|
receipts,
|
4594
4830
|
transaction,
|
@@ -4597,7 +4833,9 @@ async function getTransactionSummaryFromRequest(params) {
|
|
4597
4833
|
gasPerByte,
|
4598
4834
|
gasPriceFactor,
|
4599
4835
|
maxInputs,
|
4600
|
-
gasCosts
|
4836
|
+
gasCosts,
|
4837
|
+
maxGasPerTx,
|
4838
|
+
gasPrice
|
4601
4839
|
});
|
4602
4840
|
return transactionSummary;
|
4603
4841
|
}
|
@@ -4606,13 +4844,18 @@ async function getTransactionsSummaries(params) {
|
|
4606
4844
|
const { transactionsByOwner } = await provider.operations.getTransactionsByOwner(filters);
|
4607
4845
|
const { edges, pageInfo } = transactionsByOwner;
|
4608
4846
|
const {
|
4609
|
-
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts }
|
4847
|
+
consensusParameters: { gasPerByte, gasPriceFactor, maxInputs, gasCosts, maxGasPerTx }
|
4610
4848
|
} = provider.getChain();
|
4849
|
+
const gasPrice = await provider.getLatestGasPrice();
|
4611
4850
|
const transactions = edges.map((edge) => {
|
4612
4851
|
const { node: gqlTransaction } = edge;
|
4613
|
-
const { id, rawPayload,
|
4852
|
+
const { id, rawPayload, status } = gqlTransaction;
|
4614
4853
|
const [decodedTransaction] = new TransactionCoder6().decode(arrayify12(rawPayload), 0);
|
4615
|
-
|
4854
|
+
let txReceipts = [];
|
4855
|
+
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
4856
|
+
txReceipts = gqlTransaction.status.receipts;
|
4857
|
+
}
|
4858
|
+
const receipts = txReceipts.map(processGqlReceipt);
|
4616
4859
|
const transactionSummary = assembleTransactionSummary({
|
4617
4860
|
id,
|
4618
4861
|
receipts,
|
@@ -4623,7 +4866,9 @@ async function getTransactionsSummaries(params) {
|
|
4623
4866
|
gasPerByte,
|
4624
4867
|
gasPriceFactor,
|
4625
4868
|
maxInputs,
|
4626
|
-
gasCosts
|
4869
|
+
gasCosts,
|
4870
|
+
maxGasPerTx,
|
4871
|
+
gasPrice
|
4627
4872
|
});
|
4628
4873
|
const output = {
|
4629
4874
|
gqlTransaction,
|
@@ -4955,36 +5200,33 @@ var Account = class extends AbstractAccount {
|
|
4955
5200
|
* @param fee - The estimated transaction fee.
|
4956
5201
|
* @returns A promise that resolves when the resources are added to the transaction.
|
4957
5202
|
*/
|
4958
|
-
async fund(request,
|
4959
|
-
const
|
4960
|
-
|
5203
|
+
async fund(request, params) {
|
5204
|
+
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
5205
|
+
const txRequest = request;
|
5206
|
+
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
5207
|
+
amount: bn18(fee),
|
4961
5208
|
assetId: BaseAssetId3,
|
4962
|
-
coinQuantities
|
5209
|
+
coinQuantities: requiredQuantities
|
4963
5210
|
});
|
4964
5211
|
const quantitiesDict = {};
|
4965
|
-
|
5212
|
+
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
4966
5213
|
quantitiesDict[assetId] = {
|
4967
5214
|
required: amount,
|
4968
|
-
owned:
|
5215
|
+
owned: bn18(0)
|
4969
5216
|
};
|
4970
5217
|
});
|
4971
|
-
|
4972
|
-
const cachedMessages = [];
|
4973
|
-
const owner = this.address.toB256();
|
4974
|
-
request.inputs.forEach((input) => {
|
5218
|
+
txRequest.inputs.forEach((input) => {
|
4975
5219
|
const isResource = "amount" in input;
|
4976
5220
|
if (isResource) {
|
4977
5221
|
const isCoin2 = "owner" in input;
|
4978
5222
|
if (isCoin2) {
|
4979
5223
|
const assetId = String(input.assetId);
|
4980
|
-
if (
|
4981
|
-
const amount =
|
5224
|
+
if (quantitiesDict[assetId]) {
|
5225
|
+
const amount = bn18(input.amount);
|
4982
5226
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
4983
|
-
cachedUtxos.push(input.id);
|
4984
5227
|
}
|
4985
|
-
} else if (input.
|
5228
|
+
} else if (input.amount && quantitiesDict[BaseAssetId3]) {
|
4986
5229
|
quantitiesDict[BaseAssetId3].owned = quantitiesDict[BaseAssetId3].owned.add(input.amount);
|
4987
|
-
cachedMessages.push(input.nonce);
|
4988
5230
|
}
|
4989
5231
|
}
|
4990
5232
|
});
|
@@ -4999,12 +5241,23 @@ var Account = class extends AbstractAccount {
|
|
4999
5241
|
});
|
5000
5242
|
const needsToBeFunded = missingQuantities.length;
|
5001
5243
|
if (needsToBeFunded) {
|
5002
|
-
const
|
5003
|
-
|
5004
|
-
|
5005
|
-
|
5006
|
-
|
5244
|
+
const excludedIds = cacheTxInputsFromOwner(txRequest.inputs, this.address.toB256());
|
5245
|
+
const resources = await this.getResourcesToSpend(missingQuantities, excludedIds);
|
5246
|
+
txRequest.addResources(resources);
|
5247
|
+
}
|
5248
|
+
txRequest.shiftPredicateData();
|
5249
|
+
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
5250
|
+
const requestToBeReEstimate = clone4(txRequest);
|
5251
|
+
if (addedSignatures) {
|
5252
|
+
Array.from({ length: addedSignatures }).forEach(
|
5253
|
+
() => requestToBeReEstimate.addEmptyWitness()
|
5254
|
+
);
|
5007
5255
|
}
|
5256
|
+
const { maxFee } = await this.provider.estimateTxGasAndFee({
|
5257
|
+
transactionRequest: requestToBeReEstimate
|
5258
|
+
});
|
5259
|
+
txRequest.maxFee = maxFee;
|
5260
|
+
return txRequest;
|
5008
5261
|
}
|
5009
5262
|
/**
|
5010
5263
|
* A helper that creates a transfer transaction request and returns it.
|
@@ -5012,28 +5265,25 @@ var Account = class extends AbstractAccount {
|
|
5012
5265
|
* @param destination - The address of the destination.
|
5013
5266
|
* @param amount - The amount of coins to transfer.
|
5014
5267
|
* @param assetId - The asset ID of the coins to transfer.
|
5015
|
-
* @param txParams - The transaction parameters (gasLimit,
|
5268
|
+
* @param txParams - The transaction parameters (gasLimit, tip, maturity, maxFee, witnessLimit).
|
5016
5269
|
* @returns A promise that resolves to the prepared transaction request.
|
5017
5270
|
*/
|
5018
5271
|
async createTransfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
|
5019
|
-
const
|
5020
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
5021
|
-
const request = new ScriptTransactionRequest(params);
|
5272
|
+
const request = new ScriptTransactionRequest(txParams);
|
5022
5273
|
request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetId);
|
5023
|
-
const
|
5274
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
5024
5275
|
estimateTxDependencies: true,
|
5025
5276
|
resourcesOwner: this
|
5026
5277
|
});
|
5027
|
-
|
5028
|
-
|
5029
|
-
|
5030
|
-
|
5031
|
-
|
5032
|
-
|
5033
|
-
|
5034
|
-
|
5035
|
-
await this.fund(request,
|
5036
|
-
request.updatePredicateInputs(estimatedInputs);
|
5278
|
+
if ("gasLimit" in txParams) {
|
5279
|
+
this.validateGas({
|
5280
|
+
gasUsed: txCost.gasUsed,
|
5281
|
+
gasLimit: request.gasLimit
|
5282
|
+
});
|
5283
|
+
}
|
5284
|
+
request.gasLimit = txCost.gasUsed;
|
5285
|
+
request.maxFee = txCost.maxFee;
|
5286
|
+
await this.fund(request, txCost);
|
5037
5287
|
return request;
|
5038
5288
|
}
|
5039
5289
|
/**
|
@@ -5046,7 +5296,7 @@ var Account = class extends AbstractAccount {
|
|
5046
5296
|
* @returns A promise that resolves to the transaction response.
|
5047
5297
|
*/
|
5048
5298
|
async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
|
5049
|
-
if (
|
5299
|
+
if (bn18(amount).lte(0)) {
|
5050
5300
|
throw new FuelError15(
|
5051
5301
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5052
5302
|
"Transfer amount must be a positive number."
|
@@ -5065,38 +5315,37 @@ var Account = class extends AbstractAccount {
|
|
5065
5315
|
* @returns A promise that resolves to the transaction response.
|
5066
5316
|
*/
|
5067
5317
|
async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
|
5068
|
-
if (
|
5318
|
+
if (bn18(amount).lte(0)) {
|
5069
5319
|
throw new FuelError15(
|
5070
5320
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5071
5321
|
"Transfer amount must be a positive number."
|
5072
5322
|
);
|
5073
5323
|
}
|
5074
5324
|
const contractAddress = Address3.fromAddressOrString(contractId);
|
5075
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
5076
|
-
const params = { gasPrice: minGasPrice, ...txParams };
|
5077
5325
|
const { script, scriptData } = await assembleTransferToContractScript({
|
5078
5326
|
hexlifiedContractId: contractAddress.toB256(),
|
5079
|
-
amountToTransfer:
|
5327
|
+
amountToTransfer: bn18(amount),
|
5080
5328
|
assetId
|
5081
5329
|
});
|
5082
5330
|
const request = new ScriptTransactionRequest({
|
5083
|
-
...
|
5331
|
+
...txParams,
|
5084
5332
|
script,
|
5085
5333
|
scriptData
|
5086
5334
|
});
|
5087
5335
|
request.addContractInputAndOutput(contractAddress);
|
5088
|
-
const
|
5089
|
-
|
5090
|
-
[{ amount:
|
5091
|
-
);
|
5092
|
-
request.gasLimit = bn17(params.gasLimit ?? gasUsed);
|
5093
|
-
this.validateGas({
|
5094
|
-
gasUsed,
|
5095
|
-
gasPrice: request.gasPrice,
|
5096
|
-
gasLimit: request.gasLimit,
|
5097
|
-
minGasPrice
|
5336
|
+
const txCost = await this.provider.getTransactionCost(request, {
|
5337
|
+
resourcesOwner: this,
|
5338
|
+
quantitiesToContract: [{ amount: bn18(amount), assetId: String(assetId) }]
|
5098
5339
|
});
|
5099
|
-
|
5340
|
+
if (txParams.gasLimit) {
|
5341
|
+
this.validateGas({
|
5342
|
+
gasUsed: txCost.gasUsed,
|
5343
|
+
gasLimit: request.gasLimit
|
5344
|
+
});
|
5345
|
+
}
|
5346
|
+
request.gasLimit = txCost.gasUsed;
|
5347
|
+
request.maxFee = txCost.maxFee;
|
5348
|
+
await this.fund(request, txCost);
|
5100
5349
|
return this.sendTransaction(request);
|
5101
5350
|
}
|
5102
5351
|
/**
|
@@ -5108,34 +5357,31 @@ var Account = class extends AbstractAccount {
|
|
5108
5357
|
* @returns A promise that resolves to the transaction response.
|
5109
5358
|
*/
|
5110
5359
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
5111
|
-
const { minGasPrice } = this.provider.getGasConfig();
|
5112
5360
|
const recipientAddress = Address3.fromAddressOrString(recipient);
|
5113
5361
|
const recipientDataArray = arrayify14(
|
5114
5362
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5115
5363
|
);
|
5116
5364
|
const amountDataArray = arrayify14(
|
5117
|
-
"0x".concat(
|
5365
|
+
"0x".concat(bn18(amount).toHex().substring(2).padStart(16, "0"))
|
5118
5366
|
);
|
5119
5367
|
const script = new Uint8Array([
|
5120
5368
|
...arrayify14(withdrawScript.bytes),
|
5121
5369
|
...recipientDataArray,
|
5122
5370
|
...amountDataArray
|
5123
5371
|
]);
|
5124
|
-
const params = { script,
|
5372
|
+
const params = { script, ...txParams };
|
5125
5373
|
const request = new ScriptTransactionRequest(params);
|
5126
|
-
const
|
5127
|
-
const
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5134
|
-
|
5135
|
-
|
5136
|
-
|
5137
|
-
});
|
5138
|
-
await this.fund(request, requiredQuantities, maxFee);
|
5374
|
+
const quantitiesToContract = [{ amount: bn18(amount), assetId: BaseAssetId3 }];
|
5375
|
+
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
5376
|
+
if (txParams.gasLimit) {
|
5377
|
+
this.validateGas({
|
5378
|
+
gasUsed: txCost.gasUsed,
|
5379
|
+
gasLimit: request.gasLimit
|
5380
|
+
});
|
5381
|
+
}
|
5382
|
+
request.maxFee = txCost.maxFee;
|
5383
|
+
request.gasLimit = txCost.gasUsed;
|
5384
|
+
await this.fund(request, txCost);
|
5139
5385
|
return this.sendTransaction(request);
|
5140
5386
|
}
|
5141
5387
|
async signMessage(message) {
|
@@ -5193,18 +5439,7 @@ var Account = class extends AbstractAccount {
|
|
5193
5439
|
}
|
5194
5440
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
5195
5441
|
}
|
5196
|
-
validateGas({
|
5197
|
-
gasUsed,
|
5198
|
-
gasPrice,
|
5199
|
-
gasLimit,
|
5200
|
-
minGasPrice
|
5201
|
-
}) {
|
5202
|
-
if (minGasPrice.gt(gasPrice)) {
|
5203
|
-
throw new FuelError15(
|
5204
|
-
ErrorCode15.GAS_PRICE_TOO_LOW,
|
5205
|
-
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
5206
|
-
);
|
5207
|
-
}
|
5442
|
+
validateGas({ gasUsed, gasLimit }) {
|
5208
5443
|
if (gasUsed.gt(gasLimit)) {
|
5209
5444
|
throw new FuelError15(
|
5210
5445
|
ErrorCode15.GAS_LIMIT_TOO_LOW,
|
@@ -5500,7 +5735,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5500
5735
|
* @param transactionRequestLike - The transaction request to send.
|
5501
5736
|
* @returns A promise that resolves to the TransactionResponse object.
|
5502
5737
|
*/
|
5503
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies =
|
5738
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false, awaitExecution } = {}) {
|
5504
5739
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
5505
5740
|
if (estimateTxDependencies) {
|
5506
5741
|
await this.provider.estimateTxDependencies(transactionRequest);
|
@@ -5541,7 +5776,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
5541
5776
|
// src/hdwallet/hdwallet.ts
|
5542
5777
|
import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
|
5543
5778
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
5544
|
-
import { bn as
|
5779
|
+
import { bn as bn19, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
5545
5780
|
import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
|
5546
5781
|
import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
|
5547
5782
|
|
@@ -8013,7 +8248,7 @@ var HDWallet = class {
|
|
8013
8248
|
const IR = bytes.slice(32);
|
8014
8249
|
if (privateKey) {
|
8015
8250
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
8016
|
-
const ki =
|
8251
|
+
const ki = bn19(IL).add(privateKey).mod(N).toBytes(32);
|
8017
8252
|
return new HDWallet({
|
8018
8253
|
privateKey: ki,
|
8019
8254
|
chainCode: IR,
|
@@ -8702,7 +8937,7 @@ import {
|
|
8702
8937
|
import { Address as Address9 } from "@fuel-ts/address";
|
8703
8938
|
import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
|
8704
8939
|
import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
|
8705
|
-
import { ByteArrayCoder, InputType as
|
8940
|
+
import { ByteArrayCoder, InputType as InputType8 } from "@fuel-ts/transactions";
|
8706
8941
|
import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
|
8707
8942
|
|
8708
8943
|
// src/predicate/utils/getPredicateRoot.ts
|
@@ -8762,9 +8997,9 @@ var Predicate = class extends Account {
|
|
8762
8997
|
const request = transactionRequestify(transactionRequestLike);
|
8763
8998
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
8764
8999
|
request.inputs?.forEach((input) => {
|
8765
|
-
if (input.type ===
|
8766
|
-
input.predicate = this.bytes;
|
8767
|
-
input.predicateData = this.getPredicateData(policies.length);
|
9000
|
+
if (input.type === InputType8.Coin && hexlify19(input.owner) === this.address.toB256()) {
|
9001
|
+
input.predicate = hexlify19(this.bytes);
|
9002
|
+
input.predicateData = hexlify19(this.getPredicateData(policies.length));
|
8768
9003
|
}
|
8769
9004
|
});
|
8770
9005
|
return request;
|
@@ -8779,8 +9014,7 @@ var Predicate = class extends Account {
|
|
8779
9014
|
* @returns A promise that resolves to the prepared transaction request.
|
8780
9015
|
*/
|
8781
9016
|
async createTransfer(destination, amount, assetId = BaseAssetId4, txParams = {}) {
|
8782
|
-
|
8783
|
-
return this.populateTransactionPredicateData(request);
|
9017
|
+
return super.createTransfer(destination, amount, assetId, txParams);
|
8784
9018
|
}
|
8785
9019
|
/**
|
8786
9020
|
* Sends a transaction with the populated predicate data.
|
@@ -8788,9 +9022,9 @@ var Predicate = class extends Account {
|
|
8788
9022
|
* @param transactionRequestLike - The transaction request-like object.
|
8789
9023
|
* @returns A promise that resolves to the transaction response.
|
8790
9024
|
*/
|
8791
|
-
sendTransaction(transactionRequestLike
|
8792
|
-
const transactionRequest =
|
8793
|
-
return super.sendTransaction(transactionRequest,
|
9025
|
+
sendTransaction(transactionRequestLike) {
|
9026
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9027
|
+
return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
|
8794
9028
|
}
|
8795
9029
|
/**
|
8796
9030
|
* Simulates a transaction with the populated predicate data.
|
@@ -8799,8 +9033,8 @@ var Predicate = class extends Account {
|
|
8799
9033
|
* @returns A promise that resolves to the call result.
|
8800
9034
|
*/
|
8801
9035
|
simulateTransaction(transactionRequestLike) {
|
8802
|
-
const transactionRequest =
|
8803
|
-
return super.simulateTransaction(transactionRequest);
|
9036
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9037
|
+
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
8804
9038
|
}
|
8805
9039
|
getPredicateData(policiesLength) {
|
8806
9040
|
if (!this.predicateData.length) {
|
@@ -8846,6 +9080,25 @@ var Predicate = class extends Account {
|
|
8846
9080
|
predicateInterface: abiInterface
|
8847
9081
|
};
|
8848
9082
|
}
|
9083
|
+
/**
|
9084
|
+
* Retrieves resources satisfying the spend query for the account.
|
9085
|
+
*
|
9086
|
+
* @param quantities - IDs of coins to exclude.
|
9087
|
+
* @param excludedIds - IDs of resources to be excluded from the query.
|
9088
|
+
* @returns A promise that resolves to an array of Resources.
|
9089
|
+
*/
|
9090
|
+
async getResourcesToSpend(quantities, excludedIds) {
|
9091
|
+
const resources = await this.provider.getResourcesToSpend(
|
9092
|
+
this.address,
|
9093
|
+
quantities,
|
9094
|
+
excludedIds
|
9095
|
+
);
|
9096
|
+
return resources.map((resource) => ({
|
9097
|
+
...resource,
|
9098
|
+
predicate: hexlify19(this.bytes),
|
9099
|
+
paddPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
|
9100
|
+
}));
|
9101
|
+
}
|
8849
9102
|
/**
|
8850
9103
|
* Sets the configurable constants for the predicate.
|
8851
9104
|
*
|
@@ -9594,7 +9847,7 @@ export {
|
|
9594
9847
|
WalletLocked,
|
9595
9848
|
WalletManager,
|
9596
9849
|
WalletUnlocked,
|
9597
|
-
|
9850
|
+
addAmountToCoinQuantities,
|
9598
9851
|
addOperation,
|
9599
9852
|
assemblePanicError,
|
9600
9853
|
assembleReceiptByType,
|
@@ -9603,9 +9856,10 @@ export {
|
|
9603
9856
|
assets,
|
9604
9857
|
buildBlockExplorerUrl,
|
9605
9858
|
cacheFor,
|
9859
|
+
cacheTxInputsFromOwner,
|
9860
|
+
calculateGasFee,
|
9606
9861
|
calculateMetadataGasForTxCreate,
|
9607
9862
|
calculateMetadataGasForTxScript,
|
9608
|
-
calculatePriceWithFactor,
|
9609
9863
|
calculateTransactionFee,
|
9610
9864
|
coinQuantityfy,
|
9611
9865
|
deferPromise,
|