v3.4.0: feat(#219) add support for account asset v3 REST endpoints

This commit is contained in:
tiagosiebler
2023-02-13 17:20:03 +00:00
parent 0c0900e608
commit 6fa204e8bd
11 changed files with 870 additions and 49 deletions

View File

@@ -0,0 +1,58 @@
import { AccountAssetClientV3 } from '../../src';
import { successResponseObjectV3 } from '../response.util';
// Only some minimal coverage for v3 apis, since v5 apis are already available
describe('Private Account Asset V3 REST API Endpoints', () => {
const API_KEY = process.env.API_KEY_COM;
const API_SECRET = process.env.API_SECRET_COM;
it('should have api credentials to test with', () => {
expect(API_KEY).toStrictEqual(expect.any(String));
expect(API_SECRET).toStrictEqual(expect.any(String));
});
const api = new AccountAssetClientV3({
key: API_KEY,
secret: API_SECRET,
testnet: false,
});
const coin = 'USDT';
it('fetchServerTime()', async () => {
expect(await api.fetchServerTime()).toEqual(expect.any(Number));
});
it('getInternalTransfers()', async () => {
expect(
await api.getInternalTransfers({
coin: coin,
})
).toMatchObject(successResponseObjectV3());
});
it('getSubAccountTransfers()', async () => {
expect(await api.getSubAccountTransfers()).toMatchObject(
successResponseObjectV3()
);
});
it('getSubAccounts()', async () => {
expect(await api.getSubAccounts()).toMatchObject(successResponseObjectV3());
});
it('getUniversalTransfers()', async () => {
expect(await api.getUniversalTransfers({ coin: coin })).toMatchObject(
successResponseObjectV3()
);
});
it('getTransferableCoinList()', async () => {
expect(
await api.getTransferableCoinList({
fromAccountType: 'SPOT',
toAccountType: 'CONTRACT',
})
).toMatchObject(successResponseObjectV3());
});
});