UNPKG

wallets-africa

Version:
38 lines (37 loc) 1.44 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const axios_1 = __importDefault(require("axios")); const self_1 = __importDefault(require("./resources/self")); const wallet_1 = __importDefault(require("./resources/wallet")); const bank_1 = __importDefault(require("./resources/bank")); /** * @class WalletAfrica * @author sheghun {@link https://github.com/sheghun} * {@link https://github.com/sheghun/wallets-africa-nodejs-sdk} * * Wallets Africa wrapper for communicating with the wallets africa api */ class WalletAfrica { /** * * @param options - secret and public key */ constructor(options) { this.self = self_1.default; this.wallet = wallet_1.default; this.bank = bank_1.default; this._apiRoot = ''; axios_1.default.defaults.headers.Authorization = `Bearer ${options.publicKey}`; axios_1.default.defaults.headers['Content-Type'] = 'application/json'; axios_1.default.defaults.baseURL = options.sandbox ? 'https://sandbox.wallets.africa' : 'https://api.wallets.africa'; this.self.secretKey = options.secretKey; this.wallet.secretKey = options.secretKey; this.bank.secretKey = options.secretKey; } } exports.default = WalletAfrica;