Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Browser and Node.js Coinswitch.co API client
Easily exchange assets with few lines of code.
npm install --save coinswitch
const Coinswitch = require('coinswitch')
;(async () => {
const cs = new Coinswitch({
apiKey: '<YOUR API KEY>',
userIP: '1.1.1.1'
})
const coinsList = await cs.getCoins()
console.log(coinsList)
/*
[
{
"symbol": "btc",
"name": "Bitcoin",
"isActive": true
},
{
"symbol": "ltc",
"name": "Litecoin",
"isActive": true
},
{
"symbol": "bch",
"name": "Bitcoin Cash",
"isActive": true
},
...
]
*/
})()
const cs = new Coinswitch({
apiKey: '<YOUR API KEY>',
userIP: '1.1.1.1'
})
const {
offerReferenceId,
depositCoinAmount,
destinationCoinAmount
} = await cs.generateOffer('btc', 'ltc', 0.03)
const {
orderId,
exchangeAddress: { address }
} = await cs.makeOrder({
depositCoin: 'btc',
destinationCoin: 'ltc',
depositCoinAmount,
offerReferenceId,
userReferenceId: 'test-user',
destinationAddress: { address: 'LXdmzmqSALB1DbJyA43b6prQCXKn1J6SdV' },
refundAddress: { address: '1KcuzqzcvkpY3K8eoNgmKbqhFvoeQXAoPa' }
})
console.log(`
=========
Order ID: ${orderId}
Deposit: BTC (${depositCoinAmount})
Receive: LTC (${destinationCoinAmount})
Exchange Address: ${address}
=========
`)
NB: Addresses must be specified as a JS Object like {address: "...", tag: "..."}
Get your api-key from the coinswitch API page.
new CoinSwitch(<Object>)
: The class constructor requires an Object like { apiKey: "...", userIP: "..."}
.Method Name | Return | Description |
---|---|---|
.version() | String | Return API version being used |
.getCoins() | Array | Get list of supported coins as obj {symbol, name, isActive} |
.isCoinActive(<symbol>) | Boolean | Given a symbol (ex. btc ) return true /false wether the coin is active or not |
.getDestinationCoins(<symbol>) | Array | Return list of available destination coins for the one provided |
.getDepositCoins(<symbol>) | Array | Return list of depositable coins for the one provided |
.getExchangeLimit(<symbol>, <symbol>) | Object | Get exchange limits for a depositCoin and destinationCoin |
.generateOffer(<symbol>, <symbol>, <number>) | Object | Generate an exchange offer for a coin pair |
.makeOrder(<object>*) | Object | Creates a new tx for an offer. It will return transaction object with an order_id field to track the tx status. |
.getOrder(<string>) | Object | Get status of the given Order ID string. |
*
makeOrder input object sample:
{
depositCoin: 'btc',
destinationCoin: 'ltc',
depositCoinAmount: 0.03,
offerReferenceId: "...", // get it from generateOffer(..)
userReferenceId: 'test-user',
destinationAddress: { address: 'LXdmzmqSALB1DbJyA43b6prQCXKn1J6SdV' },
refundAddress: { address: '1KcuzqzcvkpY3K8eoNgmKbqhFvoeQXAoPa' }
}
For more examples look at the unit test/
folder.
npm test
To enable debug set the env var DEBUG=coinswitch
MIT
FAQs
Coinswitch.co API javascript client
We found that coinswitch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.