Browse Source

fix weaving, cleanup

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
42935eada0
  1. 2
      dist/src/network/receive.js
  2. 2
      dist/src/network/receive.js.map
  3. 3
      dist/src/utils/lightning.js
  4. 2
      dist/src/utils/lightning.js.map
  5. 2
      src/network/receive.ts
  6. 3
      src/utils/lightning.ts

2
dist/src/network/receive.js

@ -101,7 +101,6 @@ function onReceive(payload) {
// CHECK PRICES
if (needsPricePerMessage) {
if (payload.message.amount < chat.pricePerMessage) {
console.log("===> WEAVE AMOUNT IS TOO LOW", payload.message.amount, chat.pricePerMessage);
doAction = false;
}
if (chat.escrowAmount) {
@ -387,7 +386,6 @@ function parseKeysendInvoice(i) {
if (payload) {
const dat = payload;
if (value && dat && dat.message) {
console.log("===> WEAVE TRUE VALUE:", value);
dat.message.amount = value; // ADD IN TRUE VALUE
}
dat.network_type = constants_1.default.network_types.lightning;

2
dist/src/network/receive.js.map

File diff suppressed because one or more lines are too long

3
dist/src/utils/lightning.js

@ -204,14 +204,11 @@ function keysendMessage(opts) {
let res = null;
const ts = new Date().valueOf();
// WEAVE MESSAGE If TOO LARGE
console.log("===> WEAVE");
yield asyncForEach(Array.from(Array(n)), (u, i) => __awaiter(this, void 0, void 0, function* () {
const spliti = Math.ceil(opts.data.length / n);
const m = opts.data.substr(i * spliti, spliti);
const isLastThread = i === n - 1;
console.log("===> WEAVE i:", i);
const amt = isLastThread ? opts.amt : constants_1.default.min_sat_amount;
console.log("===> WEAVE amt:", amt);
try {
res = yield keysend(Object.assign(Object.assign({}, opts), { amt, data: `${ts}_${i}_${n}_${m}` }));
success = true;

2
dist/src/utils/lightning.js.map

File diff suppressed because one or more lines are too long

2
src/network/receive.ts

@ -90,7 +90,6 @@ async function onReceive(payload){
// CHECK PRICES
if(needsPricePerMessage) {
if(payload.message.amount<chat.pricePerMessage) {
console.log("===> WEAVE AMOUNT IS TOO LOW", payload.message.amount, chat.pricePerMessage)
doAction=false
}
if(chat.escrowAmount) {
@ -356,7 +355,6 @@ export async function parseKeysendInvoice(i){
if(payload){
const dat = payload
if(value && dat && dat.message){
console.log("===> WEAVE TRUE VALUE:", value)
dat.message.amount = value // ADD IN TRUE VALUE
}
dat.network_type = constants.network_types.lightning

3
src/utils/lightning.ts

@ -191,14 +191,11 @@ async function keysendMessage(opts) {
let res:any = null
const ts = new Date().valueOf()
// WEAVE MESSAGE If TOO LARGE
console.log("===> WEAVE")
await asyncForEach(Array.from(Array(n)), async(u,i)=> {
const spliti = Math.ceil(opts.data.length/n)
const m = opts.data.substr(i*spliti, spliti)
const isLastThread = i===n-1
console.log("===> WEAVE i:",i)
const amt = isLastThread ? opts.amt : constants.min_sat_amount
console.log("===> WEAVE amt:",amt)
try {
res = await keysend({
...opts, amt, // split the amt too

Loading…
Cancel
Save