@7kprotocol/sdk-ts 3.6.1-beta.1 → 3.6.1-beta.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 +13 -10
- package/dist/bluefin7k-I6ZCDWDN.js +2 -0
- package/dist/bluefin7k-I6ZCDWDN.js.map +1 -0
- package/dist/bluefin7k-TERLUCNL.mjs +2 -0
- package/dist/bluefin7k-TERLUCNL.mjs.map +1 -0
- package/dist/cetus-AU3OMWOY.mjs +2 -0
- package/dist/cetus-AU3OMWOY.mjs.map +1 -0
- package/dist/cetus-SIPX6FYL.js +2 -0
- package/dist/cetus-SIPX6FYL.js.map +1 -0
- package/dist/chunk-ETQEI4QC.mjs +2 -0
- package/dist/chunk-ETQEI4QC.mjs.map +1 -0
- package/dist/chunk-KVGSSW22.js +2 -0
- package/dist/chunk-KVGSSW22.js.map +1 -0
- package/dist/flowx-6M54WFWO.js +2 -0
- package/dist/flowx-6M54WFWO.js.map +1 -0
- package/dist/flowx-OXZZX5FD.mjs +2 -0
- package/dist/flowx-OXZZX5FD.mjs.map +1 -0
- package/dist/index.d.mts +536 -0
- package/dist/index.d.ts +536 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +12 -20
- package/lib/cjs/config/fetchClient.js +0 -12
- package/lib/cjs/constants/_7k.js +0 -20
- package/lib/cjs/constants/apiEndpoints.js +0 -9
- package/lib/cjs/constants/sui.js +0 -4
- package/lib/cjs/constants/tokens.js +0 -7
- package/lib/cjs/features/limitDca/cancelDcaOrder.js +0 -14
- package/lib/cjs/features/limitDca/cancelLimitOrder.js +0 -14
- package/lib/cjs/features/limitDca/claimExpiredLimitOrder.js +0 -14
- package/lib/cjs/features/limitDca/constants.js +0 -13
- package/lib/cjs/features/limitDca/getClosedDcaOrders.js +0 -23
- package/lib/cjs/features/limitDca/getClosedLimitOrders.js +0 -22
- package/lib/cjs/features/limitDca/getDcaOrderExecutions.js +0 -23
- package/lib/cjs/features/limitDca/getOpenDcaOrders.js +0 -22
- package/lib/cjs/features/limitDca/getOpenLimitOrders.js +0 -22
- package/lib/cjs/features/limitDca/index.js +0 -26
- package/lib/cjs/features/limitDca/placeDcaOrder.js +0 -33
- package/lib/cjs/features/limitDca/placeLimitOrder.js +0 -27
- package/lib/cjs/features/limitDca/types.js +0 -16
- package/lib/cjs/features/metaAg/common.js +0 -103
- package/lib/cjs/features/metaAg/error.js +0 -31
- package/lib/cjs/features/metaAg/index.js +0 -268
- package/lib/cjs/features/metaAg/providers/bluefin7k.js +0 -57
- package/lib/cjs/features/metaAg/providers/cetus.js +0 -59
- package/lib/cjs/features/metaAg/providers/flowx.js +0 -52
- package/lib/cjs/features/metaAg/providers/okx.js +0 -182
- package/lib/cjs/features/prices/index.js +0 -99
- package/lib/cjs/index.js +0 -55
- package/lib/cjs/libs/url.js +0 -17
- package/lib/cjs/types/config/fetchClient.d.ts +0 -2
- package/lib/cjs/types/config/fetchClient.d.ts.map +0 -1
- package/lib/cjs/types/constants/_7k.d.ts +0 -6
- package/lib/cjs/types/constants/_7k.d.ts.map +0 -1
- package/lib/cjs/types/constants/apiEndpoints.d.ts +0 -7
- package/lib/cjs/types/constants/apiEndpoints.d.ts.map +0 -1
- package/lib/cjs/types/constants/sui.d.ts +0 -2
- package/lib/cjs/types/constants/sui.d.ts.map +0 -1
- package/lib/cjs/types/constants/tokens.d.ts +0 -5
- package/lib/cjs/types/constants/tokens.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
- package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
- package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
- package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/constants.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/constants.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/index.d.ts +0 -11
- package/lib/cjs/types/features/limitDca/index.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts +0 -14
- package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts +0 -13
- package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/types.d.ts +0 -98
- package/lib/cjs/types/features/limitDca/types.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/common.d.ts +0 -24
- package/lib/cjs/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/error.d.ts +0 -54
- package/lib/cjs/types/features/metaAg/error.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/index.d.ts +0 -42
- package/lib/cjs/types/features/metaAg/index.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
- package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +0 -11
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +0 -13
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts +0 -21
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts.map +0 -1
- package/lib/cjs/types/features/prices/index.d.ts +0 -18
- package/lib/cjs/types/features/prices/index.d.ts.map +0 -1
- package/lib/cjs/types/index.d.ts +0 -23
- package/lib/cjs/types/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/url.d.ts +0 -2
- package/lib/cjs/types/libs/url.d.ts.map +0 -1
- package/lib/cjs/types/metaAg.js +0 -16
- package/lib/cjs/types/okx.js +0 -6
- package/lib/cjs/types/types/metaAg.d.ts +0 -165
- package/lib/cjs/types/types/metaAg.d.ts.map +0 -1
- package/lib/cjs/types/types/okx.d.ts +0 -206
- package/lib/cjs/types/types/okx.d.ts.map +0 -1
- package/lib/cjs/types/utils/ObjectCache.d.ts +0 -87
- package/lib/cjs/types/utils/ObjectCache.d.ts.map +0 -1
- package/lib/cjs/types/utils/SuiClientUtils.d.ts +0 -15
- package/lib/cjs/types/utils/SuiClientUtils.d.ts.map +0 -1
- package/lib/cjs/types/utils/sui.d.ts +0 -27
- package/lib/cjs/types/utils/sui.d.ts.map +0 -1
- package/lib/cjs/types/utils/swap.d.ts +0 -15
- package/lib/cjs/types/utils/swap.d.ts.map +0 -1
- package/lib/cjs/types/utils/token.d.ts +0 -4
- package/lib/cjs/types/utils/token.d.ts.map +0 -1
- package/lib/cjs/utils/ObjectCache.js +0 -273
- package/lib/cjs/utils/SuiClientUtils.js +0 -50
- package/lib/cjs/utils/sui.js +0 -96
- package/lib/cjs/utils/swap.js +0 -37
- package/lib/cjs/utils/token.js +0 -15
- package/lib/esm/config/fetchClient.js +0 -9
- package/lib/esm/constants/_7k.js +0 -17
- package/lib/esm/constants/apiEndpoints.js +0 -6
- package/lib/esm/constants/sui.js +0 -1
- package/lib/esm/constants/tokens.js +0 -4
- package/lib/esm/features/limitDca/cancelDcaOrder.js +0 -11
- package/lib/esm/features/limitDca/cancelLimitOrder.js +0 -11
- package/lib/esm/features/limitDca/claimExpiredLimitOrder.js +0 -11
- package/lib/esm/features/limitDca/constants.js +0 -10
- package/lib/esm/features/limitDca/getClosedDcaOrders.js +0 -20
- package/lib/esm/features/limitDca/getClosedLimitOrders.js +0 -19
- package/lib/esm/features/limitDca/getDcaOrderExecutions.js +0 -20
- package/lib/esm/features/limitDca/getOpenDcaOrders.js +0 -19
- package/lib/esm/features/limitDca/getOpenLimitOrders.js +0 -19
- package/lib/esm/features/limitDca/index.js +0 -10
- package/lib/esm/features/limitDca/placeDcaOrder.js +0 -30
- package/lib/esm/features/limitDca/placeLimitOrder.js +0 -24
- package/lib/esm/features/limitDca/types.js +0 -13
- package/lib/esm/features/metaAg/common.js +0 -96
- package/lib/esm/features/metaAg/error.js +0 -29
- package/lib/esm/features/metaAg/index.js +0 -234
- package/lib/esm/features/metaAg/providers/bluefin7k.js +0 -55
- package/lib/esm/features/metaAg/providers/cetus.js +0 -57
- package/lib/esm/features/metaAg/providers/flowx.js +0 -51
- package/lib/esm/features/metaAg/providers/okx.js +0 -147
- package/lib/esm/features/prices/index.js +0 -94
- package/lib/esm/index.mjs +0 -31
- package/lib/esm/libs/url.js +0 -14
- package/lib/esm/types/config/fetchClient.d.ts +0 -2
- package/lib/esm/types/config/fetchClient.d.ts.map +0 -1
- package/lib/esm/types/constants/_7k.d.ts +0 -6
- package/lib/esm/types/constants/_7k.d.ts.map +0 -1
- package/lib/esm/types/constants/apiEndpoints.d.ts +0 -7
- package/lib/esm/types/constants/apiEndpoints.d.ts.map +0 -1
- package/lib/esm/types/constants/sui.d.ts +0 -2
- package/lib/esm/types/constants/sui.d.ts.map +0 -1
- package/lib/esm/types/constants/tokens.d.ts +0 -5
- package/lib/esm/types/constants/tokens.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
- package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
- package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
- package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/constants.d.ts +0 -10
- package/lib/esm/types/features/limitDca/constants.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/index.d.ts +0 -11
- package/lib/esm/types/features/limitDca/index.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts +0 -14
- package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts +0 -13
- package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/types.d.ts +0 -98
- package/lib/esm/types/features/limitDca/types.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/common.d.ts +0 -24
- package/lib/esm/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/error.d.ts +0 -54
- package/lib/esm/types/features/metaAg/error.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/index.d.ts +0 -42
- package/lib/esm/types/features/metaAg/index.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
- package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts +0 -11
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts +0 -13
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/okx.d.ts +0 -21
- package/lib/esm/types/features/metaAg/providers/okx.d.ts.map +0 -1
- package/lib/esm/types/features/prices/index.d.ts +0 -18
- package/lib/esm/types/features/prices/index.d.ts.map +0 -1
- package/lib/esm/types/index.d.ts +0 -23
- package/lib/esm/types/index.d.ts.map +0 -1
- package/lib/esm/types/libs/url.d.ts +0 -2
- package/lib/esm/types/libs/url.d.ts.map +0 -1
- package/lib/esm/types/metaAg.js +0 -11
- package/lib/esm/types/okx.js +0 -5
- package/lib/esm/types/types/metaAg.d.ts +0 -165
- package/lib/esm/types/types/metaAg.d.ts.map +0 -1
- package/lib/esm/types/types/okx.d.ts +0 -206
- package/lib/esm/types/types/okx.d.ts.map +0 -1
- package/lib/esm/types/utils/ObjectCache.d.ts +0 -87
- package/lib/esm/types/utils/ObjectCache.d.ts.map +0 -1
- package/lib/esm/types/utils/SuiClientUtils.d.ts +0 -15
- package/lib/esm/types/utils/SuiClientUtils.d.ts.map +0 -1
- package/lib/esm/types/utils/sui.d.ts +0 -27
- package/lib/esm/types/utils/sui.d.ts.map +0 -1
- package/lib/esm/types/utils/swap.d.ts +0 -15
- package/lib/esm/types/utils/swap.d.ts.map +0 -1
- package/lib/esm/types/utils/token.d.ts +0 -4
- package/lib/esm/types/utils/token.d.ts.map +0 -1
- package/lib/esm/utils/ObjectCache.js +0 -250
- package/lib/esm/utils/SuiClientUtils.js +0 -34
- package/lib/esm/utils/sui.js +0 -92
- package/lib/esm/utils/swap.js +0 -33
- package/lib/esm/utils/token.js +0 -10
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowxProvider = void 0;
|
|
4
|
-
const sdk_1 = require("@flowx-finance/sdk");
|
|
5
|
-
const uuid_1 = require("uuid");
|
|
6
|
-
const _7k_1 = require("../../../constants/_7k");
|
|
7
|
-
const metaAg_1 = require("../../../types/metaAg");
|
|
8
|
-
const error_1 = require("../error");
|
|
9
|
-
class FlowxProvider {
|
|
10
|
-
constructor(options, client) {
|
|
11
|
-
this.options = options;
|
|
12
|
-
this.client = client;
|
|
13
|
-
this.kind = metaAg_1.EProvider.FLOWX;
|
|
14
|
-
this.quoter = new sdk_1.AggregatorQuoter("mainnet", options.apiKey);
|
|
15
|
-
}
|
|
16
|
-
async quote(quoteOptions) {
|
|
17
|
-
const quote = await this.quoter.getRoutes({
|
|
18
|
-
amountIn: quoteOptions.amountIn,
|
|
19
|
-
tokenIn: quoteOptions.coinTypeIn,
|
|
20
|
-
tokenOut: quoteOptions.coinTypeOut,
|
|
21
|
-
includeSources: this.options.sources,
|
|
22
|
-
excludePools: this.options.excludePools,
|
|
23
|
-
excludeSources: this.options.excludeSources,
|
|
24
|
-
maxHops: this.options.maxHops,
|
|
25
|
-
splitDistributionPercent: this.options.splitDistributionPercent,
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
id: (0, uuid_1.v4)(),
|
|
29
|
-
provider: metaAg_1.EProvider.FLOWX,
|
|
30
|
-
quote: quote,
|
|
31
|
-
amountIn: quote.amountIn?.toString() ?? "0",
|
|
32
|
-
rawAmountOut: quote.amountOut?.toString() ?? "0",
|
|
33
|
-
amountOut: quote.amountOut?.toString() ?? "0",
|
|
34
|
-
coinTypeIn: quoteOptions.coinTypeIn,
|
|
35
|
-
coinTypeOut: quoteOptions.coinTypeOut,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
async swap(options) {
|
|
39
|
-
error_1.MetaAgError.assert(options.quote.provider === metaAg_1.EProvider.FLOWX, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote: options.quote, expectedProvider: metaAg_1.EProvider.FLOWX });
|
|
40
|
-
const builder = new sdk_1.TradeBuilder("mainnet", options.quote.quote.routes);
|
|
41
|
-
builder.sender(options.signer);
|
|
42
|
-
builder.slippage(10000 * 100);
|
|
43
|
-
builder.commission(new sdk_1.Commission(_7k_1._7K_PARTNER_ADDRESS, options.quote.quote.coinOut, sdk_1.CommissionType.PERCENTAGE, 0, true));
|
|
44
|
-
const res = await builder.build().swap({
|
|
45
|
-
tx: options.tx,
|
|
46
|
-
client: this.client,
|
|
47
|
-
coinIn: options.coinIn,
|
|
48
|
-
});
|
|
49
|
-
return res;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.FlowxProvider = FlowxProvider;
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.simulateOKXSwap = exports.OkxProvider = void 0;
|
|
37
|
-
const transactions_1 = require("@mysten/sui/transactions");
|
|
38
|
-
const utils_1 = require("@mysten/sui/utils");
|
|
39
|
-
const uuid_1 = require("uuid");
|
|
40
|
-
const tokens_1 = require("../../../constants/tokens");
|
|
41
|
-
const metaAg_1 = require("../../../types/metaAg");
|
|
42
|
-
const sui_1 = require("../../../utils/sui");
|
|
43
|
-
const common_1 = require("../common");
|
|
44
|
-
const error_1 = require("../error");
|
|
45
|
-
const API = "https://web3.okx.com";
|
|
46
|
-
const SWAP_PATH = "/api/v6/dex/aggregator/swap";
|
|
47
|
-
const CHAIN_ID = "784";
|
|
48
|
-
const NORMALIZED_SUI_TYPE = (0, utils_1.normalizeStructTag)(tokens_1.SUI_TYPE);
|
|
49
|
-
class OkxProvider {
|
|
50
|
-
constructor(options, metaOptions, client) {
|
|
51
|
-
this.options = options;
|
|
52
|
-
this.metaOptions = metaOptions;
|
|
53
|
-
this.client = client;
|
|
54
|
-
this.kind = metaAg_1.EProvider.OKX;
|
|
55
|
-
}
|
|
56
|
-
async quote({ amountIn, coinTypeIn, coinTypeOut, signer, }) {
|
|
57
|
-
if (!signer || (0, sui_1.isSystemAddress)(signer))
|
|
58
|
-
return null;
|
|
59
|
-
const request = {
|
|
60
|
-
chainIndex: CHAIN_ID,
|
|
61
|
-
amount: amountIn,
|
|
62
|
-
fromTokenAddress: coinTypeIn === NORMALIZED_SUI_TYPE ? tokens_1.SUI_TYPE : coinTypeIn,
|
|
63
|
-
toTokenAddress: coinTypeOut === NORMALIZED_SUI_TYPE ? tokens_1.SUI_TYPE : coinTypeOut,
|
|
64
|
-
slippagePercent: (this.metaOptions.slippageBps / 100).toString(),
|
|
65
|
-
userWalletAddress: signer,
|
|
66
|
-
};
|
|
67
|
-
const queryString = "?" + new URLSearchParams(request).toString();
|
|
68
|
-
const url = `${this.options.api ?? API}${SWAP_PATH}${queryString}`;
|
|
69
|
-
const response = await fetch(url, {
|
|
70
|
-
headers: await getHeaders(this.options, "GET", SWAP_PATH, queryString),
|
|
71
|
-
});
|
|
72
|
-
const quote = (await response.json());
|
|
73
|
-
error_1.MetaAgError.assert(quote.code === "0" && quote.data.length > 0, "No quote found", error_1.MetaAgErrorCode.QUOTE_NOT_FOUND, { provider: this.kind });
|
|
74
|
-
return {
|
|
75
|
-
id: (0, uuid_1.v4)(),
|
|
76
|
-
provider: this.kind,
|
|
77
|
-
coinTypeIn,
|
|
78
|
-
coinTypeOut,
|
|
79
|
-
amountIn,
|
|
80
|
-
amountOut: quote.data[0].routerResult.toTokenAmount,
|
|
81
|
-
rawAmountOut: quote.data[0].routerResult.toTokenAmount,
|
|
82
|
-
quote: quote.data[0],
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
async fastSwap(options) {
|
|
86
|
-
const { quote, signer, signTransaction } = options;
|
|
87
|
-
error_1.MetaAgError.assert(quote.provider === metaAg_1.EProvider.OKX, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: metaAg_1.EProvider.OKX });
|
|
88
|
-
const { tx, coin } = buildTx({ quote, signer });
|
|
89
|
-
tx.add((0, common_1.metaSettle)(quote, coin, this.metaOptions.slippageBps, this.metaOptions.tipBps, this.metaOptions.partner, this.metaOptions.partnerCommissionBps));
|
|
90
|
-
tx.transferObjects([coin], signer);
|
|
91
|
-
const txBytes = await tx.build({ client: this.client });
|
|
92
|
-
const { bytes, signature } = await signTransaction((0, utils_1.toBase64)(txBytes));
|
|
93
|
-
const res = await this.client.executeTransactionBlock({
|
|
94
|
-
signature,
|
|
95
|
-
transactionBlock: bytes,
|
|
96
|
-
});
|
|
97
|
-
return res.digest;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.OkxProvider = OkxProvider;
|
|
101
|
-
async function generateHmacSha256(message, secretKey) {
|
|
102
|
-
const encoder = new TextEncoder();
|
|
103
|
-
const encodeBase64 = (bytes) => {
|
|
104
|
-
if (typeof Buffer !== "undefined") {
|
|
105
|
-
return Buffer.from(bytes).toString("base64");
|
|
106
|
-
}
|
|
107
|
-
let binary = "";
|
|
108
|
-
for (let i = 0; i < bytes.byteLength; i++) {
|
|
109
|
-
binary += String.fromCharCode(bytes[i]);
|
|
110
|
-
}
|
|
111
|
-
if (typeof btoa !== "undefined") {
|
|
112
|
-
return btoa(binary);
|
|
113
|
-
}
|
|
114
|
-
throw new error_1.MetaAgError("Base64 encoder not available in this environment");
|
|
115
|
-
};
|
|
116
|
-
if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
|
|
117
|
-
const key = await globalThis.crypto.subtle.importKey("raw", encoder.encode(secretKey), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
118
|
-
const signature = await globalThis.crypto.subtle.sign("HMAC", key, encoder.encode(message));
|
|
119
|
-
return encodeBase64(new Uint8Array(signature));
|
|
120
|
-
}
|
|
121
|
-
const { createHmac } = await Promise.resolve().then(() => __importStar(require("node:crypto")));
|
|
122
|
-
return createHmac("sha256", secretKey).update(message).digest("base64");
|
|
123
|
-
}
|
|
124
|
-
async function getHeaders(options, method, requestPath, queryString = "") {
|
|
125
|
-
const { apiKey, secretKey, apiPassphrase, projectId } = options;
|
|
126
|
-
if (!apiKey || !secretKey || !apiPassphrase || !projectId) {
|
|
127
|
-
throw new error_1.MetaAgError("Missing required environment variables");
|
|
128
|
-
}
|
|
129
|
-
const timestamp = new Date().toISOString();
|
|
130
|
-
const stringToSign = timestamp + method + requestPath + queryString;
|
|
131
|
-
return {
|
|
132
|
-
"Content-Type": "application/json",
|
|
133
|
-
"OK-ACCESS-KEY": apiKey,
|
|
134
|
-
"OK-ACCESS-SIGN": await generateHmacSha256(stringToSign, secretKey),
|
|
135
|
-
"OK-ACCESS-TIMESTAMP": timestamp,
|
|
136
|
-
"OK-ACCESS-PASSPHRASE": apiPassphrase,
|
|
137
|
-
"OK-ACCESS-PROJECT": projectId,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
const replaceFinalizeCommand = (tx, packageId) => {
|
|
141
|
-
const builder = transactions_1.TransactionDataBuilder.restore(tx.getData());
|
|
142
|
-
const i = builder.commands.findIndex((cmd) => cmd.$kind === "MoveCall" &&
|
|
143
|
-
(0, utils_1.normalizeSuiAddress)(cmd.MoveCall.package) ===
|
|
144
|
-
(0, utils_1.normalizeSuiAddress)(packageId) &&
|
|
145
|
-
cmd.MoveCall.module === "router" &&
|
|
146
|
-
cmd.MoveCall.function === "finalize");
|
|
147
|
-
const cmd = builder.commands[i];
|
|
148
|
-
error_1.MetaAgError.assert(cmd.MoveCall, "OKX: Finalize command not found", error_1.MetaAgErrorCode.OKX_FINALIZE_COMMAND_NOT_FOUND, { packageId });
|
|
149
|
-
builder.replaceCommand(i, transactions_1.Commands.MoveCall({
|
|
150
|
-
package: packageId,
|
|
151
|
-
module: "router",
|
|
152
|
-
function: "finalize_without_transfer",
|
|
153
|
-
typeArguments: cmd.MoveCall.typeArguments,
|
|
154
|
-
arguments: [
|
|
155
|
-
cmd.MoveCall.arguments[0],
|
|
156
|
-
cmd.MoveCall.arguments[5],
|
|
157
|
-
cmd.MoveCall.arguments[6],
|
|
158
|
-
],
|
|
159
|
-
}));
|
|
160
|
-
const tx2 = transactions_1.Transaction.from(builder.build());
|
|
161
|
-
return { tx: tx2, coin: { NestedResult: [i, 0] } };
|
|
162
|
-
};
|
|
163
|
-
const buildTx = (options) => {
|
|
164
|
-
const { quote, signer } = options;
|
|
165
|
-
error_1.MetaAgError.assert(quote.provider === metaAg_1.EProvider.OKX, "Invalid quote", error_1.MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: metaAg_1.EProvider.OKX });
|
|
166
|
-
const tx = transactions_1.Transaction.from(quote.quote.tx.data);
|
|
167
|
-
tx.setSenderIfNotSet(signer);
|
|
168
|
-
const { tx: tx2, coin } = replaceFinalizeCommand(tx, quote.quote.tx.to);
|
|
169
|
-
return { tx: tx2, coin };
|
|
170
|
-
};
|
|
171
|
-
const simulateOKXSwap = async (quote, inspector, simulation, metaOptions) => {
|
|
172
|
-
const { tx, coin } = buildTx({ quote, signer: quote.quote.tx.from });
|
|
173
|
-
tx.add((0, common_1.metaSettle)(quote, coin, 10000, metaOptions.tipBps, metaOptions.partner, metaOptions.partnerCommissionBps));
|
|
174
|
-
tx.transferObjects([coin], quote.quote.tx.from);
|
|
175
|
-
const res = await (0, common_1.simulateSwapTx)(tx, inspector, simulation);
|
|
176
|
-
return {
|
|
177
|
-
id: quote.id,
|
|
178
|
-
provider: quote.provider,
|
|
179
|
-
...res,
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
exports.simulateOKXSwap = simulateOKXSwap;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokenPrice = getTokenPrice;
|
|
4
|
-
exports.getTokenPrices = getTokenPrices;
|
|
5
|
-
exports.getSuiPrice = getSuiPrice;
|
|
6
|
-
const fetchClient_1 = require("../../config/fetchClient");
|
|
7
|
-
const apiEndpoints_1 = require("../../constants/apiEndpoints");
|
|
8
|
-
const tokens_1 = require("../../constants/tokens");
|
|
9
|
-
const token_1 = require("../../utils/token");
|
|
10
|
-
const chunkArray = (array, chunkSize) => {
|
|
11
|
-
const chunks = [];
|
|
12
|
-
for (let i = 0; i < array.length; i += chunkSize) {
|
|
13
|
-
chunks.push(array.slice(i, i + chunkSize));
|
|
14
|
-
}
|
|
15
|
-
return chunks;
|
|
16
|
-
};
|
|
17
|
-
const MAX_TOTAL_IDS = 500;
|
|
18
|
-
const MAX_IDS_PER_REQUEST = 100;
|
|
19
|
-
/**
|
|
20
|
-
* Get the current Unix timestamp as a string
|
|
21
|
-
*/
|
|
22
|
-
function getCurrentTimestamp() {
|
|
23
|
-
return Math.floor(Date.now() / 1000).toString();
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get price for a single token
|
|
27
|
-
* @param id - Token ID (coin type)
|
|
28
|
-
* @returns Token price, or 0 if not found or on error
|
|
29
|
-
*/
|
|
30
|
-
async function getTokenPrice(id) {
|
|
31
|
-
try {
|
|
32
|
-
const normalizedId = (0, token_1.normalizeTokenType)(id);
|
|
33
|
-
const prices = await getTokenPrices([normalizedId]);
|
|
34
|
-
return prices[normalizedId] || 0;
|
|
35
|
-
}
|
|
36
|
-
catch (_) {
|
|
37
|
-
return 0;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Get prices for multiple tokens
|
|
42
|
-
* @param ids - Array of token IDs (coin types)
|
|
43
|
-
* @returns Record mapping token IDs to their prices
|
|
44
|
-
*/
|
|
45
|
-
async function getTokenPrices(ids) {
|
|
46
|
-
try {
|
|
47
|
-
if (ids.length === 0) {
|
|
48
|
-
return {};
|
|
49
|
-
}
|
|
50
|
-
const limitedIds = ids.slice(0, MAX_TOTAL_IDS).map(token_1.normalizeTokenType);
|
|
51
|
-
const idChunks = chunkArray(limitedIds, MAX_IDS_PER_REQUEST);
|
|
52
|
-
const timestamp = getCurrentTimestamp();
|
|
53
|
-
const responses = await Promise.all(idChunks.map(async (chunk) => {
|
|
54
|
-
const requestBody = {
|
|
55
|
-
timestamp,
|
|
56
|
-
token_ids: chunk,
|
|
57
|
-
};
|
|
58
|
-
const response = await (0, fetchClient_1.fetchClient)(`${apiEndpoints_1.API_ENDPOINTS.PRICES}/prices/batch`, {
|
|
59
|
-
method: "POST",
|
|
60
|
-
headers: {
|
|
61
|
-
"Content-Type": "application/json",
|
|
62
|
-
},
|
|
63
|
-
body: JSON.stringify(requestBody),
|
|
64
|
-
});
|
|
65
|
-
if (!response.ok) {
|
|
66
|
-
throw new Error(`Price API returned status ${response.status}`);
|
|
67
|
-
}
|
|
68
|
-
const pricesRes = (await response.json());
|
|
69
|
-
return pricesRes;
|
|
70
|
-
}));
|
|
71
|
-
// Combine all responses into a single record
|
|
72
|
-
const combinedPrices = responses.reduce((acc, priceResponses) => {
|
|
73
|
-
priceResponses.forEach((priceResponse) => {
|
|
74
|
-
acc[priceResponse.token_id] = priceResponse.price;
|
|
75
|
-
});
|
|
76
|
-
return acc;
|
|
77
|
-
}, {});
|
|
78
|
-
// Ensure all requested IDs are in the result (set to 0 if not found)
|
|
79
|
-
const finalPrices = limitedIds.reduce((acc, id) => {
|
|
80
|
-
acc[id] = combinedPrices[id] || 0;
|
|
81
|
-
return acc;
|
|
82
|
-
}, {});
|
|
83
|
-
return finalPrices;
|
|
84
|
-
}
|
|
85
|
-
catch (_) {
|
|
86
|
-
// On error, return 0 for all requested IDs
|
|
87
|
-
return ids.slice(0, MAX_TOTAL_IDS).reduce((acc, id) => {
|
|
88
|
-
acc[(0, token_1.normalizeTokenType)(id)] = 0;
|
|
89
|
-
return acc;
|
|
90
|
-
}, {});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Get the current SUI token price
|
|
95
|
-
* @returns SUI price, or 0 if not found or on error
|
|
96
|
-
*/
|
|
97
|
-
async function getSuiPrice() {
|
|
98
|
-
return await getTokenPrice(tokens_1.SUI_FULL_TYPE);
|
|
99
|
-
}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.placeLimitOrder = exports.placeDcaOrder = exports.getTokenPrices = exports.getTokenPrice = exports.getSuiPrice = exports.getOpenLimitOrders = exports.getOpenDcaOrders = exports.getDcaOrderExecutions = exports.getClosedLimitOrders = exports.getClosedDcaOrders = exports.claimExpiredLimitOrder = exports.cancelLimitOrder = exports.cancelDcaOrder = exports.MetaAg = void 0;
|
|
18
|
-
__exportStar(require("./types/metaAg"), exports);
|
|
19
|
-
const metaAg_1 = require("./features/metaAg");
|
|
20
|
-
Object.defineProperty(exports, "MetaAg", { enumerable: true, get: function () { return metaAg_1.MetaAg; } });
|
|
21
|
-
const prices_1 = require("./features/prices");
|
|
22
|
-
Object.defineProperty(exports, "getSuiPrice", { enumerable: true, get: function () { return prices_1.getSuiPrice; } });
|
|
23
|
-
Object.defineProperty(exports, "getTokenPrice", { enumerable: true, get: function () { return prices_1.getTokenPrice; } });
|
|
24
|
-
Object.defineProperty(exports, "getTokenPrices", { enumerable: true, get: function () { return prices_1.getTokenPrices; } });
|
|
25
|
-
const limitDca_1 = require("./features/limitDca");
|
|
26
|
-
Object.defineProperty(exports, "cancelDcaOrder", { enumerable: true, get: function () { return limitDca_1.cancelDcaOrder; } });
|
|
27
|
-
Object.defineProperty(exports, "cancelLimitOrder", { enumerable: true, get: function () { return limitDca_1.cancelLimitOrder; } });
|
|
28
|
-
Object.defineProperty(exports, "claimExpiredLimitOrder", { enumerable: true, get: function () { return limitDca_1.claimExpiredLimitOrder; } });
|
|
29
|
-
Object.defineProperty(exports, "getClosedDcaOrders", { enumerable: true, get: function () { return limitDca_1.getClosedDcaOrders; } });
|
|
30
|
-
Object.defineProperty(exports, "getClosedLimitOrders", { enumerable: true, get: function () { return limitDca_1.getClosedLimitOrders; } });
|
|
31
|
-
Object.defineProperty(exports, "getDcaOrderExecutions", { enumerable: true, get: function () { return limitDca_1.getDcaOrderExecutions; } });
|
|
32
|
-
Object.defineProperty(exports, "getOpenDcaOrders", { enumerable: true, get: function () { return limitDca_1.getOpenDcaOrders; } });
|
|
33
|
-
Object.defineProperty(exports, "getOpenLimitOrders", { enumerable: true, get: function () { return limitDca_1.getOpenLimitOrders; } });
|
|
34
|
-
Object.defineProperty(exports, "placeDcaOrder", { enumerable: true, get: function () { return limitDca_1.placeDcaOrder; } });
|
|
35
|
-
Object.defineProperty(exports, "placeLimitOrder", { enumerable: true, get: function () { return limitDca_1.placeLimitOrder; } });
|
|
36
|
-
exports.default = {
|
|
37
|
-
// prices
|
|
38
|
-
getTokenPrice: prices_1.getTokenPrice,
|
|
39
|
-
getTokenPrices: prices_1.getTokenPrices,
|
|
40
|
-
getSuiPrice: prices_1.getSuiPrice,
|
|
41
|
-
// limit order
|
|
42
|
-
placeLimitOrder: limitDca_1.placeLimitOrder,
|
|
43
|
-
getOpenLimitOrders: limitDca_1.getOpenLimitOrders,
|
|
44
|
-
cancelLimitOrder: limitDca_1.cancelLimitOrder,
|
|
45
|
-
claimExpiredLimitOrder: limitDca_1.claimExpiredLimitOrder,
|
|
46
|
-
getClosedLimitOrders: limitDca_1.getClosedLimitOrders,
|
|
47
|
-
// dca
|
|
48
|
-
placeDcaOrder: limitDca_1.placeDcaOrder,
|
|
49
|
-
getOpenDcaOrders: limitDca_1.getOpenDcaOrders,
|
|
50
|
-
cancelDcaOrder: limitDca_1.cancelDcaOrder,
|
|
51
|
-
getClosedDcaOrders: limitDca_1.getClosedDcaOrders,
|
|
52
|
-
getDcaOrderExecutions: limitDca_1.getDcaOrderExecutions,
|
|
53
|
-
// Meta aggregator
|
|
54
|
-
MetaAg: metaAg_1.MetaAg,
|
|
55
|
-
};
|
package/lib/cjs/libs/url.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatQueryParams = formatQueryParams;
|
|
4
|
-
function formatQueryParams(params) {
|
|
5
|
-
let str = "";
|
|
6
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
7
|
-
if (Array.isArray(value)) {
|
|
8
|
-
for (const v of value) {
|
|
9
|
-
str += str ? `&${key}=${v}` : `${key}=${v}`;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
else if (value !== undefined) {
|
|
13
|
-
str += str ? `&${key}=${value}` : `${key}=${value}`;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return str;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchClient.d.ts","sourceRoot":"","sources":["../../../../src/config/fetchClient.ts"],"names":[],"mappings":"AAAA,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,QAAQ,CAAC,CAUnB"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const _7K_META_PUBLISHED_AT = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302";
|
|
2
|
-
export declare const _7K_META_PACKAGE_ID = "0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302";
|
|
3
|
-
export declare const _7K_META_VAULT = "0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c";
|
|
4
|
-
export declare const _7K_META_CONFIG = "0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56";
|
|
5
|
-
export declare const _7K_PARTNER_ADDRESS = "0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5";
|
|
6
|
-
//# sourceMappingURL=_7k.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_7k.d.ts","sourceRoot":"","sources":["../../../../src/constants/_7k.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,qBAAqB,uEACoC,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC;AACvE,eAAO,MAAM,cAAc,uEAC2C,CAAC;AACvE,eAAO,MAAM,eAAe,uEAC0C,CAAC;AACvE,eAAO,MAAM,mBAAmB,uEACsC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiEndpoints.d.ts","sourceRoot":"","sources":["../../../../src/constants/apiEndpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;CAKzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/constants/sui.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,uEACyC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const SUI_TYPE = "0x2::sui::SUI";
|
|
2
|
-
export declare const SUI_FULL_TYPE = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
|
|
3
|
-
export declare const USDC_TOKEN_TYPE = "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN";
|
|
4
|
-
export declare const NATIVE_USDC_TOKEN_TYPE = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
5
|
-
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/constants/tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AAExC,eAAO,MAAM,aAAa,iFACsD,CAAC;AAEjF,eAAO,MAAM,eAAe,mFACsD,CAAC;AAEnF,eAAO,MAAM,sBAAsB,mFAC+C,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
interface CancelDcaOrderParams {
|
|
3
|
-
orderId: string;
|
|
4
|
-
payCoinType: string;
|
|
5
|
-
targetCoinType: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function cancelDcaOrder({ orderId, payCoinType, targetCoinType, }: CancelDcaOrderParams): Promise<Transaction>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=cancelDcaOrder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cancelDcaOrder.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/cancelDcaOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,WAAW,EACX,cAAc,GACf,EAAE,oBAAoB,wBAUtB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
interface CancelLimitOrderParams {
|
|
3
|
-
orderId: string;
|
|
4
|
-
payCoinType: string;
|
|
5
|
-
targetCoinType: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function cancelLimitOrder({ orderId, payCoinType, targetCoinType, }: CancelLimitOrderParams): Promise<Transaction>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=cancelLimitOrder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cancelLimitOrder.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/cancelLimitOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,gBAAgB,CAAC,EACrC,OAAO,EACP,WAAW,EACX,cAAc,GACf,EAAE,sBAAsB,wBAUxB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
interface ClaimExpiredLimitOrderParams {
|
|
3
|
-
orderId: string;
|
|
4
|
-
payCoinType: string;
|
|
5
|
-
targetCoinType: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function claimExpiredLimitOrder({ orderId, payCoinType, targetCoinType, }: ClaimExpiredLimitOrderParams): Promise<Transaction>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=claimExpiredLimitOrder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claimExpiredLimitOrder.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/claimExpiredLimitOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,UAAU,4BAA4B;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,sBAAsB,CAAC,EAC3C,OAAO,EACP,WAAW,EACX,cAAc,GACf,EAAE,4BAA4B,wBAU9B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const GLOBAL_CONFIG_ID = "0xffc7f420b481ed7a012b42e125fd7e5716b5673759cf4629e5fcfebce970a72d";
|
|
2
|
-
export declare const RATE_SCALE: bigint;
|
|
3
|
-
export declare const SLIPPAGE_SCALE: bigint;
|
|
4
|
-
export declare const PACKAGE = "0x0ef0f805710cf53c10f29c4f73e1144a662747e1839689a846e2520cae122adc";
|
|
5
|
-
export declare const LIMIT_ORDER_MODULE_ID = "0x0ef0f805710cf53c10f29c4f73e1144a662747e1839689a846e2520cae122adc::limit_order";
|
|
6
|
-
export declare const DCA_ORDER_MODULE_ID = "0x0ef0f805710cf53c10f29c4f73e1144a662747e1839689a846e2520cae122adc::dca_order";
|
|
7
|
-
export declare const CONFIG_MODULE_ID = "0x0ef0f805710cf53c10f29c4f73e1144a662747e1839689a846e2520cae122adc::config";
|
|
8
|
-
export declare const DCA_MAX_RATE: bigint;
|
|
9
|
-
export declare const LO_DCA_API: string;
|
|
10
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,uEACyC,CAAC;AACvE,eAAO,MAAM,UAAU,QAA0B,CAAC;AAClD,eAAO,MAAM,cAAc,QAAkB,CAAC;AAC9C,eAAO,MAAM,OAAO,uEACkD,CAAC;AACvE,eAAO,MAAM,qBAAqB,oFAA4B,CAAC;AAC/D,eAAO,MAAM,mBAAmB,kFAA0B,CAAC;AAC3D,eAAO,MAAM,gBAAgB,+EAAuB,CAAC;AACrD,eAAO,MAAM,YAAY,QAAiC,CAAC;AAC3D,eAAO,MAAM,UAAU,QAAgC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LoDcaOrderExecution } from "./types";
|
|
2
|
-
interface Params {
|
|
3
|
-
owner: string;
|
|
4
|
-
offset: number;
|
|
5
|
-
limit: number;
|
|
6
|
-
tokenPair?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function getClosedDcaOrders({ owner, offset, limit, tokenPair, }: Params): Promise<LoDcaOrderExecution[]>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=getClosedDcaOrders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getClosedDcaOrders.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/getClosedDcaOrders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAoB,MAAM,SAAS,CAAC;AAEhE,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,EACL,MAAU,EACV,KAAU,EACV,SAAS,GACV,EAAE,MAAM,kCAqBR"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LimitOrder } from "./types";
|
|
2
|
-
interface Params {
|
|
3
|
-
owner: string;
|
|
4
|
-
offset: number;
|
|
5
|
-
limit: number;
|
|
6
|
-
tokenPair?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function getClosedLimitOrders({ owner, offset, limit, tokenPair, }: Params): Promise<LimitOrder[]>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=getClosedLimitOrders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getClosedLimitOrders.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/getClosedLimitOrders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAoB,MAAM,SAAS,CAAC;AAEvD,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,oBAAoB,CAAC,EACzC,KAAK,EACL,MAAU,EACV,KAAU,EACV,SAAS,GACV,EAAE,MAAM,yBAkBR"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LoDcaOrderExecution } from "./types";
|
|
2
|
-
interface Params {
|
|
3
|
-
owner: string;
|
|
4
|
-
orderId: string;
|
|
5
|
-
offset: number;
|
|
6
|
-
limit: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function getDcaOrderExecutions({ owner, orderId, offset, limit, }: Params): Promise<LoDcaOrderExecution[]>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=getDcaOrderExecutions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDcaOrderExecutions.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/getDcaOrderExecutions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAoB,MAAM,SAAS,CAAC;AAEhE,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,qBAAqB,CAAC,EAC1C,KAAK,EACL,OAAO,EACP,MAAU,EACV,KAAU,GACX,EAAE,MAAM,kCAqBR"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DcaOrder } from "./types";
|
|
2
|
-
interface Params {
|
|
3
|
-
owner: string;
|
|
4
|
-
offset: number;
|
|
5
|
-
limit: number;
|
|
6
|
-
tokenPair?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function getOpenDcaOrders({ owner, offset, limit, tokenPair, }: Params): Promise<DcaOrder[]>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=getOpenDcaOrders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getOpenDcaOrders.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/getOpenDcaOrders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAoB,MAAM,SAAS,CAAC;AAErD,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,gBAAgB,CAAC,EACrC,KAAK,EACL,MAAU,EACV,KAAU,EACV,SAAS,GACV,EAAE,MAAM,uBAkBR"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LimitOrder } from "./types";
|
|
2
|
-
interface Params {
|
|
3
|
-
owner: string;
|
|
4
|
-
offset: number;
|
|
5
|
-
limit: number;
|
|
6
|
-
tokenPair?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function getOpenLimitOrders({ owner, offset, limit, tokenPair, }: Params): Promise<LimitOrder[]>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=getOpenLimitOrders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getOpenLimitOrders.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/getOpenLimitOrders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAoB,MAAM,SAAS,CAAC;AAEvD,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,EACL,MAAU,EACV,KAAU,EACV,SAAS,GACV,EAAE,MAAM,yBAkBR"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from "./placeLimitOrder";
|
|
2
|
-
export * from "./cancelLimitOrder";
|
|
3
|
-
export * from "./claimExpiredLimitOrder";
|
|
4
|
-
export * from "./getOpenLimitOrders";
|
|
5
|
-
export * from "./getClosedLimitOrders";
|
|
6
|
-
export * from "./placeDcaOrder";
|
|
7
|
-
export * from "./cancelDcaOrder";
|
|
8
|
-
export * from "./getOpenDcaOrders";
|
|
9
|
-
export * from "./getClosedDcaOrders";
|
|
10
|
-
export * from "./getDcaOrderExecutions";
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
interface PlaceDcaOrderParams {
|
|
3
|
-
payCoinType: string;
|
|
4
|
-
targetCoinType: string;
|
|
5
|
-
payCoinAmountEach: bigint;
|
|
6
|
-
numOrders: number;
|
|
7
|
-
interval: number;
|
|
8
|
-
slippage: bigint;
|
|
9
|
-
minRate: bigint;
|
|
10
|
-
maxRate: bigint;
|
|
11
|
-
}
|
|
12
|
-
export declare function placeDcaOrder({ payCoinType, targetCoinType, payCoinAmountEach, numOrders, interval, slippage, minRate, maxRate, }: PlaceDcaOrderParams): Promise<Transaction>;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=placeDcaOrder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placeDcaOrder.d.ts","sourceRoot":"","sources":["../../../../../src/features/limitDca/placeDcaOrder.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EAEZ,MAAM,0BAA0B,CAAC;AAElC,UAAU,mBAAmB;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,aAAa,CAAC,EAClC,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,GACR,EAAE,mBAAmB,wBA6BrB"}
|