@coinbase/wallet-sdk
Advanced tools
Comparing version 3.0.4 to 3.0.5
@@ -13,5 +13,3 @@ "use strict"; | ||
const LINK_API_URL = process.env.LINK_API_URL || "https://www.walletlink.org"; | ||
const SDK_VERSION = process.env.SDK_VERSION || | ||
require("../package.json").version || | ||
"unknown"; | ||
const SDK_VERSION = process.env.SDK_VERSION || require("../package.json").version || "unknown"; | ||
class CoinbaseWalletSDK { | ||
@@ -18,0 +16,0 @@ /** |
@@ -12,6 +12,6 @@ "use strict"; | ||
const hooks_1 = require("preact/hooks"); | ||
const version_1 = require("../version"); | ||
const LinkDialog_css_1 = __importDefault(require("./LinkDialog-css")); | ||
const QRCode_1 = require("./QRCode"); | ||
const Spinner_1 = require("./Spinner"); | ||
const version_1 = require("../version"); | ||
const LinkDialog = props => { | ||
@@ -18,0 +18,0 @@ const [isContainerHidden, setContainerHidden] = (0, hooks_1.useState)(!props.isOpen); |
@@ -41,3 +41,3 @@ "use strict"; | ||
.catch(err => { | ||
console.error('Couldn\'t fetch feature flags - ', err); | ||
console.error("Couldn't fetch feature flags - ", err); | ||
this.extensionUI$.next({ value: false }); | ||
@@ -44,0 +44,0 @@ }); |
@@ -83,3 +83,4 @@ "use strict"; | ||
(0, preact_1.h)("path", { "fill-rule": action.defaultFillRule, "clip-rule": action.defaultClipRule, d: action.path, fill: "#AAAAAA" })), | ||
(0, preact_1.h)("span", { class: (0, clsx_1.default)("-cbwsdk-snackbar-instance-menu-item-info", action.isRed && "-cbwsdk-snackbar-instance-menu-item-info-is-red") }, action.info)))))))); | ||
(0, preact_1.h)("span", { class: (0, clsx_1.default)("-cbwsdk-snackbar-instance-menu-item-info", action.isRed && | ||
"-cbwsdk-snackbar-instance-menu-item-info-is-red") }, action.info)))))))); | ||
}; |
@@ -1,2 +0,2 @@ | ||
declare const _default: ".-cbwsdk-css-reset .-cbwsdk-extension-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5);transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box{display:flex;position:relative;max-width:500px;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top{display:flex;flex-direction:row;background-color:#fff;border-radius:8px;overflow:hidden;min-height:300px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;padding:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region button{display:block;border-radius:8px;background-color:#1652f0;color:#fff;width:90%;min-width:fit-content;height:44px;margin-top:16px;font-size:16px;padding-left:16px;padding-right:16px;cursor:pointer;font-weight:500;text-align:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-info-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;background-color:#fafbfc}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description{display:flex;flex-direction:row;align-items:center;padding-top:14px;padding-bottom:14px;padding-left:24px;padding-right:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper{display:block;position:relative;width:40px;height:40px;flex-shrink:0;flex-grow:0;border-radius:20px;background-color:#fff;box-shadow:0px 0px 8px rgba(0,0,0,.04),0px 16px 24px rgba(0,0,0,.06)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper img{position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-text{margin-left:16px;flex-grow:1;font-size:13px;line-height:19px;color:#000;align-self:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom{display:flex;flex-direction:row;overflow:hidden;border-radius:8px;background-color:#fff;margin-top:8px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description-region{display:flex;flex-direction:column;justify-content:center;padding:32px;flex-grow:1}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description{font-size:13px;line-height:19px;margin-top:12px;color:#aaa}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description a{font-size:inherit;line-height:inherit;color:#1652f0;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-region{position:relative;flex-shrink:0;display:flex;flex-direction:column;justify-content:center;padding-left:24px;padding-right:24px;padding-top:16px;padding-bottom:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper{position:relative;display:block;padding:8px;border-radius:8px;box-shadow:0px 4px 12px rgba(0,0,0,.1)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper img{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting>p{font-size:12px;font-weight:bold;color:#000;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel{position:absolute;-webkit-appearance:none;display:flex;align-items:center;justify-content:center;top:16px;right:16px;width:24px;height:24px;border-radius:12px;background-color:#fafbfc;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{content:\"\";position:absolute;display:block;top:-1px;left:-7px;width:14px;height:1px;background-color:#000;transition:background-color .2s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before{transform:rotate(45deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{transform:rotate(135deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-a,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-b{background-color:#000}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container-hidden{display:none}.-cbwsdk-css-reset .-cbwsdk-extension-dialog h2{display:block;text-align:left;font-size:22px;font-weight:600;line-height:28px;color:#000}"; | ||
declare const _default: ".-cbwsdk-css-reset .-cbwsdk-extension-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5);transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box{display:flex;position:relative;max-width:500px;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top{display:flex;flex-direction:row;background-color:#fff;border-radius:8px;overflow:hidden;min-height:300px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-subtext{margin-top:15px;font-size:12px;line-height:1.5}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;padding:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region button{display:block;border-radius:8px;background-color:#1652f0;color:#fff;width:90%;min-width:fit-content;height:44px;margin-top:16px;font-size:16px;padding-left:16px;padding-right:16px;cursor:pointer;font-weight:500;text-align:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-info-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;background-color:#fafbfc}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description{display:flex;flex-direction:row;align-items:center;padding-top:14px;padding-bottom:14px;padding-left:24px;padding-right:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper{display:block;position:relative;width:40px;height:40px;flex-shrink:0;flex-grow:0;border-radius:20px;background-color:#fff;box-shadow:0px 0px 8px rgba(0,0,0,.04),0px 16px 24px rgba(0,0,0,.06)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper img{position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-text{margin-left:16px;flex-grow:1;font-size:13px;line-height:19px;color:#000;align-self:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom{display:flex;flex-direction:row;overflow:hidden;border-radius:8px;background-color:#fff;margin-top:8px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description-region{display:flex;flex-direction:column;justify-content:center;padding:32px;flex-grow:1}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description{font-size:13px;line-height:19px;margin-top:12px;color:#aaa}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description a{font-size:inherit;line-height:inherit;color:#1652f0;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-region{position:relative;flex-shrink:0;display:flex;flex-direction:column;justify-content:center;padding-left:24px;padding-right:24px;padding-top:16px;padding-bottom:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper{position:relative;display:block;padding:8px;border-radius:8px;box-shadow:0px 4px 12px rgba(0,0,0,.1)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper img{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting>p{font-size:12px;font-weight:bold;color:#000;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel{position:absolute;-webkit-appearance:none;display:flex;align-items:center;justify-content:center;top:16px;right:16px;width:24px;height:24px;border-radius:12px;background-color:#fafbfc;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{content:\"\";position:absolute;display:block;top:-1px;left:-7px;width:14px;height:1px;background-color:#000;transition:background-color .2s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before{transform:rotate(45deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{transform:rotate(135deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-a,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-b{background-color:#000}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container-hidden{display:none}.-cbwsdk-css-reset .-cbwsdk-extension-dialog h2{display:block;text-align:left;font-size:22px;font-weight:600;line-height:28px;color:#000}"; | ||
export default _default; |
@@ -5,2 +5,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = `.-cbwsdk-css-reset .-cbwsdk-extension-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5);transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box{display:flex;position:relative;max-width:500px;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top{display:flex;flex-direction:row;background-color:#fff;border-radius:8px;overflow:hidden;min-height:300px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;padding:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region button{display:block;border-radius:8px;background-color:#1652f0;color:#fff;width:90%;min-width:fit-content;height:44px;margin-top:16px;font-size:16px;padding-left:16px;padding-right:16px;cursor:pointer;font-weight:500;text-align:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-info-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;background-color:#fafbfc}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description{display:flex;flex-direction:row;align-items:center;padding-top:14px;padding-bottom:14px;padding-left:24px;padding-right:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper{display:block;position:relative;width:40px;height:40px;flex-shrink:0;flex-grow:0;border-radius:20px;background-color:#fff;box-shadow:0px 0px 8px rgba(0,0,0,.04),0px 16px 24px rgba(0,0,0,.06)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper img{position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-text{margin-left:16px;flex-grow:1;font-size:13px;line-height:19px;color:#000;align-self:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom{display:flex;flex-direction:row;overflow:hidden;border-radius:8px;background-color:#fff;margin-top:8px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description-region{display:flex;flex-direction:column;justify-content:center;padding:32px;flex-grow:1}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description{font-size:13px;line-height:19px;margin-top:12px;color:#aaa}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description a{font-size:inherit;line-height:inherit;color:#1652f0;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-region{position:relative;flex-shrink:0;display:flex;flex-direction:column;justify-content:center;padding-left:24px;padding-right:24px;padding-top:16px;padding-bottom:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper{position:relative;display:block;padding:8px;border-radius:8px;box-shadow:0px 4px 12px rgba(0,0,0,.1)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper img{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting>p{font-size:12px;font-weight:bold;color:#000;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel{position:absolute;-webkit-appearance:none;display:flex;align-items:center;justify-content:center;top:16px;right:16px;width:24px;height:24px;border-radius:12px;background-color:#fafbfc;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{content:"";position:absolute;display:block;top:-1px;left:-7px;width:14px;height:1px;background-color:#000;transition:background-color .2s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before{transform:rotate(45deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{transform:rotate(135deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-a,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-b{background-color:#000}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container-hidden{display:none}.-cbwsdk-css-reset .-cbwsdk-extension-dialog h2{display:block;text-align:left;font-size:22px;font-weight:600;line-height:28px;color:#000}`; | ||
exports.default = `.-cbwsdk-css-reset .-cbwsdk-extension-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5);transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box{display:flex;position:relative;max-width:500px;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top{display:flex;flex-direction:row;background-color:#fff;border-radius:8px;overflow:hidden;min-height:300px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-subtext{margin-top:15px;font-size:12px;line-height:1.5}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;padding:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-install-region button{display:block;border-radius:8px;background-color:#1652f0;color:#fff;width:90%;min-width:fit-content;height:44px;margin-top:16px;font-size:16px;padding-left:16px;padding-right:16px;cursor:pointer;font-weight:500;text-align:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-info-region{display:flex;flex-basis:50%;flex-direction:column;justify-content:center;background-color:#fafbfc}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description{display:flex;flex-direction:row;align-items:center;padding-top:14px;padding-bottom:14px;padding-left:24px;padding-right:32px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper{display:block;position:relative;width:40px;height:40px;flex-shrink:0;flex-grow:0;border-radius:20px;background-color:#fff;box-shadow:0px 0px 8px rgba(0,0,0,.04),0px 16px 24px rgba(0,0,0,.06)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-icon-wrapper img{position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-top-description-text{margin-left:16px;flex-grow:1;font-size:13px;line-height:19px;color:#000;align-self:center}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom{display:flex;flex-direction:row;overflow:hidden;border-radius:8px;background-color:#fff;margin-top:8px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description-region{display:flex;flex-direction:column;justify-content:center;padding:32px;flex-grow:1}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description{font-size:13px;line-height:19px;margin-top:12px;color:#aaa}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-description a{font-size:inherit;line-height:inherit;color:#1652f0;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-region{position:relative;flex-shrink:0;display:flex;flex-direction:column;justify-content:center;padding-left:24px;padding-right:24px;padding-top:16px;padding-bottom:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper{position:relative;display:block;padding:8px;border-radius:8px;box-shadow:0px 4px 12px rgba(0,0,0,.1)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-wrapper img{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-bottom-qr-connecting>p{font-size:12px;font-weight:bold;color:#000;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel{position:absolute;-webkit-appearance:none;display:flex;align-items:center;justify-content:center;top:16px;right:16px;width:24px;height:24px;border-radius:12px;background-color:#fafbfc;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{content:"";position:absolute;display:block;top:-1px;left:-7px;width:14px;height:1px;background-color:#000;transition:background-color .2s}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::before{transform:rotate(45deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel-x::after{transform:rotate(135deg)}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-a,.-cbwsdk-css-reset .-cbwsdk-extension-dialog-box-cancel:hover .-cbwsdk-link-dialog-box-cancel-x-b{background-color:#000}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-extension-dialog-container-hidden{display:none}.-cbwsdk-css-reset .-cbwsdk-extension-dialog h2{display:block;text-align:left;font-size:22px;font-weight:600;line-height:28px;color:#000}`; |
@@ -10,2 +10,3 @@ "use strict"; | ||
const hooks_1 = require("preact/hooks"); | ||
const version_1 = require("../version"); | ||
const globe_icon_svg_1 = __importDefault(require("./icons/globe-icon-svg")); | ||
@@ -18,3 +19,2 @@ const link_icon_svg_1 = __importDefault(require("./icons/link-icon-svg")); | ||
const TryExtensionLinkDialog_css_1 = __importDefault(require("./TryExtensionLinkDialog-css")); | ||
const version_1 = require("../version"); | ||
const TryExtensionLinkDialog = props => { | ||
@@ -54,7 +54,18 @@ const [isContainerHidden, setContainerHidden] = (0, hooks_1.useState)(!props.isOpen); | ||
exports.TryExtensionLinkDialog = TryExtensionLinkDialog; | ||
const TryExtensionBox = props => { | ||
const TryExtensionBox = ({ onInstallClick }) => { | ||
const [isClicked, setIsClicked] = (0, hooks_1.useState)(false); | ||
const clickHandler = (0, hooks_1.useCallback)(() => { | ||
if (isClicked) { | ||
window.location.reload(); | ||
} | ||
else { | ||
onInstallClick(); | ||
setIsClicked(true); | ||
} | ||
}, []); | ||
return ((0, preact_1.h)("div", { class: "-cbwsdk-extension-dialog-box-top" }, | ||
(0, preact_1.h)("div", { class: "-cbwsdk-extension-dialog-box-top-install-region" }, | ||
(0, preact_1.h)("h2", null, "Try the Coinbase Wallet extension"), | ||
(0, preact_1.h)("button", { onClick: props.onInstallClick }, "Install")), | ||
isClicked && ((0, preact_1.h)("div", { class: "-cbwsdk-extension-dialog-box-top-subtext" }, "After installing Coinbase Wallet, refresh the page and connect again.")), | ||
(0, preact_1.h)("button", { type: "button", onClick: clickHandler }, isClicked ? "Refresh" : "Install")), | ||
(0, preact_1.h)("div", { class: "-cbwsdk-extension-dialog-box-top-info-region" }, | ||
@@ -73,5 +84,7 @@ (0, preact_1.h)(DescriptionItem, { icon: link_icon_svg_1.default, text: "Connect to crypto apps with one click" }), | ||
(0, preact_1.h)("body", { class: "-cbwsdk-extension-dialog-box-bottom-description" }, | ||
"Open ", | ||
(0, preact_1.h)("a", { href: "https://wallet.coinbase.com/" }, "Coinbase Wallet"), | ||
" on your mobile phone and scan")), | ||
"Open", | ||
" ", | ||
(0, preact_1.h)("a", { href: "https://wallet.coinbase.com/", target: "_blank", rel: "noopener noreferrer" }, "Coinbase Wallet"), | ||
" ", | ||
"on your mobile phone and scan")), | ||
(0, preact_1.h)("div", { class: "-cbwsdk-extension-dialog-box-bottom-qr-region" }, | ||
@@ -96,3 +109,3 @@ (0, preact_1.h)("div", { class: "-cbwsdk-extension-dialog-box-bottom-qr-wrapper" }, | ||
}; | ||
const CancelButton = props => ((0, preact_1.h)("button", { class: "-cbwsdk-extension-dialog-box-cancel", onClick: props.onClick }, | ||
const CancelButton = props => ((0, preact_1.h)("button", { type: "button", class: "-cbwsdk-extension-dialog-box-cancel", onClick: props.onClick }, | ||
(0, preact_1.h)("div", { class: "-cbwsdk-extension-dialog-box-cancel-x" }))); |
@@ -8,6 +8,6 @@ "use strict"; | ||
const operators_1 = require("rxjs/operators"); | ||
const EventListener_1 = require("./EventListener"); | ||
const Session_1 = require("../relay/Session"); | ||
const types_1 = require("../types"); | ||
const ClientMessage_1 = require("./ClientMessage"); | ||
const EventListener_1 = require("./EventListener"); | ||
const RxWebSocket_1 = require("./RxWebSocket"); | ||
@@ -14,0 +14,0 @@ const ServerMessage_1 = require("./ServerMessage"); |
@@ -32,21 +32,40 @@ "use strict"; | ||
switch (thiz) { | ||
case EthereumChain.ETHEREUM_MAINNET: return "https://mainnet-infura.wallet.coinbase.com"; | ||
case EthereumChain.ROPSTEN: return "https://ropsten-infura.wallet.coinbase.com"; | ||
case EthereumChain.RINKEBY: return "https://rinkeby-infura.wallet.coinbase.com"; | ||
case EthereumChain.KOVAN: return "https://kovan-infura.wallet.coinbase.com"; | ||
case EthereumChain.GOERLI: return "https://goerli-node.wallet.coinbase.com"; | ||
case EthereumChain.OPTIMISM_KOVAN: return "https://optimism-node.wallet.coinbase.com"; | ||
case EthereumChain.OPTIMISM_MAINNET: return "https://optimism-mainnet.wallet.coinbase.com"; | ||
case EthereumChain.POLYGON_MAINNET: return "https://polygon-mainnet-infura.wallet.coinbase.com"; | ||
case EthereumChain.POLYGON_TESTNET: return "https://polygon-mumbai-infura.wallet.coinbase.com"; | ||
case EthereumChain.BSC_MAINNET: return "https://bsc-dataseed.binance.org"; | ||
case EthereumChain.BSC_TESTNET: return "https://data-seed-prebsc-1-s1.binance.org:8545"; | ||
case EthereumChain.FANTOM_MAINNET: return "https://rpcapi.fantom.network"; | ||
case EthereumChain.FANTOM_TESTNET: return "https://rpc.testnet.fantom.network"; | ||
case EthereumChain.ARBITRUM_MAINNET: return "https://l2-mainnet.wallet.coinbase.com?targetName=arbitrum"; | ||
case EthereumChain.ARBITRUM_TESTNET: return "https://rinkeby.arbitrum.io/rpc"; | ||
case EthereumChain.XDAI_MAINNET: return "https://rpc.xdaichain.com"; | ||
case EthereumChain.AVALANCHE_MAINNET: return "https://api.avax.network/ext/bc/C/rpc"; | ||
case EthereumChain.AVALANCHE_FUJI: return "https://api.avax-test.network/ext/bc/C/rpc"; | ||
default: return undefined; | ||
case EthereumChain.ETHEREUM_MAINNET: | ||
return "https://mainnet-infura.wallet.coinbase.com"; | ||
case EthereumChain.ROPSTEN: | ||
return "https://ropsten-infura.wallet.coinbase.com"; | ||
case EthereumChain.RINKEBY: | ||
return "https://rinkeby-infura.wallet.coinbase.com"; | ||
case EthereumChain.KOVAN: | ||
return "https://kovan-infura.wallet.coinbase.com"; | ||
case EthereumChain.GOERLI: | ||
return "https://goerli-node.wallet.coinbase.com"; | ||
case EthereumChain.OPTIMISM_KOVAN: | ||
return "https://optimism-node.wallet.coinbase.com"; | ||
case EthereumChain.OPTIMISM_MAINNET: | ||
return "https://optimism-mainnet.wallet.coinbase.com"; | ||
case EthereumChain.POLYGON_MAINNET: | ||
return "https://polygon-mainnet-infura.wallet.coinbase.com"; | ||
case EthereumChain.POLYGON_TESTNET: | ||
return "https://polygon-mumbai-infura.wallet.coinbase.com"; | ||
case EthereumChain.BSC_MAINNET: | ||
return "https://bsc-dataseed.binance.org"; | ||
case EthereumChain.BSC_TESTNET: | ||
return "https://data-seed-prebsc-1-s1.binance.org:8545"; | ||
case EthereumChain.FANTOM_MAINNET: | ||
return "https://rpcapi.fantom.network"; | ||
case EthereumChain.FANTOM_TESTNET: | ||
return "https://rpc.testnet.fantom.network"; | ||
case EthereumChain.ARBITRUM_MAINNET: | ||
return "https://l2-mainnet.wallet.coinbase.com?targetName=arbitrum"; | ||
case EthereumChain.ARBITRUM_TESTNET: | ||
return "https://rinkeby.arbitrum.io/rpc"; | ||
case EthereumChain.XDAI_MAINNET: | ||
return "https://rpc.xdaichain.com"; | ||
case EthereumChain.AVALANCHE_MAINNET: | ||
return "https://api.avax.network/ext/bc/C/rpc"; | ||
case EthereumChain.AVALANCHE_FUJI: | ||
return "https://api.avax-test.network/ext/bc/C/rpc"; | ||
default: | ||
return undefined; | ||
} | ||
@@ -58,23 +77,43 @@ } | ||
// mainnets | ||
case EthereumChain.ETHEREUM_MAINNET.valueOf(): return EthereumChain.ETHEREUM_MAINNET; | ||
case EthereumChain.OPTIMISM_MAINNET.valueOf(): return EthereumChain.OPTIMISM_MAINNET; | ||
case EthereumChain.POLYGON_MAINNET.valueOf(): return EthereumChain.POLYGON_MAINNET; | ||
case EthereumChain.ETHEREUM_CLASSIC_MAINNET.valueOf(): return EthereumChain.ETHEREUM_CLASSIC_MAINNET; | ||
case EthereumChain.BSC_MAINNET.valueOf(): return EthereumChain.BSC_MAINNET; | ||
case EthereumChain.FANTOM_MAINNET.valueOf(): return EthereumChain.FANTOM_MAINNET; | ||
case EthereumChain.ARBITRUM_MAINNET.valueOf(): return EthereumChain.ARBITRUM_MAINNET; | ||
case EthereumChain.AVALANCHE_MAINNET.valueOf(): return EthereumChain.AVALANCHE_MAINNET; | ||
case EthereumChain.XDAI_MAINNET.valueOf(): return EthereumChain.XDAI_MAINNET; | ||
case EthereumChain.ETHEREUM_MAINNET.valueOf(): | ||
return EthereumChain.ETHEREUM_MAINNET; | ||
case EthereumChain.OPTIMISM_MAINNET.valueOf(): | ||
return EthereumChain.OPTIMISM_MAINNET; | ||
case EthereumChain.POLYGON_MAINNET.valueOf(): | ||
return EthereumChain.POLYGON_MAINNET; | ||
case EthereumChain.ETHEREUM_CLASSIC_MAINNET.valueOf(): | ||
return EthereumChain.ETHEREUM_CLASSIC_MAINNET; | ||
case EthereumChain.BSC_MAINNET.valueOf(): | ||
return EthereumChain.BSC_MAINNET; | ||
case EthereumChain.FANTOM_MAINNET.valueOf(): | ||
return EthereumChain.FANTOM_MAINNET; | ||
case EthereumChain.ARBITRUM_MAINNET.valueOf(): | ||
return EthereumChain.ARBITRUM_MAINNET; | ||
case EthereumChain.AVALANCHE_MAINNET.valueOf(): | ||
return EthereumChain.AVALANCHE_MAINNET; | ||
case EthereumChain.XDAI_MAINNET.valueOf(): | ||
return EthereumChain.XDAI_MAINNET; | ||
// testnets | ||
case EthereumChain.ROPSTEN.valueOf(): return EthereumChain.ROPSTEN; | ||
case EthereumChain.RINKEBY.valueOf(): return EthereumChain.RINKEBY; | ||
case EthereumChain.GOERLI.valueOf(): return EthereumChain.GOERLI; | ||
case EthereumChain.KOVAN.valueOf(): return EthereumChain.KOVAN; | ||
case EthereumChain.OPTIMISM_KOVAN.valueOf(): return EthereumChain.OPTIMISM_KOVAN; | ||
case EthereumChain.POLYGON_TESTNET.valueOf(): return EthereumChain.POLYGON_TESTNET; | ||
case EthereumChain.BSC_TESTNET.valueOf(): return EthereumChain.BSC_TESTNET; | ||
case EthereumChain.FANTOM_TESTNET.valueOf(): return EthereumChain.FANTOM_TESTNET; | ||
case EthereumChain.ARBITRUM_TESTNET.valueOf(): return EthereumChain.ARBITRUM_TESTNET; | ||
case EthereumChain.AVALANCHE_FUJI.valueOf(): return EthereumChain.AVALANCHE_FUJI; | ||
default: return undefined; | ||
case EthereumChain.ROPSTEN.valueOf(): | ||
return EthereumChain.ROPSTEN; | ||
case EthereumChain.RINKEBY.valueOf(): | ||
return EthereumChain.RINKEBY; | ||
case EthereumChain.GOERLI.valueOf(): | ||
return EthereumChain.GOERLI; | ||
case EthereumChain.KOVAN.valueOf(): | ||
return EthereumChain.KOVAN; | ||
case EthereumChain.OPTIMISM_KOVAN.valueOf(): | ||
return EthereumChain.OPTIMISM_KOVAN; | ||
case EthereumChain.POLYGON_TESTNET.valueOf(): | ||
return EthereumChain.POLYGON_TESTNET; | ||
case EthereumChain.BSC_TESTNET.valueOf(): | ||
return EthereumChain.BSC_TESTNET; | ||
case EthereumChain.FANTOM_TESTNET.valueOf(): | ||
return EthereumChain.FANTOM_TESTNET; | ||
case EthereumChain.ARBITRUM_TESTNET.valueOf(): | ||
return EthereumChain.ARBITRUM_TESTNET; | ||
case EthereumChain.AVALANCHE_FUJI.valueOf(): | ||
return EthereumChain.AVALANCHE_FUJI; | ||
default: | ||
return undefined; | ||
} | ||
@@ -81,0 +120,0 @@ } |
@@ -18,2 +18,3 @@ import SafeEventEmitter from "@metamask/safe-event-emitter"; | ||
eventListener?: EventListener; | ||
supportsAddressSwitching?: boolean; | ||
} | ||
@@ -33,2 +34,3 @@ export declare class CoinbaseWalletProvider extends SafeEventEmitter implements Web3Provider { | ||
private hasMadeFirstChainChangedEmission; | ||
private supportsAddressSwitching?; | ||
constructor(options: Readonly<CoinbaseWalletProviderOptions>); | ||
@@ -35,0 +37,0 @@ get selectedAddress(): AddressString | undefined; |
@@ -55,2 +55,3 @@ "use strict"; | ||
this.isCoinbaseWallet = (_a = options.overrideIsCoinbaseWallet) !== null && _a !== void 0 ? _a : true; | ||
this.supportsAddressSwitching = options.supportsAddressSwitching; | ||
const chainId = this.getChainId(); | ||
@@ -98,2 +99,3 @@ const chainIdStr = (0, util_1.prepend0x)(chainId.toString(16)); | ||
get isWalletLink() { | ||
// backward compatibility | ||
return true; | ||
@@ -166,4 +168,3 @@ } | ||
const isWhitelistedNetworkOrStandalone = relay.inlineAddEthereumChain(chainId.toString()); | ||
if (!this._isAuthorized() && | ||
!isWhitelistedNetworkOrStandalone) { | ||
if (!this._isAuthorized() && !isWhitelistedNetworkOrStandalone) { | ||
await relay.requestEthereumAccounts().promise; | ||
@@ -346,2 +347,9 @@ } | ||
} | ||
if (this._addresses.length > 0 && this.supportsAddressSwitching === false) { | ||
/** | ||
* The extension currently doesn't support switching selected wallet index | ||
* make sure walletlink doesn't update it's address in this case | ||
*/ | ||
return; | ||
} | ||
this._addresses = newAddresses; | ||
@@ -478,5 +486,5 @@ this.emit("accountsChanged", this._addresses); | ||
try { | ||
const address = (0, util_1.ensureAddressString)(addressString); | ||
const addressStr = (0, util_1.ensureAddressString)(addressString); | ||
const lowercaseAddresses = this._addresses.map(address => (0, util_1.ensureAddressString)(address)); | ||
return lowercaseAddresses.includes(address); | ||
return lowercaseAddresses.includes(addressStr); | ||
} | ||
@@ -507,3 +515,5 @@ catch (_a) { } | ||
const maxFeePerGas = tx.maxFeePerGas != null ? (0, util_1.ensureBN)(tx.maxFeePerGas) : null; | ||
const maxPriorityFeePerGas = tx.maxPriorityFeePerGas != null ? (0, util_1.ensureBN)(tx.maxPriorityFeePerGas) : null; | ||
const maxPriorityFeePerGas = tx.maxPriorityFeePerGas != null | ||
? (0, util_1.ensureBN)(tx.maxPriorityFeePerGas) | ||
: null; | ||
const gasLimit = tx.gas != null ? (0, util_1.ensureBN)(tx.gas) : null; | ||
@@ -510,0 +520,0 @@ const chainId = this.getChainId(); |
@@ -25,3 +25,3 @@ import { EthereumAddressFromSignedMessageRequest, SignEthereumMessageRequest, SignEthereumTransactionRequest, SubmitEthereumTransactionRequest } from "../relay/Web3Request"; | ||
}): void; | ||
watchAsset(options: { | ||
watchAsset(_options: { | ||
onCancel: () => void; | ||
@@ -35,3 +35,3 @@ onApprove: () => void; | ||
}): void; | ||
switchEthereumChain(options: { | ||
switchEthereumChain(_options: { | ||
onCancel: () => void; | ||
@@ -71,3 +71,3 @@ onApprove: () => void; | ||
inlineAccountsResponse(): boolean; | ||
inlineAddEthereumChain(chainId: string): boolean; | ||
inlineAddEthereumChain(_chainId: string): boolean; | ||
inlineWatchAsset(): boolean; | ||
@@ -74,0 +74,0 @@ inlineSwitchEthereumChain(): boolean; |
@@ -44,8 +44,6 @@ "use strict"; | ||
} | ||
// @ts-ignore | ||
watchAsset(options) { | ||
watchAsset(_options) { | ||
// no-op | ||
} | ||
// @ts-ignore | ||
switchEthereumChain(options) { | ||
switchEthereumChain(_options) { | ||
// no-op | ||
@@ -126,4 +124,3 @@ } | ||
} | ||
// @ts-ignore | ||
inlineAddEthereumChain(chainId) { | ||
inlineAddEthereumChain(_chainId) { | ||
return false; | ||
@@ -130,0 +127,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Observable } from 'rxjs'; | ||
import { Observable } from "rxjs"; | ||
/** | ||
@@ -3,0 +3,0 @@ * |
@@ -20,3 +20,3 @@ "use strict"; | ||
const ivBytes = crypto.getRandomValues(new Uint8Array(12)); | ||
const secretKey = await crypto.subtle.importKey("raw", (0, util_1.hexStringToUint8Array)(secret), { "name": "aes-gcm" }, false, ["encrypt", "decrypt"]); | ||
const secretKey = await crypto.subtle.importKey("raw", (0, util_1.hexStringToUint8Array)(secret), { name: "aes-gcm" }, false, ["encrypt", "decrypt"]); | ||
const enc = new TextEncoder(); | ||
@@ -33,3 +33,7 @@ // Will return encrypted plainText with auth tag (ie MAC or checksum) appended at the end | ||
const encryptedPlaintextBytes = new Uint8Array(encryptedPlaintext); | ||
const concatted = new Uint8Array([...ivBytes, ...authTagBytes, ...encryptedPlaintextBytes]); | ||
const concatted = new Uint8Array([ | ||
...ivBytes, | ||
...authTagBytes, | ||
...encryptedPlaintextBytes | ||
]); | ||
return (0, util_1.uint8ArrayToHex)(concatted); | ||
@@ -47,5 +51,5 @@ } | ||
throw Error(`secret must be 256 bits`); | ||
return new rxjs_1.Observable((subscriber) => { | ||
return new rxjs_1.Observable(subscriber => { | ||
void (async function () { | ||
const secretKey = await crypto.subtle.importKey("raw", (0, util_1.hexStringToUint8Array)(secret), { "name": "aes-gcm" }, false, ["encrypt", "decrypt"]); | ||
const secretKey = await crypto.subtle.importKey("raw", (0, util_1.hexStringToUint8Array)(secret), { name: "aes-gcm" }, false, ["encrypt", "decrypt"]); | ||
const encrypted = (0, util_1.hexStringToUint8Array)(cipherText); | ||
@@ -55,3 +59,6 @@ const ivBytes = encrypted.slice(0, 12); | ||
const encryptedPlaintextBytes = encrypted.slice(28); | ||
const concattedBytes = new Uint8Array([...encryptedPlaintextBytes, ...authTagBytes]); | ||
const concattedBytes = new Uint8Array([ | ||
...encryptedPlaintextBytes, | ||
...authTagBytes | ||
]); | ||
const algo = { | ||
@@ -58,0 +65,0 @@ name: "AES-GCM", |
@@ -21,3 +21,3 @@ "use strict"; | ||
function uint8ArrayToHex(value) { | ||
return [...value].map(b => b.toString(16).padStart(2, '0')).join(''); | ||
return [...value].map(b => b.toString(16).padStart(2, "0")).join(""); | ||
} | ||
@@ -24,0 +24,0 @@ exports.uint8ArrayToHex = uint8ArrayToHex; |
@@ -1,1 +0,1 @@ | ||
export declare const LIB_VERSION = "3.0.4"; | ||
export declare const LIB_VERSION = "3.0.5"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LIB_VERSION = void 0; | ||
exports.LIB_VERSION = "3.0.4"; | ||
exports.LIB_VERSION = "3.0.5"; |
{ | ||
"name": "@coinbase/wallet-sdk", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "Coinbase Wallet JavaScript SDK", | ||
@@ -26,3 +26,2 @@ "keywords": [ | ||
"scripts": { | ||
"tsc": "tsc --noEmit --pretty", | ||
"test": "yarn build-npm && karma start", | ||
@@ -35,4 +34,8 @@ "prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts", | ||
"build:prod": "yarn prebuild && yarn build && yarn build-npm && cp ./package.json ./README.md ./LICENSE build/npm && cp -a src/vendor-js build/npm/dist && sed -i.bak 's| \"private\": true,||g' build/npm/package.json && rm -f build/npm/package.json.bak", | ||
"lint": "eslint ./src --ext .ts,.tsx", | ||
"lint:watch": "nodemon -e ts,tsx,js,json,css,scss,svg --watch src/ --exec 'yarn tsc && yarn lint'" | ||
"lint:types": "tsc --noEmit", | ||
"lint:prettier": "prettier --check \"{src,__tests__}/**/*.(js|ts|tsx)\"", | ||
"lint:eslint": "eslint ./src --ext .ts,.tsx", | ||
"fix:eslint": "yarn lint:eslint --fix", | ||
"fix:prettier": "prettier . --write", | ||
"pretest": "yarn lint:eslint && yarn lint:types && yarn lint:prettier" | ||
}, | ||
@@ -39,0 +42,0 @@ |
131
README.md
# Coinbase Wallet SDK | ||
Coinbase Wallet SDK (formerly WalletLink) lets developers connect their dapps to Coinbase Wallet | ||
on both mobile web (for iOS and Android) and desktop: | ||
on both mobile web (for iOS and Android) and desktop: | ||
- **Mobile**: Users can connect to your mobile web dapp through a deeplink to the | ||
dapp browser in Coinbase Wallet Mobile App. | ||
- **Mobile**: Users can connect to your mobile web dapp through a deeplink to the | ||
dapp browser in Coinbase Wallet Mobile App. | ||
- **Desktop**: Users can connect to your desktop app with a QR code in the | ||
Coinbase Wallet Mobile App or with the Coinbase Wallet Chrome Extension. | ||
- **Desktop**: Users can connect to your desktop app with a QR code in the | ||
Coinbase Wallet Mobile App or with the Coinbase Wallet Chrome Extension. | ||
Wallet SDK is open-source and uses minimal dependencies for maximum security | ||
and no code bloat. Simply drop a few lines of code into your dapp and Wallet | ||
SDK takes care of the rest. | ||
Wallet SDK is open-source and uses minimal dependencies for maximum security | ||
and no code bloat. Simply drop a few lines of code into your dapp and Wallet | ||
SDK takes care of the rest. | ||
## Getting started | ||
- This readme cointains brief instructions to get up and running. | ||
- Visit our [public developer docs](https://docs.cloud.coinbase.com/wallet-sdk/docs) for more detail, including samples for integating Coinbase Wallet using libraries like [web3-react](https://github.com/NoahZinsmeister/web3-react), [web3modal](https://github.com/Web3Modal/web3modal), [Web3-Onboard](https://docs.blocknative.com/onboard), and [wagmi](https://wagmi.sh/). | ||
## Installing and Upgrading | ||
@@ -22,5 +27,4 @@ | ||
Install Coinbase Wallet SDK with yarn or npm. | ||
Install Coinbase Wallet SDK with yarn or npm. | ||
#### Yarn | ||
@@ -41,3 +45,3 @@ | ||
3. Check your installed version. | ||
3. Check your installed version. | ||
@@ -63,3 +67,3 @@ ```shell | ||
3. Check your installed version. | ||
3. Check your installed version. | ||
@@ -72,3 +76,3 @@ ```shell | ||
Upgrade Coinbase Wallet SDK with yarn or npm. | ||
Upgrade Coinbase Wallet SDK with yarn or npm. | ||
@@ -91,3 +95,3 @@ #### Yarn | ||
1. Compare your installed version of Coinbase Wallet SDK with the latest available version. | ||
1. Compare your installed version of Coinbase Wallet SDK with the latest available version. | ||
@@ -98,3 +102,3 @@ ```shell | ||
2. If necessary, update `package.json` with the latest major version. | ||
2. If necessary, update `package.json` with the latest major version. | ||
@@ -117,16 +121,16 @@ ```shell | ||
> Instructions are in [TypeScript](https://www.typescriptlang.org/). The usage | ||
is the same in JavaScript, except for the occasional TypeScript type | ||
annotation such as `string[]` or `as any`. | ||
> Instructions are in [TypeScript](https://www.typescriptlang.org/). The usage | ||
> is the same in JavaScript, except for the occasional TypeScript type | ||
> annotation such as `string[]` or `as any`. | ||
```typescript | ||
// TypeScript | ||
import CoinbaseWalletSDK from '@coinbase/wallet-sdk' | ||
import Web3 from 'web3' | ||
import CoinbaseWalletSDK from "@coinbase/wallet-sdk"; | ||
import Web3 from "web3"; | ||
const APP_NAME = 'My Awesome App' | ||
const APP_LOGO_URL = 'https://example.com/logo.png' | ||
const DEFAULT_ETH_JSONRPC_URL = 'https://mainnet.infura.io/v3/<YOUR_INFURA_API_KEY>' | ||
const DEFAULT_CHAIN_ID = 1 | ||
const APP_NAME = "My Awesome App"; | ||
const APP_LOGO_URL = "https://example.com/logo.png"; | ||
const DEFAULT_ETH_JSONRPC_URL = | ||
"https://mainnet.infura.io/v3/<YOUR_INFURA_API_KEY>"; | ||
const DEFAULT_CHAIN_ID = 1; | ||
@@ -138,13 +142,16 @@ // Initialize Coinbase Wallet SDK | ||
darkMode: false | ||
}) | ||
}); | ||
// Initialize a Web3 Provider object | ||
export const ethereum = coinbaseWallet.makeWeb3Provider(DEFAULT_ETH_JSONRPC_URL, DEFAULT_CHAIN_ID) | ||
export const ethereum = coinbaseWallet.makeWeb3Provider( | ||
DEFAULT_ETH_JSONRPC_URL, | ||
DEFAULT_CHAIN_ID | ||
); | ||
// Initialize a Web3 object | ||
export const web3 = new Web3(ethereum as any) | ||
export const web3 = new Web3(ethereum as any); | ||
``` | ||
Coinbase Wallet SDK uses an rpcUrl provided by Coinbase Wallet clients | ||
regardless of the rpcUrl passed into `makeWeb3Provider` for whitelisted | ||
Coinbase Wallet SDK uses an rpcUrl provided by Coinbase Wallet clients | ||
regardless of the rpcUrl passed into `makeWeb3Provider` for whitelisted | ||
networks. Wallet SDK needs an rpcUrl to be provided by the dapp as a fallback. | ||
@@ -156,3 +163,3 @@ | ||
Use [EIP-1102](https://eips.ethereum.org/EIPS/eip-1102) to obtain authorization and get Ethereum accounts. Invoking EIP-1102 shows a QR code dialog if the user's mobile wallet is not already connected to your app. | ||
Use [EIP-1102](https://eips.ethereum.org/EIPS/eip-1102) to obtain authorization and get Ethereum accounts. Invoking EIP-1102 shows a QR code dialog if the user's mobile wallet is not already connected to your app. | ||
@@ -163,24 +170,23 @@ The following code runs in response to a user-initiated action such as clicking a button to ensure the pop up is not blocked by the browser. | ||
// Use eth_requestAccounts | ||
ethereum.request('eth_requestAccounts').then((accounts: string[]) => { | ||
console.log(`User's address is ${accounts[0]}`) | ||
ethereum.request("eth_requestAccounts").then((accounts: string[]) => { | ||
console.log(`User's address is ${accounts[0]}`); | ||
// Optionally, have the default account set for web3.js | ||
web3.eth.defaultAccount = accounts[0] | ||
}) | ||
web3.eth.defaultAccount = accounts[0]; | ||
}); | ||
// Alternatively, you can use ethereum.enable() | ||
ethereum.enable().then((accounts: string[]) => { | ||
console.log(`User's address is ${accounts[0]}`) | ||
web3.eth.defaultAccount = accounts[0] | ||
}) | ||
console.log(`User's address is ${accounts[0]}`); | ||
web3.eth.defaultAccount = accounts[0]; | ||
}); | ||
``` | ||
Once the user obtains authorization, the Web3 object (`web3`) and the Web3 | ||
Once the user obtains authorization, the Web3 object (`web3`) and the Web3 | ||
Provider (`ethereum`) are ready to be used. | ||
> If you were using `ethereum.on("accountsChanged")`, remove it and obtain | ||
addresses with EIP-1102 callbacks instead. It was removed to improve | ||
compatibility with the latest web3.js. | ||
> If you were using `ethereum.on("accountsChanged")`, remove it and obtain | ||
> addresses with EIP-1102 callbacks instead. It was removed to improve | ||
> compatibility with the latest web3.js. | ||
## Switching / Adding Alternative EVM-Compatible Chains | ||
@@ -194,6 +200,6 @@ | ||
Current whitelisted networks: | ||
Current whitelisted networks: | ||
| Whitelisted Networks | | ||
|:----------------------------| | ||
| :-------------------------- | | ||
| Arbitrum | | ||
@@ -230,3 +236,3 @@ | Arbitrum Rinkeby | | ||
params: [{ chainId: '0xA86A' }] | ||
}) | ||
}) | ||
``` | ||
@@ -250,5 +256,5 @@ | ||
Many dapps attempt to switch to a network with `wallet_switchEthereumChain`, | ||
determine if the network is supported by the wallet based on the error code, | ||
and follow with a `wallet_addEthereumChain` request if the network is not | ||
Many dapps attempt to switch to a network with `wallet_switchEthereumChain`, | ||
determine if the network is supported by the wallet based on the error code, | ||
and follow with a `wallet_addEthereumChain` request if the network is not | ||
supported. Here's an example: | ||
@@ -286,9 +292,9 @@ | ||
interface WatchAssetParameters { | ||
type: string // The asset's interface, e.g. 'ERC20' | ||
type: string; // The asset's interface, e.g. 'ERC20' | ||
options: { | ||
address: string // The hexadecimal Ethereum address of the token contract | ||
symbol?: string // A ticker symbol or shorthand, up to 5 alphanumerical characters | ||
decimals?: number // The number of asset decimals | ||
image?: string // A string url of the token logo | ||
} | ||
address: string; // The hexadecimal Ethereum address of the token contract | ||
symbol?: string; // A ticker symbol or shorthand, up to 5 alphanumerical characters | ||
decimals?: number; // The number of asset decimals | ||
image?: string; // A string url of the token logo | ||
}; | ||
} | ||
@@ -338,5 +344,5 @@ ``` | ||
```typescript | ||
coinbaseWallet.disconnect() | ||
coinbaseWallet.disconnect(); | ||
// is the same as the following: | ||
ethereum.close() | ||
ethereum.close(); | ||
``` | ||
@@ -373,6 +379,7 @@ | ||
## Attributions | ||
* [Eth-json-rpc-filters](https://github.com/MetaMask/eth-json-rpc-filters/blob/main/LICENSE) under the ISC license | ||
* [Safe-event-emitter](https://github.com/MetaMask/safe-event-emitter/blob/master/LICENSE) under the ISC license | ||
* [Json-rpc-engine](https://github.com/MetaMask/json-rpc-engine/blob/main/LICENSE) under the ISC license | ||
* [Eth-rpc-errors](https://github.com/MetaMask/eth-rpc-errors/blob/main/LICENSE) under the MIT license | ||
* [Eth-block-tracker](https://github.com/MetaMask/eth-block-tracker/blob/master/LICENSE) under the MIT license | ||
- [Eth-json-rpc-filters](https://github.com/MetaMask/eth-json-rpc-filters/blob/main/LICENSE) under the ISC license | ||
- [Safe-event-emitter](https://github.com/MetaMask/safe-event-emitter/blob/master/LICENSE) under the ISC license | ||
- [Json-rpc-engine](https://github.com/MetaMask/json-rpc-engine/blob/main/LICENSE) under the ISC license | ||
- [Eth-rpc-errors](https://github.com/MetaMask/eth-rpc-errors/blob/main/LICENSE) under the MIT license | ||
- [Eth-block-tracker](https://github.com/MetaMask/eth-block-tracker/blob/master/LICENSE) under the MIT license |
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
360016
7071
370