@gardenfi/react-hooks 2.5.3-beta.18 → 2.5.3-beta.19

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/dist/index2.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),m=require("./index3.cjs"),d=require("@gardenfi/core"),q=require("./index4.cjs"),f=require("./index5.cjs"),v=require("@gardenfi/utils"),G=require("./index6.cjs"),w=a.createContext({pendingOrders:[]}),k=({children:i,config:e,store:l,setRedeemServiceEnabled:n=!0})=>{const[s,O]=a.useState(),{digestKey:c}=f.useDigestKey(n),{pendingOrders:h}=m.useOrderbook(s,l),p=a.useMemo(()=>{const{api:t}=d.resolveApiConfig(e.environment);return e.quote??new d.Quote(t.baseurl)},[e.environment,e.quote]),g=a.useMemo(()=>async({fromAsset:t,toAsset:r,amount:u,isExactOut:o=!1,options:y})=>await(s?s.quote:p).getQuoteFromAssets({fromAsset:t,toAsset:r,amount:u,isExactOut:o,options:y}),[s,p]),_=async t=>{if(!s)return v.Err("Garden not initialized");const r=await s.createSwap(t);if(!r.val)return v.Err(r.error||"Unknown error occurred");if(n)try{const u=l.getItem(G.PENDING_ORDERS_STORE),o=u?JSON.parse(u):[];typeof r.val=="string"?o.includes(r.val)||o.push(r.val):r.val&&typeof r.val.order_id=="string"&&(o.includes(r.val.order_id)||o.push(r.val.order_id));const y=Array.from(new Set(o));l.setItem(G.PENDING_ORDERS_STORE,JSON.stringify(y))}catch(u){console.error("Failed to persist pending order id",u)}return v.Ok(r.val)};return a.useEffect(()=>{if(!("wallets"in e)&&!("htlc"in e))return;let t;if("wallets"in e&&Object.keys(e.wallets??{}).length>0&&q.hasAnyValidValue(e.wallets??{}))t=d.Garden.fromWallets({...e,digestKey:n?void 0:c}).setRedeemServiceEnabled(n);else if("htlc"in e&&Object.keys(e.htlc??{}).length>0&&q.hasAnyValidValue(e.htlc??{}))t=new d.Garden({...e,digestKey:n?void 0:c}).setRedeemServiceEnabled(n);else return;O(t)},[e,c,n]),a.createElement(w.Provider,{value:{swap:_,pendingOrders:h,getQuote:g,garden:s,orderBook:s}},i)},E=()=>{const i=a.useContext(w);if(!i)throw new Error("useGarden must be used within a GardenProvider");return i};exports.GardenContext=w;exports.GardenProvider=k;exports.useGarden=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),g=require("./index3.cjs"),d=require("@gardenfi/core"),v=require("./index4.cjs"),k=require("./index5.cjs"),p=require("@gardenfi/utils"),q=require("./index6.cjs"),w=a.createContext({pendingOrders:[]}),E=({children:i,config:e,store:l,setRedeemServiceEnabled:n=!0})=>{const[s,G]=a.useState(),{digestKey:c}=k.useDigestKey(n),{pendingOrders:O}=g.useOrderbook(s,l),h=a.useMemo(()=>{const{api:t}=d.resolveApiConfig(e.environment);return e.quote??new d.Quote(t.baseurl,v.resolveAuth(e.apiKey))},[e.environment,e.quote,e.apiKey]),_=a.useMemo(()=>async({fromAsset:t,toAsset:r,amount:u,isExactOut:o=!1,options:y})=>await(s?s.quote:h).getQuoteFromAssets({fromAsset:t,toAsset:r,amount:u,isExactOut:o,options:y}),[s,h]),m=async t=>{if(!s)return p.Err("Garden not initialized");const r=await s.createSwap(t);if(!r.val)return p.Err(r.error||"Unknown error occurred");if(n)try{const u=l.getItem(q.PENDING_ORDERS_STORE),o=u?JSON.parse(u):[];typeof r.val=="string"?o.includes(r.val)||o.push(r.val):r.val&&typeof r.val.order_id=="string"&&(o.includes(r.val.order_id)||o.push(r.val.order_id));const y=Array.from(new Set(o));l.setItem(q.PENDING_ORDERS_STORE,JSON.stringify(y))}catch(u){console.error("Failed to persist pending order id",u)}return p.Ok(r.val)};return a.useEffect(()=>{if(!("wallets"in e)&&!("htlc"in e))return;let t;if("wallets"in e&&Object.keys(e.wallets??{}).length>0&&v.hasAnyValidValue(e.wallets??{}))t=d.Garden.fromWallets({...e,digestKey:n?void 0:c}).setRedeemServiceEnabled(n);else if("htlc"in e&&Object.keys(e.htlc??{}).length>0&&v.hasAnyValidValue(e.htlc??{}))t=new d.Garden({...e,digestKey:n?void 0:c}).setRedeemServiceEnabled(n);else return;G(t)},[e,c,n]),a.createElement(w.Provider,{value:{swap:m,pendingOrders:O,getQuote:_,garden:s,orderBook:s}},i)},K=()=>{const i=a.useContext(w);if(!i)throw new Error("useGarden must be used within a GardenProvider");return i};exports.GardenContext=w;exports.GardenProvider=E;exports.useGarden=K;
package/dist/index2.js CHANGED
@@ -1,88 +1,88 @@
1
- import f, { useState as g, useMemo as m, useEffect as k, createContext as x } from "react";
1
+ import h, { useState as k, useMemo as m, useEffect as K, createContext as x } from "react";
2
2
  import { useOrderbook as A } from "./index3.js";
3
- import { resolveApiConfig as C, Quote as I, Garden as c } from "@gardenfi/core";
4
- import { hasAnyValidValue as w } from "./index4.js";
5
- import { useDigestKey as K } from "./index5.js";
6
- import { Err as v, Ok as N } from "@gardenfi/utils";
7
- import { PENDING_ORDERS_STORE as y } from "./index6.js";
8
- const h = x({
3
+ import { resolveApiConfig as g, Quote as C, Garden as c } from "@gardenfi/core";
4
+ import { resolveAuth as I, hasAnyValidValue as y } from "./index4.js";
5
+ import { useDigestKey as N } from "./index5.js";
6
+ import { Err as v, Ok as P } from "@gardenfi/utils";
7
+ import { PENDING_ORDERS_STORE as w } from "./index6.js";
8
+ const f = x({
9
9
  pendingOrders: []
10
- }), V = ({
10
+ }), b = ({
11
11
  children: i,
12
12
  config: e,
13
13
  store: u,
14
- setRedeemServiceEnabled: n = !0
14
+ setRedeemServiceEnabled: o = !0
15
15
  }) => {
16
- const [o, O] = g(), { digestKey: l } = K(n), { pendingOrders: G } = A(o, u), p = m(() => {
17
- const { api: t } = C(e.environment);
18
- return e.quote ?? new I(t.baseurl);
19
- }, [e.environment, e.quote]), q = m(
16
+ const [s, O] = k(), { digestKey: l } = N(o), { pendingOrders: G } = A(s, u), p = m(() => {
17
+ const { api: t } = g(e.environment);
18
+ return e.quote ?? new C(t.baseurl, I(e.apiKey));
19
+ }, [e.environment, e.quote, e.apiKey]), q = m(
20
20
  () => async ({
21
21
  fromAsset: t,
22
22
  toAsset: r,
23
23
  amount: a,
24
- isExactOut: s = !1,
24
+ isExactOut: n = !1,
25
25
  options: d
26
- }) => await (o ? o.quote : p).getQuoteFromAssets({
26
+ }) => await (s ? s.quote : p).getQuoteFromAssets({
27
27
  fromAsset: t,
28
28
  toAsset: r,
29
29
  amount: a,
30
- isExactOut: s,
30
+ isExactOut: n,
31
31
  options: d
32
32
  }),
33
- [o, p]
33
+ [s, p]
34
34
  ), _ = async (t) => {
35
- if (!o) return v("Garden not initialized");
36
- const r = await o.createSwap(t);
35
+ if (!s) return v("Garden not initialized");
36
+ const r = await s.createSwap(t);
37
37
  if (!r.val) return v(r.error || "Unknown error occurred");
38
- if (n)
38
+ if (o)
39
39
  try {
40
- const a = u.getItem(y), s = a ? JSON.parse(a) : [];
41
- typeof r.val == "string" ? s.includes(r.val) || s.push(r.val) : r.val && typeof r.val.order_id == "string" && (s.includes(r.val.order_id) || s.push(r.val.order_id));
42
- const d = Array.from(new Set(s));
43
- u.setItem(y, JSON.stringify(d));
40
+ const a = u.getItem(w), n = a ? JSON.parse(a) : [];
41
+ typeof r.val == "string" ? n.includes(r.val) || n.push(r.val) : r.val && typeof r.val.order_id == "string" && (n.includes(r.val.order_id) || n.push(r.val.order_id));
42
+ const d = Array.from(new Set(n));
43
+ u.setItem(w, JSON.stringify(d));
44
44
  } catch (a) {
45
45
  console.error("Failed to persist pending order id", a);
46
46
  }
47
- return N(r.val);
47
+ return P(r.val);
48
48
  };
49
- return k(() => {
49
+ return K(() => {
50
50
  if (!("wallets" in e) && !("htlc" in e)) return;
51
51
  let t;
52
- if ("wallets" in e && Object.keys(e.wallets ?? {}).length > 0 && w(e.wallets ?? {}))
52
+ if ("wallets" in e && Object.keys(e.wallets ?? {}).length > 0 && y(e.wallets ?? {}))
53
53
  t = c.fromWallets({
54
54
  ...e,
55
- digestKey: n ? void 0 : l
56
- }).setRedeemServiceEnabled(n);
57
- else if ("htlc" in e && Object.keys(e.htlc ?? {}).length > 0 && w(e.htlc ?? {}))
55
+ digestKey: o ? void 0 : l
56
+ }).setRedeemServiceEnabled(o);
57
+ else if ("htlc" in e && Object.keys(e.htlc ?? {}).length > 0 && y(e.htlc ?? {}))
58
58
  t = new c({
59
59
  ...e,
60
- digestKey: n ? void 0 : l
61
- }).setRedeemServiceEnabled(n);
60
+ digestKey: o ? void 0 : l
61
+ }).setRedeemServiceEnabled(o);
62
62
  else
63
63
  return;
64
64
  O(t);
65
- }, [e, l, n]), /* @__PURE__ */ f.createElement(
66
- h.Provider,
65
+ }, [e, l, o]), /* @__PURE__ */ h.createElement(
66
+ f.Provider,
67
67
  {
68
68
  value: {
69
69
  swap: _,
70
70
  pendingOrders: G,
71
71
  getQuote: q,
72
- garden: o,
73
- orderBook: o
72
+ garden: s,
73
+ orderBook: s
74
74
  }
75
75
  },
76
76
  i
77
77
  );
78
- }, b = () => {
79
- const i = f.useContext(h);
78
+ }, z = () => {
79
+ const i = h.useContext(f);
80
80
  if (!i)
81
81
  throw new Error("useGarden must be used within a GardenProvider");
82
82
  return i;
83
83
  };
84
84
  export {
85
- h as GardenContext,
86
- V as GardenProvider,
87
- b as useGarden
85
+ f as GardenContext,
86
+ b as GardenProvider,
87
+ z as useGarden
88
88
  };
package/dist/index3.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gardenfi/orderbook"),i=require("react"),R=require("./index6.cjs"),v=(e,u)=>{const[k,y]=i.useState([]),O=i.useRef(null),E=i.useRef(!1),A=i.useRef(!1),_=5e3,m=i.useCallback(()=>{var n,o,f,a,d,s,t,l,c,S,b,N;if(!e)return[];const r=new Set;try{[(o=(n=e.htlcs)==null?void 0:n.evm)==null?void 0:o.htlcActorAddress,(a=(f=e.htlcs)==null?void 0:f.sui)==null?void 0:a.htlcActorAddress,(s=(d=e.htlcs)==null?void 0:d.solana)==null?void 0:s.htlcActorAddress,(l=(t=e.htlcs)==null?void 0:t.starknet)==null?void 0:l.htlcActorAddress,(S=(c=e.htlcs)==null?void 0:c.bitcoin)==null?void 0:S.htlcActorAddress,(N=(b=e.htlcs)==null?void 0:b.tron)==null?void 0:N.htlcActorAddress].filter(g=>!!g&&g.length>0).forEach(g=>r.add(g.toLowerCase()))}catch(T){console.error("Error getting HTLC addresses:",T)}return Array.from(r)},[e]),C=i.useCallback(async()=>{if(e)try{const r=m();if(r.length===0){console.log("No HTLC addresses found for initial pending orders fetch");return}const n=r.map(async s=>{try{const[t,l]=await Promise.all([e.getOrders({address:s,status:h.OrderLifecycle.pending,per_page:500}),e.getOrders({address:s,status:h.OrderLifecycle.notInitiated,per_page:500})]),c=[];return t.ok?c.push(...t.val.data):console.error(`Failed to fetch pending orders for address ${s}:`,t.error),l.ok?c.push(...l.val.data):console.error(`Failed to fetch notInitiated orders for address ${s}:`,l.error),c}catch(t){return console.error(`Error fetching orders for address ${s}:`,t),[]}}),a=(await Promise.all(n)).flat().map(s=>s.order_id),d=Array.from(new Set(a));if(d.length>0)try{u.setItem(R.PENDING_ORDERS_STORE,JSON.stringify(d))}catch(s){console.error("Error saving initial pending order IDs to localStorage",s)}}catch(r){console.error("Error fetching initial pending orders:",r)}},[e,u,m]),I=i.useCallback(async()=>{if(e)try{const r=u.getItem(R.PENDING_ORDERS_STORE),n=r?JSON.parse(r):[],o=Array.from(new Set(n));if(o.length===0){y([]);return}const f=await Promise.all(o.map(t=>e.getOrder(t))),a=[],d=[];f.forEach((t,l)=>{if(!t.ok){d.push(o[l]);return}const c=t.val;c.status===h.OrderStatus.Redeemed||c.status===h.OrderStatus.Refunded||c.status===h.OrderStatus.Expired||(a.push(c),d.push(o[l]))});const s=Array.from(new Set(d));try{u.setItem(R.PENDING_ORDERS_STORE,JSON.stringify(s))}catch(t){console.error("Error persisting remaining pending order ids",t)}y(a)}catch(r){console.error("Error fetching pending orders:",r)}},[e,u]),p=i.useMemo(()=>{try{return m().join(",")}catch(r){return console.error("Error computing HTLC addresses:",r),""}},[m]),P=i.useRef("");return i.useEffect(()=>{if(!e||!e.redeemServiceEnabled||!p)return;P.current!==p&&(A.current=!1,P.current=p),A.current||(C(),A.current=!0)},[e,p,C]),i.useEffect(()=>{if(e)if(e.redeemServiceEnabled){let r=!1;const n=()=>{r||(O.current=setTimeout(o,_))},o=async()=>{if(!r){if(E.current){n();return}E.current=!0;try{await I()}finally{E.current=!1}n()}};return o(),()=>{r=!0,O.current&&(clearTimeout(O.current),O.current=null)}}else{const r=n=>y(n);return e.on("onPendingOrdersChanged",r),()=>{e.off("onPendingOrdersChanged",r)}}},[e,I]),{pendingOrders:k}};exports.useOrderbook=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gardenfi/orderbook"),i=require("react"),R=require("./index6.cjs"),k=(e,u)=>{const[N,y]=i.useState([]),O=i.useRef(null),E=i.useRef(!1),S=i.useRef(!1),T=5e3,m=i.useCallback(()=>{var n,o,f,a,d,s,t,l,c,A;if(!e)return[];const r=new Set;try{[(o=(n=e.htlcs)==null?void 0:n.evm)==null?void 0:o.htlcActorAddress,(a=(f=e.htlcs)==null?void 0:f.sui)==null?void 0:a.htlcActorAddress,(s=(d=e.htlcs)==null?void 0:d.solana)==null?void 0:s.htlcActorAddress,(l=(t=e.htlcs)==null?void 0:t.starknet)==null?void 0:l.htlcActorAddress,(A=(c=e.htlcs)==null?void 0:c.bitcoin)==null?void 0:A.htlcActorAddress].filter(g=>!!g&&g.length>0).forEach(g=>r.add(g.toLowerCase()))}catch(b){console.error("Error getting HTLC addresses:",b)}return Array.from(r)},[e]),C=i.useCallback(async()=>{if(e)try{const r=m();if(r.length===0){console.log("No HTLC addresses found for initial pending orders fetch");return}const n=r.map(async s=>{try{const[t,l]=await Promise.all([e.getOrders({address:s,status:h.OrderLifecycle.pending,per_page:500}),e.getOrders({address:s,status:h.OrderLifecycle.notInitiated,per_page:500})]),c=[];return t.ok?c.push(...t.val.data):console.error(`Failed to fetch pending orders for address ${s}:`,t.error),l.ok?c.push(...l.val.data):console.error(`Failed to fetch notInitiated orders for address ${s}:`,l.error),c}catch(t){return console.error(`Error fetching orders for address ${s}:`,t),[]}}),a=(await Promise.all(n)).flat().map(s=>s.order_id),d=Array.from(new Set(a));if(d.length>0)try{u.setItem(R.PENDING_ORDERS_STORE,JSON.stringify(d))}catch(s){console.error("Error saving initial pending order IDs to localStorage",s)}}catch(r){console.error("Error fetching initial pending orders:",r)}},[e,u,m]),I=i.useCallback(async()=>{if(e)try{const r=u.getItem(R.PENDING_ORDERS_STORE),n=r?JSON.parse(r):[],o=Array.from(new Set(n));if(o.length===0){y([]);return}const f=await Promise.all(o.map(t=>e.getOrder(t))),a=[],d=[];f.forEach((t,l)=>{if(!t.ok){d.push(o[l]);return}const c=t.val;c.status===h.OrderStatus.Redeemed||c.status===h.OrderStatus.Refunded||c.status===h.OrderStatus.Expired||(a.push(c),d.push(o[l]))});const s=Array.from(new Set(d));try{u.setItem(R.PENDING_ORDERS_STORE,JSON.stringify(s))}catch(t){console.error("Error persisting remaining pending order ids",t)}y(a)}catch(r){console.error("Error fetching pending orders:",r)}},[e,u]),p=i.useMemo(()=>{try{return m().join(",")}catch(r){return console.error("Error computing HTLC addresses:",r),""}},[m]),P=i.useRef("");return i.useEffect(()=>{if(!e||!e.redeemServiceEnabled||!p)return;P.current!==p&&(S.current=!1,P.current=p),S.current||(C(),S.current=!0)},[e,p,C]),i.useEffect(()=>{if(e)if(e.redeemServiceEnabled){let r=!1;const n=()=>{r||(O.current=setTimeout(o,T))},o=async()=>{if(!r){if(E.current){n();return}E.current=!0;try{await I()}finally{E.current=!1}n()}};return o(),()=>{r=!0,O.current&&(clearTimeout(O.current),O.current=null)}}else{const r=n=>y(n);return e.on("onPendingOrdersChanged",r),()=>{e.off("onPendingOrdersChanged",r)}}},[e,I]),{pendingOrders:N}};exports.useOrderbook=k;
package/dist/index3.js CHANGED
@@ -1,9 +1,9 @@
1
- import { OrderLifecycle as N, OrderStatus as S } from "@gardenfi/orderbook";
2
- import { useState as _, useRef as g, useCallback as C, useMemo as D, useEffect as b } from "react";
1
+ import { OrderLifecycle as T, OrderStatus as S } from "@gardenfi/orderbook";
2
+ import { useState as k, useRef as g, useCallback as C, useMemo as F, useEffect as L } from "react";
3
3
  import { PENDING_ORDERS_STORE as I } from "./index6.js";
4
- const J = (r, a) => {
5
- const [k, O] = _([]), f = g(null), y = g(!1), A = g(!1), F = 5e3, h = C(() => {
6
- var n, o, u, l, i, s, t, d, c, E, v, T;
4
+ const q = (r, a) => {
5
+ const [N, O] = k([]), f = g(null), y = g(!1), A = g(!1), b = 5e3, h = C(() => {
6
+ var n, o, u, l, i, s, t, d, c, E;
7
7
  if (!r) return [];
8
8
  const e = /* @__PURE__ */ new Set();
9
9
  try {
@@ -12,11 +12,10 @@ const J = (r, a) => {
12
12
  (l = (u = r.htlcs) == null ? void 0 : u.sui) == null ? void 0 : l.htlcActorAddress,
13
13
  (s = (i = r.htlcs) == null ? void 0 : i.solana) == null ? void 0 : s.htlcActorAddress,
14
14
  (d = (t = r.htlcs) == null ? void 0 : t.starknet) == null ? void 0 : d.htlcActorAddress,
15
- (E = (c = r.htlcs) == null ? void 0 : c.bitcoin) == null ? void 0 : E.htlcActorAddress,
16
- (T = (v = r.htlcs) == null ? void 0 : v.tron) == null ? void 0 : T.htlcActorAddress
15
+ (E = (c = r.htlcs) == null ? void 0 : c.bitcoin) == null ? void 0 : E.htlcActorAddress
17
16
  ].filter((p) => !!p && p.length > 0).forEach((p) => e.add(p.toLowerCase()));
18
- } catch (L) {
19
- console.error("Error getting HTLC addresses:", L);
17
+ } catch (v) {
18
+ console.error("Error getting HTLC addresses:", v);
20
19
  }
21
20
  return Array.from(e);
22
21
  }, [r]), P = C(async () => {
@@ -32,12 +31,12 @@ const J = (r, a) => {
32
31
  const [t, d] = await Promise.all([
33
32
  r.getOrders({
34
33
  address: s,
35
- status: N.pending,
34
+ status: T.pending,
36
35
  per_page: 500
37
36
  }),
38
37
  r.getOrders({
39
38
  address: s,
40
- status: N.notInitiated,
39
+ status: T.notInitiated,
41
40
  per_page: 500
42
41
  })
43
42
  ]), c = [];
@@ -93,22 +92,22 @@ const J = (r, a) => {
93
92
  } catch (e) {
94
93
  console.error("Error fetching pending orders:", e);
95
94
  }
96
- }, [r, a]), m = D(() => {
95
+ }, [r, a]), m = F(() => {
97
96
  try {
98
97
  return h().join(",");
99
98
  } catch (e) {
100
99
  return console.error("Error computing HTLC addresses:", e), "";
101
100
  }
102
101
  }, [h]), w = g("");
103
- return b(() => {
102
+ return L(() => {
104
103
  if (!r || !r.redeemServiceEnabled || !m) return;
105
104
  w.current !== m && (A.current = !1, w.current = m), A.current || (P(), A.current = !0);
106
- }, [r, m, P]), b(() => {
105
+ }, [r, m, P]), L(() => {
107
106
  if (r)
108
107
  if (r.redeemServiceEnabled) {
109
108
  let e = !1;
110
109
  const n = () => {
111
- e || (f.current = setTimeout(o, F));
110
+ e || (f.current = setTimeout(o, b));
112
111
  }, o = async () => {
113
112
  if (!e) {
114
113
  if (y.current) {
@@ -133,8 +132,8 @@ const J = (r, a) => {
133
132
  r.off("onPendingOrdersChanged", e);
134
133
  };
135
134
  }
136
- }, [r, R]), { pendingOrders: k };
135
+ }, [r, R]), { pendingOrders: N };
137
136
  };
138
137
  export {
139
- J as useOrderbook
138
+ q as useOrderbook
140
139
  };
package/dist/index4.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>Object.values(e).some(a=>a!==void 0);exports.hasAnyValidValue=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@gardenfi/utils"),s=e=>Object.values(e).some(t=>t!==void 0),l=e=>typeof e=="string"?new r.ApiKey(e):e;exports.hasAnyValidValue=s;exports.resolveAuth=l;
package/dist/index4.js CHANGED
@@ -1,4 +1,6 @@
1
- const o = (e) => Object.values(e).some((a) => a !== void 0);
1
+ import { ApiKey as o } from "@gardenfi/utils";
2
+ const n = (e) => Object.values(e).some((r) => r !== void 0), s = (e) => typeof e == "string" ? new o(e) : e;
2
3
  export {
3
- o as hasAnyValidValue
4
+ n as hasAnyValidValue,
5
+ s as resolveAuth
4
6
  };
@@ -1 +1,4 @@
1
+ import { IAuth } from '@gardenfi/utils';
2
+
1
3
  export declare const hasAnyValidValue: (obj: Record<string, any>) => boolean;
4
+ export declare const resolveAuth: (auth: string | IAuth) => IAuth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/react-hooks",
3
- "version": "2.5.3-beta.18",
3
+ "version": "2.5.3-beta.19",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -27,9 +27,9 @@
27
27
  "registry": "https://registry.npmjs.org/"
28
28
  },
29
29
  "dependencies": {
30
- "@gardenfi/core": "2.5.3-beta.17",
31
- "@gardenfi/orderbook": "2.5.3-beta.15",
32
- "@gardenfi/utils": "2.5.3-beta.7",
30
+ "@gardenfi/core": "2.5.3-beta.18",
31
+ "@gardenfi/orderbook": "2.5.3-beta.16",
32
+ "@gardenfi/utils": "2.5.3-beta.8",
33
33
  "react": "^18.3.1",
34
34
  "starknet": "7.6.4"
35
35
  },