@coinbase/cdp-react-native 0.0.99 → 0.0.101

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.
@@ -1,10 +1,10 @@
1
1
  import { createEndUserApplePayOnrampOrder as f, APIError as h } from "@coinbase/cdp-api-client";
2
2
  import { useCurrentUser as g, useConfig as v } from "@coinbase/cdp-hooks";
3
- import C, { createContext as U, useReducer as x, useCallback as n, useEffect as A } from "react";
4
- import { checkUserVerification as E } from "../utils/checkUserVerification.js";
5
- const I = U(null);
3
+ import C, { createContext as I, useReducer as U, useCallback as n, useEffect as x } from "react";
4
+ import { checkUserVerification as A } from "../utils/checkUserVerification.js";
5
+ const E = I(null);
6
6
  function w({ children: t, debug: a = !1 }) {
7
- const [p, r] = x(P, i), { currentUser: o } = g(), { config: d } = v(), c = n(() => {
7
+ const [p, r] = U(P, i), { currentUser: o } = g(), { config: d } = v(), c = n(() => {
8
8
  if (!o)
9
9
  return r({
10
10
  type: "validation_error",
@@ -12,7 +12,7 @@ function w({ children: t, debug: a = !1 }) {
12
12
  code: "user_not_authenticated"
13
13
  }
14
14
  }), null;
15
- const { missingVerification: e } = E(o);
15
+ const { missingVerification: e } = A(o);
16
16
  return e ? (r({
17
17
  type: "validation_error",
18
18
  error: {
@@ -20,7 +20,7 @@ function w({ children: t, debug: a = !1 }) {
20
20
  }
21
21
  }), null) : (r({ type: "reset" }), o);
22
22
  }, [o]);
23
- A(() => {
23
+ x(() => {
24
24
  c();
25
25
  }, [c]);
26
26
  const l = n(
@@ -29,19 +29,23 @@ function w({ children: t, debug: a = !1 }) {
29
29
  if (u)
30
30
  try {
31
31
  r({ type: "purchase_requested" });
32
- const s = await f(d.projectId, u.userId, {
33
- agreementAcceptedAt: (/* @__PURE__ */ new Date()).toISOString(),
34
- // TODO: Do we need to verify the user owns the destination address?
35
- destination: e.destination,
36
- payment: {
37
- currency: e.payment.currency.toUpperCase()
32
+ const s = await f(
33
+ u.userId,
34
+ {
35
+ agreementAcceptedAt: (/* @__PURE__ */ new Date()).toISOString(),
36
+ // TODO: Do we need to verify the user owns the destination address?
37
+ destination: e.destination,
38
+ payment: {
39
+ currency: e.payment.currency.toUpperCase()
40
+ },
41
+ purchase: {
42
+ amount: e.purchase.amount,
43
+ currency: e.purchase.currency.toUpperCase()
44
+ },
45
+ isSandbox: e.isSandbox
38
46
  },
39
- purchase: {
40
- amount: e.purchase.amount,
41
- currency: e.purchase.currency.toUpperCase()
42
- },
43
- isSandbox: e.isSandbox
44
- });
47
+ { projectID: d.projectId }
48
+ );
45
49
  r({ type: "purchase_started", data: s });
46
50
  } catch (s) {
47
51
  s instanceof h ? r({
@@ -89,7 +93,7 @@ function w({ children: t, debug: a = !1 }) {
89
93
  reset: _,
90
94
  debug: a
91
95
  };
92
- return /* @__PURE__ */ C.createElement(I.Provider, { value: y }, t);
96
+ return /* @__PURE__ */ C.createElement(E.Provider, { value: y }, t);
93
97
  }
94
98
  const i = {
95
99
  status: "idle",
@@ -135,6 +139,6 @@ function P(t, a) {
135
139
  }
136
140
  }
137
141
  export {
138
- I as ApplePayContext,
142
+ E as ApplePayContext,
139
143
  w as ApplePayProvider
140
144
  };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react-native",
3
- "version": "0.0.99",
3
+ "version": "0.0.101",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
6
  "expo-apple-authentication": ">=4.0.0",
7
7
  "react": ">=18.2.0",
8
8
  "react-native": ">=0.70.0",
9
9
  "react-native-webview": ">=13.0.0",
10
- "@coinbase/cdp-api-client": "^0.0.99",
11
- "@coinbase/cdp-core": "^0.0.99",
12
- "@coinbase/cdp-hooks": "^0.0.99"
10
+ "@coinbase/cdp-hooks": "^0.0.101",
11
+ "@coinbase/cdp-api-client": "^0.0.101",
12
+ "@coinbase/cdp-core": "^0.0.101"
13
13
  },
14
14
  "peerDependenciesMeta": {
15
15
  "expo-apple-authentication": {
@@ -23,9 +23,9 @@
23
23
  "react-dom": "^19.1.2",
24
24
  "react-native": "^0.79.6",
25
25
  "react-native-webview": "^13.13.5",
26
- "@coinbase/cdp-api-client": "0.0.99",
27
- "@coinbase/cdp-core": "0.0.99",
28
- "@coinbase/cdp-hooks": "0.0.99"
26
+ "@coinbase/cdp-api-client": "0.0.101",
27
+ "@coinbase/cdp-core": "0.0.101",
28
+ "@coinbase/cdp-hooks": "0.0.101"
29
29
  },
30
30
  "files": [
31
31
  "dist/**",