Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crypttp

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crypttp - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

4

env.js

@@ -6,3 +6,3 @@ const env = 'dev'

const host = (env == 'development') ? `http://localhost:${port+1}` : 'https://alemey.com'
const aloborio = (env == 'development') ? `http://localhost:${port+2}` : `https://api.alobor.io`
// const aloborio = (env == 'development') ? `http://localhost:${port+2}` : `https://api.alobor.io`

@@ -12,4 +12,4 @@ module.exports = {

getLink: `${apihost}/link?params=`,
api: apihost,
qrCodeRedirect: `${host}/crypttp`,
aloborio: aloborio
}
const axios = require('axios')
const env = require('./env')
const io = require('socket.io-client')
class isMobile {

@@ -49,5 +51,56 @@ constructor () {}

this.companyAccount = {}
this.subscribeToTransactionConfirmed()
}
subscribeToTransactionConfirmed () {
axios({
method:"get",
url: `${env.api}/find_service/blockchain`
})
.then(response => {
this.blockchain_service = response.data
this.io = io(this.blockchain_service);
this.io.on('transaction_paid', (msg) => {
this.saveStats(msg, this.orderDetails)
/**
* @dev here probably i can add showing success pop
*/
})
})
}
saveStats (receipt, order) {
try {
const data = {
type: "payment",
isNative: true,
order: order,
tx: receipt
}
Axios({
method: "post",
headers: {
"Content-Type": "application/json"
},
url: `${env.api}/aqr/setConfirmedOrder`,
data: data
})
}
catch (e) {
console.log(e)
}
}
startListening () {
io.emit('start_listening', {
order_id: this.order_id,
merchant_id: this.merchant_id,
wallets: this.companyAccount,
amount: this.amount
})
}
convertRates (input, output) {

@@ -86,5 +139,5 @@ return new Promise(async (resolve, reject) => {

*/
getWalletsOfMerchant (merchant_id, order_id) {
getWalletsOfMerchant () {
return new Promise((resolve, reject) => {
axios({ method:"post", url:`${env.aloborio}/b2b/company_wallets?merchant_id=${merchant_id}&order_id=${order_id}` })
axios({ method:"post", url:`${env.aloborio}/b2b/company_wallets?merchant_id=${this.merchant_id}&order_id=${this.order_id}` })
.then(response => {

@@ -130,3 +183,3 @@ if (!Object.keys(response.data).length)

this.validateInputs({ merchant_id, country_currency, amount })
country_currency = (country_currency) ? country_currency.replace("#/", "") : ''

@@ -139,4 +192,15 @@ amount = (amount) ? amount.replace("#/", "") : ''

const data_order_id = await axios({ method:"post", url: `https://api.alobor.io/aqr/pay?total=${amount}&currency=${country_currency}` })
await this.getWalletsOfMerchant(merchant_id, data_order_id.id)
this.merchant_id = merchant_id
this.order_id = data_order_id.id
this.amount = {
ETHEREUM: (amount / this.rates["ETH"]).toString(),
MINTER: (amount / this.rates["BIP"]).toString(),
STELLAR: (amount / this.rates["XLM"]).toString()
}
await this.getWalletsOfMerchant()
this.startListening()
let list = []

@@ -143,0 +207,0 @@

{
"name": "crypttp",
"version": "0.1.5",
"version": "0.1.6",
"description": "Module to call APIs of crypttp powered by alemey",

@@ -9,3 +9,4 @@ "main": "index.js",

"axios": "^0.19.0",
"dev": "^0.1.3"
"dev": "^0.1.3",
"socket.io-client": "^2.3.0"
},

@@ -21,7 +22,5 @@ "devDependencies": {

},
"scripts": {
"build": "rm -rf dist/ && webpack --config webpack.config.js"
},
"scripts": {},
"author": "Bogdan Sizov, Alemey",
"license": "ISC"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc