From e50b4d8c1a05635c21c8236cea35401ce63a51df Mon Sep 17 00:00:00 2001 From: Anderson Arboleya Date: Mon, 5 Feb 2024 09:03:58 -0300 Subject: [PATCH] chore: remove `bytecode` and `salt` from Receipt fragment (#1715) --- .changeset/sixty-steaks-wonder.md | 5 +++++ packages/providers/src/operations.graphql | 20 +++++++++++++++---- .../src/transaction-summary/receipt.ts | 6 ++++-- packages/providers/src/utils/receipts.ts | 4 ++-- packages/providers/test/fixtures/receipts.ts | 4 ---- 5 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 .changeset/sixty-steaks-wonder.md diff --git a/.changeset/sixty-steaks-wonder.md b/.changeset/sixty-steaks-wonder.md new file mode 100644 index 00000000000..a4c1192c73b --- /dev/null +++ b/.changeset/sixty-steaks-wonder.md @@ -0,0 +1,5 @@ +--- +"@fuel-ts/providers": patch +--- + +Removing properties `bytecode` and `salt` from GraphQL `ReceiptFragment` diff --git a/packages/providers/src/operations.graphql b/packages/providers/src/operations.graphql index a17615a0684..291adb0a26f 100644 --- a/packages/providers/src/operations.graphql +++ b/packages/providers/src/operations.graphql @@ -44,15 +44,27 @@ fragment transactionFragment on Transaction { fragment receiptFragment on Receipt { contract { id - bytecode - salt + # + # NOTE: + # Props removed due to excessive bandwidth usage: + # https://github.com/FuelLabs/fuels-ts/issues/1706 + # + # bytecode + # salt + # } pc is to { id - bytecode - salt + # + # NOTE: + # Props removed due to excessive bandwidth usage: + # https://github.com/FuelLabs/fuels-ts/issues/1706 + # + # bytecode + # salt + # } toAddress amount diff --git a/packages/providers/src/transaction-summary/receipt.ts b/packages/providers/src/transaction-summary/receipt.ts index b7d2f7f17a5..1d6e45f316f 100644 --- a/packages/providers/src/transaction-summary/receipt.ts +++ b/packages/providers/src/transaction-summary/receipt.ts @@ -1,12 +1,14 @@ import { ReceiptType } from '@fuel-ts/transactions'; -import type { GqlReceipt } from '../__generated__/operations'; +import type { GqlReceiptFragmentFragment } from '../__generated__/operations'; import type { TransactionResultReceipt } from '../transaction-response'; import { assembleReceiptByType } from '../utils'; import type { BurnedAsset, MintedAsset } from './types'; -export const processGqlReceipt = (gqlReceipt: GqlReceipt): TransactionResultReceipt => { +export const processGqlReceipt = ( + gqlReceipt: GqlReceiptFragmentFragment +): TransactionResultReceipt => { const receipt = assembleReceiptByType(gqlReceipt); switch (receipt.type) { diff --git a/packages/providers/src/utils/receipts.ts b/packages/providers/src/utils/receipts.ts index 80cb3b2a160..1bf7055c026 100644 --- a/packages/providers/src/utils/receipts.ts +++ b/packages/providers/src/utils/receipts.ts @@ -25,7 +25,7 @@ import { import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from '@fuel-ts/transactions/configs'; import { getBytesCopy } from 'ethers'; -import type { GqlReceipt } from '../__generated__/operations'; +import type { GqlReceiptFragmentFragment } from '../__generated__/operations'; import { GqlReceiptType } from '../__generated__/operations'; import type { TransactionResultReceipt } from '../transaction-response'; @@ -66,7 +66,7 @@ export const getReceiptsWithMissingData = (receipts: Array hex || ZeroBytes32; -export function assembleReceiptByType(receipt: GqlReceipt) { +export function assembleReceiptByType(receipt: GqlReceiptFragmentFragment) { const { receiptType } = receipt; switch (receiptType) { diff --git a/packages/providers/test/fixtures/receipts.ts b/packages/providers/test/fixtures/receipts.ts index 61c01fb93ff..b1e3430ffab 100644 --- a/packages/providers/test/fixtures/receipts.ts +++ b/packages/providers/test/fixtures/receipts.ts @@ -9,8 +9,6 @@ export const MOCK_GQL_RECEIPT_FRAGMENT: GqlReceiptFragmentFragment = { to: { __typename: 'Contract', id: '0xfc69a2f25c26312fbecc7fce531eca80a2d315482c03fbc00d36b5cf065a0ac3', - bytecode: '0x74000003', - salt: '0x0000000000', }, amount: '100', assetId: '0x0000000000000000000000000000000000000000000000000000000000000000', @@ -20,8 +18,6 @@ export const MOCK_GQL_RECEIPT_FRAGMENT: GqlReceiptFragmentFragment = { contract: { __typename: 'Contract', id: '0xfc69a2f25c26312fbecc7fce531eca80a2d315482c03fbc00d36b5cf065a0ac3', - bytecode: '0x74000003', - salt: '0x0000000000', }, val: '1', ptr: '13296',