@gardenfi/orderbook 3.1.2 → 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 +55 -49
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +29 -186
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +138 -157
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +203 -27
- package/dist/index13.cjs +1 -0
- package/dist/index13.js +14 -0
- package/dist/index14.cjs +1 -0
- package/dist/index14.js +31 -0
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +56 -57
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +1 -1
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +67 -31
- 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 +54 -28
- package/dist/src/index.d.ts +3 -2
- package/dist/src/lib/ExplorerUrlBuilder/ExplorerUrlBuilder.d.ts +13 -0
- package/dist/src/lib/api.d.ts +1 -0
- package/dist/src/lib/constants/asset.d.ts +86 -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
package/dist/index7.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { hasKeys as r } from "@gardenfi/utils";
|
|
2
2
|
import { BlockchainType as i } from "./index3.js";
|
|
3
|
-
const
|
|
3
|
+
const p = (t, a, o) => {
|
|
4
4
|
const e = t.endpoint(a);
|
|
5
|
-
return
|
|
6
|
-
n !== void 0 && (Array.isArray(n) ? e.searchParams.append(
|
|
5
|
+
return o && Object.entries(o).forEach(([c, n]) => {
|
|
6
|
+
n !== void 0 && (Array.isArray(n) ? e.searchParams.append(c, n.join(",")) : e.searchParams.append(c, n.toString()));
|
|
7
7
|
}), e;
|
|
8
8
|
}, u = (t) => r(t, ["typed_data", "initiate_transaction"]) && typeof t.initiate_transaction == "object" && t.initiate_transaction && r(t.initiate_transaction, [
|
|
9
9
|
"to",
|
|
@@ -11,14 +11,14 @@ const m = (t, a, c) => {
|
|
|
11
11
|
"data",
|
|
12
12
|
"gas_limit",
|
|
13
13
|
"chain_id"
|
|
14
|
-
]), f = (t) => r(t, ["typed_data", "initiate_transaction"]) && typeof t.initiate_transaction == "object" && t.initiate_transaction && r(t.initiate_transaction, ["to", "selector", "calldata"]),
|
|
14
|
+
]), f = (t) => r(t, ["typed_data", "initiate_transaction"]) && typeof t.initiate_transaction == "object" && t.initiate_transaction && r(t.initiate_transaction, ["to", "selector", "calldata"]), y = (t) => r(t, ["to", "amount"]) && typeof t.to == "string" && typeof t.amount == "string", _ = (t) => r(t, ["versioned_tx"]) && typeof t.versioned_tx == "string", d = (t) => r(t, ["ptb_bytes"]) && Array.isArray(t.ptb_bytes) && t.ptb_bytes.every((a) => typeof a == "number"), l = (t) => r(t, ["order_id", "escrow_create_tx"]) && typeof t.escrow_create_tx == "object" && t.escrow_create_tx && r(t.escrow_create_tx, [
|
|
15
15
|
"Account",
|
|
16
16
|
"Amount",
|
|
17
17
|
"CancelAfter",
|
|
18
18
|
"Condition",
|
|
19
19
|
"Destination",
|
|
20
20
|
"TransactionType"
|
|
21
|
-
]),
|
|
21
|
+
]), m = (t) => r(t, ["to", "amount"]) && typeof t.to == "string" && typeof t.amount == "number", g = (t) => r(t, ["source_swap", "destination_swap"]) && typeof t.source_swap == "object" && typeof t.destination_swap == "object";
|
|
22
22
|
function O(t) {
|
|
23
23
|
return u(t) ? {
|
|
24
24
|
type: i.evm,
|
|
@@ -26,32 +26,36 @@ function O(t) {
|
|
|
26
26
|
} : f(t) ? {
|
|
27
27
|
type: i.starknet,
|
|
28
28
|
...t
|
|
29
|
-
} :
|
|
29
|
+
} : y(t) ? {
|
|
30
30
|
type: i.bitcoin,
|
|
31
31
|
...t
|
|
32
|
-
} :
|
|
32
|
+
} : _(t) ? {
|
|
33
33
|
type: i.solana,
|
|
34
34
|
...t
|
|
35
|
-
} :
|
|
35
|
+
} : d(t) ? {
|
|
36
36
|
type: i.sui,
|
|
37
37
|
...t
|
|
38
38
|
} : l(t) ? {
|
|
39
39
|
type: i.xrpl,
|
|
40
40
|
...t
|
|
41
|
+
} : m(t) ? {
|
|
42
|
+
type: i.lightning,
|
|
43
|
+
...t
|
|
41
44
|
} : null;
|
|
42
45
|
}
|
|
43
46
|
function x(t) {
|
|
44
|
-
return u(t) ? i.evm : f(t) ? i.starknet :
|
|
47
|
+
return u(t) ? i.evm : f(t) ? i.starknet : y(t) ? i.bitcoin : _(t) ? i.solana : d(t) ? i.sui : l(t) ? i.xrpl : null;
|
|
45
48
|
}
|
|
46
49
|
export {
|
|
47
|
-
|
|
50
|
+
p as ConstructUrl,
|
|
48
51
|
O as discriminateOrderResponse,
|
|
49
52
|
x as getOrderResponseType,
|
|
50
|
-
|
|
53
|
+
y as isBitcoinOrderResponse,
|
|
51
54
|
u as isEvmOrderResponse,
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
m as isLightningOrderResponse,
|
|
56
|
+
g as isOrder,
|
|
57
|
+
_ as isSolanaOrderResponse,
|
|
54
58
|
f as isStarknetOrderResponse,
|
|
55
|
-
|
|
59
|
+
d as isSuiOrderResponse,
|
|
56
60
|
l as isXrplOrderResponse
|
|
57
61
|
};
|
package/dist/index9.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@gardenfi/utils"),d=require("./index4.cjs"),i=require("./index3.cjs"),o={[i.BlockchainType.bitcoin]:{address:(e,t)=>new s.Url("address",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("tx",e).endpoint(t).toString()},[i.BlockchainType.tron]:{address:(e,t)=>`${e}/#/address/${t}`,tx:(e,t)=>`${e}/#/transaction/${t.slice(2)}`},[i.BlockchainType.starknet]:{address:(e,t)=>new s.Url("contract",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("tx",e).endpoint(t).toString()},[i.BlockchainType.xrpl]:{address:(e,t)=>new s.Url("accounts",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("transactions",e).endpoint(t).toString()},[i.BlockchainType.solana]:{address:(e,t,n)=>{let r=new s.Url("address",e).endpoint(t);return n===s.Network.TESTNET&&(r=r.addSearchParams({cluster:"devnet"})),r.toString()},tx:(e,t,n)=>{let r=new s.Url("tx",e).endpoint(t);return n===s.Network.TESTNET&&(r=r.addSearchParams({cluster:"devnet"})),r.toString()}},default:{address:(e,t)=>new s.Url("address",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("tx",e).endpoint(t).toString()}};class a{constructor(t,n,r){this.explorerUrl=n,this.network=r,this.chainType=d.getBlockchainType(t)}static from(t,n,r){return new a(t,n,r)}getAddressLink(t){return(o[this.chainType]??o.default).address(this.explorerUrl,t,this.network)}getTxLink(t){const n=this.extractTxHash(t);return(o[this.chainType]??o.default).tx(this.explorerUrl,n,this.network)}extractTxHash(t){var n,r;return((r=(n=t.split(",").at(-1))==null?void 0:n.split(":").at(0))==null?void 0:r.trim())??""}}exports.ExplorerUrlBuilder=a;
|
package/dist/index9.js
CHANGED
|
@@ -1,31 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { Url as s, Network as d } from "@gardenfi/utils";
|
|
2
|
+
import { getBlockchainType as c } from "./index4.js";
|
|
3
|
+
import { BlockchainType as i } from "./index3.js";
|
|
4
|
+
const o = {
|
|
5
|
+
[i.bitcoin]: {
|
|
6
|
+
address: (e, t) => new s("address", e).endpoint(t).toString(),
|
|
7
|
+
tx: (e, t) => new s("tx", e).endpoint(t).toString()
|
|
8
|
+
},
|
|
9
|
+
[i.tron]: {
|
|
10
|
+
address: (e, t) => `${e}/#/address/${t}`,
|
|
11
|
+
tx: (e, t) => `${e}/#/transaction/${t.slice(2)}`
|
|
12
|
+
},
|
|
13
|
+
[i.starknet]: {
|
|
14
|
+
address: (e, t) => new s("contract", e).endpoint(t).toString(),
|
|
15
|
+
tx: (e, t) => new s("tx", e).endpoint(t).toString()
|
|
16
|
+
},
|
|
17
|
+
[i.xrpl]: {
|
|
18
|
+
address: (e, t) => new s("accounts", e).endpoint(t).toString(),
|
|
19
|
+
tx: (e, t) => new s("transactions", e).endpoint(t).toString()
|
|
20
|
+
},
|
|
21
|
+
[i.solana]: {
|
|
22
|
+
address: (e, t, n) => {
|
|
23
|
+
let r = new s("address", e).endpoint(t);
|
|
24
|
+
return n === d.TESTNET && (r = r.addSearchParams({ cluster: "devnet" })), r.toString();
|
|
25
|
+
},
|
|
26
|
+
tx: (e, t, n) => {
|
|
27
|
+
let r = new s("tx", e).endpoint(t);
|
|
28
|
+
return n === d.TESTNET && (r = r.addSearchParams({ cluster: "devnet" })), r.toString();
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
default: {
|
|
32
|
+
address: (e, t) => new s("address", e).endpoint(t).toString(),
|
|
33
|
+
tx: (e, t) => new s("tx", e).endpoint(t).toString()
|
|
34
|
+
}
|
|
24
35
|
};
|
|
36
|
+
class a {
|
|
37
|
+
constructor(t, n, r) {
|
|
38
|
+
this.explorerUrl = n, this.network = r, this.chainType = c(t);
|
|
39
|
+
}
|
|
40
|
+
static from(t, n, r) {
|
|
41
|
+
return new a(t, n, r);
|
|
42
|
+
}
|
|
43
|
+
getAddressLink(t) {
|
|
44
|
+
return (o[this.chainType] ?? o.default).address(this.explorerUrl, t, this.network);
|
|
45
|
+
}
|
|
46
|
+
getTxLink(t) {
|
|
47
|
+
const n = this.extractTxHash(t);
|
|
48
|
+
return (o[this.chainType] ?? o.default).tx(this.explorerUrl, n, this.network);
|
|
49
|
+
}
|
|
50
|
+
extractTxHash(t) {
|
|
51
|
+
var n, r;
|
|
52
|
+
return ((r = (n = t.split(",").at(-1)) == null ? void 0 : n.split(":").at(0)) == null ? void 0 : r.trim()) ?? "";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
25
55
|
export {
|
|
26
|
-
|
|
27
|
-
s as ParseOrderStatus,
|
|
28
|
-
m as isCompleted,
|
|
29
|
-
a as isDeadlinePassed,
|
|
30
|
-
o as parseAction
|
|
56
|
+
a as ExplorerUrlBuilder
|
|
31
57
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { Orderbook } from './lib/orderbook/orderbook';
|
|
2
2
|
export type * from './lib/orderbook/orderbook.types';
|
|
3
3
|
export { BlockchainType } from './lib/constants/asset.types';
|
|
4
|
-
export type { Asset, BitcoinChains, Chain, ChainsByBlockchainType, ChainsByNetwork, EVMChains, LocalnetOnlyChains, MainnetOnlyChains, SolanaChains, SuiChains, StarknetChains, XrplChains, TestnetOnlyChains, } from './lib/constants/asset.types';
|
|
4
|
+
export type { Asset, BitcoinChains, Chain, ChainsByBlockchainType, ChainsByNetwork, EVMChains, LocalnetOnlyChains, MainnetOnlyChains, SolanaChains, SuiChains, StarknetChains, XrplChains, LightningChains, TestnetOnlyChains, } from './lib/constants/asset.types';
|
|
5
5
|
export * from './lib/constants/asset';
|
|
6
6
|
export * from './lib/constants/localnetConstants';
|
|
7
7
|
export * from './lib/constants/utils';
|
|
8
|
-
export { isSuiOrderResponse, ConstructUrl, discriminateOrderResponse, getOrderResponseType, isBitcoinOrderResponse, isEvmOrderResponse, isOrder, isSolanaOrderResponse, isStarknetOrderResponse, isXrplOrderResponse, } from './lib/utils';
|
|
8
|
+
export { isSuiOrderResponse, ConstructUrl, discriminateOrderResponse, getOrderResponseType, isBitcoinOrderResponse, isEvmOrderResponse, isOrder, isSolanaOrderResponse, isStarknetOrderResponse, isXrplOrderResponse, isLightningOrderResponse, } from './lib/utils';
|
|
9
9
|
export { ChainAsset } from './lib/chainAsset/chainAsset';
|
|
10
10
|
export type { ChainAssetString, AssetLike } from './lib/chainAsset/chainAsset';
|
|
11
|
+
export { ExplorerUrlBuilder } from './lib/ExplorerUrlBuilder/ExplorerUrlBuilder';
|
|
11
12
|
export { OrderAction, ParseOrderStatus, isCompleted, isDeadlinePassed, parseAction, } from './lib/orderStatus/orderStatus';
|
|
12
13
|
export { AssetManager } from './lib/assetManager/AssetManager';
|
|
13
14
|
export type { ApiChainData, ApiChainsResponse, AssetManagerState, BaseChainData, ChainData, FiatResponse, } from './lib/assetManager/types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Network } from '@gardenfi/utils';
|
|
2
|
+
import { Chain } from '../constants/asset.types';
|
|
3
|
+
|
|
4
|
+
export declare class ExplorerUrlBuilder {
|
|
5
|
+
private readonly explorerUrl;
|
|
6
|
+
private readonly network;
|
|
7
|
+
private readonly chainType;
|
|
8
|
+
constructor(chain: Chain, explorerUrl: string, network: Network);
|
|
9
|
+
static from(chain: Chain, explorerUrl: string, network: Network): ExplorerUrlBuilder;
|
|
10
|
+
getAddressLink(address: string): string;
|
|
11
|
+
getTxLink(tx: string): string;
|
|
12
|
+
private extractTxHash;
|
|
13
|
+
}
|
package/dist/src/lib/api.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1180,6 +1201,26 @@ export declare const Config: {
|
|
|
1180
1201
|
};
|
|
1181
1202
|
};
|
|
1182
1203
|
};
|
|
1204
|
+
readonly hyperevm_testnet: {
|
|
1205
|
+
readonly type: BlockchainType.evm;
|
|
1206
|
+
readonly network: Network.TESTNET;
|
|
1207
|
+
readonly USDC: {
|
|
1208
|
+
readonly id: "hyperevm_testnet:usdc";
|
|
1209
|
+
readonly name: "USD Coin";
|
|
1210
|
+
readonly symbol: "USDC";
|
|
1211
|
+
readonly decimals: 6;
|
|
1212
|
+
readonly icon: "https://garden.imgix.net/token-images/usdc.svg";
|
|
1213
|
+
readonly chain: "evm:998";
|
|
1214
|
+
readonly htlc: {
|
|
1215
|
+
readonly address: "0xdb6Bd9e3363d456be65bCB5eF806c11DDC9b882B";
|
|
1216
|
+
readonly schema: "evm:htlc_erc20";
|
|
1217
|
+
};
|
|
1218
|
+
readonly token: {
|
|
1219
|
+
readonly address: "0x2b3370ee501b4a559b57d449569354196457d8ab";
|
|
1220
|
+
readonly schema: "evm:erc20";
|
|
1221
|
+
};
|
|
1222
|
+
};
|
|
1223
|
+
};
|
|
1183
1224
|
readonly hyperliquid: {
|
|
1184
1225
|
readonly type: BlockchainType.evm;
|
|
1185
1226
|
readonly network: Network.MAINNET;
|
|
@@ -1216,7 +1257,7 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1216
1257
|
};
|
|
1217
1258
|
readonly arbitrum_localnet: {
|
|
1218
1259
|
readonly type: BlockchainType.evm;
|
|
1219
|
-
readonly
|
|
1260
|
+
readonly USDC: {
|
|
1220
1261
|
name: string;
|
|
1221
1262
|
decimals: number;
|
|
1222
1263
|
symbol: string;
|
|
@@ -1234,6 +1275,13 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
1234
1275
|
atomicSwapAddress: string;
|
|
1235
1276
|
tokenAddress: string;
|
|
1236
1277
|
};
|
|
1278
|
+
readonly USDC: {
|
|
1279
|
+
name: string;
|
|
1280
|
+
decimals: number;
|
|
1281
|
+
symbol: string;
|
|
1282
|
+
atomicSwapAddress: string;
|
|
1283
|
+
tokenAddress: string;
|
|
1284
|
+
};
|
|
1237
1285
|
readonly network: Network.LOCALNET;
|
|
1238
1286
|
};
|
|
1239
1287
|
readonly bitcoin_regtest: {
|
|
@@ -2324,6 +2372,20 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2324
2372
|
readonly token: null;
|
|
2325
2373
|
};
|
|
2326
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
|
+
};
|
|
2327
2389
|
readonly litecoin: {
|
|
2328
2390
|
readonly type: BlockchainType.litecoin;
|
|
2329
2391
|
readonly network: Network.MAINNET;
|
|
@@ -2358,6 +2420,26 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2358
2420
|
};
|
|
2359
2421
|
};
|
|
2360
2422
|
};
|
|
2423
|
+
readonly hyperevm_testnet: {
|
|
2424
|
+
readonly type: BlockchainType.evm;
|
|
2425
|
+
readonly network: Network.TESTNET;
|
|
2426
|
+
readonly USDC: {
|
|
2427
|
+
readonly id: "hyperevm_testnet:usdc";
|
|
2428
|
+
readonly name: "USD Coin";
|
|
2429
|
+
readonly symbol: "USDC";
|
|
2430
|
+
readonly decimals: 6;
|
|
2431
|
+
readonly icon: "https://garden.imgix.net/token-images/usdc.svg";
|
|
2432
|
+
readonly chain: "evm:998";
|
|
2433
|
+
readonly htlc: {
|
|
2434
|
+
readonly address: "0xdb6Bd9e3363d456be65bCB5eF806c11DDC9b882B";
|
|
2435
|
+
readonly schema: "evm:htlc_erc20";
|
|
2436
|
+
};
|
|
2437
|
+
readonly token: {
|
|
2438
|
+
readonly address: "0x2b3370ee501b4a559b57d449569354196457d8ab";
|
|
2439
|
+
readonly schema: "evm:erc20";
|
|
2440
|
+
};
|
|
2441
|
+
};
|
|
2442
|
+
};
|
|
2361
2443
|
readonly hyperliquid: {
|
|
2362
2444
|
readonly type: BlockchainType.evm;
|
|
2363
2445
|
readonly network: Network.MAINNET;
|
|
@@ -2381,7 +2463,7 @@ export declare const Assets: import('./utils').AssetsType<{
|
|
|
2381
2463
|
}>;
|
|
2382
2464
|
export declare const isMainnet: (chain: Chain) => boolean;
|
|
2383
2465
|
export declare function is<T extends BlockchainType>(type: T): (chain: Chain) => chain is Extract<Chain, ChainsByBlockchainType<T>>;
|
|
2384
|
-
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" | "hyperliquid" | "hypercore" | "hypercore_testnet";
|
|
2466
|
+
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";
|
|
2385
2467
|
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_regtest" | "bitcoin_testnet";
|
|
2386
2468
|
export declare const isLitecoin: (chain: Chain) => chain is "litecoin_testnet" | "litecoin";
|
|
2387
2469
|
export declare const isSpark: (chain: Chain) => chain is "spark_regtest" | "spark";
|
|
@@ -2391,6 +2473,7 @@ export declare const isSui: (chain: Chain) => chain is "sui" | "sui_testnet";
|
|
|
2391
2473
|
export declare const isTron: (chain: Chain) => chain is "tron_shasta" | "tron";
|
|
2392
2474
|
export declare const isXrpl: (chain: Chain) => chain is "xrpl" | "xrpl_testnet";
|
|
2393
2475
|
export declare const isAlpenSignet: (chain: Chain) => chain is "alpen_signet";
|
|
2476
|
+
export declare const isLightning: (chain: Chain) => chain is "lightning";
|
|
2394
2477
|
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
2395
2478
|
export declare const NATIVE_TOKENS: {
|
|
2396
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
|
+
"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",
|