From 18c27a840b752fbd0dfef64b5caebb8a5751b90e Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 16 Dec 2020 12:28:35 -0800 Subject: [PATCH 1/6] list utxos route --- dist/src/auth.js | 3 +- dist/src/auth.js.map | 2 +- dist/src/controllers/index.js | 1 + dist/src/controllers/index.js.map | 2 +- dist/src/controllers/queries.js | 13 + dist/src/controllers/queries.js.map | 2 +- dist/src/utils/wallet.js | 54 +++ dist/src/utils/wallet.js.map | 1 + proto/walletkit.proto | 601 ++++++++++++++++++++++++++++ src/auth.ts | 3 +- src/controllers/index.ts | 1 + src/controllers/queries.ts | 10 + src/utils/wallet.ts | 44 ++ 13 files changed, 732 insertions(+), 5 deletions(-) create mode 100644 dist/src/utils/wallet.js create mode 100644 dist/src/utils/wallet.js.map create mode 100644 proto/walletkit.proto create mode 100644 src/utils/wallet.ts diff --git a/dist/src/auth.js b/dist/src/auth.js index cb10fc008..61f031081 100644 --- a/dist/src/auth.js +++ b/dist/src/auth.js @@ -76,7 +76,8 @@ function authModule(req, res, next) { req.path == '/latest' || req.path.startsWith('/static') || req.path == '/contacts/set_dev' || - req.path == '/connect') { + req.path == '/connect' || + req.path == '/utxos') { next(); return; } diff --git a/dist/src/auth.js.map b/dist/src/auth.js.map index 24d01610d..bfa1c57a2 100644 --- a/dist/src/auth.js.map +++ b/dist/src/auth.js.map @@ -1 +1 @@ -{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAgC;AAChC,qCAAiC;AACjC,sCAAqC;AACrC,qCAA8C;AAC9C,+CAAsD;AACtD,2CAA2C;AAC3C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAExB,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAE3B;;;EAGE;AAEF,SAAsB,QAAQ,CAAC,GAAG,EAAE,GAAG;;QACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,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QC;AAED,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/src/controllers/index.js b/dist/src/controllers/index.js index 79166b1cf..668d90824 100644 --- a/dist/src/controllers/index.js +++ b/dist/src/controllers/index.js @@ -95,6 +95,7 @@ function set(app) { app.get('/info', details.getNodeInfo); app.get('/route', details.checkRoute); app.get('/query/onchain_address/:app', queries.queryOnchainAddress); + app.get('/utxos', queries.listUTXOs); app.post('/action', actions.processAction); app.get('/bots', bots.getBots); app.post('/bot', bots.createBot); diff --git a/dist/src/controllers/index.js.map b/dist/src/controllers/index.js.map index 610a070c0..987806287 100644 --- a/dist/src/controllers/index.js.map +++ b/dist/src/controllers/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkC;AAClC,iCAAgC;AAChC,2CAA0C;AAC1C,+BAA8B;AAC9B,qCAAoC;AACpC,uCAAsC;AACtC,qCAAoC;AACpC,uCAAsC;AACtC,iCAAgC;AAChC,uCAAsC;AACtC,sCAAqC;AACrC,gDAA+C;AAC/C,qCAAoC;AACpC,iDAAgD;AAChD,iCAAgC;AAChC,qCAAoC;AACpC,8CAA2C;AAC3C,0CAAyC;AACzC,0CAAyC;AACzC,4CAAoC;AACpC,+BAA8B;AAE9B,SAAsB,GAAG,CAAC,GAAG;;QAE5B,WAAW,CAAC,IAAI,EAAE,CAAA;QAElB,IAAI,eAAM,IAAI,eAAM,CAAC,YAAY,EAAE;YAClC,YAAY,CAAC,kBAAkB,EAAE,CAAA;SACjC;QACD,IAAI;YACH,MAAM,KAAK,CAAC,eAAe,EAAE,CAAA;SAC7B;QAAC,OAAO,CAAC,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,CAAC,CAAC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AAsB,CAAC,EAAE,aAAa,CAAC,4BAA4B;IAC7E,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,YAAY;IACvC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY;IACtC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,oBAAoB;CACvD,CAAA"} \ No newline at end of file diff --git a/dist/src/controllers/queries.js b/dist/src/controllers/queries.js index 873c45c4b..0628bf6b5 100644 --- a/dist/src/controllers/queries.js +++ b/dist/src/controllers/queries.js @@ -15,8 +15,21 @@ const network = require("../network"); const constants_1 = require("../constants"); const short = require("short-uuid"); const lightning = require("../utils/lightning"); +const wallet_1 = require("../utils/wallet"); let queries = {}; const hub_pubkey = '023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b2867b77f'; +function listUTXOs(req, res) { + return __awaiter(this, void 0, void 0, function* () { + try { + const utxos = yield wallet_1.listUnspent(); + res_1.success(res, utxos); + } + catch (e) { + res_1.failure(res, e); + } + }); +} +exports.listUTXOs = listUTXOs; function queryOnchainAddress(req, res) { return __awaiter(this, void 0, void 0, function* () { console.log('=> queryOnchainAddress'); diff --git a/dist/src/controllers/queries.js.map b/dist/src/controllers/queries.js.map index 605d7b8eb..e3e86b8a9 100644 --- a/dist/src/controllers/queries.js.map +++ b/dist/src/controllers/queries.js.map @@ -1 +1 @@ -{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAU/C,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,UAAU,GAAG,oEAAoE,CAAA;AAEvF,SAAsB,mBAAmB,CAAC,GAAG,EAAE,GAAG;;QAChD,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACrC,MA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;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file +{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAC/C,4CAA2C;AAU3C,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,UAAU,GAAG,oEAAoE,CAAA;AAEvF,SAAsB,SAAS,CAAC,GAAG,EAAE,GAAG;;QACtC,IAAI;YACF,MAAM,KAAK,GAAG,MAAM,oBAAW,EAAE,CAAA;YACjC,aAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;SACpB;QAAC,OAAM,CAAC,EAAE;YACT,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;SAChB;IACH,CAAC;CAAA;AAPD,8BAOC;AAED,SAAsB,mBAAmB,CAAC,GAAG,EAAE,GAAG;;QAChD,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;QAC9B,MAAM,KAAK,GAAG,MAAM,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QACxE,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;QAE1B,MAAM,KAAK,GAAS;YAClB,IAAI,EAAC,iBAAiB;YACtB,IAAI;YACJ,GAAG;SACJ,CAAA;QAEF,MAAM,IAAI,GAAG;YACZ,GAAG,EAAE,mBAAS,CAAC,cAAc;YAC7B,IAAI,EAAE,UAAU;YAChB,IAAI,EAAe;gBAClB,IAAI,EAAE,mBAAS,CAAC,a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;YAClB,IAAI,EAAE,mBAAS,CAAC,aAAa,CAAC,cAAc;YAC5C,OAAO,EAAE;gBACJ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;aAChC;YACD,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE;SACpC;KACD,CAAA;IACD,IAAI;QACH,MAAM,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;KAC/B;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;QAC5C,OAAM;KACN;AACF,CAAC,CAAA,CAAA;AAEY,QAAA,oBAAoB,GAAG,CAAO,OAAO,EAAE,EAAE;IACpD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAA;IACtC,4CAA4C;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;IACnC,IAAI;QACF,MAAM,CAAC,GAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file diff --git a/dist/src/utils/wallet.js b/dist/src/utils/wallet.js new file mode 100644 index 000000000..1046c9ed5 --- /dev/null +++ b/dist/src/utils/wallet.js @@ -0,0 +1,54 @@ +"use strict"; +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 }); +const grpc = require("grpc"); +const lightning_1 = require("./lightning"); +const config_1 = require("./config"); +const config = config_1.loadConfig(); +const LND_IP = config.lnd_ip || 'localhost'; +let walletClient; +exports.loadWalletKit = () => { + if (walletClient) { + return walletClient; + } + else { + try { + var credentials = lightning_1.loadCredentials(); + var lnrpcDescriptor = grpc.load("proto/walletkit.proto"); + var walletkit = lnrpcDescriptor.walletrpc; + walletClient = new walletkit.WalletKit(LND_IP + ':' + config.lnd_port, credentials); + return walletClient; + } + catch (e) { + throw e; + } + } +}; +exports.listUnspent = () => { + return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () { + let walletkit = yield exports.loadWalletKit(); + try { + const opts = { min_confs: 1, max_confs: 100 }; + walletkit.listUnspent(opts, function (err, res) { + if (err) { + reject(err); + } + else { + resolve(res); + } + }); + } + catch (e) { + reject(e); + } + })); +}; +//# sourceMappingURL=wallet.js.map \ No newline at end of file diff --git a/dist/src/utils/wallet.js.map b/dist/src/utils/wallet.js.map new file mode 100644 index 000000000..8202b95d6 --- /dev/null +++ b/dist/src/utils/wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/utils/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,6BAA4B;AAC5B,2CAA6C;AAC7C,qCAAmC;AAEnC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,WAAW,CAAA;AAE3C,IAAI,YAAY,CAAA;AAEH,QAAA,aAAa,GAAG,GAAG,EAAE;IAChC,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAA;KACpB;SAAM;QACL,IAAI;YACF,IAAI,WAAW,GAAG,2BAAe,EAAE,CAAA;YACnC,IAAI,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACzD,IAAI,SAAS,GAAQ,eAAe,CAAC,SAAS,CAAA;YAC9C,YAAY,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACpF,OAAO,YAAY,CAAA;SACpB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,CAAA;SACR;KACF;AACH,CAAC,CAAA;AAEY,QAAA,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,IAAI,SAAS,GAAG,MAAM,qBAAa,EAAE,CAAA;QACrC,IAAI;YACF,MAAM,IAAI,GAAG,EAAC,SAAS,EAAC,CAAC,EAAC,SAAS,EAAC,GAAG,EAAC,CAAA;YACxC,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,UAAS,GAAG,EAAE,GAAG;gBAC3C,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAA;iBACZ;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,CAAA;iBACb;YACH,CAAC,CAAC,CAAA;SACH;QAAC,OAAM,CAAC,EAAE;YACT,MAAM,CAAC,CAAC,CAAC,CAAA;SACV;IACH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAA"} \ No newline at end of file diff --git a/proto/walletkit.proto b/proto/walletkit.proto new file mode 100644 index 000000000..301e7d35e --- /dev/null +++ b/proto/walletkit.proto @@ -0,0 +1,601 @@ +syntax = "proto3"; + +import "rpc.proto"; +import "signer.proto"; + +package walletrpc; + +option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc"; + +// WalletKit is a service that gives access to the core functionalities of the +// daemon's wallet. +service WalletKit { + /* + ListUnspent returns a list of all utxos spendable by the wallet with a + number of confirmations between the specified minimum and maximum. + */ + rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse); + + /* + LeaseOutput locks an output to the given ID, preventing it from being + available for any future coin selection attempts. The absolute time of the + lock's expiration is returned. The expiration of the lock can be extended by + successive invocations of this RPC. Outputs can be unlocked before their + expiration through `ReleaseOutput`. + */ + rpc LeaseOutput (LeaseOutputRequest) returns (LeaseOutputResponse); + + /* + ReleaseOutput unlocks an output, allowing it to be available for coin + selection if it remains unspent. The ID should match the one used to + originally lock the output. + */ + rpc ReleaseOutput (ReleaseOutputRequest) returns (ReleaseOutputResponse); + + /* + DeriveNextKey attempts to derive the *next* key within the key family + (account in BIP43) specified. This method should return the next external + child within this branch. + */ + rpc DeriveNextKey (KeyReq) returns (signrpc.KeyDescriptor); + + /* + DeriveKey attempts to derive an arbitrary key specified by the passed + KeyLocator. + */ + rpc DeriveKey (signrpc.KeyLocator) returns (signrpc.KeyDescriptor); + + /* + NextAddr returns the next unused address within the wallet. + */ + rpc NextAddr (AddrRequest) returns (AddrResponse); + + /* + PublishTransaction attempts to publish the passed transaction to the + network. Once this returns without an error, the wallet will continually + attempt to re-broadcast the transaction on start up, until it enters the + chain. + */ + rpc PublishTransaction (Transaction) returns (PublishResponse); + + /* + SendOutputs is similar to the existing sendmany call in Bitcoind, and + allows the caller to create a transaction that sends to several outputs at + once. This is ideal when wanting to batch create a set of transactions. + */ + rpc SendOutputs (SendOutputsRequest) returns (SendOutputsResponse); + + /* + EstimateFee attempts to query the internal fee estimator of the wallet to + determine the fee (in sat/kw) to attach to a transaction in order to + achieve the confirmation target. + */ + rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse); + + /* + PendingSweeps returns lists of on-chain outputs that lnd is currently + attempting to sweep within its central batching engine. Outputs with similar + fee rates are batched together in order to sweep them within a single + transaction. + + NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to + remain supported. This is an advanced API that depends on the internals of + the UtxoSweeper, so things may change. + */ + rpc PendingSweeps (PendingSweepsRequest) returns (PendingSweepsResponse); + + /* + BumpFee bumps the fee of an arbitrary input within a transaction. This RPC + takes a different approach than bitcoind's bumpfee command. lnd has a + central batching engine in which inputs with similar fee rates are batched + together to save on transaction fees. Due to this, we cannot rely on + bumping the fee on a specific transaction, since transactions can change at + any point with the addition of new inputs. The list of inputs that + currently exist within lnd's central batching engine can be retrieved + through the PendingSweeps RPC. + + When bumping the fee of an input that currently exists within lnd's central + batching engine, a higher fee transaction will be created that replaces the + lower fee transaction through the Replace-By-Fee (RBF) policy. If it + + This RPC also serves useful when wanting to perform a Child-Pays-For-Parent + (CPFP), where the child transaction pays for its parent's fee. This can be + done by specifying an outpoint within the low fee transaction that is under + the control of the wallet. + + The fee preference can be expressed either as a specific fee rate or a delta + of blocks in which the output should be swept on-chain within. If a fee + preference is not explicitly specified, then an error is returned. + + Note that this RPC currently doesn't perform any validation checks on the + fee preference being provided. For now, the responsibility of ensuring that + the new fee preference is sufficient is delegated to the user. + */ + rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse); + + /* + ListSweeps returns a list of the sweep transactions our node has produced. + Note that these sweeps may not be confirmed yet, as we record sweeps on + broadcast, not confirmation. + */ + rpc ListSweeps (ListSweepsRequest) returns (ListSweepsResponse); + + /* + LabelTransaction adds a label to a transaction. If the transaction already + has a label the call will fail unless the overwrite bool is set. This will + overwrite the exiting transaction label. Labels must not be empty, and + cannot exceed 500 characters. + */ + rpc LabelTransaction (LabelTransactionRequest) + returns (LabelTransactionResponse); + + /* + FundPsbt creates a fully populated PSBT that contains enough inputs to fund + the outputs specified in the template. There are two ways of specifying a + template: Either by passing in a PSBT with at least one output declared or + by passing in a raw TxTemplate message. + + If there are no inputs specified in the template, coin selection is + performed automatically. If the template does contain any inputs, it is + assumed that full coin selection happened externally and no additional + inputs are added. If the specified inputs aren't enough to fund the outputs + with the given fee rate, an error is returned. + + After either selecting or verifying the inputs, all input UTXOs are locked + with an internal app ID. + + NOTE: If this method returns without an error, it is the caller's + responsibility to either spend the locked UTXOs (by finalizing and then + publishing the transaction) or to unlock/release the locked UTXOs in case of + an error on the caller's side. + */ + rpc FundPsbt (FundPsbtRequest) returns (FundPsbtResponse); + + /* + FinalizePsbt expects a partial transaction with all inputs and outputs fully + declared and tries to sign all inputs that belong to the wallet. Lnd must be + the last signer of the transaction. That means, if there are any unsigned + non-witness inputs or inputs without UTXO information attached or inputs + without witness data that do not belong to lnd's wallet, this method will + fail. If no error is returned, the PSBT is ready to be extracted and the + final TX within to be broadcast. + + NOTE: This method does NOT publish the transaction once finalized. It is the + caller's responsibility to either publish the transaction on success or + unlock/release any locked UTXOs in case of an error in this method. + */ + rpc FinalizePsbt (FinalizePsbtRequest) returns (FinalizePsbtResponse); +} + +message ListUnspentRequest { + // The minimum number of confirmations to be included. + int32 min_confs = 1; + + // The maximum number of confirmations to be included. + int32 max_confs = 2; +} + +message ListUnspentResponse { + // A list of utxos satisfying the specified number of confirmations. + repeated lnrpc.Utxo utxos = 1; +} + +message LeaseOutputRequest { + /* + An ID of 32 random bytes that must be unique for each distinct application + using this RPC which will be used to bound the output lease to. + */ + bytes id = 1; + + // The identifying outpoint of the output being leased. + lnrpc.OutPoint outpoint = 2; +} + +message LeaseOutputResponse { + /* + The absolute expiration of the output lease represented as a unix timestamp. + */ + uint64 expiration = 1; +} + +message ReleaseOutputRequest { + // The unique ID that was used to lock the output. + bytes id = 1; + + // The identifying outpoint of the output being released. + lnrpc.OutPoint outpoint = 2; +} + +message ReleaseOutputResponse { +} + +message KeyReq { + /* + Is the key finger print of the root pubkey that this request is targeting. + This allows the WalletKit to possibly serve out keys for multiple HD chains + via public derivation. + */ + int32 key_finger_print = 1; + + /* + The target key family to derive a key from. In other contexts, this is + known as the "account". + */ + int32 key_family = 2; +} + +message AddrRequest { + // No fields, as we always give out a p2wkh address. +} +message AddrResponse { + /* + The address encoded using a bech32 format. + */ + string addr = 1; +} + +message Transaction { + /* + The raw serialized transaction. + */ + bytes tx_hex = 1; + + /* + An optional label to save with the transaction. Limited to 500 characters. + */ + string label = 2; +} +message PublishResponse { + /* + If blank, then no error occurred and the transaction was successfully + published. If not the empty string, then a string representation of the + broadcast error. + + TODO(roasbeef): map to a proper enum type + */ + string publish_error = 1; +} + +message SendOutputsRequest { + /* + The number of satoshis per kilo weight that should be used when crafting + this transaction. + */ + int64 sat_per_kw = 1; + + /* + A slice of the outputs that should be created in the transaction produced. + */ + repeated signrpc.TxOut outputs = 2; + + // An optional label for the transaction, limited to 500 characters. + string label = 3; + + // The minimum number of confirmations each one of your outputs used for + // the transaction must satisfy. + int32 min_confs = 4; + + // Whether unconfirmed outputs should be used as inputs for the transaction. + bool spend_unconfirmed = 5; +} +message SendOutputsResponse { + /* + The serialized transaction sent out on the network. + */ + bytes raw_tx = 1; +} + +message EstimateFeeRequest { + /* + The number of confirmations to shoot for when estimating the fee. + */ + int32 conf_target = 1; +} +message EstimateFeeResponse { + /* + The amount of satoshis per kw that should be used in order to reach the + confirmation target in the request. + */ + int64 sat_per_kw = 1; +} + +enum WitnessType { + UNKNOWN_WITNESS = 0; + + /* + A witness that allows us to spend the output of a commitment transaction + after a relative lock-time lockout. + */ + COMMITMENT_TIME_LOCK = 1; + + /* + A witness that allows us to spend a settled no-delay output immediately on a + counterparty's commitment transaction. + */ + COMMITMENT_NO_DELAY = 2; + + /* + A witness that allows us to sweep the settled output of a malicious + counterparty's who broadcasts a revoked commitment transaction. + */ + COMMITMENT_REVOKE = 3; + + /* + A witness that allows us to sweep an HTLC which we offered to the remote + party in the case that they broadcast a revoked commitment state. + */ + HTLC_OFFERED_REVOKE = 4; + + /* + A witness that allows us to sweep an HTLC output sent to us in the case that + the remote party broadcasts a revoked commitment state. + */ + HTLC_ACCEPTED_REVOKE = 5; + + /* + A witness that allows us to sweep an HTLC output that we extended to a + party, but was never fulfilled. This HTLC output isn't directly on the + commitment transaction, but is the result of a confirmed second-level HTLC + transaction. As a result, we can only spend this after a CSV delay. + */ + HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 6; + + /* + A witness that allows us to sweep an HTLC output that was offered to us, and + for which we have a payment preimage. This HTLC output isn't directly on our + commitment transaction, but is the result of confirmed second-level HTLC + transaction. As a result, we can only spend this after a CSV delay. + */ + HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 7; + + /* + A witness that allows us to sweep an HTLC that we offered to the remote + party which lies in the commitment transaction of the remote party. We can + spend this output after the absolute CLTV timeout of the HTLC as passed. + */ + HTLC_OFFERED_REMOTE_TIMEOUT = 8; + + /* + A witness that allows us to sweep an HTLC that was offered to us by the + remote party. We use this witness in the case that the remote party goes to + chain, and we know the pre-image to the HTLC. We can sweep this without any + additional timeout. + */ + HTLC_ACCEPTED_REMOTE_SUCCESS = 9; + + /* + A witness that allows us to sweep an HTLC from the remote party's commitment + transaction in the case that the broadcast a revoked commitment, but then + also immediately attempt to go to the second level to claim the HTLC. + */ + HTLC_SECOND_LEVEL_REVOKE = 10; + + /* + A witness type that allows us to spend a regular p2wkh output that's sent to + an output which is under complete control of the backing wallet. + */ + WITNESS_KEY_HASH = 11; + + /* + A witness type that allows us to sweep an output that sends to a nested P2SH + script that pays to a key solely under our control. + */ + NESTED_WITNESS_KEY_HASH = 12; + + /* + A witness type that allows us to spend our anchor on the commitment + transaction. + */ + COMMITMENT_ANCHOR = 13; +} + +message PendingSweep { + // The outpoint of the output we're attempting to sweep. + lnrpc.OutPoint outpoint = 1; + + // The witness type of the output we're attempting to sweep. + WitnessType witness_type = 2; + + // The value of the output we're attempting to sweep. + uint32 amount_sat = 3; + + /* + The fee rate we'll use to sweep the output. The fee rate is only determined + once a sweeping transaction for the output is created, so it's possible for + this to be 0 before this. + */ + uint32 sat_per_byte = 4; + + // The number of broadcast attempts we've made to sweep the output. + uint32 broadcast_attempts = 5; + + /* + The next height of the chain at which we'll attempt to broadcast the + sweep transaction of the output. + */ + uint32 next_broadcast_height = 6; + + // The requested confirmation target for this output. + uint32 requested_conf_target = 8; + + // The requested fee rate, expressed in sat/byte, for this output. + uint32 requested_sat_per_byte = 9; + + /* + Whether this input must be force-swept. This means that it is swept even + if it has a negative yield. + */ + bool force = 7; +} + +message PendingSweepsRequest { +} + +message PendingSweepsResponse { + /* + The set of outputs currently being swept by lnd's central batching engine. + */ + repeated PendingSweep pending_sweeps = 1; +} + +message BumpFeeRequest { + // The input we're attempting to bump the fee of. + lnrpc.OutPoint outpoint = 1; + + // The target number of blocks that the input should be spent within. + uint32 target_conf = 2; + + /* + The fee rate, expressed in sat/byte, that should be used to spend the input + with. + */ + uint32 sat_per_byte = 3; + + /* + Whether this input must be force-swept. This means that it is swept even + if it has a negative yield. + */ + bool force = 4; +} + +message BumpFeeResponse { +} + +message ListSweepsRequest { + /* + Retrieve the full sweep transaction details. If false, only the sweep txids + will be returned. Note that some sweeps that LND publishes will have been + replaced-by-fee, so will not be included in this output. + */ + bool verbose = 1; +} + +message ListSweepsResponse { + message TransactionIDs { + /* + Reversed, hex-encoded string representing the transaction ids of the + sweeps that our node has broadcast. Note that these transactions may + not have confirmed yet, we record sweeps on broadcast, not confirmation. + */ + repeated string transaction_ids = 1; + } + + oneof sweeps { + lnrpc.TransactionDetails transaction_details = 1; + TransactionIDs transaction_ids = 2; + } +} + +message LabelTransactionRequest { + // The txid of the transaction to label. + bytes txid = 1; + + // The label to add to the transaction, limited to 500 characters. + string label = 2; + + // Whether to overwrite the existing label, if it is present. + bool overwrite = 3; +} + +message LabelTransactionResponse { +} + +message FundPsbtRequest { + oneof template { + /* + Use an existing PSBT packet as the template for the funded PSBT. + + The packet must contain at least one non-dust output. If one or more + inputs are specified, no coin selection is performed. In that case every + input must be an UTXO known to the wallet that has not been locked + before. The sum of all inputs must be sufficiently greater than the sum + of all outputs to pay a miner fee with the specified fee rate. A change + output is added to the PSBT if necessary. + */ + bytes psbt = 1; + + /* + Use the outputs and optional inputs from this raw template. + */ + TxTemplate raw = 2; + } + + oneof fees { + /* + The target number of blocks that the transaction should be confirmed in. + */ + uint32 target_conf = 3; + + /* + The fee rate, expressed in sat/vbyte, that should be used to spend the + input with. + */ + uint32 sat_per_vbyte = 4; + } +} +message FundPsbtResponse { + /* + The funded but not yet signed PSBT packet. + */ + bytes funded_psbt = 1; + + /* + The index of the added change output or -1 if no change was left over. + */ + int32 change_output_index = 2; + + /* + The list of lock leases that were acquired for the inputs in the funded PSBT + packet. + */ + repeated UtxoLease locked_utxos = 3; +} + +message TxTemplate { + /* + An optional list of inputs to use. Every input must be an UTXO known to the + wallet that has not been locked before. The sum of all inputs must be + sufficiently greater than the sum of all outputs to pay a miner fee with the + fee rate specified in the parent message. + + If no inputs are specified, coin selection will be performed instead and + inputs of sufficient value will be added to the resulting PSBT. + */ + repeated lnrpc.OutPoint inputs = 1; + + /* + A map of all addresses and the amounts to send to in the funded PSBT. + */ + map outputs = 2; +} + +message UtxoLease { + /* + A 32 byte random ID that identifies the lease. + */ + bytes id = 1; + + // The identifying outpoint of the output being leased. + lnrpc.OutPoint outpoint = 2; + + /* + The absolute expiration of the output lease represented as a unix timestamp. + */ + uint64 expiration = 3; +} + +message FinalizePsbtRequest { + /* + A PSBT that should be signed and finalized. The PSBT must contain all + required inputs, outputs, UTXO data and partial signatures of all other + signers. + */ + bytes funded_psbt = 1; +} +message FinalizePsbtResponse { + // The fully signed and finalized transaction in PSBT format. + bytes signed_psbt = 1; + + // The fully signed and finalized transaction in the raw wire format. + bytes raw_final_tx = 2; +} \ No newline at end of file diff --git a/src/auth.ts b/src/auth.ts index d98e5139b..9bb6d1628 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -72,7 +72,8 @@ export async function authModule(req, res, next) { req.path == '/latest' || req.path.startsWith('/static') || req.path == '/contacts/set_dev' || - req.path == '/connect' + req.path == '/connect' || + req.path == '/utxos' ) { next() return diff --git a/src/controllers/index.ts b/src/controllers/index.ts index 03f64c069..3eca62058 100644 --- a/src/controllers/index.ts +++ b/src/controllers/index.ts @@ -98,6 +98,7 @@ export async function set(app) { app.get('/route', details.checkRoute) app.get('/query/onchain_address/:app', queries.queryOnchainAddress) + app.get('/utxos', queries.listUTXOs) app.post('/action', actions.processAction) app.get('/bots', bots.getBots) diff --git a/src/controllers/queries.ts b/src/controllers/queries.ts index 096da8859..c93825f88 100644 --- a/src/controllers/queries.ts +++ b/src/controllers/queries.ts @@ -4,6 +4,7 @@ import * as network from '../network' import constants from '../constants' import * as short from 'short-uuid' import * as lightning from '../utils/lightning' +import {listUnspent} from '../utils/wallet' type QueryType = 'onchain_address' export interface Query { @@ -17,6 +18,15 @@ let queries: { [k: string]: Query } = {} const hub_pubkey = '023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b2867b77f' +export async function listUTXOs(req, res) { + try { + const utxos = await listUnspent() + success(res, utxos) + } catch(e) { + failure(res, e) + } +} + export async function queryOnchainAddress(req, res) { console.log('=> queryOnchainAddress') const uuid = short.generate() diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts new file mode 100644 index 000000000..7f266b08b --- /dev/null +++ b/src/utils/wallet.ts @@ -0,0 +1,44 @@ + + +import * as grpc from 'grpc' +import { loadCredentials } from './lightning' +import {loadConfig} from './config' + +const config = loadConfig() +const LND_IP = config.lnd_ip || 'localhost' + +let walletClient + +export const loadWalletKit = () => { + if (walletClient) { + return walletClient + } else { + try { + var credentials = loadCredentials() + var lnrpcDescriptor = grpc.load("proto/walletkit.proto"); + var walletkit: any = lnrpcDescriptor.walletrpc + walletClient = new walletkit.WalletKit(LND_IP + ':' + config.lnd_port, credentials); + return walletClient + } catch (e) { + throw e + } + } +} + +export const listUnspent = () => { + return new Promise(async (resolve, reject) => { + let walletkit = await loadWalletKit() + try { + const opts = {min_confs:1,max_confs:100} + walletkit.listUnspent(opts, function(err, res){ + if (err) { + reject(err) + } else { + resolve(res) + } + }) + } catch(e) { + reject(e) + } + }) +} \ No newline at end of file From 4f3e73c407c949461ac101e2f79caaf670d76818 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 16 Dec 2020 12:37:18 -0800 Subject: [PATCH 2/6] accountings --- dist/src/controllers/queries.js | 7 ++++++- dist/src/controllers/queries.js.map | 2 +- dist/src/utils/json.js | 2 ++ dist/src/utils/json.js.map | 2 +- dist/src/utils/wallet.js | 4 ++-- dist/src/utils/wallet.js.map | 2 +- src/controllers/queries.ts | 7 ++++++- src/utils/json.ts | 3 +++ src/utils/wallet.ts | 4 ++-- 9 files changed, 24 insertions(+), 9 deletions(-) diff --git a/dist/src/controllers/queries.js b/dist/src/controllers/queries.js index 0628bf6b5..87c57e8d9 100644 --- a/dist/src/controllers/queries.js +++ b/dist/src/controllers/queries.js @@ -16,13 +16,18 @@ const constants_1 = require("../constants"); const short = require("short-uuid"); const lightning = require("../utils/lightning"); const wallet_1 = require("../utils/wallet"); +const jsonUtils = require("../utils/json"); let queries = {}; const hub_pubkey = '023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b2867b77f'; function listUTXOs(req, res) { return __awaiter(this, void 0, void 0, function* () { try { const utxos = yield wallet_1.listUnspent(); - res_1.success(res, utxos); + const accountings = yield models_1.models.Accounting.findAll(); + res_1.success(res, { + utxos, + accountings: accountings.map(acc => jsonUtils.accountingToJson(acc)) + }); } catch (e) { res_1.failure(res, e); diff --git a/dist/src/controllers/queries.js.map b/dist/src/controllers/queries.js.map index e3e86b8a9..153b591ab 100644 --- a/dist/src/controllers/queries.js.map +++ b/dist/src/controllers/queries.js.map @@ -1 +1 @@ -{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAC/C,4CAA2C;AAU3C,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,UAAU,GAAG,oEAAoE,CAAA;AAEvF,SAAsB,SAAS,CAAC,GAAG,EAAE,GAAG;;QACtC,IAAI;YACF,MAAM,KAAK,GAAG,MAAM,oBAAW,EAAE,CAAA;YACjC,aAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;SAC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AA;IACtC,4CAA4C;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;IACnC,IAAI;QACF,MAAM,CAAC,GAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file +{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAC/C,4CAA2C;AAC3C,2CAA0C;AAU1C,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,UAAU,GAAG,oEAAoE,CAAA;AAEvF,SAAsB,SAAS,CAAC,GAAG,EAAE,GAAG;;QACtC,IAAI;YACF,MAAM,KAAK,GAAG,MAAM,oBAAW,EAAE,CAAA;YACjC,MAAM,WAAW,GAAG,MAAM,eAAM,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;YACrD,aAAO,CAAC,GAAG,EAAE;gBACX,KAAK;gBACL,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAA,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;aACpE,CAAC,CAAA;SACH;QAAC,OAAM,CAAC,EAAE;YACT,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;SAChB;IACH,CAAC;CAAA;AAXD,8BAWC;AAED,SAAsB,mBAAmB,CAAC,GAAG,EAAE,GAAG;;QAChD,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,C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CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file diff --git a/dist/src/utils/json.js b/dist/src/utils/json.js index 43477b7f2..c6edad9e1 100644 --- a/dist/src/utils/json.js +++ b/dist/src/utils/json.js @@ -36,6 +36,8 @@ const inviteToJson = (invite) => case_1.toSnake(invite.dataValues || invite); exports.inviteToJson = inviteToJson; const botToJson = (bot) => case_1.toSnake(bot.dataValues || bot); exports.botToJson = botToJson; +const accountingToJson = (acc) => case_1.toSnake(acc.dataValues || acc); +exports.accountingToJson = accountingToJson; const jsonToContact = (json) => case_1.toCamel(json); exports.jsonToContact = jsonToContact; function subscriptionToJson(subscription, chat) { diff --git a/dist/src/utils/json.js.map b/dist/src/utils/json.js.map index e8b15a227..ba820bfe8 100644 --- a/dist/src/utils/json.js.map +++ b/dist/src/utils/json.js.map @@ -1 +1 @@ -{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":";;AAAA,wCAAgD;AAChD,oCAAmC;AAEnC,SAAS,UAAU,CAAC,CAAC;IACnB,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAA;IACjB,MAAM,EAAE,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAA;IAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3C,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAA;IACxC,IAAI,IAAI,CAAC,UAAU,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,EAAE;QAC1D,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;KACzC;IACD,OAAO,IAAI,CAAC,eAAe,CAAA;IAC3B,OAAO,cAAO,iCACT,IAAI,KACP,UAAU,IACV,CAAA;AACJ,CAAC;AA8CC,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AAC,cAAO,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,CAAA;AAwBvD,8BAAS;AAtBX,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,cAAO,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,CAAA;AAuB9D,4CAAgB;AArBlB,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,cAAO,CAAC,IAAI,CAAC,CAAA;AAiB3C,sCAAa;AAff,SAAS,kBAAkB,CAAC,YAAY,EAAE,IAAI;IAC5C,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,IAAI,YAAY,CAAA;IACnD,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpD,OAAO,cAAO,iCACT,GAAG,KACN,QAAQ;QACR,IAAI,EACJ,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IACpC,CAAA;AACJ,CAAC;AAQC,gDAAkB"} \ No newline at end of file diff --git a/dist/src/utils/wallet.js b/dist/src/utils/wallet.js index 1046c9ed5..bcf9059cc 100644 --- a/dist/src/utils/wallet.js +++ b/dist/src/utils/wallet.js @@ -38,11 +38,11 @@ exports.listUnspent = () => { try { const opts = { min_confs: 1, max_confs: 100 }; walletkit.listUnspent(opts, function (err, res) { - if (err) { + if (err || !(res && res.utxos)) { reject(err); } else { - resolve(res); + resolve(res.utxos); } }); } diff --git a/dist/src/utils/wallet.js.map b/dist/src/utils/wallet.js.map index 8202b95d6..fa5a02500 100644 --- a/dist/src/utils/wallet.js.map +++ b/dist/src/utils/wallet.js.map @@ -1 +1 @@ -{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/utils/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,6BAA4B;AAC5B,2CAA6C;AAC7C,qCAAmC;AAEnC,M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A;SACH;QAAC,OAAM,CAAC,EAAE;YACT,MAAM,CAAC,CAAC,CAAC,CAAA;SACV;IACH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAA"} \ No newline at end of file diff --git a/src/controllers/queries.ts b/src/controllers/queries.ts index c93825f88..43355a6ea 100644 --- a/src/controllers/queries.ts +++ b/src/controllers/queries.ts @@ -5,6 +5,7 @@ import constants from '../constants' import * as short from 'short-uuid' import * as lightning from '../utils/lightning' import {listUnspent} from '../utils/wallet' +import * as jsonUtils from '../utils/json' type QueryType = 'onchain_address' export interface Query { @@ -21,7 +22,11 @@ const hub_pubkey = '023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b28 export async function listUTXOs(req, res) { try { const utxos = await listUnspent() - success(res, utxos) + const accountings = await models.Accounting.findAll() + success(res, { + utxos, + accountings: accountings.map(acc=> jsonUtils.accountingToJson(acc)) + }) } catch(e) { failure(res, e) } diff --git a/src/utils/json.ts b/src/utils/json.ts index c7d09832c..ffbdf8d14 100644 --- a/src/utils/json.ts +++ b/src/utils/json.ts @@ -42,6 +42,8 @@ const inviteToJson = (invite) => toSnake(invite.dataValues || invite) const botToJson = (bot) => toSnake(bot.dataValues || bot) +const accountingToJson = (acc) => toSnake(acc.dataValues || acc) + const jsonToContact = (json) => toCamel(json) function subscriptionToJson(subscription, chat) { @@ -63,4 +65,5 @@ export { chatToJson, subscriptionToJson, botToJson, + accountingToJson } diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 7f266b08b..7a5e7e3e8 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -31,10 +31,10 @@ export const listUnspent = () => { try { const opts = {min_confs:1,max_confs:100} walletkit.listUnspent(opts, function(err, res){ - if (err) { + if (err || !(res&&res.utxos)) { reject(err) } else { - resolve(res) + resolve(res.utxos) } }) } catch(e) { From 40e55cfdae3c4033b370c47282a4928ed4576efb Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 16 Dec 2020 13:19:08 -0800 Subject: [PATCH 3/6] testing compare utxos and accountings --- dist/src/controllers/index.js.map | 2 +- dist/src/controllers/queries.js | 17 ++++++++---- dist/src/controllers/queries.js.map | 2 +- dist/src/utils/wallet.js | 41 ++++++++++++++++------------- dist/src/utils/wallet.js.map | 2 +- src/controllers/index.ts | 1 - src/controllers/queries.ts | 21 ++++++++++----- src/utils/wallet.ts | 10 +++++-- 8 files changed, 60 insertions(+), 36 deletions(-) diff --git a/dist/src/controllers/index.js.map b/dist/src/controllers/index.js.map index 987806287..406ef1f3b 100644 --- a/dist/src/controllers/index.js.map +++ b/dist/src/controllers/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkC;AAClC,iCAAgC;AAChC,2CAA0C;AAC1C,+BAA8B;AAC9B,qCAAoC;AACpC,uCAAsC;AACtC,qCAAoC;AACpC,uCAAsC;AACtC,iCAAgC;AAChC,uCAAsC;AACtC,sCAAqC;AACrC,gDAA+C;AAC/C,qCAAoC;AACpC,iDAAgD;AAChD,iCAAgC;AAChC,qCAAoC;AACpC,8CAA2C;AAC3C,0CAAyC;AACzC,0CAAyC;AACzC,4CAAoC;AACpC,+BAA8B;AAE9B,SAAsB,GAAG,CAAC,GAAG;;QAE5B,WAAW,CAAC,IAAI,EAAE,CAAA;QAElB,IAAI,eAAM,IAAI,eAAM,CAAC,YAAY,EAAE;YAClC,YAAY,CAAC,kBAAkB,EAAE,CAAA;SACjC;QACD,IAAI;YACH,MAAM,KAAK,CAAC,eAAe,EAAE,CAAA;SAC7B;QAAC,OAAO,CAAC,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;SAC7D;QAED,MAAM,CAAC,YAAY,EAAE,CAAA;QAErB,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;QACjC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K,CAAC,EAAE,QAAQ,CAAC,YAAY;IACvC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY;IACtC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,oBAAoB;CACvD,CAAA"} \ No newline at end of file diff --git a/dist/src/controllers/queries.js b/dist/src/controllers/queries.js index 87c57e8d9..faf1974c2 100644 --- a/dist/src/controllers/queries.js +++ b/dist/src/controllers/queries.js @@ -17,17 +17,24 @@ const short = require("short-uuid"); const lightning = require("../utils/lightning"); const wallet_1 = require("../utils/wallet"); const jsonUtils = require("../utils/json"); +const sequelize_1 = require("sequelize"); let queries = {}; const hub_pubkey = '023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b2867b77f'; function listUTXOs(req, res) { return __awaiter(this, void 0, void 0, function* () { try { - const utxos = yield wallet_1.listUnspent(); - const accountings = yield models_1.models.Accounting.findAll(); - res_1.success(res, { - utxos, - accountings: accountings.map(acc => jsonUtils.accountingToJson(acc)) + const utxos = yield wallet_1.listUnspent(); // at least 1 confg + const addys = utxos.map(utxo => utxo.address); + console.log('addys', addys); + const accountings = yield models_1.models.Accounting.findAll({ + where: { + address: { + [sequelize_1.Op.in]: addys + }, + status: constants_1.default.statuses.pending + } }); + res_1.success(res, accountings.map(acc => jsonUtils.accountingToJson(acc))); } catch (e) { res_1.failure(res, e); diff --git a/dist/src/controllers/queries.js.map b/dist/src/controllers/queries.js.map index 153b591ab..b0a143f1d 100644 --- a/dist/src/controllers/queries.js.map +++ b/dist/src/controllers/queries.js.map @@ -1 +1 @@ -{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAC/C,4CAA2C;AAC3C,2CAA0C;AAU1C,IAAI,OAAO,GAA2B,EAAE,CAAA;AA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E,KAAK,CAAC,SAAS,EAAE;SACpC;KACD,CAAA;IACD,IAAI;QACH,MAAM,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;KAC/B;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;QAC5C,OAAM;KACN;AACF,CAAC,CAAA,CAAA;AAEY,QAAA,oBAAoB,GAAG,CAAO,OAAO,EAAE,EAAE;IACpD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAA;IACtC,4CAA4C;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;IACnC,IAAI;QACF,MAAM,CAAC,GAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file +{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAC/C,4CAAgD;AAChD,2CAA0C;AAC1C,yCAA8B;AAU9B,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,UAAU,GAAG,oEAAoE,CAAA;AAEvF,SAAsB,SAAS,CAAC,GAAG,EAAE,GAAG;;QACtC,IAAI;YACF,MAAM,KAAK,GAAU,MAAM,oBAAW,EAAE,CAAA,CAAC,mBAAmB;YAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAA,EAAE,CAAC,IAAI,CAAC,O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AC,SAAS,CAAC,GAAG,CAAC;aAChC;YACD,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE;SACpC;KACD,CAAA;IACD,IAAI;QACH,MAAM,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;KAC/B;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;QAC5C,OAAM;KACN;AACF,CAAC,CAAA,CAAA;AAEY,QAAA,oBAAoB,GAAG,CAAO,OAAO,EAAE,EAAE;IACpD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAA;IACtC,4CAA4C;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;IACnC,IAAI;QACF,MAAM,CAAC,GAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file diff --git a/dist/src/utils/wallet.js b/dist/src/utils/wallet.js index bcf9059cc..d911d6701 100644 --- a/dist/src/utils/wallet.js +++ b/dist/src/utils/wallet.js @@ -32,23 +32,26 @@ exports.loadWalletKit = () => { } } }; -exports.listUnspent = () => { - return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () { - let walletkit = yield exports.loadWalletKit(); - try { - const opts = { min_confs: 1, max_confs: 100 }; - walletkit.listUnspent(opts, function (err, res) { - if (err || !(res && res.utxos)) { - reject(err); - } - else { - resolve(res.utxos); - } - }); - } - catch (e) { - reject(e); - } - })); -}; +function listUnspent() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + let walletkit = yield exports.loadWalletKit(); + try { + const opts = { min_confs: 0, max_confs: 10000 }; + walletkit.listUnspent(opts, function (err, res) { + if (err || !(res && res.utxos)) { + reject(err); + } + else { + resolve(res.utxos); + } + }); + } + catch (e) { + reject(e); + } + })); + }); +} +exports.listUnspent = listUnspent; //# sourceMappingURL=wallet.js.map \ No newline at end of file diff --git a/dist/src/utils/wallet.js.map b/dist/src/utils/wallet.js.map index fa5a02500..14e88319b 100644 --- a/dist/src/utils/wallet.js.map +++ b/dist/src/utils/wallet.js.map @@ -1 +1 @@ -{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/utils/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,6BAA4B;AAC5B,2CAA6C;AAC7C,qCAAmC;AAEnC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,WAAW,CAAA;AAE3C,IAAI,YAAY,CAAA;AAEH,QAAA,aAAa,GAAG,GAAG,EAAE;IAChC,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAA;KACpB;SAAM;QACL,IAAI;YACF,IAAI,WAAW,GAAG,2BAAe,EAAE,CAAA;YACnC,IAAI,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACzD,IAAI,SAAS,GAAQ,eAAe,CAAC,SAAS,CAAA;YAC9C,YAAY,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACpF,OAAO,YAAY,CAAA;SACpB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,CAAA;SACR;KACF;AACH,CAAC,CAAA;AAEY,QAAA,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,IAAI,SAA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V,MAAM,CAAC,CAAA;SACR;KACF;AACH,CAAC,CAAA;AAQD,SAAsB,WAAW;;QAC/B,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,SAAS,GAAG,MAAM,qBAAa,EAAE,CAAA;YACrC,IAAI;gBACF,MAAM,IAAI,GAAG,EAAC,SAAS,EAAC,CAAC,EAAC,SAAS,EAAC,KAAK,EAAC,CAAA;gBAC1C,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,UAAS,GAAG,EAAE,GAAG;oBAC3C,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,IAAE,GAAG,CAAC,KAAK,CAAC,EAAE;wBAC5B,MAAM,CAAC,GAAG,CAAC,CAAA;qBACZ;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;qBACnB;gBACH,CAAC,CAAC,CAAA;aACH;YAAC,OAAM,CAAC,EAAE;gBACT,MAAM,CAAC,CAAC,CAAC,CAAA;aACV;QACH,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CAAA;AAhBD,kCAgBC"} \ No newline at end of file diff --git a/src/controllers/index.ts b/src/controllers/index.ts index 3eca62058..7dad4580a 100644 --- a/src/controllers/index.ts +++ b/src/controllers/index.ts @@ -124,7 +124,6 @@ export async function set(app) { res.status(200).send(last.createdAt) } }) - } const msgtypes = constants.message_types diff --git a/src/controllers/queries.ts b/src/controllers/queries.ts index 43355a6ea..6e1cac5b3 100644 --- a/src/controllers/queries.ts +++ b/src/controllers/queries.ts @@ -4,8 +4,9 @@ import * as network from '../network' import constants from '../constants' import * as short from 'short-uuid' import * as lightning from '../utils/lightning' -import {listUnspent} from '../utils/wallet' +import {listUnspent,UTXO} from '../utils/wallet' import * as jsonUtils from '../utils/json' +import { Op } from 'sequelize' type QueryType = 'onchain_address' export interface Query { @@ -21,12 +22,20 @@ const hub_pubkey = '023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b28 export async function listUTXOs(req, res) { try { - const utxos = await listUnspent() - const accountings = await models.Accounting.findAll() - success(res, { - utxos, - accountings: accountings.map(acc=> jsonUtils.accountingToJson(acc)) + const utxos:UTXO[] = await listUnspent() // at least 1 confg + const addys = utxos.map(utxo=> utxo.address) + + console.log('addys', addys) + const accountings = await models.Accounting.findAll({ + where:{ + address: { + [Op.in]: addys + }, + status: constants.statuses.pending + } }) + + success(res, accountings.map(acc=> jsonUtils.accountingToJson(acc))) } catch(e) { failure(res, e) } diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 7a5e7e3e8..5cb4a93bc 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -25,11 +25,17 @@ export const loadWalletKit = () => { } } -export const listUnspent = () => { + +export interface UTXO { + address: string + address_type: number +} + +export async function listUnspent():Promise { return new Promise(async (resolve, reject) => { let walletkit = await loadWalletKit() try { - const opts = {min_confs:1,max_confs:100} + const opts = {min_confs:0,max_confs:10000} walletkit.listUnspent(opts, function(err, res){ if (err || !(res&&res.utxos)) { reject(err) From a5bfee7249a9383c1ac09a20e302b7d3b03f24bc Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 16 Dec 2020 13:29:07 -0800 Subject: [PATCH 4/6] fix query --- dist/src/controllers/queries.js | 2 +- dist/src/controllers/queries.js.map | 2 +- src/controllers/queries.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/src/controllers/queries.js b/dist/src/controllers/queries.js index faf1974c2..76be073b0 100644 --- a/dist/src/controllers/queries.js +++ b/dist/src/controllers/queries.js @@ -28,7 +28,7 @@ function listUTXOs(req, res) { console.log('addys', addys); const accountings = yield models_1.models.Accounting.findAll({ where: { - address: { + onchain_address: { [sequelize_1.Op.in]: addys }, status: constants_1.default.statuses.pending diff --git a/dist/src/controllers/queries.js.map b/dist/src/controllers/queries.js.map index b0a143f1d..369388e85 100644 --- a/dist/src/controllers/queries.js.map +++ b/dist/src/controllers/queries.js.map @@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AC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file +{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAC/C,4CAAgD;AAChD,2CAA0C;AAC1C,yCAA8B;AAU9B,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,UAAU,GAAG,oEAAoE,CAAA;AAEvF,SAAsB,SAAS,CAAC,GAAG,EAAE,GAAG;;QACtC,IAAI;YACF,MAAM,KAAK,GAAU,MAAM,oBAAW,EAAE,CAAA,CAAC,mBAAmB;YAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAA,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAE5C,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAC3B,MAAM,WAAW,GAAG,MAAM,eAAM,CAAC,UAAU,CAAC,OAAO,CAAC;gBAClD,KAAK,EAAC;oBACJ,eAAe,EAAE;wBACf,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,KAAK;qBACf;oBACD,MAAM,EAAE,mBAAS,CAAC,QAAQ,CAAC,OAAO;iBACnC;aACF,CAAC,CAAA;YAEF,aAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAA,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;SACrE;QAAC,OAAM,CAAC,EAAE;YACT,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;SAChB;IACH,CAAC;CAAA;AAnBD,8BAmBC;AAED,SAAsB,mBAAmB,CAAC,GAAG,EAAE,GAAG;;QAChD,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA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AAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file diff --git a/src/controllers/queries.ts b/src/controllers/queries.ts index 6e1cac5b3..dd58694a2 100644 --- a/src/controllers/queries.ts +++ b/src/controllers/queries.ts @@ -28,7 +28,7 @@ export async function listUTXOs(req, res) { console.log('addys', addys) const accountings = await models.Accounting.findAll({ where:{ - address: { + onchain_address: { [Op.in]: addys }, status: constants.statuses.pending From 319e1bbe95bf6c27e5f87ab01c6f0fed2bb65b3a Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 16 Dec 2020 13:54:52 -0800 Subject: [PATCH 5/6] add amount into acc record --- dist/src/controllers/queries.js | 11 ++++++++++- dist/src/controllers/queries.js.map | 2 +- dist/src/utils/wallet.js.map | 2 +- src/controllers/queries.ts | 12 +++++++++++- src/utils/wallet.ts | 1 + 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/dist/src/controllers/queries.js b/dist/src/controllers/queries.js index 76be073b0..087d5fc8c 100644 --- a/dist/src/controllers/queries.js +++ b/dist/src/controllers/queries.js @@ -34,7 +34,16 @@ function listUTXOs(req, res) { status: constants_1.default.statuses.pending } }); - res_1.success(res, accountings.map(acc => jsonUtils.accountingToJson(acc))); + const ret = []; + accountings.forEach(a => { + const acc = Object.assign({}, a.dataValues); + const utxo = utxos.find(u => u.address === a.onchainAddress); + if (utxo) { + acc.amount = utxo.amount_sat; + ret.push(acc); + } + }); + res_1.success(res, ret.map(acc => jsonUtils.accountingToJson(acc))); } catch (e) { res_1.failure(res, e); diff --git a/dist/src/controllers/queries.js.map b/dist/src/controllers/queries.js.map index 369388e85..2acf19c07 100644 --- a/dist/src/controllers/queries.js.map +++ b/dist/src/controllers/queries.js.map @@ -1 +1 @@ -{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],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,QAAA,oBAAoB,GAAG,CAAO,OAAO,EAAE,EAAE;IACpD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAA;IACtC,4CAA4C;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;IACnC,IAAI;QACF,MAAM,CAAC,GAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file diff --git a/dist/src/utils/wallet.js.map b/dist/src/utils/wallet.js.map index 14e88319b..6a6f05b9f 100644 --- a/dist/src/utils/wallet.js.map +++ b/dist/src/utils/wallet.js.map @@ -1 +1 @@ -{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/utils/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,6BAA4B;AAC5B,2CAA6C;AAC7C,qCAAmC;AAEnC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,WAAW,CAAA;AAE3C,IAAI,YAAY,CAAA;AAEH,QAAA,aAAa,GAAG,GAAG,EAAE;IAChC,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAA;KACpB;SAAM;QACL,IAAI;YACF,IAAI,WAAW,GAAG,2BAAe,EAAE,CAAA;YACnC,IAAI,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACzD,IAAI,SAAS,GAAQ,eAAe,CAAC,SAAS,CAAA;YAC9C,YAAY,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,GAAG,M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AAG,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACzD,IAAI,SAAS,GAAQ,eAAe,CAAC,SAAS,CAAA;YAC9C,YAAY,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACpF,OAAO,YAAY,CAAA;SACpB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,CAAA;SACR;KACF;AACH,CAAC,CAAA;AASD,SAAsB,WAAW;;QAC/B,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,SAAS,GAAG,MAAM,qBAAa,EAAE,CAAA;YACrC,IAAI;gBACF,MAAM,IAAI,GAAG,EAAC,SAAS,EAAC,CAAC,EAAC,SAAS,EAAC,KAAK,EAAC,CAAA;gBAC1C,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,UAAS,GAAG,EAAE,GAAG;oBAC3C,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,IAAE,GAAG,CAAC,KAAK,CAAC,EAAE;wBAC5B,MAAM,CAAC,GAAG,CAAC,CAAA;qBACZ;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;qBACnB;gBACH,CAAC,CAAC,CAAA;aACH;YAAC,OAAM,CAAC,EAAE;gBACT,MAAM,CAAC,CAAC,CAAC,CAAA;aACV;QACH,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CAAA;AAhBD,kCAgBC"} \ No newline at end of file diff --git a/src/controllers/queries.ts b/src/controllers/queries.ts index dd58694a2..8087c0147 100644 --- a/src/controllers/queries.ts +++ b/src/controllers/queries.ts @@ -35,7 +35,17 @@ export async function listUTXOs(req, res) { } }) - success(res, accountings.map(acc=> jsonUtils.accountingToJson(acc))) + const ret: any[] = [] + accountings.forEach(a=>{ + const acc = {...a.dataValues} + const utxo = utxos.find(u=>u.address===a.onchainAddress) + if(utxo) { + acc.amount = utxo.amount_sat + ret.push(acc) + } + }) + + success(res, ret.map(acc=> jsonUtils.accountingToJson(acc))) } catch(e) { failure(res, e) } diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 5cb4a93bc..621ad052b 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -29,6 +29,7 @@ export const loadWalletKit = () => { export interface UTXO { address: string address_type: number + amount_sat: number } export async function listUnspent():Promise { From feff52d0e4cd9f30c87cfc443152caa21c0876d3 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 16 Dec 2020 14:15:17 -0800 Subject: [PATCH 6/6] add confs too --- dist/src/controllers/queries.js | 2 +- dist/src/controllers/queries.js.map | 2 +- dist/src/utils/wallet.js.map | 2 +- src/controllers/queries.ts | 2 +- src/utils/wallet.ts | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dist/src/controllers/queries.js b/dist/src/controllers/queries.js index 087d5fc8c..35fb8ce70 100644 --- a/dist/src/controllers/queries.js +++ b/dist/src/controllers/queries.js @@ -25,7 +25,6 @@ function listUTXOs(req, res) { try { const utxos = yield wallet_1.listUnspent(); // at least 1 confg const addys = utxos.map(utxo => utxo.address); - console.log('addys', addys); const accountings = yield models_1.models.Accounting.findAll({ where: { onchain_address: { @@ -40,6 +39,7 @@ function listUTXOs(req, res) { const utxo = utxos.find(u => u.address === a.onchainAddress); if (utxo) { acc.amount = utxo.amount_sat; + acc.confirmations = utxo.confirmations; ret.push(acc); } }); diff --git a/dist/src/controllers/queries.js.map b/dist/src/controllers/queries.js.map index 2acf19c07..824237be5 100644 --- a/dist/src/controllers/queries.js.map +++ b/dist/src/controllers/queries.js.map @@ -1 +1 @@ -{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;A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5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;IACnC,IAAI;QACF,MAAM,CAAC,GAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file +{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/controllers/queries.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA+C;AAC/C,sCAAkC;AAClC,sCAAqC;AACrC,4CAAoC;AACpC,oCAAmC;AACnC,gDAA+C;AAC/C,4CAAgD;AAChD,2CAA0C;AAC1C,yCAA8B;AAU9B,IAAI,OAAO,GAA2B,EAAE,CAAA;AAExC,MAAM,UAAU,GAAG,oEAAoE,CAAA;AAEvF,SAAsB,SAAS,CAAC,GAAG,EAAE,GAAG;;QACtC,IAAI;YACF,MAAM,KAAK,GAAU,MAAM,oBAAW,EAAE,CAAA,CAAC,mBAAmB;YAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAA,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAE5C,MAAM,WAAW,GAAG,MAAM,eAAM,CAAC,UAAU,CAAC,OAAO,CAAC;gBAClD,KAAK,EAAC;oBACJ,eAAe,EAAE;wBACf,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,KAAK;qBACf;oBACD,MAAM,EAAE,mBAAS,CAAC,QAAQ,CAAC,OAAO;iBACnC;aACF,CAAC,CAAA;YAEF,MAAM,GAAG,GAAU,EAAE,CAAA;YACrB,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA,EAAE;gBACrB,MAAM,GAAG,qBAAO,CAAC,CAAC,UAAU,CAAC,CAAA;gBAC7B,MAAM,I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,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;aAChC;YACD,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE;SACpC;KACD,CAAA;IACD,IAAI;QACH,MAAM,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;KAC/B;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;QAC5C,OAAM;KACN;AACF,CAAC,CAAA,CAAA;AAEY,QAAA,oBAAoB,GAAG,CAAO,OAAO,EAAE,EAAE;IACpD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAA;IACtC,4CAA4C;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;IACnC,IAAI;QACF,MAAM,CAAC,GAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACpB;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAC,CAAC,CAAC,CAAA;KAChD;AACH,CAAC,CAAA,CAAA"} \ No newline at end of file diff --git a/dist/src/utils/wallet.js.map b/dist/src/utils/wallet.js.map index 6a6f05b9f..1da4bd65b 100644 --- a/dist/src/utils/wallet.js.map +++ b/dist/src/utils/wallet.js.map @@ -1 +1 @@ -{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/utils/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,6BAA4B;AAC5B,2CAA6C;AAC7C,qCAAmC;AAEnC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAA;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,WAAW,CAAA;AAE3C,IAAI,YAAY,CAAA;AAEH,QAAA,aAAa,GAAG,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CAAA,CAAC,CAAA;IACJ,CAAC;CAAA;AAhBD,kCAgBC"} \ No newline at end of file diff --git a/src/controllers/queries.ts b/src/controllers/queries.ts index 8087c0147..041987890 100644 --- a/src/controllers/queries.ts +++ b/src/controllers/queries.ts @@ -25,7 +25,6 @@ export async function listUTXOs(req, res) { const utxos:UTXO[] = await listUnspent() // at least 1 confg const addys = utxos.map(utxo=> utxo.address) - console.log('addys', addys) const accountings = await models.Accounting.findAll({ where:{ onchain_address: { @@ -41,6 +40,7 @@ export async function listUTXOs(req, res) { const utxo = utxos.find(u=>u.address===a.onchainAddress) if(utxo) { acc.amount = utxo.amount_sat + acc.confirmations = utxo.confirmations ret.push(acc) } }) diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 621ad052b..fad95b368 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -30,6 +30,7 @@ export interface UTXO { address: string address_type: number amount_sat: number + confirmations: number } export async function listUnspent():Promise {