Skip to content

Commit

Permalink
Pass builder api key as 'X-Access-Key' header when making indexer req…
Browse files Browse the repository at this point in the history
…uests
  • Loading branch information
BellringerQuinn committed Dec 15, 2023
1 parent caaec04 commit 8887a2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Assets/SequenceSDK/Indexer/Indexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Runtime.CompilerServices;
using System.IO;
using System.Net;
using Sequence.Config;

namespace Sequence
{
Expand Down Expand Up @@ -80,6 +81,8 @@ private static readonly Dictionary<BigInteger, string> IndexerNames
{ (int)Chain.TestnetBaseGoerli, "base-goerli" },
};

private static string _builderApiKey = SequenceConfig.GetConfig().BuilderAPIKey_Prod;

/// <summary>
/// Combines <see cref="PATH"/> and <paramref name="name"/> to suffix on to the Base Address
/// </summary>
Expand Down Expand Up @@ -237,6 +240,7 @@ private static async Task<string> HttpPost(BigInteger chainID, string endPoint,
using var req = UnityWebRequest.Put(Url(chainID, endPoint), requestJson);
req.SetRequestHeader("Content-Type", "application/json");
req.SetRequestHeader("Accept", "application/json");
req.SetRequestHeader("X-Access-Key", _builderApiKey);
req.method = UnityWebRequest.kHttpVerbPOST;
req.timeout = 10; // Request will timeout after 10 seconds

Expand Down
3 changes: 2 additions & 1 deletion Assets/SequenceSDK/Indexer/SequenceIndexer.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "SequenceIndexer",
"rootNamespace": "",
"references": [
"GUID:f7fd4ba36aabd1d499450c174865e70b"
"GUID:f7fd4ba36aabd1d499450c174865e70b",
"GUID:a35e3a53d4439435f8b36ed2c6158cd8"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down

0 comments on commit 8887a2a

Please sign in to comment.