@numen-crypto/contract 0.2.1 → 0.2.2

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.d.ts CHANGED
@@ -143,18 +143,12 @@ declare const SessionInfoSchema: z.ZodObject<{
143
143
  }>;
144
144
  type SessionInfo = z.infer<typeof SessionInfoSchema>;
145
145
 
146
- /** All assets that can appear as a wallet balance. NMN is internal-only. */
147
146
  declare const ASSET_SYMBOLS: readonly ["NMN", "USDT", "BTC", "ETH", "BNB", "TRX", "SOL"];
148
147
  declare const AssetSymbolSchema: z.ZodEnum<["NMN", "USDT", "BTC", "ETH", "BNB", "TRX", "SOL"]>;
149
148
  type AssetSymbol = z.infer<typeof AssetSymbolSchema>;
150
- /**
151
- * Assets that can be deposited/withdrawn on-chain via SHKeeper.
152
- * NMN is excluded — it only exists inside the platform and is acquired via swap.
153
- */
154
149
  declare const DEPOSITABLE_ASSETS: readonly ["USDT", "BTC", "ETH", "BNB", "TRX", "SOL"];
155
150
  declare const DepositableAssetSchema: z.ZodEnum<["USDT", "BTC", "ETH", "BNB", "TRX", "SOL"]>;
156
151
  type DepositableAsset = z.infer<typeof DepositableAssetSchema>;
157
- /** The internal token and the funding stablecoin. */
158
152
  declare const TOKEN_ASSET: "NMN";
159
153
  declare const FUNDING_ASSET: "USDT";
160
154
  declare const AssetBalanceSchema: z.ZodObject<{
@@ -1380,10 +1374,6 @@ declare namespace GetTokenChartCommand {
1380
1374
 
1381
1375
  declare namespace SwapCommand {
1382
1376
  const endpointDetails: EndpointDetails;
1383
- /**
1384
- * For BUY, `amount` is the USDT spent. For SELL, `amount` is the NMN sold.
1385
- * `maxPrice` (optional) — slippage guard; reject if the live price exceeds it.
1386
- */
1387
1377
  const RequestSchema: z.ZodObject<{
1388
1378
  side: z.ZodEnum<["BUY", "SELL"]>;
1389
1379
  amount: z.ZodEffects<z.ZodString, string, string>;
@@ -1426,6 +1416,437 @@ declare namespace SwapCommand {
1426
1416
  type Response = z.infer<typeof ResponseSchema>;
1427
1417
  }
1428
1418
 
1419
+ declare const OrderSideSchema: z.ZodEnum<["BUY", "SELL"]>;
1420
+ type OrderSide = z.infer<typeof OrderSideSchema>;
1421
+ declare const OrderTypeSchema: z.ZodEnum<["LIMIT", "MARKET"]>;
1422
+ type OrderType = z.infer<typeof OrderTypeSchema>;
1423
+ declare const OrderStatusSchema: z.ZodEnum<["OPEN", "PARTIAL", "FILLED", "CANCELLED"]>;
1424
+ type OrderStatus = z.infer<typeof OrderStatusSchema>;
1425
+ declare const OrderSchema: z.ZodObject<{
1426
+ id: z.ZodString;
1427
+ side: z.ZodEnum<["BUY", "SELL"]>;
1428
+ type: z.ZodEnum<["LIMIT", "MARKET"]>;
1429
+ price: z.ZodString;
1430
+ quantity: z.ZodString;
1431
+ filled: z.ZodString;
1432
+ remaining: z.ZodString;
1433
+ avgPrice: z.ZodString;
1434
+ status: z.ZodEnum<["OPEN", "PARTIAL", "FILLED", "CANCELLED"]>;
1435
+ createdAt: z.ZodString;
1436
+ }, "strip", z.ZodTypeAny, {
1437
+ type: "LIMIT" | "MARKET";
1438
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1439
+ id: string;
1440
+ createdAt: string;
1441
+ price: string;
1442
+ side: "BUY" | "SELL";
1443
+ quantity: string;
1444
+ filled: string;
1445
+ remaining: string;
1446
+ avgPrice: string;
1447
+ }, {
1448
+ type: "LIMIT" | "MARKET";
1449
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1450
+ id: string;
1451
+ createdAt: string;
1452
+ price: string;
1453
+ side: "BUY" | "SELL";
1454
+ quantity: string;
1455
+ filled: string;
1456
+ remaining: string;
1457
+ avgPrice: string;
1458
+ }>;
1459
+ type Order = z.infer<typeof OrderSchema>;
1460
+ declare const OrderBookLevelSchema: z.ZodObject<{
1461
+ price: z.ZodString;
1462
+ quantity: z.ZodString;
1463
+ orders: z.ZodNumber;
1464
+ total: z.ZodString;
1465
+ }, "strip", z.ZodTypeAny, {
1466
+ total: string;
1467
+ price: string;
1468
+ quantity: string;
1469
+ orders: number;
1470
+ }, {
1471
+ total: string;
1472
+ price: string;
1473
+ quantity: string;
1474
+ orders: number;
1475
+ }>;
1476
+ type OrderBookLevel = z.infer<typeof OrderBookLevelSchema>;
1477
+ declare const OrderBookSchema: z.ZodObject<{
1478
+ price: z.ZodString;
1479
+ asks: z.ZodArray<z.ZodObject<{
1480
+ price: z.ZodString;
1481
+ quantity: z.ZodString;
1482
+ orders: z.ZodNumber;
1483
+ total: z.ZodString;
1484
+ }, "strip", z.ZodTypeAny, {
1485
+ total: string;
1486
+ price: string;
1487
+ quantity: string;
1488
+ orders: number;
1489
+ }, {
1490
+ total: string;
1491
+ price: string;
1492
+ quantity: string;
1493
+ orders: number;
1494
+ }>, "many">;
1495
+ bids: z.ZodArray<z.ZodObject<{
1496
+ price: z.ZodString;
1497
+ quantity: z.ZodString;
1498
+ orders: z.ZodNumber;
1499
+ total: z.ZodString;
1500
+ }, "strip", z.ZodTypeAny, {
1501
+ total: string;
1502
+ price: string;
1503
+ quantity: string;
1504
+ orders: number;
1505
+ }, {
1506
+ total: string;
1507
+ price: string;
1508
+ quantity: string;
1509
+ orders: number;
1510
+ }>, "many">;
1511
+ updatedAt: z.ZodString;
1512
+ }, "strip", z.ZodTypeAny, {
1513
+ price: string;
1514
+ updatedAt: string;
1515
+ asks: {
1516
+ total: string;
1517
+ price: string;
1518
+ quantity: string;
1519
+ orders: number;
1520
+ }[];
1521
+ bids: {
1522
+ total: string;
1523
+ price: string;
1524
+ quantity: string;
1525
+ orders: number;
1526
+ }[];
1527
+ }, {
1528
+ price: string;
1529
+ updatedAt: string;
1530
+ asks: {
1531
+ total: string;
1532
+ price: string;
1533
+ quantity: string;
1534
+ orders: number;
1535
+ }[];
1536
+ bids: {
1537
+ total: string;
1538
+ price: string;
1539
+ quantity: string;
1540
+ orders: number;
1541
+ }[];
1542
+ }>;
1543
+ type OrderBook = z.infer<typeof OrderBookSchema>;
1544
+ declare const PublicTradeSchema: z.ZodObject<{
1545
+ id: z.ZodString;
1546
+ side: z.ZodEnum<["BUY", "SELL"]>;
1547
+ price: z.ZodString;
1548
+ nmnAmount: z.ZodString;
1549
+ usdtAmount: z.ZodString;
1550
+ createdAt: z.ZodString;
1551
+ }, "strip", z.ZodTypeAny, {
1552
+ id: string;
1553
+ createdAt: string;
1554
+ price: string;
1555
+ side: "BUY" | "SELL";
1556
+ usdtAmount: string;
1557
+ nmnAmount: string;
1558
+ }, {
1559
+ id: string;
1560
+ createdAt: string;
1561
+ price: string;
1562
+ side: "BUY" | "SELL";
1563
+ usdtAmount: string;
1564
+ nmnAmount: string;
1565
+ }>;
1566
+ type PublicTrade = z.infer<typeof PublicTradeSchema>;
1567
+
1568
+ declare namespace PlaceOrderCommand {
1569
+ const endpointDetails: EndpointDetails;
1570
+ const RequestSchema: z.ZodEffects<z.ZodObject<{
1571
+ side: z.ZodEnum<["BUY", "SELL"]>;
1572
+ type: z.ZodDefault<z.ZodEnum<["LIMIT", "MARKET"]>>;
1573
+ price: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1574
+ quantity: z.ZodEffects<z.ZodString, string, string>;
1575
+ idempotencyKey: z.ZodString;
1576
+ }, "strip", z.ZodTypeAny, {
1577
+ type: "LIMIT" | "MARKET";
1578
+ side: "BUY" | "SELL";
1579
+ idempotencyKey: string;
1580
+ quantity: string;
1581
+ price?: string | undefined;
1582
+ }, {
1583
+ side: "BUY" | "SELL";
1584
+ idempotencyKey: string;
1585
+ quantity: string;
1586
+ type?: "LIMIT" | "MARKET" | undefined;
1587
+ price?: string | undefined;
1588
+ }>, {
1589
+ type: "LIMIT" | "MARKET";
1590
+ side: "BUY" | "SELL";
1591
+ idempotencyKey: string;
1592
+ quantity: string;
1593
+ price?: string | undefined;
1594
+ }, {
1595
+ side: "BUY" | "SELL";
1596
+ idempotencyKey: string;
1597
+ quantity: string;
1598
+ type?: "LIMIT" | "MARKET" | undefined;
1599
+ price?: string | undefined;
1600
+ }>;
1601
+ type Request = z.infer<typeof RequestSchema>;
1602
+ const ResponseSchema: z.ZodObject<{
1603
+ order: z.ZodObject<{
1604
+ id: z.ZodString;
1605
+ side: z.ZodEnum<["BUY", "SELL"]>;
1606
+ type: z.ZodEnum<["LIMIT", "MARKET"]>;
1607
+ price: z.ZodString;
1608
+ quantity: z.ZodString;
1609
+ filled: z.ZodString;
1610
+ remaining: z.ZodString;
1611
+ avgPrice: z.ZodString;
1612
+ status: z.ZodEnum<["OPEN", "PARTIAL", "FILLED", "CANCELLED"]>;
1613
+ createdAt: z.ZodString;
1614
+ }, "strip", z.ZodTypeAny, {
1615
+ type: "LIMIT" | "MARKET";
1616
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1617
+ id: string;
1618
+ createdAt: string;
1619
+ price: string;
1620
+ side: "BUY" | "SELL";
1621
+ quantity: string;
1622
+ filled: string;
1623
+ remaining: string;
1624
+ avgPrice: string;
1625
+ }, {
1626
+ type: "LIMIT" | "MARKET";
1627
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1628
+ id: string;
1629
+ createdAt: string;
1630
+ price: string;
1631
+ side: "BUY" | "SELL";
1632
+ quantity: string;
1633
+ filled: string;
1634
+ remaining: string;
1635
+ avgPrice: string;
1636
+ }>;
1637
+ trades: z.ZodArray<z.ZodObject<{
1638
+ id: z.ZodString;
1639
+ side: z.ZodEnum<["BUY", "SELL"]>;
1640
+ price: z.ZodString;
1641
+ nmnAmount: z.ZodString;
1642
+ usdtAmount: z.ZodString;
1643
+ createdAt: z.ZodString;
1644
+ }, "strip", z.ZodTypeAny, {
1645
+ id: string;
1646
+ createdAt: string;
1647
+ price: string;
1648
+ side: "BUY" | "SELL";
1649
+ usdtAmount: string;
1650
+ nmnAmount: string;
1651
+ }, {
1652
+ id: string;
1653
+ createdAt: string;
1654
+ price: string;
1655
+ side: "BUY" | "SELL";
1656
+ usdtAmount: string;
1657
+ nmnAmount: string;
1658
+ }>, "many">;
1659
+ }, "strip", z.ZodTypeAny, {
1660
+ order: {
1661
+ type: "LIMIT" | "MARKET";
1662
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1663
+ id: string;
1664
+ createdAt: string;
1665
+ price: string;
1666
+ side: "BUY" | "SELL";
1667
+ quantity: string;
1668
+ filled: string;
1669
+ remaining: string;
1670
+ avgPrice: string;
1671
+ };
1672
+ trades: {
1673
+ id: string;
1674
+ createdAt: string;
1675
+ price: string;
1676
+ side: "BUY" | "SELL";
1677
+ usdtAmount: string;
1678
+ nmnAmount: string;
1679
+ }[];
1680
+ }, {
1681
+ order: {
1682
+ type: "LIMIT" | "MARKET";
1683
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1684
+ id: string;
1685
+ createdAt: string;
1686
+ price: string;
1687
+ side: "BUY" | "SELL";
1688
+ quantity: string;
1689
+ filled: string;
1690
+ remaining: string;
1691
+ avgPrice: string;
1692
+ };
1693
+ trades: {
1694
+ id: string;
1695
+ createdAt: string;
1696
+ price: string;
1697
+ side: "BUY" | "SELL";
1698
+ usdtAmount: string;
1699
+ nmnAmount: string;
1700
+ }[];
1701
+ }>;
1702
+ type Response = z.infer<typeof ResponseSchema>;
1703
+ }
1704
+ declare namespace CancelOrderCommand {
1705
+ const endpointDetails: EndpointDetails;
1706
+ const ResponseSchema: z.ZodObject<{
1707
+ cancelled: z.ZodBoolean;
1708
+ }, "strip", z.ZodTypeAny, {
1709
+ cancelled: boolean;
1710
+ }, {
1711
+ cancelled: boolean;
1712
+ }>;
1713
+ type Response = z.infer<typeof ResponseSchema>;
1714
+ }
1715
+ declare namespace ListMyOrdersCommand {
1716
+ const endpointDetails: EndpointDetails;
1717
+ const ResponseSchema: z.ZodArray<z.ZodObject<{
1718
+ id: z.ZodString;
1719
+ side: z.ZodEnum<["BUY", "SELL"]>;
1720
+ type: z.ZodEnum<["LIMIT", "MARKET"]>;
1721
+ price: z.ZodString;
1722
+ quantity: z.ZodString;
1723
+ filled: z.ZodString;
1724
+ remaining: z.ZodString;
1725
+ avgPrice: z.ZodString;
1726
+ status: z.ZodEnum<["OPEN", "PARTIAL", "FILLED", "CANCELLED"]>;
1727
+ createdAt: z.ZodString;
1728
+ }, "strip", z.ZodTypeAny, {
1729
+ type: "LIMIT" | "MARKET";
1730
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1731
+ id: string;
1732
+ createdAt: string;
1733
+ price: string;
1734
+ side: "BUY" | "SELL";
1735
+ quantity: string;
1736
+ filled: string;
1737
+ remaining: string;
1738
+ avgPrice: string;
1739
+ }, {
1740
+ type: "LIMIT" | "MARKET";
1741
+ status: "CANCELLED" | "OPEN" | "PARTIAL" | "FILLED";
1742
+ id: string;
1743
+ createdAt: string;
1744
+ price: string;
1745
+ side: "BUY" | "SELL";
1746
+ quantity: string;
1747
+ filled: string;
1748
+ remaining: string;
1749
+ avgPrice: string;
1750
+ }>, "many">;
1751
+ type Response = z.infer<typeof ResponseSchema>;
1752
+ }
1753
+ declare namespace GetOrderBookCommand {
1754
+ const endpointDetails: EndpointDetails;
1755
+ const ResponseSchema: z.ZodObject<{
1756
+ price: z.ZodString;
1757
+ asks: z.ZodArray<z.ZodObject<{
1758
+ price: z.ZodString;
1759
+ quantity: z.ZodString;
1760
+ orders: z.ZodNumber;
1761
+ total: z.ZodString;
1762
+ }, "strip", z.ZodTypeAny, {
1763
+ total: string;
1764
+ price: string;
1765
+ quantity: string;
1766
+ orders: number;
1767
+ }, {
1768
+ total: string;
1769
+ price: string;
1770
+ quantity: string;
1771
+ orders: number;
1772
+ }>, "many">;
1773
+ bids: z.ZodArray<z.ZodObject<{
1774
+ price: z.ZodString;
1775
+ quantity: z.ZodString;
1776
+ orders: z.ZodNumber;
1777
+ total: z.ZodString;
1778
+ }, "strip", z.ZodTypeAny, {
1779
+ total: string;
1780
+ price: string;
1781
+ quantity: string;
1782
+ orders: number;
1783
+ }, {
1784
+ total: string;
1785
+ price: string;
1786
+ quantity: string;
1787
+ orders: number;
1788
+ }>, "many">;
1789
+ updatedAt: z.ZodString;
1790
+ }, "strip", z.ZodTypeAny, {
1791
+ price: string;
1792
+ updatedAt: string;
1793
+ asks: {
1794
+ total: string;
1795
+ price: string;
1796
+ quantity: string;
1797
+ orders: number;
1798
+ }[];
1799
+ bids: {
1800
+ total: string;
1801
+ price: string;
1802
+ quantity: string;
1803
+ orders: number;
1804
+ }[];
1805
+ }, {
1806
+ price: string;
1807
+ updatedAt: string;
1808
+ asks: {
1809
+ total: string;
1810
+ price: string;
1811
+ quantity: string;
1812
+ orders: number;
1813
+ }[];
1814
+ bids: {
1815
+ total: string;
1816
+ price: string;
1817
+ quantity: string;
1818
+ orders: number;
1819
+ }[];
1820
+ }>;
1821
+ type Response = z.infer<typeof ResponseSchema>;
1822
+ }
1823
+ declare namespace ListTradesCommand {
1824
+ const endpointDetails: EndpointDetails;
1825
+ const ResponseSchema: z.ZodArray<z.ZodObject<{
1826
+ id: z.ZodString;
1827
+ side: z.ZodEnum<["BUY", "SELL"]>;
1828
+ price: z.ZodString;
1829
+ nmnAmount: z.ZodString;
1830
+ usdtAmount: z.ZodString;
1831
+ createdAt: z.ZodString;
1832
+ }, "strip", z.ZodTypeAny, {
1833
+ id: string;
1834
+ createdAt: string;
1835
+ price: string;
1836
+ side: "BUY" | "SELL";
1837
+ usdtAmount: string;
1838
+ nmnAmount: string;
1839
+ }, {
1840
+ id: string;
1841
+ createdAt: string;
1842
+ price: string;
1843
+ side: "BUY" | "SELL";
1844
+ usdtAmount: string;
1845
+ nmnAmount: string;
1846
+ }>, "many">;
1847
+ type Response = z.infer<typeof ResponseSchema>;
1848
+ }
1849
+
1429
1850
  declare namespace GetPartnersCommand {
1430
1851
  const endpointDetails: EndpointDetails;
1431
1852
  const ResponseSchema: zod.ZodObject<{
@@ -2386,7 +2807,6 @@ declare const TicketStatusSchema: z.ZodEnum<["open", "pending", "answered", "res
2386
2807
  type TicketStatus = z.infer<typeof TicketStatusSchema>;
2387
2808
  declare const TicketAuthorTypeSchema: z.ZodEnum<["user", "support"]>;
2388
2809
  type TicketAuthorType = z.infer<typeof TicketAuthorTypeSchema>;
2389
- /** Rich-text body (sanitized HTML), size-capped. */
2390
2810
  declare const TicketBodySchema: z.ZodString;
2391
2811
  declare const TicketAttachmentSchema: z.ZodObject<{
2392
2812
  id: z.ZodString;
@@ -2580,7 +3000,6 @@ declare const TicketDetailSchema: z.ZodObject<{
2580
3000
  }[];
2581
3001
  }>;
2582
3002
  type TicketDetail = z.infer<typeof TicketDetailSchema>;
2583
- /** Attachment reference returned by the upload-url flow and sent when posting a message. */
2584
3003
  declare const TicketAttachmentInputSchema: z.ZodObject<{
2585
3004
  fileKey: z.ZodString;
2586
3005
  fileName: z.ZodString;
@@ -3079,6 +3498,12 @@ declare const REST_API: {
3079
3498
  readonly SWAP: {
3080
3499
  readonly EXECUTE: "/swap";
3081
3500
  };
3501
+ readonly EXCHANGE: {
3502
+ readonly ORDERBOOK: "/exchange/orderbook";
3503
+ readonly TRADES: "/exchange/trades";
3504
+ readonly ORDERS: "/exchange/orders";
3505
+ readonly ORDER: "/exchange/orders/:id";
3506
+ };
3082
3507
  readonly PARTNERS: {
3083
3508
  readonly OVERVIEW: "/partners";
3084
3509
  };
@@ -3131,4 +3556,4 @@ declare const REST_API: {
3131
3556
  declare const API_PREFIX = "/api";
3132
3557
  declare const API_VERSION = "v1";
3133
3558
 
3134
- export { API_PREFIX, API_VERSION, ASSET_SYMBOLS, AVATAR_CONTENT_TYPES, type AssetBalance, AssetBalanceSchema, type AssetSymbol, AssetSymbolSchema, AvatarContentTypeSchema, AvatarUploadUrlCommand, CancelWithdrawalCommand, type ChartPeriod, ChartPeriodSchema, type ChartPoint, ChartPointSchema, ClaimDailyBonusCommand, ConfirmEmailChangeCommand, ConfirmTotpCommand, ConfirmWithdrawalCommand, CreateTicketCommand, DEPOSITABLE_ASSETS, type DailyBonusClaimResult, DailyBonusClaimResultSchema, type DailyBonusDay, DailyBonusDaySchema, type DailyBonusStatus, DailyBonusStatusSchema, type DepositAddress, DepositAddressCommand, DepositAddressSchema, type DepositableAsset, DepositableAssetSchema, DisableTotpCommand, ERROR_CODE, type EarningsOverview, EarningsOverviewSchema, type EndpointDetails, type ErrorCode, type ErrorResponse, ErrorResponseSchema, FUNDING_ASSET, GetDailyBonusCommand, GetEarningsCommand, GetIncomeCommand, GetLeaderboardCommand, GetPartnersCommand, GetRanksCommand, GetSettingsCommand, GetTicketCommand, GetTokenChartCommand, GetTokenPriceCommand, GetTransactionsCommand, GetWalletCommand, type HttpMethod, type IncomeOverview, IncomeOverviewSchema, type IncomePeriod, IncomePeriodSchema, type Leaderboard, type LeaderboardEntry, LeaderboardEntrySchema, type LeaderboardPeriod, LeaderboardPeriodSchema, LeaderboardSchema, LinkGoogleCommand, type LinkProvider, LinkProviderSchema, LinkTelegramCommand, type LinkedAccount, LinkedAccountSchema, ListLinkedAccountsCommand, ListNotificationsCommand, ListTicketsCommand, ListWithdrawalsCommand, LoginCommand, LogoutCommand, MONEY_REGEX, MarkNotificationsReadCommand, MeCommand, MoneyStringSchema, type MonthlyPricePoint, MonthlyPricePointSchema, type Notification, NotificationSchema, type NotificationType, NotificationTypeSchema, PaginatedSchema, type PaginationQuery, PaginationQuerySchema, type PartnerAccrual, PartnerAccrualSchema, type PartnerLevel, PartnerLevelSchema, type PartnersOverview, PartnersOverviewSchema, PositiveMoneyStringSchema, REST_API, type RankDef, RankDefSchema, RegisterCommand, ReplyTicketCommand, RequestEmailChangeCommand, RequestWithdrawalCommand, type SessionInfo, SessionInfoSchema, SetupTotpCommand, SwapCommand, type SwapSide, SwapSideSchema, TICKET_CATEGORIES, TOKEN_ASSET, type TicketAttachment, type TicketAttachmentInput, TicketAttachmentInputSchema, TicketAttachmentSchema, TicketAttachmentUploadCommand, type TicketAuthorType, TicketAuthorTypeSchema, TicketBodySchema, type TicketCategory, TicketCategorySchema, type TicketDetail, TicketDetailSchema, type TicketMessage, TicketMessageSchema, type TicketStatus, TicketStatusSchema, type TicketSummary, TicketSummarySchema, type TokenPrice, TokenPriceSchema, type TradeResult, TradeResultSchema, type Transaction, TransactionSchema, type TransactionStatus, TransactionStatusSchema, type TransactionType, TransactionTypeSchema, UnlinkAccountCommand, UpdateProfileCommand, UpdateSettingsCommand, type UserProfile, UserProfileSchema, type UserRank, UserRankSchema, type UserSettings, UserSettingsSchema, type UserStatus, UserStatusSchema, UuidSchema, type WalletOverview, WalletOverviewSchema, type Withdrawal, WithdrawalSchema, type WithdrawalStatus, WithdrawalStatusSchema, endpoint };
3559
+ export { API_PREFIX, API_VERSION, ASSET_SYMBOLS, AVATAR_CONTENT_TYPES, type AssetBalance, AssetBalanceSchema, type AssetSymbol, AssetSymbolSchema, AvatarContentTypeSchema, AvatarUploadUrlCommand, CancelOrderCommand, CancelWithdrawalCommand, type ChartPeriod, ChartPeriodSchema, type ChartPoint, ChartPointSchema, ClaimDailyBonusCommand, ConfirmEmailChangeCommand, ConfirmTotpCommand, ConfirmWithdrawalCommand, CreateTicketCommand, DEPOSITABLE_ASSETS, type DailyBonusClaimResult, DailyBonusClaimResultSchema, type DailyBonusDay, DailyBonusDaySchema, type DailyBonusStatus, DailyBonusStatusSchema, type DepositAddress, DepositAddressCommand, DepositAddressSchema, type DepositableAsset, DepositableAssetSchema, DisableTotpCommand, ERROR_CODE, type EarningsOverview, EarningsOverviewSchema, type EndpointDetails, type ErrorCode, type ErrorResponse, ErrorResponseSchema, FUNDING_ASSET, GetDailyBonusCommand, GetEarningsCommand, GetIncomeCommand, GetLeaderboardCommand, GetOrderBookCommand, GetPartnersCommand, GetRanksCommand, GetSettingsCommand, GetTicketCommand, GetTokenChartCommand, GetTokenPriceCommand, GetTransactionsCommand, GetWalletCommand, type HttpMethod, type IncomeOverview, IncomeOverviewSchema, type IncomePeriod, IncomePeriodSchema, type Leaderboard, type LeaderboardEntry, LeaderboardEntrySchema, type LeaderboardPeriod, LeaderboardPeriodSchema, LeaderboardSchema, LinkGoogleCommand, type LinkProvider, LinkProviderSchema, LinkTelegramCommand, type LinkedAccount, LinkedAccountSchema, ListLinkedAccountsCommand, ListMyOrdersCommand, ListNotificationsCommand, ListTicketsCommand, ListTradesCommand, ListWithdrawalsCommand, LoginCommand, LogoutCommand, MONEY_REGEX, MarkNotificationsReadCommand, MeCommand, MoneyStringSchema, type MonthlyPricePoint, MonthlyPricePointSchema, type Notification, NotificationSchema, type NotificationType, NotificationTypeSchema, type Order, type OrderBook, type OrderBookLevel, OrderBookLevelSchema, OrderBookSchema, OrderSchema, type OrderSide, OrderSideSchema, type OrderStatus, OrderStatusSchema, type OrderType, OrderTypeSchema, PaginatedSchema, type PaginationQuery, PaginationQuerySchema, type PartnerAccrual, PartnerAccrualSchema, type PartnerLevel, PartnerLevelSchema, type PartnersOverview, PartnersOverviewSchema, PlaceOrderCommand, PositiveMoneyStringSchema, type PublicTrade, PublicTradeSchema, REST_API, type RankDef, RankDefSchema, RegisterCommand, ReplyTicketCommand, RequestEmailChangeCommand, RequestWithdrawalCommand, type SessionInfo, SessionInfoSchema, SetupTotpCommand, SwapCommand, type SwapSide, SwapSideSchema, TICKET_CATEGORIES, TOKEN_ASSET, type TicketAttachment, type TicketAttachmentInput, TicketAttachmentInputSchema, TicketAttachmentSchema, TicketAttachmentUploadCommand, type TicketAuthorType, TicketAuthorTypeSchema, TicketBodySchema, type TicketCategory, TicketCategorySchema, type TicketDetail, TicketDetailSchema, type TicketMessage, TicketMessageSchema, type TicketStatus, TicketStatusSchema, type TicketSummary, TicketSummarySchema, type TokenPrice, TokenPriceSchema, type TradeResult, TradeResultSchema, type Transaction, TransactionSchema, type TransactionStatus, TransactionStatusSchema, type TransactionType, TransactionTypeSchema, UnlinkAccountCommand, UpdateProfileCommand, UpdateSettingsCommand, type UserProfile, UserProfileSchema, type UserRank, UserRankSchema, type UserSettings, UserSettingsSchema, type UserStatus, UserStatusSchema, UuidSchema, type WalletOverview, WalletOverviewSchema, type Withdrawal, WithdrawalSchema, type WithdrawalStatus, WithdrawalStatusSchema, endpoint };
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@ import { z } from 'zod';
2
2
 
3
3
  // src/constants/error-codes.ts
4
4
  var ERROR_CODE = {
5
- // generic
6
5
  VALIDATION: "VALIDATION",
7
6
  NOT_FOUND: "NOT_FOUND",
8
7
  CONFLICT: "CONFLICT",
@@ -10,7 +9,6 @@ var ERROR_CODE = {
10
9
  FORBIDDEN: "FORBIDDEN",
11
10
  RATE_LIMITED: "RATE_LIMITED",
12
11
  INTERNAL: "INTERNAL",
13
- // auth
14
12
  EMAIL_TAKEN: "EMAIL_TAKEN",
15
13
  REFERRER_NOT_FOUND: "REFERRER_NOT_FOUND",
16
14
  INVALID_CREDENTIALS: "INVALID_CREDENTIALS",
@@ -18,14 +16,11 @@ var ERROR_CODE = {
18
16
  SESSION_EXPIRED: "SESSION_EXPIRED",
19
17
  TOTP_REQUIRED: "TOTP_REQUIRED",
20
18
  TOTP_ALREADY_ENABLED: "TOTP_ALREADY_ENABLED",
21
- // wallet / purchase / withdrawal (reserved for next slices)
22
19
  INSUFFICIENT_BALANCE: "INSUFFICIENT_BALANCE",
23
20
  PURCHASE_LIMIT_EXCEEDED: "PURCHASE_LIMIT_EXCEEDED",
24
21
  SALE_PHASE_INACTIVE: "SALE_PHASE_INACTIVE",
25
22
  WITHDRAWAL_COOLOFF: "WITHDRAWAL_COOLOFF",
26
- // bonus
27
23
  BONUS_ALREADY_CLAIMED: "BONUS_ALREADY_CLAIMED",
28
- // account linking
29
24
  LINK_PROVIDER_DISABLED: "LINK_PROVIDER_DISABLED",
30
25
  LINK_VERIFICATION_FAILED: "LINK_VERIFICATION_FAILED",
31
26
  LINK_ALREADY_USED: "LINK_ALREADY_USED"
@@ -105,13 +100,7 @@ var TransactionTypeSchema = z.enum([
105
100
  "BONUS",
106
101
  "ADJUSTMENT"
107
102
  ]);
108
- var TransactionStatusSchema = z.enum([
109
- "PENDING",
110
- "PROCESSING",
111
- "COMPLETED",
112
- "FAILED",
113
- "CANCELLED"
114
- ]);
103
+ var TransactionStatusSchema = z.enum(["PENDING", "PROCESSING", "COMPLETED", "FAILED", "CANCELLED"]);
115
104
  var TransactionSchema = z.object({
116
105
  id: z.string().uuid(),
117
106
  type: TransactionTypeSchema,
@@ -407,6 +396,79 @@ var SwapCommand;
407
396
  });
408
397
  SwapCommand2.ResponseSchema = TradeResultSchema;
409
398
  })(SwapCommand || (SwapCommand = {}));
399
+ var OrderSideSchema = z.enum(["BUY", "SELL"]);
400
+ var OrderTypeSchema = z.enum(["LIMIT", "MARKET"]);
401
+ var OrderStatusSchema = z.enum(["OPEN", "PARTIAL", "FILLED", "CANCELLED"]);
402
+ var OrderSchema = z.object({
403
+ id: UuidSchema,
404
+ side: OrderSideSchema,
405
+ type: OrderTypeSchema,
406
+ price: MoneyStringSchema,
407
+ quantity: MoneyStringSchema,
408
+ filled: MoneyStringSchema,
409
+ remaining: MoneyStringSchema,
410
+ avgPrice: MoneyStringSchema,
411
+ status: OrderStatusSchema,
412
+ createdAt: z.string().datetime()
413
+ });
414
+ var OrderBookLevelSchema = z.object({
415
+ price: MoneyStringSchema,
416
+ quantity: MoneyStringSchema,
417
+ orders: z.number().int().nonnegative(),
418
+ total: MoneyStringSchema
419
+ });
420
+ var OrderBookSchema = z.object({
421
+ price: MoneyStringSchema,
422
+ asks: z.array(OrderBookLevelSchema),
423
+ bids: z.array(OrderBookLevelSchema),
424
+ updatedAt: z.string().datetime()
425
+ });
426
+ var PublicTradeSchema = z.object({
427
+ id: UuidSchema,
428
+ side: OrderSideSchema,
429
+ price: MoneyStringSchema,
430
+ nmnAmount: MoneyStringSchema,
431
+ usdtAmount: MoneyStringSchema,
432
+ createdAt: z.string().datetime()
433
+ });
434
+ var PlaceOrderCommand;
435
+ ((PlaceOrderCommand2) => {
436
+ PlaceOrderCommand2.endpointDetails = endpoint("POST", "/exchange/orders", "Place a limit or market order");
437
+ PlaceOrderCommand2.RequestSchema = z.object({
438
+ side: OrderSideSchema,
439
+ type: OrderTypeSchema.default("LIMIT"),
440
+ price: PositiveMoneyStringSchema.optional(),
441
+ quantity: PositiveMoneyStringSchema,
442
+ idempotencyKey: z.string().min(8).max(128)
443
+ }).refine((v) => v.type === "MARKET" || v.price !== void 0, {
444
+ message: "price is required for a limit order",
445
+ path: ["price"]
446
+ });
447
+ PlaceOrderCommand2.ResponseSchema = z.object({
448
+ order: OrderSchema,
449
+ trades: z.array(PublicTradeSchema)
450
+ });
451
+ })(PlaceOrderCommand || (PlaceOrderCommand = {}));
452
+ var CancelOrderCommand;
453
+ ((CancelOrderCommand2) => {
454
+ CancelOrderCommand2.endpointDetails = endpoint("DELETE", "/exchange/orders/:id", "Cancel an open order");
455
+ CancelOrderCommand2.ResponseSchema = z.object({ cancelled: z.boolean() });
456
+ })(CancelOrderCommand || (CancelOrderCommand = {}));
457
+ var ListMyOrdersCommand;
458
+ ((ListMyOrdersCommand2) => {
459
+ ListMyOrdersCommand2.endpointDetails = endpoint("GET", "/exchange/orders", "List my open and recent orders");
460
+ ListMyOrdersCommand2.ResponseSchema = z.array(OrderSchema);
461
+ })(ListMyOrdersCommand || (ListMyOrdersCommand = {}));
462
+ var GetOrderBookCommand;
463
+ ((GetOrderBookCommand2) => {
464
+ GetOrderBookCommand2.endpointDetails = endpoint("GET", "/exchange/orderbook", "Aggregated order book with floor price");
465
+ GetOrderBookCommand2.ResponseSchema = OrderBookSchema;
466
+ })(GetOrderBookCommand || (GetOrderBookCommand = {}));
467
+ var ListTradesCommand;
468
+ ((ListTradesCommand2) => {
469
+ ListTradesCommand2.endpointDetails = endpoint("GET", "/exchange/trades", "Recent public trade tape");
470
+ ListTradesCommand2.ResponseSchema = z.array(PublicTradeSchema);
471
+ })(ListTradesCommand || (ListTradesCommand = {}));
410
472
 
411
473
  // src/commands/partners/get-partners.command.ts
412
474
  var GetPartnersCommand;
@@ -459,7 +521,11 @@ var CancelWithdrawalCommand;
459
521
  })(CancelWithdrawalCommand || (CancelWithdrawalCommand = {}));
460
522
  var ConfirmWithdrawalCommand;
461
523
  ((ConfirmWithdrawalCommand2) => {
462
- ConfirmWithdrawalCommand2.endpointDetails = endpoint("POST", "/withdrawals/:id/confirm", "Confirm a withdrawal with the email token");
524
+ ConfirmWithdrawalCommand2.endpointDetails = endpoint(
525
+ "POST",
526
+ "/withdrawals/:id/confirm",
527
+ "Confirm a withdrawal with the email token"
528
+ );
463
529
  ConfirmWithdrawalCommand2.RequestSchema = z.object({
464
530
  token: z.string().min(6).max(128)
465
531
  });
@@ -586,7 +652,11 @@ var ListLinkedAccountsCommand;
586
652
  })(ListLinkedAccountsCommand || (ListLinkedAccountsCommand = {}));
587
653
  var LinkTelegramCommand;
588
654
  ((LinkTelegramCommand2) => {
589
- LinkTelegramCommand2.endpointDetails = endpoint("POST", "/settings/link/telegram", "Link a Telegram account (login widget)");
655
+ LinkTelegramCommand2.endpointDetails = endpoint(
656
+ "POST",
657
+ "/settings/link/telegram",
658
+ "Link a Telegram account (login widget)"
659
+ );
590
660
  LinkTelegramCommand2.RequestSchema = z.object({
591
661
  id: z.union([z.number(), z.string()]),
592
662
  auth_date: z.union([z.number(), z.string()]),
@@ -717,6 +787,12 @@ var REST_API = {
717
787
  SWAP: {
718
788
  EXECUTE: "/swap"
719
789
  },
790
+ EXCHANGE: {
791
+ ORDERBOOK: "/exchange/orderbook",
792
+ TRADES: "/exchange/trades",
793
+ ORDERS: "/exchange/orders",
794
+ ORDER: "/exchange/orders/:id"
795
+ },
720
796
  PARTNERS: {
721
797
  OVERVIEW: "/partners"
722
798
  },
@@ -769,6 +845,6 @@ var REST_API = {
769
845
  var API_PREFIX = "/api";
770
846
  var API_VERSION = "v1";
771
847
 
772
- export { API_PREFIX, API_VERSION, ASSET_SYMBOLS, AVATAR_CONTENT_TYPES, AssetBalanceSchema, AssetSymbolSchema, AvatarContentTypeSchema, AvatarUploadUrlCommand, CancelWithdrawalCommand, ChartPeriodSchema, ChartPointSchema, ClaimDailyBonusCommand, ConfirmEmailChangeCommand, ConfirmTotpCommand, ConfirmWithdrawalCommand, CreateTicketCommand, DEPOSITABLE_ASSETS, DailyBonusClaimResultSchema, DailyBonusDaySchema, DailyBonusStatusSchema, DepositAddressCommand, DepositAddressSchema, DepositableAssetSchema, DisableTotpCommand, ERROR_CODE, EarningsOverviewSchema, ErrorResponseSchema, FUNDING_ASSET, GetDailyBonusCommand, GetEarningsCommand, GetIncomeCommand, GetLeaderboardCommand, GetPartnersCommand, GetRanksCommand, GetSettingsCommand, GetTicketCommand, GetTokenChartCommand, GetTokenPriceCommand, GetTransactionsCommand, GetWalletCommand, IncomeOverviewSchema, IncomePeriodSchema, LeaderboardEntrySchema, LeaderboardPeriodSchema, LeaderboardSchema, LinkGoogleCommand, LinkProviderSchema, LinkTelegramCommand, LinkedAccountSchema, ListLinkedAccountsCommand, ListNotificationsCommand, ListTicketsCommand, ListWithdrawalsCommand, LoginCommand, LogoutCommand, MONEY_REGEX, MarkNotificationsReadCommand, MeCommand, MoneyStringSchema, MonthlyPricePointSchema, NotificationSchema, NotificationTypeSchema, PaginatedSchema, PaginationQuerySchema, PartnerAccrualSchema, PartnerLevelSchema, PartnersOverviewSchema, PositiveMoneyStringSchema, REST_API, RankDefSchema, RegisterCommand, ReplyTicketCommand, RequestEmailChangeCommand, RequestWithdrawalCommand, SessionInfoSchema, SetupTotpCommand, SwapCommand, SwapSideSchema, TICKET_CATEGORIES, TOKEN_ASSET, TicketAttachmentInputSchema, TicketAttachmentSchema, TicketAttachmentUploadCommand, TicketAuthorTypeSchema, TicketBodySchema, TicketCategorySchema, TicketDetailSchema, TicketMessageSchema, TicketStatusSchema, TicketSummarySchema, TokenPriceSchema, TradeResultSchema, TransactionSchema, TransactionStatusSchema, TransactionTypeSchema, UnlinkAccountCommand, UpdateProfileCommand, UpdateSettingsCommand, UserProfileSchema, UserRankSchema, UserSettingsSchema, UserStatusSchema, UuidSchema, WalletOverviewSchema, WithdrawalSchema, WithdrawalStatusSchema, endpoint };
848
+ export { API_PREFIX, API_VERSION, ASSET_SYMBOLS, AVATAR_CONTENT_TYPES, AssetBalanceSchema, AssetSymbolSchema, AvatarContentTypeSchema, AvatarUploadUrlCommand, CancelOrderCommand, CancelWithdrawalCommand, ChartPeriodSchema, ChartPointSchema, ClaimDailyBonusCommand, ConfirmEmailChangeCommand, ConfirmTotpCommand, ConfirmWithdrawalCommand, CreateTicketCommand, DEPOSITABLE_ASSETS, DailyBonusClaimResultSchema, DailyBonusDaySchema, DailyBonusStatusSchema, DepositAddressCommand, DepositAddressSchema, DepositableAssetSchema, DisableTotpCommand, ERROR_CODE, EarningsOverviewSchema, ErrorResponseSchema, FUNDING_ASSET, GetDailyBonusCommand, GetEarningsCommand, GetIncomeCommand, GetLeaderboardCommand, GetOrderBookCommand, GetPartnersCommand, GetRanksCommand, GetSettingsCommand, GetTicketCommand, GetTokenChartCommand, GetTokenPriceCommand, GetTransactionsCommand, GetWalletCommand, IncomeOverviewSchema, IncomePeriodSchema, LeaderboardEntrySchema, LeaderboardPeriodSchema, LeaderboardSchema, LinkGoogleCommand, LinkProviderSchema, LinkTelegramCommand, LinkedAccountSchema, ListLinkedAccountsCommand, ListMyOrdersCommand, ListNotificationsCommand, ListTicketsCommand, ListTradesCommand, ListWithdrawalsCommand, LoginCommand, LogoutCommand, MONEY_REGEX, MarkNotificationsReadCommand, MeCommand, MoneyStringSchema, MonthlyPricePointSchema, NotificationSchema, NotificationTypeSchema, OrderBookLevelSchema, OrderBookSchema, OrderSchema, OrderSideSchema, OrderStatusSchema, OrderTypeSchema, PaginatedSchema, PaginationQuerySchema, PartnerAccrualSchema, PartnerLevelSchema, PartnersOverviewSchema, PlaceOrderCommand, PositiveMoneyStringSchema, PublicTradeSchema, REST_API, RankDefSchema, RegisterCommand, ReplyTicketCommand, RequestEmailChangeCommand, RequestWithdrawalCommand, SessionInfoSchema, SetupTotpCommand, SwapCommand, SwapSideSchema, TICKET_CATEGORIES, TOKEN_ASSET, TicketAttachmentInputSchema, TicketAttachmentSchema, TicketAttachmentUploadCommand, TicketAuthorTypeSchema, TicketBodySchema, TicketCategorySchema, TicketDetailSchema, TicketMessageSchema, TicketStatusSchema, TicketSummarySchema, TokenPriceSchema, TradeResultSchema, TransactionSchema, TransactionStatusSchema, TransactionTypeSchema, UnlinkAccountCommand, UpdateProfileCommand, UpdateSettingsCommand, UserProfileSchema, UserRankSchema, UserSettingsSchema, UserStatusSchema, UuidSchema, WalletOverviewSchema, WithdrawalSchema, WithdrawalStatusSchema, endpoint };
773
849
  //# sourceMappingURL=index.js.map
774
850
  //# sourceMappingURL=index.js.map