@metaflux-dex/client 0.0.1
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/LICENSE +21 -0
- package/README.md +157 -0
- package/dist/client.d.ts +32 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +344 -0
- package/dist/client.js.map +1 -0
- package/dist/http.d.ts +17 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +106 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/info-types.d.ts +380 -0
- package/dist/info-types.d.ts.map +1 -0
- package/dist/info-types.js +16 -0
- package/dist/info-types.js.map +1 -0
- package/dist/info.d.ts +65 -0
- package/dist/info.d.ts.map +1 -0
- package/dist/info.js +252 -0
- package/dist/info.js.map +1 -0
- package/dist/native.d.ts +10 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +252 -0
- package/dist/native.js.map +1 -0
- package/dist/types.d.ts +143 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/wasm.d.ts +28 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +279 -0
- package/dist/wasm.js.map +1 -0
- package/dist/ws.d.ts +43 -0
- package/dist/ws.d.ts.map +1 -0
- package/dist/ws.js +221 -0
- package/dist/ws.js.map +1 -0
- package/package.json +65 -0
- package/src/client.ts +454 -0
- package/src/http.ts +153 -0
- package/src/index.ts +144 -0
- package/src/info-types.ts +783 -0
- package/src/info.ts +355 -0
- package/src/native.ts +307 -0
- package/src/types.ts +305 -0
- package/src/wasm.ts +384 -0
- package/src/ws.ts +279 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Public barrel — every export consumers see goes through this file.
|
|
2
|
+
//
|
|
3
|
+
// Pinning the public surface here means we can refactor the internal
|
|
4
|
+
// `client.ts` / `wasm.ts` / `http.ts` split without touching anything
|
|
5
|
+
// import-facing. The npm package `exports` map points at the compiled
|
|
6
|
+
// `dist/index.js`, so consumers write:
|
|
7
|
+
//
|
|
8
|
+
// import { Client, type Order } from '@metaflux-dex/client';
|
|
9
|
+
|
|
10
|
+
export { Client, type ClientOpts } from './client.js';
|
|
11
|
+
export { MetaFluxApiError } from './http.js';
|
|
12
|
+
export {
|
|
13
|
+
// MTF-native signed-action surface (the path the server now accepts).
|
|
14
|
+
// Exported so power users can build / sign / inspect actions out-of-band.
|
|
15
|
+
MTF_CHAIN_ID,
|
|
16
|
+
nativeActionDigest,
|
|
17
|
+
buildNativeOrderAction,
|
|
18
|
+
buildNativeCancelAction,
|
|
19
|
+
signNativeAction,
|
|
20
|
+
recoverNativeSigner,
|
|
21
|
+
nativeRequestBody,
|
|
22
|
+
} from './native.js';
|
|
23
|
+
export {
|
|
24
|
+
// MTF-native `/info` read API + the account-ref union (address | account_id).
|
|
25
|
+
InfoApi,
|
|
26
|
+
type AccountRef,
|
|
27
|
+
} from './info.js';
|
|
28
|
+
export type {
|
|
29
|
+
// MTF-native `/info` response shapes. Source of truth: the node handlers in
|
|
30
|
+
// `metaflux/crates/api-node/src/rest/info/{reads,markets,hl_parity}.rs` and
|
|
31
|
+
// the KB spec `metaflux-knowledges/api/rest/info.md`. Every field is the exact
|
|
32
|
+
// snake_case key the node emits inside the `{type, data}` envelope's `data`.
|
|
33
|
+
NodeInfo,
|
|
34
|
+
AccountState,
|
|
35
|
+
AccountPosition,
|
|
36
|
+
Balances,
|
|
37
|
+
Tier,
|
|
38
|
+
MarginMode,
|
|
39
|
+
MarketInfo,
|
|
40
|
+
Funding,
|
|
41
|
+
VaultState,
|
|
42
|
+
StakingState,
|
|
43
|
+
Delegation,
|
|
44
|
+
PendingUnstake,
|
|
45
|
+
FeeSchedule,
|
|
46
|
+
FeeTier,
|
|
47
|
+
OpenOrders,
|
|
48
|
+
OpenOrder,
|
|
49
|
+
L2Book,
|
|
50
|
+
L2Level,
|
|
51
|
+
RecentTrades,
|
|
52
|
+
UserFills,
|
|
53
|
+
FundingHistory,
|
|
54
|
+
FundingSample,
|
|
55
|
+
BlockInfo,
|
|
56
|
+
Agents,
|
|
57
|
+
AgentEntry,
|
|
58
|
+
SubAccounts,
|
|
59
|
+
SubAccountEntry,
|
|
60
|
+
Mip3ActiveBids,
|
|
61
|
+
Mip3Bid,
|
|
62
|
+
// HL-node parity shapes.
|
|
63
|
+
SpotMeta,
|
|
64
|
+
SpotPair,
|
|
65
|
+
SpotClearinghouseState,
|
|
66
|
+
SpotBalance,
|
|
67
|
+
ExchangeStatus,
|
|
68
|
+
FrontendOpenOrders,
|
|
69
|
+
FrontendOpenOrder,
|
|
70
|
+
OrderTrigger,
|
|
71
|
+
Liquidatable,
|
|
72
|
+
LiquidatableAccount,
|
|
73
|
+
ActiveAssetData,
|
|
74
|
+
MaxMarketOrderNtls,
|
|
75
|
+
MaxMarketOrderNtl,
|
|
76
|
+
VaultSummaries,
|
|
77
|
+
VaultSummary,
|
|
78
|
+
UserVaultEquities,
|
|
79
|
+
VaultEquity,
|
|
80
|
+
LeadingVaults,
|
|
81
|
+
UserRateLimit,
|
|
82
|
+
SpotDeployState,
|
|
83
|
+
DelegatorSummary,
|
|
84
|
+
MaxBuilderFee,
|
|
85
|
+
UserToMultiSigSigners,
|
|
86
|
+
UserRole,
|
|
87
|
+
PerpsAtOpenInterestCap,
|
|
88
|
+
ValidatorL1Votes,
|
|
89
|
+
ValidatorL1Vote,
|
|
90
|
+
MarginTable,
|
|
91
|
+
MarginTier,
|
|
92
|
+
PerpDexs,
|
|
93
|
+
PerpDex,
|
|
94
|
+
ValidatorSummaries,
|
|
95
|
+
ValidatorSummary,
|
|
96
|
+
GossipRootIps,
|
|
97
|
+
WebData2,
|
|
98
|
+
WebData2Clearinghouse,
|
|
99
|
+
WebData2Position,
|
|
100
|
+
} from './info-types.js';
|
|
101
|
+
export {
|
|
102
|
+
// MTF-native WebSocket client + subscription/channel types.
|
|
103
|
+
WsClient,
|
|
104
|
+
WS_CHANNELS,
|
|
105
|
+
type WsChannel,
|
|
106
|
+
type WsSubscription,
|
|
107
|
+
type WsFrame,
|
|
108
|
+
type WsMessageHandler,
|
|
109
|
+
type WsConfig,
|
|
110
|
+
} from './ws.js';
|
|
111
|
+
export {
|
|
112
|
+
WasmNotBuiltError,
|
|
113
|
+
WasmCallError,
|
|
114
|
+
// Low-level crypto wrappers — exported so power users can build
|
|
115
|
+
// their own signing flows (e.g. transferring sign() out of the
|
|
116
|
+
// browser to a hardware-backed signer).
|
|
117
|
+
keccak256,
|
|
118
|
+
signSecp256k1,
|
|
119
|
+
recoverPubkey,
|
|
120
|
+
eip712TypedDataHash,
|
|
121
|
+
encodeLimitOrder,
|
|
122
|
+
deriveAddressFromPubkey,
|
|
123
|
+
} from './wasm.js';
|
|
124
|
+
export type {
|
|
125
|
+
Order,
|
|
126
|
+
Builder,
|
|
127
|
+
SignedOrder,
|
|
128
|
+
OrderAck,
|
|
129
|
+
Market,
|
|
130
|
+
Position,
|
|
131
|
+
Side,
|
|
132
|
+
Tif,
|
|
133
|
+
ErrorEnvelope,
|
|
134
|
+
// MTF-native action types.
|
|
135
|
+
NativeOrder,
|
|
136
|
+
NativeCancel,
|
|
137
|
+
NativeBuilder,
|
|
138
|
+
NativeSide,
|
|
139
|
+
NativeOrderKind,
|
|
140
|
+
NativeTif,
|
|
141
|
+
NativeStpMode,
|
|
142
|
+
NativeSignedAction,
|
|
143
|
+
NativeExchangeAck,
|
|
144
|
+
} from './types.js';
|