@coinbase/cdp-react 0.0.63 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,6 +13,11 @@ the CDP frontend SDK.
13
13
  - {@link FundModal | FundModal} - a button that triggers a modal with the fund flow
14
14
  - {@link LinkAuth | LinkAuth} - a component to link or unlink auth methods
15
15
  - {@link LinkAuthModal | LinkAuthModal} - a button that triggers a modal with the link / unlink flow
16
+ - {@link CopyAddress | CopyAddress} - a component that renders a truncated address with a copy button
17
+ - {@link CopyEvmKeyButton | CopyEvmKeyButton} - a button for copying the private key of a user's EVM EOA address
18
+ - {@link CopySolanaKeyButton | CopySolanaKeyButton} - a button for copying the private key of a user's Solana address
19
+ - {@link ExportWallet | ExportWallet} - a component for exporting a user's wallet; includes a title, a warning about keeping private keys secure, the CopyAddress component, and either the CopyEvmKeyButton or CopySolanaKeyButton depending on the type of address provided
20
+ - {@link ExportWalletModal | ExportWalletModal} - a button that triggers a modal with the ExportWallet component
16
21
 
17
22
  ## Quickstart
18
23
 
@@ -1 +1 @@
1
- .ExportWallet-module__export-wallet___EyZys{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;gap:1em;padding:1.5em 1.5em 1em;overflow:hidden;width:100%}.ExportWallet-module__export-wallet___EyZys *{box-sizing:border-box}.ExportWallet-module__export-wallet-title___MuI09{font-size:1em;line-height:1.1;font-weight:600;margin:0}.ExportWallet-module__footer___NvrFY{padding-left:0;padding-right:0}
1
+ .ExportWallet-module__export-wallet___EyZys{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;gap:1em;padding:1.5em 1.5em 1em;overflow:hidden;width:100%}.ExportWallet-module__export-wallet___EyZys.ExportWallet-module__no-footer___fzl3R{padding-bottom:1.5em}.ExportWallet-module__export-wallet___EyZys [data-part=iframe-button]{margin:-.25em;width:calc(100% + .5em)}.ExportWallet-module__export-wallet___EyZys *{box-sizing:border-box}.ExportWallet-module__export-wallet-title___MuI09{font-size:1em;line-height:1.1;font-weight:600;margin:0}.ExportWallet-module__footer___NvrFY{padding-left:0;padding-right:0}.ExportWalletModal-module__export-wallet___--L56{height:100%;overflow:hidden;gap:0}.ExportWalletModal-module__trigger___zMk8N{padding-left:2em;padding-right:2em}.ExportWalletModal-module__title-bar___RTPZq{display:flex;justify-content:space-between;align-items:center;margin-bottom:1em;width:100%}.ExportWalletModal-module__content___KzNol{display:flex;flex-direction:column;gap:1em}.ExportWalletModal-module__close-button___ImsDR{padding:0}.ExportWalletModal-module__close-icon___iAfyT{height:1.5em;width:1.5em}.ExportWalletModal-module__footer___byg1T{padding:.75em 0 0}@media (min-width: 450px){.ExportWalletModal-module__modal___pX1AP{max-width:25em}}
@@ -1 +1 @@
1
- .IframeButton-module__iframe-button___XeAhH{position:relative;width:min-content;height:3.5em;padding-left:2.5em;padding-right:2.5em}.IframeButton-module__iframe-button___XeAhH>*{grid-area:center}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__full-width___lQWpM{width:100%}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-lg___HCOiF{height:4em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-md___p44a4{height:3.5em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-sm___U8ILi{padding-left:2em;padding-right:2em;height:3em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-xs___S2jGa{padding-left:1.5em;padding-right:1.5em;height:2.5em}.IframeButton-module__loading-skeleton___fzBol{border-radius:var(--cdp-web-borderRadius-cta);width:calc(100% - .5em);height:calc(100% - .5em);position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__label___Vvl8W{visibility:hidden;white-space:nowrap;position:relative}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__with-icon___KBiq1 .IframeButton-module__label___Vvl8W{padding-left:1em}.IframeButton-module__iframe___0RBLL{border:none;width:100%;height:100%;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__iframe___0RBLL.IframeButton-module__hidden___LcF1X{display:none}.IframeButton-module__computed-style___ciB13{position:absolute;visibility:hidden;pointer-events:none;background-color:var(--cdp-web-colors-page-bg-default);border-radius:var(--cdp-web-borderRadius-cta);font-size:var(--cdp-web-font-size-base);font-family:var(--cdp-web-font-family-cta);font-weight:500}
1
+ .IframeButton-module__iframe-button___XeAhH{position:relative;width:min-content;height:3.5em;padding-left:2.5em;padding-right:2.5em}.IframeButton-module__iframe-button___XeAhH>*{grid-area:center}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__full-width___lQWpM{width:100%}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-lg___HCOiF{height:4em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-md___p44a4{height:3.5em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-sm___U8ILi{padding-left:2em;padding-right:2em;height:3em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-xs___S2jGa{padding-left:1.5em;padding-right:1.5em;height:2.5em}.IframeButton-module__loading-skeleton___fzBol{border-radius:var(--cdp-web-borderRadius-cta);width:calc(100% - .5em);height:calc(100% - .5em);position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__label___Vvl8W{visibility:hidden;white-space:nowrap;position:relative}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__with-icon___KBiq1 .IframeButton-module__label___Vvl8W{padding-left:1em}.IframeButton-module__iframe___0RBLL{border:none;width:100%;height:100%;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__iframe___0RBLL.IframeButton-module__hidden___LcF1X{display:none}.IframeButton-module__computed-style___ciB13{position:absolute;visibility:hidden;pointer-events:none;background-color:var(--cdp-web-colors-page-bg-default);border-radius:var(--cdp-web-borderRadius-cta);font-size:var(--cdp-web-font-size-base);font-family:var(--cdp-web-font-family-cta);font-weight:500;top:-999px;left:-999px;width:1px;height:1px}.IframeButton-module__computed-style___ciB13 canvas{width:100%;height:100%}
@@ -104,8 +104,8 @@ const ii = ({ children: t }) => {
104
104
  );
105
105
  };
106
106
  export {
107
- ii as L,
108
- K as a,
107
+ K as L,
108
+ ii as a,
109
109
  f as b,
110
110
  $ as u
111
111
  };
@@ -5,4 +5,4 @@ export interface CopyAddressProps extends Omit<HTMLAttributes<HTMLDivElement>, "
5
5
  onCopy?: () => void;
6
6
  onCopySuccess?: () => void;
7
7
  }
8
- export declare const CopyAddress: ({ className, address, label, onCopy, onCopySuccess, }: CopyAddressProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const CopyAddress: ({ className, address, label, onCopy, onCopySuccess, ...props }: CopyAddressProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,25 +1,26 @@
1
1
  import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
- import { c as _ } from "../../chunks/lite.1fxw3LjI.js";
3
- import { useRef as u, useState as m, useCallback as y } from "react";
4
- import { Label as C } from "../forms/Label/index.js";
5
- import { IconCheck as b } from "../../icons/IconCheck.js";
6
- import { IconCopy as f } from "../../icons/IconCopy.js";
7
- import '../../assets/CopyAddress.css';const h = "CopyAddress-module__label___O2o5m", e = {
2
+ import { c as u } from "../../chunks/lite.1fxw3LjI.js";
3
+ import { useRef as m, useState as y, useCallback as C } from "react";
4
+ import { Label as b } from "../forms/Label/index.js";
5
+ import { IconCheck as f } from "../../icons/IconCheck.js";
6
+ import { IconCopy as h } from "../../icons/IconCopy.js";
7
+ import '../../assets/CopyAddress.css';const A = "CopyAddress-module__label___O2o5m", e = {
8
8
  "address-copy": "CopyAddress-module__address-copy___KpKeI",
9
- label: h,
9
+ label: A,
10
10
  "address-input-container": "CopyAddress-module__address-input-container___qq0TH",
11
11
  "address-truncated": "CopyAddress-module__address-truncated___kr8St",
12
12
  "copy-button": "CopyAddress-module__copy-button___64o2y",
13
13
  "success-icon": "CopyAddress-module__success-icon___qXipU",
14
14
  "copy-icon": "CopyAddress-module__copy-icon___lUbYG"
15
- }, w = ({
15
+ }, T = ({
16
16
  className: l = "",
17
17
  address: s,
18
18
  label: r,
19
19
  onCopy: t,
20
- onCopySuccess: d
20
+ onCopySuccess: d,
21
+ ...i
21
22
  }) => {
22
- const i = u(null), [p, a] = m(!1), n = y(() => {
23
+ const p = m(null), [_, a] = y(!1), n = C(() => {
23
24
  if (s) {
24
25
  t?.();
25
26
  try {
@@ -28,15 +29,15 @@ import '../../assets/CopyAddress.css';const h = "CopyAddress-module__label___O2o
28
29
  else
29
30
  throw new Error("Clipboard API not supported");
30
31
  } catch {
31
- i.current?.select(), document.execCommand("copy");
32
+ p.current?.select(), document.execCommand("copy");
32
33
  }
33
34
  a(!0), setTimeout(() => {
34
35
  a(!1);
35
36
  }, 2e3), d?.();
36
37
  }
37
38
  }, [s, t, d]);
38
- return /* @__PURE__ */ c("div", { className: _(e["address-copy"], l), children: [
39
- r && /* @__PURE__ */ o(C, { as: "span", className: e.label, children: r }),
39
+ return /* @__PURE__ */ c("div", { className: u(e["address-copy"], l), ...i, children: [
40
+ r && /* @__PURE__ */ o(b, { as: "span", className: e.label, children: r }),
40
41
  /* @__PURE__ */ c("div", { className: e["address-input-container"], onClick: n, children: [
41
42
  /* @__PURE__ */ c("span", { className: e["address-truncated"], children: [
42
43
  s.slice(0, 6),
@@ -50,12 +51,12 @@ import '../../assets/CopyAddress.css';const h = "CopyAddress-module__label___O2o
50
51
  "aria-label": "copy address",
51
52
  onClick: n,
52
53
  className: e["copy-button"],
53
- children: p ? /* @__PURE__ */ o(b, { className: e["success-icon"] }) : /* @__PURE__ */ o(f, { className: e["copy-icon"] })
54
+ children: _ ? /* @__PURE__ */ o(f, { className: e["success-icon"] }) : /* @__PURE__ */ o(h, { className: e["copy-icon"] })
54
55
  }
55
56
  )
56
57
  ] })
57
58
  ] });
58
59
  };
59
60
  export {
60
- w as CopyAddress
61
+ T as CopyAddress
61
62
  };
@@ -13,4 +13,4 @@ interface CopyEvmKeyButtonProps extends Pick<ButtonProps, "size" | "fullWidth">
13
13
  variant?: Extract<ButtonProps["variant"], "primary" | "secondary">;
14
14
  }
15
15
  declare const CopyEvmKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSuccess, onError, size, theme: themeOverrides, variant, }: CopyEvmKeyButtonProps) => import("react/jsx-runtime").JSX.Element;
16
- export { CopyEvmKeyButton as unstable_CopyEvmKeyButton, type CopyEvmKeyButtonProps as unstable_CopyEvmKeyButtonProps, };
16
+ export { CopyEvmKeyButton, type CopyEvmKeyButtonProps };
@@ -1,63 +1,63 @@
1
- import { jsx as x } from "react/jsx-runtime";
2
- import { useConfig as E } from "@coinbase/cdp-hooks";
3
- import { useRef as I, useState as K, useCallback as T, useEffect as j } from "react";
1
+ import { jsx as B } from "react/jsx-runtime";
2
+ import { useConfig as I } from "@coinbase/cdp-hooks";
3
+ import { useRef as T, useState as j, useCallback as k, useEffect as w } from "react";
4
4
  import "../ui/Button/index.js";
5
- import { IframeButton as k } from "../ui/IframeButton/index.js";
6
- import { useKeyExportPostMessage as w } from "../../hooks/useKeyExportPostMessage.js";
5
+ import { IframeButton as E } from "../ui/IframeButton/index.js";
6
+ import { useKeyExportPostMessage as K } from "../../hooks/useKeyExportPostMessage.js";
7
7
  import "@coinbase/cdp-core";
8
- const A = ({
9
- address: n,
10
- className: p = "",
11
- copiedLabel: u = "Copied",
12
- icon: o = !0,
13
- fullWidth: c,
14
- label: r = "Copy key",
8
+ const D = ({
9
+ address: p,
10
+ className: n = "",
11
+ copiedLabel: c = "Copied",
12
+ icon: r = !0,
13
+ fullWidth: u,
14
+ label: o = "Copy key",
15
15
  onReady: m,
16
- onSuccess: s,
17
- onError: i,
16
+ onSuccess: i,
17
+ onError: f,
18
18
  size: h,
19
19
  theme: d,
20
20
  variant: l
21
21
  }) => {
22
22
  const {
23
- config: { projectId: y, secureIframeBasePath: C }
24
- } = E(), f = I(null), [e, g] = K(void 0), b = T(
25
- (t, P) => {
26
- t === "ready" && m?.(), t === "success" && s?.(), t === "error" && i?.(P);
23
+ config: { projectId: C, secureIframeBasePath: g }
24
+ } = I(), s = T(null), [e, y] = j(void 0), P = k(
25
+ (t, x) => {
26
+ t === "ready" && m?.(), t === "success" && i?.(), t === "error" && f?.(x);
27
27
  },
28
- [m, s, i]
29
- ), { iframeUrl: v, isPending: B, onThemeChange: a } = w({
30
- address: n,
28
+ [m, i, f]
29
+ ), { iframeUrl: b, isPending: v, onThemeChange: a } = K({
30
+ address: p,
31
31
  type: "evm",
32
- projectId: y,
33
- label: r,
34
- basePath: C,
35
- copiedLabel: u,
36
- icon: o,
37
- iframeRef: f,
38
- onStatusUpdate: b,
32
+ projectId: C,
33
+ label: o,
34
+ basePath: g,
35
+ copiedLabel: c,
36
+ icon: r,
37
+ iframeRef: s,
38
+ onStatusUpdate: P,
39
39
  theme: e
40
40
  });
41
- return j(() => {
41
+ return w(() => {
42
42
  e && a(e);
43
- }, [e, a]), /* @__PURE__ */ x(
44
- k,
43
+ }, [e, a]), /* @__PURE__ */ B(
44
+ E,
45
45
  {
46
- ref: f,
47
- src: v,
46
+ ref: s,
47
+ src: b,
48
48
  allow: "clipboard-read; clipboard-write",
49
- isPending: B,
50
- label: r,
51
- icon: o,
52
- fullWidth: c,
53
- onThemeChange: g,
49
+ isPending: v,
50
+ label: o,
51
+ icon: r,
52
+ fullWidth: u,
53
+ onThemeChange: y,
54
54
  size: h,
55
55
  theme: d,
56
56
  variant: l,
57
- className: p
57
+ className: n
58
58
  }
59
59
  );
60
60
  };
61
61
  export {
62
- A as unstable_CopyEvmKeyButton
62
+ D as CopyEvmKeyButton
63
63
  };
@@ -13,4 +13,4 @@ interface CopySolanaKeyButtonProps extends Pick<ButtonProps, "size" | "fullWidth
13
13
  variant?: Extract<ButtonProps["variant"], "primary" | "secondary">;
14
14
  }
15
15
  declare const CopySolanaKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSuccess, onError, size, theme: themeOverrides, variant, }: CopySolanaKeyButtonProps) => import("react/jsx-runtime").JSX.Element;
16
- export { CopySolanaKeyButton as unstable_CopySolanaKeyButton, type CopySolanaKeyButtonProps as unstable_CopySolanaKeyButtonProps, };
16
+ export { CopySolanaKeyButton, type CopySolanaKeyButtonProps };
@@ -1,63 +1,63 @@
1
1
  import { jsx as I } from "react/jsx-runtime";
2
- import { useConfig as K } from "@coinbase/cdp-hooks";
3
- import { useRef as S, useState as T, useCallback as j, useEffect as k } from "react";
2
+ import { useConfig as T } from "@coinbase/cdp-hooks";
3
+ import { useRef as j, useState as k, useCallback as w, useEffect as K } from "react";
4
4
  import "../ui/Button/index.js";
5
- import { IframeButton as w } from "../ui/IframeButton/index.js";
5
+ import { IframeButton as S } from "../ui/IframeButton/index.js";
6
6
  import { useKeyExportPostMessage as U } from "../../hooks/useKeyExportPostMessage.js";
7
7
  import "@coinbase/cdp-core";
8
- const A = ({
9
- address: f,
8
+ const D = ({
9
+ address: n,
10
10
  className: p = "",
11
- copiedLabel: u = "Copied",
11
+ copiedLabel: c = "Copied",
12
12
  icon: t = !0,
13
- fullWidth: c,
13
+ fullWidth: u,
14
14
  label: r = "Copy key",
15
- onReady: a,
16
- onSuccess: s,
17
- onError: m,
18
- size: l,
19
- theme: h,
15
+ onReady: m,
16
+ onSuccess: a,
17
+ onError: i,
18
+ size: h,
19
+ theme: l,
20
20
  variant: d
21
21
  }) => {
22
22
  const {
23
- config: { projectId: y, secureIframeBasePath: C }
24
- } = K(), i = S(null), [e, g] = T(void 0), b = j(
25
- (o, x) => {
26
- o === "ready" && a?.(), o === "success" && s?.(), o === "error" && m?.(x);
23
+ config: { projectId: C, secureIframeBasePath: g }
24
+ } = T(), s = j(null), [e, y] = k(void 0), P = w(
25
+ (o, B) => {
26
+ o === "ready" && m?.(), o === "success" && a?.(), o === "error" && i?.(B);
27
27
  },
28
- [a, s, m]
29
- ), { iframeUrl: B, isPending: P, onThemeChange: n } = U({
30
- address: f,
28
+ [m, a, i]
29
+ ), { iframeUrl: b, isPending: x, onThemeChange: f } = U({
30
+ address: n,
31
31
  type: "solana",
32
- projectId: y,
32
+ projectId: C,
33
33
  label: r,
34
- basePath: C,
35
- copiedLabel: u,
34
+ basePath: g,
35
+ copiedLabel: c,
36
36
  icon: t,
37
- iframeRef: i,
38
- onStatusUpdate: b,
37
+ iframeRef: s,
38
+ onStatusUpdate: P,
39
39
  theme: e
40
40
  });
41
- return k(() => {
42
- e && n(e);
43
- }, [e, n]), /* @__PURE__ */ I(
44
- w,
41
+ return K(() => {
42
+ e && f(e);
43
+ }, [e, f]), /* @__PURE__ */ I(
44
+ S,
45
45
  {
46
- ref: i,
47
- src: B,
46
+ ref: s,
47
+ src: b,
48
48
  allow: "clipboard-read; clipboard-write",
49
- isPending: P,
49
+ isPending: x,
50
50
  label: r,
51
51
  icon: t,
52
- fullWidth: c,
53
- onThemeChange: g,
54
- size: l,
55
- theme: h,
52
+ fullWidth: u,
53
+ onThemeChange: y,
54
+ size: h,
55
+ theme: l,
56
56
  variant: d,
57
57
  className: p
58
58
  }
59
59
  );
60
60
  };
61
61
  export {
62
- A as unstable_CopySolanaKeyButton
62
+ D as CopySolanaKeyButton
63
63
  };
@@ -1,6 +1,6 @@
1
1
  import { ElementType, HTMLAttributes } from 'react';
2
2
  import { CopyAddressProps } from '../CopyAddress';
3
- import { unstable_CopyEvmKeyButtonProps as CopyEvmKeyButtonProps } from '../CopyEvmKeyButton';
3
+ import { CopyEvmKeyButtonProps } from '../CopyEvmKeyButton';
4
4
  interface ExportWalletTitleProps extends HTMLAttributes<HTMLElement> {
5
5
  as?: ElementType;
6
6
  }
@@ -18,4 +18,4 @@ declare const ExportWalletCopyAddress: ({ label, ...props }: ExportWalletCopyAdd
18
18
  declare const ExportWalletCopyKeyButton: ({ fullWidth, ...props }: ExportWalletCopyKeyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
19
19
  declare const ExportWalletFooter: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
20
20
  declare const ExportWallet: ({ address, children, className, onIframeError, onIframeReady, onCopySuccess, ...props }: ExportWalletProps) => import("react/jsx-runtime").JSX.Element;
21
- export { ExportWallet as unstable_ExportWallet, ExportWalletCopyAddress as unstable_ExportWalletCopyAddress, ExportWalletCopyKeyButton as unstable_ExportWalletCopyKeyButton, ExportWalletFooter as unstable_ExportWalletFooter, ExportWalletTitle as unstable_ExportWalletTitle, ExportWalletWarning as unstable_ExportWalletWarning, type ExportWalletProps as unstable_ExportWalletProps, type ExportWalletCopyAddressProps as unstable_ExportWalletCopyAddressProps, type ExportWalletCopyKeyButtonProps as unstable_ExportWalletCopyKeyButtonProps, type ExportWalletTitleProps as unstable_ExportWalletTitleProps, };
21
+ export { ExportWallet, ExportWalletCopyAddress, ExportWalletCopyKeyButton, ExportWalletFooter, ExportWalletTitle, ExportWalletWarning, type ExportWalletProps, type ExportWalletCopyAddressProps, type ExportWalletCopyKeyButtonProps, type ExportWalletTitleProps, };