Giter VIP home page Giter VIP logo

Comments (3)

HackinwaleDev avatar HackinwaleDev commented on August 18, 2024 1

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.

4tochka avatar 4tochka commented on August 18, 2024

Could you provide more details ?

from wallet-api-examples.

HackinwaleDev avatar HackinwaleDev commented on August 18, 2024

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);
});
}
}

@4tochka

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.