Skip to content

Commit

Permalink
Add thorswapApiKey
Browse files Browse the repository at this point in the history
  • Loading branch information
paullinator committed Nov 7, 2023
1 parent 79f5623 commit 3491eb3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- fixed: Check max spendable amount of source wallet in xrpdex quote
- fixed: Thorswap to use new server and apikey

## 1.0.1 (2023-10-30)

Expand Down
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 3491eb3

Please sign in to comment.