@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/test-utils.mjs
CHANGED
@@ -26,7 +26,7 @@ import { hexlify as hexlify15 } from "@fuel-ts/utils";
|
|
26
26
|
import { Address as Address3 } from "@fuel-ts/address";
|
27
27
|
import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
|
28
28
|
import { AbstractAccount } from "@fuel-ts/interfaces";
|
29
|
-
import { bn as
|
29
|
+
import { bn as bn19 } from "@fuel-ts/math";
|
30
30
|
import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
|
31
31
|
import { clone as clone4 } from "ramda";
|
32
32
|
|
@@ -68,7 +68,7 @@ var addAmountToCoinQuantities = (params) => {
|
|
68
68
|
// src/providers/provider.ts
|
69
69
|
import { Address as Address2 } from "@fuel-ts/address";
|
70
70
|
import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
|
71
|
-
import { BN, bn as
|
71
|
+
import { BN, bn as bn17 } from "@fuel-ts/math";
|
72
72
|
import {
|
73
73
|
InputType as InputType7,
|
74
74
|
TransactionType as TransactionType8,
|
@@ -2282,15 +2282,6 @@ var BaseTransactionRequest = class {
|
|
2282
2282
|
}
|
2283
2283
|
});
|
2284
2284
|
}
|
2285
|
-
shiftPredicateData() {
|
2286
|
-
this.inputs.forEach((input) => {
|
2287
|
-
if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
|
2288
|
-
input.predicateData = input.padPredicateData(
|
2289
|
-
BaseTransactionRequest.getPolicyMeta(this).policies.length
|
2290
|
-
);
|
2291
|
-
}
|
2292
|
-
});
|
2293
|
-
}
|
2294
2285
|
};
|
2295
2286
|
|
2296
2287
|
// src/providers/transaction-request/create-transaction-request.ts
|
@@ -2713,12 +2704,12 @@ var transactionRequestify = (obj) => {
|
|
2713
2704
|
|
2714
2705
|
// src/providers/transaction-response/transaction-response.ts
|
2715
2706
|
import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
|
2716
|
-
import { bn as
|
2707
|
+
import { bn as bn16 } from "@fuel-ts/math";
|
2717
2708
|
import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
|
2718
2709
|
import { arrayify as arrayify10 } from "@fuel-ts/utils";
|
2719
2710
|
|
2720
2711
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2721
|
-
import { bn as
|
2712
|
+
import { bn as bn15 } from "@fuel-ts/math";
|
2722
2713
|
import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
|
2723
2714
|
import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
|
2724
2715
|
|
@@ -2795,43 +2786,32 @@ var calculateTXFeeForSummary = (params) => {
|
|
2795
2786
|
// src/providers/transaction-summary/operations.ts
|
2796
2787
|
import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
|
2797
2788
|
import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
|
2798
|
-
import { bn as
|
2789
|
+
import { bn as bn13 } from "@fuel-ts/math";
|
2799
2790
|
import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
|
2800
2791
|
|
2801
2792
|
// src/providers/transaction-summary/call.ts
|
2802
|
-
import { Interface as Interface2
|
2803
|
-
|
2804
|
-
var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
2793
|
+
import { Interface as Interface2 } from "@fuel-ts/abi-coder";
|
2794
|
+
var getFunctionCall = ({ abi, receipt }) => {
|
2805
2795
|
const abiInterface = new Interface2(abi);
|
2806
2796
|
const callFunctionSelector = receipt.param1.toHex(8);
|
2807
2797
|
const functionFragment = abiInterface.getFunction(callFunctionSelector);
|
2808
2798
|
const inputs = functionFragment.jsonFn.inputs;
|
2809
|
-
|
2810
|
-
if (functionFragment.isInputDataPointer) {
|
2811
|
-
if (rawPayload) {
|
2812
|
-
const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
|
2813
|
-
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
2814
|
-
}
|
2815
|
-
} else {
|
2816
|
-
encodedArgs = receipt.param2.toHex();
|
2817
|
-
}
|
2799
|
+
const encodedArgs = receipt.param2.toHex();
|
2818
2800
|
let argumentsProvided;
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
}, {});
|
2834
|
-
}
|
2801
|
+
const data = functionFragment.decodeArguments(encodedArgs);
|
2802
|
+
if (data) {
|
2803
|
+
argumentsProvided = inputs.reduce((prev, input, index) => {
|
2804
|
+
const value = data[index];
|
2805
|
+
const name = input.name;
|
2806
|
+
if (name) {
|
2807
|
+
return {
|
2808
|
+
...prev,
|
2809
|
+
// reparse to remove bn
|
2810
|
+
[name]: JSON.parse(JSON.stringify(value))
|
2811
|
+
};
|
2812
|
+
}
|
2813
|
+
return prev;
|
2814
|
+
}, {});
|
2835
2815
|
}
|
2836
2816
|
const call = {
|
2837
2817
|
functionSignature: functionFragment.signature,
|
@@ -2971,7 +2951,7 @@ var mergeAssets = (op1, op2) => {
|
|
2971
2951
|
if (!matchingAsset) {
|
2972
2952
|
return asset1;
|
2973
2953
|
}
|
2974
|
-
const mergedAmount =
|
2954
|
+
const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
|
2975
2955
|
return { ...asset1, amount: mergedAmount };
|
2976
2956
|
});
|
2977
2957
|
return mergedAssets.concat(filteredAssets);
|
@@ -3294,7 +3274,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
|
|
3294
3274
|
|
3295
3275
|
// src/providers/transaction-summary/status.ts
|
3296
3276
|
import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
|
3297
|
-
import { bn as
|
3277
|
+
import { bn as bn14 } from "@fuel-ts/math";
|
3298
3278
|
var getTransactionStatusName = (gqlStatus) => {
|
3299
3279
|
switch (gqlStatus) {
|
3300
3280
|
case "FailureStatus":
|
@@ -3328,15 +3308,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
|
|
3328
3308
|
time = gqlTransactionStatus.time;
|
3329
3309
|
blockId = gqlTransactionStatus.block.id;
|
3330
3310
|
isStatusSuccess = true;
|
3331
|
-
totalFee =
|
3332
|
-
totalGas =
|
3311
|
+
totalFee = bn14(gqlTransactionStatus.totalFee);
|
3312
|
+
totalGas = bn14(gqlTransactionStatus.totalGas);
|
3333
3313
|
break;
|
3334
3314
|
case "FailureStatus":
|
3335
3315
|
time = gqlTransactionStatus.time;
|
3336
3316
|
blockId = gqlTransactionStatus.block.id;
|
3337
3317
|
isStatusFailure = true;
|
3338
|
-
totalFee =
|
3339
|
-
totalGas =
|
3318
|
+
totalFee = bn14(gqlTransactionStatus.totalFee);
|
3319
|
+
totalGas = bn14(gqlTransactionStatus.totalGas);
|
3340
3320
|
break;
|
3341
3321
|
case "SubmittedStatus":
|
3342
3322
|
time = gqlTransactionStatus.time;
|
@@ -3386,7 +3366,7 @@ function assembleTransactionSummary(params) {
|
|
3386
3366
|
maxInputs
|
3387
3367
|
});
|
3388
3368
|
const typeName = getTransactionTypeName(transaction.type);
|
3389
|
-
const tip =
|
3369
|
+
const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
|
3390
3370
|
const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
|
3391
3371
|
const fee = calculateTXFeeForSummary({
|
3392
3372
|
totalFee,
|
@@ -3457,7 +3437,7 @@ var TransactionResponse = class {
|
|
3457
3437
|
/** Current provider */
|
3458
3438
|
provider;
|
3459
3439
|
/** Gas used on the transaction */
|
3460
|
-
gasUsed =
|
3440
|
+
gasUsed = bn16(0);
|
3461
3441
|
/** The graphql Transaction with receipts object. */
|
3462
3442
|
gqlTransaction;
|
3463
3443
|
abis;
|
@@ -3691,47 +3671,47 @@ var processGqlChain = (chain) => {
|
|
3691
3671
|
} = consensusParameters;
|
3692
3672
|
return {
|
3693
3673
|
name,
|
3694
|
-
baseChainHeight:
|
3674
|
+
baseChainHeight: bn17(daHeight),
|
3695
3675
|
consensusParameters: {
|
3696
3676
|
version,
|
3697
|
-
chainId:
|
3677
|
+
chainId: bn17(chainId),
|
3698
3678
|
baseAssetId,
|
3699
3679
|
feeParameters: {
|
3700
3680
|
version: feeParams.version,
|
3701
|
-
gasPerByte:
|
3702
|
-
gasPriceFactor:
|
3681
|
+
gasPerByte: bn17(feeParams.gasPerByte),
|
3682
|
+
gasPriceFactor: bn17(feeParams.gasPriceFactor)
|
3703
3683
|
},
|
3704
3684
|
contractParameters: {
|
3705
3685
|
version: contractParams.version,
|
3706
|
-
contractMaxSize:
|
3707
|
-
maxStorageSlots:
|
3686
|
+
contractMaxSize: bn17(contractParams.contractMaxSize),
|
3687
|
+
maxStorageSlots: bn17(contractParams.maxStorageSlots)
|
3708
3688
|
},
|
3709
3689
|
txParameters: {
|
3710
3690
|
version: txParams.version,
|
3711
|
-
maxInputs:
|
3712
|
-
maxOutputs:
|
3713
|
-
maxWitnesses:
|
3714
|
-
maxGasPerTx:
|
3715
|
-
maxSize:
|
3716
|
-
maxBytecodeSubsections:
|
3691
|
+
maxInputs: bn17(txParams.maxInputs),
|
3692
|
+
maxOutputs: bn17(txParams.maxOutputs),
|
3693
|
+
maxWitnesses: bn17(txParams.maxWitnesses),
|
3694
|
+
maxGasPerTx: bn17(txParams.maxGasPerTx),
|
3695
|
+
maxSize: bn17(txParams.maxSize),
|
3696
|
+
maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
|
3717
3697
|
},
|
3718
3698
|
predicateParameters: {
|
3719
3699
|
version: predicateParams.version,
|
3720
|
-
maxPredicateLength:
|
3721
|
-
maxPredicateDataLength:
|
3722
|
-
maxGasPerPredicate:
|
3723
|
-
maxMessageDataLength:
|
3700
|
+
maxPredicateLength: bn17(predicateParams.maxPredicateLength),
|
3701
|
+
maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
|
3702
|
+
maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
|
3703
|
+
maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
|
3724
3704
|
},
|
3725
3705
|
scriptParameters: {
|
3726
3706
|
version: scriptParams.version,
|
3727
|
-
maxScriptLength:
|
3728
|
-
maxScriptDataLength:
|
3707
|
+
maxScriptLength: bn17(scriptParams.maxScriptLength),
|
3708
|
+
maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
|
3729
3709
|
},
|
3730
3710
|
gasCosts
|
3731
3711
|
},
|
3732
3712
|
latestBlock: {
|
3733
3713
|
id: latestBlock.id,
|
3734
|
-
height:
|
3714
|
+
height: bn17(latestBlock.height),
|
3735
3715
|
time: latestBlock.header.time,
|
3736
3716
|
transactions: latestBlock.transactions.map((i) => ({
|
3737
3717
|
id: i.id
|
@@ -3927,7 +3907,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3927
3907
|
*/
|
3928
3908
|
async getBlockNumber() {
|
3929
3909
|
const { chain } = await this.operations.getChain();
|
3930
|
-
return
|
3910
|
+
return bn17(chain.latestBlock.height, 10);
|
3931
3911
|
}
|
3932
3912
|
/**
|
3933
3913
|
* Returns the chain information.
|
@@ -3937,8 +3917,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
3937
3917
|
async fetchNode() {
|
3938
3918
|
const { nodeInfo } = await this.operations.getNodeInfo();
|
3939
3919
|
const processedNodeInfo = {
|
3940
|
-
maxDepth:
|
3941
|
-
maxTx:
|
3920
|
+
maxDepth: bn17(nodeInfo.maxDepth),
|
3921
|
+
maxTx: bn17(nodeInfo.maxTx),
|
3942
3922
|
nodeVersion: nodeInfo.nodeVersion,
|
3943
3923
|
utxoValidation: nodeInfo.utxoValidation,
|
3944
3924
|
vmBacktrace: nodeInfo.vmBacktrace
|
@@ -4070,7 +4050,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4070
4050
|
} = response;
|
4071
4051
|
if (inputs) {
|
4072
4052
|
inputs.forEach((input, index) => {
|
4073
|
-
if ("predicateGasUsed" in input &&
|
4053
|
+
if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
|
4074
4054
|
transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
|
4075
4055
|
}
|
4076
4056
|
});
|
@@ -4228,12 +4208,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4228
4208
|
gasPrice = await this.estimateGasPrice(10);
|
4229
4209
|
}
|
4230
4210
|
const minFee = calculateGasFee({
|
4231
|
-
gasPrice:
|
4211
|
+
gasPrice: bn17(gasPrice),
|
4232
4212
|
gas: minGas,
|
4233
4213
|
priceFactor: gasPriceFactor,
|
4234
4214
|
tip: transactionRequest.tip
|
4235
4215
|
}).add(1);
|
4236
|
-
let gasLimit =
|
4216
|
+
let gasLimit = bn17(0);
|
4237
4217
|
if (transactionRequest.type === TransactionType8.Script) {
|
4238
4218
|
gasLimit = transactionRequest.gasLimit;
|
4239
4219
|
if (transactionRequest.gasLimit.eq(0)) {
|
@@ -4246,7 +4226,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4246
4226
|
}
|
4247
4227
|
const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
|
4248
4228
|
const maxFee = calculateGasFee({
|
4249
|
-
gasPrice:
|
4229
|
+
gasPrice: bn17(gasPrice),
|
4250
4230
|
gas: maxGas,
|
4251
4231
|
priceFactor: gasPriceFactor,
|
4252
4232
|
tip: transactionRequest.tip
|
@@ -4311,7 +4291,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4311
4291
|
const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
|
4312
4292
|
txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
|
4313
4293
|
if (isScriptTransaction) {
|
4314
|
-
txRequestClone.gasLimit =
|
4294
|
+
txRequestClone.gasLimit = bn17(0);
|
4315
4295
|
}
|
4316
4296
|
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4317
4297
|
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
@@ -4332,7 +4312,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4332
4312
|
let dryRunStatus;
|
4333
4313
|
let missingContractIds = [];
|
4334
4314
|
let outputVariables = 0;
|
4335
|
-
let gasUsed =
|
4315
|
+
let gasUsed = bn17(0);
|
4336
4316
|
txRequestClone.maxFee = maxFee;
|
4337
4317
|
if (isScriptTransaction) {
|
4338
4318
|
txRequestClone.gasLimit = gasLimit;
|
@@ -4397,10 +4377,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4397
4377
|
return coins.map((coin) => ({
|
4398
4378
|
id: coin.utxoId,
|
4399
4379
|
assetId: coin.assetId,
|
4400
|
-
amount:
|
4380
|
+
amount: bn17(coin.amount),
|
4401
4381
|
owner: Address2.fromAddressOrString(coin.owner),
|
4402
|
-
blockCreated:
|
4403
|
-
txCreatedIdx:
|
4382
|
+
blockCreated: bn17(coin.blockCreated),
|
4383
|
+
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4404
4384
|
}));
|
4405
4385
|
}
|
4406
4386
|
/**
|
@@ -4437,9 +4417,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4437
4417
|
switch (coin.type) {
|
4438
4418
|
case "MessageCoin":
|
4439
4419
|
return {
|
4440
|
-
amount:
|
4420
|
+
amount: bn17(coin.amount),
|
4441
4421
|
assetId: coin.assetId,
|
4442
|
-
daHeight:
|
4422
|
+
daHeight: bn17(coin.daHeight),
|
4443
4423
|
sender: Address2.fromAddressOrString(coin.sender),
|
4444
4424
|
recipient: Address2.fromAddressOrString(coin.recipient),
|
4445
4425
|
nonce: coin.nonce
|
@@ -4447,11 +4427,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4447
4427
|
case "Coin":
|
4448
4428
|
return {
|
4449
4429
|
id: coin.utxoId,
|
4450
|
-
amount:
|
4430
|
+
amount: bn17(coin.amount),
|
4451
4431
|
assetId: coin.assetId,
|
4452
4432
|
owner: Address2.fromAddressOrString(coin.owner),
|
4453
|
-
blockCreated:
|
4454
|
-
txCreatedIdx:
|
4433
|
+
blockCreated: bn17(coin.blockCreated),
|
4434
|
+
txCreatedIdx: bn17(coin.txCreatedIdx)
|
4455
4435
|
};
|
4456
4436
|
default:
|
4457
4437
|
return null;
|
@@ -4468,13 +4448,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4468
4448
|
async getBlock(idOrHeight) {
|
4469
4449
|
let variables;
|
4470
4450
|
if (typeof idOrHeight === "number") {
|
4471
|
-
variables = { height:
|
4451
|
+
variables = { height: bn17(idOrHeight).toString(10) };
|
4472
4452
|
} else if (idOrHeight === "latest") {
|
4473
4453
|
variables = { height: (await this.getBlockNumber()).toString(10) };
|
4474
4454
|
} else if (idOrHeight.length === 66) {
|
4475
4455
|
variables = { blockId: idOrHeight };
|
4476
4456
|
} else {
|
4477
|
-
variables = { blockId:
|
4457
|
+
variables = { blockId: bn17(idOrHeight).toString(10) };
|
4478
4458
|
}
|
4479
4459
|
const { block } = await this.operations.getBlock(variables);
|
4480
4460
|
if (!block) {
|
@@ -4482,7 +4462,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4482
4462
|
}
|
4483
4463
|
return {
|
4484
4464
|
id: block.id,
|
4485
|
-
height:
|
4465
|
+
height: bn17(block.height),
|
4486
4466
|
time: block.header.time,
|
4487
4467
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4488
4468
|
};
|
@@ -4497,7 +4477,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4497
4477
|
const { blocks: fetchedData } = await this.operations.getBlocks(params);
|
4498
4478
|
const blocks = fetchedData.edges.map(({ node: block }) => ({
|
4499
4479
|
id: block.id,
|
4500
|
-
height:
|
4480
|
+
height: bn17(block.height),
|
4501
4481
|
time: block.header.time,
|
4502
4482
|
transactionIds: block.transactions.map((tx) => tx.id)
|
4503
4483
|
}));
|
@@ -4512,7 +4492,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4512
4492
|
async getBlockWithTransactions(idOrHeight) {
|
4513
4493
|
let variables;
|
4514
4494
|
if (typeof idOrHeight === "number") {
|
4515
|
-
variables = { blockHeight:
|
4495
|
+
variables = { blockHeight: bn17(idOrHeight).toString(10) };
|
4516
4496
|
} else if (idOrHeight === "latest") {
|
4517
4497
|
variables = { blockHeight: (await this.getBlockNumber()).toString() };
|
4518
4498
|
} else {
|
@@ -4524,7 +4504,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4524
4504
|
}
|
4525
4505
|
return {
|
4526
4506
|
id: block.id,
|
4527
|
-
height:
|
4507
|
+
height: bn17(block.height, 10),
|
4528
4508
|
time: block.header.time,
|
4529
4509
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4530
4510
|
transactions: block.transactions.map(
|
@@ -4573,7 +4553,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4573
4553
|
contract: Address2.fromAddressOrString(contractId).toB256(),
|
4574
4554
|
asset: hexlify12(assetId)
|
4575
4555
|
});
|
4576
|
-
return
|
4556
|
+
return bn17(contractBalance.amount, 10);
|
4577
4557
|
}
|
4578
4558
|
/**
|
4579
4559
|
* Returns the balance for the given owner for the given asset ID.
|
@@ -4587,7 +4567,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4587
4567
|
owner: Address2.fromAddressOrString(owner).toB256(),
|
4588
4568
|
assetId: hexlify12(assetId)
|
4589
4569
|
});
|
4590
|
-
return
|
4570
|
+
return bn17(balance.amount, 10);
|
4591
4571
|
}
|
4592
4572
|
/**
|
4593
4573
|
* Returns balances for the given owner.
|
@@ -4605,7 +4585,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4605
4585
|
const balances = result.balances.edges.map((edge) => edge.node);
|
4606
4586
|
return balances.map((balance) => ({
|
4607
4587
|
assetId: balance.assetId,
|
4608
|
-
amount:
|
4588
|
+
amount: bn17(balance.amount)
|
4609
4589
|
}));
|
4610
4590
|
}
|
4611
4591
|
/**
|
@@ -4627,15 +4607,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4627
4607
|
sender: message.sender,
|
4628
4608
|
recipient: message.recipient,
|
4629
4609
|
nonce: message.nonce,
|
4630
|
-
amount:
|
4610
|
+
amount: bn17(message.amount),
|
4631
4611
|
data: message.data
|
4632
4612
|
}),
|
4633
4613
|
sender: Address2.fromAddressOrString(message.sender),
|
4634
4614
|
recipient: Address2.fromAddressOrString(message.recipient),
|
4635
4615
|
nonce: message.nonce,
|
4636
|
-
amount:
|
4616
|
+
amount: bn17(message.amount),
|
4637
4617
|
data: InputMessageCoder.decodeData(message.data),
|
4638
|
-
daHeight:
|
4618
|
+
daHeight: bn17(message.daHeight)
|
4639
4619
|
}));
|
4640
4620
|
}
|
4641
4621
|
/**
|
@@ -4688,19 +4668,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4688
4668
|
} = result.messageProof;
|
4689
4669
|
return {
|
4690
4670
|
messageProof: {
|
4691
|
-
proofIndex:
|
4671
|
+
proofIndex: bn17(messageProof.proofIndex),
|
4692
4672
|
proofSet: messageProof.proofSet
|
4693
4673
|
},
|
4694
4674
|
blockProof: {
|
4695
|
-
proofIndex:
|
4675
|
+
proofIndex: bn17(blockProof.proofIndex),
|
4696
4676
|
proofSet: blockProof.proofSet
|
4697
4677
|
},
|
4698
4678
|
messageBlockHeader: {
|
4699
4679
|
id: messageBlockHeader.id,
|
4700
|
-
daHeight:
|
4680
|
+
daHeight: bn17(messageBlockHeader.daHeight),
|
4701
4681
|
transactionsCount: Number(messageBlockHeader.transactionsCount),
|
4702
4682
|
transactionsRoot: messageBlockHeader.transactionsRoot,
|
4703
|
-
height:
|
4683
|
+
height: bn17(messageBlockHeader.height),
|
4704
4684
|
prevRoot: messageBlockHeader.prevRoot,
|
4705
4685
|
time: messageBlockHeader.time,
|
4706
4686
|
applicationHash: messageBlockHeader.applicationHash,
|
@@ -4712,10 +4692,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4712
4692
|
},
|
4713
4693
|
commitBlockHeader: {
|
4714
4694
|
id: commitBlockHeader.id,
|
4715
|
-
daHeight:
|
4695
|
+
daHeight: bn17(commitBlockHeader.daHeight),
|
4716
4696
|
transactionsCount: Number(commitBlockHeader.transactionsCount),
|
4717
4697
|
transactionsRoot: commitBlockHeader.transactionsRoot,
|
4718
|
-
height:
|
4698
|
+
height: bn17(commitBlockHeader.height),
|
4719
4699
|
prevRoot: commitBlockHeader.prevRoot,
|
4720
4700
|
time: commitBlockHeader.time,
|
4721
4701
|
applicationHash: commitBlockHeader.applicationHash,
|
@@ -4728,19 +4708,19 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4728
4708
|
sender: Address2.fromAddressOrString(sender),
|
4729
4709
|
recipient: Address2.fromAddressOrString(recipient),
|
4730
4710
|
nonce,
|
4731
|
-
amount:
|
4711
|
+
amount: bn17(amount),
|
4732
4712
|
data
|
4733
4713
|
};
|
4734
4714
|
}
|
4735
4715
|
async getLatestGasPrice() {
|
4736
4716
|
const { latestGasPrice } = await this.operations.getLatestGasPrice();
|
4737
|
-
return
|
4717
|
+
return bn17(latestGasPrice.gasPrice);
|
4738
4718
|
}
|
4739
4719
|
async estimateGasPrice(blockHorizon) {
|
4740
4720
|
const { estimateGasPrice } = await this.operations.estimateGasPrice({
|
4741
4721
|
blockHorizon: String(blockHorizon)
|
4742
4722
|
});
|
4743
|
-
return
|
4723
|
+
return bn17(estimateGasPrice.gasPrice);
|
4744
4724
|
}
|
4745
4725
|
/**
|
4746
4726
|
* Returns Message Proof for given transaction id and the message id from MessageOut receipt.
|
@@ -4761,10 +4741,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4761
4741
|
*/
|
4762
4742
|
async produceBlocks(amount, startTime) {
|
4763
4743
|
const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
|
4764
|
-
blocksToProduce:
|
4744
|
+
blocksToProduce: bn17(amount).toString(10),
|
4765
4745
|
startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
|
4766
4746
|
});
|
4767
|
-
return
|
4747
|
+
return bn17(latestBlockHeight);
|
4768
4748
|
}
|
4769
4749
|
// eslint-disable-next-line @typescript-eslint/require-await
|
4770
4750
|
async getTransactionResponse(transactionId) {
|
@@ -4810,7 +4790,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4810
4790
|
|
4811
4791
|
// src/providers/transaction-summary/get-transaction-summary.ts
|
4812
4792
|
import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
|
4813
|
-
import { bn as
|
4793
|
+
import { bn as bn18 } from "@fuel-ts/math";
|
4814
4794
|
import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
|
4815
4795
|
import { arrayify as arrayify12 } from "@fuel-ts/utils";
|
4816
4796
|
|
@@ -5088,9 +5068,9 @@ var Account = class extends AbstractAccount {
|
|
5088
5068
|
const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
|
5089
5069
|
const fee = request.maxFee;
|
5090
5070
|
const baseAssetId = this.provider.getBaseAssetId();
|
5091
|
-
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount ||
|
5071
|
+
const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn19(0);
|
5092
5072
|
const requiredQuantitiesWithFee = addAmountToCoinQuantities({
|
5093
|
-
amount:
|
5073
|
+
amount: bn19(fee),
|
5094
5074
|
assetId: baseAssetId,
|
5095
5075
|
coinQuantities: requiredQuantities
|
5096
5076
|
});
|
@@ -5098,7 +5078,7 @@ var Account = class extends AbstractAccount {
|
|
5098
5078
|
requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
|
5099
5079
|
quantitiesDict[assetId] = {
|
5100
5080
|
required: amount,
|
5101
|
-
owned:
|
5081
|
+
owned: bn19(0)
|
5102
5082
|
};
|
5103
5083
|
});
|
5104
5084
|
request.inputs.filter(isRequestInputResource).forEach((input) => {
|
@@ -5125,7 +5105,6 @@ var Account = class extends AbstractAccount {
|
|
5125
5105
|
cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
|
5126
5106
|
);
|
5127
5107
|
request.addResources(resources);
|
5128
|
-
request.shiftPredicateData();
|
5129
5108
|
request.updatePredicateGasUsed(estimatedPredicates);
|
5130
5109
|
const requestToReestimate2 = clone4(request);
|
5131
5110
|
if (addedSignatures) {
|
@@ -5157,7 +5136,6 @@ var Account = class extends AbstractAccount {
|
|
5157
5136
|
}
|
5158
5137
|
fundingAttempts += 1;
|
5159
5138
|
}
|
5160
|
-
request.shiftPredicateData();
|
5161
5139
|
request.updatePredicateGasUsed(estimatedPredicates);
|
5162
5140
|
const requestToReestimate = clone4(request);
|
5163
5141
|
if (addedSignatures) {
|
@@ -5208,7 +5186,7 @@ var Account = class extends AbstractAccount {
|
|
5208
5186
|
* @returns A promise that resolves to the transaction response.
|
5209
5187
|
*/
|
5210
5188
|
async transfer(destination, amount, assetId, txParams = {}) {
|
5211
|
-
if (
|
5189
|
+
if (bn19(amount).lte(0)) {
|
5212
5190
|
throw new FuelError15(
|
5213
5191
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5214
5192
|
"Transfer amount must be a positive number."
|
@@ -5228,7 +5206,7 @@ var Account = class extends AbstractAccount {
|
|
5228
5206
|
* @returns A promise that resolves to the transaction response.
|
5229
5207
|
*/
|
5230
5208
|
async transferToContract(contractId, amount, assetId, txParams = {}) {
|
5231
|
-
if (
|
5209
|
+
if (bn19(amount).lte(0)) {
|
5232
5210
|
throw new FuelError15(
|
5233
5211
|
ErrorCode15.INVALID_TRANSFER_AMOUNT,
|
5234
5212
|
"Transfer amount must be a positive number."
|
@@ -5238,7 +5216,7 @@ var Account = class extends AbstractAccount {
|
|
5238
5216
|
const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
|
5239
5217
|
const { script, scriptData } = await assembleTransferToContractScript({
|
5240
5218
|
hexlifiedContractId: contractAddress.toB256(),
|
5241
|
-
amountToTransfer:
|
5219
|
+
amountToTransfer: bn19(amount),
|
5242
5220
|
assetId: assetIdToTransfer
|
5243
5221
|
});
|
5244
5222
|
let request = new ScriptTransactionRequest({
|
@@ -5249,7 +5227,7 @@ var Account = class extends AbstractAccount {
|
|
5249
5227
|
request.addContractInputAndOutput(contractAddress);
|
5250
5228
|
const txCost = await this.provider.getTransactionCost(request, {
|
5251
5229
|
resourcesOwner: this,
|
5252
|
-
quantitiesToContract: [{ amount:
|
5230
|
+
quantitiesToContract: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
|
5253
5231
|
});
|
5254
5232
|
request = this.validateGasLimitAndMaxFee({
|
5255
5233
|
transactionRequest: request,
|
@@ -5274,7 +5252,7 @@ var Account = class extends AbstractAccount {
|
|
5274
5252
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
5275
5253
|
);
|
5276
5254
|
const amountDataArray = arrayify14(
|
5277
|
-
"0x".concat(
|
5255
|
+
"0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
|
5278
5256
|
);
|
5279
5257
|
const script = new Uint8Array([
|
5280
5258
|
...arrayify14(withdrawScript.bytes),
|
@@ -5284,7 +5262,7 @@ var Account = class extends AbstractAccount {
|
|
5284
5262
|
const params = { script, ...txParams };
|
5285
5263
|
const baseAssetId = this.provider.getBaseAssetId();
|
5286
5264
|
let request = new ScriptTransactionRequest(params);
|
5287
|
-
const quantitiesToContract = [{ amount:
|
5265
|
+
const quantitiesToContract = [{ amount: bn19(amount), assetId: baseAssetId }];
|
5288
5266
|
const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
|
5289
5267
|
request = this.validateGasLimitAndMaxFee({
|
5290
5268
|
transactionRequest: request,
|
@@ -5701,7 +5679,7 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
5701
5679
|
import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
|
5702
5680
|
import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
|
5703
5681
|
import { sha256 as sha2564 } from "@fuel-ts/hasher";
|
5704
|
-
import { bn as
|
5682
|
+
import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
|
5705
5683
|
import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
|
5706
5684
|
|
5707
5685
|
// src/mnemonic/mnemonic.ts
|
@@ -8165,7 +8143,7 @@ var HDWallet = class {
|
|
8165
8143
|
const IR = bytes.slice(32);
|
8166
8144
|
if (privateKey) {
|
8167
8145
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
8168
|
-
const ki =
|
8146
|
+
const ki = bn20(IL).add(privateKey).mod(N).toBytes(32);
|
8169
8147
|
return new HDWallet({
|
8170
8148
|
privateKey: ki,
|
8171
8149
|
chainCode: IR,
|
@@ -8506,7 +8484,6 @@ var launchNode = async ({
|
|
8506
8484
|
ip,
|
8507
8485
|
port,
|
8508
8486
|
args = [],
|
8509
|
-
fuelCorePath = void 0,
|
8510
8487
|
useSystemFuelCore = false,
|
8511
8488
|
loggingEnabled = true,
|
8512
8489
|
debugEnabled = false,
|
@@ -8527,7 +8504,7 @@ var launchNode = async ({
|
|
8527
8504
|
const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
|
8528
8505
|
const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
|
8529
8506
|
const graphQLStartSubstring = "Binding GraphQL provider to";
|
8530
|
-
const binPath =
|
8507
|
+
const binPath = findBinPath("fuels-core", __dirname);
|
8531
8508
|
const command = useSystemFuelCore ? "fuel-core" : binPath;
|
8532
8509
|
const ipToUse = ip || "0.0.0.0";
|
8533
8510
|
const portToUse = port || (await getPortPromise({
|