@gardenfi/orderbook 3.1.3-beta.1 → 3.1.3-beta.11
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 +54 -50
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +23 -23
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +12 -29
- package/dist/index14.cjs +1 -0
- package/dist/index14.js +31 -0
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +55 -56
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +1 -1
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +52 -32
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +21 -7
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +18 -14
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +25 -25
- package/dist/src/index.d.ts +2 -2
- package/dist/src/lib/api.d.ts +1 -0
- package/dist/src/lib/assetManager/types.d.ts +1 -0
- package/dist/src/lib/constants/asset.d.ts +54 -3
- package/dist/src/lib/constants/asset.types.d.ts +3 -1
- package/dist/src/lib/constants/localnetConstants.d.ts +14 -0
- package/dist/src/lib/errors.d.ts +1 -0
- package/dist/src/lib/orderStatus/orderStatus.d.ts +1 -1
- package/dist/src/lib/orderbook/orderbook.types.d.ts +6 -0
- package/dist/src/lib/utils.d.ts +6 -2
- package/package.json +2 -2
|
@@ -38,7 +38,7 @@ export declare const Config: {
|
|
|
38
38
|
};
|
|
39
39
|
readonly arbitrum_localnet: {
|
|
40
40
|
readonly type: BlockchainType.evm;
|
|
41
|
-
readonly
|
|
41
|
+
readonly USDC: {
|
|
42
42
|
name: string;
|
|
43
43
|
decimals: number;
|
|
44
44
|
symbol: string;
|
|
@@ -56,6 +56,13 @@ export declare const Config: {
|
|
|
56
56
|
atomicSwapAddress: string;
|
|
57
57
|
tokenAddress: string;
|
|
58
58
|
};
|
|
59
|
+
readonly USDC: {
|
|
60
|
+
name: string;
|
|
61
|
+
decimals: number;
|
|
62
|
+
symbol: string;
|
|
63
|
+
atomicSwapAddress: string;
|
|
64
|
+
tokenAddress: string;
|
|
65
|
+
};
|
|
59
66
|
readonly network: Network.LOCALNET;
|
|
60
67
|
};
|
|
61
68
|
readonly bitcoin_regtest: {
|
|
@@ -1146,6 +1153,20 @@ export declare const Config: {
|
|
|
1146
1153
|
readonly token: null;
|
|
1147
1154
|
};
|
|
1148
1155
|
};
|
|
1156
|
+
readonly lightning: {
|
|
1157
|
+
readonly type: BlockchainType.lightning;
|
|
1158
|
+
readonly network: Network.MAINNET;
|
|
1159
|
+
readonly BTC: {
|
|
1160
|
+
readonly id: "lightning:btc";
|
|
1161
|
+
readonly name: "Bitcoin";
|
|
1162
|
+
readonly symbol: "BTC";
|
|
1163
|
+
readonly decimals: 8;
|
|
1164
|
+
readonly icon: "https://garden-finance.imgix.net/assets/lightning.png";
|
|
1165
|
+
readonly chain: "lightning";
|
|
1166
|
+
readonly htlc: null;
|
|
1167
|
+
readonly token: null;
|
|
1168
|
+
};
|
|
1169
|
+
};
|
|
1149
1170
|
readonly litecoin: {
|
|
1150
1171
|
readonly type: BlockchainType.litecoin;
|
|
1151
1172
|
readonly network: Network.MAINNET;
|
|
@@ -1220,6 +1241,10 @@ export declare const Config: {
|
|
|
1220
1241
|
readonly type: BlockchainType.evm;
|
|
1221
1242
|
readonly network: Network.TESTNET;
|
|
1222
1243
|
};
|
|
1244
|
+
readonly arc_testnet: {
|
|
1245
|
+
readonly type: BlockchainType.evm;
|
|
1246
|
+
readonly network: Network.TESTNET;
|
|
1247
|
+
};
|
|
1223
1248
|
};
|
|
1224
1249
|
export declare const Chains: Record<Chain, Chain>;
|
|
1225
1250
|
export declare const Assets: import('./utils').AssetsType<{
|
|
@@ -1236,7 +1261,7 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1236
1261
|
};
|
|
1237
1262
|
readonly arbitrum_localnet: {
|
|
1238
1263
|
readonly type: BlockchainType.evm;
|
|
1239
|
-
readonly
|
|
1264
|
+
readonly USDC: {
|
|
1240
1265
|
name: string;
|
|
1241
1266
|
decimals: number;
|
|
1242
1267
|
symbol: string;
|
|
@@ -1254,6 +1279,13 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1254
1279
|
atomicSwapAddress: string;
|
|
1255
1280
|
tokenAddress: string;
|
|
1256
1281
|
};
|
|
1282
|
+
readonly USDC: {
|
|
1283
|
+
name: string;
|
|
1284
|
+
decimals: number;
|
|
1285
|
+
symbol: string;
|
|
1286
|
+
atomicSwapAddress: string;
|
|
1287
|
+
tokenAddress: string;
|
|
1288
|
+
};
|
|
1257
1289
|
readonly network: Network.LOCALNET;
|
|
1258
1290
|
};
|
|
1259
1291
|
readonly bitcoin_regtest: {
|
|
@@ -2344,6 +2376,20 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2344
2376
|
readonly token: null;
|
|
2345
2377
|
};
|
|
2346
2378
|
};
|
|
2379
|
+
readonly lightning: {
|
|
2380
|
+
readonly type: BlockchainType.lightning;
|
|
2381
|
+
readonly network: Network.MAINNET;
|
|
2382
|
+
readonly BTC: {
|
|
2383
|
+
readonly id: "lightning:btc";
|
|
2384
|
+
readonly name: "Bitcoin";
|
|
2385
|
+
readonly symbol: "BTC";
|
|
2386
|
+
readonly decimals: 8;
|
|
2387
|
+
readonly icon: "https://garden-finance.imgix.net/assets/lightning.png";
|
|
2388
|
+
readonly chain: "lightning";
|
|
2389
|
+
readonly htlc: null;
|
|
2390
|
+
readonly token: null;
|
|
2391
|
+
};
|
|
2392
|
+
};
|
|
2347
2393
|
readonly litecoin: {
|
|
2348
2394
|
readonly type: BlockchainType.litecoin;
|
|
2349
2395
|
readonly network: Network.MAINNET;
|
|
@@ -2418,10 +2464,14 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2418
2464
|
readonly type: BlockchainType.evm;
|
|
2419
2465
|
readonly network: Network.TESTNET;
|
|
2420
2466
|
};
|
|
2467
|
+
readonly arc_testnet: {
|
|
2468
|
+
readonly type: BlockchainType.evm;
|
|
2469
|
+
readonly network: Network.TESTNET;
|
|
2470
|
+
};
|
|
2421
2471
|
}>;
|
|
2422
2472
|
export declare const isMainnet: (chain: Chain) => boolean;
|
|
2423
2473
|
export declare function is<T extends BlockchainType>(type: T): (chain: Chain) => chain is Extract<Chain, ChainsByBlockchainType<T>>;
|
|
2424
|
-
export declare const isEVM: (chain: Chain) => chain is "arbitrum_localnet" | "ethereum_localnet" | "ethereum_sepolia" | "arbitrum_sepolia" | "base_sepolia" | "bera_testnet" | "citrea" | "citrea_testnet" | "monad_testnet" | "hyperliquid_testnet" | "bnbchain_testnet" | "alpen_testnet" | "base" | "monad" | "arbitrum" | "ethereum" | "bera" | "hyperevm" | "unichain" | "corn" | "botanix" | "bnbchain" | "core" | "megaeth" | "hyperevm_testnet" | "hyperliquid" | "hypercore" | "hypercore_testnet";
|
|
2474
|
+
export declare const isEVM: (chain: Chain) => chain is "arbitrum_localnet" | "ethereum_localnet" | "ethereum_sepolia" | "arbitrum_sepolia" | "base_sepolia" | "bera_testnet" | "citrea" | "citrea_testnet" | "monad_testnet" | "hyperliquid_testnet" | "bnbchain_testnet" | "alpen_testnet" | "base" | "monad" | "arbitrum" | "ethereum" | "bera" | "hyperevm" | "unichain" | "corn" | "botanix" | "bnbchain" | "core" | "megaeth" | "hyperevm_testnet" | "hyperliquid" | "hypercore" | "hypercore_testnet" | "arc_testnet";
|
|
2425
2475
|
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_regtest" | "bitcoin_testnet";
|
|
2426
2476
|
export declare const isLitecoin: (chain: Chain) => chain is "litecoin_testnet" | "litecoin";
|
|
2427
2477
|
export declare const isSpark: (chain: Chain) => chain is "spark_regtest" | "spark";
|
|
@@ -2431,6 +2481,7 @@ export declare const isSui: (chain: Chain) => chain is "sui" | "sui_testnet";
|
|
|
2431
2481
|
export declare const isTron: (chain: Chain) => chain is "tron_shasta" | "tron";
|
|
2432
2482
|
export declare const isXrpl: (chain: Chain) => chain is "xrpl" | "xrpl_testnet";
|
|
2433
2483
|
export declare const isAlpenSignet: (chain: Chain) => chain is "alpen_signet";
|
|
2484
|
+
export declare const isLightning: (chain: Chain) => chain is "lightning";
|
|
2434
2485
|
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
2435
2486
|
export declare const NATIVE_TOKENS: {
|
|
2436
2487
|
evm: string;
|
|
@@ -12,7 +12,8 @@ export declare enum BlockchainType {
|
|
|
12
12
|
litecoin = "litecoin",
|
|
13
13
|
alpen_signet = "alpen_signet",
|
|
14
14
|
xrpl = "xrpl",
|
|
15
|
-
spark = "spark"
|
|
15
|
+
spark = "spark",
|
|
16
|
+
lightning = "lightning"
|
|
16
17
|
}
|
|
17
18
|
export type AddressSchema = {
|
|
18
19
|
address: string;
|
|
@@ -48,3 +49,4 @@ export type StarknetChains = ChainsByBlockchainType<BlockchainType.starknet>;
|
|
|
48
49
|
export type SuiChains = ChainsByBlockchainType<BlockchainType.sui>;
|
|
49
50
|
export type TronChains = ChainsByBlockchainType<BlockchainType.tron>;
|
|
50
51
|
export type XrplChains = ChainsByBlockchainType<BlockchainType.xrpl>;
|
|
52
|
+
export type LightningChains = ChainsByBlockchainType<BlockchainType.lightning>;
|
|
@@ -31,6 +31,20 @@ export declare const WBTCEthereumLocalnetAsset: {
|
|
|
31
31
|
atomicSwapAddress: string;
|
|
32
32
|
tokenAddress: string;
|
|
33
33
|
};
|
|
34
|
+
export declare const USDCEthereumLocalnetAsset: {
|
|
35
|
+
name: string;
|
|
36
|
+
decimals: number;
|
|
37
|
+
symbol: string;
|
|
38
|
+
atomicSwapAddress: string;
|
|
39
|
+
tokenAddress: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const USDCArbitrumLocalnetAsset: {
|
|
42
|
+
name: string;
|
|
43
|
+
decimals: number;
|
|
44
|
+
symbol: string;
|
|
45
|
+
atomicSwapAddress: string;
|
|
46
|
+
tokenAddress: string;
|
|
47
|
+
};
|
|
34
48
|
export declare const STRKStarknetLocalnetAsset: {
|
|
35
49
|
name: string;
|
|
36
50
|
decimals: number;
|
package/dist/src/lib/errors.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { OrderStatus } from '../constants/asset';
|
|
|
2
2
|
import { Order } from '../orderbook/orderbook.types';
|
|
3
3
|
|
|
4
4
|
export declare const ParseOrderStatus: (order: Order) => OrderStatus;
|
|
5
|
-
export declare const isDeadlinePassed: (
|
|
5
|
+
export declare const isDeadlinePassed: (deadline: EpochTimeStamp) => boolean;
|
|
6
6
|
export declare const isCompleted: (order: Order) => boolean;
|
|
7
7
|
export declare enum OrderAction {
|
|
8
8
|
Initiate = "Initiate",
|
|
@@ -104,6 +104,7 @@ export type Order = {
|
|
|
104
104
|
affiliate_fees: AffiliateFeeV2[];
|
|
105
105
|
integrator: string;
|
|
106
106
|
version: string;
|
|
107
|
+
deadline: EpochTimeStamp;
|
|
107
108
|
};
|
|
108
109
|
export type OrderWithStatus = Order & {
|
|
109
110
|
status: OrderStatus;
|
|
@@ -209,6 +210,10 @@ export type XrplOrderResponse = BaseCreateOrderResponse & {
|
|
|
209
210
|
TransactionType: string;
|
|
210
211
|
};
|
|
211
212
|
};
|
|
213
|
+
export type LightningOrderResponse = BaseCreateOrderResponse & {
|
|
214
|
+
to: string;
|
|
215
|
+
amount: number;
|
|
216
|
+
};
|
|
212
217
|
type OrderResponseMap = {
|
|
213
218
|
[BlockchainType.evm]: EvmOrderResponse;
|
|
214
219
|
[BlockchainType.bitcoin]: BitcoinOrderResponse;
|
|
@@ -220,6 +225,7 @@ type OrderResponseMap = {
|
|
|
220
225
|
[BlockchainType.alpen_signet]: BitcoinOrderResponse;
|
|
221
226
|
[BlockchainType.xrpl]: XrplOrderResponse;
|
|
222
227
|
[BlockchainType.spark]: BitcoinOrderResponse;
|
|
228
|
+
[BlockchainType.lightning]: LightningOrderResponse;
|
|
223
229
|
};
|
|
224
230
|
export type CreateOrderResponse<T extends BlockchainType = BlockchainType> = {
|
|
225
231
|
type: T;
|
package/dist/src/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Url } from '@gardenfi/utils';
|
|
2
|
-
import { BaseCreateOrderResponse, CreateOrderResponse, Order, StarknetOrderResponse, EvmOrderResponse, BitcoinOrderResponse, SolanaOrderResponse, SuiOrderResponse, TronOrderResponse, XrplOrderResponse } from './orderbook/orderbook.types';
|
|
2
|
+
import { BaseCreateOrderResponse, CreateOrderResponse, Order, StarknetOrderResponse, EvmOrderResponse, BitcoinOrderResponse, SolanaOrderResponse, SuiOrderResponse, TronOrderResponse, XrplOrderResponse, LightningOrderResponse } from './orderbook/orderbook.types';
|
|
3
3
|
import { BlockchainType } from './constants/asset.types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -40,6 +40,10 @@ export declare const isTronOrderResponse: OrderResponseTypeGuard<TronOrderRespon
|
|
|
40
40
|
* Type guard for Xrpl order responses
|
|
41
41
|
*/
|
|
42
42
|
export declare const isXrplOrderResponse: OrderResponseTypeGuard<XrplOrderResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Type guard for Lightning order responses
|
|
45
|
+
*/
|
|
46
|
+
export declare const isLightningOrderResponse: OrderResponseTypeGuard<LightningOrderResponse>;
|
|
43
47
|
/**
|
|
44
48
|
* Type guard for Order objects (matched orders)
|
|
45
49
|
*/
|
|
@@ -48,7 +52,7 @@ export declare const isOrder: OrderResponseTypeGuard<Order>;
|
|
|
48
52
|
* Discriminated union type guard that determines the specific order response type
|
|
49
53
|
* and returns the appropriate typed response
|
|
50
54
|
*/
|
|
51
|
-
export declare function discriminateOrderResponse(response: BaseCreateOrderResponse): CreateOrderResponse<BlockchainType.evm> | CreateOrderResponse<BlockchainType.starknet> | CreateOrderResponse<BlockchainType.bitcoin> | CreateOrderResponse<BlockchainType.solana> | CreateOrderResponse<BlockchainType.sui> | CreateOrderResponse<BlockchainType.xrpl> | null;
|
|
55
|
+
export declare function discriminateOrderResponse(response: BaseCreateOrderResponse): CreateOrderResponse<BlockchainType.evm> | CreateOrderResponse<BlockchainType.starknet> | CreateOrderResponse<BlockchainType.bitcoin> | CreateOrderResponse<BlockchainType.solana> | CreateOrderResponse<BlockchainType.sui> | CreateOrderResponse<BlockchainType.xrpl> | CreateOrderResponse<BlockchainType.lightning> | null;
|
|
52
56
|
/**
|
|
53
57
|
* Utility function to get the blockchain type from an order response
|
|
54
58
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gardenfi/orderbook",
|
|
3
|
-
"version": "3.1.3-beta.
|
|
3
|
+
"version": "3.1.3-beta.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@coral-xyz/anchor": "^0.31.1",
|
|
31
|
-
"@gardenfi/utils": "3.1.1",
|
|
31
|
+
"@gardenfi/utils": "3.1.1-beta.9",
|
|
32
32
|
"bufferutil": "^4.0.8",
|
|
33
33
|
"node-cache": "^5.1.2",
|
|
34
34
|
"siwe": "^2.1.4",
|