Skip to content

Commit

Permalink
Merge branch 'feat/fiat-on-ramp-topper'
Browse files Browse the repository at this point in the history
  • Loading branch information
ants88 committed Jul 12, 2024
2 parents a09e0fc + 5539c9f commit e76f95e
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 4 deletions.
15 changes: 15 additions & 0 deletions handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ const getHistoryHandler = async (event) => {
return addHeader(result);
};

const { getQuote, getFiatCurrencyLimits } = require("./src/api/fiatOnRamp");
const getQuoteHandler = async (event) => {
const bodyParams = JSON.parse(event.body ?? {});
const result = await getQuote(bodyParams);
return addHeader(result);
};
const getFiatCurrencyLimitsHandler = async (event) => {
const { queryStringParameters } = event;
const queryParams = queryStringParameters ? queryStringParameters : {};
const result = await getFiatCurrencyLimits(queryParams);
return addHeader(result);
};

module.exports = {
pairsUpdaterHandler,
getAccountBalanceChartHandler,
Expand All @@ -108,6 +121,8 @@ module.exports = {
getHistoryHandler,
getAccountTransactionHistoryHandler,
getPerformanceSummaryHandler,
getQuoteHandler,
getFiatCurrencyLimitsHandler,
};

// module.exports.hello = async (event) => {
Expand Down
169 changes: 165 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@kadena/cryptography-utils": "^0.4.2",
"axios": "^1.2.2",
"dotenv": "^16.0.3",
"jsonwebtoken": "^9.0.2",
"luxon": "^3.2.1",
"node-fetch": "^3.3.0",
"pg": "^8.8.0",
Expand Down
23 changes: 23 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@ functions:
origin: "*" # <-- Specify allowed origin
headers: "*" # <-- Specify
allowCredentials: false
getQuote:
handler: handler.getQuoteHandler
description: get fiat on ramp quote
events:
- http:
path: /api/fiat-on-ramp/quote
method: post
cors:
origin: "*" # <-- Specify allowed origin
headers: "*" # <-- Specify
allowCredentials: false
getFiatCurrencyLimits:
handler: handler.getFiatCurrencyLimitsHandler
description: get fiat on ramp currency limits
timeout: 200
events:
- http:
path: /api/fiat-on-ramp/currencies
method: get
cors:
origin: "*" # <-- Specify allowed origin
headers: "*" # <-- Specify
allowCredentials: false
config:
handler: handler.getConfigHandler
description: udf config handler
Expand Down
Loading

0 comments on commit e76f95e

Please sign in to comment.