@gardenfi/orderbook 3.1.3-beta.1 → 3.1.3-beta.10
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 +48 -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/constants/asset.d.ts +45 -2
- 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;
|
|
@@ -1236,7 +1257,7 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1236
1257
|
};
|
|
1237
1258
|
readonly arbitrum_localnet: {
|
|
1238
1259
|
readonly type: BlockchainType.evm;
|
|
1239
|
-
readonly
|
|
1260
|
+
readonly USDC: {
|
|
1240
1261
|
name: string;
|
|
1241
1262
|
decimals: number;
|
|
1242
1263
|
symbol: string;
|
|
@@ -1254,6 +1275,13 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1254
1275
|
atomicSwapAddress: string;
|
|
1255
1276
|
tokenAddress: string;
|
|
1256
1277
|
};
|
|
1278
|
+
readonly USDC: {
|
|
1279
|
+
name: string;
|
|
1280
|
+
decimals: number;
|
|
1281
|
+
symbol: string;
|
|
1282
|
+
atomicSwapAddress: string;
|
|
1283
|
+
tokenAddress: string;
|
|
1284
|
+
};
|
|
1257
1285
|
readonly network: Network.LOCALNET;
|
|
1258
1286
|
};
|
|
1259
1287
|
readonly bitcoin_regtest: {
|
|
@@ -2344,6 +2372,20 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2344
2372
|
readonly token: null;
|
|
2345
2373
|
};
|
|
2346
2374
|
};
|
|
2375
|
+
readonly lightning: {
|
|
2376
|
+
readonly type: BlockchainType.lightning;
|
|
2377
|
+
readonly network: Network.MAINNET;
|
|
2378
|
+
readonly BTC: {
|
|
2379
|
+
readonly id: "lightning:btc";
|
|
2380
|
+
readonly name: "Bitcoin";
|
|
2381
|
+
readonly symbol: "BTC";
|
|
2382
|
+
readonly decimals: 8;
|
|
2383
|
+
readonly icon: "https://garden-finance.imgix.net/assets/lightning.png";
|
|
2384
|
+
readonly chain: "lightning";
|
|
2385
|
+
readonly htlc: null;
|
|
2386
|
+
readonly token: null;
|
|
2387
|
+
};
|
|
2388
|
+
};
|
|
2347
2389
|
readonly litecoin: {
|
|
2348
2390
|
readonly type: BlockchainType.litecoin;
|
|
2349
2391
|
readonly network: Network.MAINNET;
|
|
@@ -2431,6 +2473,7 @@ export declare const isSui: (chain: Chain) => chain is "sui" | "sui_testnet";
|
|
|
2431
2473
|
export declare const isTron: (chain: Chain) => chain is "tron_shasta" | "tron";
|
|
2432
2474
|
export declare const isXrpl: (chain: Chain) => chain is "xrpl" | "xrpl_testnet";
|
|
2433
2475
|
export declare const isAlpenSignet: (chain: Chain) => chain is "alpen_signet";
|
|
2476
|
+
export declare const isLightning: (chain: Chain) => chain is "lightning";
|
|
2434
2477
|
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
2435
2478
|
export declare const NATIVE_TOKENS: {
|
|
2436
2479
|
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.10",
|
|
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.8",
|
|
32
32
|
"bufferutil": "^4.0.8",
|
|
33
33
|
"node-cache": "^5.1.2",
|
|
34
34
|
"siwe": "^2.1.4",
|