@gardenfi/react-hooks 0.0.1-beta.9 → 0.0.1-beta.91

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 e=require("react"),R=require("wagmi"),W=require("./index4.cjs"),p=require("./index3.cjs"),w=require("@gardenfi/core"),a=require("@catalogfi/utils"),x=require("@gardenfi/orderbook"),E=require("@catalogfi/wallets"),S=require("@gardenfi/utils"),A=require("./index5.cjs"),k=e.createContext({}),N=({children:c,config:t})=>{const[s,B]=e.useState(),[i,C]=e.useState(),[u,G]=e.useState(),[U,m]=e.useState(),[O,g]=e.useState(0),v=new w.Quote(t.quoteUrl),{data:o}=R.useWalletClient(),{initializeSecretManager:b}=W.useSecretManager(B),{orderbook:l}=p.useOrderbook(t.orderBookUrl,u),f=e.useMemo(()=>new E.BitcoinProvider(t.bitcoinNetwork,t.bitcoinRPCUrl),[t.bitcoinNetwork,t.bitcoinRPCUrl]),y=async r=>{if(!i||!l||!o||!u)return a.Err("Garden not initialized");if(!s){const q=await b();if(q.error)return a.Err(q.error)}const n=await i.swap(r);if(n.error)return a.Err(n.error);if(x.isBitcoin(n.val.source_swap.chain))return a.Ok(n.val);const d=await w.switchOrAddNetwork(r.fromAsset.chain,o);if(d.error)return a.Err("Failed to switch network: "+d.error);const h=await new w.EvmRelay(n.val,t.orderBookUrl,u).init(o);return h.error?a.Err(h.error):a.Ok(n.val)},M=async({fromAsset:r,toAsset:n,amount:d,isExactOut:P=!1})=>await v.getQuote(A.constructOrderpair(r,n),d,P);return e.useEffect(()=>{if(!o)return;const r=new S.Siwe(new S.Url(t.orderBookUrl),o,{store:t.store});G(r)},[o]),e.useEffect(()=>{if(!s)return;const r=E.BitcoinWallet.fromPrivateKey(s.getMasterPrivKey(),f);m(r)},[s,f]),e.useEffect(()=>{if(!s||!o||!l||!u)return;const r=new w.Garden({orderbookURl:t.orderBookUrl,secretManager:s,quote:v,auth:u,wallets:{evmWallet:o,btcWallet:U}});C(r)},[s,o,l]),e.useEffect(()=>{i&&(i.execute(),i.on("onPendingOrdersChanged",r=>{g(r.length)}))},[i]),e.createElement(k.Provider,{value:{orderBookUrl:t.orderBookUrl,initializeSecretManager:b,orderBook:l,swap:y,pendingOrdersCount:O,getQuote:M}},c)},Q=()=>{const c=e.useContext(k);if(!c)throw new Error("useGarden must be used within a GardenProvider");return c};exports.GardenContext=k;exports.GardenProvider=N;exports.useGarden=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),x=require("wagmi"),z=require("./index4.cjs"),A=require("./index3.cjs"),u=require("@gardenfi/core"),n=require("@catalogfi/utils"),G=require("@gardenfi/orderbook"),v=require("@catalogfi/wallets"),q=require("@gardenfi/utils"),K=require("./index5.cjs"),R=a.createContext({isExecuting:!1}),Q=({children:b,config:r})=>{const[c,S]=a.useState(),[l,U]=a.useState(),[s,N]=a.useState(),[O,y]=a.useState(),_=a.useMemo(()=>!!(c&&l&&s&&O),[c,l,s,O]),h=a.useMemo(()=>new u.Quote(r.quoteUrl),[r.quoteUrl]),B=a.useMemo(()=>{const e=r.network===v.BitcoinNetwork.Mainnet?"mainnet":r.network===v.BitcoinNetwork.Testnet?"testnet":void 0;return r.blockNumberFetcherUrl&&e?new u.BlockNumberFetcher(r.blockNumberFetcherUrl,e):void 0},[r.blockNumberFetcherUrl,r.network]),P=a.useMemo(()=>new v.BitcoinProvider(r.network,r.bitcoinRPCUrl),[r.network,r.bitcoinRPCUrl]),{data:i}=x.useWalletClient(),{initializeSecretManager:M}=z.useSecretManager(S),{orderbook:m}=A.useOrderbook(r.orderBookUrl,s,y,B),f=async()=>{if(!i||!s)return n.Err("WalletClient or auth not initialized");const e=await M();if(e.error)return n.Err(e.error);const o=v.BitcoinWallet.fromPrivateKey(e.val.getMasterPrivKey(),P),t=new u.Garden({orderbookURl:r.orderBookUrl,secretManager:e.val,quote:h,auth:s,wallets:{evmWallet:i,btcWallet:o},blockNumberFetcher:B});return U(t),n.Ok(t)},g=async e=>{if(!m||!i||!s)return n.Err("Orderbook or walletClient or auth not initialized");let o=l;if(!c||!o){const C=await f();if(C.error)return n.Err(C.error);o=C.val}const t=await o.swap(e);if(t.error)return n.Err(t.error);if(G.isBitcoin(t.val.source_swap.chain))return n.Ok(t.val);const d=await u.switchOrAddNetwork(e.fromAsset.chain,i);if(d.error)return n.Err("Failed to switch network: "+d.error);const p=d.val.walletClient,w=await new u.EvmRelay(t.val,r.orderBookUrl,s).init(p);if(w.error)return n.Err(w.error);const k={...t.val,source_swap:{...t.val.source_swap,initiate_tx_hash:w.val}};return n.Ok(k)},F=async e=>{if(!i||!s)return n.Err("Orderbook or walletClient or auth not initialized");let o=l;if(!c||!o){const k=await f();if(k.error)return n.Err(k.error);o=k.val}if(G.isBitcoin(e.source_swap.chain))return n.Err("Not an EVM order: sourceSwap.chain is Bitcoin");const t=await u.switchOrAddNetwork(e.source_swap.chain,i);if(t.error)return n.Err("Failed to switch network: "+t.error);const d=t.val.walletClient,E=await new u.EvmRelay(e,r.orderBookUrl,s).init(d);if(E.error)return n.Err(E.error);const w={...e,source_swap:{...e.source_swap,initiate_tx_hash:E.val}};return n.Ok(w)},W=async({fromAsset:e,toAsset:o,amount:t,isExactOut:d=!1})=>await h.getQuote(K.constructOrderpair(e,o),t,d);return a.useEffect(()=>{if(!i)return;const e=new q.Siwe(new q.Url(r.orderBookUrl),i,{store:r.store});N(e)},[i]),a.useEffect(()=>{if(!c||!i||!m||!s)return;const e=v.BitcoinWallet.fromPrivateKey(c.getMasterPrivKey(),P),o=new u.Garden({orderbookURl:r.orderBookUrl,secretManager:c,quote:h,auth:s,wallets:{evmWallet:i,btcWallet:e},blockNumberFetcher:B});U(o)},[c,i,m,s]),a.useEffect(()=>{if(!l)return;const e=l.execute(),o=t=>y(t);return l.on("onPendingOrdersChanged",o),()=>{(async()=>(await e)())(),l.off("onPendingOrdersChanged",o)}},[l]),a.createElement(R.Provider,{value:{orderBookUrl:r.orderBookUrl,initializeSecretManager:M,orderBook:m,swap:g,pendingOrders:O,getQuote:W,secretManager:c,garden:l,isExecuting:_,evmInitiate:F,quote:h}},b)},$=()=>{const b=a.useContext(R);if(!b)throw new Error("useGarden must be used within a GardenProvider");return b};exports.GardenContext=R;exports.GardenProvider=Q;exports.useGarden=$;
package/dist/index2.js CHANGED
@@ -1,100 +1,177 @@
1
- import B, { createContext as x, useState as s, useMemo as E, useEffect as m } from "react";
2
- import { useWalletClient as S } from "wagmi";
3
- import { useSecretManager as A } from "./index4.js";
4
- import { useOrderbook as N } from "./index3.js";
5
- import { Quote as Q, Garden as q, switchOrAddNetwork as z, EvmRelay as K } from "@gardenfi/core";
6
- import { Err as l, Ok as b } from "@catalogfi/utils";
7
- import { isBitcoin as F } from "@gardenfi/orderbook";
8
- import { BitcoinProvider as _, BitcoinWallet as j } from "@catalogfi/wallets";
9
- import { Siwe as D, Url as H } from "@gardenfi/utils";
10
- import { constructOrderpair as I } from "./index5.js";
11
- const P = x({}), tr = ({
12
- children: c,
13
- config: e
1
+ import S, { createContext as T, useState as k, useMemo as b, useEffect as R } from "react";
2
+ import { useWalletClient as V } from "wagmi";
3
+ import { useSecretManager as j } from "./index4.js";
4
+ import { useOrderbook as D } from "./index3.js";
5
+ import { Quote as H, BlockNumberFetcher as J, Garden as F, switchOrAddNetwork as G, EvmRelay as N } from "@gardenfi/core";
6
+ import { Err as i, Ok as p } from "@catalogfi/utils";
7
+ import { isBitcoin as x } from "@gardenfi/orderbook";
8
+ import { BitcoinNetwork as W, BitcoinProvider as L, BitcoinWallet as E } from "@catalogfi/wallets";
9
+ import { Siwe as X, Url as Y } from "@gardenfi/utils";
10
+ import { constructOrderpair as Z } from "./index5.js";
11
+ const g = T({
12
+ isExecuting: !1
13
+ }), ce = ({
14
+ children: w,
15
+ config: r
14
16
  }) => {
15
- const [n, U] = s(), [i, C] = s(), [a, G] = s(), [R, y] = s(), [O, M] = s(0), w = new Q(e.quoteUrl), { data: t } = S(), { initializeSecretManager: f } = A(U), { orderbook: d } = N(e.orderBookUrl, a), v = E(
16
- () => new _(e.bitcoinNetwork, e.bitcoinRPCUrl),
17
- [e.bitcoinNetwork, e.bitcoinRPCUrl]
18
- ), W = async (r) => {
19
- if (!i || !d || !t || !a)
20
- return l("Garden not initialized");
21
- if (!n) {
22
- const h = await f();
23
- if (h.error) return l(h.error);
17
+ const [l, z] = k(), [s, B] = k(), [n, K] = k(), [f, P] = k(), q = b(
18
+ () => !!(l && s && n && f),
19
+ [l, s, n, f]
20
+ ), m = b(() => new H(r.quoteUrl), [r.quoteUrl]), U = b(() => {
21
+ const e = r.network === W.Mainnet ? "mainnet" : r.network === W.Testnet ? "testnet" : void 0;
22
+ return r.blockNumberFetcherUrl && e ? new J(
23
+ r.blockNumberFetcherUrl,
24
+ e
25
+ ) : void 0;
26
+ }, [r.blockNumberFetcherUrl, r.network]), y = b(
27
+ () => new L(r.network, r.bitcoinRPCUrl),
28
+ [r.network, r.bitcoinRPCUrl]
29
+ ), { data: a } = V(), { initializeSecretManager: O } = j(z), { orderbook: v } = D(
30
+ r.orderBookUrl,
31
+ n,
32
+ P,
33
+ U
34
+ ), M = async () => {
35
+ if (!a || !n)
36
+ return i("WalletClient or auth not initialized");
37
+ const e = await O();
38
+ if (e.error) return i(e.error);
39
+ const o = E.fromPrivateKey(
40
+ e.val.getMasterPrivKey(),
41
+ y
42
+ ), t = new F({
43
+ orderbookURl: r.orderBookUrl,
44
+ secretManager: e.val,
45
+ quote: m,
46
+ auth: n,
47
+ wallets: {
48
+ evmWallet: a,
49
+ btcWallet: o
50
+ },
51
+ blockNumberFetcher: U
52
+ });
53
+ return B(t), p(t);
54
+ }, A = async (e) => {
55
+ if (!v || !a || !n)
56
+ return i("Orderbook or walletClient or auth not initialized");
57
+ let o = s;
58
+ if (!l || !o) {
59
+ const C = await M();
60
+ if (C.error) return i(C.error);
61
+ o = C.val;
62
+ }
63
+ const t = await o.swap(e);
64
+ if (t.error) return i(t.error);
65
+ if (x(t.val.source_swap.chain)) return p(t.val);
66
+ const c = await G(
67
+ e.fromAsset.chain,
68
+ a
69
+ );
70
+ if (c.error)
71
+ return i("Failed to switch network: " + c.error);
72
+ const _ = c.val.walletClient, u = await new N(t.val, r.orderBookUrl, n).init(_);
73
+ if (u.error) return i(u.error);
74
+ const d = {
75
+ ...t.val,
76
+ source_swap: {
77
+ ...t.val.source_swap,
78
+ initiate_tx_hash: u.val
79
+ }
80
+ };
81
+ return p(d);
82
+ }, Q = async (e) => {
83
+ if (!a || !n)
84
+ return i("Orderbook or walletClient or auth not initialized");
85
+ let o = s;
86
+ if (!l || !o) {
87
+ const d = await M();
88
+ if (d.error) return i(d.error);
89
+ o = d.val;
24
90
  }
25
- const o = await i.swap(r);
26
- if (o.error) return l(o.error);
27
- if (F(o.val.source_swap.chain)) return b(o.val);
28
- const u = await z(
29
- r.fromAsset.chain,
30
- t
91
+ if (x(e.source_swap.chain))
92
+ return i("Not an EVM order: sourceSwap.chain is Bitcoin");
93
+ const t = await G(
94
+ e.source_swap.chain,
95
+ a
31
96
  );
32
- if (u.error)
33
- return l("Failed to switch network: " + u.error);
34
- const p = await new K(o.val, e.orderBookUrl, a).init(t);
35
- return p.error ? l(p.error) : b(o.val);
36
- }, g = async ({
37
- fromAsset: r,
97
+ if (t.error)
98
+ return i("Failed to switch network: " + t.error);
99
+ const c = t.val.walletClient, h = await new N(e, r.orderBookUrl, n).init(c);
100
+ if (h.error) return i(h.error);
101
+ const u = {
102
+ ...e,
103
+ source_swap: {
104
+ ...e.source_swap,
105
+ initiate_tx_hash: h.val
106
+ }
107
+ };
108
+ return p(u);
109
+ }, I = async ({
110
+ fromAsset: e,
38
111
  toAsset: o,
39
- amount: u,
40
- isExactOut: k = !1
41
- }) => await w.getQuote(
42
- I(r, o),
43
- u,
44
- k
112
+ amount: t,
113
+ isExactOut: c = !1
114
+ }) => await m.getQuote(
115
+ Z(e, o),
116
+ t,
117
+ c
45
118
  );
46
- return m(() => {
47
- if (!t) return;
48
- const r = new D(new H(e.orderBookUrl), t, {
49
- store: e.store
119
+ return R(() => {
120
+ if (!a) return;
121
+ const e = new X(new Y(r.orderBookUrl), a, {
122
+ store: r.store
50
123
  });
51
- G(r);
52
- }, [t]), m(() => {
53
- if (!n) return;
54
- const r = j.fromPrivateKey(
55
- n.getMasterPrivKey(),
56
- v
57
- );
58
- y(r);
59
- }, [n, v]), m(() => {
60
- if (!n || !t || !d || !a) return;
61
- const r = new q({
62
- orderbookURl: e.orderBookUrl,
63
- secretManager: n,
64
- quote: w,
65
- auth: a,
124
+ K(e);
125
+ }, [a]), R(() => {
126
+ if (!l || !a || !v || !n) return;
127
+ const e = E.fromPrivateKey(
128
+ l.getMasterPrivKey(),
129
+ y
130
+ ), o = new F({
131
+ orderbookURl: r.orderBookUrl,
132
+ secretManager: l,
133
+ quote: m,
134
+ auth: n,
66
135
  wallets: {
67
- evmWallet: t,
68
- btcWallet: R
69
- }
136
+ evmWallet: a,
137
+ btcWallet: e
138
+ },
139
+ blockNumberFetcher: U
70
140
  });
71
- C(r);
72
- }, [n, t, d]), m(() => {
73
- i && (i.execute(), i.on("onPendingOrdersChanged", (r) => {
74
- M(r.length);
75
- }));
76
- }, [i]), /* @__PURE__ */ B.createElement(
77
- P.Provider,
141
+ B(o);
142
+ }, [l, a, v, n]), R(() => {
143
+ if (!s) return;
144
+ const e = s.execute(), o = (t) => P(t);
145
+ return s.on("onPendingOrdersChanged", o), () => {
146
+ (async () => (await e)())(), s.off("onPendingOrdersChanged", o);
147
+ };
148
+ }, [s]), /* @__PURE__ */ S.createElement(
149
+ g.Provider,
78
150
  {
79
151
  value: {
80
- orderBookUrl: e.orderBookUrl,
81
- initializeSecretManager: f,
82
- orderBook: d,
83
- swap: W,
84
- pendingOrdersCount: O,
85
- getQuote: g
152
+ orderBookUrl: r.orderBookUrl,
153
+ initializeSecretManager: O,
154
+ orderBook: v,
155
+ swap: A,
156
+ pendingOrders: f,
157
+ getQuote: I,
158
+ secretManager: l,
159
+ garden: s,
160
+ isExecuting: q,
161
+ evmInitiate: Q,
162
+ quote: m
86
163
  }
87
164
  },
88
- c
165
+ w
89
166
  );
90
- }, or = () => {
91
- const c = B.useContext(P);
92
- if (!c)
167
+ }, ue = () => {
168
+ const w = S.useContext(g);
169
+ if (!w)
93
170
  throw new Error("useGarden must be used within a GardenProvider");
94
- return c;
171
+ return w;
95
172
  };
96
173
  export {
97
- P as GardenContext,
98
- tr as GardenProvider,
99
- or as useGarden
174
+ g as GardenContext,
175
+ ce as GardenProvider,
176
+ ue as useGarden
100
177
  };
package/dist/index3.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@gardenfi/orderbook"),t=require("react"),b=require("wagmi"),i=(e,r)=>{const{data:o}=b.useWalletClient(),[s,n]=t.useState();return t.useEffect(()=>{if(!o||!e||!r)return;const u=new c.Orderbook({url:e,walletClient:o,auth:r});n(u)},[o,e]),{orderbook:s}};exports.useOrderbook=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@gardenfi/core"),m=require("@gardenfi/orderbook"),i=require("react"),w=require("wagmi"),S=(o,s,b,n)=>{const[t,k]=i.useState(),{data:u}=w.useWalletClient();return i.useEffect(()=>{if(!u||!o||!s)return;const r=new m.Orderbook({url:o,walletClient:u,auth:s});k(r)},[u,o,s]),i.useEffect(()=>{!t||!n||n.fetchBlockNumbers().then(r=>{if(r.error)return;const{val:c}=r;t.fetchOrders(!0,!0,{per_page:500}).then(a=>{if(a.error)return;const O=f.filterDeadlineExpiredOrders(a.val.data).map(e=>{const d=c[e.source_swap.chain],l=c[e.destination_swap.chain];if(!d||!l)return;const p=f.ParseOrderStatus(e,d,l);return{...e,status:p}}).filter(e=>e!==void 0);b(O)})})},[t,n]),{orderbook:t}};exports.useOrderbook=S;
package/dist/index3.js CHANGED
@@ -1,18 +1,43 @@
1
- import { Orderbook as f } from "@gardenfi/orderbook";
2
- import { useState as i, useEffect as m } from "react";
3
- import { useWalletClient as u } from "wagmi";
4
- const a = (e, o) => {
5
- const { data: t } = u(), [r, n] = i();
6
- return m(() => {
7
- if (!t || !e || !o) return;
8
- const s = new f({
9
- url: e,
10
- walletClient: t,
11
- auth: o
1
+ import { filterDeadlineExpiredOrders as O, ParseOrderStatus as k } from "@gardenfi/core";
2
+ import { Orderbook as w } from "@gardenfi/orderbook";
3
+ import { useState as h, useEffect as l } from "react";
4
+ import { useWalletClient as v } from "wagmi";
5
+ const E = (o, n, m, s) => {
6
+ const [r, p] = h(), { data: i } = v();
7
+ return l(() => {
8
+ if (!i || !o || !n) return;
9
+ const e = new w({
10
+ url: o,
11
+ walletClient: i,
12
+ auth: n
12
13
  });
13
- n(s);
14
- }, [t, e]), { orderbook: r };
14
+ p(e);
15
+ }, [i, o, n]), l(() => {
16
+ !r || !s || s.fetchBlockNumbers().then((e) => {
17
+ if (e.error) return;
18
+ const { val: a } = e;
19
+ r.fetchOrders(!0, !0, {
20
+ per_page: 500
21
+ }).then((u) => {
22
+ if (u.error) return;
23
+ const d = O(u.val.data).map((t) => {
24
+ const c = a[t.source_swap.chain], f = a[t.destination_swap.chain];
25
+ if (!c || !f) return;
26
+ const b = k(
27
+ t,
28
+ c,
29
+ f
30
+ );
31
+ return {
32
+ ...t,
33
+ status: b
34
+ };
35
+ }).filter((t) => t !== void 0);
36
+ m(d);
37
+ });
38
+ });
39
+ }, [r, s]), { orderbook: r };
15
40
  };
16
41
  export {
17
- a as useOrderbook
42
+ E as useOrderbook
18
43
  };
@@ -1,12 +1,20 @@
1
+ import { OrderWithStatus, IGardenJS, IQuote, ISecretManager, QuoteResponse, SecretManager, SwapParams } from '@gardenfi/core';
1
2
  import { AsyncResult } from '@catalogfi/utils';
2
3
  import { BitcoinNetwork } from '@catalogfi/wallets';
3
- import { QuoteResponse, SecretManager, SwapParams } from '@gardenfi/core';
4
4
  import { Asset, IOrderbook, MatchedOrder } from '@gardenfi/orderbook';
5
5
  import { IStore } from '@gardenfi/utils';
6
6
 
7
7
  export type GardenContextType = {
8
8
  orderBookUrl?: string;
9
+ /**
10
+ * Initializing secretManager is necessary for executing orders.
11
+ * @returns {AsyncResult<SecretManager, string>} - The secret manager instance.
12
+ */
9
13
  initializeSecretManager?: () => AsyncResult<SecretManager, string>;
14
+ /**
15
+ * The orderbook instance.
16
+ * @returns {IOrderbook}
17
+ */
10
18
  orderBook?: IOrderbook | undefined;
11
19
  /**
12
20
  * Create an order and wait until its matched and then initiates if source chain is EVM.
@@ -14,8 +22,44 @@ export type GardenContextType = {
14
22
  * @returns {AsyncResult<string, string>} - create order ID.
15
23
  */
16
24
  swap?: (params: SwapParams) => AsyncResult<MatchedOrder, string>;
17
- pendingOrdersCount?: number;
25
+ /**
26
+ * Get all the pending orders of the user. This will return all the orders that are yet to be initiated, redeemed, or refunded.
27
+ * It will not return orders that have expired (deadline expiry).
28
+ * @returns {MatchedOrder[]} - The pending orders of the user.
29
+ */
30
+ pendingOrders?: OrderWithStatus[];
31
+ /**
32
+ * Get the quote for the given parameters. This will also return USD values of the assets.
33
+ * @param params
34
+ * @returns
35
+ */
18
36
  getQuote?: (params: QuoteParams) => AsyncResult<QuoteResponse, string>;
37
+ /**
38
+ * The secret manager instance.
39
+ * @returns {ISecretManager}
40
+ */
41
+ secretManager?: ISecretManager;
42
+ /**
43
+ * The garden instance.
44
+ * @returns {IGardenJS}
45
+ */
46
+ garden?: IGardenJS;
47
+ /**
48
+ * Initiates the order in the EVM chain. This can be useful if the initiation is failed when `swap` function is called.
49
+ * @param order - The order to initiate.
50
+ * @returns {AsyncResult<MatchedOrder, string>} - The initiated order.
51
+ * @NOTE This is only required if the source chain is EVM.
52
+ */
53
+ evmInitiate?: (order: MatchedOrder) => AsyncResult<MatchedOrder, string>;
54
+ /**
55
+ * Indicates if the orders are executing.
56
+ */
57
+ isExecuting: boolean;
58
+ /**
59
+ * The quote instance.
60
+ * @returns {IQuote}
61
+ */
62
+ quote?: IQuote;
19
63
  };
20
64
  export type GardenProviderProps = {
21
65
  children: React.ReactNode;
@@ -23,8 +67,9 @@ export type GardenProviderProps = {
23
67
  orderBookUrl: string;
24
68
  quoteUrl: string;
25
69
  store: IStore;
26
- bitcoinNetwork: BitcoinNetwork;
70
+ network: BitcoinNetwork;
27
71
  bitcoinRPCUrl?: string;
72
+ blockNumberFetcherUrl?: string;
28
73
  };
29
74
  };
30
75
  export type QuoteParams = {
@@ -1,6 +1,7 @@
1
+ import { IBlockNumberFetcher, OrderWithStatus } from '@gardenfi/core';
1
2
  import { IOrderbook } from '@gardenfi/orderbook';
2
3
  import { IAuth } from '@gardenfi/utils';
3
4
 
4
- export declare const useOrderbook: (orderBookUrl: string, auth: IAuth | undefined) => {
5
+ export declare const useOrderbook: (orderBookUrl: string, auth: IAuth | undefined, setPendingOrders: React.Dispatch<React.SetStateAction<OrderWithStatus[] | undefined>>, blockNumberFetcher?: IBlockNumberFetcher) => {
5
6
  orderbook: IOrderbook | undefined;
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/react-hooks",
3
- "version": "0.0.1-beta.9",
3
+ "version": "0.0.1-beta.91",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -27,10 +27,10 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@catalogfi/utils": "^0.1.6",
30
- "@catalogfi/wallets": "^0.2.50",
31
- "@gardenfi/core": "^0.2.0-beta.7",
32
- "@gardenfi/orderbook": "^0.2.0-beta.7",
33
- "@gardenfi/utils": "^0.0.1-beta.13",
30
+ "@catalogfi/wallets": "^0.2.51",
31
+ "@gardenfi/core": "^0.2.0-beta.71",
32
+ "@gardenfi/orderbook": "^0.2.0-beta.17",
33
+ "@gardenfi/utils": "^0.0.1-beta.18",
34
34
  "react": "^18.3.1",
35
35
  "viem": "^2.21.15",
36
36
  "wagmi": "^2.12.16"