@fuel-ts/account 0.0.0-pr-1788-20240222094224 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/connectors/fuel-connector.d.ts +2 -1
- package/dist/connectors/fuel-connector.d.ts.map +1 -1
- package/dist/connectors/types/data-type.d.ts +0 -8
- package/dist/connectors/types/data-type.d.ts.map +1 -1
- package/dist/connectors/types/events.d.ts +2 -36
- package/dist/connectors/types/events.d.ts.map +1 -1
- package/dist/connectors/types/index.d.ts +0 -2
- package/dist/connectors/types/index.d.ts.map +1 -1
- package/dist/index.global.js +543 -409
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +143 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +132 -159
- package/dist/index.mjs.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts +13 -3
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +9 -3
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-summary/operations.d.ts +0 -2
- package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
- package/dist/providers/transaction-summary/output.d.ts +2 -2
- package/dist/providers/transaction-summary/output.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +0 -1
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/test-utils.global.js +543 -400
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +144 -160
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +132 -148
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/connectors/types/asset.d.ts +0 -2
- package/dist/connectors/types/asset.d.ts.map +0 -1
- package/dist/connectors/types/constants.d.ts +0 -7
- package/dist/connectors/types/constants.d.ts.map +0 -1
- package/dist/connectors/types/message.d.ts +0 -15
- package/dist/connectors/types/message.d.ts.map +0 -1
package/dist/test-utils.js
CHANGED
@@ -62,7 +62,7 @@ var import_utils30 = require("@fuel-ts/utils");
|
|
62
62
|
|
63
63
|
// src/account.ts
|
64
64
|
var import_address4 = require("@fuel-ts/address");
|
65
|
-
var
|
65
|
+
var import_configs11 = require("@fuel-ts/address/configs");
|
66
66
|
var import_errors15 = require("@fuel-ts/errors");
|
67
67
|
var import_interfaces = require("@fuel-ts/interfaces");
|
68
68
|
var import_math17 = require("@fuel-ts/math");
|
@@ -921,67 +921,63 @@ function getSdk(requester) {
|
|
921
921
|
// src/providers/fuel-graphql-subscriber.ts
|
922
922
|
var import_errors = require("@fuel-ts/errors");
|
923
923
|
var import_graphql = require("graphql");
|
924
|
-
var
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
this.readableStreamController.enqueue(
|
941
|
-
new import_errors.FuelError(
|
942
|
-
import_errors.FuelError.CODES.INVALID_REQUEST,
|
943
|
-
errors.map((err) => err.message).join("\n\n")
|
944
|
-
)
|
945
|
-
);
|
946
|
-
} else {
|
947
|
-
this.readableStreamController.enqueue(data);
|
948
|
-
}
|
949
|
-
}
|
924
|
+
var _FuelGraphqlSubscriber = class {
|
925
|
+
constructor(options) {
|
926
|
+
this.options = options;
|
927
|
+
}
|
928
|
+
stream;
|
929
|
+
async setStream() {
|
930
|
+
const { url, query, variables, fetchFn } = this.options;
|
931
|
+
const response = await fetchFn(`${url}-sub`, {
|
932
|
+
method: "POST",
|
933
|
+
body: JSON.stringify({
|
934
|
+
query: (0, import_graphql.print)(query),
|
935
|
+
variables
|
936
|
+
}),
|
937
|
+
headers: {
|
938
|
+
"Content-Type": "application/json",
|
939
|
+
Accept: "text/event-stream"
|
950
940
|
}
|
951
941
|
});
|
942
|
+
this.stream = response.body.getReader();
|
952
943
|
}
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
async function* fuelGraphQLSubscriber({
|
957
|
-
url,
|
958
|
-
variables,
|
959
|
-
query,
|
960
|
-
fetchFn
|
961
|
-
}) {
|
962
|
-
const response = await fetchFn(`${url}-sub`, {
|
963
|
-
method: "POST",
|
964
|
-
body: JSON.stringify({
|
965
|
-
query: (0, import_graphql.print)(query),
|
966
|
-
variables
|
967
|
-
}),
|
968
|
-
headers: {
|
969
|
-
"Content-Type": "application/json",
|
970
|
-
Accept: "text/event-stream"
|
971
|
-
}
|
972
|
-
});
|
973
|
-
const subscriptionStreamReader = response.body.pipeThrough(new FuelSubscriptionStream()).getReader();
|
974
|
-
while (true) {
|
975
|
-
const { value, done } = await subscriptionStreamReader.read();
|
976
|
-
if (value instanceof import_errors.FuelError) {
|
977
|
-
throw value;
|
944
|
+
async next() {
|
945
|
+
if (!this.stream) {
|
946
|
+
await this.setStream();
|
978
947
|
}
|
979
|
-
|
980
|
-
|
981
|
-
|
948
|
+
while (true) {
|
949
|
+
const { value, done } = await this.stream.read();
|
950
|
+
if (done) {
|
951
|
+
return { value, done };
|
952
|
+
}
|
953
|
+
const text = _FuelGraphqlSubscriber.textDecoder.decode(value);
|
954
|
+
if (!text.startsWith("data:")) {
|
955
|
+
continue;
|
956
|
+
}
|
957
|
+
const { data, errors } = JSON.parse(text.split("data:")[1]);
|
958
|
+
if (Array.isArray(errors)) {
|
959
|
+
throw new import_errors.FuelError(
|
960
|
+
import_errors.FuelError.CODES.INVALID_REQUEST,
|
961
|
+
errors.map((err) => err.message).join("\n\n")
|
962
|
+
);
|
963
|
+
}
|
964
|
+
return { value: data, done: false };
|
982
965
|
}
|
983
966
|
}
|
984
|
-
|
967
|
+
/**
|
968
|
+
* Gets called when `break` is called in a `for-await-of` loop.
|
969
|
+
*/
|
970
|
+
async return() {
|
971
|
+
await this.stream.cancel();
|
972
|
+
this.stream.releaseLock();
|
973
|
+
return { done: true, value: void 0 };
|
974
|
+
}
|
975
|
+
[Symbol.asyncIterator]() {
|
976
|
+
return this;
|
977
|
+
}
|
978
|
+
};
|
979
|
+
var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
|
980
|
+
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
985
981
|
|
986
982
|
// src/providers/memory-cache.ts
|
987
983
|
var import_errors2 = require("@fuel-ts/errors");
|
@@ -2001,8 +1997,6 @@ var BaseTransactionRequest = class {
|
|
2001
1997
|
this.inputs.forEach((i) => {
|
2002
1998
|
let correspondingInput;
|
2003
1999
|
switch (i.type) {
|
2004
|
-
case import_transactions5.InputType.Contract:
|
2005
|
-
return;
|
2006
2000
|
case import_transactions5.InputType.Coin:
|
2007
2001
|
correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
|
2008
2002
|
break;
|
@@ -2012,7 +2006,7 @@ var BaseTransactionRequest = class {
|
|
2012
2006
|
);
|
2013
2007
|
break;
|
2014
2008
|
default:
|
2015
|
-
|
2009
|
+
return;
|
2016
2010
|
}
|
2017
2011
|
if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
|
2018
2012
|
i.predicate = correspondingInput.predicate;
|
@@ -2532,6 +2526,7 @@ var fromTai64ToDate = (tai64Timestamp) => {
|
|
2532
2526
|
};
|
2533
2527
|
|
2534
2528
|
// src/providers/transaction-summary/operations.ts
|
2529
|
+
var import_configs10 = require("@fuel-ts/address/configs");
|
2535
2530
|
var import_errors10 = require("@fuel-ts/errors");
|
2536
2531
|
var import_math12 = require("@fuel-ts/math");
|
2537
2532
|
var import_transactions13 = require("@fuel-ts/transactions");
|
@@ -2728,36 +2723,6 @@ function addOperation(operations, toAdd) {
|
|
2728
2723
|
}
|
2729
2724
|
return allOperations;
|
2730
2725
|
}
|
2731
|
-
function getReceiptsTransferOut(receipts) {
|
2732
|
-
return getReceiptsByType(receipts, import_transactions13.ReceiptType.TransferOut);
|
2733
|
-
}
|
2734
|
-
function getContractTransferOperations({ receipts }) {
|
2735
|
-
const transferOutReceipts = getReceiptsTransferOut(receipts);
|
2736
|
-
const contractTransferOperations = transferOutReceipts.reduce(
|
2737
|
-
(prevContractTransferOps, receipt) => {
|
2738
|
-
const newContractTransferOps = addOperation(prevContractTransferOps, {
|
2739
|
-
name: "Contract transfer" /* contractTransfer */,
|
2740
|
-
from: {
|
2741
|
-
type: 0 /* contract */,
|
2742
|
-
address: receipt.from
|
2743
|
-
},
|
2744
|
-
to: {
|
2745
|
-
type: 1 /* account */,
|
2746
|
-
address: receipt.to
|
2747
|
-
},
|
2748
|
-
assetsSent: [
|
2749
|
-
{
|
2750
|
-
amount: receipt.amount,
|
2751
|
-
assetId: receipt.assetId
|
2752
|
-
}
|
2753
|
-
]
|
2754
|
-
});
|
2755
|
-
return newContractTransferOps;
|
2756
|
-
},
|
2757
|
-
[]
|
2758
|
-
);
|
2759
|
-
return contractTransferOperations;
|
2760
|
-
}
|
2761
2726
|
function getWithdrawFromFuelOperations({
|
2762
2727
|
inputs,
|
2763
2728
|
receipts
|
@@ -2855,70 +2820,77 @@ function getContractCallOperations({
|
|
2855
2820
|
}, []);
|
2856
2821
|
return contractCallOperations;
|
2857
2822
|
}
|
2823
|
+
function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
|
2824
|
+
const { to: toAddress, assetId, amount } = receipt;
|
2825
|
+
let { from: fromAddress } = receipt;
|
2826
|
+
const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
|
2827
|
+
if (import_configs10.ZeroBytes32 === fromAddress) {
|
2828
|
+
const change = changeOutputs.find((output) => output.assetId === assetId);
|
2829
|
+
fromAddress = change?.to || fromAddress;
|
2830
|
+
}
|
2831
|
+
const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
|
2832
|
+
return {
|
2833
|
+
name: "Transfer asset" /* transfer */,
|
2834
|
+
from: {
|
2835
|
+
type: fromType,
|
2836
|
+
address: fromAddress
|
2837
|
+
},
|
2838
|
+
to: {
|
2839
|
+
type: toType,
|
2840
|
+
address: toAddress
|
2841
|
+
},
|
2842
|
+
assetsSent: [
|
2843
|
+
{
|
2844
|
+
assetId: assetId.toString(),
|
2845
|
+
amount
|
2846
|
+
}
|
2847
|
+
]
|
2848
|
+
};
|
2849
|
+
}
|
2858
2850
|
function getTransferOperations({
|
2859
2851
|
inputs,
|
2860
2852
|
outputs,
|
2861
2853
|
receipts
|
2862
2854
|
}) {
|
2855
|
+
let operations = [];
|
2863
2856
|
const coinOutputs = getOutputsCoin(outputs);
|
2864
|
-
const
|
2857
|
+
const contractInputs = getInputsContract(inputs);
|
2858
|
+
const changeOutputs = getOutputsChange(outputs);
|
2859
|
+
coinOutputs.forEach((output) => {
|
2860
|
+
const { amount, assetId, to } = output;
|
2861
|
+
const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
|
2862
|
+
if (changeOutput) {
|
2863
|
+
operations = addOperation(operations, {
|
2864
|
+
name: "Transfer asset" /* transfer */,
|
2865
|
+
from: {
|
2866
|
+
type: 1 /* account */,
|
2867
|
+
address: changeOutput.to
|
2868
|
+
},
|
2869
|
+
to: {
|
2870
|
+
type: 1 /* account */,
|
2871
|
+
address: to
|
2872
|
+
},
|
2873
|
+
assetsSent: [
|
2874
|
+
{
|
2875
|
+
assetId,
|
2876
|
+
amount
|
2877
|
+
}
|
2878
|
+
]
|
2879
|
+
});
|
2880
|
+
}
|
2881
|
+
});
|
2882
|
+
const transferReceipts = getReceiptsByType(
|
2865
2883
|
receipts,
|
2866
2884
|
import_transactions13.ReceiptType.Transfer
|
2867
2885
|
);
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
const inputAddress = getInputAccountAddress(utxo);
|
2877
|
-
operations = addOperation(operations, {
|
2878
|
-
name: "Transfer asset" /* transfer */,
|
2879
|
-
from: {
|
2880
|
-
type: 1 /* account */,
|
2881
|
-
address: inputAddress
|
2882
|
-
},
|
2883
|
-
to: {
|
2884
|
-
type: 0 /* contract */,
|
2885
|
-
address: contractInput.contractID
|
2886
|
-
},
|
2887
|
-
assetsSent: [
|
2888
|
-
{
|
2889
|
-
assetId: assetId.toString(),
|
2890
|
-
amount: transferReceipt.amount
|
2891
|
-
}
|
2892
|
-
]
|
2893
|
-
});
|
2894
|
-
}
|
2895
|
-
});
|
2896
|
-
} else {
|
2897
|
-
coinOutputs.forEach((output) => {
|
2898
|
-
const input = getInputFromAssetId(inputs, output.assetId);
|
2899
|
-
if (input) {
|
2900
|
-
const inputAddress = getInputAccountAddress(input);
|
2901
|
-
const operationToAdd = {
|
2902
|
-
name: "Transfer asset" /* transfer */,
|
2903
|
-
from: {
|
2904
|
-
type: 1 /* account */,
|
2905
|
-
address: inputAddress
|
2906
|
-
},
|
2907
|
-
to: {
|
2908
|
-
type: 1 /* account */,
|
2909
|
-
address: output.to.toString()
|
2910
|
-
},
|
2911
|
-
assetsSent: [
|
2912
|
-
{
|
2913
|
-
assetId: output.assetId.toString(),
|
2914
|
-
amount: output.amount
|
2915
|
-
}
|
2916
|
-
]
|
2917
|
-
};
|
2918
|
-
operations = addOperation(operations, operationToAdd);
|
2919
|
-
}
|
2920
|
-
});
|
2921
|
-
}
|
2886
|
+
const transferOutReceipts = getReceiptsByType(
|
2887
|
+
receipts,
|
2888
|
+
import_transactions13.ReceiptType.TransferOut
|
2889
|
+
);
|
2890
|
+
[...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
|
2891
|
+
const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
|
2892
|
+
operations = addOperation(operations, operation);
|
2893
|
+
});
|
2922
2894
|
return operations;
|
2923
2895
|
}
|
2924
2896
|
function getPayProducerOperations(outputs) {
|
@@ -2991,7 +2963,6 @@ function getOperations({
|
|
2991
2963
|
rawPayload,
|
2992
2964
|
maxInputs
|
2993
2965
|
}),
|
2994
|
-
...getContractTransferOperations({ receipts }),
|
2995
2966
|
...getWithdrawFromFuelOperations({ inputs, receipts })
|
2996
2967
|
];
|
2997
2968
|
}
|
@@ -3553,7 +3524,7 @@ var _Provider = class {
|
|
3553
3524
|
const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
|
3554
3525
|
const isSubscription = opDefinition?.operation === "subscription";
|
3555
3526
|
if (isSubscription) {
|
3556
|
-
return
|
3527
|
+
return new FuelGraphqlSubscriber({
|
3557
3528
|
url: this.url,
|
3558
3529
|
query,
|
3559
3530
|
fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
|
@@ -3745,11 +3716,15 @@ var _Provider = class {
|
|
3745
3716
|
async estimateTxDependencies(transactionRequest) {
|
3746
3717
|
if (transactionRequest.type === import_transactions17.TransactionType.Create) {
|
3747
3718
|
return {
|
3748
|
-
receipts: []
|
3719
|
+
receipts: [],
|
3720
|
+
outputVariables: 0,
|
3721
|
+
missingContractIds: []
|
3749
3722
|
};
|
3750
3723
|
}
|
3751
3724
|
await this.estimatePredicates(transactionRequest);
|
3752
3725
|
let receipts = [];
|
3726
|
+
const missingContractIds = [];
|
3727
|
+
let outputVariables = 0;
|
3753
3728
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
3754
3729
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
3755
3730
|
encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
|
@@ -3759,16 +3734,20 @@ var _Provider = class {
|
|
3759
3734
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
3760
3735
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
3761
3736
|
if (hasMissingOutputs) {
|
3737
|
+
outputVariables += missingOutputVariables.length;
|
3762
3738
|
transactionRequest.addVariableOutputs(missingOutputVariables.length);
|
3763
3739
|
missingOutputContractIds.forEach(({ contractId }) => {
|
3764
3740
|
transactionRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId));
|
3741
|
+
missingContractIds.push(contractId);
|
3765
3742
|
});
|
3766
3743
|
} else {
|
3767
3744
|
break;
|
3768
3745
|
}
|
3769
3746
|
}
|
3770
3747
|
return {
|
3771
|
-
receipts
|
3748
|
+
receipts,
|
3749
|
+
outputVariables,
|
3750
|
+
missingContractIds
|
3772
3751
|
};
|
3773
3752
|
}
|
3774
3753
|
/**
|
@@ -3836,11 +3815,15 @@ var _Provider = class {
|
|
3836
3815
|
const minGas = txRequestClone.calculateMinGas(chainInfo);
|
3837
3816
|
const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
|
3838
3817
|
let receipts = [];
|
3818
|
+
let missingContractIds = [];
|
3819
|
+
let outputVariables = 0;
|
3839
3820
|
if (isScriptTransaction && estimateTxDependencies) {
|
3840
3821
|
txRequestClone.gasPrice = (0, import_math14.bn)(0);
|
3841
3822
|
txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
|
3842
3823
|
const result = await this.estimateTxDependencies(txRequestClone);
|
3843
3824
|
receipts = result.receipts;
|
3825
|
+
outputVariables = result.outputVariables;
|
3826
|
+
missingContractIds = result.missingContractIds;
|
3844
3827
|
}
|
3845
3828
|
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
3846
3829
|
const usedFee = calculatePriceWithFactor(
|
@@ -3862,7 +3845,8 @@ var _Provider = class {
|
|
3862
3845
|
minFee,
|
3863
3846
|
maxFee,
|
3864
3847
|
estimatedInputs: txRequestClone.inputs,
|
3865
|
-
|
3848
|
+
outputVariables,
|
3849
|
+
missingContractIds
|
3866
3850
|
};
|
3867
3851
|
}
|
3868
3852
|
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
@@ -4482,7 +4466,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4482
4466
|
* @param assetId - The asset ID to check the balance for.
|
4483
4467
|
* @returns A promise that resolves to the balance amount.
|
4484
4468
|
*/
|
4485
|
-
async getBalance(assetId =
|
4469
|
+
async getBalance(assetId = import_configs11.BaseAssetId) {
|
4486
4470
|
const amount = await this.provider.getBalance(this.address, assetId);
|
4487
4471
|
return amount;
|
4488
4472
|
}
|
@@ -4523,7 +4507,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4523
4507
|
async fund(request, coinQuantities, fee) {
|
4524
4508
|
const updatedQuantities = addAmountToAsset({
|
4525
4509
|
amount: (0, import_math17.bn)(fee),
|
4526
|
-
assetId:
|
4510
|
+
assetId: import_configs11.BaseAssetId,
|
4527
4511
|
coinQuantities
|
4528
4512
|
});
|
4529
4513
|
const quantitiesDict = {};
|
@@ -4547,8 +4531,8 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4547
4531
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
4548
4532
|
cachedUtxos.push(input.id);
|
4549
4533
|
}
|
4550
|
-
} else if (input.recipient === owner && input.amount && quantitiesDict[
|
4551
|
-
quantitiesDict[
|
4534
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[import_configs11.BaseAssetId]) {
|
4535
|
+
quantitiesDict[import_configs11.BaseAssetId].owned = quantitiesDict[import_configs11.BaseAssetId].owned.add(input.amount);
|
4552
4536
|
cachedMessages.push(input.nonce);
|
4553
4537
|
}
|
4554
4538
|
}
|
@@ -4580,7 +4564,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4580
4564
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
4581
4565
|
* @returns A promise that resolves to the prepared transaction request.
|
4582
4566
|
*/
|
4583
|
-
async createTransfer(destination, amount, assetId =
|
4567
|
+
async createTransfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
|
4584
4568
|
const { minGasPrice } = this.provider.getGasConfig();
|
4585
4569
|
const params = { gasPrice: minGasPrice, ...txParams };
|
4586
4570
|
const request = new ScriptTransactionRequest(params);
|
@@ -4610,7 +4594,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4610
4594
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
4611
4595
|
* @returns A promise that resolves to the transaction response.
|
4612
4596
|
*/
|
4613
|
-
async transfer(destination, amount, assetId =
|
4597
|
+
async transfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
|
4614
4598
|
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
4615
4599
|
return this.sendTransaction(request, { estimateTxDependencies: false });
|
4616
4600
|
}
|
@@ -4623,7 +4607,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4623
4607
|
* @param txParams - The optional transaction parameters.
|
4624
4608
|
* @returns A promise that resolves to the transaction response.
|
4625
4609
|
*/
|
4626
|
-
async transferToContract(contractId, amount, assetId =
|
4610
|
+
async transferToContract(contractId, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
|
4627
4611
|
const contractAddress = import_address4.Address.fromAddressOrString(contractId);
|
4628
4612
|
const { minGasPrice } = this.provider.getGasConfig();
|
4629
4613
|
const params = { gasPrice: minGasPrice, ...txParams };
|
@@ -4676,7 +4660,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4676
4660
|
]);
|
4677
4661
|
const params = { script, gasPrice: minGasPrice, ...txParams };
|
4678
4662
|
const request = new ScriptTransactionRequest(params);
|
4679
|
-
const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId:
|
4663
|
+
const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: import_configs11.BaseAssetId }];
|
4680
4664
|
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
4681
4665
|
request,
|
4682
4666
|
forwardingQuantities
|
@@ -7823,7 +7807,7 @@ var generateTestWallet = async (provider, quantities) => {
|
|
7823
7807
|
};
|
7824
7808
|
|
7825
7809
|
// src/test-utils/launchNode.ts
|
7826
|
-
var
|
7810
|
+
var import_configs12 = require("@fuel-ts/address/configs");
|
7827
7811
|
var import_math20 = require("@fuel-ts/math");
|
7828
7812
|
var import_utils35 = require("@fuel-ts/utils");
|
7829
7813
|
var import_cli_utils = require("@fuel-ts/utils/cli-utils");
|
@@ -7923,7 +7907,7 @@ var launchNode = async ({
|
|
7923
7907
|
{
|
7924
7908
|
owner: signer.address.toHexString(),
|
7925
7909
|
amount: (0, import_math20.toHex)(1e9),
|
7926
|
-
asset_id:
|
7910
|
+
asset_id: import_configs12.BaseAssetId
|
7927
7911
|
}
|
7928
7912
|
]
|
7929
7913
|
}
|
@@ -7991,7 +7975,7 @@ var launchNode = async ({
|
|
7991
7975
|
var generateWallets = async (count, provider) => {
|
7992
7976
|
const wallets = [];
|
7993
7977
|
for (let i = 0; i < count; i += 1) {
|
7994
|
-
const wallet = await generateTestWallet(provider, [[1e3,
|
7978
|
+
const wallet = await generateTestWallet(provider, [[1e3, import_configs12.BaseAssetId]]);
|
7995
7979
|
wallets.push(wallet);
|
7996
7980
|
}
|
7997
7981
|
return wallets;
|