Skip to content

Commit 64d76be

Browse files
committed
Update types
1 parent 79ec7db commit 64d76be

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/enums.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export enum SwapOrderType {
1818

1919
export enum WsEvent {
2020
Sync = 'Sync',
21+
Asset = 'Asset',
2122
LiquidityPool = 'LiquidityPool',
2223
LiquidityPoolState = 'LiquidityPoolState',
2324
LiquidityPoolTick = 'LiquidityPoolTick',

src/ws.types.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { DexOperationStatus, SwapOrderType, TickInterval } from './enums';
1+
import { DexOperationStatus, SwapOrderType, TickInterval, WsEvent } from './enums';
22

33
export type WsSync = {
4-
t: 'Sync',
4+
t: WsEvent.Sync,
55
s: number, // Slot
66
bH: string, // Block hash
77
}
88

99
export type WsAsset = {
10-
t: 'Asset',
10+
t: WsEvent.Asset,
1111
pId: string, // Policy ID
1212
nH: string, // Name Hex
1313
d: number, // Decimals
@@ -20,7 +20,7 @@ export type WsAsset = {
2020
}
2121

2222
export type WsLiquidityPool = {
23-
t: 'LiquidityPool',
23+
t: WsEvent.LiquidityPool,
2424
d: string, // DEX
2525
i: string, // Identifier
2626
a: string, // Address
@@ -31,7 +31,7 @@ export type WsLiquidityPool = {
3131
}
3232

3333
export type WsLiquidityPoolState = {
34-
t: 'LiquidityPoolState',
34+
t: WsEvent.LiquidityPoolState,
3535
rA: number, // Reserve A
3636
rB: number, // Reserve B
3737
lpTs: number, // Total LP tokens
@@ -42,15 +42,15 @@ export type WsLiquidityPoolState = {
4242
}
4343

4444
export type WsOperationStatus = {
45-
t: 'OperationStatus',
45+
t: WsEvent.OperationStatus,
4646
st: DexOperationStatus, // Status type
4747
s: number, // Slot
4848
tH: string, // Tx hash
4949
oI: number, // Output index
5050
}
5151

5252
export type WsLiquidityPoolSwap = {
53-
t: 'LiquidityPoolSwap',
53+
t: WsEvent.LiquidityPoolSwap,
5454
siT?: WsAsset, // Swap in token
5555
soT?: WsAsset, // Swap out token
5656
oT: SwapOrderType, // Order type
@@ -68,7 +68,7 @@ export type WsLiquidityPoolSwap = {
6868
}
6969

7070
export type WsLiquidityPoolDesposit = {
71-
t: 'LiquidityPoolDeposit',
71+
t: WsEvent.LiquidityPoolDeposit,
7272
dAT?: WsAsset, // Deposit A token
7373
dBT?: WsAsset, // Deposit B token
7474
dAA: number, // Deposit A amount
@@ -84,7 +84,7 @@ export type WsLiquidityPoolDesposit = {
8484
}
8585

8686
export type WsLiquidityPoolWithdraw = {
87-
t: 'LiquidityPoolWithdraw',
87+
t: WsEvent.LiquidityPoolWithdraw,
8888
lpT: WsAsset, // Related LP token
8989
lpA: number, // LP token amount
9090
mA: number, // Min. receive token A
@@ -100,7 +100,7 @@ export type WsLiquidityPoolWithdraw = {
100100
}
101101

102102
export type WsLiquidityPoolTick = {
103-
t: 'LiquidityPoolTick',
103+
t: WsEvent.LiquidityPoolTick,
104104
r: TickInterval, // Resolution
105105
o: number, // Open
106106
h: number, // High

0 commit comments

Comments
 (0)