alby-tools
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -1,2 +0,2 @@ | ||
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}; | ||
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="https://getalby.com/api/rates/"+e.toLowerCase()+".json",o=await t(a);return(await o.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 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}; | ||
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{var r="https://getalby.com/api/rates/"+t.toLowerCase()+".json";return Promise.resolve(e(r)).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}(),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}); | ||
!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{var t="https://getalby.com/api/rates/"+e.toLowerCase()+".json";return Promise.resolve(n.default(t)).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 |
{ | ||
"name": "alby-tools", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Collection of helpful building blocks and tools to develop Bitcoin Lightning web apps", | ||
@@ -5,0 +5,0 @@ "type": "module", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43935