@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/index.js
CHANGED
@@ -75,7 +75,6 @@ __export(src_exports, {
|
|
75
75
|
LocalStorage: () => LocalStorage,
|
76
76
|
MNEMONIC_SIZES: () => MNEMONIC_SIZES,
|
77
77
|
MemoryStorage: () => MemoryStorage,
|
78
|
-
MessageTypes: () => MessageTypes,
|
79
78
|
Mnemonic: () => mnemonic_default,
|
80
79
|
MnemonicVault: () => MnemonicVault,
|
81
80
|
NoWitnessAtIndexError: () => NoWitnessAtIndexError,
|
@@ -124,7 +123,6 @@ __export(src_exports, {
|
|
124
123
|
getAssetWithNetwork: () => getAssetWithNetwork,
|
125
124
|
getContractCallOperations: () => getContractCallOperations,
|
126
125
|
getContractCreatedOperations: () => getContractCreatedOperations,
|
127
|
-
getContractTransferOperations: () => getContractTransferOperations,
|
128
126
|
getDecodedLogs: () => getDecodedLogs,
|
129
127
|
getDefaultChainId: () => getDefaultChainId,
|
130
128
|
getGasUsedFromReceipts: () => getGasUsedFromReceipts,
|
@@ -187,7 +185,7 @@ module.exports = __toCommonJS(src_exports);
|
|
187
185
|
|
188
186
|
// src/account.ts
|
189
187
|
var import_address4 = require("@fuel-ts/address");
|
190
|
-
var
|
188
|
+
var import_configs11 = require("@fuel-ts/address/configs");
|
191
189
|
var import_errors15 = require("@fuel-ts/errors");
|
192
190
|
var import_interfaces = require("@fuel-ts/interfaces");
|
193
191
|
var import_math17 = require("@fuel-ts/math");
|
@@ -1046,67 +1044,63 @@ function getSdk(requester) {
|
|
1046
1044
|
// src/providers/fuel-graphql-subscriber.ts
|
1047
1045
|
var import_errors = require("@fuel-ts/errors");
|
1048
1046
|
var import_graphql = require("graphql");
|
1049
|
-
var
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
this.readableStreamController.enqueue(
|
1066
|
-
new import_errors.FuelError(
|
1067
|
-
import_errors.FuelError.CODES.INVALID_REQUEST,
|
1068
|
-
errors.map((err) => err.message).join("\n\n")
|
1069
|
-
)
|
1070
|
-
);
|
1071
|
-
} else {
|
1072
|
-
this.readableStreamController.enqueue(data);
|
1073
|
-
}
|
1074
|
-
}
|
1047
|
+
var _FuelGraphqlSubscriber = class {
|
1048
|
+
constructor(options) {
|
1049
|
+
this.options = options;
|
1050
|
+
}
|
1051
|
+
stream;
|
1052
|
+
async setStream() {
|
1053
|
+
const { url, query, variables, fetchFn } = this.options;
|
1054
|
+
const response = await fetchFn(`${url}-sub`, {
|
1055
|
+
method: "POST",
|
1056
|
+
body: JSON.stringify({
|
1057
|
+
query: (0, import_graphql.print)(query),
|
1058
|
+
variables
|
1059
|
+
}),
|
1060
|
+
headers: {
|
1061
|
+
"Content-Type": "application/json",
|
1062
|
+
Accept: "text/event-stream"
|
1075
1063
|
}
|
1076
1064
|
});
|
1065
|
+
this.stream = response.body.getReader();
|
1077
1066
|
}
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
async function* fuelGraphQLSubscriber({
|
1082
|
-
url,
|
1083
|
-
variables,
|
1084
|
-
query,
|
1085
|
-
fetchFn
|
1086
|
-
}) {
|
1087
|
-
const response = await fetchFn(`${url}-sub`, {
|
1088
|
-
method: "POST",
|
1089
|
-
body: JSON.stringify({
|
1090
|
-
query: (0, import_graphql.print)(query),
|
1091
|
-
variables
|
1092
|
-
}),
|
1093
|
-
headers: {
|
1094
|
-
"Content-Type": "application/json",
|
1095
|
-
Accept: "text/event-stream"
|
1067
|
+
async next() {
|
1068
|
+
if (!this.stream) {
|
1069
|
+
await this.setStream();
|
1096
1070
|
}
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1071
|
+
while (true) {
|
1072
|
+
const { value, done } = await this.stream.read();
|
1073
|
+
if (done) {
|
1074
|
+
return { value, done };
|
1075
|
+
}
|
1076
|
+
const text = _FuelGraphqlSubscriber.textDecoder.decode(value);
|
1077
|
+
if (!text.startsWith("data:")) {
|
1078
|
+
continue;
|
1079
|
+
}
|
1080
|
+
const { data, errors } = JSON.parse(text.split("data:")[1]);
|
1081
|
+
if (Array.isArray(errors)) {
|
1082
|
+
throw new import_errors.FuelError(
|
1083
|
+
import_errors.FuelError.CODES.INVALID_REQUEST,
|
1084
|
+
errors.map((err) => err.message).join("\n\n")
|
1085
|
+
);
|
1086
|
+
}
|
1087
|
+
return { value: data, done: false };
|
1107
1088
|
}
|
1108
1089
|
}
|
1109
|
-
|
1090
|
+
/**
|
1091
|
+
* Gets called when `break` is called in a `for-await-of` loop.
|
1092
|
+
*/
|
1093
|
+
async return() {
|
1094
|
+
await this.stream.cancel();
|
1095
|
+
this.stream.releaseLock();
|
1096
|
+
return { done: true, value: void 0 };
|
1097
|
+
}
|
1098
|
+
[Symbol.asyncIterator]() {
|
1099
|
+
return this;
|
1100
|
+
}
|
1101
|
+
};
|
1102
|
+
var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
|
1103
|
+
__publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
|
1110
1104
|
|
1111
1105
|
// src/providers/memory-cache.ts
|
1112
1106
|
var import_errors2 = require("@fuel-ts/errors");
|
@@ -2201,8 +2195,6 @@ var BaseTransactionRequest = class {
|
|
2201
2195
|
this.inputs.forEach((i) => {
|
2202
2196
|
let correspondingInput;
|
2203
2197
|
switch (i.type) {
|
2204
|
-
case import_transactions5.InputType.Contract:
|
2205
|
-
return;
|
2206
2198
|
case import_transactions5.InputType.Coin:
|
2207
2199
|
correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
|
2208
2200
|
break;
|
@@ -2212,7 +2204,7 @@ var BaseTransactionRequest = class {
|
|
2212
2204
|
);
|
2213
2205
|
break;
|
2214
2206
|
default:
|
2215
|
-
|
2207
|
+
return;
|
2216
2208
|
}
|
2217
2209
|
if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
|
2218
2210
|
i.predicate = correspondingInput.predicate;
|
@@ -2733,6 +2725,7 @@ var fromTai64ToDate = (tai64Timestamp) => {
|
|
2733
2725
|
var fromDateToTai64 = (date) => import_tai64.TAI64.fromUnix(Math.floor(date.getTime() / 1e3)).toString(10);
|
2734
2726
|
|
2735
2727
|
// src/providers/transaction-summary/operations.ts
|
2728
|
+
var import_configs10 = require("@fuel-ts/address/configs");
|
2736
2729
|
var import_errors10 = require("@fuel-ts/errors");
|
2737
2730
|
var import_math12 = require("@fuel-ts/math");
|
2738
2731
|
var import_transactions13 = require("@fuel-ts/transactions");
|
@@ -2877,7 +2870,6 @@ var OperationName = /* @__PURE__ */ ((OperationName2) => {
|
|
2877
2870
|
OperationName2["contractCreated"] = "Contract created";
|
2878
2871
|
OperationName2["transfer"] = "Transfer asset";
|
2879
2872
|
OperationName2["contractCall"] = "Contract call";
|
2880
|
-
OperationName2["contractTransfer"] = "Contract transfer";
|
2881
2873
|
OperationName2["receive"] = "Receive asset";
|
2882
2874
|
OperationName2["mint"] = "Mint asset";
|
2883
2875
|
OperationName2["predicatecall"] = "Predicate call";
|
@@ -2977,33 +2969,6 @@ function addOperation(operations, toAdd) {
|
|
2977
2969
|
function getReceiptsTransferOut(receipts) {
|
2978
2970
|
return getReceiptsByType(receipts, import_transactions13.ReceiptType.TransferOut);
|
2979
2971
|
}
|
2980
|
-
function getContractTransferOperations({ receipts }) {
|
2981
|
-
const transferOutReceipts = getReceiptsTransferOut(receipts);
|
2982
|
-
const contractTransferOperations = transferOutReceipts.reduce(
|
2983
|
-
(prevContractTransferOps, receipt) => {
|
2984
|
-
const newContractTransferOps = addOperation(prevContractTransferOps, {
|
2985
|
-
name: "Contract transfer" /* contractTransfer */,
|
2986
|
-
from: {
|
2987
|
-
type: 0 /* contract */,
|
2988
|
-
address: receipt.from
|
2989
|
-
},
|
2990
|
-
to: {
|
2991
|
-
type: 1 /* account */,
|
2992
|
-
address: receipt.to
|
2993
|
-
},
|
2994
|
-
assetsSent: [
|
2995
|
-
{
|
2996
|
-
amount: receipt.amount,
|
2997
|
-
assetId: receipt.assetId
|
2998
|
-
}
|
2999
|
-
]
|
3000
|
-
});
|
3001
|
-
return newContractTransferOps;
|
3002
|
-
},
|
3003
|
-
[]
|
3004
|
-
);
|
3005
|
-
return contractTransferOperations;
|
3006
|
-
}
|
3007
2972
|
function getWithdrawFromFuelOperations({
|
3008
2973
|
inputs,
|
3009
2974
|
receipts
|
@@ -3101,70 +3066,77 @@ function getContractCallOperations({
|
|
3101
3066
|
}, []);
|
3102
3067
|
return contractCallOperations;
|
3103
3068
|
}
|
3069
|
+
function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs) {
|
3070
|
+
const { to: toAddress, assetId, amount } = receipt;
|
3071
|
+
let { from: fromAddress } = receipt;
|
3072
|
+
const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
|
3073
|
+
if (import_configs10.ZeroBytes32 === fromAddress) {
|
3074
|
+
const change = changeOutputs.find((output) => output.assetId === assetId);
|
3075
|
+
fromAddress = change?.to || fromAddress;
|
3076
|
+
}
|
3077
|
+
const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
|
3078
|
+
return {
|
3079
|
+
name: "Transfer asset" /* transfer */,
|
3080
|
+
from: {
|
3081
|
+
type: fromType,
|
3082
|
+
address: fromAddress
|
3083
|
+
},
|
3084
|
+
to: {
|
3085
|
+
type: toType,
|
3086
|
+
address: toAddress
|
3087
|
+
},
|
3088
|
+
assetsSent: [
|
3089
|
+
{
|
3090
|
+
assetId: assetId.toString(),
|
3091
|
+
amount
|
3092
|
+
}
|
3093
|
+
]
|
3094
|
+
};
|
3095
|
+
}
|
3104
3096
|
function getTransferOperations({
|
3105
3097
|
inputs,
|
3106
3098
|
outputs,
|
3107
3099
|
receipts
|
3108
3100
|
}) {
|
3101
|
+
let operations = [];
|
3109
3102
|
const coinOutputs = getOutputsCoin(outputs);
|
3110
|
-
const
|
3103
|
+
const contractInputs = getInputsContract(inputs);
|
3104
|
+
const changeOutputs = getOutputsChange(outputs);
|
3105
|
+
coinOutputs.forEach((output) => {
|
3106
|
+
const { amount, assetId, to } = output;
|
3107
|
+
const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
|
3108
|
+
if (changeOutput) {
|
3109
|
+
operations = addOperation(operations, {
|
3110
|
+
name: "Transfer asset" /* transfer */,
|
3111
|
+
from: {
|
3112
|
+
type: 1 /* account */,
|
3113
|
+
address: changeOutput.to
|
3114
|
+
},
|
3115
|
+
to: {
|
3116
|
+
type: 1 /* account */,
|
3117
|
+
address: to
|
3118
|
+
},
|
3119
|
+
assetsSent: [
|
3120
|
+
{
|
3121
|
+
assetId,
|
3122
|
+
amount
|
3123
|
+
}
|
3124
|
+
]
|
3125
|
+
});
|
3126
|
+
}
|
3127
|
+
});
|
3128
|
+
const transferReceipts = getReceiptsByType(
|
3111
3129
|
receipts,
|
3112
3130
|
import_transactions13.ReceiptType.Transfer
|
3113
3131
|
);
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
const inputAddress = getInputAccountAddress(utxo);
|
3123
|
-
operations = addOperation(operations, {
|
3124
|
-
name: "Transfer asset" /* transfer */,
|
3125
|
-
from: {
|
3126
|
-
type: 1 /* account */,
|
3127
|
-
address: inputAddress
|
3128
|
-
},
|
3129
|
-
to: {
|
3130
|
-
type: 0 /* contract */,
|
3131
|
-
address: contractInput.contractID
|
3132
|
-
},
|
3133
|
-
assetsSent: [
|
3134
|
-
{
|
3135
|
-
assetId: assetId.toString(),
|
3136
|
-
amount: transferReceipt.amount
|
3137
|
-
}
|
3138
|
-
]
|
3139
|
-
});
|
3140
|
-
}
|
3141
|
-
});
|
3142
|
-
} else {
|
3143
|
-
coinOutputs.forEach((output) => {
|
3144
|
-
const input = getInputFromAssetId(inputs, output.assetId);
|
3145
|
-
if (input) {
|
3146
|
-
const inputAddress = getInputAccountAddress(input);
|
3147
|
-
const operationToAdd = {
|
3148
|
-
name: "Transfer asset" /* transfer */,
|
3149
|
-
from: {
|
3150
|
-
type: 1 /* account */,
|
3151
|
-
address: inputAddress
|
3152
|
-
},
|
3153
|
-
to: {
|
3154
|
-
type: 1 /* account */,
|
3155
|
-
address: output.to.toString()
|
3156
|
-
},
|
3157
|
-
assetsSent: [
|
3158
|
-
{
|
3159
|
-
assetId: output.assetId.toString(),
|
3160
|
-
amount: output.amount
|
3161
|
-
}
|
3162
|
-
]
|
3163
|
-
};
|
3164
|
-
operations = addOperation(operations, operationToAdd);
|
3165
|
-
}
|
3166
|
-
});
|
3167
|
-
}
|
3132
|
+
const transferOutReceipts = getReceiptsByType(
|
3133
|
+
receipts,
|
3134
|
+
import_transactions13.ReceiptType.TransferOut
|
3135
|
+
);
|
3136
|
+
[...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
|
3137
|
+
const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
|
3138
|
+
operations = addOperation(operations, operation);
|
3139
|
+
});
|
3168
3140
|
return operations;
|
3169
3141
|
}
|
3170
3142
|
function getPayProducerOperations(outputs) {
|
@@ -3237,7 +3209,6 @@ function getOperations({
|
|
3237
3209
|
rawPayload,
|
3238
3210
|
maxInputs
|
3239
3211
|
}),
|
3240
|
-
...getContractTransferOperations({ receipts }),
|
3241
3212
|
...getWithdrawFromFuelOperations({ inputs, receipts })
|
3242
3213
|
];
|
3243
3214
|
}
|
@@ -3810,7 +3781,7 @@ var _Provider = class {
|
|
3810
3781
|
const opDefinition = query.definitions.find((x) => x.kind === "OperationDefinition");
|
3811
3782
|
const isSubscription = opDefinition?.operation === "subscription";
|
3812
3783
|
if (isSubscription) {
|
3813
|
-
return
|
3784
|
+
return new FuelGraphqlSubscriber({
|
3814
3785
|
url: this.url,
|
3815
3786
|
query,
|
3816
3787
|
fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
|
@@ -4002,11 +3973,15 @@ var _Provider = class {
|
|
4002
3973
|
async estimateTxDependencies(transactionRequest) {
|
4003
3974
|
if (transactionRequest.type === import_transactions17.TransactionType.Create) {
|
4004
3975
|
return {
|
4005
|
-
receipts: []
|
3976
|
+
receipts: [],
|
3977
|
+
outputVariables: 0,
|
3978
|
+
missingContractIds: []
|
4006
3979
|
};
|
4007
3980
|
}
|
4008
3981
|
await this.estimatePredicates(transactionRequest);
|
4009
3982
|
let receipts = [];
|
3983
|
+
const missingContractIds = [];
|
3984
|
+
let outputVariables = 0;
|
4010
3985
|
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
4011
3986
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
4012
3987
|
encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
|
@@ -4016,16 +3991,20 @@ var _Provider = class {
|
|
4016
3991
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
4017
3992
|
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
4018
3993
|
if (hasMissingOutputs) {
|
3994
|
+
outputVariables += missingOutputVariables.length;
|
4019
3995
|
transactionRequest.addVariableOutputs(missingOutputVariables.length);
|
4020
3996
|
missingOutputContractIds.forEach(({ contractId }) => {
|
4021
3997
|
transactionRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId));
|
3998
|
+
missingContractIds.push(contractId);
|
4022
3999
|
});
|
4023
4000
|
} else {
|
4024
4001
|
break;
|
4025
4002
|
}
|
4026
4003
|
}
|
4027
4004
|
return {
|
4028
|
-
receipts
|
4005
|
+
receipts,
|
4006
|
+
outputVariables,
|
4007
|
+
missingContractIds
|
4029
4008
|
};
|
4030
4009
|
}
|
4031
4010
|
/**
|
@@ -4093,11 +4072,15 @@ var _Provider = class {
|
|
4093
4072
|
const minGas = txRequestClone.calculateMinGas(chainInfo);
|
4094
4073
|
const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
|
4095
4074
|
let receipts = [];
|
4075
|
+
let missingContractIds = [];
|
4076
|
+
let outputVariables = 0;
|
4096
4077
|
if (isScriptTransaction && estimateTxDependencies) {
|
4097
4078
|
txRequestClone.gasPrice = (0, import_math14.bn)(0);
|
4098
4079
|
txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
|
4099
4080
|
const result = await this.estimateTxDependencies(txRequestClone);
|
4100
4081
|
receipts = result.receipts;
|
4082
|
+
outputVariables = result.outputVariables;
|
4083
|
+
missingContractIds = result.missingContractIds;
|
4101
4084
|
}
|
4102
4085
|
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
4103
4086
|
const usedFee = calculatePriceWithFactor(
|
@@ -4119,7 +4102,8 @@ var _Provider = class {
|
|
4119
4102
|
minFee,
|
4120
4103
|
maxFee,
|
4121
4104
|
estimatedInputs: txRequestClone.inputs,
|
4122
|
-
|
4105
|
+
outputVariables,
|
4106
|
+
missingContractIds
|
4123
4107
|
};
|
4124
4108
|
}
|
4125
4109
|
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
@@ -4905,7 +4889,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4905
4889
|
* @param assetId - The asset ID to check the balance for.
|
4906
4890
|
* @returns A promise that resolves to the balance amount.
|
4907
4891
|
*/
|
4908
|
-
async getBalance(assetId =
|
4892
|
+
async getBalance(assetId = import_configs11.BaseAssetId) {
|
4909
4893
|
const amount = await this.provider.getBalance(this.address, assetId);
|
4910
4894
|
return amount;
|
4911
4895
|
}
|
@@ -4946,7 +4930,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4946
4930
|
async fund(request, coinQuantities, fee) {
|
4947
4931
|
const updatedQuantities = addAmountToAsset({
|
4948
4932
|
amount: (0, import_math17.bn)(fee),
|
4949
|
-
assetId:
|
4933
|
+
assetId: import_configs11.BaseAssetId,
|
4950
4934
|
coinQuantities
|
4951
4935
|
});
|
4952
4936
|
const quantitiesDict = {};
|
@@ -4970,8 +4954,8 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4970
4954
|
quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
|
4971
4955
|
cachedUtxos.push(input.id);
|
4972
4956
|
}
|
4973
|
-
} else if (input.recipient === owner && input.amount && quantitiesDict[
|
4974
|
-
quantitiesDict[
|
4957
|
+
} else if (input.recipient === owner && input.amount && quantitiesDict[import_configs11.BaseAssetId]) {
|
4958
|
+
quantitiesDict[import_configs11.BaseAssetId].owned = quantitiesDict[import_configs11.BaseAssetId].owned.add(input.amount);
|
4975
4959
|
cachedMessages.push(input.nonce);
|
4976
4960
|
}
|
4977
4961
|
}
|
@@ -5003,7 +4987,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5003
4987
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
5004
4988
|
* @returns A promise that resolves to the prepared transaction request.
|
5005
4989
|
*/
|
5006
|
-
async createTransfer(destination, amount, assetId =
|
4990
|
+
async createTransfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
|
5007
4991
|
const { minGasPrice } = this.provider.getGasConfig();
|
5008
4992
|
const params = { gasPrice: minGasPrice, ...txParams };
|
5009
4993
|
const request = new ScriptTransactionRequest(params);
|
@@ -5033,7 +5017,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5033
5017
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
5034
5018
|
* @returns A promise that resolves to the transaction response.
|
5035
5019
|
*/
|
5036
|
-
async transfer(destination, amount, assetId =
|
5020
|
+
async transfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
|
5037
5021
|
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
5038
5022
|
return this.sendTransaction(request, { estimateTxDependencies: false });
|
5039
5023
|
}
|
@@ -5046,7 +5030,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5046
5030
|
* @param txParams - The optional transaction parameters.
|
5047
5031
|
* @returns A promise that resolves to the transaction response.
|
5048
5032
|
*/
|
5049
|
-
async transferToContract(contractId, amount, assetId =
|
5033
|
+
async transferToContract(contractId, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
|
5050
5034
|
const contractAddress = import_address4.Address.fromAddressOrString(contractId);
|
5051
5035
|
const { minGasPrice } = this.provider.getGasConfig();
|
5052
5036
|
const params = { gasPrice: minGasPrice, ...txParams };
|
@@ -5099,7 +5083,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5099
5083
|
]);
|
5100
5084
|
const params = { script, gasPrice: minGasPrice, ...txParams };
|
5101
5085
|
const request = new ScriptTransactionRequest(params);
|
5102
|
-
const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId:
|
5086
|
+
const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: import_configs11.BaseAssetId }];
|
5103
5087
|
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
5104
5088
|
request,
|
5105
5089
|
forwardingQuantities
|
@@ -8645,7 +8629,7 @@ var StorageAbstract = class {
|
|
8645
8629
|
// src/predicate/predicate.ts
|
8646
8630
|
var import_abi_coder5 = require("@fuel-ts/abi-coder");
|
8647
8631
|
var import_address10 = require("@fuel-ts/address");
|
8648
|
-
var
|
8632
|
+
var import_configs12 = require("@fuel-ts/address/configs");
|
8649
8633
|
var import_errors24 = require("@fuel-ts/errors");
|
8650
8634
|
var import_transactions19 = require("@fuel-ts/transactions");
|
8651
8635
|
var import_utils36 = require("@fuel-ts/utils");
|
@@ -8714,7 +8698,7 @@ var Predicate = class extends Account {
|
|
8714
8698
|
* @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
|
8715
8699
|
* @returns A promise that resolves to the prepared transaction request.
|
8716
8700
|
*/
|
8717
|
-
async createTransfer(destination, amount, assetId =
|
8701
|
+
async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
|
8718
8702
|
const request = await super.createTransfer(destination, amount, assetId, txParams);
|
8719
8703
|
return this.populateTransactionPredicateData(request);
|
8720
8704
|
}
|
@@ -8872,17 +8856,6 @@ var FuelConnectorEventTypes = /* @__PURE__ */ ((FuelConnectorEventTypes2) => {
|
|
8872
8856
|
})(FuelConnectorEventTypes || {});
|
8873
8857
|
var FuelConnectorEventType = "FuelConnector";
|
8874
8858
|
|
8875
|
-
// src/connectors/types/data-type.ts
|
8876
|
-
var MessageTypes = /* @__PURE__ */ ((MessageTypes2) => {
|
8877
|
-
MessageTypes2["ping"] = "ping";
|
8878
|
-
MessageTypes2["uiEvent"] = "uiEvent";
|
8879
|
-
MessageTypes2["event"] = "event";
|
8880
|
-
MessageTypes2["request"] = "request";
|
8881
|
-
MessageTypes2["response"] = "response";
|
8882
|
-
MessageTypes2["removeConnection"] = "removeConnection";
|
8883
|
-
return MessageTypes2;
|
8884
|
-
})(MessageTypes || {});
|
8885
|
-
|
8886
8859
|
// src/connectors/types/local-storage.ts
|
8887
8860
|
var LocalStorage = class {
|
8888
8861
|
storage;
|
@@ -9520,7 +9493,6 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9520
9493
|
LocalStorage,
|
9521
9494
|
MNEMONIC_SIZES,
|
9522
9495
|
MemoryStorage,
|
9523
|
-
MessageTypes,
|
9524
9496
|
Mnemonic,
|
9525
9497
|
MnemonicVault,
|
9526
9498
|
NoWitnessAtIndexError,
|
@@ -9569,7 +9541,6 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9569
9541
|
getAssetWithNetwork,
|
9570
9542
|
getContractCallOperations,
|
9571
9543
|
getContractCreatedOperations,
|
9572
|
-
getContractTransferOperations,
|
9573
9544
|
getDecodedLogs,
|
9574
9545
|
getDefaultChainId,
|
9575
9546
|
getGasUsedFromReceipts,
|