Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Oct 31, 2024
1 parent 0b3bacc commit e86659a
Show file tree
Hide file tree
Showing 69 changed files with 5,230 additions and 387 deletions.
9 changes: 9 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/ApplyCode.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
POST
/api/v4/main-account/codes/apply
true
{
"message": "Code was successfully applied",
"ticker": "ETH",
"amount": "0.002",
"external_id": "be08a482-5faf-11ed-9b6a-0242ac120002"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POST
/api/v4/sub-account/block
true
8 changes: 8 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/CreateCode.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
POST
/api/v4/main-account/codes
true
{
"code": "WBe11f4fce-2a53-4edc-b195-66b693bd77e3ETH",
"message": "Code was successfully created",
"external_id": "be08a482-5faf-11ed-9b6a-0242ac120002"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
POST
/api/v4/main-account/create-new-address
true
{
"account": {
"address": "GDTSOI56XNVAKJNJBLJGRNZIVOCIZJRBIDKTWSCYEYNFAZEMBLN75RMN",
"memo": "48565488244493"
},
"required": {
"maxAmount": "0",
"minAmount": "1",
"fixedFee": "0",
"flexFee": {
"maxFee": "0",
"minFee": "0",
"percent": "0"
}
}
}
19 changes: 19 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/CreateSubAccount.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
POST
/api/v4/sub-account/create
true
{
"id": "8e667b4a-0b71-4988-8af5-9474dbfaeb51",
"alias": "training",
"userId": "0d7b66ff-1909-4938-ab7a-d16d9a64dcd5",
"email": "e***@g***m",
"status": "active",
"color": "#FF0000",
"kyc" : {
"shareKyc": true,
"kycStatus": "shared"
},
"permissions": {
"spotEnabled": true,
"collateralEnabled": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POST
/api/v4/sub-account/delete
true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POST
/api/v4/sub-account/edit
true
27 changes: 27 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/GetCodeHistory.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
POST
/api/v4/main-account/codes/history
true
{
"total": 29,
"data": [
{
"amount": "+0.002",
"code": "WBe11f4fce-2a53-4edc-b195-66b693bd77e3ETH",
"date": 1598296734,
"status": "Activated",
"ticker": "ETH",
"external_id": "cf7c3ff8-5eb0-11ed-9b6a-0242ac120002"
},
{
"amount": "-0.002",
"code": "WBe11f4fce-2a53-4edc-b195-66b693bd77e3ETH",
"date": 1598296332,
"status": "Activated",
"ticker": "ETH",
"external_id": "52995812-5eb1-11ed-9b6a-0242ac120002"
}
],
"limit": 100,
"offset": 0
}

18 changes: 18 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/GetCreatedCodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
GET
/api/v4/main-account/codes/my
true
{
"total": 15,
"data": [
{
"amount": "0.002",
"code": "WBe11f4fce-2a53-4edc-b195-66b693bd77e3ETH",
"date": 1598296332,
"status": "Activated",
"ticker": "ETH",
"external_id": "cf7c3ff8-5eb0-11ed-9b6a-0242ac120002"
}
],
"limit": 30,
"offset": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
POST
/api/v4/main-account/history
true
{
"limit": 100,
"offset": 0,
"records": [
{
"address": "3ApEASLcrQtZpg1TsssFgYF5V5YQJAKvuE",
"uniqueId": null,
"createdAt": 1593437922,
"currency": "Bitcoin",
"ticker": "BTC",
"method": 1,
"amount": "0.0006",
"description": "",
"memo": "",
"fee": "0",
"status": 15,
"network": null,
"transactionHash": "a275a514013e4e0f927fd0d1bed215e7f6f2c4c6ce762836fe135ec22529d886",
"transactionId": "5e112b38-9652-11ed-a1eb-0242ac120002",
"details": {
"partial": {
"requestAmount": "50000",
"processedAmount": "39000",
"processedFee": "273",
"normalizeTransaction": ""
}
},
"confirmations": {
"actual": 1,
"required": 2
}
}
],
"total": 300
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
POST
/api/v4/main-account/fee
true
[
{
"ticker": "BTC",
"name": "Bitcoin",
"can_deposit": "0",
"can_withdraw": "0",
"deposit": {
"minFlex": "0",
"maxFlex": "0",
"percentFlex": "0",
"fixed": "0",
"minAmount": "0.0005",
"maxAmount": "0"
},
"withdraw": {
"minFlex": "0",
"maxFlex": "0",
"percentFlex": "0",
"fixed": "0.0004",
"minAmount": "0.001",
"maxAmount": "0"
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
POST
/api/v4/main-account/fiat-deposit-url
true
{
"url": "https://someaddress.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
POST
/api/v4/mining/rewards
true
{
"offset": 0,
"limit": 25,
"data": [
{
"miningAccountName": "my-mining-account-01",
"totalReward": "3.15",
"reward": "3.14",
"fee": "0.01",
"fppsRate": "0.00000068",
"hashRate": "658425440887845683",
"date": 1715339355
}
]
}
25 changes: 25 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/GetSubAccounts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
POST
/api/v4/sub-account/list
true
{
"offset": 0,
"limit": 10,
"data": [
{
"id": "8e667b4a-0b71-4988-8af5-9474dbfaeb51",
"alias": "training",
"userId": "0d7b66ff-1909-4938-ab7a-d16d9a64dcd5",
"email": "e***@g***m",
"status": "active",
"color": "#FF0000",
"kyc" : {
"shareKyc": true,
"kycStatus": "shared"
},
"permissions": {
"spotEnabled": true,
"collateralEnabled": false
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
POST
/api/v4/sub-account/transfer/history
true
{
"offset": 0,
"limit": 30,
"data": [
{
"id": "0d7b66ff-1909-4938-ab7a-d16d9a64dcd5",
"direction": "main_to_sub",
"currency": "USDT",
"amount": "3.14",
"createdAt": 1715339355
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POST
/api/v4/sub-account/transfer
true
4 changes: 4 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/Transfer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POST
/api/v4/main-account/transfer
true
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POST
/api/v4/sub-account/unblock
true
4 changes: 4 additions & 0 deletions WhiteBit.Net.UnitTests/Endpoints/V4/Account/Withdraw.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POST
/api/v4/main-account/withdraw
true
[]
26 changes: 23 additions & 3 deletions WhiteBit.Net.UnitTests/RestRequestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using System.Threading.Tasks;
using WhiteBit.Net.Clients;
using WhiteBit.Net.Enums;

namespace WhiteBit.Net.UnitTests
{
Expand All @@ -21,9 +22,28 @@ public async Task ValidateV4AccountCalls()
opts.ApiCredentials = new CryptoExchange.Net.Authentication.ApiCredentials("123", "456");
});
var tester = new RestRequestValidator<WhiteBitRestClient>(client, "Endpoints/V4/Account", "https://whitebit.com", IsAuthenticated, stjCompare: true);
await tester.ValidateAsync(client => client.V4Api.Account.GetConvertEstimateAsync("123", "123", 0.1m, "123"), "GetConvertEstimate");
await tester.ValidateAsync(client => client.V4Api.Account.ConfirmConvertAsync("123"), "ConfirmConvert");
await tester.ValidateAsync(client => client.V4Api.Account.GetConvertHistoryAsync(), "GetConvertHistory");
await tester.ValidateAsync(client => client.V4Api.Convert.GetConvertEstimateAsync("123", "123", 0.1m, "123"), "GetConvertEstimate");
await tester.ValidateAsync(client => client.V4Api.Convert.ConfirmConvertAsync("123"), "ConfirmConvert");
await tester.ValidateAsync(client => client.V4Api.Convert.GetConvertHistoryAsync(), "GetConvertHistory");
await tester.ValidateAsync(client => client.V4Api.Account.GetFiatDepositAddressAsync("123", "123", 0.1m, "123"), "GetFiatDepositAddress");
await tester.ValidateAsync(client => client.V4Api.Account.WithdrawAsync("123", 0.1m, "123", "123", true), "Withdraw");
await tester.ValidateAsync(client => client.V4Api.Account.TransferAsync(AccountType.Spot, AccountType.Main, "123", 0.1m), "Transfer"); ;
await tester.ValidateAsync(client => client.V4Api.Account.GetDepositWithdrawalHistoryAsync(), "GetDepositWithdrawalHistory");
await tester.ValidateAsync(client => client.V4Api.Account.CreateDepositAddressAsync("123"), "CreateDepositAddress");
await tester.ValidateAsync(client => client.V4Api.Account.GetDepositWithdrawalSettingsAsync(), "GetDepositWithdrawalSettings");
await tester.ValidateAsync(client => client.V4Api.Account.GetMiningRewardHistoryAsync(), "GetMiningRewardHistory");
await tester.ValidateAsync(client => client.V4Api.Codes.CreateCodeAsync("123", 0.1m), "CreateCode");
await tester.ValidateAsync(client => client.V4Api.Codes.ApplyCodeAsync("123"), "ApplyCode");
await tester.ValidateAsync(client => client.V4Api.Codes.GetCreatedCodesAsync(), "GetCreatedCodes");
await tester.ValidateAsync(client => client.V4Api.Codes.GetCodeHistoryAsync(), "GetCodeHistory");
await tester.ValidateAsync(client => client.V4Api.SubAccount.CreateSubAccountAsync("123"), "CreateSubAccount");
await tester.ValidateAsync(client => client.V4Api.SubAccount.DeleteSubAccountAsync("123"), "DeleteSubAccount");
await tester.ValidateAsync(client => client.V4Api.SubAccount.EditSubAccountAsync("123", "123", "123", "123"), "EditSubAccount");
await tester.ValidateAsync(client => client.V4Api.SubAccount.GetSubAccountsAsync(), "GetSubAccounts");
await tester.ValidateAsync(client => client.V4Api.SubAccount.SubaccountTransferAsync("123", SubTransferDirection.ToSubAccount, "123", 0.1m), "SubaccountTransfer");
await tester.ValidateAsync(client => client.V4Api.SubAccount.BlockSubaccountAsync("123"), "BlockSubaccount");
await tester.ValidateAsync(client => client.V4Api.SubAccount.UnblockSubaccountAsync("123"), "UnblockSubaccount");
await tester.ValidateAsync(client => client.V4Api.SubAccount.GetSubaccountTransferHistoryAsync(), "GetSubaccountTransferHistory");
}

[Test]
Expand Down
Loading

0 comments on commit e86659a

Please sign in to comment.