diff --git a/graphql/server.ts b/graphql/server.ts index 23ead82..de01a5b 100644 --- a/graphql/server.ts +++ b/graphql/server.ts @@ -69,7 +69,7 @@ const setupGraphQLServer = () => { const graphQLServer = setupGraphQLServer(); if (Config.ENV === 'development') { - graphQLServer.listen(3000); + graphQLServer.listen(4000); } export const graphql = onRequest(graphQLServer); diff --git a/package.json b/package.json index 183beef..2ee0c02 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "pg": "6.1.6", "pg-hstore": "^2.3.2", "sequelize": "4.22.6", - "stellar-sdk": "2.0.0-rc.2", + "stellar-sdk": "5.0.0", "stripe": "^6.5.0", "ts-node": "3.1.0", "typescript": "^2.2.2", diff --git a/payments/stellar.ts b/payments/stellar.ts index 52d65c4..18e83e7 100644 --- a/payments/stellar.ts +++ b/payments/stellar.ts @@ -1,13 +1,7 @@ import fetch from 'node-fetch'; import StellarSdkLibrary = require('stellar-sdk'); import { Config } from '../config'; -export const BASE_FEE = 102; // stroops - -if (Config.ENV === 'production') { - StellarSdkLibrary.Network.usePublicNetwork(); -} else { - StellarSdkLibrary.Network.useTestNetwork(); -} +export const BASE_FEE = '102'; // stroops export const stellarServer = new StellarSdkLibrary.Server(Config.HORIZON_URL); export const StellarSdk = StellarSdkLibrary; @@ -223,7 +217,7 @@ export async function getUSDPrice() { export async function convertUSDtoXLM(USDAmount: number) { if (Config.ENV === 'production') { const currentPrice = await getUSDPrice(); - const XLMAmount = USDAmount * currentPrice; + const XLMAmount = USDAmount * parseInt(currentPrice); return XLMAmount; } // using 12.5 cents as reference diff --git a/yarn.lock b/yarn.lock index 3839c37..2349cef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -130,6 +130,13 @@ version "8.10.43" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.43.tgz#8d3281a33c92a56038b05d9460a65bc1dcd5735b" +"@types/randombytes@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/randombytes/-/randombytes-2.0.0.tgz#0087ff5e60ae68023b9bc4398b406fea7ad18304" + integrity sha512-bz8PhAVlwN72vqefzxa14DKNT8jK/mV66CSjwdVQM/k3Th3EPKfUtdMniwZgMedQTFuywAsfjnZsg+pEnltaMA== + dependencies: + "@types/node" "*" + "@types/request@^2.0.3": version "2.0.8" resolved "https://registry.yarnpkg.com/@types/request/-/request-2.0.8.tgz#424d3de255868107ed4dd6695c65c5f1766aba80" @@ -158,10 +165,10 @@ dependencies: "@types/node" "*" -"@types/urijs@^1.19.2": - version "1.19.3" - resolved "https://registry.yarnpkg.com/@types/urijs/-/urijs-1.19.3.tgz#ed90d38baf3eff1627544ad6ed3bcdeb79ef3533" - integrity sha512-L5tP2dEIV+OMVEVRhf8PCFMNMyO5ZBodrXpEqnGczky60lcv8l5Kl9Yi4J1yxhSVfHUe+Pr2nXJfDM+rUYNs3w== +"@types/urijs@^1.19.6": + version "1.19.8" + resolved "https://registry.yarnpkg.com/@types/urijs/-/urijs-1.19.8.tgz#a66b2fd8b1d3cf3ef5bae7ca093b7d1b50e48c0a" + integrity sha512-SVQd2Qq0oL+b8VtJbQyv0cMIdU7fbRDcg2JIpcBvv+GUayJ3c5Ll1K+iivZl6ifcI6NbYcwjqDjljDFSiSGOeA== "@types/validator@*": version "6.2.0" @@ -686,11 +693,6 @@ cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" -core-js@^2.6.3: - version "2.6.9" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" - integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== - core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -1548,12 +1550,11 @@ js-tokens@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-xdr@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/js-xdr/-/js-xdr-1.1.2.tgz#aba1f0952508c83f33dd7e774fa9231b3073992b" - integrity sha512-ipiz1CnsyjLsba+QQd5jezGXddNKGa4oO9EODy0kWr3G3R8MNslIxkhQFpyRfY3yoY7YplhRVfC3cmXb4AobZQ== +js-xdr@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/js-xdr/-/js-xdr-1.1.4.tgz#678df4c6f8c7960de85bdf3bfa02b89df2730777" + integrity sha512-Xhwys9hyDZQDisxCKZi2nDhvGg6fKhsEgAUaJlzjwo32mZ2gZVIQl3+w4Le5SX5dsKDsboFdM2gnu5JALWetTg== dependencies: - core-js "^2.6.3" cursor "^0.1.5" lodash "^4.17.5" long "^2.2.3" @@ -2437,6 +2438,13 @@ querystringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.0.0.tgz#fa3ed6e68eb15159457c89b37bc6472833195755" +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" @@ -2654,6 +2662,11 @@ safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-buffer@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + safe-buffer@^5.1.1, safe-buffer@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -2854,36 +2867,38 @@ sshpk@^1.7.0: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" -stellar-base@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-1.0.2.tgz#081121e19f90a66becf741ce1f370d700c3ea2a6" - integrity sha512-L7w+wWPH+zjRzWXNwovl76oQozB7Gj+jZaqMIb4H+5i2ELnFd/7im9JTl/3PQ2iKffipz+X6Px6fxD6H8K/z7A== +stellar-base@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-3.0.2.tgz#09083c8f2eb68eddb820504d3b19576da0632c31" + integrity sha512-ZZji4go8gRT932OTuUSggohWWuRIs11C99ShokoIurmWPwh0NsvkxN2cBxfEfQi/TdiO1/DiteCzz7w233AfXA== dependencies: base32.js "^0.1.0" bignumber.js "^4.0.0" crc "^3.5.0" - js-xdr "^1.1.1" + js-xdr "^1.1.3" lodash "^4.17.11" sha.js "^2.3.6" tweetnacl "^1.0.0" optionalDependencies: sodium-native "^2.3.0" -stellar-sdk@2.0.0-rc.2: - version "2.0.0-rc.2" - resolved "https://registry.yarnpkg.com/stellar-sdk/-/stellar-sdk-2.0.0-rc.2.tgz#c40db8ac97f8e105302cebcb6d514656efe4d1a8" - integrity sha512-LjipZwxzfzY3BB8om9ASQTpyQceUgZCXkXkKBJqGfJnCRaBo3nVq8OdXLET9LFtkKe+X5b4xW4AozIs2LxcOvg== +stellar-sdk@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/stellar-sdk/-/stellar-sdk-5.0.0.tgz#c9cfd36ed9871142cc3ec9a9bbcd5efc834ec9c0" + integrity sha512-/D4OPnUnIXARkNwhnV9fFTBlDdulf/uAM/Gtb3l6T/0ERq8kiBbnI1GEKzlSNi1hWVAPulzpa9hw5NZWUdz4BQ== dependencies: "@types/eventsource" "^1.1.2" "@types/node" ">= 8" - "@types/urijs" "^1.19.2" + "@types/randombytes" "^2.0.0" + "@types/urijs" "^1.19.6" axios "^0.19.0" bignumber.js "^4.0.0" detect-node "^2.0.4" es6-promise "^4.2.4" eventsource "^1.0.7" lodash "^4.17.11" - stellar-base "^1.0.2" + randombytes "^2.1.0" + stellar-base "^3.0.0" toml "^2.3.0" tslib "^1.10.0" urijs "^1.19.1"