@d8x/perpetuals-sdk 0.0.35 → 0.0.36

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "v1.5",
3
3
  "proxyAddr": "0xaB6AD25eE5CA28E7d7b16A33A33897aE34BF9e67",
4
- "nodeURL": "https://rpc-mumbai.maticvigil.com/",
4
+ "nodeURL": "https://polygon-mumbai.blockpi.network/v1/rpc/public",
5
5
  "proxyABILocation": "../abi/IPerpetualManager.json",
6
6
  "limitOrderBookFactoryAddr": "0xe95422bf27C62F3b9ae19d6032aC58c1bd13C71E",
7
7
  "limitOrderBookFactoryABILocation": "../abi/LimitOrderBookFactory.json",
@@ -1,7 +1,7 @@
1
1
  import { ethers } from "ethers";
2
- import { NodeSDKConfig, Order, PerpetualStaticInfo, OrderResponse } from "./nodeSDKTypes";
3
- import WriteAccessHandler from "./writeAccessHandler";
2
+ import { NodeSDKConfig, Order, OrderResponse, PerpetualStaticInfo } from "./nodeSDKTypes";
4
3
  import TraderDigests from "./traderDigests";
4
+ import WriteAccessHandler from "./writeAccessHandler";
5
5
  /**
6
6
  * Functions to create, submit and cancel orders on the exchange.
7
7
  * This class requires a private key and executes smart-contract interactions that
@@ -206,4 +206,16 @@ export default class AccountTrade extends WriteAccessHandler {
206
206
  * @ignore
207
207
  */
208
208
  private _createSignature;
209
+ /**
210
+ *
211
+ * @param {string} symbol Symbol of the form ETH-USD-MATIC.
212
+ * @param {number} amount How much collateral to add, in units of collateral currency, e.g. MATIC
213
+ */
214
+ addCollateral(symbol: string, amount: number): Promise<ethers.ContractTransaction>;
215
+ /**
216
+ *
217
+ * @param {string} symbol Symbol of the form ETH-USD-MATIC.
218
+ * @param {number} amount How much collateral to remove, in units of collateral currency, e.g. MATIC
219
+ */
220
+ removeCollateral(symbol: string, amount: number): Promise<ethers.ContractTransaction>;
209
221
  }
@@ -16,8 +16,8 @@ const d8XMath_1 = require("./d8XMath");
16
16
  const marketData_1 = __importDefault(require("./marketData"));
17
17
  const nodeSDKTypes_1 = require("./nodeSDKTypes");
18
18
  const perpetualDataHandler_1 = __importDefault(require("./perpetualDataHandler"));
19
- const writeAccessHandler_1 = __importDefault(require("./writeAccessHandler"));
20
19
  const traderDigests_1 = __importDefault(require("./traderDigests"));
20
+ const writeAccessHandler_1 = __importDefault(require("./writeAccessHandler"));
21
21
  /**
22
22
  * Functions to create, submit and cancel orders on the exchange.
23
23
  * This class requires a private key and executes smart-contract interactions that
@@ -308,5 +308,35 @@ class AccountTrade extends writeAccessHandler_1.default {
308
308
  return [signature, digest];
309
309
  });
310
310
  }
311
+ /**
312
+ *
313
+ * @param {string} symbol Symbol of the form ETH-USD-MATIC.
314
+ * @param {number} amount How much collateral to add, in units of collateral currency, e.g. MATIC
315
+ */
316
+ addCollateral(symbol, amount) {
317
+ return __awaiter(this, void 0, void 0, function* () {
318
+ if (this.proxyContract == null || this.signer == null) {
319
+ throw Error("no proxy contract or wallet initialized. Use createProxyInstance().");
320
+ }
321
+ let perpId = this.getPerpIdFromSymbol(symbol);
322
+ let fAmountCC = (0, d8XMath_1.floatToABK64x64)(amount);
323
+ return yield this.proxyContract.deposit(perpId, fAmountCC);
324
+ });
325
+ }
326
+ /**
327
+ *
328
+ * @param {string} symbol Symbol of the form ETH-USD-MATIC.
329
+ * @param {number} amount How much collateral to remove, in units of collateral currency, e.g. MATIC
330
+ */
331
+ removeCollateral(symbol, amount) {
332
+ return __awaiter(this, void 0, void 0, function* () {
333
+ if (this.proxyContract == null || this.signer == null) {
334
+ throw Error("no proxy contract or wallet initialized. Use createProxyInstance().");
335
+ }
336
+ let perpId = this.getPerpIdFromSymbol(symbol);
337
+ let fAmountCC = (0, d8XMath_1.floatToABK64x64)(amount);
338
+ return yield this.proxyContract.withdraw(perpId, fAmountCC);
339
+ });
340
+ }
311
341
  }
312
342
  exports.default = AccountTrade;
package/dist/index.js CHANGED
@@ -38,18 +38,6 @@ const traderInterface_1 = __importDefault(require("./traderInterface"));
38
38
  exports.TraderInterface = traderInterface_1.default;
39
39
  const perpetualEventHandler_1 = __importDefault(require("./perpetualEventHandler"));
40
40
  exports.PerpetualEventHandler = perpetualEventHandler_1.default;
41
- // import {
42
- // NodeSDKConfig,
43
- // MarginAccount,
44
- // CollaterlCCY,
45
- // PoolStaticInfo,
46
- // PerpetualStaticInfo,
47
- // ExchangeInfo,
48
- // PoolState,
49
- // PerpetualState,
50
- // Order,
51
- // SmartContractOrder,
52
- // } from "./nodeSDKTypes";
53
41
  __exportStar(require("./nodeSDKTypes"), exports);
54
42
  __exportStar(require("./utils"), exports);
55
43
  __exportStar(require("./d8XMath"), exports);
@@ -1,8 +1,7 @@
1
- import { ExchangeInfo, NodeSDKConfig, MarginAccount, PerpetualState, PoolStaticInfo, PerpetualStaticInfo } from "./nodeSDKTypes";
2
1
  import { ethers } from "ethers";
3
- import PerpetualDataHandler from "./perpetualDataHandler";
4
- import { SmartContractOrder, Order } from "./nodeSDKTypes";
5
2
  import "./nodeSDKTypes";
3
+ import { ExchangeInfo, MarginAccount, NodeSDKConfig, Order, PerpetualState, PerpetualStaticInfo, PoolStaticInfo, SmartContractOrder } from "./nodeSDKTypes";
4
+ import PerpetualDataHandler from "./perpetualDataHandler";
6
5
  /**
7
6
  * Functions to access market data (e.g., information on open orders, information on products that can be traded).
8
7
  * This class requires no private key and is blockchain read-only.
@@ -36,6 +35,11 @@ export default class MarketData extends PerpetualDataHandler {
36
35
  * @param provider optional provider
37
36
  */
38
37
  createProxyInstance(provider?: ethers.providers.JsonRpcProvider): Promise<void>;
38
+ /**
39
+ * Get the proxy address
40
+ * @returns Address of the perpetual proxy contract
41
+ */
42
+ getProxyAddress(): string;
39
43
  /**
40
44
  * Convert the smart contract output of an order into a convenient format of type "Order"
41
45
  * @param smOrder SmartContractOrder, as obtained e.g., by PerpetualLimitOrderCreated event
@@ -12,12 +12,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const nodeSDKTypes_1 = require("./nodeSDKTypes");
16
15
  const ethers_1 = require("ethers");
17
16
  const d8XMath_1 = require("./d8XMath");
18
- const utils_1 = require("./utils");
19
- const perpetualDataHandler_1 = __importDefault(require("./perpetualDataHandler"));
20
17
  require("./nodeSDKTypes");
18
+ const nodeSDKTypes_1 = require("./nodeSDKTypes");
19
+ const perpetualDataHandler_1 = __importDefault(require("./perpetualDataHandler"));
20
+ const utils_1 = require("./utils");
21
21
  /**
22
22
  * Functions to access market data (e.g., information on open orders, information on products that can be traded).
23
23
  * This class requires no private key and is blockchain read-only.
@@ -63,6 +63,16 @@ class MarketData extends perpetualDataHandler_1.default {
63
63
  yield this.initContractsAndData(this.provider);
64
64
  });
65
65
  }
66
+ /**
67
+ * Get the proxy address
68
+ * @returns Address of the perpetual proxy contract
69
+ */
70
+ getProxyAddress() {
71
+ if (this.proxyContract == null) {
72
+ throw Error("no proxy contract initialized. Use createProxyInstance().");
73
+ }
74
+ return this.proxyContract.address;
75
+ }
66
76
  /**
67
77
  * Convert the smart contract output of an order into a convenient format of type "Order"
68
78
  * @param smOrder SmartContractOrder, as obtained e.g., by PerpetualLimitOrderCreated event
@@ -1,4 +1,4 @@
1
- import { BytesLike, BigNumber, BigNumberish, ContractTransaction } from "ethers";
1
+ import { BigNumber, BigNumberish, BytesLike, ContractTransaction } from "ethers";
2
2
  export declare const DEFAULT_CONFIG_TESTNET = "../config/defaultConfig.json";
3
3
  export declare const DEFAULT_CONFIG_MAINNET = "notthereyet";
4
4
  export declare const DEFAULT_CONFIG_TESTNET_NAME = "testnet";
@@ -1,6 +1,6 @@
1
- import WriteAccessHandler from "./writeAccessHandler";
2
- import { NodeSDKConfig, Order, PerpetualStaticInfo } from "./nodeSDKTypes";
3
1
  import { ethers } from "ethers";
2
+ import { NodeSDKConfig, Order, PerpetualStaticInfo } from "./nodeSDKTypes";
3
+ import WriteAccessHandler from "./writeAccessHandler";
4
4
  /**
5
5
  * Functions to execute existing conditional orders from the limit order book. This class
6
6
  * requires a private key and executes smart-contract interactions that require
@@ -12,10 +12,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const writeAccessHandler_1 = __importDefault(require("./writeAccessHandler"));
16
- const nodeSDKTypes_1 = require("./nodeSDKTypes");
17
15
  const ethers_1 = require("ethers");
16
+ const nodeSDKTypes_1 = require("./nodeSDKTypes");
18
17
  const perpetualDataHandler_1 = __importDefault(require("./perpetualDataHandler"));
18
+ const writeAccessHandler_1 = __importDefault(require("./writeAccessHandler"));
19
19
  /**
20
20
  * Functions to execute existing conditional orders from the limit order book. This class
21
21
  * requires a private key and executes smart-contract interactions that require
@@ -1,6 +1,6 @@
1
1
  import { BigNumber } from "ethers";
2
- import { PerpetualState, ExchangeInfo, SmartContractOrder, MarginAccount, OrderStruct, TradeEvent } from "./nodeSDKTypes";
3
2
  import MarketData from "./marketData";
3
+ import { ExchangeInfo, MarginAccount, OrderStruct, PerpetualState, SmartContractOrder, TradeEvent } from "./nodeSDKTypes";
4
4
  /**
5
5
  * This class handles events and stores relevant variables
6
6
  * as member variables. The events change the state of the member variables:
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ const process_1 = require("process");
12
13
  const d8XMath_1 = require("./d8XMath");
13
14
  const nodeSDKTypes_1 = require("./nodeSDKTypes");
14
- const process_1 = require("process");
15
15
  /**
16
16
  * This class handles events and stores relevant variables
17
17
  * as member variables. The events change the state of the member variables:
@@ -1,6 +1,6 @@
1
1
  import { BigNumber, ethers } from "ethers";
2
- import PerpetualDataHandler from "./perpetualDataHandler";
3
2
  import { NodeSDKConfig } from "./nodeSDKTypes";
3
+ import PerpetualDataHandler from "./perpetualDataHandler";
4
4
  /**
5
5
  * This is a parent class for the classes that require
6
6
  * write access to the contracts.
@@ -13,9 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const ethers_1 = require("ethers");
16
- const perpetualDataHandler_1 = __importDefault(require("./perpetualDataHandler"));
17
- const nodeSDKTypes_1 = require("./nodeSDKTypes");
18
16
  const d8XMath_1 = require("./d8XMath");
17
+ const nodeSDKTypes_1 = require("./nodeSDKTypes");
18
+ const perpetualDataHandler_1 = __importDefault(require("./perpetualDataHandler"));
19
19
  /**
20
20
  * This is a parent class for the classes that require
21
21
  * write access to the contracts.
package/package.json CHANGED
@@ -1,33 +1,38 @@
1
1
  {
2
2
  "dependencies": {
3
- "@babel/core": "^7.20.2",
4
- "@types/jest": "^29.2.3",
5
- "@types/node": "^18.11.9",
6
- "babel-jest": "^29.3.1",
3
+ "@ethersproject/bytes": "^5.7.0",
4
+ "@ethersproject/strings": "^5.7.0",
7
5
  "ethers": "^5.7.2",
8
- "jest": "^29.3.1",
9
- "ts-jest": "^29.0.3",
10
- "ts-node": "^10.9.1",
11
- "typescript": "^4.9.3"
6
+ "process": "^0.11.10"
12
7
  },
13
8
  "scripts": {
14
9
  "build": "tsc",
15
10
  "build:doc": "jsdoc2md --files ./src/accountTrade.ts --configure ./jsdoc2md.json > ./doc/accountTrade.md && jsdoc2md --files ./src/marketData.ts --configure ./jsdoc2md.json > ./doc/marketData.md && jsdoc2md --files ./src/liquidatorTool.ts --configure ./jsdoc2md.json > ./doc/liquidatorTool.md && jsdoc2md --files ./src/liquidityProviderTool.ts --configure ./jsdoc2md.json > ./doc/liquidityProviderTool.md && jsdoc2md --files ./src/brokerTool.ts --configure ./jsdoc2md.json > ./doc/brokerTool.md && jsdoc2md --files ./src/orderReferrerTool.ts --configure ./jsdoc2md.json > ./doc/orderReferrerTool.md && jsdoc2md --files ./src/*.ts --configure ./jsdoc2md.json > ./doc/d8x-perpetuals-sdk.md",
16
11
  "test": "jest",
17
- "coverage": "nyc -r lcov -e .ts -x \"*.test.ts\" npm run test"
12
+ "coverage": "nyc -r lcov -e .ts -x \"*.test.ts\" npm run test",
13
+ "prepubish": "test test/readonly.test && build:doc"
18
14
  },
19
15
  "devDependencies": {
16
+ "@babel/core": "^7.20.2",
20
17
  "@babel/plugin-proposal-class-properties": "^7.18.6",
21
18
  "@babel/plugin-proposal-object-rest-spread": "^7.20.2",
22
19
  "@babel/preset-env": "^7.20.2",
23
20
  "@babel/preset-typescript": "^7.18.6",
21
+ "@types/jest": "^29.2.3",
22
+ "@types/node": "^18.11.9",
23
+ "babel-jest": "^29.3.1",
24
+ "jest": "^29.3.1",
24
25
  "jsdoc-babel": "^0.5.0",
25
26
  "jsdoc-to-markdown": "^7.1.1",
26
- "json2md": "^2.0.0"
27
+ "json2md": "^2.0.0",
28
+ "prettier": "^2.8.4",
29
+ "ts-jest": "^29.0.3",
30
+ "ts-node": "^10.9.1",
31
+ "typescript": "^4.9.3"
27
32
  },
28
33
  "name": "@d8x/perpetuals-sdk",
29
34
  "description": "Node TypeScript SDK for D8X Perpetual Futures",
30
- "version": "0.0.35",
35
+ "version": "0.0.36",
31
36
  "main": "./dist/index.js",
32
37
  "types": "./dist/index.d.ts",
33
38
  "directories": {
@@ -54,8 +59,8 @@
54
59
  "sdk",
55
60
  "api"
56
61
  ],
57
- "author": "d8x",
58
- "license": "UNLICENSED",
62
+ "author": "D8X",
63
+ "license": "MIT",
59
64
  "bugs": {
60
65
  "url": "https://github.com/D8-X/d8x-futures-node-sdk/issues"
61
66
  },
@@ -1,19 +1,17 @@
1
1
  import { ethers } from "ethers";
2
-
3
- import { ABK64x64ToFloat } from "./d8XMath";
2
+ import { ABK64x64ToFloat, floatToABK64x64 } from "./d8XMath";
4
3
  import MarketData from "./marketData";
5
4
  import {
6
5
  NodeSDKConfig,
7
6
  Order,
7
+ OrderResponse,
8
+ PerpetualStaticInfo,
8
9
  SmartContractOrder,
9
10
  ZERO_ADDRESS,
10
- ORDER_TYPE_MARKET,
11
- PerpetualStaticInfo,
12
- OrderResponse,
13
11
  } from "./nodeSDKTypes";
14
12
  import PerpetualDataHandler from "./perpetualDataHandler";
15
- import WriteAccessHandler from "./writeAccessHandler";
16
13
  import TraderDigests from "./traderDigests";
14
+ import WriteAccessHandler from "./writeAccessHandler";
17
15
 
18
16
  /**
19
17
  * Functions to create, submit and cancel orders on the exchange.
@@ -329,4 +327,32 @@ export default class AccountTrade extends WriteAccessHandler {
329
327
  let signature = await signer.signMessage(digestBuffer);
330
328
  return [signature, digest];
331
329
  }
330
+
331
+ /**
332
+ *
333
+ * @param {string} symbol Symbol of the form ETH-USD-MATIC.
334
+ * @param {number} amount How much collateral to add, in units of collateral currency, e.g. MATIC
335
+ */
336
+ public async addCollateral(symbol: string, amount: number): Promise<ethers.ContractTransaction> {
337
+ if (this.proxyContract == null || this.signer == null) {
338
+ throw Error("no proxy contract or wallet initialized. Use createProxyInstance().");
339
+ }
340
+ let perpId = this.getPerpIdFromSymbol(symbol);
341
+ let fAmountCC = floatToABK64x64(amount);
342
+ return await this.proxyContract.deposit(perpId, fAmountCC);
343
+ }
344
+
345
+ /**
346
+ *
347
+ * @param {string} symbol Symbol of the form ETH-USD-MATIC.
348
+ * @param {number} amount How much collateral to remove, in units of collateral currency, e.g. MATIC
349
+ */
350
+ public async removeCollateral(symbol: string, amount: number): Promise<ethers.ContractTransaction> {
351
+ if (this.proxyContract == null || this.signer == null) {
352
+ throw Error("no proxy contract or wallet initialized. Use createProxyInstance().");
353
+ }
354
+ let perpId = this.getPerpIdFromSymbol(symbol);
355
+ let fAmountCC = floatToABK64x64(amount);
356
+ return await this.proxyContract.withdraw(perpId, fAmountCC);
357
+ }
332
358
  }
package/src/d8XMath.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { assert } from "console";
2
1
  import { BigNumber } from "ethers";
3
2
  import { DECIMALS, ONE_64x64 } from "./nodeSDKTypes";
4
3
 
package/src/index.ts CHANGED
@@ -8,18 +8,7 @@ import WriteAccessHandler from "./writeAccessHandler";
8
8
  import LiquidatorTool from "./liquidatorTool";
9
9
  import TraderInterface from "./traderInterface";
10
10
  import PerpetualEventHandler from "./perpetualEventHandler";
11
- // import {
12
- // NodeSDKConfig,
13
- // MarginAccount,
14
- // CollaterlCCY,
15
- // PoolStaticInfo,
16
- // PerpetualStaticInfo,
17
- // ExchangeInfo,
18
- // PoolState,
19
- // PerpetualState,
20
- // Order,
21
- // SmartContractOrder,
22
- // } from "./nodeSDKTypes";
11
+
23
12
  export * from "./nodeSDKTypes";
24
13
  export * from "./utils";
25
14
  export * from "./d8XMath";
package/src/marketData.ts CHANGED
@@ -1,35 +1,35 @@
1
+ import { BigNumber, ethers } from "ethers";
1
2
  import {
3
+ ABK64x64ToFloat,
4
+ calculateLiquidationPriceCollateralBase,
5
+ calculateLiquidationPriceCollateralQuanto,
6
+ calculateLiquidationPriceCollateralQuote,
7
+ getMarginRequiredForLeveragedTrade,
8
+ getMaxSignedPositionSize,
9
+ getNewPositionLeverage,
10
+ } from "./d8XMath";
11
+ import "./nodeSDKTypes";
12
+ import {
13
+ BUY_SIDE,
14
+ CLOSED_SIDE,
15
+ COLLATERAL_CURRENCY_BASE,
16
+ COLLATERAL_CURRENCY_QUANTO,
17
+ CollaterlCCY,
2
18
  ExchangeInfo,
3
- NodeSDKConfig,
4
19
  MarginAccount,
5
- PoolState,
20
+ NodeSDKConfig,
21
+ Order,
6
22
  PerpetualState,
7
- COLLATERAL_CURRENCY_BASE,
8
- COLLATERAL_CURRENCY_QUANTO,
23
+ PerpetualStaticInfo,
9
24
  PERP_STATE_STR,
10
- ZERO_ADDRESS,
25
+ PoolState,
11
26
  PoolStaticInfo,
12
- BUY_SIDE,
13
- CLOSED_SIDE,
14
27
  SELL_SIDE,
15
- CollaterlCCY,
16
- PerpetualStaticInfo,
28
+ SmartContractOrder,
29
+ ZERO_ADDRESS,
17
30
  } from "./nodeSDKTypes";
18
- import { BigNumber, BytesLike, ethers } from "ethers";
19
- import {
20
- floatToABK64x64,
21
- ABK64x64ToFloat,
22
- getNewPositionLeverage,
23
- getMarginRequiredForLeveragedTrade,
24
- calculateLiquidationPriceCollateralBase,
25
- calculateLiquidationPriceCollateralQuanto,
26
- calculateLiquidationPriceCollateralQuote,
27
- getMaxSignedPositionSize,
28
- } from "./d8XMath";
29
- import { contractSymbolToSymbol, fromBytes4HexString, toBytes4 } from "./utils";
30
31
  import PerpetualDataHandler from "./perpetualDataHandler";
31
- import { SmartContractOrder, Order } from "./nodeSDKTypes";
32
- import "./nodeSDKTypes";
32
+ import { contractSymbolToSymbol, toBytes4 } from "./utils";
33
33
 
34
34
  /**
35
35
  * Functions to access market data (e.g., information on open orders, information on products that can be traded).
@@ -75,6 +75,17 @@ export default class MarketData extends PerpetualDataHandler {
75
75
  await this.initContractsAndData(this.provider);
76
76
  }
77
77
 
78
+ /**
79
+ * Get the proxy address
80
+ * @returns Address of the perpetual proxy contract
81
+ */
82
+ public getProxyAddress(): string {
83
+ if (this.proxyContract == null) {
84
+ throw Error("no proxy contract initialized. Use createProxyInstance().");
85
+ }
86
+ return this.proxyContract.address;
87
+ }
88
+
78
89
  /**
79
90
  * Convert the smart contract output of an order into a convenient format of type "Order"
80
91
  * @param smOrder SmartContractOrder, as obtained e.g., by PerpetualLimitOrderCreated event
@@ -1,4 +1,4 @@
1
- import { BytesLike, BigNumber, BigNumberish, constants, ContractTransaction } from "ethers";
1
+ import { BigNumber, BigNumberish, BytesLike, constants, ContractTransaction } from "ethers";
2
2
  export const DEFAULT_CONFIG_TESTNET = "../config/defaultConfig.json";
3
3
  export const DEFAULT_CONFIG_MAINNET = "notthereyet";
4
4
  export const DEFAULT_CONFIG_TESTNET_NAME = "testnet";
@@ -1,4 +1,4 @@
1
- import WriteAccessHandler from "./writeAccessHandler";
1
+ import { BigNumber, ethers } from "ethers";
2
2
  import {
3
3
  BUY_SIDE,
4
4
  NodeSDKConfig,
@@ -8,8 +8,8 @@ import {
8
8
  ZERO_ADDRESS,
9
9
  ZERO_ORDER_ID,
10
10
  } from "./nodeSDKTypes";
11
- import { BigNumber, ethers } from "ethers";
12
11
  import PerpetualDataHandler from "./perpetualDataHandler";
12
+ import WriteAccessHandler from "./writeAccessHandler";
13
13
 
14
14
  /**
15
15
  * Functions to execute existing conditional orders from the limit order book. This class
@@ -1,17 +1,17 @@
1
- import { BigNumber, utils } from "ethers";
2
- import { ABK64x64ToFloat, mul64x64, div64x64 } from "./d8XMath";
1
+ import { BigNumber } from "ethers";
2
+ import { emitWarning } from "process";
3
+ import { ABK64x64ToFloat, mul64x64 } from "./d8XMath";
4
+ import MarketData from "./marketData";
3
5
  import {
4
- PerpetualState,
5
- ONE_64x64,
6
6
  ExchangeInfo,
7
- Order,
8
- SmartContractOrder,
9
7
  MarginAccount,
8
+ ONE_64x64,
9
+ Order,
10
10
  OrderStruct,
11
+ PerpetualState,
12
+ SmartContractOrder,
11
13
  TradeEvent,
12
14
  } from "./nodeSDKTypes";
13
- import { emitWarning } from "process";
14
- import MarketData from "./marketData";
15
15
 
16
16
  /**
17
17
  * This class handles events and stores relevant variables
@@ -1,8 +1,7 @@
1
- import { BigNumber, BigNumberish, ethers, Wallet } from "ethers";
2
- import PerpetualDataHandler from "./perpetualDataHandler";
3
- import { NodeSDKConfig, MAX_UINT_256, ERC20_ABI } from "./nodeSDKTypes";
4
- import { to4Chars } from "./utils";
1
+ import { BigNumber, ethers } from "ethers";
5
2
  import { floatToDec18 } from "./d8XMath";
3
+ import { ERC20_ABI, MAX_UINT_256, NodeSDKConfig } from "./nodeSDKTypes";
4
+ import PerpetualDataHandler from "./perpetualDataHandler";
6
5
 
7
6
  /**
8
7
  * This is a parent class for the classes that require