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 4.1.3 to 4.1.4-alpha.afa05fb.0

2

dist/connect.cjs.development.js

@@ -169,3 +169,3 @@ 'use strict';

var version = "4.1.3";
var version = "4.1.4-alpha.afa05fb.0";

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

@@ -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&&(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)};"undefined"!=typeof window&&(window.__CONNECT_VERSION__="4.1.3");var c,u,p=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},l=function(){return!p()},d=function(n){if(!n){var t=new e.AppConfig(["store_write"],document.location.href);n=new e.UserSession({appConfig:t})}return n},h=function(e){var n=e.redirectTo,t=void 0===n?"/":n,r=e.manifestPath,o=e.finished,i=e.onFinish,a=e.onCancel,c=e.authOrigin,u=e.sendToSignIn,p=void 0!==u&&u,h=e.userSession,v=e.appDetails;try{var g,m=d(h);m.isUserSignedIn()&&m.signUserOut();var y=m.generateAndStoreTransitKey(),w=m.makeAuthRequest(y,""+document.location.origin+t,""+document.location.origin+r,m.appConfig.scopes,void 0,void 0,{sendToSignIn:p,appDetails:v,connectVersion:"4.1.3"}),k=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),P=new URLSearchParams;k.forEach((function(e){return P.set(e[0],e[1])})),P.set("authRequest",w);var C=p?"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#/"+C+"?"+P.toString();if(l()){var r=s({url:t,skipPopupFallback:!!window.BlockstackProvider});f({popup:r,authRequest:w,onFinish:i||o,authURL:n,userSession:m,onCancel:a})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},f=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})};(c=exports.TransactionTypes||(exports.TransactionTypes={})).ContractCall="contract_call",c.ContractDeploy="smart_contract",c.STXTransfer="token_transfer",(u=exports.ContractCallArgumentType||(exports.ContractCallArgumentType={})).BUFFER="buffer",u.UINT="uint",u.INT="int",u.PRINCIPAL="principal",u.BOOL="bool";var v=function(e,n){try{return Promise.resolve(n(e)).then((function(n){return y({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},g=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)}},m=function(e,t){try{var r=new n.TokenSigner("ES256k",t);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},y=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)}},w=function(e){try{var n=e.functionArgs,r=e.appDetails,s=e.userSession,a=i(e,["functionArgs","appDetails","userSession"]),c=g(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),m(l,u)}catch(e){return Promise.reject(e)}},k=function(e){try{var n=e.appDetails,t=e.userSession,r=i(e,["appDetails","userSession"]),s=g(t),a=s.privateKey,c=o({},r,{publicKey:s.publicKey,txType:exports.TransactionTypes.ContractDeploy});return n&&(c.appDetails=n),m(c,a)}catch(e){return Promise.reject(e)}},P=function(e){try{var n=e.amount,t=e.appDetails,r=e.userSession,s=i(e,["amount","appDetails","userSession"]),a=g(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),m(p,c)}catch(e){return Promise.reject(e)}},C=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(){h(o({},e,{sendToSignIn:!1,onFinish:t}))})),n.addEventListener("onSignIn",(function(){h(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=h,exports.defaultAuthURL="https://app.blockstack.org",exports.getOrCreateUserSession=d,exports.getUserData=function(e){try{return(e=d(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},exports.isMobile=p,exports.makeContractCallToken=w,exports.makeContractDeployToken=k,exports.makeSTXTransferToken=P,exports.openContractCall=function(e){return v(e,w)},exports.openContractDeploy=function(e){return v(e,k)},exports.openSTXTransfer=function(e){return v(e,P)},exports.popupCenter=s,exports.setupListener=a,exports.shouldUsePopup=l,exports.showBlockstackConnect=function(e){return C(e)},exports.showConnect=C;
"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,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+(p?48:0),left:v+h+(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)};"undefined"!=typeof window&&(window.__CONNECT_VERSION__="4.1.4-alpha.afa05fb.0");var c,u,p=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},l=function(){return!p()},d=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,c=e.authOrigin,u=e.sendToSignIn,p=void 0!==u&&u,f=e.userSession,v=e.appDetails;try{var g,m=d(f);m.isUserSignedIn()&&m.signUserOut();var y=m.generateAndStoreTransitKey(),w=m.makeAuthRequest(y,""+document.location.origin+t,""+document.location.origin+r,m.appConfig.scopes,void 0,void 0,{sendToSignIn:p,appDetails:v,connectVersion:"4.1.4-alpha.afa05fb.0"}),k=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),P=new URLSearchParams;k.forEach((function(e){return P.set(e[0],e[1])})),P.set("authRequest",w);var C=p?"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#/"+C+"?"+P.toString();if(l()){var r=s({url:t,skipPopupFallback:!!window.BlockstackProvider});h({popup:r,authRequest:w,onFinish:i||o,authURL:n,userSession:m,onCancel:a})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},h=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})};(c=exports.TransactionTypes||(exports.TransactionTypes={})).ContractCall="contract_call",c.ContractDeploy="smart_contract",c.STXTransfer="token_transfer",(u=exports.ContractCallArgumentType||(exports.ContractCallArgumentType={})).BUFFER="buffer",u.UINT="uint",u.INT="int",u.PRINCIPAL="principal",u.BOOL="bool";var v=function(e,n){try{return Promise.resolve(n(e)).then((function(n){return y({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},g=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)}},m=function(e,t){try{var r=new n.TokenSigner("ES256k",t);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},y=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)}},w=function(e){try{var n=e.functionArgs,r=e.appDetails,s=e.userSession,a=i(e,["functionArgs","appDetails","userSession"]),c=g(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),m(l,u)}catch(e){return Promise.reject(e)}},k=function(e){try{var n=e.appDetails,t=e.userSession,r=i(e,["appDetails","userSession"]),s=g(t),a=s.privateKey,c=o({},r,{publicKey:s.publicKey,txType:exports.TransactionTypes.ContractDeploy});return n&&(c.appDetails=n),m(c,a)}catch(e){return Promise.reject(e)}},P=function(e){try{var n=e.amount,t=e.appDetails,r=e.userSession,s=i(e,["amount","appDetails","userSession"]),a=g(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),m(p,c)}catch(e){return Promise.reject(e)}},C=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=d,exports.getUserData=function(e){try{return(e=d(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},exports.isMobile=p,exports.makeContractCallToken=w,exports.makeContractDeployToken=k,exports.makeSTXTransferToken=P,exports.openContractCall=function(e){return v(e,w)},exports.openContractDeploy=function(e){return v(e,k)},exports.openSTXTransfer=function(e){return v(e,P)},exports.popupCenter=s,exports.setupListener=a,exports.shouldUsePopup=l,exports.showBlockstackConnect=function(e){return C(e)},exports.showConnect=C;
//# sourceMappingURL=connect.cjs.production.min.js.map

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

var version = "4.1.3";
var version = "4.1.4-alpha.afa05fb.0";

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

@@ -168,3 +168,3 @@ (function (global, factory) {

var version = "4.1.3";
var version = "4.1.4-alpha.afa05fb.0";

@@ -171,0 +171,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,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)};"undefined"!=typeof window&&(window.__CONNECT_VERSION__="4.1.3");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()},f=function(e){if(!e){var t=new n.AppConfig(["store_write"],document.location.href);e=new n.UserSession({appConfig:t})}return e},h=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,u=e.sendToSignIn,p=void 0!==u&&u,l=e.userSession,h=e.appDetails;try{var m,g=f(l);g.isUserSignedIn()&&g.signUserOut();var k=g.generateAndStoreTransitKey(),y=g.makeAuthRequest(k,""+document.location.origin+t,""+document.location.origin+r,g.appConfig.scopes,void 0,void 0,{sendToSignIn:p,appDetails:h,connectVersion:"4.1.3"}),w=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),P=new URLSearchParams;w.forEach((function(e){return P.set(e[0],e[1])})),P.set("authRequest",y);var C=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#/"+C+"?"+P.toString();if(d()){var r=a({url:t,skipPopupFallback:!!window.BlockstackProvider});v({popup:r,authRequest:y,onFinish:i||o,authURL:n,userSession:g,onCancel:s})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},v=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})};(u=e.TransactionTypes||(e.TransactionTypes={})).ContractCall="contract_call",u.ContractDeploy="smart_contract",u.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 y({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},g=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)}},k=function(e,n){try{var r=new t.TokenSigner("ES256k",n);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},y=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)}},w=function(n){try{var t=n.functionArgs,o=n.appDetails,a=n.userSession,c=s(n,["functionArgs","appDetails","userSession"]),u=g(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),k(d,p)}catch(e){return Promise.reject(e)}},P=function(n){try{var t=n.appDetails,r=n.userSession,o=s(n,["appDetails","userSession"]),a=g(r),c=a.privateKey,u=i({},o,{publicKey:a.publicKey,txType:e.TransactionTypes.ContractDeploy});return t&&(u.appDetails=t),k(u,c)}catch(e){return Promise.reject(e)}},C=function(n){try{var t=n.amount,r=n.appDetails,o=n.userSession,a=s(n,["amount","appDetails","userSession"]),c=g(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),k(l,u)}catch(e){return Promise.reject(e)}},S=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(){h(i({},e,{sendToSignIn:!1,onFinish:t}))})),n.addEventListener("onSignIn",(function(){h(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=h,e.defaultAuthURL="https://app.blockstack.org",e.getOrCreateUserSession=f,e.getUserData=function(e){try{return(e=f(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},e.isMobile=l,e.makeContractCallToken=w,e.makeContractDeployToken=P,e.makeSTXTransferToken=C,e.openContractCall=function(e){return m(e,w)},e.openContractDeploy=function(e){return m(e,P)},e.openSTXTransfer=function(e){return m(e,C)},e.popupCenter=a,e.setupListener=c,e.shouldUsePopup=d,e.showBlockstackConnect=function(e){return S(e)},e.showConnect=S}));
!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,f=u.innerHeight,d=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)+d+(f-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)};"undefined"!=typeof window&&(window.__CONNECT_VERSION__="4.1.4-alpha.afa05fb.0");var u,p,l=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},f=function(){return!l()},d=function(e){if(!e){var t=new n.AppConfig(["store_write"],document.location.href);e=new n.UserSession({appConfig:t})}return e},h=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,u=e.sendToSignIn,p=void 0!==u&&u,l=e.userSession,h=e.appDetails;try{var m,g=d(l);g.isUserSignedIn()&&g.signUserOut();var k=g.generateAndStoreTransitKey(),y=g.makeAuthRequest(k,""+document.location.origin+t,""+document.location.origin+r,g.appConfig.scopes,void 0,void 0,{sendToSignIn:p,appDetails:h,connectVersion:"4.1.4-alpha.afa05fb.0"}),w=window.location.search.substr(1).split("&").filter((function(e){return e.startsWith("utm")})).map((function(e){return e.split("=")})),P=new URLSearchParams;w.forEach((function(e){return P.set(e[0],e[1])})),P.set("authRequest",y);var C=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#/"+C+"?"+P.toString();if(f()){var r=a({url:t,skipPopupFallback:!!window.BlockstackProvider});v({popup:r,authRequest:y,onFinish:i||o,authURL:n,userSession:g,onCancel:s})}else document.location.href=t}))}catch(e){return Promise.reject(e)}},v=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})};(u=e.TransactionTypes||(e.TransactionTypes={})).ContractCall="contract_call",u.ContractDeploy="smart_contract",u.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 y({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},g=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)}},k=function(e,n){try{var r=new t.TokenSigner("ES256k",n);return Promise.resolve(r.signAsync(e))}catch(e){return Promise.reject(e)}},y=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)}},w=function(n){try{var t=n.functionArgs,o=n.appDetails,a=n.userSession,c=s(n,["functionArgs","appDetails","userSession"]),u=g(a),p=u.privateKey,l=u.publicKey,f=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&&(f.appDetails=o),k(f,p)}catch(e){return Promise.reject(e)}},P=function(n){try{var t=n.appDetails,r=n.userSession,o=s(n,["appDetails","userSession"]),a=g(r),c=a.privateKey,u=i({},o,{publicKey:a.publicKey,txType:e.TransactionTypes.ContractDeploy});return t&&(u.appDetails=t),k(u,c)}catch(e){return Promise.reject(e)}},C=function(n){try{var t=n.amount,r=n.appDetails,o=n.userSession,a=s(n,["amount","appDetails","userSession"]),c=g(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),k(l,u)}catch(e){return Promise.reject(e)}},S=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(){h(i({},e,{sendToSignIn:!1,onFinish:t}))})),n.addEventListener("onSignIn",(function(){h(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=h,e.defaultAuthURL="https://app.blockstack.org",e.getOrCreateUserSession=d,e.getUserData=function(e){try{return(e=d(e)).isUserSignedIn()?Promise.resolve(e.loadUserData()):e.isSignInPending()?Promise.resolve(e.handlePendingSignIn()):Promise.resolve(null)}catch(e){return Promise.reject(e)}},e.isMobile=l,e.makeContractCallToken=w,e.makeContractDeployToken=P,e.makeSTXTransferToken=C,e.openContractCall=function(e){return m(e,w)},e.openContractDeploy=function(e){return m(e,P)},e.openSTXTransfer=function(e){return m(e,C)},e.popupCenter=a,e.setupListener=c,e.shouldUsePopup=f,e.showBlockstackConnect=function(e){return S(e)},e.showConnect=S}));
//# sourceMappingURL=connect.umd.production.min.js.map
{
"name": "@stacks/connect",
"version": "4.1.3",
"version": "4.1.4-alpha.afa05fb.0",
"scripts": {

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

"@blockstack/stacks-transactions": "0.7.0",
"@stacks/connect-ui": "^2.15.3",
"@stacks/connect-ui": "^2.15.4-alpha.afa05fb.0",
"jsontokens": "^3.0.0"

@@ -39,5 +39,5 @@ },

"peerDependencies": {
"blockstack": "^19"
"blockstack": ">=19"
},
"gitHead": "4716c2cca121ef4cbf3cf0f130758c1bf2e799cc"
"gitHead": "70de089e078697d38b541723de58dbc9168e6946"
}

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

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