zklighter-perps 1.0.286 → 1.0.288
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 +78 -0
- package/README.md +7 -1
- package/apis/InfoApi.ts +0 -10
- package/models/AccountMetadata.ts +9 -0
- package/models/DetailedAccount.ts +9 -0
- package/models/ReqGetTransferFeeInfo.ts +0 -8
- package/openapi.json +10 -18
- package/package.json +1 -1
package/.circleci/config.yml
CHANGED
|
@@ -156,11 +156,80 @@ jobs:
|
|
|
156
156
|
- run:
|
|
157
157
|
name: Publish npm package
|
|
158
158
|
command: |
|
|
159
|
+
VERSION=$(jq -r .version package.json)
|
|
160
|
+
if npm view "zklighter-perps@${VERSION}" version > /dev/null 2>&1; then
|
|
161
|
+
echo "zklighter-perps@${VERSION} is already published; skipping"
|
|
162
|
+
exit 0
|
|
163
|
+
fi
|
|
159
164
|
git config --global user.email "hasan@lighter.xyz"
|
|
160
165
|
git config --global user.name "CircleCI Hasan"
|
|
161
166
|
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
|
|
162
167
|
npm publish
|
|
163
168
|
|
|
169
|
+
publish_prerelease:
|
|
170
|
+
docker:
|
|
171
|
+
- image: cimg/node:22.4.1
|
|
172
|
+
|
|
173
|
+
steps:
|
|
174
|
+
- checkout
|
|
175
|
+
- run:
|
|
176
|
+
name: Find open PR for branch
|
|
177
|
+
command: |
|
|
178
|
+
PR_NUMBER=$(curl -s -H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
|
179
|
+
"https://api.github.com/repos/elliottech/zklighter-perps-ts/pulls?head=elliottech:${CIRCLE_BRANCH}&state=open" \
|
|
180
|
+
| jq -r '.[0].number // empty')
|
|
181
|
+
if [ -z "$PR_NUMBER" ]; then
|
|
182
|
+
echo "No open PR for branch ${CIRCLE_BRANCH}; skipping prerelease publish"
|
|
183
|
+
circleci-agent step halt
|
|
184
|
+
else
|
|
185
|
+
echo "Found PR #${PR_NUMBER}"
|
|
186
|
+
echo "export PR_NUMBER=${PR_NUMBER}" >> "$BASH_ENV"
|
|
187
|
+
fi
|
|
188
|
+
- run:
|
|
189
|
+
name: Generate prerelease version
|
|
190
|
+
command: |
|
|
191
|
+
CLEAN_BRANCH_NAME=$(echo "$CIRCLE_BRANCH" | sed 's/[^a-zA-Z0-9-]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g')
|
|
192
|
+
CLEAN_ACTOR=$(echo "${CIRCLE_USERNAME:-circleci}" | sed 's/[^a-zA-Z0-9-]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g')
|
|
193
|
+
COMMIT_SHA=$(echo "$CIRCLE_SHA1" | cut -c1-7)
|
|
194
|
+
|
|
195
|
+
# Semver-compatible version: 0.PR_NUMBER.0-ACTOR.COMMIT_SHA.BRANCH_NAME
|
|
196
|
+
# Always < 1.0.0 so it can never shadow a real release.
|
|
197
|
+
PRERELEASE_VERSION="0.${PR_NUMBER}.0-${CLEAN_ACTOR}.${COMMIT_SHA}.${CLEAN_BRANCH_NAME}"
|
|
198
|
+
echo "Prerelease version: $PRERELEASE_VERSION"
|
|
199
|
+
|
|
200
|
+
echo "export CLEAN_BRANCH_NAME=${CLEAN_BRANCH_NAME}" >> "$BASH_ENV"
|
|
201
|
+
echo "export PRERELEASE_VERSION=${PRERELEASE_VERSION}" >> "$BASH_ENV"
|
|
202
|
+
- run:
|
|
203
|
+
name: Remove binaries
|
|
204
|
+
command: |
|
|
205
|
+
rm -rf goctl-swagger-amd
|
|
206
|
+
rm -rf openapi-generator-cli.jar
|
|
207
|
+
- run:
|
|
208
|
+
name: Publish prerelease npm package
|
|
209
|
+
command: |
|
|
210
|
+
jq --arg v "$PRERELEASE_VERSION" '.version = $v' package.json > tmp.json && mv tmp.json package.json
|
|
211
|
+
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
|
|
212
|
+
npm publish --tag "$CLEAN_BRANCH_NAME"
|
|
213
|
+
- run:
|
|
214
|
+
name: Comment on PR
|
|
215
|
+
command: |
|
|
216
|
+
COMMENT_BODY=$(jq -n --arg version "$PRERELEASE_VERSION" --arg tag "$CLEAN_BRANCH_NAME" \
|
|
217
|
+
'{body: ("## 🚀 Prerelease Published\n\n**Version:** `" + $version + "`\n**Tag:** `" + $tag + "`\n\n### Update package.json:\n```json\n\"zklighter-perps\": \"" + $version + "\"\n```")}')
|
|
218
|
+
|
|
219
|
+
EXISTING_COMMENT_ID=$(curl -s -H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
|
220
|
+
"https://api.github.com/repos/elliottech/zklighter-perps-ts/issues/${PR_NUMBER}/comments?per_page=100" \
|
|
221
|
+
| jq -r '[.[] | select(.body | contains("🚀 Prerelease Published"))][0].id // empty')
|
|
222
|
+
|
|
223
|
+
if [ -n "$EXISTING_COMMENT_ID" ]; then
|
|
224
|
+
curl -s -X PATCH -H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
|
225
|
+
-d "$COMMENT_BODY" \
|
|
226
|
+
"https://api.github.com/repos/elliottech/zklighter-perps-ts/issues/comments/${EXISTING_COMMENT_ID}" > /dev/null
|
|
227
|
+
else
|
|
228
|
+
curl -s -X POST -H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
|
229
|
+
-d "$COMMENT_BODY" \
|
|
230
|
+
"https://api.github.com/repos/elliottech/zklighter-perps-ts/issues/${PR_NUMBER}/comments" > /dev/null
|
|
231
|
+
fi
|
|
232
|
+
|
|
164
233
|
parameters:
|
|
165
234
|
update_ts_sdk:
|
|
166
235
|
default: false
|
|
@@ -205,4 +274,13 @@ workflows:
|
|
|
205
274
|
only: main
|
|
206
275
|
requires:
|
|
207
276
|
- typecheck
|
|
277
|
+
# Publishes a PR prerelease (version 0.PR.0-actor.sha.branch, dist-tag =
|
|
278
|
+
# branch name) and posts/updates a PR comment with the version to use,
|
|
279
|
+
# mirroring the prerelease flow in zklighter-react-store.
|
|
280
|
+
- publish_prerelease:
|
|
281
|
+
filters:
|
|
282
|
+
branches:
|
|
283
|
+
ignore: main
|
|
284
|
+
requires:
|
|
285
|
+
- typecheck
|
|
208
286
|
|
package/README.md
CHANGED
|
@@ -29,7 +29,13 @@ The `update_npm_package` workflow runs on `main`:
|
|
|
29
29
|
[`tsconfig.json`](tsconfig.json)). Runs on every branch, including the
|
|
30
30
|
timestamped branches opened by `update_ts_sdk`, so a regenerated SDK that
|
|
31
31
|
would fail to compile in a consumer (e.g. `perps-fe`) is caught on its PR.
|
|
32
|
-
- **`update_npm_package`** — publishes to npm (requires `typecheck` to pass
|
|
32
|
+
- **`update_npm_package`** — publishes to npm (requires `typecheck` to pass;
|
|
33
|
+
`main` only).
|
|
34
|
+
- **`publish_prerelease`** — on non-`main` branches with an open PR, publishes
|
|
35
|
+
a prerelease version (`0.<PR>.0-<actor>.<sha>.<branch>`, npm dist-tag =
|
|
36
|
+
branch name) and posts/updates a PR comment with the exact version to drop
|
|
37
|
+
into a consumer's `package.json`, mirroring the prerelease flow in
|
|
38
|
+
`zklighter-react-store`.
|
|
33
39
|
|
|
34
40
|
## OpenAPI post-processing
|
|
35
41
|
|
package/apis/InfoApi.ts
CHANGED
|
@@ -50,8 +50,6 @@ export interface SyntheticSpotInfoRequest {
|
|
|
50
50
|
|
|
51
51
|
export interface TransferFeeInfoRequest {
|
|
52
52
|
account_index: number;
|
|
53
|
-
authorization?: string;
|
|
54
|
-
auth?: string;
|
|
55
53
|
to_account_index?: number;
|
|
56
54
|
}
|
|
57
55
|
|
|
@@ -208,14 +206,6 @@ export class InfoApi extends runtime.BaseAPI {
|
|
|
208
206
|
|
|
209
207
|
const queryParameters: any = {};
|
|
210
208
|
|
|
211
|
-
if (requestParameters['authorization'] != null) {
|
|
212
|
-
queryParameters['authorization'] = requestParameters['authorization'];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (requestParameters['auth'] != null) {
|
|
216
|
-
queryParameters['auth'] = requestParameters['auth'];
|
|
217
|
-
}
|
|
218
|
-
|
|
219
209
|
if (requestParameters['account_index'] != null) {
|
|
220
210
|
queryParameters['account_index'] = requestParameters['account_index'];
|
|
221
211
|
}
|
|
@@ -68,6 +68,12 @@ export interface AccountMetadata {
|
|
|
68
68
|
* @memberof AccountMetadata
|
|
69
69
|
*/
|
|
70
70
|
can_rfq_market_ids: Array<string>;
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @type {boolean}
|
|
74
|
+
* @memberof AccountMetadata
|
|
75
|
+
*/
|
|
76
|
+
agent_enabled: boolean;
|
|
71
77
|
/**
|
|
72
78
|
*
|
|
73
79
|
* @type {number}
|
|
@@ -93,6 +99,7 @@ export function instanceOfAccountMetadata(value: object): value is AccountMetada
|
|
|
93
99
|
if (!('referral_points_percentage' in value) || value['referral_points_percentage'] === undefined) return false;
|
|
94
100
|
if (!('can_rfq' in value) || value['can_rfq'] === undefined) return false;
|
|
95
101
|
if (!('can_rfq_market_ids' in value) || value['can_rfq_market_ids'] === undefined) return false;
|
|
102
|
+
if (!('agent_enabled' in value) || value['agent_enabled'] === undefined) return false;
|
|
96
103
|
if (!('created_at' in value) || value['created_at'] === undefined) return false;
|
|
97
104
|
if (!('metadata' in value) || value['metadata'] === undefined) return false;
|
|
98
105
|
return true;
|
|
@@ -115,6 +122,7 @@ export function AccountMetadataFromJSONTyped(json: any, ignoreDiscriminator: boo
|
|
|
115
122
|
'referral_points_percentage': json['referral_points_percentage'],
|
|
116
123
|
'can_rfq': json['can_rfq'],
|
|
117
124
|
'can_rfq_market_ids': json['can_rfq_market_ids'],
|
|
125
|
+
'agent_enabled': json['agent_enabled'],
|
|
118
126
|
'created_at': json['created_at'],
|
|
119
127
|
'metadata': SubAccountMetadataFromJSON(json['metadata']),
|
|
120
128
|
};
|
|
@@ -133,6 +141,7 @@ export function AccountMetadataToJSON(value?: AccountMetadata | null): any {
|
|
|
133
141
|
'referral_points_percentage': value['referral_points_percentage'],
|
|
134
142
|
'can_rfq': value['can_rfq'],
|
|
135
143
|
'can_rfq_market_ids': value['can_rfq_market_ids'],
|
|
144
|
+
'agent_enabled': value['agent_enabled'],
|
|
136
145
|
'created_at': value['created_at'],
|
|
137
146
|
'metadata': SubAccountMetadataToJSON(value['metadata']),
|
|
138
147
|
};
|
|
@@ -188,6 +188,12 @@ export interface DetailedAccount {
|
|
|
188
188
|
* @memberof DetailedAccount
|
|
189
189
|
*/
|
|
190
190
|
can_rfq_market_ids: Array<string>;
|
|
191
|
+
/**
|
|
192
|
+
*
|
|
193
|
+
* @type {boolean}
|
|
194
|
+
* @memberof DetailedAccount
|
|
195
|
+
*/
|
|
196
|
+
agent_enabled: boolean;
|
|
191
197
|
/**
|
|
192
198
|
*
|
|
193
199
|
* @type {number}
|
|
@@ -285,6 +291,7 @@ export function instanceOfDetailedAccount(value: object): value is DetailedAccou
|
|
|
285
291
|
if (!('referral_points_percentage' in value) || value['referral_points_percentage'] === undefined) return false;
|
|
286
292
|
if (!('can_rfq' in value) || value['can_rfq'] === undefined) return false;
|
|
287
293
|
if (!('can_rfq_market_ids' in value) || value['can_rfq_market_ids'] === undefined) return false;
|
|
294
|
+
if (!('agent_enabled' in value) || value['agent_enabled'] === undefined) return false;
|
|
288
295
|
if (!('created_at' in value) || value['created_at'] === undefined) return false;
|
|
289
296
|
if (!('metadata' in value) || value['metadata'] === undefined) return false;
|
|
290
297
|
if (!('positions' in value) || value['positions'] === undefined) return false;
|
|
@@ -329,6 +336,7 @@ export function DetailedAccountFromJSONTyped(json: any, ignoreDiscriminator: boo
|
|
|
329
336
|
'referral_points_percentage': json['referral_points_percentage'],
|
|
330
337
|
'can_rfq': json['can_rfq'],
|
|
331
338
|
'can_rfq_market_ids': json['can_rfq_market_ids'],
|
|
339
|
+
'agent_enabled': json['agent_enabled'],
|
|
332
340
|
'created_at': json['created_at'],
|
|
333
341
|
'metadata': SubAccountMetadataFromJSON(json['metadata']),
|
|
334
342
|
'positions': ((json['positions'] as Array<any>).map(AccountPositionFromJSON)),
|
|
@@ -371,6 +379,7 @@ export function DetailedAccountToJSON(value?: DetailedAccount | null): any {
|
|
|
371
379
|
'referral_points_percentage': value['referral_points_percentage'],
|
|
372
380
|
'can_rfq': value['can_rfq'],
|
|
373
381
|
'can_rfq_market_ids': value['can_rfq_market_ids'],
|
|
382
|
+
'agent_enabled': value['agent_enabled'],
|
|
374
383
|
'created_at': value['created_at'],
|
|
375
384
|
'metadata': SubAccountMetadataToJSON(value['metadata']),
|
|
376
385
|
'positions': ((value['positions'] as Array<any>).map(AccountPositionToJSON)),
|
|
@@ -19,12 +19,6 @@ import { mapValues } from '../runtime';
|
|
|
19
19
|
* @interface ReqGetTransferFeeInfo
|
|
20
20
|
*/
|
|
21
21
|
export interface ReqGetTransferFeeInfo {
|
|
22
|
-
/**
|
|
23
|
-
* made optional to support header auth clients
|
|
24
|
-
* @type {string}
|
|
25
|
-
* @memberof ReqGetTransferFeeInfo
|
|
26
|
-
*/
|
|
27
|
-
auth?: string;
|
|
28
22
|
/**
|
|
29
23
|
*
|
|
30
24
|
* @type {number}
|
|
@@ -57,7 +51,6 @@ export function ReqGetTransferFeeInfoFromJSONTyped(json: any, ignoreDiscriminato
|
|
|
57
51
|
}
|
|
58
52
|
return {
|
|
59
53
|
|
|
60
|
-
'auth': json['auth'] == null ? undefined : json['auth'],
|
|
61
54
|
'account_index': json['account_index'],
|
|
62
55
|
'to_account_index': json['to_account_index'] == null ? undefined : json['to_account_index'],
|
|
63
56
|
};
|
|
@@ -69,7 +62,6 @@ export function ReqGetTransferFeeInfoToJSON(value?: ReqGetTransferFeeInfo | null
|
|
|
69
62
|
}
|
|
70
63
|
return {
|
|
71
64
|
|
|
72
|
-
'auth': value['auth'],
|
|
73
65
|
'account_index': value['account_index'],
|
|
74
66
|
'to_account_index': value['to_account_index'],
|
|
75
67
|
};
|
package/openapi.json
CHANGED
|
@@ -5126,20 +5126,6 @@
|
|
|
5126
5126
|
}
|
|
5127
5127
|
},
|
|
5128
5128
|
"parameters": [
|
|
5129
|
-
{
|
|
5130
|
-
"name": "authorization",
|
|
5131
|
-
"description": " make required after integ is done",
|
|
5132
|
-
"in": "query",
|
|
5133
|
-
"required": false,
|
|
5134
|
-
"type": "string"
|
|
5135
|
-
},
|
|
5136
|
-
{
|
|
5137
|
-
"name": "auth",
|
|
5138
|
-
"description": " made optional to support header auth clients",
|
|
5139
|
-
"in": "query",
|
|
5140
|
-
"required": false,
|
|
5141
|
-
"type": "string"
|
|
5142
|
-
},
|
|
5143
5129
|
{
|
|
5144
5130
|
"name": "account_index",
|
|
5145
5131
|
"in": "query",
|
|
@@ -5950,6 +5936,10 @@
|
|
|
5950
5936
|
"type": "string"
|
|
5951
5937
|
}
|
|
5952
5938
|
},
|
|
5939
|
+
"agent_enabled": {
|
|
5940
|
+
"type": "boolean",
|
|
5941
|
+
"format": "boolean"
|
|
5942
|
+
},
|
|
5953
5943
|
"created_at": {
|
|
5954
5944
|
"type": "integer",
|
|
5955
5945
|
"format": "int64"
|
|
@@ -5967,6 +5957,7 @@
|
|
|
5967
5957
|
"referral_points_percentage",
|
|
5968
5958
|
"can_rfq",
|
|
5969
5959
|
"can_rfq_market_ids",
|
|
5960
|
+
"agent_enabled",
|
|
5970
5961
|
"created_at",
|
|
5971
5962
|
"metadata"
|
|
5972
5963
|
]
|
|
@@ -7548,6 +7539,10 @@
|
|
|
7548
7539
|
"type": "string"
|
|
7549
7540
|
}
|
|
7550
7541
|
},
|
|
7542
|
+
"agent_enabled": {
|
|
7543
|
+
"type": "boolean",
|
|
7544
|
+
"format": "boolean"
|
|
7545
|
+
},
|
|
7551
7546
|
"created_at": {
|
|
7552
7547
|
"type": "integer",
|
|
7553
7548
|
"format": "int64"
|
|
@@ -7626,6 +7621,7 @@
|
|
|
7626
7621
|
"referral_points_percentage",
|
|
7627
7622
|
"can_rfq",
|
|
7628
7623
|
"can_rfq_market_ids",
|
|
7624
|
+
"agent_enabled",
|
|
7629
7625
|
"created_at",
|
|
7630
7626
|
"metadata",
|
|
7631
7627
|
"positions",
|
|
@@ -12699,10 +12695,6 @@
|
|
|
12699
12695
|
"ReqGetTransferFeeInfo": {
|
|
12700
12696
|
"type": "object",
|
|
12701
12697
|
"properties": {
|
|
12702
|
-
"auth": {
|
|
12703
|
-
"type": "string",
|
|
12704
|
-
"description": " made optional to support header auth clients"
|
|
12705
|
-
},
|
|
12706
12698
|
"account_index": {
|
|
12707
12699
|
"type": "integer",
|
|
12708
12700
|
"format": "int64"
|