@metaflux-dex/client 0.0.3 → 0.0.6
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/README.md +196 -16
- package/dist/client.d.ts +173 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +264 -11
- package/dist/client.js.map +1 -1
- package/dist/faucet.js +1 -1
- package/dist/faucet.js.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/dist/native/actions.d.ts +46 -0
- package/dist/native/actions.d.ts.map +1 -0
- package/dist/native/actions.js +593 -0
- package/dist/native/actions.js.map +1 -0
- package/dist/native/digest.d.ts +28 -0
- package/dist/native/digest.d.ts.map +1 -0
- package/dist/{native.js → native/digest.js} +71 -86
- package/dist/native/digest.js.map +1 -0
- package/dist/native/index.d.ts +3 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +5 -0
- package/dist/native/index.js.map +1 -0
- package/dist/rest/http.d.ts.map +1 -0
- package/dist/rest/http.js.map +1 -0
- package/dist/{info.d.ts → rest/info.d.ts} +1 -1
- package/dist/rest/info.d.ts.map +1 -0
- package/dist/{info.js → rest/info.js} +8 -5
- package/dist/rest/info.js.map +1 -0
- package/dist/types/account.d.ts +52 -0
- package/dist/types/account.d.ts.map +1 -0
- package/dist/types/account.js +8 -0
- package/dist/types/account.js.map +1 -0
- package/dist/types/encrypted.d.ts +8 -0
- package/dist/types/encrypted.d.ts.map +1 -0
- package/dist/types/encrypted.js +7 -0
- package/dist/types/encrypted.js.map +1 -0
- package/dist/types/governance.d.ts +11 -0
- package/dist/types/governance.d.ts.map +1 -0
- package/dist/types/governance.js +7 -0
- package/dist/types/governance.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/info/core.d.ts +97 -0
- package/dist/types/info/core.d.ts.map +1 -0
- package/dist/types/info/core.js +15 -0
- package/dist/types/info/core.js.map +1 -0
- package/dist/{info-types.d.ts → types/info/hl-parity.d.ts} +8 -177
- package/dist/types/info/hl-parity.d.ts.map +1 -0
- package/dist/types/info/hl-parity.js +8 -0
- package/dist/types/info/hl-parity.js.map +1 -0
- package/dist/types/info/index.d.ts +4 -0
- package/dist/types/info/index.d.ts.map +1 -0
- package/dist/types/info/index.js +6 -0
- package/dist/types/info/index.js.map +1 -0
- package/dist/types/info/reads.d.ts +81 -0
- package/dist/types/info/reads.d.ts.map +1 -0
- package/dist/types/info/reads.js +7 -0
- package/dist/types/info/reads.js.map +1 -0
- package/dist/types/meta-bridge.d.ts +8 -0
- package/dist/types/meta-bridge.d.ts.map +1 -0
- package/dist/types/meta-bridge.js +7 -0
- package/dist/types/meta-bridge.js.map +1 -0
- package/dist/types/spot.d.ts +41 -0
- package/dist/types/spot.d.ts.map +1 -0
- package/dist/types/spot.js +7 -0
- package/dist/types/spot.js.map +1 -0
- package/dist/types/staking.d.ts +12 -0
- package/dist/types/staking.d.ts.map +1 -0
- package/dist/types/staking.js +6 -0
- package/dist/types/staking.js.map +1 -0
- package/dist/{types.d.ts → types/trading.d.ts} +33 -1
- package/dist/types/trading.d.ts.map +1 -0
- package/dist/{types.js → types/trading.js} +3 -3
- package/dist/types/trading.js.map +1 -0
- package/dist/types/twap.d.ts +13 -0
- package/dist/types/twap.d.ts.map +1 -0
- package/dist/types/twap.js +7 -0
- package/dist/types/twap.js.map +1 -0
- package/dist/types/vault.d.ts +24 -0
- package/dist/types/vault.d.ts.map +1 -0
- package/dist/types/vault.js +6 -0
- package/dist/types/vault.js.map +1 -0
- package/dist/{wasm.d.ts → wallet/wasm.d.ts} +1 -1
- package/dist/wallet/wasm.d.ts.map +1 -0
- package/dist/{wasm.js → wallet/wasm.js} +9 -8
- package/dist/wallet/wasm.js.map +1 -0
- package/dist/{ws.d.ts → ws/ws.d.ts} +14 -1
- package/dist/ws/ws.d.ts.map +1 -0
- package/dist/{ws.js → ws/ws.js} +27 -15
- package/dist/ws/ws.js.map +1 -0
- package/package.json +3 -1
- package/src/client.ts +610 -12
- package/src/faucet.ts +1 -1
- package/src/index.ts +117 -15
- package/src/native/actions.ts +820 -0
- package/src/{native.ts → native/digest.ts} +78 -95
- package/src/native/index.ts +5 -0
- package/src/{http.ts → rest/http.ts} +1 -1
- package/src/{info.ts → rest/info.ts} +9 -6
- package/src/types/account.ts +111 -0
- package/src/types/encrypted.ts +21 -0
- package/src/types/governance.ts +27 -0
- package/src/types/index.ts +79 -0
- package/src/types/info/core.ts +214 -0
- package/src/types/info/hl-parity.ts +428 -0
- package/src/types/info/index.ts +78 -0
- package/src/types/info/reads.ts +165 -0
- package/src/types/meta-bridge.ts +22 -0
- package/src/types/spot.ts +114 -0
- package/src/types/staking.ts +27 -0
- package/src/{types.ts → types/trading.ts} +92 -8
- package/src/types/twap.ts +29 -0
- package/src/types/vault.ts +55 -0
- package/src/{wasm.ts → wallet/wasm.ts} +10 -9
- package/src/{ws.ts → ws/ws.ts} +75 -22
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js.map +0 -1
- package/dist/info-types.d.ts.map +0 -1
- package/dist/info-types.js +0 -16
- package/dist/info-types.js.map +0 -1
- package/dist/info.d.ts.map +0 -1
- package/dist/info.js.map +0 -1
- package/dist/native.d.ts +0 -12
- package/dist/native.d.ts.map +0 -1
- package/dist/native.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/wasm.d.ts.map +0 -1
- package/dist/wasm.js.map +0 -1
- package/dist/ws.d.ts.map +0 -1
- package/dist/ws.js.map +0 -1
- package/src/info-types.ts +0 -783
- /package/dist/{http.d.ts → rest/http.d.ts} +0 -0
- /package/dist/{http.js → rest/http.js} +0 -0
package/src/index.ts
CHANGED
|
@@ -1,36 +1,81 @@
|
|
|
1
1
|
// Public barrel — every export consumers see goes through this file.
|
|
2
2
|
//
|
|
3
3
|
// Pinning the public surface here means we can refactor the internal
|
|
4
|
-
// `client.ts` / `wasm.ts` / `http.ts` split without touching
|
|
5
|
-
// import-facing. The npm package `exports` map points at the compiled
|
|
4
|
+
// `client.ts` / `wallet/wasm.ts` / `rest/http.ts` split without touching
|
|
5
|
+
// anything import-facing. The npm package `exports` map points at the compiled
|
|
6
6
|
// `dist/index.js`, so consumers write:
|
|
7
7
|
//
|
|
8
8
|
// import { Client, type Order } from '@metaflux-dex/client';
|
|
9
9
|
|
|
10
10
|
export { Client, type ClientOpts } from './client.js';
|
|
11
|
-
export { MetaFluxApiError } from './http.js';
|
|
11
|
+
export { MetaFluxApiError } from './rest/http.js';
|
|
12
12
|
export { requestFaucet, type FaucetResponse } from './faucet.js';
|
|
13
13
|
export {
|
|
14
|
-
// MTF-native signed-action
|
|
15
|
-
//
|
|
14
|
+
// MTF-native signed-action signing core. Exported so power users can build /
|
|
15
|
+
// sign / inspect actions out-of-band.
|
|
16
16
|
MTF_CHAIN_ID,
|
|
17
17
|
MTF_MAINNET_CHAIN_ID,
|
|
18
18
|
MTF_TESTNET_CHAIN_ID,
|
|
19
19
|
nativeActionDigest,
|
|
20
|
-
buildNativeOrderAction,
|
|
21
|
-
buildNativeCancelAction,
|
|
22
20
|
signNativeAction,
|
|
23
21
|
recoverNativeSigner,
|
|
24
22
|
nativeRequestBody,
|
|
25
|
-
} from './native.js';
|
|
23
|
+
} from './native/digest.js';
|
|
24
|
+
export {
|
|
25
|
+
// MTF-native action builders — the full real /exchange surface.
|
|
26
|
+
buildNativeOrderAction,
|
|
27
|
+
buildNativeCancelAction,
|
|
28
|
+
buildNativeCancelByCloidAction,
|
|
29
|
+
buildNativeModifyAction,
|
|
30
|
+
buildNativeBatchModifyAction,
|
|
31
|
+
buildNativeBatchOrderAction,
|
|
32
|
+
buildNativeBatchCancelAction,
|
|
33
|
+
buildNativeScheduleCancelAction,
|
|
34
|
+
buildNativeCancelAllOrdersAction,
|
|
35
|
+
buildNativeSetPositionModeAction,
|
|
36
|
+
buildNativeTwapOrderAction,
|
|
37
|
+
buildNativeTwapCancelAction,
|
|
38
|
+
buildNativeUpdateLeverageAction,
|
|
39
|
+
buildNativeUpdateIsolatedMarginAction,
|
|
40
|
+
buildNativeTopUpIsolatedOnlyMarginAction,
|
|
41
|
+
buildNativeUserPortfolioMarginAction,
|
|
42
|
+
buildNativeSetDisplayNameAction,
|
|
43
|
+
buildNativeSetReferrerAction,
|
|
44
|
+
buildNativeApproveAgentAction,
|
|
45
|
+
buildNativeApproveBuilderFeeAction,
|
|
46
|
+
buildNativeConvertToMultiSigUserAction,
|
|
47
|
+
buildNativeUserDexAbstractionAction,
|
|
48
|
+
buildNativeUserSetAbstractionAction,
|
|
49
|
+
buildNativeAgentSetAbstractionAction,
|
|
50
|
+
buildNativePriorityBidAction,
|
|
51
|
+
buildNativeTokenDelegateAction,
|
|
52
|
+
buildNativeClaimRewardsAction,
|
|
53
|
+
buildNativeLinkStakingUserAction,
|
|
54
|
+
buildNativeSubmitEncryptedOrderAction,
|
|
55
|
+
buildNativeCreateVaultAction,
|
|
56
|
+
buildNativeVaultTransferAction,
|
|
57
|
+
buildNativeVaultModifyAction,
|
|
58
|
+
buildNativeVaultWithdrawAction,
|
|
59
|
+
buildNativeMbWithdrawAction,
|
|
60
|
+
buildNativeSetMetaliquidityWhitelistAction,
|
|
61
|
+
buildNativeRegisterMetaliquidityOperatorAction,
|
|
62
|
+
// Spot CLOB + spot margin (leveraged spot) + Earn (lending pool).
|
|
63
|
+
buildNativeSpotOrderAction,
|
|
64
|
+
buildNativeSpotCancelAction,
|
|
65
|
+
buildNativeSpotMarginDepositAction,
|
|
66
|
+
buildNativeSpotMarginWithdrawAction,
|
|
67
|
+
buildNativeSpotMarginOpenAction,
|
|
68
|
+
buildNativeSpotMarginCloseAction,
|
|
69
|
+
buildNativeEarnDepositAction,
|
|
70
|
+
buildNativeEarnWithdrawAction,
|
|
71
|
+
} from './native/actions.js';
|
|
26
72
|
export {
|
|
27
73
|
// MTF-native `/info` read API + the account-ref union (address | account_id).
|
|
28
74
|
InfoApi,
|
|
29
75
|
type AccountRef,
|
|
30
|
-
} from './info.js';
|
|
76
|
+
} from './rest/info.js';
|
|
31
77
|
export type {
|
|
32
|
-
// MTF-native `/info` response shapes. Source of truth:
|
|
33
|
-
// `metaflux/crates/api-node/src/rest/info/{reads,markets,hl_parity}.rs` and
|
|
78
|
+
// MTF-native `/info` response shapes. Source of truth:
|
|
34
79
|
// the KB spec `metaflux-knowledges/api/rest/info.md`. Every field is the exact
|
|
35
80
|
// snake_case key the node emits inside the `{type, data}` envelope's `data`.
|
|
36
81
|
NodeInfo,
|
|
@@ -65,6 +110,7 @@ export type {
|
|
|
65
110
|
// HL-node parity shapes.
|
|
66
111
|
SpotMeta,
|
|
67
112
|
SpotPair,
|
|
113
|
+
SpotToken,
|
|
68
114
|
SpotClearinghouseState,
|
|
69
115
|
SpotBalance,
|
|
70
116
|
ExchangeStatus,
|
|
@@ -100,7 +146,7 @@ export type {
|
|
|
100
146
|
WebData2,
|
|
101
147
|
WebData2Clearinghouse,
|
|
102
148
|
WebData2Position,
|
|
103
|
-
} from './info
|
|
149
|
+
} from './types/info/index.js';
|
|
104
150
|
export {
|
|
105
151
|
// MTF-native WebSocket client + subscription/channel types.
|
|
106
152
|
WsClient,
|
|
@@ -110,7 +156,9 @@ export {
|
|
|
110
156
|
type WsFrame,
|
|
111
157
|
type WsMessageHandler,
|
|
112
158
|
type WsConfig,
|
|
113
|
-
|
|
159
|
+
type AllMids,
|
|
160
|
+
type ActiveAssetCtx,
|
|
161
|
+
} from './ws/ws.js';
|
|
114
162
|
export {
|
|
115
163
|
WasmNotBuiltError,
|
|
116
164
|
WasmCallError,
|
|
@@ -123,7 +171,7 @@ export {
|
|
|
123
171
|
eip712TypedDataHash,
|
|
124
172
|
encodeLimitOrder,
|
|
125
173
|
deriveAddressFromPubkey,
|
|
126
|
-
} from './wasm.js';
|
|
174
|
+
} from './wallet/wasm.js';
|
|
127
175
|
export type {
|
|
128
176
|
Order,
|
|
129
177
|
Builder,
|
|
@@ -139,9 +187,63 @@ export type {
|
|
|
139
187
|
NativeCancel,
|
|
140
188
|
NativeBuilder,
|
|
141
189
|
NativeSide,
|
|
190
|
+
NativePositionSide,
|
|
142
191
|
NativeOrderKind,
|
|
143
192
|
NativeTif,
|
|
144
193
|
NativeStpMode,
|
|
194
|
+
NativeSetPositionMode,
|
|
195
|
+
NativeSpotOrder,
|
|
196
|
+
NativeSpotCancel,
|
|
197
|
+
NativeSpotMarginDeposit,
|
|
198
|
+
NativeSpotMarginWithdraw,
|
|
199
|
+
NativeSpotMarginOpen,
|
|
200
|
+
NativeSpotMarginClose,
|
|
201
|
+
NativeEarnDeposit,
|
|
202
|
+
NativeEarnWithdraw,
|
|
145
203
|
NativeSignedAction,
|
|
146
204
|
NativeExchangeAck,
|
|
147
|
-
|
|
205
|
+
// Order-management actions.
|
|
206
|
+
OrderGrouping,
|
|
207
|
+
Modify,
|
|
208
|
+
BatchModify,
|
|
209
|
+
BatchOrder,
|
|
210
|
+
BatchCancel,
|
|
211
|
+
CancelByCloid,
|
|
212
|
+
ScheduleCancel,
|
|
213
|
+
CancelAllOrders,
|
|
214
|
+
// Account / margin / agent actions.
|
|
215
|
+
UpdateLeverage,
|
|
216
|
+
UpdateIsolatedMargin,
|
|
217
|
+
TopUpIsolatedOnlyMargin,
|
|
218
|
+
UserPortfolioMargin,
|
|
219
|
+
SetDisplayName,
|
|
220
|
+
SetReferrer,
|
|
221
|
+
ApproveAgent,
|
|
222
|
+
ApproveBuilderFee,
|
|
223
|
+
ConvertToMultiSigUser,
|
|
224
|
+
UserDexAbstraction,
|
|
225
|
+
UserSetAbstraction,
|
|
226
|
+
AgentSetAbstraction,
|
|
227
|
+
PriorityBid,
|
|
228
|
+
// TWAP.
|
|
229
|
+
TwapOrder,
|
|
230
|
+
TwapCancel,
|
|
231
|
+
// Staking.
|
|
232
|
+
TokenDelegate,
|
|
233
|
+
ClaimRewards,
|
|
234
|
+
LinkStakingUser,
|
|
235
|
+
// Encrypted orders.
|
|
236
|
+
SubmitEncryptedOrder,
|
|
237
|
+
// Vaults.
|
|
238
|
+
VaultKind,
|
|
239
|
+
CreateVault,
|
|
240
|
+
VaultTransfer,
|
|
241
|
+
VaultModify,
|
|
242
|
+
VaultWithdraw,
|
|
243
|
+
// MetaBridge.
|
|
244
|
+
MbChain,
|
|
245
|
+
MbWithdraw,
|
|
246
|
+
// Governance / operator.
|
|
247
|
+
SetMetaliquidityWhitelist,
|
|
248
|
+
RegisterMetaliquidityOperator,
|
|
249
|
+
} from './types/index.js';
|