Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alby-tools

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alby-tools - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

dist/podcasting2/boostagrams.d.ts

6

dist/index.d.ts
import fetchWithLsat from "./lsat/fetch";
export { fetchWithLsat };
import { boost as sendBoostagram } from "./podcasting2/boostagrams";
export * as lsat from "./lsat/fetch";
export * as boostagrams from "./podcasting2/boostagrams";
export * as fiat from "./utils/fiat";
export { fetchWithLsat, sendBoostagram };
//# sourceMappingURL=index.d.ts.map

2

dist/index.modern.js

@@ -1,2 +0,2 @@

import e from"cross-fetch";class t{constructor(e){this.storage=e||{}}getItem(e){return this.storage[e]}setItem(e,t){this.storage[e]=t}}const r=async(r,a,s)=>{s||(s={});const i=s.webln||"undefined"!=typeof window&&window.webln;if(!i)throw new Error("WebLN is missing");let n=s.store||new t;a||(a={}),a.cache="no-store",a.mode="cors",a.headers||(a.headers={});const o=n.getItem(r);if(o){const t=JSON.parse(o);return a.headers.Authorization=`LSAT ${t.mac}:${t.preimage}`,await e(r,a)}a.headers["Accept-Authenticate"]="LSAT";const c=await e(r,a),m=c.headers.get("www-authenticate");if(!m)return c;const w=m.split(","),h=w[0].replace("LSAT macaroon=","").trimStart(),d=w[1].replace("invoice=","").trimStart();await i.enable();const g=await i.sendPayment(d);return n.setItem(r,JSON.stringify({mac:h,preimage:g.preimage})),a.headers.Authorization=`LSAT ${h}:${g.preimage}`,await e(r,a)};export{r as fetchWithLsat};
import t from"cross-fetch";class e{constructor(t){this.storage=t||{}}getItem(t){return this.storage[t]}setItem(t,e){this.storage[t]=e}}const a=async(a,o,r)=>{r||(r={});const s=r.webln||"undefined"!=typeof window&&window.webln;if(!s)throw new Error("WebLN is missing");let n=r.store||new e;o||(o={}),o.cache="no-store",o.mode="cors",o.headers||(o.headers={});const c=n.getItem(a);if(c){const e=JSON.parse(c);return o.headers.Authorization=`LSAT ${e.mac}:${e.preimage}`,await t(a,o)}o.headers["Accept-Authenticate"]="LSAT";const i=await t(a,o),u=i.headers.get("www-authenticate");if(!u)return i;const l=u.split(","),m=l[0].replace("LSAT macaroon=","").trim(),w=l[1].replace("invoice=","").trim();await s.enable();const d=await s.sendPayment(w);return n.setItem(a,JSON.stringify({mac:m,preimage:d.preimage})),o.headers.Authorization=`LSAT ${m}:${d.preimage}`,await t(a,o)};var o={__proto__:null,fetchWithLsat:a,default:a};const r=async(t,e)=>{let{boost:a,amount:o}=t;e||(e={});const r=e.webln||"undefined"!=typeof window&&window.webln;o||(o=Math.floor(a.value_msat/1e3));let s={destination:t.destination,amount:o,customRecords:{7629169:JSON.stringify(a)}};return t.customKey&&t.customValue&&(s.customRecords[t.customKey]=t.customValue),await r.enable(),await r.keysend(s)};var s={__proto__:null,boost:r,default:r};const n=async e=>{const a=await t(`https://getalby.com/api/rates/${e.toLowerCase()}.json`);return(await a.json()).rate_float/1e8},c=async({satoshi:t,currency:e})=>{const a=await n(e);return Number(t)*a};var i={__proto__:null,getFiatBtcRate:n,getFiatValue:c,getSatoshiValue:async({amount:t,currency:e})=>{const a=await n(e);return Math.floor(Number(t)/a)},getFormattedFiatValue:async({satoshi:t,currency:e})=>(await c({satoshi:t,currency:e})).toLocaleString("en",{style:"currency",currency:e})};export{s as boostagrams,a as fetchWithLsat,i as fiat,o as lsat,r as sendBoostagram};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

import e from"cross-fetch";var r=/*#__PURE__*/function(){function e(e){this.storage=e||{}}var r=e.prototype;return r.getItem=function(e){return this.storage[e]},r.setItem=function(e,r){this.storage[e]=r},e}(),t=function(t,n,o){try{var i,a=function(r){return i?r:(n.headers["Accept-Authenticate"]="LSAT",Promise.resolve(e(t,n)).then(function(r){var o=r.headers.get("www-authenticate");if(!o)return r;var i=o.split(","),a=i[0].replace("LSAT macaroon=","").trimStart(),u=i[1].replace("invoice=","").trimStart();return Promise.resolve(s.enable()).then(function(){return Promise.resolve(s.sendPayment(u)).then(function(r){return c.setItem(t,JSON.stringify({mac:a,preimage:r.preimage})),n.headers.Authorization="LSAT "+a+":"+r.preimage,Promise.resolve(e(t,n))})})}))};o||(o={});var s=o.webln||"undefined"!=typeof window&&window.webln;if(!s)throw new Error("WebLN is missing");var c=o.store||new r;n||(n={}),n.cache="no-store",n.mode="cors",n.headers||(n.headers={});var u=c.getItem(t),m=function(){if(u){var r=JSON.parse(u);return n.headers.Authorization="LSAT "+r.mac+":"+r.preimage,Promise.resolve(e(t,n)).then(function(e){return i=1,e})}}();return Promise.resolve(m&&m.then?m.then(a):a(m))}catch(e){return Promise.reject(e)}};export{t as fetchWithLsat};
import e from"cross-fetch";var t=/*#__PURE__*/function(){function e(e){this.storage=e||{}}var t=e.prototype;return t.getItem=function(e){return this.storage[e]},t.setItem=function(e,t){this.storage[e]=t},e}(),r=function(r,n,o){try{var s,i=function(t){return s?t:(n.headers["Accept-Authenticate"]="LSAT",Promise.resolve(e(r,n)).then(function(t){var o=t.headers.get("www-authenticate");if(!o)return t;var s=o.split(","),i=s[0].replace("LSAT macaroon=","").trim(),c=s[1].replace("invoice=","").trim();return Promise.resolve(a.enable()).then(function(){return Promise.resolve(a.sendPayment(c)).then(function(t){return u.setItem(r,JSON.stringify({mac:i,preimage:t.preimage})),n.headers.Authorization="LSAT "+i+":"+t.preimage,Promise.resolve(e(r,n))})})}))};o||(o={});var a=o.webln||"undefined"!=typeof window&&window.webln;if(!a)throw new Error("WebLN is missing");var u=o.store||new t;n||(n={}),n.cache="no-store",n.mode="cors",n.headers||(n.headers={});var c=u.getItem(r),m=function(){if(c){var t=JSON.parse(c);return n.headers.Authorization="LSAT "+t.mac+":"+t.preimage,Promise.resolve(e(r,n)).then(function(e){return s=1,e})}}();return Promise.resolve(m&&m.then?m.then(i):i(m))}catch(e){return Promise.reject(e)}},n={__proto__:null,fetchWithLsat:r,default:r},o=function(e,t){try{var r=e.boost,n=e.amount;t||(t={});var o=t.webln||"undefined"!=typeof window&&window.webln;n||(n=Math.floor(r.value_msat/1e3));var s={destination:e.destination,amount:n,customRecords:{7629169:JSON.stringify(r)}};return e.customKey&&e.customValue&&(s.customRecords[e.customKey]=e.customValue),Promise.resolve(o.enable()).then(function(){return Promise.resolve(o.keysend(s))})}catch(e){return Promise.reject(e)}},s={__proto__:null,boost:o,default:o},i=function(t){try{return Promise.resolve(e("https://getalby.com/api/rates/"+t.toLowerCase()+".json")).then(function(e){return Promise.resolve(e.json()).then(function(e){return e.rate_float/1e8})})}catch(e){return Promise.reject(e)}},a=function(e){var t=e.satoshi;return Promise.resolve(i(e.currency)).then(function(e){return Number(t)*e})},u={__proto__:null,getFiatBtcRate:i,getFiatValue:a,getSatoshiValue:function(e){var t=e.amount;return Promise.resolve(i(e.currency)).then(function(e){return Math.floor(Number(t)/e)})},getFormattedFiatValue:function(e){var t=e.currency;return Promise.resolve(a({satoshi:e.satoshi,currency:t})).then(function(e){return e.toLocaleString("en",{style:"currency",currency:t})})}};export{s as boostagrams,r as fetchWithLsat,u as fiat,n as lsat,o as sendBoostagram};
//# sourceMappingURL=index.module.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("cross-fetch")):"function"==typeof define&&define.amd?define(["exports","cross-fetch"],t):t((e||self).albyTools={},e.crossFetch)}(this,function(e,t){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/r(t),o=/*#__PURE__*/function(){function e(e){this.storage=e||{}}var t=e.prototype;return t.getItem=function(e){return this.storage[e]},t.setItem=function(e,t){this.storage[e]=t},e}();e.fetchWithLsat=function(e,t,r){try{var i,s=function(r){return i?r:(t.headers["Accept-Authenticate"]="LSAT",Promise.resolve(n.default(e,t)).then(function(r){var o=r.headers.get("www-authenticate");if(!o)return r;var i=o.split(","),s=i[0].replace("LSAT macaroon=","").trimStart(),c=i[1].replace("invoice=","").trimStart();return Promise.resolve(a.enable()).then(function(){return Promise.resolve(a.sendPayment(c)).then(function(r){return u.setItem(e,JSON.stringify({mac:s,preimage:r.preimage})),t.headers.Authorization="LSAT "+s+":"+r.preimage,Promise.resolve(n.default(e,t))})})}))};r||(r={});var a=r.webln||"undefined"!=typeof window&&window.webln;if(!a)throw new Error("WebLN is missing");var u=r.store||new o;t||(t={}),t.cache="no-store",t.mode="cors",t.headers||(t.headers={});var c=u.getItem(e),f=function(){if(c){var r=JSON.parse(c);return t.headers.Authorization="LSAT "+r.mac+":"+r.preimage,Promise.resolve(n.default(e,t)).then(function(e){return i=1,e})}}();return Promise.resolve(f&&f.then?f.then(s):s(f))}catch(e){return Promise.reject(e)}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("cross-fetch")):"function"==typeof define&&define.amd?define(["exports","cross-fetch"],t):t((e||self).albyTools={},e.crossFetch)}(this,function(e,t){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/r(t),o=/*#__PURE__*/function(){function e(e){this.storage=e||{}}var t=e.prototype;return t.getItem=function(e){return this.storage[e]},t.setItem=function(e,t){this.storage[e]=t},e}(),i=function(e,t,r){try{var i,s=function(r){return i?r:(t.headers["Accept-Authenticate"]="LSAT",Promise.resolve(n.default(e,t)).then(function(r){var o=r.headers.get("www-authenticate");if(!o)return r;var i=o.split(","),s=i[0].replace("LSAT macaroon=","").trim(),c=i[1].replace("invoice=","").trim();return Promise.resolve(a.enable()).then(function(){return Promise.resolve(a.sendPayment(c)).then(function(r){return u.setItem(e,JSON.stringify({mac:s,preimage:r.preimage})),t.headers.Authorization="LSAT "+s+":"+r.preimage,Promise.resolve(n.default(e,t))})})}))};r||(r={});var a=r.webln||"undefined"!=typeof window&&window.webln;if(!a)throw new Error("WebLN is missing");var u=r.store||new o;t||(t={}),t.cache="no-store",t.mode="cors",t.headers||(t.headers={});var c=u.getItem(e),f=function(){if(c){var r=JSON.parse(c);return t.headers.Authorization="LSAT "+r.mac+":"+r.preimage,Promise.resolve(n.default(e,t)).then(function(e){return i=1,e})}}();return Promise.resolve(f&&f.then?f.then(s):s(f))}catch(e){return Promise.reject(e)}},s={__proto__:null,fetchWithLsat:i,default:i},a=function(e,t){try{var r=e.boost,n=e.amount;t||(t={});var o=t.webln||"undefined"!=typeof window&&window.webln;n||(n=Math.floor(r.value_msat/1e3));var i={destination:e.destination,amount:n,customRecords:{7629169:JSON.stringify(r)}};return e.customKey&&e.customValue&&(i.customRecords[e.customKey]=e.customValue),Promise.resolve(o.enable()).then(function(){return Promise.resolve(o.keysend(i))})}catch(e){return Promise.reject(e)}},u=function(e){try{return Promise.resolve(n.default("https://getalby.com/api/rates/"+e.toLowerCase()+".json")).then(function(e){return Promise.resolve(e.json()).then(function(e){return e.rate_float/1e8})})}catch(e){return Promise.reject(e)}},c=function(e){var t=e.satoshi;return Promise.resolve(u(e.currency)).then(function(e){return Number(t)*e})},f={__proto__:null,getFiatBtcRate:u,getFiatValue:c,getSatoshiValue:function(e){var t=e.amount;return Promise.resolve(u(e.currency)).then(function(e){return Math.floor(Number(t)/e)})},getFormattedFiatValue:function(e){var t=e.currency;return Promise.resolve(c({satoshi:e.satoshi,currency:t})).then(function(e){return e.toLocaleString("en",{style:"currency",currency:t})})}};e.boostagrams={__proto__:null,boost:a,default:a},e.fetchWithLsat=i,e.fiat=f,e.lsat=s,e.sendBoostagram=a});
//# sourceMappingURL=index.umd.js.map

@@ -0,3 +1,3 @@

export function fetchWithLsat(url: any, fetchArgs: any, options: any): Promise<Response>;
export default fetchWithLsat;
declare function fetchWithLsat(url: any, fetchArgs: any, options: any): Promise<Response>;
//# sourceMappingURL=fetch.d.ts.map
{
"name": "alby-tools",
"version": "1.0.0",
"description": "Collection of helpful building blocks and tools to build Bitcoin Lighting web apps",
"version": "1.1.0",
"description": "Collection of helpful building blocks and tools to develop Bitcoin Lightning web apps",
"type": "module",

@@ -6,0 +6,0 @@ "source": "src/index.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc