Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ PENDING_PAYMENT_WINDOW=5

# Fiat currency rate API
FIAT_RATE_NAME=''
FIAT_RATE_EP=''
FIAT_RATE_EP='https://api.yadio.io/convert'
NODE_ENV='development'

# Expiration time for published order in seconds
Expand Down
2 changes: 1 addition & 1 deletion docs/INSTALL.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ CHANNEL='@tu-canal-de-ofertas'
ADMIN_CHANNEL='-10*****46'
HELP_GROUP='@tu-grupo-de-soporte'

FIAT_RATE_EP='https://api.yadio.io/rate'
FIAT_RATE_EP='https://api.yadio.io/convert'

DISPUTE_CHANNEL='@tu-canal-de-disputas'

Expand Down
2 changes: 1 addition & 1 deletion docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ CHANNEL='@your-offers-channel'
ADMIN_CHANNEL='-10*****46'
HELP_GROUP='@your-support-group'

FIAT_RATE_EP='https://api.yadio.io/rate'
FIAT_RATE_EP='https://api.yadio.io/convert'

DISPUTE_CHANNEL='@your-dispute-channel'

Expand Down
6 changes: 4 additions & 2 deletions util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ const getBtcFiatPrice = async (fiatCode: string, fiatAmount: number) => {
if (!currency.price) return;
// Before hit the endpoint we make sure the code have only 3 chars
const code = currency.code.substring(0, 3);
const response = await axios.get(`${process.env.FIAT_RATE_EP}/${code}`);
const response = await axios.get(
`${process.env.FIAT_RATE_EP}/${fiatAmount}/${code}/BTC`,
);
if (response.data.error) {
return 0;
}
const sats = (fiatAmount / response.data.btc) * 100000000;
const sats = response.data.result * 100000000;

return Number(sats);
} catch (error) {
Expand Down
Loading