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

@keystonehq/sdk

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keystonehq/sdk - npm Package Compare versions

Comparing version 0.12.0-alpha.1 to 0.12.0-alpha.3

3

dist/sdk.cjs.development.js

@@ -63,2 +63,5 @@ 'use strict';

SupportedResult["UR_ETH_SIGNATURE"] = "eth-signature";
SupportedResult["UR_CRYPTO_MULTI_ACCOUNT"] = "crypto-multi-account";
SupportedResult["UR_SOL_SIGN_REQUEST"] = "sol-sign-request";
SupportedResult["UR_SOL_SIGNATURE"] = "sol-signature";
})(exports.SupportedResult || (exports.SupportedResult = {}));

@@ -65,0 +68,0 @@

2

dist/sdk.cjs.production.min.js

@@ -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")),l=require("events"),i=require("rxjs"),o=e(require("qrcode.react")),s=require("@ngraveio/bc-ur");const A=({size:e=200,data:t="",ecl:r="L"})=>n.createElement(o,{value:t,size:e,level:r});var c,u,m;(c=exports.ReadStatus||(exports.ReadStatus={})).canceled="canceled",c.success="success",(u=exports.PlayStatus||(exports.PlayStatus={})).canceled="canceled",u.success="success",(m=exports.SupportedResult||(exports.SupportedResult={})).UR_BYTES="bytes",m.UR_CRYPTO_HDKEY="crypto-hdkey",m.UR_CRYPTO_ACCOUNT="crypto-account",m.UR_ETH_SIGN_REQUEST="eth-sign-request",m.UR_ETH_SIGNATURE="eth-signature";const d={minWidth:"16rem",height:"3rem",background:"#784FFE",borderColor:"grey",borderRadius:"8px",borderWidth:1,color:"white",outline:"none",margin:2},y=e=>{const{onClick:t,children:r}=e;return n.createElement("button",{onClick:t,style:d},r)},g=e=>n.createElement("div",{style:{width:"100%",marginTop:"1rem",display:"flex",flexDirection:"row-reverse",alignItems:"center",justifyContent:"center"}},e.children),E=new s.UR(Buffer.from("NO DATA","utf-8"));class p extends Error{constructor(e){super(e),Object.setPrototypeOf(this,p.prototype)}}const f=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:{margin:"auto",display:"block",shapeRendering:"auto",animationPlayState:"running",animationDelay:"0s"},width:"200px",height:"200px",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},n.createElement("circle",{cx:"50",cy:"50",fill:"none",stroke:"#9b9b9b",strokeWidth:"7",r:"35",strokeDasharray:"164.93361431346415 56.97787143782138",style:{animationPlayState:"running",animationDelay:"0s"}},n.createElement("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1",style:{animationPlayState:"running",animationDelay:"0s"}}))),S=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")))})));let h="";const v=e=>n.createElement("div",{style:{paddingLeft:"1rem"}},n.createElement("div",{style:{display:"flex",alignItems:"center",padding:0}},n.createElement("img",{style:{display:"inline-block"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAoCAYAAACfKfiZAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAKAAAAACc9ikyAAAD+ElEQVRYCb1WbWiNURw/Z9caY5SyrKzVhuUtZcYoJdZ8kMywGClG+WK+eJsPmogNKfZBxBbmAyPyEgvtA8UUX9inbVeb8AGTd8t2j9/vdp91ntPzPPd57h3/+t1z/uf/ev7nnP9zhUiMsmH2BOgF9ifmIjmrVpgrDWuScxfMeqUW2E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cwiaAUPfegRm76syHgBylINaIX0c1hout8FecB/i/Uy23OedvZP/4Z5cDzSeAnYAZnK54P/BcahygHAD5dNh12tilAIPoLD0OnpwCV000AAAAASUVORK5CYII=",alt:""}),n.createElement("div",{style:{fontSize:"1.25rem",fontWeight:"bold",marginLeft:"1rem"}},"Sync Keystone")),n.createElement("ul",{style:{marginTop:"2rem",listStyleType:"none",padding:0,fontSize:"1rem"}},n.createElement("li",{style:{marginBottom:"0.75rem"}},"1. Turn on your Keystone hardware device"),n.createElement("li",{style:{marginBottom:"0.75rem"}},`2. Select your "${e.walletMode}" as your Watch-only wallet(Companion App)`),n.createElement("li",{style:{marginBottom:"0.75rem"}}," ",'3. Press the "Scan Keystone" button and scan the QR Code displayed on your Keystone hardware wallet'),n.createElement("li",{style:{marginBottom:"0.75rem"}}," ","4. Select account and check your watch-only wallet")),n.createElement("div",{style:{marginBottom:"1rem"}},n.createElement("a",{style:{marginTop:"1.25rem",color:"#784FFE",textDecoration:"none"},href:e.link,target:"_blank",rel:"noreferrer"},"Click here to view detailed tutorial")),n.createElement(y,{onClick:e.onButtonClick},"Sync Keystone")),w={overlay:{zIndex:999},content:{top:"50%",left:"50%",right:"auto",bottom:"auto",borderRadius:"10px",width:"37rem",marginRight:"-50%",transform:"translate(-50%, -50%)",postion:"relative"}};var x=()=>{const[e,{read:t,play:o,cameraReady:c}]=(()=>{const e=r.useMemo(()=>new l.EventEmitter,[]),[t,o]=r.useState(!1),[c,u]=r.useState(""),[m,d]=r.useState(""),[x,b]=r.useState(null),[R,{play:C}]=(()=>{const[e,t]=r.useState(E),[a,o]=r.useState(!1),[c,u]=r.useState(100),[m,d]=r.useState(!1),[p,f]=r.useState(null),[S,h]=r.useState(null),v=r.useMemo(()=>new s.UREncoder(e),[e]),[w,x]=r.useState(v.nextPart()),b=r.useMemo(()=>new l.EventEmitter,[]);return r.useEffect(()=>{v.cbor.toString("hex")!==E.cbor.toString("hex")&&o(!0)},[v]),r.useEffect(()=>{const e=i.interval(c).subscribe(()=>{x(v.nextPart())});return()=>{e.unsubscribe()}},[c,v]),[a?n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},p&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},p),n.createElement(A,{size:288,data:w}),S&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},S),n.createElement(g,null,n.createElement(y,{onClick:()=>{b.emit("finish",!0)}},m?"Scan Keystone":"Finish"))):n.createElement("div",null),{play:(e,r)=>new Promise(n=>{t(e),r&&(r.refreshSpeed&&u(r.refreshSpeed),r.hasNext&&d(r.hasNext),r.title&&f(r.title),r.description&&h(r.description)),b.once("finish",()=>{t(E),o(!1),u(100),n(exports.PlayStatus.success)})})}]})(),[B,{read:D,cameraReady:k}]=(()=>{const[e,t]=r.useState(!1),[a,i]=r.useState([]),[o,A]=r.useState(new s.URDecoder),[c,u]=r.useState(""),m=r.useMemo(()=>new l.EventEmitter,[]),[d,E]=r.useState(null),[v,w]=r.useState(0),[x,b]=r.useState(null),R=()=>{A(new s.URDecoder),u("")};return[n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},d&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},d),x&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},x),n.createElement(r.Suspense,{fallback:n.createElement("div",null)},n.createElement("div",{style:{position:"relative",width:"100%"}},e?null:n.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}},n.createElement(f,null)),n.createElement(S,{onScan:e=>{e&&(t(!0),((e,t)=>{try{if(o.isComplete()){const e=o.resultUR();let t=!1;if(a.forEach(r=>{if(r===e.type)return t=!0,void m.emit("read",{result:e,status:"success"})}),!t)throw new p(`received ur type ${e.type}, but expected [${a.join(",")}]`)}else o.receivePart(e),w(o.getProgress())}catch(e){u(e instanceof p?t:e.message)}})(e,h))},delay:100,style:{width:"100%"},onError:e=>{u(e.message)}}))),n.createElement("p",null,(100*v).toFixed(0)," %"),c&&n.createElement("p",{style:{color:"red",fontSize:"1rem"}},c),n.createElement(g,null,n.createElement(y,{onClick:()=>{m.emit("read",{status:"canceled"})}},"Close"),c&&n.createElement(y,{onClick:()=>{R()}},"Retry"))),{read:(e,t)=>new Promise(r=>{i(e),t&&(t.title&&E(t.title),t.description&&b(t.description),h=t.URTypeErrorMessage?t.URTypeErrorMessage:""),m.once("read",e=>{R(),r(e)})}),cameraReady:e}]})(),P=()=>{b(null),d(""),u(""),o(!1)};var T;return[n.createElement(a,{isOpen:t,style:w},n.createElement("div",{onClick:()=>{e.emit("close"),P()}},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",padding:18,flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#002237"}},"initial"===(T=x)?n.createElement(v,{walletMode:c,link:m,onButtonClick:()=>{b("read")}}):"read"===T?B:"play"===T?R:null)),{play:(t,r)=>new Promise(n=>{e.once("close",()=>{n(exports.PlayStatus.canceled)}),o(!0),b("play"),C(t,r).then(()=>{P(),n(exports.PlayStatus.success)})}),read:async(e,t)=>{if(t.renderInitial){u(t.renderInitial.walletMode),d(t.renderInitial.link),b("initial"),o(!0);const r=await D(e,t);return P(),r}{b("read"),o(!0);const r=await D(e,t);return P(),r}},cameraReady:k}]})();return D(t,o,c),e};let b,R,C,B=!1;const D=(e,t,r)=>{B=!0,b=e,R=t,C=r};exports.default={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(x),r)},getSdk:()=>{if(B)return{read:b,play:R,cameraReady:C};throw new Error("SDK is not initialized")}};
"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")),l=require("events"),i=require("rxjs"),o=e(require("qrcode.react")),s=require("@ngraveio/bc-ur");const A=({size:e=200,data:t="",ecl:r="L"})=>n.createElement(o,{value:t,size:e,level:r});var c,u,m;(c=exports.ReadStatus||(exports.ReadStatus={})).canceled="canceled",c.success="success",(u=exports.PlayStatus||(exports.PlayStatus={})).canceled="canceled",u.success="success",(m=exports.SupportedResult||(exports.SupportedResult={})).UR_BYTES="bytes",m.UR_CRYPTO_HDKEY="crypto-hdkey",m.UR_CRYPTO_ACCOUNT="crypto-account",m.UR_ETH_SIGN_REQUEST="eth-sign-request",m.UR_ETH_SIGNATURE="eth-signature",m.UR_CRYPTO_MULTI_ACCOUNT="crypto-multi-account",m.UR_SOL_SIGN_REQUEST="sol-sign-request",m.UR_SOL_SIGNATURE="sol-signature";const d={minWidth:"16rem",height:"3rem",background:"#784FFE",borderColor:"grey",borderRadius:"8px",borderWidth:1,color:"white",outline:"none",margin:2},y=e=>{const{onClick:t,children:r}=e;return n.createElement("button",{onClick:t,style:d},r)},g=e=>n.createElement("div",{style:{width:"100%",marginTop:"1rem",display:"flex",flexDirection:"row-reverse",alignItems:"center",justifyContent:"center"}},e.children),E=new s.UR(Buffer.from("NO DATA","utf-8"));class p extends Error{constructor(e){super(e),Object.setPrototypeOf(this,p.prototype)}}const f=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:{margin:"auto",display:"block",shapeRendering:"auto",animationPlayState:"running",animationDelay:"0s"},width:"200px",height:"200px",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},n.createElement("circle",{cx:"50",cy:"50",fill:"none",stroke:"#9b9b9b",strokeWidth:"7",r:"35",strokeDasharray:"164.93361431346415 56.97787143782138",style:{animationPlayState:"running",animationDelay:"0s"}},n.createElement("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1",style:{animationPlayState:"running",animationDelay:"0s"}}))),S=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")))})));let h="";const v=e=>n.createElement("div",{style:{paddingLeft:"1rem"}},n.createElement("div",{style:{display:"flex",alignItems:"center",padding:0}},n.createElement("img",{style:{display:"inline-block"},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAoCAYAAACfKfiZAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAKAAAAACc9ikyAAAD+ElEQVRYCb1WbWiNURw/Z9caY5SyrKzVhuUtZcYoJdZ8kMywGClG+WK+eJsPmogNKfZBxBbmAyPyEgvtA8UUX9inbVeb8AGTd8t2j9/vdp91ntPzPPd57h3/+t1z/uf/ev7nnP9zhUiMsmH2BOgF9ifmIjmrVpgrDWuScxfMeqUW2EqiB2sjgrlJTDsNZmHACqyP2xJzGcyq2iU4E7kTzFVw7fEw+Qbou9bn94K7FCIlgNFh6I7y0E8oAQ9/NlEBuAig71ifv4VspM1iiJnHHsGZyPohjm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:""}),n.createElement("div",{style:{fontSize:"1.25rem",fontWeight:"bold",marginLeft:"1rem"}},"Sync Keystone")),n.createElement("ul",{style:{marginTop:"2rem",listStyleType:"none",padding:0,fontSize:"1rem"}},n.createElement("li",{style:{marginBottom:"0.75rem"}},"1. Turn on your Keystone hardware device"),n.createElement("li",{style:{marginBottom:"0.75rem"}},`2. Select your "${e.walletMode}" as your Watch-only wallet(Companion App)`),n.createElement("li",{style:{marginBottom:"0.75rem"}}," ",'3. Press the "Scan Keystone" button and scan the QR Code displayed on your Keystone hardware wallet'),n.createElement("li",{style:{marginBottom:"0.75rem"}}," ","4. Select account and check your watch-only wallet")),n.createElement("div",{style:{marginBottom:"1rem"}},n.createElement("a",{style:{marginTop:"1.25rem",color:"#784FFE",textDecoration:"none"},href:e.link,target:"_blank",rel:"noreferrer"},"Click here to view detailed tutorial")),n.createElement(y,{onClick:e.onButtonClick},"Sync Keystone")),w={overlay:{zIndex:999},content:{top:"50%",left:"50%",right:"auto",bottom:"auto",borderRadius:"10px",width:"37rem",marginRight:"-50%",transform:"translate(-50%, -50%)",postion:"relative"}};var x=()=>{const[e,{read:t,play:o,cameraReady:c}]=(()=>{const e=r.useMemo(()=>new l.EventEmitter,[]),[t,o]=r.useState(!1),[c,u]=r.useState(""),[m,d]=r.useState(""),[x,b]=r.useState(null),[R,{play:C}]=(()=>{const[e,t]=r.useState(E),[a,o]=r.useState(!1),[c,u]=r.useState(100),[m,d]=r.useState(!1),[p,f]=r.useState(null),[S,h]=r.useState(null),v=r.useMemo(()=>new s.UREncoder(e),[e]),[w,x]=r.useState(v.nextPart()),b=r.useMemo(()=>new l.EventEmitter,[]);return r.useEffect(()=>{v.cbor.toString("hex")!==E.cbor.toString("hex")&&o(!0)},[v]),r.useEffect(()=>{const e=i.interval(c).subscribe(()=>{x(v.nextPart())});return()=>{e.unsubscribe()}},[c,v]),[a?n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},p&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},p),n.createElement(A,{size:288,data:w}),S&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},S),n.createElement(g,null,n.createElement(y,{onClick:()=>{b.emit("finish",!0)}},m?"Scan Keystone":"Finish"))):n.createElement("div",null),{play:(e,r)=>new Promise(n=>{t(e),r&&(r.refreshSpeed&&u(r.refreshSpeed),r.hasNext&&d(r.hasNext),r.title&&f(r.title),r.description&&h(r.description)),b.once("finish",()=>{t(E),o(!1),u(100),n(exports.PlayStatus.success)})})}]})(),[B,{read:D,cameraReady:U}]=(()=>{const[e,t]=r.useState(!1),[a,i]=r.useState([]),[o,A]=r.useState(new s.URDecoder),[c,u]=r.useState(""),m=r.useMemo(()=>new l.EventEmitter,[]),[d,E]=r.useState(null),[v,w]=r.useState(0),[x,b]=r.useState(null),R=()=>{A(new s.URDecoder),u("")};return[n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},d&&n.createElement("p",{style:{fontSize:"1.25rem",fontWeight:"bold"}},d),x&&n.createElement("p",{style:{fontSize:"1rem",textAlign:"center"}},x),n.createElement(r.Suspense,{fallback:n.createElement("div",null)},n.createElement("div",{style:{position:"relative",width:"100%"}},e?null:n.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}},n.createElement(f,null)),n.createElement(S,{onScan:e=>{e&&(t(!0),((e,t)=>{try{if(o.isComplete()){const e=o.resultUR();let t=!1;if(a.forEach(r=>{if(r===e.type)return t=!0,void m.emit("read",{result:e,status:"success"})}),!t)throw new p(`received ur type ${e.type}, but expected [${a.join(",")}]`)}else o.receivePart(e),w(o.getProgress())}catch(e){u(e instanceof p?t:e.message)}})(e,h))},delay:100,style:{width:"100%"},onError:e=>{u(e.message)}}))),n.createElement("p",null,(100*v).toFixed(0)," %"),c&&n.createElement("p",{style:{color:"red",fontSize:"1rem"}},c),n.createElement(g,null,n.createElement(y,{onClick:()=>{m.emit("read",{status:"canceled"})}},"Close"),c&&n.createElement(y,{onClick:()=>{R()}},"Retry"))),{read:(e,t)=>new Promise(r=>{i(e),t&&(t.title&&E(t.title),t.description&&b(t.description),h=t.URTypeErrorMessage?t.URTypeErrorMessage:""),m.once("read",e=>{R(),r(e)})}),cameraReady:e}]})(),k=()=>{b(null),d(""),u(""),o(!1)};var T;return[n.createElement(a,{isOpen:t,style:w},n.createElement("div",{onClick:()=>{e.emit("close"),k()}},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",padding:18,flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#002237"}},"initial"===(T=x)?n.createElement(v,{walletMode:c,link:m,onButtonClick:()=>{b("read")}}):"read"===T?B:"play"===T?R:null)),{play:(t,r)=>new Promise(n=>{e.once("close",()=>{n(exports.PlayStatus.canceled)}),o(!0),b("play"),C(t,r).then(()=>{k(),n(exports.PlayStatus.success)})}),read:async(e,t)=>{if(t.renderInitial){u(t.renderInitial.walletMode),d(t.renderInitial.link),b("initial"),o(!0);const r=await D(e,t);return k(),r}{b("read"),o(!0);const r=await D(e,t);return k(),r}},cameraReady:U}]})();return D(t,o,c),e};let b,R,C,B=!1;const D=(e,t,r)=>{B=!0,b=e,R=t,C=r};exports.default={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(x),r)},getSdk:()=>{if(B)return{read:b,play:R,cameraReady:C};throw new Error("SDK is not initialized")}};
//# sourceMappingURL=sdk.cjs.production.min.js.map

@@ -43,2 +43,5 @@ import ReactDOM from 'react-dom';

SupportedResult["UR_ETH_SIGNATURE"] = "eth-signature";
SupportedResult["UR_CRYPTO_MULTI_ACCOUNT"] = "crypto-multi-account";
SupportedResult["UR_SOL_SIGN_REQUEST"] = "sol-sign-request";
SupportedResult["UR_SOL_SIGNATURE"] = "sol-signature";
})(SupportedResult || (SupportedResult = {}));

@@ -45,0 +48,0 @@

@@ -38,4 +38,7 @@ import { UR } from "@ngraveio/bc-ur";

UR_ETH_SIGN_REQUEST = "eth-sign-request",
UR_ETH_SIGNATURE = "eth-signature"
UR_ETH_SIGNATURE = "eth-signature",
UR_CRYPTO_MULTI_ACCOUNT = "crypto-multi-account",
UR_SOL_SIGN_REQUEST = "sol-sign-request",
UR_SOL_SIGNATURE = "sol-signature"
}
export {};
{
"name": "@keystonehq/sdk",
"version": "0.12.0-alpha.1",
"version": "0.12.0-alpha.3",
"description": "Keystone airgaped wallet SDK",

@@ -56,3 +56,3 @@ "author": "aaronisme <aarondongchen@gmail.com>",

},
"gitHead": "2e867890afda80d6078091bebc6040537d02602c"
"gitHead": "063603af47428deb619aec26d21e23cdeff11bb9"
}

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