westwallet-js-api is a WestWallet Public API wrapper for JavaScript programming language. Use it for building payment solutions.
Install from npm:
npm install westwallet-api
// Sending 0.1 ETH to 0x57689002367b407f031f1BB5Ef2923F103015A32
const westwallet = require('westwallet-api');
const westwalletErrors = westwallet.WestWalletAPIErrors;
let client = new westwallet.WestWalletAPI(
"your_public_key",
"your_private_key"
);
client.createWithdrawal("ETH", "0.1", "0x57689002367b407f031f1BB5Ef2923F103015A32")
.then((data) => {
console.log(data);
}).catch((error) => {
if (error instanceof westwalletErrors.InsufficientFundsError) {
console.log("Insufficient funds");
} else if (error instanceof westwalletErrors.BadAddressError) {
console.log("Bad address regex");
} else {
console.log(error);
}
});
const westwallet = require('westwallet-api');
const westwalletErrors = westwallet.WestWalletAPIErrors;
let client = new westwallet.WestWalletAPI(
"your_public_key",
"your_private_key"
);
client.generateAddress("BTC").then((data) => {
console.log(data);
}).catch((error) => {
if (error instanceof westwalletErrors.CurrencyNotFoundError) {
console.log("No such currency");
}
});