@gmx-io/sdk 1.0.0-alpha.3 → 1.0.1
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/build/cjs/src/modules/orders/helpers.js +6 -0
- package/build/esm/src/modules/orders/helpers.js +6 -0
- package/package.json +31 -30
- package/build/cjs/tsconfig.cjs.tsbuildinfo +0 -1
- package/build/esm/tsconfig.esm.tsbuildinfo +0 -1
- /package/build/{scripts → types/scripts}/prebuild/index.d.ts +0 -0
- /package/build/{scripts → types/scripts}/prebuild/prebuildKinkModelMarketRatesKeys.d.ts +0 -0
- /package/build/{scripts → types/scripts}/prebuild/prebuildMarketConfigKeys.d.ts +0 -0
- /package/build/{scripts → types/scripts}/prebuild/prebuildMarketValuesKeys.d.ts +0 -0
- /package/build/{src → types/src}/abis/index.d.ts +0 -0
- /package/build/{src → types/src}/configs/__tests__/markets.spec.d.ts +0 -0
- /package/build/{src → types/src}/configs/__tests__/tokens.spec.d.ts +0 -0
- /package/build/{src → types/src}/configs/batch.d.ts +0 -0
- /package/build/{src → types/src}/configs/chains.d.ts +0 -0
- /package/build/{src → types/src}/configs/contracts.d.ts +0 -0
- /package/build/{src → types/src}/configs/dataStore.d.ts +0 -0
- /package/build/{src → types/src}/configs/factors.d.ts +0 -0
- /package/build/{src → types/src}/configs/markets.d.ts +0 -0
- /package/build/{src → types/src}/configs/oracleKeeper.d.ts +0 -0
- /package/build/{src → types/src}/configs/tokens.d.ts +0 -0
- /package/build/{src → types/src}/index.d.ts +0 -0
- /package/build/{src → types/src}/modules/accounts/accounts.d.ts +0 -0
- /package/build/{src → types/src}/modules/accounts/accounts.spec.d.ts +0 -0
- /package/build/{src → types/src}/modules/base.d.ts +0 -0
- /package/build/{src → types/src}/modules/markets/index.d.ts +0 -0
- /package/build/{src → types/src}/modules/markets/markets.spec.d.ts +0 -0
- /package/build/{src → types/src}/modules/markets/query-builders.d.ts +0 -0
- /package/build/{src → types/src}/modules/markets/types.d.ts +0 -0
- /package/build/{src → types/src}/modules/oracle.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/helpers.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/helpers.spec.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/orders.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/orders.spec.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/transactions/cancelOrdersTxn.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/transactions/createDecreaseOrderTxn.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/transactions/createIncreaseOrderTxn.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/transactions/createSwapOrderTxn.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/transactions/createWrapOrUnwrapTxn.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/transactions/updateOrderTxn.d.ts +0 -0
- /package/build/{src → types/src}/modules/orders/utils.d.ts +0 -0
- /package/build/{src → types/src}/modules/positions/positions.d.ts +0 -0
- /package/build/{src → types/src}/modules/positions/positions.spec.d.ts +0 -0
- /package/build/{src → types/src}/modules/tokens/tokens.d.ts +0 -0
- /package/build/{src → types/src}/modules/tokens/tokens.spec.d.ts +0 -0
- /package/build/{src → types/src}/modules/trades/trades.d.ts +0 -0
- /package/build/{src → types/src}/modules/trades/trades.spec.d.ts +0 -0
- /package/build/{src → types/src}/modules/utils/utils.d.ts +0 -0
- /package/build/{src → types/src}/prebuilt/index.d.ts +0 -0
- /package/build/{src → types/src}/test/mock.d.ts +0 -0
- /package/build/{src → types/src}/types/common.d.ts +0 -0
- /package/build/{src → types/src}/types/fees.d.ts +0 -0
- /package/build/{src → types/src}/types/markets.d.ts +0 -0
- /package/build/{src → types/src}/types/orders.d.ts +0 -0
- /package/build/{src → types/src}/types/positions.d.ts +0 -0
- /package/build/{src → types/src}/types/referrals.d.ts +0 -0
- /package/build/{src → types/src}/types/sdk.d.ts +0 -0
- /package/build/{src → types/src}/types/sidecarOrders.d.ts +0 -0
- /package/build/{src → types/src}/types/tokens.d.ts +0 -0
- /package/build/{src → types/src}/types/trade.d.ts +0 -0
- /package/build/{src → types/src}/types/tradeHistory.d.ts +0 -0
- /package/build/{src → types/src}/utils/LruCache.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/LruCache.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/bigmath.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/fees.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/hash.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/markets.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/numbers.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/objects.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/positions.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/prices.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/referrals.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/subgraph.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/tokens.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/__tests__/trade.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/bigmath.d.ts +0 -0
- /package/build/{src → types/src}/utils/buildUrl.d.ts +0 -0
- /package/build/{src → types/src}/utils/callContract.d.ts +0 -0
- /package/build/{src → types/src}/utils/common.d.ts +0 -0
- /package/build/{src → types/src}/utils/contracts.d.ts +0 -0
- /package/build/{src → types/src}/utils/fees/estimateOraclePriceCount.d.ts +0 -0
- /package/build/{src → types/src}/utils/fees/executionFee.d.ts +0 -0
- /package/build/{src → types/src}/utils/fees/executionFee.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/fees/getNaiveEstimatedGasBySwapCount.d.ts +0 -0
- /package/build/{src → types/src}/utils/fees/index.d.ts +0 -0
- /package/build/{src → types/src}/utils/fees/priceImpact.d.ts +0 -0
- /package/build/{src → types/src}/utils/graphqlFetcher.d.ts +0 -0
- /package/build/{src → types/src}/utils/hash.d.ts +0 -0
- /package/build/{src → types/src}/utils/marketKeysAndConfigs.d.ts +0 -0
- /package/build/{src → types/src}/utils/markets.d.ts +0 -0
- /package/build/{src → types/src}/utils/multicall.d.ts +0 -0
- /package/build/{src → types/src}/utils/numbers.d.ts +0 -0
- /package/build/{src → types/src}/utils/objects.d.ts +0 -0
- /package/build/{src → types/src}/utils/orders.d.ts +0 -0
- /package/build/{src → types/src}/utils/positions.d.ts +0 -0
- /package/build/{src → types/src}/utils/prices.d.ts +0 -0
- /package/build/{src → types/src}/utils/referrals.d.ts +0 -0
- /package/build/{src → types/src}/utils/simulateExecuteOrder.d.ts +0 -0
- /package/build/{src → types/src}/utils/subgraph.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/__tests__/buildMarketsAdjacencyGraph.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/__tests__/findReachableTokens.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/__tests__/mockRouting.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/__tests__/swapRouting.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/__tests__/swapStats.spec.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/buildMarketsAdjacencyGraph.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/constants.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/findReachableTokens.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/findSwapPathsBetweenTokens.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/index.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/preparedSwapData.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/swapPath.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/swapRouting.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/swapStats.d.ts +0 -0
- /package/build/{src → types/src}/utils/swap/swapValues.d.ts +0 -0
- /package/build/{src → types/src}/utils/testUtil.d.ts +0 -0
- /package/build/{src → types/src}/utils/tokens.d.ts +0 -0
- /package/build/{src → types/src}/utils/trade/amounts.d.ts +0 -0
- /package/build/{src → types/src}/utils/trade/index.d.ts +0 -0
- /package/build/{src → types/src}/utils/trade/trade.d.ts +0 -0
- /package/build/{src → types/src}/utils/tradeHistory.d.ts +0 -0
|
@@ -139,6 +139,12 @@ async function swap(sdk, params) {
|
|
|
139
139
|
if (!fromToken || !toToken) {
|
|
140
140
|
throw new Error("From or to token is not available");
|
|
141
141
|
}
|
|
142
|
+
if (toToken.isSynthetic) {
|
|
143
|
+
throw new Error(`Synthetic tokens are not supported: ${toToken.symbol}`);
|
|
144
|
+
}
|
|
145
|
+
if (fromToken.isSynthetic) {
|
|
146
|
+
throw new Error(`Synthetic tokens are not supported: ${fromToken.symbol}`);
|
|
147
|
+
}
|
|
142
148
|
const isLimit = Boolean(params.triggerPrice);
|
|
143
149
|
if (!fromToken || !toToken) {
|
|
144
150
|
return undefined;
|
|
@@ -135,6 +135,12 @@ export async function swap(sdk, params) {
|
|
|
135
135
|
if (!fromToken || !toToken) {
|
|
136
136
|
throw new Error("From or to token is not available");
|
|
137
137
|
}
|
|
138
|
+
if (toToken.isSynthetic) {
|
|
139
|
+
throw new Error(`Synthetic tokens are not supported: ${toToken.symbol}`);
|
|
140
|
+
}
|
|
141
|
+
if (fromToken.isSynthetic) {
|
|
142
|
+
throw new Error(`Synthetic tokens are not supported: ${fromToken.symbol}`);
|
|
143
|
+
}
|
|
138
144
|
const isLimit = Boolean(params.triggerPrice);
|
|
139
145
|
if (!fromToken || !toToken) {
|
|
140
146
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmx-io/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./build/cjs/src/index.js",
|
|
6
6
|
"module": "./build/esm/src/index.js",
|
|
7
|
-
"types": "./build/src/index.d.ts",
|
|
7
|
+
"types": "./build/types/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./build/esm/src/index.js",
|
|
11
11
|
"require": "./build/cjs/src/index.js",
|
|
12
|
-
"types": "./build/src/index.d.ts",
|
|
12
|
+
"types": "./build/types/src/index.d.ts",
|
|
13
13
|
"default": "./build/cjs/src/index.js"
|
|
14
14
|
},
|
|
15
|
+
"./configs/*": {
|
|
16
|
+
"import": "./build/esm/src/configs/*.js",
|
|
17
|
+
"require": "./build/cjs/src/configs/*.js",
|
|
18
|
+
"types": "./build/types/src/configs/*.d.ts",
|
|
19
|
+
"default": "./build/cjs/src/configs/*.js"
|
|
20
|
+
},
|
|
15
21
|
"./abis/*": {
|
|
16
|
-
"import": "./build/esm/src/abis
|
|
17
|
-
"require": "./build/cjs/src/abis
|
|
18
|
-
"types": "./build/src/abis
|
|
19
|
-
"default": "./build/cjs/src/abis
|
|
22
|
+
"import": "./build/esm/src/abis/*.js",
|
|
23
|
+
"require": "./build/cjs/src/abis/*.js",
|
|
24
|
+
"types": "./build/types/src/abis/*.d.ts",
|
|
25
|
+
"default": "./build/cjs/src/abis/*.js"
|
|
20
26
|
},
|
|
21
27
|
"./prebuilt/*": {
|
|
22
|
-
"import": "./build/esm/src/prebuilt
|
|
23
|
-
"require": "./build/cjs/src/prebuilt
|
|
24
|
-
"types": "./build/src/prebuilt
|
|
25
|
-
"default": "./build/cjs/src/prebuilt
|
|
28
|
+
"import": "./build/esm/src/prebuilt/*.js",
|
|
29
|
+
"require": "./build/cjs/src/prebuilt/*.js",
|
|
30
|
+
"types": "./build/types/src/prebuilt/*.d.ts",
|
|
31
|
+
"default": "./build/cjs/src/prebuilt/*.js"
|
|
26
32
|
},
|
|
27
33
|
"./utils/*": {
|
|
28
|
-
"import": "./build/esm/src/utils
|
|
29
|
-
"require": "./build/cjs/src/utils
|
|
30
|
-
"types": "./build/src/utils
|
|
31
|
-
"default": "./build/cjs/src/utils
|
|
34
|
+
"import": "./build/esm/src/utils/*.js",
|
|
35
|
+
"require": "./build/cjs/src/utils/*.js",
|
|
36
|
+
"types": "./build/types/src/utils/*.d.ts",
|
|
37
|
+
"default": "./build/cjs/src/utils/*.js"
|
|
32
38
|
},
|
|
33
39
|
"./types/*": {
|
|
34
|
-
"import": "./build/esm/src/types
|
|
35
|
-
"require": "./build/cjs/src/types
|
|
36
|
-
"types": "./build/src/types
|
|
37
|
-
"default": "./build/cjs/src/types
|
|
38
|
-
},
|
|
39
|
-
"./configs/*": {
|
|
40
|
-
"import": "./build/esm/src/configs/*",
|
|
41
|
-
"require": "./build/cjs/src/configs/*",
|
|
42
|
-
"types": "./build/src/configs/*",
|
|
43
|
-
"default": "./build/cjs/src/configs/*"
|
|
40
|
+
"import": "./build/esm/src/types/*.js",
|
|
41
|
+
"require": "./build/cjs/src/types/*.js",
|
|
42
|
+
"types": "./build/types/src/types/*.d.ts",
|
|
43
|
+
"default": "./build/cjs/src/types/*.js"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
@@ -48,10 +48,12 @@
|
|
|
48
48
|
"prepare": "ts-patch install -s",
|
|
49
49
|
"test": "vitest",
|
|
50
50
|
"test:ci": "vitest run",
|
|
51
|
-
"build:cjs": "tsc -p tsconfig.cjs.json
|
|
52
|
-
"build:esm": "tsc -p tsconfig.esm.json
|
|
51
|
+
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > build/cjs/src/package.json",
|
|
52
|
+
"build:esm": "tsc -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > build/esm/src/package.json",
|
|
53
|
+
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
53
54
|
"tscheck": "tsc -p tsconfig.json --noEmit",
|
|
54
|
-
"
|
|
55
|
+
"clean": "rm -rf build/**/*.tsbuildinfo",
|
|
56
|
+
"build": "rm -rf build && yarn build:types && yarn build:cjs && yarn build:esm && yarn clean"
|
|
55
57
|
},
|
|
56
58
|
"publishConfig": {
|
|
57
59
|
"access": "public"
|
|
@@ -82,6 +84,5 @@
|
|
|
82
84
|
"files": [
|
|
83
85
|
"build"
|
|
84
86
|
],
|
|
85
|
-
"packageManager": "yarn@3.1.0"
|
|
86
|
-
"stableVersion": "0.2.0"
|
|
87
|
+
"packageManager": "yarn@3.1.0"
|
|
87
88
|
}
|