Browse Source

finish loopbot, rnd

push-params
Evan Feenstra 4 years ago
parent
commit
f291b8cb5a
  1. 68
      api/bots/loop.ts
  2. 4
      api/utils/tribes.ts
  3. 45
      dist/api/bots/loop.js
  4. 2
      dist/api/bots/loop.js.map
  5. 4
      dist/api/utils/tribes.js
  6. 2
      dist/api/utils/tribes.js.map

68
api/bots/loop.ts

@ -6,10 +6,10 @@ const msg_types = Sphinx.MSG_TYPE
let initted = false let initted = false
const url = 'http://localhost:8081' const baseurl = 'https://localhost:8080'
export function init() { export function init() {
if(initted) return if (initted) return
initted = true initted = true
const client = new Sphinx.Client() const client = new Sphinx.Client()
@ -18,11 +18,11 @@ export function init() {
client.on(msg_types.MESSAGE, async (message: Sphinx.Message) => { client.on(msg_types.MESSAGE, async (message: Sphinx.Message) => {
const arr = message.content.split(' ') const arr = message.content.split(' ')
if (arr.length < 2) return if (arr.length < 2) return
if (arr[0]!=='/loopout') return if (arr[0] !== '/loopout') return
if (arr.length===3) { // loop if (arr.length === 3) { // loop
const addy = arr[1] const addy = arr[1]
if(!validate(addy)) { if (!validate(addy)) {
const embed = new Sphinx.MessageEmbed() const embed = new Sphinx.MessageEmbed()
.setAuthor('LoopBot') .setAuthor('LoopBot')
.setDescription('Invalid BTC address') .setDescription('Invalid BTC address')
@ -30,7 +30,7 @@ export function init() {
return return
} }
const amt = arr[2] const amt = arr[2]
if(!validateAmount(amt)) { if (!validateAmount(amt)) {
const embed = new Sphinx.MessageEmbed() const embed = new Sphinx.MessageEmbed()
.setAuthor('LoopBot') .setAuthor('LoopBot')
.setDescription('Invalid amount') .setDescription('Invalid amount')
@ -38,22 +38,29 @@ export function init() {
return return
} }
try { try {
const r = await fetch(url+'/v1/loop/out',{ const j = await doRequest(baseurl + '/v1/loop/out/quote/'+amt)
method: 'POST', console.log("=> LOOP QUOTE RES", j)
if(!(j&&(j.swap_fee||j.swap_fee_sat))){
return
}
const j2 = await doRequest(baseurl + '/v1/loop/out', {
method:'POST',
body: JSON.stringify({ body: JSON.stringify({
amt: amt, amt: amt,
dest: addy, dest: addy,
}), }),
headers: { 'Content-Type': 'application/json' },
}) })
if (!r.ok) return console.log("=> LOOP RESPONSE", j2)
// const j = await r.json() if(!(j2&&j2.server_message)) {
return
}
const embed = new Sphinx.MessageEmbed() const embed = new Sphinx.MessageEmbed()
.setAuthor('LoopBot') .setAuthor('LoopBot')
.setTitle('Loop Initialized!') .setTitle('Loop Initialized!')
.setDescription(j2.server_message)
message.channel.send({ embed }) message.channel.send({ embed })
} catch(e){ } catch (e) {
console.log('Loop bot error',e) console.log('LoopBot error', e)
} }
} }
@ -74,7 +81,7 @@ export function init() {
const embed2 = new Sphinx.MessageEmbed() const embed2 = new Sphinx.MessageEmbed()
.setAuthor('LoopBot') .setAuthor('LoopBot')
.setDescription('Command not recognized') .setDescription('Command not recognized')
message.channel.send({ embed:embed2 }) message.channel.send({ embed: embed2 })
return return
} }
}) })
@ -84,8 +91,37 @@ const botSVG = `<svg viewBox="64 64 896 896" height="12" width="12" fill="white"
<path d="M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" /> <path d="M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" />
</svg>` </svg>`
function validateAmount(amtString:string){ function validateAmount(amtString: string) {
const amt = parseInt(amtString) const amt = parseInt(amtString)
const ok = amt>0 const ok = amt > 0
return ok return ok
} }
const fs = require('fs')
const https = require("https");
const homedir = require('os').homedir();
const agent = new https.Agent({
rejectUnauthorized: false
})
var filepath = homedir + '/.lnd/data/chain/bitcoin/mainnet/admin.macaroon'
async function doRequest(theurl:string, params?:Object) {
const ps = params || {}
try {
var macaroonString = fs.readFileSync(filepath);
var mac = Buffer.from(macaroonString, 'utf8').toString('hex');
const theParams = {
agent,
headers: {
'Grpc-Metadata-macaroon': mac
},
...ps
}
const r = await fetch(theurl, theParams)
const j = await r.json()
return j
} catch (e) {
throw e
}
}

4
api/utils/tribes.ts

@ -25,10 +25,12 @@ export async function connect(onMessage) {
password: pwd, password: pwd,
reconnectPeriod: 0, // dont auto reconnect reconnectPeriod: 0, // dont auto reconnect
}) })
client.on('connect', function () { client.on('connect', async function () {
console.log("[tribes] connected!") console.log("[tribes] connected!")
client.subscribe(`${info.identity_pubkey}/#`) client.subscribe(`${info.identity_pubkey}/#`)
updateTribeStats(info.identity_pubkey) updateTribeStats(info.identity_pubkey)
const rndToken = await genSignedTimestamp()
console.log('=> random sig', rndToken)
}) })
client.on('close', function (e) { client.on('close', function (e) {
setTimeout(() => reconnect(), 2000) setTimeout(() => reconnect(), 2000)

45
dist/api/bots/loop.js

@ -15,7 +15,7 @@ const node_fetch_1 = require("node-fetch");
const bitcoin_address_validation_1 = require("bitcoin-address-validation"); const bitcoin_address_validation_1 = require("bitcoin-address-validation");
const msg_types = Sphinx.MSG_TYPE; const msg_types = Sphinx.MSG_TYPE;
let initted = false; let initted = false;
const url = 'http://localhost:8081'; const baseurl = 'https://localhost:8080';
function init() { function init() {
if (initted) if (initted)
return; return;
@ -46,24 +46,30 @@ function init() {
return; return;
} }
try { try {
const r = yield node_fetch_1.default(url + '/v1/loop/out', { const j = yield doRequest(baseurl + '/v1/loop/out/quote/' + amt);
console.log("=> LOOP QUOTE RES", j);
if (!(j && (j.swap_fee || j.swap_fee_sat))) {
return;
}
const j2 = yield doRequest(baseurl + '/v1/loop/out', {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
amt: amt, amt: amt,
dest: addy, dest: addy,
}), }),
headers: { 'Content-Type': 'application/json' },
}); });
if (!r.ok) console.log("=> LOOP RESPONSE", j2);
if (!(j2 && j2.server_message)) {
return; return;
// const j = await r.json() }
const embed = new Sphinx.MessageEmbed() const embed = new Sphinx.MessageEmbed()
.setAuthor('LoopBot') .setAuthor('LoopBot')
.setTitle('Loop Initialized!'); .setTitle('Loop Initialized!')
.setDescription(j2.server_message);
message.channel.send({ embed }); message.channel.send({ embed });
} }
catch (e) { catch (e) {
console.log('Loop bot error', e); console.log('LoopBot error', e);
} }
} }
const cmd = arr[1]; const cmd = arr[1];
@ -97,4 +103,29 @@ function validateAmount(amtString) {
const ok = amt > 0; const ok = amt > 0;
return ok; return ok;
} }
const fs = require('fs');
const https = require("https");
const homedir = require('os').homedir();
const agent = new https.Agent({
rejectUnauthorized: false
});
var filepath = homedir + '/.lnd/data/chain/bitcoin/mainnet/admin.macaroon';
function doRequest(theurl, params) {
return __awaiter(this, void 0, void 0, function* () {
const ps = params || {};
try {
var macaroonString = fs.readFileSync(filepath);
var mac = Buffer.from(macaroonString, 'utf8').toString('hex');
const theParams = Object.assign({ agent, headers: {
'Grpc-Metadata-macaroon': mac
} }, ps);
const r = yield node_fetch_1.default(theurl, theParams);
const j = yield r.json();
return j;
}
catch (e) {
throw e;
}
});
}
//# sourceMappingURL=loop.js.map //# sourceMappingURL=loop.js.map

2
dist/api/bots/loop.js.map

@ -1 +1 @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O,CAAC,CAAA;SACT;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,CAAA;SACR;IACH,CAAC;CAAA"}

4
dist/api/utils/tribes.js

@ -34,9 +34,13 @@ function connect(onMessage) {
reconnectPeriod: 0, reconnectPeriod: 0,
}); });
client.on('connect', function () { client.on('connect', function () {
return __awaiter(this, void 0, void 0, function* () {
console.log("[tribes] connected!"); console.log("[tribes] connected!");
client.subscribe(`${info.identity_pubkey}/#`); client.subscribe(`${info.identity_pubkey}/#`);
updateTribeStats(info.identity_pubkey); updateTribeStats(info.identity_pubkey);
const rndToken = yield genSignedTimestamp();
console.log('=> random sig', rndToken);
});
}); });
client.on('close', function (e) { client.on('close', function (e) {
setTimeout(() => reconnect(), 2000); setTimeout(() => reconnect(), 2000);

2
dist/api/utils/tribes.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save