Skip to content

Commit

Permalink
fix: add open ocean api to csp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Jan 9, 2024
1 parent 5dc5ab8 commit a334e7f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
18 changes: 10 additions & 8 deletions features/withdrawals/hooks/useWithdrawalRates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ type GetRateType = (
type GetWithdrawalRateResult = SingleWithdrawalRateResult[];

const getOpenOceanWithdrawalRate: GetRateType = async ({ amount, token }) => {
try {
const rate = await getOpenOceanRate(amount, token, 'ETH');
return {
name: 'openOcean',
...rate,
};
} catch (e) {
console.warn('[getOpenOceanRate] Failed to receive withdraw rate', e);
if (amount && amount.gt(Zero)) {
try {
const rate = await getOpenOceanRate(amount, token, 'ETH');
return {
name: 'openOcean',
...rate,
};
} catch (e) {
console.warn('[getOpenOceanRate] Failed to receive withdraw rate', e);
}
}

return {
Expand Down
7 changes: 4 additions & 3 deletions utilsApi/withCSP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ export const contentSecurityPolicy = {
'wss://*.walletlink.org/',
'https://cloudflare-eth.com/',
'https://rpc.ankr.com',
'https://cdn.live.ledger.com/',
'https://cdn.live.ledger.com',
'https://api-lido.1inch.io',
'https://apiv5.paraswap.io/',
'https://api.cow.fi/',
'https://apiv5.paraswap.io',
'https://api.cow.fi',
'https://open-api.openocean.finance',
...trustedHosts,
],
frameAncestors: ['*'],
Expand Down

0 comments on commit a334e7f

Please sign in to comment.