@lifi/perps-sdk-provider-lighter 17.3.0 → 18.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/README.md +8 -0
- package/dist/cjs/LighterProvider.d.ts.map +1 -1
- package/dist/cjs/LighterProvider.js +76 -57
- package/dist/cjs/LighterProvider.js.map +1 -1
- package/dist/cjs/accountConfig.d.ts.map +1 -1
- package/dist/cjs/accountConfig.js.map +1 -1
- package/dist/cjs/constants.d.ts +2 -1
- package/dist/cjs/constants.d.ts.map +1 -1
- package/dist/cjs/constants.js +3 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/signers/LighterKeyStore.d.ts +3 -1
- package/dist/cjs/signers/LighterKeyStore.d.ts.map +1 -1
- package/dist/cjs/signers/LighterKeyStore.js +14 -2
- package/dist/cjs/signers/LighterKeyStore.js.map +1 -1
- package/dist/cjs/signers/LighterReadOnlyTokenManager.d.ts +7 -0
- package/dist/cjs/signers/LighterReadOnlyTokenManager.d.ts.map +1 -1
- package/dist/cjs/signers/LighterReadOnlyTokenManager.js +19 -7
- package/dist/cjs/signers/LighterReadOnlyTokenManager.js.map +1 -1
- package/dist/cjs/signers/signActions.d.ts.map +1 -1
- package/dist/cjs/signers/signActions.js +8 -0
- package/dist/cjs/signers/signActions.js.map +1 -1
- package/dist/cjs/utils/apiClient.d.ts +12 -0
- package/dist/cjs/utils/apiClient.d.ts.map +1 -1
- package/dist/cjs/utils/apiClient.js +62 -7
- package/dist/cjs/utils/apiClient.js.map +1 -1
- package/dist/esm/LighterProvider.d.ts.map +1 -1
- package/dist/esm/LighterProvider.js +78 -102
- package/dist/esm/LighterProvider.js.map +1 -1
- package/dist/esm/accountConfig.d.ts.map +1 -1
- package/dist/esm/accountConfig.js +2 -4
- package/dist/esm/accountConfig.js.map +1 -1
- package/dist/esm/constants.d.ts +7 -1
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.js +7 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/signers/LighterKeyStore.d.ts +4 -1
- package/dist/esm/signers/LighterKeyStore.d.ts.map +1 -1
- package/dist/esm/signers/LighterKeyStore.js +15 -3
- package/dist/esm/signers/LighterKeyStore.js.map +1 -1
- package/dist/esm/signers/LighterReadOnlyTokenManager.d.ts +12 -0
- package/dist/esm/signers/LighterReadOnlyTokenManager.d.ts.map +1 -1
- package/dist/esm/signers/LighterReadOnlyTokenManager.js +23 -7
- package/dist/esm/signers/LighterReadOnlyTokenManager.js.map +1 -1
- package/dist/esm/signers/signActions.d.ts.map +1 -1
- package/dist/esm/signers/signActions.js +9 -0
- package/dist/esm/signers/signActions.js.map +1 -1
- package/dist/esm/utils/apiClient.d.ts +34 -7
- package/dist/esm/utils/apiClient.d.ts.map +1 -1
- package/dist/esm/utils/apiClient.js +77 -14
- package/dist/esm/utils/apiClient.js.map +1 -1
- package/dist/types/LighterProvider.d.ts.map +1 -1
- package/dist/types/accountConfig.d.ts.map +1 -1
- package/dist/types/constants.d.ts +7 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/signers/LighterKeyStore.d.ts +4 -1
- package/dist/types/signers/LighterKeyStore.d.ts.map +1 -1
- package/dist/types/signers/LighterReadOnlyTokenManager.d.ts +12 -0
- package/dist/types/signers/LighterReadOnlyTokenManager.d.ts.map +1 -1
- package/dist/types/signers/signActions.d.ts.map +1 -1
- package/dist/types/utils/apiClient.d.ts +34 -7
- package/dist/types/utils/apiClient.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/LighterProvider.ts +103 -138
- package/src/accountConfig.ts +2 -4
- package/src/constants.ts +8 -0
- package/src/signers/LighterKeyStore.ts +28 -3
- package/src/signers/LighterReadOnlyTokenManager.ts +39 -6
- package/src/signers/signActions.ts +10 -0
- package/src/utils/apiClient.ts +106 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LighterProvider.d.ts","sourceRoot":"","sources":["../../src/LighterProvider.ts"],"names":[],"mapp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KACnC,oBACyD,CAAA;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAS,sBAA2B,KACnC,oBAA6E,CAAA;AAEhF;;;;GAIG;AACH,eAAO,MAAM,OAAO,aA7BT,sBAAsB,KAC9B,oBA4BmC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountConfig.d.ts","sourceRoot":"","sources":["../../src/accountConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACf,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"accountConfig.d.ts","sourceRoot":"","sources":["../../src/accountConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACf,MAAM,mBAAmB,CAAA;AAgL1B;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,EAC5B,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,cAAc,EAAE,GACxB,oBAAoB,EAAE,CAIxB"}
|
|
@@ -178,6 +178,12 @@ declare const LIGHTER_CODE_ACCOUNT_NOT_FOUND = 21100;
|
|
|
178
178
|
* @internal
|
|
179
179
|
*/
|
|
180
180
|
declare const LIGHTER_INVALID_AUTH_CODE = 20013;
|
|
181
|
+
/**
|
|
182
|
+
* Lighter body `code` for a read-only auth token revoked at the venue.
|
|
183
|
+
*
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
186
|
+
declare const LIGHTER_TOKEN_REVOKED_CODE = 61006;
|
|
181
187
|
/**
|
|
182
188
|
* Lighter body `code` values that mean success. Lighter is inconsistent per
|
|
183
189
|
* endpoint: `/api/v1/account` returns `code: 200`, most others return `code: 0`.
|
|
@@ -194,5 +200,5 @@ declare const LIGHTER_SUCCESS_CODES: Set<number>;
|
|
|
194
200
|
* @internal
|
|
195
201
|
*/
|
|
196
202
|
declare const LIGHTER_MUTATION_SUCCESS_CODE = 200;
|
|
197
|
-
export { LIGHTER_CODE_ACCOUNT_NOT_FOUND, LIGHTER_INVALID_AUTH_CODE, LIGHTER_MUTATION_SUCCESS_CODE, LIGHTER_SUCCESS_CODES, };
|
|
203
|
+
export { LIGHTER_CODE_ACCOUNT_NOT_FOUND, LIGHTER_INVALID_AUTH_CODE, LIGHTER_MUTATION_SUCCESS_CODE, LIGHTER_SUCCESS_CODES, LIGHTER_TOKEN_REVOKED_CODE, };
|
|
198
204
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAGpE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAE7C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,eAAe,CAAA;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,SAAS,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,wCAAwC,CAAA;AAC7E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,6CAA6C,CAAA;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAA;AAElD;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,2CACP,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,kBAAkB,EAClB,sBAAsB,CAUvB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,gFAAgF;IAChF,WAAW,EAAE,kBAAkB,CA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AAM,qBAAqB,EAAE,iBAOlC,CAAA;AAEF,gBAAgB;AAChB,eAAO,MAAM,oBAAoB,KAAK,CAAA;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,UAAY,CAAA;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,OAAoC,CAAA;AAExE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAA;AAE/C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C,gBAAgB;AAChB,QAAA,MAAM,8BAA8B,QAAQ,CAAA;AAE5C;;;;GAIG;AACH,QAAA,MAAM,yBAAyB,QAAQ,CAAA;AAEvC;;;;GAIG;AACH,QAAA,MAAM,0BAA0B,QAAQ,CAAA;AAExC;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,aAAoB,CAAA;AAE/C;;;;;;GAMG;AACH,QAAA,MAAM,6BAA6B,MAAM,CAAA;AAEzC,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,0BAA0B,GAC3B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StorageAdapter } from '@lifi/perps-sdk';
|
|
2
|
-
import type
|
|
2
|
+
import { type LighterProviderKey } from '@lifi/perps-types';
|
|
3
3
|
import type { Address } from 'viem';
|
|
4
4
|
/**
|
|
5
5
|
* Persisted Lighter API-key material associated with one L2 account.
|
|
@@ -23,6 +23,8 @@ export interface LighterApiKey {
|
|
|
23
23
|
apiKeyPrivateKey: string;
|
|
24
24
|
/** Corresponding public key, registered via ChangePubKey. */
|
|
25
25
|
apiKeyPublicKey: string;
|
|
26
|
+
/** Referral code confirmed by the standard-token SET_REFERRAL action. */
|
|
27
|
+
appliedReferralCode?: string;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Storage-backed cache for Lighter API keys. Records are namespaced by L1
|
|
@@ -61,6 +63,7 @@ export declare class LighterKeyStore {
|
|
|
61
63
|
* key, so callers never name the instance themselves.
|
|
62
64
|
*/
|
|
63
65
|
set(address: Address, value: Omit<LighterApiKey, 'providerKey'>): Promise<void>;
|
|
66
|
+
markReferralApplied(address: Address, appliedReferralCode: string): Promise<void>;
|
|
64
67
|
/**
|
|
65
68
|
* Remove the persisted API key for an L1 address and clear its in-memory
|
|
66
69
|
* cache entry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LighterKeyStore.d.ts","sourceRoot":"","sources":["../../../src/signers/LighterKeyStore.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LighterKeyStore.d.ts","sourceRoot":"","sources":["../../../src/signers/LighterKeyStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,KAAK,kBAAkB,EAAkB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAQnC;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAA;IACpB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAA;IACnB,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,CAAA;IACxB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAA;IACvB,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAgCD;;;;;;;GAOG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,WAAW,CAAoB;IAEvC;;;;OAIG;gBAED,OAAO,EAAE,cAAc,EACvB,WAAW,GAAE,kBAAyC;IAMxD;;;;;OAKG;IACH,eAAe,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;IAMtD,OAAO,CAAC,UAAU;IAOlB;;;OAGG;IACG,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAkB1D;;;;OAIG;IACG,GAAG,CACP,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC;IAOV,mBAAmB,CACvB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC;IAYhB;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAK9C"}
|
|
@@ -60,6 +60,7 @@ export type LighterTokenFetcher = (params: {
|
|
|
60
60
|
expiry: number;
|
|
61
61
|
subAccountAccess: boolean;
|
|
62
62
|
scopes: string;
|
|
63
|
+
fetchImpl?: typeof fetch;
|
|
63
64
|
}) => Promise<LighterCreateTokenResponse>;
|
|
64
65
|
/**
|
|
65
66
|
* One row of Lighter's read-only token registry, matching Lighter's
|
|
@@ -108,6 +109,7 @@ export type LighterTokenListFetcher = (params: {
|
|
|
108
109
|
url: string;
|
|
109
110
|
authorization: string;
|
|
110
111
|
accountIndex: number;
|
|
112
|
+
fetchImpl?: typeof fetch;
|
|
111
113
|
}) => Promise<LighterListTokensResponse>;
|
|
112
114
|
/**
|
|
113
115
|
* Function injected for the HTTP boundary against Lighter's
|
|
@@ -119,6 +121,7 @@ export type LighterTokenRevokeFetcher = (params: {
|
|
|
119
121
|
authorization: string;
|
|
120
122
|
tokenId: number;
|
|
121
123
|
accountIndex: number;
|
|
124
|
+
fetchImpl?: typeof fetch;
|
|
122
125
|
}) => Promise<LighterRevokeTokenResponse>;
|
|
123
126
|
/**
|
|
124
127
|
* Dependencies and overrides for {@link LighterReadOnlyTokenManager}.
|
|
@@ -144,6 +147,8 @@ export interface LighterReadOnlyTokenManagerOptions {
|
|
|
144
147
|
listFetcher?: LighterTokenListFetcher;
|
|
145
148
|
/** Override the revoke POST. Defaults to a `fetch`-based implementation. */
|
|
146
149
|
revokeFetcher?: LighterTokenRevokeFetcher;
|
|
150
|
+
/** Transport used by the default endpoint fetchers. Defaults to `fetch`. */
|
|
151
|
+
fetchImpl?: typeof fetch;
|
|
147
152
|
/** Clock injection for testing expiry logic. Defaults to `Date.now`. */
|
|
148
153
|
now?: () => number;
|
|
149
154
|
}
|
|
@@ -194,6 +199,7 @@ export declare class LighterReadOnlyTokenManager {
|
|
|
194
199
|
private readonly fetcher;
|
|
195
200
|
private readonly listFetcher;
|
|
196
201
|
private readonly revokeFetcher;
|
|
202
|
+
private readonly fetchImpl;
|
|
197
203
|
private readonly now;
|
|
198
204
|
private readonly cache;
|
|
199
205
|
constructor(options?: LighterReadOnlyTokenManagerOptions);
|
|
@@ -253,6 +259,12 @@ export declare class LighterReadOnlyTokenManager {
|
|
|
253
259
|
* @param inputs Token-create parameters plus the owning `address`.
|
|
254
260
|
*/
|
|
255
261
|
approve(authorization: string, inputs: ApproveReadOnlyTokenInputs): Promise<ApproveReadOnlyTokenResult>;
|
|
262
|
+
/**
|
|
263
|
+
* Replace a token that Lighter explicitly reports as revoked.
|
|
264
|
+
* The venue already revoked the row, so this path skips registry cleanup.
|
|
265
|
+
*/
|
|
266
|
+
replaceRevoked(authorization: string, inputs: ApproveReadOnlyTokenInputs): Promise<ApproveReadOnlyTokenResult>;
|
|
267
|
+
private createAndPersist;
|
|
256
268
|
/**
|
|
257
269
|
* Revoke the registry rows this SDK owns and no longer needs. Lighter's
|
|
258
270
|
* `tokens/create` appends a row on every call, so without this pass the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LighterReadOnlyTokenManager.d.ts","sourceRoot":"","sources":["../../../src/signers/LighterReadOnlyTokenManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAGnC;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,gBAAgB,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAA;IACvB,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE;IACzC,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,OAAO,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"LighterReadOnlyTokenManager.d.ts","sourceRoot":"","sources":["../../../src/signers/LighterReadOnlyTokenManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,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EAC5B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,EAAE,OAAO,EAChB,GAAG,CAAC,EAAE,kBAAkB,GACvB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAsB7B"}
|
|
@@ -2,21 +2,36 @@ import { PerpsError, type ResolvedRetryPolicy } from '@lifi/perps-sdk';
|
|
|
2
2
|
/** @internal */
|
|
3
3
|
export type ApiParams = Record<string, string | number | boolean>;
|
|
4
4
|
/**
|
|
5
|
-
* Auth-gated read whose token Lighter rejected.
|
|
6
|
-
*
|
|
7
|
-
* with a freshly-created one. Lighter signals this on either channel: an HTTP
|
|
8
|
-
* 401/403, or an HTTP 200 carrying an error `code` in the body.
|
|
5
|
+
* Auth-gated read whose token format Lighter rejected.
|
|
6
|
+
*
|
|
9
7
|
* @internal
|
|
10
8
|
*/
|
|
11
9
|
export declare class LighterAuthRejectedError extends PerpsError {
|
|
12
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Auth-gated read whose read-only token Lighter reports as revoked.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare class LighterTokenRevokedError extends PerpsError {
|
|
17
|
+
}
|
|
13
18
|
/** @internal */
|
|
14
19
|
export declare const LIGHTER_RETRY_DEFAULTS: ResolvedRetryPolicy;
|
|
20
|
+
/**
|
|
21
|
+
* Mutable rate-limit deadline shared by the request clients for one provider
|
|
22
|
+
* instance. A client creates an isolated hold when the caller omits this.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export interface LighterRateLimitHold {
|
|
27
|
+
untilMs: number;
|
|
28
|
+
}
|
|
15
29
|
/** @internal */
|
|
16
30
|
export interface LighterApiClientOptions {
|
|
17
31
|
signal?: AbortSignal;
|
|
18
32
|
policy?: ResolvedRetryPolicy;
|
|
19
33
|
fetchImpl?: typeof fetch;
|
|
34
|
+
rateLimitHold?: LighterRateLimitHold;
|
|
20
35
|
}
|
|
21
36
|
/**
|
|
22
37
|
* HTTP boundary against Lighter's REST API.
|
|
@@ -32,9 +47,10 @@ export interface LighterApiClientOptions {
|
|
|
32
47
|
* `Authorization` header. This matches Lighter's OpenAPI spec and lets the
|
|
33
48
|
* same call work browser-direct and from server-side proxies.
|
|
34
49
|
*
|
|
35
|
-
* Lighter signals rate
|
|
36
|
-
*
|
|
37
|
-
*
|
|
50
|
+
* Lighter signals rate limits through HTTP 429 or HTTP 405. This client never
|
|
51
|
+
* retries such a response. It throws `RateLimitExceeded` and holds all network
|
|
52
|
+
* dispatch until `Retry-After` expires (capped at five minutes), or for 60
|
|
53
|
+
* seconds when the response has no valid header.
|
|
38
54
|
* @public
|
|
39
55
|
*/
|
|
40
56
|
export declare class LighterApiClient {
|
|
@@ -42,7 +58,18 @@ export declare class LighterApiClient {
|
|
|
42
58
|
private readonly signal;
|
|
43
59
|
private readonly policy;
|
|
44
60
|
private readonly fetchImpl;
|
|
61
|
+
private readonly rateLimitHold;
|
|
62
|
+
private readonly fetchWithHold;
|
|
45
63
|
constructor(baseUrl: string, options?: LighterApiClientOptions);
|
|
64
|
+
/**
|
|
65
|
+
* Send a single request through this client's rate-limit hold.
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
request(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
70
|
+
private rateLimitError;
|
|
71
|
+
private assertRequestAllowed;
|
|
72
|
+
private assertNotRateLimited;
|
|
46
73
|
private buildUrl;
|
|
47
74
|
get<T>(path: string, params?: ApiParams): Promise<T>;
|
|
48
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/utils/apiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,mBAAmB,EACzB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src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5B,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,QAAQ;IAaV,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1D;;;;OAIG;IACG,SAAS,CAAC,CAAC,EACf,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,SAAc,GACrB,OAAO,CAAC,CAAC,CAAC;IAqBb;;;;OAIG;IACG,aAAa,CAAC,CAAC,EACnB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC;IAiBvC;;;;;OAKG;IACG,QAAQ,CAAC,CAAC,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC;YAgBzB,UAAU;IAMxB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;CAejB"}
|
package/package.json
CHANGED
package/src/LighterProvider.ts
CHANGED
|
@@ -75,7 +75,10 @@ import {
|
|
|
75
75
|
} from './constants.js'
|
|
76
76
|
import { lighterDepositFlow } from './depositFlow.js'
|
|
77
77
|
import { createAuthToken } from './signers/createAuthToken.js'
|
|
78
|
-
import {
|
|
78
|
+
import {
|
|
79
|
+
type LighterApiKey,
|
|
80
|
+
LighterKeyStore,
|
|
81
|
+
} from './signers/LighterKeyStore.js'
|
|
79
82
|
import { LighterReadOnlyTokenManager } from './signers/LighterReadOnlyTokenManager.js'
|
|
80
83
|
import { LighterSigner } from './signers/LighterSigner.js'
|
|
81
84
|
import {
|
|
@@ -103,9 +106,8 @@ import {
|
|
|
103
106
|
import {
|
|
104
107
|
LIGHTER_RETRY_DEFAULTS,
|
|
105
108
|
LighterApiClient,
|
|
106
|
-
|
|
109
|
+
LighterTokenRevokedError,
|
|
107
110
|
} from './utils/apiClient.js'
|
|
108
|
-
import { fetchAppliedReferralCode } from './utils/appliedReferralCode.js'
|
|
109
111
|
import { isAssetMarginEnabled } from './utils/assetCollateral.js'
|
|
110
112
|
import {
|
|
111
113
|
classifyAndMapOrders,
|
|
@@ -311,11 +313,6 @@ export const createLighterProvider = (
|
|
|
311
313
|
})
|
|
312
314
|
const keyStore = new LighterKeyStore(storage, providerKey)
|
|
313
315
|
const apiKeyFreshness = createLighterApiKeyFreshness()
|
|
314
|
-
const readOnlyTokenManager = new LighterReadOnlyTokenManager({
|
|
315
|
-
storage,
|
|
316
|
-
providerKey,
|
|
317
|
-
lighterApiUrl: restUrl,
|
|
318
|
-
})
|
|
319
316
|
const tokenLifetimeSeconds = options.tokenLifetimeSeconds ?? 60 * 60
|
|
320
317
|
const tokenRenewBufferSeconds = options.tokenRenewBufferSeconds ?? 60
|
|
321
318
|
const standardTokenByAddress: Map<string, CachedStandardToken> = new Map()
|
|
@@ -326,6 +323,7 @@ export const createLighterProvider = (
|
|
|
326
323
|
const readOnlyCreationInFlight: Map<string, Promise<string>> = new Map()
|
|
327
324
|
const readOnlyCreationBackoff: Map<string, ReadOnlyCreationBackoff> =
|
|
328
325
|
new Map()
|
|
326
|
+
const rateLimitHold = { untilMs: 0 }
|
|
329
327
|
|
|
330
328
|
const apiClient = (opts?: SDKRequestOptions): LighterApiClient => {
|
|
331
329
|
const client = requireClient()
|
|
@@ -337,9 +335,17 @@ export const createLighterProvider = (
|
|
|
337
335
|
providerKey
|
|
338
336
|
),
|
|
339
337
|
fetchImpl: client.config.fetch,
|
|
338
|
+
rateLimitHold,
|
|
340
339
|
})
|
|
341
340
|
}
|
|
342
341
|
|
|
342
|
+
const readOnlyTokenManager = new LighterReadOnlyTokenManager({
|
|
343
|
+
storage,
|
|
344
|
+
providerKey,
|
|
345
|
+
lighterApiUrl: restUrl,
|
|
346
|
+
fetchImpl: (input, init) => apiClient().request(input, init),
|
|
347
|
+
})
|
|
348
|
+
|
|
343
349
|
const getStandardAuthToken = async (
|
|
344
350
|
address: Address,
|
|
345
351
|
apiKeyPrivateKey: string,
|
|
@@ -385,7 +391,8 @@ export const createLighterProvider = (
|
|
|
385
391
|
*/
|
|
386
392
|
const resolveAuthToken = async (
|
|
387
393
|
opts: SDKRequestOptions | undefined,
|
|
388
|
-
address?: Address
|
|
394
|
+
address?: Address,
|
|
395
|
+
knownApiKey?: LighterApiKey
|
|
389
396
|
): Promise<string | undefined> => {
|
|
390
397
|
if (opts?.lighterAuthToken !== undefined) {
|
|
391
398
|
return opts.lighterAuthToken
|
|
@@ -396,7 +403,7 @@ export const createLighterProvider = (
|
|
|
396
403
|
if (address === undefined) {
|
|
397
404
|
return undefined
|
|
398
405
|
}
|
|
399
|
-
const apiKey = await keyStore.get(address)
|
|
406
|
+
const apiKey = knownApiKey ?? (await keyStore.get(address))
|
|
400
407
|
if (apiKey === null) {
|
|
401
408
|
return undefined
|
|
402
409
|
}
|
|
@@ -468,27 +475,60 @@ export const createLighterProvider = (
|
|
|
468
475
|
return attempt
|
|
469
476
|
}
|
|
470
477
|
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
// rides reads during the creation-failure fallback and authorises
|
|
476
|
-
// read-only token creation — so a revocation must re-sign it too.
|
|
477
|
-
standardTokenByAddress.delete(cacheKey)
|
|
478
|
+
const replaceRevokedReadOnlyToken = async (
|
|
479
|
+
address: Address,
|
|
480
|
+
revokedToken: string
|
|
481
|
+
): Promise<string | undefined> => {
|
|
478
482
|
const apiKey = await keyStore.get(address)
|
|
479
|
-
if (apiKey
|
|
480
|
-
|
|
483
|
+
if (apiKey === null) {
|
|
484
|
+
return undefined
|
|
485
|
+
}
|
|
486
|
+
const flightKey = address.toLowerCase()
|
|
487
|
+
const activeFlight = readOnlyCreationInFlight.get(flightKey)
|
|
488
|
+
if (activeFlight !== undefined) {
|
|
489
|
+
return activeFlight
|
|
490
|
+
}
|
|
491
|
+
const current = await readOnlyTokenManager.get(address, apiKey.accountIndex)
|
|
492
|
+
if (current !== undefined && current.token !== revokedToken) {
|
|
493
|
+
return current.token
|
|
494
|
+
}
|
|
495
|
+
const inFlightAfterRead = readOnlyCreationInFlight.get(flightKey)
|
|
496
|
+
if (inFlightAfterRead !== undefined) {
|
|
497
|
+
return inFlightAfterRead
|
|
498
|
+
}
|
|
499
|
+
const attempt = (async (): Promise<string> => {
|
|
500
|
+
const standardToken = await getStandardAuthToken(
|
|
501
|
+
address,
|
|
502
|
+
apiKey.apiKeyPrivateKey,
|
|
503
|
+
{
|
|
504
|
+
apiKeyIndex: apiKey.apiKeyIndex,
|
|
505
|
+
accountIndex: apiKey.accountIndex,
|
|
506
|
+
}
|
|
507
|
+
)
|
|
508
|
+
const { token } = await readOnlyTokenManager.replaceRevoked(
|
|
509
|
+
standardToken,
|
|
510
|
+
{
|
|
511
|
+
address,
|
|
512
|
+
accountIndex: apiKey.accountIndex,
|
|
513
|
+
expirySeconds:
|
|
514
|
+
Math.floor(Date.now() / 1000) +
|
|
515
|
+
DEFAULT_READ_ONLY_TOKEN_LIFETIME_SECONDS,
|
|
516
|
+
scope: 'all',
|
|
517
|
+
}
|
|
518
|
+
)
|
|
519
|
+
readOnlyCreationBackoff.delete(flightKey)
|
|
520
|
+
return token.token
|
|
521
|
+
})()
|
|
522
|
+
readOnlyCreationInFlight.set(flightKey, attempt)
|
|
523
|
+
try {
|
|
524
|
+
return await attempt
|
|
525
|
+
} finally {
|
|
526
|
+
if (readOnlyCreationInFlight.get(flightKey) === attempt) {
|
|
527
|
+
readOnlyCreationInFlight.delete(flightKey)
|
|
528
|
+
}
|
|
481
529
|
}
|
|
482
530
|
}
|
|
483
531
|
|
|
484
|
-
/**
|
|
485
|
-
* Run an auth-gated read; if Lighter rejects the token (revoked server-side —
|
|
486
|
-
* invisible to `checkSetup`, since the read-only token is a client-only
|
|
487
|
-
* concern), evict the SDK-resolved credentials (stored read-only token and
|
|
488
|
-
* cached standard token) and retry once with freshly resolved ones. Only
|
|
489
|
-
* self-heals tokens the SDK itself resolved — a caller-supplied
|
|
490
|
-
* `lighterAuthToken`/`authToken` source is the caller's to fix.
|
|
491
|
-
*/
|
|
492
532
|
const retryOnRevoked = async <T>(
|
|
493
533
|
opts: SDKRequestOptions | undefined,
|
|
494
534
|
address: Address,
|
|
@@ -500,11 +540,10 @@ export const createLighterProvider = (
|
|
|
500
540
|
} catch (err) {
|
|
501
541
|
const sdkOwnsToken =
|
|
502
542
|
opts?.lighterAuthToken === undefined && authTokenSource === undefined
|
|
503
|
-
if (!(err instanceof
|
|
543
|
+
if (!(err instanceof LighterTokenRevokedError) || !sdkOwnsToken) {
|
|
504
544
|
throw err
|
|
505
545
|
}
|
|
506
|
-
await
|
|
507
|
-
const fresh = await resolveAuthToken(opts, address)
|
|
546
|
+
const fresh = await replaceRevokedReadOnlyToken(address, token)
|
|
508
547
|
if (fresh === undefined || fresh === token) {
|
|
509
548
|
throw err
|
|
510
549
|
}
|
|
@@ -512,38 +551,6 @@ export const createLighterProvider = (
|
|
|
512
551
|
}
|
|
513
552
|
}
|
|
514
553
|
|
|
515
|
-
/**
|
|
516
|
-
* Degrade an auth-gated `getAccount` read to `undefined` when Lighter
|
|
517
|
-
* rejects an SDK-owned token even after `retryOnRevoked` re-resolved it —
|
|
518
|
-
* the signature of a stale local API key (the venue's slot was
|
|
519
|
-
* re-registered elsewhere). `getAccount` must resolve in that state so
|
|
520
|
-
* `apiKeyRegistered: false` can render the REGISTER_API_KEY gate, which is
|
|
521
|
-
* the only recovery. A caller-supplied token stays the caller's to fix, so
|
|
522
|
-
* its rejection propagates, as does every other error class.
|
|
523
|
-
*/
|
|
524
|
-
const degradeOnAuthRejection = async <T>(
|
|
525
|
-
opts: SDKRequestOptions | undefined,
|
|
526
|
-
endpoint: string,
|
|
527
|
-
read: Promise<T>
|
|
528
|
-
): Promise<T | undefined> => {
|
|
529
|
-
try {
|
|
530
|
-
return await read
|
|
531
|
-
} catch (err) {
|
|
532
|
-
const sdkOwnsToken =
|
|
533
|
-
opts?.lighterAuthToken === undefined && authTokenSource === undefined
|
|
534
|
-
if (err instanceof LighterAuthRejectedError && sdkOwnsToken) {
|
|
535
|
-
console.warn(
|
|
536
|
-
`[lighter] ${endpoint} rejected the auth token after re-resolution; ` +
|
|
537
|
-
'degrading the read — the stored API key no longer matches the ' +
|
|
538
|
-
'registered key, and the REGISTER_API_KEY gate will surface it.',
|
|
539
|
-
err
|
|
540
|
-
)
|
|
541
|
-
return undefined
|
|
542
|
-
}
|
|
543
|
-
throw err
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
554
|
const fetchAccountLimits = (
|
|
548
555
|
client: LighterApiClient,
|
|
549
556
|
accountIndex: number,
|
|
@@ -702,86 +709,46 @@ export const createLighterProvider = (
|
|
|
702
709
|
opts?: SDKRequestOptions
|
|
703
710
|
): Promise<AccountResponse> {
|
|
704
711
|
const client = apiClient(opts)
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
const registry = getMarketRegistry(requireClient(), providerKey)
|
|
711
|
-
const assetRegistry = getAssetRegistry(requireClient(), providerKey)
|
|
712
|
-
// Shared promise: the referral read below awaits this instance's runtime
|
|
713
|
-
// metadata off the same `/providers` fetch — no second request.
|
|
714
|
-
const providersPromise = getProviders(requireClient())
|
|
715
|
-
// Shared promise: the registered-key read names the slot off the local
|
|
716
|
-
// record, and the config readout reports the record — one storage read.
|
|
717
|
-
const localKeyPromise = keyStore.get(params.address)
|
|
718
|
-
const [
|
|
719
|
-
{ providers },
|
|
720
|
-
,
|
|
721
|
-
,
|
|
722
|
-
registeredKey,
|
|
723
|
-
limitsResult,
|
|
724
|
-
localKey,
|
|
725
|
-
storedReadOnlyToken,
|
|
726
|
-
appliedReferralCode,
|
|
727
|
-
] = await Promise.all([
|
|
728
|
-
providersPromise,
|
|
729
|
-
registry.sync(),
|
|
730
|
-
assetRegistry.sync(),
|
|
731
|
-
// The local record names the only slot worth reading: no record means
|
|
732
|
-
// nothing to compare the registered key against, so the read is skipped.
|
|
733
|
-
localKeyPromise.then((key) =>
|
|
734
|
-
key === null
|
|
735
|
-
? undefined
|
|
736
|
-
: fetchRegisteredApiKey(client, account.index, key.apiKeyIndex)
|
|
737
|
-
),
|
|
738
|
-
// No token is a legitimate unauthenticated read → undefined → zero fee
|
|
739
|
-
// tier. A generic fetch error is NOT: it must propagate, never be
|
|
740
|
-
// coerced to a fabricated 0%/0% fee tier. One carve-out: a token the
|
|
741
|
-
// venue rejects even after re-resolution (stale local API key) degrades
|
|
742
|
-
// to undefined, so the REGISTER_API_KEY gate can render the recovery.
|
|
743
|
-
token === undefined
|
|
712
|
+
const accountPromise = fetchDetailedAccount(client, params.address)
|
|
713
|
+
const localKey = await keyStore.get(params.address)
|
|
714
|
+
const registeredKeyPromise =
|
|
715
|
+
localKey === null
|
|
744
716
|
? Promise.resolve(undefined)
|
|
745
|
-
:
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
readOnlyTokenManager.get(params.address, account.index),
|
|
754
|
-
// The expected code is backend-owned runtime metadata on this
|
|
755
|
-
// instance's own provider descriptor (keyed by `providerKey`, so the
|
|
756
|
-
// RH instance never compares against mainnet attribution). Metadata
|
|
757
|
-
// without a code, or no token to authenticate the read → undefined →
|
|
758
|
-
// `referralPresent: false`. The read stays SDK-direct: the token only
|
|
759
|
-
// ever goes to Lighter, never to the LI.FI backend.
|
|
760
|
-
token === undefined
|
|
761
|
-
? Promise.resolve(undefined)
|
|
762
|
-
: providersPromise.then((response) =>
|
|
763
|
-
response.providers.find((p) => p.key === providerKey)
|
|
764
|
-
?.referralCode
|
|
765
|
-
? degradeOnAuthRejection(
|
|
766
|
-
opts,
|
|
767
|
-
'/api/v1/referral/userReferrals',
|
|
768
|
-
retryOnRevoked(opts, params.address, token, (t) =>
|
|
769
|
-
fetchAppliedReferralCode(client, params.address, t)
|
|
770
|
-
)
|
|
771
|
-
)
|
|
772
|
-
: undefined
|
|
773
|
-
),
|
|
717
|
+
: fetchRegisteredApiKey(
|
|
718
|
+
client,
|
|
719
|
+
localKey.accountIndex,
|
|
720
|
+
localKey.apiKeyIndex
|
|
721
|
+
)
|
|
722
|
+
const [account, registeredKey] = await Promise.all([
|
|
723
|
+
accountPromise,
|
|
724
|
+
registeredKeyPromise,
|
|
774
725
|
])
|
|
775
726
|
|
|
776
|
-
// REGISTER_API_KEY is satisfied only when the locally-held keypair
|
|
777
|
-
// matches the key registered on-chain at this slot — existence alone is
|
|
778
|
-
// insufficient (a stale/rotated local key can't sign valid auth tokens).
|
|
779
727
|
const apiKeyRegistered =
|
|
780
728
|
registeredKey !== undefined &&
|
|
781
729
|
localKey !== null &&
|
|
782
730
|
normalizeLighterPublicKey(localKey.apiKeyPublicKey) ===
|
|
783
731
|
normalizeLighterPublicKey(registeredKey.public_key)
|
|
732
|
+
const token = apiKeyRegistered
|
|
733
|
+
? await resolveAuthToken(opts, params.address, localKey)
|
|
734
|
+
: undefined
|
|
784
735
|
|
|
736
|
+
const registry = getMarketRegistry(requireClient(), providerKey)
|
|
737
|
+
const assetRegistry = getAssetRegistry(requireClient(), providerKey)
|
|
738
|
+
const [{ providers }, , , limitsResult, storedReadOnlyToken] =
|
|
739
|
+
await Promise.all([
|
|
740
|
+
getProviders(requireClient()),
|
|
741
|
+
registry.sync(),
|
|
742
|
+
assetRegistry.sync(),
|
|
743
|
+
token === undefined
|
|
744
|
+
? Promise.resolve(undefined)
|
|
745
|
+
: retryOnRevoked(opts, params.address, token, (resolvedToken) =>
|
|
746
|
+
fetchAccountLimits(client, account.index, resolvedToken)
|
|
747
|
+
),
|
|
748
|
+
apiKeyRegistered
|
|
749
|
+
? readOnlyTokenManager.get(params.address, localKey.accountIndex)
|
|
750
|
+
: Promise.resolve(undefined),
|
|
751
|
+
])
|
|
785
752
|
const positions: Position[] = mapOpenPositions(account.positions, (id) =>
|
|
786
753
|
toPerpsMarketDisplay(registry.require(String(id)))
|
|
787
754
|
)
|
|
@@ -868,12 +835,10 @@ export const createLighterProvider = (
|
|
|
868
835
|
readOnlyTokenApproved: storedReadOnlyToken !== undefined,
|
|
869
836
|
readOnlyTokenExpiry: storedReadOnlyToken?.expiry,
|
|
870
837
|
readOnlyTokenScope: storedReadOnlyToken?.scope,
|
|
871
|
-
// True only when the authenticated `used_code` equals the backend-owned
|
|
872
|
-
// code for this instance; `appliedReferralCode` is only ever fetched
|
|
873
|
-
// when that code exists.
|
|
874
838
|
referralPresent:
|
|
875
|
-
|
|
876
|
-
|
|
839
|
+
apiKeyRegistered &&
|
|
840
|
+
instanceMeta?.referralCode !== undefined &&
|
|
841
|
+
localKey?.appliedReferralCode === instanceMeta.referralCode,
|
|
877
842
|
}
|
|
878
843
|
|
|
879
844
|
return {
|
package/src/accountConfig.ts
CHANGED
|
@@ -104,10 +104,8 @@ function projectLighterDescriptor(
|
|
|
104
104
|
satisfied: config.readOnlyTokenApproved,
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
// `SET_REFERRAL`
|
|
108
|
-
//
|
|
109
|
-
// since the applied referral is a per-user, auth-gated read. Lighter referral
|
|
110
|
-
// is mutable, so an account on another integrator's code stays gateable.
|
|
107
|
+
// `SET_REFERRAL` persists its confirmed code beside the local API key.
|
|
108
|
+
// The account read compares that marker with this instance's runtime code.
|
|
111
109
|
case ActionType.SET_REFERRAL:
|
|
112
110
|
return {
|
|
113
111
|
type: descriptor.type,
|
package/src/constants.ts
CHANGED
|
@@ -228,6 +228,13 @@ const LIGHTER_CODE_ACCOUNT_NOT_FOUND = 21100
|
|
|
228
228
|
*/
|
|
229
229
|
const LIGHTER_INVALID_AUTH_CODE = 20013
|
|
230
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Lighter body `code` for a read-only auth token revoked at the venue.
|
|
233
|
+
*
|
|
234
|
+
* @internal
|
|
235
|
+
*/
|
|
236
|
+
const LIGHTER_TOKEN_REVOKED_CODE = 61006
|
|
237
|
+
|
|
231
238
|
/**
|
|
232
239
|
* Lighter body `code` values that mean success. Lighter is inconsistent per
|
|
233
240
|
* endpoint: `/api/v1/account` returns `code: 200`, most others return `code: 0`.
|
|
@@ -251,4 +258,5 @@ export {
|
|
|
251
258
|
LIGHTER_INVALID_AUTH_CODE,
|
|
252
259
|
LIGHTER_MUTATION_SUCCESS_CODE,
|
|
253
260
|
LIGHTER_SUCCESS_CODES,
|
|
261
|
+
LIGHTER_TOKEN_REVOKED_CODE,
|
|
254
262
|
}
|