@gardenfi/orderbook 2.1.3 → 2.1.4-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index3.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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"},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,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]:
|
|
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",unichan:"unichan"},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.unichan,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.unichan]: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
|
@@ -19,8 +19,9 @@ const t = {
|
|
|
19
19
|
starknet_sepolia: "starknet_sepolia",
|
|
20
20
|
starknet_devnet: "starknet_devnet",
|
|
21
21
|
hyperliquid_testnet: "hyperliquid_testnet",
|
|
22
|
-
hyperliquid: "hyperliquid"
|
|
23
|
-
|
|
22
|
+
hyperliquid: "hyperliquid",
|
|
23
|
+
unichan: "unichan"
|
|
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.unichan, _ = (e) => e === t.starknet || e === t.starknet_devnet || e === t.starknet_sepolia, r = {
|
|
24
25
|
[t.bitcoin]: 144,
|
|
25
26
|
[t.bitcoin_testnet]: 144,
|
|
26
27
|
[t.bitcoin_regtest]: 144,
|
|
@@ -32,15 +33,16 @@ const t = {
|
|
|
32
33
|
[t.ethereum_localnet]: 7200,
|
|
33
34
|
[t.base_sepolia]: 43200,
|
|
34
35
|
[t.base]: 43200,
|
|
35
|
-
[t.bera_testnet]:
|
|
36
|
-
[t.citrea_testnet]:
|
|
36
|
+
[t.bera_testnet]: 43200,
|
|
37
|
+
[t.citrea_testnet]: 43200,
|
|
37
38
|
[t.bera]: 43200,
|
|
38
39
|
[t.monad_testnet]: 172800,
|
|
39
40
|
[t.starknet]: 2880,
|
|
40
41
|
[t.starknet_devnet]: 2880,
|
|
41
42
|
[t.starknet_sepolia]: 2880,
|
|
42
43
|
[t.hyperliquid_testnet]: 43200,
|
|
43
|
-
[t.hyperliquid]: 43200
|
|
44
|
+
[t.hyperliquid]: 43200,
|
|
45
|
+
[t.unichan]: 86400
|
|
44
46
|
}, b = (e) => {
|
|
45
47
|
if (a(e)) return "Bitcoin";
|
|
46
48
|
if (s(e)) return "EVM";
|
|
@@ -49,11 +51,11 @@ const t = {
|
|
|
49
51
|
}, m = (e) => {
|
|
50
52
|
if (!r[e]) throw new Error("Invalid or unsupported chain");
|
|
51
53
|
return r[e];
|
|
52
|
-
},
|
|
54
|
+
}, u = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", p = (e, n) => s(e) && n.toLowerCase() === u.toLowerCase();
|
|
53
55
|
export {
|
|
54
56
|
i as BlockchainType,
|
|
55
57
|
t as Chains,
|
|
56
|
-
|
|
58
|
+
u as NativeTokenAddress,
|
|
57
59
|
o as NetworkType,
|
|
58
60
|
r as TimeLocks,
|
|
59
61
|
b as getBlockchainType,
|
|
@@ -61,6 +63,6 @@ export {
|
|
|
61
63
|
a as isBitcoin,
|
|
62
64
|
s as isEVM,
|
|
63
65
|
p as isEvmNativeToken,
|
|
64
|
-
|
|
66
|
+
l as isMainnet,
|
|
65
67
|
_ as isStarknet
|
|
66
68
|
};
|
package/dist/src/lib/asset.d.ts
CHANGED
|
@@ -51,12 +51,13 @@ export declare const Chains: {
|
|
|
51
51
|
readonly starknet_devnet: "starknet_devnet";
|
|
52
52
|
readonly hyperliquid_testnet: "hyperliquid_testnet";
|
|
53
53
|
readonly hyperliquid: "hyperliquid";
|
|
54
|
+
readonly unichan: "unichan";
|
|
54
55
|
};
|
|
55
56
|
export type Chain = keyof typeof Chains;
|
|
56
57
|
export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest' | 'starknet' | 'starknet_devnet' | 'starknet_sepolia'>;
|
|
57
|
-
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "base" | "arbitrum" | "bera" | "starknet" | "hyperliquid";
|
|
58
|
+
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "base" | "arbitrum" | "bera" | "starknet" | "hyperliquid" | "unichan";
|
|
58
59
|
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest";
|
|
59
|
-
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";
|
|
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" | "unichan";
|
|
60
61
|
export declare const isStarknet: (chain: Chain) => chain is "starknet" | "starknet_sepolia" | "starknet_devnet";
|
|
61
62
|
export declare const TimeLocks: Record<Chain, number>;
|
|
62
63
|
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
@@ -173,7 +173,20 @@ export type AdditionalDataWithStrategyId = {
|
|
|
173
173
|
[key: string]: any;
|
|
174
174
|
};
|
|
175
175
|
};
|
|
176
|
-
export type CreateOrderReqWithStrategyId = CreateOrderRequest & AdditionalDataWithStrategyId
|
|
176
|
+
export type CreateOrderReqWithStrategyId = CreateOrderRequest & AdditionalDataWithStrategyId & AffiliateFeeList<AffiliateFee>;
|
|
177
|
+
export type AffiliateFee = {
|
|
178
|
+
fee: number;
|
|
179
|
+
address: string;
|
|
180
|
+
chain: string;
|
|
181
|
+
asset: string;
|
|
182
|
+
};
|
|
183
|
+
export type AffiliateFeeWithAmount = AffiliateFee & {
|
|
184
|
+
amount: string;
|
|
185
|
+
};
|
|
186
|
+
export type AffiliateFeeList<T extends AffiliateFee | AffiliateFeeWithAmount> = {
|
|
187
|
+
affiliate_fees?: T[];
|
|
188
|
+
};
|
|
189
|
+
export type AffiliateFeeOptionalChainAsset = Omit<AffiliateFee, 'chain' | 'asset'> & Partial<Pick<AffiliateFee, 'chain' | 'asset'>>;
|
|
177
190
|
export type CreateOrderRequest = {
|
|
178
191
|
source_chain: string;
|
|
179
192
|
destination_chain: string;
|
|
@@ -189,7 +202,7 @@ export type CreateOrderRequest = {
|
|
|
189
202
|
timelock: number;
|
|
190
203
|
secret_hash: string;
|
|
191
204
|
};
|
|
192
|
-
export type CreateOrderRequestWithAdditionalData = CreateOrderRequest & AdditionalData
|
|
205
|
+
export type CreateOrderRequestWithAdditionalData = CreateOrderRequest & AdditionalData & AffiliateFeeList<AffiliateFeeWithAmount>;
|
|
193
206
|
export type CreateOrder = CreateOrderRequestWithAdditionalData & {
|
|
194
207
|
created_at: string;
|
|
195
208
|
updated_at: string;
|