@fuel-ts/account 0.99.0 → 0.100.0
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.
- package/dist/account.d.ts +9 -4
- package/dist/account.d.ts.map +1 -1
- package/dist/connectors/fuel-connector.d.ts +7 -6
- package/dist/connectors/fuel-connector.d.ts.map +1 -1
- package/dist/connectors/types/data-type.d.ts +8 -1
- package/dist/connectors/types/data-type.d.ts.map +1 -1
- package/dist/index.global.js +4116 -3431
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +970 -562
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +900 -502
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts +1 -1
- package/dist/providers/__generated__/operations.d.ts +98 -3
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +75 -11
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/resource-cache.d.ts +6 -4
- package/dist/providers/resource-cache.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts +10 -1
- package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +29 -1
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary-from-serialized.d.ts +7 -0
- package/dist/providers/transaction-summary/assemble-transaction-summary-from-serialized.d.ts.map +1 -0
- package/dist/providers/transaction-summary/call.d.ts +8 -2
- package/dist/providers/transaction-summary/call.d.ts.map +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts +1 -1
- package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/index.d.ts +1 -0
- package/dist/providers/transaction-summary/index.d.ts.map +1 -1
- package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
- package/dist/providers/transaction-summary/receipt.d.ts +3 -2
- package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +5 -3
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/providers/utils/handle-gql-error-message.d.ts +0 -4
- package/dist/providers/utils/handle-gql-error-message.d.ts.map +1 -1
- package/dist/providers/utils/helpers.d.ts +14 -0
- package/dist/providers/utils/helpers.d.ts.map +1 -0
- package/dist/providers/utils/index.d.ts +1 -0
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/providers/utils/receipts.d.ts +4 -3
- package/dist/providers/utils/receipts.d.ts.map +1 -1
- package/dist/providers/utils/serialization.d.ts +35 -0
- package/dist/providers/utils/serialization.d.ts.map +1 -0
- package/dist/signer/signer.d.ts +1 -1
- package/dist/test-utils.global.js +3839 -3179
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +895 -537
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +827 -469
- package/dist/test-utils.mjs.map +1 -1
- package/dist/utils/formatTransferToContractScriptData.d.ts +3 -3
- package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -1
- package/dist/utils/predicate-script-loader-instructions.d.ts +2 -2
- package/dist/wallet/base-wallet-unlocked.d.ts +2 -1
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +21 -21
package/dist/index.js
CHANGED
@@ -61,6 +61,7 @@ __export(src_exports, {
|
|
61
61
|
AbstractScriptRequest: () => AbstractScriptRequest,
|
62
62
|
Account: () => Account,
|
63
63
|
AddressType: () => AddressType,
|
64
|
+
BALANCES_PAGE_SIZE_LIMIT: () => BALANCES_PAGE_SIZE_LIMIT,
|
64
65
|
BLOCKS_PAGE_SIZE_LIMIT: () => BLOCKS_PAGE_SIZE_LIMIT,
|
65
66
|
BaseTransactionRequest: () => BaseTransactionRequest,
|
66
67
|
BaseWalletUnlocked: () => BaseWalletUnlocked,
|
@@ -96,7 +97,7 @@ __export(src_exports, {
|
|
96
97
|
TRANSACTIONS_PAGE_SIZE_LIMIT: () => TRANSACTIONS_PAGE_SIZE_LIMIT,
|
97
98
|
TransactionResponse: () => TransactionResponse,
|
98
99
|
TransactionStatus: () => TransactionStatus,
|
99
|
-
TransactionType: () =>
|
100
|
+
TransactionType: () => import_transactions8.TransactionType,
|
100
101
|
TransactionTypeName: () => TransactionTypeName,
|
101
102
|
UpgradeTransactionRequest: () => UpgradeTransactionRequest,
|
102
103
|
UploadTransactionRequest: () => UploadTransactionRequest,
|
@@ -112,6 +113,7 @@ __export(src_exports, {
|
|
112
113
|
assembleReceiptByType: () => assembleReceiptByType,
|
113
114
|
assembleRevertError: () => assembleRevertError,
|
114
115
|
assembleTransactionSummary: () => assembleTransactionSummary,
|
116
|
+
assembleTransactionSummaryFromJson: () => assembleTransactionSummaryFromJson,
|
115
117
|
assets: () => assets,
|
116
118
|
buildBlockExplorerUrl: () => buildBlockExplorerUrl,
|
117
119
|
cacheFor: () => cacheFor,
|
@@ -128,6 +130,10 @@ __export(src_exports, {
|
|
128
130
|
coinQuantityfy: () => coinQuantityfy,
|
129
131
|
deferPromise: () => deferPromise,
|
130
132
|
deployScriptOrPredicate: () => deployScriptOrPredicate,
|
133
|
+
deserializeChain: () => deserializeChain,
|
134
|
+
deserializeNodeInfo: () => deserializeNodeInfo,
|
135
|
+
deserializeProviderCache: () => deserializeProviderCache,
|
136
|
+
deserializeReceipt: () => deserializeReceipt,
|
131
137
|
dispatchFuelConnectorEvent: () => dispatchFuelConnectorEvent,
|
132
138
|
english: () => english,
|
133
139
|
extractBurnedAssetsFromReceipts: () => extractBurnedAssetsFromReceipts,
|
@@ -192,6 +198,7 @@ __export(src_exports, {
|
|
192
198
|
isInputCoin: () => isInputCoin,
|
193
199
|
isMessage: () => isMessage,
|
194
200
|
isMessageCoin: () => isMessageCoin,
|
201
|
+
isPredicate: () => isPredicate,
|
195
202
|
isRawCoin: () => isRawCoin,
|
196
203
|
isRawMessage: () => isRawMessage,
|
197
204
|
isRequestInputCoin: () => isRequestInputCoin,
|
@@ -220,6 +227,9 @@ __export(src_exports, {
|
|
220
227
|
resolveGasDependentCosts: () => resolveGasDependentCosts,
|
221
228
|
resolveIconPaths: () => resolveIconPaths,
|
222
229
|
returnZeroScript: () => returnZeroScript,
|
230
|
+
serializeChain: () => serializeChain,
|
231
|
+
serializeNodeInfo: () => serializeNodeInfo,
|
232
|
+
serializeProviderCache: () => serializeProviderCache,
|
223
233
|
transactionRequestify: () => transactionRequestify,
|
224
234
|
urlJoin: () => urlJoin,
|
225
235
|
validateTransactionForAssetBurn: () => validateTransactionForAssetBurn,
|
@@ -929,12 +939,12 @@ var getAssetsByOwner = async (opts) => {
|
|
929
939
|
};
|
930
940
|
|
931
941
|
// src/account.ts
|
932
|
-
var
|
942
|
+
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
933
943
|
var import_address5 = require("@fuel-ts/address");
|
934
944
|
var import_crypto2 = require("@fuel-ts/crypto");
|
935
945
|
var import_errors21 = require("@fuel-ts/errors");
|
936
|
-
var
|
937
|
-
var
|
946
|
+
var import_math21 = require("@fuel-ts/math");
|
947
|
+
var import_transactions26 = require("@fuel-ts/transactions");
|
938
948
|
var import_utils34 = require("@fuel-ts/utils");
|
939
949
|
var import_ramda9 = require("ramda");
|
940
950
|
|
@@ -954,10 +964,9 @@ var coinQuantityfy = (coinQuantityLike) => {
|
|
954
964
|
assetId = coinQuantityLike.assetId;
|
955
965
|
max = coinQuantityLike.max ?? void 0;
|
956
966
|
}
|
957
|
-
const bnAmount = (0, import_math.bn)(amount);
|
958
967
|
return {
|
959
968
|
assetId: (0, import_utils2.hexlify)(assetId),
|
960
|
-
amount:
|
969
|
+
amount: (0, import_math.bn)(amount),
|
961
970
|
max: max ? (0, import_math.bn)(max) : void 0
|
962
971
|
};
|
963
972
|
};
|
@@ -977,10 +986,9 @@ var addAmountToCoinQuantities = (params) => {
|
|
977
986
|
var import_address3 = require("@fuel-ts/address");
|
978
987
|
var import_errors19 = require("@fuel-ts/errors");
|
979
988
|
var import_math18 = require("@fuel-ts/math");
|
980
|
-
var
|
989
|
+
var import_transactions23 = require("@fuel-ts/transactions");
|
981
990
|
var import_utils29 = require("@fuel-ts/utils");
|
982
991
|
var import_versions = require("@fuel-ts/versions");
|
983
|
-
var import_utils30 = require("@noble/curves/abstract/utils");
|
984
992
|
var import_graphql_request = require("graphql-request");
|
985
993
|
var import_graphql_tag2 = __toESM(require("graphql-tag"));
|
986
994
|
var import_ramda8 = require("ramda");
|
@@ -1592,6 +1600,16 @@ var EstimatePredicatesDocument = import_graphql_tag.default`
|
|
1592
1600
|
}
|
1593
1601
|
}
|
1594
1602
|
${TransactionEstimatePredicatesFragmentDoc}`;
|
1603
|
+
var EstimatePredicatesAndGasPriceDocument = import_graphql_tag.default`
|
1604
|
+
query estimatePredicatesAndGasPrice($encodedTransaction: HexString!, $blockHorizon: U32!) {
|
1605
|
+
estimatePredicates(tx: $encodedTransaction) {
|
1606
|
+
...transactionEstimatePredicatesFragment
|
1607
|
+
}
|
1608
|
+
estimateGasPrice(blockHorizon: $blockHorizon) {
|
1609
|
+
gasPrice
|
1610
|
+
}
|
1611
|
+
}
|
1612
|
+
${TransactionEstimatePredicatesFragmentDoc}`;
|
1595
1613
|
var GetLatestBlockDocument = import_graphql_tag.default`
|
1596
1614
|
query getLatestBlock {
|
1597
1615
|
chain {
|
@@ -1707,6 +1725,13 @@ var GetBalanceDocument = import_graphql_tag.default`
|
|
1707
1725
|
}
|
1708
1726
|
}
|
1709
1727
|
`;
|
1728
|
+
var GetBalanceV2Document = import_graphql_tag.default`
|
1729
|
+
query getBalanceV2($owner: Address!, $assetId: AssetId!) {
|
1730
|
+
balance(owner: $owner, assetId: $assetId) {
|
1731
|
+
amountU128
|
1732
|
+
}
|
1733
|
+
}
|
1734
|
+
`;
|
1710
1735
|
var GetLatestGasPriceDocument = import_graphql_tag.default`
|
1711
1736
|
query getLatestGasPrice {
|
1712
1737
|
latestGasPrice {
|
@@ -1739,6 +1764,27 @@ var GetBalancesDocument = import_graphql_tag.default`
|
|
1739
1764
|
}
|
1740
1765
|
}
|
1741
1766
|
`;
|
1767
|
+
var GetBalancesV2Document = import_graphql_tag.default`
|
1768
|
+
query getBalancesV2($filter: BalanceFilterInput!, $after: String, $before: String, $first: Int, $last: Int) {
|
1769
|
+
balances(
|
1770
|
+
filter: $filter
|
1771
|
+
after: $after
|
1772
|
+
before: $before
|
1773
|
+
first: $first
|
1774
|
+
last: $last
|
1775
|
+
) {
|
1776
|
+
pageInfo {
|
1777
|
+
...pageInfoFragment
|
1778
|
+
}
|
1779
|
+
edges {
|
1780
|
+
node {
|
1781
|
+
assetId
|
1782
|
+
amountU128
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
}
|
1786
|
+
}
|
1787
|
+
${PageInfoFragmentDoc}`;
|
1742
1788
|
var GetMessagesDocument = import_graphql_tag.default`
|
1743
1789
|
query getMessages($owner: Address!, $after: String, $before: String, $first: Int, $last: Int) {
|
1744
1790
|
messages(
|
@@ -1793,6 +1839,15 @@ var GetRelayedTransactionStatusDocument = import_graphql_tag.default`
|
|
1793
1839
|
}
|
1794
1840
|
}
|
1795
1841
|
${RelayedTransactionStatusFragmentDoc}`;
|
1842
|
+
var GetAssetDetailsDocument = import_graphql_tag.default`
|
1843
|
+
query getAssetDetails($assetId: AssetId!) {
|
1844
|
+
assetDetails(id: $assetId) {
|
1845
|
+
subId
|
1846
|
+
contractId
|
1847
|
+
totalSupply
|
1848
|
+
}
|
1849
|
+
}
|
1850
|
+
`;
|
1796
1851
|
var DryRunDocument = import_graphql_tag.default`
|
1797
1852
|
mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
|
1798
1853
|
dryRun(
|
@@ -1893,6 +1948,9 @@ function getSdk(requester) {
|
|
1893
1948
|
estimatePredicates(variables, options) {
|
1894
1949
|
return requester(EstimatePredicatesDocument, variables, options);
|
1895
1950
|
},
|
1951
|
+
estimatePredicatesAndGasPrice(variables, options) {
|
1952
|
+
return requester(EstimatePredicatesAndGasPriceDocument, variables, options);
|
1953
|
+
},
|
1896
1954
|
getLatestBlock(variables, options) {
|
1897
1955
|
return requester(GetLatestBlockDocument, variables, options);
|
1898
1956
|
},
|
@@ -1926,6 +1984,9 @@ function getSdk(requester) {
|
|
1926
1984
|
getBalance(variables, options) {
|
1927
1985
|
return requester(GetBalanceDocument, variables, options);
|
1928
1986
|
},
|
1987
|
+
getBalanceV2(variables, options) {
|
1988
|
+
return requester(GetBalanceV2Document, variables, options);
|
1989
|
+
},
|
1929
1990
|
getLatestGasPrice(variables, options) {
|
1930
1991
|
return requester(GetLatestGasPriceDocument, variables, options);
|
1931
1992
|
},
|
@@ -1935,6 +1996,9 @@ function getSdk(requester) {
|
|
1935
1996
|
getBalances(variables, options) {
|
1936
1997
|
return requester(GetBalancesDocument, variables, options);
|
1937
1998
|
},
|
1999
|
+
getBalancesV2(variables, options) {
|
2000
|
+
return requester(GetBalancesV2Document, variables, options);
|
2001
|
+
},
|
1938
2002
|
getMessages(variables, options) {
|
1939
2003
|
return requester(GetMessagesDocument, variables, options);
|
1940
2004
|
},
|
@@ -1950,6 +2014,9 @@ function getSdk(requester) {
|
|
1950
2014
|
getRelayedTransactionStatus(variables, options) {
|
1951
2015
|
return requester(GetRelayedTransactionStatusDocument, variables, options);
|
1952
2016
|
},
|
2017
|
+
getAssetDetails(variables, options) {
|
2018
|
+
return requester(GetAssetDetailsDocument, variables, options);
|
2019
|
+
},
|
1953
2020
|
dryRun(variables, options) {
|
1954
2021
|
return requester(DryRunDocument, variables, options);
|
1955
2022
|
},
|
@@ -1984,24 +2051,23 @@ var import_graphql = require("graphql");
|
|
1984
2051
|
// src/providers/utils/handle-gql-error-message.ts
|
1985
2052
|
var import_errors = require("@fuel-ts/errors");
|
1986
2053
|
var mapGqlErrorMessage = (error) => {
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
default:
|
2003
|
-
return new import_errors.FuelError(import_errors.ErrorCode.INVALID_REQUEST, error.message, {}, error);
|
2054
|
+
if (new RegExp("the target cannot be met due to no coins available or exceeding the \\d+ coin limit." /* NOT_ENOUGH_COINS_MAX_COINS */).test(error.message)) {
|
2055
|
+
return new import_errors.FuelError(
|
2056
|
+
import_errors.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
2057
|
+
`Insufficient funds or too many small value coins. Consider combining UTXOs.`,
|
2058
|
+
{},
|
2059
|
+
error
|
2060
|
+
);
|
2061
|
+
}
|
2062
|
+
if (new RegExp("resource was not found in table" /* ASSET_NOT_FOUND */).test(error.message)) {
|
2063
|
+
return new import_errors.FuelError(
|
2064
|
+
import_errors.ErrorCode.ASSET_NOT_FOUND,
|
2065
|
+
`Asset not found for given asset id.`,
|
2066
|
+
{},
|
2067
|
+
error
|
2068
|
+
);
|
2004
2069
|
}
|
2070
|
+
return new import_errors.FuelError(import_errors.ErrorCode.INVALID_REQUEST, error.message, {}, error);
|
2005
2071
|
};
|
2006
2072
|
var mapGqlErrorWithIncompatibleNodeVersion = (error, incompatibleNodeVersionMessage) => {
|
2007
2073
|
if (!incompatibleNodeVersionMessage) {
|
@@ -2101,97 +2167,39 @@ __publicField(FuelGraphqlSubscriber, "incompatibleNodeVersionMessage", false);
|
|
2101
2167
|
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
2102
2168
|
|
2103
2169
|
// src/providers/resource-cache.ts
|
2104
|
-
var
|
2105
|
-
var
|
2106
|
-
var cache = /* @__PURE__ */ new Map();
|
2107
|
-
var ResourceCache = class {
|
2108
|
-
ttl;
|
2109
|
-
constructor(ttl) {
|
2110
|
-
this.ttl = ttl;
|
2111
|
-
if (typeof ttl !== "number" || this.ttl <= 0) {
|
2112
|
-
throw new import_errors3.FuelError(
|
2113
|
-
import_errors3.ErrorCode.INVALID_TTL,
|
2114
|
-
`Invalid TTL: ${this.ttl}. Use a value greater than zero.`
|
2115
|
-
);
|
2116
|
-
}
|
2117
|
-
}
|
2118
|
-
// Add resources to the cache
|
2119
|
-
set(transactionId, resources) {
|
2120
|
-
const currentTime = Date.now();
|
2121
|
-
const existingResources = cache.get(transactionId) || {
|
2122
|
-
utxos: /* @__PURE__ */ new Set(),
|
2123
|
-
messages: /* @__PURE__ */ new Set(),
|
2124
|
-
timestamp: currentTime
|
2125
|
-
};
|
2126
|
-
resources.utxos.forEach((utxo) => existingResources.utxos.add((0, import_utils3.hexlify)(utxo)));
|
2127
|
-
resources.messages.forEach((message) => existingResources.messages.add((0, import_utils3.hexlify)(message)));
|
2128
|
-
cache.set(transactionId, existingResources);
|
2129
|
-
}
|
2130
|
-
// Remove resources from the cache for a given transaction ID
|
2131
|
-
unset(transactionId) {
|
2132
|
-
cache.delete(transactionId);
|
2133
|
-
}
|
2134
|
-
// Get all cached resources and remove expired ones
|
2135
|
-
getActiveData() {
|
2136
|
-
const allResources = { utxos: [], messages: [] };
|
2137
|
-
const currentTime = Date.now();
|
2138
|
-
cache.forEach((resource, transactionId) => {
|
2139
|
-
if (currentTime - resource.timestamp < this.ttl) {
|
2140
|
-
allResources.utxos.push(...resource.utxos);
|
2141
|
-
allResources.messages.push(...resource.messages);
|
2142
|
-
} else {
|
2143
|
-
cache.delete(transactionId);
|
2144
|
-
}
|
2145
|
-
});
|
2146
|
-
return allResources;
|
2147
|
-
}
|
2148
|
-
// Check if a UTXO ID or message nonce is already cached and not expired
|
2149
|
-
isCached(key) {
|
2150
|
-
const currentTime = Date.now();
|
2151
|
-
for (const [transactionId, resourceData] of cache.entries()) {
|
2152
|
-
if (currentTime - resourceData.timestamp > this.ttl) {
|
2153
|
-
cache.delete(transactionId);
|
2154
|
-
} else if (resourceData.utxos.has(key) || resourceData.messages.has(key)) {
|
2155
|
-
return true;
|
2156
|
-
}
|
2157
|
-
}
|
2158
|
-
return false;
|
2159
|
-
}
|
2160
|
-
clear() {
|
2161
|
-
cache.clear();
|
2162
|
-
}
|
2163
|
-
};
|
2170
|
+
var import_errors13 = require("@fuel-ts/errors");
|
2171
|
+
var import_utils22 = require("@fuel-ts/utils");
|
2164
2172
|
|
2165
2173
|
// src/providers/transaction-request/input.ts
|
2166
2174
|
var import_abi_coder = require("@fuel-ts/abi-coder");
|
2167
2175
|
var import_configs = require("@fuel-ts/address/configs");
|
2168
|
-
var
|
2176
|
+
var import_errors3 = require("@fuel-ts/errors");
|
2169
2177
|
var import_math2 = require("@fuel-ts/math");
|
2170
2178
|
var import_transactions = require("@fuel-ts/transactions");
|
2171
|
-
var
|
2179
|
+
var import_utils3 = require("@fuel-ts/utils");
|
2172
2180
|
var inputify = (value) => {
|
2173
2181
|
const { type } = value;
|
2174
2182
|
switch (value.type) {
|
2175
2183
|
case import_transactions.InputType.Coin: {
|
2176
|
-
const predicate = (0,
|
2177
|
-
const predicateData = (0,
|
2184
|
+
const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
|
2185
|
+
const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
|
2178
2186
|
return {
|
2179
2187
|
type: import_transactions.InputType.Coin,
|
2180
|
-
txID: (0,
|
2181
|
-
outputIndex: (0, import_math2.toNumber)((0,
|
2182
|
-
owner: (0,
|
2188
|
+
txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, import_abi_coder.BYTES_32)),
|
2189
|
+
outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(import_abi_coder.BYTES_32, import_abi_coder.UTXO_ID_LEN)),
|
2190
|
+
owner: (0, import_utils3.hexlify)(value.owner),
|
2183
2191
|
amount: (0, import_math2.bn)(value.amount),
|
2184
|
-
assetId: (0,
|
2192
|
+
assetId: (0, import_utils3.hexlify)(value.assetId),
|
2185
2193
|
txPointer: {
|
2186
|
-
blockHeight: (0, import_math2.toNumber)((0,
|
2187
|
-
txIndex: (0, import_math2.toNumber)((0,
|
2194
|
+
blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
|
2195
|
+
txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
|
2188
2196
|
},
|
2189
2197
|
witnessIndex: value.witnessIndex,
|
2190
2198
|
predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
|
2191
2199
|
predicateLength: (0, import_math2.bn)(predicate.length),
|
2192
2200
|
predicateDataLength: (0, import_math2.bn)(predicateData.length),
|
2193
|
-
predicate: (0,
|
2194
|
-
predicateData: (0,
|
2201
|
+
predicate: (0, import_utils3.hexlify)(predicate),
|
2202
|
+
predicateData: (0, import_utils3.hexlify)(predicateData)
|
2195
2203
|
};
|
2196
2204
|
}
|
2197
2205
|
case import_transactions.InputType.Contract: {
|
@@ -2202,35 +2210,35 @@ var inputify = (value) => {
|
|
2202
2210
|
balanceRoot: import_configs.ZeroBytes32,
|
2203
2211
|
stateRoot: import_configs.ZeroBytes32,
|
2204
2212
|
txPointer: {
|
2205
|
-
blockHeight: (0, import_math2.toNumber)((0,
|
2206
|
-
txIndex: (0, import_math2.toNumber)((0,
|
2213
|
+
blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
|
2214
|
+
txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
|
2207
2215
|
},
|
2208
|
-
contractID: (0,
|
2216
|
+
contractID: (0, import_utils3.hexlify)(value.contractId)
|
2209
2217
|
};
|
2210
2218
|
}
|
2211
2219
|
case import_transactions.InputType.Message: {
|
2212
|
-
const predicate = (0,
|
2213
|
-
const predicateData = (0,
|
2214
|
-
const data = (0,
|
2220
|
+
const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
|
2221
|
+
const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
|
2222
|
+
const data = (0, import_utils3.arrayify)(value.data ?? "0x");
|
2215
2223
|
return {
|
2216
2224
|
type: import_transactions.InputType.Message,
|
2217
|
-
sender: (0,
|
2218
|
-
recipient: (0,
|
2225
|
+
sender: (0, import_utils3.hexlify)(value.sender),
|
2226
|
+
recipient: (0, import_utils3.hexlify)(value.recipient),
|
2219
2227
|
amount: (0, import_math2.bn)(value.amount),
|
2220
|
-
nonce: (0,
|
2228
|
+
nonce: (0, import_utils3.hexlify)(value.nonce),
|
2221
2229
|
witnessIndex: value.witnessIndex,
|
2222
2230
|
predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
|
2223
2231
|
predicateLength: (0, import_math2.bn)(predicate.length),
|
2224
2232
|
predicateDataLength: (0, import_math2.bn)(predicateData.length),
|
2225
|
-
predicate: (0,
|
2226
|
-
predicateData: (0,
|
2227
|
-
data: (0,
|
2233
|
+
predicate: (0, import_utils3.hexlify)(predicate),
|
2234
|
+
predicateData: (0, import_utils3.hexlify)(predicateData),
|
2235
|
+
data: (0, import_utils3.hexlify)(data),
|
2228
2236
|
dataLength: data.length
|
2229
2237
|
};
|
2230
2238
|
}
|
2231
2239
|
default: {
|
2232
|
-
throw new
|
2233
|
-
|
2240
|
+
throw new import_errors3.FuelError(
|
2241
|
+
import_errors3.ErrorCode.INVALID_TRANSACTION_INPUT,
|
2234
2242
|
`Invalid transaction input type: ${type}.`
|
2235
2243
|
);
|
2236
2244
|
}
|
@@ -2239,19 +2247,19 @@ var inputify = (value) => {
|
|
2239
2247
|
|
2240
2248
|
// src/providers/transaction-request/output.ts
|
2241
2249
|
var import_configs2 = require("@fuel-ts/address/configs");
|
2242
|
-
var
|
2250
|
+
var import_errors4 = require("@fuel-ts/errors");
|
2243
2251
|
var import_math3 = require("@fuel-ts/math");
|
2244
2252
|
var import_transactions2 = require("@fuel-ts/transactions");
|
2245
|
-
var
|
2253
|
+
var import_utils4 = require("@fuel-ts/utils");
|
2246
2254
|
var outputify = (value) => {
|
2247
2255
|
const { type } = value;
|
2248
2256
|
switch (type) {
|
2249
2257
|
case import_transactions2.OutputType.Coin: {
|
2250
2258
|
return {
|
2251
2259
|
type: import_transactions2.OutputType.Coin,
|
2252
|
-
to: (0,
|
2260
|
+
to: (0, import_utils4.hexlify)(value.to),
|
2253
2261
|
amount: (0, import_math3.bn)(value.amount),
|
2254
|
-
assetId: (0,
|
2262
|
+
assetId: (0, import_utils4.hexlify)(value.assetId)
|
2255
2263
|
};
|
2256
2264
|
}
|
2257
2265
|
case import_transactions2.OutputType.Contract: {
|
@@ -2265,9 +2273,9 @@ var outputify = (value) => {
|
|
2265
2273
|
case import_transactions2.OutputType.Change: {
|
2266
2274
|
return {
|
2267
2275
|
type: import_transactions2.OutputType.Change,
|
2268
|
-
to: (0,
|
2276
|
+
to: (0, import_utils4.hexlify)(value.to),
|
2269
2277
|
amount: (0, import_math3.bn)(0),
|
2270
|
-
assetId: (0,
|
2278
|
+
assetId: (0, import_utils4.hexlify)(value.assetId)
|
2271
2279
|
};
|
2272
2280
|
}
|
2273
2281
|
case import_transactions2.OutputType.Variable: {
|
@@ -2281,13 +2289,13 @@ var outputify = (value) => {
|
|
2281
2289
|
case import_transactions2.OutputType.ContractCreated: {
|
2282
2290
|
return {
|
2283
2291
|
type: import_transactions2.OutputType.ContractCreated,
|
2284
|
-
contractId: (0,
|
2285
|
-
stateRoot: (0,
|
2292
|
+
contractId: (0, import_utils4.hexlify)(value.contractId),
|
2293
|
+
stateRoot: (0, import_utils4.hexlify)(value.stateRoot)
|
2286
2294
|
};
|
2287
2295
|
}
|
2288
2296
|
default: {
|
2289
|
-
throw new
|
2290
|
-
|
2297
|
+
throw new import_errors4.FuelError(
|
2298
|
+
import_errors4.ErrorCode.INVALID_TRANSACTION_INPUT,
|
2291
2299
|
`Invalid transaction output type: ${type}.`
|
2292
2300
|
);
|
2293
2301
|
}
|
@@ -2299,9 +2307,9 @@ var import_abi_coder2 = require("@fuel-ts/abi-coder");
|
|
2299
2307
|
var import_address = require("@fuel-ts/address");
|
2300
2308
|
var import_configs6 = require("@fuel-ts/address/configs");
|
2301
2309
|
var import_crypto = require("@fuel-ts/crypto");
|
2302
|
-
var
|
2310
|
+
var import_errors9 = require("@fuel-ts/errors");
|
2303
2311
|
var import_math8 = require("@fuel-ts/math");
|
2304
|
-
var
|
2312
|
+
var import_transactions8 = require("@fuel-ts/transactions");
|
2305
2313
|
var import_utils10 = require("@fuel-ts/utils");
|
2306
2314
|
|
2307
2315
|
// src/providers/message.ts
|
@@ -2314,31 +2322,157 @@ var isCoin = (resource) => "id" in resource;
|
|
2314
2322
|
var isMessage = (resource) => "recipient" in resource;
|
2315
2323
|
|
2316
2324
|
// src/providers/utils/receipts.ts
|
2325
|
+
var import_transactions4 = require("@fuel-ts/transactions");
|
2326
|
+
var import_configs4 = require("@fuel-ts/transactions/configs");
|
2327
|
+
|
2328
|
+
// src/providers/utils/serialization.ts
|
2317
2329
|
var import_configs3 = require("@fuel-ts/address/configs");
|
2318
|
-
var
|
2330
|
+
var import_errors5 = require("@fuel-ts/errors");
|
2319
2331
|
var import_math4 = require("@fuel-ts/math");
|
2320
2332
|
var import_transactions3 = require("@fuel-ts/transactions");
|
2321
|
-
var
|
2322
|
-
var
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2333
|
+
var import_utils5 = require("@fuel-ts/utils");
|
2334
|
+
var deserializeChain = (chain) => {
|
2335
|
+
const { name, daHeight, consensusParameters } = chain;
|
2336
|
+
const {
|
2337
|
+
contractParams,
|
2338
|
+
feeParams,
|
2339
|
+
predicateParams,
|
2340
|
+
scriptParams,
|
2341
|
+
txParams,
|
2342
|
+
gasCosts,
|
2343
|
+
baseAssetId,
|
2344
|
+
chainId,
|
2345
|
+
version
|
2346
|
+
} = consensusParameters;
|
2347
|
+
return {
|
2348
|
+
name,
|
2349
|
+
baseChainHeight: (0, import_math4.bn)(daHeight),
|
2350
|
+
consensusParameters: {
|
2351
|
+
version,
|
2352
|
+
chainId: (0, import_math4.bn)(chainId),
|
2353
|
+
baseAssetId,
|
2354
|
+
feeParameters: {
|
2355
|
+
version: feeParams.version,
|
2356
|
+
gasPerByte: (0, import_math4.bn)(feeParams.gasPerByte),
|
2357
|
+
gasPriceFactor: (0, import_math4.bn)(feeParams.gasPriceFactor)
|
2358
|
+
},
|
2359
|
+
contractParameters: {
|
2360
|
+
version: contractParams.version,
|
2361
|
+
contractMaxSize: (0, import_math4.bn)(contractParams.contractMaxSize),
|
2362
|
+
maxStorageSlots: (0, import_math4.bn)(contractParams.maxStorageSlots)
|
2363
|
+
},
|
2364
|
+
txParameters: {
|
2365
|
+
version: txParams.version,
|
2366
|
+
maxInputs: (0, import_math4.bn)(txParams.maxInputs),
|
2367
|
+
maxOutputs: (0, import_math4.bn)(txParams.maxOutputs),
|
2368
|
+
maxWitnesses: (0, import_math4.bn)(txParams.maxWitnesses),
|
2369
|
+
maxGasPerTx: (0, import_math4.bn)(txParams.maxGasPerTx),
|
2370
|
+
maxSize: (0, import_math4.bn)(txParams.maxSize),
|
2371
|
+
maxBytecodeSubsections: (0, import_math4.bn)(txParams.maxBytecodeSubsections)
|
2372
|
+
},
|
2373
|
+
predicateParameters: {
|
2374
|
+
version: predicateParams.version,
|
2375
|
+
maxPredicateLength: (0, import_math4.bn)(predicateParams.maxPredicateLength),
|
2376
|
+
maxPredicateDataLength: (0, import_math4.bn)(predicateParams.maxPredicateDataLength),
|
2377
|
+
maxGasPerPredicate: (0, import_math4.bn)(predicateParams.maxGasPerPredicate),
|
2378
|
+
maxMessageDataLength: (0, import_math4.bn)(predicateParams.maxMessageDataLength)
|
2379
|
+
},
|
2380
|
+
scriptParameters: {
|
2381
|
+
version: scriptParams.version,
|
2382
|
+
maxScriptLength: (0, import_math4.bn)(scriptParams.maxScriptLength),
|
2383
|
+
maxScriptDataLength: (0, import_math4.bn)(scriptParams.maxScriptDataLength)
|
2384
|
+
},
|
2385
|
+
gasCosts
|
2329
2386
|
}
|
2330
|
-
|
2331
|
-
|
2387
|
+
};
|
2388
|
+
};
|
2389
|
+
var serializeChain = (chain) => {
|
2390
|
+
const { name, baseChainHeight, consensusParameters } = chain;
|
2391
|
+
const {
|
2392
|
+
contractParameters,
|
2393
|
+
feeParameters,
|
2394
|
+
predicateParameters,
|
2395
|
+
scriptParameters,
|
2396
|
+
txParameters,
|
2397
|
+
gasCosts,
|
2398
|
+
baseAssetId,
|
2399
|
+
chainId,
|
2400
|
+
version
|
2401
|
+
} = consensusParameters;
|
2402
|
+
return {
|
2403
|
+
name,
|
2404
|
+
daHeight: baseChainHeight.toString(),
|
2405
|
+
consensusParameters: {
|
2406
|
+
version,
|
2407
|
+
chainId: chainId.toString(),
|
2408
|
+
baseAssetId,
|
2409
|
+
feeParams: {
|
2410
|
+
version: feeParameters.version,
|
2411
|
+
gasPerByte: feeParameters.gasPerByte.toString(),
|
2412
|
+
gasPriceFactor: feeParameters.gasPriceFactor.toString()
|
2413
|
+
},
|
2414
|
+
contractParams: {
|
2415
|
+
version: contractParameters.version,
|
2416
|
+
contractMaxSize: contractParameters.contractMaxSize.toString(),
|
2417
|
+
maxStorageSlots: contractParameters.maxStorageSlots.toString()
|
2418
|
+
},
|
2419
|
+
txParams: {
|
2420
|
+
version: txParameters.version,
|
2421
|
+
maxInputs: txParameters.maxInputs.toString(),
|
2422
|
+
maxOutputs: txParameters.maxOutputs.toString(),
|
2423
|
+
maxWitnesses: txParameters.maxWitnesses.toString(),
|
2424
|
+
maxGasPerTx: txParameters.maxGasPerTx.toString(),
|
2425
|
+
maxSize: txParameters.maxSize.toString(),
|
2426
|
+
maxBytecodeSubsections: txParameters.maxBytecodeSubsections.toString()
|
2427
|
+
},
|
2428
|
+
predicateParams: {
|
2429
|
+
version: predicateParameters.version,
|
2430
|
+
maxPredicateLength: predicateParameters.maxPredicateLength.toString(),
|
2431
|
+
maxPredicateDataLength: predicateParameters.maxPredicateDataLength.toString(),
|
2432
|
+
maxGasPerPredicate: predicateParameters.maxGasPerPredicate.toString(),
|
2433
|
+
maxMessageDataLength: predicateParameters.maxMessageDataLength.toString()
|
2434
|
+
},
|
2435
|
+
scriptParams: {
|
2436
|
+
version: scriptParameters.version,
|
2437
|
+
maxScriptLength: scriptParameters.maxScriptLength.toString(),
|
2438
|
+
maxScriptDataLength: scriptParameters.maxScriptDataLength.toString()
|
2439
|
+
},
|
2440
|
+
gasCosts
|
2332
2441
|
}
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
)
|
2442
|
+
};
|
2443
|
+
};
|
2444
|
+
var deserializeNodeInfo = (nodeInfo) => {
|
2445
|
+
const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
|
2446
|
+
return {
|
2447
|
+
maxDepth: (0, import_math4.bn)(maxDepth),
|
2448
|
+
maxTx: (0, import_math4.bn)(maxTx),
|
2449
|
+
nodeVersion,
|
2450
|
+
utxoValidation,
|
2451
|
+
vmBacktrace
|
2452
|
+
};
|
2453
|
+
};
|
2454
|
+
var serializeNodeInfo = (nodeInfo) => {
|
2455
|
+
const { maxDepth, maxTx, nodeVersion, utxoValidation, vmBacktrace } = nodeInfo;
|
2456
|
+
return {
|
2457
|
+
maxDepth: maxDepth.toString(),
|
2458
|
+
maxTx: maxTx.toString(),
|
2459
|
+
nodeVersion,
|
2460
|
+
utxoValidation,
|
2461
|
+
vmBacktrace
|
2462
|
+
};
|
2463
|
+
};
|
2464
|
+
var deserializeProviderCache = (cache2) => ({
|
2465
|
+
consensusParametersTimestamp: cache2.consensusParametersTimestamp,
|
2466
|
+
chain: deserializeChain(cache2.chain),
|
2467
|
+
nodeInfo: deserializeNodeInfo(cache2.nodeInfo)
|
2468
|
+
});
|
2469
|
+
var serializeProviderCache = async (provider) => ({
|
2470
|
+
consensusParametersTimestamp: provider.consensusParametersTimestamp,
|
2471
|
+
chain: serializeChain(await provider.getChain()),
|
2472
|
+
nodeInfo: serializeNodeInfo(await provider.getNode())
|
2473
|
+
});
|
2340
2474
|
var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
|
2341
|
-
|
2475
|
+
var deserializeReceipt = (receipt) => {
|
2342
2476
|
const { receiptType } = receipt;
|
2343
2477
|
switch (receiptType) {
|
2344
2478
|
case "CALL" /* Call */: {
|
@@ -2474,7 +2608,7 @@ function assembleReceiptByType(receipt) {
|
|
2474
2608
|
const recipient = hexOrZero(receipt.recipient);
|
2475
2609
|
const nonce = hexOrZero(receipt.nonce);
|
2476
2610
|
const amount = (0, import_math4.bn)(receipt.amount);
|
2477
|
-
const data = receipt.data ? (0,
|
2611
|
+
const data = receipt.data ? (0, import_utils5.arrayify)(receipt.data) : Uint8Array.from([]);
|
2478
2612
|
const digest = hexOrZero(receipt.digest);
|
2479
2613
|
const len = (0, import_math4.bn)(receipt.len).toNumber();
|
2480
2614
|
const messageId = import_transactions3.InputMessageCoder.getMessageId({
|
@@ -2482,7 +2616,7 @@ function assembleReceiptByType(receipt) {
|
|
2482
2616
|
recipient,
|
2483
2617
|
nonce,
|
2484
2618
|
amount,
|
2485
|
-
data: (0,
|
2619
|
+
data: (0, import_utils5.hexlify)(data)
|
2486
2620
|
});
|
2487
2621
|
const receiptMessageOut = {
|
2488
2622
|
type: import_transactions3.ReceiptType.MessageOut,
|
@@ -2528,12 +2662,32 @@ function assembleReceiptByType(receipt) {
|
|
2528
2662
|
return burnReceipt;
|
2529
2663
|
}
|
2530
2664
|
default:
|
2531
|
-
throw new
|
2665
|
+
throw new import_errors5.FuelError(import_errors5.ErrorCode.INVALID_RECEIPT_TYPE, `Invalid receipt type: ${receiptType}.`);
|
2532
2666
|
}
|
2533
|
-
}
|
2667
|
+
};
|
2668
|
+
|
2669
|
+
// src/providers/utils/receipts.ts
|
2670
|
+
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions4.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
2671
|
+
var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions4.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
|
2672
|
+
var getReceiptsWithMissingData = (receipts) => receipts.reduce(
|
2673
|
+
(memo, receipt) => {
|
2674
|
+
if (doesReceiptHaveMissingOutputVariables(receipt)) {
|
2675
|
+
memo.missingOutputVariables.push(receipt);
|
2676
|
+
}
|
2677
|
+
if (doesReceiptHaveMissingContractId(receipt)) {
|
2678
|
+
memo.missingOutputContractIds.push(receipt);
|
2679
|
+
}
|
2680
|
+
return memo;
|
2681
|
+
},
|
2682
|
+
{
|
2683
|
+
missingOutputVariables: [],
|
2684
|
+
missingOutputContractIds: []
|
2685
|
+
}
|
2686
|
+
);
|
2687
|
+
var assembleReceiptByType = (gqlReceipt) => deserializeReceipt(gqlReceipt);
|
2534
2688
|
|
2535
2689
|
// src/providers/utils/block-explorer.ts
|
2536
|
-
var
|
2690
|
+
var import_errors6 = require("@fuel-ts/errors");
|
2537
2691
|
var DEFAULT_BLOCK_EXPLORER_URL = "https://app.fuel.network";
|
2538
2692
|
var getPathFromInput = (key, value) => {
|
2539
2693
|
const pathMap = {
|
@@ -2567,15 +2721,15 @@ var buildBlockExplorerUrl = (options = {}) => {
|
|
2567
2721
|
}));
|
2568
2722
|
const hasAnyDefinedValues = definedValues.length > 0;
|
2569
2723
|
if (definedValues.length > 1) {
|
2570
|
-
throw new
|
2571
|
-
|
2724
|
+
throw new import_errors6.FuelError(
|
2725
|
+
import_errors6.ErrorCode.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2572
2726
|
`Only one of the following can be passed in to buildBlockExplorerUrl: ${customInputParams.map((param) => param.key).join(", ")}.`
|
2573
2727
|
);
|
2574
2728
|
}
|
2575
2729
|
if (path && definedValues.length > 0) {
|
2576
2730
|
const inputKeys = customInputParams.map(({ key }) => key).join(", ");
|
2577
|
-
throw new
|
2578
|
-
|
2731
|
+
throw new import_errors6.FuelError(
|
2732
|
+
import_errors6.ErrorCode.ERROR_BUILDING_BLOCK_EXPLORER_URL,
|
2579
2733
|
`You cannot pass in a path to 'buildBlockExplorerUrl' along with any of the following: ${inputKeys}.`
|
2580
2734
|
);
|
2581
2735
|
}
|
@@ -2596,11 +2750,11 @@ var buildBlockExplorerUrl = (options = {}) => {
|
|
2596
2750
|
|
2597
2751
|
// src/providers/utils/gas.ts
|
2598
2752
|
var import_math5 = require("@fuel-ts/math");
|
2599
|
-
var
|
2600
|
-
var
|
2753
|
+
var import_transactions5 = require("@fuel-ts/transactions");
|
2754
|
+
var import_utils6 = require("@fuel-ts/utils");
|
2601
2755
|
var getGasUsedFromReceipts = (receipts) => {
|
2602
2756
|
const scriptResult = receipts.filter(
|
2603
|
-
(receipt) => receipt.type ===
|
2757
|
+
(receipt) => receipt.type === import_transactions5.ReceiptType.ScriptResult
|
2604
2758
|
);
|
2605
2759
|
const gasUsed = scriptResult.reduce((prev, receipt) => prev.add(receipt.gasUsed), (0, import_math5.bn)(0));
|
2606
2760
|
return gasUsed;
|
@@ -2634,7 +2788,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
|
2634
2788
|
const totalGas = chargeableInputs.reduce((total, input) => {
|
2635
2789
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
2636
2790
|
return total.add(
|
2637
|
-
vmInitializationCost.add(resolveGasDependentCosts((0,
|
2791
|
+
vmInitializationCost.add(resolveGasDependentCosts((0, import_utils6.arrayify)(input.predicate).length, gasCosts.contractRoot)).add((0, import_math5.bn)(input.predicateGasUsed))
|
2638
2792
|
);
|
2639
2793
|
}
|
2640
2794
|
return total.add(gasCosts.ecr1);
|
@@ -2733,13 +2887,13 @@ var calculateGasFee = (params) => {
|
|
2733
2887
|
};
|
2734
2888
|
|
2735
2889
|
// src/providers/utils/json.ts
|
2736
|
-
var
|
2890
|
+
var import_utils7 = require("@fuel-ts/utils");
|
2737
2891
|
var import_ramda = require("ramda");
|
2738
2892
|
function normalize(object) {
|
2739
2893
|
Object.keys(object).forEach((key) => {
|
2740
2894
|
switch (object[key]?.constructor.name) {
|
2741
2895
|
case "Uint8Array":
|
2742
|
-
object[key] = (0,
|
2896
|
+
object[key] = (0, import_utils7.hexlify)(object[key]);
|
2743
2897
|
break;
|
2744
2898
|
case "Array":
|
2745
2899
|
object[key] = normalize(object[key]);
|
@@ -2764,9 +2918,9 @@ function normalizeJSON(root) {
|
|
2764
2918
|
}
|
2765
2919
|
|
2766
2920
|
// src/providers/utils/extract-tx-error.ts
|
2767
|
-
var
|
2921
|
+
var import_errors7 = require("@fuel-ts/errors");
|
2768
2922
|
var import_math6 = require("@fuel-ts/math");
|
2769
|
-
var
|
2923
|
+
var import_transactions6 = require("@fuel-ts/transactions");
|
2770
2924
|
var import_configs5 = require("@fuel-ts/transactions/configs");
|
2771
2925
|
var assemblePanicError = (statusReason, metadata) => {
|
2772
2926
|
let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
|
@@ -2777,7 +2931,7 @@ You can read more about this error at:
|
|
2777
2931
|
|
2778
2932
|
${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
|
2779
2933
|
}
|
2780
|
-
return new
|
2934
|
+
return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
2781
2935
|
...metadata,
|
2782
2936
|
reason: statusReason
|
2783
2937
|
});
|
@@ -2785,7 +2939,7 @@ ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
|
|
2785
2939
|
var stringify = (obj) => JSON.stringify(obj, null, 2);
|
2786
2940
|
var assembleRevertError = (receipts, logs, metadata) => {
|
2787
2941
|
let errorMessage = "The transaction reverted with an unknown reason.";
|
2788
|
-
const revertReceipt = receipts.find(({ type }) => type ===
|
2942
|
+
const revertReceipt = receipts.find(({ type }) => type === import_transactions6.ReceiptType.Revert);
|
2789
2943
|
let reason = "";
|
2790
2944
|
if (revertReceipt) {
|
2791
2945
|
const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
|
@@ -2798,15 +2952,15 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2798
2952
|
break;
|
2799
2953
|
}
|
2800
2954
|
case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
|
2801
|
-
const
|
2955
|
+
const suffix = logs.length >= 2 ? ` comparing ${stringify(lastLog)} and ${stringify(lastButOneLog)}.` : ".";
|
2802
2956
|
reason = "assert_eq";
|
2803
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${
|
2957
|
+
errorMessage = `The transaction reverted because of an "assert_eq" statement${suffix}`;
|
2804
2958
|
break;
|
2805
2959
|
}
|
2806
2960
|
case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
|
2807
|
-
const
|
2961
|
+
const suffix = logs.length >= 2 ? ` comparing ${stringify(lastButOneLog)} and ${stringify(lastLog)}.` : ".";
|
2808
2962
|
reason = "assert_ne";
|
2809
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${
|
2963
|
+
errorMessage = `The transaction reverted because of an "assert_ne" statement${suffix}`;
|
2810
2964
|
break;
|
2811
2965
|
}
|
2812
2966
|
case import_configs5.FAILED_ASSERT_SIGNAL:
|
@@ -2814,12 +2968,12 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2814
2968
|
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
2815
2969
|
break;
|
2816
2970
|
case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
2817
|
-
reason = "
|
2818
|
-
errorMessage = `The transaction reverted because it's missing an "
|
2971
|
+
reason = "MissingOutputVariable";
|
2972
|
+
errorMessage = `The transaction reverted because it's missing an "OutputVariable".`;
|
2819
2973
|
break;
|
2820
2974
|
default:
|
2821
|
-
throw new
|
2822
|
-
|
2975
|
+
throw new import_errors7.FuelError(
|
2976
|
+
import_errors7.ErrorCode.UNKNOWN,
|
2823
2977
|
`The transaction reverted with an unknown reason: ${revertReceipt.val}`,
|
2824
2978
|
{
|
2825
2979
|
...metadata,
|
@@ -2828,15 +2982,15 @@ var assembleRevertError = (receipts, logs, metadata) => {
|
|
2828
2982
|
);
|
2829
2983
|
}
|
2830
2984
|
}
|
2831
|
-
return new
|
2985
|
+
return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
|
2832
2986
|
...metadata,
|
2833
2987
|
reason
|
2834
2988
|
});
|
2835
2989
|
};
|
2836
2990
|
var extractTxError = (params) => {
|
2837
2991
|
const { receipts, statusReason, logs } = params;
|
2838
|
-
const isPanic = receipts.some(({ type }) => type ===
|
2839
|
-
const isRevert = receipts.some(({ type }) => type ===
|
2992
|
+
const isPanic = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Panic);
|
2993
|
+
const isRevert = receipts.some(({ type }) => type === import_transactions6.ReceiptType.Revert);
|
2840
2994
|
const metadata = {
|
2841
2995
|
logs,
|
2842
2996
|
receipts,
|
@@ -2873,16 +3027,18 @@ var NoWitnessByOwnerError = class extends Error {
|
|
2873
3027
|
};
|
2874
3028
|
|
2875
3029
|
// src/providers/transaction-request/helpers.ts
|
2876
|
-
var
|
3030
|
+
var import_errors8 = require("@fuel-ts/errors");
|
2877
3031
|
var import_math7 = require("@fuel-ts/math");
|
2878
|
-
var
|
2879
|
-
var
|
2880
|
-
var
|
2881
|
-
var
|
3032
|
+
var import_transactions7 = require("@fuel-ts/transactions");
|
3033
|
+
var import_utils8 = require("@fuel-ts/utils");
|
3034
|
+
var isRequestInputCoin = (input) => input.type === import_transactions7.InputType.Coin;
|
3035
|
+
var isRequestInputMessage = (input) => input.type === import_transactions7.InputType.Message;
|
3036
|
+
var isRequestInputMessageWithoutData = (input) => input.type === import_transactions7.InputType.Message && (0, import_math7.bn)(input.data).isZero();
|
2882
3037
|
var isRequestInputCoinOrMessage = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
2883
3038
|
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessageWithoutData(input);
|
2884
3039
|
var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
|
2885
3040
|
var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
|
3041
|
+
var isPredicate = (input) => isRequestInputCoinOrMessage(input) && !!input.predicate && (0, import_utils8.hexlify)(input.predicate) !== "0x";
|
2886
3042
|
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
2887
3043
|
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
2888
3044
|
return acc.add(input.amount);
|
@@ -2927,7 +3083,7 @@ var getBurnableAssetCount = (baseAssetId, transactionRequest) => {
|
|
2927
3083
|
coinInputs.add(baseAssetId);
|
2928
3084
|
}
|
2929
3085
|
const changeOutputs = new Set(
|
2930
|
-
outputs.filter((output) => output.type ===
|
3086
|
+
outputs.filter((output) => output.type === import_transactions7.OutputType.Change).map((output) => output.assetId)
|
2931
3087
|
);
|
2932
3088
|
const difference = new Set([...coinInputs].filter((x) => !changeOutputs.has(x)));
|
2933
3089
|
return difference.size;
|
@@ -2944,7 +3100,7 @@ var validateTransactionForAssetBurn = (baseAssetId, transactionRequest, enableAs
|
|
2944
3100
|
"Add the relevant change outputs to the transaction to avoid burning assets.",
|
2945
3101
|
"Or enable asset burn, upon sending the transaction."
|
2946
3102
|
].join("\n");
|
2947
|
-
throw new
|
3103
|
+
throw new import_errors8.FuelError(import_errors8.ErrorCode.ASSET_BURN_DETECTED, message);
|
2948
3104
|
};
|
2949
3105
|
|
2950
3106
|
// src/providers/transaction-request/witness.ts
|
@@ -2963,6 +3119,8 @@ var BaseTransactionRequest = class {
|
|
2963
3119
|
tip;
|
2964
3120
|
/** Block until which tx cannot be included */
|
2965
3121
|
maturity;
|
3122
|
+
/** The block number after which the transaction is no longer valid. */
|
3123
|
+
expiration;
|
2966
3124
|
/** The maximum fee payable by this transaction using BASE_ASSET. */
|
2967
3125
|
maxFee;
|
2968
3126
|
/** The maximum amount of witness data allowed for the transaction */
|
@@ -2973,6 +3131,12 @@ var BaseTransactionRequest = class {
|
|
2973
3131
|
outputs = [];
|
2974
3132
|
/** List of witnesses */
|
2975
3133
|
witnesses = [];
|
3134
|
+
/**
|
3135
|
+
* @hidden
|
3136
|
+
*
|
3137
|
+
* The current status of the transaction
|
3138
|
+
*/
|
3139
|
+
flag = { state: void 0, transactionId: void 0, summary: void 0 };
|
2976
3140
|
/**
|
2977
3141
|
* Constructor for initializing a base transaction request.
|
2978
3142
|
*
|
@@ -2981,6 +3145,7 @@ var BaseTransactionRequest = class {
|
|
2981
3145
|
constructor({
|
2982
3146
|
tip,
|
2983
3147
|
maturity,
|
3148
|
+
expiration,
|
2984
3149
|
maxFee,
|
2985
3150
|
witnessLimit,
|
2986
3151
|
inputs,
|
@@ -2989,6 +3154,7 @@ var BaseTransactionRequest = class {
|
|
2989
3154
|
} = {}) {
|
2990
3155
|
this.tip = tip ? (0, import_math8.bn)(tip) : void 0;
|
2991
3156
|
this.maturity = maturity && maturity > 0 ? maturity : void 0;
|
3157
|
+
this.expiration = expiration && expiration > 0 ? expiration : void 0;
|
2992
3158
|
this.witnessLimit = (0, import_utils10.isDefined)(witnessLimit) ? (0, import_math8.bn)(witnessLimit) : void 0;
|
2993
3159
|
this.maxFee = (0, import_math8.bn)(maxFee);
|
2994
3160
|
this.inputs = inputs ?? [];
|
@@ -2998,21 +3164,25 @@ var BaseTransactionRequest = class {
|
|
2998
3164
|
static getPolicyMeta(req) {
|
2999
3165
|
let policyTypes = 0;
|
3000
3166
|
const policies = [];
|
3001
|
-
const { tip, witnessLimit, maturity } = req;
|
3167
|
+
const { tip, witnessLimit, maturity, expiration } = req;
|
3002
3168
|
if ((0, import_math8.bn)(tip).gt(0)) {
|
3003
|
-
policyTypes +=
|
3004
|
-
policies.push({ data: (0, import_math8.bn)(tip), type:
|
3169
|
+
policyTypes += import_transactions8.PolicyType.Tip;
|
3170
|
+
policies.push({ data: (0, import_math8.bn)(tip), type: import_transactions8.PolicyType.Tip });
|
3005
3171
|
}
|
3006
3172
|
if ((0, import_utils10.isDefined)(witnessLimit) && (0, import_math8.bn)(witnessLimit).gte(0)) {
|
3007
|
-
policyTypes +=
|
3008
|
-
policies.push({ data: (0, import_math8.bn)(witnessLimit), type:
|
3173
|
+
policyTypes += import_transactions8.PolicyType.WitnessLimit;
|
3174
|
+
policies.push({ data: (0, import_math8.bn)(witnessLimit), type: import_transactions8.PolicyType.WitnessLimit });
|
3009
3175
|
}
|
3010
3176
|
if (maturity && maturity > 0) {
|
3011
|
-
policyTypes +=
|
3012
|
-
policies.push({ data: maturity, type:
|
3177
|
+
policyTypes += import_transactions8.PolicyType.Maturity;
|
3178
|
+
policies.push({ data: maturity, type: import_transactions8.PolicyType.Maturity });
|
3179
|
+
}
|
3180
|
+
policyTypes += import_transactions8.PolicyType.MaxFee;
|
3181
|
+
policies.push({ data: req.maxFee, type: import_transactions8.PolicyType.MaxFee });
|
3182
|
+
if (expiration && expiration > 0) {
|
3183
|
+
policyTypes += import_transactions8.PolicyType.Expiration;
|
3184
|
+
policies.push({ data: expiration, type: import_transactions8.PolicyType.Expiration });
|
3013
3185
|
}
|
3014
|
-
policyTypes += import_transactions7.PolicyType.MaxFee;
|
3015
|
-
policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
|
3016
3186
|
return {
|
3017
3187
|
policyTypes,
|
3018
3188
|
policies
|
@@ -3045,7 +3215,7 @@ var BaseTransactionRequest = class {
|
|
3045
3215
|
* @returns The transaction bytes.
|
3046
3216
|
*/
|
3047
3217
|
toTransactionBytes() {
|
3048
|
-
return new
|
3218
|
+
return new import_transactions8.TransactionCoder().encode(this.toTransaction());
|
3049
3219
|
}
|
3050
3220
|
/**
|
3051
3221
|
* @hidden
|
@@ -3085,8 +3255,7 @@ var BaseTransactionRequest = class {
|
|
3085
3255
|
* @returns The index of the created witness.
|
3086
3256
|
*/
|
3087
3257
|
addEmptyWitness() {
|
3088
|
-
this.addWitness((0, import_utils10.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
|
3089
|
-
return this.witnesses.length - 1;
|
3258
|
+
return this.addWitness((0, import_utils10.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
|
3090
3259
|
}
|
3091
3260
|
/**
|
3092
3261
|
* Updates the witness for a given owner and signature.
|
@@ -3136,7 +3305,7 @@ var BaseTransactionRequest = class {
|
|
3136
3305
|
*/
|
3137
3306
|
getCoinInputs() {
|
3138
3307
|
return this.inputs.filter(
|
3139
|
-
(input) => input.type ===
|
3308
|
+
(input) => input.type === import_transactions8.InputType.Coin
|
3140
3309
|
);
|
3141
3310
|
}
|
3142
3311
|
/**
|
@@ -3146,7 +3315,7 @@ var BaseTransactionRequest = class {
|
|
3146
3315
|
*/
|
3147
3316
|
getCoinOutputs() {
|
3148
3317
|
return this.outputs.filter(
|
3149
|
-
(output) => output.type ===
|
3318
|
+
(output) => output.type === import_transactions8.OutputType.Coin
|
3150
3319
|
);
|
3151
3320
|
}
|
3152
3321
|
/**
|
@@ -3156,7 +3325,7 @@ var BaseTransactionRequest = class {
|
|
3156
3325
|
*/
|
3157
3326
|
getChangeOutputs() {
|
3158
3327
|
return this.outputs.filter(
|
3159
|
-
(output) => output.type ===
|
3328
|
+
(output) => output.type === import_transactions8.OutputType.Change
|
3160
3329
|
);
|
3161
3330
|
}
|
3162
3331
|
/**
|
@@ -3168,9 +3337,9 @@ var BaseTransactionRequest = class {
|
|
3168
3337
|
const ownerAddress = (0, import_address.addressify)(owner);
|
3169
3338
|
const found = this.inputs.find((input) => {
|
3170
3339
|
switch (input.type) {
|
3171
|
-
case
|
3340
|
+
case import_transactions8.InputType.Coin:
|
3172
3341
|
return (0, import_utils10.hexlify)(input.owner) === ownerAddress.toB256();
|
3173
|
-
case
|
3342
|
+
case import_transactions8.InputType.Message:
|
3174
3343
|
return (0, import_utils10.hexlify)(input.recipient) === ownerAddress.toB256();
|
3175
3344
|
default:
|
3176
3345
|
return false;
|
@@ -3197,7 +3366,7 @@ var BaseTransactionRequest = class {
|
|
3197
3366
|
}
|
3198
3367
|
const input = {
|
3199
3368
|
id,
|
3200
|
-
type:
|
3369
|
+
type: import_transactions8.InputType.Coin,
|
3201
3370
|
owner: owner.toB256(),
|
3202
3371
|
amount,
|
3203
3372
|
assetId,
|
@@ -3228,7 +3397,7 @@ var BaseTransactionRequest = class {
|
|
3228
3397
|
}
|
3229
3398
|
const input = {
|
3230
3399
|
nonce,
|
3231
|
-
type:
|
3400
|
+
type: import_transactions8.InputType.Message,
|
3232
3401
|
sender: sender.toB256(),
|
3233
3402
|
recipient: recipient.toB256(),
|
3234
3403
|
data: isMessageCoin(message) ? "0x" : message.data,
|
@@ -3277,7 +3446,7 @@ var BaseTransactionRequest = class {
|
|
3277
3446
|
*/
|
3278
3447
|
addCoinOutput(to, amount, assetId) {
|
3279
3448
|
this.pushOutput({
|
3280
|
-
type:
|
3449
|
+
type: import_transactions8.OutputType.Coin,
|
3281
3450
|
to: (0, import_address.addressify)(to).toB256(),
|
3282
3451
|
amount,
|
3283
3452
|
assetId
|
@@ -3293,7 +3462,7 @@ var BaseTransactionRequest = class {
|
|
3293
3462
|
addCoinOutputs(to, quantities) {
|
3294
3463
|
quantities.map(coinQuantityfy).forEach((quantity) => {
|
3295
3464
|
this.pushOutput({
|
3296
|
-
type:
|
3465
|
+
type: import_transactions8.OutputType.Coin,
|
3297
3466
|
to: (0, import_address.addressify)(to).toB256(),
|
3298
3467
|
amount: quantity.amount,
|
3299
3468
|
assetId: quantity.assetId
|
@@ -3313,7 +3482,7 @@ var BaseTransactionRequest = class {
|
|
3313
3482
|
);
|
3314
3483
|
if (!changeOutput) {
|
3315
3484
|
this.pushOutput({
|
3316
|
-
type:
|
3485
|
+
type: import_transactions8.OutputType.Change,
|
3317
3486
|
to: (0, import_address.addressify)(to).toB256(),
|
3318
3487
|
assetId
|
3319
3488
|
});
|
@@ -3329,7 +3498,7 @@ var BaseTransactionRequest = class {
|
|
3329
3498
|
* @hidden
|
3330
3499
|
*/
|
3331
3500
|
metadataGas(_gasCosts) {
|
3332
|
-
throw new
|
3501
|
+
throw new import_errors9.FuelError(import_errors9.FuelError.CODES.NOT_IMPLEMENTED, "Not implemented");
|
3333
3502
|
}
|
3334
3503
|
/**
|
3335
3504
|
* @hidden
|
@@ -3456,6 +3625,21 @@ var BaseTransactionRequest = class {
|
|
3456
3625
|
byteLength() {
|
3457
3626
|
return this.toTransactionBytes().byteLength;
|
3458
3627
|
}
|
3628
|
+
/**
|
3629
|
+
* @hidden
|
3630
|
+
*
|
3631
|
+
* Used internally to update the state of a transaction request.
|
3632
|
+
*
|
3633
|
+
* @param state - The state to update.
|
3634
|
+
*/
|
3635
|
+
updateState(chainId, state, summary) {
|
3636
|
+
if (!state) {
|
3637
|
+
this.flag = { state: void 0, transactionId: void 0, summary: void 0 };
|
3638
|
+
return;
|
3639
|
+
}
|
3640
|
+
const transactionId = this.getTransactionId(chainId);
|
3641
|
+
this.flag = { state, transactionId, summary };
|
3642
|
+
}
|
3459
3643
|
};
|
3460
3644
|
|
3461
3645
|
// src/providers/transaction-request/blob-transaction-request.ts
|
@@ -3465,18 +3649,18 @@ var import_ramda3 = require("ramda");
|
|
3465
3649
|
var import_configs7 = require("@fuel-ts/address/configs");
|
3466
3650
|
var import_hasher = require("@fuel-ts/hasher");
|
3467
3651
|
var import_math9 = require("@fuel-ts/math");
|
3468
|
-
var
|
3652
|
+
var import_transactions9 = require("@fuel-ts/transactions");
|
3469
3653
|
var import_utils12 = require("@fuel-ts/utils");
|
3470
3654
|
var import_ramda2 = require("ramda");
|
3471
3655
|
function hashTransaction(transactionRequest, chainId) {
|
3472
3656
|
const transaction = transactionRequest.toTransaction();
|
3473
|
-
if (transaction.type ===
|
3657
|
+
if (transaction.type === import_transactions9.TransactionType.Script) {
|
3474
3658
|
transaction.receiptsRoot = import_configs7.ZeroBytes32;
|
3475
3659
|
}
|
3476
3660
|
transaction.inputs = transaction.inputs.map((input) => {
|
3477
3661
|
const inputClone = (0, import_ramda2.clone)(input);
|
3478
3662
|
switch (inputClone.type) {
|
3479
|
-
case
|
3663
|
+
case import_transactions9.InputType.Coin: {
|
3480
3664
|
inputClone.txPointer = {
|
3481
3665
|
blockHeight: 0,
|
3482
3666
|
txIndex: 0
|
@@ -3484,11 +3668,11 @@ function hashTransaction(transactionRequest, chainId) {
|
|
3484
3668
|
inputClone.predicateGasUsed = (0, import_math9.bn)(0);
|
3485
3669
|
return inputClone;
|
3486
3670
|
}
|
3487
|
-
case
|
3671
|
+
case import_transactions9.InputType.Message: {
|
3488
3672
|
inputClone.predicateGasUsed = (0, import_math9.bn)(0);
|
3489
3673
|
return inputClone;
|
3490
3674
|
}
|
3491
|
-
case
|
3675
|
+
case import_transactions9.InputType.Contract: {
|
3492
3676
|
inputClone.txPointer = {
|
3493
3677
|
blockHeight: 0,
|
3494
3678
|
txIndex: 0
|
@@ -3506,16 +3690,16 @@ function hashTransaction(transactionRequest, chainId) {
|
|
3506
3690
|
transaction.outputs = transaction.outputs.map((output) => {
|
3507
3691
|
const outputClone = (0, import_ramda2.clone)(output);
|
3508
3692
|
switch (outputClone.type) {
|
3509
|
-
case
|
3693
|
+
case import_transactions9.OutputType.Contract: {
|
3510
3694
|
outputClone.balanceRoot = import_configs7.ZeroBytes32;
|
3511
3695
|
outputClone.stateRoot = import_configs7.ZeroBytes32;
|
3512
3696
|
return outputClone;
|
3513
3697
|
}
|
3514
|
-
case
|
3698
|
+
case import_transactions9.OutputType.Change: {
|
3515
3699
|
outputClone.amount = (0, import_math9.bn)(0);
|
3516
3700
|
return outputClone;
|
3517
3701
|
}
|
3518
|
-
case
|
3702
|
+
case import_transactions9.OutputType.Variable: {
|
3519
3703
|
outputClone.to = import_configs7.ZeroBytes32;
|
3520
3704
|
outputClone.amount = (0, import_math9.bn)(0);
|
3521
3705
|
outputClone.assetId = import_configs7.ZeroBytes32;
|
@@ -3528,7 +3712,7 @@ function hashTransaction(transactionRequest, chainId) {
|
|
3528
3712
|
transaction.witnessesCount = 0;
|
3529
3713
|
transaction.witnesses = [];
|
3530
3714
|
const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
|
3531
|
-
const concatenatedData = (0, import_utils12.concat)([chainIdBytes, new
|
3715
|
+
const concatenatedData = (0, import_utils12.concat)([chainIdBytes, new import_transactions9.TransactionCoder().encode(transaction)]);
|
3532
3716
|
return (0, import_hasher.sha256)(concatenatedData);
|
3533
3717
|
}
|
3534
3718
|
|
@@ -3538,7 +3722,7 @@ var BlobTransactionRequest = class extends BaseTransactionRequest {
|
|
3538
3722
|
return new this((0, import_ramda3.clone)(obj));
|
3539
3723
|
}
|
3540
3724
|
/** Type of the transaction */
|
3541
|
-
type =
|
3725
|
+
type = import_transactions8.TransactionType.Blob;
|
3542
3726
|
/** Blob ID */
|
3543
3727
|
blobId;
|
3544
3728
|
/** Witness index of the bytecode to create */
|
@@ -3562,7 +3746,7 @@ var BlobTransactionRequest = class extends BaseTransactionRequest {
|
|
3562
3746
|
const baseTransaction = this.getBaseTransaction();
|
3563
3747
|
const { witnessIndex, blobId } = this;
|
3564
3748
|
return {
|
3565
|
-
type:
|
3749
|
+
type: import_transactions8.TransactionType.Blob,
|
3566
3750
|
...baseTransaction,
|
3567
3751
|
blobId,
|
3568
3752
|
witnessIndex
|
@@ -3596,7 +3780,7 @@ var BlobTransactionRequest = class extends BaseTransactionRequest {
|
|
3596
3780
|
// src/providers/transaction-request/create-transaction-request.ts
|
3597
3781
|
var import_configs8 = require("@fuel-ts/address/configs");
|
3598
3782
|
var import_math10 = require("@fuel-ts/math");
|
3599
|
-
var
|
3783
|
+
var import_transactions10 = require("@fuel-ts/transactions");
|
3600
3784
|
var import_utils15 = require("@fuel-ts/utils");
|
3601
3785
|
var import_ramda4 = require("ramda");
|
3602
3786
|
|
@@ -3629,7 +3813,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
3629
3813
|
return new this((0, import_ramda4.clone)(obj));
|
3630
3814
|
}
|
3631
3815
|
/** Type of the transaction */
|
3632
|
-
type =
|
3816
|
+
type = import_transactions10.TransactionType.Create;
|
3633
3817
|
/** Witness index of contract bytecode to create */
|
3634
3818
|
bytecodeWitnessIndex;
|
3635
3819
|
/** Salt */
|
@@ -3657,7 +3841,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
3657
3841
|
const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
|
3658
3842
|
const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
|
3659
3843
|
return {
|
3660
|
-
type:
|
3844
|
+
type: import_transactions10.TransactionType.Create,
|
3661
3845
|
...baseTransaction,
|
3662
3846
|
bytecodeWitnessIndex,
|
3663
3847
|
storageSlotsCount: (0, import_math10.bn)(storageSlots.length),
|
@@ -3672,7 +3856,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
3672
3856
|
*/
|
3673
3857
|
getContractCreatedOutputs() {
|
3674
3858
|
return this.outputs.filter(
|
3675
|
-
(output) => output.type ===
|
3859
|
+
(output) => output.type === import_transactions10.OutputType.ContractCreated
|
3676
3860
|
);
|
3677
3861
|
}
|
3678
3862
|
/**
|
@@ -3693,7 +3877,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
3693
3877
|
*/
|
3694
3878
|
addContractCreatedOutput(contractId, stateRoot) {
|
3695
3879
|
this.pushOutput({
|
3696
|
-
type:
|
3880
|
+
type: import_transactions10.OutputType.ContractCreated,
|
3697
3881
|
contractId,
|
3698
3882
|
stateRoot
|
3699
3883
|
});
|
@@ -3713,7 +3897,7 @@ var import_abi_coder3 = require("@fuel-ts/abi-coder");
|
|
3713
3897
|
var import_address2 = require("@fuel-ts/address");
|
3714
3898
|
var import_configs9 = require("@fuel-ts/address/configs");
|
3715
3899
|
var import_math11 = require("@fuel-ts/math");
|
3716
|
-
var
|
3900
|
+
var import_transactions11 = require("@fuel-ts/transactions");
|
3717
3901
|
var import_utils17 = require("@fuel-ts/utils");
|
3718
3902
|
var import_ramda5 = require("ramda");
|
3719
3903
|
|
@@ -3749,7 +3933,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3749
3933
|
return new this((0, import_ramda5.clone)(obj));
|
3750
3934
|
}
|
3751
3935
|
/** Type of the transaction */
|
3752
|
-
type =
|
3936
|
+
type = import_transactions11.TransactionType.Script;
|
3753
3937
|
/** Gas limit for transaction */
|
3754
3938
|
gasLimit;
|
3755
3939
|
/** Script to execute */
|
@@ -3792,7 +3976,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3792
3976
|
const script = (0, import_utils17.arrayify)(this.script ?? "0x");
|
3793
3977
|
const scriptData = (0, import_utils17.arrayify)(this.scriptData ?? "0x");
|
3794
3978
|
return {
|
3795
|
-
type:
|
3979
|
+
type: import_transactions11.TransactionType.Script,
|
3796
3980
|
scriptGasLimit: this.gasLimit,
|
3797
3981
|
...super.getBaseTransaction(),
|
3798
3982
|
scriptLength: (0, import_math11.bn)(script.length),
|
@@ -3809,7 +3993,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3809
3993
|
*/
|
3810
3994
|
getContractInputs() {
|
3811
3995
|
return this.inputs.filter(
|
3812
|
-
(input) => input.type ===
|
3996
|
+
(input) => input.type === import_transactions11.InputType.Contract
|
3813
3997
|
);
|
3814
3998
|
}
|
3815
3999
|
/**
|
@@ -3819,7 +4003,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3819
4003
|
*/
|
3820
4004
|
getContractOutputs() {
|
3821
4005
|
return this.outputs.filter(
|
3822
|
-
(output) => output.type ===
|
4006
|
+
(output) => output.type === import_transactions11.OutputType.Contract
|
3823
4007
|
);
|
3824
4008
|
}
|
3825
4009
|
/**
|
@@ -3829,7 +4013,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3829
4013
|
*/
|
3830
4014
|
getVariableOutputs() {
|
3831
4015
|
return this.outputs.filter(
|
3832
|
-
(output) => output.type ===
|
4016
|
+
(output) => output.type === import_transactions11.OutputType.Variable
|
3833
4017
|
);
|
3834
4018
|
}
|
3835
4019
|
/**
|
@@ -3852,7 +4036,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3852
4036
|
let outputsNumber = numberOfVariables;
|
3853
4037
|
while (outputsNumber) {
|
3854
4038
|
this.pushOutput({
|
3855
|
-
type:
|
4039
|
+
type: import_transactions11.OutputType.Variable
|
3856
4040
|
});
|
3857
4041
|
outputsNumber -= 1;
|
3858
4042
|
}
|
@@ -3896,12 +4080,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3896
4080
|
return this;
|
3897
4081
|
}
|
3898
4082
|
const inputIndex = super.pushInput({
|
3899
|
-
type:
|
4083
|
+
type: import_transactions11.InputType.Contract,
|
3900
4084
|
contractId: contractAddress.toB256(),
|
3901
4085
|
txPointer: "0x00000000000000000000000000000000"
|
3902
4086
|
});
|
3903
4087
|
this.pushOutput({
|
3904
|
-
type:
|
4088
|
+
type: import_transactions11.OutputType.Contract,
|
3905
4089
|
inputIndex
|
3906
4090
|
});
|
3907
4091
|
return this;
|
@@ -3937,9 +4121,9 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
3937
4121
|
};
|
3938
4122
|
|
3939
4123
|
// src/providers/transaction-request/upgrade-transaction-request.ts
|
3940
|
-
var
|
4124
|
+
var import_errors11 = require("@fuel-ts/errors");
|
3941
4125
|
var import_hasher2 = require("@fuel-ts/hasher");
|
3942
|
-
var
|
4126
|
+
var import_transactions12 = require("@fuel-ts/transactions");
|
3943
4127
|
var import_utils18 = require("@fuel-ts/utils");
|
3944
4128
|
var import_ramda6 = require("ramda");
|
3945
4129
|
var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
@@ -3950,7 +4134,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
3950
4134
|
return new this((0, import_ramda6.clone)(obj));
|
3951
4135
|
}
|
3952
4136
|
/** The type of transaction */
|
3953
|
-
type =
|
4137
|
+
type = import_transactions12.TransactionType.Upgrade;
|
3954
4138
|
/** The upgrade purpose */
|
3955
4139
|
upgradePurpose;
|
3956
4140
|
/** Witness index of consensus */
|
@@ -3968,7 +4152,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
3968
4152
|
super(rest);
|
3969
4153
|
this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
|
3970
4154
|
this.upgradePurpose = upgradePurpose ?? {
|
3971
|
-
type:
|
4155
|
+
type: import_transactions12.UpgradePurposeTypeEnum.ConsensusParameters,
|
3972
4156
|
checksum: "0x"
|
3973
4157
|
};
|
3974
4158
|
}
|
@@ -3982,7 +4166,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
3982
4166
|
addConsensusParametersUpgradePurpose(consensus) {
|
3983
4167
|
this.bytecodeWitnessIndex = this.addWitness(consensus);
|
3984
4168
|
this.upgradePurpose = {
|
3985
|
-
type:
|
4169
|
+
type: import_transactions12.UpgradePurposeTypeEnum.ConsensusParameters,
|
3986
4170
|
checksum: (0, import_hasher2.hash)(consensus)
|
3987
4171
|
};
|
3988
4172
|
return this;
|
@@ -3996,7 +4180,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
3996
4180
|
*/
|
3997
4181
|
addStateTransitionUpgradePurpose(bytecodeRoot) {
|
3998
4182
|
this.upgradePurpose = {
|
3999
|
-
type:
|
4183
|
+
type: import_transactions12.UpgradePurposeTypeEnum.StateTransition,
|
4000
4184
|
data: (0, import_utils18.hexlify)(bytecodeRoot)
|
4001
4185
|
};
|
4002
4186
|
return this;
|
@@ -4010,10 +4194,10 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4010
4194
|
* @returns - The current instance of `UpgradeTransactionRequest`.
|
4011
4195
|
*/
|
4012
4196
|
addUpgradePurpose(type, data) {
|
4013
|
-
if (type ===
|
4197
|
+
if (type === import_transactions12.UpgradePurposeTypeEnum.ConsensusParameters) {
|
4014
4198
|
this.addConsensusParametersUpgradePurpose(data);
|
4015
4199
|
}
|
4016
|
-
if (type ===
|
4200
|
+
if (type === import_transactions12.UpgradePurposeTypeEnum.StateTransition) {
|
4017
4201
|
this.addStateTransitionUpgradePurpose(data);
|
4018
4202
|
}
|
4019
4203
|
return this;
|
@@ -4025,26 +4209,26 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4025
4209
|
*/
|
4026
4210
|
toTransaction() {
|
4027
4211
|
let upgradePurpose;
|
4028
|
-
if (this.upgradePurpose.type ===
|
4212
|
+
if (this.upgradePurpose.type === import_transactions12.UpgradePurposeTypeEnum.ConsensusParameters) {
|
4029
4213
|
upgradePurpose = {
|
4030
|
-
type:
|
4214
|
+
type: import_transactions12.UpgradePurposeTypeEnum.ConsensusParameters,
|
4031
4215
|
data: {
|
4032
4216
|
witnessIndex: this.bytecodeWitnessIndex,
|
4033
4217
|
checksum: this.upgradePurpose.checksum
|
4034
4218
|
}
|
4035
4219
|
};
|
4036
|
-
} else if (this.upgradePurpose.type ===
|
4220
|
+
} else if (this.upgradePurpose.type === import_transactions12.UpgradePurposeTypeEnum.StateTransition) {
|
4037
4221
|
upgradePurpose = {
|
4038
|
-
type:
|
4222
|
+
type: import_transactions12.UpgradePurposeTypeEnum.StateTransition,
|
4039
4223
|
data: {
|
4040
4224
|
bytecodeRoot: (0, import_utils18.hexlify)(this.upgradePurpose.data)
|
4041
4225
|
}
|
4042
4226
|
};
|
4043
4227
|
} else {
|
4044
|
-
throw new
|
4228
|
+
throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4045
4229
|
}
|
4046
4230
|
return {
|
4047
|
-
type:
|
4231
|
+
type: import_transactions12.TransactionType.Upgrade,
|
4048
4232
|
...super.getBaseTransaction(),
|
4049
4233
|
upgradePurpose
|
4050
4234
|
};
|
@@ -4068,7 +4252,7 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4068
4252
|
*/
|
4069
4253
|
metadataGas(gasCosts) {
|
4070
4254
|
const txBytesSize = this.byteSize();
|
4071
|
-
if (this.upgradePurpose.type ===
|
4255
|
+
if (this.upgradePurpose.type === import_transactions12.UpgradePurposeTypeEnum.ConsensusParameters) {
|
4072
4256
|
const witnessIndex = this.bytecodeWitnessIndex;
|
4073
4257
|
const consensusSize = this.witnesses[witnessIndex].length;
|
4074
4258
|
return calculateMetadataGasForTxUpgrade({
|
@@ -4077,19 +4261,19 @@ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
|
|
4077
4261
|
consensusSize
|
4078
4262
|
});
|
4079
4263
|
}
|
4080
|
-
if (this.upgradePurpose.type ===
|
4264
|
+
if (this.upgradePurpose.type === import_transactions12.UpgradePurposeTypeEnum.StateTransition) {
|
4081
4265
|
return calculateMetadataGasForTxUpgrade({
|
4082
4266
|
gasCosts,
|
4083
4267
|
txBytesSize
|
4084
4268
|
});
|
4085
4269
|
}
|
4086
|
-
throw new
|
4270
|
+
throw new import_errors11.FuelError(import_errors11.FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
|
4087
4271
|
}
|
4088
4272
|
};
|
4089
4273
|
|
4090
4274
|
// src/providers/transaction-request/upload-transaction-request.ts
|
4091
4275
|
var import_configs10 = require("@fuel-ts/address/configs");
|
4092
|
-
var
|
4276
|
+
var import_transactions13 = require("@fuel-ts/transactions");
|
4093
4277
|
var import_utils20 = require("@fuel-ts/utils");
|
4094
4278
|
var import_ramda7 = require("ramda");
|
4095
4279
|
var UploadTransactionRequest = class extends BaseTransactionRequest {
|
@@ -4100,7 +4284,7 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
|
|
4100
4284
|
return new this((0, import_ramda7.clone)(obj));
|
4101
4285
|
}
|
4102
4286
|
/** Type of the transaction */
|
4103
|
-
type =
|
4287
|
+
type = import_transactions13.TransactionType.Upload;
|
4104
4288
|
/** The witness index of the subsection of the bytecode. */
|
4105
4289
|
witnessIndex;
|
4106
4290
|
/** The subsection data. */
|
@@ -4149,7 +4333,7 @@ var UploadTransactionRequest = class extends BaseTransactionRequest {
|
|
4149
4333
|
const baseTransaction = this.getBaseTransaction();
|
4150
4334
|
const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
|
4151
4335
|
return {
|
4152
|
-
type:
|
4336
|
+
type: import_transactions13.TransactionType.Upload,
|
4153
4337
|
...baseTransaction,
|
4154
4338
|
subsectionIndex,
|
4155
4339
|
subsectionsNumber,
|
@@ -4198,58 +4382,149 @@ var AbstractScriptRequest = class {
|
|
4198
4382
|
};
|
4199
4383
|
|
4200
4384
|
// src/providers/transaction-request/utils.ts
|
4201
|
-
var
|
4202
|
-
var
|
4385
|
+
var import_errors12 = require("@fuel-ts/errors");
|
4386
|
+
var import_transactions14 = require("@fuel-ts/transactions");
|
4203
4387
|
var transactionRequestify = (obj) => {
|
4204
4388
|
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
|
4205
4389
|
return obj;
|
4206
4390
|
}
|
4207
4391
|
const { type } = obj;
|
4208
4392
|
switch (obj.type) {
|
4209
|
-
case
|
4393
|
+
case import_transactions14.TransactionType.Script: {
|
4210
4394
|
return ScriptTransactionRequest.from(obj);
|
4211
4395
|
}
|
4212
|
-
case
|
4396
|
+
case import_transactions14.TransactionType.Create: {
|
4213
4397
|
return CreateTransactionRequest.from(obj);
|
4214
4398
|
}
|
4215
|
-
case
|
4399
|
+
case import_transactions14.TransactionType.Blob: {
|
4216
4400
|
return BlobTransactionRequest.from(obj);
|
4217
4401
|
}
|
4218
|
-
case
|
4402
|
+
case import_transactions14.TransactionType.Upgrade: {
|
4219
4403
|
return UpgradeTransactionRequest.from(obj);
|
4220
4404
|
}
|
4221
|
-
case
|
4405
|
+
case import_transactions14.TransactionType.Upload: {
|
4222
4406
|
return UploadTransactionRequest.from(obj);
|
4223
4407
|
}
|
4224
4408
|
default: {
|
4409
|
+
throw new import_errors12.FuelError(
|
4410
|
+
import_errors12.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
|
4411
|
+
`Unsupported transaction type: ${type}.`
|
4412
|
+
);
|
4413
|
+
}
|
4414
|
+
}
|
4415
|
+
};
|
4416
|
+
var isTransactionTypeScript = (request2) => request2.type === import_transactions14.TransactionType.Script;
|
4417
|
+
var isTransactionTypeCreate = (request2) => request2.type === import_transactions14.TransactionType.Create;
|
4418
|
+
var isTransactionTypeBlob = (request2) => request2.type === import_transactions14.TransactionType.Blob;
|
4419
|
+
var isTransactionTypeUpgrade = (request2) => request2.type === import_transactions14.TransactionType.Upgrade;
|
4420
|
+
var isTransactionTypeUpload = (request2) => request2.type === import_transactions14.TransactionType.Upload;
|
4421
|
+
|
4422
|
+
// src/providers/resource-cache.ts
|
4423
|
+
var cache = /* @__PURE__ */ new Map();
|
4424
|
+
var ResourceCache = class {
|
4425
|
+
ttl;
|
4426
|
+
constructor(ttl) {
|
4427
|
+
this.ttl = ttl;
|
4428
|
+
if (typeof ttl !== "number" || this.ttl <= 0) {
|
4225
4429
|
throw new import_errors13.FuelError(
|
4226
|
-
import_errors13.ErrorCode.
|
4227
|
-
`
|
4430
|
+
import_errors13.ErrorCode.INVALID_TTL,
|
4431
|
+
`Invalid TTL: ${this.ttl}. Use a value greater than zero.`
|
4228
4432
|
);
|
4229
4433
|
}
|
4230
4434
|
}
|
4435
|
+
// Add resources to the cache
|
4436
|
+
set(transactionId, inputs) {
|
4437
|
+
const transactionResourceCache = this.setupResourcesCache(inputs);
|
4438
|
+
cache.set(transactionId, transactionResourceCache);
|
4439
|
+
}
|
4440
|
+
unset(transactionId) {
|
4441
|
+
cache.delete(transactionId);
|
4442
|
+
}
|
4443
|
+
getActiveData(owner) {
|
4444
|
+
const activeData = { utxos: [], messages: [] };
|
4445
|
+
const currentTime = Date.now();
|
4446
|
+
const expired = [];
|
4447
|
+
cache.forEach((resource, transactionId) => {
|
4448
|
+
const isActive = currentTime - resource.timestamp < this.ttl;
|
4449
|
+
if (isActive) {
|
4450
|
+
const resourcesFromOwner = resource.owners.get(owner);
|
4451
|
+
if (resourcesFromOwner) {
|
4452
|
+
activeData.utxos.push(...resourcesFromOwner.utxos);
|
4453
|
+
activeData.messages.push(...resourcesFromOwner.messages);
|
4454
|
+
}
|
4455
|
+
} else {
|
4456
|
+
expired.push(transactionId);
|
4457
|
+
}
|
4458
|
+
});
|
4459
|
+
expired.forEach(this.unset);
|
4460
|
+
activeData.utxos.reverse();
|
4461
|
+
activeData.messages.reverse();
|
4462
|
+
return activeData;
|
4463
|
+
}
|
4464
|
+
isCached(owner, key) {
|
4465
|
+
const currentTime = Date.now();
|
4466
|
+
let cached = false;
|
4467
|
+
const expired = [];
|
4468
|
+
for (const [transactionId, resourceData] of cache.entries()) {
|
4469
|
+
const isActive = currentTime - resourceData.timestamp < this.ttl;
|
4470
|
+
if (isActive) {
|
4471
|
+
const resourcesFromOwner = resourceData.owners.get(owner);
|
4472
|
+
if (resourcesFromOwner?.utxos.has(key) || resourcesFromOwner?.messages.has(key)) {
|
4473
|
+
cached = true;
|
4474
|
+
break;
|
4475
|
+
}
|
4476
|
+
} else {
|
4477
|
+
expired.push(transactionId);
|
4478
|
+
}
|
4479
|
+
}
|
4480
|
+
expired.forEach(this.unset);
|
4481
|
+
return cached;
|
4482
|
+
}
|
4483
|
+
clear() {
|
4484
|
+
cache.clear();
|
4485
|
+
}
|
4486
|
+
setupResourcesCache(inputs) {
|
4487
|
+
const currentTime = Date.now();
|
4488
|
+
const transactionResourcesCache = {
|
4489
|
+
owners: /* @__PURE__ */ new Map(),
|
4490
|
+
timestamp: currentTime
|
4491
|
+
};
|
4492
|
+
inputs.filter(isRequestInputCoinOrMessage).forEach((input) => {
|
4493
|
+
const { owner, key, type } = this.extractResourceData(input);
|
4494
|
+
if (!transactionResourcesCache.owners.has(owner)) {
|
4495
|
+
transactionResourcesCache.owners.set(owner, { utxos: /* @__PURE__ */ new Set(), messages: /* @__PURE__ */ new Set() });
|
4496
|
+
}
|
4497
|
+
if (type === "utxo") {
|
4498
|
+
transactionResourcesCache.owners.get(owner)?.utxos.add(key);
|
4499
|
+
} else {
|
4500
|
+
transactionResourcesCache.owners.get(owner)?.messages.add(key);
|
4501
|
+
}
|
4502
|
+
});
|
4503
|
+
return transactionResourcesCache;
|
4504
|
+
}
|
4505
|
+
extractResourceData(input) {
|
4506
|
+
if (isRequestInputCoin(input)) {
|
4507
|
+
return { owner: (0, import_utils22.hexlify)(input.owner), key: (0, import_utils22.hexlify)(input.id), type: "utxo" };
|
4508
|
+
}
|
4509
|
+
return { owner: (0, import_utils22.hexlify)(input.recipient), key: (0, import_utils22.hexlify)(input.nonce), type: "message" };
|
4510
|
+
}
|
4231
4511
|
};
|
4232
|
-
var isTransactionTypeScript = (request2) => request2.type === import_transactions13.TransactionType.Script;
|
4233
|
-
var isTransactionTypeCreate = (request2) => request2.type === import_transactions13.TransactionType.Create;
|
4234
|
-
var isTransactionTypeBlob = (request2) => request2.type === import_transactions13.TransactionType.Blob;
|
4235
|
-
var isTransactionTypeUpgrade = (request2) => request2.type === import_transactions13.TransactionType.Upgrade;
|
4236
|
-
var isTransactionTypeUpload = (request2) => request2.type === import_transactions13.TransactionType.Upload;
|
4237
4512
|
|
4238
4513
|
// src/providers/transaction-response/transaction-response.ts
|
4239
4514
|
var import_errors17 = require("@fuel-ts/errors");
|
4240
4515
|
var import_math17 = require("@fuel-ts/math");
|
4241
|
-
var
|
4516
|
+
var import_transactions22 = require("@fuel-ts/transactions");
|
4242
4517
|
var import_utils26 = require("@fuel-ts/utils");
|
4243
4518
|
|
4244
4519
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
4245
4520
|
var import_math16 = require("@fuel-ts/math");
|
4246
|
-
var
|
4521
|
+
var import_transactions20 = require("@fuel-ts/transactions");
|
4247
4522
|
var import_utils24 = require("@fuel-ts/utils");
|
4248
4523
|
|
4249
4524
|
// src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
|
4250
4525
|
var import_math12 = require("@fuel-ts/math");
|
4251
|
-
var
|
4252
|
-
var
|
4526
|
+
var import_transactions15 = require("@fuel-ts/transactions");
|
4527
|
+
var import_utils23 = require("@fuel-ts/utils");
|
4253
4528
|
var calculateTXFeeForSummary = (params) => {
|
4254
4529
|
const {
|
4255
4530
|
gasPrice,
|
@@ -4259,17 +4534,17 @@ var calculateTXFeeForSummary = (params) => {
|
|
4259
4534
|
} = params;
|
4260
4535
|
const gasPerByte = (0, import_math12.bn)(feeParams.gasPerByte);
|
4261
4536
|
const gasPriceFactor = (0, import_math12.bn)(feeParams.gasPriceFactor);
|
4262
|
-
const transactionBytes = (0,
|
4263
|
-
const [transaction] = new
|
4537
|
+
const transactionBytes = (0, import_utils23.arrayify)(rawPayload);
|
4538
|
+
const [transaction] = new import_transactions15.TransactionCoder().decode(transactionBytes, 0);
|
4264
4539
|
const { type, witnesses, inputs, policies } = transaction;
|
4265
4540
|
let metadataGas = (0, import_math12.bn)(0);
|
4266
4541
|
let gasLimit = (0, import_math12.bn)(0);
|
4267
|
-
if (type !==
|
4542
|
+
if (type !== import_transactions15.TransactionType.Create && type !== import_transactions15.TransactionType.Script) {
|
4268
4543
|
return (0, import_math12.bn)(0);
|
4269
4544
|
}
|
4270
|
-
if (type ===
|
4545
|
+
if (type === import_transactions15.TransactionType.Create) {
|
4271
4546
|
const { bytecodeWitnessIndex, storageSlots } = transaction;
|
4272
|
-
const contractBytesSize = (0, import_math12.bn)((0,
|
4547
|
+
const contractBytesSize = (0, import_math12.bn)((0, import_utils23.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
|
4273
4548
|
metadataGas = calculateMetadataGasForTxCreate({
|
4274
4549
|
contractBytesSize,
|
4275
4550
|
gasCosts,
|
@@ -4293,7 +4568,7 @@ var calculateTXFeeForSummary = (params) => {
|
|
4293
4568
|
metadataGas,
|
4294
4569
|
txBytesSize: transactionBytes.length
|
4295
4570
|
});
|
4296
|
-
const witnessLimit = policies.find((policy) => policy.type ===
|
4571
|
+
const witnessLimit = policies.find((policy) => policy.type === import_transactions15.PolicyType.WitnessLimit)?.data;
|
4297
4572
|
const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
|
4298
4573
|
const maxGas = getMaxGas({
|
4299
4574
|
gasPerByte,
|
@@ -4316,45 +4591,12 @@ var calculateTXFeeForSummary = (params) => {
|
|
4316
4591
|
var import_configs11 = require("@fuel-ts/address/configs");
|
4317
4592
|
var import_errors15 = require("@fuel-ts/errors");
|
4318
4593
|
var import_math14 = require("@fuel-ts/math");
|
4319
|
-
var
|
4320
|
-
|
4321
|
-
// src/providers/transaction-summary/call.ts
|
4322
|
-
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
4323
|
-
var getFunctionCall = ({ abi, receipt }) => {
|
4324
|
-
const abiInterface = new import_abi_coder4.Interface(abi);
|
4325
|
-
const callFunctionSelector = receipt.param1.toHex(8);
|
4326
|
-
const functionFragment = abiInterface.getFunction(callFunctionSelector);
|
4327
|
-
const inputs = functionFragment.jsonFn.inputs;
|
4328
|
-
const encodedArgs = receipt.param2.toHex();
|
4329
|
-
let argumentsProvided;
|
4330
|
-
const data = functionFragment.decodeArguments(encodedArgs);
|
4331
|
-
if (data) {
|
4332
|
-
argumentsProvided = inputs.reduce((prev, input, index) => {
|
4333
|
-
const value = data[index];
|
4334
|
-
const name = input.name;
|
4335
|
-
if (name) {
|
4336
|
-
return {
|
4337
|
-
...prev,
|
4338
|
-
// reparse to remove bn
|
4339
|
-
[name]: JSON.parse(JSON.stringify(value))
|
4340
|
-
};
|
4341
|
-
}
|
4342
|
-
return prev;
|
4343
|
-
}, {});
|
4344
|
-
}
|
4345
|
-
const call = {
|
4346
|
-
functionSignature: functionFragment.signature,
|
4347
|
-
functionName: functionFragment.name,
|
4348
|
-
argumentsProvided,
|
4349
|
-
...receipt.amount?.isZero() ? {} : { amount: receipt.amount, assetId: receipt.assetId }
|
4350
|
-
};
|
4351
|
-
return call;
|
4352
|
-
};
|
4594
|
+
var import_transactions18 = require("@fuel-ts/transactions");
|
4353
4595
|
|
4354
4596
|
// src/providers/transaction-summary/input.ts
|
4355
4597
|
var import_errors14 = require("@fuel-ts/errors");
|
4356
4598
|
var import_math13 = require("@fuel-ts/math");
|
4357
|
-
var
|
4599
|
+
var import_transactions16 = require("@fuel-ts/transactions");
|
4358
4600
|
function getInputsByTypes(inputs, types) {
|
4359
4601
|
return inputs.filter((i) => types.includes(i.type));
|
4360
4602
|
}
|
@@ -4362,19 +4604,19 @@ function getInputsByType(inputs, type) {
|
|
4362
4604
|
return inputs.filter((i) => i.type === type);
|
4363
4605
|
}
|
4364
4606
|
function getInputsCoin(inputs) {
|
4365
|
-
return getInputsByType(inputs,
|
4607
|
+
return getInputsByType(inputs, import_transactions16.InputType.Coin);
|
4366
4608
|
}
|
4367
4609
|
function getInputsMessage(inputs) {
|
4368
|
-
return getInputsByType(inputs,
|
4610
|
+
return getInputsByType(inputs, import_transactions16.InputType.Message);
|
4369
4611
|
}
|
4370
4612
|
function getInputsCoinAndMessage(inputs) {
|
4371
|
-
return getInputsByTypes(inputs, [
|
4613
|
+
return getInputsByTypes(inputs, [import_transactions16.InputType.Coin, import_transactions16.InputType.Message]);
|
4372
4614
|
}
|
4373
4615
|
function isInputCoin(input) {
|
4374
|
-
return input.type ===
|
4616
|
+
return input.type === import_transactions16.InputType.Coin;
|
4375
4617
|
}
|
4376
4618
|
function getInputsContract(inputs) {
|
4377
|
-
return getInputsByType(inputs,
|
4619
|
+
return getInputsByType(inputs, import_transactions16.InputType.Contract);
|
4378
4620
|
}
|
4379
4621
|
function findCoinInput(inputs, assetId) {
|
4380
4622
|
const coinInputs = getInputsCoin(inputs);
|
@@ -4420,7 +4662,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
4420
4662
|
if (!contractInput) {
|
4421
4663
|
return void 0;
|
4422
4664
|
}
|
4423
|
-
if (contractInput.type !==
|
4665
|
+
if (contractInput.type !== import_transactions16.InputType.Contract) {
|
4424
4666
|
throw new import_errors14.FuelError(
|
4425
4667
|
import_errors14.ErrorCode.INVALID_TRANSACTION_INPUT,
|
4426
4668
|
`Contract input should be of type 'contract'.`
|
@@ -4429,34 +4671,34 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
4429
4671
|
return contractInput;
|
4430
4672
|
}
|
4431
4673
|
function getInputAccountAddress(input) {
|
4432
|
-
if (input.type ===
|
4674
|
+
if (input.type === import_transactions16.InputType.Coin) {
|
4433
4675
|
return input.owner.toString();
|
4434
4676
|
}
|
4435
|
-
if (input.type ===
|
4677
|
+
if (input.type === import_transactions16.InputType.Message) {
|
4436
4678
|
return input.recipient.toString();
|
4437
4679
|
}
|
4438
4680
|
return "";
|
4439
4681
|
}
|
4440
4682
|
|
4441
4683
|
// src/providers/transaction-summary/output.ts
|
4442
|
-
var
|
4684
|
+
var import_transactions17 = require("@fuel-ts/transactions");
|
4443
4685
|
function getOutputsByType(outputs, type) {
|
4444
4686
|
return outputs.filter((o) => o.type === type);
|
4445
4687
|
}
|
4446
4688
|
function getOutputsContractCreated(outputs) {
|
4447
|
-
return getOutputsByType(outputs,
|
4689
|
+
return getOutputsByType(outputs, import_transactions17.OutputType.ContractCreated);
|
4448
4690
|
}
|
4449
4691
|
function getOutputsCoin(outputs) {
|
4450
|
-
return getOutputsByType(outputs,
|
4692
|
+
return getOutputsByType(outputs, import_transactions17.OutputType.Coin);
|
4451
4693
|
}
|
4452
4694
|
function getOutputsChange(outputs) {
|
4453
|
-
return getOutputsByType(outputs,
|
4695
|
+
return getOutputsByType(outputs, import_transactions17.OutputType.Change);
|
4454
4696
|
}
|
4455
4697
|
function getOutputsContract(outputs) {
|
4456
|
-
return getOutputsByType(outputs,
|
4698
|
+
return getOutputsByType(outputs, import_transactions17.OutputType.Contract);
|
4457
4699
|
}
|
4458
4700
|
function getOutputsVariable(outputs) {
|
4459
|
-
return getOutputsByType(outputs,
|
4701
|
+
return getOutputsByType(outputs, import_transactions17.OutputType.Variable);
|
4460
4702
|
}
|
4461
4703
|
|
4462
4704
|
// src/providers/transaction-summary/types.ts
|
@@ -4502,17 +4744,17 @@ function getReceiptsByType(receipts, type) {
|
|
4502
4744
|
}
|
4503
4745
|
function getTransactionTypeName(transactionType) {
|
4504
4746
|
switch (transactionType) {
|
4505
|
-
case
|
4747
|
+
case import_transactions18.TransactionType.Mint:
|
4506
4748
|
return "Mint" /* Mint */;
|
4507
|
-
case
|
4749
|
+
case import_transactions18.TransactionType.Create:
|
4508
4750
|
return "Create" /* Create */;
|
4509
|
-
case
|
4751
|
+
case import_transactions18.TransactionType.Script:
|
4510
4752
|
return "Script" /* Script */;
|
4511
|
-
case
|
4753
|
+
case import_transactions18.TransactionType.Blob:
|
4512
4754
|
return "Blob" /* Blob */;
|
4513
|
-
case
|
4755
|
+
case import_transactions18.TransactionType.Upgrade:
|
4514
4756
|
return "Upgrade" /* Upgrade */;
|
4515
|
-
case
|
4757
|
+
case import_transactions18.TransactionType.Upload:
|
4516
4758
|
return "Upload" /* Upload */;
|
4517
4759
|
default:
|
4518
4760
|
throw new import_errors15.FuelError(
|
@@ -4547,10 +4789,10 @@ function hasSameAssetId(a) {
|
|
4547
4789
|
return (b) => a.assetId === b.assetId;
|
4548
4790
|
}
|
4549
4791
|
function getReceiptsCall(receipts) {
|
4550
|
-
return getReceiptsByType(receipts,
|
4792
|
+
return getReceiptsByType(receipts, import_transactions18.ReceiptType.Call);
|
4551
4793
|
}
|
4552
4794
|
function getReceiptsMessageOut(receipts) {
|
4553
|
-
return getReceiptsByType(receipts,
|
4795
|
+
return getReceiptsByType(receipts, import_transactions18.ReceiptType.MessageOut);
|
4554
4796
|
}
|
4555
4797
|
function mergeAssets(op1, op2) {
|
4556
4798
|
const assets1 = op1.assetsSent || [];
|
@@ -4588,7 +4830,11 @@ function mergeOperations(existing, toAdd) {
|
|
4588
4830
|
return {
|
4589
4831
|
...existing,
|
4590
4832
|
assetsSent: mergeAssetsSent(existing, toAdd),
|
4591
|
-
calls: mergeCalls(existing, toAdd)
|
4833
|
+
calls: mergeCalls(existing, toAdd),
|
4834
|
+
receipts: [
|
4835
|
+
...existing.receipts || [],
|
4836
|
+
...toAdd.receipts?.filter((r) => !existing.receipts?.some((er) => er === r)) || []
|
4837
|
+
]
|
4592
4838
|
};
|
4593
4839
|
}
|
4594
4840
|
function addOperation(operations, toAdd) {
|
@@ -4599,7 +4845,7 @@ function addOperation(operations, toAdd) {
|
|
4599
4845
|
return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
|
4600
4846
|
}
|
4601
4847
|
function getReceiptsTransferOut(receipts) {
|
4602
|
-
return getReceiptsByType(receipts,
|
4848
|
+
return getReceiptsByType(receipts, import_transactions18.ReceiptType.TransferOut);
|
4603
4849
|
}
|
4604
4850
|
function getWithdrawFromFuelOperations({
|
4605
4851
|
inputs,
|
@@ -4628,7 +4874,8 @@ function getWithdrawFromFuelOperations({
|
|
4628
4874
|
amount: receipt.amount,
|
4629
4875
|
assetId: baseAssetId
|
4630
4876
|
}
|
4631
|
-
]
|
4877
|
+
],
|
4878
|
+
receipts: [receipt]
|
4632
4879
|
});
|
4633
4880
|
return newWithdrawFromFuelOps;
|
4634
4881
|
}
|
@@ -4638,19 +4885,12 @@ function getWithdrawFromFuelOperations({
|
|
4638
4885
|
);
|
4639
4886
|
return withdrawFromFuelOperations;
|
4640
4887
|
}
|
4641
|
-
function getContractCalls(contractInput, abiMap,
|
4888
|
+
function getContractCalls(contractInput, abiMap, _receipt, _rawPayload, _maxInputs) {
|
4642
4889
|
const abi = abiMap?.[contractInput.contractID];
|
4643
4890
|
if (!abi) {
|
4644
4891
|
return [];
|
4645
4892
|
}
|
4646
|
-
return [
|
4647
|
-
getFunctionCall({
|
4648
|
-
abi,
|
4649
|
-
receipt,
|
4650
|
-
rawPayload,
|
4651
|
-
maxInputs
|
4652
|
-
})
|
4653
|
-
];
|
4893
|
+
return [];
|
4654
4894
|
}
|
4655
4895
|
function getAssetsSent(receipt) {
|
4656
4896
|
return receipt.amount?.isZero() ? void 0 : [
|
@@ -4680,7 +4920,8 @@ function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload,
|
|
4680
4920
|
address: receipt.to
|
4681
4921
|
},
|
4682
4922
|
assetsSent: getAssetsSent(receipt),
|
4683
|
-
calls
|
4923
|
+
calls,
|
4924
|
+
receipts: [receipt]
|
4684
4925
|
}
|
4685
4926
|
];
|
4686
4927
|
}
|
@@ -4737,7 +4978,8 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
|
|
4737
4978
|
assetId: assetId.toString(),
|
4738
4979
|
amount
|
4739
4980
|
}
|
4740
|
-
]
|
4981
|
+
],
|
4982
|
+
receipts: [receipt]
|
4741
4983
|
};
|
4742
4984
|
}
|
4743
4985
|
function getTransferOperations({
|
@@ -4782,11 +5024,11 @@ function getTransferOperations({
|
|
4782
5024
|
});
|
4783
5025
|
const transferReceipts = getReceiptsByType(
|
4784
5026
|
receipts,
|
4785
|
-
|
5027
|
+
import_transactions18.ReceiptType.Transfer
|
4786
5028
|
);
|
4787
5029
|
const transferOutReceipts = getReceiptsByType(
|
4788
5030
|
receipts,
|
4789
|
-
|
5031
|
+
import_transactions18.ReceiptType.TransferOut
|
4790
5032
|
);
|
4791
5033
|
[...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
|
4792
5034
|
const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
|
@@ -4870,12 +5112,12 @@ function getOperations({
|
|
4870
5112
|
}
|
4871
5113
|
|
4872
5114
|
// src/providers/transaction-summary/receipt.ts
|
4873
|
-
var
|
4874
|
-
var processGqlReceipt = (gqlReceipt) =>
|
5115
|
+
var import_transactions19 = require("@fuel-ts/transactions");
|
5116
|
+
var processGqlReceipt = (gqlReceipt) => deserializeReceipt(gqlReceipt);
|
4875
5117
|
var extractMintedAssetsFromReceipts = (receipts) => {
|
4876
5118
|
const mintedAssets = [];
|
4877
5119
|
receipts.forEach((receipt) => {
|
4878
|
-
if (receipt.type ===
|
5120
|
+
if (receipt.type === import_transactions19.ReceiptType.Mint) {
|
4879
5121
|
mintedAssets.push({
|
4880
5122
|
subId: receipt.subId,
|
4881
5123
|
contractId: receipt.contractId,
|
@@ -4889,7 +5131,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
|
|
4889
5131
|
var extractBurnedAssetsFromReceipts = (receipts) => {
|
4890
5132
|
const burnedAssets = [];
|
4891
5133
|
receipts.forEach((receipt) => {
|
4892
|
-
if (receipt.type ===
|
5134
|
+
if (receipt.type === import_transactions19.ReceiptType.Burn) {
|
4893
5135
|
burnedAssets.push({
|
4894
5136
|
subId: receipt.subId,
|
4895
5137
|
contractId: receipt.contractId,
|
@@ -4998,7 +5240,7 @@ function assembleTransactionSummary(params) {
|
|
4998
5240
|
baseAssetId
|
4999
5241
|
});
|
5000
5242
|
const typeName = getTransactionTypeName(transaction.type);
|
5001
|
-
const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type ===
|
5243
|
+
const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions20.PolicyType.Tip)?.data);
|
5002
5244
|
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
|
5003
5245
|
const fee = totalFee ?? calculateTXFeeForSummary({
|
5004
5246
|
gasPrice,
|
@@ -5048,13 +5290,13 @@ function assembleTransactionSummary(params) {
|
|
5048
5290
|
}
|
5049
5291
|
|
5050
5292
|
// src/providers/transaction-response/getDecodedLogs.ts
|
5051
|
-
var
|
5052
|
-
var
|
5293
|
+
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
5294
|
+
var import_transactions21 = require("@fuel-ts/transactions");
|
5053
5295
|
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
5054
5296
|
return receipts.reduce((logs, receipt) => {
|
5055
|
-
if (receipt.type ===
|
5056
|
-
const interfaceToUse = new
|
5057
|
-
const data = receipt.type ===
|
5297
|
+
if (receipt.type === import_transactions21.ReceiptType.LogData || receipt.type === import_transactions21.ReceiptType.Log) {
|
5298
|
+
const interfaceToUse = new import_abi_coder4.Interface(externalAbis[receipt.id] || mainAbi);
|
5299
|
+
const data = receipt.type === import_transactions21.ReceiptType.Log ? new import_abi_coder4.BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
|
5058
5300
|
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
|
5059
5301
|
logs.push(decodedLog);
|
5060
5302
|
}
|
@@ -5068,24 +5310,24 @@ function mapGqlOutputsToTxOutputs(outputs) {
|
|
5068
5310
|
const obj = "amount" in o ? { ...o, amount: (0, import_math17.bn)(o.amount) } : o;
|
5069
5311
|
switch (obj.type) {
|
5070
5312
|
case "CoinOutput":
|
5071
|
-
return { ...obj, type:
|
5313
|
+
return { ...obj, type: import_transactions22.OutputType.Coin };
|
5072
5314
|
case "ContractOutput":
|
5073
5315
|
return {
|
5074
5316
|
...obj,
|
5075
|
-
type:
|
5317
|
+
type: import_transactions22.OutputType.Contract,
|
5076
5318
|
inputIndex: parseInt(obj.inputIndex, 10)
|
5077
5319
|
};
|
5078
5320
|
case "ChangeOutput":
|
5079
5321
|
return {
|
5080
5322
|
...obj,
|
5081
|
-
type:
|
5323
|
+
type: import_transactions22.OutputType.Change
|
5082
5324
|
};
|
5083
5325
|
case "VariableOutput":
|
5084
|
-
return { ...obj, type:
|
5326
|
+
return { ...obj, type: import_transactions22.OutputType.Variable };
|
5085
5327
|
case "ContractCreated":
|
5086
5328
|
return {
|
5087
5329
|
...obj,
|
5088
|
-
type:
|
5330
|
+
type: import_transactions22.OutputType.ContractCreated,
|
5089
5331
|
contractId: obj.contract
|
5090
5332
|
};
|
5091
5333
|
default:
|
@@ -5145,7 +5387,7 @@ var TransactionResponse = class {
|
|
5145
5387
|
const correspondingInput = status.transaction.inputs?.[idx];
|
5146
5388
|
return {
|
5147
5389
|
...input,
|
5148
|
-
txPointer:
|
5390
|
+
txPointer: import_transactions22.TxPointerCoder.decodeFromGqlScalar(correspondingInput.txPointer)
|
5149
5391
|
};
|
5150
5392
|
}
|
5151
5393
|
return input;
|
@@ -5176,7 +5418,7 @@ var TransactionResponse = class {
|
|
5176
5418
|
switch (status?.type) {
|
5177
5419
|
case "SuccessStatus":
|
5178
5420
|
case "FailureStatus":
|
5179
|
-
return status.receipts.map(
|
5421
|
+
return status.receipts.map(deserializeReceipt);
|
5180
5422
|
default:
|
5181
5423
|
return [];
|
5182
5424
|
}
|
@@ -5212,7 +5454,7 @@ var TransactionResponse = class {
|
|
5212
5454
|
* @returns The decoded transaction.
|
5213
5455
|
*/
|
5214
5456
|
decodeTransaction(transactionWithReceipts) {
|
5215
|
-
return new
|
5457
|
+
return new import_transactions22.TransactionCoder().decode(
|
5216
5458
|
(0, import_utils26.arrayify)(transactionWithReceipts.rawPayload),
|
5217
5459
|
0
|
5218
5460
|
)?.[0];
|
@@ -5300,7 +5542,6 @@ var TransactionResponse = class {
|
|
5300
5542
|
const { receipts } = transactionResult;
|
5301
5543
|
const status = this.status ?? this.gqlTransaction?.status;
|
5302
5544
|
if (status?.type === "FailureStatus") {
|
5303
|
-
this.unsetResourceCache();
|
5304
5545
|
const { reason } = status;
|
5305
5546
|
throw extractTxError({
|
5306
5547
|
receipts,
|
@@ -5317,6 +5558,7 @@ var TransactionResponse = class {
|
|
5317
5558
|
*/
|
5318
5559
|
async waitForResult(contractsAbiMap) {
|
5319
5560
|
await this.waitForStatusChange();
|
5561
|
+
this.unsetResourceCache();
|
5320
5562
|
return this.assembleResult(contractsAbiMap);
|
5321
5563
|
}
|
5322
5564
|
/**
|
@@ -5369,6 +5611,22 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
|
|
5369
5611
|
};
|
5370
5612
|
}
|
5371
5613
|
|
5614
|
+
// src/providers/utils/helpers.ts
|
5615
|
+
var adjustResourcesToExclude = (params) => {
|
5616
|
+
const { userInput, cached, maxInputs } = params;
|
5617
|
+
const final = { ...userInput };
|
5618
|
+
let total = final.utxos.length + final.messages.length;
|
5619
|
+
if (total >= maxInputs) {
|
5620
|
+
return final;
|
5621
|
+
}
|
5622
|
+
final.utxos = [...final.utxos, ...cached.utxos.slice(0, maxInputs - total)];
|
5623
|
+
total = final.utxos.length + final.messages.length;
|
5624
|
+
if (total < maxInputs) {
|
5625
|
+
final.messages = [...final.messages, ...cached.messages.slice(0, maxInputs - total)];
|
5626
|
+
}
|
5627
|
+
return final;
|
5628
|
+
};
|
5629
|
+
|
5372
5630
|
// src/providers/utils/validate-pagination-args.ts
|
5373
5631
|
var import_errors18 = require("@fuel-ts/errors");
|
5374
5632
|
var validatePaginationArgs = (params) => {
|
@@ -5408,64 +5666,10 @@ var validatePaginationArgs = (params) => {
|
|
5408
5666
|
var MAX_RETRIES = 10;
|
5409
5667
|
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
5410
5668
|
var TRANSACTIONS_PAGE_SIZE_LIMIT = 60;
|
5669
|
+
var BALANCES_PAGE_SIZE_LIMIT = 100;
|
5411
5670
|
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
5412
5671
|
var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
|
5413
5672
|
var GAS_USED_MODIFIER = 1.2;
|
5414
|
-
var processGqlChain = (chain) => {
|
5415
|
-
const { name, daHeight, consensusParameters } = chain;
|
5416
|
-
const {
|
5417
|
-
contractParams,
|
5418
|
-
feeParams,
|
5419
|
-
predicateParams,
|
5420
|
-
scriptParams,
|
5421
|
-
txParams,
|
5422
|
-
gasCosts,
|
5423
|
-
baseAssetId,
|
5424
|
-
chainId,
|
5425
|
-
version
|
5426
|
-
} = consensusParameters;
|
5427
|
-
return {
|
5428
|
-
name,
|
5429
|
-
baseChainHeight: (0, import_math18.bn)(daHeight),
|
5430
|
-
consensusParameters: {
|
5431
|
-
version,
|
5432
|
-
chainId: (0, import_math18.bn)(chainId),
|
5433
|
-
baseAssetId,
|
5434
|
-
feeParameters: {
|
5435
|
-
version: feeParams.version,
|
5436
|
-
gasPerByte: (0, import_math18.bn)(feeParams.gasPerByte),
|
5437
|
-
gasPriceFactor: (0, import_math18.bn)(feeParams.gasPriceFactor)
|
5438
|
-
},
|
5439
|
-
contractParameters: {
|
5440
|
-
version: contractParams.version,
|
5441
|
-
contractMaxSize: (0, import_math18.bn)(contractParams.contractMaxSize),
|
5442
|
-
maxStorageSlots: (0, import_math18.bn)(contractParams.maxStorageSlots)
|
5443
|
-
},
|
5444
|
-
txParameters: {
|
5445
|
-
version: txParams.version,
|
5446
|
-
maxInputs: (0, import_math18.bn)(txParams.maxInputs),
|
5447
|
-
maxOutputs: (0, import_math18.bn)(txParams.maxOutputs),
|
5448
|
-
maxWitnesses: (0, import_math18.bn)(txParams.maxWitnesses),
|
5449
|
-
maxGasPerTx: (0, import_math18.bn)(txParams.maxGasPerTx),
|
5450
|
-
maxSize: (0, import_math18.bn)(txParams.maxSize),
|
5451
|
-
maxBytecodeSubsections: (0, import_math18.bn)(txParams.maxBytecodeSubsections)
|
5452
|
-
},
|
5453
|
-
predicateParameters: {
|
5454
|
-
version: predicateParams.version,
|
5455
|
-
maxPredicateLength: (0, import_math18.bn)(predicateParams.maxPredicateLength),
|
5456
|
-
maxPredicateDataLength: (0, import_math18.bn)(predicateParams.maxPredicateDataLength),
|
5457
|
-
maxGasPerPredicate: (0, import_math18.bn)(predicateParams.maxGasPerPredicate),
|
5458
|
-
maxMessageDataLength: (0, import_math18.bn)(predicateParams.maxMessageDataLength)
|
5459
|
-
},
|
5460
|
-
scriptParameters: {
|
5461
|
-
version: scriptParams.version,
|
5462
|
-
maxScriptLength: (0, import_math18.bn)(scriptParams.maxScriptLength),
|
5463
|
-
maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
|
5464
|
-
},
|
5465
|
-
gasCosts
|
5466
|
-
}
|
5467
|
-
};
|
5468
|
-
};
|
5469
5673
|
var _cacheInputs, cacheInputs_fn;
|
5470
5674
|
var _Provider = class {
|
5471
5675
|
/**
|
@@ -5487,13 +5691,19 @@ var _Provider = class {
|
|
5487
5691
|
/** @hidden */
|
5488
5692
|
__publicField(this, "urlWithoutAuth");
|
5489
5693
|
/** @hidden */
|
5694
|
+
__publicField(this, "features", {
|
5695
|
+
balancePagination: false,
|
5696
|
+
amount128: false
|
5697
|
+
});
|
5698
|
+
/** @hidden */
|
5490
5699
|
__publicField(this, "consensusParametersTimestamp");
|
5491
5700
|
__publicField(this, "options", {
|
5492
5701
|
timeout: void 0,
|
5493
5702
|
resourceCacheTTL: void 0,
|
5494
5703
|
fetch: void 0,
|
5495
5704
|
retryOptions: void 0,
|
5496
|
-
headers: void 0
|
5705
|
+
headers: void 0,
|
5706
|
+
cache: void 0
|
5497
5707
|
});
|
5498
5708
|
const { url: rawUrl, urlWithoutAuth, headers: authHeaders } = _Provider.extractBasicAuth(url);
|
5499
5709
|
this.url = rawUrl;
|
@@ -5507,7 +5717,13 @@ var _Provider = class {
|
|
5507
5717
|
headers
|
5508
5718
|
};
|
5509
5719
|
this.operations = this.createOperations();
|
5510
|
-
const { resourceCacheTTL } = this.options;
|
5720
|
+
const { resourceCacheTTL, cache: cache2 } = this.options;
|
5721
|
+
if (cache2) {
|
5722
|
+
const { consensusParametersTimestamp, chain, nodeInfo } = deserializeProviderCache(cache2);
|
5723
|
+
this.consensusParametersTimestamp = consensusParametersTimestamp;
|
5724
|
+
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
5725
|
+
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
5726
|
+
}
|
5511
5727
|
if ((0, import_utils29.isDefined)(resourceCacheTTL)) {
|
5512
5728
|
if (resourceCacheTTL !== -1) {
|
5513
5729
|
this.cache = new ResourceCache(resourceCacheTTL);
|
@@ -5566,7 +5782,8 @@ var _Provider = class {
|
|
5566
5782
|
* Initialize Provider async stuff
|
5567
5783
|
*/
|
5568
5784
|
async init() {
|
5569
|
-
await this.fetchChainAndNodeInfo();
|
5785
|
+
const { nodeInfo } = await this.fetchChainAndNodeInfo();
|
5786
|
+
this.setupFeatures(nodeInfo.nodeVersion);
|
5570
5787
|
return this;
|
5571
5788
|
}
|
5572
5789
|
/**
|
@@ -5637,15 +5854,9 @@ var _Provider = class {
|
|
5637
5854
|
}
|
5638
5855
|
} catch (_err) {
|
5639
5856
|
const data = await this.operations.getChainAndNodeInfo();
|
5640
|
-
nodeInfo =
|
5641
|
-
maxDepth: (0, import_math18.bn)(data.nodeInfo.maxDepth),
|
5642
|
-
maxTx: (0, import_math18.bn)(data.nodeInfo.maxTx),
|
5643
|
-
nodeVersion: data.nodeInfo.nodeVersion,
|
5644
|
-
utxoValidation: data.nodeInfo.utxoValidation,
|
5645
|
-
vmBacktrace: data.nodeInfo.vmBacktrace
|
5646
|
-
};
|
5857
|
+
nodeInfo = deserializeNodeInfo(data.nodeInfo);
|
5647
5858
|
_Provider.setIncompatibleNodeVersionMessage(nodeInfo);
|
5648
|
-
chain =
|
5859
|
+
chain = deserializeChain(data.chain);
|
5649
5860
|
_Provider.chainInfoCache[this.urlWithoutAuth] = chain;
|
5650
5861
|
_Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
|
5651
5862
|
this.consensusParametersTimestamp = Date.now();
|
@@ -5723,6 +5934,15 @@ var _Provider = class {
|
|
5723
5934
|
});
|
5724
5935
|
return { ...getSdk(executeQuery), ...customOperations(executeQuery) };
|
5725
5936
|
}
|
5937
|
+
/**
|
5938
|
+
* @hidden
|
5939
|
+
*/
|
5940
|
+
setupFeatures(nodeVersion) {
|
5941
|
+
if ((0, import_versions.gte)(nodeVersion, "0.41.0")) {
|
5942
|
+
this.features.balancePagination = true;
|
5943
|
+
this.features.amount128 = true;
|
5944
|
+
}
|
5945
|
+
}
|
5726
5946
|
/**
|
5727
5947
|
* Returns the version of the connected node.
|
5728
5948
|
*
|
@@ -5754,13 +5974,7 @@ var _Provider = class {
|
|
5754
5974
|
*/
|
5755
5975
|
async fetchNode() {
|
5756
5976
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
5757
|
-
const processedNodeInfo =
|
5758
|
-
maxDepth: (0, import_math18.bn)(nodeInfo.maxDepth),
|
5759
|
-
maxTx: (0, import_math18.bn)(nodeInfo.maxTx),
|
5760
|
-
nodeVersion: nodeInfo.nodeVersion,
|
5761
|
-
utxoValidation: nodeInfo.utxoValidation,
|
5762
|
-
vmBacktrace: nodeInfo.vmBacktrace
|
5763
|
-
};
|
5977
|
+
const processedNodeInfo = deserializeNodeInfo(nodeInfo);
|
5764
5978
|
_Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
|
5765
5979
|
return processedNodeInfo;
|
5766
5980
|
}
|
@@ -5771,7 +5985,7 @@ var _Provider = class {
|
|
5771
5985
|
*/
|
5772
5986
|
async fetchChain() {
|
5773
5987
|
const { chain } = await this.operations.getChain();
|
5774
|
-
const processedChain =
|
5988
|
+
const processedChain = deserializeChain(chain);
|
5775
5989
|
_Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
|
5776
5990
|
return processedChain;
|
5777
5991
|
}
|
@@ -5798,6 +6012,21 @@ var _Provider = class {
|
|
5798
6012
|
} = all;
|
5799
6013
|
return baseAssetId;
|
5800
6014
|
}
|
6015
|
+
/**
|
6016
|
+
* Retrieves the details of an asset given its ID.
|
6017
|
+
*
|
6018
|
+
* @param assetId - The unique identifier of the asset.
|
6019
|
+
* @returns A promise that resolves to an object containing the asset details.
|
6020
|
+
*/
|
6021
|
+
async getAssetDetails(assetId) {
|
6022
|
+
const { assetDetails } = await this.operations.getAssetDetails({ assetId });
|
6023
|
+
const { contractId, subId, totalSupply } = assetDetails;
|
6024
|
+
return {
|
6025
|
+
subId,
|
6026
|
+
contractId,
|
6027
|
+
totalSupply: (0, import_math18.bn)(totalSupply)
|
6028
|
+
};
|
6029
|
+
}
|
5801
6030
|
/**
|
5802
6031
|
* @hidden
|
5803
6032
|
*/
|
@@ -5872,22 +6101,20 @@ var _Provider = class {
|
|
5872
6101
|
utxoValidation: utxoValidation || false
|
5873
6102
|
});
|
5874
6103
|
const [{ receipts: rawReceipts, status: dryRunStatus }] = dryRunStatuses;
|
5875
|
-
const receipts = rawReceipts.map(
|
6104
|
+
const receipts = rawReceipts.map(deserializeReceipt);
|
5876
6105
|
return { receipts, dryRunStatus };
|
5877
6106
|
}
|
5878
6107
|
/**
|
5879
|
-
*
|
6108
|
+
* Estimates the gas usage for predicates in a transaction request.
|
5880
6109
|
*
|
5881
6110
|
* @template T - The type of the transaction request object.
|
5882
6111
|
*
|
5883
|
-
* @param transactionRequest - The transaction request
|
5884
|
-
* @returns A promise that resolves to the
|
6112
|
+
* @param transactionRequest - The transaction request to estimate predicates for.
|
6113
|
+
* @returns A promise that resolves to the updated transaction request with estimated gas usage for predicates.
|
5885
6114
|
*/
|
5886
6115
|
async estimatePredicates(transactionRequest) {
|
5887
|
-
const shouldEstimatePredicates =
|
5888
|
-
|
5889
|
-
(input) => "predicate" in input && input.predicate && !(0, import_utils30.equalBytes)((0, import_utils29.arrayify)(input.predicate), (0, import_utils29.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
|
5890
|
-
)
|
6116
|
+
const shouldEstimatePredicates = transactionRequest.inputs.some(
|
6117
|
+
(input) => isPredicate(input) && (0, import_math18.bn)(input.predicateGasUsed).isZero()
|
5891
6118
|
);
|
5892
6119
|
if (!shouldEstimatePredicates) {
|
5893
6120
|
return transactionRequest;
|
@@ -5896,18 +6123,42 @@ var _Provider = class {
|
|
5896
6123
|
const response = await this.operations.estimatePredicates({
|
5897
6124
|
encodedTransaction
|
5898
6125
|
});
|
5899
|
-
const {
|
5900
|
-
|
5901
|
-
|
5902
|
-
|
5903
|
-
|
5904
|
-
if ("predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
|
5905
|
-
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
5906
|
-
}
|
5907
|
-
});
|
5908
|
-
}
|
6126
|
+
const { estimatePredicates } = response;
|
6127
|
+
transactionRequest = this.parseEstimatePredicatesResponse(
|
6128
|
+
transactionRequest,
|
6129
|
+
estimatePredicates
|
6130
|
+
);
|
5909
6131
|
return transactionRequest;
|
5910
6132
|
}
|
6133
|
+
/**
|
6134
|
+
* Estimates the gas price and predicates for a given transaction request and block horizon.
|
6135
|
+
*
|
6136
|
+
* @param transactionRequest - The transaction request to estimate predicates and gas price for.
|
6137
|
+
* @param blockHorizon - The block horizon to use for gas price estimation.
|
6138
|
+
* @returns A promise that resolves to an object containing the updated transaction
|
6139
|
+
* request and the estimated gas price.
|
6140
|
+
*/
|
6141
|
+
async estimatePredicatesAndGasPrice(transactionRequest, blockHorizon) {
|
6142
|
+
const shouldEstimatePredicates = transactionRequest.inputs.some(
|
6143
|
+
(input) => isPredicate(input) && (0, import_math18.bn)(input.predicateGasUsed).isZero()
|
6144
|
+
);
|
6145
|
+
if (!shouldEstimatePredicates) {
|
6146
|
+
const gasPrice2 = await this.estimateGasPrice(blockHorizon);
|
6147
|
+
return { transactionRequest, gasPrice: gasPrice2 };
|
6148
|
+
}
|
6149
|
+
const {
|
6150
|
+
estimateGasPrice: { gasPrice },
|
6151
|
+
estimatePredicates
|
6152
|
+
} = await this.operations.estimatePredicatesAndGasPrice({
|
6153
|
+
blockHorizon: String(blockHorizon),
|
6154
|
+
encodedTransaction: (0, import_utils29.hexlify)(transactionRequest.toTransactionBytes())
|
6155
|
+
});
|
6156
|
+
transactionRequest = this.parseEstimatePredicatesResponse(
|
6157
|
+
transactionRequest,
|
6158
|
+
estimatePredicates
|
6159
|
+
);
|
6160
|
+
return { transactionRequest, gasPrice: (0, import_math18.bn)(gasPrice) };
|
6161
|
+
}
|
5911
6162
|
/**
|
5912
6163
|
* Will dryRun a transaction and check for missing dependencies.
|
5913
6164
|
*
|
@@ -5921,11 +6172,13 @@ var _Provider = class {
|
|
5921
6172
|
async estimateTxDependencies(transactionRequest, { gasPrice: gasPriceParam } = {}) {
|
5922
6173
|
if (isTransactionTypeCreate(transactionRequest)) {
|
5923
6174
|
return {
|
6175
|
+
rawReceipts: [],
|
5924
6176
|
receipts: [],
|
5925
6177
|
outputVariables: 0,
|
5926
6178
|
missingContractIds: []
|
5927
6179
|
};
|
5928
6180
|
}
|
6181
|
+
let rawReceipts = [];
|
5929
6182
|
let receipts = [];
|
5930
6183
|
const missingContractIds = [];
|
5931
6184
|
let outputVariables = 0;
|
@@ -5934,13 +6187,14 @@ var _Provider = class {
|
|
5934
6187
|
const gasPrice = gasPriceParam ?? await this.estimateGasPrice(10);
|
5935
6188
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
5936
6189
|
const {
|
5937
|
-
dryRun: [{ receipts:
|
6190
|
+
dryRun: [{ receipts: serializedReceipts, status }]
|
5938
6191
|
} = await this.operations.dryRun({
|
5939
6192
|
encodedTransactions: [(0, import_utils29.hexlify)(transactionRequest.toTransactionBytes())],
|
5940
6193
|
utxoValidation: false,
|
5941
6194
|
gasPrice: gasPrice.toString()
|
5942
6195
|
});
|
5943
|
-
|
6196
|
+
rawReceipts = serializedReceipts;
|
6197
|
+
receipts = serializedReceipts.map(deserializeReceipt);
|
5944
6198
|
dryRunStatus = status;
|
5945
6199
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
5946
6200
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
@@ -5961,6 +6215,7 @@ var _Provider = class {
|
|
5961
6215
|
}
|
5962
6216
|
}
|
5963
6217
|
return {
|
6218
|
+
rawReceipts,
|
5964
6219
|
receipts,
|
5965
6220
|
outputVariables,
|
5966
6221
|
missingContractIds,
|
@@ -5979,6 +6234,7 @@ var _Provider = class {
|
|
5979
6234
|
*/
|
5980
6235
|
async estimateMultipleTxDependencies(transactionRequests) {
|
5981
6236
|
const results = transactionRequests.map(() => ({
|
6237
|
+
rawReceipts: [],
|
5982
6238
|
receipts: [],
|
5983
6239
|
outputVariables: 0,
|
5984
6240
|
missingContractIds: [],
|
@@ -6006,7 +6262,7 @@ var _Provider = class {
|
|
6006
6262
|
const requestIdx = transactionsToProcess[i];
|
6007
6263
|
const { receipts: rawReceipts, status } = dryRunResults.dryRun[i];
|
6008
6264
|
const result = results[requestIdx];
|
6009
|
-
result.receipts = rawReceipts.map(
|
6265
|
+
result.receipts = rawReceipts.map(deserializeReceipt);
|
6010
6266
|
result.dryRunStatus = status;
|
6011
6267
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(
|
6012
6268
|
result.receipts
|
@@ -6051,7 +6307,7 @@ var _Provider = class {
|
|
6051
6307
|
utxoValidation: utxoValidation || false
|
6052
6308
|
});
|
6053
6309
|
const results = dryRunStatuses.map(({ receipts: rawReceipts, status }) => {
|
6054
|
-
const receipts = rawReceipts.map(
|
6310
|
+
const receipts = rawReceipts.map(deserializeReceipt);
|
6055
6311
|
return { receipts, dryRunStatus: status };
|
6056
6312
|
});
|
6057
6313
|
return results;
|
@@ -6152,7 +6408,7 @@ var _Provider = class {
|
|
6152
6408
|
});
|
6153
6409
|
const callResult = dryRunStatuses.map((dryRunStatus) => {
|
6154
6410
|
const { id, receipts, status } = dryRunStatus;
|
6155
|
-
const processedReceipts = receipts.map(
|
6411
|
+
const processedReceipts = receipts.map(deserializeReceipt);
|
6156
6412
|
return { id, receipts: processedReceipts, status };
|
6157
6413
|
});
|
6158
6414
|
return { receipts: callResult[0].receipts };
|
@@ -6183,14 +6439,20 @@ var _Provider = class {
|
|
6183
6439
|
await signatureCallback(signedRequest);
|
6184
6440
|
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
6185
6441
|
}
|
6186
|
-
|
6442
|
+
let gasPrice;
|
6443
|
+
if (gasPriceParam) {
|
6444
|
+
gasPrice = gasPriceParam;
|
6445
|
+
await this.estimatePredicates(signedRequest);
|
6446
|
+
} else {
|
6447
|
+
({ gasPrice } = await this.estimatePredicatesAndGasPrice(signedRequest, 10));
|
6448
|
+
}
|
6187
6449
|
txRequestClone.updatePredicateGasUsed(signedRequest.inputs);
|
6188
|
-
const gasPrice = gasPriceParam ?? await this.estimateGasPrice(10);
|
6189
6450
|
let { maxFee, maxGas, minFee, minGas, gasLimit } = await this.estimateTxGasAndFee({
|
6190
6451
|
// Fetches and returns a gas price
|
6191
6452
|
transactionRequest: signedRequest,
|
6192
6453
|
gasPrice
|
6193
6454
|
});
|
6455
|
+
let rawReceipts = [];
|
6194
6456
|
let receipts = [];
|
6195
6457
|
let dryRunStatus;
|
6196
6458
|
let missingContractIds = [];
|
@@ -6202,7 +6464,7 @@ var _Provider = class {
|
|
6202
6464
|
if (signatureCallback) {
|
6203
6465
|
await signatureCallback(txRequestClone);
|
6204
6466
|
}
|
6205
|
-
({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone, { gasPrice }));
|
6467
|
+
({ rawReceipts, receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone, { gasPrice }));
|
6206
6468
|
if (dryRunStatus && "reason" in dryRunStatus) {
|
6207
6469
|
throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
|
6208
6470
|
}
|
@@ -6215,7 +6477,12 @@ var _Provider = class {
|
|
6215
6477
|
gasPrice
|
6216
6478
|
}));
|
6217
6479
|
}
|
6480
|
+
const transactionSummary = {
|
6481
|
+
gasPrice: gasPrice.toString(),
|
6482
|
+
receipts: rawReceipts
|
6483
|
+
};
|
6218
6484
|
return {
|
6485
|
+
rawReceipts,
|
6219
6486
|
receipts,
|
6220
6487
|
gasUsed,
|
6221
6488
|
gasPrice,
|
@@ -6228,7 +6495,8 @@ var _Provider = class {
|
|
6228
6495
|
addedSignatures,
|
6229
6496
|
estimatedPredicates: txRequestClone.inputs,
|
6230
6497
|
dryRunStatus,
|
6231
|
-
updateMaxFee
|
6498
|
+
updateMaxFee,
|
6499
|
+
transactionSummary
|
6232
6500
|
};
|
6233
6501
|
}
|
6234
6502
|
/**
|
@@ -6274,23 +6542,33 @@ var _Provider = class {
|
|
6274
6542
|
*/
|
6275
6543
|
async getResourcesToSpend(owner, quantities, excludedIds) {
|
6276
6544
|
const ownerAddress = new import_address3.Address(owner);
|
6277
|
-
|
6545
|
+
let idsToExclude = {
|
6278
6546
|
messages: excludedIds?.messages?.map((nonce) => (0, import_utils29.hexlify)(nonce)) || [],
|
6279
6547
|
utxos: excludedIds?.utxos?.map((id) => (0, import_utils29.hexlify)(id)) || []
|
6280
6548
|
};
|
6281
6549
|
if (this.cache) {
|
6282
|
-
const cached = this.cache.getActiveData();
|
6283
|
-
|
6284
|
-
|
6550
|
+
const cached = this.cache.getActiveData(ownerAddress.toB256());
|
6551
|
+
if (cached.utxos.length || cached.messages.length) {
|
6552
|
+
const {
|
6553
|
+
consensusParameters: {
|
6554
|
+
txParameters: { maxInputs }
|
6555
|
+
}
|
6556
|
+
} = await this.getChain();
|
6557
|
+
idsToExclude = adjustResourcesToExclude({
|
6558
|
+
userInput: idsToExclude,
|
6559
|
+
cached,
|
6560
|
+
maxInputs: maxInputs.toNumber()
|
6561
|
+
});
|
6562
|
+
}
|
6285
6563
|
}
|
6286
6564
|
const coinsQuery = {
|
6287
6565
|
owner: ownerAddress.toB256(),
|
6288
6566
|
queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
|
6289
6567
|
assetId: (0, import_utils29.hexlify)(assetId),
|
6290
|
-
amount: amount.toString(10),
|
6568
|
+
amount: (amount.eqn(0) ? (0, import_math18.bn)(1) : amount).toString(10),
|
6291
6569
|
max: maxPerAsset ? maxPerAsset.toString(10) : void 0
|
6292
6570
|
})),
|
6293
|
-
excludedIds:
|
6571
|
+
excludedIds: idsToExclude
|
6294
6572
|
};
|
6295
6573
|
const result = await this.operations.getCoinsToSpend(coinsQuery);
|
6296
6574
|
const coins = result.coinsToSpend.flat().map((coin) => {
|
@@ -6348,7 +6626,7 @@ var _Provider = class {
|
|
6348
6626
|
} = await this.operations.getLatestBlock();
|
6349
6627
|
block = latestBlock;
|
6350
6628
|
} else {
|
6351
|
-
const isblockId = typeof idOrHeight === "string" && idOrHeight
|
6629
|
+
const isblockId = typeof idOrHeight === "string" && (0, import_address3.isB256)(idOrHeight);
|
6352
6630
|
const variables = isblockId ? { blockId: idOrHeight } : { height: (0, import_math18.bn)(idOrHeight).toString(10) };
|
6353
6631
|
const response = await this.operations.getBlock(variables);
|
6354
6632
|
block = response.block;
|
@@ -6419,8 +6697,10 @@ var _Provider = class {
|
|
6419
6697
|
variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString(10) };
|
6420
6698
|
} else if (idOrHeight === "latest") {
|
6421
6699
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
6422
|
-
} else {
|
6700
|
+
} else if (typeof idOrHeight === "string" && (0, import_address3.isB256)(idOrHeight)) {
|
6423
6701
|
variables = { blockId: idOrHeight };
|
6702
|
+
} else {
|
6703
|
+
variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString() };
|
6424
6704
|
}
|
6425
6705
|
const { block } = await this.operations.getBlockWithTransactions(variables);
|
6426
6706
|
if (!block) {
|
@@ -6442,7 +6722,7 @@ var _Provider = class {
|
|
6442
6722
|
},
|
6443
6723
|
transactionIds: block.transactions.map((tx) => tx.id),
|
6444
6724
|
transactions: block.transactions.map(
|
6445
|
-
(tx) => new
|
6725
|
+
(tx) => new import_transactions23.TransactionCoder().decode((0, import_utils29.arrayify)(tx.rawPayload), 0)?.[0]
|
6446
6726
|
)
|
6447
6727
|
};
|
6448
6728
|
}
|
@@ -6458,7 +6738,7 @@ var _Provider = class {
|
|
6458
6738
|
return null;
|
6459
6739
|
}
|
6460
6740
|
try {
|
6461
|
-
return new
|
6741
|
+
return new import_transactions23.TransactionCoder().decode(
|
6462
6742
|
(0, import_utils29.arrayify)(transaction.rawPayload),
|
6463
6743
|
0
|
6464
6744
|
)?.[0];
|
@@ -6484,7 +6764,7 @@ var _Provider = class {
|
|
6484
6764
|
paginationLimit: TRANSACTIONS_PAGE_SIZE_LIMIT
|
6485
6765
|
})
|
6486
6766
|
});
|
6487
|
-
const coder = new
|
6767
|
+
const coder = new import_transactions23.TransactionCoder();
|
6488
6768
|
const transactions = edges.map(({ node: { rawPayload } }) => {
|
6489
6769
|
try {
|
6490
6770
|
return coder.decode((0, import_utils29.arrayify)(rawPayload), 0)[0];
|
@@ -6548,11 +6828,20 @@ var _Provider = class {
|
|
6548
6828
|
* @returns A promise that resolves to the balance.
|
6549
6829
|
*/
|
6550
6830
|
async getBalance(owner, assetId) {
|
6551
|
-
const
|
6552
|
-
|
6553
|
-
|
6831
|
+
const ownerStr = new import_address3.Address(owner).toB256();
|
6832
|
+
const assetIdStr = (0, import_utils29.hexlify)(assetId);
|
6833
|
+
if (!this.features.amount128) {
|
6834
|
+
const { balance: balance2 } = await this.operations.getBalance({
|
6835
|
+
owner: ownerStr,
|
6836
|
+
assetId: assetIdStr
|
6837
|
+
});
|
6838
|
+
return (0, import_math18.bn)(balance2.amount, 10);
|
6839
|
+
}
|
6840
|
+
const { balance } = await this.operations.getBalanceV2({
|
6841
|
+
owner: ownerStr,
|
6842
|
+
assetId: assetIdStr
|
6554
6843
|
});
|
6555
|
-
return (0, import_math18.bn)(balance.
|
6844
|
+
return (0, import_math18.bn)(balance.amountU128, 10);
|
6556
6845
|
}
|
6557
6846
|
/**
|
6558
6847
|
* Returns balances for the given owner.
|
@@ -6561,7 +6850,16 @@ var _Provider = class {
|
|
6561
6850
|
* @param paginationArgs - Pagination arguments (optional).
|
6562
6851
|
* @returns A promise that resolves to the balances.
|
6563
6852
|
*/
|
6564
|
-
async getBalances(owner) {
|
6853
|
+
async getBalances(owner, paginationArgs) {
|
6854
|
+
if (!this.features.balancePagination) {
|
6855
|
+
return this.getBalancesV1(owner, paginationArgs);
|
6856
|
+
}
|
6857
|
+
return this.getBalancesV2(owner, paginationArgs);
|
6858
|
+
}
|
6859
|
+
/**
|
6860
|
+
* @hidden
|
6861
|
+
*/
|
6862
|
+
async getBalancesV1(owner, _paginationArgs) {
|
6565
6863
|
const {
|
6566
6864
|
balances: { edges }
|
6567
6865
|
} = await this.operations.getBalances({
|
@@ -6578,6 +6876,25 @@ var _Provider = class {
|
|
6578
6876
|
}));
|
6579
6877
|
return { balances };
|
6580
6878
|
}
|
6879
|
+
/**
|
6880
|
+
* @hidden
|
6881
|
+
*/
|
6882
|
+
async getBalancesV2(owner, paginationArgs) {
|
6883
|
+
const {
|
6884
|
+
balances: { edges, pageInfo }
|
6885
|
+
} = await this.operations.getBalancesV2({
|
6886
|
+
...validatePaginationArgs({
|
6887
|
+
inputArgs: paginationArgs,
|
6888
|
+
paginationLimit: BALANCES_PAGE_SIZE_LIMIT
|
6889
|
+
}),
|
6890
|
+
filter: { owner: new import_address3.Address(owner).toB256() }
|
6891
|
+
});
|
6892
|
+
const balances = edges.map(({ node }) => ({
|
6893
|
+
assetId: node.assetId,
|
6894
|
+
amount: (0, import_math18.bn)(node.amountU128)
|
6895
|
+
}));
|
6896
|
+
return { balances, pageInfo };
|
6897
|
+
}
|
6581
6898
|
/**
|
6582
6899
|
* Returns message for the given address.
|
6583
6900
|
*
|
@@ -6596,7 +6913,7 @@ var _Provider = class {
|
|
6596
6913
|
owner: new import_address3.Address(address).toB256()
|
6597
6914
|
});
|
6598
6915
|
const messages = edges.map(({ node }) => ({
|
6599
|
-
messageId:
|
6916
|
+
messageId: import_transactions23.InputMessageCoder.getMessageId({
|
6600
6917
|
sender: node.sender,
|
6601
6918
|
recipient: node.recipient,
|
6602
6919
|
nonce: node.nonce,
|
@@ -6607,7 +6924,7 @@ var _Provider = class {
|
|
6607
6924
|
recipient: new import_address3.Address(node.recipient),
|
6608
6925
|
nonce: node.nonce,
|
6609
6926
|
amount: (0, import_math18.bn)(node.amount),
|
6610
|
-
data:
|
6927
|
+
data: import_transactions23.InputMessageCoder.decodeData(node.data),
|
6611
6928
|
daHeight: (0, import_math18.bn)(node.daHeight)
|
6612
6929
|
}));
|
6613
6930
|
return {
|
@@ -6644,15 +6961,12 @@ var _Provider = class {
|
|
6644
6961
|
if (commitBlockHeight) {
|
6645
6962
|
inputObject = {
|
6646
6963
|
...inputObject,
|
6647
|
-
//
|
6648
|
-
// This should
|
6964
|
+
// Convert BN into a number string required on the query
|
6965
|
+
// This should probably be fixed on the fuel client side
|
6649
6966
|
commitBlockHeight: commitBlockHeight.toNumber().toString()
|
6650
6967
|
};
|
6651
6968
|
}
|
6652
6969
|
const result = await this.operations.getMessageProof(inputObject);
|
6653
|
-
if (!result.messageProof) {
|
6654
|
-
return null;
|
6655
|
-
}
|
6656
6970
|
const {
|
6657
6971
|
messageProof,
|
6658
6972
|
messageBlockHeader,
|
@@ -6761,16 +7075,15 @@ var _Provider = class {
|
|
6761
7075
|
* @returns A promise that resolves to the result of the check.
|
6762
7076
|
*/
|
6763
7077
|
async isUserAccount(id) {
|
6764
|
-
const
|
6765
|
-
|
6766
|
-
contractId: id,
|
6767
|
-
transactionId: id
|
6768
|
-
});
|
6769
|
-
if (contract || blob || transaction) {
|
6770
|
-
return false;
|
6771
|
-
}
|
6772
|
-
return true;
|
7078
|
+
const type = await this.getAddressType(id);
|
7079
|
+
return type === "Account";
|
6773
7080
|
}
|
7081
|
+
/**
|
7082
|
+
* Determines the type of address based on the provided ID.
|
7083
|
+
*
|
7084
|
+
* @param id - The ID to be checked.
|
7085
|
+
* @returns A promise that resolves to a string indicating the type of address.
|
7086
|
+
*/
|
6774
7087
|
async getAddressType(id) {
|
6775
7088
|
const { contract, blob, transaction } = await this.operations.isUserAccount({
|
6776
7089
|
blobId: id,
|
@@ -6786,6 +7099,13 @@ var _Provider = class {
|
|
6786
7099
|
if (transaction) {
|
6787
7100
|
return "Transaction";
|
6788
7101
|
}
|
7102
|
+
try {
|
7103
|
+
const asset = await this.getAssetDetails(id);
|
7104
|
+
if (asset) {
|
7105
|
+
return "Asset";
|
7106
|
+
}
|
7107
|
+
} catch (e) {
|
7108
|
+
}
|
6789
7109
|
return "Account";
|
6790
7110
|
}
|
6791
7111
|
/**
|
@@ -6810,7 +7130,7 @@ var _Provider = class {
|
|
6810
7130
|
return null;
|
6811
7131
|
}
|
6812
7132
|
const message = {
|
6813
|
-
messageId:
|
7133
|
+
messageId: import_transactions23.InputMessageCoder.getMessageId({
|
6814
7134
|
sender: rawMessage.sender,
|
6815
7135
|
recipient: rawMessage.recipient,
|
6816
7136
|
nonce,
|
@@ -6821,7 +7141,7 @@ var _Provider = class {
|
|
6821
7141
|
recipient: new import_address3.Address(rawMessage.recipient),
|
6822
7142
|
nonce,
|
6823
7143
|
amount: (0, import_math18.bn)(rawMessage.amount),
|
6824
|
-
data:
|
7144
|
+
data: import_transactions23.InputMessageCoder.decodeData(rawMessage.data),
|
6825
7145
|
daHeight: (0, import_math18.bn)(rawMessage.daHeight)
|
6826
7146
|
};
|
6827
7147
|
return message;
|
@@ -6860,6 +7180,19 @@ var _Provider = class {
|
|
6860
7180
|
statusReason: status.reason
|
6861
7181
|
});
|
6862
7182
|
}
|
7183
|
+
/**
|
7184
|
+
* @hidden
|
7185
|
+
*/
|
7186
|
+
parseEstimatePredicatesResponse(transactionRequest, { inputs }) {
|
7187
|
+
if (inputs) {
|
7188
|
+
inputs.forEach((input, i) => {
|
7189
|
+
if (input && "predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
|
7190
|
+
transactionRequest.inputs[i].predicateGasUsed = input.predicateGasUsed;
|
7191
|
+
}
|
7192
|
+
});
|
7193
|
+
}
|
7194
|
+
return transactionRequest;
|
7195
|
+
}
|
6863
7196
|
};
|
6864
7197
|
var Provider = _Provider;
|
6865
7198
|
_cacheInputs = new WeakSet();
|
@@ -6867,18 +7200,7 @@ cacheInputs_fn = function(inputs, transactionId) {
|
|
6867
7200
|
if (!this.cache) {
|
6868
7201
|
return;
|
6869
7202
|
}
|
6870
|
-
|
6871
|
-
(acc, input) => {
|
6872
|
-
if (input.type === import_transactions22.InputType.Coin) {
|
6873
|
-
acc.utxos.push(input.id);
|
6874
|
-
} else if (input.type === import_transactions22.InputType.Message) {
|
6875
|
-
acc.messages.push(input.nonce);
|
6876
|
-
}
|
6877
|
-
return acc;
|
6878
|
-
},
|
6879
|
-
{ utxos: [], messages: [] }
|
6880
|
-
);
|
6881
|
-
this.cache.set(transactionId, inputsToCache);
|
7203
|
+
this.cache.set(transactionId, inputs);
|
6882
7204
|
};
|
6883
7205
|
/** @hidden */
|
6884
7206
|
__publicField(Provider, "chainInfoCache", {});
|
@@ -6890,8 +7212,8 @@ __publicField(Provider, "incompatibleNodeVersionMessage", "");
|
|
6890
7212
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
6891
7213
|
var import_errors20 = require("@fuel-ts/errors");
|
6892
7214
|
var import_math19 = require("@fuel-ts/math");
|
6893
|
-
var
|
6894
|
-
var
|
7215
|
+
var import_transactions24 = require("@fuel-ts/transactions");
|
7216
|
+
var import_utils31 = require("@fuel-ts/utils");
|
6895
7217
|
async function getTransactionSummary(params) {
|
6896
7218
|
const { id, provider, abiMap } = params;
|
6897
7219
|
const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
|
@@ -6903,15 +7225,15 @@ async function getTransactionSummary(params) {
|
|
6903
7225
|
`Transaction not found for given id: ${id}.`
|
6904
7226
|
);
|
6905
7227
|
}
|
6906
|
-
const [decodedTransaction] = new
|
6907
|
-
(0,
|
7228
|
+
const [decodedTransaction] = new import_transactions24.TransactionCoder().decode(
|
7229
|
+
(0, import_utils31.arrayify)(gqlTransaction.rawPayload),
|
6908
7230
|
0
|
6909
7231
|
);
|
6910
7232
|
let txReceipts = [];
|
6911
7233
|
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
6912
7234
|
txReceipts = gqlTransaction.status.receipts;
|
6913
7235
|
}
|
6914
|
-
const receipts = txReceipts.map(
|
7236
|
+
const receipts = txReceipts.map(deserializeReceipt);
|
6915
7237
|
const {
|
6916
7238
|
consensusParameters: {
|
6917
7239
|
feeParameters: { gasPerByte, gasPriceFactor },
|
@@ -6926,7 +7248,7 @@ async function getTransactionSummary(params) {
|
|
6926
7248
|
id: gqlTransaction.id,
|
6927
7249
|
receipts,
|
6928
7250
|
transaction: decodedTransaction,
|
6929
|
-
transactionBytes: (0,
|
7251
|
+
transactionBytes: (0, import_utils31.arrayify)(gqlTransaction.rawPayload),
|
6930
7252
|
gqlTransactionStatus: gqlTransaction.status,
|
6931
7253
|
gasPerByte: (0, import_math19.bn)(gasPerByte),
|
6932
7254
|
gasPriceFactor: (0, import_math19.bn)(gasPriceFactor),
|
@@ -6990,17 +7312,17 @@ async function getTransactionsSummaries(params) {
|
|
6990
7312
|
const transactions = edges.map((edge) => {
|
6991
7313
|
const { node: gqlTransaction } = edge;
|
6992
7314
|
const { id, rawPayload, status } = gqlTransaction;
|
6993
|
-
const [decodedTransaction] = new
|
7315
|
+
const [decodedTransaction] = new import_transactions24.TransactionCoder().decode((0, import_utils31.arrayify)(rawPayload), 0);
|
6994
7316
|
let txReceipts = [];
|
6995
7317
|
if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
|
6996
7318
|
txReceipts = gqlTransaction.status.receipts;
|
6997
7319
|
}
|
6998
|
-
const receipts = txReceipts.map(
|
7320
|
+
const receipts = txReceipts.map(deserializeReceipt);
|
6999
7321
|
const transactionSummary = assembleTransactionSummary({
|
7000
7322
|
id,
|
7001
7323
|
receipts,
|
7002
7324
|
transaction: decodedTransaction,
|
7003
|
-
transactionBytes: (0,
|
7325
|
+
transactionBytes: (0, import_utils31.arrayify)(rawPayload),
|
7004
7326
|
gqlTransactionStatus: status,
|
7005
7327
|
abiMap,
|
7006
7328
|
gasPerByte,
|
@@ -7022,6 +7344,39 @@ async function getTransactionsSummaries(params) {
|
|
7022
7344
|
};
|
7023
7345
|
}
|
7024
7346
|
|
7347
|
+
// src/providers/transaction-summary/assemble-transaction-summary-from-serialized.ts
|
7348
|
+
var import_math20 = require("@fuel-ts/math");
|
7349
|
+
var import_transactions25 = require("@fuel-ts/transactions");
|
7350
|
+
var import_utils32 = require("@fuel-ts/utils");
|
7351
|
+
var assembleTransactionSummaryFromJson = async (opts) => {
|
7352
|
+
const { provider, transactionSummary } = opts;
|
7353
|
+
const { id, transactionBytes, gasPrice, receipts } = transactionSummary;
|
7354
|
+
const {
|
7355
|
+
consensusParameters: {
|
7356
|
+
baseAssetId,
|
7357
|
+
txParameters: { maxInputs, maxGasPerTx },
|
7358
|
+
feeParameters: { gasPriceFactor, gasPerByte },
|
7359
|
+
gasCosts
|
7360
|
+
}
|
7361
|
+
} = await provider.getChain();
|
7362
|
+
const deserializedTransactionBytes = (0, import_utils32.arrayify)(transactionBytes);
|
7363
|
+
const [transaction] = new import_transactions25.TransactionCoder().decode(deserializedTransactionBytes, 0);
|
7364
|
+
return assembleTransactionSummary({
|
7365
|
+
id,
|
7366
|
+
transaction,
|
7367
|
+
transactionBytes: deserializedTransactionBytes,
|
7368
|
+
receipts: receipts.map(deserializeReceipt),
|
7369
|
+
gasPrice: (0, import_math20.bn)(gasPrice),
|
7370
|
+
// From chain
|
7371
|
+
baseAssetId,
|
7372
|
+
maxInputs,
|
7373
|
+
gasCosts,
|
7374
|
+
maxGasPerTx,
|
7375
|
+
gasPerByte,
|
7376
|
+
gasPriceFactor
|
7377
|
+
});
|
7378
|
+
};
|
7379
|
+
|
7025
7380
|
// src/providers/utils/merge-quantities.ts
|
7026
7381
|
var mergeQuantities = (...coinQuantities) => {
|
7027
7382
|
const resultMap = {};
|
@@ -7041,12 +7396,12 @@ var AbstractAccount = class {
|
|
7041
7396
|
};
|
7042
7397
|
|
7043
7398
|
// src/utils/formatTransferToContractScriptData.ts
|
7044
|
-
var
|
7399
|
+
var import_abi_coder5 = require("@fuel-ts/abi-coder");
|
7045
7400
|
var import_address4 = require("@fuel-ts/address");
|
7046
7401
|
var import_utils33 = require("@fuel-ts/utils");
|
7047
7402
|
var asm = __toESM(require("@fuels/vm-asm"));
|
7048
7403
|
var formatTransferToContractScriptData = (transferParams) => {
|
7049
|
-
const numberCoder = new
|
7404
|
+
const numberCoder = new import_abi_coder5.BigNumberCoder("u64");
|
7050
7405
|
return transferParams.reduce((acc, transferParam) => {
|
7051
7406
|
const { assetId, amount, contractId } = transferParam;
|
7052
7407
|
const encoded = numberCoder.encode(amount);
|
@@ -7059,7 +7414,7 @@ var assembleTransferToContractScript = async (transferParams) => {
|
|
7059
7414
|
await asm.initWasm();
|
7060
7415
|
let script = new Uint8Array();
|
7061
7416
|
transferParams.forEach((_, i) => {
|
7062
|
-
const offset = (
|
7417
|
+
const offset = (import_abi_coder5.CONTRACT_ID_LEN + import_abi_coder5.WORD_SIZE + import_abi_coder5.ASSET_ID_LEN) * i;
|
7063
7418
|
script = (0, import_utils33.concat)([
|
7064
7419
|
script,
|
7065
7420
|
// Load ScriptData into register 0x10.
|
@@ -7067,11 +7422,11 @@ var assembleTransferToContractScript = async (transferParams) => {
|
|
7067
7422
|
// Add the offset to 0x10 so it will point to the current contract ID, store in 0x11.
|
7068
7423
|
asm.addi(17, 16, offset).to_bytes(),
|
7069
7424
|
// Add CONTRACT_ID_LEN to 0x11 to point to the amount in the ScriptData, store in 0x12.
|
7070
|
-
asm.addi(18, 17,
|
7425
|
+
asm.addi(18, 17, import_abi_coder5.CONTRACT_ID_LEN).to_bytes(),
|
7071
7426
|
// Load word to the amount at 0x12 into register 0x13.
|
7072
7427
|
asm.lw(19, 18, 0).to_bytes(),
|
7073
7428
|
// Add WORD_SIZE to 0x12 to point to the asset ID in the ScriptData, store in 0x14.
|
7074
|
-
asm.addi(20, 18,
|
7429
|
+
asm.addi(20, 18, import_abi_coder5.WORD_SIZE).to_bytes(),
|
7075
7430
|
// Perform the transfer using contract ID in 0x11, amount in 0x13, and asset ID in 0x14.
|
7076
7431
|
asm.tr(17, 19, 20).to_bytes()
|
7077
7432
|
]);
|
@@ -7194,12 +7549,20 @@ var Account = class extends AbstractAccount {
|
|
7194
7549
|
* @returns A promise that resolves to the funded transaction request.
|
7195
7550
|
*/
|
7196
7551
|
async fund(request2, params) {
|
7197
|
-
const {
|
7552
|
+
const {
|
7553
|
+
addedSignatures,
|
7554
|
+
estimatedPredicates,
|
7555
|
+
requiredQuantities,
|
7556
|
+
updateMaxFee,
|
7557
|
+
gasPrice,
|
7558
|
+
transactionSummary
|
7559
|
+
} = params;
|
7560
|
+
const chainId = await this.provider.getChainId();
|
7198
7561
|
const fee = request2.maxFee;
|
7199
7562
|
const baseAssetId = await this.provider.getBaseAssetId();
|
7200
|
-
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0,
|
7563
|
+
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math21.bn)(0);
|
7201
7564
|
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
7202
|
-
amount: (0,
|
7565
|
+
amount: (0, import_math21.bn)(fee),
|
7203
7566
|
assetId: baseAssetId,
|
7204
7567
|
coinQuantities: requiredQuantities
|
7205
7568
|
});
|
@@ -7207,7 +7570,7 @@ var Account = class extends AbstractAccount {
|
|
7207
7570
|
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
7208
7571
|
quantitiesDict[assetId] = {
|
7209
7572
|
required: amount,
|
7210
|
-
owned: (0,
|
7573
|
+
owned: (0, import_math21.bn)(0)
|
7211
7574
|
};
|
7212
7575
|
});
|
7213
7576
|
request2.inputs.filter(isRequestInputResource).forEach((input) => {
|
@@ -7269,10 +7632,11 @@ var Account = class extends AbstractAccount {
|
|
7269
7632
|
}
|
7270
7633
|
if (needsToBeFunded) {
|
7271
7634
|
throw new import_errors21.FuelError(
|
7272
|
-
import_errors21.ErrorCode.
|
7635
|
+
import_errors21.ErrorCode.INSUFFICIENT_FUNDS_OR_MAX_COINS,
|
7273
7636
|
`The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
|
7274
7637
|
);
|
7275
7638
|
}
|
7639
|
+
request2.updateState(chainId, "funded", transactionSummary);
|
7276
7640
|
await this.provider.validateTransaction(request2);
|
7277
7641
|
request2.updatePredicateGasUsed(estimatedPredicates);
|
7278
7642
|
const requestToReestimate = (0, import_ramda9.clone)(request2);
|
@@ -7383,7 +7747,7 @@ var Account = class extends AbstractAccount {
|
|
7383
7747
|
const quantities = [];
|
7384
7748
|
const defaultAssetId = await this.provider.getBaseAssetId();
|
7385
7749
|
const transferParams = contractTransferParams.map((transferParam) => {
|
7386
|
-
const amount = (0,
|
7750
|
+
const amount = (0, import_math21.bn)(transferParam.amount);
|
7387
7751
|
const contractAddress = new import_address5.Address(transferParam.contractId);
|
7388
7752
|
const assetId = transferParam.assetId ? (0, import_utils34.hexlify)(transferParam.assetId) : defaultAssetId;
|
7389
7753
|
if (amount.lte(0)) {
|
@@ -7420,7 +7784,7 @@ var Account = class extends AbstractAccount {
|
|
7420
7784
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
7421
7785
|
);
|
7422
7786
|
const amountDataArray = (0, import_utils34.arrayify)(
|
7423
|
-
"0x".concat((0,
|
7787
|
+
"0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
|
7424
7788
|
);
|
7425
7789
|
const script = new Uint8Array([
|
7426
7790
|
...(0, import_utils34.arrayify)(withdrawScript.bytes),
|
@@ -7430,7 +7794,7 @@ var Account = class extends AbstractAccount {
|
|
7430
7794
|
const params = { script, ...txParams };
|
7431
7795
|
const baseAssetId = await this.provider.getBaseAssetId();
|
7432
7796
|
let request2 = new ScriptTransactionRequest(params);
|
7433
|
-
const quantities = [{ amount: (0,
|
7797
|
+
const quantities = [{ amount: (0, import_math21.bn)(amount), assetId: baseAssetId }];
|
7434
7798
|
const txCost = await this.getTransactionCost(request2, { quantities });
|
7435
7799
|
request2 = this.validateGasLimitAndMaxFee({
|
7436
7800
|
transactionRequest: request2,
|
@@ -7456,9 +7820,9 @@ var Account = class extends AbstractAccount {
|
|
7456
7820
|
const baseAssetId = await this.provider.getBaseAssetId();
|
7457
7821
|
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
7458
7822
|
const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
|
7459
|
-
const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0,
|
7823
|
+
const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: (0, import_math21.bn)("100000000000000000") }];
|
7460
7824
|
const findAssetInput = (assetId) => txRequestClone.inputs.find((input) => {
|
7461
|
-
if (input.type ===
|
7825
|
+
if (input.type === import_transactions26.InputType.Coin) {
|
7462
7826
|
return input.assetId === assetId;
|
7463
7827
|
}
|
7464
7828
|
if (isRequestInputMessageWithoutData(input)) {
|
@@ -7530,16 +7894,28 @@ var Account = class extends AbstractAccount {
|
|
7530
7894
|
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
7531
7895
|
* @returns A promise that resolves to the transaction response.
|
7532
7896
|
*/
|
7533
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true,
|
7897
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
|
7898
|
+
let transactionRequest = transactionRequestify(transactionRequestLike);
|
7534
7899
|
if (this._connector) {
|
7535
|
-
|
7536
|
-
|
7537
|
-
|
7538
|
-
|
7539
|
-
|
7900
|
+
const { onBeforeSend, skipCustomFee = false } = connectorOptions;
|
7901
|
+
transactionRequest = await this.prepareTransactionForSend(transactionRequest);
|
7902
|
+
const params = {
|
7903
|
+
onBeforeSend,
|
7904
|
+
skipCustomFee,
|
7905
|
+
provider: {
|
7906
|
+
url: this.provider.url,
|
7907
|
+
cache: await serializeProviderCache(this.provider)
|
7908
|
+
},
|
7909
|
+
transactionState: transactionRequest.flag.state,
|
7910
|
+
transactionSummary: await this.prepareTransactionSummary(transactionRequest)
|
7911
|
+
};
|
7912
|
+
const transaction = await this._connector.sendTransaction(
|
7913
|
+
this.address.toString(),
|
7914
|
+
transactionRequest,
|
7915
|
+
params
|
7540
7916
|
);
|
7917
|
+
return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
|
7541
7918
|
}
|
7542
|
-
const transactionRequest = transactionRequestify(transactionRequestLike);
|
7543
7919
|
if (estimateTxDependencies) {
|
7544
7920
|
await this.provider.estimateTxDependencies(transactionRequest);
|
7545
7921
|
}
|
@@ -7569,16 +7945,38 @@ var Account = class extends AbstractAccount {
|
|
7569
7945
|
*/
|
7570
7946
|
generateFakeResources(coins) {
|
7571
7947
|
return coins.map((coin) => ({
|
7572
|
-
id: (0, import_utils34.hexlify)((0, import_crypto2.randomBytes)(
|
7948
|
+
id: (0, import_utils34.hexlify)((0, import_crypto2.randomBytes)(import_abi_coder6.UTXO_ID_LEN)),
|
7573
7949
|
owner: this.address,
|
7574
|
-
blockCreated: (0,
|
7575
|
-
txCreatedIdx: (0,
|
7950
|
+
blockCreated: (0, import_math21.bn)(1),
|
7951
|
+
txCreatedIdx: (0, import_math21.bn)(1),
|
7576
7952
|
...coin
|
7577
7953
|
}));
|
7578
7954
|
}
|
7955
|
+
/** @hidden */
|
7956
|
+
async prepareTransactionForSend(request2) {
|
7957
|
+
const { transactionId } = request2.flag;
|
7958
|
+
if (!(0, import_utils34.isDefined)(transactionId)) {
|
7959
|
+
return request2;
|
7960
|
+
}
|
7961
|
+
const chainId = await this.provider.getChainId();
|
7962
|
+
const currentTransactionId = request2.getTransactionId(chainId);
|
7963
|
+
if (transactionId !== currentTransactionId) {
|
7964
|
+
request2.updateState(chainId);
|
7965
|
+
}
|
7966
|
+
return request2;
|
7967
|
+
}
|
7968
|
+
/** @hidden */
|
7969
|
+
async prepareTransactionSummary(request2) {
|
7970
|
+
const chainId = await this.provider.getChainId();
|
7971
|
+
return (0, import_utils34.isDefined)(request2.flag.summary) ? {
|
7972
|
+
...request2.flag.summary,
|
7973
|
+
id: request2.getTransactionId(chainId),
|
7974
|
+
transactionBytes: (0, import_utils34.hexlify)(request2.toTransactionBytes())
|
7975
|
+
} : void 0;
|
7976
|
+
}
|
7579
7977
|
/** @hidden * */
|
7580
7978
|
validateTransferAmount(amount) {
|
7581
|
-
if ((0,
|
7979
|
+
if ((0, import_math21.bn)(amount).lte(0)) {
|
7582
7980
|
throw new import_errors21.FuelError(
|
7583
7981
|
import_errors21.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
7584
7982
|
"Transfer amount must be a positive number."
|
@@ -7634,7 +8032,7 @@ var import_utils37 = require("@fuel-ts/utils");
|
|
7634
8032
|
var import_address6 = require("@fuel-ts/address");
|
7635
8033
|
var import_crypto3 = require("@fuel-ts/crypto");
|
7636
8034
|
var import_hasher3 = require("@fuel-ts/hasher");
|
7637
|
-
var
|
8035
|
+
var import_math22 = require("@fuel-ts/math");
|
7638
8036
|
var import_utils35 = require("@fuel-ts/utils");
|
7639
8037
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
7640
8038
|
var Signer = class {
|
@@ -7654,7 +8052,7 @@ var Signer = class {
|
|
7654
8052
|
privateKey = `0x${privateKey}`;
|
7655
8053
|
}
|
7656
8054
|
}
|
7657
|
-
const privateKeyBytes = (0,
|
8055
|
+
const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
|
7658
8056
|
this.privateKey = (0, import_utils35.hexlify)(privateKeyBytes);
|
7659
8057
|
this.publicKey = (0, import_utils35.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
7660
8058
|
this.compressedPublicKey = (0, import_utils35.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
|
@@ -7672,8 +8070,8 @@ var Signer = class {
|
|
7672
8070
|
*/
|
7673
8071
|
sign(data) {
|
7674
8072
|
const signature = import_secp256k1.secp256k1.sign((0, import_utils35.arrayify)(data), (0, import_utils35.arrayify)(this.privateKey));
|
7675
|
-
const r = (0,
|
7676
|
-
const s = (0,
|
8073
|
+
const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
|
8074
|
+
const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
|
7677
8075
|
s[0] |= (signature.recovery || 0) << 7;
|
7678
8076
|
return (0, import_utils35.hexlify)((0, import_utils35.concat)([r, s]));
|
7679
8077
|
}
|
@@ -7957,7 +8355,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
7957
8355
|
var import_crypto6 = require("@fuel-ts/crypto");
|
7958
8356
|
var import_errors25 = require("@fuel-ts/errors");
|
7959
8357
|
var import_hasher7 = require("@fuel-ts/hasher");
|
7960
|
-
var
|
8358
|
+
var import_math23 = require("@fuel-ts/math");
|
7961
8359
|
var import_utils41 = require("@fuel-ts/utils");
|
7962
8360
|
|
7963
8361
|
// src/mnemonic/mnemonic.ts
|
@@ -10389,13 +10787,13 @@ var HDWallet = class {
|
|
10389
10787
|
} else {
|
10390
10788
|
data.set((0, import_utils41.arrayify)(this.publicKey));
|
10391
10789
|
}
|
10392
|
-
data.set((0,
|
10790
|
+
data.set((0, import_math23.toBytes)(index, 4), 33);
|
10393
10791
|
const bytes = (0, import_utils41.arrayify)((0, import_crypto6.computeHmac)("sha512", chainCode, data));
|
10394
10792
|
const IL = bytes.slice(0, 32);
|
10395
10793
|
const IR = bytes.slice(32);
|
10396
10794
|
if (privateKey) {
|
10397
10795
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
10398
|
-
const ki = (0,
|
10796
|
+
const ki = (0, import_math23.bn)(IL).add(privateKey).mod(N).toBytes(32);
|
10399
10797
|
return new HDWallet({
|
10400
10798
|
privateKey: ki,
|
10401
10799
|
chainCode: IR,
|
@@ -10441,7 +10839,7 @@ var HDWallet = class {
|
|
10441
10839
|
const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
|
10442
10840
|
const depth = (0, import_utils41.hexlify)(Uint8Array.from([this.depth]));
|
10443
10841
|
const parentFingerprint = this.parentFingerprint;
|
10444
|
-
const index = (0,
|
10842
|
+
const index = (0, import_math23.toHex)(this.index, 4);
|
10445
10843
|
const chainCode = this.chainCode;
|
10446
10844
|
const key = this.privateKey != null && !isPublic ? (0, import_utils41.concat)(["0x00", this.privateKey]) : this.publicKey;
|
10447
10845
|
const extendedKey = (0, import_utils41.arrayify)((0, import_utils41.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
|
@@ -10461,7 +10859,7 @@ var HDWallet = class {
|
|
10461
10859
|
});
|
10462
10860
|
}
|
10463
10861
|
static fromExtendedKey(extendedKey) {
|
10464
|
-
const decoded = (0, import_utils41.hexlify)((0,
|
10862
|
+
const decoded = (0, import_utils41.hexlify)((0, import_math23.toBytes)((0, import_utils41.decodeBase58)(extendedKey)));
|
10465
10863
|
const bytes = (0, import_utils41.arrayify)(decoded);
|
10466
10864
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
10467
10865
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
@@ -11074,18 +11472,18 @@ var StorageAbstract = class {
|
|
11074
11472
|
};
|
11075
11473
|
|
11076
11474
|
// src/predicate/predicate.ts
|
11077
|
-
var
|
11475
|
+
var import_abi_coder8 = require("@fuel-ts/abi-coder");
|
11078
11476
|
var import_address11 = require("@fuel-ts/address");
|
11079
11477
|
var import_errors31 = require("@fuel-ts/errors");
|
11080
11478
|
var import_utils45 = require("@fuel-ts/utils");
|
11081
11479
|
|
11082
11480
|
// src/utils/deployScriptOrPredicate.ts
|
11083
11481
|
var import_errors30 = require("@fuel-ts/errors");
|
11084
|
-
var
|
11482
|
+
var import_math24 = require("@fuel-ts/math");
|
11085
11483
|
var import_utils43 = require("@fuel-ts/utils");
|
11086
11484
|
|
11087
11485
|
// src/utils/predicate-script-loader-instructions.ts
|
11088
|
-
var
|
11486
|
+
var import_abi_coder7 = require("@fuel-ts/abi-coder");
|
11089
11487
|
var import_hasher8 = require("@fuel-ts/hasher");
|
11090
11488
|
var import_utils42 = require("@fuel-ts/utils");
|
11091
11489
|
var asm2 = __toESM(require("@fuels/vm-asm"));
|
@@ -11097,11 +11495,11 @@ var WORD_SIZE2 = 8;
|
|
11097
11495
|
var DATA_OFFSET_INDEX = 8;
|
11098
11496
|
var CONFIGURABLE_OFFSET_INDEX = 16;
|
11099
11497
|
function getBytecodeDataOffset(bytecode) {
|
11100
|
-
const [offset] = new
|
11498
|
+
const [offset] = new import_abi_coder7.BigNumberCoder("u64").decode(bytecode, DATA_OFFSET_INDEX);
|
11101
11499
|
return offset.toNumber();
|
11102
11500
|
}
|
11103
11501
|
function getBytecodeConfigurableOffset(bytecode) {
|
11104
|
-
const [offset] = new
|
11502
|
+
const [offset] = new import_abi_coder7.BigNumberCoder("u64").decode(bytecode, CONFIGURABLE_OFFSET_INDEX);
|
11105
11503
|
return offset.toNumber();
|
11106
11504
|
}
|
11107
11505
|
function getBytecodeId(bytecode) {
|
@@ -11229,7 +11627,7 @@ function getPredicateScriptLoaderInstructions(originalBinary, blobId) {
|
|
11229
11627
|
|
11230
11628
|
// src/utils/deployScriptOrPredicate.ts
|
11231
11629
|
async function fundBlobTx(deployer, blobTxRequest) {
|
11232
|
-
let totalCost = (0,
|
11630
|
+
let totalCost = (0, import_math24.bn)(0);
|
11233
11631
|
const chainInfo = await deployer.provider.getChain();
|
11234
11632
|
const gasPrice = await deployer.provider.estimateGasPrice(10);
|
11235
11633
|
const priceFactor = chainInfo.consensusParameters.feeParameters.gasPriceFactor;
|
@@ -11426,7 +11824,7 @@ var Predicate = class extends Account {
|
|
11426
11824
|
*/
|
11427
11825
|
static processPredicateData(bytes, jsonAbi, configurableConstants) {
|
11428
11826
|
let predicateBytes = (0, import_utils45.arrayify)(bytes);
|
11429
|
-
const abiInterface = new
|
11827
|
+
const abiInterface = new import_abi_coder8.Interface(jsonAbi);
|
11430
11828
|
if (abiInterface.functions.main === void 0) {
|
11431
11829
|
throw new import_errors31.FuelError(
|
11432
11830
|
import_errors31.ErrorCode.ABI_MAIN_METHOD_MISSING,
|
@@ -11724,7 +12122,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
11724
12122
|
* @param address - The address to sign the transaction
|
11725
12123
|
* @param transaction - The transaction to send
|
11726
12124
|
* @param params - Optional parameters to send the transaction
|
11727
|
-
* @returns The transaction id
|
12125
|
+
* @returns The transaction id or transaction response
|
11728
12126
|
*/
|
11729
12127
|
async sendTransaction(_address, _transaction, _params) {
|
11730
12128
|
throw new import_errors32.FuelError(import_errors32.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
@@ -12255,6 +12653,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
12255
12653
|
AbstractScriptRequest,
|
12256
12654
|
Account,
|
12257
12655
|
AddressType,
|
12656
|
+
BALANCES_PAGE_SIZE_LIMIT,
|
12258
12657
|
BLOCKS_PAGE_SIZE_LIMIT,
|
12259
12658
|
BaseTransactionRequest,
|
12260
12659
|
BaseWalletUnlocked,
|
@@ -12306,6 +12705,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
12306
12705
|
assembleReceiptByType,
|
12307
12706
|
assembleRevertError,
|
12308
12707
|
assembleTransactionSummary,
|
12708
|
+
assembleTransactionSummaryFromJson,
|
12309
12709
|
assets,
|
12310
12710
|
buildBlockExplorerUrl,
|
12311
12711
|
cacheFor,
|
@@ -12322,6 +12722,10 @@ __publicField(Fuel, "defaultConfig", {});
|
|
12322
12722
|
coinQuantityfy,
|
12323
12723
|
deferPromise,
|
12324
12724
|
deployScriptOrPredicate,
|
12725
|
+
deserializeChain,
|
12726
|
+
deserializeNodeInfo,
|
12727
|
+
deserializeProviderCache,
|
12728
|
+
deserializeReceipt,
|
12325
12729
|
dispatchFuelConnectorEvent,
|
12326
12730
|
english,
|
12327
12731
|
extractBurnedAssetsFromReceipts,
|
@@ -12386,6 +12790,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
12386
12790
|
isInputCoin,
|
12387
12791
|
isMessage,
|
12388
12792
|
isMessageCoin,
|
12793
|
+
isPredicate,
|
12389
12794
|
isRawCoin,
|
12390
12795
|
isRawMessage,
|
12391
12796
|
isRequestInputCoin,
|
@@ -12414,6 +12819,9 @@ __publicField(Fuel, "defaultConfig", {});
|
|
12414
12819
|
resolveGasDependentCosts,
|
12415
12820
|
resolveIconPaths,
|
12416
12821
|
returnZeroScript,
|
12822
|
+
serializeChain,
|
12823
|
+
serializeNodeInfo,
|
12824
|
+
serializeProviderCache,
|
12417
12825
|
transactionRequestify,
|
12418
12826
|
urlJoin,
|
12419
12827
|
validateTransactionForAssetBurn,
|