@gardenfi/orderbook 3.1.3-beta.2 → 3.1.3-beta.21
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 +53 -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 +111 -37
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +21 -7
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +14 -14
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +42 -26
- package/dist/src/index.d.ts +1 -1
- 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 +162 -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 +13 -0
- 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,34 @@ 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
|
+
};
|
|
1170
|
+
readonly lightning_regtest: {
|
|
1171
|
+
readonly type: BlockchainType.lightning;
|
|
1172
|
+
readonly network: Network.TESTNET;
|
|
1173
|
+
readonly BTC: {
|
|
1174
|
+
readonly id: "lightning_regtest:btc";
|
|
1175
|
+
readonly name: "Bitcoin";
|
|
1176
|
+
readonly symbol: "BTC";
|
|
1177
|
+
readonly decimals: 8;
|
|
1178
|
+
readonly icon: "https://garden-finance.imgix.net/assets/lightning.png";
|
|
1179
|
+
readonly chain: "lightning_regtest";
|
|
1180
|
+
readonly htlc: null;
|
|
1181
|
+
readonly token: null;
|
|
1182
|
+
};
|
|
1183
|
+
};
|
|
1149
1184
|
readonly litecoin: {
|
|
1150
1185
|
readonly type: BlockchainType.litecoin;
|
|
1151
1186
|
readonly network: Network.MAINNET;
|
|
@@ -1220,6 +1255,50 @@ export declare const Config: {
|
|
|
1220
1255
|
readonly type: BlockchainType.evm;
|
|
1221
1256
|
readonly network: Network.TESTNET;
|
|
1222
1257
|
};
|
|
1258
|
+
readonly arc_testnet: {
|
|
1259
|
+
readonly type: BlockchainType.evm;
|
|
1260
|
+
readonly network: Network.TESTNET;
|
|
1261
|
+
};
|
|
1262
|
+
readonly ink_sepolia: {
|
|
1263
|
+
readonly type: BlockchainType.evm;
|
|
1264
|
+
readonly network: Network.TESTNET;
|
|
1265
|
+
};
|
|
1266
|
+
readonly ink: {
|
|
1267
|
+
readonly type: BlockchainType.evm;
|
|
1268
|
+
readonly network: Network.MAINNET;
|
|
1269
|
+
};
|
|
1270
|
+
readonly robinhood_testnet: {
|
|
1271
|
+
readonly type: BlockchainType.evm;
|
|
1272
|
+
readonly network: Network.TESTNET;
|
|
1273
|
+
};
|
|
1274
|
+
readonly robinhood: {
|
|
1275
|
+
readonly type: BlockchainType.evm;
|
|
1276
|
+
readonly network: Network.MAINNET;
|
|
1277
|
+
};
|
|
1278
|
+
readonly tempo: {
|
|
1279
|
+
readonly type: BlockchainType.evm;
|
|
1280
|
+
readonly network: Network.MAINNET;
|
|
1281
|
+
};
|
|
1282
|
+
readonly tempo_testnet: {
|
|
1283
|
+
readonly type: BlockchainType.evm;
|
|
1284
|
+
readonly network: Network.TESTNET;
|
|
1285
|
+
readonly pathUSD: {
|
|
1286
|
+
readonly id: "tempo_testnet:pathusd";
|
|
1287
|
+
readonly name: "Path USD";
|
|
1288
|
+
readonly symbol: "pathUSD";
|
|
1289
|
+
readonly decimals: 6;
|
|
1290
|
+
readonly icon: "https://cdn.garden.finance/catalog/asset/pathusd.png";
|
|
1291
|
+
readonly chain: "evm:42431";
|
|
1292
|
+
readonly htlc: {
|
|
1293
|
+
readonly address: "0x8c529570277427c8cd34a9d59acff73235d370e1";
|
|
1294
|
+
readonly schema: "evm:htlc_erc20";
|
|
1295
|
+
};
|
|
1296
|
+
readonly token: {
|
|
1297
|
+
readonly address: "0x20c0000000000000000000000000000000000000";
|
|
1298
|
+
readonly schema: "evm:erc20";
|
|
1299
|
+
};
|
|
1300
|
+
};
|
|
1301
|
+
};
|
|
1223
1302
|
};
|
|
1224
1303
|
export declare const Chains: Record<Chain, Chain>;
|
|
1225
1304
|
export declare const Assets: import('./utils').AssetsType<{
|
|
@@ -1236,7 +1315,7 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1236
1315
|
};
|
|
1237
1316
|
readonly arbitrum_localnet: {
|
|
1238
1317
|
readonly type: BlockchainType.evm;
|
|
1239
|
-
readonly
|
|
1318
|
+
readonly USDC: {
|
|
1240
1319
|
name: string;
|
|
1241
1320
|
decimals: number;
|
|
1242
1321
|
symbol: string;
|
|
@@ -1254,6 +1333,13 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1254
1333
|
atomicSwapAddress: string;
|
|
1255
1334
|
tokenAddress: string;
|
|
1256
1335
|
};
|
|
1336
|
+
readonly USDC: {
|
|
1337
|
+
name: string;
|
|
1338
|
+
decimals: number;
|
|
1339
|
+
symbol: string;
|
|
1340
|
+
atomicSwapAddress: string;
|
|
1341
|
+
tokenAddress: string;
|
|
1342
|
+
};
|
|
1257
1343
|
readonly network: Network.LOCALNET;
|
|
1258
1344
|
};
|
|
1259
1345
|
readonly bitcoin_regtest: {
|
|
@@ -2344,6 +2430,34 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2344
2430
|
readonly token: null;
|
|
2345
2431
|
};
|
|
2346
2432
|
};
|
|
2433
|
+
readonly lightning: {
|
|
2434
|
+
readonly type: BlockchainType.lightning;
|
|
2435
|
+
readonly network: Network.MAINNET;
|
|
2436
|
+
readonly BTC: {
|
|
2437
|
+
readonly id: "lightning:btc";
|
|
2438
|
+
readonly name: "Bitcoin";
|
|
2439
|
+
readonly symbol: "BTC";
|
|
2440
|
+
readonly decimals: 8;
|
|
2441
|
+
readonly icon: "https://garden-finance.imgix.net/assets/lightning.png";
|
|
2442
|
+
readonly chain: "lightning";
|
|
2443
|
+
readonly htlc: null;
|
|
2444
|
+
readonly token: null;
|
|
2445
|
+
};
|
|
2446
|
+
};
|
|
2447
|
+
readonly lightning_regtest: {
|
|
2448
|
+
readonly type: BlockchainType.lightning;
|
|
2449
|
+
readonly network: Network.TESTNET;
|
|
2450
|
+
readonly BTC: {
|
|
2451
|
+
readonly id: "lightning_regtest:btc";
|
|
2452
|
+
readonly name: "Bitcoin";
|
|
2453
|
+
readonly symbol: "BTC";
|
|
2454
|
+
readonly decimals: 8;
|
|
2455
|
+
readonly icon: "https://garden-finance.imgix.net/assets/lightning.png";
|
|
2456
|
+
readonly chain: "lightning_regtest";
|
|
2457
|
+
readonly htlc: null;
|
|
2458
|
+
readonly token: null;
|
|
2459
|
+
};
|
|
2460
|
+
};
|
|
2347
2461
|
readonly litecoin: {
|
|
2348
2462
|
readonly type: BlockchainType.litecoin;
|
|
2349
2463
|
readonly network: Network.MAINNET;
|
|
@@ -2418,10 +2532,54 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2418
2532
|
readonly type: BlockchainType.evm;
|
|
2419
2533
|
readonly network: Network.TESTNET;
|
|
2420
2534
|
};
|
|
2535
|
+
readonly arc_testnet: {
|
|
2536
|
+
readonly type: BlockchainType.evm;
|
|
2537
|
+
readonly network: Network.TESTNET;
|
|
2538
|
+
};
|
|
2539
|
+
readonly ink_sepolia: {
|
|
2540
|
+
readonly type: BlockchainType.evm;
|
|
2541
|
+
readonly network: Network.TESTNET;
|
|
2542
|
+
};
|
|
2543
|
+
readonly ink: {
|
|
2544
|
+
readonly type: BlockchainType.evm;
|
|
2545
|
+
readonly network: Network.MAINNET;
|
|
2546
|
+
};
|
|
2547
|
+
readonly robinhood_testnet: {
|
|
2548
|
+
readonly type: BlockchainType.evm;
|
|
2549
|
+
readonly network: Network.TESTNET;
|
|
2550
|
+
};
|
|
2551
|
+
readonly robinhood: {
|
|
2552
|
+
readonly type: BlockchainType.evm;
|
|
2553
|
+
readonly network: Network.MAINNET;
|
|
2554
|
+
};
|
|
2555
|
+
readonly tempo: {
|
|
2556
|
+
readonly type: BlockchainType.evm;
|
|
2557
|
+
readonly network: Network.MAINNET;
|
|
2558
|
+
};
|
|
2559
|
+
readonly tempo_testnet: {
|
|
2560
|
+
readonly type: BlockchainType.evm;
|
|
2561
|
+
readonly network: Network.TESTNET;
|
|
2562
|
+
readonly pathUSD: {
|
|
2563
|
+
readonly id: "tempo_testnet:pathusd";
|
|
2564
|
+
readonly name: "Path USD";
|
|
2565
|
+
readonly symbol: "pathUSD";
|
|
2566
|
+
readonly decimals: 6;
|
|
2567
|
+
readonly icon: "https://cdn.garden.finance/catalog/asset/pathusd.png";
|
|
2568
|
+
readonly chain: "evm:42431";
|
|
2569
|
+
readonly htlc: {
|
|
2570
|
+
readonly address: "0x8c529570277427c8cd34a9d59acff73235d370e1";
|
|
2571
|
+
readonly schema: "evm:htlc_erc20";
|
|
2572
|
+
};
|
|
2573
|
+
readonly token: {
|
|
2574
|
+
readonly address: "0x20c0000000000000000000000000000000000000";
|
|
2575
|
+
readonly schema: "evm:erc20";
|
|
2576
|
+
};
|
|
2577
|
+
};
|
|
2578
|
+
};
|
|
2421
2579
|
}>;
|
|
2422
2580
|
export declare const isMainnet: (chain: Chain) => boolean;
|
|
2423
2581
|
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";
|
|
2582
|
+
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" | "ink_sepolia" | "ink" | "robinhood_testnet" | "robinhood" | "tempo" | "tempo_testnet";
|
|
2425
2583
|
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_regtest" | "bitcoin_testnet";
|
|
2426
2584
|
export declare const isLitecoin: (chain: Chain) => chain is "litecoin_testnet" | "litecoin";
|
|
2427
2585
|
export declare const isSpark: (chain: Chain) => chain is "spark_regtest" | "spark";
|
|
@@ -2431,6 +2589,7 @@ export declare const isSui: (chain: Chain) => chain is "sui" | "sui_testnet";
|
|
|
2431
2589
|
export declare const isTron: (chain: Chain) => chain is "tron_shasta" | "tron";
|
|
2432
2590
|
export declare const isXrpl: (chain: Chain) => chain is "xrpl" | "xrpl_testnet";
|
|
2433
2591
|
export declare const isAlpenSignet: (chain: Chain) => chain is "alpen_signet";
|
|
2592
|
+
export declare const isLightning: (chain: Chain) => chain is "lightning" | "lightning_regtest";
|
|
2434
2593
|
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
2435
2594
|
export declare const NATIVE_TOKENS: {
|
|
2436
2595
|
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",
|
|
@@ -60,6 +60,7 @@ export type CreateOrderRequest = {
|
|
|
60
60
|
amount: string;
|
|
61
61
|
};
|
|
62
62
|
solver_id: string;
|
|
63
|
+
quote_id?: string;
|
|
63
64
|
slippage?: number;
|
|
64
65
|
secret_hash?: string;
|
|
65
66
|
nonce: number;
|
|
@@ -82,6 +83,7 @@ export type Swap = {
|
|
|
82
83
|
initiate_tx_hash: string;
|
|
83
84
|
redeem_tx_hash: string;
|
|
84
85
|
refund_tx_hash: string;
|
|
86
|
+
deposit_tx_hash: string;
|
|
85
87
|
initiate_block_number: string | null;
|
|
86
88
|
redeem_block_number: string | null;
|
|
87
89
|
refund_block_number: string | null;
|
|
@@ -104,6 +106,7 @@ export type Order = {
|
|
|
104
106
|
affiliate_fees: AffiliateFeeV2[];
|
|
105
107
|
integrator: string;
|
|
106
108
|
version: string;
|
|
109
|
+
deadline: EpochTimeStamp;
|
|
107
110
|
};
|
|
108
111
|
export type OrderWithStatus = Order & {
|
|
109
112
|
status: OrderStatus;
|
|
@@ -187,6 +190,14 @@ export type EvmOrderResponse = WithTypedData<BaseCreateOrderResponse & {
|
|
|
187
190
|
approval_transaction: EVMTransaction | null;
|
|
188
191
|
initiate_transaction: EVMTransaction;
|
|
189
192
|
}, EvmTypedData>;
|
|
193
|
+
export type EvmOrderResponseWithCoreTransfer = EvmOrderResponse & {
|
|
194
|
+
core_to_evm_transfer: {
|
|
195
|
+
to: string;
|
|
196
|
+
value: string;
|
|
197
|
+
data: string;
|
|
198
|
+
gas_limit: string;
|
|
199
|
+
} | null;
|
|
200
|
+
};
|
|
190
201
|
export type StarknetOrderResponse = WithTypedData<BaseCreateOrderResponse & {
|
|
191
202
|
approval_transaction: StarknetCall;
|
|
192
203
|
initiate_transaction: StarknetCall;
|
|
@@ -209,6 +220,7 @@ export type XrplOrderResponse = BaseCreateOrderResponse & {
|
|
|
209
220
|
TransactionType: string;
|
|
210
221
|
};
|
|
211
222
|
};
|
|
223
|
+
export type LightningOrderResponse = BitcoinOrderResponse;
|
|
212
224
|
type OrderResponseMap = {
|
|
213
225
|
[BlockchainType.evm]: EvmOrderResponse;
|
|
214
226
|
[BlockchainType.bitcoin]: BitcoinOrderResponse;
|
|
@@ -220,6 +232,7 @@ type OrderResponseMap = {
|
|
|
220
232
|
[BlockchainType.alpen_signet]: BitcoinOrderResponse;
|
|
221
233
|
[BlockchainType.xrpl]: XrplOrderResponse;
|
|
222
234
|
[BlockchainType.spark]: BitcoinOrderResponse;
|
|
235
|
+
[BlockchainType.lightning]: LightningOrderResponse;
|
|
223
236
|
};
|
|
224
237
|
export type CreateOrderResponse<T extends BlockchainType = BlockchainType> = {
|
|
225
238
|
type: T;
|
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.21",
|
|
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.19",
|
|
32
32
|
"bufferutil": "^4.0.8",
|
|
33
33
|
"node-cache": "^5.1.2",
|
|
34
34
|
"siwe": "^2.1.4",
|