-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287 from pendulum-chain/polygon-prototype-staging
Create new production release
- Loading branch information
Showing
63 changed files
with
2,805 additions
and
1,085 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"type": "module", | ||
"packageManager": "[email protected]+sha512.837566d24eec14ec0f5f1411adb544e892b3454255e61fdef8fd05f3429480102806bac7446bc9daff3896b01ae4b62d00096c7e989f1596f2af10b927532f39", | ||
"scripts": { | ||
"dev": "vite", | ||
"dev": "vite --host", | ||
"build": "tsc && vite build && cp -R src/assets/coins dist/assets/coins && echo '/* /index.html 200' | cat > dist/_redirects", | ||
"preview": "vite preview", | ||
"lint": "eslint . --ext .ts,.tsx", | ||
|
@@ -34,7 +34,8 @@ | |
"@polkadot/types": "^13.2.1", | ||
"@polkadot/util": "^13.1.1", | ||
"@polkadot/util-crypto": "^13.1.1", | ||
"@rainbow-me/rainbowkit": "^2.1.7", | ||
"@reown/appkit": "^1.3.1", | ||
"@reown/appkit-adapter-wagmi": "^1.3.1", | ||
"@sentry/react": "^8.36.0", | ||
"@sentry/vite-plugin": "^2.22.6", | ||
"@talismn/connect-components": "^1.1.8", | ||
|
@@ -60,8 +61,8 @@ | |
"stellar-sdk": "^11.3.0", | ||
"tailwind": "^4.0.0", | ||
"tailwindcss": "^3.4.3", | ||
"viem": "2.x", | ||
"wagmi": "^2.10.3", | ||
"viem": "^2.21.43", | ||
"wagmi": "^2.12.29", | ||
"web3": "^4.10.0", | ||
"yup": "^1.4.0" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require('dotenv').config(); | ||
|
||
const alchemyPayService = require('../services/alchemypay.service'); | ||
const transakService = require('../services/transak.service'); | ||
const moonpayService = require('../services/moonpay.service'); | ||
|
||
exports.SUPPORTED_PROVIDERS = ['alchemypay', 'moonpay', 'transak']; | ||
|
||
exports.SUPPORTED_CRYPTO_CURRENCIES = ['usdc', 'usdce', 'usdc.e', 'usdt']; | ||
|
||
exports.SUPPORTED_FIAT_CURRENCIES = ['eur', 'ars']; | ||
|
||
exports.getQuoteForProvider = async (req, res, next) => { | ||
const { provider, fromCrypto, toFiat, amount, network } = req.query; | ||
try { | ||
switch (provider.toLowerCase()) { | ||
case 'alchemypay': | ||
try { | ||
const alchemyPayQuote = await alchemyPayService.getQuoteFor(fromCrypto, toFiat, amount, network); | ||
return res.json(alchemyPayQuote); | ||
} catch (error) { | ||
// AlchemyPay's errors are not very descriptive, so we just return a generic error message | ||
return res.status(500).json({ error: 'Could not get quote from AlchemyPay', details: error.message }); | ||
} | ||
case 'moonpay': | ||
try { | ||
const moonpayQuote = await moonpayService.getQuoteFor(fromCrypto, toFiat, amount); | ||
return res.json(moonpayQuote); | ||
} catch (error) { | ||
if (error.message === 'Token not supported') { | ||
return res.status(404).json({ error: 'Token not supported' }); | ||
} | ||
return res.status(500).json({ error: 'Could not get quote from Moonpay', details: error.message }); | ||
} | ||
case 'transak': | ||
try { | ||
const transakQuote = await transakService.getQuoteFor(fromCrypto, toFiat, amount, network); | ||
return res.json(transakQuote); | ||
} catch (error) { | ||
if (error.message === 'Token not supported') { | ||
return res.status(404).json({ error: 'Token not supported' }); | ||
} | ||
return res.status(500).json({ error: 'Could not get quote from Transak', details: error.message }); | ||
} | ||
default: | ||
return res.status(400).json({ error: 'Invalid provider' }); | ||
} | ||
} catch (error) { | ||
console.error('Server error:', error); | ||
return res.status(500).json({ error: 'Server error', details: error.message }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const fetchTomlValues = async (tomlFileUrl) => { | ||
const response = await fetch(tomlFileUrl); | ||
if (response.status !== 200) { | ||
throw new Error(`Failed to fetch TOML file: ${response.statusText}`); | ||
} | ||
|
||
const tomlFileContent = (await response.text()).split('\n'); | ||
const findValueInToml = (key) => { | ||
const keyValue = tomlFileContent.find((line) => line.includes(key)); | ||
return keyValue?.split('=')[1].trim().replaceAll('"', ''); | ||
}; | ||
|
||
return { | ||
signingKey: findValueInToml('SIGNING_KEY'), | ||
webAuthEndpoint: findValueInToml('WEB_AUTH_ENDPOINT'), | ||
sep24Url: findValueInToml('TRANSFER_SERVER_SEP0024'), | ||
sep6Url: findValueInToml('TRANSFER_SERVER'), | ||
kycServer: findValueInToml('KYC_SERVER'), | ||
}; | ||
}; | ||
|
||
module.exports = { fetchTomlValues }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const express = require('express'); | ||
const controller = require('../../controllers/quote.controller'); | ||
const { validateQuoteInput } = require('../../middlewares/validators'); | ||
|
||
const router = express.Router({ mergeParams: true }); | ||
|
||
router.route('/').get(validateQuoteInput, controller.getQuoteForProvider); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
const express = require('express'); | ||
const controller = require('../../controllers/stellar.controller'); | ||
const { validateCreationInput, validateChangeOpInput } = require('../../middlewares/validators'); | ||
const { validateCreationInput, validateChangeOpInput, validateSep10Input } = require('../../middlewares/validators'); | ||
|
||
const router = express.Router({ mergeParams: true }); | ||
|
||
router.route('/create').post(validateCreationInput, controller.createStellarTransaction); | ||
|
||
router.route('/payment').post(validateChangeOpInput, controller.changeOpTransaction); | ||
|
||
router.route('/sep10').post(validateSep10Input, controller.signSep10Challenge); | ||
|
||
module.exports = router; |
Oops, something went wrong.