@1stdex/first-sdk 1.0.92-beta.5 → 1.0.92-beta.6
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 +6 -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 +17 -0
- 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 +20 -0
- 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.getCrossChainLZWithdrawalStatus = exports.getUserVolumeUSD = exports.getTradeHistory = exports.getOrderPositionValue = exports.getOrder = exports.getTradeInfo = exports.getOrderSetupStatus = exports.needsVaultDeposit = exports.checkTokenAllowances = exports.getRealTokenBalance = exports.getAllBalances = exports.getPortfolioBalance = exports.getTradingBalance = exports.getVault = exports.getReferralSummary = exports.getUserNativeVolume = exports.getTopUsersByNativeVolume = exports.getUserDailyVolumes = exports.getProtocolAnalytics = exports.getLatestPrice = exports.getDailyClosePriceMap = exports.getLatestPriceMap = exports.getStableCurrencies = exports.getCurrencies = exports.getContractAddresses = exports.getSubgraphBlock = exports.getSubgraphBlockNumber = exports.getSubgraphEndpoint = exports.getClaimableOrders = exports.getCancelableOrders = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = exports.getMakeOrderResult = exports.getLimitOrderResult = exports.parseMakeOrderIdsFromReceipt = exports.getQuoteToken = exports.getMarketSnapshot = exports.getMarketSnapshots = exports.getExpectedInput = exports.getExpectedOutput = exports.getLatestChartLog = exports.getChartLogs = exports.getMarket = void 0;
|
|
3
|
+
exports.getCrossChainLZWithdrawalStatus = exports.getUserVolumeUSD = exports.getTradeHistory = exports.getOrderPositionValue = exports.getOrder = exports.getTradeInfo = exports.getOrderSetupStatus = exports.needsVaultDeposit = exports.checkTokenAllowances = exports.getRealTokenBalance = exports.getAllBalances = exports.getPortfolioBalance = exports.getTradingBalance = exports.getVault = exports.getReferralSummary = exports.getUserNativeVolume = exports.getTopUsersByNativeVolume = exports.getUserDailyVolumes = exports.getProtocolAnalytics = exports.getLatestPrice = exports.getDailyClosePriceMap = exports.getLatestPriceMap = exports.getStableCurrencies = exports.getCurrencies = exports.getContractAddresses = exports.getSubgraphBlock = exports.getSubgraphBlockNumber = exports.getSubgraphEndpoint = exports.decodeOrderId = exports.getClaimableOrders = exports.getCancelableOrders = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = exports.getMakeOrderResult = exports.getLimitOrderResult = 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; } });
|
|
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "getOpenOrder", { enumerable: true, get: function
|
|
|
20
20
|
Object.defineProperty(exports, "getOpenOrders", { enumerable: true, get: function () { return open_order_1.getOpenOrders; } });
|
|
21
21
|
Object.defineProperty(exports, "getCancelableOrders", { enumerable: true, get: function () { return open_order_1.getCancelableOrders; } });
|
|
22
22
|
Object.defineProperty(exports, "getClaimableOrders", { enumerable: true, get: function () { return open_order_1.getClaimableOrders; } });
|
|
23
|
+
Object.defineProperty(exports, "decodeOrderId", { enumerable: true, get: function () { return open_order_1.decodeOrderId; } });
|
|
23
24
|
var subgraph_1 = require("./subgraph");
|
|
24
25
|
Object.defineProperty(exports, "getSubgraphEndpoint", { enumerable: true, get: function () { return subgraph_1.getSubgraphEndpoint; } });
|
|
25
26
|
Object.defineProperty(exports, "getSubgraphBlockNumber", { enumerable: true, get: function () { return subgraph_1.getSubgraphBlockNumber; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,mCAYkB;AAXhB,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,6GAAA,mBAAmB,OAAA;AACnB,4GAAA,kBAAkB,OAAA;AAGpB,+BAA8C;AAArC,4GAAA,oBAAoB,OAAA;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,mCAYkB;AAXhB,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,6GAAA,mBAAmB,OAAA;AACnB,4GAAA,kBAAkB,OAAA;AAGpB,+BAA8C;AAArC,4GAAA,oBAAoB,OAAA;AAC7B,2CAMsB;AALpB,0GAAA,YAAY,OAAA;AACZ,2GAAA,aAAa,OAAA;AACb,iHAAA,mBAAmB,OAAA;AACnB,gHAAA,kBAAkB,OAAA;AAClB,2GAAA,aAAa,OAAA;AAEf,uCAIoB;AAHlB,+GAAA,mBAAmB,OAAA;AACnB,kHAAA,sBAAsB,OAAA;AACtB,4GAAA,gBAAgB,OAAA;AAElB,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA;AAC7B,uCAMoB;AALlB,yGAAA,aAAa,OAAA;AACb,+GAAA,mBAAmB,OAAA;AACnB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA;AACrB,0GAAA,cAAc,OAAA;AAEhB,yCAMqB;AALnB,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA;AACnB,sHAAA,yBAAyB,OAAA;AACzB,gHAAA,mBAAmB,OAAA;AACnB,+GAAA,kBAAkB,OAAA;AAEpB,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA;AACjB,qCAKmB;AAJjB,4GAAA,iBAAiB,OAAA;AACjB,8GAAA,mBAAmB,OAAA;AACnB,yGAAA,cAAc,OAAA;AACd,8GAAA,mBAAmB,OAAA;AAErB,iCAIiB;AAHf,6GAAA,oBAAoB,OAAA;AACpB,0GAAA,iBAAiB,OAAA;AACjB,4GAAA,mBAAmB,OAAA;AAErB,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,iCAA0D;AAAjD,iGAAA,QAAQ,OAAA;AAAE,8GAAA,qBAAqB,OAAA;AACxC,iDAAkD;AAAzC,gHAAA,eAAe,OAAA;AACxB,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,2CAA+D;AAAtD,6HAAA,+BAA+B,OAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getClaimableOrders = exports.getCancelableOrders = exports.getOpenOrders = exports.getOpenOrder = void 0;
|
|
3
|
+
exports.decodeOrderId = exports.getClaimableOrders = exports.getCancelableOrders = exports.getOpenOrders = exports.getOpenOrder = void 0;
|
|
4
4
|
const apis_1 = require("../entities/open-order/apis");
|
|
5
|
+
const order_id_1 = require("../entities/open-order/utils/order-id");
|
|
5
6
|
const getOpenOrder = async ({ chainId, id, }) => {
|
|
6
7
|
return (0, apis_1.fetchOpenOrderByOrderIdFromSubgraph)(chainId, id);
|
|
7
8
|
};
|
|
@@ -18,4 +19,8 @@ const getClaimableOrders = async ({ chainId, userAddress, tokenAddresses, }) =>
|
|
|
18
19
|
return (0, apis_1.fetchClaimableOrdersFromSubgraph)(chainId, userAddress, tokenAddresses);
|
|
19
20
|
};
|
|
20
21
|
exports.getClaimableOrders = getClaimableOrders;
|
|
22
|
+
const decodeOrderId = ({ orderId, }) => {
|
|
23
|
+
return (0, order_id_1.fromOrderId)(orderId);
|
|
24
|
+
};
|
|
25
|
+
exports.decodeOrderId = decodeOrderId;
|
|
21
26
|
//# sourceMappingURL=open-order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":";;;AAEA,sDAKqC;
|
|
1
|
+
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":";;;AAEA,sDAKqC;AACrC,oEAAoE;AAiB7D,MAAM,YAAY,GAAG,KAAK,EAAE,EACjC,OAAO,EACP,EAAE,GAIH,EAAsB,EAAE;IACvB,OAAO,IAAA,0CAAmC,EAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB;AAiBK,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,OAAO,EACP,WAAW,EACX,YAAY,GAKb,EAAwB,EAAE;IACzB,OAAO,IAAA,+CAAwC,EAC7C,OAAO,EACP,WAAW,EACX,YAAY,CACb,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,aAAa,iBAcxB;AAkBK,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACxC,OAAO,EACP,WAAW,EACX,cAAc,GAKf,EAAwB,EAAE;IACzB,OAAO,IAAA,qDAA8C,EACnD,OAAO,EACP,WAAW,EACX,cAAc,CACf,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B;AAkBK,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,OAAO,EACP,WAAW,EACX,cAAc,GAKf,EAAwB,EAAE;IACzB,OAAO,IAAA,uCAAgC,EAAC,OAAO,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AAChF,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B;AAeK,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,GAGR,EAIC,EAAE;IACF,OAAO,IAAA,sBAAW,EAAC,OAAO,CAAC,CAAC;AAC9B,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
|
package/dist/esm/views/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getMarket, getChartLogs, getLatestChartLog, getExpectedOutput, getExpectedInput, getMarketSnapshots, getMarketSnapshot, getQuoteToken, parseMakeOrderIdsFromReceipt, getLimitOrderResult, getMakeOrderResult, } from './market';
|
|
2
2
|
export { getPriceNeighborhood } from './tick';
|
|
3
|
-
export { getOpenOrder, getOpenOrders, getCancelableOrders, getClaimableOrders, } from './open-order';
|
|
3
|
+
export { getOpenOrder, getOpenOrders, getCancelableOrders, getClaimableOrders, decodeOrderId, } from './open-order';
|
|
4
4
|
export { getSubgraphEndpoint, getSubgraphBlockNumber, getSubgraphBlock, } from './subgraph';
|
|
5
5
|
export { getContractAddresses } from './address';
|
|
6
6
|
export { getCurrencies, getStableCurrencies, getLatestPriceMap, getDailyClosePriceMap, getLatestPrice, } 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,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,kBAAkB,
|
|
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,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fetchOpenOrderByOrderIdFromSubgraph, fetchOpenOrdersByUserAddressFromSubgraph, fetchCancelableOrdersByUserAddressFromSubgraph, fetchClaimableOrdersFromSubgraph, } from '../entities/open-order/apis';
|
|
2
|
+
import { fromOrderId } from '../entities/open-order/utils/order-id';
|
|
2
3
|
/**
|
|
3
4
|
* Retrieves the open order with the specified ID on the given chain.
|
|
4
5
|
*
|
|
@@ -76,4 +77,20 @@ export const getCancelableOrders = async ({ chainId, userAddress, tokenAddresses
|
|
|
76
77
|
export const getClaimableOrders = async ({ chainId, userAddress, tokenAddresses, }) => {
|
|
77
78
|
return fetchClaimableOrdersFromSubgraph(chainId, userAddress, tokenAddresses);
|
|
78
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Decodes an order ID into its constituent parts: book ID, tick, and index.
|
|
82
|
+
*
|
|
83
|
+
* @param {bigint} orderId The order ID to decode.
|
|
84
|
+
* @returns {{ bookId: bigint; tick: bigint; index: bigint }} Object containing the decoded book ID, tick, and index.
|
|
85
|
+
* @example
|
|
86
|
+
* import { decodeOrderId } from '@1stdex/first-sdk'
|
|
87
|
+
*
|
|
88
|
+
* const decoded = decodeOrderId({
|
|
89
|
+
* orderId: 46223845323662364279893361453861711542636620039907198451770258805035840307200n
|
|
90
|
+
* })
|
|
91
|
+
* // Returns: { bookId: 2503n, tick: 0n, index: 0n }
|
|
92
|
+
*/
|
|
93
|
+
export const decodeOrderId = ({ orderId, }) => {
|
|
94
|
+
return fromOrderId(orderId);
|
|
95
|
+
};
|
|
79
96
|
//# sourceMappingURL=open-order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mCAAmC,EACnC,wCAAwC,EACxC,8CAA8C,EAC9C,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"open-order.js","sourceRoot":"","sources":["../../../src/views/open-order.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mCAAmC,EACnC,wCAAwC,EACxC,8CAA8C,EAC9C,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,EACjC,OAAO,EACP,EAAE,GAIH,EAAsB,EAAE;IACvB,OAAO,mCAAmC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AACF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,OAAO,EACP,WAAW,EACX,YAAY,GAKb,EAAwB,EAAE;IACzB,OAAO,wCAAwC,CAC7C,OAAO,EACP,WAAW,EACX,YAAY,CACb,CAAC;AACJ,CAAC,CAAC;AACF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACxC,OAAO,EACP,WAAW,EACX,cAAc,GAKf,EAAwB,EAAE;IACzB,OAAO,8CAA8C,CACnD,OAAO,EACP,WAAW,EACX,cAAc,CACf,CAAC;AACJ,CAAC,CAAC;AACF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,OAAO,EACP,WAAW,EACX,cAAc,GAKf,EAAwB,EAAE;IACzB,OAAO,gCAAgC,CAAC,OAAO,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AAChF,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,GAGR,EAIC,EAAE;IACF,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|