@cetusprotocol/aggregator-sdk 0.2.2 → 0.3.0
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/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +69 -42
- package/dist/index.mjs +69 -43
- package/dist/src/client.d.ts +1 -0
- package/dist/src/transaction/bluemove.d.ts +7 -0
- package/package.json +1 -1
- package/src/client.ts +9 -5
- package/src/transaction/bluemove.ts +41 -0
- package/tests/router.test.ts +1 -4
package/dist/index.d.mts
CHANGED
|
@@ -71,6 +71,7 @@ declare const AFTERMATH = "AFTERMATH";
|
|
|
71
71
|
declare const HAEDAL = "HAEDAL";
|
|
72
72
|
declare const VOLO = "VOLO";
|
|
73
73
|
declare const AFSUI = "AFSUI";
|
|
74
|
+
declare const BLUEMOVE = "BLUEMOVE";
|
|
74
75
|
type BuildRouterSwapParams = {
|
|
75
76
|
routers: Router[];
|
|
76
77
|
byAmountIn: boolean;
|
|
@@ -220,4 +221,4 @@ declare enum Env {
|
|
|
220
221
|
Testnet = 1
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
|
224
|
+
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ declare const AFTERMATH = "AFTERMATH";
|
|
|
71
71
|
declare const HAEDAL = "HAEDAL";
|
|
72
72
|
declare const VOLO = "VOLO";
|
|
73
73
|
declare const AFSUI = "AFSUI";
|
|
74
|
+
declare const BLUEMOVE = "BLUEMOVE";
|
|
74
75
|
type BuildRouterSwapParams = {
|
|
75
76
|
routers: Router[];
|
|
76
77
|
byAmountIn: boolean;
|
|
@@ -220,4 +221,4 @@ declare enum Env {
|
|
|
220
221
|
Testnet = 1
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
|
224
|
+
export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
package/dist/index.js
CHANGED
|
@@ -5145,6 +5145,34 @@ var KriyaV2 = class {
|
|
|
5145
5145
|
}
|
|
5146
5146
|
};
|
|
5147
5147
|
|
|
5148
|
+
// src/transaction/kriya_v3.ts
|
|
5149
|
+
var KriyaV3 = class {
|
|
5150
|
+
constructor(env) {
|
|
5151
|
+
if (env !== 0 /* Mainnet */) {
|
|
5152
|
+
throw new Error("Kriya clmm only supported on mainnet");
|
|
5153
|
+
}
|
|
5154
|
+
this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
|
|
5155
|
+
}
|
|
5156
|
+
swap(client, txb, path, inputCoin) {
|
|
5157
|
+
return __async(this, null, function* () {
|
|
5158
|
+
const { direction, from, target } = path;
|
|
5159
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5160
|
+
const args = [
|
|
5161
|
+
txb.object(path.id),
|
|
5162
|
+
inputCoin,
|
|
5163
|
+
txb.object(this.version),
|
|
5164
|
+
txb.object(CLOCK_ADDRESS)
|
|
5165
|
+
];
|
|
5166
|
+
const res = txb.moveCall({
|
|
5167
|
+
target: `${client.publishedAt()}::kriya_clmm::${func}`,
|
|
5168
|
+
typeArguments: [coinAType, coinBType],
|
|
5169
|
+
arguments: args
|
|
5170
|
+
});
|
|
5171
|
+
return res;
|
|
5172
|
+
});
|
|
5173
|
+
}
|
|
5174
|
+
};
|
|
5175
|
+
|
|
5148
5176
|
// src/transaction/flowx_v2.ts
|
|
5149
5177
|
var FlowxV2 = class {
|
|
5150
5178
|
constructor(env) {
|
|
@@ -5168,6 +5196,36 @@ var FlowxV2 = class {
|
|
|
5168
5196
|
}
|
|
5169
5197
|
};
|
|
5170
5198
|
|
|
5199
|
+
// src/transaction/flowx_v3.ts
|
|
5200
|
+
var FlowxV3 = class {
|
|
5201
|
+
constructor(env) {
|
|
5202
|
+
if (env !== 0 /* Mainnet */) {
|
|
5203
|
+
throw new Error("Flowx clmm only supported on mainnet");
|
|
5204
|
+
}
|
|
5205
|
+
this.versioned = "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656";
|
|
5206
|
+
this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
|
|
5207
|
+
}
|
|
5208
|
+
swap(client, txb, path, inputCoin) {
|
|
5209
|
+
return __async(this, null, function* () {
|
|
5210
|
+
const { direction, from, target } = path;
|
|
5211
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5212
|
+
const args = [
|
|
5213
|
+
txb.object(this.poolRegistry),
|
|
5214
|
+
txb.pure.u64(path.feeRate * 1e6),
|
|
5215
|
+
inputCoin,
|
|
5216
|
+
txb.object(this.versioned),
|
|
5217
|
+
txb.object(CLOCK_ADDRESS)
|
|
5218
|
+
];
|
|
5219
|
+
const res = txb.moveCall({
|
|
5220
|
+
target: `${client.publishedAt()}::flowx_clmm::${func}`,
|
|
5221
|
+
typeArguments: [coinAType, coinBType],
|
|
5222
|
+
arguments: args
|
|
5223
|
+
});
|
|
5224
|
+
return res;
|
|
5225
|
+
});
|
|
5226
|
+
}
|
|
5227
|
+
};
|
|
5228
|
+
|
|
5171
5229
|
// src/transaction/turbos.ts
|
|
5172
5230
|
var Turbos = class {
|
|
5173
5231
|
constructor(env) {
|
|
@@ -5818,34 +5876,6 @@ function swapInPools(client, params, sender) {
|
|
|
5818
5876
|
});
|
|
5819
5877
|
}
|
|
5820
5878
|
|
|
5821
|
-
// src/transaction/kriya_v3.ts
|
|
5822
|
-
var KriyaV3 = class {
|
|
5823
|
-
constructor(env) {
|
|
5824
|
-
if (env !== 0 /* Mainnet */) {
|
|
5825
|
-
throw new Error("Kriya clmm only supported on mainnet");
|
|
5826
|
-
}
|
|
5827
|
-
this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
|
|
5828
|
-
}
|
|
5829
|
-
swap(client, txb, path, inputCoin) {
|
|
5830
|
-
return __async(this, null, function* () {
|
|
5831
|
-
const { direction, from, target } = path;
|
|
5832
|
-
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5833
|
-
const args = [
|
|
5834
|
-
txb.object(path.id),
|
|
5835
|
-
inputCoin,
|
|
5836
|
-
txb.object(this.version),
|
|
5837
|
-
txb.object(CLOCK_ADDRESS)
|
|
5838
|
-
];
|
|
5839
|
-
const res = txb.moveCall({
|
|
5840
|
-
target: `${client.publishedAt()}::kriya_clmm::${func}`,
|
|
5841
|
-
typeArguments: [coinAType, coinBType],
|
|
5842
|
-
arguments: args
|
|
5843
|
-
});
|
|
5844
|
-
return res;
|
|
5845
|
-
});
|
|
5846
|
-
}
|
|
5847
|
-
};
|
|
5848
|
-
|
|
5849
5879
|
// src/transaction/haedal.ts
|
|
5850
5880
|
var Haedal = class {
|
|
5851
5881
|
constructor(env) {
|
|
@@ -5939,28 +5969,21 @@ var Volo = class {
|
|
|
5939
5969
|
}
|
|
5940
5970
|
};
|
|
5941
5971
|
|
|
5942
|
-
// src/transaction/
|
|
5943
|
-
var
|
|
5972
|
+
// src/transaction/bluemove.ts
|
|
5973
|
+
var Bluemove = class {
|
|
5944
5974
|
constructor(env) {
|
|
5945
5975
|
if (env !== 0 /* Mainnet */) {
|
|
5946
|
-
throw new Error("
|
|
5976
|
+
throw new Error("Bluemove only supported on mainnet");
|
|
5947
5977
|
}
|
|
5948
|
-
this.
|
|
5949
|
-
this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
|
|
5978
|
+
this.dexInfo = "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92";
|
|
5950
5979
|
}
|
|
5951
5980
|
swap(client, txb, path, inputCoin) {
|
|
5952
5981
|
return __async(this, null, function* () {
|
|
5953
5982
|
const { direction, from, target } = path;
|
|
5954
5983
|
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5955
|
-
const args = [
|
|
5956
|
-
txb.object(this.poolRegistry),
|
|
5957
|
-
txb.pure.u64(path.feeRate * 1e6),
|
|
5958
|
-
inputCoin,
|
|
5959
|
-
txb.object(this.versioned),
|
|
5960
|
-
txb.object(CLOCK_ADDRESS)
|
|
5961
|
-
];
|
|
5984
|
+
const args = [txb.object(this.dexInfo), inputCoin];
|
|
5962
5985
|
const res = txb.moveCall({
|
|
5963
|
-
target: `${client.publishedAt()}::
|
|
5986
|
+
target: `${client.publishedAt()}::bluemove::${func}`,
|
|
5964
5987
|
typeArguments: [coinAType, coinBType],
|
|
5965
5988
|
arguments: args
|
|
5966
5989
|
});
|
|
@@ -5981,6 +6004,7 @@ var AFTERMATH = "AFTERMATH";
|
|
|
5981
6004
|
var HAEDAL = "HAEDAL";
|
|
5982
6005
|
var VOLO = "VOLO";
|
|
5983
6006
|
var AFSUI = "AFSUI";
|
|
6007
|
+
var BLUEMOVE = "BLUEMOVE";
|
|
5984
6008
|
var AggregatorClient6 = class {
|
|
5985
6009
|
constructor(endpoint, signer, client, env) {
|
|
5986
6010
|
this.endpoint = endpoint;
|
|
@@ -6218,7 +6242,7 @@ var AggregatorClient6 = class {
|
|
|
6218
6242
|
}
|
|
6219
6243
|
publishedAt() {
|
|
6220
6244
|
if (this.env === 0 /* Mainnet */) {
|
|
6221
|
-
return "
|
|
6245
|
+
return "0x764b8132a94d35abc9dfd91b23a0757b2a717d5ecb04c03098794aa2a508db91";
|
|
6222
6246
|
} else {
|
|
6223
6247
|
return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
|
|
6224
6248
|
}
|
|
@@ -6272,6 +6296,8 @@ var AggregatorClient6 = class {
|
|
|
6272
6296
|
return new Afsui(this.env);
|
|
6273
6297
|
case VOLO:
|
|
6274
6298
|
return new Volo(this.env);
|
|
6299
|
+
case BLUEMOVE:
|
|
6300
|
+
return new Bluemove(this.env);
|
|
6275
6301
|
default:
|
|
6276
6302
|
throw new Error(`Unsupported dex ${provider}`);
|
|
6277
6303
|
}
|
|
@@ -6541,6 +6567,7 @@ decimal.js/decimal.mjs:
|
|
|
6541
6567
|
exports.AFSUI = AFSUI;
|
|
6542
6568
|
exports.AFTERMATH = AFTERMATH;
|
|
6543
6569
|
exports.AggregatorClient = AggregatorClient6;
|
|
6570
|
+
exports.BLUEMOVE = BLUEMOVE;
|
|
6544
6571
|
exports.CETUS = CETUS;
|
|
6545
6572
|
exports.CLOCK_ADDRESS = CLOCK_ADDRESS;
|
|
6546
6573
|
exports.DEEPBOOKV2 = DEEPBOOKV2;
|
package/dist/index.mjs
CHANGED
|
@@ -5143,6 +5143,34 @@ var KriyaV2 = class {
|
|
|
5143
5143
|
}
|
|
5144
5144
|
};
|
|
5145
5145
|
|
|
5146
|
+
// src/transaction/kriya_v3.ts
|
|
5147
|
+
var KriyaV3 = class {
|
|
5148
|
+
constructor(env) {
|
|
5149
|
+
if (env !== 0 /* Mainnet */) {
|
|
5150
|
+
throw new Error("Kriya clmm only supported on mainnet");
|
|
5151
|
+
}
|
|
5152
|
+
this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
|
|
5153
|
+
}
|
|
5154
|
+
swap(client, txb, path, inputCoin) {
|
|
5155
|
+
return __async(this, null, function* () {
|
|
5156
|
+
const { direction, from, target } = path;
|
|
5157
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5158
|
+
const args = [
|
|
5159
|
+
txb.object(path.id),
|
|
5160
|
+
inputCoin,
|
|
5161
|
+
txb.object(this.version),
|
|
5162
|
+
txb.object(CLOCK_ADDRESS)
|
|
5163
|
+
];
|
|
5164
|
+
const res = txb.moveCall({
|
|
5165
|
+
target: `${client.publishedAt()}::kriya_clmm::${func}`,
|
|
5166
|
+
typeArguments: [coinAType, coinBType],
|
|
5167
|
+
arguments: args
|
|
5168
|
+
});
|
|
5169
|
+
return res;
|
|
5170
|
+
});
|
|
5171
|
+
}
|
|
5172
|
+
};
|
|
5173
|
+
|
|
5146
5174
|
// src/transaction/flowx_v2.ts
|
|
5147
5175
|
var FlowxV2 = class {
|
|
5148
5176
|
constructor(env) {
|
|
@@ -5166,6 +5194,36 @@ var FlowxV2 = class {
|
|
|
5166
5194
|
}
|
|
5167
5195
|
};
|
|
5168
5196
|
|
|
5197
|
+
// src/transaction/flowx_v3.ts
|
|
5198
|
+
var FlowxV3 = class {
|
|
5199
|
+
constructor(env) {
|
|
5200
|
+
if (env !== 0 /* Mainnet */) {
|
|
5201
|
+
throw new Error("Flowx clmm only supported on mainnet");
|
|
5202
|
+
}
|
|
5203
|
+
this.versioned = "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656";
|
|
5204
|
+
this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
|
|
5205
|
+
}
|
|
5206
|
+
swap(client, txb, path, inputCoin) {
|
|
5207
|
+
return __async(this, null, function* () {
|
|
5208
|
+
const { direction, from, target } = path;
|
|
5209
|
+
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5210
|
+
const args = [
|
|
5211
|
+
txb.object(this.poolRegistry),
|
|
5212
|
+
txb.pure.u64(path.feeRate * 1e6),
|
|
5213
|
+
inputCoin,
|
|
5214
|
+
txb.object(this.versioned),
|
|
5215
|
+
txb.object(CLOCK_ADDRESS)
|
|
5216
|
+
];
|
|
5217
|
+
const res = txb.moveCall({
|
|
5218
|
+
target: `${client.publishedAt()}::flowx_clmm::${func}`,
|
|
5219
|
+
typeArguments: [coinAType, coinBType],
|
|
5220
|
+
arguments: args
|
|
5221
|
+
});
|
|
5222
|
+
return res;
|
|
5223
|
+
});
|
|
5224
|
+
}
|
|
5225
|
+
};
|
|
5226
|
+
|
|
5169
5227
|
// src/transaction/turbos.ts
|
|
5170
5228
|
var Turbos = class {
|
|
5171
5229
|
constructor(env) {
|
|
@@ -5816,34 +5874,6 @@ function swapInPools(client, params, sender) {
|
|
|
5816
5874
|
});
|
|
5817
5875
|
}
|
|
5818
5876
|
|
|
5819
|
-
// src/transaction/kriya_v3.ts
|
|
5820
|
-
var KriyaV3 = class {
|
|
5821
|
-
constructor(env) {
|
|
5822
|
-
if (env !== 0 /* Mainnet */) {
|
|
5823
|
-
throw new Error("Kriya clmm only supported on mainnet");
|
|
5824
|
-
}
|
|
5825
|
-
this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
|
|
5826
|
-
}
|
|
5827
|
-
swap(client, txb, path, inputCoin) {
|
|
5828
|
-
return __async(this, null, function* () {
|
|
5829
|
-
const { direction, from, target } = path;
|
|
5830
|
-
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5831
|
-
const args = [
|
|
5832
|
-
txb.object(path.id),
|
|
5833
|
-
inputCoin,
|
|
5834
|
-
txb.object(this.version),
|
|
5835
|
-
txb.object(CLOCK_ADDRESS)
|
|
5836
|
-
];
|
|
5837
|
-
const res = txb.moveCall({
|
|
5838
|
-
target: `${client.publishedAt()}::kriya_clmm::${func}`,
|
|
5839
|
-
typeArguments: [coinAType, coinBType],
|
|
5840
|
-
arguments: args
|
|
5841
|
-
});
|
|
5842
|
-
return res;
|
|
5843
|
-
});
|
|
5844
|
-
}
|
|
5845
|
-
};
|
|
5846
|
-
|
|
5847
5877
|
// src/transaction/haedal.ts
|
|
5848
5878
|
var Haedal = class {
|
|
5849
5879
|
constructor(env) {
|
|
@@ -5937,28 +5967,21 @@ var Volo = class {
|
|
|
5937
5967
|
}
|
|
5938
5968
|
};
|
|
5939
5969
|
|
|
5940
|
-
// src/transaction/
|
|
5941
|
-
var
|
|
5970
|
+
// src/transaction/bluemove.ts
|
|
5971
|
+
var Bluemove = class {
|
|
5942
5972
|
constructor(env) {
|
|
5943
5973
|
if (env !== 0 /* Mainnet */) {
|
|
5944
|
-
throw new Error("
|
|
5974
|
+
throw new Error("Bluemove only supported on mainnet");
|
|
5945
5975
|
}
|
|
5946
|
-
this.
|
|
5947
|
-
this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
|
|
5976
|
+
this.dexInfo = "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92";
|
|
5948
5977
|
}
|
|
5949
5978
|
swap(client, txb, path, inputCoin) {
|
|
5950
5979
|
return __async(this, null, function* () {
|
|
5951
5980
|
const { direction, from, target } = path;
|
|
5952
5981
|
const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
|
|
5953
|
-
const args = [
|
|
5954
|
-
txb.object(this.poolRegistry),
|
|
5955
|
-
txb.pure.u64(path.feeRate * 1e6),
|
|
5956
|
-
inputCoin,
|
|
5957
|
-
txb.object(this.versioned),
|
|
5958
|
-
txb.object(CLOCK_ADDRESS)
|
|
5959
|
-
];
|
|
5982
|
+
const args = [txb.object(this.dexInfo), inputCoin];
|
|
5960
5983
|
const res = txb.moveCall({
|
|
5961
|
-
target: `${client.publishedAt()}::
|
|
5984
|
+
target: `${client.publishedAt()}::bluemove::${func}`,
|
|
5962
5985
|
typeArguments: [coinAType, coinBType],
|
|
5963
5986
|
arguments: args
|
|
5964
5987
|
});
|
|
@@ -5979,6 +6002,7 @@ var AFTERMATH = "AFTERMATH";
|
|
|
5979
6002
|
var HAEDAL = "HAEDAL";
|
|
5980
6003
|
var VOLO = "VOLO";
|
|
5981
6004
|
var AFSUI = "AFSUI";
|
|
6005
|
+
var BLUEMOVE = "BLUEMOVE";
|
|
5982
6006
|
var AggregatorClient6 = class {
|
|
5983
6007
|
constructor(endpoint, signer, client, env) {
|
|
5984
6008
|
this.endpoint = endpoint;
|
|
@@ -6216,7 +6240,7 @@ var AggregatorClient6 = class {
|
|
|
6216
6240
|
}
|
|
6217
6241
|
publishedAt() {
|
|
6218
6242
|
if (this.env === 0 /* Mainnet */) {
|
|
6219
|
-
return "
|
|
6243
|
+
return "0x764b8132a94d35abc9dfd91b23a0757b2a717d5ecb04c03098794aa2a508db91";
|
|
6220
6244
|
} else {
|
|
6221
6245
|
return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
|
|
6222
6246
|
}
|
|
@@ -6270,6 +6294,8 @@ var AggregatorClient6 = class {
|
|
|
6270
6294
|
return new Afsui(this.env);
|
|
6271
6295
|
case VOLO:
|
|
6272
6296
|
return new Volo(this.env);
|
|
6297
|
+
case BLUEMOVE:
|
|
6298
|
+
return new Bluemove(this.env);
|
|
6273
6299
|
default:
|
|
6274
6300
|
throw new Error(`Unsupported dex ${provider}`);
|
|
6275
6301
|
}
|
|
@@ -6536,4 +6562,4 @@ decimal.js/decimal.mjs:
|
|
|
6536
6562
|
*)
|
|
6537
6563
|
*/
|
|
6538
6564
|
|
|
6539
|
-
export { AFSUI, AFTERMATH, AggregatorClient6 as AggregatorClient, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, Env, FLOWXV2, FLOWXV3, HAEDAL, KRIYA, KRIYAV3, ONE, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
|
6565
|
+
export { AFSUI, AFTERMATH, AggregatorClient6 as AggregatorClient, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, Env, FLOWXV2, FLOWXV3, HAEDAL, KRIYA, KRIYAV3, ONE, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
|
package/dist/src/client.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const AFTERMATH = "AFTERMATH";
|
|
|
15
15
|
export declare const HAEDAL = "HAEDAL";
|
|
16
16
|
export declare const VOLO = "VOLO";
|
|
17
17
|
export declare const AFSUI = "AFSUI";
|
|
18
|
+
export declare const BLUEMOVE = "BLUEMOVE";
|
|
18
19
|
export type BuildRouterSwapParams = {
|
|
19
20
|
routers: Router[];
|
|
20
21
|
byAmountIn: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
|
+
import { AggregatorClient, Dex, Env, Path } from "..";
|
|
3
|
+
export declare class Bluemove implements Dex {
|
|
4
|
+
private dexInfo;
|
|
5
|
+
constructor(env: Env);
|
|
6
|
+
swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
7
|
+
}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -19,18 +19,19 @@ import {
|
|
|
19
19
|
import { Aftermath } from "./transaction/aftermath"
|
|
20
20
|
import { DeepbookV2 } from "./transaction/deepbook_v2"
|
|
21
21
|
import { KriyaV2 } from "./transaction/kriya_v2"
|
|
22
|
+
import { KriyaV3 } from "./transaction/kriya_v3"
|
|
22
23
|
import { FlowxV2 } from "./transaction/flowx_v2"
|
|
24
|
+
import { FlowxV3 } from "./transaction/flowx_v3"
|
|
23
25
|
import { Turbos } from "./transaction/turbos"
|
|
24
26
|
import { Cetus } from "./transaction/cetus"
|
|
25
27
|
import { swapInPools } from "./transaction/swap"
|
|
26
28
|
import { CalculateAmountLimit } from "./math"
|
|
27
|
-
import { buildInputCoin } from "./utils/coin"
|
|
28
|
-
import { CoinAsset } from "./types/sui"
|
|
29
|
-
import { KriyaV3 } from "./transaction/kriya_v3"
|
|
30
29
|
import { Haedal } from "./transaction/haedal"
|
|
31
30
|
import { Afsui } from "./transaction/afsui"
|
|
32
31
|
import { Volo } from "./transaction/volo"
|
|
33
|
-
import {
|
|
32
|
+
import { Bluemove } from "./transaction/bluemove"
|
|
33
|
+
import { CoinAsset } from "./types/sui"
|
|
34
|
+
import { buildInputCoin } from "./utils/coin"
|
|
34
35
|
|
|
35
36
|
export const CETUS = "CETUS"
|
|
36
37
|
export const DEEPBOOKV2 = "DEEPBOOK"
|
|
@@ -43,6 +44,7 @@ export const AFTERMATH = "AFTERMATH"
|
|
|
43
44
|
export const HAEDAL = "HAEDAL"
|
|
44
45
|
export const VOLO = "VOLO"
|
|
45
46
|
export const AFSUI = "AFSUI"
|
|
47
|
+
export const BLUEMOVE = "BLUEMOVE"
|
|
46
48
|
|
|
47
49
|
export type BuildRouterSwapParams = {
|
|
48
50
|
routers: Router[]
|
|
@@ -335,7 +337,7 @@ export class AggregatorClient {
|
|
|
335
337
|
|
|
336
338
|
publishedAt(): string {
|
|
337
339
|
if (this.env === Env.Mainnet) {
|
|
338
|
-
return "
|
|
340
|
+
return "0x764b8132a94d35abc9dfd91b23a0757b2a717d5ecb04c03098794aa2a508db91"
|
|
339
341
|
} else {
|
|
340
342
|
return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595"
|
|
341
343
|
}
|
|
@@ -402,6 +404,8 @@ export class AggregatorClient {
|
|
|
402
404
|
return new Afsui(this.env)
|
|
403
405
|
case VOLO:
|
|
404
406
|
return new Volo(this.env)
|
|
407
|
+
case BLUEMOVE:
|
|
408
|
+
return new Bluemove(this.env)
|
|
405
409
|
default:
|
|
406
410
|
throw new Error(`Unsupported dex ${provider}`)
|
|
407
411
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Transaction,
|
|
3
|
+
TransactionObjectArgument,
|
|
4
|
+
} from "@mysten/sui/transactions"
|
|
5
|
+
import { AggregatorClient, Dex, Env, Path } from ".."
|
|
6
|
+
|
|
7
|
+
export class Bluemove implements Dex {
|
|
8
|
+
private dexInfo: string
|
|
9
|
+
|
|
10
|
+
constructor(env: Env) {
|
|
11
|
+
if (env !== Env.Mainnet) {
|
|
12
|
+
throw new Error("Bluemove only supported on mainnet")
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
this.dexInfo =
|
|
16
|
+
"0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async swap(
|
|
20
|
+
client: AggregatorClient,
|
|
21
|
+
txb: Transaction,
|
|
22
|
+
path: Path,
|
|
23
|
+
inputCoin: TransactionObjectArgument
|
|
24
|
+
): Promise<TransactionObjectArgument> {
|
|
25
|
+
const { direction, from, target } = path
|
|
26
|
+
|
|
27
|
+
const [func, coinAType, coinBType] = direction
|
|
28
|
+
? ["swap_a2b", from, target]
|
|
29
|
+
: ["swap_b2a", target, from]
|
|
30
|
+
|
|
31
|
+
const args = [txb.object(this.dexInfo), inputCoin]
|
|
32
|
+
|
|
33
|
+
const res = txb.moveCall({
|
|
34
|
+
target: `${client.publishedAt()}::bluemove::${func}`,
|
|
35
|
+
typeArguments: [coinAType, coinBType],
|
|
36
|
+
arguments: args,
|
|
37
|
+
}) as TransactionObjectArgument
|
|
38
|
+
|
|
39
|
+
return res
|
|
40
|
+
}
|
|
41
|
+
}
|
package/tests/router.test.ts
CHANGED
|
@@ -137,9 +137,6 @@ describe("router module", () => {
|
|
|
137
137
|
const byAmountIn = true
|
|
138
138
|
const amount = "1000000000"
|
|
139
139
|
|
|
140
|
-
// const from = M_USDC
|
|
141
|
-
// const target = M_SUI
|
|
142
|
-
|
|
143
140
|
const from = M_SUI
|
|
144
141
|
// const target =
|
|
145
142
|
// "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
|
|
@@ -162,7 +159,7 @@ describe("router module", () => {
|
|
|
162
159
|
// "KRIYA",
|
|
163
160
|
// "KRIYAV3",
|
|
164
161
|
// "TURBOS",
|
|
165
|
-
"
|
|
162
|
+
"BLUEMOVE",
|
|
166
163
|
],
|
|
167
164
|
})
|
|
168
165
|
|