@reyaxyz/common 0.6.0 → 0.7.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/services/getSocketAddresses.js +16 -3
- package/dist/services/getSocketAddresses.js.map +1 -1
- package/dist/types/services/getSocketAddresses.d.ts +2 -1
- package/dist/types/services/getSocketAddresses.d.ts.map +1 -1
- package/dist/types/types.d.ts +20 -7
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/services/getSocketAddresses.ts +21 -2
- package/src/types.ts +29 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b;
|
|
2
|
+
var _a, _b, _c;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getSocketController = exports.getSocketConnector = void 0;
|
|
4
|
+
exports.getSocketVault = exports.getSocketController = exports.getSocketConnector = void 0;
|
|
5
5
|
var types_1 = require("../types");
|
|
6
6
|
// TODO: add proper config
|
|
7
7
|
var socketConnectors = (_a = {},
|
|
@@ -14,9 +14,12 @@ var socketConnectors = (_a = {},
|
|
|
14
14
|
_a[types_1.ReyaChainId.reyaNetwork] = {
|
|
15
15
|
'': '',
|
|
16
16
|
},
|
|
17
|
+
_a[types_1.MoneyInOutChainId.ethereumSepolia] = {
|
|
18
|
+
'': '',
|
|
19
|
+
},
|
|
17
20
|
_a);
|
|
18
21
|
var getSocketConnector = function (params) {
|
|
19
|
-
return socketConnectors[params.
|
|
22
|
+
return socketConnectors[params.chainId][params.tokenAddress];
|
|
20
23
|
};
|
|
21
24
|
exports.getSocketConnector = getSocketConnector;
|
|
22
25
|
// TODO: add proper config
|
|
@@ -35,4 +38,14 @@ var getSocketController = function (params) {
|
|
|
35
38
|
return socketControllers[params.reyaChainId][params.tokenAddress];
|
|
36
39
|
};
|
|
37
40
|
exports.getSocketController = getSocketController;
|
|
41
|
+
// TODO: add proper config
|
|
42
|
+
var socketVaults = (_c = {},
|
|
43
|
+
_c[types_1.MoneyInOutChainId.ethereumSepolia] = {
|
|
44
|
+
'': '',
|
|
45
|
+
},
|
|
46
|
+
_c);
|
|
47
|
+
var getSocketVault = function (params) {
|
|
48
|
+
return socketVaults[params.moneyInOutChainId][params.tokenAddress];
|
|
49
|
+
};
|
|
50
|
+
exports.getSocketVault = getSocketVault;
|
|
38
51
|
//# sourceMappingURL=getSocketAddresses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSocketAddresses.js","sourceRoot":"/","sources":["services/getSocketAddresses.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getSocketAddresses.js","sourceRoot":"/","sources":["services/getSocketAddresses.ts"],"names":[],"mappings":";;;;AAAA,kCAOkB;AAElB,0BAA0B;AAC1B,IAAM,gBAAgB;IAIpB,GAAC,mBAAW,CAAC,aAAa,IAAG;QAC3B,EAAE,EAAE,EAAE;KACP;IACD,GAAC,mBAAW,CAAC,UAAU,IAAG;QACxB,EAAE,EAAE,EAAE;KACP;IACD,GAAC,mBAAW,CAAC,WAAW,IAAG;QACzB,EAAE,EAAE,EAAE;KACP;IACD,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,EAAE,EAAE,EAAE;KACP;OACF,CAAC;AAEK,IAAM,kBAAkB,GAAG,UAChC,MAAgC;IAEhC,OAAO,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAC/D,CAAC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B;AAEF,0BAA0B;AAC1B,IAAM,iBAAiB;IACrB,GAAC,mBAAW,CAAC,aAAa,IAAG;QAC3B,EAAE,EAAE,EAAE;KACP;IACD,GAAC,mBAAW,CAAC,UAAU,IAAG;QACxB,EAAE,EAAE,EAAE;KACP;IACD,GAAC,mBAAW,CAAC,WAAW,IAAG;QACzB,EAAE,EAAE,EAAE;KACP;OACF,CAAC;AAEK,IAAM,mBAAmB,GAAG,UACjC,MAAiC;IAEjC,OAAO,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B;AAEF,0BAA0B;AAC1B,IAAM,YAAY;IAChB,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,EAAE,EAAE,EAAE;KACP;OACF,CAAC;AAEK,IAAM,cAAc,GAAG,UAAC,MAA4B;IACzD,OAAO,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACrE,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB","sourcesContent":["import {\n ReyaChainId,\n GetSocketConnectorParams,\n Address,\n GetSocketControllerParams,\n MoneyInOutChainId,\n GetSocketVaultParams,\n} from '../types';\n\n// TODO: add proper config\nconst socketConnectors: Record<\n ReyaChainId | MoneyInOutChainId,\n Record<Address, Address>\n> = {\n [ReyaChainId.polygonMumbai]: {\n '': '',\n },\n [ReyaChainId.reyaCronos]: {\n '': '',\n },\n [ReyaChainId.reyaNetwork]: {\n '': '',\n },\n [MoneyInOutChainId.ethereumSepolia]: {\n '': '',\n },\n};\n\nexport const getSocketConnector = (\n params: GetSocketConnectorParams,\n): string => {\n return socketConnectors[params.chainId][params.tokenAddress];\n};\n\n// TODO: add proper config\nconst socketControllers: Record<ReyaChainId, Record<Address, Address>> = {\n [ReyaChainId.polygonMumbai]: {\n '': '',\n },\n [ReyaChainId.reyaCronos]: {\n '': '',\n },\n [ReyaChainId.reyaNetwork]: {\n '': '',\n },\n};\n\nexport const getSocketController = (\n params: GetSocketControllerParams,\n): string => {\n return socketControllers[params.reyaChainId][params.tokenAddress];\n};\n\n// TODO: add proper config\nconst socketVaults: Record<MoneyInOutChainId, Record<Address, Address>> = {\n [MoneyInOutChainId.ethereumSepolia]: {\n '': '',\n },\n};\n\nexport const getSocketVault = (params: GetSocketVaultParams): string => {\n return socketVaults[params.moneyInOutChainId][params.tokenAddress];\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GetSocketConnectorParams, GetSocketControllerParams } from '../types';
|
|
1
|
+
import { GetSocketConnectorParams, GetSocketControllerParams, GetSocketVaultParams } from '../types';
|
|
2
2
|
export declare const getSocketConnector: (params: GetSocketConnectorParams) => string;
|
|
3
3
|
export declare const getSocketController: (params: GetSocketControllerParams) => string;
|
|
4
|
+
export declare const getSocketVault: (params: GetSocketVaultParams) => string;
|
|
4
5
|
//# sourceMappingURL=getSocketAddresses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSocketAddresses.d.ts","sourceRoot":"/","sources":["services/getSocketAddresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EAExB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"getSocketAddresses.d.ts","sourceRoot":"/","sources":["services/getSocketAddresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EAExB,yBAAyB,EAEzB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAqBlB,eAAO,MAAM,kBAAkB,WACrB,wBAAwB,KAC/B,MAEF,CAAC;AAeF,eAAO,MAAM,mBAAmB,WACtB,yBAAyB,KAChC,MAEF,CAAC;AASF,eAAO,MAAM,cAAc,WAAY,oBAAoB,KAAG,MAE7D,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -53,6 +53,14 @@ export interface Candle {
|
|
|
53
53
|
}
|
|
54
54
|
export type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';
|
|
55
55
|
export type Side = 'long' | 'short';
|
|
56
|
+
export type CollateralEntity = {
|
|
57
|
+
token: string;
|
|
58
|
+
percentage: number;
|
|
59
|
+
balance: number;
|
|
60
|
+
balanceRUSD: number;
|
|
61
|
+
exchangeRate: number;
|
|
62
|
+
exchangeRateChange24HPercentage: number;
|
|
63
|
+
};
|
|
56
64
|
export type MarginAccountEntity = {
|
|
57
65
|
id: number;
|
|
58
66
|
name: string;
|
|
@@ -60,12 +68,13 @@ export type MarginAccountEntity = {
|
|
|
60
68
|
marginRatioPercentage: number;
|
|
61
69
|
totalBalance: number;
|
|
62
70
|
totalBalanceUnderlyingAsset: string;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
totalBalanceChange24HPercentage: 5;
|
|
72
|
+
livePnL: number;
|
|
73
|
+
livePnLUnderlyingAsset: string;
|
|
74
|
+
realizedPnL: number;
|
|
75
|
+
realizedPnLUnderlyingAsset: string;
|
|
76
|
+
totalPositionsCount: number;
|
|
77
|
+
collaterals: CollateralEntity[];
|
|
69
78
|
};
|
|
70
79
|
export type PositionEntity = {
|
|
71
80
|
id: number;
|
|
@@ -179,11 +188,15 @@ export type GetLpPoolPerformanceChartDataResult = {
|
|
|
179
188
|
capitalInvestedChangePercentage: number;
|
|
180
189
|
};
|
|
181
190
|
export type GetSocketConnectorParams = {
|
|
182
|
-
|
|
191
|
+
chainId: ReyaChainId | MoneyInOutChainId;
|
|
183
192
|
tokenAddress: Address;
|
|
184
193
|
};
|
|
185
194
|
export type GetSocketControllerParams = {
|
|
186
195
|
reyaChainId: ReyaChainId;
|
|
187
196
|
tokenAddress: Address;
|
|
188
197
|
};
|
|
198
|
+
export type GetSocketVaultParams = {
|
|
199
|
+
moneyInOutChainId: MoneyInOutChainId;
|
|
200
|
+
tokenAddress: Address;
|
|
201
|
+
};
|
|
189
202
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAGxC,MAAM,MAAM,eAAe,GAAG;IAC5B,sBAAsB,EAAE,MAAM,EAA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;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["types.ts"],"names":[],"mappings":";;;AA0BA,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,mEAAqB,CAAA;IACrB,gCAAgC;IAChC,4DAAgB,CAAA;IAChB,4DAAiB,CAAA;AACnB,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,sFAA0B,CAAA;AAC5B,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B;AAED,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,uCAAkB,CAAA;IAClB,0CAAqB,CAAA;IACrB,qCAAgB,CAAA;AAClB,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["types.ts"],"names":[],"mappings":";;;AA0BA,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,mEAAqB,CAAA;IACrB,gCAAgC;IAChC,4DAAgB,CAAA;IAChB,4DAAiB,CAAA;AACnB,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,sFAA0B,CAAA;AAC5B,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B;AAED,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,uCAAkB,CAAA;IAClB,0CAAqB,CAAA;IACrB,qCAAgB,CAAA;AAClB,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B;AAyJD,6GAA6G;AAC7G,0BAA0B;AAC1B,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,2EAAsB,CAAA;IACtB,yEAAyB,CAAA;IACzB,wEAA6B,CAAA;IAC7B,2EAAkC,CAAA;IAClC,8EAAoC,CAAA;IACpC,6EAAoC,CAAA;AACtC,CAAC,EAPW,kBAAkB,kCAAlB,kBAAkB,QAO7B","sourcesContent":["export type Address = Lowercase<string>;\n\n// -- Markets --\nexport type MarketOrderInfo = {\n counterpartyAccountIds: number[];\n exchangeId: number;\n};\n\nexport type MarketEntity = {\n id: number;\n ticker: string;\n underlyingAsset: string;\n quoteToken: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n description: string;\n orderInfo: MarketOrderInfo;\n tickSizeDecimals: number;\n};\n\nexport enum ReyaChainId {\n polygonMumbai = 80001,\n // TODO: add the correct ID here\n reyaNetwork = -1,\n reyaCronos = 1729,\n}\n\nexport enum MoneyInOutChainId {\n ethereumSepolia = 11155111,\n}\n\nexport enum CandlesResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\n// -- Candles --\nexport interface Candle {\n id: string;\n startedAt: string;\n ticker: string;\n resolution: CandlesResolution;\n low: string;\n high: string;\n open: string;\n close: string;\n baseTokenVolume: string;\n usdVolume: string;\n trades: number;\n startingOpenInterest: string;\n}\n\n// -- Account --\n\nexport type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';\nexport type Side = 'long' | 'short';\n\nexport type CollateralEntity = {\n token: string;\n percentage: number;\n balance: number;\n balanceRUSD: number;\n // TODO: Milan evaluate type\n exchangeRate: number;\n // TODO: Milan evaluate type\n exchangeRateChange24HPercentage: number;\n};\n\nexport type MarginAccountEntity = {\n id: number;\n name: string;\n marginRatioHealth: 'danger' | 'healthy' | 'warning';\n marginRatioPercentage: number;\n totalBalance: number;\n totalBalanceUnderlyingAsset: string;\n totalBalanceChange24HPercentage: 5;\n // TODO: Milan evaluate type\n livePnL: number;\n // TODO: Milan evaluate type\n livePnLUnderlyingAsset: string;\n // TODO: Milan evaluate type\n realizedPnL: number;\n // TODO: Milan evaluate type\n realizedPnLUnderlyingAsset: string;\n // TODO: Milan evaluate type\n totalPositionsCount: number;\n collaterals: CollateralEntity[];\n};\n\nexport type PositionEntity = {\n id: number;\n side: Side;\n size: number;\n base: number;\n price: number;\n markPrice: number;\n orderStatus: Status;\n realisedPnl?: number | null;\n unrealisedPnl?: number | null;\n liquidationPrice: number;\n fundingRate: number;\n market: MarketEntity;\n date: Date;\n};\n\nexport type TradingHistoryEntity = {\n id: number;\n price: number;\n priceUnderlyingToken: string;\n size: number;\n sizeUnderlyingToken: string;\n timestampMillisecondsUTC: number;\n};\n\nexport type OrderType = 'market';\n\nexport type PositionHistoryType =\n | 'long-trade'\n | 'short-trade'\n | 'long-liquidation'\n | 'short-liquidation';\n\nexport type PositionHistoryEntity = {\n id: number;\n action: PositionHistoryType;\n orderType: OrderType;\n size: number;\n executionPrice: number;\n realisedPnl?: number | null;\n fees: number;\n timestamp: number;\n market: MarketEntity;\n};\n\nexport type LpPoolEntity = {\n id: number;\n name: string;\n description: string;\n longDescription: string;\n readMoreLink: string;\n currentAPY: number;\n balanceSupplied?: number | null;\n apyChange24H: number;\n tokenAddress: string;\n token: string;\n allowedChainsForLiquidity: MoneyInOutChainId[];\n};\n\nexport type TransactionHistoryType = 'deposit' | 'withdrawal';\n\nexport type LpTransactionHistoryEntity = {\n id: number;\n type: TransactionHistoryType;\n token: string;\n amount: number;\n transactionHash: string;\n timestamp: number;\n};\n\nexport type LpPositionEntity = {\n id: number;\n deposited: number;\n currentBalance: number;\n pnl: number;\n fundingRate: number;\n lpPool: LpPoolEntity;\n};\n\nexport type MarginAccountTransactionHistoryType =\n | 'deposit'\n | 'withdrawal'\n | 'transfer'\n | 'auto_exchange';\n\nexport type MarginAccountTransactionHistoryEntity = {\n id: number;\n type: MarginAccountTransactionHistoryType;\n token: string;\n amount: number;\n transactionHash: string;\n timestamp: number;\n};\n\nexport type TokenEntity = {\n id: string;\n address: Address;\n};\n// TODO: Milan evaluate if these need to be in common. At moment of writting it was shared in api and api-sdk\n// --- Lp Pool Balance ---\nexport enum BalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n// TODO: Milan evaluate if these need to be in common. At moment of writting it was shared in api and api-sdk\nexport type GetLpPoolBalanceChartDataResult = {\n data: {\n timestampInMs: number;\n value: number;\n }[];\n tvl: number;\n tvlChangePercentage: number;\n apy: number;\n apyChangePercentage: number;\n};\n\n// TODO: Milan evaluate if these need to be in common. At moment of writting it was shared in api and api-sdk\n// - LP Account Performance -\nexport type GetLpPoolPerformanceChartDataResult = {\n capitalInvestedData: {\n timestampInMs: number;\n value: number;\n }[];\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n balance: number;\n balanceChangePercentage: number;\n capitalInvested: number;\n capitalInvestedChangePercentage: number;\n};\n\nexport type GetSocketConnectorParams = {\n chainId: ReyaChainId | MoneyInOutChainId;\n tokenAddress: Address;\n};\n\nexport type GetSocketControllerParams = {\n reyaChainId: ReyaChainId;\n tokenAddress: Address;\n};\n\nexport type GetSocketVaultParams = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenAddress: Address;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
41
41
|
},
|
|
42
42
|
"packageManager": "pnpm@8.10.4",
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "44ed0310f670e85361b182c46cfc55168ae9eb62"
|
|
44
44
|
}
|
|
@@ -3,10 +3,15 @@ import {
|
|
|
3
3
|
GetSocketConnectorParams,
|
|
4
4
|
Address,
|
|
5
5
|
GetSocketControllerParams,
|
|
6
|
+
MoneyInOutChainId,
|
|
7
|
+
GetSocketVaultParams,
|
|
6
8
|
} from '../types';
|
|
7
9
|
|
|
8
10
|
// TODO: add proper config
|
|
9
|
-
const socketConnectors: Record<
|
|
11
|
+
const socketConnectors: Record<
|
|
12
|
+
ReyaChainId | MoneyInOutChainId,
|
|
13
|
+
Record<Address, Address>
|
|
14
|
+
> = {
|
|
10
15
|
[ReyaChainId.polygonMumbai]: {
|
|
11
16
|
'': '',
|
|
12
17
|
},
|
|
@@ -16,12 +21,15 @@ const socketConnectors: Record<ReyaChainId, Record<Address, Address>> = {
|
|
|
16
21
|
[ReyaChainId.reyaNetwork]: {
|
|
17
22
|
'': '',
|
|
18
23
|
},
|
|
24
|
+
[MoneyInOutChainId.ethereumSepolia]: {
|
|
25
|
+
'': '',
|
|
26
|
+
},
|
|
19
27
|
};
|
|
20
28
|
|
|
21
29
|
export const getSocketConnector = (
|
|
22
30
|
params: GetSocketConnectorParams,
|
|
23
31
|
): string => {
|
|
24
|
-
return socketConnectors[params.
|
|
32
|
+
return socketConnectors[params.chainId][params.tokenAddress];
|
|
25
33
|
};
|
|
26
34
|
|
|
27
35
|
// TODO: add proper config
|
|
@@ -42,3 +50,14 @@ export const getSocketController = (
|
|
|
42
50
|
): string => {
|
|
43
51
|
return socketControllers[params.reyaChainId][params.tokenAddress];
|
|
44
52
|
};
|
|
53
|
+
|
|
54
|
+
// TODO: add proper config
|
|
55
|
+
const socketVaults: Record<MoneyInOutChainId, Record<Address, Address>> = {
|
|
56
|
+
[MoneyInOutChainId.ethereumSepolia]: {
|
|
57
|
+
'': '',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const getSocketVault = (params: GetSocketVaultParams): string => {
|
|
62
|
+
return socketVaults[params.moneyInOutChainId][params.tokenAddress];
|
|
63
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -66,6 +66,17 @@ export interface Candle {
|
|
|
66
66
|
export type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';
|
|
67
67
|
export type Side = 'long' | 'short';
|
|
68
68
|
|
|
69
|
+
export type CollateralEntity = {
|
|
70
|
+
token: string;
|
|
71
|
+
percentage: number;
|
|
72
|
+
balance: number;
|
|
73
|
+
balanceRUSD: number;
|
|
74
|
+
// TODO: Milan evaluate type
|
|
75
|
+
exchangeRate: number;
|
|
76
|
+
// TODO: Milan evaluate type
|
|
77
|
+
exchangeRateChange24HPercentage: number;
|
|
78
|
+
};
|
|
79
|
+
|
|
69
80
|
export type MarginAccountEntity = {
|
|
70
81
|
id: number;
|
|
71
82
|
name: string;
|
|
@@ -73,12 +84,18 @@ export type MarginAccountEntity = {
|
|
|
73
84
|
marginRatioPercentage: number;
|
|
74
85
|
totalBalance: number;
|
|
75
86
|
totalBalanceUnderlyingAsset: string;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
totalBalanceChange24HPercentage: 5;
|
|
88
|
+
// TODO: Milan evaluate type
|
|
89
|
+
livePnL: number;
|
|
90
|
+
// TODO: Milan evaluate type
|
|
91
|
+
livePnLUnderlyingAsset: string;
|
|
92
|
+
// TODO: Milan evaluate type
|
|
93
|
+
realizedPnL: number;
|
|
94
|
+
// TODO: Milan evaluate type
|
|
95
|
+
realizedPnLUnderlyingAsset: string;
|
|
96
|
+
// TODO: Milan evaluate type
|
|
97
|
+
totalPositionsCount: number;
|
|
98
|
+
collaterals: CollateralEntity[];
|
|
82
99
|
};
|
|
83
100
|
|
|
84
101
|
export type PositionEntity = {
|
|
@@ -219,7 +236,7 @@ export type GetLpPoolPerformanceChartDataResult = {
|
|
|
219
236
|
};
|
|
220
237
|
|
|
221
238
|
export type GetSocketConnectorParams = {
|
|
222
|
-
|
|
239
|
+
chainId: ReyaChainId | MoneyInOutChainId;
|
|
223
240
|
tokenAddress: Address;
|
|
224
241
|
};
|
|
225
242
|
|
|
@@ -227,3 +244,8 @@ export type GetSocketControllerParams = {
|
|
|
227
244
|
reyaChainId: ReyaChainId;
|
|
228
245
|
tokenAddress: Address;
|
|
229
246
|
};
|
|
247
|
+
|
|
248
|
+
export type GetSocketVaultParams = {
|
|
249
|
+
moneyInOutChainId: MoneyInOutChainId;
|
|
250
|
+
tokenAddress: Address;
|
|
251
|
+
};
|