Comments (3)
Fixed now. I was wrapping request.post in Promise whereas it is a promise itself.
return request.post((BASE_URI+"/create/wallet", options); is the right way
Thanks.
from wallet-api-examples.
Could you provide more details ?
from wallet-api-examples.
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/";
Creating module (bitaps_com.js)
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);
});
}
}
Using the module (index.js)
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.
from wallet-api-examples.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wallet-api-examples.