@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 CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index2.cjs"),t=require("./index3.cjs"),s=require("./index4.cjs"),e=require("./index5.cjs");exports.Orderbook=r.Orderbook;exports.Chains=t.Chains;exports.isBitcoin=t.isBitcoin;exports.isEVM=t.isEVM;exports.isMainnet=t.isMainnet;exports.OrdersProvider=s.OrdersProvider;exports.ArbitrumLocalnet=e.ArbitrumLocalnet;exports.EthereumLocalnet=e.EthereumLocalnet;exports.WBTCArbitrumLocalnetAsset=e.WBTCArbitrumLocalnetAsset;exports.WBTCEthereumLocalnetAsset=e.WBTCEthereumLocalnetAsset;exports.bitcoinRegtestAsset=e.bitcoinRegtestAsset;
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 t } from "./index2.js";
2
- import { Chains as i, isBitcoin as s, isEVM as n, isMainnet as m } from "./index3.js";
3
- import { OrdersProvider as c } from "./index4.js";
4
- import { ArbitrumLocalnet as b, EthereumLocalnet as f, WBTCArbitrumLocalnetAsset as l, WBTCEthereumLocalnetAsset as p, bitcoinRegtestAsset as u } from "./index5.js";
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
- b as ArbitrumLocalnet,
6
+ h as ArbitrumLocalnet,
7
+ s as BlockchainType,
7
8
  i as Chains,
8
- f as EthereumLocalnet,
9
- t as Orderbook,
10
- c as OrdersProvider,
11
- l as WBTCArbitrumLocalnetAsset,
12
- p as WBTCEthereumLocalnetAsset,
13
- u as bitcoinRegtestAsset,
14
- s as isBitcoin,
15
- n as isEVM,
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"),a=require("@gardenfi/utils"),o=require("./index4.cjs");class u extends o.OrdersProvider{constructor(e){var t;const r=new a.Url("/relayer",e.url??d.MAINNET_ORDERBOOK_API);super(r),this.Url=r,this.walletClient=e.walletClient,this.auth=new a.Siwe(this.Url,e.walletClient,{...e.opts,store:((t=e.opts)==null?void 0:t.store)||new a.MemoryStorage})}static async init(e){return await new a.Siwe(new a.Url("/relayer",e.url??d.MAINNET_ORDERBOOK_API),e.walletClient,e.opts).getToken(),new u(e)}async createOrder(e){const r=await this.auth.getToken();if(r.error)return s.Err(r.error);try{const t=await s.Fetcher.post(this.Url.endpoint("create-order"),{body:JSON.stringify(e),headers:{Authorization:a.Authorization(r.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(e,r=!1,t){var i;const n=(i=this.walletClient.account)==null?void 0:i.address;return n?e?await super.getMatchedOrders(n,r,t):await super.getUnMatchedOrders(n,t):s.Err("Wallet client does not have an account")}async subscribeToOrders(e,r,t,n,i){var c;const l=(c=this.walletClient.account)==null?void 0:c.address;return l?await super.subscribeOrders(l,e,r,t,n,i):()=>{}}async getUserOrdersCount(){var r;const e=(r=this.walletClient.account)==null?void 0:r.address;return e?super.getOrdersCount(e):s.Err("Wallet client does not have an account")}}exports.Orderbook=u;
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 h, Ok as w } from "@catalogfi/utils";
2
- import { MAINNET_ORDERBOOK_API as u } from "./index6.js";
3
- import { Url as c, Siwe as d, MemoryStorage as p, Authorization as O } from "@gardenfi/utils";
4
- import { OrdersProvider as y } from "./index4.js";
5
- class o extends y {
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(e) {
12
- var r;
13
- const t = new c(
11
+ constructor(r) {
12
+ const e = new h(
14
13
  "/relayer",
15
- e.url ?? u
14
+ r.url ?? d
16
15
  );
17
- super(t), this.Url = t, this.walletClient = e.walletClient, this.auth = new d(this.Url, e.walletClient, {
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(e) {
27
- return await new d(
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(e) {
39
- const t = await this.auth.getToken();
40
- if (t.error) return s(t.error);
30
+ async createOrder(r) {
31
+ const e = await this.auth.getToken();
32
+ if (e.error) return s(e.error);
41
33
  try {
42
- const r = await h.post(
34
+ const t = await o.post(
43
35
  this.Url.endpoint("create-order"),
44
36
  {
45
- body: JSON.stringify(e),
37
+ body: JSON.stringify(r),
46
38
  headers: {
47
- Authorization: O(t.val),
39
+ Authorization: O(e.val),
48
40
  "Content-Type": "application/json"
49
41
  }
50
42
  }
51
43
  );
52
- return r.error ? s(r.error) : r.result ? w(r.result) : s("CreateOrder: Unexpected error, result is undefined");
53
- } catch (r) {
54
- return s("CreateOrder:", String(r));
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(e, t = !1, r) {
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 ? e ? await super.getMatchedOrders(
52
+ return a ? r ? await super.getMatchedOrders(
61
53
  a,
62
- t,
63
- r
54
+ e,
55
+ t
64
56
  ) : await super.getUnMatchedOrders(
65
57
  a,
66
- r
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, r, a, n) {
78
- var l;
79
- const i = (l = this.walletClient.account) == null ? void 0 : l.address;
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 t;
92
- const e = (t = this.walletClient.account) == null ? void 0 : t.address;
93
- return e ? super.getOrdersCount(e) : s("Wallet client does not have an account");
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
- o as Orderbook
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"},r=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;exports.Chains=t;exports.isBitcoin=i;exports.isEVM=o;exports.isMainnet=r;
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
- }, r = (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;
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
- r as isMainnet
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"),t={id:31338,name:"Arbitrum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8546/"]}},testnet:!0},s={id:31337,name:"Ethereum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8545/"]}},testnet:!0},a={name:"Bitcoin Regtest",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_regtest,atomicSwapAddress:"primary",tokenAddress:"primary",isToken:!0},r={name:"WBTC Arbitrum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.arbitrum_localnet,atomicSwapAddress:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",tokenAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",isToken:!0},n={name:"WBTC Ethereum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_localnet,atomicSwapAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",tokenAddress:"0x5FbDB2315678afecb367f032d93F642f64180aa3",isToken:!0};exports.ArbitrumLocalnet=t;exports.EthereumLocalnet=s;exports.WBTCArbitrumLocalnetAsset=r;exports.WBTCEthereumLocalnetAsset=n;exports.bitcoinRegtestAsset=a;
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 a = {
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
- }, s = {
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
- }, r = {
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
- isToken: !0
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
- isToken: !0
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
- isToken: !0
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
- a as ArbitrumLocalnet,
57
- s as EthereumLocalnet,
58
- n as WBTCArbitrumLocalnetAsset,
59
- c as WBTCEthereumLocalnetAsset,
60
- r as bitcoinRegtestAsset
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"});require("@catalogfi/utils");const c=(n,o,t)=>{const r=n.endpoint(o);return t&&Object.entries(t).forEach(([i,e])=>{e!==void 0&&r.searchParams.append(i,e.toString())}),r};exports.ConstructUrl=c;
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
- import "@catalogfi/utils";
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(([i, n]) => {
5
- n !== void 0 && r.searchParams.append(i, n.toString());
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
- s as ConstructUrl
8
+ i as ConstructUrl
10
9
  };
@@ -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';
@@ -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
- opts?: OrderbookOpts;
81
+ auth: IAuth;
82
82
  }
83
83
  /**
84
84
  * Configuration for the orders you want to receive
@@ -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.5",
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
- "@catalogfi/wallets": "0.2.43",
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",