@stacks/connect
Advanced tools
Comparing version 2.12.10 to 2.12.11-alpha.873ca52.0
@@ -174,3 +174,3 @@ 'use strict'; | ||
var version = "2.12.10"; | ||
var version = "2.12.11-alpha.873ca52.0"; | ||
@@ -177,0 +177,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&&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)};"undefined"!=typeof window&&(window.__CONNECT_VERSION__="2.12.10");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:"2.12.10"}),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,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.873ca52.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 |
@@ -172,3 +172,3 @@ import { AppConfig, UserSession } from 'blockstack'; | ||
var version = "2.12.10"; | ||
var version = "2.12.11-alpha.873ca52.0"; | ||
@@ -175,0 +175,0 @@ var defaultAuthURL = 'https://app.blockstack.org'; |
@@ -173,3 +173,3 @@ (function (global, factory) { | ||
var version = "2.12.10"; | ||
var version = "2.12.11-alpha.873ca52.0"; | ||
@@ -176,0 +176,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)};"undefined"!=typeof window&&(window.__CONNECT_VERSION__="2.12.10");var u,l,p=function(){var e=navigator.userAgent;return!!/android/i.test(e)||!!/iPad|iPhone|iPod/.test(e)||!!/windows phone/i.test(e)},d=function(){return!p()},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,l=void 0!==u&&u,p=e.userSession,h=e.appDetails;try{var g,m=f(p);m.isUserSignedIn()&&m.signUserOut();var k=m.generateAndStoreTransitKey(),y=m.makeAuthRequest(k,""+document.location.origin+t,""+document.location.origin+r,m.appConfig.scopes,void 0,void 0,{sendToSignIn:l,appDetails:h,connectVersion:"2.12.10"}),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=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#/"+C+"?"+P.toString();if(d()){var r=a({url:t,skipPopupFallback:!!window.BlockstackProvider});v({popup:r,authRequest:y,onFinish:i||o,authURL:n,userSession:m,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",(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 y({token:n,opts:e})}))}catch(e){return Promise.reject(e)}},m=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=m(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),k(d,l)}catch(e){return Promise.reject(e)}},P=function(n){try{var t=n.appDetails,r=n.userSession,o=s(n,["appDetails","userSession"]),a=m(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=m(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),k(p,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=p,e.makeContractCallToken=w,e.makeContractDeployToken=P,e.makeSTXTransferToken=C,e.openContractCall=function(e){return g(e,w)},e.openContractDeploy=function(e){return g(e,P)},e.openSTXTransfer=function(e){return g(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,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.873ca52.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})); | ||
//# sourceMappingURL=connect.umd.production.min.js.map |
{ | ||
"name": "@stacks/connect", | ||
"version": "2.12.10", | ||
"version": "2.12.11-alpha.873ca52.0", | ||
"scripts": { | ||
@@ -23,3 +23,3 @@ "build": "yarn build:modules && yarn build:standalone", | ||
"@blockstack/stacks-transactions": "0.7.0", | ||
"@stacks/connect-ui": "^2.12.4", | ||
"@stacks/connect-ui": "^2.12.5-alpha.873ca52.0", | ||
"jsontokens": "^3.0.0" | ||
@@ -41,3 +41,3 @@ }, | ||
}, | ||
"gitHead": "61a47d77a651b8c6337ce5b01557dcb5b1a7cfb8" | ||
"gitHead": "61c77c9a2aad697bd7d4e2dc5b07085be159299b" | ||
} |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
1058237
4