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 bytecode and salt from Receipt fragment #1715

Merged
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/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
Loading