Skip to content

Commit

Permalink
feat(vote-commitment): added blockfrost auth header for submit api
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmorano committed Sep 24, 2024
1 parent 24af8e2 commit 94585c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public BlockchainTransactionSubmissionService backendServiceTransactionSubmissio
@Bean
@Profile( value = { "prod", "dev--preprod" } )
public BlockchainTransactionSubmissionService cardanoSummitTransactionSubmissionService(HttpClient httpClient,
@Value("${cardano.tx.submit.api.url}") String cardanoSubmitApiUrl) {
return new CardanoSubmitApiBlockchainTransactionSubmissionService(cardanoSubmitApiUrl, httpClient);
@Value("${cardano.tx.submit.api.url}") String cardanoSubmitApiUrl,
@Value("${blockfrost.api.key}") String blockfrostApiKey) {
return new CardanoSubmitApiBlockchainTransactionSubmissionService(cardanoSubmitApiUrl, httpClient, blockfrostApiKey);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ public class CardanoSubmitApiBlockchainTransactionSubmissionService implements B

private final HttpClient httpClient;

private final String blockfrostApiKey;

@Override
@SneakyThrows
public String submitTransaction(byte[] txData) {
var txTransactionSubmitPostRequest = HttpRequest.newBuilder()
.uri(URI.create(cardanoSubmitApiUrl))
.POST(HttpRequest.BodyPublishers.ofByteArray(txData))
.header("Content-Type", "application/cbor")
.header("project_id", blockfrostApiKey)
.build();

var r = httpClient.send(txTransactionSubmitPostRequest, HttpResponse.BodyHandlers.ofString());
Expand Down

0 comments on commit 94585c2

Please sign in to comment.