@ultrade/ultrade-js-sdk 2.0.2 → 2.0.4

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 (46) hide show
  1. package/README.md +2496 -0
  2. package/dist/argsAsObj/affiliates.args.d.ts +22 -0
  3. package/dist/argsAsObj/auth.args.d.ts +24 -0
  4. package/dist/argsAsObj/client.args.d.ts +21 -0
  5. package/dist/argsAsObj/index.d.ts +8 -0
  6. package/dist/argsAsObj/market.args.d.ts +53 -0
  7. package/dist/argsAsObj/social.args.d.ts +39 -0
  8. package/dist/argsAsObj/system.args.d.ts +7 -0
  9. package/dist/argsAsObj/trading.args.d.ts +12 -0
  10. package/dist/argsAsObj/wallet.args.d.ts +31 -0
  11. package/dist/client.d.ts +112 -0
  12. package/dist/const/auth.const.d.ts +1 -0
  13. package/dist/const/client.const.d.ts +8 -0
  14. package/dist/const/index.d.ts +2 -0
  15. package/dist/enum/account.enum.d.ts +42 -0
  16. package/dist/enum/affiliates.enum.d.ts +5 -0
  17. package/dist/enum/common.enum.d.ts +15 -0
  18. package/dist/enum/index.d.ts +6 -0
  19. package/dist/enum/market.enum.d.ts +252 -0
  20. package/dist/enum/social.enum.d.ts +6 -0
  21. package/dist/{src/enums.d.ts → enum/socket.enum.d.ts} +0 -16
  22. package/dist/index.d.ts +6 -0
  23. package/dist/index.js +1 -1
  24. package/dist/interface/account.interface.d.ts +64 -0
  25. package/dist/interface/affiliates.interface.d.ts +42 -0
  26. package/dist/interface/auth.interface.d.ts +19 -0
  27. package/dist/interface/client.interface.d.ts +11 -0
  28. package/dist/interface/index.d.ts +11 -0
  29. package/dist/interface/market.interface.d.ts +232 -0
  30. package/dist/interface/notification.interface.d.ts +6 -0
  31. package/dist/interface/social.interface.d.ts +145 -0
  32. package/dist/interface/socket.interface.d.ts +35 -0
  33. package/dist/interface/system.interface.d.ts +20 -0
  34. package/dist/interface/trading.interface.d.ts +38 -0
  35. package/dist/interface/wallet.interface.d.ts +143 -0
  36. package/dist/{src/localStorage.d.ts → localStorage.d.ts} +1 -1
  37. package/dist/{src/sockets.d.ts → sockets.d.ts} +3 -2
  38. package/dist/{src → utils}/algodService.d.ts +6 -8
  39. package/dist/utils/algorand.util.d.ts +4 -0
  40. package/dist/utils/client.util.d.ts +6 -0
  41. package/dist/utils/index.d.ts +3 -0
  42. package/package.json +8 -5
  43. package/dist/src/client.d.ts +0 -143
  44. package/dist/src/index.d.ts +0 -2
  45. package/dist/src/interfaces.d.ts +0 -136
  46. package/dist/src/utils.d.ts +0 -2
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Affiliates-related method arguments
3
+ */
4
+ export interface IGetAffiliatesStatusArgs {
5
+ companyId: number;
6
+ }
7
+ export interface ICreateAffiliateArgs {
8
+ companyId: number;
9
+ }
10
+ export interface IGetAffiliateProgressArgs {
11
+ companyId: number;
12
+ }
13
+ export interface IGetAffiliateInfoArgs {
14
+ companyId: number;
15
+ range: string;
16
+ }
17
+ export interface ICountAffiliateDepositArgs {
18
+ companyId: number;
19
+ }
20
+ export interface ICountAffiliateClickArgs {
21
+ referralToken: string;
22
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Authentication-related method arguments
3
+ */
4
+ import { ILoginData, ITradingKeyData, IWithdrawData, ITransferData } from '../../../shared/dist/browser/interfaces';
5
+ import { Signer } from '../interface/index.ts';
6
+ export interface ILoginArgs extends ILoginData {
7
+ loginMessage?: string;
8
+ }
9
+ export interface IAddTradingKeyArgs {
10
+ data: ITradingKeyData;
11
+ }
12
+ export interface IRevokeTradingKeyArgs {
13
+ data: ITradingKeyData;
14
+ }
15
+ export interface IWithdrawArgs {
16
+ withdrawData: IWithdrawData;
17
+ prettyMsg?: string;
18
+ }
19
+ export interface ITransferArgs {
20
+ transferData: ITransferData;
21
+ }
22
+ export interface ISetSignerArgs {
23
+ signer: Signer;
24
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Client configuration and subscription arguments
3
+ */
4
+ import { ClientOptions, AuthCredentials, SubscribeOptions, WalletCredentials } from '../interface/index.ts';
5
+ export interface IClientConstructorArgs {
6
+ options: ClientOptions;
7
+ authCredentials?: AuthCredentials;
8
+ }
9
+ export interface ISubscribeArgs {
10
+ subscribeOptions: SubscribeOptions;
11
+ callback: Function;
12
+ }
13
+ export interface IUnsubscribeArgs {
14
+ handlerId: number;
15
+ }
16
+ export interface ISetMainWalletArgs {
17
+ wallet: WalletCredentials;
18
+ }
19
+ export interface ISetUseUltradeIdArgs {
20
+ isUltrade: boolean;
21
+ }
@@ -0,0 +1,8 @@
1
+ export * from './market.args';
2
+ export * from './wallet.args';
3
+ export * from './system.args';
4
+ export * from './affiliates.args';
5
+ export * from './social.args';
6
+ export * from './auth.args';
7
+ export * from './trading.args';
8
+ export * from './client.args';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Market-related method arguments
3
+ */
4
+ export interface IGetPairListArgs {
5
+ companyId?: number;
6
+ }
7
+ export interface IGetPairArgs {
8
+ symbol: string | number;
9
+ }
10
+ export interface IGetPriceArgs {
11
+ symbol: string;
12
+ }
13
+ export interface IGetDepthArgs {
14
+ symbol: string;
15
+ depth: number;
16
+ }
17
+ export interface IGetSymbolsArgs {
18
+ mask?: string;
19
+ }
20
+ export interface IGetLastTradesArgs {
21
+ symbol: string;
22
+ }
23
+ export interface IGetHistoryArgs {
24
+ symbol: string;
25
+ interval: string;
26
+ startTime?: number;
27
+ endTime?: number;
28
+ limit?: number;
29
+ page?: number;
30
+ }
31
+ export interface IGetOrdersArgs {
32
+ symbol?: string;
33
+ status?: number;
34
+ limit?: number;
35
+ endTime?: number;
36
+ startTime?: number;
37
+ }
38
+ export interface IGetOrderByIdArgs {
39
+ orderId: number;
40
+ }
41
+ export interface IGetWithdrawalFeeArgs {
42
+ assetAddress: string;
43
+ chainId: number;
44
+ }
45
+ export interface IGetKycInitLinkArgs {
46
+ embeddedAppUrl: string | null;
47
+ }
48
+ export interface IGetDollarValuesArgs {
49
+ assetIds?: number[];
50
+ }
51
+ export interface IGetTransactionDetailsArgs {
52
+ transactionId: number;
53
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Social-related method arguments
3
+ */
4
+ import { TelegramData } from '../interface/index.ts';
5
+ export interface IAddSocialEmailArgs {
6
+ email: string;
7
+ embeddedAppUrl: string;
8
+ }
9
+ export interface IVerifySocialEmailArgs {
10
+ email: string;
11
+ hash: string;
12
+ }
13
+ export interface IGetSeasonArgs {
14
+ ultradeId?: number;
15
+ }
16
+ export interface IAddTelegramArgs {
17
+ data: TelegramData;
18
+ }
19
+ export interface IDisconnectTelegramArgs {
20
+ data: TelegramData;
21
+ }
22
+ export interface IGetDiscordConnectionUrlArgs {
23
+ url: string;
24
+ }
25
+ export interface IGetTwitterConnectionUrlArgs {
26
+ appUrl: string;
27
+ permissions?: string;
28
+ }
29
+ export interface IActionWithTweetArgs {
30
+ actions: Array<{
31
+ id: number;
32
+ text?: string;
33
+ }>;
34
+ tweetId?: string;
35
+ }
36
+ export interface IGetAICommentArgs {
37
+ styleId: number;
38
+ tweetId: string;
39
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * System-related method arguments
3
+ */
4
+ import { UpdateUserNotificationDto } from '../interface/index.ts';
5
+ export interface IReadNotificationsArgs {
6
+ notifications: UpdateUserNotificationDto[];
7
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Trading-related method arguments
3
+ */
4
+ import { CreateOrderArgs, CancelOrderArgs } from '../interface/index.ts';
5
+ export interface ICreateOrderArgs extends CreateOrderArgs {
6
+ }
7
+ export interface ICancelOrderArgs extends CancelOrderArgs {
8
+ }
9
+ export interface ICancelMultipleOrdersArgs {
10
+ orderIds?: number[];
11
+ pairId?: number;
12
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Wallet-related method arguments
3
+ */
4
+ import { CreateWithdrawalWallet, UpdateWithdrawalWallet, IWhiteList } from '../../../shared/dist/browser/interfaces';
5
+ export interface IGetWalletTransactionsArgs {
6
+ type: string;
7
+ page: number;
8
+ limit?: number;
9
+ }
10
+ export interface IGetTransfersArgs {
11
+ page: number;
12
+ limit?: number;
13
+ }
14
+ export interface IAddWhitelistArgs {
15
+ data: IWhiteList;
16
+ }
17
+ export interface IDeleteWhitelistArgs {
18
+ whitelistId: number;
19
+ }
20
+ export interface IGetWithdrawalWalletByAddressArgs {
21
+ address: string;
22
+ }
23
+ export interface ICreateWithdrawalWalletArgs {
24
+ body: CreateWithdrawalWallet;
25
+ }
26
+ export interface IUpdateWithdrawalWalletArgs {
27
+ params: UpdateWithdrawalWallet;
28
+ }
29
+ export interface IDeleteWithdrawalWalletArgs {
30
+ address: string;
31
+ }
@@ -0,0 +1,112 @@
1
+ import { ITradingKeyData, TradingKeyView } from '../../shared/dist/browser/interfaces';
2
+ import { ILoginData, ITransferData, IWithdrawData } from "../../shared/dist/browser/interfaces";
3
+ import { CreateWithdrawalWallet, UpdateWithdrawalWallet } from "../../shared/dist/browser/interfaces";
4
+ import { ISafeWithdrawalWallets } from "../../shared/dist/browser/interfaces";
5
+ import { PaginatedResult } from "../../shared/dist/browser/interfaces";
6
+ import { SocketManager } from "./sockets";
7
+ import { AuthCredentials, ClientOptions, CancelOrderArgs, CreateOrderArgs, Signer, SubscribeOptions, TelegramData, WalletCredentials, UserNotification, IPairDto, IGetDepth, SettingsInit, IGetLastTrades, CodexBalanceDto, IOrderDto, Order, Chain, MappedCCTPAssets, CCTPUnifiedAssets, IGetKycStatus, IGetKycInitLink, IGetDollarValues, ITransactionDetails, IClient, IGetPrice, IGetSymbols, IGetHistoryResponse, IWithdrawalFee, ITransaction, ITradingKey, ITransfer, IPendingTxn, IGetWhiteList, IWhiteList, ISystemVersion, ISystemMaintenance, IUnreadNotificationsCount, UpdateUserNotificationDto, IAffiliateDashboardStatus, IAffiliateProgress, DashboardInfo, ISocialAccount, ILeaderboardItem, IUnlock, IAction, IActionHistory, ISocialSettings, ISocialSeason, ITelegramConnectResponse, ICompanyTweet, IAIStyle, IAIGeneratedComment, IWithdrawResponse, IRevokeTradingKeyResponse, ICancelOrderResponse, ICancelMultipleOrdersResponse } from "./interface/index.ts";
8
+ export declare class Client implements IClient {
9
+ private client;
10
+ private algodNode;
11
+ private algodIndexer;
12
+ private apiUrl;
13
+ private companyId;
14
+ private websocketUrl;
15
+ private wallet;
16
+ private _axios;
17
+ private localStorageService;
18
+ private isUltradeID;
19
+ socketManager: SocketManager;
20
+ constructor(options: ClientOptions, authCredentials?: AuthCredentials);
21
+ private axiosInterceptor;
22
+ get useUltradeID(): boolean;
23
+ set useUltradeID(isUltrade: boolean);
24
+ get isLogged(): boolean;
25
+ get mainWallet(): WalletCredentials | null;
26
+ set mainWallet(wallet: WalletCredentials);
27
+ setSigner(signer: Signer): void;
28
+ subscribe(subscribeOptions: SubscribeOptions, callback: Function): number;
29
+ unsubscribe(handlerId: number): void;
30
+ getPairList(companyId?: number): Promise<IPairDto[]>;
31
+ getPair(symbol: string | number): Promise<IPairDto>;
32
+ getPrice(symbol: string): Promise<IGetPrice>;
33
+ getDepth(symbol: string, depth: number): Promise<IGetDepth>;
34
+ getSymbols(mask?: string): Promise<IGetSymbols>;
35
+ getLastTrades(symbol: string): Promise<IGetLastTrades>;
36
+ getHistory(symbol: string, interval: string, startTime?: number, endTime?: number, limit?: number, page?: number): Promise<IGetHistoryResponse>;
37
+ getOrders(symbol?: string, status?: number, limit?: number, endTime?: number, startTime?: number): Promise<IOrderDto[]>;
38
+ getOrderById(orderId: number): Promise<Order>;
39
+ getSettings(): Promise<SettingsInit>;
40
+ getBalances(): Promise<CodexBalanceDto[]>;
41
+ getChains(): Promise<Chain[]>;
42
+ getCodexAssets(): Promise<CodexBalanceDto>;
43
+ getCCTPAssets(): Promise<MappedCCTPAssets>;
44
+ getCCTPUnifiedAssets(): Promise<CCTPUnifiedAssets[]>;
45
+ getWithdrawalFee(assetAddress: string, chainId: number): Promise<IWithdrawalFee>;
46
+ getKycStatus(): Promise<IGetKycStatus>;
47
+ getKycInitLink(embeddedAppUrl: string | null): Promise<IGetKycInitLink>;
48
+ getDollarValues(assetIds?: number[]): Promise<IGetDollarValues>;
49
+ getTransactionDetalis(transactionId: number): Promise<ITransactionDetails>;
50
+ getWalletTransactions(type: string, page: number, limit?: number): Promise<PaginatedResult<ITransaction>>;
51
+ getTradingKeys(): Promise<ITradingKey>;
52
+ getTransfers(page: number, limit?: number): Promise<PaginatedResult<ITransfer>>;
53
+ getPendingTransactions(): Promise<IPendingTxn[]>;
54
+ getWhitelist(): Promise<PaginatedResult<IGetWhiteList>>;
55
+ addWhitelist(data: IWhiteList): Promise<IGetWhiteList>;
56
+ deleteWhitelist(whitelistId: number): Promise<void>;
57
+ getAllWithdrawalWallets(): Promise<ISafeWithdrawalWallets[]>;
58
+ getWithdrawalWalletByAddress(address: string): Promise<ISafeWithdrawalWallets>;
59
+ createWithdrawalWallet(body: CreateWithdrawalWallet): Promise<ISafeWithdrawalWallets>;
60
+ updateWithdrawalWallet(params: UpdateWithdrawalWallet): Promise<boolean>;
61
+ deleteWithdrawalWallet(address: string): Promise<boolean>;
62
+ getVersion(): Promise<ISystemVersion>;
63
+ getMaintenance(): Promise<ISystemMaintenance>;
64
+ getNotifications(): Promise<UserNotification[]>;
65
+ getNotificationsUnreadCount(): Promise<IUnreadNotificationsCount>;
66
+ readNotifications(notifications: UpdateUserNotificationDto[]): Promise<UpdateUserNotificationDto[]>;
67
+ getAffiliatesStatus(companyId: number): Promise<IAffiliateDashboardStatus>;
68
+ createAffiliate(companyId: number): Promise<DashboardInfo>;
69
+ getAffiliateProgress(companyId: number): Promise<IAffiliateProgress>;
70
+ getAffiliateInfo(companyId: number, range: string): Promise<DashboardInfo>;
71
+ countAffiliateDepost(companyId: number): Promise<void>;
72
+ countAffiliateClick(referralToken: string): Promise<void>;
73
+ getSocialAccount(): Promise<ISocialAccount | undefined>;
74
+ addSocialEmail(email: string, embeddedAppUrl: string): Promise<void>;
75
+ verifySocialEmail(email: string, hash: string): Promise<void>;
76
+ getLeaderboards(): Promise<ILeaderboardItem[]>;
77
+ getUnlocks(): Promise<IUnlock[]>;
78
+ getSocialSettings(): Promise<ISocialSettings>;
79
+ getSeason(ultradeId?: number): Promise<ISocialSeason>;
80
+ getPastSeasons(): Promise<ISocialSeason[]>;
81
+ addTelegram(data: TelegramData): Promise<ITelegramConnectResponse>;
82
+ disconnectTelegram(data: TelegramData): Promise<void>;
83
+ getDiscordConnectionUrl(url: string): Promise<string>;
84
+ disconnectDiscord(): Promise<void>;
85
+ getTwitterConnectionUrl(appUrl: string, permissions?: string): Promise<string>;
86
+ disconnectTwitter(): Promise<void>;
87
+ getTweets(): Promise<ICompanyTweet[]>;
88
+ actionWithTweet(data: {
89
+ actions: Array<{
90
+ id: number;
91
+ text?: string;
92
+ }>;
93
+ tweetId?: string;
94
+ }): Promise<void>;
95
+ getActions(): Promise<IAction[]>;
96
+ getActionHistory(): Promise<IActionHistory[]>;
97
+ getAIStyles(): Promise<IAIStyle[]>;
98
+ getAIComment(styleId: number, tweetId: string): Promise<IAIGeneratedComment>;
99
+ private getTechnologyByProvider;
100
+ login({ address, provider, chain, referralToken, loginMessage }: ILoginData): Promise<string>;
101
+ addTradingKey(data: ITradingKeyData): Promise<TradingKeyView>;
102
+ revokeTradingKey(data: ITradingKeyData): Promise<IRevokeTradingKeyResponse>;
103
+ withdraw(withdrawData: IWithdrawData, prettyMsg?: string): Promise<IWithdrawResponse>;
104
+ transfer(transferData: ITransferData): Promise<ITransfer>;
105
+ createOrder(order: CreateOrderArgs): Promise<IOrderDto>;
106
+ cancelOrder(order: CancelOrderArgs): Promise<ICancelOrderResponse>;
107
+ cancelMultipleOrders({ orderIds, pairId }: {
108
+ orderIds?: number[];
109
+ pairId?: number;
110
+ }): Promise<ICancelMultipleOrdersResponse>;
111
+ ping(): Promise<number>;
112
+ }
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_LOGIN_MESSAGE = "By signing this message you are logging into your trading account and agreeing to all terms and conditions of the platform.";
@@ -0,0 +1,8 @@
1
+ export interface NetworkConfig {
2
+ algodNode: string;
3
+ apiUrl: string;
4
+ algodIndexer: string;
5
+ }
6
+ export type Network = 'mainnet' | 'testnet' | 'local';
7
+ export declare const NETWORK_CONFIGS: Record<Network, NetworkConfig>;
8
+ export declare const tokenizedUrls: readonly ["/market/balances", "/market/order", "/market/orders", "/market/account/kyc/status", "/market/account/kyc/init", "/market/withdrawal-fee", "/market/operation-details", "/wallet/key", "/wallet/transactions", "/wallet/transfer", "/wallet/withdraw", "/wallet/whitelist", "/wallet/withdrawal-wallets"];
@@ -0,0 +1,2 @@
1
+ export * from "./auth.const";
2
+ export * from "./client.const";
@@ -0,0 +1,42 @@
1
+ export declare enum POINTS_SETTING {
2
+ OFF = "disable",
3
+ ULTRADE = "ultrade",
4
+ ALL = "all"
5
+ }
6
+ export declare enum SettingIds {
7
+ ENABLED = "company.enabled",
8
+ APP_TITLE = "company.appTitle",
9
+ DOMAIN = "company.domain",
10
+ DIRECT_SETTLE = "company.directSettlement",
11
+ KYC = "markets.kycTradeRequirementEnabled",
12
+ GEOBLOCK = "company.geoblock",
13
+ LOGO = "appearance.logo",
14
+ THEMES = "appearance.themes",
15
+ NEW_TAB = "appearance.newTab",
16
+ TARGET = "appearance.target",
17
+ REPORT_BUTTONS = "appearance.reportButtons",
18
+ CUSTOM_MENU_ITEMS = "appearance.customMenuItems",
19
+ APPEARANCE_CHART_TYPE = "appearance.chartType",
20
+ APPEARANCE_CHART_INT = "appearance.chartInt",
21
+ AMM = "product.amm",
22
+ OBDEX = "product.obdex",
23
+ POINTS = "product.pointSystem",
24
+ AFFILIATE_DASHBOARD_THRESHOLD = "product.affiliateDashboardThreshold",
25
+ AFFILIATE_DEFAULT_FEE_SHARE = "product.affiliateDefaultFeeShare",
26
+ AFFILIATE_DASHBOARD_VISIBILITY = "product.affiliateDashboardVisibility",
27
+ AMM_FEE = "company.ammFee",
28
+ FEE_SHARE = "company.feeShare",
29
+ MIN_FEE = "company.minFee",
30
+ MAKER_FEE = "company.makerFee",
31
+ TAKER_FEE = "company.takerFee",
32
+ PINNED_PAIRS = "markets.pinnedPairs",
33
+ TWITTER_ENABLED = "point-system.twitterEnabled",
34
+ TWITTER_JOB_ENABLED = "point-system.twitterJobEnabled",
35
+ TWITTER_HASHTAGS = "point-system.twitterHashtags",
36
+ TWITTER_ACCOUNT_NAME = "point-system.twitterAccountName",
37
+ DISCORD_ENABLED = "point-system.discordEnabled",
38
+ TELEGRAM_ENABLED = "point-system.telegramEnabled",
39
+ TELEGRAM_GROUP_NAME = "point-system.telegramGroupName",
40
+ TELEGRAM_BOT_NAME = "point-system.telegramBotName",
41
+ GUIDE_LINK = "point-system.guideLink"
42
+ }
@@ -0,0 +1,5 @@
1
+ export declare enum AffDashboardVisibilitySettingEnum {
2
+ DISABLED = "disabled",
3
+ ENABLED_FOR_ALL = "enabled for all",
4
+ ENABLED_FOR_AFFILIATES = "enabled for affiliates"
5
+ }
@@ -0,0 +1,15 @@
1
+ export declare enum DIRECT_SETTLE {
2
+ YES = "Y",
3
+ NO = "N"
4
+ }
5
+ export declare enum PairSettingsIds {
6
+ MFT_AUDIO_LINK = "mft.audioLink",
7
+ MFT_TITLE = "mft.title",
8
+ VIEW_BASE_COIN_ICON_LINK = "view.baseCoinIconLink",
9
+ VIEW_BASE_COIN_MARKET_LINK = "view.baseCoinMarketLink",
10
+ VIEW_PRICE_COIN_ICON_LINK = "view.priceCoinIconLink",
11
+ VIEW_PRICE_COIN_MARKET_LINK = "view.priceCoinMarketLink",
12
+ MAKER_FEE = "makerFee",
13
+ TAKER_FEE = "takerFee",
14
+ MODE_PRE_SALE = "mode.preSale"
15
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./common.enum";
2
+ export * from "./market.enum";
3
+ export * from "./social.enum";
4
+ export * from "./socket.enum";
5
+ export * from "./account.enum";
6
+ export * from "./affiliates.enum";