@ultrade/ultrade-js-sdk 0.2.6 → 2.0.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.
@@ -0,0 +1,35 @@
1
+ import algosdk, { Transaction, SuggestedParams } from 'algosdk';
2
+ import { AuthCredentials, OrderSide, Signer } from './interfaces';
3
+ export declare class AlgodService {
4
+ private client;
5
+ private authCredentials;
6
+ private indexerDomain;
7
+ constructor(algodClient: algosdk.Algodv2, credentials: AuthCredentials, indexerDomain: string);
8
+ isAppOptedIn(appLocalState: any, appId: number): boolean;
9
+ isAssetOptedIn(balances: any, assetId: number): boolean;
10
+ optInAsset(userAddress: string, assetIndex: number): Promise<Transaction>;
11
+ makeAppCallTransaction(assetIndex: number, senderAddress: string, appId: number, args: any[], params?: any): Promise<algosdk.Transaction>;
12
+ makeTransferTransaction(params: SuggestedParams, assetIndex: number, transferAmount: number, senderAddress: string, appAddress: string): Transaction | null;
13
+ get signer(): Signer;
14
+ set signer(value: Signer);
15
+ signAndSend(txnGroup: Transaction[] | Transaction): Promise<any>;
16
+ signAndSendData(data: object | string, signMessage: (msg: string, encoding?: BufferEncoding) => Promise<string>, sendAction: (signedData: {
17
+ signature: string;
18
+ }) => Promise<{
19
+ signature: string;
20
+ }>, encoding?: BufferEncoding): Promise<{
21
+ signature: string;
22
+ }>;
23
+ getTxnParams(): Promise<algosdk.SuggestedParams>;
24
+ getCurrentAccount(): {
25
+ addr: string;
26
+ sk: Uint8Array;
27
+ } | null;
28
+ getAccountInfo(address: string): Promise<Record<string, any>>;
29
+ constructArgsForAppCall(...args: any[]): Uint8Array<ArrayBufferLike>[];
30
+ validateCredentials(): void;
31
+ getAppState(appId: number): Promise<{}>;
32
+ getSuperAppId(appId: number): Promise<any>;
33
+ getPairBalances(appId: number, address: string): Promise<any>;
34
+ calculateTransferAmount(appId: number, address: string, side: OrderSide, quantity: number, price: number, decimal: number): Promise<number>;
35
+ }
@@ -0,0 +1,143 @@
1
+ import axios from "axios";
2
+ import { SocketManager } from "./sockets";
3
+ import { AuthCredentials, ClientOptions, CancelOrderArgs, CreateOrderArgs, Signer, SubscribeOptions, TelegramData, WalletCredentials, UserNotification } from "./interfaces";
4
+ import { ITradingKeyData } from '@ultrade/shared/interfaces';
5
+ import { ILoginData, ITransferData, IWithdrawData } from "@ultrade/shared/interfaces";
6
+ import { KYCAuthenticationStatus } from "@ultrade/shared/enums";
7
+ import { CreateWithdrawalWallet, UpdateWithdrawalWallet } from "@ultrade/shared/interfaces";
8
+ import { ISafeWithdrawalWallets } from "@ultrade/shared/interfaces";
9
+ export declare class Client {
10
+ private client;
11
+ private algodNode;
12
+ private algodIndexer;
13
+ private apiUrl;
14
+ private companyId;
15
+ private websocketUrl;
16
+ private wallet;
17
+ private _axios;
18
+ private localStorageService;
19
+ private isUltradeID;
20
+ socketManager: SocketManager;
21
+ constructor(options: ClientOptions, authCredentials?: AuthCredentials);
22
+ private axiosInterceptor;
23
+ get useUltradeID(): boolean;
24
+ set useUltradeID(isUltrade: boolean);
25
+ get isLogged(): boolean;
26
+ get mainWallet(): WalletCredentials | null;
27
+ set mainWallet(wallet: WalletCredentials);
28
+ setSigner(signer: Signer): void;
29
+ subscribe(subscribeOptions: SubscribeOptions, callback: Function): number;
30
+ unsubscribe(handlerId: number): void;
31
+ getPairList(companyId?: number): Promise<axios.AxiosResponse<any, any, {}>>;
32
+ getExchangeInfo(symbol: string | number): Promise<axios.AxiosResponse<any, any, {}>>;
33
+ getPrice(symbol: string): Promise<{
34
+ ask: number;
35
+ bid: number;
36
+ last: number;
37
+ }>;
38
+ getDepth(symbol: string, depth: number): Promise<any>;
39
+ getSymbols(mask?: string): Promise<Array<{
40
+ pairKey: string;
41
+ }>>;
42
+ getLastTrades(symbol: string): Promise<any>;
43
+ getHistory(symbol: string, interval: string, startTime?: number, endTime?: number, limit?: number, page?: number): Promise<any>;
44
+ getOrders(symbol?: string, status?: number, limit?: number, endTime?: number, startTime?: number): Promise<axios.AxiosResponse<any, any, {}>>;
45
+ getOrderById(orderId: number): Promise<any>;
46
+ getSettings(): Promise<any>;
47
+ getBalances(): Promise<any>;
48
+ getChains(): Promise<any>;
49
+ getCodexAssets(): Promise<any>;
50
+ getCCTPAssets(): Promise<any>;
51
+ getCCTPUnifiedAssets(): Promise<any>;
52
+ getWithdrawalFee(assetAddress: string, chainId: number): Promise<any>;
53
+ getKycStatus(): Promise<{
54
+ kycStatus?: KYCAuthenticationStatus;
55
+ }>;
56
+ getKycInitLink(embeddedAppUrl: string | null): Promise<{
57
+ url: string;
58
+ }>;
59
+ getDollarValues(assetIds?: number[]): Promise<{
60
+ [key: string]: number;
61
+ }>;
62
+ getTransactionDetalis(transactionId: number): Promise<any>;
63
+ getWalletTransactions(type: string, page: number, limit?: number): Promise<axios.AxiosResponse<any, any, {}>>;
64
+ getTradingKeys(): Promise<axios.AxiosResponse<any, any, {}>>;
65
+ getTransfers(page: number, limit?: number): Promise<axios.AxiosResponse<any, any, {}>>;
66
+ getPendingTransactions(): Promise<axios.AxiosResponse<any, any, {}>>;
67
+ getWhitelist(): Promise<axios.AxiosResponse<any, any, {}>>;
68
+ addWhitelist(data: any): Promise<{
69
+ signature: string;
70
+ }>;
71
+ deleteWhitelist(whitelistId: number): Promise<{
72
+ signature: string;
73
+ }>;
74
+ getAllWithdrawalWallets(): Promise<ISafeWithdrawalWallets[]>;
75
+ getWithdrawalWalletByAddress(address: string): Promise<ISafeWithdrawalWallets>;
76
+ createWithdrawalWallet(body: CreateWithdrawalWallet): Promise<ISafeWithdrawalWallets>;
77
+ updateWithdrawalWallet(params: UpdateWithdrawalWallet): Promise<boolean>;
78
+ deleteWithdrawalWallet(address: string): Promise<boolean>;
79
+ getVersion(): Promise<any>;
80
+ getMaintenance(): Promise<any>;
81
+ getNotifications(): Promise<UserNotification[]>;
82
+ getNotificationsUnreadCount(): Promise<{
83
+ count: number;
84
+ }>;
85
+ readNotifications(notifications: any[]): Promise<any>;
86
+ getAffiliatesStatus(companyId: number): Promise<axios.AxiosResponse<any, any, {}>>;
87
+ createAffiliate(companyId: number): Promise<axios.AxiosResponse<any, any, {}>>;
88
+ getAffiliateProgress(companyId: number): Promise<axios.AxiosResponse<any, any, {}>>;
89
+ getAffiliateInfo(companyId: number, range: string): Promise<axios.AxiosResponse<any, any, {}>>;
90
+ countAffiliateDepost(companyId: number): Promise<axios.AxiosResponse<any, any, {}>>;
91
+ countAffiliateClick(referralToken: string): Promise<axios.AxiosResponse<any, any, {}>>;
92
+ getSocialAccount(): Promise<axios.AxiosResponse<any, any, {}>>;
93
+ addSocialEmail(email: string, embeddedAppUrl: string): Promise<axios.AxiosResponse<any, any, {}>>;
94
+ verifySocialEmail(email: string, hash: string): Promise<axios.AxiosResponse<any, any, {}>>;
95
+ getLeaderboards(): Promise<axios.AxiosResponse<any, any, {}>>;
96
+ getUnlocks(): Promise<axios.AxiosResponse<any, any, {}>>;
97
+ getSocialSettings(): Promise<axios.AxiosResponse<any, any, {}>>;
98
+ getSeason(ultradeId?: number): Promise<axios.AxiosResponse<any, any, {}>>;
99
+ getPastSeasons(): Promise<axios.AxiosResponse<any, any, {}>>;
100
+ addTelegram(data: TelegramData): Promise<axios.AxiosResponse<any, any, {}>>;
101
+ disconnectTelegram(data: TelegramData): Promise<axios.AxiosResponse<any, any, {}>>;
102
+ getDiscordConnectionUrl(url: any): Promise<any>;
103
+ disconnectDiscord(): Promise<axios.AxiosResponse<any, any, {}>>;
104
+ getTwitterConnectionUrl(appUrl: string, permissions?: string): Promise<any>;
105
+ disconnectTwitter(): Promise<axios.AxiosResponse<any, any, {}>>;
106
+ getTweets(): Promise<axios.AxiosResponse<any, any, {}>>;
107
+ actionWithTweet(data: {
108
+ actions: [{
109
+ id: number;
110
+ text?: string;
111
+ }];
112
+ tweetId?: string;
113
+ }): Promise<axios.AxiosResponse<any, any, {}>>;
114
+ getActions(): Promise<axios.AxiosResponse<any, any, {}>>;
115
+ getActionHistory(): Promise<axios.AxiosResponse<any, any, {}>>;
116
+ getAIStyles(): Promise<axios.AxiosResponse<any, any, {}>>;
117
+ getAIComment(styleId: number, tweetId: string): Promise<axios.AxiosResponse<any, any, {}>>;
118
+ private getTechnologyByProvider;
119
+ login({ address, provider, chain, referralToken, loginMessage }: ILoginData): Promise<{
120
+ signature: string;
121
+ }>;
122
+ addTradingKey(data: ITradingKeyData): Promise<{
123
+ signature: string;
124
+ }>;
125
+ revokeTradingKey(data: ITradingKeyData): Promise<{
126
+ signature: string;
127
+ }>;
128
+ withdraw(withdrawData: IWithdrawData, prettyMsg?: string): Promise<{
129
+ signature: string;
130
+ }>;
131
+ transfer(transferData: ITransferData): Promise<{
132
+ signature: string;
133
+ }>;
134
+ createOrder(order: CreateOrderArgs): Promise<{
135
+ signature: string;
136
+ }>;
137
+ cancelOrder(order: CancelOrderArgs): Promise<any>;
138
+ cancelMultipleOrders({ orderIds, pairId }: {
139
+ orderIds?: number[];
140
+ pairId?: number;
141
+ }): Promise<any>;
142
+ ping(): Promise<number>;
143
+ }
@@ -0,0 +1,34 @@
1
+ export declare enum DIRECT_SETTLE {
2
+ YES = "Y",
3
+ NO = "N"
4
+ }
5
+ export declare enum ORDER_STATUS {
6
+ OPEN_ORDER = 1,
7
+ CANCELLED = 2,
8
+ MATCHED = 3,
9
+ SELF_MATCHED = 4
10
+ }
11
+ export declare enum STREAMS {
12
+ QUOTE = 1,
13
+ LAST_PRICE = 2,
14
+ DEPTH = 3,
15
+ LAST_CANDLESTICK = 4,
16
+ ORDERS = 5,
17
+ TRADES = 6,
18
+ SYSTEM = 7,
19
+ WALLET_TRANSACTIONS = 8,
20
+ ALL_STAT = 9,
21
+ CODEX_ASSETS = 12,
22
+ CODEX_BALANCES = 10,
23
+ LAST_LOOK = 11,
24
+ SETTINGS_UPDATE = 13,
25
+ NEW_NOTIFICATION = 14,
26
+ POINT_SYSTEM_SETTINGS_UPDATE = 15
27
+ }
28
+ export declare const PRIVATE_STREAMS: STREAMS[];
29
+ export declare enum SOCIAL_ACTION_SOURCE {
30
+ COMPANY = "COMPANY",
31
+ TWITTER = "TWITTER",
32
+ DISCORD = "DISCORD",
33
+ TELEGRAM = "TELEGRAM"
34
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './amm';
2
- export * from './constants';
3
- export * from './types';
1
+ export * from './client';
2
+ export { SocketManager } from './sockets';