@gardenfi/orderbook 2.3.2-beta.1 → 2.3.2
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/index.cjs +1 -1
- package/dist/index.js +26 -22
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +74 -69
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +48 -15
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +81 -374
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +379 -6
- package/dist/index6.cjs +1 -0
- package/dist/index6.js +9 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/lib/asset.d.ts +2 -0
- package/dist/src/lib/orderbook/orderbook.d.ts +2 -2
- package/dist/src/lib/orderbook/orderbook.types.d.ts +8 -8
- package/dist/src/lib/orders/orders.types.d.ts +60 -0
- package/dist/src/lib/orders/ordersProvider.d.ts +14 -0
- package/package.json +2 -2
package/dist/index5.js
CHANGED
|
@@ -1,9 +1,382 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Chains as e } from "./index3.js";
|
|
2
|
+
const o = {
|
|
3
|
+
id: 1001,
|
|
4
|
+
name: "Starknet Localnet",
|
|
5
|
+
nativeCurrency: {
|
|
6
|
+
name: "Stark Token",
|
|
7
|
+
symbol: "STRK",
|
|
8
|
+
decimals: 18
|
|
9
|
+
},
|
|
10
|
+
rpcUrls: {
|
|
11
|
+
default: {
|
|
12
|
+
http: ["http://127.0.0.1:8547/"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
testnet: !0
|
|
16
|
+
}, m = {
|
|
17
|
+
id: 31338,
|
|
18
|
+
name: "Arbitrum Localnet",
|
|
19
|
+
nativeCurrency: {
|
|
20
|
+
name: "Ethereum",
|
|
21
|
+
symbol: "ETH",
|
|
22
|
+
decimals: 18
|
|
23
|
+
},
|
|
24
|
+
rpcUrls: {
|
|
25
|
+
default: {
|
|
26
|
+
http: ["http://localhost:8546/"]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
testnet: !0
|
|
30
|
+
}, r = {
|
|
31
|
+
id: 31337,
|
|
32
|
+
name: "Ethereum Localnet",
|
|
33
|
+
nativeCurrency: {
|
|
34
|
+
name: "Ethereum",
|
|
35
|
+
symbol: "ETH",
|
|
36
|
+
decimals: 18
|
|
37
|
+
},
|
|
38
|
+
rpcUrls: {
|
|
39
|
+
default: {
|
|
40
|
+
http: ["http://localhost:8545/"]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
testnet: !0
|
|
44
|
+
}, a = {
|
|
45
|
+
name: "SOL Solana Localnet",
|
|
46
|
+
decimals: 9,
|
|
47
|
+
symbol: "SOL",
|
|
48
|
+
chain: e.solana_localnet,
|
|
49
|
+
atomicSwapAddress: "primary",
|
|
50
|
+
tokenAddress: "primary"
|
|
51
|
+
}, t = {
|
|
52
|
+
name: "Bitcoin Regtest",
|
|
53
|
+
decimals: 8,
|
|
54
|
+
symbol: "BTC",
|
|
55
|
+
chain: e.bitcoin_regtest,
|
|
56
|
+
atomicSwapAddress: "primary",
|
|
57
|
+
tokenAddress: "primary"
|
|
58
|
+
}, s = {
|
|
59
|
+
name: "WBTC Arbitrum Localnet",
|
|
60
|
+
decimals: 8,
|
|
61
|
+
symbol: "WBTC",
|
|
62
|
+
chain: e.arbitrum_localnet,
|
|
63
|
+
// atomicSwapAddress: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
|
|
64
|
+
atomicSwapAddress: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
|
|
65
|
+
//present on localnet
|
|
66
|
+
tokenAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
|
|
67
|
+
}, n = {
|
|
68
|
+
name: "WBTC Ethereum Localnet",
|
|
69
|
+
decimals: 8,
|
|
70
|
+
symbol: "WBTC",
|
|
71
|
+
chain: e.ethereum_localnet,
|
|
72
|
+
// atomicSwapAddress: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
|
|
73
|
+
atomicSwapAddress: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
|
|
74
|
+
//present on localnet
|
|
75
|
+
tokenAddress: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
|
|
76
|
+
}, i = {
|
|
77
|
+
name: "STRK Starknet Localnet",
|
|
78
|
+
decimals: 18,
|
|
79
|
+
symbol: "STRK",
|
|
80
|
+
chain: e.starknet_devnet,
|
|
81
|
+
atomicSwapAddress: "0x15cf8b127aa850c97ed10de6f8b300cabc4f09232a57e63667af02fdef8a55a",
|
|
82
|
+
tokenAddress: "0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"
|
|
83
|
+
}, c = {
|
|
84
|
+
name: "ETH Starknet Localnet",
|
|
85
|
+
decimals: 18,
|
|
86
|
+
symbol: "ETH",
|
|
87
|
+
chain: e.starknet_devnet,
|
|
88
|
+
atomicSwapAddress: "0x1890470168440bbb9df50988748924a74ea22de10d22a081e458737b9574e75",
|
|
89
|
+
tokenAddress: "0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"
|
|
90
|
+
}, b = {
|
|
91
|
+
localnet: {
|
|
92
|
+
solana_localnet_SOL: a,
|
|
93
|
+
arbitrum_localnet_WBTC: s,
|
|
94
|
+
ethereum_localnet_WBTC: n,
|
|
95
|
+
bitcoin_regtest_BTC: t,
|
|
96
|
+
starknet_localnet_STRK: i,
|
|
97
|
+
starknet_localnet_ETH: c
|
|
98
|
+
},
|
|
99
|
+
testnet: {
|
|
100
|
+
solana_testnet_SOL: {
|
|
101
|
+
name: "SOL Solana Testnet",
|
|
102
|
+
decimals: 9,
|
|
103
|
+
symbol: "SOL",
|
|
104
|
+
chain: e.solana_testnet,
|
|
105
|
+
logo: "https://garden-finance.imgix.net/chain_images/solana.png",
|
|
106
|
+
atomicSwapAddress: "primary",
|
|
107
|
+
tokenAddress: "primary"
|
|
108
|
+
},
|
|
109
|
+
bitcoin_testnet_BTC: {
|
|
110
|
+
name: "BTC",
|
|
111
|
+
decimals: 8,
|
|
112
|
+
symbol: "BTC",
|
|
113
|
+
chain: e.bitcoin_testnet,
|
|
114
|
+
tokenAddress: "primary",
|
|
115
|
+
atomicSwapAddress: "primary"
|
|
116
|
+
},
|
|
117
|
+
ethereum_sepolia_WBTC: {
|
|
118
|
+
name: "Wrapped Bitcoin",
|
|
119
|
+
decimals: 8,
|
|
120
|
+
symbol: "WBTC",
|
|
121
|
+
chain: e.ethereum_sepolia,
|
|
122
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
123
|
+
tokenAddress: "0x4D68da063577F98C55166c7AF6955cF58a97b20A",
|
|
124
|
+
atomicSwapAddress: "0x3C6a17b8cD92976D1D91E491c93c98cd81998265"
|
|
125
|
+
},
|
|
126
|
+
arbitrum_sepolia_WBTC: {
|
|
127
|
+
name: "Wrapped Bitcoin",
|
|
128
|
+
decimals: 8,
|
|
129
|
+
symbol: "WBTC",
|
|
130
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
131
|
+
chain: e.arbitrum_sepolia,
|
|
132
|
+
tokenAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf",
|
|
133
|
+
atomicSwapAddress: "0xE918A5a47b8e0AFAC2382bC5D1e981613e63fB07"
|
|
134
|
+
},
|
|
135
|
+
arbitrum_sepolia_SEED: {
|
|
136
|
+
name: "Seed",
|
|
137
|
+
decimals: 18,
|
|
138
|
+
symbol: "SEED",
|
|
139
|
+
chain: e.arbitrum_sepolia,
|
|
140
|
+
logo: "https://garden-finance.imgix.net/token-images/seed.svg",
|
|
141
|
+
tokenAddress: "0x13DCec0762EcC5E666c207ab44Dc768e5e33070F",
|
|
142
|
+
atomicSwapAddress: "0xB47716a220C319b25a532594511D63EC68702CEf"
|
|
143
|
+
},
|
|
144
|
+
arbitrum_sepolia_iBTC: {
|
|
145
|
+
name: "iBTC",
|
|
146
|
+
decimals: 8,
|
|
147
|
+
symbol: "iBTC",
|
|
148
|
+
chain: e.arbitrum_sepolia,
|
|
149
|
+
logo: "https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",
|
|
150
|
+
tokenAddress: "0x685437f025c5f33A94818408C286bc1F023201Fc",
|
|
151
|
+
atomicSwapAddress: "0x88e1032252c712681A3659986F452E910D2134D8"
|
|
152
|
+
},
|
|
153
|
+
base_sepolia_WBTC: {
|
|
154
|
+
name: "Wrapped Bitcoin",
|
|
155
|
+
decimals: 8,
|
|
156
|
+
symbol: "WBTC",
|
|
157
|
+
chain: e.base_sepolia,
|
|
158
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
159
|
+
tokenAddress: "0x13DCec0762EcC5E666c207ab44Dc768e5e33070F",
|
|
160
|
+
atomicSwapAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf"
|
|
161
|
+
},
|
|
162
|
+
base_sepolia_USDT: {
|
|
163
|
+
name: "Tether USD",
|
|
164
|
+
decimals: 6,
|
|
165
|
+
symbol: "USDT",
|
|
166
|
+
chain: e.base_sepolia,
|
|
167
|
+
logo: "https://garden-finance.imgix.net/token-images/usdt.svg",
|
|
168
|
+
tokenAddress: "0xD72Fc3e7D52301b3e5f7d4E3366F88d5C8747520",
|
|
169
|
+
atomicSwapAddress: "0xB391CA6D0A76CD2A927bC314856E8a374a225CFc"
|
|
170
|
+
},
|
|
171
|
+
base_sepolia_iBTC: {
|
|
172
|
+
name: "iBTC",
|
|
173
|
+
decimals: 8,
|
|
174
|
+
symbol: "iBTC",
|
|
175
|
+
chain: e.base_sepolia,
|
|
176
|
+
logo: "https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",
|
|
177
|
+
tokenAddress: "0xbaFb499B60F9E30fd82A54342cb7695C92F5B527",
|
|
178
|
+
atomicSwapAddress: "0xbcdad29ac77e5bb27fd528ab0045af630259fe4f"
|
|
179
|
+
},
|
|
180
|
+
citrea_testnet_WCBTC: {
|
|
181
|
+
name: "Wrapped Citrea Bitcoin",
|
|
182
|
+
decimals: 18,
|
|
183
|
+
symbol: "WCBTC",
|
|
184
|
+
chain: e.citrea_testnet,
|
|
185
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
186
|
+
tokenAddress: "0x8d0c9d1c17aE5e40ffF9bE350f57840E9E66Cd93",
|
|
187
|
+
atomicSwapAddress: "0xaD9d14CA82d9BF97fFf745fFC7d48172A1c0969E"
|
|
188
|
+
},
|
|
189
|
+
citrea_testnet_cBTC: {
|
|
190
|
+
name: "Citrea Bitcoin",
|
|
191
|
+
decimals: 18,
|
|
192
|
+
symbol: "cBTC",
|
|
193
|
+
chain: e.citrea_testnet,
|
|
194
|
+
logo: "https://garden-finance.imgix.net/token-images/bitcoin.svg",
|
|
195
|
+
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
196
|
+
atomicSwapAddress: "0x6218FA00f47a61aCD8B46D6f1b15c4D730F803F2"
|
|
197
|
+
},
|
|
198
|
+
starknet_testnet_WBTC: {
|
|
199
|
+
name: "Wrapped Bitcoin",
|
|
200
|
+
decimals: 8,
|
|
201
|
+
symbol: "WBTC",
|
|
202
|
+
chain: e.starknet_sepolia,
|
|
203
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
204
|
+
tokenAddress: "0x496bef3ed20371382fbe0ca6a5a64252c5c848f9f1f0cccf8110fc4def912d5",
|
|
205
|
+
atomicSwapAddress: "0x06579d255314109429a4477d89629bc2b94f529ae01979c2f8014f9246482603"
|
|
206
|
+
},
|
|
207
|
+
monad_testnet_cbBTC: {
|
|
208
|
+
name: "Coinbase Bitcoin",
|
|
209
|
+
decimals: 8,
|
|
210
|
+
symbol: "cbBTC",
|
|
211
|
+
chain: e.monad_testnet,
|
|
212
|
+
logo: "https://garden-finance.imgix.net/token-images/cbBTC.svg",
|
|
213
|
+
tokenAddress: "0xaD9d14CA82d9BF97fFf745fFC7d48172A1c0969E",
|
|
214
|
+
atomicSwapAddress: "0x1dC94FdcAd8Aee13cfd34Db8a26d26E31572805c"
|
|
215
|
+
},
|
|
216
|
+
monad_testnet_USDC: {
|
|
217
|
+
name: "USD Coin",
|
|
218
|
+
decimals: 6,
|
|
219
|
+
symbol: "USDC",
|
|
220
|
+
chain: e.monad_testnet,
|
|
221
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
222
|
+
tokenAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf",
|
|
223
|
+
atomicSwapAddress: "0xE99D8A21d4F2ad2f90c279c869311503f9e25867"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
mainnet: {
|
|
227
|
+
bitcoin_BTC: {
|
|
228
|
+
name: "BTC",
|
|
229
|
+
decimals: 8,
|
|
230
|
+
symbol: "BTC",
|
|
231
|
+
chain: e.bitcoin,
|
|
232
|
+
tokenAddress: "primary",
|
|
233
|
+
atomicSwapAddress: "primary"
|
|
234
|
+
},
|
|
235
|
+
base_cbBTC: {
|
|
236
|
+
name: "Coinbase Bitcoin",
|
|
237
|
+
decimals: 8,
|
|
238
|
+
symbol: "cbBTC",
|
|
239
|
+
chain: e.base,
|
|
240
|
+
logo: "https://garden-finance.imgix.net/token-images/cbBTC.svg",
|
|
241
|
+
tokenAddress: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
|
|
242
|
+
atomicSwapAddress: "0xeae7721d779276eb0f5837e2fe260118724a2ba4"
|
|
243
|
+
},
|
|
244
|
+
base_USDC: {
|
|
245
|
+
name: "USD Coin",
|
|
246
|
+
decimals: 6,
|
|
247
|
+
symbol: "USDC",
|
|
248
|
+
chain: e.base,
|
|
249
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
250
|
+
tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
251
|
+
atomicSwapAddress: "0xd8a6e3fca403d79b6ad6216b60527f51cc967d39"
|
|
252
|
+
},
|
|
253
|
+
ethereum_WBTC: {
|
|
254
|
+
name: "Wrapped Bitcoin",
|
|
255
|
+
decimals: 8,
|
|
256
|
+
symbol: "WBTC",
|
|
257
|
+
chain: e.ethereum,
|
|
258
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
259
|
+
tokenAddress: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
|
260
|
+
atomicSwapAddress: "0x795dcb58d1cd4789169d5f938ea05e17eceb68ca"
|
|
261
|
+
},
|
|
262
|
+
ethereum_USDC: {
|
|
263
|
+
name: "USD Coin",
|
|
264
|
+
decimals: 6,
|
|
265
|
+
symbol: "USDC",
|
|
266
|
+
chain: e.ethereum,
|
|
267
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
268
|
+
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
269
|
+
atomicSwapAddress: "0xd8a6e3fca403d79b6ad6216b60527f51cc967d39"
|
|
270
|
+
},
|
|
271
|
+
ethereum_cbBTC: {
|
|
272
|
+
name: "Coinbase Bitcoin",
|
|
273
|
+
decimals: 8,
|
|
274
|
+
symbol: "cbBTC",
|
|
275
|
+
chain: e.ethereum,
|
|
276
|
+
logo: "https://garden-finance.imgix.net/token-images/cbBTC.svg",
|
|
277
|
+
tokenAddress: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
|
|
278
|
+
atomicSwapAddress: "0xeae7721d779276eb0f5837e2fe260118724a2ba4"
|
|
279
|
+
},
|
|
280
|
+
arbitrum_WBTC: {
|
|
281
|
+
name: "Wrapped Bitcoin",
|
|
282
|
+
decimals: 8,
|
|
283
|
+
symbol: "WBTC",
|
|
284
|
+
chain: e.arbitrum,
|
|
285
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
286
|
+
tokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
287
|
+
atomicSwapAddress: "0x6b6303fab8ec7232b4f2a7b9fa58e5216f608fcb"
|
|
288
|
+
},
|
|
289
|
+
arbitrum_USDC: {
|
|
290
|
+
name: "USD Coin",
|
|
291
|
+
decimals: 6,
|
|
292
|
+
symbol: "USDC",
|
|
293
|
+
chain: e.arbitrum,
|
|
294
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
295
|
+
tokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
296
|
+
atomicSwapAddress: "0xeae7721d779276eb0f5837e2fe260118724a2ba4"
|
|
297
|
+
},
|
|
298
|
+
arbitrum_iBTC: {
|
|
299
|
+
name: "iBTC",
|
|
300
|
+
decimals: 8,
|
|
301
|
+
symbol: "iBTC",
|
|
302
|
+
chain: e.arbitrum,
|
|
303
|
+
logo: "https://garden-finance.imgix.net/token-images/iBTC.svg",
|
|
304
|
+
tokenAddress: "0x050C24dBf1eEc17babE5fc585F06116A259CC77A",
|
|
305
|
+
atomicSwapAddress: "0xdc74a45e86dedf1ff7c6dac77e0c2f082f9e4f72"
|
|
306
|
+
},
|
|
307
|
+
bera_LBTC: {
|
|
308
|
+
name: "Lombard Bitcoin",
|
|
309
|
+
decimals: 8,
|
|
310
|
+
symbol: "LBTC",
|
|
311
|
+
chain: e.bera,
|
|
312
|
+
logo: "https://garden-finance.imgix.net/token-images/LBTC.svg",
|
|
313
|
+
tokenAddress: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
|
|
314
|
+
atomicSwapAddress: "0x39f3294352208905fc6ebf033954E6c6455CdB4C"
|
|
315
|
+
},
|
|
316
|
+
hyperliquid_uBTC: {
|
|
317
|
+
name: "Unit Bitcoin",
|
|
318
|
+
decimals: 8,
|
|
319
|
+
symbol: "uBTC",
|
|
320
|
+
chain: e.hyperliquid,
|
|
321
|
+
tokenAddress: "0x9FDBdA0A5e284c32744D2f17Ee5c74B284993463",
|
|
322
|
+
atomicSwapAddress: "0x39f3294352208905fc6ebf033954E6c6455CdB4C"
|
|
323
|
+
},
|
|
324
|
+
starknet_WBTC: {
|
|
325
|
+
name: "Wrapped Bitcoin",
|
|
326
|
+
decimals: 8,
|
|
327
|
+
symbol: "WBTC",
|
|
328
|
+
chain: e.starknet,
|
|
329
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
330
|
+
tokenAddress: "0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
|
|
331
|
+
atomicSwapAddress: "0x7defd8eb3b770005ab1ca5f89ad31f98fb5bc3c52deaeafd130be3b49f967b4"
|
|
332
|
+
},
|
|
333
|
+
unichain_USDC: {
|
|
334
|
+
name: "USD Coin",
|
|
335
|
+
decimals: 6,
|
|
336
|
+
symbol: "USDC",
|
|
337
|
+
chain: e.unichain,
|
|
338
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
339
|
+
tokenAddress: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
|
|
340
|
+
atomicSwapAddress: "0x795Dcb58d1cd4789169D5F938Ea05E17ecEB68cA"
|
|
341
|
+
},
|
|
342
|
+
corn_BTCN: {
|
|
343
|
+
name: "Bitcorn",
|
|
344
|
+
decimals: 18,
|
|
345
|
+
symbol: "BTCN",
|
|
346
|
+
chain: e.corn,
|
|
347
|
+
logo: "https://garden-finance.imgix.net/token-images/bitcorn.jpg",
|
|
348
|
+
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
349
|
+
atomicSwapAddress: "0xeaE7721d779276eb0f5837e2fE260118724a2Ba4"
|
|
350
|
+
},
|
|
351
|
+
solana_SOL: {
|
|
352
|
+
name: "Solana ",
|
|
353
|
+
decimals: 9,
|
|
354
|
+
symbol: "SOL",
|
|
355
|
+
chain: e.solana,
|
|
356
|
+
logo: "https://garden-finance.imgix.net/chain_images/solana.png",
|
|
357
|
+
tokenAddress: "primary",
|
|
358
|
+
atomicSwapAddress: "2bag6xpshpvPe7SJ9nSDLHpxqhEAoHPGpEkjNSv7gxoF"
|
|
359
|
+
},
|
|
360
|
+
botanix_BOTX: {
|
|
361
|
+
name: "Botanix",
|
|
362
|
+
decimals: 18,
|
|
363
|
+
symbol: "BTC",
|
|
364
|
+
chain: e.botanix,
|
|
365
|
+
logo: "https://garden-finance.imgix.net/chain_images/BotanixLogo.svg",
|
|
366
|
+
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
367
|
+
atomicSwapAddress: "0x39f3294352208905fc6ebf033954E6c6455CdB4C"
|
|
368
|
+
}
|
|
369
|
+
}
|
|
6
370
|
};
|
|
7
371
|
export {
|
|
8
|
-
|
|
372
|
+
m as ArbitrumLocalnet,
|
|
373
|
+
c as ETHStarknetLocalnetAsset,
|
|
374
|
+
r as EthereumLocalnet,
|
|
375
|
+
a as SOLSolanaLocalnetAsset,
|
|
376
|
+
i as STRKStarknetLocalnetAsset,
|
|
377
|
+
o as StarknetLocalnet,
|
|
378
|
+
b as SupportedAssets,
|
|
379
|
+
s as WBTCArbitrumLocalnetAsset,
|
|
380
|
+
n as WBTCEthereumLocalnetAsset,
|
|
381
|
+
t as bitcoinRegtestAsset
|
|
9
382
|
};
|
package/dist/index6.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=(n,o,t)=>{const r=n.endpoint(o);return t&&Object.entries(t).forEach(([c,e])=>{e!==void 0&&r.searchParams.append(c,e.toString())}),r};exports.ConstructUrl=i;
|
package/dist/index6.js
ADDED
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { Orderbook } from './lib/orderbook/orderbook';
|
|
2
2
|
export type * from './lib/orderbook/orderbook.types';
|
|
3
3
|
export type { Chain, EvmChain, Asset } from './lib/asset';
|
|
4
|
-
export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, isStarknet, isSolana, getBlockchainType, NetworkType, NativeTokenAddress, isEvmNativeToken, isSolanaNativeToken, } from './lib/asset';
|
|
4
|
+
export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, isStarknet, isSolana, getBlockchainType, NetworkType, TimeLocks, getTimeLock, NativeTokenAddress, isEvmNativeToken, isSolanaNativeToken, } from './lib/asset';
|
|
5
|
+
export { OrdersProvider } from './lib/orders/ordersProvider';
|
|
6
|
+
export type { IOrderProvider } from './lib/orders/orders.types';
|
|
5
7
|
export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, bitcoinRegtestAsset, SOLSolanaLocalnetAsset, SupportedAssets, StarknetLocalnet, STRKStarknetLocalnetAsset, } from './lib/constants';
|
package/dist/src/lib/asset.d.ts
CHANGED
|
@@ -66,7 +66,9 @@ export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_
|
|
|
66
66
|
export declare const isEVM: (chain: Chain) => chain is "ethereum" | "base" | "arbitrum" | "ethereum_sepolia" | "arbitrum_localnet" | "arbitrum_sepolia" | "ethereum_localnet" | "base_sepolia" | "bera_testnet" | "citrea_testnet" | "bera" | "monad_testnet" | "hyperliquid_testnet" | "hyperliquid" | "unichain" | "corn" | "botanix";
|
|
67
67
|
export declare const isSolana: (chain: Chain) => chain is "solana" | "solana_testnet" | "solana_localnet";
|
|
68
68
|
export declare const isStarknet: (chain: Chain) => chain is "starknet" | "starknet_sepolia" | "starknet_devnet";
|
|
69
|
+
export declare const TimeLocks: Record<Chain, number>;
|
|
69
70
|
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
71
|
+
export declare const getTimeLock: (chain: Chain) => number;
|
|
70
72
|
export declare const NativeTokenAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
71
73
|
export declare const isEvmNativeToken: (chain: Chain, tokenAddress: string) => boolean;
|
|
72
74
|
export declare const isSolanaNativeToken: (chain: Chain, tokenAddress: string) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateOrder,
|
|
1
|
+
import { CreateOrder, CreateOrderRequestWithAdditionalData, IOrderbook, MatchedOrder, PaginatedData, PaginationConfig, Status } from './orderbook.types';
|
|
2
2
|
import { AsyncResult, IAuth, Url } from '@gardenfi/utils';
|
|
3
3
|
import { Chain } from '../asset';
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ export declare class Orderbook implements IOrderbook {
|
|
|
16
16
|
* @param {IAuth} auth - The auth object.
|
|
17
17
|
* @returns {string} The create order ID.
|
|
18
18
|
*/
|
|
19
|
-
createOrder(order:
|
|
19
|
+
createOrder(order: CreateOrderRequestWithAdditionalData, auth: IAuth): AsyncResult<string, string>;
|
|
20
20
|
getOrder<T extends boolean>(id: string, matched: T): AsyncResult<T extends true ? MatchedOrder : CreateOrder, string>;
|
|
21
21
|
getMatchedOrders(address: string, status: Status, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<MatchedOrder>, string>;
|
|
22
22
|
getUnMatchedOrders(address: string, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<CreateOrder>, string>;
|
|
@@ -88,7 +88,7 @@ export interface IOrderbook {
|
|
|
88
88
|
* @param {CreateOrderConfig} orderConfig - The configuration for the creating the order.
|
|
89
89
|
* @returns {number} The create order ID.
|
|
90
90
|
*/
|
|
91
|
-
createOrder(order:
|
|
91
|
+
createOrder(order: CreateOrderRequestWithAdditionalData, auth: IAuth): AsyncResult<string, string>;
|
|
92
92
|
/**
|
|
93
93
|
* Get the order from orderbook based on provided Id and match status.
|
|
94
94
|
* @param id - The create Id of the order
|
|
@@ -195,18 +195,18 @@ export type CreateOrderRequest = {
|
|
|
195
195
|
destination_chain: string;
|
|
196
196
|
source_asset: string;
|
|
197
197
|
destination_asset: string;
|
|
198
|
+
initiator_source_address: string;
|
|
199
|
+
initiator_destination_address: string;
|
|
198
200
|
source_amount: string;
|
|
199
201
|
destination_amount: string;
|
|
202
|
+
fee: string;
|
|
200
203
|
nonce: string;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
secret_hash
|
|
204
|
+
min_destination_confirmations: number;
|
|
205
|
+
timelock: number;
|
|
206
|
+
secret_hash: string;
|
|
204
207
|
};
|
|
205
208
|
export type CreateOrderRequestWithAdditionalData = CreateOrderRequest & AdditionalData & AffiliateFeeList<AffiliateFeeWithAmount>;
|
|
206
209
|
export type CreateOrder = CreateOrderRequestWithAdditionalData & {
|
|
207
|
-
fee: string;
|
|
208
|
-
min_destination_confirmations: number;
|
|
209
|
-
timelock: number;
|
|
210
210
|
created_at: string;
|
|
211
211
|
updated_at: string;
|
|
212
212
|
deleted_at: string | null;
|
|
@@ -250,7 +250,7 @@ export type PaginatedData<T> = {
|
|
|
250
250
|
total_items: number;
|
|
251
251
|
per_page: number;
|
|
252
252
|
};
|
|
253
|
-
export type CreateOrderResponse = APIResponse<
|
|
253
|
+
export type CreateOrderResponse = APIResponse<string>;
|
|
254
254
|
export type PaginationConfig = {
|
|
255
255
|
page?: number;
|
|
256
256
|
per_page?: number;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AsyncResult } from '@gardenfi/utils';
|
|
2
|
+
import { CreateOrder, MatchedOrder, PaginatedData, PaginationConfig } from '../orderbook/orderbook.types';
|
|
3
|
+
|
|
4
|
+
export interface IOrderProvider {
|
|
5
|
+
/**
|
|
6
|
+
* Get the order from orderbook based on provided Id and match status.
|
|
7
|
+
* @param id - The create Id of the order
|
|
8
|
+
* @template T - If true, returns matched order, else returns create order (unmatched Order).
|
|
9
|
+
* @returns {AsyncResult<T extends true ? MatchedOrder : CreateOrder, string>} A promise that resolves to the order.
|
|
10
|
+
*/
|
|
11
|
+
getOrder<T extends boolean>(id: string, matched: T): AsyncResult<T extends true ? MatchedOrder : CreateOrder, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Get all matched orders from the orderbook associated with the `address`.
|
|
14
|
+
* @param address The address to get the orders for.
|
|
15
|
+
* @param pending If true, returns pending orders, else returns all matched orders.
|
|
16
|
+
* @param paginationConfig - The configuration for the pagination.
|
|
17
|
+
* @returns {AsyncResult<PaginatedData<MatchedOrder>, string>} A promise that resolves to the orders.
|
|
18
|
+
*/
|
|
19
|
+
getMatchedOrders(address: string, pending: boolean, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<MatchedOrder>, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Get all unmatched orders from the orderbook associated with the `address`.
|
|
22
|
+
* @param address The address to get the orders for.
|
|
23
|
+
* @param paginationConfig - The configuration for the pagination.
|
|
24
|
+
* @returns {AsyncResult<PaginatedData<CreateOrder>, string>} A promise that resolves to the orders.
|
|
25
|
+
*/
|
|
26
|
+
getUnMatchedOrders(address: string, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<CreateOrder>, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get all orders from the orderbook based on the match status.
|
|
29
|
+
* @param matched - If true, returns matched orders, else returns unmatched orders.
|
|
30
|
+
* @param paginationConfig - The configuration for the pagination.
|
|
31
|
+
* @returns {AsyncResult<PaginatedData<T extends true ? MatchedOrder : CreateOrder>, string>} A promise that resolves to the orders.
|
|
32
|
+
*/
|
|
33
|
+
getOrders<T extends boolean>(matched: T, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<T extends true ? MatchedOrder : CreateOrder>, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Polls for every provided interval and returns matched and unmatched orders associated on the account.
|
|
36
|
+
* @param account The account to subscribe to
|
|
37
|
+
* @param matched If true, returns matched orders, else returns unmatched orders
|
|
38
|
+
* @param cb Th ack to be called when the orders are updated
|
|
39
|
+
* @param interval The interval to poll for updates
|
|
40
|
+
*
|
|
41
|
+
* Example usage:
|
|
42
|
+
*
|
|
43
|
+
* ```js
|
|
44
|
+
* const unsubscribe =await orderbook.subscribeOrders(account, matched, interval, handleOrders, paginationConfig);
|
|
45
|
+
*
|
|
46
|
+
* // Unsubscribe after 20 seconds
|
|
47
|
+
* setTimeout(() => {
|
|
48
|
+
* unsubscribe();
|
|
49
|
+
* console.log('Unsubscribed from orders');
|
|
50
|
+
* }, 20000);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
subscribeOrders<T extends boolean>(account: string, matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>, pending?: boolean, paginationConfig?: PaginationConfig): Promise<() => void>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the current orders count associated with the provided address. Used to calculate nonce for secret generation.
|
|
56
|
+
* @param address The address to get the orders count for.
|
|
57
|
+
* @returns {AsyncResult<number, string>} A promise that resolves to the orders count.
|
|
58
|
+
*/
|
|
59
|
+
getOrdersCount(address: string): AsyncResult<number, string>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IOrderProvider } from './orders.types';
|
|
2
|
+
import { CreateOrder, MatchedOrder, PaginatedData, PaginationConfig } from '../orderbook/orderbook.types';
|
|
3
|
+
import { AsyncResult, Url } from '@gardenfi/utils';
|
|
4
|
+
|
|
5
|
+
export declare class OrdersProvider implements IOrderProvider {
|
|
6
|
+
private url;
|
|
7
|
+
constructor(url: string | Url);
|
|
8
|
+
getOrder<T extends boolean>(id: string, matched: T): AsyncResult<T extends true ? MatchedOrder : CreateOrder, string>;
|
|
9
|
+
getMatchedOrders(address: string, pending: boolean, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<MatchedOrder>, string>;
|
|
10
|
+
getUnMatchedOrders(address: string, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<CreateOrder>, string>;
|
|
11
|
+
getOrders<T extends boolean>(matched: T, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<T extends true ? MatchedOrder : CreateOrder>, string>;
|
|
12
|
+
subscribeOrders<T extends boolean>(account: string, matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>, pending?: boolean, paginationConfig?: PaginationConfig): Promise<() => void>;
|
|
13
|
+
getOrdersCount(address: string): AsyncResult<number, string>;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gardenfi/orderbook",
|
|
3
|
-
"version": "2.3.2
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@coral-xyz/anchor": "^0.30.1",
|
|
30
|
-
"@gardenfi/utils": "2.3.
|
|
30
|
+
"@gardenfi/utils": "2.3.2",
|
|
31
31
|
"bufferutil": "^4.0.8",
|
|
32
32
|
"siwe": "^2.1.4",
|
|
33
33
|
"utf-8-validate": "^6.0.3",
|