@gmx-io/sdk 1.1.1 → 1.1.2

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,4 +1,3 @@
1
- import { BytesLike } from "./common";
2
1
  import { MarketInfo } from "./markets";
3
2
  import { OrderType } from "./orders";
4
3
  import { TokenData } from "./tokens";
@@ -9,45 +8,6 @@ export declare enum TradeActionType {
9
8
  OrderUpdated = "OrderUpdated",
10
9
  OrderFrozen = "OrderFrozen"
11
10
  }
12
- export type RawTradeAction = {
13
- id: string;
14
- eventName: TradeActionType;
15
- account: string;
16
- marketAddress?: string;
17
- swapPath?: string[];
18
- initialCollateralTokenAddress?: string;
19
- initialCollateralDeltaAmount?: string;
20
- sizeDeltaUsd?: string;
21
- triggerPrice?: string;
22
- acceptablePrice?: string;
23
- executionPrice?: string;
24
- minOutputAmount?: string;
25
- executionAmountOut?: string;
26
- priceImpactDiffUsd?: string;
27
- priceImpactUsd?: string;
28
- positionFeeAmount?: string;
29
- borrowingFeeAmount?: string;
30
- fundingFeeAmount?: string;
31
- liquidationFeeAmount?: string;
32
- pnlUsd?: string;
33
- basePnlUsd?: string;
34
- collateralTokenPriceMax?: string;
35
- collateralTokenPriceMin?: string;
36
- indexTokenPriceMin?: string;
37
- indexTokenPriceMax?: string;
38
- orderType: OrderType;
39
- orderKey: string;
40
- isLong?: boolean;
41
- shouldUnwrapNativeToken?: boolean;
42
- twapGroupId?: string;
43
- numberOfParts?: number;
44
- reason?: string;
45
- reasonBytes?: BytesLike;
46
- timestamp: number;
47
- transaction: {
48
- hash: string;
49
- };
50
- };
51
11
  export type PositionTradeAction = {
52
12
  id: string;
53
13
  eventName: TradeActionType;
@@ -16,7 +16,7 @@ export declare function getMarketIndexName(p: ({
16
16
  export declare function getMarketPoolName(p: {
17
17
  longToken: Token;
18
18
  shortToken: Token;
19
- }): string;
19
+ }, separator?: string): string;
20
20
  export declare function getContractMarketPrices(tokensData: TokensData, market: Market): ContractMarketPrices | undefined;
21
21
  /**
22
22
  * Apart from usual cases, returns `long` for single token backed markets.
@@ -3,6 +3,7 @@ export type BigNumberish = string | Numeric;
3
3
  export declare const USD_DECIMALS = 30;
4
4
  export declare const BASIS_POINTS_DIVISOR = 10000;
5
5
  export declare const BASIS_POINTS_DIVISOR_BIGINT = 10000n;
6
+ export declare const BASIS_POINTS_DECIMALS = 4;
6
7
  export declare const PRECISION_DECIMALS = 30;
7
8
  export declare const PRECISION: bigint;
8
9
  export declare const BN_ZERO = 0n;
@@ -1,7 +1,7 @@
1
1
  import type { MarketsInfoData } from "../types/markets";
2
+ import type { TradeAction as SubsquidTradeAction } from "../types/subsquid";
2
3
  import { Token, TokensData } from "../types/tokens";
3
4
  import type { PositionTradeAction } from "../types/tradeHistory";
4
- import type { RawTradeAction } from "../types/tradeHistory";
5
5
  import type { SwapTradeAction } from "../types/tradeHistory";
6
- export declare function createRawTradeActionTransformer(marketsInfoData: MarketsInfoData, wrappedToken: Token, tokensData: TokensData): (value: RawTradeAction, index: number, array: RawTradeAction[]) => SwapTradeAction | PositionTradeAction | undefined;
6
+ export declare function createRawTradeActionTransformer(marketsInfoData: MarketsInfoData, wrappedToken: Token, tokensData: TokensData): (value: SubsquidTradeAction, index: number, array: SubsquidTradeAction[]) => SwapTradeAction | PositionTradeAction | undefined;
7
7
  export declare function bigNumberify(n?: bigint | string | null | undefined): bigint | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmx-io/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "main": "./build/cjs/src/index.js",
6
6
  "module": "./build/esm/src/index.js",
@@ -51,9 +51,10 @@
51
51
  "build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > build/cjs/src/package.json",
52
52
  "build:esm": "tsc -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > build/esm/src/package.json",
53
53
  "build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
54
+ "build:subsquid": "./node_modules/@graphql-codegen/cli/cjs/bin.js -c subsquid-codegen.ts",
54
55
  "tscheck": "tsc -p tsconfig.json --noEmit",
55
56
  "clean": "rm -rf build/**/*.tsbuildinfo",
56
- "build": "rm -rf build && yarn build:types && yarn build:cjs && yarn build:esm && yarn clean"
57
+ "build": "rm -rf build && yarn build:subsquid && yarn build:types && yarn build:cjs && yarn build:esm && yarn clean"
57
58
  },
58
59
  "publishConfig": {
59
60
  "access": "public"
@@ -75,6 +76,10 @@
75
76
  },
76
77
  "devDependencies": {
77
78
  "@babel/plugin-proposal-private-property-in-object": "7.21.11",
79
+ "@graphql-codegen/cli": "5.0.6",
80
+ "@graphql-codegen/client-preset": "4.8.1",
81
+ "@graphql-codegen/typescript": "4.1.6",
82
+ "@graphql-codegen/typescript-operations": "4.6.1",
78
83
  "@types/lodash": "4.14.198",
79
84
  "@types/node": "18.7.13",
80
85
  "lint-staged": "12.3.4",