@gardenfi/orderbook 2.1.7-beta.7 → 2.1.7-beta.8
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 +20 -23
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +38 -40
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +19 -31
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +21 -22
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +26 -57
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +6 -187
- package/dist/src/index.d.ts +2 -2
- package/dist/src/lib/asset.d.ts +3 -10
- package/dist/src/lib/constants.d.ts +2 -22
- package/dist/src/lib/orderbook/orderbook.d.ts +1 -2
- package/dist/src/lib/orderbook/orderbook.types.d.ts +1 -2
- package/dist/src/lib/orders/orders.types.d.ts +1 -1
- package/dist/src/lib/orders/ordersProvider.d.ts +1 -2
- package/package.json +2 -3
- package/dist/index7.cjs +0 -1
- package/dist/index7.js +0 -9
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index2.cjs"),e=require("./index3.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index2.cjs"),e=require("./index3.cjs"),r=require("./index4.cjs"),t=require("./index5.cjs");exports.Orderbook=s.Orderbook;exports.BlockchainType=e.BlockchainType;exports.Chains=e.Chains;exports.NativeTokenAddress=e.NativeTokenAddress;exports.NetworkType=e.NetworkType;exports.TimeLocks=e.TimeLocks;exports.getBlockchainType=e.getBlockchainType;exports.getTimeLock=e.getTimeLock;exports.isBitcoin=e.isBitcoin;exports.isEVM=e.isEVM;exports.isEvmNativeToken=e.isEvmNativeToken;exports.isMainnet=e.isMainnet;exports.isStarknet=e.isStarknet;exports.OrdersProvider=r.OrdersProvider;exports.ArbitrumLocalnet=t.ArbitrumLocalnet;exports.EthereumLocalnet=t.EthereumLocalnet;exports.STRKStarknetLocalnetAsset=t.STRKStarknetLocalnetAsset;exports.StarknetLocalnet=t.StarknetLocalnet;exports.SupportedAssets=t.SupportedAssets;exports.WBTCArbitrumLocalnetAsset=t.WBTCArbitrumLocalnetAsset;exports.WBTCEthereumLocalnetAsset=t.WBTCEthereumLocalnetAsset;exports.bitcoinRegtestAsset=t.bitcoinRegtestAsset;
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
import { Orderbook as o } from "./index2.js";
|
|
2
|
-
import { BlockchainType as s, Chains as
|
|
3
|
-
import { OrdersProvider as
|
|
4
|
-
import { ArbitrumLocalnet as B, EthereumLocalnet as
|
|
2
|
+
import { BlockchainType as s, Chains as i, NativeTokenAddress as n, NetworkType as a, TimeLocks as c, getBlockchainType as k, getTimeLock as m, isBitcoin as T, isEVM as p, isEvmNativeToken as l, isMainnet as A, isStarknet as L } from "./index3.js";
|
|
3
|
+
import { OrdersProvider as h } from "./index4.js";
|
|
4
|
+
import { ArbitrumLocalnet as B, EthereumLocalnet as S, STRKStarknetLocalnetAsset as b, StarknetLocalnet as f, SupportedAssets as v, WBTCArbitrumLocalnetAsset as x, WBTCEthereumLocalnetAsset as E, bitcoinRegtestAsset as g } from "./index5.js";
|
|
5
5
|
export {
|
|
6
6
|
B as ArbitrumLocalnet,
|
|
7
7
|
s as BlockchainType,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
i as Chains,
|
|
9
|
+
S as EthereumLocalnet,
|
|
10
|
+
n as NativeTokenAddress,
|
|
11
|
+
a as NetworkType,
|
|
12
12
|
o as Orderbook,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
N as SupportedAssets,
|
|
13
|
+
h as OrdersProvider,
|
|
14
|
+
b as STRKStarknetLocalnetAsset,
|
|
15
|
+
f as StarknetLocalnet,
|
|
16
|
+
v as SupportedAssets,
|
|
18
17
|
c as TimeLocks,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
x as WBTCArbitrumLocalnetAsset,
|
|
19
|
+
E as WBTCEthereumLocalnetAsset,
|
|
20
|
+
g as bitcoinRegtestAsset,
|
|
22
21
|
k as getBlockchainType,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
S as isSolanaNativeToken,
|
|
30
|
-
d as isStarknet
|
|
22
|
+
m as getTimeLock,
|
|
23
|
+
T as isBitcoin,
|
|
24
|
+
p as isEVM,
|
|
25
|
+
l as isEvmNativeToken,
|
|
26
|
+
A as isMainnet,
|
|
27
|
+
L as isStarknet
|
|
31
28
|
};
|
package/dist/index2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@gardenfi/utils"),i=require("./index6.cjs");class h{constructor(n){this.Url=n}async createOrder(n,o){const t=await o.getAuthHeaders();if(t.error)return r.Err(t.error);try{const s=await r.Fetcher.post(this.Url.endpoint("/relayer").endpoint("create-order"),{body:JSON.stringify(n),headers:{...t.val,"Content-Type":"application/json"}});return s.error?r.Err(s.error):s.result?r.Ok(s.result):r.Err("CreateOrder: Unexpected error, result is undefined")}catch(s){return r.Err("CreateOrder:",String(s))}}async getOrder(n,o){const t=o?`/id/${n}/matched`:`/id/${n}/unmatched`,s=this.Url.endpoint("orders").endpoint(t);try{const e=await r.Fetcher.get(s);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetOrder: Unexpected error, result is undefined")}catch(e){return r.Err("GetOrder:",String(e))}}async getMatchedOrders(n,o,t){const s=i.ConstructUrl(this.Url.endpoint("orders"),`/user/${n}/matched`,{...t,status:o});try{const e=await r.Fetcher.get(s);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetMatchedOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetMatchedOrders:",String(e))}}async getUnMatchedOrders(n,o){const t=i.ConstructUrl(this.Url.endpoint("orders"),`/user/${n}/unmatched`,o);try{const s=await r.Fetcher.get(t);return s.error?r.Err(s.error):s.result?r.Ok(s.result):r.Err("GetUnMatchedOrders: Unexpected error, result is undefined")}catch(s){return r.Err("GetUnMatchedOrders:",String(s))}}async getOrders(n,o){const t=n?"/matched":"/unmatched",s=i.ConstructUrl(this.Url.endpoint("orders"),t,o);try{const e=await r.Fetcher.get(s);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetAllOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetAllOrders:",String(e))}}async subscribeOrders(n,o,t,s,e="all",u){let d=!1;const a=async()=>{if(!d){d=!0;try{const c=o?await this.getMatchedOrders(n,e,u):await this.getUnMatchedOrders(n,u);c.ok?await s(c.val):console.error("Error fetching orders:",c.error)}catch(c){console.error("Error fetching orders:",c)}finally{d=!1}}};await a();const l=setInterval(a,t);return()=>{clearInterval(l)}}async getOrdersCount(n){const o=this.Url.endpoint("orders").endpoint(`/user/${n}/count`);try{const t=await r.Fetcher.get(o);return t.error?r.Err(t.error):t.status===r.ApiStatus.Ok&&t.result!==void 0?r.Ok(t.result):r.Err("GetOrdersCount: Unexpected error, result is undefined")}catch(t){return r.Err("GetOrdersCount:",String(t))}}}exports.Orderbook=h;
|
package/dist/index2.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Err as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.Url = n;
|
|
1
|
+
import { Err as n, Fetcher as d, Ok as c, ApiStatus as f } from "@gardenfi/utils";
|
|
2
|
+
import { ConstructUrl as u } from "./index6.js";
|
|
3
|
+
class U {
|
|
4
|
+
constructor(s) {
|
|
5
|
+
this.Url = s;
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
9
8
|
* Creates an order
|
|
@@ -11,39 +10,38 @@ class m {
|
|
|
11
10
|
* @param {IAuth} auth - The auth object.
|
|
12
11
|
* @returns {string} The create order ID.
|
|
13
12
|
*/
|
|
14
|
-
async createOrder(
|
|
13
|
+
async createOrder(s, o) {
|
|
15
14
|
const e = await o.getAuthHeaders();
|
|
16
|
-
if (e.error)
|
|
17
|
-
return s(e.error);
|
|
15
|
+
if (e.error) return n(e.error);
|
|
18
16
|
try {
|
|
19
17
|
const t = await d.post(
|
|
20
18
|
this.Url.endpoint("/relayer").endpoint("create-order"),
|
|
21
19
|
{
|
|
22
|
-
body: JSON.stringify(
|
|
20
|
+
body: JSON.stringify(s),
|
|
23
21
|
headers: {
|
|
24
22
|
...e.val,
|
|
25
23
|
"Content-Type": "application/json"
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
);
|
|
29
|
-
return t.error ?
|
|
27
|
+
return t.error ? n(t.error) : t.result ? c(t.result) : n("CreateOrder: Unexpected error, result is undefined");
|
|
30
28
|
} catch (t) {
|
|
31
|
-
return
|
|
29
|
+
return n("CreateOrder:", String(t));
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
|
-
async getOrder(
|
|
35
|
-
const e = o ? `/id/${
|
|
32
|
+
async getOrder(s, o) {
|
|
33
|
+
const e = o ? `/id/${s}/matched` : `/id/${s}/unmatched`, t = this.Url.endpoint("orders").endpoint(e);
|
|
36
34
|
try {
|
|
37
35
|
const r = await d.get(t);
|
|
38
|
-
return r.error ?
|
|
36
|
+
return r.error ? n(r.error) : r.result ? c(r.result) : n("GetOrder: Unexpected error, result is undefined");
|
|
39
37
|
} catch (r) {
|
|
40
|
-
return
|
|
38
|
+
return n("GetOrder:", String(r));
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
|
-
async getMatchedOrders(
|
|
41
|
+
async getMatchedOrders(s, o, e) {
|
|
44
42
|
const t = u(
|
|
45
43
|
this.Url.endpoint("orders"),
|
|
46
|
-
`/user/${
|
|
44
|
+
`/user/${s}/matched`,
|
|
47
45
|
{
|
|
48
46
|
...e,
|
|
49
47
|
status: o
|
|
@@ -53,51 +51,51 @@ class m {
|
|
|
53
51
|
const r = await d.get(
|
|
54
52
|
t
|
|
55
53
|
);
|
|
56
|
-
return r.error ?
|
|
54
|
+
return r.error ? n(r.error) : r.result ? c(r.result) : n("GetMatchedOrders: Unexpected error, result is undefined");
|
|
57
55
|
} catch (r) {
|
|
58
|
-
return
|
|
56
|
+
return n("GetMatchedOrders:", String(r));
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
|
-
async getUnMatchedOrders(
|
|
59
|
+
async getUnMatchedOrders(s, o) {
|
|
62
60
|
const e = u(
|
|
63
61
|
this.Url.endpoint("orders"),
|
|
64
|
-
`/user/${
|
|
62
|
+
`/user/${s}/unmatched`,
|
|
65
63
|
o
|
|
66
64
|
);
|
|
67
65
|
try {
|
|
68
66
|
const t = await d.get(
|
|
69
67
|
e
|
|
70
68
|
);
|
|
71
|
-
return t.error ?
|
|
69
|
+
return t.error ? n(t.error) : t.result ? c(t.result) : n("GetUnMatchedOrders: Unexpected error, result is undefined");
|
|
72
70
|
} catch (t) {
|
|
73
|
-
return
|
|
71
|
+
return n("GetUnMatchedOrders:", String(t));
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
|
-
async getOrders(
|
|
77
|
-
const e =
|
|
74
|
+
async getOrders(s, o) {
|
|
75
|
+
const e = s ? "/matched" : "/unmatched", t = u(
|
|
78
76
|
this.Url.endpoint("orders"),
|
|
79
77
|
e,
|
|
80
78
|
o
|
|
81
79
|
);
|
|
82
80
|
try {
|
|
83
81
|
const r = await d.get(t);
|
|
84
|
-
return r.error ?
|
|
82
|
+
return r.error ? n(r.error) : r.result ? c(r.result) : n("GetAllOrders: Unexpected error, result is undefined");
|
|
85
83
|
} catch (r) {
|
|
86
|
-
return
|
|
84
|
+
return n("GetAllOrders:", String(r));
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
|
-
async subscribeOrders(
|
|
87
|
+
async subscribeOrders(s, o, e, t, r = "all", l) {
|
|
90
88
|
let i = !1;
|
|
91
89
|
const h = async () => {
|
|
92
90
|
if (!i) {
|
|
93
91
|
i = !0;
|
|
94
92
|
try {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
) : console.error("Error fetching orders:",
|
|
99
|
-
} catch (
|
|
100
|
-
console.error("Error fetching orders:",
|
|
93
|
+
const a = o ? await this.getMatchedOrders(s, r, l) : await this.getUnMatchedOrders(s, l);
|
|
94
|
+
a.ok ? await t(
|
|
95
|
+
a.val
|
|
96
|
+
) : console.error("Error fetching orders:", a.error);
|
|
97
|
+
} catch (a) {
|
|
98
|
+
console.error("Error fetching orders:", a);
|
|
101
99
|
} finally {
|
|
102
100
|
i = !1;
|
|
103
101
|
}
|
|
@@ -109,16 +107,16 @@ class m {
|
|
|
109
107
|
clearInterval(O);
|
|
110
108
|
};
|
|
111
109
|
}
|
|
112
|
-
async getOrdersCount(
|
|
113
|
-
const o = this.Url.endpoint("orders").endpoint(`/user/${
|
|
110
|
+
async getOrdersCount(s) {
|
|
111
|
+
const o = this.Url.endpoint("orders").endpoint(`/user/${s}/count`);
|
|
114
112
|
try {
|
|
115
113
|
const e = await d.get(o);
|
|
116
|
-
return e.error ?
|
|
114
|
+
return e.error ? n(e.error) : e.status === f.Ok && e.result !== void 0 ? c(e.result) : n("GetOrdersCount: Unexpected error, result is undefined");
|
|
117
115
|
} catch (e) {
|
|
118
|
-
return
|
|
116
|
+
return n("GetOrdersCount:", String(e));
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
export {
|
|
123
|
-
|
|
121
|
+
U as Orderbook
|
|
124
122
|
};
|
package/dist/index3.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var n=(e=>(e.Bitcoin="Bitcoin",e.EVM="EVM",e.Starknet="Starknet",e))(n||{}),i=(e=>(e.mainnet="mainnet",e.testnet="testnet",e.localnet="localnet",e))(i||{});const t={bitcoin:"bitcoin",bitcoin_testnet:"bitcoin_testnet",bitcoin_regtest:"bitcoin_regtest",ethereum:"ethereum",base:"base",arbitrum:"arbitrum",ethereum_sepolia:"ethereum_sepolia",arbitrum_localnet:"arbitrum_localnet",arbitrum_sepolia:"arbitrum_sepolia",ethereum_localnet:"ethereum_localnet",base_sepolia:"base_sepolia",bera_testnet:"bera_testnet",citrea_testnet:"citrea_testnet",bera:"bera",monad_testnet:"monad_testnet",starknet:"starknet",starknet_sepolia:"starknet_sepolia",starknet_devnet:"starknet_devnet",hyperliquid_testnet:"hyperliquid_testnet",hyperliquid:"hyperliquid",unichain:"unichain"},u=e=>!(e===t.ethereum_sepolia||e===t.bitcoin_testnet||e===t.bitcoin_regtest||e===t.arbitrum_localnet||e===t.ethereum_localnet||e===t.arbitrum_sepolia||e===t.base_sepolia||e===t.bera_testnet||e===t.citrea_testnet||e===t.monad_testnet||e===t.starknet_devnet||e===t.starknet_sepolia||e===t.hyperliquid_testnet),o=e=>e===t.bitcoin||e===t.bitcoin_testnet||e===t.bitcoin_regtest,s=e=>e===t.ethereum||e===t.arbitrum||e===t.ethereum_sepolia||e===t.ethereum_localnet||e===t.arbitrum_localnet||e===t.arbitrum_sepolia||e===t.base_sepolia||e===t.base||e===t.bera_testnet||e===t.citrea_testnet||e===t.bera||e===t.monad_testnet||e===t.hyperliquid_testnet||e===t.hyperliquid||e===t.unichain,a=e=>e===t.starknet||e===t.starknet_devnet||e===t.starknet_sepolia,r={[t.bitcoin]:144,[t.bitcoin_testnet]:144,[t.bitcoin_regtest]:144,[t.ethereum]:7200,[t.arbitrum]:7200,[t.ethereum_sepolia]:7200,[t.arbitrum_localnet]:7200,[t.arbitrum_sepolia]:7200,[t.ethereum_localnet]:7200,[t.base_sepolia]:43200,[t.base]:43200,[t.bera_testnet]:43200,[t.citrea_testnet]:43200,[t.bera]:43200,[t.monad_testnet]:172800,[t.starknet]:2880,[t.starknet_devnet]:2880,[t.starknet_sepolia]:2880,[t.hyperliquid_testnet]:43200,[t.hyperliquid]:43200,[t.unichain]:86400},b=e=>{if(o(e))return"Bitcoin";if(s(e))return"EVM";if(a(e))return"Starknet";throw new Error("Invalid or unsupported chain")},m=e=>{if(!r[e])throw new Error("Invalid or unsupported chain");return r[e]},_="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",p=(e,l)=>s(e)&&l.toLowerCase()===_.toLowerCase();exports.BlockchainType=n;exports.Chains=t;exports.NativeTokenAddress=_;exports.NetworkType=i;exports.TimeLocks=r;exports.getBlockchainType=b;exports.getTimeLock=m;exports.isBitcoin=o;exports.isEVM=s;exports.isEvmNativeToken=p;exports.isMainnet=u;exports.isStarknet=a;
|
package/dist/index3.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var i = /* @__PURE__ */ ((e) => (e.Bitcoin = "Bitcoin", e.EVM = "EVM", e.Starknet = "Starknet", e))(i || {}), o = /* @__PURE__ */ ((e) => (e.mainnet = "mainnet", e.testnet = "testnet", e.localnet = "localnet", e))(o || {});
|
|
2
2
|
const t = {
|
|
3
3
|
bitcoin: "bitcoin",
|
|
4
4
|
bitcoin_testnet: "bitcoin_testnet",
|
|
@@ -11,9 +11,6 @@ const t = {
|
|
|
11
11
|
arbitrum_sepolia: "arbitrum_sepolia",
|
|
12
12
|
ethereum_localnet: "ethereum_localnet",
|
|
13
13
|
base_sepolia: "base_sepolia",
|
|
14
|
-
solana: "solana",
|
|
15
|
-
solana_testnet: "solana_testnet",
|
|
16
|
-
solana_localnet: "solana_localnet",
|
|
17
14
|
bera_testnet: "bera_testnet",
|
|
18
15
|
citrea_testnet: "citrea_testnet",
|
|
19
16
|
bera: "bera",
|
|
@@ -23,12 +20,11 @@ const t = {
|
|
|
23
20
|
starknet_devnet: "starknet_devnet",
|
|
24
21
|
hyperliquid_testnet: "hyperliquid_testnet",
|
|
25
22
|
hyperliquid: "hyperliquid",
|
|
26
|
-
unichain: "unichain"
|
|
27
|
-
|
|
28
|
-
}, b = (e) => !(e === t.ethereum_sepolia || e === t.bitcoin_testnet || e === t.bitcoin_regtest || e === t.arbitrum_localnet || e === t.ethereum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia || e === t.solana_testnet || e === t.solana_localnet || e === t.bera_testnet || e === t.citrea_testnet || e === t.monad_testnet || e === t.starknet_devnet || e === t.starknet_sepolia || e === t.hyperliquid_testnet), l = (e) => e === t.bitcoin || e === t.bitcoin_testnet || e === t.bitcoin_regtest, s = (e) => e === t.ethereum || e === t.arbitrum || e === t.ethereum_sepolia || e === t.ethereum_localnet || e === t.arbitrum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia || e === t.base || e === t.bera_testnet || e === t.citrea_testnet || e === t.bera || e === t.monad_testnet || e === t.hyperliquid_testnet || e === t.hyperliquid || e === t.unichain || e === t.corn, a = (e) => e === t.solana || e === t.solana_testnet || e === t.solana_localnet, _ = (e) => e === t.starknet || e === t.starknet_devnet || e === t.starknet_sepolia, n = {
|
|
23
|
+
unichain: "unichain"
|
|
24
|
+
}, l = (e) => !(e === t.ethereum_sepolia || e === t.bitcoin_testnet || e === t.bitcoin_regtest || e === t.arbitrum_localnet || e === t.ethereum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia || e === t.bera_testnet || e === t.citrea_testnet || e === t.monad_testnet || e === t.starknet_devnet || e === t.starknet_sepolia || e === t.hyperliquid_testnet), a = (e) => e === t.bitcoin || e === t.bitcoin_testnet || e === t.bitcoin_regtest, s = (e) => e === t.ethereum || e === t.arbitrum || e === t.ethereum_sepolia || e === t.ethereum_localnet || e === t.arbitrum_localnet || e === t.arbitrum_sepolia || e === t.base_sepolia || e === t.base || e === t.bera_testnet || e === t.citrea_testnet || e === t.bera || e === t.monad_testnet || e === t.hyperliquid_testnet || e === t.hyperliquid || e === t.unichain, _ = (e) => e === t.starknet || e === t.starknet_devnet || e === t.starknet_sepolia, r = {
|
|
29
25
|
[t.bitcoin]: 144,
|
|
30
26
|
[t.bitcoin_testnet]: 144,
|
|
31
|
-
[t.bitcoin_regtest]:
|
|
27
|
+
[t.bitcoin_regtest]: 144,
|
|
32
28
|
[t.ethereum]: 7200,
|
|
33
29
|
[t.arbitrum]: 7200,
|
|
34
30
|
[t.ethereum_sepolia]: 7200,
|
|
@@ -41,40 +37,32 @@ const t = {
|
|
|
41
37
|
[t.citrea_testnet]: 43200,
|
|
42
38
|
[t.bera]: 43200,
|
|
43
39
|
[t.monad_testnet]: 172800,
|
|
44
|
-
[t.solana]: 432e3,
|
|
45
|
-
//In solana timeslots exist in chunks of 0.4s so, 48 hrs in terms of that would be 48hrs => sec / 0.4
|
|
46
|
-
[t.solana_localnet]: 432e3,
|
|
47
|
-
[t.solana_testnet]: 432e3,
|
|
48
40
|
[t.starknet]: 2880,
|
|
49
41
|
[t.starknet_devnet]: 2880,
|
|
50
42
|
[t.starknet_sepolia]: 2880,
|
|
51
43
|
[t.hyperliquid_testnet]: 43200,
|
|
52
44
|
[t.hyperliquid]: 43200,
|
|
53
|
-
[t.unichain]: 86400
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (l(e)) return "Bitcoin";
|
|
45
|
+
[t.unichain]: 86400
|
|
46
|
+
}, b = (e) => {
|
|
47
|
+
if (a(e)) return "Bitcoin";
|
|
57
48
|
if (s(e)) return "EVM";
|
|
58
|
-
if (a(e)) return "Solana";
|
|
59
49
|
if (_(e)) return "Starknet";
|
|
60
50
|
throw new Error("Invalid or unsupported chain");
|
|
61
|
-
},
|
|
62
|
-
if (!
|
|
63
|
-
return
|
|
64
|
-
}, u = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
51
|
+
}, m = (e) => {
|
|
52
|
+
if (!r[e]) throw new Error("Invalid or unsupported chain");
|
|
53
|
+
return r[e];
|
|
54
|
+
}, u = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", p = (e, n) => s(e) && n.toLowerCase() === u.toLowerCase();
|
|
65
55
|
export {
|
|
66
|
-
|
|
56
|
+
i as BlockchainType,
|
|
67
57
|
t as Chains,
|
|
68
58
|
u as NativeTokenAddress,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
o as NetworkType,
|
|
60
|
+
r as TimeLocks,
|
|
61
|
+
b as getBlockchainType,
|
|
62
|
+
m as getTimeLock,
|
|
63
|
+
a as isBitcoin,
|
|
74
64
|
s as isEVM,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
a as isSolana,
|
|
78
|
-
c as isSolanaNativeToken,
|
|
65
|
+
p as isEvmNativeToken,
|
|
66
|
+
l as isMainnet,
|
|
79
67
|
_ as isStarknet
|
|
80
68
|
};
|
package/dist/index4.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@gardenfi/utils"),d=require("./index6.cjs");class h{constructor(s){this.url=new r.Url("/orders",s)}async getOrder(s,c){const t=c?`/id/matched/${s}`:`/id/unmatched/${s}`,n=this.url.endpoint(t);try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetOrder: Unexpected error, result is undefined")}catch(e){return r.Err("GetOrder:",String(e))}}async getMatchedOrders(s,c,t){const n=d.ConstructUrl(this.url,`/user/matched/${s}`,{...t,pending:c});try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetMatchedOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetMatchedOrders:",String(e))}}async getUnMatchedOrders(s,c){const t=d.ConstructUrl(this.url,`/user/unmatched/${s}`,c);try{const n=await r.Fetcher.get(t);return n.error?r.Err(n.error):n.result?r.Ok(n.result):r.Err("GetUnMatchedOrders: Unexpected error, result is undefined")}catch(n){return r.Err("GetUnMatchedOrders:",String(n))}}async getOrders(s,c){const t=s?"/matched":"/unmatched",n=d.ConstructUrl(this.url,t,c);try{const e=await r.Fetcher.get(n);return e.error?r.Err(e.error):e.result?r.Ok(e.result):r.Err("GetAllOrders: Unexpected error, result is undefined")}catch(e){return r.Err("GetAllOrders:",String(e))}}async subscribeOrders(s,c,t,n,e=!1,i){let o=!1;const a=async()=>{if(!o){o=!0;try{const u=c?await this.getMatchedOrders(s,e,i):await this.getUnMatchedOrders(s,i);u.ok?await n(u.val):console.error("Error fetching orders:",u.error)}catch(u){console.error("Error fetching orders:",u)}finally{o=!1}}};await a();const l=setInterval(a,t);return()=>{clearInterval(l)}}async getOrdersCount(s){const c=this.url.endpoint(`/user/count/${s}`);try{const t=await r.Fetcher.get(c);return t.error?r.Err(t.error):t.status===r.ApiStatus.Ok&&t.result!==void 0?r.Ok(t.result):r.Err("GetOrdersCount: Unexpected error, result is undefined")}catch(t){return r.Err("GetOrdersCount:",String(t))}}}exports.OrdersProvider=h;
|
package/dist/index4.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Fetcher as u, Err as s, Ok as d } from "
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
class w {
|
|
1
|
+
import { Url as f, Fetcher as u, Err as s, Ok as d, ApiStatus as g } from "@gardenfi/utils";
|
|
2
|
+
import { ConstructUrl as i } from "./index6.js";
|
|
3
|
+
class m {
|
|
5
4
|
constructor(t) {
|
|
6
5
|
this.url = new f("/orders", t);
|
|
7
6
|
}
|
|
8
|
-
async getOrder(t,
|
|
9
|
-
const e =
|
|
7
|
+
async getOrder(t, c) {
|
|
8
|
+
const e = c ? `/id/matched/${t}` : `/id/unmatched/${t}`, n = this.url.endpoint(e);
|
|
10
9
|
try {
|
|
11
10
|
const r = await u.get(n);
|
|
12
11
|
return r.error ? s(r.error) : r.result ? d(r.result) : s("GetOrder: Unexpected error, result is undefined");
|
|
@@ -14,10 +13,10 @@ class w {
|
|
|
14
13
|
return s("GetOrder:", String(r));
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
async getMatchedOrders(t,
|
|
16
|
+
async getMatchedOrders(t, c, e) {
|
|
18
17
|
const n = i(this.url, `/user/matched/${t}`, {
|
|
19
18
|
...e,
|
|
20
|
-
pending:
|
|
19
|
+
pending: c
|
|
21
20
|
});
|
|
22
21
|
try {
|
|
23
22
|
const r = await u.get(
|
|
@@ -28,11 +27,11 @@ class w {
|
|
|
28
27
|
return s("GetMatchedOrders:", String(r));
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
async getUnMatchedOrders(t,
|
|
30
|
+
async getUnMatchedOrders(t, c) {
|
|
32
31
|
const e = i(
|
|
33
32
|
this.url,
|
|
34
33
|
`/user/unmatched/${t}`,
|
|
35
|
-
|
|
34
|
+
c
|
|
36
35
|
);
|
|
37
36
|
try {
|
|
38
37
|
const n = await u.get(
|
|
@@ -43,8 +42,8 @@ class w {
|
|
|
43
42
|
return s("GetUnMatchedOrders:", String(n));
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
|
-
async getOrders(t,
|
|
47
|
-
const e = t ? "/matched" : "/unmatched", n = i(this.url, e,
|
|
45
|
+
async getOrders(t, c) {
|
|
46
|
+
const e = t ? "/matched" : "/unmatched", n = i(this.url, e, c);
|
|
48
47
|
try {
|
|
49
48
|
const r = await u.get(n);
|
|
50
49
|
return r.error ? s(r.error) : r.result ? d(r.result) : s("GetAllOrders: Unexpected error, result is undefined");
|
|
@@ -52,18 +51,18 @@ class w {
|
|
|
52
51
|
return s("GetAllOrders:", String(r));
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
async subscribeOrders(t,
|
|
54
|
+
async subscribeOrders(t, c, e, n, r = !1, l) {
|
|
56
55
|
let a = !1;
|
|
57
56
|
const h = async () => {
|
|
58
57
|
if (!a) {
|
|
59
58
|
a = !0;
|
|
60
59
|
try {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
) : console.error("Error fetching orders:",
|
|
65
|
-
} catch (
|
|
66
|
-
console.error("Error fetching orders:",
|
|
60
|
+
const o = c ? await this.getMatchedOrders(t, r, l) : await this.getUnMatchedOrders(t, l);
|
|
61
|
+
o.ok ? await n(
|
|
62
|
+
o.val
|
|
63
|
+
) : console.error("Error fetching orders:", o.error);
|
|
64
|
+
} catch (o) {
|
|
65
|
+
console.error("Error fetching orders:", o);
|
|
67
66
|
} finally {
|
|
68
67
|
a = !1;
|
|
69
68
|
}
|
|
@@ -76,9 +75,9 @@ class w {
|
|
|
76
75
|
};
|
|
77
76
|
}
|
|
78
77
|
async getOrdersCount(t) {
|
|
79
|
-
const
|
|
78
|
+
const c = this.url.endpoint(`/user/count/${t}`);
|
|
80
79
|
try {
|
|
81
|
-
const e = await u.get(
|
|
80
|
+
const e = await u.get(c);
|
|
82
81
|
return e.error ? s(e.error) : e.status === g.Ok && e.result !== void 0 ? d(e.result) : s("GetOrdersCount: Unexpected error, result is undefined");
|
|
83
82
|
} catch (e) {
|
|
84
83
|
return s("GetOrdersCount:", String(e));
|
|
@@ -86,5 +85,5 @@ class w {
|
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
export {
|
|
89
|
-
|
|
88
|
+
m as OrdersProvider
|
|
90
89
|
};
|
package/dist/index5.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index3.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index3.cjs"),i={id:1001,name:"Starknet Localnet",nativeCurrency:{name:"Stark Token",symbol:"STRK",decimals:18},rpcUrls:{default:{http:["http://127.0.0.1:8547/"]}},testnet:!0},c={id:31338,name:"Arbitrum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8546/"]}},testnet:!0},d={id:31337,name:"Ethereum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8545/"]}},testnet:!0},o={name:"Bitcoin Regtest",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_regtest,atomicSwapAddress:"primary",tokenAddress:"primary"},a={name:"WBTC Arbitrum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.arbitrum_localnet,atomicSwapAddress:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",tokenAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"},t={name:"WBTC Ethereum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_localnet,atomicSwapAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",tokenAddress:"0x5FbDB2315678afecb367f032d93F642f64180aa3"},s={name:"STRK Starknet Localnet",decimals:18,symbol:"STRK",chain:e.Chains.starknet_devnet,atomicSwapAddress:"0x15cf8b127aa850c97ed10de6f8b300cabc4f09232a57e63667af02fdef8a55a",tokenAddress:"0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"},n={name:"ETH Starknet Localnet",decimals:18,symbol:"ETH",chain:e.Chains.starknet_devnet,atomicSwapAddress:"0x1890470168440bbb9df50988748924a74ea22de10d22a081e458737b9574e75",tokenAddress:"0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"},m={localnet:{arbitrum_localnet_WBTC:a,ethereum_localnet_WBTC:t,starknet_localnet_STRK:s,starknet_localnet_ETH:n},testnet:{bitcoin_testnet_BTC:{name:"BTC",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_testnet,tokenAddress:"primary",atomicSwapAddress:"primary"},ethereum_sepolia_WBTC:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_sepolia,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x4D68da063577F98C55166c7AF6955cF58a97b20A",atomicSwapAddress:"0x3C6a17b8cD92976D1D91E491c93c98cd81998265"},arbitrum_sepolia_WBTC:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",chain:e.Chains.arbitrum_sepolia,tokenAddress:"0x00ab86f54F436CfE15253845F139955ae0C00bAf",atomicSwapAddress:"0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1"},arbitrum_sepolia_SEED:{name:"Seed",decimals:18,symbol:"SEED",chain:e.Chains.arbitrum_sepolia,logo:"https://garden-finance.imgix.net/token-images/seed.svg",tokenAddress:"0x13DCec0762EcC5E666c207ab44Dc768e5e33070F",atomicSwapAddress:"0xD5FeDb4ceCB0F1D32788a190d9EB47D94D23eE4e"},arbitrum_sepolia_iBTC:{name:"iBTC",decimals:8,symbol:"iBTC",chain:e.Chains.arbitrum_sepolia,logo:"https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",tokenAddress:"0x8219B871534F29ff7434519287131a875e0D8eCa",atomicSwapAddress:"0xdfe6d9363ee96152d39391009a6723819d9e25eb"},base_sepolia_WBTC:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",chain:e.Chains.base_sepolia,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x13DCec0762EcC5E666c207ab44Dc768e5e33070F",atomicSwapAddress:"0x00ab86f54F436CfE15253845F139955ae0C00bAf"},base_sepolia_USDT:{name:"Tether USD",decimals:6,symbol:"USDT",chain:e.Chains.base_sepolia,logo:"https://garden-finance.imgix.net/token-images/usdt.svg",tokenAddress:"0xD72Fc3e7D52301b3e5f7d4E3366F88d5C8747520",atomicSwapAddress:"0xB391CA6D0A76CD2A927bC314856E8a374a225CFc"},base_sepolia_iBTC:{name:"iBTC",decimals:8,symbol:"iBTC",chain:e.Chains.base_sepolia,logo:"https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",tokenAddress:"0xbaFb499B60F9E30fd82A54342cb7695C92F5B527",atomicSwapAddress:"0xbcdad29ac77e5bb27fd528ab0045af630259fe4f"},citrea_testnet_WCBTC:{name:"Wrapped Citrea Bitcoin",decimals:18,symbol:"WCBTC",chain:e.Chains.citrea_testnet,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x8d0c9d1c17aE5e40ffF9bE350f57840E9E66Cd93",atomicSwapAddress:"0xaD9d14CA82d9BF97fFf745fFC7d48172A1c0969E"},citrea_testnet_cBTC:{name:"Citrea Bitcoin",decimals:18,symbol:"cBTC",chain:e.Chains.citrea_testnet,logo:"https://garden-finance.imgix.net/token-images/bitcoin.svg",tokenAddress:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",atomicSwapAddress:"0x6218FA00f47a61aCD8B46D6f1b15c4D730F803F2"},starknet_testnet_WBTC:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",chain:e.Chains.starknet_sepolia,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x496bef3ed20371382fbe0ca6a5a64252c5c848f9f1f0cccf8110fc4def912d5",atomicSwapAddress:"0x06579d255314109429a4477d89629bc2b94f529ae01979c2f8014f9246482603"},monad_testnet_cbBTC:{name:"Coinbase Bitcoin",decimals:8,symbol:"cbBTC",chain:e.Chains.monad_testnet,logo:"https://garden-finance.imgix.net/token-images/cbBTC.svg",tokenAddress:"0xaD9d14CA82d9BF97fFf745fFC7d48172A1c0969E",atomicSwapAddress:"0x1dC94FdcAd8Aee13cfd34Db8a26d26E31572805c"},monad_testnet_USDC:{name:"USD Coin",decimals:6,symbol:"USDC",chain:e.Chains.monad_testnet,logo:"https://garden-finance.imgix.net/token-images/usdc.svg",tokenAddress:"0x00ab86f54F436CfE15253845F139955ae0C00bAf",atomicSwapAddress:"0xE99D8A21d4F2ad2f90c279c869311503f9e25867"}},mainnet:{bitcoin_BTC:{name:"BTC",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin,tokenAddress:"primary",atomicSwapAddress:"primary"},base_cbBTC:{name:"Coinbase Bitcoin",decimals:8,symbol:"cbBTC",chain:e.Chains.base,logo:"https://garden-finance.imgix.net/token-images/cbBTC.svg",tokenAddress:"0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",atomicSwapAddress:"0xeae7721d779276eb0f5837e2fe260118724a2ba4"},base_USDC:{name:"USD Coin",decimals:6,symbol:"USDC",chain:e.Chains.base,logo:"https://garden-finance.imgix.net/token-images/usdc.svg",tokenAddress:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",atomicSwapAddress:"0xd8a6e3fca403d79b6ad6216b60527f51cc967d39"},ethereum_WBTC:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",atomicSwapAddress:"0x795dcb58d1cd4789169d5f938ea05e17eceb68ca"},ethereum_USDC:{name:"USD Coin",decimals:6,symbol:"USDC",chain:e.Chains.ethereum,logo:"https://garden-finance.imgix.net/token-images/usdc.svg",tokenAddress:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",atomicSwapAddress:"0xd8a6e3fca403d79b6ad6216b60527f51cc967d39"},ethereum_cbBTC:{name:"Coinbase Bitcoin",decimals:8,symbol:"cbBTC",chain:e.Chains.ethereum,logo:"https://garden-finance.imgix.net/token-images/cbBTC.svg",tokenAddress:"0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",atomicSwapAddress:"0xeae7721d779276eb0f5837e2fe260118724a2ba4"},arbitrum_WBTC:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",chain:e.Chains.arbitrum,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",atomicSwapAddress:"0x6b6303fab8ec7232b4f2a7b9fa58e5216f608fcb"},arbitrum_USDC:{name:"USD Coin",decimals:6,symbol:"USDC",chain:e.Chains.arbitrum,logo:"https://garden-finance.imgix.net/token-images/usdc.svg",tokenAddress:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",atomicSwapAddress:"0xeae7721d779276eb0f5837e2fe260118724a2ba4"},arbitrum_iBTC:{name:"iBTC",decimals:8,symbol:"iBTC",chain:e.Chains.arbitrum,logo:"https://garden-finance.imgix.net/token-images/iBTC.svg",tokenAddress:"0x050C24dBf1eEc17babE5fc585F06116A259CC77A",atomicSwapAddress:"0xdc74a45e86dedf1ff7c6dac77e0c2f082f9e4f72"},bera_LBTC:{name:"Lombard Bitcoin",decimals:8,symbol:"LBTC",chain:e.Chains.bera,logo:"https://garden-finance.imgix.net/token-images/LBTC.svg",tokenAddress:"0xecAc9C5F704e954931349Da37F60E39f515c11c1",atomicSwapAddress:"0x39f3294352208905fc6ebf033954E6c6455CdB4C"},hyperliquid_uBTC:{name:"Unit Bitcoin",decimals:8,symbol:"uBTC",chain:e.Chains.hyperliquid,tokenAddress:"0x9FDBdA0A5e284c32744D2f17Ee5c74B284993463",atomicSwapAddress:"0x39f3294352208905fc6ebf033954E6c6455CdB4C"},starknet_WBTC:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",chain:e.Chains.starknet,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",atomicSwapAddress:"0x7defd8eb3b770005ab1ca5f89ad31f98fb5bc3c52deaeafd130be3b49f967b4"},unichain_USDC:{name:"USD Coin",decimals:6,symbol:"USDC",chain:e.Chains.unichain,logo:"https://garden-finance.imgix.net/token-images/usdc.svg",tokenAddress:"0x078D782b760474a361dDA0AF3839290b0EF57AD6",atomicSwapAddress:"0x795Dcb58d1cd4789169D5F938Ea05E17ecEB68cA"}}};exports.ArbitrumLocalnet=c;exports.ETHStarknetLocalnetAsset=n;exports.EthereumLocalnet=d;exports.STRKStarknetLocalnetAsset=s;exports.StarknetLocalnet=i;exports.SupportedAssets=m;exports.WBTCArbitrumLocalnetAsset=a;exports.WBTCEthereumLocalnetAsset=t;exports.bitcoinRegtestAsset=o;
|
package/dist/index5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chains as e } from "./index3.js";
|
|
2
|
-
const
|
|
2
|
+
const i = {
|
|
3
3
|
id: 1001,
|
|
4
4
|
name: "Starknet Localnet",
|
|
5
5
|
nativeCurrency: {
|
|
@@ -13,7 +13,7 @@ const o = {
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
testnet: !0
|
|
16
|
-
},
|
|
16
|
+
}, d = {
|
|
17
17
|
id: 31338,
|
|
18
18
|
name: "Arbitrum Localnet",
|
|
19
19
|
nativeCurrency: {
|
|
@@ -27,7 +27,7 @@ const o = {
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
testnet: !0
|
|
30
|
-
},
|
|
30
|
+
}, o = {
|
|
31
31
|
id: 31337,
|
|
32
32
|
name: "Ethereum Localnet",
|
|
33
33
|
nativeCurrency: {
|
|
@@ -41,70 +41,49 @@ const o = {
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
testnet: !0
|
|
44
|
-
},
|
|
45
|
-
name: "SOL Solana Localnet",
|
|
46
|
-
decimals: 9,
|
|
47
|
-
symbol: "SOL",
|
|
48
|
-
chain: e.solana_localnet,
|
|
49
|
-
atomicSwapAddress: "primary",
|
|
50
|
-
tokenAddress: "primary"
|
|
51
|
-
}, t = {
|
|
44
|
+
}, m = {
|
|
52
45
|
name: "Bitcoin Regtest",
|
|
53
46
|
decimals: 8,
|
|
54
47
|
symbol: "BTC",
|
|
55
48
|
chain: e.bitcoin_regtest,
|
|
56
49
|
atomicSwapAddress: "primary",
|
|
57
50
|
tokenAddress: "primary"
|
|
58
|
-
},
|
|
51
|
+
}, a = {
|
|
59
52
|
name: "WBTC Arbitrum Localnet",
|
|
60
53
|
decimals: 8,
|
|
61
54
|
symbol: "WBTC",
|
|
62
55
|
chain: e.arbitrum_localnet,
|
|
63
|
-
|
|
64
|
-
atomicSwapAddress: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
|
|
65
|
-
//present on localnet
|
|
56
|
+
atomicSwapAddress: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
|
|
66
57
|
tokenAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
|
|
67
|
-
},
|
|
58
|
+
}, t = {
|
|
68
59
|
name: "WBTC Ethereum Localnet",
|
|
69
60
|
decimals: 8,
|
|
70
61
|
symbol: "WBTC",
|
|
71
62
|
chain: e.ethereum_localnet,
|
|
72
|
-
|
|
73
|
-
atomicSwapAddress: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
|
|
74
|
-
//present on localnet
|
|
63
|
+
atomicSwapAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
|
|
75
64
|
tokenAddress: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
|
|
76
|
-
},
|
|
65
|
+
}, s = {
|
|
77
66
|
name: "STRK Starknet Localnet",
|
|
78
67
|
decimals: 18,
|
|
79
68
|
symbol: "STRK",
|
|
80
69
|
chain: e.starknet_devnet,
|
|
81
70
|
atomicSwapAddress: "0x15cf8b127aa850c97ed10de6f8b300cabc4f09232a57e63667af02fdef8a55a",
|
|
82
71
|
tokenAddress: "0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"
|
|
83
|
-
},
|
|
72
|
+
}, n = {
|
|
84
73
|
name: "ETH Starknet Localnet",
|
|
85
74
|
decimals: 18,
|
|
86
75
|
symbol: "ETH",
|
|
87
76
|
chain: e.starknet_devnet,
|
|
88
77
|
atomicSwapAddress: "0x1890470168440bbb9df50988748924a74ea22de10d22a081e458737b9574e75",
|
|
89
78
|
tokenAddress: "0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"
|
|
90
|
-
},
|
|
79
|
+
}, r = {
|
|
91
80
|
localnet: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
starknet_localnet_STRK: c,
|
|
97
|
-
starknet_localnet_ETH: i
|
|
81
|
+
arbitrum_localnet_WBTC: a,
|
|
82
|
+
ethereum_localnet_WBTC: t,
|
|
83
|
+
starknet_localnet_STRK: s,
|
|
84
|
+
starknet_localnet_ETH: n
|
|
98
85
|
},
|
|
99
86
|
testnet: {
|
|
100
|
-
solana_testnet_SOL: {
|
|
101
|
-
name: "SOL Solana Testnet",
|
|
102
|
-
decimals: 9,
|
|
103
|
-
symbol: "SOL",
|
|
104
|
-
chain: e.solana_testnet,
|
|
105
|
-
atomicSwapAddress: "primary",
|
|
106
|
-
tokenAddress: "primary"
|
|
107
|
-
},
|
|
108
87
|
bitcoin_testnet_BTC: {
|
|
109
88
|
name: "BTC",
|
|
110
89
|
decimals: 8,
|
|
@@ -128,8 +107,8 @@ const o = {
|
|
|
128
107
|
symbol: "WBTC",
|
|
129
108
|
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
130
109
|
chain: e.arbitrum_sepolia,
|
|
131
|
-
tokenAddress: "
|
|
132
|
-
atomicSwapAddress: "
|
|
110
|
+
tokenAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf",
|
|
111
|
+
atomicSwapAddress: "0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1"
|
|
133
112
|
},
|
|
134
113
|
arbitrum_sepolia_SEED: {
|
|
135
114
|
name: "Seed",
|
|
@@ -337,27 +316,17 @@ const o = {
|
|
|
337
316
|
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
338
317
|
tokenAddress: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
|
|
339
318
|
atomicSwapAddress: "0x795Dcb58d1cd4789169D5F938Ea05E17ecEB68cA"
|
|
340
|
-
},
|
|
341
|
-
corn_BTCN: {
|
|
342
|
-
name: "Bitcorn",
|
|
343
|
-
decimals: 18,
|
|
344
|
-
symbol: "BTCN",
|
|
345
|
-
chain: e.corn,
|
|
346
|
-
logo: "https://garden-finance.imgix.net/token-images/bitcorn.jpg",
|
|
347
|
-
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
348
|
-
atomicSwapAddress: "0xeaE7721d779276eb0f5837e2fE260118724a2Ba4"
|
|
349
319
|
}
|
|
350
320
|
}
|
|
351
321
|
};
|
|
352
322
|
export {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
t as bitcoinRegtestAsset
|
|
323
|
+
d as ArbitrumLocalnet,
|
|
324
|
+
n as ETHStarknetLocalnetAsset,
|
|
325
|
+
o as EthereumLocalnet,
|
|
326
|
+
s as STRKStarknetLocalnetAsset,
|
|
327
|
+
i as StarknetLocalnet,
|
|
328
|
+
r as SupportedAssets,
|
|
329
|
+
a as WBTCArbitrumLocalnetAsset,
|
|
330
|
+
t as WBTCEthereumLocalnetAsset,
|
|
331
|
+
m as bitcoinRegtestAsset
|
|
363
332
|
};
|
package/dist/index6.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
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
CHANGED
|
@@ -1,190 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
7
|
-
t instanceof WeakSet ? t.add(e) : t.set(e, a);
|
|
8
|
-
}, w = (e, t, a, r) => (p(e, t, "write to private field"), t.set(e, a), a);
|
|
9
|
-
const d = (e) => new Promise((t) => setTimeout(t, e));
|
|
10
|
-
class g {
|
|
11
|
-
/**
|
|
12
|
-
* @param {number} maxRetries - The maximum number of retries, if less < 0 then it is set to 0
|
|
13
|
-
* @param {number} delay - The delay between retries
|
|
14
|
-
*/
|
|
15
|
-
constructor(t, a) {
|
|
16
|
-
this.maxRetries = Math.max(t, 0), this.delay = a;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Retries a function until it succeeds or the max number of retries is reached
|
|
20
|
-
*
|
|
21
|
-
* @param {() => Promise<T>} fn - The function to retry
|
|
22
|
-
* @return {Promise<T>} a Promise that resolves to the result of the function
|
|
23
|
-
*/
|
|
24
|
-
async retry(t) {
|
|
25
|
-
let a = 0, r;
|
|
26
|
-
for (; a < this.maxRetries + 1; )
|
|
27
|
-
try {
|
|
28
|
-
return await t();
|
|
29
|
-
} catch (i) {
|
|
30
|
-
a++, r = i, await d(this.delay * a);
|
|
31
|
-
}
|
|
32
|
-
throw r;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const v = (e) => {
|
|
36
|
-
try {
|
|
37
|
-
return JSON.parse(e);
|
|
38
|
-
} catch {
|
|
39
|
-
return e;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
class m {
|
|
43
|
-
static async _postWithFallback(t, a) {
|
|
44
|
-
let r = "";
|
|
45
|
-
for (const i of t)
|
|
46
|
-
try {
|
|
47
|
-
const s = await fetch(i, {
|
|
48
|
-
method: "POST",
|
|
49
|
-
...a
|
|
50
|
-
});
|
|
51
|
-
if (s.status >= 500) {
|
|
52
|
-
r = await (s.text() || s.json());
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
return await this.parse(s);
|
|
56
|
-
} catch (s) {
|
|
57
|
-
r = y(s);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
throw new Error(r || "All APIs failed");
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Asynchronously sends a POST request to multiple URLs with fallback logic.
|
|
64
|
-
*
|
|
65
|
-
* @param {string[]} input - array of URLs to send the POST request to
|
|
66
|
-
* @param {RequestInit} [init] - optional request initialization options
|
|
67
|
-
* @return {Promise<T>} a Promise that resolves to the parsed response data
|
|
68
|
-
*/
|
|
69
|
-
static async postWithFallback(t, a) {
|
|
70
|
-
return await n(a).retry(
|
|
71
|
-
() => this._postWithFallback(t, a)
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
static async _getWithFallback(t, a) {
|
|
75
|
-
let r = "";
|
|
76
|
-
for (const i of t)
|
|
77
|
-
try {
|
|
78
|
-
const s = await fetch(i, a);
|
|
79
|
-
if (s.status >= 500) {
|
|
80
|
-
r = await (s.text() || s.json());
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
return await this.parse(s);
|
|
84
|
-
} catch (s) {
|
|
85
|
-
r = y(s);
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
throw new Error(r || "All APIs failed");
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Asynchronously sends a POST request to multiple URLs with fallback mechanism.
|
|
92
|
-
*
|
|
93
|
-
* @param {string[]} input - An array of URLs to retrieve data from.
|
|
94
|
-
* @param {RequestInit} [init] - Optional request options.
|
|
95
|
-
* @return {Promise<T>} A promise that resolves to the retrieved data.
|
|
96
|
-
*/
|
|
97
|
-
static async getWithFallback(t, a) {
|
|
98
|
-
return await n(a).retry(
|
|
99
|
-
() => this._getWithFallback(t, a)
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
static async _get(t, a) {
|
|
103
|
-
return await this.parse(await fetch(t, a));
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Asynchronously retrieves data of type T from the specified URL or RequestInfo, with optional initialization options.
|
|
107
|
-
*
|
|
108
|
-
* @param {RequestInfo | URL} input - The URL or RequestInfo to fetch data from
|
|
109
|
-
* @param {RequestInit} init - Optional initialization options for the fetch request
|
|
110
|
-
* @return {Promise<T>} The retrieved data of type T
|
|
111
|
-
*/
|
|
112
|
-
static async get(t, a) {
|
|
113
|
-
return await n(a).retry(() => this._get(t, a));
|
|
114
|
-
}
|
|
115
|
-
static async _post(t, a) {
|
|
116
|
-
return await this.parse(
|
|
117
|
-
await fetch(t, {
|
|
118
|
-
method: "POST",
|
|
119
|
-
...a
|
|
120
|
-
})
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Asynchronously sends a POST request to the specified URL or RequestInfo, with optional initialization options.
|
|
125
|
-
*/
|
|
126
|
-
static async post(t, a) {
|
|
127
|
-
return await n(a).retry(() => this._post(t, a));
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Parses the response and returns the result as the specified type.
|
|
131
|
-
*
|
|
132
|
-
* @param {Response} res - the response object to be parsed
|
|
133
|
-
* @return {Promise<T>} the parsed result of type T
|
|
134
|
-
*/
|
|
135
|
-
static async parse(t) {
|
|
136
|
-
const a = await t.text();
|
|
137
|
-
if (t.status >= 200 && t.status < 300)
|
|
138
|
-
return v(a);
|
|
139
|
-
throw new Error(a);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function y(e) {
|
|
143
|
-
return (e == null ? void 0 : e.message) || (e == null ? void 0 : e.toString()) || "unknown error";
|
|
144
|
-
}
|
|
145
|
-
const n = (e) => new g((e == null ? void 0 : e.retryCount) ?? 2, (e == null ? void 0 : e.retryDelay) ?? 1e3);
|
|
146
|
-
var o, c, l;
|
|
147
|
-
class f {
|
|
148
|
-
constructor(t, a, r = void 0) {
|
|
149
|
-
u(this, o, void 0), u(this, c, void 0), u(this, l, void 0), w(this, o, t), w(this, l, r), w(this, c, a);
|
|
150
|
-
}
|
|
151
|
-
get ok() {
|
|
152
|
-
return h(this, o);
|
|
153
|
-
}
|
|
154
|
-
get error() {
|
|
155
|
-
return h(this, l);
|
|
156
|
-
}
|
|
157
|
-
get val() {
|
|
158
|
-
return h(this, c);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
o = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();
|
|
162
|
-
const k = (e) => new f(!0, e), W = (e, ...t) => {
|
|
163
|
-
if (typeof e == "string" && t && t.length > 0) {
|
|
164
|
-
let a = [e, ...t].map((r) => {
|
|
165
|
-
if (r) {
|
|
166
|
-
if (r instanceof Error)
|
|
167
|
-
return r.message;
|
|
168
|
-
if (typeof r == "string")
|
|
169
|
-
return r;
|
|
170
|
-
if (r != null && r.toString)
|
|
171
|
-
return r.toString();
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
return new f(
|
|
175
|
-
!1,
|
|
176
|
-
null,
|
|
177
|
-
a.filter((r) => r !== void 0).join(" ")
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
return new f(!1, null, e);
|
|
1
|
+
const i = (o, e, t) => {
|
|
2
|
+
const r = o.endpoint(e);
|
|
3
|
+
return t && Object.entries(t).forEach(([c, n]) => {
|
|
4
|
+
n !== void 0 && r.searchParams.append(c, n.toString());
|
|
5
|
+
}), r;
|
|
181
6
|
};
|
|
182
7
|
export {
|
|
183
|
-
|
|
184
|
-
m as Fetcher,
|
|
185
|
-
k as Ok,
|
|
186
|
-
f as Result,
|
|
187
|
-
g as Retry,
|
|
188
|
-
v as safeParseJson,
|
|
189
|
-
d as sleep
|
|
8
|
+
i as ConstructUrl
|
|
190
9
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +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,
|
|
4
|
+
export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, isStarknet, getBlockchainType, NetworkType, TimeLocks, getTimeLock, NativeTokenAddress, isEvmNativeToken, } from './lib/asset';
|
|
5
5
|
export { OrdersProvider } from './lib/orders/ordersProvider';
|
|
6
6
|
export type { IOrderProvider } from './lib/orders/orders.types';
|
|
7
|
-
export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, bitcoinRegtestAsset,
|
|
7
|
+
export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, bitcoinRegtestAsset, SupportedAssets, StarknetLocalnet, STRKStarknetLocalnetAsset, } from './lib/constants';
|
package/dist/src/lib/asset.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export type Asset = AssetToken;
|
|
|
13
13
|
export declare enum BlockchainType {
|
|
14
14
|
Bitcoin = "Bitcoin",
|
|
15
15
|
EVM = "EVM",
|
|
16
|
-
Solana = "Solana",
|
|
17
16
|
Starknet = "Starknet"
|
|
18
17
|
}
|
|
19
18
|
export declare enum NetworkType {
|
|
@@ -43,9 +42,6 @@ export declare const Chains: {
|
|
|
43
42
|
readonly arbitrum_sepolia: "arbitrum_sepolia";
|
|
44
43
|
readonly ethereum_localnet: "ethereum_localnet";
|
|
45
44
|
readonly base_sepolia: "base_sepolia";
|
|
46
|
-
readonly solana: "solana";
|
|
47
|
-
readonly solana_testnet: "solana_testnet";
|
|
48
|
-
readonly solana_localnet: "solana_localnet";
|
|
49
45
|
readonly bera_testnet: "bera_testnet";
|
|
50
46
|
readonly citrea_testnet: "citrea_testnet";
|
|
51
47
|
readonly bera: "bera";
|
|
@@ -56,18 +52,15 @@ export declare const Chains: {
|
|
|
56
52
|
readonly hyperliquid_testnet: "hyperliquid_testnet";
|
|
57
53
|
readonly hyperliquid: "hyperliquid";
|
|
58
54
|
readonly unichain: "unichain";
|
|
59
|
-
readonly corn: "corn";
|
|
60
55
|
};
|
|
61
56
|
export type Chain = keyof typeof Chains;
|
|
62
|
-
export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest' | '
|
|
63
|
-
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "base" | "arbitrum" | "
|
|
57
|
+
export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest' | 'starknet' | 'starknet_devnet' | 'starknet_sepolia'>;
|
|
58
|
+
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "base" | "arbitrum" | "bera" | "starknet" | "hyperliquid" | "unichain";
|
|
64
59
|
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest";
|
|
65
|
-
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"
|
|
66
|
-
export declare const isSolana: (chain: Chain) => chain is "solana" | "solana_testnet" | "solana_localnet";
|
|
60
|
+
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";
|
|
67
61
|
export declare const isStarknet: (chain: Chain) => chain is "starknet" | "starknet_sepolia" | "starknet_devnet";
|
|
68
62
|
export declare const TimeLocks: Record<Chain, number>;
|
|
69
63
|
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
70
64
|
export declare const getTimeLock: (chain: Chain) => number;
|
|
71
65
|
export declare const NativeTokenAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
72
66
|
export declare const isEvmNativeToken: (chain: Chain, tokenAddress: string) => boolean;
|
|
73
|
-
export declare const isSolanaNativeToken: (chain: Chain, tokenAddress: string) => boolean;
|
|
@@ -4,7 +4,6 @@ import { Asset } from './asset';
|
|
|
4
4
|
export declare const StarknetLocalnet: Chain;
|
|
5
5
|
export declare const ArbitrumLocalnet: Chain;
|
|
6
6
|
export declare const EthereumLocalnet: Chain;
|
|
7
|
-
export declare const SOLSolanaLocalnetAsset: Asset;
|
|
8
7
|
export declare const bitcoinRegtestAsset: Asset;
|
|
9
8
|
export declare const WBTCArbitrumLocalnetAsset: Asset;
|
|
10
9
|
export declare const WBTCEthereumLocalnetAsset: Asset;
|
|
@@ -12,22 +11,12 @@ export declare const STRKStarknetLocalnetAsset: Asset;
|
|
|
12
11
|
export declare const ETHStarknetLocalnetAsset: Asset;
|
|
13
12
|
export declare const SupportedAssets: {
|
|
14
13
|
readonly localnet: {
|
|
15
|
-
readonly solana_localnet_SOL: import('./asset').AssetToken;
|
|
16
14
|
readonly arbitrum_localnet_WBTC: import('./asset').AssetToken;
|
|
17
15
|
readonly ethereum_localnet_WBTC: import('./asset').AssetToken;
|
|
18
|
-
readonly bitcoin_regtest_BTC: import('./asset').AssetToken;
|
|
19
16
|
readonly starknet_localnet_STRK: import('./asset').AssetToken;
|
|
20
17
|
readonly starknet_localnet_ETH: import('./asset').AssetToken;
|
|
21
18
|
};
|
|
22
19
|
readonly testnet: {
|
|
23
|
-
readonly solana_testnet_SOL: {
|
|
24
|
-
readonly name: "SOL Solana Testnet";
|
|
25
|
-
readonly decimals: 9;
|
|
26
|
-
readonly symbol: "SOL";
|
|
27
|
-
readonly chain: "solana_testnet";
|
|
28
|
-
readonly atomicSwapAddress: "primary";
|
|
29
|
-
readonly tokenAddress: "primary";
|
|
30
|
-
};
|
|
31
20
|
readonly bitcoin_testnet_BTC: {
|
|
32
21
|
readonly name: "BTC";
|
|
33
22
|
readonly decimals: 8;
|
|
@@ -51,8 +40,8 @@ export declare const SupportedAssets: {
|
|
|
51
40
|
readonly symbol: "WBTC";
|
|
52
41
|
readonly logo: "https://garden-finance.imgix.net/token-images/wbtc.svg";
|
|
53
42
|
readonly chain: "arbitrum_sepolia";
|
|
54
|
-
readonly tokenAddress: "
|
|
55
|
-
readonly atomicSwapAddress: "
|
|
43
|
+
readonly tokenAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf";
|
|
44
|
+
readonly atomicSwapAddress: "0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1";
|
|
56
45
|
};
|
|
57
46
|
readonly arbitrum_sepolia_SEED: {
|
|
58
47
|
readonly name: "Seed";
|
|
@@ -261,14 +250,5 @@ export declare const SupportedAssets: {
|
|
|
261
250
|
readonly tokenAddress: "0x078D782b760474a361dDA0AF3839290b0EF57AD6";
|
|
262
251
|
readonly atomicSwapAddress: "0x795Dcb58d1cd4789169D5F938Ea05E17ecEB68cA";
|
|
263
252
|
};
|
|
264
|
-
readonly corn_BTCN: {
|
|
265
|
-
readonly name: "Bitcorn";
|
|
266
|
-
readonly decimals: 18;
|
|
267
|
-
readonly symbol: "BTCN";
|
|
268
|
-
readonly chain: "corn";
|
|
269
|
-
readonly logo: "https://garden-finance.imgix.net/token-images/bitcorn.jpg";
|
|
270
|
-
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
271
|
-
readonly atomicSwapAddress: "0xeaE7721d779276eb0f5837e2fE260118724a2Ba4";
|
|
272
|
-
};
|
|
273
253
|
};
|
|
274
254
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AsyncResult } from '@catalogfi/utils';
|
|
2
1
|
import { CreateOrder, CreateOrderRequestWithAdditionalData, IOrderbook, MatchedOrder, PaginatedData, PaginationConfig, Status } from './orderbook.types';
|
|
3
|
-
import { IAuth, Url } from '@gardenfi/utils';
|
|
2
|
+
import { AsyncResult, IAuth, Url } from '@gardenfi/utils';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* A class that allows you to create and manage orders with the orderbook url.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { AsyncResult } from '@catalogfi/utils';
|
|
2
1
|
import { IOrderProvider } from './orders.types';
|
|
3
2
|
import { CreateOrder, MatchedOrder, PaginatedData, PaginationConfig } from '../orderbook/orderbook.types';
|
|
4
|
-
import { Url } from '@gardenfi/utils';
|
|
3
|
+
import { AsyncResult, Url } from '@gardenfi/utils';
|
|
5
4
|
|
|
6
5
|
export declare class OrdersProvider implements IOrderProvider {
|
|
7
6
|
private url;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gardenfi/orderbook",
|
|
3
|
-
"version": "2.1.7-beta.
|
|
3
|
+
"version": "2.1.7-beta.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@gardenfi/utils": "2.1.3-beta.13",
|
|
29
|
+
"@gardenfi/utils": "2.1.3-beta.14",
|
|
31
30
|
"bufferutil": "^4.0.8",
|
|
32
31
|
"siwe": "^2.1.4",
|
|
33
32
|
"utf-8-validate": "^6.0.3",
|
package/dist/index7.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|