Closed HackinwaleDev closed 5 years ago
Could you provide more details ?
Sure! Below is my implementation around the endpoint given to me:
const request = require('request'); const BASE_URI = "https://api.bitaps.com/btc/testnet/v1/";
module.exports = { // Let's create the wallet createAdminWallet: (walletCallbackUri) => { let options = {callback_link: walletCallbackUri, password: "mypassword"} return new Promise(() => { request.post(BASE_URI+"/create/wallet", options); }); } }
@4tochka
const bitaps = require('../bitaps_com'); const {createAdminWallet} = bitaps;
let callbackUrl = 'http://myhostname/wallet/report' createAdminWallet(callbackUrl) .then(response =>{ console.log('=========Wallet Created Successfully=======') console.log(response.wallet_id +' --- '+ response.currency); }) .catch(err => { console.log('========Failed to create wallet=========='); console.log(err); });
Pls kindly check and see what I am doing wrong. thanks.
Fixed now. I was wrapping request.post in Promise whereas it is a promise itself.
_return request.post((BASEURI+"/create/wallet", options); is the right way
Thanks.
I am not getting any response while trying to create wallet. Does it mean this API does not support NodeJs or what was I doing wrong?