Skip to content

Commit

Permalink
chore: remove bytecode and salt from Receipt fragment (#1715)
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya authored Feb 5, 2024
1 parent a2e0ff6 commit e50b4d8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-steaks-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/providers": patch
---

Removing properties `bytecode` and `salt` from GraphQL `ReceiptFragment`
20 changes: 16 additions & 4 deletions packages/providers/src/operations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions packages/providers/src/transaction-summary/receipt.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/providers/src/utils/receipts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -66,7 +66,7 @@ export const getReceiptsWithMissingData = (receipts: Array<TransactionResultRece

const hexOrZero = (hex?: string | null) => hex || ZeroBytes32;

export function assembleReceiptByType(receipt: GqlReceipt) {
export function assembleReceiptByType(receipt: GqlReceiptFragmentFragment) {
const { receiptType } = receipt;

switch (receiptType) {
Expand Down
4 changes: 0 additions & 4 deletions packages/providers/test/fixtures/receipts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export const MOCK_GQL_RECEIPT_FRAGMENT: GqlReceiptFragmentFragment = {
to: {
__typename: 'Contract',
id: '0xfc69a2f25c26312fbecc7fce531eca80a2d315482c03fbc00d36b5cf065a0ac3',
bytecode: '0x74000003',
salt: '0x0000000000',
},
amount: '100',
assetId: '0x0000000000000000000000000000000000000000000000000000000000000000',
Expand All @@ -20,8 +18,6 @@ export const MOCK_GQL_RECEIPT_FRAGMENT: GqlReceiptFragmentFragment = {
contract: {
__typename: 'Contract',
id: '0xfc69a2f25c26312fbecc7fce531eca80a2d315482c03fbc00d36b5cf065a0ac3',
bytecode: '0x74000003',
salt: '0x0000000000',
},
val: '1',
ptr: '13296',
Expand Down

0 comments on commit e50b4d8

Please sign in to comment.