@gardenfi/orderbook 0.2.0-beta.5 → 0.2.0-beta.7
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 +16 -13
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +33 -41
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +10 -2
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +46 -16
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +4 -5
- package/dist/src/index.d.ts +2 -2
- package/dist/src/lib/asset.d.ts +7 -2
- package/dist/src/lib/constants.d.ts +7 -0
- package/dist/src/lib/orderbook/orderbook.types.d.ts +2 -2
- package/dist/src/lib/utils.d.ts +0 -4
- package/package.json +2 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index2.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index2.cjs"),e=require("./index3.cjs"),s=require("./index4.cjs"),t=require("./index5.cjs");exports.Orderbook=r.Orderbook;exports.BlockchainType=e.BlockchainType;exports.Chains=e.Chains;exports.getBlockchainType=e.getBlockchainType;exports.isBitcoin=e.isBitcoin;exports.isEVM=e.isEVM;exports.isMainnet=e.isMainnet;exports.OrdersProvider=s.OrdersProvider;exports.ArbitrumLocalnet=t.ArbitrumLocalnet;exports.EthereumLocalnet=t.EthereumLocalnet;exports.SupportedAssets=t.SupportedAssets;exports.WBTCArbitrumLocalnetAsset=t.WBTCArbitrumLocalnetAsset;exports.WBTCEthereumLocalnetAsset=t.WBTCEthereumLocalnetAsset;exports.bitcoinRegtestAsset=t.bitcoinRegtestAsset;
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { Orderbook as
|
|
2
|
-
import { Chains as i, isBitcoin as
|
|
3
|
-
import { OrdersProvider as
|
|
4
|
-
import { ArbitrumLocalnet as
|
|
1
|
+
import { Orderbook as r } from "./index2.js";
|
|
2
|
+
import { BlockchainType as s, Chains as i, getBlockchainType as n, isBitcoin as c, isEVM as a, isMainnet as m } from "./index3.js";
|
|
3
|
+
import { OrdersProvider as l } from "./index4.js";
|
|
4
|
+
import { ArbitrumLocalnet as h, EthereumLocalnet as u, SupportedAssets as B, WBTCArbitrumLocalnetAsset as b, WBTCEthereumLocalnetAsset as d, bitcoinRegtestAsset as f } from "./index5.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
h as ArbitrumLocalnet,
|
|
7
|
+
s as BlockchainType,
|
|
7
8
|
i as Chains,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
n as
|
|
9
|
+
u as EthereumLocalnet,
|
|
10
|
+
r as Orderbook,
|
|
11
|
+
l as OrdersProvider,
|
|
12
|
+
B as SupportedAssets,
|
|
13
|
+
b as WBTCArbitrumLocalnetAsset,
|
|
14
|
+
d as WBTCEthereumLocalnetAsset,
|
|
15
|
+
f as bitcoinRegtestAsset,
|
|
16
|
+
n as getBlockchainType,
|
|
17
|
+
c as isBitcoin,
|
|
18
|
+
a as isEVM,
|
|
16
19
|
m as isMainnet
|
|
17
20
|
};
|
package/dist/index2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@catalogfi/utils"),d=require("./index6.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@catalogfi/utils"),d=require("./index6.cjs"),l=require("@gardenfi/utils"),o=require("./index4.cjs");class i extends o.OrdersProvider{constructor(r){const e=new l.Url("/relayer",r.url??d.MAINNET_ORDERBOOK_API);super(e),this.Url=e,this.walletClient=r.walletClient,this.auth=r.auth}static async init(r){return await r.auth.getToken(),new i(r)}async createOrder(r){const e=await this.auth.getToken();if(e.error)return s.Err(e.error);try{const t=await s.Fetcher.post(this.Url.endpoint("create-order"),{body:JSON.stringify(r),headers:{Authorization:l.Authorization(e.val),"Content-Type":"application/json"}});return t.error?s.Err(t.error):t.result?s.Ok(t.result):s.Err("CreateOrder: Unexpected error, result is undefined")}catch(t){return s.Err("CreateOrder:",String(t))}}async fetchOrders(r,e=!1,t){var n;const a=(n=this.walletClient.account)==null?void 0:n.address;return a?r?await super.getMatchedOrders(a,e,t):await super.getUnMatchedOrders(a,t):s.Err("Wallet client does not have an account")}async subscribeToOrders(r,e,t,a,n){var c;const u=(c=this.walletClient.account)==null?void 0:c.address;return u?await super.subscribeOrders(u,r,e,t,a,n):()=>{}}async getUserOrdersCount(){var e;const r=(e=this.walletClient.account)==null?void 0:e.address;return r?super.getOrdersCount(r):s.Err("Wallet client does not have an account")}}exports.Orderbook=i;
|
package/dist/index2.js
CHANGED
|
@@ -1,69 +1,61 @@
|
|
|
1
|
-
import { Err as s, Fetcher as
|
|
2
|
-
import { MAINNET_ORDERBOOK_API as
|
|
3
|
-
import { Url as
|
|
4
|
-
import { OrdersProvider as
|
|
5
|
-
class
|
|
1
|
+
import { Err as s, Fetcher as o, Ok as l } from "@catalogfi/utils";
|
|
2
|
+
import { MAINNET_ORDERBOOK_API as d } from "./index6.js";
|
|
3
|
+
import { Url as h, Authorization as O } from "@gardenfi/utils";
|
|
4
|
+
import { OrdersProvider as p } from "./index4.js";
|
|
5
|
+
class c extends p {
|
|
6
6
|
/**
|
|
7
7
|
* Creates an instance of Orderbook. Does not login to the orderbook.
|
|
8
8
|
* @constructor
|
|
9
9
|
* @param {OrderbookConfig} orderbookConfig - The configuration object for the orderbook.
|
|
10
10
|
*/
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
const t = new c(
|
|
11
|
+
constructor(r) {
|
|
12
|
+
const e = new h(
|
|
14
13
|
"/relayer",
|
|
15
|
-
|
|
14
|
+
r.url ?? d
|
|
16
15
|
);
|
|
17
|
-
super(
|
|
18
|
-
...e.opts,
|
|
19
|
-
store: ((r = e.opts) == null ? void 0 : r.store) || new p()
|
|
20
|
-
});
|
|
16
|
+
super(e), this.Url = e, this.walletClient = r.walletClient, this.auth = r.auth;
|
|
21
17
|
}
|
|
22
18
|
/**
|
|
23
19
|
* Initializes the orderbook as well as logs in the orderbook (fetches the auth token).
|
|
24
20
|
* @param {OrderbookConfig} orderbookConfig - The configuration object for the orderbook.
|
|
25
21
|
*/
|
|
26
|
-
static async init(
|
|
27
|
-
return await new
|
|
28
|
-
new c("/relayer", e.url ?? u),
|
|
29
|
-
e.walletClient,
|
|
30
|
-
e.opts
|
|
31
|
-
).getToken(), new o(e);
|
|
22
|
+
static async init(r) {
|
|
23
|
+
return await r.auth.getToken(), new c(r);
|
|
32
24
|
}
|
|
33
25
|
/**
|
|
34
26
|
* Creates an order
|
|
35
27
|
* @param {CreateOrderConfig} createOrderConfig - The configuration for the creating the order.
|
|
36
28
|
* @returns {string} The create order ID.
|
|
37
29
|
*/
|
|
38
|
-
async createOrder(
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
30
|
+
async createOrder(r) {
|
|
31
|
+
const e = await this.auth.getToken();
|
|
32
|
+
if (e.error) return s(e.error);
|
|
41
33
|
try {
|
|
42
|
-
const
|
|
34
|
+
const t = await o.post(
|
|
43
35
|
this.Url.endpoint("create-order"),
|
|
44
36
|
{
|
|
45
|
-
body: JSON.stringify(
|
|
37
|
+
body: JSON.stringify(r),
|
|
46
38
|
headers: {
|
|
47
|
-
Authorization: O(
|
|
39
|
+
Authorization: O(e.val),
|
|
48
40
|
"Content-Type": "application/json"
|
|
49
41
|
}
|
|
50
42
|
}
|
|
51
43
|
);
|
|
52
|
-
return
|
|
53
|
-
} catch (
|
|
54
|
-
return s("CreateOrder:", String(
|
|
44
|
+
return t.error ? s(t.error) : t.result ? l(t.result) : s("CreateOrder: Unexpected error, result is undefined");
|
|
45
|
+
} catch (t) {
|
|
46
|
+
return s("CreateOrder:", String(t));
|
|
55
47
|
}
|
|
56
48
|
}
|
|
57
|
-
async fetchOrders(
|
|
49
|
+
async fetchOrders(r, e = !1, t) {
|
|
58
50
|
var n;
|
|
59
51
|
const a = (n = this.walletClient.account) == null ? void 0 : n.address;
|
|
60
|
-
return a ?
|
|
52
|
+
return a ? r ? await super.getMatchedOrders(
|
|
61
53
|
a,
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
e,
|
|
55
|
+
t
|
|
64
56
|
) : await super.getUnMatchedOrders(
|
|
65
57
|
a,
|
|
66
|
-
|
|
58
|
+
t
|
|
67
59
|
) : s("Wallet client does not have an account");
|
|
68
60
|
}
|
|
69
61
|
/**
|
|
@@ -74,25 +66,25 @@ class o extends y {
|
|
|
74
66
|
* @param paginationConfig - The configuration for the pagination
|
|
75
67
|
* @returns {() => void} A function to unsubscribe from the order updates
|
|
76
68
|
*/
|
|
77
|
-
async subscribeToOrders(e, t,
|
|
78
|
-
var
|
|
79
|
-
const i = (
|
|
69
|
+
async subscribeToOrders(r, e, t, a, n) {
|
|
70
|
+
var u;
|
|
71
|
+
const i = (u = this.walletClient.account) == null ? void 0 : u.address;
|
|
80
72
|
return i ? await super.subscribeOrders(
|
|
81
73
|
i,
|
|
74
|
+
r,
|
|
82
75
|
e,
|
|
83
76
|
t,
|
|
84
|
-
r,
|
|
85
77
|
a,
|
|
86
78
|
n
|
|
87
79
|
) : () => {
|
|
88
80
|
};
|
|
89
81
|
}
|
|
90
82
|
async getUserOrdersCount() {
|
|
91
|
-
var
|
|
92
|
-
const
|
|
93
|
-
return
|
|
83
|
+
var e;
|
|
84
|
+
const r = (e = this.walletClient.account) == null ? void 0 : e.address;
|
|
85
|
+
return r ? super.getOrdersCount(r) : s("Wallet client does not have an account");
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
export {
|
|
97
|
-
|
|
89
|
+
c as Orderbook
|
|
98
90
|
};
|
package/dist/index3.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={bitcoin:"bitcoin",bitcoin_testnet:"bitcoin_testnet",bitcoin_regtest:"bitcoin_regtest",ethereum:"ethereum",ethereum_arbitrum:"ethereum_arbitrum",ethereum_sepolia:"ethereum_sepolia",arbitrum_localnet:"arbitrum_localnet",ethereum_localnet:"ethereum_localnet"},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r=(e=>(e.Bitcoin="Bitcoin",e.EVM="EVM",e))(r||{});const t={bitcoin:"bitcoin",bitcoin_testnet:"bitcoin_testnet",bitcoin_regtest:"bitcoin_regtest",ethereum:"ethereum",ethereum_arbitrum:"ethereum_arbitrum",ethereum_sepolia:"ethereum_sepolia",arbitrum_localnet:"arbitrum_localnet",arbitrum_sepolia:"arbitrum_sepolia",ethereum_localnet:"ethereum_localnet"},n=e=>!(e===t.ethereum_sepolia||e===t.bitcoin_testnet||e===t.bitcoin_regtest||e===t.arbitrum_localnet||e===t.ethereum_localnet),i=e=>e===t.bitcoin||e===t.bitcoin_testnet||e===t.bitcoin_regtest,o=e=>e===t.ethereum||e===t.ethereum_arbitrum||e===t.ethereum_sepolia||e===t.ethereum_localnet||e===t.arbitrum_localnet,u=e=>{if(i(e))return"Bitcoin";if(o(e))return"EVM";throw new Error("Invalid or unsupported chain")};exports.BlockchainType=r;exports.Chains=t;exports.getBlockchainType=u;exports.isBitcoin=i;exports.isEVM=o;exports.isMainnet=n;
|
package/dist/index3.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var r = /* @__PURE__ */ ((e) => (e.Bitcoin = "Bitcoin", e.EVM = "EVM", e))(r || {});
|
|
1
2
|
const t = {
|
|
2
3
|
bitcoin: "bitcoin",
|
|
3
4
|
bitcoin_testnet: "bitcoin_testnet",
|
|
@@ -6,11 +7,18 @@ const t = {
|
|
|
6
7
|
ethereum_arbitrum: "ethereum_arbitrum",
|
|
7
8
|
ethereum_sepolia: "ethereum_sepolia",
|
|
8
9
|
arbitrum_localnet: "arbitrum_localnet",
|
|
10
|
+
arbitrum_sepolia: "arbitrum_sepolia",
|
|
9
11
|
ethereum_localnet: "ethereum_localnet"
|
|
10
|
-
},
|
|
12
|
+
}, n = (e) => !(e === t.ethereum_sepolia || e === t.bitcoin_testnet || e === t.bitcoin_regtest || e === t.arbitrum_localnet || e === t.ethereum_localnet), i = (e) => e === t.bitcoin || e === t.bitcoin_testnet || e === t.bitcoin_regtest, o = (e) => e === t.ethereum || e === t.ethereum_arbitrum || e === t.ethereum_sepolia || e === t.ethereum_localnet || e === t.arbitrum_localnet, u = (e) => {
|
|
13
|
+
if (i(e)) return "Bitcoin";
|
|
14
|
+
if (o(e)) return "EVM";
|
|
15
|
+
throw new Error("Invalid or unsupported chain");
|
|
16
|
+
};
|
|
11
17
|
export {
|
|
18
|
+
r as BlockchainType,
|
|
12
19
|
t as Chains,
|
|
20
|
+
u as getBlockchainType,
|
|
13
21
|
i as isBitcoin,
|
|
14
22
|
o as isEVM,
|
|
15
|
-
|
|
23
|
+
n as isMainnet
|
|
16
24
|
};
|
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"),a={id:31338,name:"Arbitrum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8546/"]}},testnet:!0},n={id:31337,name:"Ethereum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8545/"]}},testnet:!0},r={name:"Bitcoin Regtest",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_regtest,atomicSwapAddress:"primary",tokenAddress:"primary"},t={name:"WBTC Arbitrum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.arbitrum_localnet,atomicSwapAddress:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",tokenAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"},s={name:"WBTC Ethereum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_localnet,atomicSwapAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",tokenAddress:"0x5FbDB2315678afecb367f032d93F642f64180aa3"},c={localnet:{[e.Chains.arbitrum_localnet]:t,[e.Chains.ethereum_localnet]:s},testnet:{[e.Chains.bitcoin_testnet]:{name:"BTC",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_testnet,tokenAddress:"primary",atomicSwapAddress:"primary"},[e.Chains.ethereum_sepolia]:{name:"WBTC",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_sepolia,tokenAddress:"0x00ab86f54F436CfE15253845F139955ae0C00bAf",atomicSwapAddress:"0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1"},[e.Chains.arbitrum_sepolia]:{name:"WBTC",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_sepolia,tokenAddress:"0x4D68da063577F98C55166c7AF6955cF58a97b20A",atomicSwapAddress:"0x3C6a17b8cD92976D1D91E491c93c98cd81998265"}},mainnet:{}};exports.ArbitrumLocalnet=a;exports.EthereumLocalnet=n;exports.SupportedAssets=c;exports.WBTCArbitrumLocalnetAsset=t;exports.WBTCEthereumLocalnetAsset=s;exports.bitcoinRegtestAsset=r;
|
package/dist/index5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chains as e } from "./index3.js";
|
|
2
|
-
const
|
|
2
|
+
const c = {
|
|
3
3
|
id: 31338,
|
|
4
4
|
name: "Arbitrum Localnet",
|
|
5
5
|
nativeCurrency: {
|
|
@@ -13,7 +13,7 @@ const a = {
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
testnet: !0
|
|
16
|
-
},
|
|
16
|
+
}, r = {
|
|
17
17
|
id: 31337,
|
|
18
18
|
name: "Ethereum Localnet",
|
|
19
19
|
nativeCurrency: {
|
|
@@ -27,35 +27,65 @@ const a = {
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
testnet: !0
|
|
30
|
-
},
|
|
30
|
+
}, n = {
|
|
31
31
|
name: "Bitcoin Regtest",
|
|
32
32
|
decimals: 8,
|
|
33
33
|
symbol: "BTC",
|
|
34
34
|
chain: e.bitcoin_regtest,
|
|
35
35
|
atomicSwapAddress: "primary",
|
|
36
|
-
tokenAddress: "primary"
|
|
37
|
-
|
|
38
|
-
}, n = {
|
|
36
|
+
tokenAddress: "primary"
|
|
37
|
+
}, t = {
|
|
39
38
|
name: "WBTC Arbitrum Localnet",
|
|
40
39
|
decimals: 8,
|
|
41
40
|
symbol: "WBTC",
|
|
42
41
|
chain: e.arbitrum_localnet,
|
|
43
42
|
atomicSwapAddress: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
|
|
44
|
-
tokenAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
|
|
45
|
-
|
|
46
|
-
}, c = {
|
|
43
|
+
tokenAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
|
|
44
|
+
}, a = {
|
|
47
45
|
name: "WBTC Ethereum Localnet",
|
|
48
46
|
decimals: 8,
|
|
49
47
|
symbol: "WBTC",
|
|
50
48
|
chain: e.ethereum_localnet,
|
|
51
49
|
atomicSwapAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
|
|
52
|
-
tokenAddress: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
|
|
53
|
-
|
|
50
|
+
tokenAddress: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
|
|
51
|
+
}, m = {
|
|
52
|
+
localnet: {
|
|
53
|
+
[e.arbitrum_localnet]: t,
|
|
54
|
+
[e.ethereum_localnet]: a
|
|
55
|
+
},
|
|
56
|
+
testnet: {
|
|
57
|
+
[e.bitcoin_testnet]: {
|
|
58
|
+
name: "BTC",
|
|
59
|
+
decimals: 8,
|
|
60
|
+
symbol: "BTC",
|
|
61
|
+
chain: e.bitcoin_testnet,
|
|
62
|
+
tokenAddress: "primary",
|
|
63
|
+
atomicSwapAddress: "primary"
|
|
64
|
+
},
|
|
65
|
+
[e.ethereum_sepolia]: {
|
|
66
|
+
name: "WBTC",
|
|
67
|
+
decimals: 8,
|
|
68
|
+
symbol: "WBTC",
|
|
69
|
+
chain: e.ethereum_sepolia,
|
|
70
|
+
tokenAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf",
|
|
71
|
+
atomicSwapAddress: "0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1"
|
|
72
|
+
},
|
|
73
|
+
[e.arbitrum_sepolia]: {
|
|
74
|
+
name: "WBTC",
|
|
75
|
+
decimals: 8,
|
|
76
|
+
symbol: "WBTC",
|
|
77
|
+
chain: e.ethereum_sepolia,
|
|
78
|
+
tokenAddress: "0x4D68da063577F98C55166c7AF6955cF58a97b20A",
|
|
79
|
+
atomicSwapAddress: "0x3C6a17b8cD92976D1D91E491c93c98cd81998265"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
mainnet: {}
|
|
54
83
|
};
|
|
55
84
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
85
|
+
c as ArbitrumLocalnet,
|
|
86
|
+
r as EthereumLocalnet,
|
|
87
|
+
m as SupportedAssets,
|
|
88
|
+
t as WBTCArbitrumLocalnetAsset,
|
|
89
|
+
a as WBTCEthereumLocalnetAsset,
|
|
90
|
+
n as bitcoinRegtestAsset
|
|
61
91
|
};
|
package/dist/index7.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/index7.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
const s = (o, e, t) => {
|
|
1
|
+
const i = (o, e, t) => {
|
|
3
2
|
const r = o.endpoint(e);
|
|
4
|
-
return t && Object.entries(t).forEach(([
|
|
5
|
-
n !== void 0 && r.searchParams.append(
|
|
3
|
+
return t && Object.entries(t).forEach(([c, n]) => {
|
|
4
|
+
n !== void 0 && r.searchParams.append(c, n.toString());
|
|
6
5
|
}), r;
|
|
7
6
|
};
|
|
8
7
|
export {
|
|
9
|
-
|
|
8
|
+
i as ConstructUrl
|
|
10
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, isMainnet, isBitcoin, isEVM } from './lib/asset';
|
|
4
|
+
export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, getBlockchainType, } 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, } from './lib/constants';
|
|
7
|
+
export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, bitcoinRegtestAsset, SupportedAssets, } from './lib/constants';
|
package/dist/src/lib/asset.d.ts
CHANGED
|
@@ -8,9 +8,12 @@ export type AssetCommon = {
|
|
|
8
8
|
};
|
|
9
9
|
export type AssetToken = AssetCommon & {
|
|
10
10
|
tokenAddress: string;
|
|
11
|
-
isToken: true;
|
|
12
11
|
};
|
|
13
12
|
export type Asset = AssetToken;
|
|
13
|
+
export declare enum BlockchainType {
|
|
14
|
+
Bitcoin = "Bitcoin",
|
|
15
|
+
EVM = "EVM"
|
|
16
|
+
}
|
|
14
17
|
export declare enum NetworkType {
|
|
15
18
|
mainnet = "mainnet",
|
|
16
19
|
testnet = "testnet",
|
|
@@ -34,10 +37,12 @@ export declare const Chains: {
|
|
|
34
37
|
readonly ethereum_arbitrum: "ethereum_arbitrum";
|
|
35
38
|
readonly ethereum_sepolia: "ethereum_sepolia";
|
|
36
39
|
readonly arbitrum_localnet: "arbitrum_localnet";
|
|
40
|
+
readonly arbitrum_sepolia: "arbitrum_sepolia";
|
|
37
41
|
readonly ethereum_localnet: "ethereum_localnet";
|
|
38
42
|
};
|
|
39
43
|
export type Chain = keyof typeof Chains;
|
|
40
44
|
export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest'>;
|
|
41
|
-
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "ethereum_arbitrum";
|
|
45
|
+
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "ethereum_arbitrum" | "arbitrum_sepolia";
|
|
42
46
|
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest";
|
|
43
47
|
export declare const isEVM: (chain: Chain) => chain is "ethereum" | "ethereum_arbitrum" | "ethereum_sepolia" | "arbitrum_localnet" | "ethereum_localnet";
|
|
48
|
+
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
@@ -6,3 +6,10 @@ export declare const EthereumLocalnet: Chain;
|
|
|
6
6
|
export declare const bitcoinRegtestAsset: Asset;
|
|
7
7
|
export declare const WBTCArbitrumLocalnetAsset: Asset;
|
|
8
8
|
export declare const WBTCEthereumLocalnetAsset: Asset;
|
|
9
|
+
type SupportedAssets = {
|
|
10
|
+
[chain: string]: {
|
|
11
|
+
[asset: string]: Asset;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const SupportedAssets: SupportedAssets;
|
|
15
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletClient } from 'viem';
|
|
2
2
|
import { AsyncResult } from '@catalogfi/utils';
|
|
3
|
-
import { APIResponse, IStore } from '@gardenfi/utils';
|
|
3
|
+
import { APIResponse, IAuth, IStore } from '@gardenfi/utils';
|
|
4
4
|
import { Asset, Chain } from '../asset';
|
|
5
5
|
import { IOrderProvider } from '../orders/orders.types';
|
|
6
6
|
|
|
@@ -78,7 +78,7 @@ export type OrderbookOpts = {
|
|
|
78
78
|
export interface OrderbookConfig {
|
|
79
79
|
url?: string;
|
|
80
80
|
walletClient: WalletClient;
|
|
81
|
-
|
|
81
|
+
auth: IAuth;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Configuration for the orders you want to receive
|
package/dist/src/lib/utils.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { WalletClient, Chain } from 'viem';
|
|
2
1
|
import { Url } from '@gardenfi/utils';
|
|
3
|
-
import { EvmChain, Chain as GardenChain } from './asset';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Constructs a URL with the given base URL, endpoint and parameters (query params)
|
|
@@ -11,5 +9,3 @@ import { EvmChain, Chain as GardenChain } from './asset';
|
|
|
11
9
|
export declare const ConstructUrl: (baseUrl: Url, endPoint: string, params?: {
|
|
12
10
|
[key: string]: string | number | boolean | undefined;
|
|
13
11
|
}) => URL;
|
|
14
|
-
export declare const ChainToID: Record<EvmChain, Chain>;
|
|
15
|
-
export declare const switchOrAddNetwork: (chain: GardenChain, walletClient: WalletClient) => Promise<import('@catalogfi/utils').Result<string, never> | import('@catalogfi/utils').Result<never, string>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gardenfi/orderbook",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@catalogfi/utils": "^0.1.6",
|
|
30
|
-
"@
|
|
31
|
-
"@gardenfi/utils": "^0.0.1-beta.6",
|
|
30
|
+
"@gardenfi/utils": "^0.0.1-beta.13",
|
|
32
31
|
"bufferutil": "^4.0.8",
|
|
33
32
|
"siwe": "^2.1.4",
|
|
34
33
|
"utf-8-validate": "^6.0.3",
|