@keystonehq/sdk
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -54,2 +54,3 @@ 'use strict'; | ||
borderWidth: 1, | ||
color: 'white', | ||
outline: 'none', | ||
@@ -56,0 +57,0 @@ margin: 2 |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react-dom")),r=require("react"),n=e(r),a=e(require("react-modal")),i=require("rxjs"),l=e(require("qrcode.react")),o=require("events"),s=require("@ngraveio/bc-ur");const c=({size:e=200,data:t="",ecl:r="L"})=>n.createElement(l,{value:t,size:e,level:r}),u={minWidth:"16rem",height:"3rem",background:"#784FFE",borderColor:"grey",borderRadius:"8px",borderWidth:1,outline:"none",margin:2},A=e=>{const{onClick:t,children:r}=e;return n.createElement("button",{onClick:t,style:u},r)},d=e=>n.createElement("div",{style:{width:"100%",marginTop:"1rem",display:"flex",flexDirection:"row-reverse",alignItems:"center",justifyContent:"center"}},e.children),m=new s.UR(Buffer.from("NO DATA","utf-8")),p=n.lazy(()=>new Promise((function(e){e(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t.default=e,t}(require("react-qr-reader")))}))),E={content:{top:"50%",left:"50%",right:"auto",bottom:"auto",borderRadius:"10px",width:"37rem",marginRight:"-50%",transform:"translate(-50%, -50%)",postion:"relative"}};var f=()=>{const[e,{read:t,play:l,cameraReady:u}]=(()=>{const[e,t]=r.useState(!1),[l,u]=r.useState("play"),[f,{play:y}]=(()=>{const[e,t]=r.useState(m),[a,l]=r.useState(!1),[u,p]=r.useState(100),[E,f]=r.useState(!1),[y,g]=r.useState(null),[S,h]=r.useState(null),b=r.useMemo(()=>new s.UREncoder(e),[e]),[R,v]=r.useState(b.nextPart()),x=r.useMemo(()=>new o.EventEmitter,[]);return r.useEffect(()=>{b.cbor.toString("hex")!==m.cbor.toString("hex")&&l(!0)},[b]),r.useEffect(()=>{const e=i.interval(u).subscribe(()=>{v(b.nextPart())});return()=>{e.unsubscribe()}},[u,b]),[a?n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},y&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},y),S&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},S),n.createElement(c,{size:288,data:R}),n.createElement(d,null,n.createElement(A,{onClick:()=>{x.emit("finish",!0)}},E?"Continue":"Finish"))):n.createElement("div",null),{play:(e,r)=>new Promise(n=>{t(e),r&&(r.refreshSpeed&&p(r.refreshSpeed),r.hasNext&&f(r.hasNext),r.title&&g(r.title),r.description&&h(r.description)),x.once("finish",()=>{t(m),l(!1),p(100),n()})})}]})(),[g,{read:S,cameraReady:h}]=(()=>{const[e,t]=r.useState(!1),[a,i]=r.useState([]),[l,c]=r.useState(new s.URDecoder),[u,m]=r.useState(""),E=r.useMemo(()=>new o.EventEmitter,[]),[f,y]=r.useState(null),[g,S]=r.useState(0),[h,b]=r.useState(null),R=()=>{c(new s.URDecoder),m("")};return[n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},f&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},f),h&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},h),n.createElement(r.Suspense,{fallback:n.createElement("div",null)},n.createElement(p,{onScan:e=>{e&&(e=>{try{if(l.isComplete()){const e=l.resultUR();let t=!1;if(a.forEach(r=>{if(r===e.type)return t=!0,void E.emit("read",{result:e,status:"success"})}),!t)throw new Error(`received ur type ${e.type}, but expected [${a.join(",")}]`)}else l.receivePart(e),S(l.getProgress())}catch(e){m(e.message)}})(e)},onLoad:()=>{t(!0)},delay:100,style:{width:"100%"},onError:e=>{m(e.message)}})),n.createElement("p",null,(100*g).toFixed(0)," %"),u&&n.createElement("p",{style:{color:"red",fontSize:"1rem"}},u),n.createElement(d,null,n.createElement(A,{onClick:()=>{E.emit("read",{status:"canceled"})}},"Close"),u&&n.createElement(A,{onClick:()=>{R()}},"Retry"))),{read:(e,t)=>new Promise(r=>{i(e),t&&(t.title&&y(t.title),t.description&&b(t.description)),E.once("read",e=>{R(),r(e)})}),cameraReady:e}]})(),b=()=>{t(!1),u("play")};return[n.createElement(a,{isOpen:e,style:E},n.createElement("div",{onClick:()=>t(!1)},n.createElement("img",{style:{position:"absolute",top:"1rem",right:"1rem"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAADAAAAAATDPpdAAAAmklEQVQoFZWRwQ3DIAwAa4brJPBP80hnaD/lD5N0iYxEfRVBxBGRwsvgO2PZklJaReTrvX/eTk7O+VVKuTtgDRYVPyOeHAysAFV40jCGEB69aHN/YSRZGK4JVuKu5/DrToDoqnI9tOh4vXJ2Qlc96kSY2lTfWs0m9DCT0r3MSkUrXR9r3eBCNbuDrY/td23z7Vg3wQhGIgcD+wPGY2fPvHuWagAAAABJRU5ErkJggg=="})),n.createElement("div",{style:{width:"35rem",boxSizing:"border-box",padding:18,flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center"}},"read"===l?g:f)),{play:async(e,r)=>{t(!0),u("play"),await y(e,r),b()},read:async(e,r)=>{t(!0),u("read");const n=await S(e,r);return b(),n},cameraReady:h}]})();return b(t,l,u),e};let y,g,S,h=!1;const b=(e,t,r)=>{h=!0,y=e,g=t,S=r},R={bootstrap:()=>{const e=document.getElementsByTagName("body").item(0),r=document.createElement("div");r.id="kv_sdk_container",e.appendChild(r),a.setAppElement("#kv_sdk_container"),t.render(n.createElement(f),r)},getSdk:()=>{if(h)return{read:y,play:g,cameraReady:S};throw new Error("SDK is not initialized")}};var v;(v=exports.SupportedResult||(exports.SupportedResult={})).UR_BYTES="bytes",v.UR_CRYPTO_HDKEY="crypto-hdkey",v.UR_ETH_SIGN_REQUEST="eth-sign-request",v.UR_ETH_SIGNATURE="eth-signature",exports.default=R; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react-dom")),r=require("react"),n=e(r),a=e(require("react-modal")),i=require("rxjs"),l=e(require("qrcode.react")),o=require("events"),s=require("@ngraveio/bc-ur");const c=({size:e=200,data:t="",ecl:r="L"})=>n.createElement(l,{value:t,size:e,level:r}),u={minWidth:"16rem",height:"3rem",background:"#784FFE",borderColor:"grey",borderRadius:"8px",borderWidth:1,color:"white",outline:"none",margin:2},A=e=>{const{onClick:t,children:r}=e;return n.createElement("button",{onClick:t,style:u},r)},d=e=>n.createElement("div",{style:{width:"100%",marginTop:"1rem",display:"flex",flexDirection:"row-reverse",alignItems:"center",justifyContent:"center"}},e.children),m=new s.UR(Buffer.from("NO DATA","utf-8")),p=n.lazy(()=>new Promise((function(e){e(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t.default=e,t}(require("react-qr-reader")))}))),E={content:{top:"50%",left:"50%",right:"auto",bottom:"auto",borderRadius:"10px",width:"37rem",marginRight:"-50%",transform:"translate(-50%, -50%)",postion:"relative"}};var f=()=>{const[e,{read:t,play:l,cameraReady:u}]=(()=>{const[e,t]=r.useState(!1),[l,u]=r.useState("play"),[f,{play:y}]=(()=>{const[e,t]=r.useState(m),[a,l]=r.useState(!1),[u,p]=r.useState(100),[E,f]=r.useState(!1),[y,g]=r.useState(null),[S,h]=r.useState(null),b=r.useMemo(()=>new s.UREncoder(e),[e]),[R,v]=r.useState(b.nextPart()),w=r.useMemo(()=>new o.EventEmitter,[]);return r.useEffect(()=>{b.cbor.toString("hex")!==m.cbor.toString("hex")&&l(!0)},[b]),r.useEffect(()=>{const e=i.interval(u).subscribe(()=>{v(b.nextPart())});return()=>{e.unsubscribe()}},[u,b]),[a?n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},y&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},y),S&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},S),n.createElement(c,{size:288,data:R}),n.createElement(d,null,n.createElement(A,{onClick:()=>{w.emit("finish",!0)}},E?"Continue":"Finish"))):n.createElement("div",null),{play:(e,r)=>new Promise(n=>{t(e),r&&(r.refreshSpeed&&p(r.refreshSpeed),r.hasNext&&f(r.hasNext),r.title&&g(r.title),r.description&&h(r.description)),w.once("finish",()=>{t(m),l(!1),p(100),n()})})}]})(),[g,{read:S,cameraReady:h}]=(()=>{const[e,t]=r.useState(!1),[a,i]=r.useState([]),[l,c]=r.useState(new s.URDecoder),[u,m]=r.useState(""),E=r.useMemo(()=>new o.EventEmitter,[]),[f,y]=r.useState(null),[g,S]=r.useState(0),[h,b]=r.useState(null),R=()=>{c(new s.URDecoder),m("")};return[n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},f&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},f),h&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},h),n.createElement(r.Suspense,{fallback:n.createElement("div",null)},n.createElement(p,{onScan:e=>{e&&(e=>{try{if(l.isComplete()){const e=l.resultUR();let t=!1;if(a.forEach(r=>{if(r===e.type)return t=!0,void E.emit("read",{result:e,status:"success"})}),!t)throw new Error(`received ur type ${e.type}, but expected [${a.join(",")}]`)}else l.receivePart(e),S(l.getProgress())}catch(e){m(e.message)}})(e)},onLoad:()=>{t(!0)},delay:100,style:{width:"100%"},onError:e=>{m(e.message)}})),n.createElement("p",null,(100*g).toFixed(0)," %"),u&&n.createElement("p",{style:{color:"red",fontSize:"1rem"}},u),n.createElement(d,null,n.createElement(A,{onClick:()=>{E.emit("read",{status:"canceled"})}},"Close"),u&&n.createElement(A,{onClick:()=>{R()}},"Retry"))),{read:(e,t)=>new Promise(r=>{i(e),t&&(t.title&&y(t.title),t.description&&b(t.description)),E.once("read",e=>{R(),r(e)})}),cameraReady:e}]})(),b=()=>{t(!1),u("play")};return[n.createElement(a,{isOpen:e,style:E},n.createElement("div",{onClick:()=>t(!1)},n.createElement("img",{style:{position:"absolute",top:"1rem",right:"1rem"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAADAAAAAATDPpdAAAAmklEQVQoFZWRwQ3DIAwAa4brJPBP80hnaD/lD5N0iYxEfRVBxBGRwsvgO2PZklJaReTrvX/eTk7O+VVKuTtgDRYVPyOeHAysAFV40jCGEB69aHN/YSRZGK4JVuKu5/DrToDoqnI9tOh4vXJ2Qlc96kSY2lTfWs0m9DCT0r3MSkUrXR9r3eBCNbuDrY/td23z7Vg3wQhGIgcD+wPGY2fPvHuWagAAAABJRU5ErkJggg=="})),n.createElement("div",{style:{width:"35rem",boxSizing:"border-box",padding:18,flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center"}},"read"===l?g:f)),{play:async(e,r)=>{t(!0),u("play"),await y(e,r),b()},read:async(e,r)=>{t(!0),u("read");const n=await S(e,r);return b(),n},cameraReady:h}]})();return b(t,l,u),e};let y,g,S,h=!1;const b=(e,t,r)=>{h=!0,y=e,g=t,S=r},R={bootstrap:()=>{const e=document.getElementsByTagName("body").item(0),r=document.createElement("div");r.id="kv_sdk_container",e.appendChild(r),a.setAppElement("#kv_sdk_container"),t.render(n.createElement(f),r)},getSdk:()=>{if(h)return{read:y,play:g,cameraReady:S};throw new Error("SDK is not initialized")}};var v;(v=exports.SupportedResult||(exports.SupportedResult={})).UR_BYTES="bytes",v.UR_CRYPTO_HDKEY="crypto-hdkey",v.UR_ETH_SIGN_REQUEST="eth-sign-request",v.UR_ETH_SIGNATURE="eth-signature",exports.default=R; | ||
//# sourceMappingURL=sdk.cjs.production.min.js.map |
@@ -28,2 +28,3 @@ import ReactDOM from 'react-dom'; | ||
borderWidth: 1, | ||
color: 'white', | ||
outline: 'none', | ||
@@ -30,0 +31,0 @@ margin: 2 |
{ | ||
"name": "@keystonehq/sdk", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Keystone airgaped wallet SDK", | ||
@@ -47,3 +47,3 @@ "author": "aaronisme <aarondongchen@gmail.com>", | ||
}, | ||
"gitHead": "4ee31dd9a0d51130889825a5a409f8f2d482fb5f" | ||
"gitHead": "c59814ab6b4d786cdfbaea21968e9a14c7301d75" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117255
1250