Skip to content

Commit

Permalink
chore: remove call ops in tx summary (#3734)
Browse files Browse the repository at this point in the history
* feat: deprecate call ops in tx summary

* chore: changeset

* chore: changeset
  • Loading branch information
danielbate authored Feb 24, 2025
1 parent 043d211 commit da33ca5
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-bats-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/account": patch
---

chore: remove call ops in tx summary
6 changes: 6 additions & 0 deletions packages/account/src/providers/transaction-summary/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export interface FunctionCall {
argumentsProvided: Record<string, unknown> | undefined;
}

/**
* Builds a FunctionCall object from a call receipt.
*
* Currently only supports the first function call, multicall is not supported.
* This should be https://github.com/FuelLabs/fuels-ts/issues/3733.
*/
export const getFunctionCall = ({
abi,
receipt,
Expand Down
20 changes: 8 additions & 12 deletions packages/account/src/providers/transaction-summary/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type {
} from '../transaction-response';

import type { FunctionCall } from './call';
import { getFunctionCall } from './call';
import {
getInputFromAssetId,
getInputAccountAddress,
Expand Down Expand Up @@ -274,23 +273,20 @@ export function getWithdrawFromFuelOperations({
function getContractCalls(
contractInput: InputContract,
abiMap: AbiMap | undefined,
receipt: TransactionResultCallReceipt,
rawPayload: string,
maxInputs: BN
_receipt: TransactionResultCallReceipt,
_rawPayload: string,
_maxInputs: BN
): FunctionCall[] {
const abi = abiMap?.[contractInput.contractID];
if (!abi) {
return [];
}

return [
getFunctionCall({
abi,
receipt,
rawPayload,
maxInputs,
}),
];
// Until we can successfully decode all operations, including multicall we
// will just return an empty. This should then be reintroduced in
// https://github.com/FuelLabs/fuels-ts/issues/3733
return [];
// return [ getFunctionCall({ abi, receipt, rawPayload, maxInputs }) ];
}

/** @hidden */
Expand Down
45 changes: 41 additions & 4 deletions packages/fuel-gauge/src/transaction-summary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,38 @@ describe('TransactionSummary', () => {
});
});

it('should ensure getTransactionsSummaries executes just fine [w/ ABI & call op]', async () => {
// We can remove this test once https://github.com/FuelLabs/fuels-ts/issues/3733 has been resolved as the
// below tests are more verbose. But this ensures the method does not throw with an ABI map provided.
it('should ensure getTransactionsSummaries executes just fine [w/ ABI map]', async () => {
using launched = await launchTestNode({
contractsConfigs: [
{
factory: TokenContractFactory,
},
],
});

const {
contracts: [contract],
} = launched;

const contractId = contract.id.toB256();

const call = await contract.functions.mint_coins(bn(100_000)).call();
const res = await call.waitForResult();

const summary = await res.transactionResponse.getTransactionSummary({
[contractId]: TokenContract.abi,
});

validateTxSummary({
transaction: summary,
});
});

// Test disabled due to unsupported call ops in tx summaries. We should re-enable this via
// https://github.com/FuelLabs/fuels-ts/issues/3733
it.skip('should ensure getTransactionsSummaries executes just fine [w/ ABI & call op]', async () => {
using launched = await launchTestNode({
contractsConfigs: [
{
Expand Down Expand Up @@ -340,7 +371,9 @@ describe('TransactionSummary', () => {
});
});

it('should ensure getTransactionsSummaries executes just fine [w/ ABI & call w/ transfer op]', async () => {
// Test disabled due to unsupported call ops in tx summaries. We should re-enable this via
// https://github.com/FuelLabs/fuels-ts/issues/3733
it.skip('should ensure getTransactionsSummaries executes just fine [w/ ABI & call w/ transfer op]', async () => {
using launched = await launchTestNode({
contractsConfigs: [
{
Expand Down Expand Up @@ -396,7 +429,9 @@ describe('TransactionSummary', () => {
});
});

it('should ensure getTransactionSummary fn executes just fine [w/ ABI & call op]', async () => {
// Test disabled due to unsupported call ops in tx summaries. We should re-enable this via
// https://github.com/FuelLabs/fuels-ts/issues/3733
it.skip('should ensure getTransactionSummary fn executes just fine [w/ ABI & call op]', async () => {
using launched = await launchTestNode({
contractsConfigs: [
{
Expand Down Expand Up @@ -449,7 +484,9 @@ describe('TransactionSummary', () => {
// expect(summary).toStrictEqual(responseSummary);
});

it('should ensure getTransactionSummary fn executes just fine [w/ ABI & call w/ transfer op]', async () => {
// Test disabled due to unsupported call ops in tx summaries. We should re-enable this via
// https://github.com/FuelLabs/fuels-ts/issues/3733
it.skip('should ensure getTransactionSummary fn executes just fine [w/ ABI & call w/ transfer op]', async () => {
using launched = await launchTestNode({
contractsConfigs: [
{
Expand Down

0 comments on commit da33ca5

Please sign in to comment.