From d1f7b4912b2185e82f6d0700ecf8e22c3ad0f6e4 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Sun, 15 Jul 2018 20:56:28 +0100 Subject: [PATCH] WIP: lightning --- LightningCustodianWallet.test.js | 12 ++++++++ class/index.js | 1 + class/lightning-custodian-wallet.js | 43 +++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 LightningCustodianWallet.test.js create mode 100644 class/lightning-custodian-wallet.js diff --git a/LightningCustodianWallet.test.js b/LightningCustodianWallet.test.js new file mode 100644 index 000000000..e36d3aba0 --- /dev/null +++ b/LightningCustodianWallet.test.js @@ -0,0 +1,12 @@ +/* global it */ +import { LightningCustodianWallet } from './class'; +let assert = require('assert'); + +it('can generate auth secret', () => { + let l1 = new LightningCustodianWallet(); + let l2 = new LightningCustodianWallet(); + l1.generate(); + l2.generate(); + + assert.ok(l1.getSecret() !== l2.getSecret(), 'generated credentials should be the same'); +}); diff --git a/class/index.js b/class/index.js index 57fe17d90..8326dabf8 100644 --- a/class/index.js +++ b/class/index.js @@ -8,3 +8,4 @@ export * from './hd-segwit-p2sh-wallet'; export * from './hd-legacy-breadwallet-wallet'; export * from './hd-legacy-p2pkh-wallet'; export * from './watch-only-wallet'; +export * from './lightning-custodian-wallet'; diff --git a/class/lightning-custodian-wallet.js b/class/lightning-custodian-wallet.js new file mode 100644 index 000000000..f3d1ac87c --- /dev/null +++ b/class/lightning-custodian-wallet.js @@ -0,0 +1,43 @@ +import { LegacyWallet } from './legacy-wallet'; +import Frisbee from 'frisbee'; + +export class LightningCustodianWallet extends LegacyWallet { + constructor() { + super(); + this.type = 'lightningCustodianWallet'; + this.pendingTransactions = []; + this.token = false; + this.tokenRefreshedOn = 0; + this._api = new Frisbee({ + baseURI: 'https://api.blockcypher.com/v1/btc/main/addrs/', + }); + } + + async createAccount() {} + + async authorize() {} + + async getToken() {} + + async getBtcAddress() {} + + async newBtcAddress() {} + + async getPendngBalance() {} + + async decodeInvoice() {} + + async checkRoute() {} + + async payInvoice() {} + + async sendCoins() {} + + async getTransactions() {} + + async getTransaction() {} + + async getBalance() {} + + async getInfo() {} +}