@@ -6,7 +6,7 @@ import { expectToThrowFuelError, safeExec } from '@fuel-ts/errors/test-utils';
66import { BN , bn } from '@fuel-ts/math' ;
77import type { Receipt } from '@fuel-ts/transactions' ;
88import { InputType , OutputType , ReceiptType } from '@fuel-ts/transactions' ;
9- import { DateTime , arrayify , sleep } from '@fuel-ts/utils' ;
9+ import { DateTime , arrayify , hexlify , sleep } from '@fuel-ts/utils' ;
1010import { ASSET_A , ASSET_B } from '@fuel-ts/utils/test-utils' ;
1111import { versions } from '@fuel-ts/versions' ;
1212
@@ -2462,4 +2462,29 @@ describe('Provider', () => {
24622462 code : ErrorCode . SCRIPT_REVERTED ,
24632463 } ) ;
24642464 } ) ;
2465+
2466+ it ( 'can get compressed block bytes' , async ( ) => {
2467+ const bytes = hexlify ( randomBytes ( 32 ) ) ;
2468+
2469+ using launched = await setupTestProviderAndWallets ( ) ;
2470+ const { provider } = launched ;
2471+
2472+ // Should return null when block is not found
2473+ let compressed = await provider . daCompressedBlock ( '1' ) ;
2474+
2475+ expect ( compressed ) . toBeNull ( ) ;
2476+
2477+ vi . spyOn ( provider , 'daCompressedBlock' ) . mockImplementationOnce ( async ( ) =>
2478+ Promise . resolve ( {
2479+ bytes,
2480+ } )
2481+ ) ;
2482+
2483+ const block = await provider . getBlock ( 'latest' ) ;
2484+ compressed = await provider . daCompressedBlock ( String ( block ?. height ) ) ;
2485+
2486+ expect ( compressed ) . toStrictEqual ( { bytes } ) ;
2487+
2488+ vi . restoreAllMocks ( ) ;
2489+ } ) ;
24652490} ) ;
0 commit comments