@cetusprotocol/aggregator-sdk 0.0.0-experimental-20240923114128 → 0.0.0-experimental-20240929115104
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 +76 -45
- package/dist/index.mjs +76 -46
- 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 +10 -5
- package/src/transaction/bluemove.ts +44 -0
- package/tests/router.test.ts +1 -1
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,29 +5969,26 @@ 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
|
-
const {
|
|
5954
|
-
const
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
txb.object(CLOCK_ADDRESS)
|
|
5961
|
-
];
|
|
5982
|
+
const { from, target } = path;
|
|
5983
|
+
const { direction } = path;
|
|
5984
|
+
if (!direction) {
|
|
5985
|
+
throw new Error("Bluemove not support b2a swap");
|
|
5986
|
+
}
|
|
5987
|
+
const func = "swap_a2b";
|
|
5988
|
+
const args = [txb.object(this.dexInfo), inputCoin];
|
|
5962
5989
|
const res = txb.moveCall({
|
|
5963
|
-
target: `${client.publishedAt()}::
|
|
5964
|
-
typeArguments: [
|
|
5990
|
+
target: `${client.publishedAt()}::bluemove::${func}`,
|
|
5991
|
+
typeArguments: [from, target],
|
|
5965
5992
|
arguments: args
|
|
5966
5993
|
});
|
|
5967
5994
|
return res;
|
|
@@ -5981,6 +6008,7 @@ var AFTERMATH = "AFTERMATH";
|
|
|
5981
6008
|
var HAEDAL = "HAEDAL";
|
|
5982
6009
|
var VOLO = "VOLO";
|
|
5983
6010
|
var AFSUI = "AFSUI";
|
|
6011
|
+
var BLUEMOVE = "BLUEMOVE";
|
|
5984
6012
|
var AggregatorClient6 = class {
|
|
5985
6013
|
constructor(endpoint, signer, client, env) {
|
|
5986
6014
|
this.endpoint = endpoint;
|
|
@@ -6218,7 +6246,7 @@ var AggregatorClient6 = class {
|
|
|
6218
6246
|
}
|
|
6219
6247
|
publishedAt() {
|
|
6220
6248
|
if (this.env === 0 /* Mainnet */) {
|
|
6221
|
-
return "
|
|
6249
|
+
return "0x72b5c77a8309d87d7bd7f63fc4ce6e04b58ecc2eaa90a78889af5d14b1729622";
|
|
6222
6250
|
} else {
|
|
6223
6251
|
return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
|
|
6224
6252
|
}
|
|
@@ -6272,6 +6300,8 @@ var AggregatorClient6 = class {
|
|
|
6272
6300
|
return new Afsui(this.env);
|
|
6273
6301
|
case VOLO:
|
|
6274
6302
|
return new Volo(this.env);
|
|
6303
|
+
case BLUEMOVE:
|
|
6304
|
+
return new Bluemove(this.env);
|
|
6275
6305
|
default:
|
|
6276
6306
|
throw new Error(`Unsupported dex ${provider}`);
|
|
6277
6307
|
}
|
|
@@ -6541,6 +6571,7 @@ decimal.js/decimal.mjs:
|
|
|
6541
6571
|
exports.AFSUI = AFSUI;
|
|
6542
6572
|
exports.AFTERMATH = AFTERMATH;
|
|
6543
6573
|
exports.AggregatorClient = AggregatorClient6;
|
|
6574
|
+
exports.BLUEMOVE = BLUEMOVE;
|
|
6544
6575
|
exports.CETUS = CETUS;
|
|
6545
6576
|
exports.CLOCK_ADDRESS = CLOCK_ADDRESS;
|
|
6546
6577
|
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,29 +5967,26 @@ 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
|
-
const {
|
|
5952
|
-
const
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
txb.object(CLOCK_ADDRESS)
|
|
5959
|
-
];
|
|
5980
|
+
const { from, target } = path;
|
|
5981
|
+
const { direction } = path;
|
|
5982
|
+
if (!direction) {
|
|
5983
|
+
throw new Error("Bluemove not support b2a swap");
|
|
5984
|
+
}
|
|
5985
|
+
const func = "swap_a2b";
|
|
5986
|
+
const args = [txb.object(this.dexInfo), inputCoin];
|
|
5960
5987
|
const res = txb.moveCall({
|
|
5961
|
-
target: `${client.publishedAt()}::
|
|
5962
|
-
typeArguments: [
|
|
5988
|
+
target: `${client.publishedAt()}::bluemove::${func}`,
|
|
5989
|
+
typeArguments: [from, target],
|
|
5963
5990
|
arguments: args
|
|
5964
5991
|
});
|
|
5965
5992
|
return res;
|
|
@@ -5979,6 +6006,7 @@ var AFTERMATH = "AFTERMATH";
|
|
|
5979
6006
|
var HAEDAL = "HAEDAL";
|
|
5980
6007
|
var VOLO = "VOLO";
|
|
5981
6008
|
var AFSUI = "AFSUI";
|
|
6009
|
+
var BLUEMOVE = "BLUEMOVE";
|
|
5982
6010
|
var AggregatorClient6 = class {
|
|
5983
6011
|
constructor(endpoint, signer, client, env) {
|
|
5984
6012
|
this.endpoint = endpoint;
|
|
@@ -6216,7 +6244,7 @@ var AggregatorClient6 = class {
|
|
|
6216
6244
|
}
|
|
6217
6245
|
publishedAt() {
|
|
6218
6246
|
if (this.env === 0 /* Mainnet */) {
|
|
6219
|
-
return "
|
|
6247
|
+
return "0x72b5c77a8309d87d7bd7f63fc4ce6e04b58ecc2eaa90a78889af5d14b1729622";
|
|
6220
6248
|
} else {
|
|
6221
6249
|
return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
|
|
6222
6250
|
}
|
|
@@ -6270,6 +6298,8 @@ var AggregatorClient6 = class {
|
|
|
6270
6298
|
return new Afsui(this.env);
|
|
6271
6299
|
case VOLO:
|
|
6272
6300
|
return new Volo(this.env);
|
|
6301
|
+
case BLUEMOVE:
|
|
6302
|
+
return new Bluemove(this.env);
|
|
6273
6303
|
default:
|
|
6274
6304
|
throw new Error(`Unsupported dex ${provider}`);
|
|
6275
6305
|
}
|
|
@@ -6536,4 +6566,4 @@ decimal.js/decimal.mjs:
|
|
|
6536
6566
|
*)
|
|
6537
6567
|
*/
|
|
6538
6568
|
|
|
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 };
|
|
6569
|
+
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,8 @@ export class AggregatorClient {
|
|
|
335
337
|
|
|
336
338
|
publishedAt(): string {
|
|
337
339
|
if (this.env === Env.Mainnet) {
|
|
338
|
-
return "0xeffc8ae61f439bb34c9b905ff8f29ec56873dcedf81c7123ff2f1f67c45ec302"
|
|
340
|
+
// return "0xeffc8ae61f439bb34c9b905ff8f29ec56873dcedf81c7123ff2f1f67c45ec302"
|
|
341
|
+
return "0x72b5c77a8309d87d7bd7f63fc4ce6e04b58ecc2eaa90a78889af5d14b1729622"
|
|
339
342
|
} else {
|
|
340
343
|
return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595"
|
|
341
344
|
}
|
|
@@ -402,6 +405,8 @@ export class AggregatorClient {
|
|
|
402
405
|
return new Afsui(this.env)
|
|
403
406
|
case VOLO:
|
|
404
407
|
return new Volo(this.env)
|
|
408
|
+
case BLUEMOVE:
|
|
409
|
+
return new Bluemove(this.env)
|
|
405
410
|
default:
|
|
406
411
|
throw new Error(`Unsupported dex ${provider}`)
|
|
407
412
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { from, target } = path
|
|
26
|
+
|
|
27
|
+
const { direction } = path
|
|
28
|
+
if (!direction) {
|
|
29
|
+
throw new Error("Bluemove not support b2a swap")
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const func = "swap_a2b"
|
|
33
|
+
|
|
34
|
+
const args = [txb.object(this.dexInfo), inputCoin]
|
|
35
|
+
|
|
36
|
+
const res = txb.moveCall({
|
|
37
|
+
target: `${client.publishedAt()}::bluemove::${func}`,
|
|
38
|
+
typeArguments: [from, target],
|
|
39
|
+
arguments: args,
|
|
40
|
+
}) as TransactionObjectArgument
|
|
41
|
+
|
|
42
|
+
return res
|
|
43
|
+
}
|
|
44
|
+
}
|