@fuel-ts/account 0.0.0-pr-2149-20240427110619 → 0.0.0-pr-2217-20240503100416
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 +15 -12
- package/dist/account.d.ts +1 -1
- package/dist/account.d.ts.map +1 -1
- package/dist/index.global.js +1624 -1618
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +366 -207
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +347 -190
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +203 -80
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/message.d.ts +2 -2
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +30 -29
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/resource.d.ts +0 -1
- package/dist/providers/resource.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts +8 -0
- package/dist/providers/transaction-request/helpers.d.ts.map +1 -0
- package/dist/providers/transaction-request/script-transaction-request.d.ts +2 -3
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +5 -6
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +2 -1
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +2 -2
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts +20 -0
- package/dist/providers/transaction-summary/calculate-tx-fee-for-summary.d.ts.map +1 -0
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/index.d.ts +1 -1
- package/dist/providers/transaction-summary/index.d.ts.map +1 -1
- package/dist/providers/transaction-summary/operations.d.ts +4 -0
- package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
- package/dist/providers/transaction-summary/status.d.ts +5 -1
- package/dist/providers/transaction-summary/status.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +6 -1
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +7 -6
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/resources.d.ts +4 -0
- package/dist/test-utils/resources.d.ts.map +1 -0
- package/dist/test-utils/transactionRequest.d.ts +5 -0
- package/dist/test-utils/transactionRequest.d.ts.map +1 -0
- package/dist/test-utils.global.js +1628 -1621
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +343 -196
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +328 -181
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +17 -17
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +0 -22
- package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +0 -1
package/dist/test-utils.mjs
CHANGED
@@ -26,8 +26,8 @@ import { hexlify as hexlify15 } from "@fuel-ts/utils";
|
|
26
26
|
import { Address as Address3 } from "@fuel-ts/address";
|
27
27
|
import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
|
28
28
|
import { AbstractAccount } from "@fuel-ts/interfaces";
|
29
|
-
import { bn as
|
30
|
-
import { arrayify as arrayify14, isDefined } from "@fuel-ts/utils";
|
29
|
+
import { bn as bn20 } from "@fuel-ts/math";
|
30
|
+
import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
|
31
31
|
import { clone as clone4 } from "ramda";
|
32
32
|
|
33
33
|
// src/providers/coin-quantity.ts
|
@@ -68,7 +68,7 @@ var addAmountToCoinQuantities = (params) => {
|
|
68
68
|
// src/providers/provider.ts
|
69
69
|
import { Address as Address2 } from "@fuel-ts/address";
|
70
70
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
71
|
-
import { BN, bn as
|
71
|
+
import { BN, bn as bn17 } from "@fuel-ts/math";
|
72
72
|
import {
|
73
73
|
InputType as InputType7,
|
74
74
|
TransactionType as TransactionType8,
|
@@ -78,7 +78,6 @@ import {
|
|
78
78
|
import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
|
79
79
|
import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
|
80
80
|
import { equalBytes } from "@noble/curves/abstract/utils";
|
81
|
-
import { Network } from "ethers";
|
82
81
|
import { GraphQLClient } from "graphql-request";
|
83
82
|
import { clone as clone3 } from "ramda";
|
84
83
|
|
@@ -135,9 +134,6 @@ var TransactionStatusFragmentFragmentDoc = gql`
|
|
135
134
|
id
|
136
135
|
}
|
137
136
|
time
|
138
|
-
receipts {
|
139
|
-
...receiptFragment
|
140
|
-
}
|
141
137
|
programState {
|
142
138
|
returnType
|
143
139
|
data
|
@@ -145,11 +141,15 @@ var TransactionStatusFragmentFragmentDoc = gql`
|
|
145
141
|
receipts {
|
146
142
|
...receiptFragment
|
147
143
|
}
|
144
|
+
totalGas
|
145
|
+
totalFee
|
148
146
|
}
|
149
147
|
... on FailureStatus {
|
150
148
|
block {
|
151
149
|
id
|
152
150
|
}
|
151
|
+
totalGas
|
152
|
+
totalFee
|
153
153
|
time
|
154
154
|
reason
|
155
155
|
receipts {
|
@@ -189,6 +189,8 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = gql`
|
|
189
189
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
190
190
|
var DryRunFailureStatusFragmentFragmentDoc = gql`
|
191
191
|
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
192
|
+
totalGas
|
193
|
+
totalFee
|
192
194
|
reason
|
193
195
|
programState {
|
194
196
|
returnType
|
@@ -198,6 +200,8 @@ var DryRunFailureStatusFragmentFragmentDoc = gql`
|
|
198
200
|
`;
|
199
201
|
var DryRunSuccessStatusFragmentFragmentDoc = gql`
|
200
202
|
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
203
|
+
totalGas
|
204
|
+
totalFee
|
201
205
|
programState {
|
202
206
|
returnType
|
203
207
|
data
|
@@ -333,6 +337,7 @@ var TxParametersFragmentFragmentDoc = gql`
|
|
333
337
|
maxWitnesses
|
334
338
|
maxGasPerTx
|
335
339
|
maxSize
|
340
|
+
maxBytecodeSubsections
|
336
341
|
}
|
337
342
|
`;
|
338
343
|
var PredicateParametersFragmentFragmentDoc = gql`
|
@@ -602,6 +607,14 @@ var NodeInfoFragmentFragmentDoc = gql`
|
|
602
607
|
nodeVersion
|
603
608
|
}
|
604
609
|
`;
|
610
|
+
var RelayedTransactionStatusFragmentFragmentDoc = gql`
|
611
|
+
fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
|
612
|
+
... on RelayedTransactionFailed {
|
613
|
+
blockHeight
|
614
|
+
failure
|
615
|
+
}
|
616
|
+
}
|
617
|
+
`;
|
605
618
|
var GetVersionDocument = gql`
|
606
619
|
query getVersion {
|
607
620
|
nodeInfo {
|
@@ -831,6 +844,13 @@ var GetMessageStatusDocument = gql`
|
|
831
844
|
}
|
832
845
|
}
|
833
846
|
`;
|
847
|
+
var GetRelayedTransactionStatusDocument = gql`
|
848
|
+
query getRelayedTransactionStatus($relayedTransactionId: RelayedTransactionId!) {
|
849
|
+
relayedTransactionStatus(id: $relayedTransactionId) {
|
850
|
+
...relayedTransactionStatusFragment
|
851
|
+
}
|
852
|
+
}
|
853
|
+
${RelayedTransactionStatusFragmentFragmentDoc}`;
|
834
854
|
var DryRunDocument = gql`
|
835
855
|
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
836
856
|
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
@@ -853,6 +873,13 @@ var ProduceBlocksDocument = gql`
|
|
853
873
|
)
|
854
874
|
}
|
855
875
|
`;
|
876
|
+
var GetMessageByNonceDocument = gql`
|
877
|
+
query getMessageByNonce($nonce: Nonce!) {
|
878
|
+
message(nonce: $nonce) {
|
879
|
+
...messageFragment
|
880
|
+
}
|
881
|
+
}
|
882
|
+
${MessageFragmentFragmentDoc}`;
|
856
883
|
var SubmitAndAwaitDocument = gql`
|
857
884
|
subscription submitAndAwait($encodedTransaction: HexString!) {
|
858
885
|
submitAndAwait(tx: $encodedTransaction) {
|
@@ -938,6 +965,9 @@ function getSdk(requester) {
|
|
938
965
|
getMessageStatus(variables, options) {
|
939
966
|
return requester(GetMessageStatusDocument, variables, options);
|
940
967
|
},
|
968
|
+
getRelayedTransactionStatus(variables, options) {
|
969
|
+
return requester(GetRelayedTransactionStatusDocument, variables, options);
|
970
|
+
},
|
941
971
|
dryRun(variables, options) {
|
942
972
|
return requester(DryRunDocument, variables, options);
|
943
973
|
},
|
@@ -947,6 +977,9 @@ function getSdk(requester) {
|
|
947
977
|
produceBlocks(variables, options) {
|
948
978
|
return requester(ProduceBlocksDocument, variables, options);
|
949
979
|
},
|
980
|
+
getMessageByNonce(variables, options) {
|
981
|
+
return requester(GetMessageByNonceDocument, variables, options);
|
982
|
+
},
|
950
983
|
submitAndAwait(variables, options) {
|
951
984
|
return requester(SubmitAndAwaitDocument, variables, options);
|
952
985
|
},
|
@@ -1239,7 +1272,7 @@ import {
|
|
1239
1272
|
OutputType as OutputType2,
|
1240
1273
|
TransactionType
|
1241
1274
|
} from "@fuel-ts/transactions";
|
1242
|
-
import { concat, hexlify as hexlify7 } from "@fuel-ts/utils";
|
1275
|
+
import { concat, hexlify as hexlify7, isDefined } from "@fuel-ts/utils";
|
1243
1276
|
|
1244
1277
|
// src/providers/resource.ts
|
1245
1278
|
var isCoin = (resource) => "id" in resource;
|
@@ -1552,7 +1585,7 @@ function calculateMetadataGasForTxScript({
|
|
1552
1585
|
}
|
1553
1586
|
var calculateGasFee = (params) => {
|
1554
1587
|
const { gas, gasPrice, priceFactor, tip } = params;
|
1555
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
1588
|
+
return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
|
1556
1589
|
};
|
1557
1590
|
|
1558
1591
|
// src/providers/utils/json.ts
|
@@ -1725,10 +1758,10 @@ var BaseTransactionRequest = class {
|
|
1725
1758
|
outputs,
|
1726
1759
|
witnesses
|
1727
1760
|
} = {}) {
|
1728
|
-
this.tip = bn7(tip);
|
1729
|
-
this.maturity = maturity
|
1730
|
-
this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
|
1731
|
-
this.maxFee =
|
1761
|
+
this.tip = tip ? bn7(tip) : void 0;
|
1762
|
+
this.maturity = maturity && maturity > 0 ? maturity : void 0;
|
1763
|
+
this.witnessLimit = isDefined(witnessLimit) ? bn7(witnessLimit) : void 0;
|
1764
|
+
this.maxFee = bn7(maxFee);
|
1732
1765
|
this.inputs = inputs ?? [];
|
1733
1766
|
this.outputs = outputs ?? [];
|
1734
1767
|
this.witnesses = witnesses ?? [];
|
@@ -1736,22 +1769,21 @@ var BaseTransactionRequest = class {
|
|
1736
1769
|
static getPolicyMeta(req) {
|
1737
1770
|
let policyTypes = 0;
|
1738
1771
|
const policies = [];
|
1739
|
-
|
1772
|
+
const { tip, witnessLimit, maturity } = req;
|
1773
|
+
if (bn7(tip).gt(0)) {
|
1740
1774
|
policyTypes += PolicyType.Tip;
|
1741
|
-
policies.push({ data:
|
1775
|
+
policies.push({ data: bn7(tip), type: PolicyType.Tip });
|
1742
1776
|
}
|
1743
|
-
if (
|
1777
|
+
if (isDefined(witnessLimit) && bn7(witnessLimit).gte(0)) {
|
1744
1778
|
policyTypes += PolicyType.WitnessLimit;
|
1745
|
-
policies.push({ data:
|
1779
|
+
policies.push({ data: bn7(witnessLimit), type: PolicyType.WitnessLimit });
|
1746
1780
|
}
|
1747
|
-
if (
|
1781
|
+
if (maturity && maturity > 0) {
|
1748
1782
|
policyTypes += PolicyType.Maturity;
|
1749
|
-
policies.push({ data:
|
1750
|
-
}
|
1751
|
-
if (req.maxFee) {
|
1752
|
-
policyTypes += PolicyType.MaxFee;
|
1753
|
-
policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
|
1783
|
+
policies.push({ data: maturity, type: PolicyType.Maturity });
|
1754
1784
|
}
|
1785
|
+
policyTypes += PolicyType.MaxFee;
|
1786
|
+
policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
|
1755
1787
|
return {
|
1756
1788
|
policyTypes,
|
1757
1789
|
policies
|
@@ -2067,8 +2099,11 @@ var BaseTransactionRequest = class {
|
|
2067
2099
|
* @hidden
|
2068
2100
|
*/
|
2069
2101
|
calculateMinGas(chainInfo) {
|
2070
|
-
const {
|
2071
|
-
const {
|
2102
|
+
const { consensusParameters } = chainInfo;
|
2103
|
+
const {
|
2104
|
+
gasCosts,
|
2105
|
+
feeParameters: { gasPerByte }
|
2106
|
+
} = consensusParameters;
|
2072
2107
|
return getMinGas({
|
2073
2108
|
gasPerByte,
|
2074
2109
|
gasCosts,
|
@@ -2079,7 +2114,10 @@ var BaseTransactionRequest = class {
|
|
2079
2114
|
}
|
2080
2115
|
calculateMaxGas(chainInfo, minGas) {
|
2081
2116
|
const { consensusParameters } = chainInfo;
|
2082
|
-
const {
|
2117
|
+
const {
|
2118
|
+
feeParameters: { gasPerByte },
|
2119
|
+
txParameters: { maxGasPerTx }
|
2120
|
+
} = consensusParameters;
|
2083
2121
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2084
2122
|
(acc, wit) => acc + wit.dataLength,
|
2085
2123
|
0
|
@@ -2514,7 +2552,11 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2514
2552
|
}
|
2515
2553
|
calculateMaxGas(chainInfo, minGas) {
|
2516
2554
|
const { consensusParameters } = chainInfo;
|
2517
|
-
const {
|
2555
|
+
const {
|
2556
|
+
// TODO: Validade if it will be simpler to pass only required props
|
2557
|
+
feeParameters: { gasPerByte },
|
2558
|
+
txParameters: { maxGasPerTx }
|
2559
|
+
} = consensusParameters;
|
2518
2560
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2519
2561
|
(acc, wit) => acc + wit.dataLength,
|
2520
2562
|
0
|
@@ -2602,10 +2644,10 @@ var transactionRequestify = (obj) => {
|
|
2602
2644
|
};
|
2603
2645
|
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
2604
2646
|
(acc, input) => {
|
2605
|
-
if (input.type === InputType5.Coin && input.owner === owner) {
|
2647
|
+
if (input.type === InputType5.Coin && input.owner === owner.toB256()) {
|
2606
2648
|
acc.utxos.push(input.id);
|
2607
2649
|
}
|
2608
|
-
if (input.type === InputType5.Message && input.recipient === owner) {
|
2650
|
+
if (input.type === InputType5.Message && input.recipient === owner.toB256()) {
|
2609
2651
|
acc.messages.push(input.nonce);
|
2610
2652
|
}
|
2611
2653
|
return acc;
|
@@ -2618,40 +2660,40 @@ var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
|
2618
2660
|
|
2619
2661
|
// src/providers/transaction-response/transaction-response.ts
|
2620
2662
|
import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
|
2621
|
-
import { bn as
|
2663
|
+
import { bn as bn16 } from "@fuel-ts/math";
|
2622
2664
|
import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
|
2623
2665
|
import { arrayify as arrayify10 } from "@fuel-ts/utils";
|
2624
2666
|
|
2625
2667
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2626
|
-
import { bn as
|
2668
|
+
import { bn as bn15 } from "@fuel-ts/math";
|
2627
2669
|
import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
|
2628
2670
|
import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
|
2629
2671
|
|
2630
|
-
// src/providers/transaction-summary/calculate-
|
2672
|
+
// src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
|
2631
2673
|
import { bn as bn11 } from "@fuel-ts/math";
|
2632
2674
|
import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
|
2633
2675
|
import { arrayify as arrayify9 } from "@fuel-ts/utils";
|
2634
|
-
var
|
2676
|
+
var calculateTXFeeForSummary = (params) => {
|
2635
2677
|
const {
|
2636
2678
|
gasPrice,
|
2637
2679
|
rawPayload,
|
2638
2680
|
tip,
|
2681
|
+
totalFee,
|
2639
2682
|
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
2640
2683
|
} = params;
|
2684
|
+
if (totalFee) {
|
2685
|
+
return totalFee;
|
2686
|
+
}
|
2641
2687
|
const gasPerByte = bn11(feeParams.gasPerByte);
|
2642
2688
|
const gasPriceFactor = bn11(feeParams.gasPriceFactor);
|
2643
2689
|
const transactionBytes = arrayify9(rawPayload);
|
2644
2690
|
const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
|
2645
|
-
if (transaction.type === TransactionType6.Mint) {
|
2646
|
-
return {
|
2647
|
-
fee: bn11(0),
|
2648
|
-
minFee: bn11(0),
|
2649
|
-
maxFee: bn11(0)
|
2650
|
-
};
|
2651
|
-
}
|
2652
2691
|
const { type, witnesses, inputs, policies } = transaction;
|
2653
2692
|
let metadataGas = bn11(0);
|
2654
2693
|
let gasLimit = bn11(0);
|
2694
|
+
if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
|
2695
|
+
return bn11(0);
|
2696
|
+
}
|
2655
2697
|
if (type === TransactionType6.Create) {
|
2656
2698
|
const { bytecodeWitnessIndex, storageSlots } = transaction;
|
2657
2699
|
const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
|
@@ -2688,23 +2730,13 @@ var calculateTransactionFee = (params) => {
|
|
2688
2730
|
witnessLimit,
|
2689
2731
|
maxGasPerTx
|
2690
2732
|
});
|
2691
|
-
const minFee = calculateGasFee({
|
2692
|
-
gasPrice,
|
2693
|
-
gas: minGas,
|
2694
|
-
priceFactor: gasPriceFactor,
|
2695
|
-
tip
|
2696
|
-
});
|
2697
2733
|
const maxFee = calculateGasFee({
|
2698
2734
|
gasPrice,
|
2699
2735
|
gas: maxGas,
|
2700
2736
|
priceFactor: gasPriceFactor,
|
2701
2737
|
tip
|
2702
2738
|
});
|
2703
|
-
return
|
2704
|
-
minFee,
|
2705
|
-
maxFee,
|
2706
|
-
fee: maxFee
|
2707
|
-
};
|
2739
|
+
return maxFee;
|
2708
2740
|
};
|
2709
2741
|
|
2710
2742
|
// src/providers/transaction-summary/operations.ts
|
@@ -2863,6 +2895,12 @@ function isTypeCreate(transactionType) {
|
|
2863
2895
|
function isTypeScript(transactionType) {
|
2864
2896
|
return isType(transactionType, "Script" /* Script */);
|
2865
2897
|
}
|
2898
|
+
function isTypeUpgrade(transactionType) {
|
2899
|
+
return isType(transactionType, "Upgrade" /* Upgrade */);
|
2900
|
+
}
|
2901
|
+
function isTypeUpload(transactionType) {
|
2902
|
+
return isType(transactionType, "Upload" /* Upload */);
|
2903
|
+
}
|
2866
2904
|
function getReceiptsCall(receipts) {
|
2867
2905
|
return getReceiptsByType(receipts, ReceiptType4.Call);
|
2868
2906
|
}
|
@@ -3203,6 +3241,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
3203
3241
|
|
3204
3242
|
// src/providers/transaction-summary/status.ts
|
3205
3243
|
import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
|
3244
|
+
import { bn as bn14 } from "@fuel-ts/math";
|
3206
3245
|
var getTransactionStatusName = (gqlStatus) => {
|
3207
3246
|
switch (gqlStatus) {
|
3208
3247
|
case "FailureStatus":
|
@@ -3224,6 +3263,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3224
3263
|
let time;
|
3225
3264
|
let blockId;
|
3226
3265
|
let status;
|
3266
|
+
let totalFee;
|
3267
|
+
let totalGas;
|
3227
3268
|
let isStatusFailure = false;
|
3228
3269
|
let isStatusSuccess = false;
|
3229
3270
|
let isStatusPending = false;
|
@@ -3234,11 +3275,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3234
3275
|
time = gqlTransactionStatus.time;
|
3235
3276
|
blockId = gqlTransactionStatus.block.id;
|
3236
3277
|
isStatusSuccess = true;
|
3278
|
+
totalFee = bn14(gqlTransactionStatus.totalFee);
|
3279
|
+
totalGas = bn14(gqlTransactionStatus.totalGas);
|
3237
3280
|
break;
|
3238
3281
|
case "FailureStatus":
|
3239
3282
|
time = gqlTransactionStatus.time;
|
3240
3283
|
blockId = gqlTransactionStatus.block.id;
|
3241
3284
|
isStatusFailure = true;
|
3285
|
+
totalFee = bn14(gqlTransactionStatus.totalFee);
|
3286
|
+
totalGas = bn14(gqlTransactionStatus.totalGas);
|
3242
3287
|
break;
|
3243
3288
|
case "SubmittedStatus":
|
3244
3289
|
time = gqlTransactionStatus.time;
|
@@ -3251,6 +3296,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3251
3296
|
time,
|
3252
3297
|
blockId,
|
3253
3298
|
status,
|
3299
|
+
totalFee,
|
3300
|
+
totalGas,
|
3254
3301
|
isStatusFailure,
|
3255
3302
|
isStatusSuccess,
|
3256
3303
|
isStatusPending
|
@@ -3286,8 +3333,10 @@ function assembleTransactionSummary(params) {
|
|
3286
3333
|
maxInputs
|
3287
3334
|
});
|
3288
3335
|
const typeName = getTransactionTypeName(transaction.type);
|
3289
|
-
const tip =
|
3290
|
-
const {
|
3336
|
+
const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
|
3337
|
+
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
|
3338
|
+
const fee = calculateTXFeeForSummary({
|
3339
|
+
totalFee,
|
3291
3340
|
gasPrice,
|
3292
3341
|
rawPayload,
|
3293
3342
|
tip,
|
@@ -3300,7 +3349,6 @@ function assembleTransactionSummary(params) {
|
|
3300
3349
|
}
|
3301
3350
|
}
|
3302
3351
|
});
|
3303
|
-
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time } = processGraphqlStatus(gqlTransactionStatus);
|
3304
3352
|
const mintedAssets = extractMintedAssetsFromReceipts(receipts);
|
3305
3353
|
const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
|
3306
3354
|
let date;
|
@@ -3309,6 +3357,7 @@ function assembleTransactionSummary(params) {
|
|
3309
3357
|
}
|
3310
3358
|
const transactionSummary = {
|
3311
3359
|
id,
|
3360
|
+
tip,
|
3312
3361
|
fee,
|
3313
3362
|
gasUsed,
|
3314
3363
|
operations,
|
@@ -3322,6 +3371,8 @@ function assembleTransactionSummary(params) {
|
|
3322
3371
|
isTypeMint: isTypeMint(transaction.type),
|
3323
3372
|
isTypeCreate: isTypeCreate(transaction.type),
|
3324
3373
|
isTypeScript: isTypeScript(transaction.type),
|
3374
|
+
isTypeUpgrade: isTypeUpgrade(transaction.type),
|
3375
|
+
isTypeUpload: isTypeUpload(transaction.type),
|
3325
3376
|
isStatusFailure,
|
3326
3377
|
isStatusSuccess,
|
3327
3378
|
isStatusPending,
|
@@ -3353,7 +3404,7 @@ var TransactionResponse = class {
|
|
3353
3404
|
/** Current provider */
|
3354
3405
|
provider;
|
3355
3406
|
/** Gas used on the transaction */
|
3356
|
-
gasUsed =
|
3407
|
+
gasUsed = bn16(0);
|
3357
3408
|
/** The graphql Transaction with receipts object. */
|
3358
3409
|
gqlTransaction;
|
3359
3410
|
abis;
|
@@ -3438,7 +3489,7 @@ var TransactionResponse = class {
|
|
3438
3489
|
const receipts = txReceipts.map(processGqlReceipt) || [];
|
3439
3490
|
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
3440
3491
|
const gasPrice = await this.provider.getLatestGasPrice();
|
3441
|
-
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
3492
|
+
const maxInputs = this.provider.getChain().consensusParameters.txParameters.maxInputs;
|
3442
3493
|
const transactionSummary = assembleTransactionSummary({
|
3443
3494
|
id: this.id,
|
3444
3495
|
receipts,
|
@@ -3574,33 +3625,60 @@ var mergeQuantities = (...coinQuantities) => {
|
|
3574
3625
|
var MAX_RETRIES = 10;
|
3575
3626
|
var processGqlChain = (chain) => {
|
3576
3627
|
const { name, daHeight, consensusParameters, latestBlock } = chain;
|
3577
|
-
const {
|
3628
|
+
const {
|
3629
|
+
contractParams,
|
3630
|
+
feeParams,
|
3631
|
+
predicateParams,
|
3632
|
+
scriptParams,
|
3633
|
+
txParams,
|
3634
|
+
gasCosts,
|
3635
|
+
baseAssetId,
|
3636
|
+
chainId,
|
3637
|
+
version
|
3638
|
+
} = consensusParameters;
|
3578
3639
|
return {
|
3579
3640
|
name,
|
3580
|
-
baseChainHeight:
|
3641
|
+
baseChainHeight: bn17(daHeight),
|
3581
3642
|
consensusParameters: {
|
3582
|
-
|
3583
|
-
|
3584
|
-
|
3585
|
-
|
3586
|
-
|
3587
|
-
|
3588
|
-
|
3589
|
-
|
3590
|
-
|
3591
|
-
|
3592
|
-
|
3593
|
-
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3597
|
-
|
3643
|
+
version,
|
3644
|
+
chainId: bn17(chainId),
|
3645
|
+
baseAssetId,
|
3646
|
+
feeParameters: {
|
3647
|
+
version: feeParams.version,
|
3648
|
+
gasPerByte: bn17(feeParams.gasPerByte),
|
3649
|
+
gasPriceFactor: bn17(feeParams.gasPriceFactor)
|
3650
|
+
},
|
3651
|
+
contractParameters: {
|
3652
|
+
version: contractParams.version,
|
3653
|
+
contractMaxSize: bn17(contractParams.contractMaxSize),
|
3654
|
+
maxStorageSlots: bn17(contractParams.maxStorageSlots)
|
3655
|
+
},
|
3656
|
+
txParameters: {
|
3657
|
+
version: txParams.version,
|
3658
|
+
maxInputs: bn17(txParams.maxInputs),
|
3659
|
+
maxOutputs: bn17(txParams.maxOutputs),
|
3660
|
+
maxWitnesses: bn17(txParams.maxWitnesses),
|
3661
|
+
maxGasPerTx: bn17(txParams.maxGasPerTx),
|
3662
|
+
maxSize: bn17(txParams.maxSize),
|
3663
|
+
maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
|
3664
|
+
},
|
3665
|
+
predicateParameters: {
|
3666
|
+
version: predicateParams.version,
|
3667
|
+
maxPredicateLength: bn17(predicateParams.maxPredicateLength),
|
3668
|
+
maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
|
3669
|
+
maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
|
3670
|
+
maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
|
3671
|
+
},
|
3672
|
+
scriptParameters: {
|
3673
|
+
version: scriptParams.version,
|
3674
|
+
maxScriptLength: bn17(scriptParams.maxScriptLength),
|
3675
|
+
maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
|
3676
|
+
},
|
3598
3677
|
gasCosts
|
3599
3678
|
},
|
3600
|
-
gasCosts,
|
3601
3679
|
latestBlock: {
|
3602
3680
|
id: latestBlock.id,
|
3603
|
-
height:
|
3681
|
+
height: bn17(latestBlock.height),
|
3604
3682
|
time: latestBlock.header.time,
|
3605
3683
|
transactions: latestBlock.transactions.map((i) => ({
|
3606
3684
|
id: i.id
|
@@ -3694,7 +3772,12 @@ var _Provider = class {
|
|
3694
3772
|
* Returns some helpful parameters related to gas fees.
|
3695
3773
|
*/
|
3696
3774
|
getGasConfig() {
|
3697
|
-
const {
|
3775
|
+
const {
|
3776
|
+
txParameters: { maxGasPerTx },
|
3777
|
+
predicateParameters: { maxGasPerPredicate },
|
3778
|
+
feeParameters: { gasPriceFactor, gasPerByte },
|
3779
|
+
gasCosts
|
3780
|
+
} = this.getChain().consensusParameters;
|
3698
3781
|
return {
|
3699
3782
|
maxGasPerTx,
|
3700
3783
|
maxGasPerPredicate,
|
@@ -3743,7 +3826,18 @@ var _Provider = class {
|
|
3743
3826
|
createOperations() {
|
3744
3827
|
const fetchFn = _Provider.getFetchFn(this.options);
|
3745
3828
|
const gqlClient = new GraphQLClient(this.url, {
|
3746
|
-
fetch: (url, requestInit) => fetchFn(url, requestInit, this.options)
|
3829
|
+
fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
|
3830
|
+
responseMiddleware: (response) => {
|
3831
|
+
if ("response" in response) {
|
3832
|
+
const graphQlResponse = response.response;
|
3833
|
+
if (Array.isArray(graphQlResponse?.errors)) {
|
3834
|
+
throw new FuelError13(
|
3835
|
+
FuelError13.CODES.INVALID_REQUEST,
|
3836
|
+
graphQlResponse.errors.map((err) => err.message).join("\n\n")
|
3837
|
+
);
|
3838
|
+
}
|
3839
|
+
}
|
3840
|
+
}
|
3747
3841
|
});
|
3748
3842
|
const executeQuery = (query, vars) => {
|
3749
3843
|
const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
|
@@ -3771,21 +3865,6 @@ var _Provider = class {
|
|
3771
3865
|
} = await this.operations.getVersion();
|
3772
3866
|
return nodeVersion;
|
3773
3867
|
}
|
3774
|
-
/**
|
3775
|
-
* @hidden
|
3776
|
-
*
|
3777
|
-
* Returns the network configuration of the connected Fuel node.
|
3778
|
-
*
|
3779
|
-
* @returns A promise that resolves to the network configuration object
|
3780
|
-
*/
|
3781
|
-
async getNetwork() {
|
3782
|
-
const {
|
3783
|
-
name,
|
3784
|
-
consensusParameters: { chainId }
|
3785
|
-
} = await this.getChain();
|
3786
|
-
const network = new Network(name, chainId.toNumber());
|
3787
|
-
return Promise.resolve(network);
|
3788
|
-
}
|
3789
3868
|
/**
|
3790
3869
|
* Returns the block number.
|
3791
3870
|
*
|
@@ -3793,7 +3872,7 @@ var _Provider = class {
|
|
3793
3872
|
*/
|
3794
3873
|
async getBlockNumber() {
|
3795
3874
|
const { chain } = await this.operations.getChain();
|
3796
|
-
return
|
3875
|
+
return bn17(chain.latestBlock.height, 10);
|
3797
3876
|
}
|
3798
3877
|
/**
|
3799
3878
|
* Returns the chain information.
|
@@ -3803,8 +3882,8 @@ var _Provider = class {
|
|
3803
3882
|
async fetchNode() {
|
3804
3883
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
3805
3884
|
const processedNodeInfo = {
|
3806
|
-
maxDepth:
|
3807
|
-
maxTx:
|
3885
|
+
maxDepth: bn17(nodeInfo.maxDepth),
|
3886
|
+
maxTx: bn17(nodeInfo.maxTx),
|
3808
3887
|
nodeVersion: nodeInfo.nodeVersion,
|
3809
3888
|
utxoValidation: nodeInfo.utxoValidation,
|
3810
3889
|
vmBacktrace: nodeInfo.vmBacktrace
|
@@ -3908,9 +3987,9 @@ var _Provider = class {
|
|
3908
3987
|
encodedTransactions: encodedTransaction,
|
3909
3988
|
utxoValidation: utxoValidation || false
|
3910
3989
|
});
|
3911
|
-
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
3990
|
+
const [{ receipts: rawReceipts, status: dryRunStatus }] = dryRunStatuses;
|
3912
3991
|
const receipts = rawReceipts.map(processGqlReceipt);
|
3913
|
-
return { receipts,
|
3992
|
+
return { receipts, dryRunStatus };
|
3914
3993
|
}
|
3915
3994
|
/**
|
3916
3995
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -3936,7 +4015,7 @@ var _Provider = class {
|
|
3936
4015
|
} = response;
|
3937
4016
|
if (inputs) {
|
3938
4017
|
inputs.forEach((input, index) => {
|
3939
|
-
if ("predicateGasUsed" in input &&
|
4018
|
+
if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
|
3940
4019
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
3941
4020
|
}
|
3942
4021
|
});
|
@@ -3964,7 +4043,7 @@ var _Provider = class {
|
|
3964
4043
|
let receipts = [];
|
3965
4044
|
const missingContractIds = [];
|
3966
4045
|
let outputVariables = 0;
|
3967
|
-
let
|
4046
|
+
let dryRunStatus;
|
3968
4047
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
3969
4048
|
const {
|
3970
4049
|
dryRun: [{ receipts: rawReceipts, status }]
|
@@ -3973,7 +4052,7 @@ var _Provider = class {
|
|
3973
4052
|
utxoValidation: false
|
3974
4053
|
});
|
3975
4054
|
receipts = rawReceipts.map(processGqlReceipt);
|
3976
|
-
|
4055
|
+
dryRunStatus = status;
|
3977
4056
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
3978
4057
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
3979
4058
|
if (hasMissingOutputs) {
|
@@ -3995,7 +4074,7 @@ var _Provider = class {
|
|
3995
4074
|
receipts,
|
3996
4075
|
outputVariables,
|
3997
4076
|
missingContractIds,
|
3998
|
-
|
4077
|
+
dryRunStatus
|
3999
4078
|
};
|
4000
4079
|
}
|
4001
4080
|
/**
|
@@ -4013,7 +4092,7 @@ var _Provider = class {
|
|
4013
4092
|
receipts: [],
|
4014
4093
|
outputVariables: 0,
|
4015
4094
|
missingContractIds: [],
|
4016
|
-
|
4095
|
+
dryRunStatus: void 0
|
4017
4096
|
}));
|
4018
4097
|
const allRequests = clone3(transactionRequests);
|
4019
4098
|
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
@@ -4038,7 +4117,7 @@ var _Provider = class {
|
|
4038
4117
|
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
4039
4118
|
const result = results[requestIdx];
|
4040
4119
|
result.receipts = rawReceipts.map(processGqlReceipt);
|
4041
|
-
result.
|
4120
|
+
result.dryRunStatus = status;
|
4042
4121
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
4043
4122
|
result.receipts
|
4044
4123
|
);
|
@@ -4075,7 +4154,7 @@ var _Provider = class {
|
|
4075
4154
|
});
|
4076
4155
|
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
4077
4156
|
const receipts = rawReceipts.map(processGqlReceipt);
|
4078
|
-
return { receipts,
|
4157
|
+
return { receipts, dryRunStatus: status };
|
4079
4158
|
});
|
4080
4159
|
return results;
|
4081
4160
|
}
|
@@ -4094,12 +4173,12 @@ var _Provider = class {
|
|
4094
4173
|
gasPrice = await this.estimateGasPrice(10);
|
4095
4174
|
}
|
4096
4175
|
const minFee = calculateGasFee({
|
4097
|
-
gasPrice:
|
4176
|
+
gasPrice: bn17(gasPrice),
|
4098
4177
|
gas: minGas,
|
4099
4178
|
priceFactor: gasPriceFactor,
|
4100
4179
|
tip: transactionRequest.tip
|
4101
4180
|
}).add(1);
|
4102
|
-
let gasLimit =
|
4181
|
+
let gasLimit = bn17(0);
|
4103
4182
|
if (transactionRequest.type === TransactionType8.Script) {
|
4104
4183
|
gasLimit = transactionRequest.gasLimit;
|
4105
4184
|
if (transactionRequest.gasLimit.eq(0)) {
|
@@ -4112,7 +4191,7 @@ var _Provider = class {
|
|
4112
4191
|
}
|
4113
4192
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4114
4193
|
const maxFee = calculateGasFee({
|
4115
|
-
gasPrice:
|
4194
|
+
gasPrice: bn17(gasPrice),
|
4116
4195
|
gas: maxGas,
|
4117
4196
|
priceFactor: gasPriceFactor,
|
4118
4197
|
tip: transactionRequest.tip
|
@@ -4175,9 +4254,9 @@ var _Provider = class {
|
|
4175
4254
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
4176
4255
|
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4177
4256
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4178
|
-
txRequestClone.maxFee =
|
4257
|
+
txRequestClone.maxFee = bn17(0);
|
4179
4258
|
if (isScriptTransaction) {
|
4180
|
-
txRequestClone.gasLimit =
|
4259
|
+
txRequestClone.gasLimit = bn17(0);
|
4181
4260
|
}
|
4182
4261
|
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4183
4262
|
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
@@ -4194,9 +4273,10 @@ var _Provider = class {
|
|
4194
4273
|
transactionRequest: signedRequest
|
4195
4274
|
});
|
4196
4275
|
let receipts = [];
|
4276
|
+
let dryRunStatus;
|
4197
4277
|
let missingContractIds = [];
|
4198
4278
|
let outputVariables = 0;
|
4199
|
-
let gasUsed =
|
4279
|
+
let gasUsed = bn17(0);
|
4200
4280
|
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
4201
4281
|
txRequestClone.maxFee = maxFee;
|
4202
4282
|
if (isScriptTransaction) {
|
@@ -4204,10 +4284,7 @@ var _Provider = class {
|
|
4204
4284
|
if (signatureCallback) {
|
4205
4285
|
await signatureCallback(txRequestClone);
|
4206
4286
|
}
|
4207
|
-
|
4208
|
-
receipts = result.receipts;
|
4209
|
-
outputVariables = result.outputVariables;
|
4210
|
-
missingContractIds = result.missingContractIds;
|
4287
|
+
({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
|
4211
4288
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
4212
4289
|
txRequestClone.gasLimit = gasUsed;
|
4213
4290
|
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
@@ -4227,7 +4304,8 @@ var _Provider = class {
|
|
4227
4304
|
outputVariables,
|
4228
4305
|
missingContractIds,
|
4229
4306
|
addedSignatures,
|
4230
|
-
estimatedPredicates: txRequestClone.inputs
|
4307
|
+
estimatedPredicates: txRequestClone.inputs,
|
4308
|
+
dryRunStatus
|
4231
4309
|
};
|
4232
4310
|
}
|
4233
4311
|
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
@@ -4263,10 +4341,10 @@ var _Provider = class {
|
|
4263
4341
|
return coins.map((coin) => ({
|
4264
4342
|
id: coin.utxoId,
|
4265
4343
|
assetId: coin.assetId,
|
4266
|
-
amount:
|
4344
|
+
amount: bn17(coin.amount),
|
4267
4345
|
owner: Address2.fromAddressOrString(coin.owner),
|
4268
|
-
blockCreated:
|
4269
|
-
txCreatedIdx:
|
4346
|
+
blockCreated: bn17(coin.blockCreated),
|
4347
|
+
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4270
4348
|
}));
|
4271
4349
|
}
|
4272
4350
|
/**
|
@@ -4303,9 +4381,9 @@ var _Provider = class {
|
|
4303
4381
|
switch (coin.__typename) {
|
4304
4382
|
case "MessageCoin":
|
4305
4383
|
return {
|
4306
|
-
amount:
|
4384
|
+
amount: bn17(coin.amount),
|
4307
4385
|
assetId: coin.assetId,
|
4308
|
-
daHeight:
|
4386
|
+
daHeight: bn17(coin.daHeight),
|
4309
4387
|
sender: Address2.fromAddressOrString(coin.sender),
|
4310
4388
|
recipient: Address2.fromAddressOrString(coin.recipient),
|
4311
4389
|
nonce: coin.nonce
|
@@ -4313,11 +4391,11 @@ var _Provider = class {
|
|
4313
4391
|
case "Coin":
|
4314
4392
|
return {
|
4315
4393
|
id: coin.utxoId,
|
4316
|
-
amount:
|
4394
|
+
amount: bn17(coin.amount),
|
4317
4395
|
assetId: coin.assetId,
|
4318
4396
|
owner: Address2.fromAddressOrString(coin.owner),
|
4319
|
-
blockCreated:
|
4320
|
-
txCreatedIdx:
|
4397
|
+
blockCreated: bn17(coin.blockCreated),
|
4398
|
+
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4321
4399
|
};
|
4322
4400
|
default:
|
4323
4401
|
return null;
|
@@ -4334,13 +4412,13 @@ var _Provider = class {
|
|
4334
4412
|
async getBlock(idOrHeight) {
|
4335
4413
|
let variables;
|
4336
4414
|
if (typeof idOrHeight === "number") {
|
4337
|
-
variables = { height:
|
4415
|
+
variables = { height: bn17(idOrHeight).toString(10) };
|
4338
4416
|
} else if (idOrHeight === "latest") {
|
4339
4417
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4340
4418
|
} else if (idOrHeight.length === 66) {
|
4341
4419
|
variables = { blockId: idOrHeight };
|
4342
4420
|
} else {
|
4343
|
-
variables = { blockId:
|
4421
|
+
variables = { blockId: bn17(idOrHeight).toString(10) };
|
4344
4422
|
}
|
4345
4423
|
const { block } = await this.operations.getBlock(variables);
|
4346
4424
|
if (!block) {
|
@@ -4348,7 +4426,7 @@ var _Provider = class {
|
|
4348
4426
|
}
|
4349
4427
|
return {
|
4350
4428
|
id: block.id,
|
4351
|
-
height:
|
4429
|
+
height: bn17(block.height),
|
4352
4430
|
time: block.header.time,
|
4353
4431
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4354
4432
|
};
|
@@ -4363,7 +4441,7 @@ var _Provider = class {
|
|
4363
4441
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4364
4442
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4365
4443
|
id: block.id,
|
4366
|
-
height:
|
4444
|
+
height: bn17(block.height),
|
4367
4445
|
time: block.header.time,
|
4368
4446
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4369
4447
|
}));
|
@@ -4378,7 +4456,7 @@ var _Provider = class {
|
|
4378
4456
|
async getBlockWithTransactions(idOrHeight) {
|
4379
4457
|
let variables;
|
4380
4458
|
if (typeof idOrHeight === "number") {
|
4381
|
-
variables = { blockHeight:
|
4459
|
+
variables = { blockHeight: bn17(idOrHeight).toString(10) };
|
4382
4460
|
} else if (idOrHeight === "latest") {
|
4383
4461
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4384
4462
|
} else {
|
@@ -4390,7 +4468,7 @@ var _Provider = class {
|
|
4390
4468
|
}
|
4391
4469
|
return {
|
4392
4470
|
id: block.id,
|
4393
|
-
height:
|
4471
|
+
height: bn17(block.height, 10),
|
4394
4472
|
time: block.header.time,
|
4395
4473
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4396
4474
|
transactions: block.transactions.map(
|
@@ -4439,7 +4517,7 @@ var _Provider = class {
|
|
4439
4517
|
contract: Address2.fromAddressOrString(contractId).toB256(),
|
4440
4518
|
asset: hexlify12(assetId)
|
4441
4519
|
});
|
4442
|
-
return
|
4520
|
+
return bn17(contractBalance.amount, 10);
|
4443
4521
|
}
|
4444
4522
|
/**
|
4445
4523
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4453,7 +4531,7 @@ var _Provider = class {
|
|
4453
4531
|
owner: Address2.fromAddressOrString(owner).toB256(),
|
4454
4532
|
assetId: hexlify12(assetId)
|
4455
4533
|
});
|
4456
|
-
return
|
4534
|
+
return bn17(balance.amount, 10);
|
4457
4535
|
}
|
4458
4536
|
/**
|
4459
4537
|
* Returns balances for the given owner.
|
@@ -4471,7 +4549,7 @@ var _Provider = class {
|
|
4471
4549
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4472
4550
|
return balances.map((balance) => ({
|
4473
4551
|
assetId: balance.assetId,
|
4474
|
-
amount:
|
4552
|
+
amount: bn17(balance.amount)
|
4475
4553
|
}));
|
4476
4554
|
}
|
4477
4555
|
/**
|
@@ -4493,15 +4571,15 @@ var _Provider = class {
|
|
4493
4571
|
sender: message.sender,
|
4494
4572
|
recipient: message.recipient,
|
4495
4573
|
nonce: message.nonce,
|
4496
|
-
amount:
|
4574
|
+
amount: bn17(message.amount),
|
4497
4575
|
data: message.data
|
4498
4576
|
}),
|
4499
4577
|
sender: Address2.fromAddressOrString(message.sender),
|
4500
4578
|
recipient: Address2.fromAddressOrString(message.recipient),
|
4501
4579
|
nonce: message.nonce,
|
4502
|
-
amount:
|
4580
|
+
amount: bn17(message.amount),
|
4503
4581
|
data: InputMessageCoder.decodeData(message.data),
|
4504
|
-
daHeight:
|
4582
|
+
daHeight: bn17(message.daHeight)
|
4505
4583
|
}));
|
4506
4584
|
}
|
4507
4585
|
/**
|
@@ -4554,59 +4632,59 @@ var _Provider = class {
|
|
4554
4632
|
} = result.messageProof;
|
4555
4633
|
return {
|
4556
4634
|
messageProof: {
|
4557
|
-
proofIndex:
|
4635
|
+
proofIndex: bn17(messageProof.proofIndex),
|
4558
4636
|
proofSet: messageProof.proofSet
|
4559
4637
|
},
|
4560
4638
|
blockProof: {
|
4561
|
-
proofIndex:
|
4639
|
+
proofIndex: bn17(blockProof.proofIndex),
|
4562
4640
|
proofSet: blockProof.proofSet
|
4563
4641
|
},
|
4564
4642
|
messageBlockHeader: {
|
4565
4643
|
id: messageBlockHeader.id,
|
4566
|
-
daHeight:
|
4567
|
-
transactionsCount:
|
4644
|
+
daHeight: bn17(messageBlockHeader.daHeight),
|
4645
|
+
transactionsCount: Number(messageBlockHeader.transactionsCount),
|
4568
4646
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4569
|
-
height:
|
4647
|
+
height: bn17(messageBlockHeader.height),
|
4570
4648
|
prevRoot: messageBlockHeader.prevRoot,
|
4571
4649
|
time: messageBlockHeader.time,
|
4572
4650
|
applicationHash: messageBlockHeader.applicationHash,
|
4573
|
-
messageReceiptCount:
|
4651
|
+
messageReceiptCount: Number(messageBlockHeader.messageReceiptCount),
|
4574
4652
|
messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
|
4575
|
-
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
4653
|
+
consensusParametersVersion: Number(messageBlockHeader.consensusParametersVersion),
|
4576
4654
|
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
4577
|
-
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
4655
|
+
stateTransitionBytecodeVersion: Number(messageBlockHeader.stateTransitionBytecodeVersion)
|
4578
4656
|
},
|
4579
4657
|
commitBlockHeader: {
|
4580
4658
|
id: commitBlockHeader.id,
|
4581
|
-
daHeight:
|
4582
|
-
transactionsCount:
|
4659
|
+
daHeight: bn17(commitBlockHeader.daHeight),
|
4660
|
+
transactionsCount: Number(commitBlockHeader.transactionsCount),
|
4583
4661
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
4584
|
-
height:
|
4662
|
+
height: bn17(commitBlockHeader.height),
|
4585
4663
|
prevRoot: commitBlockHeader.prevRoot,
|
4586
4664
|
time: commitBlockHeader.time,
|
4587
4665
|
applicationHash: commitBlockHeader.applicationHash,
|
4588
|
-
messageReceiptCount:
|
4666
|
+
messageReceiptCount: Number(commitBlockHeader.messageReceiptCount),
|
4589
4667
|
messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
|
4590
|
-
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
4668
|
+
consensusParametersVersion: Number(commitBlockHeader.consensusParametersVersion),
|
4591
4669
|
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
4592
|
-
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
4670
|
+
stateTransitionBytecodeVersion: Number(commitBlockHeader.stateTransitionBytecodeVersion)
|
4593
4671
|
},
|
4594
4672
|
sender: Address2.fromAddressOrString(sender),
|
4595
4673
|
recipient: Address2.fromAddressOrString(recipient),
|
4596
4674
|
nonce,
|
4597
|
-
amount:
|
4675
|
+
amount: bn17(amount),
|
4598
4676
|
data
|
4599
4677
|
};
|
4600
4678
|
}
|
4601
4679
|
async getLatestGasPrice() {
|
4602
4680
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4603
|
-
return
|
4681
|
+
return bn17(latestGasPrice.gasPrice);
|
4604
4682
|
}
|
4605
4683
|
async estimateGasPrice(blockHorizon) {
|
4606
4684
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4607
4685
|
blockHorizon: String(blockHorizon)
|
4608
4686
|
});
|
4609
|
-
return
|
4687
|
+
return bn17(estimateGasPrice.gasPrice);
|
4610
4688
|
}
|
4611
4689
|
/**
|
4612
4690
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -4627,15 +4705,37 @@ var _Provider = class {
|
|
4627
4705
|
*/
|
4628
4706
|
async produceBlocks(amount, startTime) {
|
4629
4707
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4630
|
-
blocksToProduce:
|
4708
|
+
blocksToProduce: bn17(amount).toString(10),
|
4631
4709
|
startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4632
4710
|
});
|
4633
|
-
return
|
4711
|
+
return bn17(latestBlockHeight);
|
4634
4712
|
}
|
4635
4713
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4636
4714
|
async getTransactionResponse(transactionId) {
|
4637
4715
|
return new TransactionResponse(transactionId, this);
|
4638
4716
|
}
|
4717
|
+
/**
|
4718
|
+
* Returns Message for given nonce.
|
4719
|
+
*
|
4720
|
+
* @param nonce - The nonce of the message to retrieve.
|
4721
|
+
* @returns A promise that resolves to the Message object.
|
4722
|
+
*/
|
4723
|
+
async getMessageByNonce(nonce) {
|
4724
|
+
const { message } = await this.operations.getMessageByNonce({ nonce });
|
4725
|
+
if (!message) {
|
4726
|
+
return null;
|
4727
|
+
}
|
4728
|
+
return message;
|
4729
|
+
}
|
4730
|
+
async getRelayedTransactionStatus(relayedTransactionId) {
|
4731
|
+
const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
|
4732
|
+
relayedTransactionId
|
4733
|
+
});
|
4734
|
+
if (!relayedTransactionStatus) {
|
4735
|
+
return null;
|
4736
|
+
}
|
4737
|
+
return relayedTransactionStatus;
|
4738
|
+
}
|
4639
4739
|
};
|
4640
4740
|
var Provider = _Provider;
|
4641
4741
|
_cacheInputs = new WeakSet();
|
@@ -4654,7 +4754,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4654
4754
|
|
4655
4755
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4656
4756
|
import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
|
4657
|
-
import { bn as
|
4757
|
+
import { bn as bn18 } from "@fuel-ts/math";
|
4658
4758
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
4659
4759
|
import { arrayify as arrayify12 } from "@fuel-ts/utils";
|
4660
4760
|
|
@@ -4703,6 +4803,22 @@ var assets = [
|
|
4703
4803
|
}
|
4704
4804
|
];
|
4705
4805
|
|
4806
|
+
// src/providers/transaction-request/helpers.ts
|
4807
|
+
import { bn as bn19 } from "@fuel-ts/math";
|
4808
|
+
import { InputType as InputType8 } from "@fuel-ts/transactions";
|
4809
|
+
var isRequestInputCoin = (input) => input.type === InputType8.Coin;
|
4810
|
+
var isRequestInputMessage = (input) => input.type === InputType8.Message;
|
4811
|
+
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
4812
|
+
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
4813
|
+
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
4814
|
+
return acc.add(input.amount);
|
4815
|
+
}
|
4816
|
+
if (isRequestInputMessage(input) && assetId === baseAsset) {
|
4817
|
+
return acc.add(input.amount);
|
4818
|
+
}
|
4819
|
+
return acc;
|
4820
|
+
}, bn19(0));
|
4821
|
+
|
4706
4822
|
// src/utils/formatTransferToContractScriptData.ts
|
4707
4823
|
import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
|
4708
4824
|
import { BN as BN2 } from "@fuel-ts/math";
|
@@ -4740,6 +4856,7 @@ var assembleTransferToContractScript = async (params) => {
|
|
4740
4856
|
};
|
4741
4857
|
|
4742
4858
|
// src/account.ts
|
4859
|
+
var MAX_FUNDING_ATTEMPTS = 2;
|
4743
4860
|
var Account = class extends AbstractAccount {
|
4744
4861
|
/**
|
4745
4862
|
* The address associated with the account.
|
@@ -4897,16 +5014,17 @@ var Account = class extends AbstractAccount {
|
|
4897
5014
|
* Adds resources to the transaction enough to fund it.
|
4898
5015
|
*
|
4899
5016
|
* @param request - The transaction request.
|
4900
|
-
* @param
|
5017
|
+
* @param requiredQuantities - The coin quantities required to execute the transaction.
|
4901
5018
|
* @param fee - The estimated transaction fee.
|
4902
5019
|
* @returns A promise that resolves when the resources are added to the transaction.
|
4903
5020
|
*/
|
4904
5021
|
async fund(request, params) {
|
4905
5022
|
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
4906
5023
|
const baseAssetId = this.provider.getBaseAssetId();
|
5024
|
+
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn20(0);
|
4907
5025
|
const txRequest = request;
|
4908
5026
|
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
4909
|
-
amount:
|
5027
|
+
amount: bn20(fee),
|
4910
5028
|
assetId: baseAssetId,
|
4911
5029
|
coinQuantities: requiredQuantities
|
4912
5030
|
});
|
@@ -4914,21 +5032,17 @@ var Account = class extends AbstractAccount {
|
|
4914
5032
|
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
4915
5033
|
quantitiesDict[assetId] = {
|
4916
5034
|
required: amount,
|
4917
|
-
owned:
|
5035
|
+
owned: bn20(0)
|
4918
5036
|
};
|
4919
5037
|
});
|
4920
|
-
|
4921
|
-
const
|
4922
|
-
if (!isResource) {
|
4923
|
-
return;
|
4924
|
-
}
|
4925
|
-
const isCoin2 = "owner" in input;
|
5038
|
+
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
5039
|
+
const isCoin2 = isRequestInputCoin(input);
|
4926
5040
|
const assetId = isCoin2 ? String(input.assetId) : baseAssetId;
|
4927
5041
|
if (quantitiesDict[assetId]) {
|
4928
5042
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(input.amount);
|
4929
5043
|
}
|
4930
5044
|
});
|
4931
|
-
|
5045
|
+
let missingQuantities = [];
|
4932
5046
|
Object.entries(quantitiesDict).forEach(([assetId, { owned, required }]) => {
|
4933
5047
|
if (owned.lt(required)) {
|
4934
5048
|
missingQuantities.push({
|
@@ -4937,11 +5051,42 @@ var Account = class extends AbstractAccount {
|
|
4937
5051
|
});
|
4938
5052
|
}
|
4939
5053
|
});
|
4940
|
-
|
4941
|
-
|
4942
|
-
|
4943
|
-
const resources = await this.getResourcesToSpend(
|
4944
|
-
|
5054
|
+
let needsToBeFunded = missingQuantities.length > 0;
|
5055
|
+
let fundingAttempts = 0;
|
5056
|
+
while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
|
5057
|
+
const resources = await this.getResourcesToSpend(
|
5058
|
+
missingQuantities,
|
5059
|
+
cacheTxInputsFromOwner(request.inputs, this.address)
|
5060
|
+
);
|
5061
|
+
request.addResources(resources);
|
5062
|
+
txRequest.shiftPredicateData();
|
5063
|
+
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
5064
|
+
const requestToReestimate2 = clone4(txRequest);
|
5065
|
+
if (addedSignatures) {
|
5066
|
+
Array.from({ length: addedSignatures }).forEach(
|
5067
|
+
() => requestToReestimate2.addEmptyWitness()
|
5068
|
+
);
|
5069
|
+
}
|
5070
|
+
const { maxFee: newFee } = await this.provider.estimateTxGasAndFee({
|
5071
|
+
transactionRequest: requestToReestimate2
|
5072
|
+
});
|
5073
|
+
const totalBaseAssetOnInputs = getAssetAmountInRequestInputs(
|
5074
|
+
request.inputs,
|
5075
|
+
baseAssetId,
|
5076
|
+
baseAssetId
|
5077
|
+
);
|
5078
|
+
const totalBaseAssetRequiredWithFee = requiredInBaseAsset.add(newFee);
|
5079
|
+
if (totalBaseAssetOnInputs.gt(totalBaseAssetRequiredWithFee)) {
|
5080
|
+
needsToBeFunded = false;
|
5081
|
+
} else {
|
5082
|
+
missingQuantities = [
|
5083
|
+
{
|
5084
|
+
amount: totalBaseAssetRequiredWithFee.sub(totalBaseAssetOnInputs),
|
5085
|
+
assetId: baseAssetId
|
5086
|
+
}
|
5087
|
+
];
|
5088
|
+
}
|
5089
|
+
fundingAttempts += 1;
|
4945
5090
|
}
|
4946
5091
|
txRequest.shiftPredicateData();
|
4947
5092
|
txRequest.updatePredicateGasUsed(estimatedPredicates);
|
@@ -4992,7 +5137,7 @@ var Account = class extends AbstractAccount {
|
|
4992
5137
|
* @returns A promise that resolves to the transaction response.
|
4993
5138
|
*/
|
4994
5139
|
async transfer(destination, amount, assetId, txParams = {}) {
|
4995
|
-
if (
|
5140
|
+
if (bn20(amount).lte(0)) {
|
4996
5141
|
throw new FuelError15(
|
4997
5142
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
4998
5143
|
"Transfer amount must be a positive number."
|
@@ -5012,7 +5157,7 @@ var Account = class extends AbstractAccount {
|
|
5012
5157
|
* @returns A promise that resolves to the transaction response.
|
5013
5158
|
*/
|
5014
5159
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
5015
|
-
if (
|
5160
|
+
if (bn20(amount).lte(0)) {
|
5016
5161
|
throw new FuelError15(
|
5017
5162
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5018
5163
|
"Transfer amount must be a positive number."
|
@@ -5022,7 +5167,7 @@ var Account = class extends AbstractAccount {
|
|
5022
5167
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
5023
5168
|
const { script, scriptData } = await assembleTransferToContractScript({
|
5024
5169
|
hexlifiedContractId: contractAddress.toB256(),
|
5025
|
-
amountToTransfer:
|
5170
|
+
amountToTransfer: bn20(amount),
|
5026
5171
|
assetId: assetIdToTransfer
|
5027
5172
|
});
|
5028
5173
|
const request = new ScriptTransactionRequest({
|
@@ -5033,7 +5178,7 @@ var Account = class extends AbstractAccount {
|
|
5033
5178
|
request.addContractInputAndOutput(contractAddress);
|
5034
5179
|
const txCost = await this.provider.getTransactionCost(request, {
|
5035
5180
|
resourcesOwner: this,
|
5036
|
-
quantitiesToContract: [{ amount:
|
5181
|
+
quantitiesToContract: [{ amount: bn20(amount), assetId: String(assetIdToTransfer) }]
|
5037
5182
|
});
|
5038
5183
|
this.validateGasLimitAndMaxFee({
|
5039
5184
|
gasUsed: txCost.gasUsed,
|
@@ -5059,7 +5204,7 @@ var Account = class extends AbstractAccount {
|
|
5059
5204
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5060
5205
|
);
|
5061
5206
|
const amountDataArray = arrayify14(
|
5062
|
-
"0x".concat(
|
5207
|
+
"0x".concat(bn20(amount).toHex().substring(2).padStart(16, "0"))
|
5063
5208
|
);
|
5064
5209
|
const script = new Uint8Array([
|
5065
5210
|
...arrayify14(withdrawScript.bytes),
|
@@ -5069,7 +5214,7 @@ var Account = class extends AbstractAccount {
|
|
5069
5214
|
const params = { script, ...txParams };
|
5070
5215
|
const baseAssetId = this.provider.getBaseAssetId();
|
5071
5216
|
const request = new ScriptTransactionRequest(params);
|
5072
|
-
const quantitiesToContract = [{ amount:
|
5217
|
+
const quantitiesToContract = [{ amount: bn20(amount), assetId: baseAssetId }];
|
5073
5218
|
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
5074
5219
|
this.validateGasLimitAndMaxFee({
|
5075
5220
|
gasUsed: txCost.gasUsed,
|
@@ -5141,13 +5286,13 @@ var Account = class extends AbstractAccount {
|
|
5141
5286
|
gasUsed,
|
5142
5287
|
maxFee
|
5143
5288
|
}) {
|
5144
|
-
if (
|
5289
|
+
if (isDefined2(setGasLimit) && gasUsed.gt(setGasLimit)) {
|
5145
5290
|
throw new FuelError15(
|
5146
5291
|
ErrorCode15.GAS_LIMIT_TOO_LOW,
|
5147
5292
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
5148
5293
|
);
|
5149
5294
|
}
|
5150
|
-
if (
|
5295
|
+
if (isDefined2(setMaxFee) && maxFee.gt(setMaxFee)) {
|
5151
5296
|
throw new FuelError15(
|
5152
5297
|
ErrorCode15.MAX_FEE_TOO_LOW,
|
5153
5298
|
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
@@ -5479,7 +5624,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
5479
5624
|
// src/hdwallet/hdwallet.ts
|
5480
5625
|
import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
|
5481
5626
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
5482
|
-
import { bn as
|
5627
|
+
import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
5483
5628
|
import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
|
5484
5629
|
import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
|
5485
5630
|
|
@@ -7945,7 +8090,7 @@ var HDWallet = class {
|
|
7945
8090
|
const IR = bytes.slice(32);
|
7946
8091
|
if (privateKey) {
|
7947
8092
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
7948
|
-
const ki =
|
8093
|
+
const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
|
7949
8094
|
return new HDWallet({
|
7950
8095
|
privateKey: ki,
|
7951
8096
|
chainCode: IR,
|
@@ -8360,9 +8505,11 @@ var launchNode = async ({
|
|
8360
8505
|
const chainConfigWritePath = path.join(tempDirPath, "chainConfig.json");
|
8361
8506
|
const stateConfigWritePath = path.join(tempDirPath, "stateConfig.json");
|
8362
8507
|
const metadataWritePath = path.join(tempDirPath, "metadata.json");
|
8508
|
+
const stateTransitionWritePath = path.join(tempDirPath, "state_transition_bytecode.wasm");
|
8363
8509
|
writeFileSync(chainConfigWritePath, JSON.stringify(chainConfigJson), "utf8");
|
8364
8510
|
writeFileSync(stateConfigWritePath, fixedStateConfigJSON, "utf8");
|
8365
8511
|
writeFileSync(metadataWritePath, JSON.stringify(metadataJson), "utf8");
|
8512
|
+
writeFileSync(stateTransitionWritePath, JSON.stringify(""));
|
8366
8513
|
snapshotDirToUse = tempDirPath;
|
8367
8514
|
}
|
8368
8515
|
const child = spawn(
|