dipcoin-cli 0.5.0

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.
Files changed (50) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +736 -0
  3. package/dist/cli/commands/account.d.ts +3 -0
  4. package/dist/cli/commands/account.d.ts.map +1 -0
  5. package/dist/cli/commands/balance.d.ts +3 -0
  6. package/dist/cli/commands/balance.d.ts.map +1 -0
  7. package/dist/cli/commands/history.d.ts +3 -0
  8. package/dist/cli/commands/history.d.ts.map +1 -0
  9. package/dist/cli/commands/market.d.ts +3 -0
  10. package/dist/cli/commands/market.d.ts.map +1 -0
  11. package/dist/cli/commands/position.d.ts +3 -0
  12. package/dist/cli/commands/position.d.ts.map +1 -0
  13. package/dist/cli/commands/trade.d.ts +3 -0
  14. package/dist/cli/commands/trade.d.ts.map +1 -0
  15. package/dist/cli/commands/vault.d.ts +4 -0
  16. package/dist/cli/commands/vault.d.ts.map +1 -0
  17. package/dist/cli/index.d.ts +2 -0
  18. package/dist/cli/index.d.ts.map +1 -0
  19. package/dist/cli/utils/output.d.ts +7 -0
  20. package/dist/cli/utils/output.d.ts.map +1 -0
  21. package/dist/cli/utils/sdk-factory.d.ts +5 -0
  22. package/dist/cli/utils/sdk-factory.d.ts.map +1 -0
  23. package/dist/cli.cjs +19252 -0
  24. package/dist/config/deployed/mainnet/main_contract.json +550 -0
  25. package/dist/config/deployed/testnet/main_contract.json +550 -0
  26. package/dist/index.cjs.js +4 -0
  27. package/dist/index.cjs.js.map +1 -0
  28. package/dist/index.esm.js +4 -0
  29. package/dist/index.esm.js.map +1 -0
  30. package/dist/index.mjs +4 -0
  31. package/dist/index.mjs.map +1 -0
  32. package/dist/src/__tests__/sdk.test.d.ts +2 -0
  33. package/dist/src/__tests__/sdk.test.d.ts.map +1 -0
  34. package/dist/src/config/index.d.ts +15 -0
  35. package/dist/src/config/index.d.ts.map +1 -0
  36. package/dist/src/constants/index.d.ts +55 -0
  37. package/dist/src/constants/index.d.ts.map +1 -0
  38. package/dist/src/index.d.ts +20 -0
  39. package/dist/src/index.d.ts.map +1 -0
  40. package/dist/src/sdk/index.d.ts +2 -0
  41. package/dist/src/sdk/index.d.ts.map +1 -0
  42. package/dist/src/sdk/sdk.d.ts +300 -0
  43. package/dist/src/sdk/sdk.d.ts.map +1 -0
  44. package/dist/src/services/httpClient.d.ts +25 -0
  45. package/dist/src/services/httpClient.d.ts.map +1 -0
  46. package/dist/src/types/index.d.ts +603 -0
  47. package/dist/src/types/index.d.ts.map +1 -0
  48. package/dist/src/utils/index.d.ts +62 -0
  49. package/dist/src/utils/index.d.ts.map +1 -0
  50. package/package.json +78 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sdk.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/sdk.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { DipCoinPerpSDKOptions } from "../types";
2
+ /**
3
+ * Default API base URLs
4
+ */
5
+ export declare const DEFAULT_API_URLS: {
6
+ mainnet: string;
7
+ testnet: string;
8
+ };
9
+ /**
10
+ * Initialize SDK options with defaults
11
+ */
12
+ export declare function initSDKOptions(options: Partial<DipCoinPerpSDKOptions> & {
13
+ network: "mainnet" | "testnet";
14
+ }): DipCoinPerpSDKOptions;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAAE,OAAO,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,GAC3E,qBAAqB,CAMvB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Default values and constants
3
+ */
4
+ export declare const DEFAULT_SLIPPAGE = 0.05;
5
+ /**
6
+ * API endpoints
7
+ */
8
+ export declare const API_ENDPOINTS: {
9
+ readonly AUTHORIZE: "/api/authorize";
10
+ readonly PLACE_ORDER: "/api/perp-trade-api/trade/placeorder";
11
+ readonly CANCEL_ORDER: "/api/perp-trade-api/trade/cancelorder";
12
+ readonly PLAN_CLOSE_ORDER: "/api/perp-trade-api/plan/batch/plancloseorder";
13
+ readonly CANCEL_PLAN_ORDER: "/api/perp-trade-api/plan/cancelplanorder";
14
+ readonly ADJUST_LEVERAGE: "/api/perp-trade-api/user-config/adjust-leverage";
15
+ readonly GET_USER_CONFIG: "/api/perp-trade-api/user-config/config";
16
+ readonly GET_ACCOUNT_INFO: "/api/perp-trade-api/curr-info/account";
17
+ readonly GET_POSITIONS: "/api/perp-trade-api/curr-info/positions";
18
+ readonly GET_OPEN_ORDERS: "/api/perp-trade-api/curr-info/orders";
19
+ readonly GET_TRADING_PAIRS: "/api/perp-market-api/list";
20
+ readonly GET_ORDER_BOOK: "/api/perp-market-api/orderBook";
21
+ readonly GET_TICKER: "/api/perp-market-api/ticker";
22
+ readonly GET_POSITION_TPSL: "/api/perp-trade-api/plan/position/tpsl";
23
+ readonly HISTORY_ORDERS: "/api/perp-trade-api/history/orders";
24
+ readonly FUNDING_SETTLEMENTS: "/api/perp-trade-api/history/funding-settlements";
25
+ readonly BALANCE_CHANGES: "/api/perp-trade-api/history/balance-changes";
26
+ readonly ORACLE: "/api/perp-market-api/oracle";
27
+ };
28
+ /**
29
+ * Onboarding message for authentication
30
+ */
31
+ export declare const ONBOARDING_MESSAGE = "{\"onboardingUrl\":\"dipcoin.io\"}";
32
+ /**
33
+ * Decimal precision for formatting
34
+ */
35
+ export declare const DECIMALS: {
36
+ readonly USDC: 6;
37
+ readonly SUI: 9;
38
+ readonly DEFAULT: 18;
39
+ };
40
+ /**
41
+ * Pyth + Wormhole configuration per network
42
+ */
43
+ export declare const PYTH_CONFIG: {
44
+ readonly mainnet: {
45
+ readonly wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
46
+ readonly pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
47
+ readonly priceServiceUrl: "https://hermes.pyth.network/";
48
+ };
49
+ readonly testnet: {
50
+ readonly wormholeStateId: "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790";
51
+ readonly pythStateId: "0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";
52
+ readonly priceServiceUrl: "https://hermes-beta.pyth.network";
53
+ };
54
+ };
55
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;CAmBhB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,kBAAkB,uCAAmC,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;CAWd,CAAC"}
@@ -0,0 +1,20 @@
1
+ export * from "./config";
2
+ export * from "./sdk";
3
+ export { HttpClient } from "./services/httpClient";
4
+ export * from "./types";
5
+ export * from "./utils";
6
+ export * from "./constants";
7
+ import { Keypair } from "@mysten/sui/cryptography";
8
+ import { DipCoinPerpSDK } from "./sdk";
9
+ import { DipCoinPerpSDKOptions } from "./types";
10
+ /**
11
+ * Initialize DipCoin Perpetual Trading SDK
12
+ * @param privateKey Private key string or Keypair instance
13
+ * @param options SDK configuration options
14
+ * @returns Initialized SDK instance
15
+ */
16
+ export declare function initDipCoinPerpSDK(privateKey: string | Keypair, options: Partial<DipCoinPerpSDKOptions> & {
17
+ network: "mainnet" | "testnet";
18
+ }): DipCoinPerpSDK;
19
+ export default DipCoinPerpSDK;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,GAAG,OAAO,EAC5B,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAAE,OAAO,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,GAC3E,cAAc,CAGhB;AAGD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./sdk";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAGA,cAAc,OAAO,CAAC"}
@@ -0,0 +1,300 @@
1
+ import { SuiTransactionBlockResponse } from "@mysten/sui/client";
2
+ import { Keypair } from "@mysten/sui/cryptography";
3
+ import { AccountInfo, AccountInfoParams, AdjustLeverageParams, BalanceChange, BalanceChangesParams, CancelOrderParams, CancelTpSlOrdersParams, DipCoinPerpSDKOptions, FundingSettlement, FundingSettlementsParams, HistoryOrder, HistoryOrdersParams, MarginAdjustmentParams, OpenOrder, OpenOrdersParams, OrderBook, OrderResponse, PageResponse, PlaceOrderParams, PlaceTpSlOrdersParams, PlaceTpSlOrdersResult, Position, PositionTpSlOrder, PositionsParams, SDKResponse, Ticker, TpSlMode, TradingPair, UserConfig } from "../types";
4
+ /**
5
+ * DipCoin Perpetual Trading SDK
6
+ */
7
+ export declare class DipCoinPerpSDK {
8
+ private httpClient;
9
+ private keypair;
10
+ private subKeypair?;
11
+ private walletAddress;
12
+ private subAddress?;
13
+ private options;
14
+ private jwtToken?;
15
+ private subJwtToken?;
16
+ private isAuthenticating;
17
+ private isSubAuthenticating;
18
+ private exchangeOnChain;
19
+ private deploymentConfig;
20
+ private suiClient;
21
+ private transactionBuilder;
22
+ private priceServiceConnection?;
23
+ private pythClient?;
24
+ private tradingPairsCache?;
25
+ private tradingPairsCacheTimestamp?;
26
+ /**
27
+ * Initialize SDK
28
+ * @param privateKey Private key string or keypair
29
+ * @param options SDK configuration options
30
+ */
31
+ constructor(privateKey: string | Keypair, options: DipCoinPerpSDKOptions);
32
+ /**
33
+ * Get wallet address
34
+ */
35
+ get address(): string;
36
+ /**
37
+ * Get sub-account wallet address (if configured)
38
+ */
39
+ get subAccountAddress(): string | undefined;
40
+ /**
41
+ * Get SDK options
42
+ */
43
+ get optionsField(): DipCoinPerpSDKOptions;
44
+ /**
45
+ * Authenticate and get JWT token (onboarding)
46
+ * This method signs the onboarding message and exchanges it for a JWT token
47
+ * @returns JWT token
48
+ */
49
+ authenticate(): Promise<SDKResponse<string>>;
50
+ /**
51
+ * Authenticate sub-account and get JWT token
52
+ * Used for trading operations when sub-account is configured
53
+ */
54
+ authenticateSub(): Promise<SDKResponse<string>>;
55
+ /**
56
+ * Authenticate for trading operations
57
+ * Uses sub-account if configured, otherwise falls back to main account
58
+ */
59
+ private authenticateForTrading;
60
+ /**
61
+ * Restore main account auth context after trading operations
62
+ */
63
+ private restoreMainAuth;
64
+ /**
65
+ * Get JWT token, authenticate if needed
66
+ * @param forceRefresh Force refresh the token even if one exists
67
+ * @returns JWT token
68
+ */
69
+ getJWTToken(forceRefresh?: boolean): Promise<SDKResponse<string>>;
70
+ /**
71
+ * Clear JWT token (logout)
72
+ */
73
+ clearAuth(): void;
74
+ /**
75
+ * Place an order
76
+ * @param params Order parameters
77
+ * @returns Order response
78
+ */
79
+ placeOrder(params: PlaceOrderParams): Promise<SDKResponse<OrderResponse>>;
80
+ /**
81
+ * Cancel an order
82
+ * @param params Cancel order parameters
83
+ * @returns Cancel order response
84
+ */
85
+ cancelOrder(params: CancelOrderParams): Promise<SDKResponse<OrderResponse>>;
86
+ /**
87
+ * Adjust preferred leverage for a symbol (matches ts-frontend behavior)
88
+ * @param params Adjust leverage parameters
89
+ */
90
+ adjustLeverage(params: AdjustLeverageParams): Promise<SDKResponse<OrderResponse>>;
91
+ /**
92
+ * Fetch current user config (preferred leverage & margin type) for a symbol
93
+ * Mirrors ts-frontend behavior: GET /user-config/config + formatWeiToNormal
94
+ * @param symbol Trading symbol, e.g. "BTC-PERP"
95
+ */
96
+ getUserConfig(symbol: string): Promise<SDKResponse<UserConfig>>;
97
+ /**
98
+ * Place or edit TP/SL orders for a position
99
+ */
100
+ placePositionTpSlOrders(params: PlaceTpSlOrdersParams): Promise<SDKResponse<PlaceTpSlOrdersResult>>;
101
+ /**
102
+ * Get TP/SL orders for a position
103
+ */
104
+ getPositionTpSl(positionId: string | number, tpslType?: TpSlMode): Promise<SDKResponse<PositionTpSlOrder[]>>;
105
+ /**
106
+ * Cancel TP/SL orders (alias of cancelOrder)
107
+ */
108
+ cancelTpSlOrders(params: CancelTpSlOrdersParams): Promise<SDKResponse<OrderResponse>>;
109
+ /**
110
+ * Get account information
111
+ * @returns Account info response
112
+ */
113
+ getAccountInfo(params?: AccountInfoParams): Promise<SDKResponse<AccountInfo>>;
114
+ /**
115
+ * Get positions
116
+ * @param symbol Optional symbol filter
117
+ * @returns Positions response
118
+ */
119
+ getPositions(paramsOrSymbol?: string | PositionsParams): Promise<SDKResponse<Position[]>>;
120
+ /**
121
+ * Get trading pairs list
122
+ * This can be used to find the PerpetualID (perpId) for a given symbol
123
+ * @returns Trading pairs response
124
+ */
125
+ getTradingPairs(): Promise<SDKResponse<TradingPair[]>>;
126
+ /**
127
+ * Get PerpetualID for a given symbol
128
+ * @param symbol Trading symbol (e.g., "BTC-PERP")
129
+ * @returns PerpetualID or null if not found
130
+ */
131
+ getPerpetualID(symbol: string): Promise<string | null>;
132
+ /**
133
+ * Get open orders
134
+ * @param symbol Optional symbol filter
135
+ * @returns Open orders response
136
+ */
137
+ getOpenOrders(paramsOrSymbol?: string | OpenOrdersParams): Promise<SDKResponse<OpenOrder[]>>;
138
+ /**
139
+ * Get order book for a trading pair
140
+ * @param symbol Trading symbol (e.g., "BTC-PERP")
141
+ * @returns Order book response with bids and asks
142
+ * @example
143
+ * ```typescript
144
+ * const orderBook = await sdk.getOrderBook("BTC-PERP");
145
+ * if (orderBook.status && orderBook.data) {
146
+ * console.log("Bids:", orderBook.data.bids);
147
+ * console.log("Asks:", orderBook.data.asks);
148
+ * }
149
+ * ```
150
+ */
151
+ getOrderBook(symbol: string): Promise<SDKResponse<OrderBook>>;
152
+ /**
153
+ * Process order book entries from API format to OrderBookEntry format
154
+ * Match ts-frontend: processOrderBookEntries method
155
+ * @param entries Raw entries from API (array of [price, quantity, orderNum] or objects)
156
+ * @param side "bids" or "asks"
157
+ * @returns Processed OrderBookEntry array
158
+ */
159
+ private processOrderBookEntries;
160
+ /**
161
+ * Format wei value to normal units (18 decimals)
162
+ * Match ts-frontend: formatWeiToNormal function
163
+ * @param value Value in wei (string or number)
164
+ * @param decimals Number of decimals (default 18)
165
+ * @returns Formatted string in normal units
166
+ */
167
+ private formatWeiToNormal;
168
+ /**
169
+ * Get ticker information for a trading pair
170
+ * @param symbol Trading symbol (e.g., "BTC-PERP")
171
+ * @returns Ticker information response
172
+ * @example
173
+ * ```typescript
174
+ * const ticker = await sdk.getTicker("BTC-PERP");
175
+ * if (ticker.status && ticker.data) {
176
+ * console.log("Last Price:", ticker.data.lastPrice);
177
+ * console.log("24h Volume:", ticker.data.volume24h);
178
+ * console.log("24h Change:", ticker.data.rate24h);
179
+ * }
180
+ * ```
181
+ */
182
+ getTicker(symbol: string): Promise<SDKResponse<Ticker>>;
183
+ /**
184
+ * Transform raw TP/SL order data into SDK-friendly format
185
+ */
186
+ private transformPositionTpSlOrder;
187
+ /**
188
+ * Check whether TP/SL config should be submitted
189
+ */
190
+ private hasTpSlOrderConfig;
191
+ /**
192
+ * Determine if a numeric input is greater than zero
193
+ */
194
+ private isPositiveNumber;
195
+ /**
196
+ * Process ticker data from API format to Ticker format
197
+ * Keep all values in wei format - no conversion
198
+ * @param rawData Raw ticker data from API
199
+ * @returns Processed Ticker object
200
+ */
201
+ private processTickerData;
202
+ /**
203
+ * Get history orders (matches Java historyOrders)
204
+ * @param params History orders query parameters
205
+ */
206
+ getHistoryOrders(params?: HistoryOrdersParams): Promise<SDKResponse<PageResponse<HistoryOrder>>>;
207
+ /**
208
+ * Get funding settlements history (matches Java fundingSettlements)
209
+ * @param params Funding settlements query parameters
210
+ */
211
+ getFundingSettlements(params?: FundingSettlementsParams): Promise<SDKResponse<PageResponse<FundingSettlement>>>;
212
+ /**
213
+ * Get balance changes history (matches Java balanceChanges)
214
+ * @param params Balance changes query parameters
215
+ */
216
+ getBalanceChanges(params?: BalanceChangesParams): Promise<SDKResponse<PageResponse<BalanceChange>>>;
217
+ /**
218
+ * Get oracle price for a trading pair (matches Java oracle)
219
+ * @param symbol Trading symbol (e.g., "BTC-PERP")
220
+ * @returns Oracle price as string (in wei/base unit)
221
+ */
222
+ getOraclePrice(symbol: string): Promise<SDKResponse<string>>;
223
+ /**
224
+ * Add isolated margin to an existing position (on-chain)
225
+ * @param params Margin adjustment parameters
226
+ */
227
+ addMargin(params: MarginAdjustmentParams): Promise<SuiTransactionBlockResponse>;
228
+ /**
229
+ * Remove isolated margin from an existing position (on-chain)
230
+ * @param params Margin adjustment parameters
231
+ */
232
+ removeMargin(params: MarginAdjustmentParams): Promise<SuiTransactionBlockResponse>;
233
+ /**
234
+ * Build ExchangeOnChain call args for margin adjustments
235
+ */
236
+ private buildMarginCallArgs;
237
+ private getDeploymentPackageId;
238
+ private getDeploymentProtocolConfigId;
239
+ private buildMarginTransaction;
240
+ private buildUpdatePriceTransaction;
241
+ private buildMainnetPriceUpdateTransaction;
242
+ private buildTestnetPriceUpdateTransaction;
243
+ private getPriceInfoObjectId;
244
+ private getDeploymentMarket;
245
+ private resolvePriceFeedId;
246
+ private getCachedTradingPairs;
247
+ private ensurePythClients;
248
+ private extractOracleArrivalTime;
249
+ private extractClockTimeSeconds;
250
+ /**
251
+ * Resolve perpId from deployment data
252
+ */
253
+ private resolvePerpIdFromDeployment;
254
+ /**
255
+ * Set sub-account on-chain (authorize a sub-account address)
256
+ * @param subAddress Sub-account address to authorize
257
+ * @returns On-chain transaction result
258
+ */
259
+ setSubAccount(subAddress: string): Promise<SuiTransactionBlockResponse>;
260
+ /**
261
+ * Deposit to bank (fund account)
262
+ * Deposit USDC from wallet to exchange bank account for trading collateral
263
+ * @param amount Deposit amount in USDC (standard units, e.g., 10 means 10 USDC)
264
+ * @returns On-chain transaction result
265
+ * @example
266
+ * ```typescript
267
+ * const result = await sdk.depositToBank(100); // Deposit 100 USDC
268
+ * ```
269
+ */
270
+ depositToBank(amount: number): Promise<SuiTransactionBlockResponse>;
271
+ /**
272
+ * Withdraw from bank (withdraw funds)
273
+ * Withdraw USDC from exchange bank account back to wallet
274
+ * @param amount Withdraw amount in USDC (standard units, e.g., 50 means 50 USDC)
275
+ * @returns On-chain transaction result
276
+ * @example
277
+ * ```typescript
278
+ * const result = await sdk.withdrawFromBank(50); // Withdraw 50 USDC
279
+ * ```
280
+ */
281
+ withdrawFromBank(amount: number): Promise<SuiTransactionBlockResponse>;
282
+ /**
283
+ * Get all coin balances on-chain for the current wallet address
284
+ * @returns Array of coin balances with coinType and totalBalance
285
+ */
286
+ getAllBalances(): Promise<SDKResponse<{
287
+ coinType: string;
288
+ totalBalance: string;
289
+ }[]>>;
290
+ /**
291
+ * Get coin metadata (symbol, decimals, name) for a given coin type
292
+ * @param coinType Full coin type string (e.g., "0x2::sui::SUI")
293
+ */
294
+ getCoinMetadata(coinType: string): Promise<SDKResponse<{
295
+ decimals: number;
296
+ symbol: string;
297
+ name: string;
298
+ }>>;
299
+ }
300
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/sdk/sdk.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,2BAA2B,EAAkB,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAMnD,OAAO,EACL,WAAW,EACX,iBAAiB,EAEjB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,gBAAgB,EAEhB,SAAS,EAET,aAAa,EAGb,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EAEf,WAAW,EACX,MAAM,EACN,QAAQ,EAER,WAAW,EAEX,UAAU,EACX,MAAM,UAAU,CAAC;AAUlB;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAC,CAAU;IAC7B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,mBAAmB,C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C,2BAA2B;IAUnC;;;;OAIG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM;IAUtC;;;;;;;;;OASG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM;IAUlC;;;;;;;;;OASG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAUrC;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;IAS1F;;;OAGG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAWlH"}
@@ -0,0 +1,25 @@
1
+ import { ApiResponse } from "../types";
2
+ /**
3
+ * HTTP Client using curl to bypass Cloudflare TLS fingerprinting.
4
+ * Node.js's TLS stack produces a known JA3/JA4 fingerprint that Cloudflare
5
+ * blocks. System curl uses OpenSSL/SecureTransport with a different fingerprint.
6
+ */
7
+ export declare class HttpClient {
8
+ private baseURL;
9
+ private walletAddress?;
10
+ private authToken?;
11
+ private timeout;
12
+ constructor(baseURL: string);
13
+ private isPerpTradeApiUrl;
14
+ private isPublicEndpoint;
15
+ private buildHeaders;
16
+ private curlRequest;
17
+ setWalletAddress(address: string): void;
18
+ setAuthToken(token: string): void;
19
+ get<T = any>(url: string, config?: {
20
+ params?: Record<string, any>;
21
+ }): Promise<ApiResponse<T>>;
22
+ post<T = any>(url: string, data?: any): Promise<ApiResponse<T>>;
23
+ postForm<T = any>(url: string, data: Record<string, any>): Promise<ApiResponse<T>>;
24
+ }
25
+ //# sourceMappingURL=httpClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../../src/services/httpClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAc;gBAEjB,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,WAAW;IAmCnB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIvC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI3B,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAe7F,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAK/D,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CASzF"}