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

@stacks/connect

Package Overview
Dependencies
Maintainers
6
Versions
703
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacks/connect - npm Package Compare versions

Comparing version 2.12.11-alpha.176008c.0 to 2.12.11-alpha.5046c96.0

7

dist/connect.cjs.development.js

@@ -132,8 +132,3 @@ 'use strict';

if (lastPong) {
console.log(new Date().getTime() - lastPong);
}
if (lastPong && new Date().getTime() - lastPong > pingInterval * 8) {
console.log('No pong in over 2 seconds. REMOVE ME BEFORE MERGE');
onCancel && onCancel();

@@ -175,3 +170,3 @@ clearInterval(interval);

var version = "2.12.11-alpha.176008c.0";
var version = "2.12.11-alpha.5046c96.0";

@@ -178,0 +173,0 @@ var defaultAuthURL = 'https://app.blockstack.org';

2

dist/connect.cjs.production.min.js

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

"use strict";var e=require("blockstack"),n=require("jsontokens"),t=require("@blockstack/stacks-transactions"),r=require("@stacks/connect-ui");function o(){return(o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function i(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}var s=function(e){var n=e.url,t=e.title,r=void 0===t?"Continue with Secret Key":t,o=e.w,i=void 0===o?442:o,s=e.h,a=void 0===s?532:s,c=e.skipPopupFallback,u=window,p=void 0!==u.safari,l=u.innerWidth,d=u.innerHeight,h=u.outerHeight-u.innerHeight,f=u.outerWidth-u.innerWidth,v=u.screenX-(u.screen.width-u.screen.availWidth),g={scrollbars:"no",width:i,height:a,top:function(e){return e-(u.screen.height-u.screen.availHeight)}(u.screenY)+h+(d-a)/2+(p?48:0),left:v+f+(l-i)/2},m=Object.keys(g).map((function(e){return e+"="+g[e]})),y=window.open(n,r,m.join(","));return y?(y.focus(),y):c?y:window.open(n)},a=function(e){var n=e.popup,t=e.messageParams,r=e.onFinish,i=e.onCancel,s=e.authURL,a=null,c=setInterval((function(){if(n)try{n.postMessage(o({method:"ping"},t),s.origin)}catch(e){console.warn("[Blockstack] Unable to send ping to authentication service"),clearInterval(c)}else console.warn("[Blockstack] Unable to send ping to authentication service - popup closed");a&&console.log((new Date).getTime()-a),a&&(new Date).getTime()-a>2e3&&(console.log("No pong in over 2 seconds. REMOVE ME BEFORE MERGE"),i&&i(),clearInterval(c))}),250),u=function(e){!function(e){try{if("pong"===e.data.method)return a=(new Date).getTime(),Promise.resolve();var n=function(){if("blockstack-app"===e.data.source)return Promise.resolve(r(e.data)).then((function(){window.focus(),window.removeEventListener("message",u),clearInterval(c)}))}();Promise.resolve(n&&n.then?n.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}(e)};window.addEventListener("message",u,!1)},c="2.12.11-alpha.176008c.0";"undefined"!=typeof window&&(window.__CONNECT_VERSION__=c);var u,p,l=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},d=function(){return!l()},h=function(n){if(!n){var t=new e.AppConfig(["store_write"],document.location.href);n=new e.UserSession({appConfig:t})}return n},f=function(e){var n=e.redirectTo,t=void 0===n?"/":n,r=e.manifestPath,o=e.finished,i=e.onFinish,a=e.onCancel,u=e.authOrigin,p=e.sendToSignIn,l=void 0!==p&&p,f=e.userSession,g=e.appDetails;try{var m,y=h(f);y.isUserSignedIn()&&y.signUserOut();var w=y.generateAndStoreTransitKey(),k=y.makeAuthRequest(w,""+document.location.origin+t,""+document.location.origin+r,y.appConfig.scopes,void 0,void 0,{sendToSignIn:l,appDetails:g,connectVersion:c}),P=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),C=new URLSearchParams;P.forEach((function(e){return C.set(e[0],e[1])})),C.set("authRequest",k);var S=l?"sign-in":"sign-up";return Promise.resolve(null===(m=window.BlockstackProvider)||void 0===m?void 0:m.getURL()).then((function(e){var n=new URL(e||u||"https://app.blockstack.org"),t=n.origin+"/index.html#/"+S+"?"+C.toString();if(d()){var r=s({url:t,skipPopupFallback:!!window.BlockstackProvider});v({popup:r,authRequest:k,onFinish:i||o,authURL:n,userSession:y,onCancel:a})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},v=function(e){var n=e.authRequest,t=e.onFinish,r=e.userSession;a({popup:e.popup,onCancel:e.onCancel,onFinish:function(e){try{var o=function(){if(e.authRequest===n){var o=function(){if(t){var n=e.authResponse;return Promise.resolve(r.handlePendingSignIn(n)).then((function(){t({authResponse:n,userSession:r})}))}}();if(o&&o.then)return o.then((function(){}))}}();return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},messageParams:{authRequest:n},authURL:e.authURL})};(u=exports.TransactionTypes||(exports.TransactionTypes={})).ContractCall="contract_call",u.ContractDeploy="smart_contract",u.STXTransfer="token_transfer",(p=exports.ContractCallArgumentType||(exports.ContractCallArgumentType={})).BUFFER="buffer",p.UINT="uint",p.INT="int",p.PRINCIPAL="principal",p.BOOL="bool";var g=function(e,n){try{return Promise.resolve(n(e)).then((function(n){return w({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},m=function(t){var r=t;if(!r){var o=new e.AppConfig(["store_write"],document.location.href);r=new e.UserSession({appConfig:o})}var i=r.loadUserData().appPrivateKey;return{privateKey:i,publicKey:n.SECP256K1Client.derivePublicKey(i)}},y=function(e,t){try{var r=new n.TokenSigner("ES256k",t);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},w=function(e){var n=e.token,t=e.opts;try{var r;return Promise.resolve(null===(r=window.BlockstackProvider)||void 0===r?void 0:r.getURL()).then((function(e){var r=new URL(e||t.authOrigin||"https://app.blockstack.org"),o=new URLSearchParams;o.set("request",n);var i=s({url:r.origin+"/#/transaction?"+o.toString(),h:700});return a({popup:i,authURL:r,onFinish:function(e){t.finished&&t.finished(e)},messageParams:{}}),i}))}catch(e){return Promise.reject(e)}},k=function(e){try{var n=e.functionArgs,r=e.appDetails,s=e.userSession,a=i(e,["functionArgs","appDetails","userSession"]),c=m(s),u=c.privateKey,p=c.publicKey,l=o({},a,{functionArgs:n.map((function(e){return"string"==typeof e?e:t.serializeCV(e).toString("hex")})),txType:exports.TransactionTypes.ContractCall,publicKey:p});return r&&(l.appDetails=r),y(l,u)}catch(e){return Promise.reject(e)}},P=function(e){try{var n=e.appDetails,t=e.userSession,r=i(e,["appDetails","userSession"]),s=m(t),a=s.privateKey,c=o({},r,{publicKey:s.publicKey,txType:exports.TransactionTypes.ContractDeploy});return n&&(c.appDetails=n),y(c,a)}catch(e){return Promise.reject(e)}},C=function(e){try{var n=e.amount,t=e.appDetails,r=e.userSession,s=i(e,["amount","appDetails","userSession"]),a=m(r),c=a.privateKey,u=a.publicKey,p=o({},s,{amount:n.toString(10),publicKey:u,txType:exports.TransactionTypes.STXTransfer});return t&&(p.appDetails=t),y(p,c)}catch(e){return Promise.reject(e)}},S=function(e){r.defineCustomElements();var n=document.createElement("connect-modal");n.authOptions=e,document.body.appendChild(n);var t=function(t){n.remove();var r=e.onFinish||e.finished;r&&r(t)};n.addEventListener("onSignUp",(function(){f(o({},e,{sendToSignIn:!1,onFinish:t}))})),n.addEventListener("onSignIn",(function(){f(o({},e,{sendToSignIn:!0,onFinish:t}))}));var i=function e(t){"Escape"===t.key&&(document.removeEventListener("keydown",e),n.remove())};n.addEventListener("onCloseModal",(function(){document.removeEventListener("keydown",i),n.remove()})),document.addEventListener("keydown",i)};exports.authenticate=f,exports.defaultAuthURL="https://app.blockstack.org",exports.getOrCreateUserSession=h,exports.getUserData=function(e){try{return(e=h(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},exports.isMobile=l,exports.makeContractCallToken=k,exports.makeContractDeployToken=P,exports.makeSTXTransferToken=C,exports.openContractCall=function(e){return g(e,k)},exports.openContractDeploy=function(e){return g(e,P)},exports.openSTXTransfer=function(e){return g(e,C)},exports.popupCenter=s,exports.setupListener=a,exports.shouldUsePopup=d,exports.showBlockstackConnect=function(e){return S(e)},exports.showConnect=S;
"use strict";var e=require("blockstack"),n=require("jsontokens"),t=require("@blockstack/stacks-transactions"),r=require("@stacks/connect-ui");function o(){return(o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function i(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}var s=function(e){var n=e.url,t=e.title,r=void 0===t?"Continue with Secret Key":t,o=e.w,i=void 0===o?442:o,s=e.h,a=void 0===s?532:s,c=e.skipPopupFallback,u=window,p=void 0!==u.safari,l=u.innerWidth,d=u.innerHeight,h=u.outerHeight-u.innerHeight,f=u.outerWidth-u.innerWidth,v=u.screenX-(u.screen.width-u.screen.availWidth),g={scrollbars:"no",width:i,height:a,top:function(e){return e-(u.screen.height-u.screen.availHeight)}(u.screenY)+h+(d-a)/2+(p?48:0),left:v+f+(l-i)/2},m=Object.keys(g).map((function(e){return e+"="+g[e]})),y=window.open(n,r,m.join(","));return y?(y.focus(),y):c?y:window.open(n)},a=function(e){var n=e.popup,t=e.messageParams,r=e.onFinish,i=e.onCancel,s=e.authURL,a=null,c=setInterval((function(){if(n)try{n.postMessage(o({method:"ping"},t),s.origin)}catch(e){console.warn("[Blockstack] Unable to send ping to authentication service"),clearInterval(c)}else console.warn("[Blockstack] Unable to send ping to authentication service - popup closed");a&&(new Date).getTime()-a>2e3&&(i&&i(),clearInterval(c))}),250),u=function(e){!function(e){try{if("pong"===e.data.method)return a=(new Date).getTime(),Promise.resolve();var n=function(){if("blockstack-app"===e.data.source)return Promise.resolve(r(e.data)).then((function(){window.focus(),window.removeEventListener("message",u),clearInterval(c)}))}();Promise.resolve(n&&n.then?n.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}(e)};window.addEventListener("message",u,!1)},c="2.12.11-alpha.5046c96.0";"undefined"!=typeof window&&(window.__CONNECT_VERSION__=c);var u,p,l=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},d=function(){return!l()},h=function(n){if(!n){var t=new e.AppConfig(["store_write"],document.location.href);n=new e.UserSession({appConfig:t})}return n},f=function(e){var n=e.redirectTo,t=void 0===n?"/":n,r=e.manifestPath,o=e.finished,i=e.onFinish,a=e.onCancel,u=e.authOrigin,p=e.sendToSignIn,l=void 0!==p&&p,f=e.userSession,g=e.appDetails;try{var m,y=h(f);y.isUserSignedIn()&&y.signUserOut();var w=y.generateAndStoreTransitKey(),k=y.makeAuthRequest(w,""+document.location.origin+t,""+document.location.origin+r,y.appConfig.scopes,void 0,void 0,{sendToSignIn:l,appDetails:g,connectVersion:c}),P=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),C=new URLSearchParams;P.forEach((function(e){return C.set(e[0],e[1])})),C.set("authRequest",k);var S=l?"sign-in":"sign-up";return Promise.resolve(null===(m=window.BlockstackProvider)||void 0===m?void 0:m.getURL()).then((function(e){var n=new URL(e||u||"https://app.blockstack.org"),t=n.origin+"/index.html#/"+S+"?"+C.toString();if(d()){var r=s({url:t,skipPopupFallback:!!window.BlockstackProvider});v({popup:r,authRequest:k,onFinish:i||o,authURL:n,userSession:y,onCancel:a})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},v=function(e){var n=e.authRequest,t=e.onFinish,r=e.userSession;a({popup:e.popup,onCancel:e.onCancel,onFinish:function(e){try{var o=function(){if(e.authRequest===n){var o=function(){if(t){var n=e.authResponse;return Promise.resolve(r.handlePendingSignIn(n)).then((function(){t({authResponse:n,userSession:r})}))}}();if(o&&o.then)return o.then((function(){}))}}();return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},messageParams:{authRequest:n},authURL:e.authURL})};(u=exports.TransactionTypes||(exports.TransactionTypes={})).ContractCall="contract_call",u.ContractDeploy="smart_contract",u.STXTransfer="token_transfer",(p=exports.ContractCallArgumentType||(exports.ContractCallArgumentType={})).BUFFER="buffer",p.UINT="uint",p.INT="int",p.PRINCIPAL="principal",p.BOOL="bool";var g=function(e,n){try{return Promise.resolve(n(e)).then((function(n){return w({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},m=function(t){var r=t;if(!r){var o=new e.AppConfig(["store_write"],document.location.href);r=new e.UserSession({appConfig:o})}var i=r.loadUserData().appPrivateKey;return{privateKey:i,publicKey:n.SECP256K1Client.derivePublicKey(i)}},y=function(e,t){try{var r=new n.TokenSigner("ES256k",t);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},w=function(e){var n=e.token,t=e.opts;try{var r;return Promise.resolve(null===(r=window.BlockstackProvider)||void 0===r?void 0:r.getURL()).then((function(e){var r=new URL(e||t.authOrigin||"https://app.blockstack.org"),o=new URLSearchParams;o.set("request",n);var i=s({url:r.origin+"/#/transaction?"+o.toString(),h:700});return a({popup:i,authURL:r,onFinish:function(e){t.finished&&t.finished(e)},messageParams:{}}),i}))}catch(e){return Promise.reject(e)}},k=function(e){try{var n=e.functionArgs,r=e.appDetails,s=e.userSession,a=i(e,["functionArgs","appDetails","userSession"]),c=m(s),u=c.privateKey,p=c.publicKey,l=o({},a,{functionArgs:n.map((function(e){return"string"==typeof e?e:t.serializeCV(e).toString("hex")})),txType:exports.TransactionTypes.ContractCall,publicKey:p});return r&&(l.appDetails=r),y(l,u)}catch(e){return Promise.reject(e)}},P=function(e){try{var n=e.appDetails,t=e.userSession,r=i(e,["appDetails","userSession"]),s=m(t),a=s.privateKey,c=o({},r,{publicKey:s.publicKey,txType:exports.TransactionTypes.ContractDeploy});return n&&(c.appDetails=n),y(c,a)}catch(e){return Promise.reject(e)}},C=function(e){try{var n=e.amount,t=e.appDetails,r=e.userSession,s=i(e,["amount","appDetails","userSession"]),a=m(r),c=a.privateKey,u=a.publicKey,p=o({},s,{amount:n.toString(10),publicKey:u,txType:exports.TransactionTypes.STXTransfer});return t&&(p.appDetails=t),y(p,c)}catch(e){return Promise.reject(e)}},S=function(e){r.defineCustomElements();var n=document.createElement("connect-modal");n.authOptions=e,document.body.appendChild(n);var t=function(t){n.remove();var r=e.onFinish||e.finished;r&&r(t)};n.addEventListener("onSignUp",(function(){f(o({},e,{sendToSignIn:!1,onFinish:t}))})),n.addEventListener("onSignIn",(function(){f(o({},e,{sendToSignIn:!0,onFinish:t}))}));var i=function e(t){"Escape"===t.key&&(document.removeEventListener("keydown",e),n.remove())};n.addEventListener("onCloseModal",(function(){document.removeEventListener("keydown",i),n.remove()})),document.addEventListener("keydown",i)};exports.authenticate=f,exports.defaultAuthURL="https://app.blockstack.org",exports.getOrCreateUserSession=h,exports.getUserData=function(e){try{return(e=h(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},exports.isMobile=l,exports.makeContractCallToken=k,exports.makeContractDeployToken=P,exports.makeSTXTransferToken=C,exports.openContractCall=function(e){return g(e,k)},exports.openContractDeploy=function(e){return g(e,P)},exports.openSTXTransfer=function(e){return g(e,C)},exports.popupCenter=s,exports.setupListener=a,exports.shouldUsePopup=d,exports.showBlockstackConnect=function(e){return S(e)},exports.showConnect=S;
//# sourceMappingURL=connect.cjs.production.min.js.map

@@ -130,8 +130,3 @@ import { AppConfig, UserSession } from 'blockstack';

if (lastPong) {
console.log(new Date().getTime() - lastPong);
}
if (lastPong && new Date().getTime() - lastPong > pingInterval * 8) {
console.log('No pong in over 2 seconds. REMOVE ME BEFORE MERGE');
onCancel && onCancel();

@@ -173,3 +168,3 @@ clearInterval(interval);

var version = "2.12.11-alpha.176008c.0";
var version = "2.12.11-alpha.5046c96.0";

@@ -176,0 +171,0 @@ var defaultAuthURL = 'https://app.blockstack.org';

@@ -131,8 +131,3 @@ (function (global, factory) {

if (lastPong) {
console.log(new Date().getTime() - lastPong);
}
if (lastPong && new Date().getTime() - lastPong > pingInterval * 8) {
console.log('No pong in over 2 seconds. REMOVE ME BEFORE MERGE');
onCancel && onCancel();

@@ -174,3 +169,3 @@ clearInterval(interval);

var version = "2.12.11-alpha.176008c.0";
var version = "2.12.11-alpha.5046c96.0";

@@ -177,0 +172,0 @@ var defaultAuthURL = 'https://app.blockstack.org';

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("blockstack"),require("jsontokens"),require("@blockstack/stacks-transactions"),require("@stacks/connect-ui")):"function"==typeof define&&define.amd?define(["exports","blockstack","jsontokens","@blockstack/stacks-transactions","@stacks/connect-ui"],n):n((e=e||self)["@stacks/connect"]={},e.blockstack,e.jsontokens,e.stacksTransactions,e.connectUi)}(this,(function(e,n,t,r,o){"use strict";function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function s(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}var a=function(e){var n=e.url,t=e.title,r=void 0===t?"Continue with Secret Key":t,o=e.w,i=void 0===o?442:o,s=e.h,a=void 0===s?532:s,c=e.skipPopupFallback,u=window,l=void 0!==u.safari,p=u.innerWidth,d=u.innerHeight,f=u.outerHeight-u.innerHeight,h=u.outerWidth-u.innerWidth,v=u.screenX-(u.screen.width-u.screen.availWidth),g={scrollbars:"no",width:i,height:a,top:function(e){return e-(u.screen.height-u.screen.availHeight)}(u.screenY)+f+(d-a)/2+(l?48:0),left:v+h+(p-i)/2},m=Object.keys(g).map((function(e){return e+"="+g[e]})),k=window.open(n,r,m.join(","));return k?(k.focus(),k):c?k:window.open(n)},c=function(e){var n=e.popup,t=e.messageParams,r=e.onFinish,o=e.onCancel,s=e.authURL,a=null,c=setInterval((function(){if(n)try{n.postMessage(i({method:"ping"},t),s.origin)}catch(e){console.warn("[Blockstack] Unable to send ping to authentication service"),clearInterval(c)}else console.warn("[Blockstack] Unable to send ping to authentication service - popup closed");a&&console.log((new Date).getTime()-a),a&&(new Date).getTime()-a>2e3&&(console.log("No pong in over 2 seconds. REMOVE ME BEFORE MERGE"),o&&o(),clearInterval(c))}),250),u=function(e){!function(e){try{if("pong"===e.data.method)return a=(new Date).getTime(),Promise.resolve();var n=function(){if("blockstack-app"===e.data.source)return Promise.resolve(r(e.data)).then((function(){window.focus(),window.removeEventListener("message",u),clearInterval(c)}))}();Promise.resolve(n&&n.then?n.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}(e)};window.addEventListener("message",u,!1)},u="2.12.11-alpha.176008c.0";"undefined"!=typeof window&&(window.__CONNECT_VERSION__=u);var l,p,d=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},f=function(){return!d()},h=function(e){if(!e){var t=new n.AppConfig(["store_write"],document.location.href);e=new n.UserSession({appConfig:t})}return e},v=function(e){var n=e.redirectTo,t=void 0===n?"/":n,r=e.manifestPath,o=e.finished,i=e.onFinish,s=e.onCancel,c=e.authOrigin,l=e.sendToSignIn,p=void 0!==l&&l,d=e.userSession,v=e.appDetails;try{var m,k=h(d);k.isUserSignedIn()&&k.signUserOut();var y=k.generateAndStoreTransitKey(),w=k.makeAuthRequest(y,""+document.location.origin+t,""+document.location.origin+r,k.appConfig.scopes,void 0,void 0,{sendToSignIn:p,appDetails:v,connectVersion:u}),P=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),C=new URLSearchParams;P.forEach((function(e){return C.set(e[0],e[1])})),C.set("authRequest",w);var S=p?"sign-in":"sign-up";return Promise.resolve(null===(m=window.BlockstackProvider)||void 0===m?void 0:m.getURL()).then((function(e){var n=new URL(e||c||"https://app.blockstack.org"),t=n.origin+"/index.html#/"+S+"?"+C.toString();if(f()){var r=a({url:t,skipPopupFallback:!!window.BlockstackProvider});g({popup:r,authRequest:w,onFinish:i||o,authURL:n,userSession:k,onCancel:s})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},g=function(e){var n=e.authRequest,t=e.onFinish,r=e.userSession;c({popup:e.popup,onCancel:e.onCancel,onFinish:function(e){try{var o=function(){if(e.authRequest===n){var o=function(){if(t){var n=e.authResponse;return Promise.resolve(r.handlePendingSignIn(n)).then((function(){t({authResponse:n,userSession:r})}))}}();if(o&&o.then)return o.then((function(){}))}}();return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},messageParams:{authRequest:n},authURL:e.authURL})};(l=e.TransactionTypes||(e.TransactionTypes={})).ContractCall="contract_call",l.ContractDeploy="smart_contract",l.STXTransfer="token_transfer",(p=e.ContractCallArgumentType||(e.ContractCallArgumentType={})).BUFFER="buffer",p.UINT="uint",p.INT="int",p.PRINCIPAL="principal",p.BOOL="bool";var m=function(e,n){try{return Promise.resolve(n(e)).then((function(n){return w({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},k=function(e){var r=e;if(!r){var o=new n.AppConfig(["store_write"],document.location.href);r=new n.UserSession({appConfig:o})}var i=r.loadUserData().appPrivateKey;return{privateKey:i,publicKey:t.SECP256K1Client.derivePublicKey(i)}},y=function(e,n){try{var r=new t.TokenSigner("ES256k",n);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},w=function(e){var n=e.token,t=e.opts;try{var r;return Promise.resolve(null===(r=window.BlockstackProvider)||void 0===r?void 0:r.getURL()).then((function(e){var r=new URL(e||t.authOrigin||"https://app.blockstack.org"),o=new URLSearchParams;o.set("request",n);var i=a({url:r.origin+"/#/transaction?"+o.toString(),h:700});return c({popup:i,authURL:r,onFinish:function(e){t.finished&&t.finished(e)},messageParams:{}}),i}))}catch(e){return Promise.reject(e)}},P=function(n){try{var t=n.functionArgs,o=n.appDetails,a=n.userSession,c=s(n,["functionArgs","appDetails","userSession"]),u=k(a),l=u.privateKey,p=u.publicKey,d=i({},c,{functionArgs:t.map((function(e){return"string"==typeof e?e:r.serializeCV(e).toString("hex")})),txType:e.TransactionTypes.ContractCall,publicKey:p});return o&&(d.appDetails=o),y(d,l)}catch(e){return Promise.reject(e)}},C=function(n){try{var t=n.appDetails,r=n.userSession,o=s(n,["appDetails","userSession"]),a=k(r),c=a.privateKey,u=i({},o,{publicKey:a.publicKey,txType:e.TransactionTypes.ContractDeploy});return t&&(u.appDetails=t),y(u,c)}catch(e){return Promise.reject(e)}},S=function(n){try{var t=n.amount,r=n.appDetails,o=n.userSession,a=s(n,["amount","appDetails","userSession"]),c=k(o),u=c.privateKey,l=c.publicKey,p=i({},a,{amount:t.toString(10),publicKey:l,txType:e.TransactionTypes.STXTransfer});return r&&(p.appDetails=r),y(p,u)}catch(e){return Promise.reject(e)}},T=function(e){o.defineCustomElements();var n=document.createElement("connect-modal");n.authOptions=e,document.body.appendChild(n);var t=function(t){n.remove();var r=e.onFinish||e.finished;r&&r(t)};n.addEventListener("onSignUp",(function(){v(i({},e,{sendToSignIn:!1,onFinish:t}))})),n.addEventListener("onSignIn",(function(){v(i({},e,{sendToSignIn:!0,onFinish:t}))}));var r=function e(t){"Escape"===t.key&&(document.removeEventListener("keydown",e),n.remove())};n.addEventListener("onCloseModal",(function(){document.removeEventListener("keydown",r),n.remove()})),document.addEventListener("keydown",r)};e.authenticate=v,e.defaultAuthURL="https://app.blockstack.org",e.getOrCreateUserSession=h,e.getUserData=function(e){try{return(e=h(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},e.isMobile=d,e.makeContractCallToken=P,e.makeContractDeployToken=C,e.makeSTXTransferToken=S,e.openContractCall=function(e){return m(e,P)},e.openContractDeploy=function(e){return m(e,C)},e.openSTXTransfer=function(e){return m(e,S)},e.popupCenter=a,e.setupListener=c,e.shouldUsePopup=f,e.showBlockstackConnect=function(e){return T(e)},e.showConnect=T}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("blockstack"),require("jsontokens"),require("@blockstack/stacks-transactions"),require("@stacks/connect-ui")):"function"==typeof define&&define.amd?define(["exports","blockstack","jsontokens","@blockstack/stacks-transactions","@stacks/connect-ui"],n):n((e=e||self)["@stacks/connect"]={},e.blockstack,e.jsontokens,e.stacksTransactions,e.connectUi)}(this,(function(e,n,t,r,o){"use strict";function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function s(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}var a=function(e){var n=e.url,t=e.title,r=void 0===t?"Continue with Secret Key":t,o=e.w,i=void 0===o?442:o,s=e.h,a=void 0===s?532:s,c=e.skipPopupFallback,u=window,p=void 0!==u.safari,l=u.innerWidth,d=u.innerHeight,f=u.outerHeight-u.innerHeight,h=u.outerWidth-u.innerWidth,v=u.screenX-(u.screen.width-u.screen.availWidth),m={scrollbars:"no",width:i,height:a,top:function(e){return e-(u.screen.height-u.screen.availHeight)}(u.screenY)+f+(d-a)/2+(p?48:0),left:v+h+(l-i)/2},g=Object.keys(m).map((function(e){return e+"="+m[e]})),k=window.open(n,r,g.join(","));return k?(k.focus(),k):c?k:window.open(n)},c=function(e){var n=e.popup,t=e.messageParams,r=e.onFinish,o=e.onCancel,s=e.authURL,a=null,c=setInterval((function(){if(n)try{n.postMessage(i({method:"ping"},t),s.origin)}catch(e){console.warn("[Blockstack] Unable to send ping to authentication service"),clearInterval(c)}else console.warn("[Blockstack] Unable to send ping to authentication service - popup closed");a&&(new Date).getTime()-a>2e3&&(o&&o(),clearInterval(c))}),250),u=function(e){!function(e){try{if("pong"===e.data.method)return a=(new Date).getTime(),Promise.resolve();var n=function(){if("blockstack-app"===e.data.source)return Promise.resolve(r(e.data)).then((function(){window.focus(),window.removeEventListener("message",u),clearInterval(c)}))}();Promise.resolve(n&&n.then?n.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}(e)};window.addEventListener("message",u,!1)},u="2.12.11-alpha.5046c96.0";"undefined"!=typeof window&&(window.__CONNECT_VERSION__=u);var p,l,d=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},f=function(){return!d()},h=function(e){if(!e){var t=new n.AppConfig(["store_write"],document.location.href);e=new n.UserSession({appConfig:t})}return e},v=function(e){var n=e.redirectTo,t=void 0===n?"/":n,r=e.manifestPath,o=e.finished,i=e.onFinish,s=e.onCancel,c=e.authOrigin,p=e.sendToSignIn,l=void 0!==p&&p,d=e.userSession,v=e.appDetails;try{var g,k=h(d);k.isUserSignedIn()&&k.signUserOut();var y=k.generateAndStoreTransitKey(),w=k.makeAuthRequest(y,""+document.location.origin+t,""+document.location.origin+r,k.appConfig.scopes,void 0,void 0,{sendToSignIn:l,appDetails:v,connectVersion:u}),P=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),C=new URLSearchParams;P.forEach((function(e){return C.set(e[0],e[1])})),C.set("authRequest",w);var S=l?"sign-in":"sign-up";return Promise.resolve(null===(g=window.BlockstackProvider)||void 0===g?void 0:g.getURL()).then((function(e){var n=new URL(e||c||"https://app.blockstack.org"),t=n.origin+"/index.html#/"+S+"?"+C.toString();if(f()){var r=a({url:t,skipPopupFallback:!!window.BlockstackProvider});m({popup:r,authRequest:w,onFinish:i||o,authURL:n,userSession:k,onCancel:s})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},m=function(e){var n=e.authRequest,t=e.onFinish,r=e.userSession;c({popup:e.popup,onCancel:e.onCancel,onFinish:function(e){try{var o=function(){if(e.authRequest===n){var o=function(){if(t){var n=e.authResponse;return Promise.resolve(r.handlePendingSignIn(n)).then((function(){t({authResponse:n,userSession:r})}))}}();if(o&&o.then)return o.then((function(){}))}}();return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},messageParams:{authRequest:n},authURL:e.authURL})};(p=e.TransactionTypes||(e.TransactionTypes={})).ContractCall="contract_call",p.ContractDeploy="smart_contract",p.STXTransfer="token_transfer",(l=e.ContractCallArgumentType||(e.ContractCallArgumentType={})).BUFFER="buffer",l.UINT="uint",l.INT="int",l.PRINCIPAL="principal",l.BOOL="bool";var g=function(e,n){try{return Promise.resolve(n(e)).then((function(n){return w({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},k=function(e){var r=e;if(!r){var o=new n.AppConfig(["store_write"],document.location.href);r=new n.UserSession({appConfig:o})}var i=r.loadUserData().appPrivateKey;return{privateKey:i,publicKey:t.SECP256K1Client.derivePublicKey(i)}},y=function(e,n){try{var r=new t.TokenSigner("ES256k",n);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},w=function(e){var n=e.token,t=e.opts;try{var r;return Promise.resolve(null===(r=window.BlockstackProvider)||void 0===r?void 0:r.getURL()).then((function(e){var r=new URL(e||t.authOrigin||"https://app.blockstack.org"),o=new URLSearchParams;o.set("request",n);var i=a({url:r.origin+"/#/transaction?"+o.toString(),h:700});return c({popup:i,authURL:r,onFinish:function(e){t.finished&&t.finished(e)},messageParams:{}}),i}))}catch(e){return Promise.reject(e)}},P=function(n){try{var t=n.functionArgs,o=n.appDetails,a=n.userSession,c=s(n,["functionArgs","appDetails","userSession"]),u=k(a),p=u.privateKey,l=u.publicKey,d=i({},c,{functionArgs:t.map((function(e){return"string"==typeof e?e:r.serializeCV(e).toString("hex")})),txType:e.TransactionTypes.ContractCall,publicKey:l});return o&&(d.appDetails=o),y(d,p)}catch(e){return Promise.reject(e)}},C=function(n){try{var t=n.appDetails,r=n.userSession,o=s(n,["appDetails","userSession"]),a=k(r),c=a.privateKey,u=i({},o,{publicKey:a.publicKey,txType:e.TransactionTypes.ContractDeploy});return t&&(u.appDetails=t),y(u,c)}catch(e){return Promise.reject(e)}},S=function(n){try{var t=n.amount,r=n.appDetails,o=n.userSession,a=s(n,["amount","appDetails","userSession"]),c=k(o),u=c.privateKey,p=c.publicKey,l=i({},a,{amount:t.toString(10),publicKey:p,txType:e.TransactionTypes.STXTransfer});return r&&(l.appDetails=r),y(l,u)}catch(e){return Promise.reject(e)}},T=function(e){o.defineCustomElements();var n=document.createElement("connect-modal");n.authOptions=e,document.body.appendChild(n);var t=function(t){n.remove();var r=e.onFinish||e.finished;r&&r(t)};n.addEventListener("onSignUp",(function(){v(i({},e,{sendToSignIn:!1,onFinish:t}))})),n.addEventListener("onSignIn",(function(){v(i({},e,{sendToSignIn:!0,onFinish:t}))}));var r=function e(t){"Escape"===t.key&&(document.removeEventListener("keydown",e),n.remove())};n.addEventListener("onCloseModal",(function(){document.removeEventListener("keydown",r),n.remove()})),document.addEventListener("keydown",r)};e.authenticate=v,e.defaultAuthURL="https://app.blockstack.org",e.getOrCreateUserSession=h,e.getUserData=function(e){try{return(e=h(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},e.isMobile=d,e.makeContractCallToken=P,e.makeContractDeployToken=C,e.makeSTXTransferToken=S,e.openContractCall=function(e){return g(e,P)},e.openContractDeploy=function(e){return g(e,C)},e.openSTXTransfer=function(e){return g(e,S)},e.popupCenter=a,e.setupListener=c,e.shouldUsePopup=f,e.showBlockstackConnect=function(e){return T(e)},e.showConnect=T}));
//# sourceMappingURL=connect.umd.production.min.js.map
{
"name": "@stacks/connect",
"version": "2.12.11-alpha.176008c.0",
"version": "2.12.11-alpha.5046c96.0",
"scripts": {

@@ -23,3 +23,3 @@ "build": "yarn build:modules && yarn build:standalone",

"@blockstack/stacks-transactions": "0.7.0",
"@stacks/connect-ui": "^2.12.5-alpha.176008c.0",
"@stacks/connect-ui": "^2.12.5-alpha.5046c96.0",
"jsontokens": "^3.0.0"

@@ -41,3 +41,3 @@ },

},
"gitHead": "ffb42a15a0c7b5039f9feb8a1332de42eebb4eca"
"gitHead": "7e3618d18ac9e66e9ed2d1608ac7d1e7f59c3817"
}

Sorry, the diff of this file is too big to display

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