@clober/v2-sdk 1.0.0-rc.56 → 1.0.0-rc.57
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/entities/swap/apis/index.js +48 -0
- package/dist/cjs/entities/swap/apis/index.js.map +1 -0
- package/dist/cjs/entities/swap/types.js +3 -0
- package/dist/cjs/entities/swap/types.js.map +1 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/views/index.js +3 -1
- package/dist/cjs/views/index.js.map +1 -1
- package/dist/cjs/views/trade.js +15 -0
- package/dist/cjs/views/trade.js.map +1 -0
- package/dist/esm/entities/swap/apis/index.js +44 -0
- package/dist/esm/entities/swap/apis/index.js.map +1 -0
- package/dist/esm/entities/swap/types.js +2 -0
- package/dist/esm/entities/swap/types.js.map +1 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/views/index.js +1 -0
- package/dist/esm/views/index.js.map +1 -1
- package/dist/esm/views/trade.js +11 -0
- package/dist/esm/views/trade.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/entities/swap/apis/index.d.ts +5 -0
- package/dist/types/entities/swap/apis/index.d.ts.map +1 -0
- package/dist/types/entities/swap/types.d.ts +12 -0
- package/dist/types/entities/swap/types.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/views/index.d.ts +1 -0
- package/dist/types/views/index.d.ts.map +1 -1
- package/dist/types/views/trade.d.ts +10 -0
- package/dist/types/views/trade.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchLatestTrades = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const subgraph_1 = require("../../../constants/chain-configs/subgraph");
|
|
6
|
+
const apis_1 = require("../../currency/apis");
|
|
7
|
+
const fetchLatestTrades = async (publicClient, chainId, n, useSubgraph) => {
|
|
8
|
+
const { data: { swaps }, } = await subgraph_1.Subgraph.get(chainId, 'getLatestTrades', 'query getLatestTrades($first: Int!) { swaps(first: $first, orderBy: timestamp, orderDirection: desc) { transaction { id gasUsed gasPrice value to from } timestamp inputToken outputToken inputAmount outputAmount amountUSD router } }', {
|
|
9
|
+
first: n,
|
|
10
|
+
});
|
|
11
|
+
const uniqueTokens = [
|
|
12
|
+
...new Set(swaps.flatMap((swap) => [swap.inputToken, swap.outputToken])),
|
|
13
|
+
].map((address) => (0, viem_1.getAddress)(address));
|
|
14
|
+
const currencyMap = await (0, apis_1.fetchCurrencyMap)(publicClient, chainId, uniqueTokens, useSubgraph);
|
|
15
|
+
return swaps
|
|
16
|
+
.map((swap) => {
|
|
17
|
+
return currencyMap[(0, viem_1.getAddress)(swap.inputToken)] &&
|
|
18
|
+
currencyMap[(0, viem_1.getAddress)(swap.outputToken)]
|
|
19
|
+
? {
|
|
20
|
+
transaction: {
|
|
21
|
+
data: '',
|
|
22
|
+
id: swap.transaction.id,
|
|
23
|
+
gas: BigInt(swap.transaction.gasUsed),
|
|
24
|
+
gasPrice: BigInt(swap.transaction.gasPrice),
|
|
25
|
+
value: BigInt(swap.transaction.value),
|
|
26
|
+
to: (0, viem_1.getAddress)(swap.transaction.to),
|
|
27
|
+
from: (0, viem_1.getAddress)(swap.transaction.from),
|
|
28
|
+
},
|
|
29
|
+
timestamp: Number(swap.timestamp),
|
|
30
|
+
currencyIn: {
|
|
31
|
+
currency: currencyMap[(0, viem_1.getAddress)(swap.inputToken)],
|
|
32
|
+
amount: (0, viem_1.formatUnits)(BigInt(swap.inputAmount), currencyMap[(0, viem_1.getAddress)(swap.inputToken)].decimals),
|
|
33
|
+
direction: 'in',
|
|
34
|
+
},
|
|
35
|
+
currencyOut: {
|
|
36
|
+
currency: currencyMap[(0, viem_1.getAddress)(swap.outputToken)],
|
|
37
|
+
amount: (0, viem_1.formatUnits)(BigInt(swap.outputAmount), currencyMap[(0, viem_1.getAddress)(swap.outputToken)].decimals),
|
|
38
|
+
direction: 'out',
|
|
39
|
+
},
|
|
40
|
+
amountUSD: Number(swap.amountUSD),
|
|
41
|
+
router: (0, viem_1.getAddress)(swap.router),
|
|
42
|
+
}
|
|
43
|
+
: null;
|
|
44
|
+
})
|
|
45
|
+
.filter((swap) => swap !== null);
|
|
46
|
+
};
|
|
47
|
+
exports.fetchLatestTrades = fetchLatestTrades;
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/swap/apis/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4D;AAG5D,wEAAoE;AAEpE,8CAAsD;AAoB/C,MAAM,iBAAiB,GAAG,KAAK,EACpC,YAA0B,EAC1B,OAAkB,EAClB,CAAS,EACT,WAAoB,EACH,EAAE;IACnB,MAAM,EACJ,IAAI,EAAE,EAAE,KAAK,EAAE,GAChB,GAAG,MAAM,mBAAQ,CAAC,GAAG,CAKpB,OAAO,EACP,iBAAiB,EACjB,yOAAyO,EACzO;QACE,KAAK,EAAE,CAAC;KACT,CACF,CAAA;IACD,MAAM,YAAY,GAAG;QACnB,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;KACzE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,iBAAU,EAAC,OAAO,CAAC,CAAC,CAAA;IACvC,MAAM,WAAW,GAAG,MAAM,IAAA,uBAAgB,EACxC,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,WAAW,CACZ,CAAA;IAED,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,OAAO,WAAW,CAAC,IAAA,iBAAU,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E,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;gBACjC,MAAM,EAAE,IAAA,iBAAU,EAAC,IAAI,CAAC,MAAM,CAAC;aAChC;YACH,CAAC,CAAC,IAAI,CAAA;IACV,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAe,EAAE,CAAC,IAAI,KAAK,IAAI,CAAW,CAAA;AAC3D,CAAC,CAAA;AAnEY,QAAA,iBAAiB,qBAmE7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/entities/swap/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,0DAA4D;AAAnD,kGAAA,SAAS,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,0DAA4D;AAAnD,kGAAA,SAAS,OAAA;AAkClB,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC7B,uCAAgB,CAAA;IAChB,0CAAmB,CAAA;IACnB,yCAAkB,CAAA;IAClB,yCAAkB,CAAA;IAClB,6CAAsB,CAAA;IACtB,4CAAqB,CAAA;IACrB,qCAAc,CAAA;IACd,sCAAe,CAAA;IACf,uCAAgB,CAAA;IAChB,sCAAe,CAAA;IACf,oCAAa,CAAA;IACb,qCAAc,CAAA;AAChB,CAAC,EAbW,mBAAmB,mCAAnB,mBAAmB,QAa9B"}
|
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.getSubgraphEndpoint = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = exports.getLpWrappedERC20Address = exports.getLastAmounts = exports.getStrategyPrice = exports.getPoolSnapshots = exports.getPoolSnapshot = exports.getPool = 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.getSubgraphEndpoint = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = exports.getLatestTrades = exports.getLpWrappedERC20Address = exports.getLastAmounts = exports.getStrategyPrice = exports.getPoolSnapshots = exports.getPoolSnapshot = exports.getPool = 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; } });
|
|
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "getPoolSnapshots", { enumerable: true, get: func
|
|
|
17
17
|
Object.defineProperty(exports, "getStrategyPrice", { enumerable: true, get: function () { return pool_1.getStrategyPrice; } });
|
|
18
18
|
Object.defineProperty(exports, "getLastAmounts", { enumerable: true, get: function () { return pool_1.getLastAmounts; } });
|
|
19
19
|
Object.defineProperty(exports, "getLpWrappedERC20Address", { enumerable: true, get: function () { return pool_1.getLpWrappedERC20Address; } });
|
|
20
|
+
var trade_1 = require("./trade");
|
|
21
|
+
Object.defineProperty(exports, "getLatestTrades", { enumerable: true, get: function () { return trade_1.getLatestTrades; } });
|
|
20
22
|
var tick_1 = require("./tick");
|
|
21
23
|
Object.defineProperty(exports, "getPriceNeighborhood", { enumerable: true, get: function () { return tick_1.getPriceNeighborhood; } });
|
|
22
24
|
var open_order_1 = require("./open-order");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,mCASiB;AARf,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;AAEf,+BAOe;AANb,+FAAA,OAAO,OAAA;AACP,uGAAA,eAAe,OAAA;AACf,wGAAA,gBAAgB,OAAA;AAChB,wGAAA,gBAAgB,OAAA;AAChB,sGAAA,cAAc,OAAA;AACd,gHAAA,wBAAwB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,mCASiB;AARf,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;AAEf,+BAOe;AANb,+FAAA,OAAO,OAAA;AACP,uGAAA,eAAe,OAAA;AACf,wGAAA,gBAAgB,OAAA;AAChB,wGAAA,gBAAgB,OAAA;AAChB,sGAAA,cAAc,OAAA;AACd,gHAAA,wBAAwB,OAAA;AAE1B,iCAAyC;AAAhC,wGAAA,eAAe,OAAA;AAExB,+BAA6C;AAApC,4GAAA,oBAAoB,OAAA;AAC7B,2CAA0D;AAAjD,0GAAA,YAAY,OAAA;AAAE,2GAAA,aAAa,OAAA;AACpC,uCAImB;AAHjB,+GAAA,mBAAmB,OAAA;AACnB,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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLatestTrades = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const chain_1 = require("../constants/chain-configs/chain");
|
|
6
|
+
const apis_1 = require("../entities/swap/apis");
|
|
7
|
+
const getLatestTrades = async ({ chainId, n, options, }) => {
|
|
8
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
9
|
+
chain: chain_1.CHAIN_MAP[chainId],
|
|
10
|
+
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
11
|
+
});
|
|
12
|
+
return (0, apis_1.fetchLatestTrades)(publicClient, chainId, n, !!(options && options.useSubgraph));
|
|
13
|
+
};
|
|
14
|
+
exports.getLatestTrades = getLatestTrades;
|
|
15
|
+
//# sourceMappingURL=trade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade.js","sourceRoot":"","sources":["../../../src/views/trade.ts"],"names":[],"mappings":";;;AAAA,+BAA+C;AAE/C,4DAAuE;AAEvE,gDAAyD;AAElD,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,OAAO,EACP,CAAC,EACD,OAAO,GAOR,EAAmB,EAAE;IACpB,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,wBAAiB,EACtB,YAAY,EACZ,OAAO,EACP,CAAC,EACD,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,CACnC,CAAA;AACH,CAAC,CAAA;AArBY,QAAA,eAAe,mBAqB3B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { formatUnits, getAddress } from 'viem';
|
|
2
|
+
import { Subgraph } from '../../../constants/chain-configs/subgraph';
|
|
3
|
+
import { fetchCurrencyMap } from '../../currency/apis';
|
|
4
|
+
export const fetchLatestTrades = async (publicClient, chainId, n, useSubgraph) => {
|
|
5
|
+
const { data: { swaps }, } = await Subgraph.get(chainId, 'getLatestTrades', 'query getLatestTrades($first: Int!) { swaps(first: $first, orderBy: timestamp, orderDirection: desc) { transaction { id gasUsed gasPrice value to from } timestamp inputToken outputToken inputAmount outputAmount amountUSD router } }', {
|
|
6
|
+
first: n,
|
|
7
|
+
});
|
|
8
|
+
const uniqueTokens = [
|
|
9
|
+
...new Set(swaps.flatMap((swap) => [swap.inputToken, swap.outputToken])),
|
|
10
|
+
].map((address) => getAddress(address));
|
|
11
|
+
const currencyMap = await fetchCurrencyMap(publicClient, chainId, uniqueTokens, useSubgraph);
|
|
12
|
+
return swaps
|
|
13
|
+
.map((swap) => {
|
|
14
|
+
return currencyMap[getAddress(swap.inputToken)] &&
|
|
15
|
+
currencyMap[getAddress(swap.outputToken)]
|
|
16
|
+
? {
|
|
17
|
+
transaction: {
|
|
18
|
+
data: '',
|
|
19
|
+
id: swap.transaction.id,
|
|
20
|
+
gas: BigInt(swap.transaction.gasUsed),
|
|
21
|
+
gasPrice: BigInt(swap.transaction.gasPrice),
|
|
22
|
+
value: BigInt(swap.transaction.value),
|
|
23
|
+
to: getAddress(swap.transaction.to),
|
|
24
|
+
from: getAddress(swap.transaction.from),
|
|
25
|
+
},
|
|
26
|
+
timestamp: Number(swap.timestamp),
|
|
27
|
+
currencyIn: {
|
|
28
|
+
currency: currencyMap[getAddress(swap.inputToken)],
|
|
29
|
+
amount: formatUnits(BigInt(swap.inputAmount), currencyMap[getAddress(swap.inputToken)].decimals),
|
|
30
|
+
direction: 'in',
|
|
31
|
+
},
|
|
32
|
+
currencyOut: {
|
|
33
|
+
currency: currencyMap[getAddress(swap.outputToken)],
|
|
34
|
+
amount: formatUnits(BigInt(swap.outputAmount), currencyMap[getAddress(swap.outputToken)].decimals),
|
|
35
|
+
direction: 'out',
|
|
36
|
+
},
|
|
37
|
+
amountUSD: Number(swap.amountUSD),
|
|
38
|
+
router: getAddress(swap.router),
|
|
39
|
+
}
|
|
40
|
+
: null;
|
|
41
|
+
})
|
|
42
|
+
.filter((swap) => swap !== null);
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/swap/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAA;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAoBtD,MAAM,CAAC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AC,WAAW,CAAC,IAAI,CAAC;iBACxC;gBACD,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;gBACjC,UAAU,EAAE;oBACV,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAClD,MAAM,EAAE,WAAW,CACjB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EACxB,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAClD;oBACD,SAAS,EAAE,IAAI;iBAChB;gBACD,WAAW,EAAE;oBACX,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACnD,MAAM,EAAE,WAAW,CACjB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EACzB,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CACnD;oBACD,SAAS,EAAE,KAAK;iBACjB;gBACD,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;gBACjC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;aAChC;YACH,CAAC,CAAC,IAAI,CAAA;IACV,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAe,EAAE,CAAC,IAAI,KAAK,IAAI,CAAW,CAAA;AAC3D,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/entities/swap/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAkC5D,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC7B,uCAAgB,CAAA;IAChB,0CAAmB,CAAA;IACnB,yCAAkB,CAAA;IAClB,yCAAkB,CAAA;IAClB,6CAAsB,CAAA;IACtB,4CAAqB,CAAA;IACrB,qCAAc,CAAA;IACd,sCAAe,CAAA;IACf,uCAAgB,CAAA;IAChB,sCAAe,CAAA;IACf,oCAAa,CAAA;IACb,qCAAc,CAAA;AAChB,CAAC,EAbW,mBAAmB,KAAnB,mBAAmB,QAa9B"}
|
package/dist/esm/views/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { getMarket, getChartLogs, getLatestChartLog, getExpectedOutput, getExpectedInput, getMarketSnapshots, getMarketSnapshot, getQuoteToken, } from './market';
|
|
2
2
|
export { getPool, getPoolSnapshot, getPoolSnapshots, getStrategyPrice, getLastAmounts, getLpWrappedERC20Address, } from './pool';
|
|
3
|
+
export { getLatestTrades } from './trade';
|
|
3
4
|
export { getPriceNeighborhood } from './tick';
|
|
4
5
|
export { getOpenOrder, getOpenOrders } from './open-order';
|
|
5
6
|
export { getSubgraphEndpoint, getSubgraphBlockNumber, getSubgraphBlock, } from './subgraph';
|
|
@@ -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,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,wBAAwB,GACzB,MAAM,QAAQ,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,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,wBAAwB,GACzB,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EACL,mBAAmB,EACnB,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createPublicClient, http } from 'viem';
|
|
2
|
+
import { CHAIN_MAP } from '../constants/chain-configs/chain';
|
|
3
|
+
import { fetchLatestTrades } from '../entities/swap/apis';
|
|
4
|
+
export const getLatestTrades = async ({ chainId, n, options, }) => {
|
|
5
|
+
const publicClient = createPublicClient({
|
|
6
|
+
chain: CHAIN_MAP[chainId],
|
|
7
|
+
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
8
|
+
});
|
|
9
|
+
return fetchLatestTrades(publicClient, chainId, n, !!(options && options.useSubgraph));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=trade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade.js","sourceRoot":"","sources":["../../../src/views/trade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE/C,OAAO,EAAa,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,OAAO,EACP,CAAC,EACD,OAAO,GAOR,EAAmB,EAAE;IACpB,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,iBAAiB,CACtB,YAAY,EACZ,OAAO,EACP,CAAC,EACD,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,CACnC,CAAA;AACH,CAAC,CAAA"}
|