zklighter-perps 1.0.0
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/.circleci/config.yml +86 -0
- package/.openapi-generator/FILES +95 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/apis/AccountApi.ts +454 -0
- package/apis/BlockApi.ts +178 -0
- package/apis/CandlestickApi.ts +231 -0
- package/apis/InfoApi.ts +197 -0
- package/apis/OrderApi.ts +607 -0
- package/apis/RelayerApi.ts +95 -0
- package/apis/RootApi.ts +56 -0
- package/apis/TransactionApi.ts +608 -0
- package/apis/WsApi.ts +82 -0
- package/apis/index.ts +11 -0
- package/config.yaml +5 -0
- package/index.ts +5 -0
- package/models/AccountMarketStats.ts +100 -0
- package/models/AccountPnL.ts +91 -0
- package/models/AccountPosition.ts +140 -0
- package/models/AccountStats.ts +92 -0
- package/models/Block.ts +163 -0
- package/models/Blocks.ts +91 -0
- package/models/Candlestick.ts +108 -0
- package/models/Candlesticks.ts +91 -0
- package/models/ContractAddress.ts +68 -0
- package/models/CurrentHeight.ts +76 -0
- package/models/Cursor.ts +60 -0
- package/models/DetailedAccount.ts +169 -0
- package/models/DetailedAccounts.ts +91 -0
- package/models/EnrichedTx.ts +204 -0
- package/models/ExchangeStats.ts +107 -0
- package/models/Funding.ts +84 -0
- package/models/Fundings.ts +91 -0
- package/models/L1ProviderInfo.ts +84 -0
- package/models/Layer1BasicInfo.ts +143 -0
- package/models/Layer2BasicInfo.ts +92 -0
- package/models/MainAccount.ts +92 -0
- package/models/MainAccounts.ts +91 -0
- package/models/MarketInfo.ts +140 -0
- package/models/MarketSig.ts +100 -0
- package/models/NextNonce.ts +76 -0
- package/models/Order.ts +209 -0
- package/models/OrderBook.ts +143 -0
- package/models/OrderBookDepth.ts +99 -0
- package/models/OrderBookDetail.ts +287 -0
- package/models/OrderBookDetails.ts +83 -0
- package/models/OrderBookOrders.ts +107 -0
- package/models/OrderBookStats.ts +100 -0
- package/models/OrderBooks.ts +83 -0
- package/models/Orders.ts +91 -0
- package/models/Permission.ts +76 -0
- package/models/PnLEntry.ts +68 -0
- package/models/PriceLevel.ts +68 -0
- package/models/ReqDoFaucet.ts +60 -0
- package/models/ReqGetAccount.ts +79 -0
- package/models/ReqGetAccountActiveOrders.ts +76 -0
- package/models/ReqGetAccountByL1Address.ts +60 -0
- package/models/ReqGetAccountInactiveOrders.ts +111 -0
- package/models/ReqGetAccountOrders.ts +84 -0
- package/models/ReqGetAccountPendingTxs.ts +87 -0
- package/models/ReqGetAccountPnL.ts +124 -0
- package/models/ReqGetAccountTxs.ts +103 -0
- package/models/ReqGetBlock.ts +79 -0
- package/models/ReqGetBlockTxs.ts +79 -0
- package/models/ReqGetByAccount.ts +79 -0
- package/models/ReqGetCandlesticks.ts +107 -0
- package/models/ReqGetFundings.ts +102 -0
- package/models/ReqGetL1Tx.ts +60 -0
- package/models/ReqGetMarketSig.ts +76 -0
- package/models/ReqGetNextNonce.ts +68 -0
- package/models/ReqGetOrderBookDetails.ts +79 -0
- package/models/ReqGetOrderBookOrders.ts +68 -0
- package/models/ReqGetOrderBooks.ts +79 -0
- package/models/ReqGetPermission.ts +87 -0
- package/models/ReqGetRangeWithCursor.ts +68 -0
- package/models/ReqGetRangeWithIndex.ts +68 -0
- package/models/ReqGetRangeWithIndexSortable.ts +87 -0
- package/models/ReqGetRecentTrades.ts +68 -0
- package/models/ReqGetRollbacks.ts +76 -0
- package/models/ReqGetSubAccount.ts +87 -0
- package/models/ReqGetTrades.ts +104 -0
- package/models/ReqGetTx.ts +79 -0
- package/models/ReqSearch.ts +60 -0
- package/models/ResultCode.ts +68 -0
- package/models/Rollback.ts +84 -0
- package/models/Rollbacks.ts +91 -0
- package/models/Search.ts +76 -0
- package/models/SignBody.ts +76 -0
- package/models/SimpleOrder.ts +100 -0
- package/models/Status.ts +68 -0
- package/models/SubAccount.ts +116 -0
- package/models/SubAccounts.ts +107 -0
- package/models/Trade.ts +148 -0
- package/models/Trades.ts +83 -0
- package/models/Tx.ts +164 -0
- package/models/TxHash.ts +76 -0
- package/models/Txs.ts +83 -0
- package/models/ValidatorInfo.ts +68 -0
- package/models/index.ts +84 -0
- package/openapi-generator-cli.jar +0 -0
- package/openapi.json +3934 -0
- package/package.json +23 -0
- package/runtime.ts +426 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
jobs:
|
|
4
|
+
load_openapi:
|
|
5
|
+
docker:
|
|
6
|
+
- image: cimg/base:2024.07
|
|
7
|
+
|
|
8
|
+
working_directory: ~/project
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- run:
|
|
12
|
+
name: Clone Python SDK
|
|
13
|
+
command: |
|
|
14
|
+
git clone https://${GITHUB_TOKEN}@github.com/elliottech/zklighter-perps-python.git
|
|
15
|
+
|
|
16
|
+
- persist_to_workspace:
|
|
17
|
+
root: ~/project/zklighter-perps-python
|
|
18
|
+
paths:
|
|
19
|
+
- openapi.json
|
|
20
|
+
|
|
21
|
+
update_ts_sdk_job:
|
|
22
|
+
docker:
|
|
23
|
+
- image: cimg/openjdk:21.0.2
|
|
24
|
+
|
|
25
|
+
working_directory: ~/project
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- checkout
|
|
29
|
+
|
|
30
|
+
- attach_workspace:
|
|
31
|
+
at: /tmp/workspace
|
|
32
|
+
|
|
33
|
+
- run:
|
|
34
|
+
name: Get openapi.json from workspace
|
|
35
|
+
command: |
|
|
36
|
+
cp /tmp/workspace/openapi.json .
|
|
37
|
+
|
|
38
|
+
- run:
|
|
39
|
+
name: Download OpenAPI Generator JAR
|
|
40
|
+
command: |
|
|
41
|
+
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar -O openapi-generator-cli.jar
|
|
42
|
+
|
|
43
|
+
- run:
|
|
44
|
+
name: Generate TS client using OpenAPI Generator
|
|
45
|
+
command: |
|
|
46
|
+
java -jar openapi-generator-cli.jar generate -i ./openapi.json -g typescript-fetch -o . -c config.yaml
|
|
47
|
+
- run:
|
|
48
|
+
name: push to new branch
|
|
49
|
+
command: |
|
|
50
|
+
git remote remove origin
|
|
51
|
+
git remote add origin https://${GITHUB_TOKEN}@github.com/elliottech/zklighter-perps-ts
|
|
52
|
+
|
|
53
|
+
git config --global user.email "hasan@circleci.com"
|
|
54
|
+
git config --global user.name "CircleCI Hasan"
|
|
55
|
+
export BRANCH_NAME=`date +%s`
|
|
56
|
+
git checkout -b $BRANCH_NAME
|
|
57
|
+
git add .
|
|
58
|
+
git commit -m "Update SDK"
|
|
59
|
+
git push origin $BRANCH_NAME
|
|
60
|
+
|
|
61
|
+
PR_URL=$(curl -X POST -H "Authorization: Bearer ${GITHUB_TOKEN}" -d '{"title": "Update SDK", "head": "'$BRANCH_NAME'", "base": "main"}' https://api.github.com/repos/elliottech/zklighter-perps-ts/pulls | jq -r '.html_url')
|
|
62
|
+
curl -X POST -H 'Content-type: application/json' --data '{"text":"TypeScript SDK has been updated. Check the PR here: '$PR_URL'", "type": "mrkdwn"}' ${SLACK_URL}
|
|
63
|
+
|
|
64
|
+
parameters:
|
|
65
|
+
update_ts_sdk:
|
|
66
|
+
default: false
|
|
67
|
+
type: boolean
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
workflows:
|
|
71
|
+
version: 2
|
|
72
|
+
update_ts_sdk:
|
|
73
|
+
when: << pipeline.parameters.update_ts_sdk >>
|
|
74
|
+
jobs:
|
|
75
|
+
- load_openapi:
|
|
76
|
+
filters:
|
|
77
|
+
branches:
|
|
78
|
+
only: main
|
|
79
|
+
|
|
80
|
+
- update_ts_sdk_job:
|
|
81
|
+
requires:
|
|
82
|
+
- load_openapi
|
|
83
|
+
filters:
|
|
84
|
+
branches:
|
|
85
|
+
only: main
|
|
86
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
apis/AccountApi.ts
|
|
2
|
+
apis/BlockApi.ts
|
|
3
|
+
apis/CandlestickApi.ts
|
|
4
|
+
apis/InfoApi.ts
|
|
5
|
+
apis/OrderApi.ts
|
|
6
|
+
apis/RelayerApi.ts
|
|
7
|
+
apis/RootApi.ts
|
|
8
|
+
apis/TransactionApi.ts
|
|
9
|
+
apis/WsApi.ts
|
|
10
|
+
apis/index.ts
|
|
11
|
+
index.ts
|
|
12
|
+
models/AccountMarketStats.ts
|
|
13
|
+
models/AccountPnL.ts
|
|
14
|
+
models/AccountPosition.ts
|
|
15
|
+
models/AccountStats.ts
|
|
16
|
+
models/Block.ts
|
|
17
|
+
models/Blocks.ts
|
|
18
|
+
models/Candlestick.ts
|
|
19
|
+
models/Candlesticks.ts
|
|
20
|
+
models/ContractAddress.ts
|
|
21
|
+
models/CurrentHeight.ts
|
|
22
|
+
models/Cursor.ts
|
|
23
|
+
models/DetailedAccount.ts
|
|
24
|
+
models/DetailedAccounts.ts
|
|
25
|
+
models/EnrichedTx.ts
|
|
26
|
+
models/ExchangeStats.ts
|
|
27
|
+
models/Funding.ts
|
|
28
|
+
models/Fundings.ts
|
|
29
|
+
models/L1ProviderInfo.ts
|
|
30
|
+
models/Layer1BasicInfo.ts
|
|
31
|
+
models/Layer2BasicInfo.ts
|
|
32
|
+
models/MainAccount.ts
|
|
33
|
+
models/MainAccounts.ts
|
|
34
|
+
models/MarketInfo.ts
|
|
35
|
+
models/MarketSig.ts
|
|
36
|
+
models/NextNonce.ts
|
|
37
|
+
models/Order.ts
|
|
38
|
+
models/OrderBook.ts
|
|
39
|
+
models/OrderBookDepth.ts
|
|
40
|
+
models/OrderBookDetail.ts
|
|
41
|
+
models/OrderBookDetails.ts
|
|
42
|
+
models/OrderBookOrders.ts
|
|
43
|
+
models/OrderBookStats.ts
|
|
44
|
+
models/OrderBooks.ts
|
|
45
|
+
models/Orders.ts
|
|
46
|
+
models/Permission.ts
|
|
47
|
+
models/PnLEntry.ts
|
|
48
|
+
models/PriceLevel.ts
|
|
49
|
+
models/ReqDoFaucet.ts
|
|
50
|
+
models/ReqGetAccount.ts
|
|
51
|
+
models/ReqGetAccountActiveOrders.ts
|
|
52
|
+
models/ReqGetAccountByL1Address.ts
|
|
53
|
+
models/ReqGetAccountInactiveOrders.ts
|
|
54
|
+
models/ReqGetAccountOrders.ts
|
|
55
|
+
models/ReqGetAccountPendingTxs.ts
|
|
56
|
+
models/ReqGetAccountPnL.ts
|
|
57
|
+
models/ReqGetAccountTxs.ts
|
|
58
|
+
models/ReqGetBlock.ts
|
|
59
|
+
models/ReqGetBlockTxs.ts
|
|
60
|
+
models/ReqGetByAccount.ts
|
|
61
|
+
models/ReqGetCandlesticks.ts
|
|
62
|
+
models/ReqGetFundings.ts
|
|
63
|
+
models/ReqGetL1Tx.ts
|
|
64
|
+
models/ReqGetMarketSig.ts
|
|
65
|
+
models/ReqGetNextNonce.ts
|
|
66
|
+
models/ReqGetOrderBookDetails.ts
|
|
67
|
+
models/ReqGetOrderBookOrders.ts
|
|
68
|
+
models/ReqGetOrderBooks.ts
|
|
69
|
+
models/ReqGetPermission.ts
|
|
70
|
+
models/ReqGetRangeWithCursor.ts
|
|
71
|
+
models/ReqGetRangeWithIndex.ts
|
|
72
|
+
models/ReqGetRangeWithIndexSortable.ts
|
|
73
|
+
models/ReqGetRecentTrades.ts
|
|
74
|
+
models/ReqGetRollbacks.ts
|
|
75
|
+
models/ReqGetSubAccount.ts
|
|
76
|
+
models/ReqGetTrades.ts
|
|
77
|
+
models/ReqGetTx.ts
|
|
78
|
+
models/ReqSearch.ts
|
|
79
|
+
models/ResultCode.ts
|
|
80
|
+
models/Rollback.ts
|
|
81
|
+
models/Rollbacks.ts
|
|
82
|
+
models/Search.ts
|
|
83
|
+
models/SignBody.ts
|
|
84
|
+
models/SimpleOrder.ts
|
|
85
|
+
models/Status.ts
|
|
86
|
+
models/SubAccount.ts
|
|
87
|
+
models/SubAccounts.ts
|
|
88
|
+
models/Trade.ts
|
|
89
|
+
models/Trades.ts
|
|
90
|
+
models/Tx.ts
|
|
91
|
+
models/TxHash.ts
|
|
92
|
+
models/Txs.ts
|
|
93
|
+
models/ValidatorInfo.ts
|
|
94
|
+
models/index.ts
|
|
95
|
+
runtime.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7.7.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# OpenAPI Generator Ignore
|
|
2
|
+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
3
|
+
|
|
4
|
+
# Use this file to prevent files from being overwritten by the generator.
|
|
5
|
+
# The patterns follow closely to .gitignore or .dockerignore.
|
|
6
|
+
|
|
7
|
+
# As an example, the C# client generator defines ApiClient.cs.
|
|
8
|
+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
9
|
+
#ApiClient.cs
|
|
10
|
+
|
|
11
|
+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
12
|
+
#foo/*/qux
|
|
13
|
+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
14
|
+
|
|
15
|
+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
16
|
+
#foo/**/qux
|
|
17
|
+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
18
|
+
|
|
19
|
+
# You can also negate patterns with an exclamation (!).
|
|
20
|
+
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
21
|
+
#docs/*.md
|
|
22
|
+
# Then explicitly reverse the ignore rule for a single file:
|
|
23
|
+
#!docs/README.md
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document:
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import type {
|
|
18
|
+
AccountPnL,
|
|
19
|
+
DetailedAccounts,
|
|
20
|
+
MainAccounts,
|
|
21
|
+
Permission,
|
|
22
|
+
ResultCode,
|
|
23
|
+
SubAccounts,
|
|
24
|
+
} from '../models/index';
|
|
25
|
+
import {
|
|
26
|
+
AccountPnLFromJSON,
|
|
27
|
+
AccountPnLToJSON,
|
|
28
|
+
DetailedAccountsFromJSON,
|
|
29
|
+
DetailedAccountsToJSON,
|
|
30
|
+
MainAccountsFromJSON,
|
|
31
|
+
MainAccountsToJSON,
|
|
32
|
+
PermissionFromJSON,
|
|
33
|
+
PermissionToJSON,
|
|
34
|
+
ResultCodeFromJSON,
|
|
35
|
+
ResultCodeToJSON,
|
|
36
|
+
SubAccountsFromJSON,
|
|
37
|
+
SubAccountsToJSON,
|
|
38
|
+
} from '../models/index';
|
|
39
|
+
|
|
40
|
+
export interface DoFaucetRequest {
|
|
41
|
+
l1Address: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface GetAccountRequest {
|
|
45
|
+
by: GetAccountByEnum;
|
|
46
|
+
value: string;
|
|
47
|
+
subAccountIndex: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface GetAccountPnlRequest {
|
|
51
|
+
by: GetAccountPnlByEnum;
|
|
52
|
+
value: string;
|
|
53
|
+
resolution: GetAccountPnlResolutionEnum;
|
|
54
|
+
startTimestamp: number;
|
|
55
|
+
endTimestamp: number;
|
|
56
|
+
countBack: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface GetAccountsRequest {
|
|
60
|
+
limit: number;
|
|
61
|
+
index?: number;
|
|
62
|
+
sort?: GetAccountsSortEnum;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface GetAccountsByL1AddressRequest {
|
|
66
|
+
l1Address: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface GetPermissionRequest {
|
|
70
|
+
by: GetPermissionByEnum;
|
|
71
|
+
value: string;
|
|
72
|
+
txType: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export class AccountApi extends runtime.BaseAPI {
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Request funds from faucet
|
|
82
|
+
*/
|
|
83
|
+
async doFaucetRaw(requestParameters: DoFaucetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ResultCode>> {
|
|
84
|
+
if (requestParameters['l1Address'] == null) {
|
|
85
|
+
throw new runtime.RequiredError(
|
|
86
|
+
'l1Address',
|
|
87
|
+
'Required parameter "l1Address" was null or undefined when calling doFaucet().'
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const queryParameters: any = {};
|
|
92
|
+
|
|
93
|
+
if (requestParameters['l1Address'] != null) {
|
|
94
|
+
queryParameters['l1_address'] = requestParameters['l1Address'];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
98
|
+
|
|
99
|
+
const response = await this.request({
|
|
100
|
+
path: `/api/v1/faucet`,
|
|
101
|
+
method: 'GET',
|
|
102
|
+
headers: headerParameters,
|
|
103
|
+
query: queryParameters,
|
|
104
|
+
}, initOverrides);
|
|
105
|
+
|
|
106
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Request funds from faucet
|
|
111
|
+
*/
|
|
112
|
+
async doFaucet(requestParameters: DoFaucetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ResultCode> {
|
|
113
|
+
const response = await this.doFaucetRaw(requestParameters, initOverrides);
|
|
114
|
+
return await response.value();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get account by main account\'s l1_address or index and sub account\'s index. Returns detailed account info
|
|
119
|
+
*/
|
|
120
|
+
async getAccountRaw(requestParameters: GetAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DetailedAccounts>> {
|
|
121
|
+
if (requestParameters['by'] == null) {
|
|
122
|
+
throw new runtime.RequiredError(
|
|
123
|
+
'by',
|
|
124
|
+
'Required parameter "by" was null or undefined when calling getAccount().'
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (requestParameters['value'] == null) {
|
|
129
|
+
throw new runtime.RequiredError(
|
|
130
|
+
'value',
|
|
131
|
+
'Required parameter "value" was null or undefined when calling getAccount().'
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (requestParameters['subAccountIndex'] == null) {
|
|
136
|
+
throw new runtime.RequiredError(
|
|
137
|
+
'subAccountIndex',
|
|
138
|
+
'Required parameter "subAccountIndex" was null or undefined when calling getAccount().'
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const queryParameters: any = {};
|
|
143
|
+
|
|
144
|
+
if (requestParameters['by'] != null) {
|
|
145
|
+
queryParameters['by'] = requestParameters['by'];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (requestParameters['value'] != null) {
|
|
149
|
+
queryParameters['value'] = requestParameters['value'];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (requestParameters['subAccountIndex'] != null) {
|
|
153
|
+
queryParameters['sub_account_index'] = requestParameters['subAccountIndex'];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
157
|
+
|
|
158
|
+
const response = await this.request({
|
|
159
|
+
path: `/api/v1/account`,
|
|
160
|
+
method: 'GET',
|
|
161
|
+
headers: headerParameters,
|
|
162
|
+
query: queryParameters,
|
|
163
|
+
}, initOverrides);
|
|
164
|
+
|
|
165
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DetailedAccountsFromJSON(jsonValue));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get account by main account\'s l1_address or index and sub account\'s index. Returns detailed account info
|
|
170
|
+
*/
|
|
171
|
+
async getAccount(requestParameters: GetAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DetailedAccounts> {
|
|
172
|
+
const response = await this.getAccountRaw(requestParameters, initOverrides);
|
|
173
|
+
return await response.value();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Get account PnL chart
|
|
178
|
+
*/
|
|
179
|
+
async getAccountPnlRaw(requestParameters: GetAccountPnlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountPnL>> {
|
|
180
|
+
if (requestParameters['by'] == null) {
|
|
181
|
+
throw new runtime.RequiredError(
|
|
182
|
+
'by',
|
|
183
|
+
'Required parameter "by" was null or undefined when calling getAccountPnl().'
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (requestParameters['value'] == null) {
|
|
188
|
+
throw new runtime.RequiredError(
|
|
189
|
+
'value',
|
|
190
|
+
'Required parameter "value" was null or undefined when calling getAccountPnl().'
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (requestParameters['resolution'] == null) {
|
|
195
|
+
throw new runtime.RequiredError(
|
|
196
|
+
'resolution',
|
|
197
|
+
'Required parameter "resolution" was null or undefined when calling getAccountPnl().'
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (requestParameters['startTimestamp'] == null) {
|
|
202
|
+
throw new runtime.RequiredError(
|
|
203
|
+
'startTimestamp',
|
|
204
|
+
'Required parameter "startTimestamp" was null or undefined when calling getAccountPnl().'
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (requestParameters['endTimestamp'] == null) {
|
|
209
|
+
throw new runtime.RequiredError(
|
|
210
|
+
'endTimestamp',
|
|
211
|
+
'Required parameter "endTimestamp" was null or undefined when calling getAccountPnl().'
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (requestParameters['countBack'] == null) {
|
|
216
|
+
throw new runtime.RequiredError(
|
|
217
|
+
'countBack',
|
|
218
|
+
'Required parameter "countBack" was null or undefined when calling getAccountPnl().'
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const queryParameters: any = {};
|
|
223
|
+
|
|
224
|
+
if (requestParameters['by'] != null) {
|
|
225
|
+
queryParameters['by'] = requestParameters['by'];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (requestParameters['value'] != null) {
|
|
229
|
+
queryParameters['value'] = requestParameters['value'];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (requestParameters['resolution'] != null) {
|
|
233
|
+
queryParameters['resolution'] = requestParameters['resolution'];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (requestParameters['startTimestamp'] != null) {
|
|
237
|
+
queryParameters['start_timestamp'] = requestParameters['startTimestamp'];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (requestParameters['endTimestamp'] != null) {
|
|
241
|
+
queryParameters['end_timestamp'] = requestParameters['endTimestamp'];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (requestParameters['countBack'] != null) {
|
|
245
|
+
queryParameters['count_back'] = requestParameters['countBack'];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
249
|
+
|
|
250
|
+
const response = await this.request({
|
|
251
|
+
path: `/api/v1/pnl`,
|
|
252
|
+
method: 'GET',
|
|
253
|
+
headers: headerParameters,
|
|
254
|
+
query: queryParameters,
|
|
255
|
+
}, initOverrides);
|
|
256
|
+
|
|
257
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => AccountPnLFromJSON(jsonValue));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Get account PnL chart
|
|
262
|
+
*/
|
|
263
|
+
async getAccountPnl(requestParameters: GetAccountPnlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountPnL> {
|
|
264
|
+
const response = await this.getAccountPnlRaw(requestParameters, initOverrides);
|
|
265
|
+
return await response.value();
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Get accounts returns main accounts by account index
|
|
270
|
+
*/
|
|
271
|
+
async getAccountsRaw(requestParameters: GetAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MainAccounts>> {
|
|
272
|
+
if (requestParameters['limit'] == null) {
|
|
273
|
+
throw new runtime.RequiredError(
|
|
274
|
+
'limit',
|
|
275
|
+
'Required parameter "limit" was null or undefined when calling getAccounts().'
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const queryParameters: any = {};
|
|
280
|
+
|
|
281
|
+
if (requestParameters['index'] != null) {
|
|
282
|
+
queryParameters['index'] = requestParameters['index'];
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (requestParameters['limit'] != null) {
|
|
286
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (requestParameters['sort'] != null) {
|
|
290
|
+
queryParameters['sort'] = requestParameters['sort'];
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
294
|
+
|
|
295
|
+
const response = await this.request({
|
|
296
|
+
path: `/api/v1/accounts`,
|
|
297
|
+
method: 'GET',
|
|
298
|
+
headers: headerParameters,
|
|
299
|
+
query: queryParameters,
|
|
300
|
+
}, initOverrides);
|
|
301
|
+
|
|
302
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => MainAccountsFromJSON(jsonValue));
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Get accounts returns main accounts by account index
|
|
307
|
+
*/
|
|
308
|
+
async getAccounts(requestParameters: GetAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MainAccounts> {
|
|
309
|
+
const response = await this.getAccountsRaw(requestParameters, initOverrides);
|
|
310
|
+
return await response.value();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Get accounts by l1_address returns main account and its sub accounts
|
|
315
|
+
*/
|
|
316
|
+
async getAccountsByL1AddressRaw(requestParameters: GetAccountsByL1AddressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubAccounts>> {
|
|
317
|
+
if (requestParameters['l1Address'] == null) {
|
|
318
|
+
throw new runtime.RequiredError(
|
|
319
|
+
'l1Address',
|
|
320
|
+
'Required parameter "l1Address" was null or undefined when calling getAccountsByL1Address().'
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const queryParameters: any = {};
|
|
325
|
+
|
|
326
|
+
if (requestParameters['l1Address'] != null) {
|
|
327
|
+
queryParameters['l1_address'] = requestParameters['l1Address'];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
331
|
+
|
|
332
|
+
const response = await this.request({
|
|
333
|
+
path: `/api/v1/accountsByL1Address`,
|
|
334
|
+
method: 'GET',
|
|
335
|
+
headers: headerParameters,
|
|
336
|
+
query: queryParameters,
|
|
337
|
+
}, initOverrides);
|
|
338
|
+
|
|
339
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SubAccountsFromJSON(jsonValue));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Get accounts by l1_address returns main account and its sub accounts
|
|
344
|
+
*/
|
|
345
|
+
async getAccountsByL1Address(requestParameters: GetAccountsByL1AddressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubAccounts> {
|
|
346
|
+
const response = await this.getAccountsByL1AddressRaw(requestParameters, initOverrides);
|
|
347
|
+
return await response.value();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Get permission by account\'s l1_address, index and tx_type
|
|
352
|
+
*/
|
|
353
|
+
async getPermissionRaw(requestParameters: GetPermissionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Permission>> {
|
|
354
|
+
if (requestParameters['by'] == null) {
|
|
355
|
+
throw new runtime.RequiredError(
|
|
356
|
+
'by',
|
|
357
|
+
'Required parameter "by" was null or undefined when calling getPermission().'
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (requestParameters['value'] == null) {
|
|
362
|
+
throw new runtime.RequiredError(
|
|
363
|
+
'value',
|
|
364
|
+
'Required parameter "value" was null or undefined when calling getPermission().'
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (requestParameters['txType'] == null) {
|
|
369
|
+
throw new runtime.RequiredError(
|
|
370
|
+
'txType',
|
|
371
|
+
'Required parameter "txType" was null or undefined when calling getPermission().'
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const queryParameters: any = {};
|
|
376
|
+
|
|
377
|
+
if (requestParameters['by'] != null) {
|
|
378
|
+
queryParameters['by'] = requestParameters['by'];
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (requestParameters['value'] != null) {
|
|
382
|
+
queryParameters['value'] = requestParameters['value'];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (requestParameters['txType'] != null) {
|
|
386
|
+
queryParameters['tx_type'] = requestParameters['txType'];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
390
|
+
|
|
391
|
+
const response = await this.request({
|
|
392
|
+
path: `/api/v1/permission`,
|
|
393
|
+
method: 'GET',
|
|
394
|
+
headers: headerParameters,
|
|
395
|
+
query: queryParameters,
|
|
396
|
+
}, initOverrides);
|
|
397
|
+
|
|
398
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PermissionFromJSON(jsonValue));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Get permission by account\'s l1_address, index and tx_type
|
|
403
|
+
*/
|
|
404
|
+
async getPermission(requestParameters: GetPermissionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Permission> {
|
|
405
|
+
const response = await this.getPermissionRaw(requestParameters, initOverrides);
|
|
406
|
+
return await response.value();
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* @export
|
|
413
|
+
*/
|
|
414
|
+
export const GetAccountByEnum = {
|
|
415
|
+
Index: 'index',
|
|
416
|
+
L1Address: 'l1_address'
|
|
417
|
+
} as const;
|
|
418
|
+
export type GetAccountByEnum = typeof GetAccountByEnum[keyof typeof GetAccountByEnum];
|
|
419
|
+
/**
|
|
420
|
+
* @export
|
|
421
|
+
*/
|
|
422
|
+
export const GetAccountPnlByEnum = {
|
|
423
|
+
Index: 'index',
|
|
424
|
+
L1Address: 'l1_address'
|
|
425
|
+
} as const;
|
|
426
|
+
export type GetAccountPnlByEnum = typeof GetAccountPnlByEnum[keyof typeof GetAccountPnlByEnum];
|
|
427
|
+
/**
|
|
428
|
+
* @export
|
|
429
|
+
*/
|
|
430
|
+
export const GetAccountPnlResolutionEnum = {
|
|
431
|
+
_1m: '1m',
|
|
432
|
+
_5m: '5m',
|
|
433
|
+
_15m: '15m',
|
|
434
|
+
_1h: '1h',
|
|
435
|
+
_4h: '4h',
|
|
436
|
+
_1d: '1d'
|
|
437
|
+
} as const;
|
|
438
|
+
export type GetAccountPnlResolutionEnum = typeof GetAccountPnlResolutionEnum[keyof typeof GetAccountPnlResolutionEnum];
|
|
439
|
+
/**
|
|
440
|
+
* @export
|
|
441
|
+
*/
|
|
442
|
+
export const GetAccountsSortEnum = {
|
|
443
|
+
Asc: 'asc',
|
|
444
|
+
Desc: 'desc'
|
|
445
|
+
} as const;
|
|
446
|
+
export type GetAccountsSortEnum = typeof GetAccountsSortEnum[keyof typeof GetAccountsSortEnum];
|
|
447
|
+
/**
|
|
448
|
+
* @export
|
|
449
|
+
*/
|
|
450
|
+
export const GetPermissionByEnum = {
|
|
451
|
+
Index: 'index',
|
|
452
|
+
L1Address: 'l1_address'
|
|
453
|
+
} as const;
|
|
454
|
+
export type GetPermissionByEnum = typeof GetPermissionByEnum[keyof typeof GetPermissionByEnum];
|