@fuel-ts/account 0.0.0-rc-2224-20240503155836 → 0.0.0-rc-2037-20240504194803
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/dist/index.global.js +1357 -485
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +497 -334
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +394 -240
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +9 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +186 -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 +24 -21
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts +4 -0
- package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
- package/dist/providers/transaction-request/index.d.ts +1 -0
- package/dist/providers/transaction-request/index.d.ts.map +1 -1
- 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 +4 -3
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -4
- 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 +6 -5
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/seedTestWallet.d.ts +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils.global.js +1320 -496
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +422 -326
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +334 -238
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +16 -16
- 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.js
CHANGED
@@ -64,7 +64,7 @@ var import_utils30 = require("@fuel-ts/utils");
|
|
64
64
|
var import_address4 = require("@fuel-ts/address");
|
65
65
|
var import_errors16 = require("@fuel-ts/errors");
|
66
66
|
var import_interfaces = require("@fuel-ts/interfaces");
|
67
|
-
var
|
67
|
+
var import_math21 = require("@fuel-ts/math");
|
68
68
|
var import_utils27 = require("@fuel-ts/utils");
|
69
69
|
var import_ramda4 = require("ramda");
|
70
70
|
|
@@ -106,8 +106,8 @@ var addAmountToCoinQuantities = (params) => {
|
|
106
106
|
// src/providers/provider.ts
|
107
107
|
var import_address3 = require("@fuel-ts/address");
|
108
108
|
var import_errors14 = require("@fuel-ts/errors");
|
109
|
-
var
|
110
|
-
var
|
109
|
+
var import_math18 = require("@fuel-ts/math");
|
110
|
+
var import_transactions20 = require("@fuel-ts/transactions");
|
111
111
|
var import_utils22 = require("@fuel-ts/utils");
|
112
112
|
var import_versions = require("@fuel-ts/versions");
|
113
113
|
var import_utils23 = require("@noble/curves/abstract/utils");
|
@@ -167,9 +167,6 @@ var TransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
|
|
167
167
|
id
|
168
168
|
}
|
169
169
|
time
|
170
|
-
receipts {
|
171
|
-
...receiptFragment
|
172
|
-
}
|
173
170
|
programState {
|
174
171
|
returnType
|
175
172
|
data
|
@@ -177,11 +174,15 @@ var TransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
|
|
177
174
|
receipts {
|
178
175
|
...receiptFragment
|
179
176
|
}
|
177
|
+
totalGas
|
178
|
+
totalFee
|
180
179
|
}
|
181
180
|
... on FailureStatus {
|
182
181
|
block {
|
183
182
|
id
|
184
183
|
}
|
184
|
+
totalGas
|
185
|
+
totalFee
|
185
186
|
time
|
186
187
|
reason
|
187
188
|
receipts {
|
@@ -221,6 +222,8 @@ var TransactionEstimatePredicatesFragmentFragmentDoc = import_graphql_tag.defaul
|
|
221
222
|
${InputEstimatePredicatesFragmentFragmentDoc}`;
|
222
223
|
var DryRunFailureStatusFragmentFragmentDoc = import_graphql_tag.default`
|
223
224
|
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
225
|
+
totalGas
|
226
|
+
totalFee
|
224
227
|
reason
|
225
228
|
programState {
|
226
229
|
returnType
|
@@ -230,6 +233,8 @@ var DryRunFailureStatusFragmentFragmentDoc = import_graphql_tag.default`
|
|
230
233
|
`;
|
231
234
|
var DryRunSuccessStatusFragmentFragmentDoc = import_graphql_tag.default`
|
232
235
|
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
236
|
+
totalGas
|
237
|
+
totalFee
|
233
238
|
programState {
|
234
239
|
returnType
|
235
240
|
data
|
@@ -365,6 +370,7 @@ var TxParametersFragmentFragmentDoc = import_graphql_tag.default`
|
|
365
370
|
maxWitnesses
|
366
371
|
maxGasPerTx
|
367
372
|
maxSize
|
373
|
+
maxBytecodeSubsections
|
368
374
|
}
|
369
375
|
`;
|
370
376
|
var PredicateParametersFragmentFragmentDoc = import_graphql_tag.default`
|
@@ -634,6 +640,14 @@ var NodeInfoFragmentFragmentDoc = import_graphql_tag.default`
|
|
634
640
|
nodeVersion
|
635
641
|
}
|
636
642
|
`;
|
643
|
+
var RelayedTransactionStatusFragmentFragmentDoc = import_graphql_tag.default`
|
644
|
+
fragment relayedTransactionStatusFragment on RelayedTransactionStatus {
|
645
|
+
... on RelayedTransactionFailed {
|
646
|
+
blockHeight
|
647
|
+
failure
|
648
|
+
}
|
649
|
+
}
|
650
|
+
`;
|
637
651
|
var GetVersionDocument = import_graphql_tag.default`
|
638
652
|
query getVersion {
|
639
653
|
nodeInfo {
|
@@ -863,6 +877,13 @@ var GetMessageStatusDocument = import_graphql_tag.default`
|
|
863
877
|
}
|
864
878
|
}
|
865
879
|
`;
|
880
|
+
var GetRelayedTransactionStatusDocument = import_graphql_tag.default`
|
881
|
+
query getRelayedTransactionStatus($relayedTransactionId: RelayedTransactionId!) {
|
882
|
+
relayedTransactionStatus(id: $relayedTransactionId) {
|
883
|
+
...relayedTransactionStatusFragment
|
884
|
+
}
|
885
|
+
}
|
886
|
+
${RelayedTransactionStatusFragmentFragmentDoc}`;
|
866
887
|
var DryRunDocument = import_graphql_tag.default`
|
867
888
|
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
|
868
889
|
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
|
@@ -977,6 +998,9 @@ function getSdk(requester) {
|
|
977
998
|
getMessageStatus(variables, options) {
|
978
999
|
return requester(GetMessageStatusDocument, variables, options);
|
979
1000
|
},
|
1001
|
+
getRelayedTransactionStatus(variables, options) {
|
1002
|
+
return requester(GetRelayedTransactionStatusDocument, variables, options);
|
1003
|
+
},
|
980
1004
|
dryRun(variables, options) {
|
981
1005
|
return requester(DryRunDocument, variables, options);
|
982
1006
|
},
|
@@ -1273,8 +1297,8 @@ var import_abi_coder2 = require("@fuel-ts/abi-coder");
|
|
1273
1297
|
var import_address = require("@fuel-ts/address");
|
1274
1298
|
var import_configs6 = require("@fuel-ts/address/configs");
|
1275
1299
|
var import_crypto = require("@fuel-ts/crypto");
|
1276
|
-
var
|
1277
|
-
var
|
1300
|
+
var import_math8 = require("@fuel-ts/math");
|
1301
|
+
var import_transactions7 = require("@fuel-ts/transactions");
|
1278
1302
|
var import_utils9 = require("@fuel-ts/utils");
|
1279
1303
|
|
1280
1304
|
// src/providers/resource.ts
|
@@ -1708,6 +1732,36 @@ var NoWitnessAtIndexError = class extends Error {
|
|
1708
1732
|
name = "NoWitnessAtIndexError";
|
1709
1733
|
};
|
1710
1734
|
|
1735
|
+
// src/providers/transaction-request/helpers.ts
|
1736
|
+
var import_math7 = require("@fuel-ts/math");
|
1737
|
+
var import_transactions6 = require("@fuel-ts/transactions");
|
1738
|
+
var isRequestInputCoin = (input) => input.type === import_transactions6.InputType.Coin;
|
1739
|
+
var isRequestInputMessage = (input) => input.type === import_transactions6.InputType.Message;
|
1740
|
+
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
1741
|
+
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
1742
|
+
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
1743
|
+
return acc.add(input.amount);
|
1744
|
+
}
|
1745
|
+
if (isRequestInputMessage(input) && assetId === baseAsset) {
|
1746
|
+
return acc.add(input.amount);
|
1747
|
+
}
|
1748
|
+
return acc;
|
1749
|
+
}, (0, import_math7.bn)(0));
|
1750
|
+
var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
|
1751
|
+
(acc, input) => {
|
1752
|
+
if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
|
1753
|
+
acc.utxos.push(input.id);
|
1754
|
+
} else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
|
1755
|
+
acc.messages.push(input.nonce);
|
1756
|
+
}
|
1757
|
+
return acc;
|
1758
|
+
},
|
1759
|
+
{
|
1760
|
+
utxos: [],
|
1761
|
+
messages: []
|
1762
|
+
}
|
1763
|
+
);
|
1764
|
+
|
1711
1765
|
// src/providers/transaction-request/witness.ts
|
1712
1766
|
var import_utils8 = require("@fuel-ts/utils");
|
1713
1767
|
var witnessify = (value) => {
|
@@ -1748,10 +1802,10 @@ var BaseTransactionRequest = class {
|
|
1748
1802
|
outputs,
|
1749
1803
|
witnesses
|
1750
1804
|
} = {}) {
|
1751
|
-
this.tip = tip ? (0,
|
1805
|
+
this.tip = tip ? (0, import_math8.bn)(tip) : void 0;
|
1752
1806
|
this.maturity = maturity && maturity > 0 ? maturity : void 0;
|
1753
|
-
this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0,
|
1754
|
-
this.maxFee = (0,
|
1807
|
+
this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math8.bn)(witnessLimit) : void 0;
|
1808
|
+
this.maxFee = (0, import_math8.bn)(maxFee);
|
1755
1809
|
this.inputs = inputs ?? [];
|
1756
1810
|
this.outputs = outputs ?? [];
|
1757
1811
|
this.witnesses = witnesses ?? [];
|
@@ -1760,20 +1814,20 @@ var BaseTransactionRequest = class {
|
|
1760
1814
|
let policyTypes = 0;
|
1761
1815
|
const policies = [];
|
1762
1816
|
const { tip, witnessLimit, maturity } = req;
|
1763
|
-
if ((0,
|
1764
|
-
policyTypes +=
|
1765
|
-
policies.push({ data: (0,
|
1817
|
+
if ((0, import_math8.bn)(tip).gt(0)) {
|
1818
|
+
policyTypes += import_transactions7.PolicyType.Tip;
|
1819
|
+
policies.push({ data: (0, import_math8.bn)(tip), type: import_transactions7.PolicyType.Tip });
|
1766
1820
|
}
|
1767
|
-
if ((0, import_utils9.isDefined)(witnessLimit) && (0,
|
1768
|
-
policyTypes +=
|
1769
|
-
policies.push({ data: (0,
|
1821
|
+
if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math8.bn)(witnessLimit).gte(0)) {
|
1822
|
+
policyTypes += import_transactions7.PolicyType.WitnessLimit;
|
1823
|
+
policies.push({ data: (0, import_math8.bn)(witnessLimit), type: import_transactions7.PolicyType.WitnessLimit });
|
1770
1824
|
}
|
1771
1825
|
if (maturity && maturity > 0) {
|
1772
|
-
policyTypes +=
|
1773
|
-
policies.push({ data: maturity, type:
|
1826
|
+
policyTypes += import_transactions7.PolicyType.Maturity;
|
1827
|
+
policies.push({ data: maturity, type: import_transactions7.PolicyType.Maturity });
|
1774
1828
|
}
|
1775
|
-
policyTypes +=
|
1776
|
-
policies.push({ data: req.maxFee, type:
|
1829
|
+
policyTypes += import_transactions7.PolicyType.MaxFee;
|
1830
|
+
policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
|
1777
1831
|
return {
|
1778
1832
|
policyTypes,
|
1779
1833
|
policies
|
@@ -1806,7 +1860,7 @@ var BaseTransactionRequest = class {
|
|
1806
1860
|
* @returns The transaction bytes.
|
1807
1861
|
*/
|
1808
1862
|
toTransactionBytes() {
|
1809
|
-
return new
|
1863
|
+
return new import_transactions7.TransactionCoder().encode(this.toTransaction());
|
1810
1864
|
}
|
1811
1865
|
/**
|
1812
1866
|
* @hidden
|
@@ -1897,7 +1951,7 @@ var BaseTransactionRequest = class {
|
|
1897
1951
|
*/
|
1898
1952
|
getCoinInputs() {
|
1899
1953
|
return this.inputs.filter(
|
1900
|
-
(input) => input.type ===
|
1954
|
+
(input) => input.type === import_transactions7.InputType.Coin
|
1901
1955
|
);
|
1902
1956
|
}
|
1903
1957
|
/**
|
@@ -1907,7 +1961,7 @@ var BaseTransactionRequest = class {
|
|
1907
1961
|
*/
|
1908
1962
|
getCoinOutputs() {
|
1909
1963
|
return this.outputs.filter(
|
1910
|
-
(output) => output.type ===
|
1964
|
+
(output) => output.type === import_transactions7.OutputType.Coin
|
1911
1965
|
);
|
1912
1966
|
}
|
1913
1967
|
/**
|
@@ -1917,7 +1971,7 @@ var BaseTransactionRequest = class {
|
|
1917
1971
|
*/
|
1918
1972
|
getChangeOutputs() {
|
1919
1973
|
return this.outputs.filter(
|
1920
|
-
(output) => output.type ===
|
1974
|
+
(output) => output.type === import_transactions7.OutputType.Change
|
1921
1975
|
);
|
1922
1976
|
}
|
1923
1977
|
/**
|
@@ -1929,9 +1983,9 @@ var BaseTransactionRequest = class {
|
|
1929
1983
|
const ownerAddress = (0, import_address.addressify)(owner);
|
1930
1984
|
const found = this.inputs.find((input) => {
|
1931
1985
|
switch (input.type) {
|
1932
|
-
case
|
1986
|
+
case import_transactions7.InputType.Coin:
|
1933
1987
|
return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
|
1934
|
-
case
|
1988
|
+
case import_transactions7.InputType.Message:
|
1935
1989
|
return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
|
1936
1990
|
default:
|
1937
1991
|
return false;
|
@@ -1946,7 +2000,7 @@ var BaseTransactionRequest = class {
|
|
1946
2000
|
* @param coin - Coin resource.
|
1947
2001
|
*/
|
1948
2002
|
addCoinInput(coin) {
|
1949
|
-
const { assetId, owner, amount } = coin;
|
2003
|
+
const { assetId, owner, amount, id, predicate } = coin;
|
1950
2004
|
let witnessIndex;
|
1951
2005
|
if (coin.predicate) {
|
1952
2006
|
witnessIndex = 0;
|
@@ -1957,13 +2011,14 @@ var BaseTransactionRequest = class {
|
|
1957
2011
|
}
|
1958
2012
|
}
|
1959
2013
|
const input = {
|
1960
|
-
|
1961
|
-
type:
|
2014
|
+
id,
|
2015
|
+
type: import_transactions7.InputType.Coin,
|
1962
2016
|
owner: owner.toB256(),
|
1963
2017
|
amount,
|
1964
2018
|
assetId,
|
1965
2019
|
txPointer: "0x00000000000000000000000000000000",
|
1966
|
-
witnessIndex
|
2020
|
+
witnessIndex,
|
2021
|
+
predicate
|
1967
2022
|
};
|
1968
2023
|
this.pushInput(input);
|
1969
2024
|
this.addChangeOutput(owner, assetId);
|
@@ -1975,7 +2030,7 @@ var BaseTransactionRequest = class {
|
|
1975
2030
|
* @param message - Message resource.
|
1976
2031
|
*/
|
1977
2032
|
addMessageInput(message) {
|
1978
|
-
const { recipient, sender, amount, assetId } = message;
|
2033
|
+
const { recipient, sender, amount, predicate, nonce, assetId } = message;
|
1979
2034
|
let witnessIndex;
|
1980
2035
|
if (message.predicate) {
|
1981
2036
|
witnessIndex = 0;
|
@@ -1986,12 +2041,13 @@ var BaseTransactionRequest = class {
|
|
1986
2041
|
}
|
1987
2042
|
}
|
1988
2043
|
const input = {
|
1989
|
-
|
1990
|
-
type:
|
2044
|
+
nonce,
|
2045
|
+
type: import_transactions7.InputType.Message,
|
1991
2046
|
sender: sender.toB256(),
|
1992
2047
|
recipient: recipient.toB256(),
|
1993
2048
|
amount,
|
1994
|
-
witnessIndex
|
2049
|
+
witnessIndex,
|
2050
|
+
predicate
|
1995
2051
|
};
|
1996
2052
|
this.pushInput(input);
|
1997
2053
|
this.addChangeOutput(recipient, assetId);
|
@@ -2031,7 +2087,7 @@ var BaseTransactionRequest = class {
|
|
2031
2087
|
*/
|
2032
2088
|
addCoinOutput(to, amount, assetId) {
|
2033
2089
|
this.pushOutput({
|
2034
|
-
type:
|
2090
|
+
type: import_transactions7.OutputType.Coin,
|
2035
2091
|
to: (0, import_address.addressify)(to).toB256(),
|
2036
2092
|
amount,
|
2037
2093
|
assetId
|
@@ -2047,7 +2103,7 @@ var BaseTransactionRequest = class {
|
|
2047
2103
|
addCoinOutputs(to, quantities) {
|
2048
2104
|
quantities.map(coinQuantityfy).forEach((quantity) => {
|
2049
2105
|
this.pushOutput({
|
2050
|
-
type:
|
2106
|
+
type: import_transactions7.OutputType.Coin,
|
2051
2107
|
to: (0, import_address.addressify)(to).toB256(),
|
2052
2108
|
amount: quantity.amount,
|
2053
2109
|
assetId: quantity.assetId
|
@@ -2067,7 +2123,7 @@ var BaseTransactionRequest = class {
|
|
2067
2123
|
);
|
2068
2124
|
if (!changeOutput) {
|
2069
2125
|
this.pushOutput({
|
2070
|
-
type:
|
2126
|
+
type: import_transactions7.OutputType.Change,
|
2071
2127
|
to: (0, import_address.addressify)(to).toB256(),
|
2072
2128
|
assetId
|
2073
2129
|
});
|
@@ -2089,8 +2145,11 @@ var BaseTransactionRequest = class {
|
|
2089
2145
|
* @hidden
|
2090
2146
|
*/
|
2091
2147
|
calculateMinGas(chainInfo) {
|
2092
|
-
const {
|
2093
|
-
const {
|
2148
|
+
const { consensusParameters } = chainInfo;
|
2149
|
+
const {
|
2150
|
+
gasCosts,
|
2151
|
+
feeParameters: { gasPerByte }
|
2152
|
+
} = consensusParameters;
|
2094
2153
|
return getMinGas({
|
2095
2154
|
gasPerByte,
|
2096
2155
|
gasCosts,
|
@@ -2101,7 +2160,10 @@ var BaseTransactionRequest = class {
|
|
2101
2160
|
}
|
2102
2161
|
calculateMaxGas(chainInfo, minGas) {
|
2103
2162
|
const { consensusParameters } = chainInfo;
|
2104
|
-
const {
|
2163
|
+
const {
|
2164
|
+
feeParameters: { gasPerByte },
|
2165
|
+
txParameters: { maxGasPerTx }
|
2166
|
+
} = consensusParameters;
|
2105
2167
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2106
2168
|
(acc, wit) => acc + wit.dataLength,
|
2107
2169
|
0
|
@@ -2132,7 +2194,7 @@ var BaseTransactionRequest = class {
|
|
2132
2194
|
const assetInput = findAssetInput(assetId);
|
2133
2195
|
let usedQuantity = quantity;
|
2134
2196
|
if (assetId === baseAssetId) {
|
2135
|
-
usedQuantity = (0,
|
2197
|
+
usedQuantity = (0, import_math8.bn)("1000000000000000000");
|
2136
2198
|
}
|
2137
2199
|
if (assetInput && "assetId" in assetInput) {
|
2138
2200
|
assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
|
@@ -2144,13 +2206,13 @@ var BaseTransactionRequest = class {
|
|
2144
2206
|
amount: usedQuantity,
|
2145
2207
|
assetId,
|
2146
2208
|
owner: resourcesOwner || import_address.Address.fromRandom(),
|
2147
|
-
blockCreated: (0,
|
2148
|
-
txCreatedIdx: (0,
|
2209
|
+
blockCreated: (0, import_math8.bn)(1),
|
2210
|
+
txCreatedIdx: (0, import_math8.bn)(1)
|
2149
2211
|
}
|
2150
2212
|
]);
|
2151
2213
|
}
|
2152
2214
|
};
|
2153
|
-
updateAssetInput(baseAssetId, (0,
|
2215
|
+
updateAssetInput(baseAssetId, (0, import_math8.bn)(1e11));
|
2154
2216
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
2155
2217
|
}
|
2156
2218
|
/**
|
@@ -2161,7 +2223,7 @@ var BaseTransactionRequest = class {
|
|
2161
2223
|
*/
|
2162
2224
|
getCoinOutputsQuantities() {
|
2163
2225
|
const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
|
2164
|
-
amount: (0,
|
2226
|
+
amount: (0, import_math8.bn)(amount),
|
2165
2227
|
assetId: assetId.toString()
|
2166
2228
|
}));
|
2167
2229
|
return coinsQuantities;
|
@@ -2175,22 +2237,33 @@ var BaseTransactionRequest = class {
|
|
2175
2237
|
toJSON() {
|
2176
2238
|
return normalizeJSON(this);
|
2177
2239
|
}
|
2240
|
+
removeWitness(index) {
|
2241
|
+
this.witnesses.splice(index, 1);
|
2242
|
+
this.adjustWitnessIndexes(index);
|
2243
|
+
}
|
2244
|
+
adjustWitnessIndexes(removedIndex) {
|
2245
|
+
this.inputs.filter(isRequestInputResource).forEach((input) => {
|
2246
|
+
if (input.witnessIndex > removedIndex) {
|
2247
|
+
input.witnessIndex -= 1;
|
2248
|
+
}
|
2249
|
+
});
|
2250
|
+
}
|
2178
2251
|
updatePredicateGasUsed(inputs) {
|
2179
2252
|
this.inputs.forEach((i) => {
|
2180
2253
|
let correspondingInput;
|
2181
2254
|
switch (i.type) {
|
2182
|
-
case
|
2183
|
-
correspondingInput = inputs.find((x) => x.type ===
|
2255
|
+
case import_transactions7.InputType.Coin:
|
2256
|
+
correspondingInput = inputs.find((x) => x.type === import_transactions7.InputType.Coin && x.owner === i.owner);
|
2184
2257
|
break;
|
2185
|
-
case
|
2258
|
+
case import_transactions7.InputType.Message:
|
2186
2259
|
correspondingInput = inputs.find(
|
2187
|
-
(x) => x.type ===
|
2260
|
+
(x) => x.type === import_transactions7.InputType.Message && x.sender === i.sender
|
2188
2261
|
);
|
2189
2262
|
break;
|
2190
2263
|
default:
|
2191
2264
|
return;
|
2192
2265
|
}
|
2193
|
-
if (correspondingInput && "predicateGasUsed" in correspondingInput && (0,
|
2266
|
+
if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math8.bn)(correspondingInput.predicateGasUsed).gt(0)) {
|
2194
2267
|
i.predicate = correspondingInput.predicate;
|
2195
2268
|
i.predicateData = correspondingInput.predicateData;
|
2196
2269
|
i.predicateGasUsed = correspondingInput.predicateGasUsed;
|
@@ -2210,38 +2283,38 @@ var BaseTransactionRequest = class {
|
|
2210
2283
|
|
2211
2284
|
// src/providers/transaction-request/create-transaction-request.ts
|
2212
2285
|
var import_configs8 = require("@fuel-ts/address/configs");
|
2213
|
-
var
|
2214
|
-
var
|
2286
|
+
var import_math10 = require("@fuel-ts/math");
|
2287
|
+
var import_transactions9 = require("@fuel-ts/transactions");
|
2215
2288
|
var import_utils13 = require("@fuel-ts/utils");
|
2216
2289
|
|
2217
2290
|
// src/providers/transaction-request/hash-transaction.ts
|
2218
2291
|
var import_configs7 = require("@fuel-ts/address/configs");
|
2219
2292
|
var import_hasher = require("@fuel-ts/hasher");
|
2220
|
-
var
|
2221
|
-
var
|
2293
|
+
var import_math9 = require("@fuel-ts/math");
|
2294
|
+
var import_transactions8 = require("@fuel-ts/transactions");
|
2222
2295
|
var import_utils11 = require("@fuel-ts/utils");
|
2223
2296
|
var import_ramda2 = require("ramda");
|
2224
2297
|
function hashTransaction(transactionRequest, chainId) {
|
2225
2298
|
const transaction = transactionRequest.toTransaction();
|
2226
|
-
if (transaction.type ===
|
2299
|
+
if (transaction.type === import_transactions8.TransactionType.Script) {
|
2227
2300
|
transaction.receiptsRoot = import_configs7.ZeroBytes32;
|
2228
2301
|
}
|
2229
2302
|
transaction.inputs = transaction.inputs.map((input) => {
|
2230
2303
|
const inputClone = (0, import_ramda2.clone)(input);
|
2231
2304
|
switch (inputClone.type) {
|
2232
|
-
case
|
2305
|
+
case import_transactions8.InputType.Coin: {
|
2233
2306
|
inputClone.txPointer = {
|
2234
2307
|
blockHeight: 0,
|
2235
2308
|
txIndex: 0
|
2236
2309
|
};
|
2237
|
-
inputClone.predicateGasUsed = (0,
|
2310
|
+
inputClone.predicateGasUsed = (0, import_math9.bn)(0);
|
2238
2311
|
return inputClone;
|
2239
2312
|
}
|
2240
|
-
case
|
2241
|
-
inputClone.predicateGasUsed = (0,
|
2313
|
+
case import_transactions8.InputType.Message: {
|
2314
|
+
inputClone.predicateGasUsed = (0, import_math9.bn)(0);
|
2242
2315
|
return inputClone;
|
2243
2316
|
}
|
2244
|
-
case
|
2317
|
+
case import_transactions8.InputType.Contract: {
|
2245
2318
|
inputClone.txPointer = {
|
2246
2319
|
blockHeight: 0,
|
2247
2320
|
txIndex: 0
|
@@ -2259,18 +2332,18 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2259
2332
|
transaction.outputs = transaction.outputs.map((output) => {
|
2260
2333
|
const outputClone = (0, import_ramda2.clone)(output);
|
2261
2334
|
switch (outputClone.type) {
|
2262
|
-
case
|
2335
|
+
case import_transactions8.OutputType.Contract: {
|
2263
2336
|
outputClone.balanceRoot = import_configs7.ZeroBytes32;
|
2264
2337
|
outputClone.stateRoot = import_configs7.ZeroBytes32;
|
2265
2338
|
return outputClone;
|
2266
2339
|
}
|
2267
|
-
case
|
2268
|
-
outputClone.amount = (0,
|
2340
|
+
case import_transactions8.OutputType.Change: {
|
2341
|
+
outputClone.amount = (0, import_math9.bn)(0);
|
2269
2342
|
return outputClone;
|
2270
2343
|
}
|
2271
|
-
case
|
2344
|
+
case import_transactions8.OutputType.Variable: {
|
2272
2345
|
outputClone.to = import_configs7.ZeroBytes32;
|
2273
|
-
outputClone.amount = (0,
|
2346
|
+
outputClone.amount = (0, import_math9.bn)(0);
|
2274
2347
|
outputClone.assetId = import_configs7.ZeroBytes32;
|
2275
2348
|
return outputClone;
|
2276
2349
|
}
|
@@ -2281,7 +2354,7 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2281
2354
|
transaction.witnessesCount = 0;
|
2282
2355
|
transaction.witnesses = [];
|
2283
2356
|
const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
|
2284
|
-
const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new
|
2357
|
+
const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions8.TransactionCoder().encode(transaction)]);
|
2285
2358
|
return (0, import_hasher.sha256)(concatenatedData);
|
2286
2359
|
}
|
2287
2360
|
|
@@ -2317,7 +2390,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2317
2390
|
return new this(obj);
|
2318
2391
|
}
|
2319
2392
|
/** Type of the transaction */
|
2320
|
-
type =
|
2393
|
+
type = import_transactions9.TransactionType.Create;
|
2321
2394
|
/** Witness index of contract bytecode to create */
|
2322
2395
|
bytecodeWitnessIndex;
|
2323
2396
|
/** Salt */
|
@@ -2345,10 +2418,10 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2345
2418
|
const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
|
2346
2419
|
const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
|
2347
2420
|
return {
|
2348
|
-
type:
|
2421
|
+
type: import_transactions9.TransactionType.Create,
|
2349
2422
|
...baseTransaction,
|
2350
2423
|
bytecodeWitnessIndex,
|
2351
|
-
storageSlotsCount: (0,
|
2424
|
+
storageSlotsCount: (0, import_math10.bn)(storageSlots.length),
|
2352
2425
|
salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
|
2353
2426
|
storageSlots
|
2354
2427
|
};
|
@@ -2360,7 +2433,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2360
2433
|
*/
|
2361
2434
|
getContractCreatedOutputs() {
|
2362
2435
|
return this.outputs.filter(
|
2363
|
-
(output) => output.type ===
|
2436
|
+
(output) => output.type === import_transactions9.OutputType.ContractCreated
|
2364
2437
|
);
|
2365
2438
|
}
|
2366
2439
|
/**
|
@@ -2381,14 +2454,14 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2381
2454
|
*/
|
2382
2455
|
addContractCreatedOutput(contractId, stateRoot) {
|
2383
2456
|
this.pushOutput({
|
2384
|
-
type:
|
2457
|
+
type: import_transactions9.OutputType.ContractCreated,
|
2385
2458
|
contractId,
|
2386
2459
|
stateRoot
|
2387
2460
|
});
|
2388
2461
|
}
|
2389
2462
|
metadataGas(gasCosts) {
|
2390
2463
|
return calculateMetadataGasForTxCreate({
|
2391
|
-
contractBytesSize: (0,
|
2464
|
+
contractBytesSize: (0, import_math10.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
|
2392
2465
|
gasCosts,
|
2393
2466
|
stateRootSize: this.storageSlots.length,
|
2394
2467
|
txBytesSize: this.byteSize()
|
@@ -2400,8 +2473,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2400
2473
|
var import_abi_coder3 = require("@fuel-ts/abi-coder");
|
2401
2474
|
var import_address2 = require("@fuel-ts/address");
|
2402
2475
|
var import_configs9 = require("@fuel-ts/address/configs");
|
2403
|
-
var
|
2404
|
-
var
|
2476
|
+
var import_math11 = require("@fuel-ts/math");
|
2477
|
+
var import_transactions10 = require("@fuel-ts/transactions");
|
2405
2478
|
var import_utils15 = require("@fuel-ts/utils");
|
2406
2479
|
|
2407
2480
|
// src/providers/transaction-request/scripts.ts
|
@@ -2439,7 +2512,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2439
2512
|
return new this(obj);
|
2440
2513
|
}
|
2441
2514
|
/** Type of the transaction */
|
2442
|
-
type =
|
2515
|
+
type = import_transactions10.TransactionType.Script;
|
2443
2516
|
/** Gas limit for transaction */
|
2444
2517
|
gasLimit;
|
2445
2518
|
/** Script to execute */
|
@@ -2454,7 +2527,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2454
2527
|
*/
|
2455
2528
|
constructor({ script, scriptData, gasLimit, ...rest } = {}) {
|
2456
2529
|
super(rest);
|
2457
|
-
this.gasLimit = (0,
|
2530
|
+
this.gasLimit = (0, import_math11.bn)(gasLimit);
|
2458
2531
|
this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
|
2459
2532
|
this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
|
2460
2533
|
this.abis = rest.abis;
|
@@ -2468,11 +2541,11 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2468
2541
|
const script = (0, import_utils15.arrayify)(this.script ?? "0x");
|
2469
2542
|
const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
|
2470
2543
|
return {
|
2471
|
-
type:
|
2544
|
+
type: import_transactions10.TransactionType.Script,
|
2472
2545
|
scriptGasLimit: this.gasLimit,
|
2473
2546
|
...super.getBaseTransaction(),
|
2474
|
-
scriptLength: (0,
|
2475
|
-
scriptDataLength: (0,
|
2547
|
+
scriptLength: (0, import_math11.bn)(script.length),
|
2548
|
+
scriptDataLength: (0, import_math11.bn)(scriptData.length),
|
2476
2549
|
receiptsRoot: import_configs9.ZeroBytes32,
|
2477
2550
|
script: (0, import_utils15.hexlify)(script),
|
2478
2551
|
scriptData: (0, import_utils15.hexlify)(scriptData)
|
@@ -2485,7 +2558,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2485
2558
|
*/
|
2486
2559
|
getContractInputs() {
|
2487
2560
|
return this.inputs.filter(
|
2488
|
-
(input) => input.type ===
|
2561
|
+
(input) => input.type === import_transactions10.InputType.Contract
|
2489
2562
|
);
|
2490
2563
|
}
|
2491
2564
|
/**
|
@@ -2495,7 +2568,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2495
2568
|
*/
|
2496
2569
|
getContractOutputs() {
|
2497
2570
|
return this.outputs.filter(
|
2498
|
-
(output) => output.type ===
|
2571
|
+
(output) => output.type === import_transactions10.OutputType.Contract
|
2499
2572
|
);
|
2500
2573
|
}
|
2501
2574
|
/**
|
@@ -2505,7 +2578,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2505
2578
|
*/
|
2506
2579
|
getVariableOutputs() {
|
2507
2580
|
return this.outputs.filter(
|
2508
|
-
(output) => output.type ===
|
2581
|
+
(output) => output.type === import_transactions10.OutputType.Variable
|
2509
2582
|
);
|
2510
2583
|
}
|
2511
2584
|
/**
|
@@ -2528,7 +2601,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2528
2601
|
let outputsNumber = numberOfVariables;
|
2529
2602
|
while (outputsNumber) {
|
2530
2603
|
this.pushOutput({
|
2531
|
-
type:
|
2604
|
+
type: import_transactions10.OutputType.Variable
|
2532
2605
|
});
|
2533
2606
|
outputsNumber -= 1;
|
2534
2607
|
}
|
@@ -2536,7 +2609,10 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2536
2609
|
}
|
2537
2610
|
calculateMaxGas(chainInfo, minGas) {
|
2538
2611
|
const { consensusParameters } = chainInfo;
|
2539
|
-
const {
|
2612
|
+
const {
|
2613
|
+
feeParameters: { gasPerByte },
|
2614
|
+
txParameters: { maxGasPerTx }
|
2615
|
+
} = consensusParameters;
|
2540
2616
|
const witnessesLength = this.toTransaction().witnesses.reduce(
|
2541
2617
|
(acc, wit) => acc + wit.dataLength,
|
2542
2618
|
0
|
@@ -2562,12 +2638,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2562
2638
|
return this;
|
2563
2639
|
}
|
2564
2640
|
const inputIndex = super.pushInput({
|
2565
|
-
type:
|
2641
|
+
type: import_transactions10.InputType.Contract,
|
2566
2642
|
contractId: contractAddress.toB256(),
|
2567
2643
|
txPointer: "0x00000000000000000000000000000000"
|
2568
2644
|
});
|
2569
2645
|
this.pushOutput({
|
2570
|
-
type:
|
2646
|
+
type: import_transactions10.OutputType.Contract,
|
2571
2647
|
inputIndex
|
2572
2648
|
});
|
2573
2649
|
return this;
|
@@ -2604,17 +2680,17 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2604
2680
|
|
2605
2681
|
// src/providers/transaction-request/utils.ts
|
2606
2682
|
var import_errors9 = require("@fuel-ts/errors");
|
2607
|
-
var
|
2683
|
+
var import_transactions11 = require("@fuel-ts/transactions");
|
2608
2684
|
var transactionRequestify = (obj) => {
|
2609
2685
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
|
2610
2686
|
return obj;
|
2611
2687
|
}
|
2612
2688
|
const { type } = obj;
|
2613
2689
|
switch (obj.type) {
|
2614
|
-
case
|
2690
|
+
case import_transactions11.TransactionType.Script: {
|
2615
2691
|
return ScriptTransactionRequest.from(obj);
|
2616
2692
|
}
|
2617
|
-
case
|
2693
|
+
case import_transactions11.TransactionType.Create: {
|
2618
2694
|
return CreateTransactionRequest.from(obj);
|
2619
2695
|
}
|
2620
2696
|
default: {
|
@@ -2622,61 +2698,46 @@ var transactionRequestify = (obj) => {
|
|
2622
2698
|
}
|
2623
2699
|
}
|
2624
2700
|
};
|
2625
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
2626
|
-
(acc, input) => {
|
2627
|
-
if (input.type === import_transactions10.InputType.Coin && input.owner === owner.toB256()) {
|
2628
|
-
acc.utxos.push(input.id);
|
2629
|
-
}
|
2630
|
-
if (input.type === import_transactions10.InputType.Message && input.recipient === owner.toB256()) {
|
2631
|
-
acc.messages.push(input.nonce);
|
2632
|
-
}
|
2633
|
-
return acc;
|
2634
|
-
},
|
2635
|
-
{
|
2636
|
-
utxos: [],
|
2637
|
-
messages: []
|
2638
|
-
}
|
2639
|
-
);
|
2640
2701
|
|
2641
2702
|
// src/providers/transaction-response/transaction-response.ts
|
2642
2703
|
var import_errors13 = require("@fuel-ts/errors");
|
2643
|
-
var
|
2644
|
-
var
|
2704
|
+
var import_math17 = require("@fuel-ts/math");
|
2705
|
+
var import_transactions19 = require("@fuel-ts/transactions");
|
2645
2706
|
var import_utils20 = require("@fuel-ts/utils");
|
2646
2707
|
|
2647
2708
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2648
|
-
var
|
2649
|
-
var
|
2709
|
+
var import_math16 = require("@fuel-ts/math");
|
2710
|
+
var import_transactions17 = require("@fuel-ts/transactions");
|
2650
2711
|
var import_utils18 = require("@fuel-ts/utils");
|
2651
2712
|
|
2652
|
-
// src/providers/transaction-summary/calculate-
|
2653
|
-
var
|
2654
|
-
var
|
2713
|
+
// src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
|
2714
|
+
var import_math12 = require("@fuel-ts/math");
|
2715
|
+
var import_transactions12 = require("@fuel-ts/transactions");
|
2655
2716
|
var import_utils16 = require("@fuel-ts/utils");
|
2656
|
-
var
|
2717
|
+
var calculateTXFeeForSummary = (params) => {
|
2657
2718
|
const {
|
2658
2719
|
gasPrice,
|
2659
2720
|
rawPayload,
|
2660
2721
|
tip,
|
2722
|
+
totalFee,
|
2661
2723
|
consensusParameters: { gasCosts, feeParams, maxGasPerTx }
|
2662
2724
|
} = params;
|
2663
|
-
|
2664
|
-
|
2665
|
-
const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
|
2666
|
-
const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
|
2667
|
-
if (transaction.type === import_transactions11.TransactionType.Mint) {
|
2668
|
-
return {
|
2669
|
-
fee: (0, import_math11.bn)(0),
|
2670
|
-
minFee: (0, import_math11.bn)(0),
|
2671
|
-
maxFee: (0, import_math11.bn)(0)
|
2672
|
-
};
|
2725
|
+
if (totalFee) {
|
2726
|
+
return totalFee;
|
2673
2727
|
}
|
2728
|
+
const gasPerByte = (0, import_math12.bn)(feeParams.gasPerByte);
|
2729
|
+
const gasPriceFactor = (0, import_math12.bn)(feeParams.gasPriceFactor);
|
2730
|
+
const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
|
2731
|
+
const [transaction] = new import_transactions12.TransactionCoder().decode(transactionBytes, 0);
|
2674
2732
|
const { type, witnesses, inputs, policies } = transaction;
|
2675
|
-
let metadataGas = (0,
|
2676
|
-
let gasLimit = (0,
|
2677
|
-
if (type
|
2733
|
+
let metadataGas = (0, import_math12.bn)(0);
|
2734
|
+
let gasLimit = (0, import_math12.bn)(0);
|
2735
|
+
if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
|
2736
|
+
return (0, import_math12.bn)(0);
|
2737
|
+
}
|
2738
|
+
if (type === import_transactions12.TransactionType.Create) {
|
2678
2739
|
const { bytecodeWitnessIndex, storageSlots } = transaction;
|
2679
|
-
const contractBytesSize = (0,
|
2740
|
+
const contractBytesSize = (0, import_math12.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
|
2680
2741
|
metadataGas = calculateMetadataGasForTxCreate({
|
2681
2742
|
contractBytesSize,
|
2682
2743
|
gasCosts,
|
@@ -2695,12 +2756,12 @@ var calculateTransactionFee = (params) => {
|
|
2695
2756
|
}
|
2696
2757
|
const minGas = getMinGas({
|
2697
2758
|
gasCosts,
|
2698
|
-
gasPerByte: (0,
|
2759
|
+
gasPerByte: (0, import_math12.bn)(gasPerByte),
|
2699
2760
|
inputs,
|
2700
2761
|
metadataGas,
|
2701
2762
|
txBytesSize: transactionBytes.length
|
2702
2763
|
});
|
2703
|
-
const witnessLimit = policies.find((policy) => policy.type ===
|
2764
|
+
const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
|
2704
2765
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
2705
2766
|
const maxGas = getMaxGas({
|
2706
2767
|
gasPerByte,
|
@@ -2710,34 +2771,24 @@ var calculateTransactionFee = (params) => {
|
|
2710
2771
|
witnessLimit,
|
2711
2772
|
maxGasPerTx
|
2712
2773
|
});
|
2713
|
-
const minFee = calculateGasFee({
|
2714
|
-
gasPrice,
|
2715
|
-
gas: minGas,
|
2716
|
-
priceFactor: gasPriceFactor,
|
2717
|
-
tip
|
2718
|
-
});
|
2719
2774
|
const maxFee = calculateGasFee({
|
2720
2775
|
gasPrice,
|
2721
2776
|
gas: maxGas,
|
2722
2777
|
priceFactor: gasPriceFactor,
|
2723
2778
|
tip
|
2724
2779
|
});
|
2725
|
-
return
|
2726
|
-
minFee,
|
2727
|
-
maxFee,
|
2728
|
-
fee: maxFee
|
2729
|
-
};
|
2780
|
+
return maxFee;
|
2730
2781
|
};
|
2731
2782
|
|
2732
2783
|
// src/providers/transaction-summary/operations.ts
|
2733
2784
|
var import_configs10 = require("@fuel-ts/address/configs");
|
2734
2785
|
var import_errors11 = require("@fuel-ts/errors");
|
2735
|
-
var
|
2736
|
-
var
|
2786
|
+
var import_math14 = require("@fuel-ts/math");
|
2787
|
+
var import_transactions15 = require("@fuel-ts/transactions");
|
2737
2788
|
|
2738
2789
|
// src/providers/transaction-summary/call.ts
|
2739
2790
|
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
2740
|
-
var
|
2791
|
+
var import_math13 = require("@fuel-ts/math");
|
2741
2792
|
var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
2742
2793
|
const abiInterface = new import_abi_coder4.Interface(abi);
|
2743
2794
|
const callFunctionSelector = receipt.param1.toHex(8);
|
@@ -2746,7 +2797,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
|
2746
2797
|
let encodedArgs;
|
2747
2798
|
if (functionFragment.isInputDataPointer) {
|
2748
2799
|
if (rawPayload) {
|
2749
|
-
const argsOffset = (0,
|
2800
|
+
const argsOffset = (0, import_math13.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
|
2750
2801
|
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
2751
2802
|
}
|
2752
2803
|
} else {
|
@@ -2781,7 +2832,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
|
2781
2832
|
|
2782
2833
|
// src/providers/transaction-summary/input.ts
|
2783
2834
|
var import_errors10 = require("@fuel-ts/errors");
|
2784
|
-
var
|
2835
|
+
var import_transactions13 = require("@fuel-ts/transactions");
|
2785
2836
|
function getInputsByTypes(inputs, types) {
|
2786
2837
|
return inputs.filter((i) => types.includes(i.type));
|
2787
2838
|
}
|
@@ -2789,16 +2840,16 @@ function getInputsByType(inputs, type) {
|
|
2789
2840
|
return inputs.filter((i) => i.type === type);
|
2790
2841
|
}
|
2791
2842
|
function getInputsCoin(inputs) {
|
2792
|
-
return getInputsByType(inputs,
|
2843
|
+
return getInputsByType(inputs, import_transactions13.InputType.Coin);
|
2793
2844
|
}
|
2794
2845
|
function getInputsMessage(inputs) {
|
2795
|
-
return getInputsByType(inputs,
|
2846
|
+
return getInputsByType(inputs, import_transactions13.InputType.Message);
|
2796
2847
|
}
|
2797
2848
|
function getInputsCoinAndMessage(inputs) {
|
2798
|
-
return getInputsByTypes(inputs, [
|
2849
|
+
return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
|
2799
2850
|
}
|
2800
2851
|
function getInputsContract(inputs) {
|
2801
|
-
return getInputsByType(inputs,
|
2852
|
+
return getInputsByType(inputs, import_transactions13.InputType.Contract);
|
2802
2853
|
}
|
2803
2854
|
function getInputFromAssetId(inputs, assetId) {
|
2804
2855
|
const coinInputs = getInputsCoin(inputs);
|
@@ -2817,7 +2868,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2817
2868
|
if (!contractInput) {
|
2818
2869
|
return void 0;
|
2819
2870
|
}
|
2820
|
-
if (contractInput.type !==
|
2871
|
+
if (contractInput.type !== import_transactions13.InputType.Contract) {
|
2821
2872
|
throw new import_errors10.FuelError(
|
2822
2873
|
import_errors10.ErrorCode.INVALID_TRANSACTION_INPUT,
|
2823
2874
|
`Contract input should be of type 'contract'.`
|
@@ -2826,31 +2877,31 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2826
2877
|
return contractInput;
|
2827
2878
|
}
|
2828
2879
|
function getInputAccountAddress(input) {
|
2829
|
-
if (input.type ===
|
2880
|
+
if (input.type === import_transactions13.InputType.Coin) {
|
2830
2881
|
return input.owner.toString();
|
2831
2882
|
}
|
2832
|
-
if (input.type ===
|
2883
|
+
if (input.type === import_transactions13.InputType.Message) {
|
2833
2884
|
return input.recipient.toString();
|
2834
2885
|
}
|
2835
2886
|
return "";
|
2836
2887
|
}
|
2837
2888
|
|
2838
2889
|
// src/providers/transaction-summary/output.ts
|
2839
|
-
var
|
2890
|
+
var import_transactions14 = require("@fuel-ts/transactions");
|
2840
2891
|
function getOutputsByType(outputs, type) {
|
2841
2892
|
return outputs.filter((o) => o.type === type);
|
2842
2893
|
}
|
2843
2894
|
function getOutputsContractCreated(outputs) {
|
2844
|
-
return getOutputsByType(outputs,
|
2895
|
+
return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
|
2845
2896
|
}
|
2846
2897
|
function getOutputsCoin(outputs) {
|
2847
|
-
return getOutputsByType(outputs,
|
2898
|
+
return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
|
2848
2899
|
}
|
2849
2900
|
function getOutputsChange(outputs) {
|
2850
|
-
return getOutputsByType(outputs,
|
2901
|
+
return getOutputsByType(outputs, import_transactions14.OutputType.Change);
|
2851
2902
|
}
|
2852
2903
|
function getOutputsContract(outputs) {
|
2853
|
-
return getOutputsByType(outputs,
|
2904
|
+
return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
|
2854
2905
|
}
|
2855
2906
|
|
2856
2907
|
// src/providers/transaction-summary/operations.ts
|
@@ -2859,11 +2910,11 @@ function getReceiptsByType(receipts, type) {
|
|
2859
2910
|
}
|
2860
2911
|
function getTransactionTypeName(transactionType) {
|
2861
2912
|
switch (transactionType) {
|
2862
|
-
case
|
2913
|
+
case import_transactions15.TransactionType.Mint:
|
2863
2914
|
return "Mint" /* Mint */;
|
2864
|
-
case
|
2915
|
+
case import_transactions15.TransactionType.Create:
|
2865
2916
|
return "Create" /* Create */;
|
2866
|
-
case
|
2917
|
+
case import_transactions15.TransactionType.Script:
|
2867
2918
|
return "Script" /* Script */;
|
2868
2919
|
default:
|
2869
2920
|
throw new import_errors11.FuelError(
|
@@ -2885,11 +2936,17 @@ function isTypeCreate(transactionType) {
|
|
2885
2936
|
function isTypeScript(transactionType) {
|
2886
2937
|
return isType(transactionType, "Script" /* Script */);
|
2887
2938
|
}
|
2939
|
+
function isTypeUpgrade(transactionType) {
|
2940
|
+
return isType(transactionType, "Upgrade" /* Upgrade */);
|
2941
|
+
}
|
2942
|
+
function isTypeUpload(transactionType) {
|
2943
|
+
return isType(transactionType, "Upload" /* Upload */);
|
2944
|
+
}
|
2888
2945
|
function getReceiptsCall(receipts) {
|
2889
|
-
return getReceiptsByType(receipts,
|
2946
|
+
return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
|
2890
2947
|
}
|
2891
2948
|
function getReceiptsMessageOut(receipts) {
|
2892
|
-
return getReceiptsByType(receipts,
|
2949
|
+
return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
|
2893
2950
|
}
|
2894
2951
|
var mergeAssets = (op1, op2) => {
|
2895
2952
|
const assets1 = op1.assetsSent || [];
|
@@ -2902,7 +2959,7 @@ var mergeAssets = (op1, op2) => {
|
|
2902
2959
|
if (!matchingAsset) {
|
2903
2960
|
return asset1;
|
2904
2961
|
}
|
2905
|
-
const mergedAmount = (0,
|
2962
|
+
const mergedAmount = (0, import_math14.bn)(asset1.amount).add(matchingAsset.amount);
|
2906
2963
|
return { ...asset1, amount: mergedAmount };
|
2907
2964
|
});
|
2908
2965
|
return mergedAssets.concat(filteredAssets);
|
@@ -3085,11 +3142,11 @@ function getTransferOperations({
|
|
3085
3142
|
});
|
3086
3143
|
const transferReceipts = getReceiptsByType(
|
3087
3144
|
receipts,
|
3088
|
-
|
3145
|
+
import_transactions15.ReceiptType.Transfer
|
3089
3146
|
);
|
3090
3147
|
const transferOutReceipts = getReceiptsByType(
|
3091
3148
|
receipts,
|
3092
|
-
|
3149
|
+
import_transactions15.ReceiptType.TransferOut
|
3093
3150
|
);
|
3094
3151
|
[...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
|
3095
3152
|
const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
|
@@ -3174,17 +3231,17 @@ function getOperations({
|
|
3174
3231
|
}
|
3175
3232
|
|
3176
3233
|
// src/providers/transaction-summary/receipt.ts
|
3177
|
-
var
|
3234
|
+
var import_transactions16 = require("@fuel-ts/transactions");
|
3178
3235
|
var processGqlReceipt = (gqlReceipt) => {
|
3179
3236
|
const receipt = assembleReceiptByType(gqlReceipt);
|
3180
3237
|
switch (receipt.type) {
|
3181
|
-
case
|
3238
|
+
case import_transactions16.ReceiptType.ReturnData: {
|
3182
3239
|
return {
|
3183
3240
|
...receipt,
|
3184
3241
|
data: gqlReceipt.data || "0x"
|
3185
3242
|
};
|
3186
3243
|
}
|
3187
|
-
case
|
3244
|
+
case import_transactions16.ReceiptType.LogData: {
|
3188
3245
|
return {
|
3189
3246
|
...receipt,
|
3190
3247
|
data: gqlReceipt.data || "0x"
|
@@ -3197,7 +3254,7 @@ var processGqlReceipt = (gqlReceipt) => {
|
|
3197
3254
|
var extractMintedAssetsFromReceipts = (receipts) => {
|
3198
3255
|
const mintedAssets = [];
|
3199
3256
|
receipts.forEach((receipt) => {
|
3200
|
-
if (receipt.type ===
|
3257
|
+
if (receipt.type === import_transactions16.ReceiptType.Mint) {
|
3201
3258
|
mintedAssets.push({
|
3202
3259
|
subId: receipt.subId,
|
3203
3260
|
contractId: receipt.contractId,
|
@@ -3211,7 +3268,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
|
|
3211
3268
|
var extractBurnedAssetsFromReceipts = (receipts) => {
|
3212
3269
|
const burnedAssets = [];
|
3213
3270
|
receipts.forEach((receipt) => {
|
3214
|
-
if (receipt.type ===
|
3271
|
+
if (receipt.type === import_transactions16.ReceiptType.Burn) {
|
3215
3272
|
burnedAssets.push({
|
3216
3273
|
subId: receipt.subId,
|
3217
3274
|
contractId: receipt.contractId,
|
@@ -3225,6 +3282,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
3225
3282
|
|
3226
3283
|
// src/providers/transaction-summary/status.ts
|
3227
3284
|
var import_errors12 = require("@fuel-ts/errors");
|
3285
|
+
var import_math15 = require("@fuel-ts/math");
|
3228
3286
|
var getTransactionStatusName = (gqlStatus) => {
|
3229
3287
|
switch (gqlStatus) {
|
3230
3288
|
case "FailureStatus":
|
@@ -3246,6 +3304,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3246
3304
|
let time;
|
3247
3305
|
let blockId;
|
3248
3306
|
let status;
|
3307
|
+
let totalFee;
|
3308
|
+
let totalGas;
|
3249
3309
|
let isStatusFailure = false;
|
3250
3310
|
let isStatusSuccess = false;
|
3251
3311
|
let isStatusPending = false;
|
@@ -3256,11 +3316,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3256
3316
|
time = gqlTransactionStatus.time;
|
3257
3317
|
blockId = gqlTransactionStatus.block.id;
|
3258
3318
|
isStatusSuccess = true;
|
3319
|
+
totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
|
3320
|
+
totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
|
3259
3321
|
break;
|
3260
3322
|
case "FailureStatus":
|
3261
3323
|
time = gqlTransactionStatus.time;
|
3262
3324
|
blockId = gqlTransactionStatus.block.id;
|
3263
3325
|
isStatusFailure = true;
|
3326
|
+
totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
|
3327
|
+
totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
|
3264
3328
|
break;
|
3265
3329
|
case "SubmittedStatus":
|
3266
3330
|
time = gqlTransactionStatus.time;
|
@@ -3273,6 +3337,8 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3273
3337
|
time,
|
3274
3338
|
blockId,
|
3275
3339
|
status,
|
3340
|
+
totalFee,
|
3341
|
+
totalGas,
|
3276
3342
|
isStatusFailure,
|
3277
3343
|
isStatusSuccess,
|
3278
3344
|
isStatusPending
|
@@ -3308,8 +3374,10 @@ function assembleTransactionSummary(params) {
|
|
3308
3374
|
maxInputs
|
3309
3375
|
});
|
3310
3376
|
const typeName = getTransactionTypeName(transaction.type);
|
3311
|
-
const tip = (0,
|
3312
|
-
const {
|
3377
|
+
const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
|
3378
|
+
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
|
3379
|
+
const fee = calculateTXFeeForSummary({
|
3380
|
+
totalFee,
|
3313
3381
|
gasPrice,
|
3314
3382
|
rawPayload,
|
3315
3383
|
tip,
|
@@ -3322,7 +3390,6 @@ function assembleTransactionSummary(params) {
|
|
3322
3390
|
}
|
3323
3391
|
}
|
3324
3392
|
});
|
3325
|
-
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time } = processGraphqlStatus(gqlTransactionStatus);
|
3326
3393
|
const mintedAssets = extractMintedAssetsFromReceipts(receipts);
|
3327
3394
|
const burnedAssets = extractBurnedAssetsFromReceipts(receipts);
|
3328
3395
|
let date;
|
@@ -3331,6 +3398,7 @@ function assembleTransactionSummary(params) {
|
|
3331
3398
|
}
|
3332
3399
|
const transactionSummary = {
|
3333
3400
|
id,
|
3401
|
+
tip,
|
3334
3402
|
fee,
|
3335
3403
|
gasUsed,
|
3336
3404
|
operations,
|
@@ -3344,6 +3412,8 @@ function assembleTransactionSummary(params) {
|
|
3344
3412
|
isTypeMint: isTypeMint(transaction.type),
|
3345
3413
|
isTypeCreate: isTypeCreate(transaction.type),
|
3346
3414
|
isTypeScript: isTypeScript(transaction.type),
|
3415
|
+
isTypeUpgrade: isTypeUpgrade(transaction.type),
|
3416
|
+
isTypeUpload: isTypeUpload(transaction.type),
|
3347
3417
|
isStatusFailure,
|
3348
3418
|
isStatusSuccess,
|
3349
3419
|
isStatusPending,
|
@@ -3355,12 +3425,12 @@ function assembleTransactionSummary(params) {
|
|
3355
3425
|
|
3356
3426
|
// src/providers/transaction-response/getDecodedLogs.ts
|
3357
3427
|
var import_abi_coder5 = require("@fuel-ts/abi-coder");
|
3358
|
-
var
|
3428
|
+
var import_transactions18 = require("@fuel-ts/transactions");
|
3359
3429
|
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
3360
3430
|
return receipts.reduce((logs, receipt) => {
|
3361
|
-
if (receipt.type ===
|
3431
|
+
if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
|
3362
3432
|
const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
|
3363
|
-
const data = receipt.type ===
|
3433
|
+
const data = receipt.type === import_transactions18.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
3364
3434
|
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
|
3365
3435
|
logs.push(decodedLog);
|
3366
3436
|
}
|
@@ -3375,7 +3445,7 @@ var TransactionResponse = class {
|
|
3375
3445
|
/** Current provider */
|
3376
3446
|
provider;
|
3377
3447
|
/** Gas used on the transaction */
|
3378
|
-
gasUsed = (0,
|
3448
|
+
gasUsed = (0, import_math17.bn)(0);
|
3379
3449
|
/** The graphql Transaction with receipts object. */
|
3380
3450
|
gqlTransaction;
|
3381
3451
|
abis;
|
@@ -3433,7 +3503,7 @@ var TransactionResponse = class {
|
|
3433
3503
|
* @returns The decoded transaction.
|
3434
3504
|
*/
|
3435
3505
|
decodeTransaction(transactionWithReceipts) {
|
3436
|
-
return new
|
3506
|
+
return new import_transactions19.TransactionCoder().decode(
|
3437
3507
|
(0, import_utils20.arrayify)(transactionWithReceipts.rawPayload),
|
3438
3508
|
0
|
3439
3509
|
)?.[0];
|
@@ -3460,7 +3530,7 @@ var TransactionResponse = class {
|
|
3460
3530
|
const receipts = txReceipts.map(processGqlReceipt) || [];
|
3461
3531
|
const { gasPerByte, gasPriceFactor, gasCosts, maxGasPerTx } = this.provider.getGasConfig();
|
3462
3532
|
const gasPrice = await this.provider.getLatestGasPrice();
|
3463
|
-
const maxInputs = this.provider.getChain().consensusParameters.maxInputs;
|
3533
|
+
const maxInputs = this.provider.getChain().consensusParameters.txParameters.maxInputs;
|
3464
3534
|
const transactionSummary = assembleTransactionSummary({
|
3465
3535
|
id: this.id,
|
3466
3536
|
receipts,
|
@@ -3596,33 +3666,60 @@ var mergeQuantities = (...coinQuantities) => {
|
|
3596
3666
|
var MAX_RETRIES = 10;
|
3597
3667
|
var processGqlChain = (chain) => {
|
3598
3668
|
const { name, daHeight, consensusParameters, latestBlock } = chain;
|
3599
|
-
const {
|
3669
|
+
const {
|
3670
|
+
contractParams,
|
3671
|
+
feeParams,
|
3672
|
+
predicateParams,
|
3673
|
+
scriptParams,
|
3674
|
+
txParams,
|
3675
|
+
gasCosts,
|
3676
|
+
baseAssetId,
|
3677
|
+
chainId,
|
3678
|
+
version
|
3679
|
+
} = consensusParameters;
|
3600
3680
|
return {
|
3601
3681
|
name,
|
3602
|
-
baseChainHeight: (0,
|
3682
|
+
baseChainHeight: (0, import_math18.bn)(daHeight),
|
3603
3683
|
consensusParameters: {
|
3604
|
-
|
3605
|
-
|
3606
|
-
|
3607
|
-
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
|
3613
|
-
|
3614
|
-
|
3615
|
-
|
3616
|
-
|
3617
|
-
|
3618
|
-
|
3619
|
-
|
3684
|
+
version,
|
3685
|
+
chainId: (0, import_math18.bn)(chainId),
|
3686
|
+
baseAssetId,
|
3687
|
+
feeParameters: {
|
3688
|
+
version: feeParams.version,
|
3689
|
+
gasPerByte: (0, import_math18.bn)(feeParams.gasPerByte),
|
3690
|
+
gasPriceFactor: (0, import_math18.bn)(feeParams.gasPriceFactor)
|
3691
|
+
},
|
3692
|
+
contractParameters: {
|
3693
|
+
version: contractParams.version,
|
3694
|
+
contractMaxSize: (0, import_math18.bn)(contractParams.contractMaxSize),
|
3695
|
+
maxStorageSlots: (0, import_math18.bn)(contractParams.maxStorageSlots)
|
3696
|
+
},
|
3697
|
+
txParameters: {
|
3698
|
+
version: txParams.version,
|
3699
|
+
maxInputs: (0, import_math18.bn)(txParams.maxInputs),
|
3700
|
+
maxOutputs: (0, import_math18.bn)(txParams.maxOutputs),
|
3701
|
+
maxWitnesses: (0, import_math18.bn)(txParams.maxWitnesses),
|
3702
|
+
maxGasPerTx: (0, import_math18.bn)(txParams.maxGasPerTx),
|
3703
|
+
maxSize: (0, import_math18.bn)(txParams.maxSize),
|
3704
|
+
maxBytecodeSubsections: (0, import_math18.bn)(txParams.maxBytecodeSubsections)
|
3705
|
+
},
|
3706
|
+
predicateParameters: {
|
3707
|
+
version: predicateParams.version,
|
3708
|
+
maxPredicateLength: (0, import_math18.bn)(predicateParams.maxPredicateLength),
|
3709
|
+
maxPredicateDataLength: (0, import_math18.bn)(predicateParams.maxPredicateDataLength),
|
3710
|
+
maxGasPerPredicate: (0, import_math18.bn)(predicateParams.maxGasPerPredicate),
|
3711
|
+
maxMessageDataLength: (0, import_math18.bn)(predicateParams.maxMessageDataLength)
|
3712
|
+
},
|
3713
|
+
scriptParameters: {
|
3714
|
+
version: scriptParams.version,
|
3715
|
+
maxScriptLength: (0, import_math18.bn)(scriptParams.maxScriptLength),
|
3716
|
+
maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
|
3717
|
+
},
|
3620
3718
|
gasCosts
|
3621
3719
|
},
|
3622
|
-
gasCosts,
|
3623
3720
|
latestBlock: {
|
3624
3721
|
id: latestBlock.id,
|
3625
|
-
height: (0,
|
3722
|
+
height: (0, import_math18.bn)(latestBlock.height),
|
3626
3723
|
time: latestBlock.header.time,
|
3627
3724
|
transactions: latestBlock.transactions.map((i) => ({
|
3628
3725
|
id: i.id
|
@@ -3716,7 +3813,12 @@ var _Provider = class {
|
|
3716
3813
|
* Returns some helpful parameters related to gas fees.
|
3717
3814
|
*/
|
3718
3815
|
getGasConfig() {
|
3719
|
-
const {
|
3816
|
+
const {
|
3817
|
+
txParameters: { maxGasPerTx },
|
3818
|
+
predicateParameters: { maxGasPerPredicate },
|
3819
|
+
feeParameters: { gasPriceFactor, gasPerByte },
|
3820
|
+
gasCosts
|
3821
|
+
} = this.getChain().consensusParameters;
|
3720
3822
|
return {
|
3721
3823
|
maxGasPerTx,
|
3722
3824
|
maxGasPerPredicate,
|
@@ -3751,11 +3853,9 @@ var _Provider = class {
|
|
3751
3853
|
static ensureClientVersionIsSupported(nodeInfo) {
|
3752
3854
|
const { isMajorSupported, isMinorSupported, supportedVersion } = (0, import_versions.checkFuelCoreVersionCompatibility)(nodeInfo.nodeVersion);
|
3753
3855
|
if (!isMajorSupported || !isMinorSupported) {
|
3754
|
-
|
3755
|
-
|
3756
|
-
|
3757
|
-
Things might or might not work as expected.
|
3758
|
-
Supported fuel-core version: ${supportedVersion}.`
|
3856
|
+
throw new import_errors14.FuelError(
|
3857
|
+
import_errors14.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
|
3858
|
+
`Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
|
3759
3859
|
);
|
3760
3860
|
}
|
3761
3861
|
}
|
@@ -3813,7 +3913,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3813
3913
|
*/
|
3814
3914
|
async getBlockNumber() {
|
3815
3915
|
const { chain } = await this.operations.getChain();
|
3816
|
-
return (0,
|
3916
|
+
return (0, import_math18.bn)(chain.latestBlock.height, 10);
|
3817
3917
|
}
|
3818
3918
|
/**
|
3819
3919
|
* Returns the chain information.
|
@@ -3823,8 +3923,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3823
3923
|
async fetchNode() {
|
3824
3924
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
3825
3925
|
const processedNodeInfo = {
|
3826
|
-
maxDepth: (0,
|
3827
|
-
maxTx: (0,
|
3926
|
+
maxDepth: (0, import_math18.bn)(nodeInfo.maxDepth),
|
3927
|
+
maxTx: (0, import_math18.bn)(nodeInfo.maxTx),
|
3828
3928
|
nodeVersion: nodeInfo.nodeVersion,
|
3829
3929
|
utxoValidation: nodeInfo.utxoValidation,
|
3830
3930
|
vmBacktrace: nodeInfo.vmBacktrace
|
@@ -3882,7 +3982,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3882
3982
|
}
|
3883
3983
|
const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
|
3884
3984
|
let abis;
|
3885
|
-
if (transactionRequest.type ===
|
3985
|
+
if (transactionRequest.type === import_transactions20.TransactionType.Script) {
|
3886
3986
|
abis = transactionRequest.abis;
|
3887
3987
|
}
|
3888
3988
|
if (awaitExecution) {
|
@@ -3928,9 +4028,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3928
4028
|
encodedTransactions: encodedTransaction,
|
3929
4029
|
utxoValidation: utxoValidation || false
|
3930
4030
|
});
|
3931
|
-
const [{ receipts: rawReceipts, status }] = dryRunStatuses;
|
4031
|
+
const [{ receipts: rawReceipts, status: dryRunStatus }] = dryRunStatuses;
|
3932
4032
|
const receipts = rawReceipts.map(processGqlReceipt);
|
3933
|
-
return { receipts,
|
4033
|
+
return { receipts, dryRunStatus };
|
3934
4034
|
}
|
3935
4035
|
/**
|
3936
4036
|
* Verifies whether enough gas is available to complete transaction.
|
@@ -3941,7 +4041,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3941
4041
|
async estimatePredicates(transactionRequest) {
|
3942
4042
|
const shouldEstimatePredicates = Boolean(
|
3943
4043
|
transactionRequest.inputs.find(
|
3944
|
-
(input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new
|
4044
|
+
(input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
|
3945
4045
|
)
|
3946
4046
|
);
|
3947
4047
|
if (!shouldEstimatePredicates) {
|
@@ -3956,7 +4056,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3956
4056
|
} = response;
|
3957
4057
|
if (inputs) {
|
3958
4058
|
inputs.forEach((input, index) => {
|
3959
|
-
if ("predicateGasUsed" in input && (0,
|
4059
|
+
if ("predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
|
3960
4060
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
3961
4061
|
}
|
3962
4062
|
});
|
@@ -3974,7 +4074,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3974
4074
|
* @returns A promise.
|
3975
4075
|
*/
|
3976
4076
|
async estimateTxDependencies(transactionRequest) {
|
3977
|
-
if (transactionRequest.type ===
|
4077
|
+
if (transactionRequest.type === import_transactions20.TransactionType.Create) {
|
3978
4078
|
return {
|
3979
4079
|
receipts: [],
|
3980
4080
|
outputVariables: 0,
|
@@ -3984,7 +4084,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3984
4084
|
let receipts = [];
|
3985
4085
|
const missingContractIds = [];
|
3986
4086
|
let outputVariables = 0;
|
3987
|
-
let
|
4087
|
+
let dryRunStatus;
|
3988
4088
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
3989
4089
|
const {
|
3990
4090
|
dryRun: [{ receipts: rawReceipts, status }]
|
@@ -3993,7 +4093,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3993
4093
|
utxoValidation: false
|
3994
4094
|
});
|
3995
4095
|
receipts = rawReceipts.map(processGqlReceipt);
|
3996
|
-
|
4096
|
+
dryRunStatus = status;
|
3997
4097
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
3998
4098
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
3999
4099
|
if (hasMissingOutputs) {
|
@@ -4015,7 +4115,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4015
4115
|
receipts,
|
4016
4116
|
outputVariables,
|
4017
4117
|
missingContractIds,
|
4018
|
-
|
4118
|
+
dryRunStatus
|
4019
4119
|
};
|
4020
4120
|
}
|
4021
4121
|
/**
|
@@ -4033,12 +4133,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4033
4133
|
receipts: [],
|
4034
4134
|
outputVariables: 0,
|
4035
4135
|
missingContractIds: [],
|
4036
|
-
|
4136
|
+
dryRunStatus: void 0
|
4037
4137
|
}));
|
4038
4138
|
const allRequests = (0, import_ramda3.clone)(transactionRequests);
|
4039
4139
|
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
4040
4140
|
allRequests.forEach((req, index) => {
|
4041
|
-
if (req.type ===
|
4141
|
+
if (req.type === import_transactions20.TransactionType.Script) {
|
4042
4142
|
serializedTransactionsMap.set(index, (0, import_utils22.hexlify)(req.toTransactionBytes()));
|
4043
4143
|
}
|
4044
4144
|
});
|
@@ -4058,13 +4158,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4058
4158
|
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
4059
4159
|
const result = results[requestIdx];
|
4060
4160
|
result.receipts = rawReceipts.map(processGqlReceipt);
|
4061
|
-
result.
|
4161
|
+
result.dryRunStatus = status;
|
4062
4162
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
4063
4163
|
result.receipts
|
4064
4164
|
);
|
4065
4165
|
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
4066
4166
|
const request = allRequests[requestIdx];
|
4067
|
-
if (hasMissingOutputs && request?.type ===
|
4167
|
+
if (hasMissingOutputs && request?.type === import_transactions20.TransactionType.Script) {
|
4068
4168
|
result.outputVariables += missingOutputVariables.length;
|
4069
4169
|
request.addVariableOutputs(missingOutputVariables.length);
|
4070
4170
|
missingOutputContractIds.forEach(({ contractId }) => {
|
@@ -4095,7 +4195,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4095
4195
|
});
|
4096
4196
|
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
4097
4197
|
const receipts = rawReceipts.map(processGqlReceipt);
|
4098
|
-
return { receipts,
|
4198
|
+
return { receipts, dryRunStatus: status };
|
4099
4199
|
});
|
4100
4200
|
return results;
|
4101
4201
|
}
|
@@ -4114,13 +4214,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4114
4214
|
gasPrice = await this.estimateGasPrice(10);
|
4115
4215
|
}
|
4116
4216
|
const minFee = calculateGasFee({
|
4117
|
-
gasPrice: (0,
|
4217
|
+
gasPrice: (0, import_math18.bn)(gasPrice),
|
4118
4218
|
gas: minGas,
|
4119
4219
|
priceFactor: gasPriceFactor,
|
4120
4220
|
tip: transactionRequest.tip
|
4121
4221
|
}).add(1);
|
4122
|
-
let gasLimit = (0,
|
4123
|
-
if (transactionRequest.type ===
|
4222
|
+
let gasLimit = (0, import_math18.bn)(0);
|
4223
|
+
if (transactionRequest.type === import_transactions20.TransactionType.Script) {
|
4124
4224
|
gasLimit = transactionRequest.gasLimit;
|
4125
4225
|
if (transactionRequest.gasLimit.eq(0)) {
|
4126
4226
|
transactionRequest.gasLimit = minGas;
|
@@ -4132,7 +4232,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4132
4232
|
}
|
4133
4233
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4134
4234
|
const maxFee = calculateGasFee({
|
4135
|
-
gasPrice: (0,
|
4235
|
+
gasPrice: (0, import_math18.bn)(gasPrice),
|
4136
4236
|
gas: maxGas,
|
4137
4237
|
priceFactor: gasPriceFactor,
|
4138
4238
|
tip: transactionRequest.tip
|
@@ -4190,14 +4290,14 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4190
4290
|
*/
|
4191
4291
|
async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
|
4192
4292
|
const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
|
4193
|
-
const isScriptTransaction = txRequestClone.type ===
|
4293
|
+
const isScriptTransaction = txRequestClone.type === import_transactions20.TransactionType.Script;
|
4194
4294
|
const baseAssetId = this.getBaseAssetId();
|
4195
4295
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
4196
4296
|
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4197
4297
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4198
|
-
txRequestClone.maxFee = (0,
|
4298
|
+
txRequestClone.maxFee = (0, import_math18.bn)(0);
|
4199
4299
|
if (isScriptTransaction) {
|
4200
|
-
txRequestClone.gasLimit = (0,
|
4300
|
+
txRequestClone.gasLimit = (0, import_math18.bn)(0);
|
4201
4301
|
}
|
4202
4302
|
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4203
4303
|
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
@@ -4214,9 +4314,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4214
4314
|
transactionRequest: signedRequest
|
4215
4315
|
});
|
4216
4316
|
let receipts = [];
|
4317
|
+
let dryRunStatus;
|
4217
4318
|
let missingContractIds = [];
|
4218
4319
|
let outputVariables = 0;
|
4219
|
-
let gasUsed = (0,
|
4320
|
+
let gasUsed = (0, import_math18.bn)(0);
|
4220
4321
|
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
4221
4322
|
txRequestClone.maxFee = maxFee;
|
4222
4323
|
if (isScriptTransaction) {
|
@@ -4224,10 +4325,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4224
4325
|
if (signatureCallback) {
|
4225
4326
|
await signatureCallback(txRequestClone);
|
4226
4327
|
}
|
4227
|
-
|
4228
|
-
receipts = result.receipts;
|
4229
|
-
outputVariables = result.outputVariables;
|
4230
|
-
missingContractIds = result.missingContractIds;
|
4328
|
+
({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
|
4231
4329
|
gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
|
4232
4330
|
txRequestClone.gasLimit = gasUsed;
|
4233
4331
|
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
@@ -4247,7 +4345,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4247
4345
|
outputVariables,
|
4248
4346
|
missingContractIds,
|
4249
4347
|
addedSignatures,
|
4250
|
-
estimatedPredicates: txRequestClone.inputs
|
4348
|
+
estimatedPredicates: txRequestClone.inputs,
|
4349
|
+
dryRunStatus
|
4251
4350
|
};
|
4252
4351
|
}
|
4253
4352
|
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
@@ -4283,10 +4382,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4283
4382
|
return coins.map((coin) => ({
|
4284
4383
|
id: coin.utxoId,
|
4285
4384
|
assetId: coin.assetId,
|
4286
|
-
amount: (0,
|
4385
|
+
amount: (0, import_math18.bn)(coin.amount),
|
4287
4386
|
owner: import_address3.Address.fromAddressOrString(coin.owner),
|
4288
|
-
blockCreated: (0,
|
4289
|
-
txCreatedIdx: (0,
|
4387
|
+
blockCreated: (0, import_math18.bn)(coin.blockCreated),
|
4388
|
+
txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
|
4290
4389
|
}));
|
4291
4390
|
}
|
4292
4391
|
/**
|
@@ -4323,9 +4422,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4323
4422
|
switch (coin.__typename) {
|
4324
4423
|
case "MessageCoin":
|
4325
4424
|
return {
|
4326
|
-
amount: (0,
|
4425
|
+
amount: (0, import_math18.bn)(coin.amount),
|
4327
4426
|
assetId: coin.assetId,
|
4328
|
-
daHeight: (0,
|
4427
|
+
daHeight: (0, import_math18.bn)(coin.daHeight),
|
4329
4428
|
sender: import_address3.Address.fromAddressOrString(coin.sender),
|
4330
4429
|
recipient: import_address3.Address.fromAddressOrString(coin.recipient),
|
4331
4430
|
nonce: coin.nonce
|
@@ -4333,11 +4432,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4333
4432
|
case "Coin":
|
4334
4433
|
return {
|
4335
4434
|
id: coin.utxoId,
|
4336
|
-
amount: (0,
|
4435
|
+
amount: (0, import_math18.bn)(coin.amount),
|
4337
4436
|
assetId: coin.assetId,
|
4338
4437
|
owner: import_address3.Address.fromAddressOrString(coin.owner),
|
4339
|
-
blockCreated: (0,
|
4340
|
-
txCreatedIdx: (0,
|
4438
|
+
blockCreated: (0, import_math18.bn)(coin.blockCreated),
|
4439
|
+
txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
|
4341
4440
|
};
|
4342
4441
|
default:
|
4343
4442
|
return null;
|
@@ -4354,13 +4453,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4354
4453
|
async getBlock(idOrHeight) {
|
4355
4454
|
let variables;
|
4356
4455
|
if (typeof idOrHeight === "number") {
|
4357
|
-
variables = { height: (0,
|
4456
|
+
variables = { height: (0, import_math18.bn)(idOrHeight).toString(10) };
|
4358
4457
|
} else if (idOrHeight === "latest") {
|
4359
4458
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4360
4459
|
} else if (idOrHeight.length === 66) {
|
4361
4460
|
variables = { blockId: idOrHeight };
|
4362
4461
|
} else {
|
4363
|
-
variables = { blockId: (0,
|
4462
|
+
variables = { blockId: (0, import_math18.bn)(idOrHeight).toString(10) };
|
4364
4463
|
}
|
4365
4464
|
const { block } = await this.operations.getBlock(variables);
|
4366
4465
|
if (!block) {
|
@@ -4368,7 +4467,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4368
4467
|
}
|
4369
4468
|
return {
|
4370
4469
|
id: block.id,
|
4371
|
-
height: (0,
|
4470
|
+
height: (0, import_math18.bn)(block.height),
|
4372
4471
|
time: block.header.time,
|
4373
4472
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4374
4473
|
};
|
@@ -4383,7 +4482,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4383
4482
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4384
4483
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4385
4484
|
id: block.id,
|
4386
|
-
height: (0,
|
4485
|
+
height: (0, import_math18.bn)(block.height),
|
4387
4486
|
time: block.header.time,
|
4388
4487
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4389
4488
|
}));
|
@@ -4398,7 +4497,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4398
4497
|
async getBlockWithTransactions(idOrHeight) {
|
4399
4498
|
let variables;
|
4400
4499
|
if (typeof idOrHeight === "number") {
|
4401
|
-
variables = { blockHeight: (0,
|
4500
|
+
variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString(10) };
|
4402
4501
|
} else if (idOrHeight === "latest") {
|
4403
4502
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4404
4503
|
} else {
|
@@ -4410,11 +4509,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4410
4509
|
}
|
4411
4510
|
return {
|
4412
4511
|
id: block.id,
|
4413
|
-
height: (0,
|
4512
|
+
height: (0, import_math18.bn)(block.height, 10),
|
4414
4513
|
time: block.header.time,
|
4415
4514
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4416
4515
|
transactions: block.transactions.map(
|
4417
|
-
(tx) => new
|
4516
|
+
(tx) => new import_transactions20.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
|
4418
4517
|
)
|
4419
4518
|
};
|
4420
4519
|
}
|
@@ -4429,7 +4528,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4429
4528
|
if (!transaction) {
|
4430
4529
|
return null;
|
4431
4530
|
}
|
4432
|
-
return new
|
4531
|
+
return new import_transactions20.TransactionCoder().decode(
|
4433
4532
|
(0, import_utils22.arrayify)(transaction.rawPayload),
|
4434
4533
|
0
|
4435
4534
|
)?.[0];
|
@@ -4459,7 +4558,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4459
4558
|
contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
|
4460
4559
|
asset: (0, import_utils22.hexlify)(assetId)
|
4461
4560
|
});
|
4462
|
-
return (0,
|
4561
|
+
return (0, import_math18.bn)(contractBalance.amount, 10);
|
4463
4562
|
}
|
4464
4563
|
/**
|
4465
4564
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4473,7 +4572,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4473
4572
|
owner: import_address3.Address.fromAddressOrString(owner).toB256(),
|
4474
4573
|
assetId: (0, import_utils22.hexlify)(assetId)
|
4475
4574
|
});
|
4476
|
-
return (0,
|
4575
|
+
return (0, import_math18.bn)(balance.amount, 10);
|
4477
4576
|
}
|
4478
4577
|
/**
|
4479
4578
|
* Returns balances for the given owner.
|
@@ -4491,7 +4590,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4491
4590
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4492
4591
|
return balances.map((balance) => ({
|
4493
4592
|
assetId: balance.assetId,
|
4494
|
-
amount: (0,
|
4593
|
+
amount: (0, import_math18.bn)(balance.amount)
|
4495
4594
|
}));
|
4496
4595
|
}
|
4497
4596
|
/**
|
@@ -4509,19 +4608,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4509
4608
|
});
|
4510
4609
|
const messages = result.messages.edges.map((edge) => edge.node);
|
4511
4610
|
return messages.map((message) => ({
|
4512
|
-
messageId:
|
4611
|
+
messageId: import_transactions20.InputMessageCoder.getMessageId({
|
4513
4612
|
sender: message.sender,
|
4514
4613
|
recipient: message.recipient,
|
4515
4614
|
nonce: message.nonce,
|
4516
|
-
amount: (0,
|
4615
|
+
amount: (0, import_math18.bn)(message.amount),
|
4517
4616
|
data: message.data
|
4518
4617
|
}),
|
4519
4618
|
sender: import_address3.Address.fromAddressOrString(message.sender),
|
4520
4619
|
recipient: import_address3.Address.fromAddressOrString(message.recipient),
|
4521
4620
|
nonce: message.nonce,
|
4522
|
-
amount: (0,
|
4523
|
-
data:
|
4524
|
-
daHeight: (0,
|
4621
|
+
amount: (0, import_math18.bn)(message.amount),
|
4622
|
+
data: import_transactions20.InputMessageCoder.decodeData(message.data),
|
4623
|
+
daHeight: (0, import_math18.bn)(message.daHeight)
|
4525
4624
|
}));
|
4526
4625
|
}
|
4527
4626
|
/**
|
@@ -4574,59 +4673,59 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4574
4673
|
} = result.messageProof;
|
4575
4674
|
return {
|
4576
4675
|
messageProof: {
|
4577
|
-
proofIndex: (0,
|
4676
|
+
proofIndex: (0, import_math18.bn)(messageProof.proofIndex),
|
4578
4677
|
proofSet: messageProof.proofSet
|
4579
4678
|
},
|
4580
4679
|
blockProof: {
|
4581
|
-
proofIndex: (0,
|
4680
|
+
proofIndex: (0, import_math18.bn)(blockProof.proofIndex),
|
4582
4681
|
proofSet: blockProof.proofSet
|
4583
4682
|
},
|
4584
4683
|
messageBlockHeader: {
|
4585
4684
|
id: messageBlockHeader.id,
|
4586
|
-
daHeight: (0,
|
4587
|
-
transactionsCount: (
|
4685
|
+
daHeight: (0, import_math18.bn)(messageBlockHeader.daHeight),
|
4686
|
+
transactionsCount: Number(messageBlockHeader.transactionsCount),
|
4588
4687
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4589
|
-
height: (0,
|
4688
|
+
height: (0, import_math18.bn)(messageBlockHeader.height),
|
4590
4689
|
prevRoot: messageBlockHeader.prevRoot,
|
4591
4690
|
time: messageBlockHeader.time,
|
4592
4691
|
applicationHash: messageBlockHeader.applicationHash,
|
4593
|
-
messageReceiptCount: (
|
4692
|
+
messageReceiptCount: Number(messageBlockHeader.messageReceiptCount),
|
4594
4693
|
messageOutboxRoot: messageBlockHeader.messageOutboxRoot,
|
4595
|
-
consensusParametersVersion: messageBlockHeader.consensusParametersVersion,
|
4694
|
+
consensusParametersVersion: Number(messageBlockHeader.consensusParametersVersion),
|
4596
4695
|
eventInboxRoot: messageBlockHeader.eventInboxRoot,
|
4597
|
-
stateTransitionBytecodeVersion: messageBlockHeader.stateTransitionBytecodeVersion
|
4696
|
+
stateTransitionBytecodeVersion: Number(messageBlockHeader.stateTransitionBytecodeVersion)
|
4598
4697
|
},
|
4599
4698
|
commitBlockHeader: {
|
4600
4699
|
id: commitBlockHeader.id,
|
4601
|
-
daHeight: (0,
|
4602
|
-
transactionsCount: (
|
4700
|
+
daHeight: (0, import_math18.bn)(commitBlockHeader.daHeight),
|
4701
|
+
transactionsCount: Number(commitBlockHeader.transactionsCount),
|
4603
4702
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
4604
|
-
height: (0,
|
4703
|
+
height: (0, import_math18.bn)(commitBlockHeader.height),
|
4605
4704
|
prevRoot: commitBlockHeader.prevRoot,
|
4606
4705
|
time: commitBlockHeader.time,
|
4607
4706
|
applicationHash: commitBlockHeader.applicationHash,
|
4608
|
-
messageReceiptCount: (
|
4707
|
+
messageReceiptCount: Number(commitBlockHeader.messageReceiptCount),
|
4609
4708
|
messageOutboxRoot: commitBlockHeader.messageOutboxRoot,
|
4610
|
-
consensusParametersVersion: commitBlockHeader.consensusParametersVersion,
|
4709
|
+
consensusParametersVersion: Number(commitBlockHeader.consensusParametersVersion),
|
4611
4710
|
eventInboxRoot: commitBlockHeader.eventInboxRoot,
|
4612
|
-
stateTransitionBytecodeVersion: commitBlockHeader.stateTransitionBytecodeVersion
|
4711
|
+
stateTransitionBytecodeVersion: Number(commitBlockHeader.stateTransitionBytecodeVersion)
|
4613
4712
|
},
|
4614
4713
|
sender: import_address3.Address.fromAddressOrString(sender),
|
4615
4714
|
recipient: import_address3.Address.fromAddressOrString(recipient),
|
4616
4715
|
nonce,
|
4617
|
-
amount: (0,
|
4716
|
+
amount: (0, import_math18.bn)(amount),
|
4618
4717
|
data
|
4619
4718
|
};
|
4620
4719
|
}
|
4621
4720
|
async getLatestGasPrice() {
|
4622
4721
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4623
|
-
return (0,
|
4722
|
+
return (0, import_math18.bn)(latestGasPrice.gasPrice);
|
4624
4723
|
}
|
4625
4724
|
async estimateGasPrice(blockHorizon) {
|
4626
4725
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4627
4726
|
blockHorizon: String(blockHorizon)
|
4628
4727
|
});
|
4629
|
-
return (0,
|
4728
|
+
return (0, import_math18.bn)(estimateGasPrice.gasPrice);
|
4630
4729
|
}
|
4631
4730
|
/**
|
4632
4731
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -4647,10 +4746,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4647
4746
|
*/
|
4648
4747
|
async produceBlocks(amount, startTime) {
|
4649
4748
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4650
|
-
blocksToProduce: (0,
|
4749
|
+
blocksToProduce: (0, import_math18.bn)(amount).toString(10),
|
4651
4750
|
startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4652
4751
|
});
|
4653
|
-
return (0,
|
4752
|
+
return (0, import_math18.bn)(latestBlockHeight);
|
4654
4753
|
}
|
4655
4754
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4656
4755
|
async getTransactionResponse(transactionId) {
|
@@ -4669,6 +4768,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4669
4768
|
}
|
4670
4769
|
return message;
|
4671
4770
|
}
|
4771
|
+
async getRelayedTransactionStatus(relayedTransactionId) {
|
4772
|
+
const { relayedTransactionStatus } = await this.operations.getRelayedTransactionStatus({
|
4773
|
+
relayedTransactionId
|
4774
|
+
});
|
4775
|
+
if (!relayedTransactionStatus) {
|
4776
|
+
return null;
|
4777
|
+
}
|
4778
|
+
return relayedTransactionStatus;
|
4779
|
+
}
|
4672
4780
|
};
|
4673
4781
|
var Provider = _Provider;
|
4674
4782
|
_cacheInputs = new WeakSet();
|
@@ -4677,7 +4785,7 @@ cacheInputs_fn = function(inputs) {
|
|
4677
4785
|
return;
|
4678
4786
|
}
|
4679
4787
|
inputs.forEach((input) => {
|
4680
|
-
if (input.type ===
|
4788
|
+
if (input.type === import_transactions20.InputType.Coin) {
|
4681
4789
|
this.cache?.set(input.id);
|
4682
4790
|
}
|
4683
4791
|
});
|
@@ -4687,8 +4795,8 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4687
4795
|
|
4688
4796
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4689
4797
|
var import_errors15 = require("@fuel-ts/errors");
|
4690
|
-
var
|
4691
|
-
var
|
4798
|
+
var import_math19 = require("@fuel-ts/math");
|
4799
|
+
var import_transactions21 = require("@fuel-ts/transactions");
|
4692
4800
|
var import_utils25 = require("@fuel-ts/utils");
|
4693
4801
|
|
4694
4802
|
// src/providers/chains.ts
|
@@ -4736,31 +4844,15 @@ var assets = [
|
|
4736
4844
|
}
|
4737
4845
|
];
|
4738
4846
|
|
4739
|
-
// src/providers/transaction-request/helpers.ts
|
4740
|
-
var import_math18 = require("@fuel-ts/math");
|
4741
|
-
var import_transactions21 = require("@fuel-ts/transactions");
|
4742
|
-
var isRequestInputCoin = (input) => input.type === import_transactions21.InputType.Coin;
|
4743
|
-
var isRequestInputMessage = (input) => input.type === import_transactions21.InputType.Message;
|
4744
|
-
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
4745
|
-
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
4746
|
-
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
4747
|
-
return acc.add(input.amount);
|
4748
|
-
}
|
4749
|
-
if (isRequestInputMessage(input) && assetId === baseAsset) {
|
4750
|
-
return acc.add(input.amount);
|
4751
|
-
}
|
4752
|
-
return acc;
|
4753
|
-
}, (0, import_math18.bn)(0));
|
4754
|
-
|
4755
4847
|
// src/utils/formatTransferToContractScriptData.ts
|
4756
4848
|
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
4757
|
-
var
|
4849
|
+
var import_math20 = require("@fuel-ts/math");
|
4758
4850
|
var import_utils26 = require("@fuel-ts/utils");
|
4759
4851
|
var asm = __toESM(require("@fuels/vm-asm"));
|
4760
4852
|
var formatTransferToContractScriptData = (params) => {
|
4761
4853
|
const { assetId, amountToTransfer, hexlifiedContractId } = params;
|
4762
4854
|
const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
|
4763
|
-
const encoded = numberCoder.encode(new
|
4855
|
+
const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
|
4764
4856
|
const scriptData = Uint8Array.from([
|
4765
4857
|
...(0, import_utils26.arrayify)(hexlifiedContractId),
|
4766
4858
|
...encoded,
|
@@ -4954,10 +5046,10 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4954
5046
|
async fund(request, params) {
|
4955
5047
|
const { addedSignatures, estimatedPredicates, maxFee: fee, requiredQuantities } = params;
|
4956
5048
|
const baseAssetId = this.provider.getBaseAssetId();
|
4957
|
-
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0,
|
5049
|
+
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math21.bn)(0);
|
4958
5050
|
const txRequest = request;
|
4959
5051
|
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
4960
|
-
amount: (0,
|
5052
|
+
amount: (0, import_math21.bn)(fee),
|
4961
5053
|
assetId: baseAssetId,
|
4962
5054
|
coinQuantities: requiredQuantities
|
4963
5055
|
});
|
@@ -4965,7 +5057,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4965
5057
|
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
4966
5058
|
quantitiesDict[assetId] = {
|
4967
5059
|
required: amount,
|
4968
|
-
owned: (0,
|
5060
|
+
owned: (0, import_math21.bn)(0)
|
4969
5061
|
};
|
4970
5062
|
});
|
4971
5063
|
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
@@ -4989,7 +5081,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4989
5081
|
while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
|
4990
5082
|
const resources = await this.getResourcesToSpend(
|
4991
5083
|
missingQuantities,
|
4992
|
-
|
5084
|
+
cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
|
4993
5085
|
);
|
4994
5086
|
request.addResources(resources);
|
4995
5087
|
txRequest.shiftPredicateData();
|
@@ -5070,7 +5162,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5070
5162
|
* @returns A promise that resolves to the transaction response.
|
5071
5163
|
*/
|
5072
5164
|
async transfer(destination, amount, assetId, txParams = {}) {
|
5073
|
-
if ((0,
|
5165
|
+
if ((0, import_math21.bn)(amount).lte(0)) {
|
5074
5166
|
throw new import_errors16.FuelError(
|
5075
5167
|
import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
5076
5168
|
"Transfer amount must be a positive number."
|
@@ -5090,7 +5182,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5090
5182
|
* @returns A promise that resolves to the transaction response.
|
5091
5183
|
*/
|
5092
5184
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
5093
|
-
if ((0,
|
5185
|
+
if ((0, import_math21.bn)(amount).lte(0)) {
|
5094
5186
|
throw new import_errors16.FuelError(
|
5095
5187
|
import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
5096
5188
|
"Transfer amount must be a positive number."
|
@@ -5100,7 +5192,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5100
5192
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
5101
5193
|
const { script, scriptData } = await assembleTransferToContractScript({
|
5102
5194
|
hexlifiedContractId: contractAddress.toB256(),
|
5103
|
-
amountToTransfer: (0,
|
5195
|
+
amountToTransfer: (0, import_math21.bn)(amount),
|
5104
5196
|
assetId: assetIdToTransfer
|
5105
5197
|
});
|
5106
5198
|
const request = new ScriptTransactionRequest({
|
@@ -5111,7 +5203,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5111
5203
|
request.addContractInputAndOutput(contractAddress);
|
5112
5204
|
const txCost = await this.provider.getTransactionCost(request, {
|
5113
5205
|
resourcesOwner: this,
|
5114
|
-
quantitiesToContract: [{ amount: (0,
|
5206
|
+
quantitiesToContract: [{ amount: (0, import_math21.bn)(amount), assetId: String(assetIdToTransfer) }]
|
5115
5207
|
});
|
5116
5208
|
this.validateGasLimitAndMaxFee({
|
5117
5209
|
gasUsed: txCost.gasUsed,
|
@@ -5137,7 +5229,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5137
5229
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5138
5230
|
);
|
5139
5231
|
const amountDataArray = (0, import_utils27.arrayify)(
|
5140
|
-
"0x".concat((0,
|
5232
|
+
"0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
|
5141
5233
|
);
|
5142
5234
|
const script = new Uint8Array([
|
5143
5235
|
...(0, import_utils27.arrayify)(withdrawScript.bytes),
|
@@ -5147,7 +5239,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5147
5239
|
const params = { script, ...txParams };
|
5148
5240
|
const baseAssetId = this.provider.getBaseAssetId();
|
5149
5241
|
const request = new ScriptTransactionRequest(params);
|
5150
|
-
const quantitiesToContract = [{ amount: (0,
|
5242
|
+
const quantitiesToContract = [{ amount: (0, import_math21.bn)(amount), assetId: baseAssetId }];
|
5151
5243
|
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
5152
5244
|
this.validateGasLimitAndMaxFee({
|
5153
5245
|
gasUsed: txCost.gasUsed,
|
@@ -5238,7 +5330,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5238
5330
|
var import_address5 = require("@fuel-ts/address");
|
5239
5331
|
var import_crypto2 = require("@fuel-ts/crypto");
|
5240
5332
|
var import_hasher2 = require("@fuel-ts/hasher");
|
5241
|
-
var
|
5333
|
+
var import_math22 = require("@fuel-ts/math");
|
5242
5334
|
var import_utils28 = require("@fuel-ts/utils");
|
5243
5335
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
5244
5336
|
var Signer = class {
|
@@ -5258,7 +5350,7 @@ var Signer = class {
|
|
5258
5350
|
privateKey = `0x${privateKey}`;
|
5259
5351
|
}
|
5260
5352
|
}
|
5261
|
-
const privateKeyBytes = (0,
|
5353
|
+
const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
|
5262
5354
|
this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
|
5263
5355
|
this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
5264
5356
|
this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
|
@@ -5276,8 +5368,8 @@ var Signer = class {
|
|
5276
5368
|
*/
|
5277
5369
|
sign(data) {
|
5278
5370
|
const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
|
5279
|
-
const r = (0,
|
5280
|
-
const s = (0,
|
5371
|
+
const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
|
5372
|
+
const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
|
5281
5373
|
s[0] |= (signature.recovery || 0) << 7;
|
5282
5374
|
return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
|
5283
5375
|
}
|
@@ -5549,7 +5641,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
5549
5641
|
// src/hdwallet/hdwallet.ts
|
5550
5642
|
var import_errors20 = require("@fuel-ts/errors");
|
5551
5643
|
var import_hasher6 = require("@fuel-ts/hasher");
|
5552
|
-
var
|
5644
|
+
var import_math23 = require("@fuel-ts/math");
|
5553
5645
|
var import_utils34 = require("@fuel-ts/utils");
|
5554
5646
|
var import_ethers2 = require("ethers");
|
5555
5647
|
|
@@ -8009,13 +8101,13 @@ var HDWallet = class {
|
|
8009
8101
|
} else {
|
8010
8102
|
data.set((0, import_utils34.arrayify)(this.publicKey));
|
8011
8103
|
}
|
8012
|
-
data.set((0,
|
8104
|
+
data.set((0, import_math23.toBytes)(index, 4), 33);
|
8013
8105
|
const bytes = (0, import_utils34.arrayify)((0, import_ethers2.computeHmac)("sha512", chainCode, data));
|
8014
8106
|
const IL = bytes.slice(0, 32);
|
8015
8107
|
const IR = bytes.slice(32);
|
8016
8108
|
if (privateKey) {
|
8017
8109
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
8018
|
-
const ki = (0,
|
8110
|
+
const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
|
8019
8111
|
return new HDWallet({
|
8020
8112
|
privateKey: ki,
|
8021
8113
|
chainCode: IR,
|
@@ -8061,7 +8153,7 @@ var HDWallet = class {
|
|
8061
8153
|
const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
|
8062
8154
|
const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
|
8063
8155
|
const parentFingerprint = this.parentFingerprint;
|
8064
|
-
const index = (0,
|
8156
|
+
const index = (0, import_math23.toHex)(this.index, 4);
|
8065
8157
|
const chainCode = this.chainCode;
|
8066
8158
|
const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
|
8067
8159
|
const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
|
@@ -8281,16 +8373,18 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
|
8281
8373
|
|
8282
8374
|
// src/test-utils/seedTestWallet.ts
|
8283
8375
|
var import_crypto5 = require("@fuel-ts/crypto");
|
8284
|
-
var seedTestWallet = async (wallet, quantities) => {
|
8285
|
-
const
|
8286
|
-
|
8287
|
-
|
8288
|
-
);
|
8376
|
+
var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
|
8377
|
+
const accountsToBeFunded = Array.isArray(wallet) ? wallet : [wallet];
|
8378
|
+
const [{ provider }] = accountsToBeFunded;
|
8379
|
+
const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET || (0, import_crypto5.randomBytes)(32), provider);
|
8289
8380
|
const request = new ScriptTransactionRequest();
|
8290
|
-
quantities.forEach(
|
8291
|
-
|
8292
|
-
|
8293
|
-
|
8381
|
+
quantities.map(coinQuantityfy).forEach(
|
8382
|
+
({ amount, assetId }) => accountsToBeFunded.forEach(({ address }) => {
|
8383
|
+
for (let i = 0; i < utxosAmount; i++) {
|
8384
|
+
request.addCoinOutput(address, amount.div(utxosAmount), assetId);
|
8385
|
+
}
|
8386
|
+
})
|
8387
|
+
);
|
8294
8388
|
const txCost = await genesisWallet.provider.getTransactionCost(request);
|
8295
8389
|
request.gasLimit = txCost.gasUsed;
|
8296
8390
|
request.maxFee = txCost.maxFee;
|
@@ -8430,9 +8524,11 @@ var launchNode = async ({
|
|
8430
8524
|
const chainConfigWritePath = import_path.default.join(tempDirPath, "chainConfig.json");
|
8431
8525
|
const stateConfigWritePath = import_path.default.join(tempDirPath, "stateConfig.json");
|
8432
8526
|
const metadataWritePath = import_path.default.join(tempDirPath, "metadata.json");
|
8527
|
+
const stateTransitionWritePath = import_path.default.join(tempDirPath, "state_transition_bytecode.wasm");
|
8433
8528
|
(0, import_fs.writeFileSync)(chainConfigWritePath, JSON.stringify(chainConfigJson), "utf8");
|
8434
8529
|
(0, import_fs.writeFileSync)(stateConfigWritePath, fixedStateConfigJSON, "utf8");
|
8435
8530
|
(0, import_fs.writeFileSync)(metadataWritePath, JSON.stringify(metadataJson), "utf8");
|
8531
|
+
(0, import_fs.writeFileSync)(stateTransitionWritePath, JSON.stringify(""));
|
8436
8532
|
snapshotDirToUse = tempDirPath;
|
8437
8533
|
}
|
8438
8534
|
const child = (0, import_child_process.spawn)(
|