@fuel-ts/account 0.0.0-rc-2143-20240513161105 → 0.0.0-rc-2238-20240513190659
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/index.global.js +412 -1146
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +116 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -144
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.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/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-summary/call.d.ts +1 -1
- package/dist/providers/transaction-summary/call.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 +3643 -6596
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +111 -134
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +102 -125
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
@@ -198,7 +198,7 @@ module.exports = __toCommonJS(src_exports);
|
|
198
198
|
var import_address4 = require("@fuel-ts/address");
|
199
199
|
var import_errors16 = require("@fuel-ts/errors");
|
200
200
|
var import_interfaces = require("@fuel-ts/interfaces");
|
201
|
-
var
|
201
|
+
var import_math20 = require("@fuel-ts/math");
|
202
202
|
var import_utils28 = require("@fuel-ts/utils");
|
203
203
|
var import_ramda4 = require("ramda");
|
204
204
|
|
@@ -240,7 +240,7 @@ var addAmountToCoinQuantities = (params) => {
|
|
240
240
|
// src/providers/provider.ts
|
241
241
|
var import_address3 = require("@fuel-ts/address");
|
242
242
|
var import_errors14 = require("@fuel-ts/errors");
|
243
|
-
var
|
243
|
+
var import_math17 = require("@fuel-ts/math");
|
244
244
|
var import_transactions20 = require("@fuel-ts/transactions");
|
245
245
|
var import_utils22 = require("@fuel-ts/utils");
|
246
246
|
var import_versions = require("@fuel-ts/versions");
|
@@ -2520,15 +2520,6 @@ var BaseTransactionRequest = class {
|
|
2520
2520
|
}
|
2521
2521
|
});
|
2522
2522
|
}
|
2523
|
-
shiftPredicateData() {
|
2524
|
-
this.inputs.forEach((input) => {
|
2525
|
-
if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
|
2526
|
-
input.predicateData = input.padPredicateData(
|
2527
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
2528
|
-
);
|
2529
|
-
}
|
2530
|
-
});
|
2531
|
-
}
|
2532
2523
|
};
|
2533
2524
|
|
2534
2525
|
// src/providers/transaction-request/create-transaction-request.ts
|
@@ -2951,12 +2942,12 @@ var transactionRequestify = (obj) => {
|
|
2951
2942
|
|
2952
2943
|
// src/providers/transaction-response/transaction-response.ts
|
2953
2944
|
var import_errors13 = require("@fuel-ts/errors");
|
2954
|
-
var
|
2945
|
+
var import_math16 = require("@fuel-ts/math");
|
2955
2946
|
var import_transactions19 = require("@fuel-ts/transactions");
|
2956
2947
|
var import_utils20 = require("@fuel-ts/utils");
|
2957
2948
|
|
2958
2949
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2959
|
-
var
|
2950
|
+
var import_math15 = require("@fuel-ts/math");
|
2960
2951
|
var import_transactions17 = require("@fuel-ts/transactions");
|
2961
2952
|
var import_utils18 = require("@fuel-ts/utils");
|
2962
2953
|
|
@@ -3033,43 +3024,32 @@ var calculateTXFeeForSummary = (params) => {
|
|
3033
3024
|
// src/providers/transaction-summary/operations.ts
|
3034
3025
|
var import_configs10 = require("@fuel-ts/address/configs");
|
3035
3026
|
var import_errors11 = require("@fuel-ts/errors");
|
3036
|
-
var
|
3027
|
+
var import_math13 = require("@fuel-ts/math");
|
3037
3028
|
var import_transactions15 = require("@fuel-ts/transactions");
|
3038
3029
|
|
3039
3030
|
// src/providers/transaction-summary/call.ts
|
3040
3031
|
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
3041
|
-
var
|
3042
|
-
var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
3032
|
+
var getFunctionCall = ({ abi, receipt }) => {
|
3043
3033
|
const abiInterface = new import_abi_coder4.Interface(abi);
|
3044
3034
|
const callFunctionSelector = receipt.param1.toHex(8);
|
3045
3035
|
const functionFragment = abiInterface.getFunction(callFunctionSelector);
|
3046
3036
|
const inputs = functionFragment.jsonFn.inputs;
|
3047
|
-
|
3048
|
-
if (functionFragment.isInputDataPointer) {
|
3049
|
-
if (rawPayload) {
|
3050
|
-
const argsOffset = (0, import_math13.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
|
3051
|
-
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
3052
|
-
}
|
3053
|
-
} else {
|
3054
|
-
encodedArgs = receipt.param2.toHex();
|
3055
|
-
}
|
3037
|
+
const encodedArgs = receipt.param2.toHex();
|
3056
3038
|
let argumentsProvided;
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
3063
|
-
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
}, {});
|
3072
|
-
}
|
3039
|
+
const data = functionFragment.decodeArguments(encodedArgs);
|
3040
|
+
if (data) {
|
3041
|
+
argumentsProvided = inputs.reduce((prev, input, index) => {
|
3042
|
+
const value = data[index];
|
3043
|
+
const name = input.name;
|
3044
|
+
if (name) {
|
3045
|
+
return {
|
3046
|
+
...prev,
|
3047
|
+
// reparse to remove bn
|
3048
|
+
[name]: JSON.parse(JSON.stringify(value))
|
3049
|
+
};
|
3050
|
+
}
|
3051
|
+
return prev;
|
3052
|
+
}, {});
|
3073
3053
|
}
|
3074
3054
|
const call = {
|
3075
3055
|
functionSignature: functionFragment.signature,
|
@@ -3255,7 +3235,7 @@ var mergeAssets = (op1, op2) => {
|
|
3255
3235
|
if (!matchingAsset) {
|
3256
3236
|
return asset1;
|
3257
3237
|
}
|
3258
|
-
const mergedAmount = (0,
|
3238
|
+
const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
|
3259
3239
|
return { ...asset1, amount: mergedAmount };
|
3260
3240
|
});
|
3261
3241
|
return mergedAssets.concat(filteredAssets);
|
@@ -3581,7 +3561,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
3581
3561
|
|
3582
3562
|
// src/providers/transaction-summary/status.ts
|
3583
3563
|
var import_errors12 = require("@fuel-ts/errors");
|
3584
|
-
var
|
3564
|
+
var import_math14 = require("@fuel-ts/math");
|
3585
3565
|
var getTransactionStatusName = (gqlStatus) => {
|
3586
3566
|
switch (gqlStatus) {
|
3587
3567
|
case "FailureStatus":
|
@@ -3615,15 +3595,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3615
3595
|
time = gqlTransactionStatus.time;
|
3616
3596
|
blockId = gqlTransactionStatus.block.id;
|
3617
3597
|
isStatusSuccess = true;
|
3618
|
-
totalFee = (0,
|
3619
|
-
totalGas = (0,
|
3598
|
+
totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
|
3599
|
+
totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
|
3620
3600
|
break;
|
3621
3601
|
case "FailureStatus":
|
3622
3602
|
time = gqlTransactionStatus.time;
|
3623
3603
|
blockId = gqlTransactionStatus.block.id;
|
3624
3604
|
isStatusFailure = true;
|
3625
|
-
totalFee = (0,
|
3626
|
-
totalGas = (0,
|
3605
|
+
totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
|
3606
|
+
totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
|
3627
3607
|
break;
|
3628
3608
|
case "SubmittedStatus":
|
3629
3609
|
time = gqlTransactionStatus.time;
|
@@ -3673,7 +3653,7 @@ function assembleTransactionSummary(params) {
|
|
3673
3653
|
maxInputs
|
3674
3654
|
});
|
3675
3655
|
const typeName = getTransactionTypeName(transaction.type);
|
3676
|
-
const tip = (0,
|
3656
|
+
const tip = (0, import_math15.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
|
3677
3657
|
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
|
3678
3658
|
const fee = calculateTXFeeForSummary({
|
3679
3659
|
totalFee,
|
@@ -3744,7 +3724,7 @@ var TransactionResponse = class {
|
|
3744
3724
|
/** Current provider */
|
3745
3725
|
provider;
|
3746
3726
|
/** Gas used on the transaction */
|
3747
|
-
gasUsed = (0,
|
3727
|
+
gasUsed = (0, import_math16.bn)(0);
|
3748
3728
|
/** The graphql Transaction with receipts object. */
|
3749
3729
|
gqlTransaction;
|
3750
3730
|
abis;
|
@@ -3978,47 +3958,47 @@ var processGqlChain = (chain) => {
|
|
3978
3958
|
} = consensusParameters;
|
3979
3959
|
return {
|
3980
3960
|
name,
|
3981
|
-
baseChainHeight: (0,
|
3961
|
+
baseChainHeight: (0, import_math17.bn)(daHeight),
|
3982
3962
|
consensusParameters: {
|
3983
3963
|
version,
|
3984
|
-
chainId: (0,
|
3964
|
+
chainId: (0, import_math17.bn)(chainId),
|
3985
3965
|
baseAssetId,
|
3986
3966
|
feeParameters: {
|
3987
3967
|
version: feeParams.version,
|
3988
|
-
gasPerByte: (0,
|
3989
|
-
gasPriceFactor: (0,
|
3968
|
+
gasPerByte: (0, import_math17.bn)(feeParams.gasPerByte),
|
3969
|
+
gasPriceFactor: (0, import_math17.bn)(feeParams.gasPriceFactor)
|
3990
3970
|
},
|
3991
3971
|
contractParameters: {
|
3992
3972
|
version: contractParams.version,
|
3993
|
-
contractMaxSize: (0,
|
3994
|
-
maxStorageSlots: (0,
|
3973
|
+
contractMaxSize: (0, import_math17.bn)(contractParams.contractMaxSize),
|
3974
|
+
maxStorageSlots: (0, import_math17.bn)(contractParams.maxStorageSlots)
|
3995
3975
|
},
|
3996
3976
|
txParameters: {
|
3997
3977
|
version: txParams.version,
|
3998
|
-
maxInputs: (0,
|
3999
|
-
maxOutputs: (0,
|
4000
|
-
maxWitnesses: (0,
|
4001
|
-
maxGasPerTx: (0,
|
4002
|
-
maxSize: (0,
|
4003
|
-
maxBytecodeSubsections: (0,
|
3978
|
+
maxInputs: (0, import_math17.bn)(txParams.maxInputs),
|
3979
|
+
maxOutputs: (0, import_math17.bn)(txParams.maxOutputs),
|
3980
|
+
maxWitnesses: (0, import_math17.bn)(txParams.maxWitnesses),
|
3981
|
+
maxGasPerTx: (0, import_math17.bn)(txParams.maxGasPerTx),
|
3982
|
+
maxSize: (0, import_math17.bn)(txParams.maxSize),
|
3983
|
+
maxBytecodeSubsections: (0, import_math17.bn)(txParams.maxBytecodeSubsections)
|
4004
3984
|
},
|
4005
3985
|
predicateParameters: {
|
4006
3986
|
version: predicateParams.version,
|
4007
|
-
maxPredicateLength: (0,
|
4008
|
-
maxPredicateDataLength: (0,
|
4009
|
-
maxGasPerPredicate: (0,
|
4010
|
-
maxMessageDataLength: (0,
|
3987
|
+
maxPredicateLength: (0, import_math17.bn)(predicateParams.maxPredicateLength),
|
3988
|
+
maxPredicateDataLength: (0, import_math17.bn)(predicateParams.maxPredicateDataLength),
|
3989
|
+
maxGasPerPredicate: (0, import_math17.bn)(predicateParams.maxGasPerPredicate),
|
3990
|
+
maxMessageDataLength: (0, import_math17.bn)(predicateParams.maxMessageDataLength)
|
4011
3991
|
},
|
4012
3992
|
scriptParameters: {
|
4013
3993
|
version: scriptParams.version,
|
4014
|
-
maxScriptLength: (0,
|
4015
|
-
maxScriptDataLength: (0,
|
3994
|
+
maxScriptLength: (0, import_math17.bn)(scriptParams.maxScriptLength),
|
3995
|
+
maxScriptDataLength: (0, import_math17.bn)(scriptParams.maxScriptDataLength)
|
4016
3996
|
},
|
4017
3997
|
gasCosts
|
4018
3998
|
},
|
4019
3999
|
latestBlock: {
|
4020
4000
|
id: latestBlock.id,
|
4021
|
-
height: (0,
|
4001
|
+
height: (0, import_math17.bn)(latestBlock.height),
|
4022
4002
|
time: latestBlock.header.time,
|
4023
4003
|
transactions: latestBlock.transactions.map((i) => ({
|
4024
4004
|
id: i.id
|
@@ -4214,7 +4194,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4214
4194
|
*/
|
4215
4195
|
async getBlockNumber() {
|
4216
4196
|
const { chain } = await this.operations.getChain();
|
4217
|
-
return (0,
|
4197
|
+
return (0, import_math17.bn)(chain.latestBlock.height, 10);
|
4218
4198
|
}
|
4219
4199
|
/**
|
4220
4200
|
* Returns the chain information.
|
@@ -4224,8 +4204,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4224
4204
|
async fetchNode() {
|
4225
4205
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
4226
4206
|
const processedNodeInfo = {
|
4227
|
-
maxDepth: (0,
|
4228
|
-
maxTx: (0,
|
4207
|
+
maxDepth: (0, import_math17.bn)(nodeInfo.maxDepth),
|
4208
|
+
maxTx: (0, import_math17.bn)(nodeInfo.maxTx),
|
4229
4209
|
nodeVersion: nodeInfo.nodeVersion,
|
4230
4210
|
utxoValidation: nodeInfo.utxoValidation,
|
4231
4211
|
vmBacktrace: nodeInfo.vmBacktrace
|
@@ -4342,7 +4322,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4342
4322
|
async estimatePredicates(transactionRequest) {
|
4343
4323
|
const shouldEstimatePredicates = Boolean(
|
4344
4324
|
transactionRequest.inputs.find(
|
4345
|
-
(input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new
|
4325
|
+
(input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
|
4346
4326
|
)
|
4347
4327
|
);
|
4348
4328
|
if (!shouldEstimatePredicates) {
|
@@ -4357,7 +4337,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4357
4337
|
} = response;
|
4358
4338
|
if (inputs) {
|
4359
4339
|
inputs.forEach((input, index) => {
|
4360
|
-
if ("predicateGasUsed" in input && (0,
|
4340
|
+
if ("predicateGasUsed" in input && (0, import_math17.bn)(input.predicateGasUsed).gt(0)) {
|
4361
4341
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
4362
4342
|
}
|
4363
4343
|
});
|
@@ -4515,12 +4495,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4515
4495
|
gasPrice = await this.estimateGasPrice(10);
|
4516
4496
|
}
|
4517
4497
|
const minFee = calculateGasFee({
|
4518
|
-
gasPrice: (0,
|
4498
|
+
gasPrice: (0, import_math17.bn)(gasPrice),
|
4519
4499
|
gas: minGas,
|
4520
4500
|
priceFactor: gasPriceFactor,
|
4521
4501
|
tip: transactionRequest.tip
|
4522
4502
|
}).add(1);
|
4523
|
-
let gasLimit = (0,
|
4503
|
+
let gasLimit = (0, import_math17.bn)(0);
|
4524
4504
|
if (transactionRequest.type === import_transactions20.TransactionType.Script) {
|
4525
4505
|
gasLimit = transactionRequest.gasLimit;
|
4526
4506
|
if (transactionRequest.gasLimit.eq(0)) {
|
@@ -4533,7 +4513,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4533
4513
|
}
|
4534
4514
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4535
4515
|
const maxFee = calculateGasFee({
|
4536
|
-
gasPrice: (0,
|
4516
|
+
gasPrice: (0, import_math17.bn)(gasPrice),
|
4537
4517
|
gas: maxGas,
|
4538
4518
|
priceFactor: gasPriceFactor,
|
4539
4519
|
tip: transactionRequest.tip
|
@@ -4598,7 +4578,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4598
4578
|
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4599
4579
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4600
4580
|
if (isScriptTransaction) {
|
4601
|
-
txRequestClone.gasLimit = (0,
|
4581
|
+
txRequestClone.gasLimit = (0, import_math17.bn)(0);
|
4602
4582
|
}
|
4603
4583
|
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4604
4584
|
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
@@ -4619,7 +4599,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4619
4599
|
let dryRunStatus;
|
4620
4600
|
let missingContractIds = [];
|
4621
4601
|
let outputVariables = 0;
|
4622
|
-
let gasUsed = (0,
|
4602
|
+
let gasUsed = (0, import_math17.bn)(0);
|
4623
4603
|
txRequestClone.maxFee = maxFee;
|
4624
4604
|
if (isScriptTransaction) {
|
4625
4605
|
txRequestClone.gasLimit = gasLimit;
|
@@ -4684,10 +4664,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4684
4664
|
return coins.map((coin) => ({
|
4685
4665
|
id: coin.utxoId,
|
4686
4666
|
assetId: coin.assetId,
|
4687
|
-
amount: (0,
|
4667
|
+
amount: (0, import_math17.bn)(coin.amount),
|
4688
4668
|
owner: import_address3.Address.fromAddressOrString(coin.owner),
|
4689
|
-
blockCreated: (0,
|
4690
|
-
txCreatedIdx: (0,
|
4669
|
+
blockCreated: (0, import_math17.bn)(coin.blockCreated),
|
4670
|
+
txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
|
4691
4671
|
}));
|
4692
4672
|
}
|
4693
4673
|
/**
|
@@ -4724,9 +4704,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4724
4704
|
switch (coin.type) {
|
4725
4705
|
case "MessageCoin":
|
4726
4706
|
return {
|
4727
|
-
amount: (0,
|
4707
|
+
amount: (0, import_math17.bn)(coin.amount),
|
4728
4708
|
assetId: coin.assetId,
|
4729
|
-
daHeight: (0,
|
4709
|
+
daHeight: (0, import_math17.bn)(coin.daHeight),
|
4730
4710
|
sender: import_address3.Address.fromAddressOrString(coin.sender),
|
4731
4711
|
recipient: import_address3.Address.fromAddressOrString(coin.recipient),
|
4732
4712
|
nonce: coin.nonce
|
@@ -4734,11 +4714,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4734
4714
|
case "Coin":
|
4735
4715
|
return {
|
4736
4716
|
id: coin.utxoId,
|
4737
|
-
amount: (0,
|
4717
|
+
amount: (0, import_math17.bn)(coin.amount),
|
4738
4718
|
assetId: coin.assetId,
|
4739
4719
|
owner: import_address3.Address.fromAddressOrString(coin.owner),
|
4740
|
-
blockCreated: (0,
|
4741
|
-
txCreatedIdx: (0,
|
4720
|
+
blockCreated: (0, import_math17.bn)(coin.blockCreated),
|
4721
|
+
txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
|
4742
4722
|
};
|
4743
4723
|
default:
|
4744
4724
|
return null;
|
@@ -4755,13 +4735,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4755
4735
|
async getBlock(idOrHeight) {
|
4756
4736
|
let variables;
|
4757
4737
|
if (typeof idOrHeight === "number") {
|
4758
|
-
variables = { height: (0,
|
4738
|
+
variables = { height: (0, import_math17.bn)(idOrHeight).toString(10) };
|
4759
4739
|
} else if (idOrHeight === "latest") {
|
4760
4740
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4761
4741
|
} else if (idOrHeight.length === 66) {
|
4762
4742
|
variables = { blockId: idOrHeight };
|
4763
4743
|
} else {
|
4764
|
-
variables = { blockId: (0,
|
4744
|
+
variables = { blockId: (0, import_math17.bn)(idOrHeight).toString(10) };
|
4765
4745
|
}
|
4766
4746
|
const { block } = await this.operations.getBlock(variables);
|
4767
4747
|
if (!block) {
|
@@ -4769,7 +4749,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4769
4749
|
}
|
4770
4750
|
return {
|
4771
4751
|
id: block.id,
|
4772
|
-
height: (0,
|
4752
|
+
height: (0, import_math17.bn)(block.height),
|
4773
4753
|
time: block.header.time,
|
4774
4754
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4775
4755
|
};
|
@@ -4784,7 +4764,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4784
4764
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4785
4765
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4786
4766
|
id: block.id,
|
4787
|
-
height: (0,
|
4767
|
+
height: (0, import_math17.bn)(block.height),
|
4788
4768
|
time: block.header.time,
|
4789
4769
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4790
4770
|
}));
|
@@ -4799,7 +4779,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4799
4779
|
async getBlockWithTransactions(idOrHeight) {
|
4800
4780
|
let variables;
|
4801
4781
|
if (typeof idOrHeight === "number") {
|
4802
|
-
variables = { blockHeight: (0,
|
4782
|
+
variables = { blockHeight: (0, import_math17.bn)(idOrHeight).toString(10) };
|
4803
4783
|
} else if (idOrHeight === "latest") {
|
4804
4784
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4805
4785
|
} else {
|
@@ -4811,7 +4791,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4811
4791
|
}
|
4812
4792
|
return {
|
4813
4793
|
id: block.id,
|
4814
|
-
height: (0,
|
4794
|
+
height: (0, import_math17.bn)(block.height, 10),
|
4815
4795
|
time: block.header.time,
|
4816
4796
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4817
4797
|
transactions: block.transactions.map(
|
@@ -4860,7 +4840,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4860
4840
|
contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
|
4861
4841
|
asset: (0, import_utils22.hexlify)(assetId)
|
4862
4842
|
});
|
4863
|
-
return (0,
|
4843
|
+
return (0, import_math17.bn)(contractBalance.amount, 10);
|
4864
4844
|
}
|
4865
4845
|
/**
|
4866
4846
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4874,7 +4854,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4874
4854
|
owner: import_address3.Address.fromAddressOrString(owner).toB256(),
|
4875
4855
|
assetId: (0, import_utils22.hexlify)(assetId)
|
4876
4856
|
});
|
4877
|
-
return (0,
|
4857
|
+
return (0, import_math17.bn)(balance.amount, 10);
|
4878
4858
|
}
|
4879
4859
|
/**
|
4880
4860
|
* Returns balances for the given owner.
|
@@ -4892,7 +4872,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4892
4872
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4893
4873
|
return balances.map((balance) => ({
|
4894
4874
|
assetId: balance.assetId,
|
4895
|
-
amount: (0,
|
4875
|
+
amount: (0, import_math17.bn)(balance.amount)
|
4896
4876
|
}));
|
4897
4877
|
}
|
4898
4878
|
/**
|
@@ -4914,15 +4894,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4914
4894
|
sender: message.sender,
|
4915
4895
|
recipient: message.recipient,
|
4916
4896
|
nonce: message.nonce,
|
4917
|
-
amount: (0,
|
4897
|
+
amount: (0, import_math17.bn)(message.amount),
|
4918
4898
|
data: message.data
|
4919
4899
|
}),
|
4920
4900
|
sender: import_address3.Address.fromAddressOrString(message.sender),
|
4921
4901
|
recipient: import_address3.Address.fromAddressOrString(message.recipient),
|
4922
4902
|
nonce: message.nonce,
|
4923
|
-
amount: (0,
|
4903
|
+
amount: (0, import_math17.bn)(message.amount),
|
4924
4904
|
data: import_transactions20.InputMessageCoder.decodeData(message.data),
|
4925
|
-
daHeight: (0,
|
4905
|
+
daHeight: (0, import_math17.bn)(message.daHeight)
|
4926
4906
|
}));
|
4927
4907
|
}
|
4928
4908
|
/**
|
@@ -4975,19 +4955,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4975
4955
|
} = result.messageProof;
|
4976
4956
|
return {
|
4977
4957
|
messageProof: {
|
4978
|
-
proofIndex: (0,
|
4958
|
+
proofIndex: (0, import_math17.bn)(messageProof.proofIndex),
|
4979
4959
|
proofSet: messageProof.proofSet
|
4980
4960
|
},
|
4981
4961
|
blockProof: {
|
4982
|
-
proofIndex: (0,
|
4962
|
+
proofIndex: (0, import_math17.bn)(blockProof.proofIndex),
|
4983
4963
|
proofSet: blockProof.proofSet
|
4984
4964
|
},
|
4985
4965
|
messageBlockHeader: {
|
4986
4966
|
id: messageBlockHeader.id,
|
4987
|
-
daHeight: (0,
|
4967
|
+
daHeight: (0, import_math17.bn)(messageBlockHeader.daHeight),
|
4988
4968
|
transactionsCount: Number(messageBlockHeader.transactionsCount),
|
4989
4969
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4990
|
-
height: (0,
|
4970
|
+
height: (0, import_math17.bn)(messageBlockHeader.height),
|
4991
4971
|
prevRoot: messageBlockHeader.prevRoot,
|
4992
4972
|
time: messageBlockHeader.time,
|
4993
4973
|
applicationHash: messageBlockHeader.applicationHash,
|
@@ -4999,10 +4979,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4999
4979
|
},
|
5000
4980
|
commitBlockHeader: {
|
5001
4981
|
id: commitBlockHeader.id,
|
5002
|
-
daHeight: (0,
|
4982
|
+
daHeight: (0, import_math17.bn)(commitBlockHeader.daHeight),
|
5003
4983
|
transactionsCount: Number(commitBlockHeader.transactionsCount),
|
5004
4984
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
5005
|
-
height: (0,
|
4985
|
+
height: (0, import_math17.bn)(commitBlockHeader.height),
|
5006
4986
|
prevRoot: commitBlockHeader.prevRoot,
|
5007
4987
|
time: commitBlockHeader.time,
|
5008
4988
|
applicationHash: commitBlockHeader.applicationHash,
|
@@ -5015,19 +4995,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5015
4995
|
sender: import_address3.Address.fromAddressOrString(sender),
|
5016
4996
|
recipient: import_address3.Address.fromAddressOrString(recipient),
|
5017
4997
|
nonce,
|
5018
|
-
amount: (0,
|
4998
|
+
amount: (0, import_math17.bn)(amount),
|
5019
4999
|
data
|
5020
5000
|
};
|
5021
5001
|
}
|
5022
5002
|
async getLatestGasPrice() {
|
5023
5003
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
5024
|
-
return (0,
|
5004
|
+
return (0, import_math17.bn)(latestGasPrice.gasPrice);
|
5025
5005
|
}
|
5026
5006
|
async estimateGasPrice(blockHorizon) {
|
5027
5007
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
5028
5008
|
blockHorizon: String(blockHorizon)
|
5029
5009
|
});
|
5030
|
-
return (0,
|
5010
|
+
return (0, import_math17.bn)(estimateGasPrice.gasPrice);
|
5031
5011
|
}
|
5032
5012
|
/**
|
5033
5013
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -5048,10 +5028,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
5048
5028
|
*/
|
5049
5029
|
async produceBlocks(amount, startTime) {
|
5050
5030
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
5051
|
-
blocksToProduce: (0,
|
5031
|
+
blocksToProduce: (0, import_math17.bn)(amount).toString(10),
|
5052
5032
|
startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
|
5053
5033
|
});
|
5054
|
-
return (0,
|
5034
|
+
return (0, import_math17.bn)(latestBlockHeight);
|
5055
5035
|
}
|
5056
5036
|
// eslint-disable-next-line @typescript-eslint/require-await
|
5057
5037
|
async getTransactionResponse(transactionId) {
|
@@ -5097,7 +5077,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
5097
5077
|
|
5098
5078
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
5099
5079
|
var import_errors15 = require("@fuel-ts/errors");
|
5100
|
-
var
|
5080
|
+
var import_math18 = require("@fuel-ts/math");
|
5101
5081
|
var import_transactions21 = require("@fuel-ts/transactions");
|
5102
5082
|
var import_utils25 = require("@fuel-ts/utils");
|
5103
5083
|
async function getTransactionSummary(params) {
|
@@ -5134,8 +5114,8 @@ async function getTransactionSummary(params) {
|
|
5134
5114
|
transaction: decodedTransaction,
|
5135
5115
|
transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
|
5136
5116
|
gqlTransactionStatus: gqlTransaction.status,
|
5137
|
-
gasPerByte: (0,
|
5138
|
-
gasPriceFactor: (0,
|
5117
|
+
gasPerByte: (0, import_math18.bn)(gasPerByte),
|
5118
|
+
gasPriceFactor: (0, import_math18.bn)(gasPriceFactor),
|
5139
5119
|
abiMap,
|
5140
5120
|
maxInputs,
|
5141
5121
|
gasCosts,
|
@@ -5343,13 +5323,13 @@ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
|
|
5343
5323
|
|
5344
5324
|
// src/utils/formatTransferToContractScriptData.ts
|
5345
5325
|
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
5346
|
-
var
|
5326
|
+
var import_math19 = require("@fuel-ts/math");
|
5347
5327
|
var import_utils27 = require("@fuel-ts/utils");
|
5348
5328
|
var asm = __toESM(require("@fuels/vm-asm"));
|
5349
5329
|
var formatTransferToContractScriptData = (params) => {
|
5350
5330
|
const { assetId, amountToTransfer, hexlifiedContractId } = params;
|
5351
5331
|
const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
|
5352
|
-
const encoded = numberCoder.encode(new
|
5332
|
+
const encoded = numberCoder.encode(new import_math19.BN(amountToTransfer).toNumber());
|
5353
5333
|
const scriptData = Uint8Array.from([
|
5354
5334
|
...(0, import_utils27.arrayify)(hexlifiedContractId),
|
5355
5335
|
...encoded,
|
@@ -5544,9 +5524,9 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5544
5524
|
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
5545
5525
|
const fee = request.maxFee;
|
5546
5526
|
const baseAssetId = this.provider.getBaseAssetId();
|
5547
|
-
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0,
|
5527
|
+
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || (0, import_math20.bn)(0);
|
5548
5528
|
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
5549
|
-
amount: (0,
|
5529
|
+
amount: (0, import_math20.bn)(fee),
|
5550
5530
|
assetId: baseAssetId,
|
5551
5531
|
coinQuantities: requiredQuantities
|
5552
5532
|
});
|
@@ -5554,7 +5534,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5554
5534
|
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
5555
5535
|
quantitiesDict[assetId] = {
|
5556
5536
|
required: amount,
|
5557
|
-
owned: (0,
|
5537
|
+
owned: (0, import_math20.bn)(0)
|
5558
5538
|
};
|
5559
5539
|
});
|
5560
5540
|
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
@@ -5581,7 +5561,6 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5581
5561
|
cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
|
5582
5562
|
);
|
5583
5563
|
request.addResources(resources);
|
5584
|
-
request.shiftPredicateData();
|
5585
5564
|
request.updatePredicateGasUsed(estimatedPredicates);
|
5586
5565
|
const requestToReestimate2 = (0, import_ramda4.clone)(request);
|
5587
5566
|
if (addedSignatures) {
|
@@ -5613,7 +5592,6 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5613
5592
|
}
|
5614
5593
|
fundingAttempts += 1;
|
5615
5594
|
}
|
5616
|
-
request.shiftPredicateData();
|
5617
5595
|
request.updatePredicateGasUsed(estimatedPredicates);
|
5618
5596
|
const requestToReestimate = (0, import_ramda4.clone)(request);
|
5619
5597
|
if (addedSignatures) {
|
@@ -5664,7 +5642,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5664
5642
|
* @returns A promise that resolves to the transaction response.
|
5665
5643
|
*/
|
5666
5644
|
async transfer(destination, amount, assetId, txParams = {}) {
|
5667
|
-
if ((0,
|
5645
|
+
if ((0, import_math20.bn)(amount).lte(0)) {
|
5668
5646
|
throw new import_errors16.FuelError(
|
5669
5647
|
import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
5670
5648
|
"Transfer amount must be a positive number."
|
@@ -5684,7 +5662,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5684
5662
|
* @returns A promise that resolves to the transaction response.
|
5685
5663
|
*/
|
5686
5664
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
5687
|
-
if ((0,
|
5665
|
+
if ((0, import_math20.bn)(amount).lte(0)) {
|
5688
5666
|
throw new import_errors16.FuelError(
|
5689
5667
|
import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
|
5690
5668
|
"Transfer amount must be a positive number."
|
@@ -5694,7 +5672,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5694
5672
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
5695
5673
|
const { script, scriptData } = await assembleTransferToContractScript({
|
5696
5674
|
hexlifiedContractId: contractAddress.toB256(),
|
5697
|
-
amountToTransfer: (0,
|
5675
|
+
amountToTransfer: (0, import_math20.bn)(amount),
|
5698
5676
|
assetId: assetIdToTransfer
|
5699
5677
|
});
|
5700
5678
|
let request = new ScriptTransactionRequest({
|
@@ -5705,7 +5683,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5705
5683
|
request.addContractInputAndOutput(contractAddress);
|
5706
5684
|
const txCost = await this.provider.getTransactionCost(request, {
|
5707
5685
|
resourcesOwner: this,
|
5708
|
-
quantitiesToContract: [{ amount: (0,
|
5686
|
+
quantitiesToContract: [{ amount: (0, import_math20.bn)(amount), assetId: String(assetIdToTransfer) }]
|
5709
5687
|
});
|
5710
5688
|
request = this.validateGasLimitAndMaxFee({
|
5711
5689
|
transactionRequest: request,
|
@@ -5730,7 +5708,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5730
5708
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5731
5709
|
);
|
5732
5710
|
const amountDataArray = (0, import_utils28.arrayify)(
|
5733
|
-
"0x".concat((0,
|
5711
|
+
"0x".concat((0, import_math20.bn)(amount).toHex().substring(2).padStart(16, "0"))
|
5734
5712
|
);
|
5735
5713
|
const script = new Uint8Array([
|
5736
5714
|
...(0, import_utils28.arrayify)(withdrawScript.bytes),
|
@@ -5740,7 +5718,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5740
5718
|
const params = { script, ...txParams };
|
5741
5719
|
const baseAssetId = this.provider.getBaseAssetId();
|
5742
5720
|
let request = new ScriptTransactionRequest(params);
|
5743
|
-
const quantitiesToContract = [{ amount: (0,
|
5721
|
+
const quantitiesToContract = [{ amount: (0, import_math20.bn)(amount), assetId: baseAssetId }];
|
5744
5722
|
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
5745
5723
|
request = this.validateGasLimitAndMaxFee({
|
5746
5724
|
transactionRequest: request,
|
@@ -5841,7 +5819,7 @@ var import_utils31 = require("@fuel-ts/utils");
|
|
5841
5819
|
var import_address5 = require("@fuel-ts/address");
|
5842
5820
|
var import_crypto2 = require("@fuel-ts/crypto");
|
5843
5821
|
var import_hasher2 = require("@fuel-ts/hasher");
|
5844
|
-
var
|
5822
|
+
var import_math21 = require("@fuel-ts/math");
|
5845
5823
|
var import_utils29 = require("@fuel-ts/utils");
|
5846
5824
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
5847
5825
|
var Signer = class {
|
@@ -5861,7 +5839,7 @@ var Signer = class {
|
|
5861
5839
|
privateKey = `0x${privateKey}`;
|
5862
5840
|
}
|
5863
5841
|
}
|
5864
|
-
const privateKeyBytes = (0,
|
5842
|
+
const privateKeyBytes = (0, import_math21.toBytes)(privateKey, 32);
|
5865
5843
|
this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
|
5866
5844
|
this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
5867
5845
|
this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
|
@@ -5879,8 +5857,8 @@ var Signer = class {
|
|
5879
5857
|
*/
|
5880
5858
|
sign(data) {
|
5881
5859
|
const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
|
5882
|
-
const r = (0,
|
5883
|
-
const s = (0,
|
5860
|
+
const r = (0, import_math21.toBytes)(`0x${signature.r.toString(16)}`, 32);
|
5861
|
+
const s = (0, import_math21.toBytes)(`0x${signature.s.toString(16)}`, 32);
|
5884
5862
|
s[0] |= (signature.recovery || 0) << 7;
|
5885
5863
|
return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
|
5886
5864
|
}
|
@@ -6153,7 +6131,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
6153
6131
|
var import_crypto5 = require("@fuel-ts/crypto");
|
6154
6132
|
var import_errors20 = require("@fuel-ts/errors");
|
6155
6133
|
var import_hasher6 = require("@fuel-ts/hasher");
|
6156
|
-
var
|
6134
|
+
var import_math22 = require("@fuel-ts/math");
|
6157
6135
|
var import_utils35 = require("@fuel-ts/utils");
|
6158
6136
|
|
6159
6137
|
// src/mnemonic/mnemonic.ts
|
@@ -8617,13 +8595,13 @@ var HDWallet = class {
|
|
8617
8595
|
} else {
|
8618
8596
|
data.set((0, import_utils35.arrayify)(this.publicKey));
|
8619
8597
|
}
|
8620
|
-
data.set((0,
|
8598
|
+
data.set((0, import_math22.toBytes)(index, 4), 33);
|
8621
8599
|
const bytes = (0, import_utils35.arrayify)((0, import_crypto5.computeHmac)("sha512", chainCode, data));
|
8622
8600
|
const IL = bytes.slice(0, 32);
|
8623
8601
|
const IR = bytes.slice(32);
|
8624
8602
|
if (privateKey) {
|
8625
8603
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
8626
|
-
const ki = (0,
|
8604
|
+
const ki = (0, import_math22.bn)(IL).add(privateKey).mod(N).toBytes(32);
|
8627
8605
|
return new HDWallet({
|
8628
8606
|
privateKey: ki,
|
8629
8607
|
chainCode: IR,
|
@@ -8669,7 +8647,7 @@ var HDWallet = class {
|
|
8669
8647
|
const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
|
8670
8648
|
const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
|
8671
8649
|
const parentFingerprint = this.parentFingerprint;
|
8672
|
-
const index = (0,
|
8650
|
+
const index = (0, import_math22.toHex)(this.index, 4);
|
8673
8651
|
const chainCode = this.chainCode;
|
8674
8652
|
const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
|
8675
8653
|
const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
|
@@ -8689,7 +8667,7 @@ var HDWallet = class {
|
|
8689
8667
|
});
|
8690
8668
|
}
|
8691
8669
|
static fromExtendedKey(extendedKey) {
|
8692
|
-
const decoded = (0, import_utils35.hexlify)((0,
|
8670
|
+
const decoded = (0, import_utils35.hexlify)((0, import_math22.toBytes)((0, import_utils35.decodeBase58)(extendedKey)));
|
8693
8671
|
const bytes = (0, import_utils35.arrayify)(decoded);
|
8694
8672
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
8695
8673
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
@@ -9305,7 +9283,6 @@ var StorageAbstract = class {
|
|
9305
9283
|
var import_abi_coder7 = require("@fuel-ts/abi-coder");
|
9306
9284
|
var import_address10 = require("@fuel-ts/address");
|
9307
9285
|
var import_errors25 = require("@fuel-ts/errors");
|
9308
|
-
var import_transactions22 = require("@fuel-ts/transactions");
|
9309
9286
|
var import_utils37 = require("@fuel-ts/utils");
|
9310
9287
|
|
9311
9288
|
// src/predicate/utils/getPredicateRoot.ts
|
@@ -9363,7 +9340,6 @@ var Predicate = class extends Account {
|
|
9363
9340
|
*/
|
9364
9341
|
populateTransactionPredicateData(transactionRequestLike) {
|
9365
9342
|
const request = transactionRequestify(transactionRequestLike);
|
9366
|
-
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
9367
9343
|
const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
|
9368
9344
|
if (placeholderIndex !== -1) {
|
9369
9345
|
request.removeWitness(placeholderIndex);
|
@@ -9371,7 +9347,7 @@ var Predicate = class extends Account {
|
|
9371
9347
|
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
9372
9348
|
if (isRequestInputResourceFromOwner(input, this.address)) {
|
9373
9349
|
input.predicate = (0, import_utils37.hexlify)(this.bytes);
|
9374
|
-
input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData(
|
9350
|
+
input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData());
|
9375
9351
|
input.witnessIndex = 0;
|
9376
9352
|
}
|
9377
9353
|
});
|
@@ -9397,17 +9373,12 @@ var Predicate = class extends Account {
|
|
9397
9373
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9398
9374
|
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
|
9399
9375
|
}
|
9400
|
-
getPredicateData(
|
9376
|
+
getPredicateData() {
|
9401
9377
|
if (!this.predicateData.length) {
|
9402
9378
|
return new Uint8Array();
|
9403
9379
|
}
|
9404
9380
|
const mainFn = this.interface?.functions.main;
|
9405
|
-
|
9406
|
-
const VM_TX_MEMORY = (0, import_abi_coder7.calculateVmTxMemory)({
|
9407
|
-
maxInputs: this.provider.getChain().consensusParameters.txParameters.maxInputs.toNumber()
|
9408
|
-
});
|
9409
|
-
const OFFSET = VM_TX_MEMORY + import_abi_coder7.SCRIPT_FIXED_SIZE + import_abi_coder7.INPUT_COIN_FIXED_SIZE + import_abi_coder7.WORD_SIZE + paddedCode.byteLength + policiesLength * import_abi_coder7.WORD_SIZE;
|
9410
|
-
return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
|
9381
|
+
return mainFn?.encodeArguments(this.predicateData) || new Uint8Array();
|
9411
9382
|
}
|
9412
9383
|
/**
|
9413
9384
|
* Processes the predicate data and returns the altered bytecode and interface.
|
@@ -9456,8 +9427,7 @@ var Predicate = class extends Account {
|
|
9456
9427
|
);
|
9457
9428
|
return resources.map((resource) => ({
|
9458
9429
|
...resource,
|
9459
|
-
predicate: (0, import_utils37.hexlify)(this.bytes)
|
9460
|
-
padPredicateData: (policiesLength) => (0, import_utils37.hexlify)(this.getPredicateData(policiesLength))
|
9430
|
+
predicate: (0, import_utils37.hexlify)(this.bytes)
|
9461
9431
|
}));
|
9462
9432
|
}
|
9463
9433
|
/**
|