@fuel-ts/account 0.0.0-pr-2943-20240815143842 → 0.0.0-pr-2942-20240816061339
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/README.md +9 -29
- package/dist/account.d.ts +15 -4
- package/dist/account.d.ts.map +1 -1
- package/dist/configs.d.ts +0 -2
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js +0 -2
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js +0 -6
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs +0 -4
- package/dist/configs.mjs.map +1 -1
- package/dist/connectors/fuel-connector.d.ts +24 -1
- package/dist/connectors/fuel-connector.d.ts.map +1 -1
- package/dist/connectors/fuel.d.ts +14 -2
- package/dist/connectors/fuel.d.ts.map +1 -1
- package/dist/connectors/types/connector-metadata.d.ts.map +1 -1
- package/dist/connectors/utils/promises.d.ts.map +1 -1
- package/dist/index.global.js +1388 -1033
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +706 -528
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +534 -367
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +15 -9
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +119 -0
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts +1 -0
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +14 -47
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/resource-cache.d.ts +14 -0
- package/dist/providers/resource-cache.d.ts.map +1 -0
- package/dist/providers/transaction-request/blob-transaction-request.d.ts +48 -0
- package/dist/providers/transaction-request/blob-transaction-request.d.ts.map +1 -0
- package/dist/providers/transaction-request/index.d.ts +1 -0
- package/dist/providers/transaction-request/index.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +4 -3
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/types.d.ts +5 -2
- package/dist/providers/transaction-request/types.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +9 -0
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +3 -0
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -1
- package/dist/providers/transaction-summary/call.d.ts +4 -3
- package/dist/providers/transaction-summary/call.d.ts.map +1 -1
- package/dist/providers/transaction-summary/input.d.ts +1 -1
- package/dist/providers/transaction-summary/input.d.ts.map +1 -1
- package/dist/providers/transaction-summary/operations.d.ts +3 -1
- package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +3 -1
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +6 -0
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +0 -16
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -1
- package/dist/test-utils/test-asset-id.d.ts +8 -0
- package/dist/test-utils/test-asset-id.d.ts.map +1 -0
- package/dist/test-utils/test-message.d.ts +4 -2
- package/dist/test-utils/test-message.d.ts.map +1 -1
- package/dist/test-utils/wallet-config.d.ts +3 -3
- package/dist/test-utils/wallet-config.d.ts.map +1 -1
- package/dist/test-utils.d.ts +1 -3
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/test-utils.global.js +39070 -38743
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +1314 -1201
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +1031 -919
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +1 -2
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/dist/wallet/keystore-wallet.d.ts.map +1 -1
- package/package.json +19 -21
- package/dist/providers/memory-cache.d.ts +0 -11
- package/dist/providers/memory-cache.d.ts.map +0 -1
- package/dist/test-utils/asset-id.d.ts +0 -8
- package/dist/test-utils/asset-id.d.ts.map +0 -1
- package/dist/test-utils/generateTestWallet.d.ts +0 -4
- package/dist/test-utils/generateTestWallet.d.ts.map +0 -1
- package/dist/test-utils/seedTestWallet.d.ts +0 -4
- package/dist/test-utils/seedTestWallet.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
@@ -31,10 +31,10 @@ var __privateMethod = (obj, member, method) => {
|
|
31
31
|
import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
|
32
32
|
import { Address as Address3 } from "@fuel-ts/address";
|
33
33
|
import { randomBytes as randomBytes2 } from "@fuel-ts/crypto";
|
34
|
-
import { ErrorCode as ErrorCode15, FuelError as
|
34
|
+
import { ErrorCode as ErrorCode15, FuelError as FuelError16 } from "@fuel-ts/errors";
|
35
35
|
import { AbstractAccount } from "@fuel-ts/interfaces";
|
36
36
|
import { bn as bn19 } from "@fuel-ts/math";
|
37
|
-
import { arrayify as arrayify14, hexlify as hexlify13, isDefined as
|
37
|
+
import { arrayify as arrayify14, hexlify as hexlify13, isDefined as isDefined3 } from "@fuel-ts/utils";
|
38
38
|
import { clone as clone4 } from "ramda";
|
39
39
|
|
40
40
|
// src/providers/coin-quantity.ts
|
@@ -74,15 +74,10 @@ var addAmountToCoinQuantities = (params) => {
|
|
74
74
|
|
75
75
|
// src/providers/provider.ts
|
76
76
|
import { Address as Address2 } from "@fuel-ts/address";
|
77
|
-
import { ErrorCode as ErrorCode13, FuelError as
|
77
|
+
import { ErrorCode as ErrorCode13, FuelError as FuelError14 } from "@fuel-ts/errors";
|
78
78
|
import { BN, bn as bn17 } from "@fuel-ts/math";
|
79
|
-
import {
|
80
|
-
|
81
|
-
TransactionType as TransactionType8,
|
82
|
-
InputMessageCoder,
|
83
|
-
TransactionCoder as TransactionCoder5
|
84
|
-
} from "@fuel-ts/transactions";
|
85
|
-
import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2 } from "@fuel-ts/utils";
|
79
|
+
import { InputType as InputType7, InputMessageCoder, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
|
80
|
+
import { arrayify as arrayify11, hexlify as hexlify12, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
|
86
81
|
import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
|
87
82
|
import { equalBytes } from "@noble/curves/abstract/utils";
|
88
83
|
import { GraphQLClient } from "graphql-request";
|
@@ -515,6 +510,12 @@ var GasCostsFragmentDoc = gql`
|
|
515
510
|
alocDependentCost {
|
516
511
|
...DependentCostFragment
|
517
512
|
}
|
513
|
+
bldd {
|
514
|
+
...DependentCostFragment
|
515
|
+
}
|
516
|
+
bsiz {
|
517
|
+
...DependentCostFragment
|
518
|
+
}
|
518
519
|
cfe {
|
519
520
|
...DependentCostFragment
|
520
521
|
}
|
@@ -533,6 +534,9 @@ var GasCostsFragmentDoc = gql`
|
|
533
534
|
csiz {
|
534
535
|
...DependentCostFragment
|
535
536
|
}
|
537
|
+
ed19DependentCost {
|
538
|
+
...DependentCostFragment
|
539
|
+
}
|
536
540
|
k256 {
|
537
541
|
...DependentCostFragment
|
538
542
|
}
|
@@ -1139,62 +1143,65 @@ var _FuelGraphqlSubscriber = class {
|
|
1139
1143
|
var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
|
1140
1144
|
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
1141
1145
|
|
1142
|
-
// src/providers/
|
1146
|
+
// src/providers/resource-cache.ts
|
1143
1147
|
import { ErrorCode as ErrorCode2, FuelError as FuelError2 } from "@fuel-ts/errors";
|
1144
1148
|
import { hexlify as hexlify2 } from "@fuel-ts/utils";
|
1145
|
-
var cache =
|
1146
|
-
var
|
1147
|
-
var MemoryCache = class {
|
1149
|
+
var cache = /* @__PURE__ */ new Map();
|
1150
|
+
var ResourceCache = class {
|
1148
1151
|
ttl;
|
1149
|
-
constructor(
|
1150
|
-
this.ttl =
|
1151
|
-
if (typeof
|
1152
|
+
constructor(ttl) {
|
1153
|
+
this.ttl = ttl;
|
1154
|
+
if (typeof ttl !== "number" || this.ttl <= 0) {
|
1152
1155
|
throw new FuelError2(
|
1153
1156
|
ErrorCode2.INVALID_TTL,
|
1154
1157
|
`Invalid TTL: ${this.ttl}. Use a value greater than zero.`
|
1155
1158
|
);
|
1156
1159
|
}
|
1157
1160
|
}
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
}
|
1166
|
-
return void 0;
|
1167
|
-
}
|
1168
|
-
set(value) {
|
1169
|
-
const expiresAt = Date.now() + this.ttl;
|
1170
|
-
const key = hexlify2(value);
|
1171
|
-
cache[key] = {
|
1172
|
-
expires: expiresAt,
|
1173
|
-
value
|
1161
|
+
// Add resources to the cache
|
1162
|
+
set(transactionId, resources) {
|
1163
|
+
const currentTime = Date.now();
|
1164
|
+
const existingResources = cache.get(transactionId) || {
|
1165
|
+
utxos: /* @__PURE__ */ new Set(),
|
1166
|
+
messages: /* @__PURE__ */ new Set(),
|
1167
|
+
timestamp: currentTime
|
1174
1168
|
};
|
1175
|
-
|
1169
|
+
resources.utxos.forEach((utxo) => existingResources.utxos.add(hexlify2(utxo)));
|
1170
|
+
resources.messages.forEach((message) => existingResources.messages.add(hexlify2(message)));
|
1171
|
+
cache.set(transactionId, existingResources);
|
1176
1172
|
}
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
if (data) {
|
1181
|
-
list.push(data);
|
1182
|
-
}
|
1183
|
-
return list;
|
1184
|
-
}, []);
|
1173
|
+
// Remove resources from the cache for a given transaction ID
|
1174
|
+
unset(transactionId) {
|
1175
|
+
cache.delete(transactionId);
|
1185
1176
|
}
|
1177
|
+
// Get all cached resources and remove expired ones
|
1186
1178
|
getActiveData() {
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1179
|
+
const allResources = { utxos: [], messages: [] };
|
1180
|
+
const currentTime = Date.now();
|
1181
|
+
cache.forEach((resource, transactionId) => {
|
1182
|
+
if (currentTime - resource.timestamp < this.ttl) {
|
1183
|
+
allResources.utxos.push(...resource.utxos);
|
1184
|
+
allResources.messages.push(...resource.messages);
|
1185
|
+
} else {
|
1186
|
+
cache.delete(transactionId);
|
1191
1187
|
}
|
1192
|
-
|
1193
|
-
|
1188
|
+
});
|
1189
|
+
return allResources;
|
1190
|
+
}
|
1191
|
+
// Check if a UTXO ID or message nonce is already cached and not expired
|
1192
|
+
isCached(key) {
|
1193
|
+
const currentTime = Date.now();
|
1194
|
+
for (const [transactionId, resourceData] of cache.entries()) {
|
1195
|
+
if (currentTime - resourceData.timestamp > this.ttl) {
|
1196
|
+
cache.delete(transactionId);
|
1197
|
+
} else if (resourceData.utxos.has(key) || resourceData.messages.has(key)) {
|
1198
|
+
return true;
|
1199
|
+
}
|
1200
|
+
}
|
1201
|
+
return false;
|
1194
1202
|
}
|
1195
|
-
|
1196
|
-
|
1197
|
-
delete cache[key];
|
1203
|
+
clear() {
|
1204
|
+
cache.clear();
|
1198
1205
|
}
|
1199
1206
|
};
|
1200
1207
|
|
@@ -1335,6 +1342,7 @@ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
|
|
1335
1342
|
import { Address, addressify } from "@fuel-ts/address";
|
1336
1343
|
import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
|
1337
1344
|
import { randomBytes } from "@fuel-ts/crypto";
|
1345
|
+
import { FuelError as FuelError8 } from "@fuel-ts/errors";
|
1338
1346
|
import { bn as bn8 } from "@fuel-ts/math";
|
1339
1347
|
import {
|
1340
1348
|
PolicyType,
|
@@ -1715,6 +1723,15 @@ function calculateMetadataGasForTxScript({
|
|
1715
1723
|
}) {
|
1716
1724
|
return resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
1717
1725
|
}
|
1726
|
+
function calculateMetadataGasForTxBlob({
|
1727
|
+
gasCosts,
|
1728
|
+
txBytesSize,
|
1729
|
+
witnessBytesSize
|
1730
|
+
}) {
|
1731
|
+
const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
|
1732
|
+
const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
|
1733
|
+
return txId.add(blobLen);
|
1734
|
+
}
|
1718
1735
|
var calculateGasFee = (params) => {
|
1719
1736
|
const { gas, gasPrice, priceFactor, tip } = params;
|
1720
1737
|
return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
|
@@ -2291,7 +2308,7 @@ var BaseTransactionRequest = class {
|
|
2291
2308
|
* @hidden
|
2292
2309
|
*/
|
2293
2310
|
metadataGas(_gasCosts) {
|
2294
|
-
throw new
|
2311
|
+
throw new FuelError8(FuelError8.CODES.NOT_IMPLEMENTED, "Not implemented");
|
2295
2312
|
}
|
2296
2313
|
/**
|
2297
2314
|
* @hidden
|
@@ -2366,6 +2383,7 @@ var BaseTransactionRequest = class {
|
|
2366
2383
|
};
|
2367
2384
|
updateAssetInput(baseAssetId, bn8(1e11));
|
2368
2385
|
quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
|
2386
|
+
return this;
|
2369
2387
|
}
|
2370
2388
|
/**
|
2371
2389
|
* Retrieves an array of CoinQuantity for each coin output present in the transaction.
|
@@ -2412,14 +2430,11 @@ var BaseTransactionRequest = class {
|
|
2412
2430
|
}
|
2413
2431
|
});
|
2414
2432
|
}
|
2433
|
+
byteLength() {
|
2434
|
+
return this.toTransactionBytes().byteLength;
|
2435
|
+
}
|
2415
2436
|
};
|
2416
2437
|
|
2417
|
-
// src/providers/transaction-request/create-transaction-request.ts
|
2418
|
-
import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
|
2419
|
-
import { bn as bn10 } from "@fuel-ts/math";
|
2420
|
-
import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
|
2421
|
-
import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
|
2422
|
-
|
2423
2438
|
// src/providers/transaction-request/hash-transaction.ts
|
2424
2439
|
import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
|
2425
2440
|
import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
|
@@ -2491,6 +2506,76 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2491
2506
|
return sha256(concatenatedData);
|
2492
2507
|
}
|
2493
2508
|
|
2509
|
+
// src/providers/transaction-request/blob-transaction-request.ts
|
2510
|
+
var BlobTransactionRequest = class extends BaseTransactionRequest {
|
2511
|
+
static from(obj) {
|
2512
|
+
if (obj instanceof this) {
|
2513
|
+
return obj;
|
2514
|
+
}
|
2515
|
+
return new this(obj);
|
2516
|
+
}
|
2517
|
+
/** Type of the transaction */
|
2518
|
+
type = TransactionType.Blob;
|
2519
|
+
/** Blob ID */
|
2520
|
+
blobId;
|
2521
|
+
/** Witness index of contract bytecode to create */
|
2522
|
+
witnessIndex;
|
2523
|
+
/**
|
2524
|
+
* Creates an instance `BlobTransactionRequest`.
|
2525
|
+
*
|
2526
|
+
* @param blobTransactionRequestLike - The initial values for the instance
|
2527
|
+
*/
|
2528
|
+
constructor({ witnessIndex, blobId, ...rest }) {
|
2529
|
+
super(rest);
|
2530
|
+
this.blobId = blobId;
|
2531
|
+
this.witnessIndex = witnessIndex ?? 0;
|
2532
|
+
}
|
2533
|
+
/**
|
2534
|
+
* Converts the transaction request to a `TransactionBlob`.
|
2535
|
+
*
|
2536
|
+
* @returns The transaction create object.
|
2537
|
+
*/
|
2538
|
+
toTransaction() {
|
2539
|
+
const baseTransaction = this.getBaseTransaction();
|
2540
|
+
const { witnessIndex, blobId } = this;
|
2541
|
+
return {
|
2542
|
+
type: TransactionType.Blob,
|
2543
|
+
...baseTransaction,
|
2544
|
+
blobId,
|
2545
|
+
witnessIndex
|
2546
|
+
};
|
2547
|
+
}
|
2548
|
+
/**
|
2549
|
+
* Gets the Transaction Request by hashing the transaction.
|
2550
|
+
*
|
2551
|
+
* @param chainId - The chain ID.
|
2552
|
+
*
|
2553
|
+
* @returns - A hash of the transaction, which is the transaction ID.
|
2554
|
+
*/
|
2555
|
+
getTransactionId(chainId) {
|
2556
|
+
return hashTransaction(this, chainId);
|
2557
|
+
}
|
2558
|
+
/**
|
2559
|
+
* Calculates the metadata gas cost for a blob transaction.
|
2560
|
+
*
|
2561
|
+
* @param gasCosts - gas costs passed from the chain.
|
2562
|
+
* @returns metadata gas cost for the blob transaction.
|
2563
|
+
*/
|
2564
|
+
metadataGas(gasCosts) {
|
2565
|
+
return calculateMetadataGasForTxBlob({
|
2566
|
+
gasCosts,
|
2567
|
+
txBytesSize: this.byteSize(),
|
2568
|
+
witnessBytesSize: this.witnesses[this.witnessIndex].length
|
2569
|
+
});
|
2570
|
+
}
|
2571
|
+
};
|
2572
|
+
|
2573
|
+
// src/providers/transaction-request/create-transaction-request.ts
|
2574
|
+
import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
|
2575
|
+
import { bn as bn10 } from "@fuel-ts/math";
|
2576
|
+
import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
|
2577
|
+
import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
|
2578
|
+
|
2494
2579
|
// src/providers/transaction-request/storage-slot.ts
|
2495
2580
|
import { arrayify as arrayify5, hexlify as hexlify8 } from "@fuel-ts/utils";
|
2496
2581
|
var getStorageValue = (value) => {
|
@@ -2819,10 +2904,10 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2819
2904
|
};
|
2820
2905
|
|
2821
2906
|
// src/providers/transaction-request/utils.ts
|
2822
|
-
import { ErrorCode as ErrorCode8, FuelError as
|
2907
|
+
import { ErrorCode as ErrorCode8, FuelError as FuelError9 } from "@fuel-ts/errors";
|
2823
2908
|
import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
|
2824
2909
|
var transactionRequestify = (obj) => {
|
2825
|
-
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
|
2910
|
+
if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
|
2826
2911
|
return obj;
|
2827
2912
|
}
|
2828
2913
|
const { type } = obj;
|
@@ -2833,17 +2918,26 @@ var transactionRequestify = (obj) => {
|
|
2833
2918
|
case TransactionType5.Create: {
|
2834
2919
|
return CreateTransactionRequest.from(obj);
|
2835
2920
|
}
|
2921
|
+
case TransactionType5.Blob: {
|
2922
|
+
return BlobTransactionRequest.from(obj);
|
2923
|
+
}
|
2836
2924
|
default: {
|
2837
|
-
throw new
|
2925
|
+
throw new FuelError9(
|
2926
|
+
ErrorCode8.UNSUPPORTED_TRANSACTION_TYPE,
|
2927
|
+
`Unsupported transaction type: ${type}.`
|
2928
|
+
);
|
2838
2929
|
}
|
2839
2930
|
}
|
2840
2931
|
};
|
2932
|
+
var isTransactionTypeScript = (request) => request.type === TransactionType5.Script;
|
2933
|
+
var isTransactionTypeCreate = (request) => request.type === TransactionType5.Create;
|
2934
|
+
var isTransactionTypeBlob = (request) => request.type === TransactionType5.Blob;
|
2841
2935
|
|
2842
2936
|
// src/providers/transaction-response/transaction-response.ts
|
2843
|
-
import { ErrorCode as ErrorCode12, FuelError as
|
2937
|
+
import { ErrorCode as ErrorCode12, FuelError as FuelError13 } from "@fuel-ts/errors";
|
2844
2938
|
import { bn as bn16 } from "@fuel-ts/math";
|
2845
2939
|
import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
|
2846
|
-
import { arrayify as arrayify10 } from "@fuel-ts/utils";
|
2940
|
+
import { arrayify as arrayify10, sleep } from "@fuel-ts/utils";
|
2847
2941
|
|
2848
2942
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2849
2943
|
import { bn as bn15 } from "@fuel-ts/math";
|
@@ -2922,7 +3016,7 @@ var calculateTXFeeForSummary = (params) => {
|
|
2922
3016
|
|
2923
3017
|
// src/providers/transaction-summary/operations.ts
|
2924
3018
|
import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
|
2925
|
-
import { ErrorCode as ErrorCode10, FuelError as
|
3019
|
+
import { ErrorCode as ErrorCode10, FuelError as FuelError11 } from "@fuel-ts/errors";
|
2926
3020
|
import { bn as bn13 } from "@fuel-ts/math";
|
2927
3021
|
import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
|
2928
3022
|
|
@@ -2960,7 +3054,7 @@ var getFunctionCall = ({ abi, receipt }) => {
|
|
2960
3054
|
};
|
2961
3055
|
|
2962
3056
|
// src/providers/transaction-summary/input.ts
|
2963
|
-
import { ErrorCode as ErrorCode9, FuelError as
|
3057
|
+
import { ErrorCode as ErrorCode9, FuelError as FuelError10 } from "@fuel-ts/errors";
|
2964
3058
|
import { InputType as InputType6 } from "@fuel-ts/transactions";
|
2965
3059
|
function getInputsByTypes(inputs, types) {
|
2966
3060
|
return inputs.filter((i) => types.includes(i.type));
|
@@ -2980,14 +3074,22 @@ function getInputsCoinAndMessage(inputs) {
|
|
2980
3074
|
function getInputsContract(inputs) {
|
2981
3075
|
return getInputsByType(inputs, InputType6.Contract);
|
2982
3076
|
}
|
2983
|
-
function
|
3077
|
+
function findCoinInput(inputs, assetId) {
|
2984
3078
|
const coinInputs = getInputsCoin(inputs);
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
3079
|
+
return coinInputs.find((i) => i.assetId === assetId);
|
3080
|
+
}
|
3081
|
+
function findMessageInput(inputs) {
|
3082
|
+
return getInputsMessage(inputs)?.[0];
|
3083
|
+
}
|
3084
|
+
function getInputFromAssetId(inputs, assetId, isBaseAsset = false) {
|
3085
|
+
const coinInput = findCoinInput(inputs, assetId);
|
3086
|
+
if (coinInput) {
|
3087
|
+
return coinInput;
|
3088
|
+
}
|
3089
|
+
if (isBaseAsset) {
|
3090
|
+
return findMessageInput(inputs);
|
3091
|
+
}
|
3092
|
+
return void 0;
|
2991
3093
|
}
|
2992
3094
|
function getInputContractFromIndex(inputs, inputIndex) {
|
2993
3095
|
if (inputIndex == null) {
|
@@ -2998,7 +3100,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
|
|
2998
3100
|
return void 0;
|
2999
3101
|
}
|
3000
3102
|
if (contractInput.type !== InputType6.Contract) {
|
3001
|
-
throw new
|
3103
|
+
throw new FuelError10(
|
3002
3104
|
ErrorCode9.INVALID_TRANSACTION_INPUT,
|
3003
3105
|
`Contract input should be of type 'contract'.`
|
3004
3106
|
);
|
@@ -3043,6 +3145,7 @@ var TransactionTypeName = /* @__PURE__ */ ((TransactionTypeName2) => {
|
|
3043
3145
|
TransactionTypeName2["Script"] = "Script";
|
3044
3146
|
TransactionTypeName2["Upgrade"] = "Upgrade";
|
3045
3147
|
TransactionTypeName2["Upload"] = "Upload";
|
3148
|
+
TransactionTypeName2["Blob"] = "Blob";
|
3046
3149
|
return TransactionTypeName2;
|
3047
3150
|
})(TransactionTypeName || {});
|
3048
3151
|
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
@@ -3088,10 +3191,12 @@ function getTransactionTypeName(transactionType) {
|
|
3088
3191
|
return "Create" /* Create */;
|
3089
3192
|
case TransactionType7.Script:
|
3090
3193
|
return "Script" /* Script */;
|
3194
|
+
case TransactionType7.Blob:
|
3195
|
+
return "Blob" /* Blob */;
|
3091
3196
|
default:
|
3092
|
-
throw new
|
3093
|
-
ErrorCode10.
|
3094
|
-
`
|
3197
|
+
throw new FuelError11(
|
3198
|
+
ErrorCode10.UNSUPPORTED_TRANSACTION_TYPE,
|
3199
|
+
`Unsupported transaction type: ${transactionType}.`
|
3095
3200
|
);
|
3096
3201
|
}
|
3097
3202
|
}
|
@@ -3114,6 +3219,9 @@ function isTypeUpgrade(transactionType) {
|
|
3114
3219
|
function isTypeUpload(transactionType) {
|
3115
3220
|
return isType(transactionType, "Upload" /* Upload */);
|
3116
3221
|
}
|
3222
|
+
function isTypeBlob(transactionType) {
|
3223
|
+
return isType(transactionType, "Blob" /* Blob */);
|
3224
|
+
}
|
3117
3225
|
function hasSameAssetId(a) {
|
3118
3226
|
return (b) => a.assetId === b.assetId;
|
3119
3227
|
}
|
@@ -3123,41 +3231,51 @@ function getReceiptsCall(receipts) {
|
|
3123
3231
|
function getReceiptsMessageOut(receipts) {
|
3124
3232
|
return getReceiptsByType(receipts, ReceiptType4.MessageOut);
|
3125
3233
|
}
|
3126
|
-
|
3234
|
+
function mergeAssets(op1, op2) {
|
3127
3235
|
const assets1 = op1.assetsSent || [];
|
3128
3236
|
const assets2 = op2.assetsSent || [];
|
3129
|
-
const
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3237
|
+
const assetMap = /* @__PURE__ */ new Map();
|
3238
|
+
assets1.forEach((asset) => {
|
3239
|
+
assetMap.set(asset.assetId, { ...asset });
|
3240
|
+
});
|
3241
|
+
assets2.forEach((asset) => {
|
3242
|
+
const existingAsset = assetMap.get(asset.assetId);
|
3243
|
+
if (existingAsset) {
|
3244
|
+
existingAsset.amount = bn13(existingAsset.amount).add(asset.amount);
|
3245
|
+
} else {
|
3246
|
+
assetMap.set(asset.assetId, { ...asset });
|
3136
3247
|
}
|
3137
|
-
const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
|
3138
|
-
return { ...asset1, amount: mergedAmount };
|
3139
3248
|
});
|
3140
|
-
return
|
3141
|
-
}
|
3249
|
+
return Array.from(assetMap.values());
|
3250
|
+
}
|
3142
3251
|
function isSameOperation(a, b) {
|
3143
3252
|
return a.name === b.name && a.from?.address === b.from?.address && a.to?.address === b.to?.address && a.from?.type === b.from?.type && a.to?.type === b.to?.type;
|
3144
3253
|
}
|
3254
|
+
function mergeAssetsSent(existing, toAdd) {
|
3255
|
+
if (!toAdd.assetsSent?.length) {
|
3256
|
+
return existing.assetsSent;
|
3257
|
+
}
|
3258
|
+
return existing.assetsSent?.length ? mergeAssets(existing, toAdd) : toAdd.assetsSent;
|
3259
|
+
}
|
3260
|
+
function mergeCalls(existing, toAdd) {
|
3261
|
+
if (!toAdd.calls?.length) {
|
3262
|
+
return existing.calls;
|
3263
|
+
}
|
3264
|
+
return [...existing.calls || [], ...toAdd.calls];
|
3265
|
+
}
|
3266
|
+
function mergeOperations(existing, toAdd) {
|
3267
|
+
return {
|
3268
|
+
...existing,
|
3269
|
+
assetsSent: mergeAssetsSent(existing, toAdd),
|
3270
|
+
calls: mergeCalls(existing, toAdd)
|
3271
|
+
};
|
3272
|
+
}
|
3145
3273
|
function addOperation(operations, toAdd) {
|
3146
|
-
const
|
3147
|
-
|
3148
|
-
|
3149
|
-
const existentOperation = { ...allOperations[index] };
|
3150
|
-
if (toAdd.assetsSent?.length) {
|
3151
|
-
existentOperation.assetsSent = existentOperation.assetsSent?.length ? mergeAssets(existentOperation, toAdd) : toAdd.assetsSent;
|
3152
|
-
}
|
3153
|
-
if (toAdd.calls?.length) {
|
3154
|
-
existentOperation.calls = [...existentOperation.calls || [], ...toAdd.calls];
|
3155
|
-
}
|
3156
|
-
allOperations[index] = existentOperation;
|
3157
|
-
} else {
|
3158
|
-
allOperations.push(toAdd);
|
3274
|
+
const existingIndex = operations.findIndex((op) => isSameOperation(op, toAdd));
|
3275
|
+
if (existingIndex === -1) {
|
3276
|
+
return [...operations, toAdd];
|
3159
3277
|
}
|
3160
|
-
return
|
3278
|
+
return operations.map((op, index) => index === existingIndex ? mergeOperations(op, toAdd) : op);
|
3161
3279
|
}
|
3162
3280
|
function getReceiptsTransferOut(receipts) {
|
3163
3281
|
return getReceiptsByType(receipts, ReceiptType4.TransferOut);
|
@@ -3170,7 +3288,7 @@ function getWithdrawFromFuelOperations({
|
|
3170
3288
|
const messageOutReceipts = getReceiptsMessageOut(receipts);
|
3171
3289
|
const withdrawFromFuelOperations = messageOutReceipts.reduce(
|
3172
3290
|
(prevWithdrawFromFuelOps, receipt) => {
|
3173
|
-
const input = getInputFromAssetId(inputs, baseAssetId);
|
3291
|
+
const input = getInputFromAssetId(inputs, baseAssetId, true);
|
3174
3292
|
if (input) {
|
3175
3293
|
const inputAddress = getInputAccountAddress(input);
|
3176
3294
|
const newWithdrawFromFuelOps = addOperation(prevWithdrawFromFuelOps, {
|
@@ -3199,65 +3317,80 @@ function getWithdrawFromFuelOperations({
|
|
3199
3317
|
);
|
3200
3318
|
return withdrawFromFuelOperations;
|
3201
3319
|
}
|
3320
|
+
function getContractCalls(contractInput, abiMap, receipt, rawPayload, maxInputs) {
|
3321
|
+
const abi = abiMap?.[contractInput.contractID];
|
3322
|
+
if (!abi) {
|
3323
|
+
return [];
|
3324
|
+
}
|
3325
|
+
return [
|
3326
|
+
getFunctionCall({
|
3327
|
+
abi,
|
3328
|
+
receipt,
|
3329
|
+
rawPayload,
|
3330
|
+
maxInputs
|
3331
|
+
})
|
3332
|
+
];
|
3333
|
+
}
|
3334
|
+
function getAssetsSent(receipt) {
|
3335
|
+
return receipt.amount?.isZero() ? void 0 : [
|
3336
|
+
{
|
3337
|
+
amount: receipt.amount,
|
3338
|
+
assetId: receipt.assetId
|
3339
|
+
}
|
3340
|
+
];
|
3341
|
+
}
|
3342
|
+
function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
|
3343
|
+
const assetId = receipt.assetId === ZeroBytes328 ? baseAssetId : receipt.assetId;
|
3344
|
+
const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
|
3345
|
+
if (!input) {
|
3346
|
+
return [];
|
3347
|
+
}
|
3348
|
+
const inputAddress = getInputAccountAddress(input);
|
3349
|
+
const calls = getContractCalls(contractInput, abiMap, receipt, rawPayload, maxInputs);
|
3350
|
+
return [
|
3351
|
+
{
|
3352
|
+
name: "Contract call" /* contractCall */,
|
3353
|
+
from: {
|
3354
|
+
type: 1 /* account */,
|
3355
|
+
address: inputAddress
|
3356
|
+
},
|
3357
|
+
to: {
|
3358
|
+
type: 0 /* contract */,
|
3359
|
+
address: receipt.to
|
3360
|
+
},
|
3361
|
+
assetsSent: getAssetsSent(receipt),
|
3362
|
+
calls
|
3363
|
+
}
|
3364
|
+
];
|
3365
|
+
}
|
3202
3366
|
function getContractCallOperations({
|
3203
3367
|
inputs,
|
3204
3368
|
outputs,
|
3205
3369
|
receipts,
|
3206
3370
|
abiMap,
|
3207
3371
|
rawPayload,
|
3208
|
-
maxInputs
|
3372
|
+
maxInputs,
|
3373
|
+
baseAssetId
|
3209
3374
|
}) {
|
3210
3375
|
const contractCallReceipts = getReceiptsCall(receipts);
|
3211
3376
|
const contractOutputs = getOutputsContract(outputs);
|
3212
|
-
|
3377
|
+
return contractOutputs.flatMap((output) => {
|
3213
3378
|
const contractInput = getInputContractFromIndex(inputs, output.inputIndex);
|
3214
|
-
if (contractInput) {
|
3215
|
-
|
3216
|
-
if (receipt.to === contractInput.contractID) {
|
3217
|
-
const input = getInputFromAssetId(inputs, receipt.assetId);
|
3218
|
-
if (input) {
|
3219
|
-
const inputAddress = getInputAccountAddress(input);
|
3220
|
-
const calls = [];
|
3221
|
-
const abi = abiMap?.[contractInput.contractID];
|
3222
|
-
if (abi) {
|
3223
|
-
calls.push(
|
3224
|
-
getFunctionCall({
|
3225
|
-
abi,
|
3226
|
-
receipt,
|
3227
|
-
rawPayload,
|
3228
|
-
maxInputs
|
3229
|
-
})
|
3230
|
-
);
|
3231
|
-
}
|
3232
|
-
const newContractCallOps = addOperation(prevContractCallOps, {
|
3233
|
-
name: "Contract call" /* contractCall */,
|
3234
|
-
from: {
|
3235
|
-
type: 1 /* account */,
|
3236
|
-
address: inputAddress
|
3237
|
-
},
|
3238
|
-
to: {
|
3239
|
-
type: 0 /* contract */,
|
3240
|
-
address: receipt.to
|
3241
|
-
},
|
3242
|
-
// if no amount is forwarded to the contract, skip showing assetsSent
|
3243
|
-
assetsSent: receipt.amount?.isZero() ? void 0 : [
|
3244
|
-
{
|
3245
|
-
amount: receipt.amount,
|
3246
|
-
assetId: receipt.assetId
|
3247
|
-
}
|
3248
|
-
],
|
3249
|
-
calls
|
3250
|
-
});
|
3251
|
-
return newContractCallOps;
|
3252
|
-
}
|
3253
|
-
}
|
3254
|
-
return prevContractCallOps;
|
3255
|
-
}, prevOutputCallOps);
|
3256
|
-
return newCallOps;
|
3379
|
+
if (!contractInput) {
|
3380
|
+
return [];
|
3257
3381
|
}
|
3258
|
-
return
|
3259
|
-
|
3260
|
-
|
3382
|
+
return contractCallReceipts.filter((receipt) => receipt.to === contractInput.contractID).flatMap(
|
3383
|
+
(receipt) => processCallReceipt(
|
3384
|
+
receipt,
|
3385
|
+
contractInput,
|
3386
|
+
inputs,
|
3387
|
+
abiMap,
|
3388
|
+
rawPayload,
|
3389
|
+
maxInputs,
|
3390
|
+
baseAssetId
|
3391
|
+
)
|
3392
|
+
);
|
3393
|
+
});
|
3261
3394
|
}
|
3262
3395
|
function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
|
3263
3396
|
const { to: toAddress, assetId, amount } = receipt;
|
@@ -3401,7 +3534,8 @@ function getOperations({
|
|
3401
3534
|
receipts,
|
3402
3535
|
abiMap,
|
3403
3536
|
rawPayload,
|
3404
|
-
maxInputs
|
3537
|
+
maxInputs,
|
3538
|
+
baseAssetId
|
3405
3539
|
}),
|
3406
3540
|
...getWithdrawFromFuelOperations({ inputs, receipts, baseAssetId })
|
3407
3541
|
];
|
@@ -3460,7 +3594,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
3460
3594
|
};
|
3461
3595
|
|
3462
3596
|
// src/providers/transaction-summary/status.ts
|
3463
|
-
import { ErrorCode as ErrorCode11, FuelError as
|
3597
|
+
import { ErrorCode as ErrorCode11, FuelError as FuelError12 } from "@fuel-ts/errors";
|
3464
3598
|
import { bn as bn14 } from "@fuel-ts/math";
|
3465
3599
|
var getTransactionStatusName = (gqlStatus) => {
|
3466
3600
|
switch (gqlStatus) {
|
@@ -3473,7 +3607,7 @@ var getTransactionStatusName = (gqlStatus) => {
|
|
3473
3607
|
case "SqueezedOutStatus":
|
3474
3608
|
return "squeezedout" /* squeezedout */;
|
3475
3609
|
default:
|
3476
|
-
throw new
|
3610
|
+
throw new FuelError12(
|
3477
3611
|
ErrorCode11.INVALID_TRANSACTION_STATUS,
|
3478
3612
|
`Invalid transaction status: ${gqlStatus}.`
|
3479
3613
|
);
|
@@ -3595,6 +3729,7 @@ function assembleTransactionSummary(params) {
|
|
3595
3729
|
isTypeScript: isTypeScript(transaction.type),
|
3596
3730
|
isTypeUpgrade: isTypeUpgrade(transaction.type),
|
3597
3731
|
isTypeUpload: isTypeUpload(transaction.type),
|
3732
|
+
isTypeBlob: isTypeBlob(transaction.type),
|
3598
3733
|
isStatusFailure,
|
3599
3734
|
isStatusSuccess,
|
3600
3735
|
isStatusPending,
|
@@ -3630,6 +3765,8 @@ var TransactionResponse = class {
|
|
3630
3765
|
/** The graphql Transaction with receipts object. */
|
3631
3766
|
gqlTransaction;
|
3632
3767
|
abis;
|
3768
|
+
/** The expected status from the getTransactionWithReceipts response */
|
3769
|
+
expectedStatus;
|
3633
3770
|
/**
|
3634
3771
|
* Constructor for `TransactionResponse`.
|
3635
3772
|
*
|
@@ -3669,11 +3806,16 @@ var TransactionResponse = class {
|
|
3669
3806
|
});
|
3670
3807
|
for await (const { statusChange } of subscription) {
|
3671
3808
|
if (statusChange) {
|
3809
|
+
this.expectedStatus = statusChange.type;
|
3672
3810
|
break;
|
3673
3811
|
}
|
3674
3812
|
}
|
3675
3813
|
return this.fetch();
|
3676
3814
|
}
|
3815
|
+
if (this.expectedStatus && response.transaction.status?.type !== this.expectedStatus) {
|
3816
|
+
await sleep(100);
|
3817
|
+
return this.fetch();
|
3818
|
+
}
|
3677
3819
|
this.gqlTransaction = response.transaction;
|
3678
3820
|
return response.transaction;
|
3679
3821
|
}
|
@@ -3740,12 +3882,14 @@ var TransactionResponse = class {
|
|
3740
3882
|
});
|
3741
3883
|
for await (const { statusChange } of subscription) {
|
3742
3884
|
if (statusChange.type === "SqueezedOutStatus") {
|
3743
|
-
|
3885
|
+
this.unsetResourceCache();
|
3886
|
+
throw new FuelError13(
|
3744
3887
|
ErrorCode12.TRANSACTION_SQUEEZED_OUT,
|
3745
3888
|
`Transaction Squeezed Out with reason: ${statusChange.reason}`
|
3746
3889
|
);
|
3747
3890
|
}
|
3748
3891
|
if (statusChange.type !== "SubmittedStatus") {
|
3892
|
+
this.expectedStatus = statusChange.type;
|
3749
3893
|
break;
|
3750
3894
|
}
|
3751
3895
|
}
|
@@ -3780,6 +3924,7 @@ var TransactionResponse = class {
|
|
3780
3924
|
}
|
3781
3925
|
const { gqlTransaction, receipts } = transactionResult;
|
3782
3926
|
if (gqlTransaction.status?.type === "FailureStatus") {
|
3927
|
+
this.unsetResourceCache();
|
3783
3928
|
const { reason } = gqlTransaction.status;
|
3784
3929
|
throw extractTxError({
|
3785
3930
|
receipts,
|
@@ -3806,10 +3951,13 @@ var TransactionResponse = class {
|
|
3806
3951
|
async wait(contractsAbiMap) {
|
3807
3952
|
return this.waitForResult(contractsAbiMap);
|
3808
3953
|
}
|
3954
|
+
unsetResourceCache() {
|
3955
|
+
this.provider.cache?.unset(this.id);
|
3956
|
+
}
|
3809
3957
|
};
|
3810
3958
|
|
3811
3959
|
// src/providers/utils/auto-retry-fetch.ts
|
3812
|
-
import { sleep } from "@fuel-ts/utils";
|
3960
|
+
import { sleep as sleep2 } from "@fuel-ts/utils";
|
3813
3961
|
function getWaitDelay(options, retryAttemptNum) {
|
3814
3962
|
const duration = options.baseDelay ?? 150;
|
3815
3963
|
switch (options.backoff) {
|
@@ -3839,30 +3987,17 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
|
|
3839
3987
|
throw error;
|
3840
3988
|
}
|
3841
3989
|
const delay = getWaitDelay(options, retryNum);
|
3842
|
-
await
|
3990
|
+
await sleep2(delay);
|
3843
3991
|
return autoRetryFetch(fetchFn, options, retryNum)(...args);
|
3844
3992
|
}
|
3845
3993
|
};
|
3846
3994
|
}
|
3847
3995
|
|
3848
|
-
// src/providers/utils/merge-quantities.ts
|
3849
|
-
var mergeQuantities = (...coinQuantities) => {
|
3850
|
-
const resultMap = {};
|
3851
|
-
function addToMap({ amount, assetId }) {
|
3852
|
-
if (resultMap[assetId]) {
|
3853
|
-
resultMap[assetId] = resultMap[assetId].add(amount);
|
3854
|
-
} else {
|
3855
|
-
resultMap[assetId] = amount;
|
3856
|
-
}
|
3857
|
-
}
|
3858
|
-
coinQuantities.forEach((arr) => arr.forEach(addToMap));
|
3859
|
-
return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
|
3860
|
-
};
|
3861
|
-
|
3862
3996
|
// src/providers/provider.ts
|
3863
3997
|
var MAX_RETRIES = 10;
|
3864
3998
|
var RESOURCES_PAGE_SIZE_LIMIT = 512;
|
3865
3999
|
var BLOCKS_PAGE_SIZE_LIMIT = 5;
|
4000
|
+
var DEFAULT_RESOURCE_CACHE_TTL = 2e4;
|
3866
4001
|
var processGqlChain = (chain) => {
|
3867
4002
|
const { name, daHeight, consensusParameters, latestBlock } = chain;
|
3868
4003
|
const {
|
@@ -3945,14 +4080,23 @@ var _Provider = class {
|
|
3945
4080
|
__publicField(this, "cache");
|
3946
4081
|
__publicField(this, "options", {
|
3947
4082
|
timeout: void 0,
|
3948
|
-
|
4083
|
+
resourceCacheTTL: void 0,
|
3949
4084
|
fetch: void 0,
|
3950
4085
|
retryOptions: void 0
|
3951
4086
|
});
|
3952
4087
|
this.options = { ...this.options, ...options };
|
3953
4088
|
this.url = url;
|
3954
4089
|
this.operations = this.createOperations();
|
3955
|
-
|
4090
|
+
const { resourceCacheTTL } = this.options;
|
4091
|
+
if (isDefined2(resourceCacheTTL)) {
|
4092
|
+
if (resourceCacheTTL !== -1) {
|
4093
|
+
this.cache = new ResourceCache(resourceCacheTTL);
|
4094
|
+
} else {
|
4095
|
+
this.cache = void 0;
|
4096
|
+
}
|
4097
|
+
} else {
|
4098
|
+
this.cache = new ResourceCache(DEFAULT_RESOURCE_CACHE_TTL);
|
4099
|
+
}
|
3956
4100
|
}
|
3957
4101
|
/** @hidden */
|
3958
4102
|
static clearChainAndNodeCaches() {
|
@@ -3996,7 +4140,7 @@ var _Provider = class {
|
|
3996
4140
|
getChain() {
|
3997
4141
|
const chain = _Provider.chainInfoCache[this.url];
|
3998
4142
|
if (!chain) {
|
3999
|
-
throw new
|
4143
|
+
throw new FuelError14(
|
4000
4144
|
ErrorCode13.CHAIN_INFO_CACHE_EMPTY,
|
4001
4145
|
"Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
|
4002
4146
|
);
|
@@ -4011,7 +4155,7 @@ var _Provider = class {
|
|
4011
4155
|
getNode() {
|
4012
4156
|
const node = _Provider.nodeInfoCache[this.url];
|
4013
4157
|
if (!node) {
|
4014
|
-
throw new
|
4158
|
+
throw new FuelError14(
|
4015
4159
|
ErrorCode13.NODE_INFO_CACHE_EMPTY,
|
4016
4160
|
"Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
|
4017
4161
|
);
|
@@ -4090,8 +4234,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4090
4234
|
if ("response" in response) {
|
4091
4235
|
const graphQlResponse = response.response;
|
4092
4236
|
if (Array.isArray(graphQlResponse?.errors)) {
|
4093
|
-
throw new
|
4094
|
-
|
4237
|
+
throw new FuelError14(
|
4238
|
+
FuelError14.CODES.INVALID_REQUEST,
|
4095
4239
|
graphQlResponse.errors.map((err) => err.message).join("\n\n")
|
4096
4240
|
);
|
4097
4241
|
}
|
@@ -4183,6 +4327,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4183
4327
|
} = this.getChain();
|
4184
4328
|
return baseAssetId;
|
4185
4329
|
}
|
4330
|
+
validateTransaction(tx, consensusParameters) {
|
4331
|
+
const { maxOutputs, maxInputs } = consensusParameters.txParameters;
|
4332
|
+
if (bn17(tx.inputs.length).gt(maxInputs)) {
|
4333
|
+
throw new FuelError14(
|
4334
|
+
ErrorCode13.MAX_INPUTS_EXCEEDED,
|
4335
|
+
"The transaction exceeds the maximum allowed number of inputs."
|
4336
|
+
);
|
4337
|
+
}
|
4338
|
+
if (bn17(tx.outputs.length).gt(maxOutputs)) {
|
4339
|
+
throw new FuelError14(
|
4340
|
+
ErrorCode13.MAX_OUTPUTS_EXCEEDED,
|
4341
|
+
"The transaction exceeds the maximum allowed number of outputs."
|
4342
|
+
);
|
4343
|
+
}
|
4344
|
+
}
|
4186
4345
|
/**
|
4187
4346
|
* Submits a transaction to the chain to be executed.
|
4188
4347
|
*
|
@@ -4194,38 +4353,22 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4194
4353
|
* @returns A promise that resolves to the transaction response object.
|
4195
4354
|
*/
|
4196
4355
|
// #region Provider-sendTransaction
|
4197
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true
|
4356
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
4198
4357
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
4199
|
-
__privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs);
|
4200
4358
|
if (estimateTxDependencies) {
|
4201
4359
|
await this.estimateTxDependencies(transactionRequest);
|
4202
4360
|
}
|
4361
|
+
const { consensusParameters } = this.getChain();
|
4362
|
+
this.validateTransaction(transactionRequest, consensusParameters);
|
4203
4363
|
const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
|
4204
4364
|
let abis;
|
4205
|
-
if (transactionRequest
|
4365
|
+
if (isTransactionTypeScript(transactionRequest)) {
|
4206
4366
|
abis = transactionRequest.abis;
|
4207
4367
|
}
|
4208
|
-
if (awaitExecution) {
|
4209
|
-
const subscription = this.operations.submitAndAwait({ encodedTransaction });
|
4210
|
-
for await (const { submitAndAwait } of subscription) {
|
4211
|
-
if (submitAndAwait.type === "SqueezedOutStatus") {
|
4212
|
-
throw new FuelError13(
|
4213
|
-
ErrorCode13.TRANSACTION_SQUEEZED_OUT,
|
4214
|
-
`Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
|
4215
|
-
);
|
4216
|
-
}
|
4217
|
-
if (submitAndAwait.type !== "SubmittedStatus") {
|
4218
|
-
break;
|
4219
|
-
}
|
4220
|
-
}
|
4221
|
-
const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
|
4222
|
-
const response = new TransactionResponse(transactionId2, this, abis);
|
4223
|
-
await response.fetch();
|
4224
|
-
return response;
|
4225
|
-
}
|
4226
4368
|
const {
|
4227
4369
|
submit: { id: transactionId }
|
4228
4370
|
} = await this.operations.submit({ encodedTransaction });
|
4371
|
+
__privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionId);
|
4229
4372
|
return new TransactionResponse(transactionId, this, abis);
|
4230
4373
|
}
|
4231
4374
|
/**
|
@@ -4295,7 +4438,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4295
4438
|
* @returns A promise that resolves to the estimate transaction dependencies.
|
4296
4439
|
*/
|
4297
4440
|
async estimateTxDependencies(transactionRequest) {
|
4298
|
-
if (transactionRequest
|
4441
|
+
if (isTransactionTypeCreate(transactionRequest)) {
|
4299
4442
|
return {
|
4300
4443
|
receipts: [],
|
4301
4444
|
outputVariables: 0,
|
@@ -4317,7 +4460,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4317
4460
|
dryRunStatus = status;
|
4318
4461
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
4319
4462
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
4320
|
-
if (hasMissingOutputs) {
|
4463
|
+
if (hasMissingOutputs && isTransactionTypeScript(transactionRequest)) {
|
4321
4464
|
outputVariables += missingOutputVariables.length;
|
4322
4465
|
transactionRequest.addVariableOutputs(missingOutputVariables.length);
|
4323
4466
|
missingOutputContractIds.forEach(({ contractId }) => {
|
@@ -4359,7 +4502,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4359
4502
|
const allRequests = clone3(transactionRequests);
|
4360
4503
|
const serializedTransactionsMap = /* @__PURE__ */ new Map();
|
4361
4504
|
allRequests.forEach((req, index) => {
|
4362
|
-
if (req
|
4505
|
+
if (isTransactionTypeScript(req)) {
|
4363
4506
|
serializedTransactionsMap.set(index, hexlify12(req.toTransactionBytes()));
|
4364
4507
|
}
|
4365
4508
|
});
|
@@ -4385,7 +4528,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4385
4528
|
);
|
4386
4529
|
const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
|
4387
4530
|
const request = allRequests[requestIdx];
|
4388
|
-
if (hasMissingOutputs && request
|
4531
|
+
if (hasMissingOutputs && isTransactionTypeScript(request)) {
|
4389
4532
|
result.outputVariables += missingOutputVariables.length;
|
4390
4533
|
request.addVariableOutputs(missingOutputVariables.length);
|
4391
4534
|
missingOutputContractIds.forEach(({ contractId }) => {
|
@@ -4449,7 +4592,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4449
4592
|
tip: transactionRequest.tip
|
4450
4593
|
}).add(1);
|
4451
4594
|
let gasLimit = bn17(0);
|
4452
|
-
if (transactionRequest
|
4595
|
+
if (isTransactionTypeScript(transactionRequest)) {
|
4453
4596
|
gasLimit = transactionRequest.gasLimit;
|
4454
4597
|
if (transactionRequest.gasLimit.eq(0)) {
|
4455
4598
|
transactionRequest.gasLimit = minGas;
|
@@ -4504,6 +4647,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4504
4647
|
return { receipts: callResult[0].receipts };
|
4505
4648
|
}
|
4506
4649
|
/**
|
4650
|
+
* @hidden
|
4651
|
+
*
|
4507
4652
|
* Returns a transaction cost to enable user
|
4508
4653
|
* to set gasLimit and also reserve balance amounts
|
4509
4654
|
* on the transaction.
|
@@ -4513,23 +4658,16 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4513
4658
|
*
|
4514
4659
|
* @returns A promise that resolves to the transaction cost object.
|
4515
4660
|
*/
|
4516
|
-
async getTransactionCost(transactionRequestLike, {
|
4661
|
+
async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
|
4517
4662
|
const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
|
4518
|
-
const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
|
4519
|
-
const baseAssetId = this.getBaseAssetId();
|
4520
4663
|
const updateMaxFee = txRequestClone.maxFee.eq(0);
|
4521
|
-
const
|
4522
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4523
|
-
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4664
|
+
const isScriptTransaction = isTransactionTypeScript(txRequestClone);
|
4524
4665
|
if (isScriptTransaction) {
|
4525
4666
|
txRequestClone.gasLimit = bn17(0);
|
4526
4667
|
}
|
4527
|
-
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4528
|
-
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
4529
|
-
}
|
4530
4668
|
const signedRequest = clone3(txRequestClone);
|
4531
4669
|
let addedSignatures = 0;
|
4532
|
-
if (signatureCallback &&
|
4670
|
+
if (signatureCallback && isTransactionTypeScript(signedRequest)) {
|
4533
4671
|
const lengthBefore = signedRequest.witnesses.length;
|
4534
4672
|
await signatureCallback(signedRequest);
|
4535
4673
|
addedSignatures = signedRequest.witnesses.length - lengthBefore;
|
@@ -4562,7 +4700,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4562
4700
|
}));
|
4563
4701
|
}
|
4564
4702
|
return {
|
4565
|
-
requiredQuantities: allQuantities,
|
4566
4703
|
receipts,
|
4567
4704
|
gasUsed,
|
4568
4705
|
gasPrice,
|
@@ -4578,34 +4715,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4578
4715
|
updateMaxFee
|
4579
4716
|
};
|
4580
4717
|
}
|
4581
|
-
/**
|
4582
|
-
* Get the required quantities and associated resources for a transaction.
|
4583
|
-
*
|
4584
|
-
* @param owner - address to add resources from.
|
4585
|
-
* @param transactionRequestLike - transaction request to populate resources for.
|
4586
|
-
* @param quantitiesToContract - quantities for the contract (optional).
|
4587
|
-
*
|
4588
|
-
* @returns a promise resolving to the required quantities for the transaction.
|
4589
|
-
*/
|
4590
|
-
async getResourcesForTransaction(owner, transactionRequestLike, quantitiesToContract = []) {
|
4591
|
-
const ownerAddress = Address2.fromAddressOrString(owner);
|
4592
|
-
const transactionRequest = transactionRequestify(clone3(transactionRequestLike));
|
4593
|
-
const transactionCost = await this.getTransactionCost(transactionRequest, {
|
4594
|
-
quantitiesToContract
|
4595
|
-
});
|
4596
|
-
transactionRequest.addResources(
|
4597
|
-
await this.getResourcesToSpend(ownerAddress, transactionCost.requiredQuantities)
|
4598
|
-
);
|
4599
|
-
const { requiredQuantities, ...txCost } = await this.getTransactionCost(transactionRequest, {
|
4600
|
-
quantitiesToContract
|
4601
|
-
});
|
4602
|
-
const resources = await this.getResourcesToSpend(ownerAddress, requiredQuantities);
|
4603
|
-
return {
|
4604
|
-
resources,
|
4605
|
-
requiredQuantities,
|
4606
|
-
...txCost
|
4607
|
-
};
|
4608
|
-
}
|
4609
4718
|
/**
|
4610
4719
|
* Returns coins for the given owner.
|
4611
4720
|
*
|
@@ -4654,10 +4763,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4654
4763
|
utxos: excludedIds?.utxos?.map((id) => hexlify12(id)) || []
|
4655
4764
|
};
|
4656
4765
|
if (this.cache) {
|
4657
|
-
const
|
4658
|
-
|
4659
|
-
);
|
4660
|
-
excludeInput.utxos = Array.from(uniqueUtxos);
|
4766
|
+
const cached = this.cache.getActiveData();
|
4767
|
+
excludeInput.messages.push(...cached.messages);
|
4768
|
+
excludeInput.utxos.push(...cached.utxos);
|
4661
4769
|
}
|
4662
4770
|
const coinsQuery = {
|
4663
4771
|
owner: ownerAddress.toB256(),
|
@@ -4923,7 +5031,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4923
5031
|
nonce
|
4924
5032
|
};
|
4925
5033
|
if (commitBlockId && commitBlockHeight) {
|
4926
|
-
throw new
|
5034
|
+
throw new FuelError14(
|
4927
5035
|
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
4928
5036
|
"commitBlockId and commitBlockHeight cannot be used together"
|
4929
5037
|
);
|
@@ -5092,25 +5200,25 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5092
5200
|
const { paginationLimit, inputArgs = {} } = params;
|
5093
5201
|
const { first, last, after, before } = inputArgs;
|
5094
5202
|
if (after && before) {
|
5095
|
-
throw new
|
5203
|
+
throw new FuelError14(
|
5096
5204
|
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5097
5205
|
'Pagination arguments "after" and "before" cannot be used together'
|
5098
5206
|
);
|
5099
5207
|
}
|
5100
5208
|
if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
|
5101
|
-
throw new
|
5209
|
+
throw new FuelError14(
|
5102
5210
|
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5103
5211
|
`Pagination limit for this query cannot exceed ${paginationLimit} items`
|
5104
5212
|
);
|
5105
5213
|
}
|
5106
5214
|
if (first && before) {
|
5107
|
-
throw new
|
5215
|
+
throw new FuelError14(
|
5108
5216
|
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5109
5217
|
'The use of pagination argument "first" with "before" is not supported'
|
5110
5218
|
);
|
5111
5219
|
}
|
5112
5220
|
if (last && after) {
|
5113
|
-
throw new
|
5221
|
+
throw new FuelError14(
|
5114
5222
|
ErrorCode13.INVALID_INPUT_PARAMETERS,
|
5115
5223
|
'The use of pagination argument "last" with "after" is not supported'
|
5116
5224
|
);
|
@@ -5142,15 +5250,22 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5142
5250
|
};
|
5143
5251
|
var Provider = _Provider;
|
5144
5252
|
_cacheInputs = new WeakSet();
|
5145
|
-
cacheInputs_fn = function(inputs) {
|
5253
|
+
cacheInputs_fn = function(inputs, transactionId) {
|
5146
5254
|
if (!this.cache) {
|
5147
5255
|
return;
|
5148
5256
|
}
|
5149
|
-
inputs.
|
5150
|
-
|
5151
|
-
|
5152
|
-
|
5153
|
-
|
5257
|
+
const inputsToCache = inputs.reduce(
|
5258
|
+
(acc, input) => {
|
5259
|
+
if (input.type === InputType7.Coin) {
|
5260
|
+
acc.utxos.push(input.id);
|
5261
|
+
} else if (input.type === InputType7.Message) {
|
5262
|
+
acc.messages.push(input.nonce);
|
5263
|
+
}
|
5264
|
+
return acc;
|
5265
|
+
},
|
5266
|
+
{ utxos: [], messages: [] }
|
5267
|
+
);
|
5268
|
+
this.cache.set(transactionId, inputsToCache);
|
5154
5269
|
};
|
5155
5270
|
/** @hidden */
|
5156
5271
|
__publicField(Provider, "chainInfoCache", {});
|
@@ -5158,7 +5273,7 @@ __publicField(Provider, "chainInfoCache", {});
|
|
5158
5273
|
__publicField(Provider, "nodeInfoCache", {});
|
5159
5274
|
|
5160
5275
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
5161
|
-
import { ErrorCode as ErrorCode14, FuelError as
|
5276
|
+
import { ErrorCode as ErrorCode14, FuelError as FuelError15 } from "@fuel-ts/errors";
|
5162
5277
|
import { bn as bn18 } from "@fuel-ts/math";
|
5163
5278
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
5164
5279
|
import { arrayify as arrayify12 } from "@fuel-ts/utils";
|
@@ -5168,7 +5283,7 @@ async function getTransactionSummary(params) {
|
|
5168
5283
|
transactionId: id
|
5169
5284
|
});
|
5170
5285
|
if (!gqlTransaction) {
|
5171
|
-
throw new
|
5286
|
+
throw new FuelError15(
|
5172
5287
|
ErrorCode14.TRANSACTION_NOT_FOUND,
|
5173
5288
|
`Transaction not found for given id: ${id}.`
|
5174
5289
|
);
|
@@ -5409,6 +5524,20 @@ var rawAssets = [
|
|
5409
5524
|
];
|
5410
5525
|
var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
|
5411
5526
|
|
5527
|
+
// src/providers/utils/merge-quantities.ts
|
5528
|
+
var mergeQuantities = (...coinQuantities) => {
|
5529
|
+
const resultMap = {};
|
5530
|
+
function addToMap({ amount, assetId }) {
|
5531
|
+
if (resultMap[assetId]) {
|
5532
|
+
resultMap[assetId] = resultMap[assetId].add(amount);
|
5533
|
+
} else {
|
5534
|
+
resultMap[assetId] = amount;
|
5535
|
+
}
|
5536
|
+
}
|
5537
|
+
coinQuantities.forEach((arr) => arr.forEach(addToMap));
|
5538
|
+
return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
|
5539
|
+
};
|
5540
|
+
|
5412
5541
|
// src/utils/formatTransferToContractScriptData.ts
|
5413
5542
|
import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
|
5414
5543
|
import { BN as BN2 } from "@fuel-ts/math";
|
@@ -5446,7 +5575,7 @@ var assembleTransferToContractScript = async (params) => {
|
|
5446
5575
|
};
|
5447
5576
|
|
5448
5577
|
// src/account.ts
|
5449
|
-
var MAX_FUNDING_ATTEMPTS =
|
5578
|
+
var MAX_FUNDING_ATTEMPTS = 5;
|
5450
5579
|
var Account = class extends AbstractAccount {
|
5451
5580
|
/**
|
5452
5581
|
* The address associated with the account.
|
@@ -5482,7 +5611,7 @@ var Account = class extends AbstractAccount {
|
|
5482
5611
|
*/
|
5483
5612
|
get provider() {
|
5484
5613
|
if (!this._provider) {
|
5485
|
-
throw new
|
5614
|
+
throw new FuelError16(ErrorCode15.MISSING_PROVIDER, "Provider not set");
|
5486
5615
|
}
|
5487
5616
|
return this._provider;
|
5488
5617
|
}
|
@@ -5559,7 +5688,7 @@ var Account = class extends AbstractAccount {
|
|
5559
5688
|
* @returns A promise that resolves to the funded transaction request.
|
5560
5689
|
*/
|
5561
5690
|
async fund(request, params) {
|
5562
|
-
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
5691
|
+
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee, gasPrice } = params;
|
5563
5692
|
const fee = request.maxFee;
|
5564
5693
|
const baseAssetId = this.provider.getBaseAssetId();
|
5565
5694
|
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn19(0);
|
@@ -5607,10 +5736,12 @@ var Account = class extends AbstractAccount {
|
|
5607
5736
|
);
|
5608
5737
|
}
|
5609
5738
|
if (!updateMaxFee) {
|
5739
|
+
needsToBeFunded = false;
|
5610
5740
|
break;
|
5611
5741
|
}
|
5612
5742
|
const { maxFee: newFee } = await this.provider.estimateTxGasAndFee({
|
5613
|
-
transactionRequest: requestToReestimate2
|
5743
|
+
transactionRequest: requestToReestimate2,
|
5744
|
+
gasPrice
|
5614
5745
|
});
|
5615
5746
|
const totalBaseAssetOnInputs = getAssetAmountInRequestInputs(
|
5616
5747
|
request.inputs,
|
@@ -5630,6 +5761,12 @@ var Account = class extends AbstractAccount {
|
|
5630
5761
|
}
|
5631
5762
|
fundingAttempts += 1;
|
5632
5763
|
}
|
5764
|
+
if (needsToBeFunded) {
|
5765
|
+
throw new FuelError16(
|
5766
|
+
ErrorCode15.NOT_ENOUGH_FUNDS,
|
5767
|
+
`The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
|
5768
|
+
);
|
5769
|
+
}
|
5633
5770
|
request.updatePredicateGasUsed(estimatedPredicates);
|
5634
5771
|
const requestToReestimate = clone4(request);
|
5635
5772
|
if (addedSignatures) {
|
@@ -5731,7 +5868,7 @@ var Account = class extends AbstractAccount {
|
|
5731
5868
|
*/
|
5732
5869
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
5733
5870
|
if (bn19(amount).lte(0)) {
|
5734
|
-
throw new
|
5871
|
+
throw new FuelError16(
|
5735
5872
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5736
5873
|
"Transfer amount must be a positive number."
|
5737
5874
|
);
|
@@ -5749,9 +5886,8 @@ var Account = class extends AbstractAccount {
|
|
5749
5886
|
scriptData
|
5750
5887
|
});
|
5751
5888
|
request.addContractInputAndOutput(contractAddress);
|
5752
|
-
const txCost = await this.
|
5753
|
-
|
5754
|
-
quantitiesToContract: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
|
5889
|
+
const txCost = await this.getTransactionCost(request, {
|
5890
|
+
quantities: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
|
5755
5891
|
});
|
5756
5892
|
request = this.validateGasLimitAndMaxFee({
|
5757
5893
|
transactionRequest: request,
|
@@ -5786,8 +5922,8 @@ var Account = class extends AbstractAccount {
|
|
5786
5922
|
const params = { script, ...txParams };
|
5787
5923
|
const baseAssetId = this.provider.getBaseAssetId();
|
5788
5924
|
let request = new ScriptTransactionRequest(params);
|
5789
|
-
const
|
5790
|
-
const txCost = await this.
|
5925
|
+
const quantities = [{ amount: bn19(amount), assetId: baseAssetId }];
|
5926
|
+
const txCost = await this.getTransactionCost(request, { quantities });
|
5791
5927
|
request = this.validateGasLimitAndMaxFee({
|
5792
5928
|
transactionRequest: request,
|
5793
5929
|
gasUsed: txCost.gasUsed,
|
@@ -5797,6 +5933,34 @@ var Account = class extends AbstractAccount {
|
|
5797
5933
|
await this.fund(request, txCost);
|
5798
5934
|
return this.sendTransaction(request);
|
5799
5935
|
}
|
5936
|
+
/**
|
5937
|
+
* Returns a transaction cost to enable user
|
5938
|
+
* to set gasLimit and also reserve balance amounts
|
5939
|
+
* on the transaction.
|
5940
|
+
*
|
5941
|
+
* @param transactionRequestLike - The transaction request object.
|
5942
|
+
* @param transactionCostParams - The transaction cost parameters (optional).
|
5943
|
+
*
|
5944
|
+
* @returns A promise that resolves to the transaction cost object.
|
5945
|
+
*/
|
5946
|
+
async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
|
5947
|
+
const txRequestClone = clone4(transactionRequestify(transactionRequestLike));
|
5948
|
+
const baseAssetId = this.provider.getBaseAssetId();
|
5949
|
+
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
5950
|
+
const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
|
5951
|
+
const transactionFeeForDryRun = [{ assetId: baseAssetId, amount: bn19("100000000000000000") }];
|
5952
|
+
const resources = this.generateFakeResources(
|
5953
|
+
mergeQuantities(requiredQuantities, transactionFeeForDryRun)
|
5954
|
+
);
|
5955
|
+
txRequestClone.addResources(resources);
|
5956
|
+
const txCost = await this.provider.getTransactionCost(txRequestClone, {
|
5957
|
+
signatureCallback
|
5958
|
+
});
|
5959
|
+
return {
|
5960
|
+
...txCost,
|
5961
|
+
requiredQuantities
|
5962
|
+
};
|
5963
|
+
}
|
5800
5964
|
/**
|
5801
5965
|
* Sign a message from the account via the connector.
|
5802
5966
|
*
|
@@ -5807,7 +5971,7 @@ var Account = class extends AbstractAccount {
|
|
5807
5971
|
*/
|
5808
5972
|
async signMessage(message) {
|
5809
5973
|
if (!this._connector) {
|
5810
|
-
throw new
|
5974
|
+
throw new FuelError16(ErrorCode15.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
5811
5975
|
}
|
5812
5976
|
return this._connector.signMessage(this.address.toString(), message);
|
5813
5977
|
}
|
@@ -5819,7 +5983,7 @@ var Account = class extends AbstractAccount {
|
|
5819
5983
|
*/
|
5820
5984
|
async signTransaction(transactionRequestLike) {
|
5821
5985
|
if (!this._connector) {
|
5822
|
-
throw new
|
5986
|
+
throw new FuelError16(
|
5823
5987
|
ErrorCode15.MISSING_CONNECTOR,
|
5824
5988
|
"A connector is required to sign transactions."
|
5825
5989
|
);
|
@@ -5833,7 +5997,7 @@ var Account = class extends AbstractAccount {
|
|
5833
5997
|
* @param sendTransactionParams - The provider send transaction parameters (optional).
|
5834
5998
|
* @returns A promise that resolves to the transaction response.
|
5835
5999
|
*/
|
5836
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true
|
6000
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
5837
6001
|
if (this._connector) {
|
5838
6002
|
return this.provider.getTransactionResponse(
|
5839
6003
|
await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
|
@@ -5844,7 +6008,6 @@ var Account = class extends AbstractAccount {
|
|
5844
6008
|
await this.provider.estimateTxDependencies(transactionRequest);
|
5845
6009
|
}
|
5846
6010
|
return this.provider.sendTransaction(transactionRequest, {
|
5847
|
-
awaitExecution,
|
5848
6011
|
estimateTxDependencies: false
|
5849
6012
|
});
|
5850
6013
|
}
|
@@ -5880,7 +6043,7 @@ var Account = class extends AbstractAccount {
|
|
5880
6043
|
/** @hidden * */
|
5881
6044
|
validateTransferAmount(amount) {
|
5882
6045
|
if (bn19(amount).lte(0)) {
|
5883
|
-
throw new
|
6046
|
+
throw new FuelError16(
|
5884
6047
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5885
6048
|
"Transfer amount must be a positive number."
|
5886
6049
|
);
|
@@ -5889,9 +6052,7 @@ var Account = class extends AbstractAccount {
|
|
5889
6052
|
/** @hidden * */
|
5890
6053
|
async estimateAndFundTransaction(transactionRequest, txParams) {
|
5891
6054
|
let request = transactionRequest;
|
5892
|
-
const txCost = await this.
|
5893
|
-
resourcesOwner: this
|
5894
|
-
});
|
6055
|
+
const txCost = await this.getTransactionCost(request);
|
5895
6056
|
request = this.validateGasLimitAndMaxFee({
|
5896
6057
|
transactionRequest: request,
|
5897
6058
|
gasUsed: txCost.gasUsed,
|
@@ -5909,18 +6070,18 @@ var Account = class extends AbstractAccount {
|
|
5909
6070
|
txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
|
5910
6071
|
}) {
|
5911
6072
|
const request = transactionRequestify(transactionRequest);
|
5912
|
-
if (!
|
6073
|
+
if (!isDefined3(setGasLimit)) {
|
5913
6074
|
request.gasLimit = gasUsed;
|
5914
6075
|
} else if (gasUsed.gt(setGasLimit)) {
|
5915
|
-
throw new
|
6076
|
+
throw new FuelError16(
|
5916
6077
|
ErrorCode15.GAS_LIMIT_TOO_LOW,
|
5917
6078
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
5918
6079
|
);
|
5919
6080
|
}
|
5920
|
-
if (!
|
6081
|
+
if (!isDefined3(setMaxFee)) {
|
5921
6082
|
request.maxFee = maxFee;
|
5922
6083
|
} else if (maxFee.gt(setMaxFee)) {
|
5923
|
-
throw new
|
6084
|
+
throw new FuelError16(
|
5924
6085
|
ErrorCode15.MAX_FEE_TOO_LOW,
|
5925
6086
|
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|
5926
6087
|
);
|
@@ -6051,11 +6212,11 @@ import {
|
|
6051
6212
|
scrypt,
|
6052
6213
|
stringFromBuffer,
|
6053
6214
|
decryptJsonWalletData,
|
6054
|
-
encryptJsonWalletData
|
6215
|
+
encryptJsonWalletData,
|
6216
|
+
randomUUID
|
6055
6217
|
} from "@fuel-ts/crypto";
|
6056
|
-
import { ErrorCode as ErrorCode16, FuelError as
|
6218
|
+
import { ErrorCode as ErrorCode16, FuelError as FuelError17 } from "@fuel-ts/errors";
|
6057
6219
|
import { hexlify as hexlify15 } from "@fuel-ts/utils";
|
6058
|
-
import { v4 as uuidv4 } from "uuid";
|
6059
6220
|
var DEFAULT_KDF_PARAMS_LOG_N = 13;
|
6060
6221
|
var DEFAULT_KDF_PARAMS_R = 8;
|
6061
6222
|
var DEFAULT_KDF_PARAMS_P = 1;
|
@@ -6085,7 +6246,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
|
|
6085
6246
|
const macHashUint8Array = keccak256(data);
|
6086
6247
|
const mac = stringFromBuffer(macHashUint8Array, "hex");
|
6087
6248
|
const keystore = {
|
6088
|
-
id:
|
6249
|
+
id: randomUUID(),
|
6089
6250
|
version: 3,
|
6090
6251
|
address: removeHexPrefix(ownerAddress.toHexString()),
|
6091
6252
|
crypto: {
|
@@ -6131,7 +6292,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
6131
6292
|
const macHashUint8Array = keccak256(data);
|
6132
6293
|
const macHash = stringFromBuffer(macHashUint8Array, "hex");
|
6133
6294
|
if (mac !== macHash) {
|
6134
|
-
throw new
|
6295
|
+
throw new FuelError17(
|
6135
6296
|
ErrorCode16.INVALID_PASSWORD,
|
6136
6297
|
"Failed to decrypt the keystore wallet, the provided password is incorrect."
|
6137
6298
|
);
|
@@ -6214,17 +6375,16 @@ var BaseWalletUnlocked = class extends Account {
|
|
6214
6375
|
*
|
6215
6376
|
* @param transactionRequestLike - The transaction request to send.
|
6216
6377
|
* @param estimateTxDependencies - Whether to estimate the transaction dependencies.
|
6217
|
-
* @param awaitExecution - Whether to wait for the transaction to be executed.
|
6218
6378
|
* @returns A promise that resolves to the TransactionResponse object.
|
6219
6379
|
*/
|
6220
|
-
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false
|
6380
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = false } = {}) {
|
6221
6381
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
6222
6382
|
if (estimateTxDependencies) {
|
6223
6383
|
await this.provider.estimateTxDependencies(transactionRequest);
|
6224
6384
|
}
|
6225
6385
|
return this.provider.sendTransaction(
|
6226
6386
|
await this.populateTransactionWitnessesSignature(transactionRequest),
|
6227
|
-
{
|
6387
|
+
{ estimateTxDependencies: false }
|
6228
6388
|
);
|
6229
6389
|
}
|
6230
6390
|
/**
|
@@ -6263,14 +6423,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
6263
6423
|
|
6264
6424
|
// src/hdwallet/hdwallet.ts
|
6265
6425
|
import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
|
6266
|
-
import { ErrorCode as ErrorCode19, FuelError as
|
6426
|
+
import { ErrorCode as ErrorCode19, FuelError as FuelError20 } from "@fuel-ts/errors";
|
6267
6427
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
6268
6428
|
import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
6269
6429
|
import { arrayify as arrayify18, hexlify as hexlify18, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
|
6270
6430
|
|
6271
6431
|
// src/mnemonic/mnemonic.ts
|
6272
6432
|
import { randomBytes as randomBytes5, pbkdf2, computeHmac } from "@fuel-ts/crypto";
|
6273
|
-
import { ErrorCode as ErrorCode18, FuelError as
|
6433
|
+
import { ErrorCode as ErrorCode18, FuelError as FuelError19 } from "@fuel-ts/errors";
|
6274
6434
|
import { sha256 as sha2563 } from "@fuel-ts/hasher";
|
6275
6435
|
import { arrayify as arrayify17, hexlify as hexlify17, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
|
6276
6436
|
|
@@ -8333,7 +8493,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
8333
8493
|
})(Language || {});
|
8334
8494
|
|
8335
8495
|
// src/mnemonic/utils.ts
|
8336
|
-
import { ErrorCode as ErrorCode17, FuelError as
|
8496
|
+
import { ErrorCode as ErrorCode17, FuelError as FuelError18 } from "@fuel-ts/errors";
|
8337
8497
|
import { sha256 as sha2562 } from "@fuel-ts/hasher";
|
8338
8498
|
import { arrayify as arrayify16 } from "@fuel-ts/utils";
|
8339
8499
|
function getLowerMask(bits) {
|
@@ -8382,7 +8542,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
8382
8542
|
for (let i = 0; i < words.length; i += 1) {
|
8383
8543
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
8384
8544
|
if (index === -1) {
|
8385
|
-
throw new
|
8545
|
+
throw new FuelError18(
|
8386
8546
|
ErrorCode17.INVALID_MNEMONIC,
|
8387
8547
|
`Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
|
8388
8548
|
);
|
@@ -8399,7 +8559,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
8399
8559
|
const checksumMask = getUpperMask(checksumBits);
|
8400
8560
|
const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
8401
8561
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
8402
|
-
throw new
|
8562
|
+
throw new FuelError18(
|
8403
8563
|
ErrorCode17.INVALID_CHECKSUM,
|
8404
8564
|
"Checksum validation failed for the provided mnemonic."
|
8405
8565
|
);
|
@@ -8414,7 +8574,7 @@ var TestnetPRV = "0x04358394";
|
|
8414
8574
|
var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
|
8415
8575
|
function assertWordList(wordlist) {
|
8416
8576
|
if (wordlist.length !== 2048) {
|
8417
|
-
throw new
|
8577
|
+
throw new FuelError19(
|
8418
8578
|
ErrorCode18.INVALID_WORD_LIST,
|
8419
8579
|
`Expected word list length of 2048, but got ${wordlist.length}.`
|
8420
8580
|
);
|
@@ -8422,7 +8582,7 @@ function assertWordList(wordlist) {
|
|
8422
8582
|
}
|
8423
8583
|
function assertEntropy(entropy) {
|
8424
8584
|
if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
|
8425
|
-
throw new
|
8585
|
+
throw new FuelError19(
|
8426
8586
|
ErrorCode18.INVALID_ENTROPY,
|
8427
8587
|
`Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
|
8428
8588
|
);
|
@@ -8433,7 +8593,7 @@ function assertMnemonic(words) {
|
|
8433
8593
|
const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
|
8434
8594
|
", "
|
8435
8595
|
)}] words, but got ${words.length}.`;
|
8436
|
-
throw new
|
8596
|
+
throw new FuelError19(ErrorCode18.INVALID_MNEMONIC, errorMsg);
|
8437
8597
|
}
|
8438
8598
|
}
|
8439
8599
|
var Mnemonic = class {
|
@@ -8551,7 +8711,7 @@ var Mnemonic = class {
|
|
8551
8711
|
static masterKeysFromSeed(seed) {
|
8552
8712
|
const seedArray = arrayify17(seed);
|
8553
8713
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
8554
|
-
throw new
|
8714
|
+
throw new FuelError19(
|
8555
8715
|
ErrorCode18.INVALID_SEED,
|
8556
8716
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
8557
8717
|
);
|
@@ -8629,7 +8789,7 @@ function isValidExtendedKey(extendedKey) {
|
|
8629
8789
|
function parsePath(path, depth = 0) {
|
8630
8790
|
const components = path.split("/");
|
8631
8791
|
if (components.length === 0 || components[0] === "m" && depth !== 0) {
|
8632
|
-
throw new
|
8792
|
+
throw new FuelError20(ErrorCode19.HD_WALLET_ERROR, `invalid path - ${path}`);
|
8633
8793
|
}
|
8634
8794
|
if (components[0] === "m") {
|
8635
8795
|
components.shift();
|
@@ -8658,7 +8818,7 @@ var HDWallet = class {
|
|
8658
8818
|
this.privateKey = hexlify18(config.privateKey);
|
8659
8819
|
} else {
|
8660
8820
|
if (!config.publicKey) {
|
8661
|
-
throw new
|
8821
|
+
throw new FuelError20(
|
8662
8822
|
ErrorCode19.HD_WALLET_ERROR,
|
8663
8823
|
"Both public and private Key cannot be missing. At least one should be provided."
|
8664
8824
|
);
|
@@ -8688,7 +8848,7 @@ var HDWallet = class {
|
|
8688
8848
|
const data = new Uint8Array(37);
|
8689
8849
|
if (index & HARDENED_INDEX) {
|
8690
8850
|
if (!privateKey) {
|
8691
|
-
throw new
|
8851
|
+
throw new FuelError20(
|
8692
8852
|
ErrorCode19.HD_WALLET_ERROR,
|
8693
8853
|
"Cannot derive a hardened index without a private Key."
|
8694
8854
|
);
|
@@ -8741,7 +8901,7 @@ var HDWallet = class {
|
|
8741
8901
|
*/
|
8742
8902
|
toExtendedKey(isPublic = false, testnet = false) {
|
8743
8903
|
if (this.depth >= 256) {
|
8744
|
-
throw new
|
8904
|
+
throw new FuelError20(
|
8745
8905
|
ErrorCode19.HD_WALLET_ERROR,
|
8746
8906
|
`Exceeded max depth of 255. Current depth: ${this.depth}.`
|
8747
8907
|
);
|
@@ -8773,10 +8933,10 @@ var HDWallet = class {
|
|
8773
8933
|
const bytes = arrayify18(decoded);
|
8774
8934
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
8775
8935
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
8776
|
-
throw new
|
8936
|
+
throw new FuelError20(ErrorCode19.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
8777
8937
|
}
|
8778
8938
|
if (!validChecksum) {
|
8779
|
-
throw new
|
8939
|
+
throw new FuelError20(ErrorCode19.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
8780
8940
|
}
|
8781
8941
|
const depth = bytes[4];
|
8782
8942
|
const parentFingerprint = hexlify18(bytes.slice(5, 9));
|
@@ -8784,14 +8944,14 @@ var HDWallet = class {
|
|
8784
8944
|
const chainCode = hexlify18(bytes.slice(13, 45));
|
8785
8945
|
const key = bytes.slice(45, 78);
|
8786
8946
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
8787
|
-
throw new
|
8947
|
+
throw new FuelError20(
|
8788
8948
|
ErrorCode19.HD_WALLET_ERROR,
|
8789
8949
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
8790
8950
|
);
|
8791
8951
|
}
|
8792
8952
|
if (isPublicExtendedKey(bytes)) {
|
8793
8953
|
if (key[0] !== 3) {
|
8794
|
-
throw new
|
8954
|
+
throw new FuelError20(ErrorCode19.HD_WALLET_ERROR, "Invalid public extended key.");
|
8795
8955
|
}
|
8796
8956
|
return new HDWallet({
|
8797
8957
|
publicKey: key,
|
@@ -8802,7 +8962,7 @@ var HDWallet = class {
|
|
8802
8962
|
});
|
8803
8963
|
}
|
8804
8964
|
if (key[0] !== 0) {
|
8805
|
-
throw new
|
8965
|
+
throw new FuelError20(ErrorCode19.HD_WALLET_ERROR, "Invalid private extended key.");
|
8806
8966
|
}
|
8807
8967
|
return new HDWallet({
|
8808
8968
|
privateKey: key.slice(1),
|
@@ -8970,7 +9130,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
|
8970
9130
|
// src/wallet-manager/wallet-manager.ts
|
8971
9131
|
import { Address as Address8 } from "@fuel-ts/address";
|
8972
9132
|
import { encrypt, decrypt } from "@fuel-ts/crypto";
|
8973
|
-
import { ErrorCode as ErrorCode22, FuelError as
|
9133
|
+
import { ErrorCode as ErrorCode22, FuelError as FuelError23 } from "@fuel-ts/errors";
|
8974
9134
|
import { EventEmitter } from "events";
|
8975
9135
|
|
8976
9136
|
// src/wallet-manager/storages/memory-storage.ts
|
@@ -8993,7 +9153,7 @@ var MemoryStorage = class {
|
|
8993
9153
|
|
8994
9154
|
// src/wallet-manager/vaults/mnemonic-vault.ts
|
8995
9155
|
import { Address as Address6 } from "@fuel-ts/address";
|
8996
|
-
import { ErrorCode as ErrorCode20, FuelError as
|
9156
|
+
import { ErrorCode as ErrorCode20, FuelError as FuelError21 } from "@fuel-ts/errors";
|
8997
9157
|
var _secret;
|
8998
9158
|
var MnemonicVault = class {
|
8999
9159
|
constructor(options) {
|
@@ -9049,7 +9209,7 @@ var MnemonicVault = class {
|
|
9049
9209
|
}
|
9050
9210
|
numberOfAccounts += 1;
|
9051
9211
|
} while (numberOfAccounts < this.numberOfAccounts);
|
9052
|
-
throw new
|
9212
|
+
throw new FuelError21(
|
9053
9213
|
ErrorCode20.WALLET_MANAGER_ERROR,
|
9054
9214
|
`Account with address '${address}' not found in derived wallets.`
|
9055
9215
|
);
|
@@ -9064,7 +9224,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
|
|
9064
9224
|
|
9065
9225
|
// src/wallet-manager/vaults/privatekey-vault.ts
|
9066
9226
|
import { Address as Address7 } from "@fuel-ts/address";
|
9067
|
-
import { ErrorCode as ErrorCode21, FuelError as
|
9227
|
+
import { ErrorCode as ErrorCode21, FuelError as FuelError22 } from "@fuel-ts/errors";
|
9068
9228
|
var _privateKeys;
|
9069
9229
|
var PrivateKeyVault = class {
|
9070
9230
|
/**
|
@@ -9105,7 +9265,7 @@ var PrivateKeyVault = class {
|
|
9105
9265
|
(pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
|
9106
9266
|
);
|
9107
9267
|
if (!privateKey) {
|
9108
|
-
throw new
|
9268
|
+
throw new FuelError22(
|
9109
9269
|
ErrorCode21.WALLET_MANAGER_ERROR,
|
9110
9270
|
`No private key found for address '${address}'.`
|
9111
9271
|
);
|
@@ -9130,7 +9290,7 @@ var ERROR_MESSAGES = {
|
|
9130
9290
|
};
|
9131
9291
|
function assert(condition, message) {
|
9132
9292
|
if (!condition) {
|
9133
|
-
throw new
|
9293
|
+
throw new FuelError23(ErrorCode22.WALLET_MANAGER_ERROR, message);
|
9134
9294
|
}
|
9135
9295
|
}
|
9136
9296
|
var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
|
@@ -9356,25 +9516,25 @@ deserializeVaults_fn = function(vaults) {
|
|
9356
9516
|
__publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
|
9357
9517
|
|
9358
9518
|
// src/wallet-manager/types.ts
|
9359
|
-
import { ErrorCode as ErrorCode23, FuelError as
|
9519
|
+
import { ErrorCode as ErrorCode23, FuelError as FuelError24 } from "@fuel-ts/errors";
|
9360
9520
|
var Vault = class {
|
9361
9521
|
constructor(_options) {
|
9362
|
-
throw new
|
9522
|
+
throw new FuelError24(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
|
9363
9523
|
}
|
9364
9524
|
serialize() {
|
9365
|
-
throw new
|
9525
|
+
throw new FuelError24(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
|
9366
9526
|
}
|
9367
9527
|
getAccounts() {
|
9368
|
-
throw new
|
9528
|
+
throw new FuelError24(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
|
9369
9529
|
}
|
9370
9530
|
addAccount() {
|
9371
|
-
throw new
|
9531
|
+
throw new FuelError24(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
|
9372
9532
|
}
|
9373
9533
|
exportAccount(_address) {
|
9374
|
-
throw new
|
9534
|
+
throw new FuelError24(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
|
9375
9535
|
}
|
9376
9536
|
getWallet(_address) {
|
9377
|
-
throw new
|
9537
|
+
throw new FuelError24(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
|
9378
9538
|
}
|
9379
9539
|
};
|
9380
9540
|
__publicField(Vault, "type");
|
@@ -9384,7 +9544,7 @@ var StorageAbstract = class {
|
|
9384
9544
|
// src/predicate/predicate.ts
|
9385
9545
|
import { Interface as Interface4 } from "@fuel-ts/abi-coder";
|
9386
9546
|
import { Address as Address9 } from "@fuel-ts/address";
|
9387
|
-
import { ErrorCode as ErrorCode24, FuelError as
|
9547
|
+
import { ErrorCode as ErrorCode24, FuelError as FuelError25 } from "@fuel-ts/errors";
|
9388
9548
|
import { arrayify as arrayify20, hexlify as hexlify20 } from "@fuel-ts/utils";
|
9389
9549
|
|
9390
9550
|
// src/predicate/utils/getPredicateRoot.ts
|
@@ -9411,14 +9571,14 @@ var Predicate = class extends Account {
|
|
9411
9571
|
* @param bytecode - The bytecode of the predicate.
|
9412
9572
|
* @param abi - The JSON ABI of the predicate.
|
9413
9573
|
* @param provider - The provider used to interact with the blockchain.
|
9414
|
-
* @param
|
9574
|
+
* @param data - The predicate input data (optional).
|
9415
9575
|
* @param configurableConstants - Optional configurable constants for the predicate.
|
9416
9576
|
*/
|
9417
9577
|
constructor({
|
9418
9578
|
bytecode,
|
9419
9579
|
abi,
|
9420
9580
|
provider,
|
9421
|
-
|
9581
|
+
data,
|
9422
9582
|
configurableConstants
|
9423
9583
|
}) {
|
9424
9584
|
const { predicateBytes, predicateInterface } = Predicate.processPredicateData(
|
@@ -9430,8 +9590,8 @@ var Predicate = class extends Account {
|
|
9430
9590
|
super(address, provider);
|
9431
9591
|
this.bytes = predicateBytes;
|
9432
9592
|
this.interface = predicateInterface;
|
9433
|
-
if (
|
9434
|
-
this.predicateData =
|
9593
|
+
if (data !== void 0 && data.length > 0) {
|
9594
|
+
this.predicateData = data;
|
9435
9595
|
}
|
9436
9596
|
}
|
9437
9597
|
/**
|
@@ -9496,7 +9656,7 @@ var Predicate = class extends Account {
|
|
9496
9656
|
if (jsonAbi) {
|
9497
9657
|
abiInterface = new Interface4(jsonAbi);
|
9498
9658
|
if (abiInterface.functions.main === void 0) {
|
9499
|
-
throw new
|
9659
|
+
throw new FuelError25(
|
9500
9660
|
ErrorCode24.ABI_MAIN_METHOD_MISSING,
|
9501
9661
|
'Cannot use ABI without "main" function.'
|
9502
9662
|
);
|
@@ -9558,23 +9718,30 @@ var Predicate = class extends Account {
|
|
9558
9718
|
const mutatedBytes = bytes;
|
9559
9719
|
try {
|
9560
9720
|
if (!abiInterface) {
|
9561
|
-
throw new
|
9721
|
+
throw new FuelError25(
|
9722
|
+
ErrorCode24.INVALID_CONFIGURABLE_CONSTANTS,
|
9562
9723
|
"Cannot validate configurable constants because the Predicate was instantiated without a JSON ABI"
|
9563
9724
|
);
|
9564
9725
|
}
|
9565
9726
|
if (Object.keys(abiInterface.configurables).length === 0) {
|
9566
|
-
throw new
|
9727
|
+
throw new FuelError25(
|
9728
|
+
ErrorCode24.INVALID_CONFIGURABLE_CONSTANTS,
|
9729
|
+
"Predicate has no configurable constants to be set"
|
9730
|
+
);
|
9567
9731
|
}
|
9568
9732
|
Object.entries(configurableConstants).forEach(([key, value]) => {
|
9569
9733
|
if (!abiInterface?.configurables[key]) {
|
9570
|
-
throw new
|
9734
|
+
throw new FuelError25(
|
9735
|
+
ErrorCode24.CONFIGURABLE_NOT_FOUND,
|
9736
|
+
`No configurable constant named '${key}' found in the Predicate`
|
9737
|
+
);
|
9571
9738
|
}
|
9572
9739
|
const { offset } = abiInterface.configurables[key];
|
9573
9740
|
const encoded = abiInterface.encodeConfigurable(key, value);
|
9574
9741
|
mutatedBytes.set(encoded, offset);
|
9575
9742
|
});
|
9576
9743
|
} catch (err) {
|
9577
|
-
throw new
|
9744
|
+
throw new FuelError25(
|
9578
9745
|
ErrorCode24.INVALID_CONFIGURABLE_CONSTANTS,
|
9579
9746
|
`Error setting configurable constants: ${err.message}.`
|
9580
9747
|
);
|
@@ -9606,9 +9773,10 @@ var Predicate = class extends Account {
|
|
9606
9773
|
};
|
9607
9774
|
|
9608
9775
|
// src/connectors/fuel.ts
|
9609
|
-
import { ErrorCode as ErrorCode25, FuelError as
|
9776
|
+
import { ErrorCode as ErrorCode25, FuelError as FuelError28 } from "@fuel-ts/errors";
|
9610
9777
|
|
9611
9778
|
// src/connectors/fuel-connector.ts
|
9779
|
+
import { FuelError as FuelError26 } from "@fuel-ts/errors";
|
9612
9780
|
import { EventEmitter as EventEmitter2 } from "events";
|
9613
9781
|
|
9614
9782
|
// src/connectors/types/connector-types.ts
|
@@ -9682,7 +9850,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9682
9850
|
* @returns Always true.
|
9683
9851
|
*/
|
9684
9852
|
async ping() {
|
9685
|
-
throw new
|
9853
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9686
9854
|
}
|
9687
9855
|
/**
|
9688
9856
|
* Should return the current version of the connector
|
@@ -9691,7 +9859,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9691
9859
|
* @returns boolean - connection status.
|
9692
9860
|
*/
|
9693
9861
|
async version() {
|
9694
|
-
throw new
|
9862
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9695
9863
|
}
|
9696
9864
|
/**
|
9697
9865
|
* Should return true if the connector is connected
|
@@ -9700,7 +9868,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9700
9868
|
* @returns The connection status.
|
9701
9869
|
*/
|
9702
9870
|
async isConnected() {
|
9703
|
-
throw new
|
9871
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9704
9872
|
}
|
9705
9873
|
/**
|
9706
9874
|
* Should return all the accounts authorized for the
|
@@ -9709,7 +9877,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9709
9877
|
* @returns The accounts addresses strings
|
9710
9878
|
*/
|
9711
9879
|
async accounts() {
|
9712
|
-
throw new
|
9880
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9713
9881
|
}
|
9714
9882
|
/**
|
9715
9883
|
* Should start the connection process and return
|
@@ -9721,7 +9889,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9721
9889
|
* @returns boolean - connection status.
|
9722
9890
|
*/
|
9723
9891
|
async connect() {
|
9724
|
-
throw new
|
9892
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9725
9893
|
}
|
9726
9894
|
/**
|
9727
9895
|
* Should disconnect the current connection and
|
@@ -9731,7 +9899,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9731
9899
|
* @returns The connection status.
|
9732
9900
|
*/
|
9733
9901
|
async disconnect() {
|
9734
|
-
throw new
|
9902
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9735
9903
|
}
|
9736
9904
|
/**
|
9737
9905
|
* Should start the sign message process and return
|
@@ -9743,7 +9911,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9743
9911
|
* @returns Message signature
|
9744
9912
|
*/
|
9745
9913
|
async signMessage(_address, _message) {
|
9746
|
-
throw new
|
9914
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9747
9915
|
}
|
9748
9916
|
/**
|
9749
9917
|
* Should start the sign transaction process and return
|
@@ -9755,7 +9923,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9755
9923
|
* @returns Transaction signature
|
9756
9924
|
*/
|
9757
9925
|
async signTransaction(_address, _transaction) {
|
9758
|
-
throw new
|
9926
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9759
9927
|
}
|
9760
9928
|
/**
|
9761
9929
|
* Should start the send transaction process and return
|
@@ -9771,7 +9939,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9771
9939
|
* @returns The transaction id
|
9772
9940
|
*/
|
9773
9941
|
async sendTransaction(_address, _transaction) {
|
9774
|
-
throw new
|
9942
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9775
9943
|
}
|
9776
9944
|
/**
|
9777
9945
|
* Should return the current account selected inside the connector, if the account
|
@@ -9782,7 +9950,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9782
9950
|
* @returns The current account selected otherwise null.
|
9783
9951
|
*/
|
9784
9952
|
async currentAccount() {
|
9785
|
-
throw new
|
9953
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9786
9954
|
}
|
9787
9955
|
/**
|
9788
9956
|
* Should add the assets metadata to the connector and return true if the asset
|
@@ -9796,7 +9964,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9796
9964
|
* @returns True if the asset was added successfully
|
9797
9965
|
*/
|
9798
9966
|
async addAssets(_assets) {
|
9799
|
-
throw new
|
9967
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9800
9968
|
}
|
9801
9969
|
/**
|
9802
9970
|
* Should add the asset metadata to the connector and return true if the asset
|
@@ -9810,7 +9978,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9810
9978
|
* @returns True if the asset was added successfully
|
9811
9979
|
*/
|
9812
9980
|
async addAsset(_asset) {
|
9813
|
-
throw new
|
9981
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9814
9982
|
}
|
9815
9983
|
/**
|
9816
9984
|
* Should return all the assets added to the connector. If a connection is already established.
|
@@ -9818,7 +9986,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9818
9986
|
* @returns Array of assets metadata from the connector vinculated to the all accounts from a specific Wallet.
|
9819
9987
|
*/
|
9820
9988
|
async assets() {
|
9821
|
-
throw new
|
9989
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9822
9990
|
}
|
9823
9991
|
/**
|
9824
9992
|
* Should start the add network process and return true if the network was added successfully.
|
@@ -9829,7 +9997,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9829
9997
|
* @returns Return true if the network was added successfully
|
9830
9998
|
*/
|
9831
9999
|
async addNetwork(_networkUrl) {
|
9832
|
-
throw new
|
10000
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9833
10001
|
}
|
9834
10002
|
/**
|
9835
10003
|
* Should start the select network process and return true if the network has change successfully.
|
@@ -9840,7 +10008,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9840
10008
|
* @returns Return true if the network was added successfully
|
9841
10009
|
*/
|
9842
10010
|
async selectNetwork(_network) {
|
9843
|
-
throw new
|
10011
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9844
10012
|
}
|
9845
10013
|
/**
|
9846
10014
|
* Should return all the networks available from the connector. If the connection is already established.
|
@@ -9848,7 +10016,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9848
10016
|
* @returns Return all the networks added to the connector.
|
9849
10017
|
*/
|
9850
10018
|
async networks() {
|
9851
|
-
throw new
|
10019
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9852
10020
|
}
|
9853
10021
|
/**
|
9854
10022
|
* Should return the current network selected inside the connector. Even if the connection is not established.
|
@@ -9856,7 +10024,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9856
10024
|
* @returns Return the current network selected inside the connector.
|
9857
10025
|
*/
|
9858
10026
|
async currentNetwork() {
|
9859
|
-
throw new
|
10027
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9860
10028
|
}
|
9861
10029
|
/**
|
9862
10030
|
* Should add the ABI to the connector and return true if the ABI was added successfully.
|
@@ -9866,7 +10034,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9866
10034
|
* @returns Return true if the ABI was added successfully.
|
9867
10035
|
*/
|
9868
10036
|
async addABI(_contractId, _abi) {
|
9869
|
-
throw new
|
10037
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9870
10038
|
}
|
9871
10039
|
/**
|
9872
10040
|
* Should return the ABI from the connector vinculated to the all accounts from a specific Wallet.
|
@@ -9875,7 +10043,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9875
10043
|
* @returns The ABI if it exists, otherwise return null.
|
9876
10044
|
*/
|
9877
10045
|
async getABI(_id) {
|
9878
|
-
throw new
|
10046
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9879
10047
|
}
|
9880
10048
|
/**
|
9881
10049
|
* Should return true if the abi exists in the connector vinculated to the all accounts from a specific Wallet.
|
@@ -9884,7 +10052,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
9884
10052
|
* @returns Returns true if the abi exists or false if not.
|
9885
10053
|
*/
|
9886
10054
|
async hasABI(_id) {
|
9887
|
-
throw new
|
10055
|
+
throw new FuelError26(FuelError26.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
9888
10056
|
}
|
9889
10057
|
/**
|
9890
10058
|
* Event listener for the connector.
|
@@ -9928,6 +10096,7 @@ function dispatchFuelConnectorEvent(connector) {
|
|
9928
10096
|
}
|
9929
10097
|
|
9930
10098
|
// src/connectors/utils/promises.ts
|
10099
|
+
import { FuelError as FuelError27 } from "@fuel-ts/errors";
|
9931
10100
|
function deferPromise() {
|
9932
10101
|
const defer = {};
|
9933
10102
|
defer.promise = new Promise((resolve, reject) => {
|
@@ -9939,7 +10108,7 @@ function deferPromise() {
|
|
9939
10108
|
async function withTimeout(promise, timeout = 1050) {
|
9940
10109
|
const timeoutPromise = new Promise((resolve, reject) => {
|
9941
10110
|
setTimeout(() => {
|
9942
|
-
reject(new
|
10111
|
+
reject(new FuelError27(FuelError27.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
|
9943
10112
|
}, timeout);
|
9944
10113
|
});
|
9945
10114
|
return Promise.race([timeoutPromise, promise]);
|
@@ -9954,11 +10123,9 @@ var _Fuel = class extends FuelConnector {
|
|
9954
10123
|
_connectors = [];
|
9955
10124
|
_targetObject = null;
|
9956
10125
|
_unsubscribes = [];
|
9957
|
-
_targetUnsubscribe
|
9958
|
-
};
|
10126
|
+
_targetUnsubscribe;
|
9959
10127
|
_pingCache = {};
|
9960
10128
|
_currentConnector;
|
9961
|
-
// private _initializationPromise: Promise<void>;
|
9962
10129
|
constructor(config = _Fuel.defaultConfig) {
|
9963
10130
|
super();
|
9964
10131
|
this.setMaxListeners(1e3);
|
@@ -9966,17 +10133,9 @@ var _Fuel = class extends FuelConnector {
|
|
9966
10133
|
this._targetObject = this.getTargetObject(config.targetObject);
|
9967
10134
|
this._storage = config.storage === void 0 ? this.getStorage() : config.storage;
|
9968
10135
|
this.setupMethods();
|
9969
|
-
(
|
9970
|
-
await this.initialize();
|
9971
|
-
})();
|
9972
|
-
}
|
9973
|
-
async initialize() {
|
9974
|
-
await this.setDefaultConnector();
|
10136
|
+
this.setDefaultConnector();
|
9975
10137
|
this._targetUnsubscribe = this.setupConnectorListener();
|
9976
10138
|
}
|
9977
|
-
// private async ensureInitialized(): Promise<void> {
|
9978
|
-
// await this._initializationPromise;
|
9979
|
-
// }
|
9980
10139
|
/**
|
9981
10140
|
* Return the target object to listen for global events.
|
9982
10141
|
*/
|
@@ -10036,7 +10195,8 @@ var _Fuel = class extends FuelConnector {
|
|
10036
10195
|
const hasConnector = await this.hasConnector();
|
10037
10196
|
await this.pingConnector();
|
10038
10197
|
if (!this._currentConnector || !hasConnector) {
|
10039
|
-
throw new
|
10198
|
+
throw new FuelError28(
|
10199
|
+
ErrorCode25.MISSING_CONNECTOR,
|
10040
10200
|
`No connector selected for calling ${method}. Use hasConnector before executing other methods.`
|
10041
10201
|
);
|
10042
10202
|
}
|
@@ -10100,7 +10260,7 @@ var _Fuel = class extends FuelConnector {
|
|
10100
10260
|
cacheTime: PING_CACHE_TIME
|
10101
10261
|
})();
|
10102
10262
|
} catch {
|
10103
|
-
throw new
|
10263
|
+
throw new FuelError28(ErrorCode25.INVALID_PROVIDER, "Current connector is not available.");
|
10104
10264
|
}
|
10105
10265
|
}
|
10106
10266
|
/**
|
@@ -10249,7 +10409,7 @@ var _Fuel = class extends FuelConnector {
|
|
10249
10409
|
const currentNetwork = await this.currentNetwork();
|
10250
10410
|
provider = await Provider.create(currentNetwork.url);
|
10251
10411
|
} else {
|
10252
|
-
throw new
|
10412
|
+
throw new FuelError28(ErrorCode25.INVALID_PROVIDER, "Provider is not valid.");
|
10253
10413
|
}
|
10254
10414
|
return provider;
|
10255
10415
|
}
|
@@ -10293,10 +10453,12 @@ export {
|
|
10293
10453
|
BLOCKS_PAGE_SIZE_LIMIT,
|
10294
10454
|
BaseTransactionRequest,
|
10295
10455
|
BaseWalletUnlocked,
|
10456
|
+
BlobTransactionRequest,
|
10296
10457
|
CHAIN_IDS,
|
10297
10458
|
ChainName,
|
10298
10459
|
ChangeOutputCollisionError,
|
10299
10460
|
CreateTransactionRequest,
|
10461
|
+
DEFAULT_RESOURCE_CACHE_TTL,
|
10300
10462
|
Fuel,
|
10301
10463
|
FuelConnector,
|
10302
10464
|
FuelConnectorEventType,
|
@@ -10340,6 +10502,7 @@ export {
|
|
10340
10502
|
cacheRequestInputsResources,
|
10341
10503
|
cacheRequestInputsResourcesFromOwner,
|
10342
10504
|
calculateGasFee,
|
10505
|
+
calculateMetadataGasForTxBlob,
|
10343
10506
|
calculateMetadataGasForTxCreate,
|
10344
10507
|
calculateMetadataGasForTxScript,
|
10345
10508
|
calculateTXFeeForSummary,
|
@@ -10405,7 +10568,11 @@ export {
|
|
10405
10568
|
isRequestInputMessage,
|
10406
10569
|
isRequestInputResource,
|
10407
10570
|
isRequestInputResourceFromOwner,
|
10571
|
+
isTransactionTypeBlob,
|
10572
|
+
isTransactionTypeCreate,
|
10573
|
+
isTransactionTypeScript,
|
10408
10574
|
isType,
|
10575
|
+
isTypeBlob,
|
10409
10576
|
isTypeCreate,
|
10410
10577
|
isTypeMint,
|
10411
10578
|
isTypeScript,
|