From 8887a2a89864142b3601a3e4041da741ca24310b Mon Sep 17 00:00:00 2001 From: Quinn Purdy Date: Fri, 15 Dec 2023 17:06:55 -0500 Subject: [PATCH] Pass builder api key as 'X-Access-Key' header when making indexer requests --- Assets/SequenceSDK/Indexer/Indexer.cs | 4 ++++ Assets/SequenceSDK/Indexer/SequenceIndexer.asmdef | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/SequenceSDK/Indexer/Indexer.cs b/Assets/SequenceSDK/Indexer/Indexer.cs index a8e6d105..86cf18cf 100644 --- a/Assets/SequenceSDK/Indexer/Indexer.cs +++ b/Assets/SequenceSDK/Indexer/Indexer.cs @@ -9,6 +9,7 @@ using System.Runtime.CompilerServices; using System.IO; using System.Net; +using Sequence.Config; namespace Sequence { @@ -80,6 +81,8 @@ private static readonly Dictionary IndexerNames { (int)Chain.TestnetBaseGoerli, "base-goerli" }, }; + private static string _builderApiKey = SequenceConfig.GetConfig().BuilderAPIKey_Prod; + /// /// Combines and to suffix on to the Base Address /// @@ -237,6 +240,7 @@ private static async Task 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 diff --git a/Assets/SequenceSDK/Indexer/SequenceIndexer.asmdef b/Assets/SequenceSDK/Indexer/SequenceIndexer.asmdef index 6935d0ee..b2e330a3 100644 --- a/Assets/SequenceSDK/Indexer/SequenceIndexer.asmdef +++ b/Assets/SequenceSDK/Indexer/SequenceIndexer.asmdef @@ -2,7 +2,8 @@ "name": "SequenceIndexer", "rootNamespace": "", "references": [ - "GUID:f7fd4ba36aabd1d499450c174865e70b" + "GUID:f7fd4ba36aabd1d499450c174865e70b", + "GUID:a35e3a53d4439435f8b36ed2c6158cd8" ], "includePlatforms": [], "excludePlatforms": [],