Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove call ops in tx summary #3734

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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