Versie 0.2.0
This commit is contained in:
commit
e77d8fd373
495 files changed
+81026
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// Generated, do not edit. sha256:7e67d01e5ccf6ce7a103e0d0647ba030da33d566237ec5c657ed27cb9e070f30
|
||||
export const isForward = p => p.tx_layer === 'lightning' && typeof p.transactionHash === 'string'
|
||||
&& p.transactionHash.startsWith('fwd:');
|
||||
|
||||
export function bulkPlan(pending) {
|
||||
return (pending || []).map(p => {
|
||||
if (p.tx_kind) return { id: p.id, action: 'internal', proposal: p };
|
||||
if (p.tx_layer !== 'lightning') return { id: p.id, action: 'skip', reason: 'onchain', proposal: p };
|
||||
if (isForward(p)) return { id: p.id, action: 'interest', proposal: p };
|
||||
return { id: p.id, action: 'trade', proposal: p };
|
||||
});
|
||||
}
|
||||
|
||||
export function bulkCounts(plan) {
|
||||
const n = { internal: 0, interest: 0, trade: 0, onchain: 0 };
|
||||
for (const s of plan || []) {
|
||||
if (s.action === 'skip') n[s.reason]++;
|
||||
else n[s.action]++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
Reference in new issue
Block a user