@fuel-ts/account 0.0.0-rc-2034-20240410172045 → 0.0.0-rc-2034-20240410182856
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/index.global.js +5 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +20 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/test-utils.global.js +5 -4
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +16 -14
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +6 -4
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.js
CHANGED
@@ -1173,6 +1173,7 @@ var MemoryCache = class {
|
|
1173
1173
|
};
|
1174
1174
|
|
1175
1175
|
// src/providers/transaction-request/input.ts
|
1176
|
+
var import_abi_coder = require("@fuel-ts/abi-coder");
|
1176
1177
|
var import_configs2 = require("@fuel-ts/address/configs");
|
1177
1178
|
var import_errors3 = require("@fuel-ts/errors");
|
1178
1179
|
var import_math2 = require("@fuel-ts/math");
|
@@ -1186,8 +1187,8 @@ var inputify = (value) => {
|
|
1186
1187
|
const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
|
1187
1188
|
return {
|
1188
1189
|
type: import_transactions.InputType.Coin,
|
1189
|
-
txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0,
|
1190
|
-
outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(
|
1190
|
+
txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, import_abi_coder.BYTES_32)),
|
1191
|
+
outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(import_abi_coder.BYTES_32, import_abi_coder.UTXO_ID_LEN)),
|
1191
1192
|
owner: (0, import_utils3.hexlify)(value.owner),
|
1192
1193
|
amount: (0, import_math2.bn)(value.amount),
|
1193
1194
|
assetId: (0, import_utils3.hexlify)(value.assetId),
|
@@ -1305,6 +1306,7 @@ var outputify = (value) => {
|
|
1305
1306
|
};
|
1306
1307
|
|
1307
1308
|
// src/providers/transaction-request/transaction-request.ts
|
1309
|
+
var import_abi_coder2 = require("@fuel-ts/abi-coder");
|
1308
1310
|
var import_address = require("@fuel-ts/address");
|
1309
1311
|
var import_configs7 = require("@fuel-ts/address/configs");
|
1310
1312
|
var import_crypto = require("@fuel-ts/crypto");
|
@@ -2251,12 +2253,12 @@ var BaseTransactionRequest = class {
|
|
2251
2253
|
const updateAssetInput = (assetId, quantity) => {
|
2252
2254
|
const assetInput = findAssetInput(assetId);
|
2253
2255
|
if (assetInput && "assetId" in assetInput) {
|
2254
|
-
assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(
|
2256
|
+
assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
|
2255
2257
|
assetInput.amount = quantity;
|
2256
2258
|
} else {
|
2257
2259
|
this.addResources([
|
2258
2260
|
{
|
2259
|
-
id: (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(
|
2261
|
+
id: (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN)),
|
2260
2262
|
amount: quantity,
|
2261
2263
|
assetId,
|
2262
2264
|
owner: resourcesOwner || import_address.Address.fromRandom(),
|
@@ -2511,7 +2513,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2511
2513
|
};
|
2512
2514
|
|
2513
2515
|
// src/providers/transaction-request/script-transaction-request.ts
|
2514
|
-
var
|
2516
|
+
var import_abi_coder3 = require("@fuel-ts/abi-coder");
|
2515
2517
|
var import_address2 = require("@fuel-ts/address");
|
2516
2518
|
var import_configs10 = require("@fuel-ts/address/configs");
|
2517
2519
|
var import_math10 = require("@fuel-ts/math");
|
@@ -2703,7 +2705,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2703
2705
|
* @returns The current instance of the `ScriptTransactionRequest`.
|
2704
2706
|
*/
|
2705
2707
|
setData(abi, args) {
|
2706
|
-
const abiInterface = new
|
2708
|
+
const abiInterface = new import_abi_coder3.Interface(abi);
|
2707
2709
|
this.scriptData = abiInterface.functions.main.encodeArguments(args);
|
2708
2710
|
return this;
|
2709
2711
|
}
|
@@ -2825,17 +2827,17 @@ var import_math13 = require("@fuel-ts/math");
|
|
2825
2827
|
var import_transactions14 = require("@fuel-ts/transactions");
|
2826
2828
|
|
2827
2829
|
// src/providers/transaction-summary/call.ts
|
2828
|
-
var
|
2830
|
+
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
2829
2831
|
var import_math12 = require("@fuel-ts/math");
|
2830
2832
|
var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
2831
|
-
const abiInterface = new
|
2833
|
+
const abiInterface = new import_abi_coder4.Interface(abi);
|
2832
2834
|
const callFunctionSelector = receipt.param1.toHex(8);
|
2833
2835
|
const functionFragment = abiInterface.getFunction(callFunctionSelector);
|
2834
2836
|
const inputs = functionFragment.jsonFn.inputs;
|
2835
2837
|
let encodedArgs;
|
2836
2838
|
if (functionFragment.isInputDataPointer) {
|
2837
2839
|
if (rawPayload) {
|
2838
|
-
const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0,
|
2840
|
+
const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
|
2839
2841
|
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
2840
2842
|
}
|
2841
2843
|
} else {
|
@@ -3485,13 +3487,13 @@ function assembleTransactionSummary(params) {
|
|
3485
3487
|
}
|
3486
3488
|
|
3487
3489
|
// src/providers/transaction-response/getDecodedLogs.ts
|
3488
|
-
var
|
3490
|
+
var import_abi_coder5 = require("@fuel-ts/abi-coder");
|
3489
3491
|
var import_transactions16 = require("@fuel-ts/transactions");
|
3490
3492
|
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
3491
3493
|
return receipts.reduce((logs, receipt) => {
|
3492
3494
|
if (receipt.type === import_transactions16.ReceiptType.LogData || receipt.type === import_transactions16.ReceiptType.Log) {
|
3493
|
-
const interfaceToUse = new
|
3494
|
-
const data = receipt.type === import_transactions16.ReceiptType.Log ? new
|
3495
|
+
const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
|
3496
|
+
const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
3495
3497
|
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
|
3496
3498
|
logs.push(decodedLog);
|
3497
3499
|
}
|
@@ -4888,13 +4890,13 @@ var assets = [
|
|
4888
4890
|
];
|
4889
4891
|
|
4890
4892
|
// src/utils/formatTransferToContractScriptData.ts
|
4891
|
-
var
|
4893
|
+
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
4892
4894
|
var import_math17 = require("@fuel-ts/math");
|
4893
4895
|
var import_utils27 = require("@fuel-ts/utils");
|
4894
4896
|
var asm = __toESM(require("@fuels/vm-asm"));
|
4895
4897
|
var formatTransferToContractScriptData = (params) => {
|
4896
4898
|
const { assetId, amountToTransfer, hexlifiedContractId } = params;
|
4897
|
-
const numberCoder = new
|
4899
|
+
const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
|
4898
4900
|
const encoded = numberCoder.encode(new import_math17.BN(amountToTransfer).toNumber());
|
4899
4901
|
const scriptData = Uint8Array.from([
|
4900
4902
|
...(0, import_utils27.arrayify)(hexlifiedContractId),
|
@@ -8813,7 +8815,7 @@ var StorageAbstract = class {
|
|
8813
8815
|
};
|
8814
8816
|
|
8815
8817
|
// src/predicate/predicate.ts
|
8816
|
-
var
|
8818
|
+
var import_abi_coder7 = require("@fuel-ts/abi-coder");
|
8817
8819
|
var import_address10 = require("@fuel-ts/address");
|
8818
8820
|
var import_configs13 = require("@fuel-ts/address/configs");
|
8819
8821
|
var import_errors25 = require("@fuel-ts/errors");
|
@@ -8923,10 +8925,10 @@ var Predicate = class extends Account {
|
|
8923
8925
|
}
|
8924
8926
|
const mainFn = this.interface?.functions.main;
|
8925
8927
|
const paddedCode = new import_transactions20.ByteArrayCoder(this.bytes.length).encode(this.bytes);
|
8926
|
-
const VM_TX_MEMORY = (0,
|
8928
|
+
const VM_TX_MEMORY = (0, import_abi_coder7.calculateVmTxMemory)({
|
8927
8929
|
maxInputs: this.provider.getChain().consensusParameters.maxInputs.toNumber()
|
8928
8930
|
});
|
8929
|
-
const OFFSET = VM_TX_MEMORY +
|
8931
|
+
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;
|
8930
8932
|
return mainFn?.encodeArguments(this.predicateData, OFFSET) || new Uint8Array();
|
8931
8933
|
}
|
8932
8934
|
/**
|
@@ -8941,7 +8943,7 @@ var Predicate = class extends Account {
|
|
8941
8943
|
let predicateBytes = (0, import_utils37.arrayify)(bytes);
|
8942
8944
|
let abiInterface;
|
8943
8945
|
if (jsonAbi) {
|
8944
|
-
abiInterface = new
|
8946
|
+
abiInterface = new import_abi_coder7.Interface(jsonAbi);
|
8945
8947
|
if (abiInterface.functions.main === void 0) {
|
8946
8948
|
throw new import_errors25.FuelError(
|
8947
8949
|
import_errors25.ErrorCode.ABI_MAIN_METHOD_MISSING,
|