@gardenfi/react-hooks 0.0.1-beta.83 → 0.0.1-beta.85
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 +1 -1
- package/dist/index2.js +78 -76
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +38 -18
- package/dist/src/lib/context/gardenProvider.types.d.ts +41 -2
- package/dist/src/lib/hooks/useOrderbook.d.ts +3 -2
- package/package.json +2 -2
package/dist/index2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),
|
|
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,41 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useWalletClient as
|
|
3
|
-
import { useSecretManager as
|
|
4
|
-
import { useOrderbook as
|
|
5
|
-
import { Quote as J, Garden as
|
|
6
|
-
import { Err as i, Ok as
|
|
7
|
-
import { isBitcoin as
|
|
8
|
-
import { BitcoinNetwork as
|
|
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
9
|
import { Siwe as X, Url as Y } from "@gardenfi/utils";
|
|
10
10
|
import { constructOrderpair as Z } from "./index5.js";
|
|
11
|
-
const g =
|
|
11
|
+
const g = T({
|
|
12
12
|
isExecuting: !1
|
|
13
13
|
}), ce = ({
|
|
14
14
|
children: w,
|
|
15
15
|
config: r
|
|
16
16
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
() => !!(
|
|
19
|
-
[
|
|
20
|
-
), m =
|
|
21
|
-
r.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} : void 0, O = R(
|
|
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(
|
|
28
27
|
() => new L(r.network, r.bitcoinRPCUrl),
|
|
29
28
|
[r.network, r.bitcoinRPCUrl]
|
|
30
|
-
),
|
|
29
|
+
), { data: a } = V(), { initializeSecretManager: O } = j(z), { orderbook: v } = D(
|
|
30
|
+
r.orderBookUrl,
|
|
31
|
+
n,
|
|
32
|
+
P,
|
|
33
|
+
U
|
|
34
|
+
), M = async () => {
|
|
31
35
|
if (!a || !n)
|
|
32
36
|
return i("WalletClient or auth not initialized");
|
|
33
|
-
const e = await
|
|
37
|
+
const e = await O();
|
|
34
38
|
if (e.error) return i(e.error);
|
|
35
|
-
const o =
|
|
39
|
+
const o = E.fromPrivateKey(
|
|
36
40
|
e.val.getMasterPrivKey(),
|
|
37
|
-
|
|
38
|
-
), t = new
|
|
41
|
+
y
|
|
42
|
+
), t = new F({
|
|
39
43
|
orderbookURl: r.orderBookUrl,
|
|
40
44
|
secretManager: e.val,
|
|
41
45
|
quote: m,
|
|
@@ -44,28 +48,28 @@ const g = V({
|
|
|
44
48
|
evmWallet: a,
|
|
45
49
|
btcWallet: o
|
|
46
50
|
},
|
|
47
|
-
blockNumberFetcher:
|
|
51
|
+
blockNumberFetcher: U
|
|
48
52
|
});
|
|
49
|
-
return
|
|
50
|
-
},
|
|
53
|
+
return B(t), p(t);
|
|
54
|
+
}, A = async (e) => {
|
|
51
55
|
if (!v || !a || !n)
|
|
52
56
|
return i("Orderbook or walletClient or auth not initialized");
|
|
53
|
-
let o =
|
|
54
|
-
if (!
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
o =
|
|
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;
|
|
58
62
|
}
|
|
59
63
|
const t = await o.swap(e);
|
|
60
64
|
if (t.error) return i(t.error);
|
|
61
|
-
if (
|
|
62
|
-
const c = await
|
|
65
|
+
if (x(t.val.source_swap.chain)) return p(t.val);
|
|
66
|
+
const c = await G(
|
|
63
67
|
e.fromAsset.chain,
|
|
64
68
|
a
|
|
65
69
|
);
|
|
66
70
|
if (c.error)
|
|
67
71
|
return i("Failed to switch network: " + c.error);
|
|
68
|
-
const
|
|
72
|
+
const _ = c.val.walletClient, u = await new N(t.val, r.orderBookUrl, n).init(_);
|
|
69
73
|
if (u.error) return i(u.error);
|
|
70
74
|
const d = {
|
|
71
75
|
...t.val,
|
|
@@ -74,35 +78,35 @@ const g = V({
|
|
|
74
78
|
initiate_tx_hash: u.val
|
|
75
79
|
}
|
|
76
80
|
};
|
|
77
|
-
return
|
|
78
|
-
},
|
|
81
|
+
return p(d);
|
|
82
|
+
}, Q = async (e) => {
|
|
79
83
|
if (!a || !n)
|
|
80
84
|
return i("Orderbook or walletClient or auth not initialized");
|
|
81
|
-
let o =
|
|
82
|
-
if (!
|
|
83
|
-
const d = await
|
|
85
|
+
let o = s;
|
|
86
|
+
if (!l || !o) {
|
|
87
|
+
const d = await M();
|
|
84
88
|
if (d.error) return i(d.error);
|
|
85
89
|
o = d.val;
|
|
86
90
|
}
|
|
87
|
-
if (
|
|
91
|
+
if (x(e.source_swap.chain))
|
|
88
92
|
return i("Not an EVM order: sourceSwap.chain is Bitcoin");
|
|
89
|
-
const t = await
|
|
93
|
+
const t = await G(
|
|
90
94
|
e.source_swap.chain,
|
|
91
95
|
a
|
|
92
96
|
);
|
|
93
97
|
if (t.error)
|
|
94
98
|
return i("Failed to switch network: " + t.error);
|
|
95
|
-
const c = t.val.walletClient,
|
|
96
|
-
if (
|
|
99
|
+
const c = t.val.walletClient, h = await new N(e, r.orderBookUrl, n).init(c);
|
|
100
|
+
if (h.error) return i(h.error);
|
|
97
101
|
const u = {
|
|
98
102
|
...e,
|
|
99
103
|
source_swap: {
|
|
100
104
|
...e.source_swap,
|
|
101
|
-
initiate_tx_hash:
|
|
105
|
+
initiate_tx_hash: h.val
|
|
102
106
|
}
|
|
103
107
|
};
|
|
104
|
-
return
|
|
105
|
-
},
|
|
108
|
+
return p(u);
|
|
109
|
+
}, I = async ({
|
|
106
110
|
fromAsset: e,
|
|
107
111
|
toAsset: o,
|
|
108
112
|
amount: t,
|
|
@@ -112,58 +116,56 @@ const g = V({
|
|
|
112
116
|
t,
|
|
113
117
|
c
|
|
114
118
|
);
|
|
115
|
-
return
|
|
119
|
+
return R(() => {
|
|
116
120
|
if (!a) return;
|
|
117
121
|
const e = new X(new Y(r.orderBookUrl), a, {
|
|
118
122
|
store: r.store
|
|
119
123
|
});
|
|
120
|
-
|
|
121
|
-
}, [a]),
|
|
122
|
-
if (!
|
|
123
|
-
const e =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
), o = new
|
|
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({
|
|
127
131
|
orderbookURl: r.orderBookUrl,
|
|
128
|
-
secretManager:
|
|
132
|
+
secretManager: l,
|
|
129
133
|
quote: m,
|
|
130
134
|
auth: n,
|
|
131
135
|
wallets: {
|
|
132
136
|
evmWallet: a,
|
|
133
137
|
btcWallet: e
|
|
134
138
|
},
|
|
135
|
-
blockNumberFetcher:
|
|
139
|
+
blockNumberFetcher: U
|
|
136
140
|
});
|
|
137
|
-
|
|
138
|
-
}, [
|
|
139
|
-
if (!
|
|
140
|
-
const e =
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
}), () => {
|
|
144
|
-
(async () => (await e)())();
|
|
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);
|
|
145
147
|
};
|
|
146
|
-
}, [
|
|
148
|
+
}, [s]), /* @__PURE__ */ S.createElement(
|
|
147
149
|
g.Provider,
|
|
148
150
|
{
|
|
149
151
|
value: {
|
|
150
152
|
orderBookUrl: r.orderBookUrl,
|
|
151
|
-
initializeSecretManager:
|
|
153
|
+
initializeSecretManager: O,
|
|
152
154
|
orderBook: v,
|
|
153
|
-
swap:
|
|
154
|
-
pendingOrders:
|
|
155
|
-
getQuote:
|
|
156
|
-
secretManager:
|
|
157
|
-
garden:
|
|
158
|
-
isExecuting:
|
|
159
|
-
evmInitiate:
|
|
155
|
+
swap: A,
|
|
156
|
+
pendingOrders: f,
|
|
157
|
+
getQuote: I,
|
|
158
|
+
secretManager: l,
|
|
159
|
+
garden: s,
|
|
160
|
+
isExecuting: q,
|
|
161
|
+
evmInitiate: Q,
|
|
160
162
|
quote: m
|
|
161
163
|
}
|
|
162
164
|
},
|
|
163
165
|
w
|
|
164
166
|
);
|
|
165
167
|
}, ue = () => {
|
|
166
|
-
const w =
|
|
168
|
+
const w = S.useContext(g);
|
|
167
169
|
if (!w)
|
|
168
170
|
throw new Error("useGarden must be used within a GardenProvider");
|
|
169
171
|
return w;
|
package/dist/index3.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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,23 +1,43 @@
|
|
|
1
|
-
import { filterDeadlineExpiredOrders as
|
|
2
|
-
import { Orderbook as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useWalletClient as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
if (!
|
|
9
|
-
const
|
|
10
|
-
url:
|
|
11
|
-
walletClient:
|
|
12
|
-
auth:
|
|
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
|
|
13
13
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
});
|
|
18
38
|
});
|
|
19
|
-
}, [
|
|
39
|
+
}, [r, s]), { orderbook: r };
|
|
20
40
|
};
|
|
21
41
|
export {
|
|
22
|
-
|
|
42
|
+
E as useOrderbook
|
|
23
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 { IGardenJS, IQuote, ISecretManager, 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,12 +22,43 @@ export type GardenContextType = {
|
|
|
14
22
|
* @returns {AsyncResult<string, string>} - create order ID.
|
|
15
23
|
*/
|
|
16
24
|
swap?: (params: SwapParams) => AsyncResult<MatchedOrder, string>;
|
|
17
|
-
|
|
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
|
+
*/
|
|
19
41
|
secretManager?: ISecretManager;
|
|
42
|
+
/**
|
|
43
|
+
* The garden instance.
|
|
44
|
+
* @returns {IGardenJS}
|
|
45
|
+
*/
|
|
20
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
|
+
*/
|
|
21
53
|
evmInitiate?: (order: MatchedOrder) => AsyncResult<MatchedOrder, string>;
|
|
54
|
+
/**
|
|
55
|
+
* Indicates if the orders are executing.
|
|
56
|
+
*/
|
|
22
57
|
isExecuting: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The quote instance.
|
|
60
|
+
* @returns {IQuote}
|
|
61
|
+
*/
|
|
23
62
|
quote?: IQuote;
|
|
24
63
|
};
|
|
25
64
|
export type GardenProviderProps = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBlockNumberFetcher, OrderWithStatus } from '@gardenfi/core';
|
|
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, setPendingOrders: React.Dispatch<React.SetStateAction<
|
|
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.
|
|
3
|
+
"version": "0.0.1-beta.85",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@catalogfi/utils": "^0.1.6",
|
|
30
30
|
"@catalogfi/wallets": "^0.2.51",
|
|
31
|
-
"@gardenfi/core": "^0.2.0-beta.
|
|
31
|
+
"@gardenfi/core": "^0.2.0-beta.65",
|
|
32
32
|
"@gardenfi/orderbook": "^0.2.0-beta.14",
|
|
33
33
|
"@gardenfi/utils": "^0.0.1-beta.18",
|
|
34
34
|
"react": "^18.3.1",
|