Skip to content

Commit e79c7a2

Browse files
authored
Merge pull request #31 from cryptomkt/feat/update-january-2025
Feat/update january 2025
2 parents a89b0bd + 8da5fb6 commit e79c7a2

File tree

9 files changed

+127
-29
lines changed

9 files changed

+127
-29
lines changed

lib/client.ts

Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { HttpClient } from "./httpClient";
1919
import {
2020
ACLSettings,
2121
Address,
22+
WhitelistAddress,
2223
AmountLock,
2324
Balance,
2425
Candle,
@@ -824,6 +825,7 @@ export class Client {
824825
* @param {string} params.newClientOrderId clientOrderId for the new order.
825826
* @param {string} params.quantity Order quantity.
826827
* @param {string} [params.price] Required if order type is limit, stopLimit, or takeProfitLimit. Order price.
828+
* @param {string} [params.stopPrice] Required if order type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket. Order price
827829
* @param {boolean} [params.strictValidate] Optional. Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tickSize and quantityIncrement.
828830
*
829831
* @returns the new spot order
@@ -834,6 +836,7 @@ export class Client {
834836
newClientOrderId: string;
835837
quantity: string;
836838
price?: string;
839+
stop_price?: string;
837840
strictValidate?: boolean;
838841
}
839842
): Promise<Order> {
@@ -999,6 +1002,19 @@ export class Client {
9991002
return balance;
10001003
}
10011004

1005+
/**
1006+
* Gets the list of whitelisted addresses
1007+
*
1008+
* Requires the "Payment information" API key Access Right
1009+
*
1010+
* https://api.exchange.cryptomkt.com/#get-whitelisted-addresses
1011+
*
1012+
* @return the list of white listed addresses
1013+
*/
1014+
getWhitelistedAddresses(): Promise<WhitelistAddress[]> {
1015+
return this.get(`wallet/crypto/address/white-list`);
1016+
}
1017+
10021018
/**
10031019
* Get the current addresses of the user
10041020
*
@@ -1197,6 +1213,21 @@ Accepted values: never, optionally, required
11971213
return this.post("wallet/crypto/fee/estimate/bulk", feeRequests);
11981214
}
11991215

1216+
1217+
/**
1218+
* Gets the hash of withdrawal fees
1219+
*
1220+
* Requires the "Payment information" API key Access Right
1221+
*
1222+
* https://api.exchange.cryptomkt.com/#get-withdrawal-fees-hash
1223+
*
1224+
* @return the fees hash
1225+
*/
1226+
async getWithdrawalFeesHash(): Promise<String[]> {
1227+
const response = await this.get("wallet/crypto/fee/withdraw/hash");
1228+
return response['hash'];
1229+
}
1230+
12001231
/**
12011232
* Get an estimate of a withdrawal fee
12021233
*
@@ -1220,20 +1251,20 @@ Accepted values: never, optionally, required
12201251
return response["fee"];
12211252
}
12221253

1223-
// /**
1224-
// * Get estimates of deposit fees
1225-
// *
1226-
// * Requires the "Payment information" API key Access Right.
1227-
// *
1228-
// * https://api.exchange.cryptomkt.com/#bulk-estimate-deposit-fee
1229-
// *
1230-
// * @param {FeeRequest[]} feeRequests A list of fee requests
1231-
// *
1232-
// * @return The list of requested fees
1233-
// */
1234-
// async getBulkEstimateDepositFees(feeRequests: FeeRequest[]): Promise<Fee[]> {
1235-
// return this.post("wallet/crypto/fee/deposit/estimate/bulk", feeRequests);
1236-
// }
1254+
// /**
1255+
// * Get estimates of deposit fees
1256+
// *
1257+
// * Requires the "Payment information" API key Access Right.
1258+
// *
1259+
// * https://api.exchange.cryptomkt.com/#bulk-estimate-deposit-fee
1260+
// *
1261+
// * @param {FeeRequest[]} feeRequests A list of fee requests
1262+
// *
1263+
// * @return The list of requested fees
1264+
// */
1265+
// async getBulkEstimateDepositFees(feeRequests: FeeRequest[]): Promise<Fee[]> {
1266+
// return this.post("wallet/crypto/fee/deposit/estimate/bulk", feeRequests);
1267+
// }
12371268

12381269
// /**
12391270
// * Get an estimate of a deposit fee
@@ -1559,6 +1590,63 @@ Accepted values: wallet, spot. Must not be the same as source
15591590
return response["response"];
15601591
}
15611592

1593+
/**
1594+
* Creates and commits a transfer from a subaccount to its super account
1595+
*
1596+
* Call is being sent by a subaccount
1597+
*
1598+
* Created but not committed transfer will reserve pending amount on the sender
1599+
* wallet affecting their ability to withdraw or transfer crypto to another
1600+
* account. Incomplete withdrawals affect subaccount transfers the same way
1601+
*
1602+
* Requires the "Withdraw cryptocurrencies" API key Access Right
1603+
*
1604+
* https://api.exchange.cryptomkt.com/#transfer-to-super-account
1605+
*
1606+
* @param {object} params Parameters
1607+
* @param {number} params.amount the amount of currency to transfer
1608+
* @param {string} params.currency the currency to transfer
1609+
*
1610+
* @return The transaction ID of the tranfer
1611+
*/
1612+
async transferToSuperAccount(params: {
1613+
amount: number;
1614+
currency: string;
1615+
}): Promise<string> {
1616+
const response = await this.post("sub-account/transfer/sub-to-super", params);
1617+
return response["response"];
1618+
}
1619+
1620+
/**
1621+
* Creates and commits a transfer between the user (subaccount) and another
1622+
* subaccount.
1623+
*
1624+
* Call is being sent by a subaccount
1625+
*
1626+
* Created but not committed transfer will reserve pending amount on the sender
1627+
* wallet affecting their ability to withdraw or transfer crypto to another
1628+
* account. Incomplete withdrawals affect subaccount transfers the same way
1629+
*
1630+
* Requires the "Withdraw cryptocurrencies" API key Access Right
1631+
*
1632+
* https://api.exchange.cryptomkt.com/#transfer-across-subaccounts
1633+
*
1634+
* @param {object} params Parameters
1635+
* @param {number} params.subAccountId The account ID of the account to transfer to
1636+
* @param {number} params.amount the amount of currency to transfer
1637+
* @param {string} params.currency the currency to transfer
1638+
*
1639+
* @return The transaction ID of the tranfer
1640+
*/
1641+
async transferToAnotherSubAccount(params: {
1642+
subAccountId: number;
1643+
amount: number;
1644+
currency: string;
1645+
}): Promise<string> {
1646+
const response = await this.post("sub-account/transfer/sub-to-sub", params);
1647+
return response["response"];
1648+
}
1649+
15621650
/**
15631651
* Returns a list of withdrawal settings for sub-accounts listed
15641652
*

lib/models.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ export * from "./models/WSCandle";
2323
export * from "./models/WSTicker";
2424
export * from "./models/WSTrades";
2525
export * from "./models/Fee";
26-
export * from "./models/FeeRequest";
26+
export * from "./models/FeeRequest";
27+
export * from "./models/WhitelistAddress";

lib/models/Address.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export interface Address {
22
address: string;
33
currency: string;
4-
paymentId: string;
5-
publicKey: string;
6-
netwokdCode: string;
4+
paymentId?: string;
5+
publicKey?: string;
6+
networkCode?: string;
77
}

lib/models/Order.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface Order {
2626
originalClientOrderId: string;
2727
orderListId: string;
2828
contingencyType: CONTINGENCY;
29+
priceAverage: string;
2930
}
3031

3132
export interface OrderRequest {

lib/models/Price.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export interface Price {
2-
currency: string;
3-
price: string;
2+
currency?: string;
3+
price?: string;
44
timestamp: string;
55
}

lib/models/WhitelistAddress.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface WhitelistAddress {
2+
address: string;
3+
currency: string;
4+
name: string;
5+
network: string;
6+
}

lib/websocket/tradingClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export class TradingClient extends AuthClient {
177177
* @param {string} params.newClientOrderId the new client order id for the modified order. must be unique within the trading day
178178
* @param {string} params.quantity new order quantity
179179
* @param {string} params.price new order price
180+
* @param {string} [params.stopPrice] Required if order type is stopLimit, stopMarket, takeProfitLimit, or takeProfitMarket. Order price
180181
* @param {boolean} [params.strictValidate] price and quantity will be checked for the incrementation with tick size and quantity step. See symbol's tickSize and quantityIncrement
181182
* @return A promise that resolves with a report of the modified order
182183
*/
@@ -185,6 +186,7 @@ export class TradingClient extends AuthClient {
185186
newClientOrderId: string;
186187
quantity: string;
187188
price: string;
189+
stop_price?: string;
188190
strictValidate?: Boolean;
189191
}): Promise<Report> {
190192
const report = await this.makeRequest<Report>({

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"bigdecimal": "0.6.1",
4040
"crypto-js": "4.2.0",
4141
"node-fetch": "^2.6.1",
42-
"ws": "^7.4.0"
42+
"ws": "8.18.0"
4343
},
4444
"devDependencies": {
4545
"@types/chai": "4.3.11",

0 commit comments

Comments
 (0)