File tree Expand file tree Collapse file tree 6 files changed +2380
-1480
lines changed Expand file tree Collapse file tree 6 files changed +2380
-1480
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
GetAccountBalanceResponse ,
18
18
GenerateNewAPIKeyResponse ,
19
19
AccountBalance ,
20
+ GetAPIKeyResponse ,
20
21
// AccountStream,
21
22
// AccountBalanceStream,
22
23
} from '../../types' ;
@@ -65,6 +66,11 @@ export class Accounts extends Api {
65
66
return this . resolveAxiosData ( res ) ;
66
67
}
67
68
69
+ public getApiKey ( ) : Promise < GetAPIKeyResponse > {
70
+ const res = this . axiosInstance . get ( '/accounts/api-key' ) ;
71
+ return this . resolveAxiosData ( res ) ;
72
+ }
73
+
68
74
public buildDepositTransaction (
69
75
data : BuildDepositTransactionRequest ,
70
76
) : Promise < BuildDepositTransactionResponse > {
Original file line number Diff line number Diff line change 1
1
import { AxiosInstance } from 'axios' ;
2
2
import { Api } from '../api' ;
3
- import { GetTermsAndConditionResponse } from '../../types' ;
3
+ import { GetHydraCycleResponse , GetTermsAndConditionResponse } from '../../types' ;
4
4
5
5
export class App extends Api {
6
6
private axiosInstance : AxiosInstance ;
@@ -14,4 +14,9 @@ export class App extends Api {
14
14
const res = this . axiosInstance . get ( '/app/terms-and-conditions' ) ;
15
15
return this . resolveAxiosData ( res ) ;
16
16
}
17
+
18
+ public getHydraCycle ( ) : Promise < GetHydraCycleResponse > {
19
+ const res = this . axiosInstance . get ( '/app/hydra-cycle' ) ;
20
+ return this . resolveAxiosData ( res ) ;
21
+ }
17
22
}
Original file line number Diff line number Diff line change 1
1
export type TradingSymbol = 'ADAUSDX' ;
2
2
3
- export type OrderStatus = 'building' | 'open' | 'closed' | 'failed' | 'cancelled' ;
3
+ export type OrderStatus = 'building' | 'processing' | ' open' | 'closed' | 'failed' | 'cancelled' ;
4
4
5
5
export type OrderSide = 'buy' | 'sell' ;
6
6
@@ -16,18 +16,34 @@ export const OrderTypes = {
16
16
LimitOrder : 'limit' as OrderType ,
17
17
} ;
18
18
19
+ export type OrderExecutionRole = 'maker' | 'taker' ;
20
+
21
+ export type OrderExecutionRecordJSON = {
22
+ id : string ;
23
+ order_id : string ;
24
+ execution_price : number ;
25
+ filled_amount : string ;
26
+ fee_unit : string ;
27
+ fee_amount : string ;
28
+ role : OrderExecutionRole ;
29
+ counter_party_order_id : string ;
30
+ create_time : number ;
31
+ } ;
32
+
19
33
export type OrderJSON = {
20
34
order_id : string ;
21
35
status : OrderStatus ;
22
36
symbol : TradingSymbol ;
23
37
orig_qty : string ;
24
38
executed_qty : string ;
25
39
side : OrderSide ;
26
- price : string ;
40
+ price : number ;
27
41
type : OrderType ;
28
- fee_amount : number ;
42
+ fee_charged : string ;
43
+ fee_unit : string ;
29
44
executed_price : number ;
30
45
slippage : string ;
31
46
create_time : number ;
32
47
update_time : number ;
48
+ fills ?: OrderExecutionRecordJSON [ ] ;
33
49
} ;
Original file line number Diff line number Diff line change 1
- import { Asset , UTxO } from '@meshsdk/core' ;
1
+ import { UTxO } from '@meshsdk/core' ;
2
2
import { TradingSymbol , OrderSide , OrderType } from '../models/order' ;
3
3
4
4
// SignInRequest to be refactored
@@ -12,6 +12,11 @@ export type SignInRequest = {
12
12
// quantity: number;
13
13
// };
14
14
15
+ export type Asset = {
16
+ unit : string ;
17
+ quantity : string ;
18
+ } ;
19
+
15
20
export type BuildDepositTransactionRequest = {
16
21
deposit_amount : Asset [ ] ;
17
22
input_utxos : UTxO [ ] ;
@@ -34,7 +39,7 @@ export type GetMarketDepthRequest = {
34
39
} ;
35
40
36
41
export type GetMarketPriceRequest = {
37
- pair : string ;
42
+ pair : TradingSymbol ;
38
43
} ;
39
44
40
45
export type Interval = '15m' | '30m' | '1h' | '1d' | '1w' | '1M' ;
@@ -53,7 +58,7 @@ export type BuildPlaceOrderTransactionRequest = {
53
58
quantity : number ;
54
59
price ?: number ;
55
60
max_slippage_basis_point ?: number ;
56
- max_slippage ? : boolean ;
61
+ max_slippage : boolean ;
57
62
} ;
58
63
59
64
export type PostOrderRequest = BuildPlaceOrderTransactionRequest ;
@@ -70,3 +75,9 @@ export type BuildCancelOrderTransactionRequest = {
70
75
export type SubmitCancelOrderTransactionRequest = {
71
76
signed_tx : string ;
72
77
} ;
78
+
79
+ export type Status = 'open' | 'closed' ;
80
+
81
+ export type GetOrderRecordRequest = {
82
+ status ?: Status ;
83
+ } ;
Original file line number Diff line number Diff line change @@ -31,12 +31,7 @@ export type SignInResponse = {
31
31
// tx_hash: string;
32
32
// };
33
33
34
- export type TransactionStatus =
35
- | 'building'
36
- | 'held_for_order'
37
- | 'submitted'
38
- | 'submission_failed'
39
- | 'confirmed' ;
34
+ export type TransactionStatus = 'building' | 'submitted' | 'submission_failed' | 'confirmed' ;
40
35
41
36
export type DepositRecord = {
42
37
created_at : string ;
@@ -53,6 +48,7 @@ export type GetOrderRecordResponse = {
53
48
54
49
export type WithdrawalRecord = {
55
50
created_at : string ;
51
+ status : TransactionStatus ;
56
52
assets : Asset [ ] ;
57
53
} ;
58
54
@@ -62,6 +58,7 @@ export type GetAccountBalanceResponse = AccountBalance[];
62
58
63
59
export type GenerateNewAPIKeyResponse = {
64
60
api_key : string ;
61
+ created_at : string ;
65
62
} ;
66
63
67
64
export type BuildDepositTransactionResponse = {
@@ -80,9 +77,7 @@ export type SubmitWithdrawalTransactionResponse = {
80
77
tx_hash : string ;
81
78
} ;
82
79
83
- export type GetTermsAndConditionResponse = {
84
- value : string ;
85
- } ;
80
+ export type GetTermsAndConditionResponse = string ;
86
81
87
82
export type MarketDepth = {
88
83
price : number ;
@@ -128,3 +123,13 @@ export type BuildCancelOrderTransactionResponse = {
128
123
export type SubmitCancelOrderTransactionResponse = {
129
124
tx_hash : string ;
130
125
} ;
126
+
127
+ export type GetAPIKeyResponse = {
128
+ api_key : string ;
129
+ created_at : string ;
130
+ } ;
131
+
132
+ export type GetHydraCycleResponse = {
133
+ start : string ;
134
+ end : string ;
135
+ } ;
You can’t perform that action at this time.
0 commit comments