aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-09-10 20:40:36 -0700
committerAdam Soltys <[email protected]>2020-09-10 20:40:36 -0700
commit54a9a19b2a623cadf8b7ac4f4741587797b68037 (patch)
treeb50232c6be86b7faef4da0e85bee2da458d7bd5c
parent37162b277c49ab693a26da3e4d8aa683222bd5a9 (diff)
downloadcoinos-server-54a9a19b2a623cadf8b7ac4f4741587797b68037.tar.gz
coinos-server-54a9a19b2a623cadf8b7ac4f4741587797b68037.zip
change network codes
-rw-r--r--lib/buildliquidtx.js2
-rw-r--r--lib/buildtx.js2
-rw-r--r--lib/send.js2
-rw-r--r--routes/invoices.js2
-rw-r--r--routes/lightning/receive.js4
-rw-r--r--routes/liquid/broadcast.js2
-rw-r--r--routes/liquid/receive.js4
-rw-r--r--routes/liquid/send.js2
-rw-r--r--routes/lnurl.js2
-rw-r--r--routes/swaps.js4
-rw-r--r--routes/users.js16
11 files changed, 25 insertions, 17 deletions
diff --git a/lib/buildliquidtx.js b/lib/buildliquidtx.js
index cc1c3f10..d84bdc0b 100644
--- a/lib/buildliquidtx.js
+++ b/lib/buildliquidtx.js
@@ -22,7 +22,7 @@ module.exports = async ({ address, asset, amount, feeRate, user }) => {
where: {
received: true,
account_id: user.account_id,
- network: 'LBTC',
+ network: 'liquid',
},
});
diff --git a/lib/buildtx.js b/lib/buildtx.js
index 8c8be959..ef24ea19 100644
--- a/lib/buildtx.js
+++ b/lib/buildtx.js
@@ -16,7 +16,7 @@ module.exports = async ({ address, amount, feeRate, user }) => {
where: {
received: true,
account_id: user.account_id,
- network: 'BTC',
+ network: 'bitcoin',
}
});
diff --git a/lib/send.js b/lib/send.js
index 519a152c..62fd5af2 100644
--- a/lib/send.js
+++ b/lib/send.js
@@ -78,7 +78,7 @@ send = async (amount, memo, hash, user) => {
rate: app.get("rates")[user.currency],
currency: user.currency,
confirmed: true,
- network: "LNBTC",
+ network: "lightning",
fee,
},
{ transaction }
diff --git a/routes/invoices.js b/routes/invoices.js
index dc0650d1..092b5eae 100644
--- a/routes/invoices.js
+++ b/routes/invoices.js
@@ -38,7 +38,7 @@ app.post("/invoice", ah(async (req, res, next) => {
invoice.rate.toFixed(2)
);
- if (invoice.network === "LBTC") {
+ if (invoice.network === "liquid") {
invoice.unconfidential = (
await lq.getAddressInfo(invoice.address)
).unconfidential;
diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js
index 719a8184..5b0d1d77 100644
--- a/routes/lightning/receive.js
+++ b/routes/lightning/receive.js
@@ -1,5 +1,3 @@
-const asset = "LNBTC";
-
const handlePayment = async (msg) => {
try {
await db.transaction(async (transaction) => {
@@ -49,7 +47,7 @@ const handlePayment = async (msg) => {
rate,
received: true,
confirmed: true,
- network: "LNBTC",
+ network: "lightning",
tip,
},
{ transaction }
diff --git a/routes/liquid/broadcast.js b/routes/liquid/broadcast.js
index e3709597..a39349a1 100644
--- a/routes/liquid/broadcast.js
+++ b/routes/liquid/broadcast.js
@@ -16,7 +16,7 @@ module.exports = ah(async (req, res) => {
currency: user.currency,
confirmed: true,
received: false,
- network: "LBTC",
+ network: "liquid",
});
account.balance += payment.amount - payment.fee;
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js
index 9f548b9c..5d732ffb 100644
--- a/routes/liquid/receive.js
+++ b/routes/liquid/receive.js
@@ -88,7 +88,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => {
where: {
unconfidential: address,
user_id: user.id,
- network: "LBTC",
+ network: "liquid",
},
order: [["id", "DESC"]],
include: {
@@ -139,7 +139,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => {
tip,
confirmed,
address,
- network: "LBTC",
+ network: "liquid",
});
payments.push(blinded.txid);
diff --git a/routes/liquid/send.js b/routes/liquid/send.js
index 7f7e1cb5..a38f84e2 100644
--- a/routes/liquid/send.js
+++ b/routes/liquid/send.js
@@ -78,7 +78,7 @@ module.exports = ah(async (req, res) => {
address,
confirmed: true,
received: false,
- network: "LBTC",
+ network: "liquid",
};
payment.account = account;
diff --git a/routes/lnurl.js b/routes/lnurl.js
index 90fa4c93..f40da684 100644
--- a/routes/lnurl.js
+++ b/routes/lnurl.js
@@ -349,7 +349,7 @@ lnurlServer.bindToHook(
rate: app.get("rates")[user.currency],
currency: user.currency,
confirmed: true,
- network: "LNBTC",
+ network: "lightning",
},
{ transaction }
);
diff --git a/routes/swaps.js b/routes/swaps.js
index 71c35733..41a7ef94 100644
--- a/routes/swaps.js
+++ b/routes/swaps.js
@@ -315,7 +315,7 @@ app.post("/accept", optionalAuth, ah(async (req, res) => {
address: u_address_r,
confirmed: true,
received: false,
- network: "LBTC",
+ network: "liquid",
});
amount = Math.round(leg2.amount * SATS);
@@ -328,7 +328,7 @@ app.post("/accept", optionalAuth, ah(async (req, res) => {
rate,
amount,
tip: 0,
- network: "LBTC",
+ network: "liquid",
});
addresses[u_address_p] = proposal.user.username;
diff --git a/routes/users.js b/routes/users.js
index c7b6bfa4..d1bdfc0c 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -237,8 +237,6 @@ app.post(
where: { id }
});
- console.log("updated", account.id, account.asset);
-
emit(user.username, "account", account);
}
@@ -422,7 +420,8 @@ app.post(
seed,
pubkey,
path,
- hide
+ hide,
+ index,
} = req.body;
try {
@@ -592,6 +591,17 @@ app.post(
);
app.post(
+ "/checkRedeemCode",
+ auth,
+ ah(async function(req, res) {
+ const { redeemcode } = req.body;
+
+ const payment = await db.Payment.findOne({ where: { redeemcode } });
+ res.send(payment);
+ })
+);
+
+app.post(
"/password",
auth,
ah(async function(req, res) {