@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.
- package/README.md +2496 -0
- package/dist/argsAsObj/affiliates.args.d.ts +22 -0
- package/dist/argsAsObj/auth.args.d.ts +24 -0
- package/dist/argsAsObj/client.args.d.ts +21 -0
- package/dist/argsAsObj/index.d.ts +8 -0
- package/dist/argsAsObj/market.args.d.ts +53 -0
- package/dist/argsAsObj/social.args.d.ts +39 -0
- package/dist/argsAsObj/system.args.d.ts +7 -0
- package/dist/argsAsObj/trading.args.d.ts +12 -0
- package/dist/argsAsObj/wallet.args.d.ts +31 -0
- package/dist/client.d.ts +112 -0
- package/dist/const/auth.const.d.ts +1 -0
- package/dist/const/client.const.d.ts +8 -0
- package/dist/const/index.d.ts +2 -0
- package/dist/enum/account.enum.d.ts +42 -0
- package/dist/enum/affiliates.enum.d.ts +5 -0
- package/dist/enum/common.enum.d.ts +15 -0
- package/dist/enum/index.d.ts +6 -0
- package/dist/enum/market.enum.d.ts +252 -0
- package/dist/enum/social.enum.d.ts +6 -0
- package/dist/{src/enums.d.ts → enum/socket.enum.d.ts} +0 -16
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/dist/interface/account.interface.d.ts +64 -0
- package/dist/interface/affiliates.interface.d.ts +42 -0
- package/dist/interface/auth.interface.d.ts +19 -0
- package/dist/interface/client.interface.d.ts +11 -0
- package/dist/interface/index.d.ts +11 -0
- package/dist/interface/market.interface.d.ts +232 -0
- package/dist/interface/notification.interface.d.ts +6 -0
- package/dist/interface/social.interface.d.ts +145 -0
- package/dist/interface/socket.interface.d.ts +35 -0
- package/dist/interface/system.interface.d.ts +20 -0
- package/dist/interface/trading.interface.d.ts +38 -0
- package/dist/interface/wallet.interface.d.ts +143 -0
- package/dist/{src/localStorage.d.ts → localStorage.d.ts} +1 -1
- package/dist/{src/sockets.d.ts → sockets.d.ts} +3 -2
- package/dist/{src → utils}/algodService.d.ts +6 -8
- package/dist/utils/algorand.util.d.ts +4 -0
- package/dist/utils/client.util.d.ts +6 -0
- package/dist/utils/index.d.ts +3 -0
- package/package.json +8 -5
- package/dist/src/client.d.ts +0 -143
- package/dist/src/index.d.ts +0 -2
- package/dist/src/interfaces.d.ts +0 -136
- package/dist/src/utils.d.ts +0 -2
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { KYCAuthenticationStatus } from "../../../shared/dist/browser/enums";
|
|
2
|
+
import { BLOCKCHAINS, OrderStatus, OrderTypeEnum, OrderUpdateStaus, PairSettingsIds } from "../enum/index.ts";
|
|
3
|
+
export interface IPairDto {
|
|
4
|
+
id: number;
|
|
5
|
+
base_chain_id: number;
|
|
6
|
+
base_currency: string;
|
|
7
|
+
base_decimal: number;
|
|
8
|
+
base_id: string;
|
|
9
|
+
min_order_size: string;
|
|
10
|
+
min_price_increment: string;
|
|
11
|
+
min_size_increment: string;
|
|
12
|
+
is_active: boolean;
|
|
13
|
+
pairId: number;
|
|
14
|
+
pair_key: string;
|
|
15
|
+
pair_name: string;
|
|
16
|
+
price_chain_id: number;
|
|
17
|
+
price_currency: string;
|
|
18
|
+
price_decimal: number;
|
|
19
|
+
price_id: string;
|
|
20
|
+
restrictedCountries: string[];
|
|
21
|
+
inuseWithPartners: number[];
|
|
22
|
+
pairSettings: {
|
|
23
|
+
[PairSettingsIds.MFT_AUDIO_LINK]?: string;
|
|
24
|
+
[PairSettingsIds.MFT_TITLE]?: string;
|
|
25
|
+
[PairSettingsIds.VIEW_BASE_COIN_ICON_LINK]?: string;
|
|
26
|
+
[PairSettingsIds.VIEW_BASE_COIN_MARKET_LINK]?: string;
|
|
27
|
+
[PairSettingsIds.VIEW_PRICE_COIN_ICON_LINK]?: string;
|
|
28
|
+
[PairSettingsIds.VIEW_PRICE_COIN_MARKET_LINK]?: string;
|
|
29
|
+
[PairSettingsIds.MAKER_FEE]?: string;
|
|
30
|
+
[PairSettingsIds.TAKER_FEE]?: string;
|
|
31
|
+
[PairSettingsIds.MODE_PRE_SALE]?: {
|
|
32
|
+
sellerAddress: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
delisting_date?: Date;
|
|
36
|
+
new_orders_disabled?: boolean;
|
|
37
|
+
current_price?: string;
|
|
38
|
+
h?: string;
|
|
39
|
+
l?: string;
|
|
40
|
+
l_p?: string;
|
|
41
|
+
price_24?: string;
|
|
42
|
+
total_24?: string;
|
|
43
|
+
volume_24?: string;
|
|
44
|
+
change_24?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface IGetDepth {
|
|
47
|
+
buy: string[][];
|
|
48
|
+
sell: string[][];
|
|
49
|
+
pair: string;
|
|
50
|
+
ts: number;
|
|
51
|
+
U: number;
|
|
52
|
+
u: number;
|
|
53
|
+
}
|
|
54
|
+
export interface IGetLastTrades {
|
|
55
|
+
tradeId: number;
|
|
56
|
+
amount: string;
|
|
57
|
+
createdAt: number;
|
|
58
|
+
price: string;
|
|
59
|
+
isBuyerMaker: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface CodexBalanceDto {
|
|
62
|
+
hash: string;
|
|
63
|
+
loginAddress: string;
|
|
64
|
+
loginChainId: number;
|
|
65
|
+
tokenId: number;
|
|
66
|
+
tokenAddress: string;
|
|
67
|
+
tokenChainId: number;
|
|
68
|
+
amount: string;
|
|
69
|
+
lockedAmount: string;
|
|
70
|
+
}
|
|
71
|
+
export type OrderSideShort = "B" | "S";
|
|
72
|
+
export interface ITradeDto {
|
|
73
|
+
tradeId: number;
|
|
74
|
+
amount: string;
|
|
75
|
+
price: string;
|
|
76
|
+
createdAt: number;
|
|
77
|
+
updatedAt?: number;
|
|
78
|
+
total?: string;
|
|
79
|
+
orderId?: number;
|
|
80
|
+
orderSide?: OrderSideShort;
|
|
81
|
+
pairId?: number;
|
|
82
|
+
baseTokenId?: number;
|
|
83
|
+
baseTokenDecimal?: number;
|
|
84
|
+
quoteTokenId?: number;
|
|
85
|
+
quoteTokenDecimal?: number;
|
|
86
|
+
status?: string;
|
|
87
|
+
fee?: string;
|
|
88
|
+
isBuyer?: boolean;
|
|
89
|
+
isMaker?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface IOrderDto {
|
|
92
|
+
id: number;
|
|
93
|
+
pairId: number;
|
|
94
|
+
pair: string;
|
|
95
|
+
status: OrderStatus;
|
|
96
|
+
side: 0 | 1;
|
|
97
|
+
type: OrderTypeEnum;
|
|
98
|
+
price: string;
|
|
99
|
+
amount: string;
|
|
100
|
+
filledAmount: string;
|
|
101
|
+
total: string;
|
|
102
|
+
filledTotal: string;
|
|
103
|
+
avgPrice: string;
|
|
104
|
+
userId: string;
|
|
105
|
+
createdAt: number;
|
|
106
|
+
updatedAt?: number;
|
|
107
|
+
completedAt?: number;
|
|
108
|
+
trades?: ITradeDto[];
|
|
109
|
+
}
|
|
110
|
+
export interface Order extends IOrderDto {
|
|
111
|
+
executed: boolean;
|
|
112
|
+
updateStatus?: OrderUpdateStaus;
|
|
113
|
+
base_currency: string;
|
|
114
|
+
base_decimal: number;
|
|
115
|
+
price_currency: string;
|
|
116
|
+
price_decimal: number;
|
|
117
|
+
min_size_increment: string;
|
|
118
|
+
min_price_increment: string;
|
|
119
|
+
price_id: number;
|
|
120
|
+
}
|
|
121
|
+
export interface Chain {
|
|
122
|
+
chainId: number;
|
|
123
|
+
whChainId: string;
|
|
124
|
+
tmc: string;
|
|
125
|
+
name: BLOCKCHAINS;
|
|
126
|
+
}
|
|
127
|
+
export interface AccountAssetType {
|
|
128
|
+
id: number;
|
|
129
|
+
index: string;
|
|
130
|
+
name: string | null;
|
|
131
|
+
decimal: number;
|
|
132
|
+
img: string;
|
|
133
|
+
amount: string;
|
|
134
|
+
lockedAmount: string;
|
|
135
|
+
unit_name: string | null;
|
|
136
|
+
chainId: number;
|
|
137
|
+
usd_value?: number;
|
|
138
|
+
isWrapped?: boolean;
|
|
139
|
+
}
|
|
140
|
+
export interface CCTPAssets {
|
|
141
|
+
chainId: number;
|
|
142
|
+
address: string;
|
|
143
|
+
unifiedChainId: number;
|
|
144
|
+
}
|
|
145
|
+
export type MappedCCTPAssets = {
|
|
146
|
+
[key: string]: CCTPAssets[];
|
|
147
|
+
};
|
|
148
|
+
export interface CCTPUnifiedAssets {
|
|
149
|
+
id: number;
|
|
150
|
+
chainId: number;
|
|
151
|
+
address: string;
|
|
152
|
+
symbol: string;
|
|
153
|
+
}
|
|
154
|
+
export interface IGetKycStatus {
|
|
155
|
+
kycStatus?: KYCAuthenticationStatus;
|
|
156
|
+
}
|
|
157
|
+
export interface IGetKycInitLink {
|
|
158
|
+
url: string;
|
|
159
|
+
}
|
|
160
|
+
export interface IGetDollarValues {
|
|
161
|
+
[key: string]: number;
|
|
162
|
+
}
|
|
163
|
+
export interface IWithdrawalFee {
|
|
164
|
+
fee: string;
|
|
165
|
+
dollarValue: string;
|
|
166
|
+
}
|
|
167
|
+
export interface IGetPrice {
|
|
168
|
+
ask: number;
|
|
169
|
+
bid: number;
|
|
170
|
+
last: number;
|
|
171
|
+
}
|
|
172
|
+
export interface IGetHistoryResponse {
|
|
173
|
+
t: number[];
|
|
174
|
+
o: number[];
|
|
175
|
+
c: number[];
|
|
176
|
+
l: number[];
|
|
177
|
+
h: number[];
|
|
178
|
+
v: number[];
|
|
179
|
+
q: number[];
|
|
180
|
+
s: string;
|
|
181
|
+
b: number;
|
|
182
|
+
}
|
|
183
|
+
interface IGetSymbolsItem {
|
|
184
|
+
pairKey: string;
|
|
185
|
+
}
|
|
186
|
+
export type IGetSymbols = IGetSymbolsItem[];
|
|
187
|
+
import { CreateOrderArgs, CancelOrderArgs } from "./index.ts";
|
|
188
|
+
export interface ICancelOrderResponse {
|
|
189
|
+
orderId: number;
|
|
190
|
+
isCancelled: boolean;
|
|
191
|
+
amount?: string;
|
|
192
|
+
filledAmount?: string;
|
|
193
|
+
filledTotal?: string;
|
|
194
|
+
averageExecutedPrice?: string;
|
|
195
|
+
}
|
|
196
|
+
export interface ICancelMultipleOrdersResponseItem {
|
|
197
|
+
orderId: number;
|
|
198
|
+
pairId: number;
|
|
199
|
+
isCancelled: boolean;
|
|
200
|
+
reason?: string;
|
|
201
|
+
amount?: string;
|
|
202
|
+
filledAmount?: string;
|
|
203
|
+
filledTotal?: string;
|
|
204
|
+
}
|
|
205
|
+
export type ICancelMultipleOrdersResponse = ICancelMultipleOrdersResponseItem[];
|
|
206
|
+
export interface IMarketForClient {
|
|
207
|
+
getPairList(companyId?: number): Promise<IPairDto[]>;
|
|
208
|
+
getPair(symbol: string | number): Promise<IPairDto>;
|
|
209
|
+
getPrice(symbol: string): Promise<IGetPrice>;
|
|
210
|
+
getDepth(symbol: string, depth: number): Promise<IGetDepth>;
|
|
211
|
+
getSymbols(mask?: string): Promise<IGetSymbols>;
|
|
212
|
+
getLastTrades(symbol: string): Promise<IGetLastTrades>;
|
|
213
|
+
getHistory(symbol: string, interval: string, startTime?: number, endTime?: number, limit?: number, page?: number): Promise<IGetHistoryResponse>;
|
|
214
|
+
getOrders(symbol?: string, status?: number, limit?: number, endTime?: number, startTime?: number): Promise<IOrderDto[]>;
|
|
215
|
+
getOrderById(orderId: number): Promise<Order>;
|
|
216
|
+
getBalances(): Promise<CodexBalanceDto[]>;
|
|
217
|
+
getChains(): Promise<Chain[]>;
|
|
218
|
+
getCodexAssets(): Promise<CodexBalanceDto>;
|
|
219
|
+
getCCTPAssets(): Promise<MappedCCTPAssets>;
|
|
220
|
+
getCCTPUnifiedAssets(): Promise<CCTPUnifiedAssets[]>;
|
|
221
|
+
getWithdrawalFee(assetAddress: string, chainId: number): Promise<IWithdrawalFee>;
|
|
222
|
+
getKycStatus(): Promise<IGetKycStatus>;
|
|
223
|
+
getKycInitLink(embeddedAppUrl: string | null): Promise<IGetKycInitLink>;
|
|
224
|
+
getDollarValues(assetIds?: number[]): Promise<IGetDollarValues>;
|
|
225
|
+
createOrder(order: CreateOrderArgs): Promise<IOrderDto>;
|
|
226
|
+
cancelOrder(order: CancelOrderArgs): Promise<ICancelOrderResponse>;
|
|
227
|
+
cancelMultipleOrders(data: {
|
|
228
|
+
orderIds?: number[];
|
|
229
|
+
pairId?: number;
|
|
230
|
+
}): Promise<ICancelMultipleOrdersResponse>;
|
|
231
|
+
}
|
|
232
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export interface TelegramData {
|
|
2
|
+
auth_date: number;
|
|
3
|
+
id: number;
|
|
4
|
+
first_name: string;
|
|
5
|
+
hash: string;
|
|
6
|
+
photo_url: string;
|
|
7
|
+
username: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ISocialAccount {
|
|
10
|
+
points: number;
|
|
11
|
+
address: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
emailVerified: boolean;
|
|
14
|
+
twitterAccount?: {
|
|
15
|
+
userName: string;
|
|
16
|
+
twitterId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
permissions: {
|
|
19
|
+
canFollowAccounts: boolean;
|
|
20
|
+
canCreateTweets: boolean;
|
|
21
|
+
canLikeTweets: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
telegramAccount?: {
|
|
25
|
+
userName: string;
|
|
26
|
+
telegramId: string;
|
|
27
|
+
};
|
|
28
|
+
discordAccount?: {
|
|
29
|
+
userName: string;
|
|
30
|
+
discordId: string;
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface ILeaderboardItem {
|
|
35
|
+
address: string;
|
|
36
|
+
currentPoints: number;
|
|
37
|
+
tasksCompleted: number;
|
|
38
|
+
twitter?: string;
|
|
39
|
+
discord?: string;
|
|
40
|
+
telegram?: string;
|
|
41
|
+
order: number;
|
|
42
|
+
}
|
|
43
|
+
export interface IUnlock {
|
|
44
|
+
id: number;
|
|
45
|
+
companyId: number;
|
|
46
|
+
seasonId: number;
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
points: number;
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface IAction {
|
|
53
|
+
id: number;
|
|
54
|
+
companyId: number;
|
|
55
|
+
seasonId: number;
|
|
56
|
+
source: string;
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
points: number;
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface IActionHistory {
|
|
63
|
+
id: number;
|
|
64
|
+
address: string;
|
|
65
|
+
companyId: number;
|
|
66
|
+
actionId: number;
|
|
67
|
+
seasonId: number;
|
|
68
|
+
source: string;
|
|
69
|
+
points: number;
|
|
70
|
+
referenceId?: string;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
}
|
|
73
|
+
export interface ISocialSettings {
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
}
|
|
76
|
+
export interface ISocialSeason {
|
|
77
|
+
id: number;
|
|
78
|
+
companyId: number;
|
|
79
|
+
startDate: Date;
|
|
80
|
+
endDate?: Date;
|
|
81
|
+
name: string;
|
|
82
|
+
isSelected: boolean;
|
|
83
|
+
status: string;
|
|
84
|
+
createdAt: Date;
|
|
85
|
+
updatedAt: Date;
|
|
86
|
+
}
|
|
87
|
+
export interface ITelegramConnectResponse {
|
|
88
|
+
address: string;
|
|
89
|
+
telegramId: string;
|
|
90
|
+
userName: string;
|
|
91
|
+
createdAt: Date;
|
|
92
|
+
}
|
|
93
|
+
export interface ICompanyTweet {
|
|
94
|
+
id: string;
|
|
95
|
+
companyId: number;
|
|
96
|
+
seasonId: number;
|
|
97
|
+
type: string;
|
|
98
|
+
text: string;
|
|
99
|
+
enabled: boolean;
|
|
100
|
+
isProcessed: boolean;
|
|
101
|
+
expiresAt: Date;
|
|
102
|
+
createdAt: Date;
|
|
103
|
+
updatedAt: Date;
|
|
104
|
+
}
|
|
105
|
+
export interface IAIStyle {
|
|
106
|
+
id: number;
|
|
107
|
+
title: string;
|
|
108
|
+
content: string;
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
type: string;
|
|
111
|
+
createdAt: Date;
|
|
112
|
+
updatedAt: Date;
|
|
113
|
+
}
|
|
114
|
+
export interface IAIGeneratedComment {
|
|
115
|
+
comment: string | null;
|
|
116
|
+
requestsLeft: number;
|
|
117
|
+
}
|
|
118
|
+
export interface ISocialForClient {
|
|
119
|
+
getSocialAccount(): Promise<ISocialAccount | undefined>;
|
|
120
|
+
addSocialEmail(email: string, embeddedAppUrl: string): Promise<void>;
|
|
121
|
+
verifySocialEmail(email: string, hash: string): Promise<void>;
|
|
122
|
+
getLeaderboards(): Promise<ILeaderboardItem[]>;
|
|
123
|
+
getUnlocks(): Promise<IUnlock[]>;
|
|
124
|
+
getSocialSettings(): Promise<ISocialSettings>;
|
|
125
|
+
getSeason(ultradeId?: number): Promise<ISocialSeason>;
|
|
126
|
+
getPastSeasons(): Promise<ISocialSeason[]>;
|
|
127
|
+
addTelegram(data: TelegramData): Promise<ITelegramConnectResponse>;
|
|
128
|
+
disconnectTelegram(data: TelegramData): Promise<void>;
|
|
129
|
+
getDiscordConnectionUrl(url: string): Promise<string>;
|
|
130
|
+
disconnectDiscord(): Promise<void>;
|
|
131
|
+
getTwitterConnectionUrl(appUrl: string, permissions?: string): Promise<string>;
|
|
132
|
+
disconnectTwitter(): Promise<void>;
|
|
133
|
+
getTweets(): Promise<ICompanyTweet[]>;
|
|
134
|
+
actionWithTweet(data: {
|
|
135
|
+
actions: Array<{
|
|
136
|
+
id: number;
|
|
137
|
+
text?: string;
|
|
138
|
+
}>;
|
|
139
|
+
tweetId?: string;
|
|
140
|
+
}): Promise<void>;
|
|
141
|
+
getActions(): Promise<IAction[]>;
|
|
142
|
+
getActionHistory(): Promise<IActionHistory[]>;
|
|
143
|
+
getAIStyles(): Promise<IAIStyle[]>;
|
|
144
|
+
getAIComment(styleId: number, tweetId: string): Promise<IAIGeneratedComment>;
|
|
145
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Socket } from "socket.io-client";
|
|
2
|
+
import { STREAMS } from "../enum/index.ts";
|
|
3
|
+
export interface SocketIOFactory {
|
|
4
|
+
(url: string, options?: unknown): Socket;
|
|
5
|
+
}
|
|
6
|
+
export interface AppSocketState {
|
|
7
|
+
address: string;
|
|
8
|
+
appId: number;
|
|
9
|
+
orderFilter: string;
|
|
10
|
+
pairKey: string;
|
|
11
|
+
pairId: number;
|
|
12
|
+
}
|
|
13
|
+
interface WSOptions {
|
|
14
|
+
address: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
tradingKey?: string;
|
|
17
|
+
message?: string;
|
|
18
|
+
signature?: string;
|
|
19
|
+
depth?: number;
|
|
20
|
+
companyId?: number;
|
|
21
|
+
interval?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SubscribeOptions {
|
|
24
|
+
symbol: string;
|
|
25
|
+
streams: STREAMS[];
|
|
26
|
+
options: WSOptions;
|
|
27
|
+
}
|
|
28
|
+
export interface ServerToClientEvents {
|
|
29
|
+
reconnect: () => void;
|
|
30
|
+
}
|
|
31
|
+
export interface ClientToServerEvents {
|
|
32
|
+
subscribe: (options: SubscribeOptions) => void;
|
|
33
|
+
unsubscribe: (options: SubscribeOptions) => void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MaintenanceMode } from "../../../shared/dist/browser/enums";
|
|
2
|
+
import { UserNotification } from "./account.interface";
|
|
3
|
+
import { UpdateUserNotificationDto } from "./notification.interface";
|
|
4
|
+
export interface ISystemVersion {
|
|
5
|
+
version: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface ISystemMaintenance {
|
|
8
|
+
mode: MaintenanceMode;
|
|
9
|
+
}
|
|
10
|
+
export interface IUnreadNotificationsCount {
|
|
11
|
+
count: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ISystemForClient {
|
|
14
|
+
getVersion(): Promise<ISystemVersion>;
|
|
15
|
+
getMaintenance(): Promise<ISystemMaintenance>;
|
|
16
|
+
getNotifications(): Promise<UserNotification[]>;
|
|
17
|
+
getNotificationsUnreadCount(): Promise<IUnreadNotificationsCount>;
|
|
18
|
+
readNotifications(notifications: UpdateUserNotificationDto[]): Promise<UpdateUserNotificationDto[]>;
|
|
19
|
+
ping(): Promise<number>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type OrderSide = 'S' | 'B';
|
|
2
|
+
export type OrderType = 'L' | 'I' | 'P' | 'M';
|
|
3
|
+
export interface CancelOrderArgs {
|
|
4
|
+
orderId: number;
|
|
5
|
+
orderSide: OrderSide;
|
|
6
|
+
orderType: OrderType;
|
|
7
|
+
amount: string;
|
|
8
|
+
price: string;
|
|
9
|
+
baseTokenAddress: string;
|
|
10
|
+
baseChain: string;
|
|
11
|
+
baseCurrency: string;
|
|
12
|
+
baseDecimal: number;
|
|
13
|
+
priceTokenAddress: string;
|
|
14
|
+
priceChain: string;
|
|
15
|
+
priceCurrency: string;
|
|
16
|
+
priceDecimal: number;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateOrderArgs {
|
|
19
|
+
pairId: number;
|
|
20
|
+
companyId: number;
|
|
21
|
+
orderSide: OrderSide;
|
|
22
|
+
orderType: OrderType;
|
|
23
|
+
amount: string;
|
|
24
|
+
price: string;
|
|
25
|
+
decimalPrice: number;
|
|
26
|
+
address: string;
|
|
27
|
+
chainId: number;
|
|
28
|
+
baseTokenAddress: string;
|
|
29
|
+
baseTokenChainId: number;
|
|
30
|
+
baseChain: string;
|
|
31
|
+
baseCurrency: string;
|
|
32
|
+
baseDecimal: number;
|
|
33
|
+
priceTokenAddress: string;
|
|
34
|
+
priceTokenChainId: number;
|
|
35
|
+
priceChain: string;
|
|
36
|
+
priceCurrency: string;
|
|
37
|
+
priceDecimal: number;
|
|
38
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { SuggestedParams } from 'algosdk';
|
|
2
|
+
import { TradingKeyType, PaginatedResult, ISafeWithdrawalWallets, UpdateWithdrawalWallet, CreateWithdrawalWallet } from "../../../shared/dist/browser/interfaces";
|
|
3
|
+
import { ACTION_TYPE, OperationStatusEnum, TransactionType } from '../enum/index.ts';
|
|
4
|
+
export interface TxnParams {
|
|
5
|
+
suggestedParams: SuggestedParams;
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
amount: number;
|
|
9
|
+
assetIndex?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface OperationTxn {
|
|
12
|
+
txn_hash: string;
|
|
13
|
+
chain_id: number;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
type?: TransactionType;
|
|
17
|
+
}
|
|
18
|
+
export interface OperationVAA {
|
|
19
|
+
vaaId: string;
|
|
20
|
+
from_chain_id: number;
|
|
21
|
+
to_chain_id: number;
|
|
22
|
+
sequence: number;
|
|
23
|
+
emitter: string;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
}
|
|
27
|
+
export interface OperationCCTP {
|
|
28
|
+
id: number;
|
|
29
|
+
destinationChainId: number;
|
|
30
|
+
messageHash: string;
|
|
31
|
+
messageBytes: string;
|
|
32
|
+
status: OperationStatusEnum;
|
|
33
|
+
attestationSignature: string;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
updatedAt: Date;
|
|
36
|
+
attestationCompletedAt: Date;
|
|
37
|
+
}
|
|
38
|
+
export interface ITransactionDetails {
|
|
39
|
+
primaryId: number;
|
|
40
|
+
id: string;
|
|
41
|
+
login_address: string;
|
|
42
|
+
login_chain_id: number;
|
|
43
|
+
action_type: 'withdraw' | 'deposit';
|
|
44
|
+
status: OperationStatusEnum;
|
|
45
|
+
amount: string;
|
|
46
|
+
targetAddress: string;
|
|
47
|
+
timestamp: string;
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
updatedAt: Date;
|
|
50
|
+
vaa_message?: Buffer;
|
|
51
|
+
fee: string | null;
|
|
52
|
+
transactions: Array<OperationTxn>;
|
|
53
|
+
vaaMessages: Array<OperationVAA>;
|
|
54
|
+
cctp: Array<OperationCCTP>;
|
|
55
|
+
}
|
|
56
|
+
export interface ITransaction {
|
|
57
|
+
primaryId: number;
|
|
58
|
+
id: string;
|
|
59
|
+
action_type: ACTION_TYPE;
|
|
60
|
+
status: OperationStatusEnum;
|
|
61
|
+
amount: string;
|
|
62
|
+
targetAddress: string;
|
|
63
|
+
createdAt?: Date;
|
|
64
|
+
updatedAt: Date;
|
|
65
|
+
vaa_message?: Buffer;
|
|
66
|
+
fee: string | null;
|
|
67
|
+
token_id: {
|
|
68
|
+
id: number;
|
|
69
|
+
address: string;
|
|
70
|
+
chainId: number;
|
|
71
|
+
unitName: string;
|
|
72
|
+
name: string;
|
|
73
|
+
decimals: number;
|
|
74
|
+
};
|
|
75
|
+
transactions: Array<{
|
|
76
|
+
txnHash: string;
|
|
77
|
+
chainId: number;
|
|
78
|
+
}>;
|
|
79
|
+
vaaMessages: Array<OperationVAA>;
|
|
80
|
+
}
|
|
81
|
+
export interface ITradingKey {
|
|
82
|
+
address: string;
|
|
83
|
+
createdAt: Date;
|
|
84
|
+
expiredAt: Date;
|
|
85
|
+
orders: number;
|
|
86
|
+
device: string;
|
|
87
|
+
type?: TradingKeyType;
|
|
88
|
+
}
|
|
89
|
+
export interface ITransfer {
|
|
90
|
+
transferId: number;
|
|
91
|
+
senderAddress: string;
|
|
92
|
+
recipientAddress: string;
|
|
93
|
+
tokenId: number;
|
|
94
|
+
amount: string;
|
|
95
|
+
expiredAt: number;
|
|
96
|
+
whitelistId: number;
|
|
97
|
+
txnId: string;
|
|
98
|
+
completedAt: Date;
|
|
99
|
+
status: OperationStatusEnum;
|
|
100
|
+
}
|
|
101
|
+
export interface IPendingTxn {
|
|
102
|
+
id: number;
|
|
103
|
+
type: ACTION_TYPE;
|
|
104
|
+
amount: string;
|
|
105
|
+
tokenId: number;
|
|
106
|
+
}
|
|
107
|
+
export interface IWhiteList {
|
|
108
|
+
id?: number;
|
|
109
|
+
loginAddress: string;
|
|
110
|
+
loginChainId: number;
|
|
111
|
+
recipient: string;
|
|
112
|
+
recipientChainId: number;
|
|
113
|
+
tkAddress: string;
|
|
114
|
+
expiredDate: number;
|
|
115
|
+
}
|
|
116
|
+
export interface IGetWhiteList {
|
|
117
|
+
id: number;
|
|
118
|
+
recipientAddress: string;
|
|
119
|
+
tkAddress: string;
|
|
120
|
+
expiredAt: number;
|
|
121
|
+
}
|
|
122
|
+
import { IWithdrawData, ITransferData } from "../../../shared/dist/browser/interfaces";
|
|
123
|
+
export interface IWithdrawResponse {
|
|
124
|
+
operationId: string;
|
|
125
|
+
txnId: string;
|
|
126
|
+
}
|
|
127
|
+
export interface IWalletForClient {
|
|
128
|
+
getTransactionDetalis(transactionId: number): Promise<ITransactionDetails>;
|
|
129
|
+
getPendingTransactions(): Promise<IPendingTxn[]>;
|
|
130
|
+
getWhitelist(): Promise<PaginatedResult<IGetWhiteList>>;
|
|
131
|
+
addWhitelist(data: IWhiteList): Promise<IGetWhiteList>;
|
|
132
|
+
deleteWhitelist(whitelistId: number): Promise<void>;
|
|
133
|
+
getWalletTransactions(type: string, page: number, limit?: number): Promise<PaginatedResult<ITransaction>>;
|
|
134
|
+
getTradingKeys(): Promise<ITradingKey>;
|
|
135
|
+
getTransfers(page: number, limit?: number): Promise<PaginatedResult<ITransfer>>;
|
|
136
|
+
getAllWithdrawalWallets(): Promise<ISafeWithdrawalWallets[]>;
|
|
137
|
+
getWithdrawalWalletByAddress(address: string): Promise<ISafeWithdrawalWallets>;
|
|
138
|
+
createWithdrawalWallet(body: CreateWithdrawalWallet): Promise<ISafeWithdrawalWallets>;
|
|
139
|
+
updateWithdrawalWallet(params: UpdateWithdrawalWallet): Promise<boolean>;
|
|
140
|
+
deleteWithdrawalWallet(address: string): Promise<boolean>;
|
|
141
|
+
withdraw(withdrawData: IWithdrawData, prettyMsg?: string): Promise<IWithdrawResponse>;
|
|
142
|
+
transfer(transferData: ITransferData): Promise<ITransfer>;
|
|
143
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Socket } from 'socket.io-client';
|
|
2
|
+
import { SubscribeOptions, SocketIOFactory } from './interface/index.ts';
|
|
2
3
|
export declare class SocketManager {
|
|
3
4
|
private onDisconnect?;
|
|
4
5
|
private onConnectError?;
|
|
@@ -8,7 +9,7 @@ export declare class SocketManager {
|
|
|
8
9
|
private socketIOFactory;
|
|
9
10
|
constructor(url: string, socketIOFactory: SocketIOFactory, onDisconnect?: (socketId: string) => void, onConnectError?: (error: Error) => void);
|
|
10
11
|
private initializeSocket;
|
|
11
|
-
getSocket():
|
|
12
|
+
getSocket(): Socket | null;
|
|
12
13
|
subscribe(subscribeOptions: SubscribeOptions, callback: Function): number;
|
|
13
14
|
unsubscribe(handlerId: number): void;
|
|
14
15
|
disconnect(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import algosdk, { Transaction, SuggestedParams } from 'algosdk';
|
|
2
|
-
import { AuthCredentials,
|
|
2
|
+
import { AuthCredentials, Signer, OrderSide } from '../interface/index.ts';
|
|
3
3
|
export declare class AlgodService {
|
|
4
4
|
private client;
|
|
5
5
|
private authCredentials;
|
|
@@ -13,13 +13,9 @@ export declare class AlgodService {
|
|
|
13
13
|
get signer(): Signer;
|
|
14
14
|
set signer(value: Signer);
|
|
15
15
|
signAndSend(txnGroup: Transaction[] | Transaction): Promise<any>;
|
|
16
|
-
signAndSendData(data: object | string, signMessage: (msg: string, encoding?: BufferEncoding) => Promise<string>, sendAction: (signedData: {
|
|
16
|
+
signAndSendData<TResponse>(data: object | string, signMessage: (msg: string, encoding?: BufferEncoding) => Promise<string>, sendAction: (signedData: {
|
|
17
17
|
signature: string;
|
|
18
|
-
}) => Promise<
|
|
19
|
-
signature: string;
|
|
20
|
-
}>, encoding?: BufferEncoding): Promise<{
|
|
21
|
-
signature: string;
|
|
22
|
-
}>;
|
|
18
|
+
}) => Promise<TResponse>, encoding?: BufferEncoding): Promise<TResponse>;
|
|
23
19
|
getTxnParams(): Promise<SuggestedParams>;
|
|
24
20
|
getCurrentAccount(): {
|
|
25
21
|
addr: string;
|
|
@@ -30,6 +26,8 @@ export declare class AlgodService {
|
|
|
30
26
|
validateCredentials(): void;
|
|
31
27
|
getAppState(appId: number): Promise<any>;
|
|
32
28
|
getSuperAppId(appId: number): Promise<any>;
|
|
33
|
-
getPairBalances(appId: number, address: string): Promise<
|
|
29
|
+
getPairBalances(appId: number, address: string): Promise<{
|
|
30
|
+
[k: string]: any;
|
|
31
|
+
}>;
|
|
34
32
|
calculateTransferAmount(appId: number, address: string, side: OrderSide, quantity: number, price: number, decimal: number): Promise<number>;
|
|
35
33
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
export interface ExtendedAxiosRequestConfig<T = any> extends AxiosRequestConfig<T> {
|
|
3
|
+
withWalletCredentials?: boolean;
|
|
4
|
+
url?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function createExtendedConfig<T>(config: ExtendedAxiosRequestConfig<T>): ExtendedAxiosRequestConfig<T>;
|