@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/test-utils.js
CHANGED
@@ -1051,6 +1051,7 @@ var MemoryCache = class {
|
|
1051
1051
|
};
|
1052
1052
|
|
1053
1053
|
// src/providers/transaction-request/input.ts
|
1054
|
+
var import_abi_coder = require("@fuel-ts/abi-coder");
|
1054
1055
|
var import_configs2 = require("@fuel-ts/address/configs");
|
1055
1056
|
var import_errors3 = require("@fuel-ts/errors");
|
1056
1057
|
var import_math2 = require("@fuel-ts/math");
|
@@ -1064,8 +1065,8 @@ var inputify = (value) => {
|
|
1064
1065
|
const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
|
1065
1066
|
return {
|
1066
1067
|
type: import_transactions.InputType.Coin,
|
1067
|
-
txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0,
|
1068
|
-
outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(
|
1068
|
+
txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, import_abi_coder.BYTES_32)),
|
1069
|
+
outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(import_abi_coder.BYTES_32, import_abi_coder.UTXO_ID_LEN)),
|
1069
1070
|
owner: (0, import_utils3.hexlify)(value.owner),
|
1070
1071
|
amount: (0, import_math2.bn)(value.amount),
|
1071
1072
|
assetId: (0, import_utils3.hexlify)(value.assetId),
|
@@ -1183,6 +1184,7 @@ var outputify = (value) => {
|
|
1183
1184
|
};
|
1184
1185
|
|
1185
1186
|
// src/providers/transaction-request/transaction-request.ts
|
1187
|
+
var import_abi_coder2 = require("@fuel-ts/abi-coder");
|
1186
1188
|
var import_address = require("@fuel-ts/address");
|
1187
1189
|
var import_configs7 = require("@fuel-ts/address/configs");
|
1188
1190
|
var import_crypto = require("@fuel-ts/crypto");
|
@@ -2055,12 +2057,12 @@ var BaseTransactionRequest = class {
|
|
2055
2057
|
const updateAssetInput = (assetId, quantity) => {
|
2056
2058
|
const assetInput = findAssetInput(assetId);
|
2057
2059
|
if (assetInput && "assetId" in assetInput) {
|
2058
|
-
assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(
|
2060
|
+
assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
|
2059
2061
|
assetInput.amount = quantity;
|
2060
2062
|
} else {
|
2061
2063
|
this.addResources([
|
2062
2064
|
{
|
2063
|
-
id: (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(
|
2065
|
+
id: (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN)),
|
2064
2066
|
amount: quantity,
|
2065
2067
|
assetId,
|
2066
2068
|
owner: resourcesOwner || import_address.Address.fromRandom(),
|
@@ -2315,7 +2317,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2315
2317
|
};
|
2316
2318
|
|
2317
2319
|
// src/providers/transaction-request/script-transaction-request.ts
|
2318
|
-
var
|
2320
|
+
var import_abi_coder3 = require("@fuel-ts/abi-coder");
|
2319
2321
|
var import_address2 = require("@fuel-ts/address");
|
2320
2322
|
var import_configs10 = require("@fuel-ts/address/configs");
|
2321
2323
|
var import_math10 = require("@fuel-ts/math");
|
@@ -2507,7 +2509,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2507
2509
|
* @returns The current instance of the `ScriptTransactionRequest`.
|
2508
2510
|
*/
|
2509
2511
|
setData(abi, args) {
|
2510
|
-
const abiInterface = new
|
2512
|
+
const abiInterface = new import_abi_coder3.Interface(abi);
|
2511
2513
|
this.scriptData = abiInterface.functions.main.encodeArguments(args);
|
2512
2514
|
return this;
|
2513
2515
|
}
|
@@ -2629,17 +2631,17 @@ var import_math13 = require("@fuel-ts/math");
|
|
2629
2631
|
var import_transactions14 = require("@fuel-ts/transactions");
|
2630
2632
|
|
2631
2633
|
// src/providers/transaction-summary/call.ts
|
2632
|
-
var
|
2634
|
+
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
2633
2635
|
var import_math12 = require("@fuel-ts/math");
|
2634
2636
|
var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
|
2635
|
-
const abiInterface = new
|
2637
|
+
const abiInterface = new import_abi_coder4.Interface(abi);
|
2636
2638
|
const callFunctionSelector = receipt.param1.toHex(8);
|
2637
2639
|
const functionFragment = abiInterface.getFunction(callFunctionSelector);
|
2638
2640
|
const inputs = functionFragment.jsonFn.inputs;
|
2639
2641
|
let encodedArgs;
|
2640
2642
|
if (functionFragment.isInputDataPointer) {
|
2641
2643
|
if (rawPayload) {
|
2642
|
-
const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0,
|
2644
|
+
const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
|
2643
2645
|
encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
|
2644
2646
|
}
|
2645
2647
|
} else {
|
@@ -3242,13 +3244,13 @@ function assembleTransactionSummary(params) {
|
|
3242
3244
|
}
|
3243
3245
|
|
3244
3246
|
// src/providers/transaction-response/getDecodedLogs.ts
|
3245
|
-
var
|
3247
|
+
var import_abi_coder5 = require("@fuel-ts/abi-coder");
|
3246
3248
|
var import_transactions16 = require("@fuel-ts/transactions");
|
3247
3249
|
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
3248
3250
|
return receipts.reduce((logs, receipt) => {
|
3249
3251
|
if (receipt.type === import_transactions16.ReceiptType.LogData || receipt.type === import_transactions16.ReceiptType.Log) {
|
3250
|
-
const interfaceToUse = new
|
3251
|
-
const data = receipt.type === import_transactions16.ReceiptType.Log ? new
|
3252
|
+
const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
|
3253
|
+
const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
3252
3254
|
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
|
3253
3255
|
logs.push(decodedLog);
|
3254
3256
|
}
|
@@ -4479,13 +4481,13 @@ var assets = [
|
|
4479
4481
|
];
|
4480
4482
|
|
4481
4483
|
// src/utils/formatTransferToContractScriptData.ts
|
4482
|
-
var
|
4484
|
+
var import_abi_coder6 = require("@fuel-ts/abi-coder");
|
4483
4485
|
var import_math17 = require("@fuel-ts/math");
|
4484
4486
|
var import_utils27 = require("@fuel-ts/utils");
|
4485
4487
|
var asm = __toESM(require("@fuels/vm-asm"));
|
4486
4488
|
var formatTransferToContractScriptData = (params) => {
|
4487
4489
|
const { assetId, amountToTransfer, hexlifiedContractId } = params;
|
4488
|
-
const numberCoder = new
|
4490
|
+
const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
|
4489
4491
|
const encoded = numberCoder.encode(new import_math17.BN(amountToTransfer).toNumber());
|
4490
4492
|
const scriptData = Uint8Array.from([
|
4491
4493
|
...(0, import_utils27.arrayify)(hexlifiedContractId),
|