@fuel-ts/account 0.0.0-pr-2143-20240514195938 → 0.0.0-pr-2328-20240517121917
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/account.d.ts.map +1 -1
- package/dist/configs.d.ts +1 -1
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js +1 -1
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js +5 -5
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs +3 -3
- package/dist/configs.mjs.map +1 -1
- package/dist/index.global.js +627 -1542
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +153 -197
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -193
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/mnemonic/utils.d.ts +0 -1
- package/dist/mnemonic/utils.d.ts.map +1 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +8 -0
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +0 -1
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +0 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +4 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +0 -2
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +0 -1
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/transaction-summary/call.d.ts +1 -1
- package/dist/providers/transaction-summary/call.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts +2 -4
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +2 -4
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +734 -3868
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +147 -184
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +136 -173
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.mjs
CHANGED
@@ -31,7 +31,7 @@ var __privateMethod = (obj, member, method) => {
|
|
31
31
|
import { Address as Address3 } from "@fuel-ts/address";
|
32
32
|
import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
|
33
33
|
import { AbstractAccount } from "@fuel-ts/interfaces";
|
34
|
-
import { bn as
|
34
|
+
import { bn as bn19 } from "@fuel-ts/math";
|
35
35
|
import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
|
36
36
|
import { clone as clone4 } from "ramda";
|
37
37
|
|
@@ -73,7 +73,7 @@ var addAmountToCoinQuantities = (params) => {
|
|
73
73
|
// src/providers/provider.ts
|
74
74
|
import { Address as Address2 } from "@fuel-ts/address";
|
75
75
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
76
|
-
import { BN, bn as
|
76
|
+
import { BN, bn as bn17 } from "@fuel-ts/math";
|
77
77
|
import {
|
78
78
|
InputType as InputType7,
|
79
79
|
TransactionType as TransactionType8,
|
@@ -220,6 +220,7 @@ var TransactionEstimatePredicatesFragmentDoc = gql`
|
|
220
220
|
${InputEstimatePredicatesFragmentDoc}`;
|
221
221
|
var DryRunFailureStatusFragmentDoc = gql`
|
222
222
|
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
223
|
+
type: __typename
|
223
224
|
totalGas
|
224
225
|
totalFee
|
225
226
|
reason
|
@@ -231,6 +232,7 @@ var DryRunFailureStatusFragmentDoc = gql`
|
|
231
232
|
`;
|
232
233
|
var DryRunSuccessStatusFragmentDoc = gql`
|
233
234
|
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
235
|
+
type: __typename
|
234
236
|
totalGas
|
235
237
|
totalFee
|
236
238
|
programState {
|
@@ -1734,17 +1736,16 @@ import {
|
|
1734
1736
|
PANIC_REASONS,
|
1735
1737
|
PANIC_DOC_URL
|
1736
1738
|
} from "@fuel-ts/transactions/configs";
|
1737
|
-
var assemblePanicError = (
|
1738
|
-
let errorMessage = `The transaction reverted with reason: "${
|
1739
|
-
|
1740
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
1739
|
+
var assemblePanicError = (statusReason) => {
|
1740
|
+
let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
|
1741
|
+
if (PANIC_REASONS.includes(statusReason)) {
|
1741
1742
|
errorMessage = `${errorMessage}
|
1742
1743
|
|
1743
1744
|
You can read more about this error at:
|
1744
1745
|
|
1745
|
-
${PANIC_DOC_URL}#variant.${
|
1746
|
+
${PANIC_DOC_URL}#variant.${statusReason}`;
|
1746
1747
|
}
|
1747
|
-
return { errorMessage, reason };
|
1748
|
+
return { errorMessage, reason: statusReason };
|
1748
1749
|
};
|
1749
1750
|
var stringify = (obj) => JSON.stringify(obj, null, 2);
|
1750
1751
|
var assembleRevertError = (receipts, logs) => {
|
@@ -1787,10 +1788,10 @@ var assembleRevertError = (receipts, logs) => {
|
|
1787
1788
|
return { errorMessage, reason };
|
1788
1789
|
};
|
1789
1790
|
var extractTxError = (params) => {
|
1790
|
-
const { receipts,
|
1791
|
+
const { receipts, statusReason, logs } = params;
|
1791
1792
|
const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
|
1792
1793
|
const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
|
1793
|
-
const { errorMessage, reason } =
|
1794
|
+
const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
|
1794
1795
|
const metadata = {
|
1795
1796
|
logs,
|
1796
1797
|
receipts,
|
@@ -2377,15 +2378,6 @@ var BaseTransactionRequest = class {
|
|
2377
2378
|
}
|
2378
2379
|
});
|
2379
2380
|
}
|
2380
|
-
shiftPredicateData() {
|
2381
|
-
this.inputs.forEach((input) => {
|
2382
|
-
if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
|
2383
|
-
input.predicateData = input.padPredicateData(
|
2384
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
2385
|
-
);
|
2386
|
-
}
|
2387
|
-
});
|
2388
|
-
}
|
2389
2381
|
};
|
2390
2382
|
|
2391
2383
|
// src/providers/transaction-request/create-transaction-request.ts
|
@@ -2808,12 +2800,12 @@ var transactionRequestify = (obj) => {
|
|
2808
2800
|
|
2809
2801
|
// src/providers/transaction-response/transaction-response.ts
|
2810
2802
|
import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
|
2811
|
-
import { bn as
|
2803
|
+
import { bn as bn16 } from "@fuel-ts/math";
|
2812
2804
|
import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
|
2813
2805
|
import { arrayify as arrayify10 } from "@fuel-ts/utils";
|
2814
2806
|
|
2815
2807
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2816
|
-
import { bn as
|
2808
|
+
import { bn as bn15 } from "@fuel-ts/math";
|
2817
2809
|
import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
|
2818
2810
|
import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
|
2819
2811
|
|
@@ -2890,43 +2882,32 @@ var calculateTXFeeForSummary = (params) => {
|
|
2890
2882
|
// src/providers/transaction-summary/operations.ts
|
2891
2883
|
import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
|
2892
2884
|
import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
|
2893
|
-
import { bn as
|
2885
|
+
import { bn as bn13 } from "@fuel-ts/math";
|
2894
2886
|
import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
|
2895
2887
|
|
2896
2888
|
// src/providers/transaction-summary/call.ts
|
2897
|
-
import { Interface as Interface2
|
2898
|
-
|
2899
|
-
var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
2889
|
+
import { Interface as Interface2 } from "@fuel-ts/abi-coder";
|
2890
|
+
var getFunctionCall = ({ abi, receipt }) => {
|
2900
2891
|
const abiInterface = new Interface2(abi);
|
2901
2892
|
const callFunctionSelector = receipt.param1.toHex(8);
|
2902
2893
|
const functionFragment = abiInterface.getFunction(callFunctionSelector);
|
2903
2894
|
const inputs = functionFragment.jsonFn.inputs;
|
2904
|
-
|
2905
|
-
if (functionFragment.isInputDataPointer) {
|
2906
|
-
if (rawPayload) {
|
2907
|
-
const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
|
2908
|
-
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
2909
|
-
}
|
2910
|
-
} else {
|
2911
|
-
encodedArgs = receipt.param2.toHex();
|
2912
|
-
}
|
2895
|
+
const encodedArgs = receipt.param2.toHex();
|
2913
2896
|
let argumentsProvided;
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
}, {});
|
2929
|
-
}
|
2897
|
+
const data = functionFragment.decodeArguments(encodedArgs);
|
2898
|
+
if (data) {
|
2899
|
+
argumentsProvided = inputs.reduce((prev, input, index) => {
|
2900
|
+
const value = data[index];
|
2901
|
+
const name = input.name;
|
2902
|
+
if (name) {
|
2903
|
+
return {
|
2904
|
+
...prev,
|
2905
|
+
// reparse to remove bn
|
2906
|
+
[name]: JSON.parse(JSON.stringify(value))
|
2907
|
+
};
|
2908
|
+
}
|
2909
|
+
return prev;
|
2910
|
+
}, {});
|
2930
2911
|
}
|
2931
2912
|
const call = {
|
2932
2913
|
functionSignature: functionFragment.signature,
|
@@ -3112,7 +3093,7 @@ var mergeAssets = (op1, op2) => {
|
|
3112
3093
|
if (!matchingAsset) {
|
3113
3094
|
return asset1;
|
3114
3095
|
}
|
3115
|
-
const mergedAmount =
|
3096
|
+
const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
|
3116
3097
|
return { ...asset1, amount: mergedAmount };
|
3117
3098
|
});
|
3118
3099
|
return mergedAssets.concat(filteredAssets);
|
@@ -3438,7 +3419,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
3438
3419
|
|
3439
3420
|
// src/providers/transaction-summary/status.ts
|
3440
3421
|
import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
|
3441
|
-
import { bn as
|
3422
|
+
import { bn as bn14 } from "@fuel-ts/math";
|
3442
3423
|
var getTransactionStatusName = (gqlStatus) => {
|
3443
3424
|
switch (gqlStatus) {
|
3444
3425
|
case "FailureStatus":
|
@@ -3472,15 +3453,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3472
3453
|
time = gqlTransactionStatus.time;
|
3473
3454
|
blockId = gqlTransactionStatus.block.id;
|
3474
3455
|
isStatusSuccess = true;
|
3475
|
-
totalFee =
|
3476
|
-
totalGas =
|
3456
|
+
totalFee = bn14(gqlTransactionStatus.totalFee);
|
3457
|
+
totalGas = bn14(gqlTransactionStatus.totalGas);
|
3477
3458
|
break;
|
3478
3459
|
case "FailureStatus":
|
3479
3460
|
time = gqlTransactionStatus.time;
|
3480
3461
|
blockId = gqlTransactionStatus.block.id;
|
3481
3462
|
isStatusFailure = true;
|
3482
|
-
totalFee =
|
3483
|
-
totalGas =
|
3463
|
+
totalFee = bn14(gqlTransactionStatus.totalFee);
|
3464
|
+
totalGas = bn14(gqlTransactionStatus.totalGas);
|
3484
3465
|
break;
|
3485
3466
|
case "SubmittedStatus":
|
3486
3467
|
time = gqlTransactionStatus.time;
|
@@ -3530,7 +3511,7 @@ function assembleTransactionSummary(params) {
|
|
3530
3511
|
maxInputs
|
3531
3512
|
});
|
3532
3513
|
const typeName = getTransactionTypeName(transaction.type);
|
3533
|
-
const tip =
|
3514
|
+
const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
|
3534
3515
|
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
|
3535
3516
|
const fee = calculateTXFeeForSummary({
|
3536
3517
|
totalFee,
|
@@ -3601,7 +3582,7 @@ var TransactionResponse = class {
|
|
3601
3582
|
/** Current provider */
|
3602
3583
|
provider;
|
3603
3584
|
/** Gas used on the transaction */
|
3604
|
-
gasUsed =
|
3585
|
+
gasUsed = bn16(0);
|
3605
3586
|
/** The graphql Transaction with receipts object. */
|
3606
3587
|
gqlTransaction;
|
3607
3588
|
abis;
|
@@ -3745,14 +3726,12 @@ var TransactionResponse = class {
|
|
3745
3726
|
);
|
3746
3727
|
transactionResult.logs = logs;
|
3747
3728
|
}
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
3751
|
-
gqlTransaction: { status }
|
3752
|
-
} = transactionResult;
|
3729
|
+
const { gqlTransaction, receipts } = transactionResult;
|
3730
|
+
if (gqlTransaction.status?.type === "FailureStatus") {
|
3731
|
+
const { reason } = gqlTransaction.status;
|
3753
3732
|
throw extractTxError({
|
3754
3733
|
receipts,
|
3755
|
-
|
3734
|
+
statusReason: reason,
|
3756
3735
|
logs
|
3757
3736
|
});
|
3758
3737
|
}
|
@@ -3835,47 +3814,47 @@ var processGqlChain = (chain) => {
|
|
3835
3814
|
} = consensusParameters;
|
3836
3815
|
return {
|
3837
3816
|
name,
|
3838
|
-
baseChainHeight:
|
3817
|
+
baseChainHeight: bn17(daHeight),
|
3839
3818
|
consensusParameters: {
|
3840
3819
|
version,
|
3841
|
-
chainId:
|
3820
|
+
chainId: bn17(chainId),
|
3842
3821
|
baseAssetId,
|
3843
3822
|
feeParameters: {
|
3844
3823
|
version: feeParams.version,
|
3845
|
-
gasPerByte:
|
3846
|
-
gasPriceFactor:
|
3824
|
+
gasPerByte: bn17(feeParams.gasPerByte),
|
3825
|
+
gasPriceFactor: bn17(feeParams.gasPriceFactor)
|
3847
3826
|
},
|
3848
3827
|
contractParameters: {
|
3849
3828
|
version: contractParams.version,
|
3850
|
-
contractMaxSize:
|
3851
|
-
maxStorageSlots:
|
3829
|
+
contractMaxSize: bn17(contractParams.contractMaxSize),
|
3830
|
+
maxStorageSlots: bn17(contractParams.maxStorageSlots)
|
3852
3831
|
},
|
3853
3832
|
txParameters: {
|
3854
3833
|
version: txParams.version,
|
3855
|
-
maxInputs:
|
3856
|
-
maxOutputs:
|
3857
|
-
maxWitnesses:
|
3858
|
-
maxGasPerTx:
|
3859
|
-
maxSize:
|
3860
|
-
maxBytecodeSubsections:
|
3834
|
+
maxInputs: bn17(txParams.maxInputs),
|
3835
|
+
maxOutputs: bn17(txParams.maxOutputs),
|
3836
|
+
maxWitnesses: bn17(txParams.maxWitnesses),
|
3837
|
+
maxGasPerTx: bn17(txParams.maxGasPerTx),
|
3838
|
+
maxSize: bn17(txParams.maxSize),
|
3839
|
+
maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
|
3861
3840
|
},
|
3862
3841
|
predicateParameters: {
|
3863
3842
|
version: predicateParams.version,
|
3864
|
-
maxPredicateLength:
|
3865
|
-
maxPredicateDataLength:
|
3866
|
-
maxGasPerPredicate:
|
3867
|
-
maxMessageDataLength:
|
3843
|
+
maxPredicateLength: bn17(predicateParams.maxPredicateLength),
|
3844
|
+
maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
|
3845
|
+
maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
|
3846
|
+
maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
|
3868
3847
|
},
|
3869
3848
|
scriptParameters: {
|
3870
3849
|
version: scriptParams.version,
|
3871
|
-
maxScriptLength:
|
3872
|
-
maxScriptDataLength:
|
3850
|
+
maxScriptLength: bn17(scriptParams.maxScriptLength),
|
3851
|
+
maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
|
3873
3852
|
},
|
3874
3853
|
gasCosts
|
3875
3854
|
},
|
3876
3855
|
latestBlock: {
|
3877
3856
|
id: latestBlock.id,
|
3878
|
-
height:
|
3857
|
+
height: bn17(latestBlock.height),
|
3879
3858
|
time: latestBlock.header.time,
|
3880
3859
|
transactions: latestBlock.transactions.map((i) => ({
|
3881
3860
|
id: i.id
|
@@ -4071,7 +4050,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4071
4050
|
*/
|
4072
4051
|
async getBlockNumber() {
|
4073
4052
|
const { chain } = await this.operations.getChain();
|
4074
|
-
return
|
4053
|
+
return bn17(chain.latestBlock.height, 10);
|
4075
4054
|
}
|
4076
4055
|
/**
|
4077
4056
|
* Returns the chain information.
|
@@ -4081,8 +4060,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4081
4060
|
async fetchNode() {
|
4082
4061
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
4083
4062
|
const processedNodeInfo = {
|
4084
|
-
maxDepth:
|
4085
|
-
maxTx:
|
4063
|
+
maxDepth: bn17(nodeInfo.maxDepth),
|
4064
|
+
maxTx: bn17(nodeInfo.maxTx),
|
4086
4065
|
nodeVersion: nodeInfo.nodeVersion,
|
4087
4066
|
utxoValidation: nodeInfo.utxoValidation,
|
4088
4067
|
vmBacktrace: nodeInfo.vmBacktrace
|
@@ -4214,7 +4193,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4214
4193
|
} = response;
|
4215
4194
|
if (inputs) {
|
4216
4195
|
inputs.forEach((input, index) => {
|
4217
|
-
if ("predicateGasUsed" in input &&
|
4196
|
+
if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
|
4218
4197
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
4219
4198
|
}
|
4220
4199
|
});
|
@@ -4372,12 +4351,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4372
4351
|
gasPrice = await this.estimateGasPrice(10);
|
4373
4352
|
}
|
4374
4353
|
const minFee = calculateGasFee({
|
4375
|
-
gasPrice:
|
4354
|
+
gasPrice: bn17(gasPrice),
|
4376
4355
|
gas: minGas,
|
4377
4356
|
priceFactor: gasPriceFactor,
|
4378
4357
|
tip: transactionRequest.tip
|
4379
4358
|
}).add(1);
|
4380
|
-
let gasLimit =
|
4359
|
+
let gasLimit = bn17(0);
|
4381
4360
|
if (transactionRequest.type === TransactionType8.Script) {
|
4382
4361
|
gasLimit = transactionRequest.gasLimit;
|
4383
4362
|
if (transactionRequest.gasLimit.eq(0)) {
|
@@ -4390,7 +4369,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4390
4369
|
}
|
4391
4370
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4392
4371
|
const maxFee = calculateGasFee({
|
4393
|
-
gasPrice:
|
4372
|
+
gasPrice: bn17(gasPrice),
|
4394
4373
|
gas: maxGas,
|
4395
4374
|
priceFactor: gasPriceFactor,
|
4396
4375
|
tip: transactionRequest.tip
|
@@ -4455,7 +4434,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4455
4434
|
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4456
4435
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4457
4436
|
if (isScriptTransaction) {
|
4458
|
-
txRequestClone.gasLimit =
|
4437
|
+
txRequestClone.gasLimit = bn17(0);
|
4459
4438
|
}
|
4460
4439
|
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4461
4440
|
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
@@ -4476,7 +4455,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4476
4455
|
let dryRunStatus;
|
4477
4456
|
let missingContractIds = [];
|
4478
4457
|
let outputVariables = 0;
|
4479
|
-
let gasUsed =
|
4458
|
+
let gasUsed = bn17(0);
|
4480
4459
|
txRequestClone.maxFee = maxFee;
|
4481
4460
|
if (isScriptTransaction) {
|
4482
4461
|
txRequestClone.gasLimit = gasLimit;
|
@@ -4484,7 +4463,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4484
4463
|
await signatureCallback(txRequestClone);
|
4485
4464
|
}
|
4486
4465
|
({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
|
4487
|
-
|
4466
|
+
if (dryRunStatus && "reason" in dryRunStatus) {
|
4467
|
+
throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
|
4468
|
+
}
|
4469
|
+
gasUsed = getGasUsedFromReceipts(receipts);
|
4488
4470
|
txRequestClone.gasLimit = gasUsed;
|
4489
4471
|
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
4490
4472
|
transactionRequest: txRequestClone,
|
@@ -4541,10 +4523,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4541
4523
|
return coins.map((coin) => ({
|
4542
4524
|
id: coin.utxoId,
|
4543
4525
|
assetId: coin.assetId,
|
4544
|
-
amount:
|
4526
|
+
amount: bn17(coin.amount),
|
4545
4527
|
owner: Address2.fromAddressOrString(coin.owner),
|
4546
|
-
blockCreated:
|
4547
|
-
txCreatedIdx:
|
4528
|
+
blockCreated: bn17(coin.blockCreated),
|
4529
|
+
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4548
4530
|
}));
|
4549
4531
|
}
|
4550
4532
|
/**
|
@@ -4581,9 +4563,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4581
4563
|
switch (coin.type) {
|
4582
4564
|
case "MessageCoin":
|
4583
4565
|
return {
|
4584
|
-
amount:
|
4566
|
+
amount: bn17(coin.amount),
|
4585
4567
|
assetId: coin.assetId,
|
4586
|
-
daHeight:
|
4568
|
+
daHeight: bn17(coin.daHeight),
|
4587
4569
|
sender: Address2.fromAddressOrString(coin.sender),
|
4588
4570
|
recipient: Address2.fromAddressOrString(coin.recipient),
|
4589
4571
|
nonce: coin.nonce
|
@@ -4591,11 +4573,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4591
4573
|
case "Coin":
|
4592
4574
|
return {
|
4593
4575
|
id: coin.utxoId,
|
4594
|
-
amount:
|
4576
|
+
amount: bn17(coin.amount),
|
4595
4577
|
assetId: coin.assetId,
|
4596
4578
|
owner: Address2.fromAddressOrString(coin.owner),
|
4597
|
-
blockCreated:
|
4598
|
-
txCreatedIdx:
|
4579
|
+
blockCreated: bn17(coin.blockCreated),
|
4580
|
+
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4599
4581
|
};
|
4600
4582
|
default:
|
4601
4583
|
return null;
|
@@ -4612,13 +4594,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4612
4594
|
async getBlock(idOrHeight) {
|
4613
4595
|
let variables;
|
4614
4596
|
if (typeof idOrHeight === "number") {
|
4615
|
-
variables = { height:
|
4597
|
+
variables = { height: bn17(idOrHeight).toString(10) };
|
4616
4598
|
} else if (idOrHeight === "latest") {
|
4617
4599
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4618
4600
|
} else if (idOrHeight.length === 66) {
|
4619
4601
|
variables = { blockId: idOrHeight };
|
4620
4602
|
} else {
|
4621
|
-
variables = { blockId:
|
4603
|
+
variables = { blockId: bn17(idOrHeight).toString(10) };
|
4622
4604
|
}
|
4623
4605
|
const { block } = await this.operations.getBlock(variables);
|
4624
4606
|
if (!block) {
|
@@ -4626,7 +4608,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4626
4608
|
}
|
4627
4609
|
return {
|
4628
4610
|
id: block.id,
|
4629
|
-
height:
|
4611
|
+
height: bn17(block.height),
|
4630
4612
|
time: block.header.time,
|
4631
4613
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4632
4614
|
};
|
@@ -4641,7 +4623,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4641
4623
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4642
4624
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4643
4625
|
id: block.id,
|
4644
|
-
height:
|
4626
|
+
height: bn17(block.height),
|
4645
4627
|
time: block.header.time,
|
4646
4628
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4647
4629
|
}));
|
@@ -4656,7 +4638,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4656
4638
|
async getBlockWithTransactions(idOrHeight) {
|
4657
4639
|
let variables;
|
4658
4640
|
if (typeof idOrHeight === "number") {
|
4659
|
-
variables = { blockHeight:
|
4641
|
+
variables = { blockHeight: bn17(idOrHeight).toString(10) };
|
4660
4642
|
} else if (idOrHeight === "latest") {
|
4661
4643
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4662
4644
|
} else {
|
@@ -4668,7 +4650,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4668
4650
|
}
|
4669
4651
|
return {
|
4670
4652
|
id: block.id,
|
4671
|
-
height:
|
4653
|
+
height: bn17(block.height, 10),
|
4672
4654
|
time: block.header.time,
|
4673
4655
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4674
4656
|
transactions: block.transactions.map(
|
@@ -4717,7 +4699,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4717
4699
|
contract: Address2.fromAddressOrString(contractId).toB256(),
|
4718
4700
|
asset: hexlify12(assetId)
|
4719
4701
|
});
|
4720
|
-
return
|
4702
|
+
return bn17(contractBalance.amount, 10);
|
4721
4703
|
}
|
4722
4704
|
/**
|
4723
4705
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4731,7 +4713,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4731
4713
|
owner: Address2.fromAddressOrString(owner).toB256(),
|
4732
4714
|
assetId: hexlify12(assetId)
|
4733
4715
|
});
|
4734
|
-
return
|
4716
|
+
return bn17(balance.amount, 10);
|
4735
4717
|
}
|
4736
4718
|
/**
|
4737
4719
|
* Returns balances for the given owner.
|
@@ -4749,7 +4731,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4749
4731
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4750
4732
|
return balances.map((balance) => ({
|
4751
4733
|
assetId: balance.assetId,
|
4752
|
-
amount:
|
4734
|
+
amount: bn17(balance.amount)
|
4753
4735
|
}));
|
4754
4736
|
}
|
4755
4737
|
/**
|
@@ -4771,15 +4753,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4771
4753
|
sender: message.sender,
|
4772
4754
|
recipient: message.recipient,
|
4773
4755
|
nonce: message.nonce,
|
4774
|
-
amount:
|
4756
|
+
amount: bn17(message.amount),
|
4775
4757
|
data: message.data
|
4776
4758
|
}),
|
4777
4759
|
sender: Address2.fromAddressOrString(message.sender),
|
4778
4760
|
recipient: Address2.fromAddressOrString(message.recipient),
|
4779
4761
|
nonce: message.nonce,
|
4780
|
-
amount:
|
4762
|
+
amount: bn17(message.amount),
|
4781
4763
|
data: InputMessageCoder.decodeData(message.data),
|
4782
|
-
daHeight:
|
4764
|
+
daHeight: bn17(message.daHeight)
|
4783
4765
|
}));
|
4784
4766
|
}
|
4785
4767
|
/**
|
@@ -4832,19 +4814,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4832
4814
|
} = result.messageProof;
|
4833
4815
|
return {
|
4834
4816
|
messageProof: {
|
4835
|
-
proofIndex:
|
4817
|
+
proofIndex: bn17(messageProof.proofIndex),
|
4836
4818
|
proofSet: messageProof.proofSet
|
4837
4819
|
},
|
4838
4820
|
blockProof: {
|
4839
|
-
proofIndex:
|
4821
|
+
proofIndex: bn17(blockProof.proofIndex),
|
4840
4822
|
proofSet: blockProof.proofSet
|
4841
4823
|
},
|
4842
4824
|
messageBlockHeader: {
|
4843
4825
|
id: messageBlockHeader.id,
|
4844
|
-
daHeight:
|
4826
|
+
daHeight: bn17(messageBlockHeader.daHeight),
|
4845
4827
|
transactionsCount: Number(messageBlockHeader.transactionsCount),
|
4846
4828
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4847
|
-
height:
|
4829
|
+
height: bn17(messageBlockHeader.height),
|
4848
4830
|
prevRoot: messageBlockHeader.prevRoot,
|
4849
4831
|
time: messageBlockHeader.time,
|
4850
4832
|
applicationHash: messageBlockHeader.applicationHash,
|
@@ -4856,10 +4838,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4856
4838
|
},
|
4857
4839
|
commitBlockHeader: {
|
4858
4840
|
id: commitBlockHeader.id,
|
4859
|
-
daHeight:
|
4841
|
+
daHeight: bn17(commitBlockHeader.daHeight),
|
4860
4842
|
transactionsCount: Number(commitBlockHeader.transactionsCount),
|
4861
4843
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
4862
|
-
height:
|
4844
|
+
height: bn17(commitBlockHeader.height),
|
4863
4845
|
prevRoot: commitBlockHeader.prevRoot,
|
4864
4846
|
time: commitBlockHeader.time,
|
4865
4847
|
applicationHash: commitBlockHeader.applicationHash,
|
@@ -4872,19 +4854,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4872
4854
|
sender: Address2.fromAddressOrString(sender),
|
4873
4855
|
recipient: Address2.fromAddressOrString(recipient),
|
4874
4856
|
nonce,
|
4875
|
-
amount:
|
4857
|
+
amount: bn17(amount),
|
4876
4858
|
data
|
4877
4859
|
};
|
4878
4860
|
}
|
4879
4861
|
async getLatestGasPrice() {
|
4880
4862
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4881
|
-
return
|
4863
|
+
return bn17(latestGasPrice.gasPrice);
|
4882
4864
|
}
|
4883
4865
|
async estimateGasPrice(blockHorizon) {
|
4884
4866
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4885
4867
|
blockHorizon: String(blockHorizon)
|
4886
4868
|
});
|
4887
|
-
return
|
4869
|
+
return bn17(estimateGasPrice.gasPrice);
|
4888
4870
|
}
|
4889
4871
|
/**
|
4890
4872
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -4905,10 +4887,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4905
4887
|
*/
|
4906
4888
|
async produceBlocks(amount, startTime) {
|
4907
4889
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4908
|
-
blocksToProduce:
|
4890
|
+
blocksToProduce: bn17(amount).toString(10),
|
4909
4891
|
startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4910
4892
|
});
|
4911
|
-
return
|
4893
|
+
return bn17(latestBlockHeight);
|
4912
4894
|
}
|
4913
4895
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4914
4896
|
async getTransactionResponse(transactionId) {
|
@@ -4936,6 +4918,22 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4936
4918
|
}
|
4937
4919
|
return relayedTransactionStatus;
|
4938
4920
|
}
|
4921
|
+
extractDryRunError(transactionRequest, receipts, dryRunStatus) {
|
4922
|
+
const status = dryRunStatus;
|
4923
|
+
let logs = [];
|
4924
|
+
if (transactionRequest.abis) {
|
4925
|
+
logs = getDecodedLogs(
|
4926
|
+
receipts,
|
4927
|
+
transactionRequest.abis.main,
|
4928
|
+
transactionRequest.abis.otherContractsAbis
|
4929
|
+
);
|
4930
|
+
}
|
4931
|
+
return extractTxError({
|
4932
|
+
logs,
|
4933
|
+
receipts,
|
4934
|
+
statusReason: status.reason
|
4935
|
+
});
|
4936
|
+
}
|
4939
4937
|
};
|
4940
4938
|
var Provider = _Provider;
|
4941
4939
|
_cacheInputs = new WeakSet();
|
@@ -4954,7 +4952,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4954
4952
|
|
4955
4953
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4956
4954
|
import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
|
4957
|
-
import { bn as
|
4955
|
+
import { bn as bn18 } from "@fuel-ts/math";
|
4958
4956
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
4959
4957
|
import { arrayify as arrayify12 } from "@fuel-ts/utils";
|
4960
4958
|
async function getTransactionSummary(params) {
|
@@ -4991,8 +4989,8 @@ async function getTransactionSummary(params) {
|
|
4991
4989
|
transaction: decodedTransaction,
|
4992
4990
|
transactionBytes: arrayify12(gqlTransaction.rawPayload),
|
4993
4991
|
gqlTransactionStatus: gqlTransaction.status,
|
4994
|
-
gasPerByte:
|
4995
|
-
gasPriceFactor:
|
4992
|
+
gasPerByte: bn18(gasPerByte),
|
4993
|
+
gasPriceFactor: bn18(gasPriceFactor),
|
4996
4994
|
abiMap,
|
4997
4995
|
maxInputs,
|
4998
4996
|
gasCosts,
|
@@ -5091,7 +5089,7 @@ var getDefaultChainId = (networkType) => {
|
|
5091
5089
|
return CHAIN_IDS.eth.sepolia;
|
5092
5090
|
}
|
5093
5091
|
if (networkType === "fuel") {
|
5094
|
-
return CHAIN_IDS.fuel.
|
5092
|
+
return CHAIN_IDS.fuel.devnet;
|
5095
5093
|
}
|
5096
5094
|
return void 0;
|
5097
5095
|
};
|
@@ -5401,9 +5399,9 @@ var Account = class extends AbstractAccount {
|
|
5401
5399
|
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
5402
5400
|
const fee = request.maxFee;
|
5403
5401
|
const baseAssetId = this.provider.getBaseAssetId();
|
5404
|
-
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount ||
|
5402
|
+
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn19(0);
|
5405
5403
|
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
5406
|
-
amount:
|
5404
|
+
amount: bn19(fee),
|
5407
5405
|
assetId: baseAssetId,
|
5408
5406
|
coinQuantities: requiredQuantities
|
5409
5407
|
});
|
@@ -5411,7 +5409,7 @@ var Account = class extends AbstractAccount {
|
|
5411
5409
|
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
5412
5410
|
quantitiesDict[assetId] = {
|
5413
5411
|
required: amount,
|
5414
|
-
owned:
|
5412
|
+
owned: bn19(0)
|
5415
5413
|
};
|
5416
5414
|
});
|
5417
5415
|
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
@@ -5438,7 +5436,6 @@ var Account = class extends AbstractAccount {
|
|
5438
5436
|
cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
|
5439
5437
|
);
|
5440
5438
|
request.addResources(resources);
|
5441
|
-
request.shiftPredicateData();
|
5442
5439
|
request.updatePredicateGasUsed(estimatedPredicates);
|
5443
5440
|
const requestToReestimate2 = clone4(request);
|
5444
5441
|
if (addedSignatures) {
|
@@ -5470,7 +5467,6 @@ var Account = class extends AbstractAccount {
|
|
5470
5467
|
}
|
5471
5468
|
fundingAttempts += 1;
|
5472
5469
|
}
|
5473
|
-
request.shiftPredicateData();
|
5474
5470
|
request.updatePredicateGasUsed(estimatedPredicates);
|
5475
5471
|
const requestToReestimate = clone4(request);
|
5476
5472
|
if (addedSignatures) {
|
@@ -5521,7 +5517,7 @@ var Account = class extends AbstractAccount {
|
|
5521
5517
|
* @returns A promise that resolves to the transaction response.
|
5522
5518
|
*/
|
5523
5519
|
async transfer(destination, amount, assetId, txParams = {}) {
|
5524
|
-
if (
|
5520
|
+
if (bn19(amount).lte(0)) {
|
5525
5521
|
throw new FuelError15(
|
5526
5522
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5527
5523
|
"Transfer amount must be a positive number."
|
@@ -5541,7 +5537,7 @@ var Account = class extends AbstractAccount {
|
|
5541
5537
|
* @returns A promise that resolves to the transaction response.
|
5542
5538
|
*/
|
5543
5539
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
5544
|
-
if (
|
5540
|
+
if (bn19(amount).lte(0)) {
|
5545
5541
|
throw new FuelError15(
|
5546
5542
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5547
5543
|
"Transfer amount must be a positive number."
|
@@ -5551,7 +5547,7 @@ var Account = class extends AbstractAccount {
|
|
5551
5547
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
5552
5548
|
const { script, scriptData } = await assembleTransferToContractScript({
|
5553
5549
|
hexlifiedContractId: contractAddress.toB256(),
|
5554
|
-
amountToTransfer:
|
5550
|
+
amountToTransfer: bn19(amount),
|
5555
5551
|
assetId: assetIdToTransfer
|
5556
5552
|
});
|
5557
5553
|
let request = new ScriptTransactionRequest({
|
@@ -5562,7 +5558,7 @@ var Account = class extends AbstractAccount {
|
|
5562
5558
|
request.addContractInputAndOutput(contractAddress);
|
5563
5559
|
const txCost = await this.provider.getTransactionCost(request, {
|
5564
5560
|
resourcesOwner: this,
|
5565
|
-
quantitiesToContract: [{ amount:
|
5561
|
+
quantitiesToContract: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
|
5566
5562
|
});
|
5567
5563
|
request = this.validateGasLimitAndMaxFee({
|
5568
5564
|
transactionRequest: request,
|
@@ -5587,7 +5583,7 @@ var Account = class extends AbstractAccount {
|
|
5587
5583
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5588
5584
|
);
|
5589
5585
|
const amountDataArray = arrayify14(
|
5590
|
-
"0x".concat(
|
5586
|
+
"0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
|
5591
5587
|
);
|
5592
5588
|
const script = new Uint8Array([
|
5593
5589
|
...arrayify14(withdrawScript.bytes),
|
@@ -5597,7 +5593,7 @@ var Account = class extends AbstractAccount {
|
|
5597
5593
|
const params = { script, ...txParams };
|
5598
5594
|
const baseAssetId = this.provider.getBaseAssetId();
|
5599
5595
|
let request = new ScriptTransactionRequest(params);
|
5600
|
-
const quantitiesToContract = [{ amount:
|
5596
|
+
const quantitiesToContract = [{ amount: bn19(amount), assetId: baseAssetId }];
|
5601
5597
|
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
5602
5598
|
request = this.validateGasLimitAndMaxFee({
|
5603
5599
|
transactionRequest: request,
|
@@ -6018,14 +6014,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
6018
6014
|
import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
|
6019
6015
|
import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
|
6020
6016
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
6021
|
-
import { bn as
|
6017
|
+
import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
6022
6018
|
import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
|
6023
6019
|
|
6024
6020
|
// src/mnemonic/mnemonic.ts
|
6025
6021
|
import { randomBytes as randomBytes4, pbkdf2, computeHmac } from "@fuel-ts/crypto";
|
6026
6022
|
import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
|
6027
6023
|
import { sha256 as sha2563 } from "@fuel-ts/hasher";
|
6028
|
-
import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4, dataSlice, encodeBase58 } from "@fuel-ts/utils";
|
6024
|
+
import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
|
6029
6025
|
|
6030
6026
|
// src/wordlists/words/english.ts
|
6031
6027
|
var english = [
|
@@ -8089,38 +8085,6 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
8089
8085
|
import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
|
8090
8086
|
import { sha256 as sha2562 } from "@fuel-ts/hasher";
|
8091
8087
|
import { arrayify as arrayify16 } from "@fuel-ts/utils";
|
8092
|
-
function toUtf8Bytes(stri) {
|
8093
|
-
const str = stri.normalize("NFKD");
|
8094
|
-
const result = [];
|
8095
|
-
for (let i = 0; i < str.length; i += 1) {
|
8096
|
-
const c = str.charCodeAt(i);
|
8097
|
-
if (c < 128) {
|
8098
|
-
result.push(c);
|
8099
|
-
} else if (c < 2048) {
|
8100
|
-
result.push(c >> 6 | 192);
|
8101
|
-
result.push(c & 63 | 128);
|
8102
|
-
} else if ((c & 64512) === 55296) {
|
8103
|
-
i += 1;
|
8104
|
-
const c2 = str.charCodeAt(i);
|
8105
|
-
if (i >= str.length || (c2 & 64512) !== 56320) {
|
8106
|
-
throw new FuelError17(
|
8107
|
-
ErrorCode17.INVALID_INPUT_PARAMETERS,
|
8108
|
-
"Invalid UTF-8 in the input string."
|
8109
|
-
);
|
8110
|
-
}
|
8111
|
-
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
8112
|
-
result.push(pair >> 18 | 240);
|
8113
|
-
result.push(pair >> 12 & 63 | 128);
|
8114
|
-
result.push(pair >> 6 & 63 | 128);
|
8115
|
-
result.push(pair & 63 | 128);
|
8116
|
-
} else {
|
8117
|
-
result.push(c >> 12 | 224);
|
8118
|
-
result.push(c >> 6 & 63 | 128);
|
8119
|
-
result.push(c & 63 | 128);
|
8120
|
-
}
|
8121
|
-
}
|
8122
|
-
return Uint8Array.from(result);
|
8123
|
-
}
|
8124
8088
|
function getLowerMask(bits) {
|
8125
8089
|
return (1 << bits) - 1;
|
8126
8090
|
}
|
@@ -8488,7 +8452,7 @@ var HDWallet = class {
|
|
8488
8452
|
const IR = bytes.slice(32);
|
8489
8453
|
if (privateKey) {
|
8490
8454
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
8491
|
-
const ki =
|
8455
|
+
const ki = bn20(IL).add(privateKey).mod(N).toBytes(32);
|
8492
8456
|
return new HDWallet({
|
8493
8457
|
privateKey: ki,
|
8494
8458
|
chainCode: IR,
|
@@ -9167,16 +9131,9 @@ var StorageAbstract = class {
|
|
9167
9131
|
};
|
9168
9132
|
|
9169
9133
|
// src/predicate/predicate.ts
|
9170
|
-
import {
|
9171
|
-
Interface as Interface4,
|
9172
|
-
INPUT_COIN_FIXED_SIZE,
|
9173
|
-
WORD_SIZE,
|
9174
|
-
calculateVmTxMemory as calculateVmTxMemory2,
|
9175
|
-
SCRIPT_FIXED_SIZE
|
9176
|
-
} from "@fuel-ts/abi-coder";
|
9134
|
+
import { Interface as Interface4 } from "@fuel-ts/abi-coder";
|
9177
9135
|
import { Address as Address9 } from "@fuel-ts/address";
|
9178
9136
|
import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
|
9179
|
-
import { ByteArrayCoder } from "@fuel-ts/transactions";
|
9180
9137
|
import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
|
9181
9138
|
|
9182
9139
|
// src/predicate/utils/getPredicateRoot.ts
|
@@ -9234,7 +9191,6 @@ var Predicate = class extends Account {
|
|
9234
9191
|
*/
|
9235
9192
|
populateTransactionPredicateData(transactionRequestLike) {
|
9236
9193
|
const request = transactionRequestify(transactionRequestLike);
|
9237
|
-
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
9238
9194
|
const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
|
9239
9195
|
if (placeholderIndex !== -1) {
|
9240
9196
|
request.removeWitness(placeholderIndex);
|
@@ -9242,7 +9198,7 @@ var Predicate = class extends Account {
|
|
9242
9198
|
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
9243
9199
|
if (isRequestInputResourceFromOwner(input, this.address)) {
|
9244
9200
|
input.predicate = hexlify19(this.bytes);
|
9245
|
-
input.predicateData = hexlify19(this.getPredicateData(
|
9201
|
+
input.predicateData = hexlify19(this.getPredicateData());
|
9246
9202
|
input.witnessIndex = 0;
|
9247
9203
|
}
|
9248
9204
|
});
|
@@ -9268,17 +9224,12 @@ var Predicate = class extends Account {
|
|
9268
9224
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9269
9225
|
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
9270
9226
|
}
|
9271
|
-
getPredicateData(
|
9227
|
+
getPredicateData() {
|
9272
9228
|
if (!this.predicateData.length) {
|
9273
9229
|
return new Uint8Array();
|
9274
9230
|
}
|
9275
9231
|
const mainFn = this.interface?.functions.main;
|
9276
|
-
|
9277
|
-
const VM_TX_MEMORY = calculateVmTxMemory2({
|
9278
|
-
maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
|
9279
|
-
});
|
9280
|
-
const OFFSET = VM_TX_MEMORY + SCRIPT_FIXED_SIZE + INPUT_COIN_FIXED_SIZE + WORD_SIZE + paddedCode.byteLength + policiesLength * WORD_SIZE;
|
9281
|
-
return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
|
9232
|
+
return mainFn?.encodeArguments(this.predicateData) || new Uint8Array();
|
9282
9233
|
}
|
9283
9234
|
/**
|
9284
9235
|
* Processes the predicate data and returns the altered bytecode and interface.
|
@@ -9327,8 +9278,7 @@ var Predicate = class extends Account {
|
|
9327
9278
|
);
|
9328
9279
|
return resources.map((resource) => ({
|
9329
9280
|
...resource,
|
9330
|
-
predicate: hexlify19(this.bytes)
|
9331
|
-
padPredicateData: (policiesLength) => hexlify19(this.getPredicateData(policiesLength))
|
9281
|
+
predicate: hexlify19(this.bytes)
|
9332
9282
|
}));
|
9333
9283
|
}
|
9334
9284
|
/**
|