Skip to content

Commit

Permalink
Add thorswapApiKey
Browse files Browse the repository at this point in the history
  • Loading branch information
paullinator committed Nov 2, 2023
1 parent 217b163 commit 84413b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/swap/defi/thorchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ export const asInitOptions = asObject({
appId: asOptional(asString, 'edge'),
affiliateFeeBasis: asOptional(asString, AFFILIATE_FEE_BASIS_DEFAULT),
ninerealmsClientId: asOptional(asString, ''),
thorname: asOptional(asString, 'ej')
thorname: asOptional(asString, 'ej'),
thorswapApiKey: asOptional(asString)
})

const asMinAmount = asObject({
Expand Down
12 changes: 10 additions & 2 deletions src/swap/defi/thorchainDa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,20 @@ export function makeThorchainDaPlugin(
appId,
affiliateFeeBasis,
ninerealmsClientId,
thorname
thorname,
thorswapApiKey
} = asInitOptions(opts.initOptions)

const headers = {
'Content-Type': 'application/json',
'x-client-id': ninerealmsClientId
}

const thorswapHeaders = {
'Content-Type': 'application/json',
referer: thorswapApiKey
}

const fetchSwapQuoteInner = async (
request: EdgeSwapRequestPlugin
): Promise<SwapOrder> => {
Expand Down Expand Up @@ -247,7 +253,9 @@ export function makeThorchainDaPlugin(
headers
}
),
fetchWaterfall(fetchCors, thorswapServers, uri, { headers })
fetchWaterfall(fetchCors, thorswapServers, uri, {
headers: thorswapHeaders
})
])

if (!iaResponse.ok) {
Expand Down

0 comments on commit 84413b6

Please sign in to comment.