@gmx-io/sdk 1.0.0 → 1.0.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.
- package/README.md +8 -6
- package/build/cjs/src/modules/orders/helpers.js +14 -2
- package/build/cjs/src/modules/orders/helpers.spec.js +24 -1
- package/build/cjs/src/modules/orders/orders.js +2 -2
- package/build/cjs/src/utils/testUtil.js +1 -1
- package/build/esm/src/modules/orders/helpers.js +14 -2
- package/build/esm/src/modules/orders/helpers.spec.js +24 -1
- package/build/esm/src/modules/orders/orders.js +2 -2
- package/build/esm/src/utils/testUtil.js +1 -1
- package/package.json +30 -28
- 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
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ const sdk = new GmxSdk({
|
|
|
18
18
|
rpcUrl: "https://arb1.arbitrum.io/rpc",
|
|
19
19
|
oracleUrl: "https://arbitrum-api.gmxinfra.io",
|
|
20
20
|
walletClient: useWallet().walletClient,
|
|
21
|
-
subsquidUrl: "https://gmx.squids.live/gmx-synthetics-arbitrum:
|
|
21
|
+
subsquidUrl: "https://gmx.squids.live/gmx-synthetics-arbitrum:prod/api/graphql",
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const { marketsInfoData, tokensData } = await sdk.markets.getMarketsInfo();
|
|
@@ -214,17 +214,19 @@ Helpers are a set of functions that help you create orders without manually calc
|
|
|
214
214
|
```typescript
|
|
215
215
|
sdk.orders.long({
|
|
216
216
|
payAmount: 100031302n,
|
|
217
|
-
marketAddress: "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336",
|
|
218
|
-
payTokenAddress:
|
|
219
|
-
collateralTokenAddress:
|
|
217
|
+
marketAddress: "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336", // ETH/USD [WETH-USDC]
|
|
218
|
+
payTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", // WETH
|
|
219
|
+
collateralTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC
|
|
220
220
|
allowedSlippageBps: 125,
|
|
221
221
|
leverage: 50000n,
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
sdk.orders.swap({
|
|
225
225
|
fromAmount: 1000n,
|
|
226
|
-
fromTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
|
|
227
|
-
toTokenAddress: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4",
|
|
226
|
+
fromTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548", // ARB
|
|
227
|
+
toTokenAddress: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4", // LINK
|
|
228
228
|
allowedSlippageBps: 125,
|
|
229
229
|
});
|
|
230
230
|
```
|
|
231
|
+
|
|
232
|
+
Pay attention to the `payTokenAddress` and `collateralTokenAddress` fields. They are the addresses of ERC20 tokens that you are paying for and receiving, respectively, some markets may have synthetic tokens in these fields, so you need to pass the correct address. For instance BTC/USD [WETH-USDC] market has synthetic BTC token in `indexTokenAddress` so you need to pass WBTC address instead of BTC.
|
|
@@ -52,10 +52,16 @@ async function increaseOrderHelper(sdk, params) {
|
|
|
52
52
|
const fromToken = tokensData[params.payTokenAddress];
|
|
53
53
|
const collateralToken = tokensData[params.collateralTokenAddress];
|
|
54
54
|
if (!fromToken) {
|
|
55
|
-
throw new Error("
|
|
55
|
+
throw new Error("payTokenAddress: token is not available");
|
|
56
56
|
}
|
|
57
57
|
if (!collateralToken) {
|
|
58
|
-
throw new Error("
|
|
58
|
+
throw new Error("collateralTokenAddress: token is not available");
|
|
59
|
+
}
|
|
60
|
+
if (fromToken.isSynthetic) {
|
|
61
|
+
throw new Error("payTokenAddress: synthetic tokens are not supported");
|
|
62
|
+
}
|
|
63
|
+
if (collateralToken.isSynthetic) {
|
|
64
|
+
throw new Error("collateralTokenAddress: synthetic tokens are not supported");
|
|
59
65
|
}
|
|
60
66
|
const marketInfo = (0, objects_1.getByKey)(marketsInfoData, params.marketAddress);
|
|
61
67
|
if (!marketInfo) {
|
|
@@ -139,6 +145,12 @@ async function swap(sdk, params) {
|
|
|
139
145
|
if (!fromToken || !toToken) {
|
|
140
146
|
throw new Error("From or to token is not available");
|
|
141
147
|
}
|
|
148
|
+
if (toToken.isSynthetic) {
|
|
149
|
+
throw new Error(`Synthetic tokens are not supported: ${toToken.symbol}`);
|
|
150
|
+
}
|
|
151
|
+
if (fromToken.isSynthetic) {
|
|
152
|
+
throw new Error(`Synthetic tokens are not supported: ${fromToken.symbol}`);
|
|
153
|
+
}
|
|
142
154
|
const isLimit = Boolean(params.triggerPrice);
|
|
143
155
|
if (!fromToken || !toToken) {
|
|
144
156
|
return undefined;
|
|
@@ -66,7 +66,30 @@ const tradeAmounts = __importStar(require("../../utils/trade/amounts"));
|
|
|
66
66
|
const e = await testUtil_1.arbitrumSdk.orders
|
|
67
67
|
.long({
|
|
68
68
|
...mockParams,
|
|
69
|
-
|
|
69
|
+
marketAddress: "0x47c031236e19d024b42f8AE6780E44A573170703",
|
|
70
|
+
collateralTokenAddress: "0xC4da4c24fd591125c3F47b340b6f4f76111883d8",
|
|
71
|
+
})
|
|
72
|
+
.catch((error) => {
|
|
73
|
+
return error.message;
|
|
74
|
+
});
|
|
75
|
+
await (0, vitest_1.expect)(e).toBe("collateralTokenAddress: synthetic tokens are not supported");
|
|
76
|
+
});
|
|
77
|
+
(0, vitest_1.it)("should throw an error if wrong collateral token selected", async () => {
|
|
78
|
+
const e = await testUtil_1.arbitrumSdk.orders
|
|
79
|
+
.long({
|
|
80
|
+
...mockParams,
|
|
81
|
+
collateralTokenAddress: "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A",
|
|
82
|
+
})
|
|
83
|
+
.catch((error) => {
|
|
84
|
+
return error.message;
|
|
85
|
+
});
|
|
86
|
+
await (0, vitest_1.expect)(e).toBe("collateralTokenAddress: token is not available");
|
|
87
|
+
});
|
|
88
|
+
(0, vitest_1.it)("should throw an error if wrong collateral token selected", async () => {
|
|
89
|
+
const e = await testUtil_1.arbitrumSdk.orders
|
|
90
|
+
.long({
|
|
91
|
+
...mockParams,
|
|
92
|
+
collateralTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
|
|
70
93
|
})
|
|
71
94
|
.catch((error) => {
|
|
72
95
|
return error.message;
|
|
@@ -112,8 +112,8 @@ class Orders extends base_1.Module {
|
|
|
112
112
|
account,
|
|
113
113
|
collateralAddress: collateralToken.address,
|
|
114
114
|
}));
|
|
115
|
-
if (collateralToken.address !== marketInfo.
|
|
116
|
-
collateralToken.address !== marketInfo.
|
|
115
|
+
if (collateralToken.address !== marketInfo.longTokenAddress &&
|
|
116
|
+
collateralToken.address !== marketInfo.shortTokenAddress) {
|
|
117
117
|
const availableTokens = marketInfo.isSameCollaterals
|
|
118
118
|
? `long ${marketInfo.longToken.symbol}`
|
|
119
119
|
: `long ${marketInfo.longToken.symbol} and short ${marketInfo.shortToken.symbol}`;
|
|
@@ -17,6 +17,6 @@ exports.arbitrumSdkConfig = {
|
|
|
17
17
|
oracleUrl: "https://arbitrum-api.gmxinfra.io",
|
|
18
18
|
rpcUrl: "https://arb1.arbitrum.io/rpc",
|
|
19
19
|
walletClient: client,
|
|
20
|
-
subsquidUrl: "https://gmx.squids.live/gmx-synthetics-arbitrum
|
|
20
|
+
subsquidUrl: "https://gmx.squids.live/gmx-synthetics-arbitrum:prod/api/graphql",
|
|
21
21
|
};
|
|
22
22
|
exports.arbitrumSdk = new index_1.GmxSdk(exports.arbitrumSdkConfig);
|
|
@@ -49,10 +49,16 @@ export async function increaseOrderHelper(sdk, params) {
|
|
|
49
49
|
const fromToken = tokensData[params.payTokenAddress];
|
|
50
50
|
const collateralToken = tokensData[params.collateralTokenAddress];
|
|
51
51
|
if (!fromToken) {
|
|
52
|
-
throw new Error("
|
|
52
|
+
throw new Error("payTokenAddress: token is not available");
|
|
53
53
|
}
|
|
54
54
|
if (!collateralToken) {
|
|
55
|
-
throw new Error("
|
|
55
|
+
throw new Error("collateralTokenAddress: token is not available");
|
|
56
|
+
}
|
|
57
|
+
if (fromToken.isSynthetic) {
|
|
58
|
+
throw new Error("payTokenAddress: synthetic tokens are not supported");
|
|
59
|
+
}
|
|
60
|
+
if (collateralToken.isSynthetic) {
|
|
61
|
+
throw new Error("collateralTokenAddress: synthetic tokens are not supported");
|
|
56
62
|
}
|
|
57
63
|
const marketInfo = getByKey(marketsInfoData, params.marketAddress);
|
|
58
64
|
if (!marketInfo) {
|
|
@@ -135,6 +141,12 @@ export async function swap(sdk, params) {
|
|
|
135
141
|
if (!fromToken || !toToken) {
|
|
136
142
|
throw new Error("From or to token is not available");
|
|
137
143
|
}
|
|
144
|
+
if (toToken.isSynthetic) {
|
|
145
|
+
throw new Error(`Synthetic tokens are not supported: ${toToken.symbol}`);
|
|
146
|
+
}
|
|
147
|
+
if (fromToken.isSynthetic) {
|
|
148
|
+
throw new Error(`Synthetic tokens are not supported: ${fromToken.symbol}`);
|
|
149
|
+
}
|
|
138
150
|
const isLimit = Boolean(params.triggerPrice);
|
|
139
151
|
if (!fromToken || !toToken) {
|
|
140
152
|
return undefined;
|
|
@@ -41,7 +41,30 @@ describe("increaseOrderHelper", () => {
|
|
|
41
41
|
const e = await arbitrumSdk.orders
|
|
42
42
|
.long({
|
|
43
43
|
...mockParams,
|
|
44
|
-
|
|
44
|
+
marketAddress: "0x47c031236e19d024b42f8AE6780E44A573170703",
|
|
45
|
+
collateralTokenAddress: "0xC4da4c24fd591125c3F47b340b6f4f76111883d8",
|
|
46
|
+
})
|
|
47
|
+
.catch((error) => {
|
|
48
|
+
return error.message;
|
|
49
|
+
});
|
|
50
|
+
await expect(e).toBe("collateralTokenAddress: synthetic tokens are not supported");
|
|
51
|
+
});
|
|
52
|
+
it("should throw an error if wrong collateral token selected", async () => {
|
|
53
|
+
const e = await arbitrumSdk.orders
|
|
54
|
+
.long({
|
|
55
|
+
...mockParams,
|
|
56
|
+
collateralTokenAddress: "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A",
|
|
57
|
+
})
|
|
58
|
+
.catch((error) => {
|
|
59
|
+
return error.message;
|
|
60
|
+
});
|
|
61
|
+
await expect(e).toBe("collateralTokenAddress: token is not available");
|
|
62
|
+
});
|
|
63
|
+
it("should throw an error if wrong collateral token selected", async () => {
|
|
64
|
+
const e = await arbitrumSdk.orders
|
|
65
|
+
.long({
|
|
66
|
+
...mockParams,
|
|
67
|
+
collateralTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
|
|
45
68
|
})
|
|
46
69
|
.catch((error) => {
|
|
47
70
|
return error.message;
|
|
@@ -109,8 +109,8 @@ export class Orders extends Module {
|
|
|
109
109
|
account,
|
|
110
110
|
collateralAddress: collateralToken.address,
|
|
111
111
|
}));
|
|
112
|
-
if (collateralToken.address !== marketInfo.
|
|
113
|
-
collateralToken.address !== marketInfo.
|
|
112
|
+
if (collateralToken.address !== marketInfo.longTokenAddress &&
|
|
113
|
+
collateralToken.address !== marketInfo.shortTokenAddress) {
|
|
114
114
|
const availableTokens = marketInfo.isSameCollaterals
|
|
115
115
|
? `long ${marketInfo.longToken.symbol}`
|
|
116
116
|
: `long ${marketInfo.longToken.symbol} and short ${marketInfo.shortToken.symbol}`;
|
|
@@ -14,6 +14,6 @@ export const arbitrumSdkConfig = {
|
|
|
14
14
|
oracleUrl: "https://arbitrum-api.gmxinfra.io",
|
|
15
15
|
rpcUrl: "https://arb1.arbitrum.io/rpc",
|
|
16
16
|
walletClient: client,
|
|
17
|
-
subsquidUrl: "https://gmx.squids.live/gmx-synthetics-arbitrum
|
|
17
|
+
subsquidUrl: "https://gmx.squids.live/gmx-synthetics-arbitrum:prod/api/graphql",
|
|
18
18
|
};
|
|
19
19
|
export const arbitrumSdk = new GmxSdk(arbitrumSdkConfig);
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmx-io/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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"
|