@1stdex/first-sdk 1.0.0-rc.3 → 1.0.0-rc.5
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/calls/approval/order.js +25 -21
- package/dist/cjs/calls/approval/order.js.map +1 -1
- package/dist/cjs/calls/index.js +2 -1
- package/dist/cjs/calls/index.js.map +1 -1
- package/dist/cjs/entities/market/apis/index.js +1 -3
- package/dist/cjs/entities/market/apis/index.js.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/views/index.js +1 -2
- package/dist/cjs/views/index.js.map +1 -1
- package/dist/cjs/views/market/index.js +1 -9
- package/dist/cjs/views/market/index.js.map +1 -1
- package/dist/esm/calls/approval/order.js +50 -20
- package/dist/esm/calls/approval/order.js.map +1 -1
- package/dist/esm/calls/index.js +1 -1
- package/dist/esm/calls/index.js.map +1 -1
- package/dist/esm/entities/market/apis/index.js +0 -1
- package/dist/esm/entities/market/apis/index.js.map +1 -1
- package/dist/esm/types/index.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/market/index.js +1 -26
- package/dist/esm/views/market/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/calls/approval/order.d.ts +31 -1
- package/dist/types/calls/approval/order.d.ts.map +1 -1
- package/dist/types/calls/index.d.ts +1 -1
- package/dist/types/calls/index.d.ts.map +1 -1
- package/dist/types/entities/market/apis/index.d.ts +0 -2
- package/dist/types/entities/market/apis/index.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/types/index.d.ts.map +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/market/index.d.ts +0 -24
- package/dist/types/views/market/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/entities/market/apis/price.js +0 -65
- package/dist/cjs/entities/market/apis/price.js.map +0 -1
- package/dist/esm/entities/market/apis/price.js +0 -86
- package/dist/esm/entities/market/apis/price.js.map +0 -1
- package/dist/types/entities/market/apis/price.d.ts +0 -32
- package/dist/types/entities/market/apis/price.d.ts.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setOrderOperatorApproval = void 0;
|
|
3
|
+
exports.approveControllerAsOrderOperator = exports.setOrderOperatorApproval = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const chain_1 = require("../../constants/chain-configs/chain");
|
|
6
6
|
const addresses_1 = require("../../constants/chain-configs/addresses");
|
|
7
|
+
const book_manager_abi_1 = require("../../constants/abis/core/book-manager-abi");
|
|
7
8
|
const setOrderOperatorApproval = async ({ chainId, walletClient, operator, approved, options, }) => {
|
|
8
9
|
if (!walletClient.account) {
|
|
9
10
|
throw new Error('Account is not found');
|
|
@@ -12,34 +13,37 @@ const setOrderOperatorApproval = async ({ chainId, walletClient, operator, appro
|
|
|
12
13
|
chain: chain_1.CHAIN_MAP[chainId],
|
|
13
14
|
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
14
15
|
});
|
|
16
|
+
const currentStatus = await publicClient.readContract({
|
|
17
|
+
address: addresses_1.CONTRACT_ADDRESSES[chainId].BookManager,
|
|
18
|
+
abi: book_manager_abi_1.BOOK_MANAGER_ABI,
|
|
19
|
+
functionName: 'isOrderOperator',
|
|
20
|
+
args: [walletClient.account.address, operator],
|
|
21
|
+
});
|
|
22
|
+
if (currentStatus === approved) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
15
25
|
const { request } = await publicClient.simulateContract({
|
|
16
26
|
account: walletClient.account,
|
|
17
27
|
chain: chain_1.CHAIN_MAP[chainId],
|
|
18
28
|
address: addresses_1.CONTRACT_ADDRESSES[chainId].BookManager,
|
|
19
|
-
abi:
|
|
20
|
-
{
|
|
21
|
-
inputs: [
|
|
22
|
-
{
|
|
23
|
-
internalType: 'address',
|
|
24
|
-
name: 'operator',
|
|
25
|
-
type: 'address',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
internalType: 'bool',
|
|
29
|
-
name: 'approved',
|
|
30
|
-
type: 'bool',
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
name: 'setOrderOperator',
|
|
34
|
-
outputs: [],
|
|
35
|
-
stateMutability: 'nonpayable',
|
|
36
|
-
type: 'function',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
29
|
+
abi: book_manager_abi_1.BOOK_MANAGER_ABI,
|
|
39
30
|
functionName: 'setOrderOperator',
|
|
40
31
|
args: [operator, approved],
|
|
41
32
|
});
|
|
42
33
|
return walletClient.writeContract(request);
|
|
43
34
|
};
|
|
44
35
|
exports.setOrderOperatorApproval = setOrderOperatorApproval;
|
|
36
|
+
const approveControllerAsOrderOperator = async ({ chainId, walletClient, options, }) => {
|
|
37
|
+
const params = {
|
|
38
|
+
chainId,
|
|
39
|
+
walletClient,
|
|
40
|
+
operator: addresses_1.CONTRACT_ADDRESSES[chainId].Controller,
|
|
41
|
+
approved: true,
|
|
42
|
+
};
|
|
43
|
+
if (options) {
|
|
44
|
+
params.options = options;
|
|
45
|
+
}
|
|
46
|
+
return (0, exports.setOrderOperatorApproval)(params);
|
|
47
|
+
};
|
|
48
|
+
exports.approveControllerAsOrderOperator = approveControllerAsOrderOperator;
|
|
45
49
|
//# sourceMappingURL=order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../../src/calls/approval/order.ts"],"names":[],"mappings":";;;AAAA,+BAA8D;AAE9D,+DAA2E;AAE3E,uEAA6E;
|
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../../src/calls/approval/order.ts"],"names":[],"mappings":";;;AAAA,+BAA8D;AAE9D,+DAA2E;AAE3E,uEAA6E;AAC7E,iF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BAAwB,4BA6CnC;AA2BK,MAAM,gCAAgC,GAAG,KAAK,EAAE,EACrD,OAAO,EACP,YAAY,EACZ,OAAO,GAKR,EAAsC,EAAE;IACvC,MAAM,MAAM,GAAmD;QAC7D,OAAO;QACP,YAAY;QACZ,QAAQ,EAAE,8BAAkB,CAAC,OAAO,CAAE,CAAC,UAAU;QACjD,QAAQ,EAAE,IAAI;KACf,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,OAAO,IAAA,gCAAwB,EAAC,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAC;AArBW,QAAA,gCAAgC,oCAqB3C"}
|
package/dist/cjs/calls/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withdrawFromVault = exports.depositToVault = exports.removeVault = exports.setVault = exports.setOrderOperatorApproval = exports.approveAllForMarket = exports.setTokenAllowances = exports.setApprovalOfOpenOrdersForAll = exports.cancelOrders = exports.cancelOrder = exports.claimOrders = exports.claimOrder = exports.marketOrder = exports.limitOrder = exports.placeMarketMakingQuotes = exports.openMarket = void 0;
|
|
3
|
+
exports.withdrawFromVault = exports.depositToVault = exports.removeVault = exports.setVault = exports.approveControllerAsOrderOperator = exports.setOrderOperatorApproval = exports.approveAllForMarket = exports.setTokenAllowances = exports.setApprovalOfOpenOrdersForAll = exports.cancelOrders = exports.cancelOrder = exports.claimOrders = exports.claimOrder = exports.marketOrder = exports.limitOrder = exports.placeMarketMakingQuotes = exports.openMarket = void 0;
|
|
4
4
|
var open_1 = require("./market/open");
|
|
5
5
|
Object.defineProperty(exports, "openMarket", { enumerable: true, get: function () { return open_1.openMarket; } });
|
|
6
6
|
var make_1 = require("./market/make");
|
|
@@ -23,6 +23,7 @@ var market_2 = require("./approval/market");
|
|
|
23
23
|
Object.defineProperty(exports, "approveAllForMarket", { enumerable: true, get: function () { return market_2.approveAllForMarket; } });
|
|
24
24
|
var order_1 = require("./approval/order");
|
|
25
25
|
Object.defineProperty(exports, "setOrderOperatorApproval", { enumerable: true, get: function () { return order_1.setOrderOperatorApproval; } });
|
|
26
|
+
Object.defineProperty(exports, "approveControllerAsOrderOperator", { enumerable: true, get: function () { return order_1.approveControllerAsOrderOperator; } });
|
|
26
27
|
var vault_1 = require("./vault");
|
|
27
28
|
Object.defineProperty(exports, "setVault", { enumerable: true, get: function () { return vault_1.setVault; } });
|
|
28
29
|
Object.defineProperty(exports, "removeVault", { enumerable: true, get: function () { return vault_1.removeVault; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/calls/index.ts"],"names":[],"mappings":";;;AAAA,sCAA2C;AAAlC,kGAAA,UAAU,OAAA;AACnB,sCAAwD;AAA/C,+GAAA,uBAAuB,OAAA;AAChC,wCAA4C;AAAnC,mGAAA,UAAU,OAAA;AACnB,0CAA8C;AAArC,qGAAA,WAAW,OAAA;AACpB,wCAAyD;AAAhD,mGAAA,UAAU,OAAA;AAAE,oGAAA,WAAW,OAAA;AAChC,0CAA4D;AAAnD,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAElC,oDAAsE;AAA7D,2HAAA,6BAA6B,OAAA;AACtC,0CAAsD;AAA7C,2GAAA,kBAAkB,OAAA;AAC3B,4CAAwD;AAA/C,6GAAA,mBAAmB,OAAA;AAC5B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/calls/index.ts"],"names":[],"mappings":";;;AAAA,sCAA2C;AAAlC,kGAAA,UAAU,OAAA;AACnB,sCAAwD;AAA/C,+GAAA,uBAAuB,OAAA;AAChC,wCAA4C;AAAnC,mGAAA,UAAU,OAAA;AACnB,0CAA8C;AAArC,qGAAA,WAAW,OAAA;AACpB,wCAAyD;AAAhD,mGAAA,UAAU,OAAA;AAAE,oGAAA,WAAW,OAAA;AAChC,0CAA4D;AAAnD,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAElC,oDAAsE;AAA7D,2HAAA,6BAA6B,OAAA;AACtC,0CAAsD;AAA7C,2GAAA,kBAAkB,OAAA;AAC3B,4CAAwD;AAA/C,6GAAA,mBAAmB,OAAA;AAC5B,0CAG0B;AAFxB,iHAAA,wBAAwB,OAAA;AACxB,yHAAA,gCAAgC,OAAA;AAGlC,iCAKiB;AAJf,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,uGAAA,cAAc,OAAA;AACd,0GAAA,iBAAiB,OAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fetchMarket = void 0;
|
|
4
4
|
const model_1 = require("../model");
|
|
5
5
|
const market_id_1 = require("../utils/market-id");
|
|
6
6
|
const apis_1 = require("../../currency/apis");
|
|
@@ -30,6 +30,4 @@ async function fetchMarket(publicClient, chainId, tokenAddresses, useSubgraph) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
exports.fetchMarket = fetchMarket;
|
|
33
|
-
var price_1 = require("./price");
|
|
34
|
-
Object.defineProperty(exports, "fetchPrices", { enumerable: true, get: function () { return price_1.fetchPrices; } });
|
|
35
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/market/apis/index.ts"],"names":[],"mappings":";;;AAGA,oCAAuC;AACvC,kDAAiD;AACjD,8CAAuD;AACvD,0CAA4C;AAErC,KAAK,UAAU,WAAW,CAC/B,YAA0B,EAC1B,OAAkB,EAClB,cAA+B,EAC/B,WAAoB;IAEpB,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAA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EAAE,gBAAgB,EAAE,GAAG,IAAA,uBAAW,EAAC,OAAO,EAAE;QACnE,cAAc,CAAC,CAAC,CAAE;QAClB,cAAc,CAAC,CAAC,CAAE;KACnB,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,MAAM,IAAA,uBAAgB,EACxC,YAAY,EACZ,OAAO,EACP,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,EACrC,WAAW,CACZ,CAAC;IACF,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG;QACpC,WAAW,CAAC,iBAAiB,CAAC;QAC9B,WAAW,CAAC,gBAAgB,CAAC;KAC9B,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC3C,IAAA,gBAAS,EAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,CAAC;QAC1E,IAAA,gBAAS,EAAC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC;KAC3E,CAAC,CAAC;IAEH,OAAO,IAAI,mBAAW,CAAC;QACrB,OAAO;QACP,MAAM,EAAE,CAAC,aAAa,EAAE,YAAY,CAAC;QACrC,OAAO;QACP,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAnCD,kCAmCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,0DAA6D;AAApD,kGAAA,SAAS,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,0DAA6D;AAApD,kGAAA,SAAS,OAAA;AAgClB,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,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVault = exports.getReferralSummary = exports.getUserNativeVolume = exports.getTopUsersByNativeVolume = exports.getUserDailyVolumes = exports.getProtocolAnalytics = exports.getDailyClosePriceMap = exports.getLatestPriceMap = exports.getStableCurrencies = exports.getCurrencies = exports.getContractAddresses = exports.getSubgraphBlock = exports.getSubgraphBlockNumber = exports.getSubgraphEndpoint = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = exports.parseMakeOrderIdsFromReceipt = exports.getQuoteToken = exports.getMarketSnapshot = exports.getMarketSnapshots = exports.getExpectedInput = exports.getExpectedOutput = exports.getLatestChartLog = exports.getChartLogs = exports.
|
|
3
|
+
exports.getVault = exports.getReferralSummary = exports.getUserNativeVolume = exports.getTopUsersByNativeVolume = exports.getUserDailyVolumes = exports.getProtocolAnalytics = exports.getDailyClosePriceMap = exports.getLatestPriceMap = exports.getStableCurrencies = exports.getCurrencies = exports.getContractAddresses = exports.getSubgraphBlock = exports.getSubgraphBlockNumber = exports.getSubgraphEndpoint = exports.getOpenOrders = exports.getOpenOrder = exports.getPriceNeighborhood = 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
|
-
Object.defineProperty(exports, "getPrices", { enumerable: true, get: function () { return market_1.getPrices; } });
|
|
7
6
|
Object.defineProperty(exports, "getChartLogs", { enumerable: true, get: function () { return market_1.getChartLogs; } });
|
|
8
7
|
Object.defineProperty(exports, "getLatestChartLog", { enumerable: true, get: function () { return market_1.getLatestChartLog; } });
|
|
9
8
|
Object.defineProperty(exports, "getExpectedOutput", { enumerable: true, get: function () { return market_1.getExpectedOutput; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":";;;AAAA,mCAUkB;AAThB,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;AAG9B,+BAA8C;AAArC,4GAAA,oBAAoB,OAAA;AAC7B,2CAA2D;AAAlD,0GAAA,YAAY,OAAA;AAAE,2GAAA,aAAa,OAAA;AACpC,uCAIoB;AAHlB,+GAAA,mBAAmB,OAAA;AACnB,kHAAA,sBAAsB,OAAA;AACtB,4GAAA,gBAAgB,OAAA;AAElB,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA;AAC7B,uCAKoB;AAJlB,yGAAA,aAAa,OAAA;AACb,+GAAA,mBAAmB,OAAA;AACnB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA;AAEvB,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getMarket = exports.parseMakeOrderIdsFromReceipt = exports.getQuoteToken = exports.getMarketSnapshot = exports.getMarketSnapshots = exports.getLatestChartLog = exports.getChartLogs = exports.getExpectedInput = exports.getExpectedOutput = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const chain_1 = require("../../constants/chain-configs/chain");
|
|
6
6
|
const apis_1 = require("../../entities/market/apis");
|
|
@@ -29,12 +29,4 @@ const getMarket = async ({ chainId, token0, token1, options, }) => {
|
|
|
29
29
|
return market.toJson();
|
|
30
30
|
};
|
|
31
31
|
exports.getMarket = getMarket;
|
|
32
|
-
const getPrices = async ({ chainId, tokenPairs, options, }) => {
|
|
33
|
-
const publicClient = (0, viem_1.createPublicClient)({
|
|
34
|
-
chain: chain_1.CHAIN_MAP[chainId],
|
|
35
|
-
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
36
|
-
});
|
|
37
|
-
return (0, apis_1.fetchPrices)(publicClient, chainId, tokenPairs);
|
|
38
|
-
};
|
|
39
|
-
exports.getPrices = getPrices;
|
|
40
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/market/index.ts"],"names":[],"mappings":";;;AAAA,+BAAgE;AAEhE,+DAA2E;AAE3E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/market/index.ts"],"names":[],"mappings":";;;AAAA,+BAAgE;AAEhE,+DAA2E;AAE3E,qDAAyD;AAEzD,iCAA8D;AAArD,0GAAA,iBAAiB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAC5C,yCAA8D;AAArD,yGAAA,YAAY,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AACxC,uCAAmE;AAA1D,8GAAA,kBAAkB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAC9C,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,iCAAuD;AAA9C,qHAAA,4BAA4B,OAAA;AAmB9B,MAAM,SAAS,GAAG,KAAK,EAAE,EAC9B,OAAO,EACP,MAAM,EACN,MAAM,EACN,OAAO,GAQR,EAAmB,EAAE;IACpB,IAAI,IAAA,qBAAc,EAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IACD,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,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAW,EAC9B,YAAY,EACZ,OAAO,EACP,CAAC,MAAM,EAAE,MAAM,CAAC,EAChB,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,CACnC,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;AACzB,CAAC,CAAC;AA3BW,QAAA,SAAS,aA2BpB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createPublicClient, http } from 'viem';
|
|
2
2
|
import { CHAIN_MAP } from '../../constants/chain-configs/chain';
|
|
3
3
|
import { CONTRACT_ADDRESSES } from '../../constants/chain-configs/addresses';
|
|
4
|
+
import { BOOK_MANAGER_ABI } from '../../constants/abis/core/book-manager-abi';
|
|
4
5
|
/**
|
|
5
6
|
* @dev This function relates with `viem` dependency
|
|
6
7
|
* Sets the order operator approval for the specified operator address on the given chain.
|
|
@@ -37,34 +38,63 @@ export const setOrderOperatorApproval = async ({ chainId, walletClient, operator
|
|
|
37
38
|
chain: CHAIN_MAP[chainId],
|
|
38
39
|
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
39
40
|
});
|
|
41
|
+
// Check current operator status before setting
|
|
42
|
+
const currentStatus = await publicClient.readContract({
|
|
43
|
+
address: CONTRACT_ADDRESSES[chainId].BookManager,
|
|
44
|
+
abi: BOOK_MANAGER_ABI,
|
|
45
|
+
functionName: 'isOrderOperator',
|
|
46
|
+
args: [walletClient.account.address, operator],
|
|
47
|
+
});
|
|
48
|
+
// If the current status matches the desired status, return early
|
|
49
|
+
if (currentStatus === approved) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
40
52
|
// Simulate the contract call first to validate it will succeed
|
|
41
53
|
const { request } = await publicClient.simulateContract({
|
|
42
54
|
account: walletClient.account,
|
|
43
55
|
chain: CHAIN_MAP[chainId],
|
|
44
56
|
address: CONTRACT_ADDRESSES[chainId].BookManager,
|
|
45
|
-
abi:
|
|
46
|
-
{
|
|
47
|
-
inputs: [
|
|
48
|
-
{
|
|
49
|
-
internalType: 'address',
|
|
50
|
-
name: 'operator',
|
|
51
|
-
type: 'address',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
internalType: 'bool',
|
|
55
|
-
name: 'approved',
|
|
56
|
-
type: 'bool',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
name: 'setOrderOperator',
|
|
60
|
-
outputs: [],
|
|
61
|
-
stateMutability: 'nonpayable',
|
|
62
|
-
type: 'function',
|
|
63
|
-
},
|
|
64
|
-
],
|
|
57
|
+
abi: BOOK_MANAGER_ABI,
|
|
65
58
|
functionName: 'setOrderOperator',
|
|
66
59
|
args: [operator, approved],
|
|
67
60
|
});
|
|
68
61
|
return walletClient.writeContract(request);
|
|
69
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* @dev This function relates with `viem` dependency
|
|
65
|
+
* Approves the controller as an order operator for the specified chain.
|
|
66
|
+
* This is a convenience function that delegates to `setOrderOperatorApproval`.
|
|
67
|
+
*
|
|
68
|
+
* @param {CHAIN_IDS} chainId The chain ID.
|
|
69
|
+
* @param {WalletClient} walletClient The wallet client.
|
|
70
|
+
* @param {Object} [options] Optional parameters for setting approval.
|
|
71
|
+
* @param {string} options.rpcUrl The RPC URL to use for executing the transaction.
|
|
72
|
+
* @returns {Promise<`0x${string}`>} Promise resolving to the transaction hash.
|
|
73
|
+
* @example
|
|
74
|
+
* import { approveControllerAsOrderOperator } from '@clober/v2-sdk'
|
|
75
|
+
* import { mnemonicToAccount } from 'viem/accounts'
|
|
76
|
+
*
|
|
77
|
+
* const walletClient = createWalletClient({
|
|
78
|
+
* chain: arbitrumSepolia,
|
|
79
|
+
* account: mnemonicToAccount('legal ...'),
|
|
80
|
+
* transport: http(),
|
|
81
|
+
* })
|
|
82
|
+
*
|
|
83
|
+
* const hash = await approveControllerAsOrderOperator({
|
|
84
|
+
* chainId: 421614,
|
|
85
|
+
* walletClient
|
|
86
|
+
* })
|
|
87
|
+
*/
|
|
88
|
+
export const approveControllerAsOrderOperator = async ({ chainId, walletClient, options, }) => {
|
|
89
|
+
const params = {
|
|
90
|
+
chainId,
|
|
91
|
+
walletClient,
|
|
92
|
+
operator: CONTRACT_ADDRESSES[chainId].Controller,
|
|
93
|
+
approved: true,
|
|
94
|
+
};
|
|
95
|
+
if (options) {
|
|
96
|
+
params.options = options;
|
|
97
|
+
}
|
|
98
|
+
return setOrderOperatorApproval(params);
|
|
99
|
+
};
|
|
70
100
|
//# sourceMappingURL=order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../../src/calls/approval/order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAgB,MAAM,MAAM,CAAC;AAE9D,OAAO,EAAa,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,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OAAO,EAAE,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC;QACtD,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC;QACzB,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAE,CAAC,WAAW;QACjD,GAAG,EAAE,gBAAgB;QACrB,YAAY,EAAE,kBAAkB;QAChC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;KAC3B,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,KAAK,EAAE,EACrD,OAAO,EACP,YAAY,EACZ,OAAO,GAKR,EAAsC,EAAE;IACvC,MAAM,MAAM,GAAmD;QAC7D,OAAO;QACP,YAAY;QACZ,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAE,CAAC,UAAU;QACjD,QAAQ,EAAE,IAAI;KACf,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -7,6 +7,6 @@ export { cancelOrder, cancelOrders } from './market/cancel';
|
|
|
7
7
|
export { setApprovalOfOpenOrdersForAll } from './approval/open-order';
|
|
8
8
|
export { setTokenAllowances } from './approval/token';
|
|
9
9
|
export { approveAllForMarket } from './approval/market';
|
|
10
|
-
export { setOrderOperatorApproval } from './approval/order';
|
|
10
|
+
export { setOrderOperatorApproval, approveControllerAsOrderOperator, } from './approval/order';
|
|
11
11
|
export { setVault, removeVault, depositToVault, withdrawFromVault, } from './vault';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/calls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/calls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,QAAQ,EACR,WAAW,E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EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC;KAC3E,CAAC,CAAC;IAEH,OAAO,IAAI,WAAW,CAAC;QACrB,OAAO;QACP,MAAM,EAAE,CAAC,aAAa,EAAE,YAAY,CAAC;QACrC,OAAO;QACP,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAgC7D,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,4 +1,4 @@
|
|
|
1
|
-
export { getMarket,
|
|
1
|
+
export { getMarket, getChartLogs, getLatestChartLog, getExpectedOutput, getExpectedInput, getMarketSnapshots, getMarketSnapshot, getQuoteToken, parseMakeOrderIdsFromReceipt, } from './market';
|
|
2
2
|
export { getPriceNeighborhood } from './tick';
|
|
3
3
|
export { getOpenOrder, getOpenOrders } from './open-order';
|
|
4
4
|
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,
|
|
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,GAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,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,GACtB,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createPublicClient, http, isAddressEqual } from 'viem';
|
|
2
2
|
import { CHAIN_MAP } from '../../constants/chain-configs/chain';
|
|
3
|
-
import { fetchMarket
|
|
3
|
+
import { fetchMarket } from '../../entities/market/apis';
|
|
4
4
|
export { getExpectedOutput, getExpectedInput } from './quote';
|
|
5
5
|
export { getChartLogs, getLatestChartLog } from './chart-log';
|
|
6
6
|
export { getMarketSnapshots, getMarketSnapshot } from './snapshot';
|
|
@@ -34,29 +34,4 @@ export const getMarket = async ({ chainId, token0, token1, options, }) => {
|
|
|
34
34
|
const market = await fetchMarket(publicClient, chainId, [token0, token1], !!(options && options.useSubgraph));
|
|
35
35
|
return market.toJson();
|
|
36
36
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Get prices for a list of token pairs from bid books
|
|
39
|
-
* @param chainId - chain id from {@link CHAIN_IDS}
|
|
40
|
-
* @param tokenPairs - array of token address pairs
|
|
41
|
-
* @param options {@link DefaultReadContractOptions} options.
|
|
42
|
-
* @returns Array of price results with token pairs and their prices
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* import { getPrices } from '@clober/v2-sdk'
|
|
46
|
-
*
|
|
47
|
-
* const prices = await getPrices({
|
|
48
|
-
* chainId: 421614,
|
|
49
|
-
* tokenPairs: [
|
|
50
|
-
* { token0: '0x...', token1: '0x...' },
|
|
51
|
-
* { token0: '0x...', token1: '0x...' }
|
|
52
|
-
* ]
|
|
53
|
-
* })
|
|
54
|
-
*/
|
|
55
|
-
export const getPrices = async ({ chainId, tokenPairs, options, }) => {
|
|
56
|
-
const publicClient = createPublicClient({
|
|
57
|
-
chain: CHAIN_MAP[chainId],
|
|
58
|
-
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
59
|
-
});
|
|
60
|
-
return fetchPrices(publicClient, chainId, tokenPairs);
|
|
61
|
-
};
|
|
62
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/market/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEhE,OAAO,EAAa,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/market/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEhE,OAAO,EAAa,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B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