@gardenfi/orderbook 0.2.0-beta.4 → 0.2.0-beta.40
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 +21 -15
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +35 -43
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +36 -6
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +183 -16
- package/dist/src/index.d.ts +2 -2
- package/dist/src/lib/asset.d.ts +14 -4
- package/dist/src/lib/constants.d.ts +30 -0
- package/dist/src/lib/orderbook/orderbook.d.ts +1 -1
- package/dist/src/lib/orderbook/orderbook.types.d.ts +5 -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"),o=require("./index4.cjs"),t=require("./index5.cjs");exports.Orderbook=r.Orderbook;exports.BlockchainType=e.BlockchainType;exports.Chains=e.Chains;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.isMainnet=e.isMainnet;exports.OrdersProvider=o.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,23 @@
|
|
|
1
|
-
import { Orderbook as
|
|
2
|
-
import {
|
|
3
|
-
import { OrdersProvider as
|
|
4
|
-
import { ArbitrumLocalnet as
|
|
1
|
+
import { Orderbook as o } from "./index2.js";
|
|
2
|
+
import { BlockchainType as i, Chains as s, NetworkType as c, TimeLocks as n, getBlockchainType as m, getTimeLock as p, isBitcoin as a, isEVM as T, isMainnet as k } from "./index3.js";
|
|
3
|
+
import { OrdersProvider as A } 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
|
-
|
|
7
|
-
i as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
c as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
h as ArbitrumLocalnet,
|
|
7
|
+
i as BlockchainType,
|
|
8
|
+
s as Chains,
|
|
9
|
+
u as EthereumLocalnet,
|
|
10
|
+
c as NetworkType,
|
|
11
|
+
o as Orderbook,
|
|
12
|
+
A as OrdersProvider,
|
|
13
|
+
B as SupportedAssets,
|
|
14
|
+
n as TimeLocks,
|
|
15
|
+
b as WBTCArbitrumLocalnetAsset,
|
|
16
|
+
d as WBTCEthereumLocalnetAsset,
|
|
17
|
+
f as bitcoinRegtestAsset,
|
|
18
|
+
m as getBlockchainType,
|
|
19
|
+
p as getTimeLock,
|
|
20
|
+
a as isBitcoin,
|
|
21
|
+
T as isEVM,
|
|
22
|
+
k as isMainnet
|
|
17
23
|
};
|
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,n,a):()=>{}}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
|
-
|
|
85
|
-
a
|
|
86
|
-
n
|
|
77
|
+
n,
|
|
78
|
+
a
|
|
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",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var i=(e=>(e.Bitcoin="Bitcoin",e.EVM="EVM",e))(i||{}),o=(e=>(e.mainnet="mainnet",e.testnet="testnet",e.localnet="localnet",e))(o||{});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"},a=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),s=e=>e===t.bitcoin||e===t.bitcoin_testnet||e===t.bitcoin_regtest,n=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,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]:7200,[t.base]:43200,[t.bera_testnet]:28800},l=e=>{if(s(e))return"Bitcoin";if(n(e))return"EVM";throw new Error("Invalid or unsupported chain")},b=e=>{if(!r[e])throw new Error("Invalid or unsupported chain");return r[e]};exports.BlockchainType=i;exports.Chains=t;exports.NetworkType=o;exports.TimeLocks=r;exports.getBlockchainType=l;exports.getTimeLock=b;exports.isBitcoin=s;exports.isEVM=n;exports.isMainnet=a;
|
package/dist/index3.js
CHANGED
|
@@ -1,16 +1,46 @@
|
|
|
1
|
+
var i = /* @__PURE__ */ ((e) => (e.Bitcoin = "Bitcoin", e.EVM = "EVM", e))(i || {}), o = /* @__PURE__ */ ((e) => (e.mainnet = "mainnet", e.testnet = "testnet", e.localnet = "localnet", e))(o || {});
|
|
1
2
|
const t = {
|
|
2
3
|
bitcoin: "bitcoin",
|
|
3
4
|
bitcoin_testnet: "bitcoin_testnet",
|
|
4
5
|
bitcoin_regtest: "bitcoin_regtest",
|
|
5
6
|
ethereum: "ethereum",
|
|
6
|
-
|
|
7
|
+
base: "base",
|
|
8
|
+
arbitrum: "arbitrum",
|
|
7
9
|
ethereum_sepolia: "ethereum_sepolia",
|
|
8
10
|
arbitrum_localnet: "arbitrum_localnet",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
arbitrum_sepolia: "arbitrum_sepolia",
|
|
12
|
+
ethereum_localnet: "ethereum_localnet",
|
|
13
|
+
base_sepolia: "base_sepolia",
|
|
14
|
+
bera_testnet: "bera_testnet"
|
|
15
|
+
}, a = (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), s = (e) => e === t.bitcoin || e === t.bitcoin_testnet || e === t.bitcoin_regtest, n = (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, r = {
|
|
16
|
+
[t.bitcoin]: 144,
|
|
17
|
+
[t.bitcoin_testnet]: 144,
|
|
18
|
+
[t.bitcoin_regtest]: 144,
|
|
19
|
+
[t.ethereum]: 7200,
|
|
20
|
+
[t.arbitrum]: 7200,
|
|
21
|
+
[t.ethereum_sepolia]: 7200,
|
|
22
|
+
[t.arbitrum_localnet]: 7200,
|
|
23
|
+
[t.arbitrum_sepolia]: 7200,
|
|
24
|
+
[t.ethereum_localnet]: 7200,
|
|
25
|
+
[t.base_sepolia]: 7200,
|
|
26
|
+
[t.base]: 43200,
|
|
27
|
+
[t.bera_testnet]: 28800
|
|
28
|
+
}, b = (e) => {
|
|
29
|
+
if (s(e)) return "Bitcoin";
|
|
30
|
+
if (n(e)) return "EVM";
|
|
31
|
+
throw new Error("Invalid or unsupported chain");
|
|
32
|
+
}, l = (e) => {
|
|
33
|
+
if (!r[e]) throw new Error("Invalid or unsupported chain");
|
|
34
|
+
return r[e];
|
|
35
|
+
};
|
|
11
36
|
export {
|
|
37
|
+
i as BlockchainType,
|
|
12
38
|
t as Chains,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
o as NetworkType,
|
|
40
|
+
r as TimeLocks,
|
|
41
|
+
b as getBlockchainType,
|
|
42
|
+
l as getTimeLock,
|
|
43
|
+
s as isBitcoin,
|
|
44
|
+
n as isEVM,
|
|
45
|
+
a as isMainnet
|
|
16
46
|
};
|
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},
|
|
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},c={id:31337,name:"Ethereum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8545/"]}},testnet:!0},d={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"},s={name:"WBTC Ethereum Localnet",decimals:8,symbol:"WBTC",chain:e.Chains.ethereum_localnet,atomicSwapAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",tokenAddress:"0x5FbDB2315678afecb367f032d93F642f64180aa3"},i={localnet:{arbitrum_localnet_0xdc64a140aa3e981100a9beca4e685f962f0cf6c9:a,ethereum_localnet_0xe7f1725e7734ce288f8367e1bb143e90bb3f0512:s},testnet:{bitcoin_testnet_primary:{name:"BTC",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin_testnet,tokenAddress:"primary",atomicSwapAddress:"primary"},ethereum_sepolia_0x3c6a17b8cd92976d1d91e491c93c98cd81998265:{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_0x1cd0bbd55fd66b4c5f7dfe434efd009c09e628d1:{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_0xd5fedb4cecb0f1d32788a190d9eb47d94d23ee4e:{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_0xdfe6d9363ee96152d39391009a6723819d9e25eb:{name:"iBTC",decimals:8,symbol:"iBTC",chain:e.Chains.arbitrum_sepolia,logo:"https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",tokenAddress:"0x685437f025c5f33a94818408c286bc1f023201fc",atomicSwapAddress:"0xdfe6d9363ee96152d39391009a6723819d9e25eb"},base_sepolia_0x00ab86f54f436cfe15253845f139955ae0c00baf:{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_0xb391ca6d0a76cd2a927bc314856e8a374a225cfc:{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_0xbcdad29ac77e5bb27fd528ab0045af630259fe4f:{name:"iBTC",decimals:8,symbol:"iBTC",chain:e.Chains.base_sepolia,logo:"https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",tokenAddress:"0x0b0D554D9573bAe1a7556d220847f45182918B28",atomicSwapAddress:"0xbcdad29ac77e5bb27fd528ab0045af630259fe4f"},bera_testnet_0x1dc94fdcad8aee13cfd34db8a26d26e31572805c:{name:"Wrapped Bitcoin",decimals:8,symbol:"WBTC",chain:e.Chains.bera_testnet,logo:"https://garden-finance.imgix.net/token-images/wbtc.svg",tokenAddress:"0x00ab86f54F436CfE15253845F139955ae0C00bAf",atomicSwapAddress:"0x1dC94FdcAd8Aee13cfd34Db8a26d26E31572805c"}},mainnet:{bitcoin_primary:{name:"BTC",decimals:8,symbol:"BTC",chain:e.Chains.bitcoin,tokenAddress:"primary",atomicSwapAddress:"primary"},base_0xeae7721d779276eb0f5837e2fe260118724a2ba4:{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_0xd8a6e3fca403d79b6ad6216b60527f51cc967d39:{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_0x795dcb58d1cd4789169d5f938ea05e17eceb68ca:{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_0xd8a6e3fca403d79b6ad6216b60527f51cc967d39:{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_0xeae7721d779276eb0f5837e2fe260118724a2ba4:{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_0x6b6303fab8ec7232b4f2a7b9fa58e5216f608fcb:{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_0xeae7721d779276eb0f5837e2fe260118724a2ba4:{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_0xdc74a45e86dedf1ff7c6dac77e0c2f082f9e4f72:{name:"iBTC",decimals:8,symbol:"iBTC",chain:e.Chains.arbitrum,logo:"https://garden-finance.imgix.net/token-images/iBTC.svg",tokenAddress:"0x050C24dBf1eEc17babE5fc585F06116A259CC77A",atomicSwapAddress:"0xdc74a45e86dedf1ff7c6dac77e0c2f082f9e4f72"}}};exports.ArbitrumLocalnet=t;exports.EthereumLocalnet=c;exports.SupportedAssets=i;exports.WBTCArbitrumLocalnetAsset=a;exports.WBTCEthereumLocalnetAsset=s;exports.bitcoinRegtestAsset=d;
|
package/dist/index5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chains as e } from "./index3.js";
|
|
2
|
-
const
|
|
2
|
+
const s = {
|
|
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
|
+
}, t = {
|
|
17
17
|
id: 31337,
|
|
18
18
|
name: "Ethereum Localnet",
|
|
19
19
|
nativeCurrency: {
|
|
@@ -27,35 +27,202 @@ const a = {
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
testnet: !0
|
|
30
|
-
},
|
|
30
|
+
}, i = {
|
|
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
|
+
}, a = {
|
|
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
|
+
}, d = {
|
|
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
|
+
}, n = {
|
|
52
|
+
localnet: {
|
|
53
|
+
arbitrum_localnet_0xdc64a140aa3e981100a9beca4e685f962f0cf6c9: a,
|
|
54
|
+
ethereum_localnet_0xe7f1725e7734ce288f8367e1bb143e90bb3f0512: d
|
|
55
|
+
},
|
|
56
|
+
testnet: {
|
|
57
|
+
bitcoin_testnet_primary: {
|
|
58
|
+
name: "BTC",
|
|
59
|
+
decimals: 8,
|
|
60
|
+
symbol: "BTC",
|
|
61
|
+
chain: e.bitcoin_testnet,
|
|
62
|
+
tokenAddress: "primary",
|
|
63
|
+
atomicSwapAddress: "primary"
|
|
64
|
+
},
|
|
65
|
+
ethereum_sepolia_0x3c6a17b8cd92976d1d91e491c93c98cd81998265: {
|
|
66
|
+
name: "Wrapped Bitcoin",
|
|
67
|
+
decimals: 8,
|
|
68
|
+
symbol: "WBTC",
|
|
69
|
+
chain: e.ethereum_sepolia,
|
|
70
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
71
|
+
tokenAddress: "0x4D68da063577F98C55166c7AF6955cF58a97b20A",
|
|
72
|
+
atomicSwapAddress: "0x3C6a17b8cD92976D1D91E491c93c98cd81998265"
|
|
73
|
+
},
|
|
74
|
+
arbitrum_sepolia_0x1cd0bbd55fd66b4c5f7dfe434efd009c09e628d1: {
|
|
75
|
+
name: "Wrapped Bitcoin",
|
|
76
|
+
decimals: 8,
|
|
77
|
+
symbol: "WBTC",
|
|
78
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
79
|
+
chain: e.arbitrum_sepolia,
|
|
80
|
+
tokenAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf",
|
|
81
|
+
atomicSwapAddress: "0x1cd0bBd55fD66B4C5F7dfE434eFD009C09e628d1"
|
|
82
|
+
},
|
|
83
|
+
arbitrum_sepolia_0xd5fedb4cecb0f1d32788a190d9eb47d94d23ee4e: {
|
|
84
|
+
name: "Seed",
|
|
85
|
+
decimals: 18,
|
|
86
|
+
symbol: "SEED",
|
|
87
|
+
chain: e.arbitrum_sepolia,
|
|
88
|
+
logo: "https://garden-finance.imgix.net/token-images/seed.svg",
|
|
89
|
+
tokenAddress: "0x13DCec0762EcC5E666c207ab44Dc768e5e33070F",
|
|
90
|
+
atomicSwapAddress: "0xD5FeDb4ceCB0F1D32788a190d9EB47D94D23eE4e"
|
|
91
|
+
},
|
|
92
|
+
arbitrum_sepolia_0xdfe6d9363ee96152d39391009a6723819d9e25eb: {
|
|
93
|
+
name: "iBTC",
|
|
94
|
+
decimals: 8,
|
|
95
|
+
symbol: "iBTC",
|
|
96
|
+
chain: e.arbitrum_sepolia,
|
|
97
|
+
logo: "https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",
|
|
98
|
+
tokenAddress: "0x685437f025c5f33a94818408c286bc1f023201fc",
|
|
99
|
+
atomicSwapAddress: "0xdfe6d9363ee96152d39391009a6723819d9e25eb"
|
|
100
|
+
},
|
|
101
|
+
base_sepolia_0x00ab86f54f436cfe15253845f139955ae0c00baf: {
|
|
102
|
+
name: "Wrapped Bitcoin",
|
|
103
|
+
decimals: 8,
|
|
104
|
+
symbol: "WBTC",
|
|
105
|
+
chain: e.base_sepolia,
|
|
106
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
107
|
+
tokenAddress: "0x13DCec0762EcC5E666c207ab44Dc768e5e33070F",
|
|
108
|
+
atomicSwapAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf"
|
|
109
|
+
},
|
|
110
|
+
base_sepolia_0xb391ca6d0a76cd2a927bc314856e8a374a225cfc: {
|
|
111
|
+
name: "Tether USD",
|
|
112
|
+
decimals: 6,
|
|
113
|
+
symbol: "USDT",
|
|
114
|
+
chain: e.base_sepolia,
|
|
115
|
+
logo: "https://garden-finance.imgix.net/token-images/usdt.svg",
|
|
116
|
+
tokenAddress: "0xD72Fc3e7D52301b3e5f7d4E3366F88d5C8747520",
|
|
117
|
+
atomicSwapAddress: "0xB391CA6D0A76CD2A927bC314856E8a374a225CFc"
|
|
118
|
+
},
|
|
119
|
+
base_sepolia_0xbcdad29ac77e5bb27fd528ab0045af630259fe4f: {
|
|
120
|
+
name: "iBTC",
|
|
121
|
+
decimals: 8,
|
|
122
|
+
symbol: "iBTC",
|
|
123
|
+
chain: e.base_sepolia,
|
|
124
|
+
logo: "https://garden-finance.imgix.net/token-images/dlcBTCIcon.svg",
|
|
125
|
+
tokenAddress: "0x0b0D554D9573bAe1a7556d220847f45182918B28",
|
|
126
|
+
atomicSwapAddress: "0xbcdad29ac77e5bb27fd528ab0045af630259fe4f"
|
|
127
|
+
},
|
|
128
|
+
bera_testnet_0x1dc94fdcad8aee13cfd34db8a26d26e31572805c: {
|
|
129
|
+
name: "Wrapped Bitcoin",
|
|
130
|
+
decimals: 8,
|
|
131
|
+
symbol: "WBTC",
|
|
132
|
+
chain: e.bera_testnet,
|
|
133
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
134
|
+
tokenAddress: "0x00ab86f54F436CfE15253845F139955ae0C00bAf",
|
|
135
|
+
atomicSwapAddress: "0x1dC94FdcAd8Aee13cfd34Db8a26d26E31572805c"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
mainnet: {
|
|
139
|
+
bitcoin_primary: {
|
|
140
|
+
name: "BTC",
|
|
141
|
+
decimals: 8,
|
|
142
|
+
symbol: "BTC",
|
|
143
|
+
chain: e.bitcoin,
|
|
144
|
+
tokenAddress: "primary",
|
|
145
|
+
atomicSwapAddress: "primary"
|
|
146
|
+
},
|
|
147
|
+
base_0xeae7721d779276eb0f5837e2fe260118724a2ba4: {
|
|
148
|
+
name: "Coinbase Bitcoin",
|
|
149
|
+
decimals: 8,
|
|
150
|
+
symbol: "cbBTC",
|
|
151
|
+
chain: e.base,
|
|
152
|
+
logo: "https://garden-finance.imgix.net/token-images/cbBTC.svg",
|
|
153
|
+
tokenAddress: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
|
|
154
|
+
atomicSwapAddress: "0xeae7721d779276eb0f5837e2fe260118724a2ba4"
|
|
155
|
+
},
|
|
156
|
+
base_0xd8a6e3fca403d79b6ad6216b60527f51cc967d39: {
|
|
157
|
+
name: "USD Coin",
|
|
158
|
+
decimals: 6,
|
|
159
|
+
symbol: "USDC",
|
|
160
|
+
chain: e.base,
|
|
161
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
162
|
+
tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
163
|
+
atomicSwapAddress: "0xd8a6e3fca403d79b6ad6216b60527f51cc967d39"
|
|
164
|
+
},
|
|
165
|
+
ethereum_0x795dcb58d1cd4789169d5f938ea05e17eceb68ca: {
|
|
166
|
+
name: "Wrapped Bitcoin",
|
|
167
|
+
decimals: 8,
|
|
168
|
+
symbol: "WBTC",
|
|
169
|
+
chain: e.ethereum,
|
|
170
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
171
|
+
tokenAddress: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
|
172
|
+
atomicSwapAddress: "0x795dcb58d1cd4789169d5f938ea05e17eceb68ca"
|
|
173
|
+
},
|
|
174
|
+
ethereum_0xd8a6e3fca403d79b6ad6216b60527f51cc967d39: {
|
|
175
|
+
name: "USD Coin",
|
|
176
|
+
decimals: 6,
|
|
177
|
+
symbol: "USDC",
|
|
178
|
+
chain: e.ethereum,
|
|
179
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
180
|
+
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
181
|
+
atomicSwapAddress: "0xd8a6e3fca403d79b6ad6216b60527f51cc967d39"
|
|
182
|
+
},
|
|
183
|
+
ethereum_0xeae7721d779276eb0f5837e2fe260118724a2ba4: {
|
|
184
|
+
name: "Coinbase Bitcoin",
|
|
185
|
+
decimals: 8,
|
|
186
|
+
symbol: "cbBTC",
|
|
187
|
+
chain: e.ethereum,
|
|
188
|
+
logo: "https://garden-finance.imgix.net/token-images/cbBTC.svg",
|
|
189
|
+
tokenAddress: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
|
|
190
|
+
atomicSwapAddress: "0xeae7721d779276eb0f5837e2fe260118724a2ba4"
|
|
191
|
+
},
|
|
192
|
+
arbitrum_0x6b6303fab8ec7232b4f2a7b9fa58e5216f608fcb: {
|
|
193
|
+
name: "Wrapped Bitcoin",
|
|
194
|
+
decimals: 8,
|
|
195
|
+
symbol: "WBTC",
|
|
196
|
+
chain: e.arbitrum,
|
|
197
|
+
logo: "https://garden-finance.imgix.net/token-images/wbtc.svg",
|
|
198
|
+
tokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
199
|
+
atomicSwapAddress: "0x6b6303fab8ec7232b4f2a7b9fa58e5216f608fcb"
|
|
200
|
+
},
|
|
201
|
+
arbitrum_0xeae7721d779276eb0f5837e2fe260118724a2ba4: {
|
|
202
|
+
name: "USD Coin",
|
|
203
|
+
decimals: 6,
|
|
204
|
+
symbol: "USDC",
|
|
205
|
+
chain: e.arbitrum,
|
|
206
|
+
logo: "https://garden-finance.imgix.net/token-images/usdc.svg",
|
|
207
|
+
tokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
208
|
+
atomicSwapAddress: "0xeae7721d779276eb0f5837e2fe260118724a2ba4"
|
|
209
|
+
},
|
|
210
|
+
arbitrum_0xdc74a45e86dedf1ff7c6dac77e0c2f082f9e4f72: {
|
|
211
|
+
name: "iBTC",
|
|
212
|
+
decimals: 8,
|
|
213
|
+
symbol: "iBTC",
|
|
214
|
+
chain: e.arbitrum,
|
|
215
|
+
logo: "https://garden-finance.imgix.net/token-images/iBTC.svg",
|
|
216
|
+
tokenAddress: "0x050C24dBf1eEc17babE5fc585F06116A259CC77A",
|
|
217
|
+
atomicSwapAddress: "0xdc74a45e86dedf1ff7c6dac77e0c2f082f9e4f72"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
54
220
|
};
|
|
55
221
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
n as
|
|
59
|
-
|
|
60
|
-
|
|
222
|
+
s as ArbitrumLocalnet,
|
|
223
|
+
t as EthereumLocalnet,
|
|
224
|
+
n as SupportedAssets,
|
|
225
|
+
a as WBTCArbitrumLocalnetAsset,
|
|
226
|
+
d as WBTCEthereumLocalnetAsset,
|
|
227
|
+
i as bitcoinRegtestAsset
|
|
61
228
|
};
|
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, NetworkType, TimeLocks, getTimeLock, } 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",
|
|
@@ -31,13 +34,20 @@ export declare const Chains: {
|
|
|
31
34
|
readonly bitcoin_testnet: "bitcoin_testnet";
|
|
32
35
|
readonly bitcoin_regtest: "bitcoin_regtest";
|
|
33
36
|
readonly ethereum: "ethereum";
|
|
34
|
-
readonly
|
|
37
|
+
readonly base: "base";
|
|
38
|
+
readonly arbitrum: "arbitrum";
|
|
35
39
|
readonly ethereum_sepolia: "ethereum_sepolia";
|
|
36
40
|
readonly arbitrum_localnet: "arbitrum_localnet";
|
|
41
|
+
readonly arbitrum_sepolia: "arbitrum_sepolia";
|
|
37
42
|
readonly ethereum_localnet: "ethereum_localnet";
|
|
43
|
+
readonly base_sepolia: "base_sepolia";
|
|
44
|
+
readonly bera_testnet: "bera_testnet";
|
|
38
45
|
};
|
|
39
46
|
export type Chain = keyof typeof Chains;
|
|
40
47
|
export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest'>;
|
|
41
|
-
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "
|
|
48
|
+
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "base" | "arbitrum";
|
|
42
49
|
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest";
|
|
43
|
-
export declare const isEVM: (chain: Chain) => chain is "ethereum" | "
|
|
50
|
+
export declare const isEVM: (chain: Chain) => chain is "ethereum" | "base" | "arbitrum" | "ethereum_sepolia" | "arbitrum_localnet" | "arbitrum_sepolia" | "ethereum_localnet" | "base_sepolia" | "bera_testnet";
|
|
51
|
+
export declare const TimeLocks: Record<Chain, number>;
|
|
52
|
+
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
53
|
+
export declare const getTimeLock: (chain: Chain) => number;
|
|
@@ -6,3 +6,33 @@ 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
|
+
localnet: {
|
|
11
|
+
arbitrum_localnet_0xdc64a140aa3e981100a9beca4e685f962f0cf6c9: Asset;
|
|
12
|
+
ethereum_localnet_0xe7f1725e7734ce288f8367e1bb143e90bb3f0512: Asset;
|
|
13
|
+
};
|
|
14
|
+
testnet: {
|
|
15
|
+
bitcoin_testnet_primary: Asset;
|
|
16
|
+
ethereum_sepolia_0x3c6a17b8cd92976d1d91e491c93c98cd81998265: Asset;
|
|
17
|
+
arbitrum_sepolia_0x1cd0bbd55fd66b4c5f7dfe434efd009c09e628d1: Asset;
|
|
18
|
+
arbitrum_sepolia_0xd5fedb4cecb0f1d32788a190d9eb47d94d23ee4e: Asset;
|
|
19
|
+
arbitrum_sepolia_0xdfe6d9363ee96152d39391009a6723819d9e25eb: Asset;
|
|
20
|
+
base_sepolia_0x00ab86f54f436cfe15253845f139955ae0c00baf: Asset;
|
|
21
|
+
base_sepolia_0xb391ca6d0a76cd2a927bc314856e8a374a225cfc: Asset;
|
|
22
|
+
base_sepolia_0xbcdad29ac77e5bb27fd528ab0045af630259fe4f: Asset;
|
|
23
|
+
bera_testnet_0x1dc94fdcad8aee13cfd34db8a26d26e31572805c: Asset;
|
|
24
|
+
};
|
|
25
|
+
mainnet: {
|
|
26
|
+
bitcoin_primary: Asset;
|
|
27
|
+
base_0xeae7721d779276eb0f5837e2fe260118724a2ba4: Asset;
|
|
28
|
+
base_0xd8a6e3fca403d79b6ad6216b60527f51cc967d39: Asset;
|
|
29
|
+
ethereum_0x795dcb58d1cd4789169d5f938ea05e17eceb68ca: Asset;
|
|
30
|
+
ethereum_0xd8a6e3fca403d79b6ad6216b60527f51cc967d39: Asset;
|
|
31
|
+
ethereum_0xeae7721d779276eb0f5837e2fe260118724a2ba4: Asset;
|
|
32
|
+
arbitrum_0xeae7721d779276eb0f5837e2fe260118724a2ba4: Asset;
|
|
33
|
+
arbitrum_0x6b6303fab8ec7232b4f2a7b9fa58e5216f608fcb: Asset;
|
|
34
|
+
arbitrum_0xdc74a45e86dedf1ff7c6dac77e0c2f082f9e4f72: Asset;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const SupportedAssets: SupportedAssets;
|
|
38
|
+
export {};
|
|
@@ -38,6 +38,6 @@ export declare class Orderbook extends OrdersProvider implements IOrderbook {
|
|
|
38
38
|
* @param paginationConfig - The configuration for the pagination
|
|
39
39
|
* @returns {() => void} A function to unsubscribe from the order updates
|
|
40
40
|
*/
|
|
41
|
-
subscribeToOrders<T extends boolean>(matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>,
|
|
41
|
+
subscribeToOrders<T extends boolean>(matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>, paginationConfig?: PaginationConfig, pending?: boolean): Promise<() => void>;
|
|
42
42
|
getUserOrdersCount(): AsyncResult<number, string>;
|
|
43
43
|
}
|
|
@@ -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
|
|
@@ -116,7 +116,7 @@ export interface IOrderbook extends IOrderProvider {
|
|
|
116
116
|
* @param paginationConfig - The configuration for the pagination
|
|
117
117
|
* @returns {() => void} A function to unsubscribe from the order updates
|
|
118
118
|
*/
|
|
119
|
-
subscribeToOrders<T extends boolean>(matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>,
|
|
119
|
+
subscribeToOrders<T extends boolean>(matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>, paginationConfig?: PaginationConfig, pending?: boolean): Promise<() => void>;
|
|
120
120
|
/**
|
|
121
121
|
* Get the current orders count associated with the provided address. Used to calculate nonce for secret generation.
|
|
122
122
|
* @returns {AsyncResult<number, string>} A promise that resolves to the orders count.
|
|
@@ -138,7 +138,7 @@ export type AdditionalData = {
|
|
|
138
138
|
sig: string;
|
|
139
139
|
input_token_price: number;
|
|
140
140
|
output_token_price: number;
|
|
141
|
-
deadline:
|
|
141
|
+
deadline: number;
|
|
142
142
|
bitcoin_optional_recipient?: string;
|
|
143
143
|
[key: string]: any;
|
|
144
144
|
};
|
|
@@ -194,6 +194,7 @@ export type Swap = {
|
|
|
194
194
|
initiate_block_number: string | null;
|
|
195
195
|
redeem_block_number: string | null;
|
|
196
196
|
refund_block_number: string | null;
|
|
197
|
+
required_confirmations: number;
|
|
197
198
|
};
|
|
198
199
|
export type MatchedOrder = {
|
|
199
200
|
created_at: 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.40",
|
|
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.4",
|
|
30
|
+
"@gardenfi/utils": "^0.0.1-beta.19",
|
|
32
31
|
"bufferutil": "^4.0.8",
|
|
33
32
|
"siwe": "^2.1.4",
|
|
34
33
|
"utf-8-validate": "^6.0.3",
|