@lifi/perps-sdk-provider-lighter 40.1.0 → 40.2.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/dist/cjs/LighterProvider.d.ts.map +1 -1
- package/dist/cjs/LighterProvider.js +2 -2
- package/dist/cjs/LighterProvider.js.map +1 -1
- package/dist/cjs/signers/LighterSigner.d.ts.map +1 -1
- package/dist/cjs/signers/LighterSigner.js +1 -20
- package/dist/cjs/signers/LighterSigner.js.map +1 -1
- package/dist/cjs/types/action.d.ts +14 -0
- package/dist/cjs/types/action.d.ts.map +1 -1
- package/dist/cjs/types/action.js +33 -1
- package/dist/cjs/types/action.js.map +1 -1
- package/dist/esm/LighterProvider.d.ts.map +1 -1
- package/dist/esm/LighterProvider.js +2 -2
- package/dist/esm/LighterProvider.js.map +1 -1
- package/dist/esm/signers/LighterSigner.d.ts.map +1 -1
- package/dist/esm/signers/LighterSigner.js +2 -22
- package/dist/esm/signers/LighterSigner.js.map +1 -1
- package/dist/esm/types/action.d.ts +67 -0
- package/dist/esm/types/action.d.ts.map +1 -1
- package/dist/esm/types/action.js +86 -3
- package/dist/esm/types/action.js.map +1 -1
- package/dist/types/LighterProvider.d.ts.map +1 -1
- package/dist/types/signers/LighterSigner.d.ts.map +1 -1
- package/dist/types/types/action.d.ts +67 -0
- package/dist/types/types/action.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/LighterProvider.ts +16 -8
- package/src/signers/LighterSigner.ts +6 -23
- package/src/types/action.ts +91 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActionType } from '@lifi/perps-types';
|
|
1
2
|
/**
|
|
2
3
|
* Backend-provided params for SignCreateOrder.
|
|
3
4
|
*
|
|
@@ -232,4 +233,70 @@ export declare const LT_NIL_TRIGGER_PRICE = 0;
|
|
|
232
233
|
* @public
|
|
233
234
|
*/
|
|
234
235
|
export declare const LT_DEFAULT_ORDER_EXPIRY = -1;
|
|
236
|
+
/**
|
|
237
|
+
* Lighter tx type `TxTypeL2ChangePubKey`.
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
240
|
+
export declare const LT_TX_TYPE_CHANGE_PUB_KEY = 8;
|
|
241
|
+
/**
|
|
242
|
+
* Lighter tx type `TxTypeL2Transfer`.
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
export declare const LT_TX_TYPE_TRANSFER = 12;
|
|
246
|
+
/**
|
|
247
|
+
* Lighter tx type `TxTypeL2Withdraw`.
|
|
248
|
+
* @public
|
|
249
|
+
*/
|
|
250
|
+
export declare const LT_TX_TYPE_WITHDRAW = 13;
|
|
251
|
+
/**
|
|
252
|
+
* Lighter tx type `TxTypeL2CreateOrder`.
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
export declare const LT_TX_TYPE_CREATE_ORDER = 14;
|
|
256
|
+
/**
|
|
257
|
+
* Lighter tx type `TxTypeL2CancelOrder`.
|
|
258
|
+
* @public
|
|
259
|
+
*/
|
|
260
|
+
export declare const LT_TX_TYPE_CANCEL_ORDER = 15;
|
|
261
|
+
/**
|
|
262
|
+
* Lighter tx type `TxTypeL2CancelAllOrders`.
|
|
263
|
+
* @public
|
|
264
|
+
*/
|
|
265
|
+
export declare const LT_TX_TYPE_CANCEL_ALL_ORDERS = 16;
|
|
266
|
+
/**
|
|
267
|
+
* Lighter tx type `TxTypeL2ModifyOrder`.
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
export declare const LT_TX_TYPE_MODIFY_ORDER = 17;
|
|
271
|
+
/**
|
|
272
|
+
* Lighter tx type `TxTypeL2UpdateLeverage`.
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
export declare const LT_TX_TYPE_UPDATE_LEVERAGE = 20;
|
|
276
|
+
/**
|
|
277
|
+
* Lighter tx type `TxTypeL2UpdateMargin`.
|
|
278
|
+
* @public
|
|
279
|
+
*/
|
|
280
|
+
export declare const LT_TX_TYPE_UPDATE_MARGIN = 29;
|
|
281
|
+
/**
|
|
282
|
+
* Lighter tx type `TxTypeL2UpdateAccountConfig`.
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
export declare const LT_TX_TYPE_UPDATE_ACCOUNT_CONFIG = 41;
|
|
286
|
+
/**
|
|
287
|
+
* Lighter tx type `TxTypeL2UpdateAccountAssetConfig`.
|
|
288
|
+
* @public
|
|
289
|
+
*/
|
|
290
|
+
export declare const LT_TX_TYPE_UPDATE_ACCOUNT_ASSET_CONFIG = 42;
|
|
291
|
+
/**
|
|
292
|
+
* Lighter tx type `TxTypeL2ApproveIntegrator`.
|
|
293
|
+
* @public
|
|
294
|
+
*/
|
|
295
|
+
export declare const LT_TX_TYPE_APPROVE_INTEGRATOR = 45;
|
|
296
|
+
/**
|
|
297
|
+
* Lighter tx type of the signed tx the SDK's WASM signer emits for each
|
|
298
|
+
* action. An action without an entry has no Lighter signing path.
|
|
299
|
+
* @public
|
|
300
|
+
*/
|
|
301
|
+
export declare const LT_TX_TYPE_BY_ACTION: Readonly<Partial<Record<ActionType, number>>>;
|
|
235
302
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/types/action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/types/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAM9C;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa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H,eAAO,MAAM,aAAa,IAAI,CAAA;AAC9B;;;GAGG;AACH,eAAO,MAAM,aAAa,IAAI,CAAA;AAE9B;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAEjC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAA;AACrC;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAGzC;;;GAGG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAA;AAC1C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AACrC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AACrC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AACzC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AACzC;;;GAGG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAA;AAC9C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AACzC;;;GAGG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAC5C;;;GAGG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAC1C;;;GAGG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAA;AAClD;;;GAGG;AACH,eAAO,MAAM,sCAAsC,KAAK,CAAA;AACxD;;;GAGG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAE/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CACzC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAmBnC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/perps-sdk-provider-lighter",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"description": "Lighter provider plugin for @lifi/perps-sdk",
|
|
5
5
|
"homepage": "https://github.com/lifinance/perps-sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@lifi/perps-types": "^24.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@lifi/perps-sdk": "^27.
|
|
50
|
+
"@lifi/perps-sdk": "^27.2.0"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/src/LighterProvider.ts
CHANGED
|
@@ -1000,12 +1000,16 @@ export const createLighterProvider = (
|
|
|
1000
1000
|
const limits =
|
|
1001
1001
|
token === undefined
|
|
1002
1002
|
? undefined
|
|
1003
|
-
: await
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1003
|
+
: await retryWithStandardToken(
|
|
1004
|
+
address,
|
|
1005
|
+
localKey,
|
|
1006
|
+
token,
|
|
1007
|
+
(resolvedToken) =>
|
|
1008
|
+
fetchAccountLimits(
|
|
1009
|
+
apiClient(),
|
|
1010
|
+
localKey.accountIndex,
|
|
1011
|
+
resolvedToken
|
|
1012
|
+
)
|
|
1009
1013
|
)
|
|
1010
1014
|
userTierName = limits?.user_tier_name
|
|
1011
1015
|
} catch (err) {
|
|
@@ -1082,8 +1086,12 @@ export const createLighterProvider = (
|
|
|
1082
1086
|
getMarketsContext(requireClient(), { provider: providerKey }, opts),
|
|
1083
1087
|
token === undefined
|
|
1084
1088
|
? Promise.resolve(undefined)
|
|
1085
|
-
:
|
|
1086
|
-
|
|
1089
|
+
: retryWithStandardToken(
|
|
1090
|
+
params.address,
|
|
1091
|
+
localKey,
|
|
1092
|
+
token,
|
|
1093
|
+
(resolvedToken) =>
|
|
1094
|
+
fetchAccountLimits(client, account.index, resolvedToken)
|
|
1087
1095
|
),
|
|
1088
1096
|
apiKeyRegistered
|
|
1089
1097
|
? readOnlyTokenManager.get(params.address, localKey.accountIndex)
|
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
PerpsError,
|
|
5
5
|
} from '@lifi/perps-sdk'
|
|
6
6
|
import { ActionType, PerpsErrorCode } from '@lifi/perps-types'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
LT_ROUTE_PERP,
|
|
9
|
+
LT_ROUTE_SPOT,
|
|
10
|
+
LT_TX_TYPE_BY_ACTION,
|
|
11
|
+
} from '../types/action.js'
|
|
8
12
|
import { assetMarginModeInt } from '../utils/assetCollateral.js'
|
|
9
13
|
import {
|
|
10
14
|
callLighterWasm,
|
|
@@ -78,27 +82,6 @@ export type LighterL1CountersignedAction =
|
|
|
78
82
|
| ActionType.APPROVE_INTEGRATOR
|
|
79
83
|
| ActionType.TRANSFER
|
|
80
84
|
|
|
81
|
-
// lighter-go `types/txtypes/constants.go`.
|
|
82
|
-
const TX_TYPE_BY_ACTION: Partial<Record<ActionType, number>> = {
|
|
83
|
-
[ActionType.REGISTER_API_KEY]: 8,
|
|
84
|
-
[ActionType.TRANSFER]: 12,
|
|
85
|
-
[ActionType.SEND_ASSET]: 12,
|
|
86
|
-
[ActionType.WITHDRAWAL]: 13,
|
|
87
|
-
[ActionType.PLACE_ORDER]: 14,
|
|
88
|
-
[ActionType.PLACE_TRIGGER_ORDER]: 14,
|
|
89
|
-
[ActionType.PLACE_TWAP_ORDER]: 14,
|
|
90
|
-
[ActionType.CANCEL_ORDER]: 15,
|
|
91
|
-
[ActionType.CANCEL_TWAP_ORDER]: 15,
|
|
92
|
-
[ActionType.CANCEL_ALL_ORDERS]: 16,
|
|
93
|
-
[ActionType.MODIFY_ORDER]: 17,
|
|
94
|
-
[ActionType.UPDATE_LEVERAGE]: 20,
|
|
95
|
-
[ActionType.UPDATE_POSITION_MARGIN]: 29,
|
|
96
|
-
[ActionType.ACCOUNT_MODE]: 41,
|
|
97
|
-
[ActionType.UPDATE_ASSET_COLLATERAL]: 42,
|
|
98
|
-
[ActionType.APPROVE_INTEGRATOR]: 45,
|
|
99
|
-
[ActionType.REVOKE_INTEGRATOR]: 45,
|
|
100
|
-
}
|
|
101
|
-
|
|
102
85
|
// Nil sentinels from lighter-go `types/txtypes/constants.go`: the Go side
|
|
103
86
|
// leaves the matching `L2TxAttributes` entry unset.
|
|
104
87
|
const NIL_INTEGRATOR_INDEX = 0
|
|
@@ -389,7 +372,7 @@ export class LighterSigner {
|
|
|
389
372
|
skipNonce: boolean,
|
|
390
373
|
call: LighterWasmCall<LighterWasmTx>
|
|
391
374
|
): Promise<LighterSignedBlob> {
|
|
392
|
-
const txType =
|
|
375
|
+
const txType = LT_TX_TYPE_BY_ACTION[action]
|
|
393
376
|
if (txType === undefined) {
|
|
394
377
|
throw new PerpsError(
|
|
395
378
|
PerpsErrorCode.ValidationError,
|
package/src/types/action.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ActionType } from '@lifi/perps-types'
|
|
2
|
+
|
|
1
3
|
// Shapes of `wasmSignParams` per action. The backend populates these and the
|
|
2
4
|
// SDK passes them to the WASM signer alongside SDK-managed fields (nonce,
|
|
3
5
|
// account_index, api_key_index).
|
|
@@ -252,3 +254,92 @@ export const LT_NIL_TRIGGER_PRICE = 0
|
|
|
252
254
|
* @public
|
|
253
255
|
*/
|
|
254
256
|
export const LT_DEFAULT_ORDER_EXPIRY = -1
|
|
257
|
+
|
|
258
|
+
// Tx type values from lighter-go `types/txtypes/constants.go`.
|
|
259
|
+
/**
|
|
260
|
+
* Lighter tx type `TxTypeL2ChangePubKey`.
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
export const LT_TX_TYPE_CHANGE_PUB_KEY = 8
|
|
264
|
+
/**
|
|
265
|
+
* Lighter tx type `TxTypeL2Transfer`.
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
export const LT_TX_TYPE_TRANSFER = 12
|
|
269
|
+
/**
|
|
270
|
+
* Lighter tx type `TxTypeL2Withdraw`.
|
|
271
|
+
* @public
|
|
272
|
+
*/
|
|
273
|
+
export const LT_TX_TYPE_WITHDRAW = 13
|
|
274
|
+
/**
|
|
275
|
+
* Lighter tx type `TxTypeL2CreateOrder`.
|
|
276
|
+
* @public
|
|
277
|
+
*/
|
|
278
|
+
export const LT_TX_TYPE_CREATE_ORDER = 14
|
|
279
|
+
/**
|
|
280
|
+
* Lighter tx type `TxTypeL2CancelOrder`.
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
export const LT_TX_TYPE_CANCEL_ORDER = 15
|
|
284
|
+
/**
|
|
285
|
+
* Lighter tx type `TxTypeL2CancelAllOrders`.
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
export const LT_TX_TYPE_CANCEL_ALL_ORDERS = 16
|
|
289
|
+
/**
|
|
290
|
+
* Lighter tx type `TxTypeL2ModifyOrder`.
|
|
291
|
+
* @public
|
|
292
|
+
*/
|
|
293
|
+
export const LT_TX_TYPE_MODIFY_ORDER = 17
|
|
294
|
+
/**
|
|
295
|
+
* Lighter tx type `TxTypeL2UpdateLeverage`.
|
|
296
|
+
* @public
|
|
297
|
+
*/
|
|
298
|
+
export const LT_TX_TYPE_UPDATE_LEVERAGE = 20
|
|
299
|
+
/**
|
|
300
|
+
* Lighter tx type `TxTypeL2UpdateMargin`.
|
|
301
|
+
* @public
|
|
302
|
+
*/
|
|
303
|
+
export const LT_TX_TYPE_UPDATE_MARGIN = 29
|
|
304
|
+
/**
|
|
305
|
+
* Lighter tx type `TxTypeL2UpdateAccountConfig`.
|
|
306
|
+
* @public
|
|
307
|
+
*/
|
|
308
|
+
export const LT_TX_TYPE_UPDATE_ACCOUNT_CONFIG = 41
|
|
309
|
+
/**
|
|
310
|
+
* Lighter tx type `TxTypeL2UpdateAccountAssetConfig`.
|
|
311
|
+
* @public
|
|
312
|
+
*/
|
|
313
|
+
export const LT_TX_TYPE_UPDATE_ACCOUNT_ASSET_CONFIG = 42
|
|
314
|
+
/**
|
|
315
|
+
* Lighter tx type `TxTypeL2ApproveIntegrator`.
|
|
316
|
+
* @public
|
|
317
|
+
*/
|
|
318
|
+
export const LT_TX_TYPE_APPROVE_INTEGRATOR = 45
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Lighter tx type of the signed tx the SDK's WASM signer emits for each
|
|
322
|
+
* action. An action without an entry has no Lighter signing path.
|
|
323
|
+
* @public
|
|
324
|
+
*/
|
|
325
|
+
export const LT_TX_TYPE_BY_ACTION: Readonly<
|
|
326
|
+
Partial<Record<ActionType, number>>
|
|
327
|
+
> = Object.freeze({
|
|
328
|
+
[ActionType.REGISTER_API_KEY]: LT_TX_TYPE_CHANGE_PUB_KEY,
|
|
329
|
+
[ActionType.TRANSFER]: LT_TX_TYPE_TRANSFER,
|
|
330
|
+
[ActionType.SEND_ASSET]: LT_TX_TYPE_TRANSFER,
|
|
331
|
+
[ActionType.WITHDRAWAL]: LT_TX_TYPE_WITHDRAW,
|
|
332
|
+
[ActionType.PLACE_ORDER]: LT_TX_TYPE_CREATE_ORDER,
|
|
333
|
+
[ActionType.PLACE_TRIGGER_ORDER]: LT_TX_TYPE_CREATE_ORDER,
|
|
334
|
+
[ActionType.PLACE_TWAP_ORDER]: LT_TX_TYPE_CREATE_ORDER,
|
|
335
|
+
[ActionType.CANCEL_ORDER]: LT_TX_TYPE_CANCEL_ORDER,
|
|
336
|
+
[ActionType.CANCEL_TWAP_ORDER]: LT_TX_TYPE_CANCEL_ORDER,
|
|
337
|
+
[ActionType.CANCEL_ALL_ORDERS]: LT_TX_TYPE_CANCEL_ALL_ORDERS,
|
|
338
|
+
[ActionType.MODIFY_ORDER]: LT_TX_TYPE_MODIFY_ORDER,
|
|
339
|
+
[ActionType.UPDATE_LEVERAGE]: LT_TX_TYPE_UPDATE_LEVERAGE,
|
|
340
|
+
[ActionType.UPDATE_POSITION_MARGIN]: LT_TX_TYPE_UPDATE_MARGIN,
|
|
341
|
+
[ActionType.ACCOUNT_MODE]: LT_TX_TYPE_UPDATE_ACCOUNT_CONFIG,
|
|
342
|
+
[ActionType.UPDATE_ASSET_COLLATERAL]: LT_TX_TYPE_UPDATE_ACCOUNT_ASSET_CONFIG,
|
|
343
|
+
[ActionType.APPROVE_INTEGRATOR]: LT_TX_TYPE_APPROVE_INTEGRATOR,
|
|
344
|
+
[ActionType.REVOKE_INTEGRATOR]: LT_TX_TYPE_APPROVE_INTEGRATOR,
|
|
345
|
+
})
|