Coins.ph API wrapper for Node.js (Using promises instead of callbacks).
This is based on [Ionică Bizău]'s work on coins-ph. This API wrapper uses Promises instead of callbacks.
The Coins.ph API Reference is a good resource to learn more about these APIs.
# Using npm
npm install --save coins-ph-promise-native
# Using yarn
yarn add coins-ph-promise-native
const Coins = require("coins-ph-promise-native");
let client = new Coins({
key: process.env.COINS_PW_KEY
, secret: process.env.COINS_PW_SECRET
// This is optional
, host: process.env.COINS_HOST || "https://coins.ph/"
});
client.cryptoAccounts({}).then((data) => console.log(data))
.catch((err) => console.log(err));
// =>
// [ { id: 'ff...c9',
// name: 'Default Account',
// currency: 'BTC',
// balance: '0.09000000',
// pending_balance: '0.00000000',
// total_received: '0.10168800',
// default_address: '34SuY....yp6m' },
// { id: '787...283',
// name: 'Default Account',
// currency: 'CLP',
// balance: '0.00000000',
// pending_balance: '0.00000000',
// total_received: '0.00000000',
// default_address: 'bf...129' } ]
client.payinOutlets({ region: "PH" }).then((data) => console.log(data))
.catch((err) => console.log(err));
// =>
// [ { id: '..._deposit',
// outlet_category: 'atm_deposit',
// payment_outlet_type: {...},
// amount_limits: [ [Object] ],
// denominations: [],
// name: '...',
// region: '...',
// verification_level_requirement: 0,
// help_text: '...',
// help_link: 'https://coinsph.zendesk.com/hc/en-us/articles/202637070',
// instructions: '...',
// payout_duration: null,
// is_express: false }, ... ]
});
There are few ways to get help:
-
Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
-
For bug reports and feature requests, open issues. 🐛
-
For direct and quick help, you can use Codementor. 🚀
Creates the instance of the Coins
class.
-
Object
options
: An object containing: -
secret
(String): The secret key (mandatory). -
key
(String): The API key (mandatory) -
host
(String): Thecoins.ph
host (default:https://coins.ph/
).
Create a new buyorder
-
Object
data
: The order data as documented here.
Mark a buy order as paid
-
Object
data
: The order data as documented here.
Retrieve an existing buyorder
-
Object
data
: The order data as documented here.
Create a new sellorder
-
Object
data
: The sell order data (documented here).
Validate field values
-
Object
data
: The post data (documented here).
Retrieve an existing sellorder
-
Object
params
: The sell order params (documented here).
Gets the transaction history (buyorders).
Retrieve supported payin-outlets
-
Object
params
: The request params (documented here).
Retrieve current payin-outlet-fees
-
Object
params
: The request params (documented here).
Retrieve supported payin-outlet-categories
-
Object
params
: The request params (documented here).
Create a new payment request
-
Object
data
: The request data (documented here).
Retrieve an existing or a list of existing payment requests
-
Object
params
: The request params (documented here).
Transfer funds between two accounts
-
Object
data
: The request data (documented here).
Get the list of transfers or a specific one.
-
Object
params
: The params object (documented here).
Retrieve existing crypto-accounts
-
Object
params
: The params object (documented here).
Convert funds between a user's accounts
-
Object
data
: The data object (documented here).
Retrieve current crypto-exchanges
-
Object
params
: The request params (documented here).
Retrieve existing crypto-routes
Get the crypto payments or a specific one.
-
Object
params
: The request params (documented here).
Create a new user
-
Object
data
: The request data (documented here).
This is called internally.
-
Number The
nonce
value.
Signs a request.
-
String
url
: The request url. -
Object
body
: The request data.
- Object An object containing:
-
signature
(String): The HMAC signature. -
nonce
(String): The stringified nonce value.
Low level function for making requests to the API endpoints.
-
Object
options
: An object containing the following fields: -
url
(String): The api endpoint. -
method
(String): The request method (default:get
). -
params
(Object): The params object. -
data
(Object): The POST data object. -
responseField
(String): The response field to take. -
version
(String): The version endpoint (default:d/api
). It could beapi/v2
orapi/v3
too, depending on the endpoint.
Have an idea? Found a bug? See how to contribute.
MIT © Ionică Bizău Converted to promise by [Ardee Aram][https://steemit.com/@ardeearam]