UNPKG

@lunch-money/coinbase-to-lunch-money

Version:

A wrapper around the coinbase API for enabling Lunch Money to gather information about a user's account.

62 lines 2.71 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LunchMoneyCoinbaseConnection = void 0; const CoinbaseClient_1 = require("./CoinbaseClient"); __exportStar(require("./types"), exports); // Create default coinbase client const defaultCoinbaseClientConstructor = CoinbaseClient_1.CoinbaseClient; /** * Lunch Money Coinbase Connection */ exports.LunchMoneyCoinbaseConnection = { /** * Initiate a connection to a user's coinbase account. * * - Check that we have correct permissions * - Return all balances */ initiate(config, CoinbaseClient = defaultCoinbaseClientConstructor) { return __awaiter(this, void 0, void 0, function* () { return exports.LunchMoneyCoinbaseConnection.getBalances(config, CoinbaseClient); }); }, /** * Get the current balances of a user's coinbase account. * * - Return all balances */ getBalances(config, CoinbaseClient = defaultCoinbaseClientConstructor) { return __awaiter(this, void 0, void 0, function* () { const coinbase = new CoinbaseClient(config); const balances = yield coinbase.getBalances(); return { providerName: 'coinbase', balances, }; }); }, }; //# sourceMappingURL=main.js.map