lynx-client 0.0.11 → 0.0.13
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 +192 -2
- package/dist/cjs/index.js +9 -1
- package/dist/cjs/lib/contractsIntegration/LexPoolV1Service/LexPoolV1Service.js +1 -0
- package/dist/cjs/lib/contractsIntegration/OnBehalfTradingService/OnBehalfTradingService.js +158 -25
- package/dist/cjs/lib/contractsIntegration/OrderBookService/OrderBookService.js +14 -2
- package/dist/cjs/lib/contractsIntegration/PNLRService/PNLRService.js +10 -10
- package/dist/cjs/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.js +26 -14
- package/dist/cjs/lib/contractsIntegration/TradingFloorService/TradingFloorService.js +72 -15
- package/dist/cjs/lib/contractsIntegration/TriggersService/TriggersService.js +14 -8
- package/dist/cjs/lib/contractsIntegration/common/ILynxVersionedContract.js +2 -0
- package/dist/cjs/lib/contractsIntegration/common/IPendableAdmin.js +2 -0
- package/dist/cjs/lib/contractsIntegration/common/IPendableImplementation.js +2 -0
- package/dist/cjs/lib/contractsIntegration/common/IProtocolConstants.js +2 -0
- package/dist/cjs/lib/contractsIntegration/common/index.js +2 -0
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/IntentsVerifier/ChipsIntentsVerifierV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/IntentsVerifier/LiquidityIntentsVerifierV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/IntentsVerifier/TradeIntentsVerifierV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/Lex/LexPool/LexPoolV1__factory.js +1 -28
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/Lex/PNLR/PNLR__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/Lex/PoolAccountant/PoolAccountantV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1__factory.js +207 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.js +1 -28
- package/dist/cjs/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.js +1 -1
- package/dist/cjs/lib/typechain/factories/contracts/Peripheral/TokensDistribution/SinglePhaseSingleTokenDistributor/SinglePhaseSingleTokenDistributor__factory.js +1 -1
- package/dist/esm/index.d.ts +9 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -1
- package/dist/esm/lib/contractsIntegration/LexPoolV1Service/ILexPoolV1Service.d.ts +2 -3
- package/dist/esm/lib/contractsIntegration/LexPoolV1Service/ILexPoolV1Service.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/LexPoolV1Service/LexPoolV1Service.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/LexPoolV1Service/LexPoolV1Service.js +1 -0
- package/dist/esm/lib/contractsIntegration/OnBehalfTradingService/IOnBehalfTradingService.d.ts +52 -6
- package/dist/esm/lib/contractsIntegration/OnBehalfTradingService/IOnBehalfTradingService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/OnBehalfTradingService/OnBehalfTradingService.d.ts +17 -20
- package/dist/esm/lib/contractsIntegration/OnBehalfTradingService/OnBehalfTradingService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/OnBehalfTradingService/OnBehalfTradingService.js +158 -25
- package/dist/esm/lib/contractsIntegration/OnBehalfTradingService/index.d.ts +1 -1
- package/dist/esm/lib/contractsIntegration/OnBehalfTradingService/index.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts +6 -10
- package/dist/esm/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts +5 -2
- package/dist/esm/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/OrderBookService/OrderBookService.js +14 -2
- package/dist/esm/lib/contractsIntegration/PNLRService/IPNLRService.d.ts +4 -12
- package/dist/esm/lib/contractsIntegration/PNLRService/IPNLRService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/PNLRService/PNLRService.d.ts +4 -3
- package/dist/esm/lib/contractsIntegration/PNLRService/PNLRService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/PNLRService/PNLRService.js +10 -10
- package/dist/esm/lib/contractsIntegration/PNLRService/index.d.ts +1 -1
- package/dist/esm/lib/contractsIntegration/PNLRService/index.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/PoolAccountantV1Service/IPoolAccountantV1Service.d.ts +2 -4
- package/dist/esm/lib/contractsIntegration/PoolAccountantV1Service/IPoolAccountantV1Service.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts +8 -13
- package/dist/esm/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts +5 -2
- package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.js +26 -14
- package/dist/esm/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts +31 -13
- package/dist/esm/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts +14 -87
- package/dist/esm/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/TradingFloorService/TradingFloorService.js +72 -15
- package/dist/esm/lib/contractsIntegration/TriggersService/ITriggersService.d.ts +6 -9
- package/dist/esm/lib/contractsIntegration/TriggersService/ITriggersService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/TriggersService/TriggersService.d.ts +4 -2
- package/dist/esm/lib/contractsIntegration/TriggersService/TriggersService.d.ts.map +1 -1
- package/dist/esm/lib/contractsIntegration/TriggersService/TriggersService.js +14 -8
- package/dist/esm/lib/contractsIntegration/common/ILynxVersionedContract.d.ts +11 -0
- package/dist/esm/lib/contractsIntegration/common/ILynxVersionedContract.d.ts.map +1 -0
- package/dist/esm/lib/contractsIntegration/common/ILynxVersionedContract.js +2 -0
- package/dist/esm/lib/contractsIntegration/common/IPendableAdmin.d.ts +9 -0
- package/dist/esm/lib/contractsIntegration/common/IPendableAdmin.d.ts.map +1 -0
- package/dist/esm/lib/contractsIntegration/common/IPendableAdmin.js +2 -0
- package/dist/esm/lib/contractsIntegration/common/IPendableImplementation.d.ts +9 -0
- package/dist/esm/lib/contractsIntegration/common/IPendableImplementation.d.ts.map +1 -0
- package/dist/esm/lib/contractsIntegration/common/IPendableImplementation.js +2 -0
- package/dist/esm/lib/contractsIntegration/common/IProtocolConstants.d.ts +32 -0
- package/dist/esm/lib/contractsIntegration/common/IProtocolConstants.d.ts.map +1 -0
- package/dist/esm/lib/contractsIntegration/common/IProtocolConstants.js +2 -0
- package/dist/esm/lib/contractsIntegration/common/index.d.ts +5 -0
- package/dist/esm/lib/contractsIntegration/common/index.d.ts.map +1 -0
- package/dist/esm/lib/contractsIntegration/common/index.js +2 -0
- package/dist/esm/lib/typechain/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1.d.ts +151 -1
- package/dist/esm/lib/typechain/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1.d.ts.map +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/IntentsVerifier/ChipsIntentsVerifierV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/IntentsVerifier/ChipsIntentsVerifierV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/IntentsVerifier/LiquidityIntentsVerifierV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/IntentsVerifier/LiquidityIntentsVerifierV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/IntentsVerifier/TradeIntentsVerifierV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/IntentsVerifier/TradeIntentsVerifierV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Lex/LexPool/LexPoolV1__factory.d.ts +1 -21
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Lex/LexPool/LexPoolV1__factory.d.ts.map +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Lex/LexPool/LexPoolV1__factory.js +1 -28
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Lex/PNLR/PNLR__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Lex/PNLR/PNLR__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Lex/PoolAccountant/PoolAccountantV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Lex/PoolAccountant/PoolAccountantV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1__factory.d.ts +157 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1__factory.d.ts.map +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1__factory.js +207 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts +1 -21
- package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts.map +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.js +1 -28
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.js +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/TokensDistribution/SinglePhaseSingleTokenDistributor/SinglePhaseSingleTokenDistributor__factory.d.ts +1 -1
- package/dist/esm/lib/typechain/factories/contracts/Peripheral/TokensDistribution/SinglePhaseSingleTokenDistributor/SinglePhaseSingleTokenDistributor__factory.js +1 -1
- package/dist/types/index.d.ts +9 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/LexPoolV1Service/ILexPoolV1Service.d.ts +2 -3
- package/dist/types/lib/contractsIntegration/LexPoolV1Service/ILexPoolV1Service.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/LexPoolV1Service/LexPoolV1Service.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/OnBehalfTradingService/IOnBehalfTradingService.d.ts +52 -6
- package/dist/types/lib/contractsIntegration/OnBehalfTradingService/IOnBehalfTradingService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/OnBehalfTradingService/OnBehalfTradingService.d.ts +17 -20
- package/dist/types/lib/contractsIntegration/OnBehalfTradingService/OnBehalfTradingService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/OnBehalfTradingService/index.d.ts +1 -1
- package/dist/types/lib/contractsIntegration/OnBehalfTradingService/index.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts +6 -10
- package/dist/types/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts +5 -2
- package/dist/types/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/PNLRService/IPNLRService.d.ts +4 -12
- package/dist/types/lib/contractsIntegration/PNLRService/IPNLRService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/PNLRService/PNLRService.d.ts +4 -3
- package/dist/types/lib/contractsIntegration/PNLRService/PNLRService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/PNLRService/index.d.ts +1 -1
- package/dist/types/lib/contractsIntegration/PNLRService/index.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/PoolAccountantV1Service/IPoolAccountantV1Service.d.ts +2 -4
- package/dist/types/lib/contractsIntegration/PoolAccountantV1Service/IPoolAccountantV1Service.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts +8 -13
- package/dist/types/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts +5 -2
- package/dist/types/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts +31 -13
- package/dist/types/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts +14 -87
- package/dist/types/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/TriggersService/ITriggersService.d.ts +6 -9
- package/dist/types/lib/contractsIntegration/TriggersService/ITriggersService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/TriggersService/TriggersService.d.ts +4 -2
- package/dist/types/lib/contractsIntegration/TriggersService/TriggersService.d.ts.map +1 -1
- package/dist/types/lib/contractsIntegration/common/ILynxVersionedContract.d.ts +11 -0
- package/dist/types/lib/contractsIntegration/common/ILynxVersionedContract.d.ts.map +1 -0
- package/dist/types/lib/contractsIntegration/common/IPendableAdmin.d.ts +9 -0
- package/dist/types/lib/contractsIntegration/common/IPendableAdmin.d.ts.map +1 -0
- package/dist/types/lib/contractsIntegration/common/IPendableImplementation.d.ts +9 -0
- package/dist/types/lib/contractsIntegration/common/IPendableImplementation.d.ts.map +1 -0
- package/dist/types/lib/contractsIntegration/common/IProtocolConstants.d.ts +32 -0
- package/dist/types/lib/contractsIntegration/common/IProtocolConstants.d.ts.map +1 -0
- package/dist/types/lib/contractsIntegration/common/index.d.ts +5 -0
- package/dist/types/lib/contractsIntegration/common/index.d.ts.map +1 -0
- package/dist/types/lib/typechain/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1.d.ts +151 -1
- package/dist/types/lib/typechain/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1.d.ts.map +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/IntentsVerifier/ChipsIntentsVerifierV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/IntentsVerifier/LiquidityIntentsVerifierV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/IntentsVerifier/TradeIntentsVerifierV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/Lex/LexPool/LexPoolV1__factory.d.ts +1 -21
- package/dist/types/lib/typechain/factories/contracts/Lynx/Lex/LexPool/LexPoolV1__factory.d.ts.map +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/Lex/PNLR/PNLR__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/Lex/PoolAccountant/PoolAccountantV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1__factory.d.ts +157 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1__factory.d.ts.map +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts +1 -21
- package/dist/types/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts.map +1 -1
- package/dist/types/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.d.ts +1 -1
- package/dist/types/lib/typechain/factories/contracts/Peripheral/TokensDistribution/SinglePhaseSingleTokenDistributor/SinglePhaseSingleTokenDistributor__factory.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -86,7 +86,47 @@ const arbitrumAddresses = LynxSystemAddresses.arbitrum;
|
|
|
86
86
|
|
|
87
87
|
### Contract Services
|
|
88
88
|
|
|
89
|
-
The SDK provides service wrappers for all Lynx contracts:
|
|
89
|
+
The SDK provides service wrappers for all Lynx contracts, organized using a consistent grouped interface pattern:
|
|
90
|
+
|
|
91
|
+
#### Service Architecture
|
|
92
|
+
|
|
93
|
+
All services follow a grouped interface pattern for better organization:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// Example: TradingFloor Service Structure
|
|
97
|
+
const tradingFloor = createTradingFloorService(signer, address);
|
|
98
|
+
|
|
99
|
+
// Grouped by functionality
|
|
100
|
+
tradingFloor.positionQueries // Position-related queries
|
|
101
|
+
tradingFloor.settlementAndPool // Settlement and pool operations
|
|
102
|
+
tradingFloor.traderTracking // Trader tracking functions
|
|
103
|
+
tradingFloor.tradingParameters // Trading parameters
|
|
104
|
+
tradingFloor.fees // Fee information
|
|
105
|
+
tradingFloor.deprecated // Deprecated functions
|
|
106
|
+
|
|
107
|
+
// Standardized accessors
|
|
108
|
+
tradingFloor.pendableAdmin // Admin functions
|
|
109
|
+
tradingFloor.pendableImplementation // Implementation functions
|
|
110
|
+
tradingFloor.lynxVersionedContract // Version information
|
|
111
|
+
tradingFloor.contractReferences // Other contract addresses
|
|
112
|
+
tradingFloor.constants // Protocol constants
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// Example: OnBehalfTrading Service Structure
|
|
117
|
+
const onBehalfTrading = new OnBehalfTradingService(signer, address);
|
|
118
|
+
|
|
119
|
+
// Grouped by functionality
|
|
120
|
+
onBehalfTrading.permissionQueries // Permission validation and queries
|
|
121
|
+
onBehalfTrading.permissionManagement // Grant/revoke permissions
|
|
122
|
+
onBehalfTrading.configuration // Contract configuration
|
|
123
|
+
onBehalfTrading.adminFunctions // Admin operations
|
|
124
|
+
|
|
125
|
+
// Standardized accessors
|
|
126
|
+
onBehalfTrading.pendableAdmin // Admin functions
|
|
127
|
+
onBehalfTrading.lynxVersionedContract // Version information
|
|
128
|
+
onBehalfTrading.contractReferences // Other contract addresses
|
|
129
|
+
```
|
|
90
130
|
|
|
91
131
|
#### Trading Operations
|
|
92
132
|
|
|
@@ -228,6 +268,49 @@ const configs = await triggers.getTriggersConfigurations();
|
|
|
228
268
|
const pairConfigs = await triggers.getPairConfigsInTriggers(1); // Pair ID 1
|
|
229
269
|
```
|
|
230
270
|
|
|
271
|
+
### Delegated Trading with OnBehalfTrading
|
|
272
|
+
|
|
273
|
+
The OnBehalfTrading service enables users to grant trading permissions to other addresses with specific limits and durations:
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import { OnBehalfTradingService } from 'lynx-client';
|
|
277
|
+
|
|
278
|
+
const onBehalfTrading = new OnBehalfTradingService(signer, onBehalfTradingAddress);
|
|
279
|
+
|
|
280
|
+
// Grant permission to a trader
|
|
281
|
+
await onBehalfTrading.permissionManagement.grantPermission(
|
|
282
|
+
traderAddress,
|
|
283
|
+
tokenAddress,
|
|
284
|
+
ethers.parseUnits("1000", 18), // 1000 token limit
|
|
285
|
+
86400n // 24 hours duration
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
// Check if permission is valid
|
|
289
|
+
const isValid = await onBehalfTrading.permissionQueries.isPermissionValid(
|
|
290
|
+
ownerAddress,
|
|
291
|
+
traderAddress,
|
|
292
|
+
tokenAddress
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
// Get remaining amount
|
|
296
|
+
const remaining = await onBehalfTrading.permissionQueries.getRemainingAmount(
|
|
297
|
+
ownerAddress,
|
|
298
|
+
traderAddress,
|
|
299
|
+
tokenAddress
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
// Revoke permissions
|
|
303
|
+
await onBehalfTrading.permissionManagement.revokePermission(
|
|
304
|
+
traderAddress,
|
|
305
|
+
tokenAddress
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
// Get all active permissions for an owner
|
|
309
|
+
const allPermissions = await onBehalfTrading.permissionQueries.getAllActivePermissions(
|
|
310
|
+
ownerAddress
|
|
311
|
+
);
|
|
312
|
+
```
|
|
313
|
+
|
|
231
314
|
### LEX Pool Operations
|
|
232
315
|
|
|
233
316
|
```typescript
|
|
@@ -244,6 +327,85 @@ const supplierState = await lexLens.getLexPoolSupplierState(
|
|
|
244
327
|
const feeConfigs = await lexLens.getAllFeeConfigurationsInLex(lexPoolAddress);
|
|
245
328
|
```
|
|
246
329
|
|
|
330
|
+
## Standardized Contract Interfaces
|
|
331
|
+
|
|
332
|
+
The SDK provides standardized interfaces for common contract patterns, ensuring consistent access across all services:
|
|
333
|
+
|
|
334
|
+
### Common Interfaces
|
|
335
|
+
|
|
336
|
+
#### ILynxVersionedContract
|
|
337
|
+
All Lynx contracts implement versioning for transparency and upgradeability tracking:
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
import { createTradingFloorService } from 'lynx-client';
|
|
341
|
+
|
|
342
|
+
const tradingFloor = createTradingFloorService(signer, tradingFloorAddress);
|
|
343
|
+
|
|
344
|
+
// Access version information through standardized property
|
|
345
|
+
const name = await tradingFloor.lynxVersionedContract.getContractName();
|
|
346
|
+
const version = await tradingFloor.lynxVersionedContract.getContractVersion();
|
|
347
|
+
const contractName = await tradingFloor.lynxVersionedContract.CONTRACT_NAME();
|
|
348
|
+
const contractVersion = await tradingFloor.lynxVersionedContract.CONTRACT_VERSION();
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
#### IPendableAdmin
|
|
352
|
+
Contracts with two-step admin transfer for enhanced security:
|
|
353
|
+
|
|
354
|
+
```typescript
|
|
355
|
+
// All services with admin functionality use the same accessor
|
|
356
|
+
const currentAdmin = await tradingFloor.pendableAdmin.admin();
|
|
357
|
+
const pendingAdmin = await tradingFloor.pendableAdmin.pendingAdmin();
|
|
358
|
+
|
|
359
|
+
// Same pattern works across all services
|
|
360
|
+
const triggersAdmin = await triggers.pendableAdmin.admin();
|
|
361
|
+
const pnlrAdmin = await pnlr.pendableAdmin.admin();
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
#### IPendableImplementation
|
|
365
|
+
Upgradeable contracts with two-step implementation updates:
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
// Access implementation details through standardized property
|
|
369
|
+
const implementation = await tradingFloor.pendableImplementation.implementation();
|
|
370
|
+
const pendingImpl = await tradingFloor.pendableImplementation.pendingImplementation();
|
|
371
|
+
|
|
372
|
+
// OrderBook also uses the same pattern
|
|
373
|
+
const orderBookImpl = await orderBook.pendableImplementation.implementation();
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Standardized Accessor Patterns
|
|
377
|
+
|
|
378
|
+
All services follow consistent naming conventions for common functionality:
|
|
379
|
+
|
|
380
|
+
| Property | Interface | Description |
|
|
381
|
+
|----------|-----------|-------------|
|
|
382
|
+
| `lynxVersionedContract` | `ILynxVersionedContract` | Contract version information |
|
|
383
|
+
| `pendableAdmin` | `IPendableAdmin` | Admin transfer functionality |
|
|
384
|
+
| `pendableImplementation` | `IPendableImplementation` | Implementation upgrade functionality |
|
|
385
|
+
| `contractReferences` | Service-specific | References to other contracts |
|
|
386
|
+
| `constants` | Service-specific | Protocol constants and scales |
|
|
387
|
+
|
|
388
|
+
Example with multiple services:
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
// TradingFloor Service
|
|
392
|
+
const tf = createTradingFloorService(signer, address);
|
|
393
|
+
await tf.pendableAdmin.admin(); // Admin functionality
|
|
394
|
+
await tf.pendableImplementation.implementation(); // Implementation info
|
|
395
|
+
await tf.lynxVersionedContract.getContractVersion(); // Version info
|
|
396
|
+
await tf.contractReferences.registry(); // Other contract addresses
|
|
397
|
+
|
|
398
|
+
// PNLR Service (no implementation pattern)
|
|
399
|
+
const pnlr = createPNLRService(signer, address);
|
|
400
|
+
await pnlr.pendableAdmin.admin(); // Admin functionality
|
|
401
|
+
await pnlr.lynxVersionedContract.getContractVersion(); // Version info
|
|
402
|
+
|
|
403
|
+
// Triggers Service (no implementation pattern)
|
|
404
|
+
const triggers = createTriggersService(signer, address);
|
|
405
|
+
await triggers.pendableAdmin.admin(); // Admin functionality
|
|
406
|
+
await triggers.contractReferences.orderBook(); // Other contract addresses
|
|
407
|
+
```
|
|
408
|
+
|
|
247
409
|
## Type Safety
|
|
248
410
|
|
|
249
411
|
The SDK provides comprehensive TypeScript types for all contract interactions:
|
|
@@ -253,7 +415,10 @@ import {
|
|
|
253
415
|
TPositionRequestIdentifierStruct,
|
|
254
416
|
TPositionRequestParamsStruct,
|
|
255
417
|
TSinglePositionStruct,
|
|
256
|
-
TPairConfigsInTriggersStruct
|
|
418
|
+
TPairConfigsInTriggersStruct,
|
|
419
|
+
ILynxVersionedContract,
|
|
420
|
+
IPendableAdmin,
|
|
421
|
+
IPendableImplementation
|
|
257
422
|
} from 'lynx-client';
|
|
258
423
|
|
|
259
424
|
// All contract structs are properly typed
|
|
@@ -261,6 +426,10 @@ const position = await tradingFloorLens.getCompletePositionData(tradingFloorAddr
|
|
|
261
426
|
console.log(position.trader); // string
|
|
262
427
|
console.log(position.collateral); // bigint
|
|
263
428
|
console.log(position.leverage); // bigint
|
|
429
|
+
|
|
430
|
+
// Common interfaces ensure type safety
|
|
431
|
+
const service: { pendableAdmin: IPendableAdmin } = tradingFloor;
|
|
432
|
+
const admin = await service.pendableAdmin.admin(); // Type-safe access
|
|
264
433
|
```
|
|
265
434
|
|
|
266
435
|
## Error Handling
|
|
@@ -359,6 +528,27 @@ const ethUsd = TPairIds.ETH_USD;
|
|
|
359
528
|
}
|
|
360
529
|
```
|
|
361
530
|
|
|
531
|
+
## Migration Guide
|
|
532
|
+
|
|
533
|
+
### From Previous Versions
|
|
534
|
+
|
|
535
|
+
If you're upgrading from an earlier version, note these changes to standardized accessors:
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
// Old pattern (mixed grouping)
|
|
539
|
+
const admin = await tradingFloor.administration.admin();
|
|
540
|
+
const version = await tradingFloor.contractInfo.getContractVersion();
|
|
541
|
+
|
|
542
|
+
// New pattern (standardized accessors)
|
|
543
|
+
const admin = await tradingFloor.pendableAdmin.admin();
|
|
544
|
+
const version = await tradingFloor.lynxVersionedContract.getContractVersion();
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
Key changes:
|
|
548
|
+
- `administration` → Split into `pendableAdmin` and `contractReferences`
|
|
549
|
+
- `contractInfo` → Split into `lynxVersionedContract` and `contractReferences`
|
|
550
|
+
- Consistent naming across all services
|
|
551
|
+
|
|
362
552
|
## Development
|
|
363
553
|
|
|
364
554
|
### Building
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.tradeIntentsVerifierPayloadTypes = exports.liquidityIntentsVerifierPayloadTypes = exports.chipsIntentsVerifierPayloadTypes = exports.OnBehalfTradingService = exports.TradeIntentsVerifierService = exports.LiquidityIntentsVerifierService = exports.ChipsIntentsVerifierService = void 0;
|
|
17
|
+
exports.tradeIntentsVerifierPayloadTypes = exports.liquidityIntentsVerifierPayloadTypes = exports.chipsIntentsVerifierPayloadTypes = exports.PoolAccountantV1Service = exports.PNLRService = exports.AcceptableImplementationClaimableAdminService = exports.LexPoolV1Service = exports.OnBehalfTradingService = exports.TradeIntentsVerifierService = exports.LiquidityIntentsVerifierService = exports.ChipsIntentsVerifierService = void 0;
|
|
18
18
|
__exportStar(require("./lib/chains/chainConstants"), exports);
|
|
19
19
|
__exportStar(require("./lib/chains/chainTypes"), exports);
|
|
20
20
|
__exportStar(require("./lib/utils/addresses"), exports);
|
|
@@ -49,6 +49,14 @@ var TradeIntentsVerifierService_1 = require("./lib/contractsIntegration/TradeInt
|
|
|
49
49
|
Object.defineProperty(exports, "TradeIntentsVerifierService", { enumerable: true, get: function () { return TradeIntentsVerifierService_1.TradeIntentsVerifierService; } });
|
|
50
50
|
var OnBehalfTradingService_1 = require("./lib/contractsIntegration/OnBehalfTradingService");
|
|
51
51
|
Object.defineProperty(exports, "OnBehalfTradingService", { enumerable: true, get: function () { return OnBehalfTradingService_1.OnBehalfTradingService; } });
|
|
52
|
+
var LexPoolV1Service_1 = require("./lib/contractsIntegration/LexPoolV1Service");
|
|
53
|
+
Object.defineProperty(exports, "LexPoolV1Service", { enumerable: true, get: function () { return LexPoolV1Service_1.LexPoolV1Service; } });
|
|
54
|
+
var AcceptableImplementationClaimableAdminService_1 = require("./lib/contractsIntegration/AcceptableImplementationClaimableAdminService");
|
|
55
|
+
Object.defineProperty(exports, "AcceptableImplementationClaimableAdminService", { enumerable: true, get: function () { return AcceptableImplementationClaimableAdminService_1.AcceptableImplementationClaimableAdminService; } });
|
|
56
|
+
var PNLRService_1 = require("./lib/contractsIntegration/PNLRService");
|
|
57
|
+
Object.defineProperty(exports, "PNLRService", { enumerable: true, get: function () { return PNLRService_1.PNLRService; } });
|
|
58
|
+
var PoolAccountantV1Service_1 = require("./lib/contractsIntegration/PoolAccountantV1Service");
|
|
59
|
+
Object.defineProperty(exports, "PoolAccountantV1Service", { enumerable: true, get: function () { return PoolAccountantV1Service_1.PoolAccountantV1Service; } });
|
|
52
60
|
__exportStar(require("./lib/contractsIntegration/IntentsVerifierLensService"), exports);
|
|
53
61
|
__exportStar(require("./lib/contractsIntegration/TriggersAndPortalLensService"), exports);
|
|
54
62
|
__exportStar(require("./lib/contractsIntegration/TradingFloorLensService"), exports);
|
|
@@ -196,6 +196,7 @@ class LexPoolV1Service {
|
|
|
196
196
|
SELF_UNIT_SCALE: () => this.lexPoolContract.SELF_UNIT_SCALE(),
|
|
197
197
|
PRECISION: () => this.lexPoolContract.PRECISION(),
|
|
198
198
|
FRACTION_SCALE: () => this.lexPoolContract.FRACTION_SCALE(),
|
|
199
|
+
LEVERAGE_SCALE: () => this.lexPoolContract.LEVERAGE_SCALE(),
|
|
199
200
|
};
|
|
200
201
|
}
|
|
201
202
|
createContractInfoGroup() {
|
|
@@ -2,28 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OnBehalfTradingService = void 0;
|
|
4
4
|
const OnBehalfTradingV1__factory_1 = require("../../typechain/factories/contracts/Lynx/OnBehalfTrading/OnBehalfTradingV1__factory");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
}
|
|
10
|
-
// Read methods
|
|
11
|
-
async getContractName() {
|
|
12
|
-
return await this.contract.getContractName();
|
|
5
|
+
// ============ Permission Queries Implementation ============
|
|
6
|
+
class PermissionQueries {
|
|
7
|
+
constructor(contract) {
|
|
8
|
+
this.contract = contract;
|
|
13
9
|
}
|
|
14
|
-
async getContractVersion() {
|
|
15
|
-
return await this.contract.getContractVersion();
|
|
16
|
-
}
|
|
17
|
-
async isPaused() {
|
|
18
|
-
return await this.contract.isPaused();
|
|
19
|
-
}
|
|
20
|
-
async maxPermissionDuration() {
|
|
21
|
-
return await this.contract.maxPermissionDuration();
|
|
22
|
-
}
|
|
23
|
-
async maxPermissionAmountPerToken(token) {
|
|
24
|
-
return await this.contract.maxPermissionAmountPerToken(token);
|
|
25
|
-
}
|
|
26
|
-
// Permission checking methods
|
|
27
10
|
async isPermissionValid(owner, spender, token) {
|
|
28
11
|
return await this.contract.isPermissionValid(owner, spender, token);
|
|
29
12
|
}
|
|
@@ -36,13 +19,47 @@ class OnBehalfTradingService {
|
|
|
36
19
|
amountLimit: permission.amountLimit,
|
|
37
20
|
amountUsed: permission.amountUsed,
|
|
38
21
|
expiryTime: permission.expiryTime,
|
|
39
|
-
isActive: permission.isActive
|
|
22
|
+
isActive: permission.isActive,
|
|
40
23
|
};
|
|
41
24
|
}
|
|
42
25
|
async permanentlyRevoked(owner, spender) {
|
|
43
26
|
return await this.contract.permanentlyRevoked(owner, spender);
|
|
44
27
|
}
|
|
45
|
-
|
|
28
|
+
async hasActivePermissions(owner) {
|
|
29
|
+
return await this.contract.hasActivePermissions(owner);
|
|
30
|
+
}
|
|
31
|
+
async getActivePermissionCount(owner) {
|
|
32
|
+
return await this.contract.getActivePermissionCount(owner);
|
|
33
|
+
}
|
|
34
|
+
async getActiveSpenders(owner) {
|
|
35
|
+
return await this.contract.getActiveSpenders(owner);
|
|
36
|
+
}
|
|
37
|
+
async getActiveTokensForSpender(owner, spender) {
|
|
38
|
+
return await this.contract.getActiveTokensForSpender(owner, spender);
|
|
39
|
+
}
|
|
40
|
+
async getAllActivePermissions(owner) {
|
|
41
|
+
const result = await this.contract.getAllActivePermissions(owner);
|
|
42
|
+
return {
|
|
43
|
+
spenders: result.spenders,
|
|
44
|
+
tokens: result.tokens,
|
|
45
|
+
permissionData: result.permissionData.map((p) => ({
|
|
46
|
+
amountLimit: p.amountLimit,
|
|
47
|
+
amountUsed: p.amountUsed,
|
|
48
|
+
expiryTime: p.expiryTime,
|
|
49
|
+
isActive: p.isActive,
|
|
50
|
+
})),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async requirePermission(owner, spender, token) {
|
|
54
|
+
await this.contract.requirePermission(owner, spender, token);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// ============ Permission Management Implementation ============
|
|
58
|
+
class PermissionManagement {
|
|
59
|
+
constructor(contract, isSigner) {
|
|
60
|
+
this.contract = contract;
|
|
61
|
+
this.isSigner = isSigner;
|
|
62
|
+
}
|
|
46
63
|
async grantPermission(spender, token, amountLimit, duration) {
|
|
47
64
|
if (!this.isSigner) {
|
|
48
65
|
throw new Error("OnBehalfTradingService: Write operations require a signer");
|
|
@@ -71,7 +88,45 @@ class OnBehalfTradingService {
|
|
|
71
88
|
const tx = await this.contract.chargePermission(owner, spender, token, amount);
|
|
72
89
|
await tx.wait();
|
|
73
90
|
}
|
|
74
|
-
|
|
91
|
+
async setPermissions(payloads) {
|
|
92
|
+
if (!this.isSigner) {
|
|
93
|
+
throw new Error("OnBehalfTradingService: Write operations require a signer");
|
|
94
|
+
}
|
|
95
|
+
const tx = await this.contract.setPermissions(payloads);
|
|
96
|
+
await tx.wait();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// ============ Configuration Implementation ============
|
|
100
|
+
class Configuration {
|
|
101
|
+
constructor(contract) {
|
|
102
|
+
this.contract = contract;
|
|
103
|
+
}
|
|
104
|
+
async isPaused() {
|
|
105
|
+
return await this.contract.isPaused();
|
|
106
|
+
}
|
|
107
|
+
async maxPermissionDuration() {
|
|
108
|
+
return await this.contract.maxPermissionDuration();
|
|
109
|
+
}
|
|
110
|
+
async maxPermissionAmountPerToken(token) {
|
|
111
|
+
return await this.contract.maxPermissionAmountPerToken(token);
|
|
112
|
+
}
|
|
113
|
+
async getContractConfiguration(tokensToQuery) {
|
|
114
|
+
const config = await this.contract.getContractConfiguration(tokensToQuery);
|
|
115
|
+
return {
|
|
116
|
+
isPausedState: config.isPausedState,
|
|
117
|
+
maxDuration: config.maxDuration,
|
|
118
|
+
tokenMaxAmounts: config.tokenMaxAmounts,
|
|
119
|
+
registryAddress: config.registryAddress,
|
|
120
|
+
tradersPortalAddress: config.tradersPortalAddress,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// ============ Admin Functions Implementation ============
|
|
125
|
+
class AdminFunctions {
|
|
126
|
+
constructor(contract, isSigner) {
|
|
127
|
+
this.contract = contract;
|
|
128
|
+
this.isSigner = isSigner;
|
|
129
|
+
}
|
|
75
130
|
async setMaxPermissionDuration(maxDuration) {
|
|
76
131
|
if (!this.isSigner) {
|
|
77
132
|
throw new Error("OnBehalfTradingService: Write operations require a signer");
|
|
@@ -114,7 +169,85 @@ class OnBehalfTradingService {
|
|
|
114
169
|
const tx = await this.contract.setDynamicRoleCallers(callers, roleNames);
|
|
115
170
|
await tx.wait();
|
|
116
171
|
}
|
|
117
|
-
|
|
172
|
+
async setPendingAdmin(newPendingAdmin) {
|
|
173
|
+
if (!this.isSigner) {
|
|
174
|
+
throw new Error("OnBehalfTradingService: Write operations require a signer");
|
|
175
|
+
}
|
|
176
|
+
const tx = await this.contract._setPendingAdmin(newPendingAdmin);
|
|
177
|
+
await tx.wait();
|
|
178
|
+
}
|
|
179
|
+
async acceptAdmin() {
|
|
180
|
+
if (!this.isSigner) {
|
|
181
|
+
throw new Error("OnBehalfTradingService: Write operations require a signer");
|
|
182
|
+
}
|
|
183
|
+
const tx = await this.contract._acceptAdmin();
|
|
184
|
+
await tx.wait();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// ============ Contract References Implementation ============
|
|
188
|
+
class ContractReferences {
|
|
189
|
+
constructor(contract) {
|
|
190
|
+
this.contract = contract;
|
|
191
|
+
}
|
|
192
|
+
async registry() {
|
|
193
|
+
return await this.contract.registry();
|
|
194
|
+
}
|
|
195
|
+
async dynamicRoleCallers(address) {
|
|
196
|
+
return await this.contract.dynamicRoleCallers(address);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// ============ Pendable Admin Implementation ============
|
|
200
|
+
class PendableAdmin {
|
|
201
|
+
constructor(contract) {
|
|
202
|
+
this.contract = contract;
|
|
203
|
+
}
|
|
204
|
+
async admin() {
|
|
205
|
+
return await this.contract.admin();
|
|
206
|
+
}
|
|
207
|
+
async pendingAdmin() {
|
|
208
|
+
return await this.contract.pendingAdmin();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// ============ Lynx Versioned Contract Implementation ============
|
|
212
|
+
class LynxVersionedContract {
|
|
213
|
+
constructor(contract) {
|
|
214
|
+
this.contract = contract;
|
|
215
|
+
}
|
|
216
|
+
async getContractName() {
|
|
217
|
+
return await this.contract.getContractName();
|
|
218
|
+
}
|
|
219
|
+
async getContractVersion() {
|
|
220
|
+
return await this.contract.getContractVersion();
|
|
221
|
+
}
|
|
222
|
+
async CONTRACT_NAME() {
|
|
223
|
+
return await this.contract.CONTRACT_NAME();
|
|
224
|
+
}
|
|
225
|
+
async CONTRACT_VERSION() {
|
|
226
|
+
return await this.contract.CONTRACT_VERSION();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// ============ Main Service Class ============
|
|
230
|
+
/**
|
|
231
|
+
* Service for interacting with the OnBehalfTrading contract
|
|
232
|
+
* Manages delegated trading permissions between users
|
|
233
|
+
*/
|
|
234
|
+
class OnBehalfTradingService {
|
|
235
|
+
constructor(signerOrProvider, address) {
|
|
236
|
+
this.contract = OnBehalfTradingV1__factory_1.OnBehalfTradingV1__factory.connect(address, signerOrProvider);
|
|
237
|
+
this.isSigner = "sendTransaction" in signerOrProvider;
|
|
238
|
+
// Initialize all function groups using separate classes
|
|
239
|
+
this.permissionQueries = new PermissionQueries(this.contract);
|
|
240
|
+
this.permissionManagement = new PermissionManagement(this.contract, this.isSigner);
|
|
241
|
+
this.configuration = new Configuration(this.contract);
|
|
242
|
+
this.adminFunctions = new AdminFunctions(this.contract, this.isSigner);
|
|
243
|
+
this.contractReferences = new ContractReferences(this.contract);
|
|
244
|
+
this.pendableAdmin = new PendableAdmin(this.contract);
|
|
245
|
+
this.lynxVersionedContract = new LynxVersionedContract(this.contract);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get the underlying contract instance
|
|
249
|
+
* Useful for accessing contract methods directly when needed
|
|
250
|
+
*/
|
|
118
251
|
getContract() {
|
|
119
252
|
return this.contract;
|
|
120
253
|
}
|
|
@@ -28,7 +28,7 @@ class OrderManagement {
|
|
|
28
28
|
return this.orderBookContract.updateOrderIdPositionInList(positionId);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
class
|
|
31
|
+
class ContractReferences {
|
|
32
32
|
constructor(orderBookContract) {
|
|
33
33
|
this.orderBookContract = orderBookContract;
|
|
34
34
|
}
|
|
@@ -38,12 +38,22 @@ class ContractInfo {
|
|
|
38
38
|
async tradingFloor() {
|
|
39
39
|
return this.orderBookContract.tradingFloor();
|
|
40
40
|
}
|
|
41
|
+
}
|
|
42
|
+
class PendableAdmin {
|
|
43
|
+
constructor(orderBookContract) {
|
|
44
|
+
this.orderBookContract = orderBookContract;
|
|
45
|
+
}
|
|
41
46
|
async admin() {
|
|
42
47
|
return this.orderBookContract.admin();
|
|
43
48
|
}
|
|
44
49
|
async pendingAdmin() {
|
|
45
50
|
return this.orderBookContract.pendingAdmin();
|
|
46
51
|
}
|
|
52
|
+
}
|
|
53
|
+
class PendableImplementation {
|
|
54
|
+
constructor(orderBookContract) {
|
|
55
|
+
this.orderBookContract = orderBookContract;
|
|
56
|
+
}
|
|
47
57
|
async implementation() {
|
|
48
58
|
return this.orderBookContract.implementation();
|
|
49
59
|
}
|
|
@@ -84,7 +94,9 @@ class OrderBookService {
|
|
|
84
94
|
this.signerOrProvider = signerOrProvider;
|
|
85
95
|
this.orderBookContract = OrderBookV1__factory_1.OrderBookV1__factory.connect(address, signerOrProvider);
|
|
86
96
|
this.orderManagement = new OrderManagement(this.orderBookContract);
|
|
87
|
-
this.
|
|
97
|
+
this.contractReferences = new ContractReferences(this.orderBookContract);
|
|
98
|
+
this.pendableAdmin = new PendableAdmin(this.orderBookContract);
|
|
99
|
+
this.pendableImplementation = new PendableImplementation(this.orderBookContract);
|
|
88
100
|
this.administration = new Administration(this.orderBookContract);
|
|
89
101
|
this.constants = new Constants(this.orderBookContract);
|
|
90
102
|
}
|
|
@@ -70,7 +70,7 @@ class PNLRFunctionsGroup_Configuration {
|
|
|
70
70
|
return this.contract.priceValidatorType();
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class PNLRFunctionsGroup_PendableAdmin {
|
|
74
74
|
constructor(contract) {
|
|
75
75
|
this.contract = contract;
|
|
76
76
|
}
|
|
@@ -80,12 +80,6 @@ class PNLRFunctionsGroup_ContractInfo {
|
|
|
80
80
|
async pendingAdmin() {
|
|
81
81
|
return this.contract.pendingAdmin();
|
|
82
82
|
}
|
|
83
|
-
async getContractName() {
|
|
84
|
-
return this.contract.getContractName();
|
|
85
|
-
}
|
|
86
|
-
async getContractVersion() {
|
|
87
|
-
return this.contract.getContractVersion();
|
|
88
|
-
}
|
|
89
83
|
}
|
|
90
84
|
class PNLRFunctionsGroup_AdminManagement {
|
|
91
85
|
constructor(contract) {
|
|
@@ -98,10 +92,16 @@ class PNLRFunctionsGroup_AdminManagement {
|
|
|
98
92
|
return this.contract._acceptAdmin();
|
|
99
93
|
}
|
|
100
94
|
}
|
|
101
|
-
class
|
|
95
|
+
class PNLRFunctionsGroup_LynxVersionedContract {
|
|
102
96
|
constructor(contract) {
|
|
103
97
|
this.contract = contract;
|
|
104
98
|
}
|
|
99
|
+
async getContractName() {
|
|
100
|
+
return this.contract.getContractName();
|
|
101
|
+
}
|
|
102
|
+
async getContractVersion() {
|
|
103
|
+
return this.contract.getContractVersion();
|
|
104
|
+
}
|
|
105
105
|
async CONTRACT_NAME() {
|
|
106
106
|
return this.contract.CONTRACT_NAME();
|
|
107
107
|
}
|
|
@@ -117,8 +117,8 @@ class PNLRService {
|
|
|
117
117
|
this.permissionManagement = new PNLRFunctionsGroup_PermissionManagement(this.pnlrContract);
|
|
118
118
|
this.configuration = new PNLRFunctionsGroup_Configuration(this.pnlrContract);
|
|
119
119
|
this.adminManagement = new PNLRFunctionsGroup_AdminManagement(this.pnlrContract);
|
|
120
|
-
this.
|
|
121
|
-
this.
|
|
120
|
+
this.pendableAdmin = new PNLRFunctionsGroup_PendableAdmin(this.pnlrContract);
|
|
121
|
+
this.lynxVersionedContract = new PNLRFunctionsGroup_LynxVersionedContract(this.pnlrContract);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
exports.PNLRService = PNLRService;
|
package/dist/cjs/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.js
CHANGED
|
@@ -56,16 +56,10 @@ class DirectActions {
|
|
|
56
56
|
return this.tradingContract.directAction_updatePendingPosition_limit(positionId, minPrice, maxPrice, tp, sl);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
class
|
|
59
|
+
class ContractReferences {
|
|
60
60
|
constructor(tradingContract) {
|
|
61
61
|
this.tradingContract = tradingContract;
|
|
62
62
|
}
|
|
63
|
-
async getContractName() {
|
|
64
|
-
return this.tradingContract.getContractName();
|
|
65
|
-
}
|
|
66
|
-
async getContractVersion() {
|
|
67
|
-
return this.tradingContract.getContractVersion();
|
|
68
|
-
}
|
|
69
63
|
async getOrderBook() {
|
|
70
64
|
return this.tradingContract.getOrderBook();
|
|
71
65
|
}
|
|
@@ -78,6 +72,11 @@ class ContractInfo {
|
|
|
78
72
|
async tradingFloor() {
|
|
79
73
|
return this.tradingContract.tradingFloor();
|
|
80
74
|
}
|
|
75
|
+
}
|
|
76
|
+
class PendableAdmin {
|
|
77
|
+
constructor(tradingContract) {
|
|
78
|
+
this.tradingContract = tradingContract;
|
|
79
|
+
}
|
|
81
80
|
async admin() {
|
|
82
81
|
return this.tradingContract.admin();
|
|
83
82
|
}
|
|
@@ -85,6 +84,23 @@ class ContractInfo {
|
|
|
85
84
|
return this.tradingContract.pendingAdmin();
|
|
86
85
|
}
|
|
87
86
|
}
|
|
87
|
+
class LynxVersionedContract {
|
|
88
|
+
constructor(tradingContract) {
|
|
89
|
+
this.tradingContract = tradingContract;
|
|
90
|
+
}
|
|
91
|
+
async getContractName() {
|
|
92
|
+
return this.tradingContract.getContractName();
|
|
93
|
+
}
|
|
94
|
+
async getContractVersion() {
|
|
95
|
+
return this.tradingContract.getContractVersion();
|
|
96
|
+
}
|
|
97
|
+
async CONTRACT_NAME() {
|
|
98
|
+
return this.tradingContract.CONTRACT_NAME();
|
|
99
|
+
}
|
|
100
|
+
async CONTRACT_VERSION() {
|
|
101
|
+
return this.tradingContract.CONTRACT_VERSION();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
88
104
|
class Status {
|
|
89
105
|
constructor(tradingContract) {
|
|
90
106
|
this.tradingContract = tradingContract;
|
|
@@ -123,12 +139,6 @@ class Constants {
|
|
|
123
139
|
async ACCURACY_IMPROVEMENT_SCALE() {
|
|
124
140
|
return this.tradingContract.ACCURACY_IMPROVEMENT_SCALE();
|
|
125
141
|
}
|
|
126
|
-
async CONTRACT_NAME() {
|
|
127
|
-
return this.tradingContract.CONTRACT_NAME();
|
|
128
|
-
}
|
|
129
|
-
async CONTRACT_VERSION() {
|
|
130
|
-
return this.tradingContract.CONTRACT_VERSION();
|
|
131
|
-
}
|
|
132
142
|
async FRACTION_SCALE() {
|
|
133
143
|
return this.tradingContract.FRACTION_SCALE();
|
|
134
144
|
}
|
|
@@ -148,7 +158,9 @@ class TradersPortalServiceService {
|
|
|
148
158
|
this.tradingContract = TradersPortalV1__factory_1.TradersPortalV1__factory.connect(address, signerOrProvider);
|
|
149
159
|
this.traderRequests = new TraderRequests(this.tradingContract);
|
|
150
160
|
this.directActions = new DirectActions(this.tradingContract);
|
|
151
|
-
this.
|
|
161
|
+
this.contractReferences = new ContractReferences(this.tradingContract);
|
|
162
|
+
this.pendableAdmin = new PendableAdmin(this.tradingContract);
|
|
163
|
+
this.lynxVersionedContract = new LynxVersionedContract(this.tradingContract);
|
|
152
164
|
this.status = new Status(this.tradingContract);
|
|
153
165
|
this.settings = new Settings(this.tradingContract);
|
|
154
166
|
this.constants = new Constants(this.tradingContract);
|