@coinbase/cdp-react 0.0.38 → 0.0.39

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
@@ -7,7 +7,8 @@ the CDP frontend SDK.
7
7
  - {@link SignIn | `SignIn`} - the forms for the sign in flow, a logo, heading, and description text
8
8
  - {@link SignOutButton | `SignOutButton`} - a sign out button
9
9
  - {@link AuthButton | `AuthButton`} - the `SignOutButton` when logged in, and the `SignInModal` when logged out
10
- - {@link SendTransactionButton | `SendTransactionButton`} - a button that signs and sends a transaction
10
+ - {@link SendEvmTransactionButton | `SendEvmTransactionButton`} - a button that signs and sends an EVM transaction
11
+ - {@link SendSolanaTransactionButton | `SendSolanaTransactionButton`} - a button that signs and sends a Solana transaction
11
12
  - {@link Fund | `Fund`} - the fund flow
12
13
  - {@link FundModal | `FundModal`} - a button that triggers a modal with the fund flow
13
14
 
@@ -0,0 +1 @@
1
+ .SendEvmTransactionButton-module__send-evm-transaction-button___74m57{padding-left:2em;padding-right:2em}
@@ -0,0 +1 @@
1
+ .SendSolanaTransactionButton-module__send-solana-transaction-button___OxwvB{padding-left:2em;padding-right:2em}
@@ -1,12 +1,11 @@
1
- import { jsx as T } from "react/jsx-runtime";
2
- import { useEvmAddress as U } from "@coinbase/cdp-hooks";
3
- import { createContext as R, useContext as b, useEffect as l, useMemo as M } from "react";
4
- import { useBuyUrl as g } from "./hooks/useBuyUrl.js";
5
- import { useEmitLifecycleStatus as k } from "./hooks/useEmitLifecycleStatus.js";
6
- import { useExchangeRate as H } from "./hooks/useExchangeRate.js";
7
- import { usePaymentMethods as N } from "./hooks/usePaymentMethods.js";
8
- import { useFundReducer as _ } from "./useFundReducer.js";
9
- const x = {
1
+ import { jsx as A } from "react/jsx-runtime";
2
+ import { createContext as E, useContext as R, useEffect as f, useMemo as b } from "react";
3
+ import { useBuyUrl as M } from "./hooks/useBuyUrl.js";
4
+ import { useEmitLifecycleStatus as g } from "./hooks/useEmitLifecycleStatus.js";
5
+ import { useExchangeRate as k } from "./hooks/useExchangeRate.js";
6
+ import { usePaymentMethods as H } from "./hooks/usePaymentMethods.js";
7
+ import { useFundReducer as N } from "./useFundReducer.js";
8
+ const h = {
10
9
  country: "US",
11
10
  cryptoCurrency: "ETH",
12
11
  cryptoDecimalPlaces: 8,
@@ -18,113 +17,118 @@ const x = {
18
17
  transactionStatus: {
19
18
  statusName: "init",
20
19
  statusData: null
21
- }
22
- }, C = R(void 0), G = ({
20
+ },
21
+ destinationAddress: ""
22
+ }, S = E(void 0), q = ({
23
23
  children: c,
24
- fetchBuyOptions: h,
25
- fetchBuyQuote: f,
26
- inputType: S,
24
+ fetchBuyOptions: v,
25
+ fetchBuyQuote: y,
26
+ inputType: D,
27
27
  onError: u,
28
- onStatus: D,
29
- onSuccess: F,
30
- ...I
28
+ onStatus: F,
29
+ onSuccess: I,
30
+ ...w
31
31
  }) => {
32
32
  const {
33
33
  country: t,
34
34
  cryptoCurrency: e,
35
- cryptoDecimalPlaces: a,
35
+ cryptoDecimalPlaces: i,
36
36
  fiatCurrency: s,
37
- fiatDecimalPlaces: i,
38
- locale: d,
39
- network: o,
40
- presetAmountInputs: m,
41
- redirectUrl: w,
42
- subdivision: r
43
- } = I, { evmAddress: A } = U(), [p, n] = _({
44
- ...x,
37
+ fiatDecimalPlaces: d,
38
+ locale: m,
39
+ network: n,
40
+ presetAmountInputs: p,
41
+ redirectUrl: T,
42
+ subdivision: o,
43
+ destinationAddress: a
44
+ } = w, [l, r] = N({
45
+ ...h,
45
46
  country: t,
46
47
  cryptoCurrency: e,
47
- cryptoDecimalPlaces: a,
48
+ cryptoDecimalPlaces: i,
48
49
  fiatCurrency: s,
49
- fiatDecimalPlaces: i,
50
- locale: d,
51
- network: o,
52
- presetAmountInputs: m,
53
- subdivision: r,
54
- selectedInputType: S || x.selectedInputType
50
+ fiatDecimalPlaces: d,
51
+ locale: m,
52
+ network: n,
53
+ presetAmountInputs: p,
54
+ subdivision: o,
55
+ destinationAddress: a,
56
+ selectedInputType: D || h.selectedInputType
55
57
  });
56
- l(() => {
57
- n({
58
+ f(() => {
59
+ r({
58
60
  type: "SYNC_WITH_PROPS",
59
61
  payload: {
60
62
  country: t,
61
63
  cryptoCurrency: e,
62
- cryptoDecimalPlaces: a,
64
+ cryptoDecimalPlaces: i,
63
65
  fiatCurrency: s,
64
- fiatDecimalPlaces: i,
65
- locale: d,
66
- network: o,
67
- presetAmountInputs: m,
68
- subdivision: r
66
+ fiatDecimalPlaces: d,
67
+ locale: m,
68
+ network: n,
69
+ presetAmountInputs: p,
70
+ subdivision: o,
71
+ destinationAddress: a
69
72
  }
70
73
  });
71
74
  }, [
72
75
  t,
73
76
  e,
74
- a,
75
- s,
76
77
  i,
78
+ s,
77
79
  d,
78
- o,
79
80
  m,
81
+ n,
82
+ p,
83
+ o,
80
84
  r,
81
- n
82
- ]), k({
83
- lifecycleStatus: p.transactionStatus,
85
+ a
86
+ ]), g({
87
+ lifecycleStatus: l.transactionStatus,
84
88
  onError: u,
85
- onStatus: D,
86
- onSuccess: F
89
+ onStatus: F,
90
+ onSuccess: I
87
91
  });
88
- const { fetchExchangeRate: y } = H({
92
+ const { fetchExchangeRate: P } = k({
89
93
  cryptoCurrency: e,
90
94
  country: t,
91
- dispatch: n,
92
- fetchBuyQuote: f,
95
+ dispatch: r,
96
+ fetchBuyQuote: y,
93
97
  fiatCurrency: s,
94
- network: o,
98
+ network: n,
95
99
  onError: u,
96
- subdivision: r
97
- }), { fetchPaymentMethods: P } = N({
100
+ subdivision: o
101
+ }), { fetchPaymentMethods: x } = H({
98
102
  country: t,
99
103
  cryptoCurrency: e,
100
- dispatch: n,
101
- fetchBuyOptions: h,
104
+ dispatch: r,
105
+ fetchBuyOptions: v,
102
106
  fiatCurrency: s,
103
- network: o,
107
+ network: n,
104
108
  onError: u,
105
- subdivision: r
106
- }), { fetchBuyUrl: v } = g({
109
+ subdivision: o
110
+ }), { fetchBuyUrl: C } = M({
107
111
  cryptoCurrency: e,
108
- destinationAddress: A || void 0,
109
112
  fiatCurrency: s,
110
- fetchBuyQuote: f,
113
+ fetchBuyQuote: y,
111
114
  country: t,
112
- network: o,
113
- redirectUrl: w,
114
- subdivision: r
115
- }), E = M(() => ({ state: p, dispatch: n, fetchBuyUrl: v }), [p, n, v]);
116
- return l(() => {
117
- y();
118
- }, [y]), l(() => {
115
+ network: n,
116
+ redirectUrl: T,
117
+ subdivision: o,
118
+ destinationAddress: a
119
+ }), U = b(() => ({ state: l, dispatch: r, fetchBuyUrl: C }), [l, r, C]);
120
+ return f(() => {
119
121
  P();
120
- }, [P]), /* @__PURE__ */ T(C.Provider, { value: E, children: c });
121
- }, J = () => {
122
- const c = b(C);
122
+ }, [P]), f(() => {
123
+ x();
124
+ }, [x]), /* @__PURE__ */ A(S.Provider, { value: U, children: c });
125
+ }, z = () => {
126
+ const c = R(S);
123
127
  if (!c)
124
128
  throw new Error("useFundContext must be used within a FundProvider");
125
129
  return c;
126
130
  };
127
131
  export {
128
- G as FundProvider,
129
- J as useFundContext
132
+ q as FundProvider,
133
+ z as useFundContext
130
134
  };
@@ -1,8 +1,7 @@
1
1
  import { OnrampError, FundProps, FundState } from '../types';
2
- export type UseBuyUrlParams = Pick<FundState, "country" | "cryptoCurrency" | "fiatCurrency" | "network" | "subdivision"> & {
2
+ export type UseBuyUrlParams = Pick<FundState, "country" | "cryptoCurrency" | "fiatCurrency" | "network" | "subdivision" | "destinationAddress"> & {
3
3
  fetchBuyQuote: FundProps["fetchBuyQuote"];
4
4
  onError?: (e: OnrampError | undefined) => void;
5
- destinationAddress?: string;
6
5
  redirectUrl?: string;
7
6
  };
8
7
  export interface FetchBuyUrlParams {
@@ -8,29 +8,29 @@ const _ = (o) => {
8
8
  }, h = ({
9
9
  country: o,
10
10
  cryptoCurrency: a,
11
- destinationAddress: n,
11
+ destinationAddress: c,
12
12
  fetchBuyQuote: u,
13
13
  fiatCurrency: p,
14
- network: U,
15
- onError: c,
16
- redirectUrl: t,
14
+ network: d,
15
+ onError: n,
16
+ redirectUrl: s,
17
17
  subdivision: i
18
18
  }) => {
19
- const l = y(
20
- async ({ paymentMethod: d, paymentAmount: m }, f) => {
21
- if (isNaN(m) || !n || !d)
19
+ const U = y(
20
+ async ({ paymentMethod: l, paymentAmount: m }, f) => {
21
+ if (isNaN(m) || !l)
22
22
  return "";
23
23
  try {
24
24
  const e = (await u({
25
25
  purchaseCurrency: a.toUpperCase(),
26
- purchaseNetwork: U.toLowerCase(),
26
+ purchaseNetwork: d.toLowerCase(),
27
27
  paymentCurrency: p.toUpperCase(),
28
28
  paymentAmount: m.toFixed(),
29
- paymentMethod: d.replace("_GUEST", ""),
29
+ paymentMethod: l.replace("_GUEST", ""),
30
30
  // remove "_GUEST" from the payment method since it is not valid in the Buy Quote API
31
31
  country: o.toUpperCase(),
32
32
  subdivision: i?.toUpperCase(),
33
- destinationAddress: n
33
+ destinationAddress: c
34
34
  })).onrampUrl;
35
35
  if (!e) {
36
36
  const r = {
@@ -38,39 +38,39 @@ const _ = (o) => {
38
38
  code: "NO_ONRAMP_URL",
39
39
  debugMessage: "No payment methods found for the selected country and currency. See docs for more information: https://docs.cdp.coinbase.com/onramp/docs/api-configurations"
40
40
  };
41
- return f?.(r), c?.(r), "";
41
+ return f?.(r), n?.(r), "";
42
42
  }
43
- if (t && _(t)) {
43
+ if (s && _(s)) {
44
44
  const r = new URL(e);
45
- return r.searchParams.set("redirectUrl", t), r.toString();
45
+ return r.searchParams.set("redirectUrl", s), r.toString();
46
46
  }
47
47
  return e;
48
- } catch (s) {
48
+ } catch (t) {
49
49
  let e;
50
- return s instanceof Error ? e = {
50
+ return t instanceof Error ? e = {
51
51
  errorType: "handled_error",
52
52
  code: "BUY_URL_ERROR",
53
- debugMessage: s.message
53
+ debugMessage: t.message
54
54
  } : e = {
55
55
  errorType: "unknown_error",
56
56
  code: "UNKNOWN_BUY_URL_ERROR",
57
- debugMessage: JSON.stringify(s)
58
- }, f?.(e), c?.(e), "";
57
+ debugMessage: JSON.stringify(t)
58
+ }, f?.(e), n?.(e), "";
59
59
  }
60
60
  },
61
61
  [
62
62
  o,
63
63
  a,
64
- n,
64
+ c,
65
65
  u,
66
66
  p,
67
- U,
68
- c,
69
- t,
67
+ d,
68
+ n,
69
+ s,
70
70
  i
71
71
  ]
72
72
  );
73
- return R(() => ({ fetchBuyUrl: l }), [l]);
73
+ return R(() => ({ fetchBuyUrl: U }), [U]);
74
74
  };
75
75
  export {
76
76
  h as useBuyUrl
@@ -100,8 +100,9 @@ export interface FundState {
100
100
  selectedPaymentMethod?: FundPaymentMethod;
101
101
  subdivision?: string;
102
102
  transactionStatus: FundLifecycleStatus;
103
+ destinationAddress: string;
103
104
  }
104
- export type FundStateProps = Pick<FundState, "country" | "cryptoCurrency" | "cryptoDecimalPlaces" | "fiatCurrency" | "fiatDecimalPlaces" | "locale" | "network" | "presetAmountInputs" | "subdivision">;
105
+ export type FundStateProps = Pick<FundState, "country" | "cryptoCurrency" | "cryptoDecimalPlaces" | "fiatCurrency" | "fiatDecimalPlaces" | "locale" | "network" | "presetAmountInputs" | "subdivision" | "destinationAddress">;
105
106
  export interface FundProps extends FundStateProps, FundLifecycleEvents {
106
107
  children?: ReactNode | ((state: FundState) => ReactNode);
107
108
  className?: string;
@@ -1,7 +1,7 @@
1
1
  import { APIError, SendEvmTransactionOptions } from '@coinbase/cdp-hooks';
2
2
  import { ButtonHTMLAttributes, ReactNode } from 'react';
3
3
  import { ButtonVariant } from '../../theme/theme';
4
- export interface SendTransactionButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onError"> {
4
+ export interface SendEvmTransactionButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onError"> {
5
5
  account: SendEvmTransactionOptions["evmAccount"];
6
6
  network: SendEvmTransactionOptions["network"];
7
7
  onError?: (error: APIError | Error) => void;
@@ -10,4 +10,4 @@ export interface SendTransactionButtonProps extends Omit<ButtonHTMLAttributes<HT
10
10
  transaction: SendEvmTransactionOptions["transaction"];
11
11
  variant?: ButtonVariant;
12
12
  }
13
- export declare const SendTransactionButton: ({ account, children, className, network, onClick, onError, onSuccess, pendingLabel, transaction, variant, ...props }: SendTransactionButtonProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const SendEvmTransactionButton: ({ account, children, className, network, onClick, onError, onSuccess, pendingLabel, transaction, variant, ...props }: SendEvmTransactionButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,67 @@
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import { useSendEvmTransaction as b, APIError as y } from "@coinbase/cdp-hooks";
3
+ import { useState as T, useCallback as _ } from "react";
4
+ import { Button as w } from "../ui/Button/index.js";
5
+ import "../../theme/theme.js";
6
+ import { getMessageFromUnknownError as B } from "../../utils/getMessageFromUnknownError.js";
7
+ import '../../assets/SendEvmTransactionButton.css';const P = {
8
+ "send-evm-transaction-button": "SendEvmTransactionButton-module__send-evm-transaction-button___74m57"
9
+ }, q = ({
10
+ account: e,
11
+ children: f,
12
+ className: l = "",
13
+ network: s,
14
+ onClick: o,
15
+ onError: a,
16
+ onSuccess: i,
17
+ pendingLabel: u,
18
+ transaction: r,
19
+ variant: p = "primary",
20
+ ...g
21
+ }) => {
22
+ const [v, m] = T(!1), { sendEvmTransaction: c } = b(), h = _(
23
+ async (d) => {
24
+ d.preventDefault(), o?.(d);
25
+ try {
26
+ if (!e || !s || !r) {
27
+ const n = [];
28
+ throw e || n.push("account"), s || n.push("network"), r || n.push("transaction"), new Error(`Missing required parameters: ${n.join(", ")}`);
29
+ }
30
+ m(!0);
31
+ const { transactionHash: t } = await c({
32
+ transaction: r,
33
+ evmAccount: e,
34
+ network: s
35
+ });
36
+ i?.(t);
37
+ } catch (t) {
38
+ let n;
39
+ if (t instanceof y || t instanceof Error)
40
+ n = t;
41
+ else {
42
+ const E = B(t);
43
+ n = new Error(E);
44
+ }
45
+ a?.(n);
46
+ } finally {
47
+ m(!1);
48
+ }
49
+ },
50
+ [e, s, o, a, i, c, r]
51
+ );
52
+ return /* @__PURE__ */ S(
53
+ w,
54
+ {
55
+ className: `${P["send-evm-transaction-button"]} ${l}`,
56
+ isPending: v,
57
+ pendingLabel: u || "Sending transaction...",
58
+ onClick: h,
59
+ variant: p,
60
+ ...g,
61
+ children: f || "Send transaction"
62
+ }
63
+ );
64
+ };
65
+ export {
66
+ q as SendEvmTransactionButton
67
+ };
@@ -0,0 +1,13 @@
1
+ import { APIError, SendSolanaTransactionOptions } from '@coinbase/cdp-hooks';
2
+ import { ButtonHTMLAttributes, ReactNode } from 'react';
3
+ import { ButtonVariant } from '../../theme/theme';
4
+ export interface SendSolanaTransactionButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onError"> {
5
+ account: SendSolanaTransactionOptions["solanaAccount"];
6
+ network: SendSolanaTransactionOptions["network"];
7
+ onError?: (error: APIError | Error) => void;
8
+ onSuccess?: (signature: string) => void;
9
+ pendingLabel?: ReactNode;
10
+ transaction: SendSolanaTransactionOptions["transaction"];
11
+ variant?: ButtonVariant;
12
+ }
13
+ export declare const SendSolanaTransactionButton: ({ account, children, className, network, onClick, onError, onSuccess, pendingLabel, transaction, variant, ...props }: SendSolanaTransactionButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,67 @@
1
+ import { jsx as y } from "react/jsx-runtime";
2
+ import { useSendSolanaTransaction as T, APIError as _ } from "@coinbase/cdp-hooks";
3
+ import { useState as w, useCallback as B } from "react";
4
+ import { Button as E } from "../ui/Button/index.js";
5
+ import "../../theme/theme.js";
6
+ import { getMessageFromUnknownError as x } from "../../utils/getMessageFromUnknownError.js";
7
+ import '../../assets/SendSolanaTransactionButton.css';const P = {
8
+ "send-solana-transaction-button": "SendSolanaTransactionButton-module__send-solana-transaction-button___OxwvB"
9
+ }, q = ({
10
+ account: t,
11
+ children: d,
12
+ className: f = "",
13
+ network: s,
14
+ onClick: r,
15
+ onError: e,
16
+ onSuccess: i,
17
+ pendingLabel: u,
18
+ transaction: o,
19
+ variant: p = "primary",
20
+ ...S
21
+ }) => {
22
+ const [g, l] = w(!1), { sendSolanaTransaction: c } = T(), h = B(
23
+ async (m) => {
24
+ m.preventDefault(), r?.(m);
25
+ try {
26
+ if (!t || !s || !o) {
27
+ const n = [];
28
+ throw t || n.push("account"), s || n.push("network"), o || n.push("transaction"), new Error(`Missing required parameters: ${n.join(", ")}`);
29
+ }
30
+ l(!0);
31
+ const { transactionSignature: a } = await c({
32
+ transaction: o,
33
+ solanaAccount: t,
34
+ network: s
35
+ });
36
+ i?.(a);
37
+ } catch (a) {
38
+ let n;
39
+ if (a instanceof _ || a instanceof Error)
40
+ n = a;
41
+ else {
42
+ const b = x(a);
43
+ n = new Error(b);
44
+ }
45
+ e?.(n);
46
+ } finally {
47
+ l(!1);
48
+ }
49
+ },
50
+ [t, s, r, e, i, c, o]
51
+ );
52
+ return /* @__PURE__ */ y(
53
+ E,
54
+ {
55
+ className: `${P["send-solana-transaction-button"]} ${f}`,
56
+ isPending: g,
57
+ pendingLabel: u || "Sending transaction...",
58
+ onClick: h,
59
+ variant: p,
60
+ ...S,
61
+ children: d || "Send transaction"
62
+ }
63
+ );
64
+ };
65
+ export {
66
+ q as SendSolanaTransactionButton
67
+ };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,8 @@ export * from './components/CDPReactProvider';
2
2
  export * from './components/AuthButton';
3
3
  export * from './components/Fund';
4
4
  export * from './components/FundModal';
5
- export * from './components/SendTransactionButton';
5
+ export * from './components/SendEvmTransactionButton';
6
+ export * from './components/SendSolanaTransactionButton';
6
7
  export * from './components/SignIn';
7
8
  export * from './components/SignOutButton';
8
9
  export * from './components/SignInModal';
package/dist/index.js CHANGED
@@ -1,44 +1,45 @@
1
1
  import { AUTH_METHODS as e, CDPReactProvider as t, useAppConfig as n } from "./components/CDPReactProvider/index.js";
2
2
  import { AuthButton as p } from "./components/AuthButton/index.js";
3
3
  import { Fund as x, FundFooter as i } from "./components/Fund/index.js";
4
- import { FundModal as c } from "./components/FundModal/index.js";
5
- import { SendTransactionButton as u } from "./components/SendTransactionButton/index.js";
6
- import { SignIn as l } from "./components/SignIn/index.js";
7
- import { useSignInReducer as g } from "./components/SignIn/useSignInReducer.js";
8
- import { SignOutButton as C } from "./components/SignOutButton/index.js";
9
- import { SignInModal as F } from "./components/SignInModal/index.js";
10
- import { ThemeProvider as k, useTheme as b } from "./components/ThemeProvider/index.js";
11
- import { cssVariables as B } from "./theme/cssVariables.js";
12
- import { theme as M } from "./theme/theme.js";
13
- import { borderRadius as w, borderRadiusComponents as D, borderRadiusSemantic as P, colors as R, colorsBase as O, colorsComponents as U, colorsSemantic as V, font as H, fontComponents as L, fontSemantic as j, tokens as N } from "./theme/tokens.js";
14
- import { flattenTokensObject as _, themeToCssVariables as q } from "./theme/utils.js";
15
- import { IconArrowLeft as z } from "./icons/IconArrowLeft.js";
16
- import { IconArrowsUpDown as J } from "./icons/IconArrowsUpDown.js";
17
- import { IconCheck as Q } from "./icons/IconCheck.js";
18
- import { IconCheckCircle as Y } from "./icons/IconCheckCircle.js";
19
- import { IconChevronDown as $ } from "./icons/IconChevronDown.js";
20
- import { IconEnvelope as ro } from "./icons/IconEnvelope.js";
21
- import { IconExclamationCircle as to } from "./icons/IconExclamationCircle.js";
22
- import { IconExclamationTriangle as mo } from "./icons/IconExclamationTriangle.js";
23
- import { IconLock as fo } from "./icons/IconLock.js";
24
- import { IconPhone as io } from "./icons/IconPhone.js";
25
- import { IconXMark as co } from "./icons/IconXMark.js";
26
- import { clamp as uo } from "./utils/clamp.js";
27
- import { getMessageFromUnknownError as lo } from "./utils/getMessageFromUnknownError.js";
28
- import { isApiError as So } from "./utils/isApiError.js";
29
- import { isEmailInvalid as ho } from "./utils/isEmailInvalid.js";
30
- import { parseValuesFromPhoneNumber as To } from "./utils/parseValuesFromPhoneNumber.js";
4
+ import { FundModal as s } from "./components/FundModal/index.js";
5
+ import { SendEvmTransactionButton as u } from "./components/SendEvmTransactionButton/index.js";
6
+ import { SendSolanaTransactionButton as l } from "./components/SendSolanaTransactionButton/index.js";
7
+ import { SignIn as S } from "./components/SignIn/index.js";
8
+ import { useSignInReducer as C } from "./components/SignIn/useSignInReducer.js";
9
+ import { SignOutButton as F } from "./components/SignOutButton/index.js";
10
+ import { SignInModal as k } from "./components/SignInModal/index.js";
11
+ import { ThemeProvider as E, useTheme as b } from "./components/ThemeProvider/index.js";
12
+ import { cssVariables as v } from "./theme/cssVariables.js";
13
+ import { theme as w } from "./theme/theme.js";
14
+ import { borderRadius as P, borderRadiusComponents as R, borderRadiusSemantic as O, colors as U, colorsBase as V, colorsComponents as H, colorsSemantic as L, font as j, fontComponents as N, fontSemantic as X, tokens as _ } from "./theme/tokens.js";
15
+ import { flattenTokensObject as y, themeToCssVariables as z } from "./theme/utils.js";
16
+ import { IconArrowLeft as J } from "./icons/IconArrowLeft.js";
17
+ import { IconArrowsUpDown as Q } from "./icons/IconArrowsUpDown.js";
18
+ import { IconCheck as Y } from "./icons/IconCheck.js";
19
+ import { IconCheckCircle as $ } from "./icons/IconCheckCircle.js";
20
+ import { IconChevronDown as ro } from "./icons/IconChevronDown.js";
21
+ import { IconEnvelope as to } from "./icons/IconEnvelope.js";
22
+ import { IconExclamationCircle as mo } from "./icons/IconExclamationCircle.js";
23
+ import { IconExclamationTriangle as fo } from "./icons/IconExclamationTriangle.js";
24
+ import { IconLock as io } from "./icons/IconLock.js";
25
+ import { IconPhone as so } from "./icons/IconPhone.js";
26
+ import { IconXMark as uo } from "./icons/IconXMark.js";
27
+ import { clamp as lo } from "./utils/clamp.js";
28
+ import { getMessageFromUnknownError as go } from "./utils/getMessageFromUnknownError.js";
29
+ import { isApiError as ho } from "./utils/isApiError.js";
30
+ import { isEmailInvalid as To } from "./utils/isEmailInvalid.js";
31
+ import { parseValuesFromPhoneNumber as Bo } from "./utils/parseValuesFromPhoneNumber.js";
31
32
  import { FundForm as bo } from "./components/Fund/FundForm.js";
32
- import { FundTitle as Bo } from "./components/Fund/FundTitle.js";
33
- import { useFundContext as Mo } from "./components/Fund/FundProvider.js";
34
- import { SignInAuthMethodButtons as wo } from "./components/SignIn/SignInAuthMethodButtons.js";
35
- import { SignInBackButton as Po } from "./components/SignIn/SignInBackButton.js";
36
- import { SignInDescription as Oo } from "./components/SignIn/SignInDescription.js";
37
- import { SignInFooter as Vo } from "./components/SignIn/SignInFooter.js";
38
- import { SignInForm as Lo } from "./components/SignIn/SignInForm.js";
39
- import { SignInImage as No } from "./components/SignIn/SignInImage.js";
40
- import { SignInTitle as _o } from "./components/SignIn/SignInTitle.js";
41
- import { useSignInContext as yo } from "./components/SignIn/SignInProvider.js";
33
+ import { FundTitle as vo } from "./components/Fund/FundTitle.js";
34
+ import { useFundContext as wo } from "./components/Fund/FundProvider.js";
35
+ import { SignInAuthMethodButtons as Po } from "./components/SignIn/SignInAuthMethodButtons.js";
36
+ import { SignInBackButton as Oo } from "./components/SignIn/SignInBackButton.js";
37
+ import { SignInDescription as Vo } from "./components/SignIn/SignInDescription.js";
38
+ import { SignInFooter as Lo } from "./components/SignIn/SignInFooter.js";
39
+ import { SignInForm as No } from "./components/SignIn/SignInForm.js";
40
+ import { SignInImage as _o } from "./components/SignIn/SignInImage.js";
41
+ import { SignInTitle as yo } from "./components/SignIn/SignInTitle.js";
42
+ import { useSignInContext as Go } from "./components/SignIn/SignInProvider.js";
42
43
  export {
43
44
  e as AUTH_METHODS,
44
45
  p as AuthButton,
@@ -46,54 +47,55 @@ export {
46
47
  x as Fund,
47
48
  i as FundFooter,
48
49
  bo as FundForm,
49
- c as FundModal,
50
- Bo as FundTitle,
51
- z as IconArrowLeft,
52
- J as IconArrowsUpDown,
53
- Q as IconCheck,
54
- Y as IconCheckCircle,
55
- $ as IconChevronDown,
56
- ro as IconEnvelope,
57
- to as IconExclamationCircle,
58
- mo as IconExclamationTriangle,
59
- fo as IconLock,
60
- io as IconPhone,
61
- co as IconXMark,
62
- u as SendTransactionButton,
63
- l as SignIn,
64
- wo as SignInAuthMethodButtons,
65
- Po as SignInBackButton,
66
- Oo as SignInDescription,
67
- Vo as SignInFooter,
68
- Lo as SignInForm,
69
- No as SignInImage,
70
- F as SignInModal,
71
- _o as SignInTitle,
72
- C as SignOutButton,
73
- k as ThemeProvider,
74
- w as borderRadius,
75
- D as borderRadiusComponents,
76
- P as borderRadiusSemantic,
77
- uo as clamp,
78
- R as colors,
79
- O as colorsBase,
80
- U as colorsComponents,
81
- V as colorsSemantic,
82
- B as cssVariables,
83
- _ as flattenTokensObject,
84
- H as font,
85
- L as fontComponents,
86
- j as fontSemantic,
87
- lo as getMessageFromUnknownError,
88
- So as isApiError,
89
- ho as isEmailInvalid,
90
- To as parseValuesFromPhoneNumber,
91
- M as theme,
92
- q as themeToCssVariables,
93
- N as tokens,
50
+ s as FundModal,
51
+ vo as FundTitle,
52
+ J as IconArrowLeft,
53
+ Q as IconArrowsUpDown,
54
+ Y as IconCheck,
55
+ $ as IconCheckCircle,
56
+ ro as IconChevronDown,
57
+ to as IconEnvelope,
58
+ mo as IconExclamationCircle,
59
+ fo as IconExclamationTriangle,
60
+ io as IconLock,
61
+ so as IconPhone,
62
+ uo as IconXMark,
63
+ u as SendEvmTransactionButton,
64
+ l as SendSolanaTransactionButton,
65
+ S as SignIn,
66
+ Po as SignInAuthMethodButtons,
67
+ Oo as SignInBackButton,
68
+ Vo as SignInDescription,
69
+ Lo as SignInFooter,
70
+ No as SignInForm,
71
+ _o as SignInImage,
72
+ k as SignInModal,
73
+ yo as SignInTitle,
74
+ F as SignOutButton,
75
+ E as ThemeProvider,
76
+ P as borderRadius,
77
+ R as borderRadiusComponents,
78
+ O as borderRadiusSemantic,
79
+ lo as clamp,
80
+ U as colors,
81
+ V as colorsBase,
82
+ H as colorsComponents,
83
+ L as colorsSemantic,
84
+ v as cssVariables,
85
+ y as flattenTokensObject,
86
+ j as font,
87
+ N as fontComponents,
88
+ X as fontSemantic,
89
+ go as getMessageFromUnknownError,
90
+ ho as isApiError,
91
+ To as isEmailInvalid,
92
+ Bo as parseValuesFromPhoneNumber,
93
+ w as theme,
94
+ z as themeToCssVariables,
95
+ _ as tokens,
94
96
  n as useAppConfig,
95
- Mo as useFundContext,
96
- yo as useSignInContext,
97
- g as useSignInReducer,
97
+ wo as useFundContext,
98
+ Go as useSignInContext,
99
+ C as useSignInReducer,
98
100
  b as useTheme
99
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@internationalized/number": "3.6.4",
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "peerDependencies": {
16
16
  "react": ">=18.2.0",
17
- "@coinbase/cdp-core": "^0.0.38",
18
- "@coinbase/cdp-hooks": "^0.0.38"
17
+ "@coinbase/cdp-core": "^0.0.39",
18
+ "@coinbase/cdp-hooks": "^0.0.39"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -45,8 +45,8 @@
45
45
  "vite": "^7.0.4",
46
46
  "vite-plugin-dts": "^4.5.4",
47
47
  "vite-plugin-lib-inject-css": "^2.2.2",
48
- "@coinbase/cdp-core": "^0.0.38",
49
- "@coinbase/cdp-hooks": "^0.0.38"
48
+ "@coinbase/cdp-core": "^0.0.39",
49
+ "@coinbase/cdp-hooks": "^0.0.39"
50
50
  },
51
51
  "size-limit": [
52
52
  {
@@ -1 +0,0 @@
1
- .SendTransactionButton-module__send-transaction-button___-6UsN{padding-left:2em;padding-right:2em}
@@ -1,67 +0,0 @@
1
- import { jsx as b } from "react/jsx-runtime";
2
- import { useSendEvmTransaction as y, APIError as T } from "@coinbase/cdp-hooks";
3
- import { useState as _, useCallback as v } from "react";
4
- import { Button as w } from "../ui/Button/index.js";
5
- import "../../theme/theme.js";
6
- import { getMessageFromUnknownError as B } from "../../utils/getMessageFromUnknownError.js";
7
- import '../../assets/SendTransactionButton.css';const P = {
8
- "send-transaction-button": "SendTransactionButton-module__send-transaction-button___-6UsN"
9
- }, N = ({
10
- account: s,
11
- children: f,
12
- className: l = "",
13
- network: r,
14
- onClick: o,
15
- onError: a,
16
- onSuccess: i,
17
- pendingLabel: u,
18
- transaction: e,
19
- variant: p = "primary",
20
- ...g
21
- }) => {
22
- const [h, c] = _(!1), { sendEvmTransaction: m } = y(), E = v(
23
- async (d) => {
24
- d.preventDefault(), o?.(d);
25
- try {
26
- if (!s || !r || !e) {
27
- const n = [];
28
- throw s || n.push("account"), r || n.push("network"), e || n.push("transaction"), new Error(`Missing required parameters: ${n.join(", ")}`);
29
- }
30
- c(!0);
31
- const { transactionHash: t } = await m({
32
- transaction: e,
33
- evmAccount: s,
34
- network: r
35
- });
36
- i?.(t);
37
- } catch (t) {
38
- let n;
39
- if (t instanceof T || t instanceof Error)
40
- n = t;
41
- else {
42
- const S = B(t);
43
- n = new Error(S);
44
- }
45
- a?.(n);
46
- } finally {
47
- c(!1);
48
- }
49
- },
50
- [s, r, o, a, i, m, e]
51
- );
52
- return /* @__PURE__ */ b(
53
- w,
54
- {
55
- className: `${P["send-transaction-button"]} ${l}`,
56
- isPending: h,
57
- pendingLabel: u || "Sending transaction...",
58
- onClick: E,
59
- variant: p,
60
- ...g,
61
- children: f || "Send transaction"
62
- }
63
- );
64
- };
65
- export {
66
- N as SendTransactionButton
67
- };