Skip to content

Commit

Permalink
Merge pull request #1549 from input-output-hk/fix/blockfrost-tx-submi…
Browse files Browse the repository at this point in the history
…t-binary-body

fix(cardano-services-client): correct blockfrost tx submit request body
  • Loading branch information
mkazlauskas authored Dec 16, 2024
2 parents 3da1f4a + eb2f69d commit 2deb2b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class BlockfrostTxSubmitProvider extends BlockfrostProvider implements Tx
async submitTx({ signedTransaction }: SubmitTxArgs): Promise<void> {
// @ todo handle context and resolutions
await this.request<string>('tx/submit', {
body: signedTransaction,
body: Buffer.from(signedTransaction, 'hex'),
headers: { 'Content-Type': 'application/cbor' },
method: 'POST'
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { BlockfrostClient, BlockfrostTxSubmitProvider } from '../../src';
import { HexBlob } from '@cardano-sdk/util';
import { ProviderError } from '@cardano-sdk/core';
import { logger } from '@cardano-sdk/util-dev';
import { mockResponses } from '../util';
Expand All @@ -17,7 +18,7 @@ describe('blockfrostTxSubmitProvider', () => {
describe('submitTx', () => {
it('wraps error in UnknownTxSubmissionError', async () => {
mockResponses(request, [['tx/submit', new Error('some error')]]);
await expect(provider.submitTx({ signedTransaction: null as any })).rejects.toThrowError(ProviderError);
await expect(provider.submitTx({ signedTransaction: HexBlob('abc') })).rejects.toThrowError(ProviderError);
});
});
});

0 comments on commit 2deb2b9

Please sign in to comment.