@clober/v2-sdk 1.0.1 → 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/dist/cjs/views/index.js +2 -1
- package/dist/cjs/views/index.js.map +1 -1
- package/dist/cjs/views/open-order.js +11 -1
- package/dist/cjs/views/open-order.js.map +1 -1
- package/dist/esm/views/index.js +1 -1
- package/dist/esm/views/index.js.map +1 -1
- package/dist/esm/views/open-order.js +10 -1
- package/dist/esm/views/open-order.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/views/index.d.ts +1 -1
- package/dist/types/views/index.d.ts.map +1 -1
- package/dist/types/views/open-order.d.ts +7 -1
- package/dist/types/views/open-order.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/views/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUserNativeVolume = exports.getTopUsersByNativeVolume = exports.getUserDailyVolumes = exports.getProtocolAnalytics = exports.getDailyClosePriceMap = exports.getLatestPriceMap = exports.getStableCurrencies = exports.getCurrencies = exports.getReferenceCurrency = exports.getNativeCurrency = exports.getContractAddresses = exports.getSubgraphBlock = exports.getSubgraphBlockNumber = exports.getFallbackSubgraphEndpoint = exports.getSubgraphEndpoint = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = exports.getLatestSwaps = exports.watchMarketMakingEvents = exports.getLpWrappedERC20Address = exports.getLastAmounts = exports.getStrategyPrice = exports.getUserPoolPositions = exports.getPoolSnapshots = exports.getPoolSnapshot = exports.getPool = exports.watchTakeEvents = exports.parseMakeOrderIdsFromReceipt = exports.getQuoteToken = exports.getMarketSnapshot = exports.getMarketSnapshots = exports.getExpectedInput = exports.getExpectedOutput = exports.getLatestChartLog = exports.getChartLogs = exports.getMarket = void 0;
|
|
3
|
+
exports.getUserNativeVolume = exports.getTopUsersByNativeVolume = exports.getUserDailyVolumes = exports.getProtocolAnalytics = exports.getDailyClosePriceMap = exports.getLatestPriceMap = exports.getStableCurrencies = exports.getCurrencies = exports.getReferenceCurrency = exports.getNativeCurrency = exports.getContractAddresses = exports.getSubgraphBlock = exports.getSubgraphBlockNumber = exports.getFallbackSubgraphEndpoint = exports.getSubgraphEndpoint = exports.getOnChainOpenOrders = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = exports.getLatestSwaps = exports.watchMarketMakingEvents = exports.getLpWrappedERC20Address = exports.getLastAmounts = exports.getStrategyPrice = exports.getUserPoolPositions = exports.getPoolSnapshots = exports.getPoolSnapshot = exports.getPool = exports.watchTakeEvents = exports.parseMakeOrderIdsFromReceipt = exports.getQuoteToken = exports.getMarketSnapshot = exports.getMarketSnapshots = exports.getExpectedInput = exports.getExpectedOutput = exports.getLatestChartLog = exports.getChartLogs = exports.getMarket = void 0;
|
|
4
4
|
var market_1 = require("./market");
|
|
5
5
|
Object.defineProperty(exports, "getMarket", { enumerable: true, get: function () { return market_1.getMarket; } });
|
|
6
6
|
Object.defineProperty(exports, "getChartLogs", { enumerable: true, get: function () { return market_1.getChartLogs; } });
|
|
@@ -28,6 +28,7 @@ Object.defineProperty(exports, "getPriceNeighborhood", { enumerable: true, get:
|
|
|
28
28
|
var open_order_1 = require("./open-order");
|
|
29
29
|
Object.defineProperty(exports, "getOpenOrder", { enumerable: true, get: function () { return open_order_1.getOpenOrder; } });
|
|
30
30
|
Object.defineProperty(exports, "getOpenOrders", { enumerable: true, get: function () { return open_order_1.getOpenOrders; } });
|
|
31
|
+
Object.defineProperty(exports, "getOnChainOpenOrders", { enumerable: true, get: function () { return open_order_1.getOnChainOpenOrders; } });
|
|
31
32
|
var subgraph_1 = require("./subgraph");
|
|
32
33
|
Object.defineProperty(exports, "getSubgraphEndpoint", { enumerable: true, get: function () { return subgraph_1.getSubgraphEndpoint; } });
|
|
33
34
|
Object.defineProperty(exports, "getFallbackSubgraphEndpoint", { enumerable: true, get: function () { return subgraph_1.getFallbackSubgraphEndpoint; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,mCAWiB;AAVf,mGAAA,SAAS,OAAA;AACT,sGAAA,YAAY,OAAA;AACZ,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AACjB,0GAAA,gBAAgB,OAAA;AAChB,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AACjB,uGAAA,aAAa,OAAA;AACb,sHAAA,4BAA4B,OAAA;AAC5B,yGAAA,eAAe,OAAA;AAEjB,+BASe;AARb,+FAAA,OAAO,OAAA;AACP,uGAAA,eAAe,OAAA;AACf,wGAAA,gBAAgB,OAAA;AAChB,4GAAA,oBAAoB,OAAA;AACpB,wGAAA,gBAAgB,OAAA;AAChB,sGAAA,cAAc,OAAA;AACd,gHAAA,wBAAwB,OAAA;AACxB,+GAAA,uBAAuB,OAAA;AAEzB,+BAAuC;AAA9B,sGAAA,cAAc,OAAA;AAEvB,+BAA6C;AAApC,4GAAA,oBAAoB,OAAA;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,mCAWiB;AAVf,mGAAA,SAAS,OAAA;AACT,sGAAA,YAAY,OAAA;AACZ,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AACjB,0GAAA,gBAAgB,OAAA;AAChB,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AACjB,uGAAA,aAAa,OAAA;AACb,sHAAA,4BAA4B,OAAA;AAC5B,yGAAA,eAAe,OAAA;AAEjB,+BASe;AARb,+FAAA,OAAO,OAAA;AACP,uGAAA,eAAe,OAAA;AACf,wGAAA,gBAAgB,OAAA;AAChB,4GAAA,oBAAoB,OAAA;AACpB,wGAAA,gBAAgB,OAAA;AAChB,sGAAA,cAAc,OAAA;AACd,gHAAA,wBAAwB,OAAA;AACxB,+GAAA,uBAAuB,OAAA;AAEzB,+BAAuC;AAA9B,sGAAA,cAAc,OAAA;AAEvB,+BAA6C;AAApC,4GAAA,oBAAoB,OAAA;AAC7B,2CAAgF;AAAvE,0GAAA,YAAY,OAAA;AAAE,2GAAA,aAAa,OAAA;AAAE,kHAAA,oBAAoB,OAAA;AAC1D,uCAKmB;AAJjB,+GAAA,mBAAmB,OAAA;AACnB,uHAAA,2BAA2B,OAAA;AAC3B,kHAAA,sBAAsB,OAAA;AACtB,4GAAA,gBAAgB,OAAA;AAElB,qCAAgD;AAAvC,+GAAA,oBAAoB,OAAA;AAC7B,uCAOmB;AANjB,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AACpB,yGAAA,aAAa,OAAA;AACb,+GAAA,mBAAmB,OAAA;AACnB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA;AAEvB,yCAKoB;AAJlB,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA;AACnB,sHAAA,yBAAyB,OAAA;AACzB,gHAAA,mBAAmB,OAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOpenOrders = exports.getOpenOrder = void 0;
|
|
3
|
+
exports.getOnChainOpenOrders = exports.getOpenOrders = exports.getOpenOrder = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const chain_1 = require("../constants/chain-configs/chain");
|
|
4
6
|
const apis_1 = require("../entities/open-order/apis");
|
|
5
7
|
const getOpenOrder = async ({ chainId, id, }) => {
|
|
6
8
|
return (0, apis_1.fetchOpenOrderByOrderIdFromSubgraph)(chainId, id);
|
|
@@ -10,4 +12,12 @@ const getOpenOrders = async ({ chainId, userAddress, }) => {
|
|
|
10
12
|
return (0, apis_1.fetchOpenOrdersByUserAddressFromSubgraph)(chainId, userAddress);
|
|
11
13
|
};
|
|
12
14
|
exports.getOpenOrders = getOpenOrders;
|
|
15
|
+
const getOnChainOpenOrders = async ({ chainId, orderIds, options, }) => {
|
|
16
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
17
|
+
chain: chain_1.CHAIN_MAP[chainId],
|
|
18
|
+
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
19
|
+
});
|
|
20
|
+
return (0, apis_1.fetchOnChainOrders)(publicClient, chainId, orderIds.map((id) => BigInt(id)), options?.blockTag ?? 'latest');
|
|
21
|
+
};
|
|
22
|
+
exports.getOnChainOpenOrders = getOnChainOpenOrders;
|
|
13
23
|
//# sourceMappingURL=open-order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":";;;AAAA,+BAA+C;AAE/C,4DAAuE;AAEvE,sDAIoC;AAkB7B,MAAM,YAAY,GAAG,KAAK,EAAE,EACjC,OAAO,EACP,EAAE,GAIH,EAAsB,EAAE;IACvB,OAAO,IAAA,0CAAmC,EAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AACzD,CAAC,CAAA;AARY,QAAA,YAAY,gBAQxB;AAgBM,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,OAAO,EACP,WAAW,GAIZ,EAAwB,EAAE;IACzB,OAAO,IAAA,+CAAwC,EAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AACvE,CAAC,CAAA;AARY,QAAA,aAAa,iBAQzB;AAEM,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,OAAO,EACP,QAAQ,EACR,OAAO,GAKR,EAA+B,EAAE;IAChC,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;QACtC,KAAK,EAAE,iBAAS,CAAC,OAAO,CAAC;QACzB,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAA,WAAI,GAAE;KAC3D,CAAC,CAAA;IACF,OAAO,IAAA,yBAAkB,EACvB,YAAY,EACZ,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAChC,OAAO,EAAE,QAAQ,IAAI,QAAQ,CAC9B,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,oBAAoB,wBAmBhC"}
|
package/dist/esm/views/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { getMarket, getChartLogs, getLatestChartLog, getExpectedOutput, getExpec
|
|
|
2
2
|
export { getPool, getPoolSnapshot, getPoolSnapshots, getUserPoolPositions, getStrategyPrice, getLastAmounts, getLpWrappedERC20Address, watchMarketMakingEvents, } from './pool';
|
|
3
3
|
export { getLatestSwaps } from './swap';
|
|
4
4
|
export { getPriceNeighborhood } from './tick';
|
|
5
|
-
export { getOpenOrder, getOpenOrders } from './open-order';
|
|
5
|
+
export { getOpenOrder, getOpenOrders, getOnChainOpenOrders } from './open-order';
|
|
6
6
|
export { getSubgraphEndpoint, getFallbackSubgraphEndpoint, getSubgraphBlockNumber, getSubgraphBlock, } from './subgraph';
|
|
7
7
|
export { getContractAddresses } from './address';
|
|
8
8
|
export { getNativeCurrency, getReferenceCurrency, getCurrencies, getStableCurrencies, getLatestPriceMap, getDailyClosePriceMap, } from './currency';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,4BAA4B,EAC5B,eAAe,GAChB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,4BAA4B,EAC5B,eAAe,GAChB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,aAAa,CAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createPublicClient, http } from 'viem';
|
|
2
|
+
import { CHAIN_MAP } from '../constants/chain-configs/chain';
|
|
3
|
+
import { fetchOnChainOrders, fetchOpenOrderByOrderIdFromSubgraph, fetchOpenOrdersByUserAddressFromSubgraph, } from '../entities/open-order/apis';
|
|
2
4
|
/**
|
|
3
5
|
* Retrieves the open order with the specified ID on the given chain.
|
|
4
6
|
*
|
|
@@ -35,4 +37,11 @@ export const getOpenOrder = async ({ chainId, id, }) => {
|
|
|
35
37
|
export const getOpenOrders = async ({ chainId, userAddress, }) => {
|
|
36
38
|
return fetchOpenOrdersByUserAddressFromSubgraph(chainId, userAddress);
|
|
37
39
|
};
|
|
40
|
+
export const getOnChainOpenOrders = async ({ chainId, orderIds, options, }) => {
|
|
41
|
+
const publicClient = createPublicClient({
|
|
42
|
+
chain: CHAIN_MAP[chainId],
|
|
43
|
+
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
44
|
+
});
|
|
45
|
+
return fetchOnChainOrders(publicClient, chainId, orderIds.map((id) => BigInt(id)), options?.blockTag ?? 'latest');
|
|
46
|
+
};
|
|
38
47
|
//# sourceMappingURL=open-order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE/C,OAAO,EAAa,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,EACL,kBAAkB,EAClB,mCAAmC,EACnC,wCAAwC,GACzC,MAAM,6BAA6B,CAAA;AAGpC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,EACjC,OAAO,EACP,EAAE,GAIH,EAAsB,EAAE;IACvB,OAAO,mCAAmC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AACzD,CAAC,CAAA;AACD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,OAAO,EACP,WAAW,GAIZ,EAAwB,EAAE;IACzB,OAAO,wCAAwC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AACvE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,OAAO,EACP,QAAQ,EACR,OAAO,GAKR,EAA+B,EAAE;IAChC,MAAM,YAAY,GAAG,kBAAkB,CAAC;QACtC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC;QACzB,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;KAC3D,CAAC,CAAA;IACF,OAAO,kBAAkB,CACvB,YAAY,EACZ,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAChC,OAAO,EAAE,QAAQ,IAAI,QAAQ,CAC9B,CAAA;AACH,CAAC,CAAA"}
|