@cetusprotocol/aggregator-sdk 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -22
- package/dist/index.mjs +29 -22
- package/dist/src/client.d.ts +1 -1
- package/dist/src/transaction/swap.d.ts +2 -2
- package/dist/tests/test_data.test.d.ts +4 -2
- package/package.json +1 -1
- package/src/client.ts +32 -16
- package/src/transaction/cetus.ts +2 -2
- package/src/transaction/swap.ts +10 -10
- package/tests/router.test.ts +30 -49
- package/tests/test_data.test.ts +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -112,7 +112,7 @@ declare class AggregatorClient {
|
|
|
112
112
|
env: Env;
|
|
113
113
|
private allCoins;
|
|
114
114
|
constructor(endpoint?: string, signer?: string, client?: SuiClient, env?: Env);
|
|
115
|
-
|
|
115
|
+
getCoins(coinType: string, refresh?: boolean): Promise<CoinAsset[]>;
|
|
116
116
|
findRouters(params: FindRouterParams): Promise<RouterData | null>;
|
|
117
117
|
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
118
118
|
expectOutputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], partner?: string): Promise<TransactionObjectArgument>;
|
package/dist/index.d.ts
CHANGED
|
@@ -112,7 +112,7 @@ declare class AggregatorClient {
|
|
|
112
112
|
env: Env;
|
|
113
113
|
private allCoins;
|
|
114
114
|
constructor(endpoint?: string, signer?: string, client?: SuiClient, env?: Env);
|
|
115
|
-
|
|
115
|
+
getCoins(coinType: string, refresh?: boolean): Promise<CoinAsset[]>;
|
|
116
116
|
findRouters(params: FindRouterParams): Promise<RouterData | null>;
|
|
117
117
|
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
118
118
|
expectOutputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], partner?: string): Promise<TransactionObjectArgument>;
|
package/dist/index.js
CHANGED
|
@@ -5265,8 +5265,8 @@ var Turbos = class {
|
|
|
5265
5265
|
// src/transaction/cetus.ts
|
|
5266
5266
|
var Cetus = class {
|
|
5267
5267
|
constructor(env, partner) {
|
|
5268
|
-
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "
|
|
5269
|
-
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "
|
|
5268
|
+
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
|
|
5269
|
+
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
|
|
5270
5270
|
}
|
|
5271
5271
|
flash_swap(client, txb, path, by_amount_in) {
|
|
5272
5272
|
const { direction, from, target } = path;
|
|
@@ -5764,7 +5764,7 @@ function sqrtPriceX64ToPrice(sqrtPriceStr, decimalsA, decimalsB) {
|
|
|
5764
5764
|
}
|
|
5765
5765
|
|
|
5766
5766
|
// src/transaction/swap.ts
|
|
5767
|
-
function swapInPools(client, params, sender) {
|
|
5767
|
+
function swapInPools(client, params, sender, env) {
|
|
5768
5768
|
return __async(this, null, function* () {
|
|
5769
5769
|
var _a, _b, _c, _d, _e;
|
|
5770
5770
|
const { from, target, amount, byAmountIn, pools } = params;
|
|
@@ -5772,12 +5772,11 @@ function swapInPools(client, params, sender) {
|
|
|
5772
5772
|
const targetCoin = completionCoin(target);
|
|
5773
5773
|
const tx = new transactions.Transaction();
|
|
5774
5774
|
const direction = compareCoins(fromCoin, targetCoin);
|
|
5775
|
-
const integratePublishedAt = "
|
|
5775
|
+
const integratePublishedAt = env === 0 /* Mainnet */ ? "0x15c0555d7601d98ca2659a8387d377a81b1e285ee0808484e101f96d05806187" : "0x2918cf39850de6d5d94d8196dc878c8c722cd79db659318e00bff57fbb4e2ede";
|
|
5776
5776
|
const coinA = direction ? fromCoin : targetCoin;
|
|
5777
5777
|
const coinB = direction ? targetCoin : fromCoin;
|
|
5778
5778
|
const typeArguments = [coinA, coinB];
|
|
5779
|
-
console.log("typeArguments", typeArguments);
|
|
5780
|
-
console.log("pools", pools);
|
|
5779
|
+
console.log("typeArguments", typeArguments, integratePublishedAt);
|
|
5781
5780
|
for (let i = 0; i < pools.length; i++) {
|
|
5782
5781
|
const args = [
|
|
5783
5782
|
tx.object(pools[i]),
|
|
@@ -5797,6 +5796,7 @@ function swapInPools(client, params, sender) {
|
|
|
5797
5796
|
"InvalidWallet" /* InvalidWallet */
|
|
5798
5797
|
);
|
|
5799
5798
|
}
|
|
5799
|
+
printTransaction(tx);
|
|
5800
5800
|
const simulateRes = yield client.devInspectTransactionBlock({
|
|
5801
5801
|
transactionBlock: tx,
|
|
5802
5802
|
sender
|
|
@@ -5838,7 +5838,6 @@ function swapInPools(client, params, sender) {
|
|
|
5838
5838
|
}
|
|
5839
5839
|
}
|
|
5840
5840
|
const event = valueData[tempIndex].parsedJson.data;
|
|
5841
|
-
console.log("event", JSON.stringify(event, null, 2));
|
|
5842
5841
|
const currentSqrtPrice = event.step_results[0].current_sqrt_price;
|
|
5843
5842
|
const [decimalA, decimalB] = yield Promise.all([
|
|
5844
5843
|
client.getCoinMetadata({ coinType: coinA }).then((metadata) => metadata == null ? void 0 : metadata.decimals),
|
|
@@ -6097,34 +6096,42 @@ var AggregatorClient8 = class {
|
|
|
6097
6096
|
this.client = client$1 || new client.SuiClient({ url: client.getFullnodeUrl("mainnet") });
|
|
6098
6097
|
this.signer = signer || "";
|
|
6099
6098
|
this.env = env || 0 /* Mainnet */;
|
|
6100
|
-
this.allCoins =
|
|
6099
|
+
this.allCoins = /* @__PURE__ */ new Map();
|
|
6101
6100
|
}
|
|
6102
|
-
|
|
6101
|
+
getCoins(coinType, refresh = true) {
|
|
6103
6102
|
return __async(this, null, function* () {
|
|
6104
6103
|
if (this.signer === "") {
|
|
6105
6104
|
throw new Error("Signer is required, but not provided.");
|
|
6106
6105
|
}
|
|
6107
6106
|
let cursor = null;
|
|
6108
6107
|
let limit = 50;
|
|
6108
|
+
if (!refresh) {
|
|
6109
|
+
const gotFromCoins = this.allCoins.get(coinType);
|
|
6110
|
+
if (gotFromCoins) {
|
|
6111
|
+
return gotFromCoins;
|
|
6112
|
+
}
|
|
6113
|
+
}
|
|
6109
6114
|
const allCoins = [];
|
|
6110
6115
|
while (true) {
|
|
6111
|
-
const
|
|
6116
|
+
const gotCoins = yield this.client.getCoins({
|
|
6112
6117
|
owner: this.signer,
|
|
6118
|
+
coinType,
|
|
6113
6119
|
cursor,
|
|
6114
6120
|
limit
|
|
6115
6121
|
});
|
|
6116
|
-
for (const coin of
|
|
6122
|
+
for (const coin of gotCoins.data) {
|
|
6117
6123
|
allCoins.push({
|
|
6118
6124
|
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
6119
6125
|
coinObjectId: coin.coinObjectId,
|
|
6120
6126
|
balance: BigInt(coin.balance)
|
|
6121
6127
|
});
|
|
6122
6128
|
}
|
|
6123
|
-
if (
|
|
6129
|
+
if (gotCoins.data.length < limit) {
|
|
6124
6130
|
break;
|
|
6125
6131
|
}
|
|
6126
|
-
cursor =
|
|
6132
|
+
cursor = gotCoins.data[limit - 1].coinObjectId;
|
|
6127
6133
|
}
|
|
6134
|
+
this.allCoins.set(coinType, allCoins);
|
|
6128
6135
|
return allCoins;
|
|
6129
6136
|
});
|
|
6130
6137
|
}
|
|
@@ -6216,7 +6223,7 @@ var AggregatorClient8 = class {
|
|
|
6216
6223
|
return __async(this, null, function* () {
|
|
6217
6224
|
let result;
|
|
6218
6225
|
try {
|
|
6219
|
-
result = yield swapInPools(this.client, params, this.signer);
|
|
6226
|
+
result = yield swapInPools(this.client, params, this.signer, this.env);
|
|
6220
6227
|
} catch (e) {
|
|
6221
6228
|
console.error("swapInPools error:", e);
|
|
6222
6229
|
return null;
|
|
@@ -6278,10 +6285,8 @@ var AggregatorClient8 = class {
|
|
|
6278
6285
|
refreshAllCoins,
|
|
6279
6286
|
payDeepFeeAmount
|
|
6280
6287
|
} = params;
|
|
6281
|
-
if (refreshAllCoins || this.allCoins.length === 0) {
|
|
6282
|
-
this.allCoins = yield this.getAllCoins();
|
|
6283
|
-
}
|
|
6284
6288
|
const fromCoinType = routers[0].path[0].from;
|
|
6289
|
+
let fromCoins = yield this.getCoins(fromCoinType, refreshAllCoins);
|
|
6285
6290
|
const targetCoinType = routers[0].path[routers[0].path.length - 1].target;
|
|
6286
6291
|
const amountIn = routers.reduce(
|
|
6287
6292
|
(acc, router) => acc.add(router.amountIn),
|
|
@@ -6299,15 +6304,16 @@ var AggregatorClient8 = class {
|
|
|
6299
6304
|
const amount = byAmountIn ? amountIn : amountLimit;
|
|
6300
6305
|
const buildFromCoinRes = buildInputCoin(
|
|
6301
6306
|
txb,
|
|
6302
|
-
|
|
6307
|
+
fromCoins,
|
|
6303
6308
|
BigInt(amount.toString()),
|
|
6304
6309
|
fromCoinType
|
|
6305
6310
|
);
|
|
6306
6311
|
let deepCoin;
|
|
6307
6312
|
if (payDeepFeeAmount && payDeepFeeAmount > 0) {
|
|
6313
|
+
let deepCoins = yield this.getCoins(this.deepbookv3DeepFeeType());
|
|
6308
6314
|
deepCoin = buildInputCoin(
|
|
6309
6315
|
txb,
|
|
6310
|
-
|
|
6316
|
+
deepCoins,
|
|
6311
6317
|
BigInt(payDeepFeeAmount),
|
|
6312
6318
|
this.deepbookv3DeepFeeType()
|
|
6313
6319
|
).targetCoin;
|
|
@@ -6322,9 +6328,10 @@ var AggregatorClient8 = class {
|
|
|
6322
6328
|
deepbookv3DeepFee: deepCoin
|
|
6323
6329
|
});
|
|
6324
6330
|
if (isMergeTragetCoin) {
|
|
6331
|
+
let targetCoins = yield this.getCoins(targetCoinType, refreshAllCoins);
|
|
6325
6332
|
const targetCoinRes = buildInputCoin(
|
|
6326
6333
|
txb,
|
|
6327
|
-
|
|
6334
|
+
targetCoins,
|
|
6328
6335
|
BigInt(0),
|
|
6329
6336
|
targetCoinType
|
|
6330
6337
|
);
|
|
@@ -6344,9 +6351,9 @@ var AggregatorClient8 = class {
|
|
|
6344
6351
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6345
6352
|
publishedAt() {
|
|
6346
6353
|
if (this.env === 0 /* Mainnet */) {
|
|
6347
|
-
return "
|
|
6354
|
+
return "0xec2108d2092dd6f1f6fe45def639500e323596e0bab9fabc206461aadf357e6a";
|
|
6348
6355
|
} else {
|
|
6349
|
-
return "
|
|
6356
|
+
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6350
6357
|
}
|
|
6351
6358
|
}
|
|
6352
6359
|
// Include deepbookv3, scallop
|
package/dist/index.mjs
CHANGED
|
@@ -5263,8 +5263,8 @@ var Turbos = class {
|
|
|
5263
5263
|
// src/transaction/cetus.ts
|
|
5264
5264
|
var Cetus = class {
|
|
5265
5265
|
constructor(env, partner) {
|
|
5266
|
-
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "
|
|
5267
|
-
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "
|
|
5266
|
+
this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
|
|
5267
|
+
this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
|
|
5268
5268
|
}
|
|
5269
5269
|
flash_swap(client, txb, path, by_amount_in) {
|
|
5270
5270
|
const { direction, from, target } = path;
|
|
@@ -5762,7 +5762,7 @@ function sqrtPriceX64ToPrice(sqrtPriceStr, decimalsA, decimalsB) {
|
|
|
5762
5762
|
}
|
|
5763
5763
|
|
|
5764
5764
|
// src/transaction/swap.ts
|
|
5765
|
-
function swapInPools(client, params, sender) {
|
|
5765
|
+
function swapInPools(client, params, sender, env) {
|
|
5766
5766
|
return __async(this, null, function* () {
|
|
5767
5767
|
var _a, _b, _c, _d, _e;
|
|
5768
5768
|
const { from, target, amount, byAmountIn, pools } = params;
|
|
@@ -5770,12 +5770,11 @@ function swapInPools(client, params, sender) {
|
|
|
5770
5770
|
const targetCoin = completionCoin(target);
|
|
5771
5771
|
const tx = new Transaction();
|
|
5772
5772
|
const direction = compareCoins(fromCoin, targetCoin);
|
|
5773
|
-
const integratePublishedAt = "
|
|
5773
|
+
const integratePublishedAt = env === 0 /* Mainnet */ ? "0x15c0555d7601d98ca2659a8387d377a81b1e285ee0808484e101f96d05806187" : "0x2918cf39850de6d5d94d8196dc878c8c722cd79db659318e00bff57fbb4e2ede";
|
|
5774
5774
|
const coinA = direction ? fromCoin : targetCoin;
|
|
5775
5775
|
const coinB = direction ? targetCoin : fromCoin;
|
|
5776
5776
|
const typeArguments = [coinA, coinB];
|
|
5777
|
-
console.log("typeArguments", typeArguments);
|
|
5778
|
-
console.log("pools", pools);
|
|
5777
|
+
console.log("typeArguments", typeArguments, integratePublishedAt);
|
|
5779
5778
|
for (let i = 0; i < pools.length; i++) {
|
|
5780
5779
|
const args = [
|
|
5781
5780
|
tx.object(pools[i]),
|
|
@@ -5795,6 +5794,7 @@ function swapInPools(client, params, sender) {
|
|
|
5795
5794
|
"InvalidWallet" /* InvalidWallet */
|
|
5796
5795
|
);
|
|
5797
5796
|
}
|
|
5797
|
+
printTransaction(tx);
|
|
5798
5798
|
const simulateRes = yield client.devInspectTransactionBlock({
|
|
5799
5799
|
transactionBlock: tx,
|
|
5800
5800
|
sender
|
|
@@ -5836,7 +5836,6 @@ function swapInPools(client, params, sender) {
|
|
|
5836
5836
|
}
|
|
5837
5837
|
}
|
|
5838
5838
|
const event = valueData[tempIndex].parsedJson.data;
|
|
5839
|
-
console.log("event", JSON.stringify(event, null, 2));
|
|
5840
5839
|
const currentSqrtPrice = event.step_results[0].current_sqrt_price;
|
|
5841
5840
|
const [decimalA, decimalB] = yield Promise.all([
|
|
5842
5841
|
client.getCoinMetadata({ coinType: coinA }).then((metadata) => metadata == null ? void 0 : metadata.decimals),
|
|
@@ -6095,34 +6094,42 @@ var AggregatorClient8 = class {
|
|
|
6095
6094
|
this.client = client || new SuiClient({ url: getFullnodeUrl("mainnet") });
|
|
6096
6095
|
this.signer = signer || "";
|
|
6097
6096
|
this.env = env || 0 /* Mainnet */;
|
|
6098
|
-
this.allCoins =
|
|
6097
|
+
this.allCoins = /* @__PURE__ */ new Map();
|
|
6099
6098
|
}
|
|
6100
|
-
|
|
6099
|
+
getCoins(coinType, refresh = true) {
|
|
6101
6100
|
return __async(this, null, function* () {
|
|
6102
6101
|
if (this.signer === "") {
|
|
6103
6102
|
throw new Error("Signer is required, but not provided.");
|
|
6104
6103
|
}
|
|
6105
6104
|
let cursor = null;
|
|
6106
6105
|
let limit = 50;
|
|
6106
|
+
if (!refresh) {
|
|
6107
|
+
const gotFromCoins = this.allCoins.get(coinType);
|
|
6108
|
+
if (gotFromCoins) {
|
|
6109
|
+
return gotFromCoins;
|
|
6110
|
+
}
|
|
6111
|
+
}
|
|
6107
6112
|
const allCoins = [];
|
|
6108
6113
|
while (true) {
|
|
6109
|
-
const
|
|
6114
|
+
const gotCoins = yield this.client.getCoins({
|
|
6110
6115
|
owner: this.signer,
|
|
6116
|
+
coinType,
|
|
6111
6117
|
cursor,
|
|
6112
6118
|
limit
|
|
6113
6119
|
});
|
|
6114
|
-
for (const coin of
|
|
6120
|
+
for (const coin of gotCoins.data) {
|
|
6115
6121
|
allCoins.push({
|
|
6116
6122
|
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
6117
6123
|
coinObjectId: coin.coinObjectId,
|
|
6118
6124
|
balance: BigInt(coin.balance)
|
|
6119
6125
|
});
|
|
6120
6126
|
}
|
|
6121
|
-
if (
|
|
6127
|
+
if (gotCoins.data.length < limit) {
|
|
6122
6128
|
break;
|
|
6123
6129
|
}
|
|
6124
|
-
cursor =
|
|
6130
|
+
cursor = gotCoins.data[limit - 1].coinObjectId;
|
|
6125
6131
|
}
|
|
6132
|
+
this.allCoins.set(coinType, allCoins);
|
|
6126
6133
|
return allCoins;
|
|
6127
6134
|
});
|
|
6128
6135
|
}
|
|
@@ -6214,7 +6221,7 @@ var AggregatorClient8 = class {
|
|
|
6214
6221
|
return __async(this, null, function* () {
|
|
6215
6222
|
let result;
|
|
6216
6223
|
try {
|
|
6217
|
-
result = yield swapInPools(this.client, params, this.signer);
|
|
6224
|
+
result = yield swapInPools(this.client, params, this.signer, this.env);
|
|
6218
6225
|
} catch (e) {
|
|
6219
6226
|
console.error("swapInPools error:", e);
|
|
6220
6227
|
return null;
|
|
@@ -6276,10 +6283,8 @@ var AggregatorClient8 = class {
|
|
|
6276
6283
|
refreshAllCoins,
|
|
6277
6284
|
payDeepFeeAmount
|
|
6278
6285
|
} = params;
|
|
6279
|
-
if (refreshAllCoins || this.allCoins.length === 0) {
|
|
6280
|
-
this.allCoins = yield this.getAllCoins();
|
|
6281
|
-
}
|
|
6282
6286
|
const fromCoinType = routers[0].path[0].from;
|
|
6287
|
+
let fromCoins = yield this.getCoins(fromCoinType, refreshAllCoins);
|
|
6283
6288
|
const targetCoinType = routers[0].path[routers[0].path.length - 1].target;
|
|
6284
6289
|
const amountIn = routers.reduce(
|
|
6285
6290
|
(acc, router) => acc.add(router.amountIn),
|
|
@@ -6297,15 +6302,16 @@ var AggregatorClient8 = class {
|
|
|
6297
6302
|
const amount = byAmountIn ? amountIn : amountLimit;
|
|
6298
6303
|
const buildFromCoinRes = buildInputCoin(
|
|
6299
6304
|
txb,
|
|
6300
|
-
|
|
6305
|
+
fromCoins,
|
|
6301
6306
|
BigInt(amount.toString()),
|
|
6302
6307
|
fromCoinType
|
|
6303
6308
|
);
|
|
6304
6309
|
let deepCoin;
|
|
6305
6310
|
if (payDeepFeeAmount && payDeepFeeAmount > 0) {
|
|
6311
|
+
let deepCoins = yield this.getCoins(this.deepbookv3DeepFeeType());
|
|
6306
6312
|
deepCoin = buildInputCoin(
|
|
6307
6313
|
txb,
|
|
6308
|
-
|
|
6314
|
+
deepCoins,
|
|
6309
6315
|
BigInt(payDeepFeeAmount),
|
|
6310
6316
|
this.deepbookv3DeepFeeType()
|
|
6311
6317
|
).targetCoin;
|
|
@@ -6320,9 +6326,10 @@ var AggregatorClient8 = class {
|
|
|
6320
6326
|
deepbookv3DeepFee: deepCoin
|
|
6321
6327
|
});
|
|
6322
6328
|
if (isMergeTragetCoin) {
|
|
6329
|
+
let targetCoins = yield this.getCoins(targetCoinType, refreshAllCoins);
|
|
6323
6330
|
const targetCoinRes = buildInputCoin(
|
|
6324
6331
|
txb,
|
|
6325
|
-
|
|
6332
|
+
targetCoins,
|
|
6326
6333
|
BigInt(0),
|
|
6327
6334
|
targetCoinType
|
|
6328
6335
|
);
|
|
@@ -6342,9 +6349,9 @@ var AggregatorClient8 = class {
|
|
|
6342
6349
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6343
6350
|
publishedAt() {
|
|
6344
6351
|
if (this.env === 0 /* Mainnet */) {
|
|
6345
|
-
return "
|
|
6352
|
+
return "0xec2108d2092dd6f1f6fe45def639500e323596e0bab9fabc206461aadf357e6a";
|
|
6346
6353
|
} else {
|
|
6347
|
-
return "
|
|
6354
|
+
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6348
6355
|
}
|
|
6349
6356
|
}
|
|
6350
6357
|
// Include deepbookv3, scallop
|
package/dist/src/client.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare class AggregatorClient {
|
|
|
56
56
|
env: Env;
|
|
57
57
|
private allCoins;
|
|
58
58
|
constructor(endpoint?: string, signer?: string, client?: SuiClient, env?: Env);
|
|
59
|
-
|
|
59
|
+
getCoins(coinType: string, refresh?: boolean): Promise<CoinAsset[]>;
|
|
60
60
|
findRouters(params: FindRouterParams): Promise<RouterData | null>;
|
|
61
61
|
expectInputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], amountOutLimit: BN, partner?: string, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
|
|
62
62
|
expectOutputSwap(txb: Transaction, inputCoin: TransactionObjectArgument, routers: Router[], partner?: string): Promise<TransactionObjectArgument>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SwapInPoolsParams } from "~/client";
|
|
2
|
-
import { SwapInPoolsResult } from "..";
|
|
2
|
+
import { Env, SwapInPoolsResult } from "..";
|
|
3
3
|
import { SuiClient } from "@mysten/sui/client";
|
|
4
|
-
export declare function swapInPools(client: SuiClient, params: SwapInPoolsParams, sender: string): Promise<SwapInPoolsResult>;
|
|
4
|
+
export declare function swapInPools(client: SuiClient, params: SwapInPoolsParams, sender: string, env: Env): Promise<SwapInPoolsResult>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export declare const T_USDC = "";
|
|
1
|
+
export declare const T_USDC = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC";
|
|
2
|
+
export declare const T_USDT = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdt::USDT";
|
|
2
3
|
export declare const T_DEEP = "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP";
|
|
3
4
|
export declare const T_DBUSDC = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC";
|
|
4
5
|
export declare const T_DBUSDT = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT";
|
|
5
|
-
export declare const M_USDC = "
|
|
6
|
+
export declare const M_USDC = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
7
|
+
export declare const M_wUSDC = "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN";
|
|
6
8
|
export declare const M_CETUS = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS";
|
|
7
9
|
export declare const M_NAVI = "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX";
|
|
8
10
|
export declare const M_SUI = "0x2::sui::SUI";
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -95,42 +95,53 @@ export class AggregatorClient {
|
|
|
95
95
|
public signer: string
|
|
96
96
|
public client: SuiClient
|
|
97
97
|
public env: Env
|
|
98
|
-
private allCoins: CoinAsset[]
|
|
98
|
+
private allCoins: Map<string, CoinAsset[]>
|
|
99
99
|
|
|
100
100
|
constructor(endpoint?: string, signer?: string, client?: SuiClient, env?: Env) {
|
|
101
101
|
this.endpoint = endpoint ? processEndpoint(endpoint) : DEFAULT_ENDPOINT
|
|
102
102
|
this.client = client || new SuiClient({url: getFullnodeUrl('mainnet')})
|
|
103
103
|
this.signer = signer || ""
|
|
104
104
|
this.env = env || Env.Mainnet
|
|
105
|
-
this.allCoins = []
|
|
105
|
+
this.allCoins = new Map<string, CoinAsset[]>()
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
async
|
|
108
|
+
async getCoins(coinType: string, refresh: boolean = true): Promise<CoinAsset[]> {
|
|
109
109
|
if (this.signer === "") {
|
|
110
110
|
throw new Error("Signer is required, but not provided.")
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
let cursor = null
|
|
114
114
|
let limit = 50
|
|
115
|
+
|
|
116
|
+
if (!refresh) {
|
|
117
|
+
const gotFromCoins = this.allCoins.get(coinType)
|
|
118
|
+
if (gotFromCoins) {
|
|
119
|
+
return gotFromCoins
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
115
123
|
const allCoins: CoinAsset[] = []
|
|
116
124
|
while (true) {
|
|
117
|
-
const
|
|
125
|
+
const gotCoins = await this.client.getCoins({
|
|
118
126
|
owner: this.signer,
|
|
127
|
+
coinType,
|
|
119
128
|
cursor,
|
|
120
129
|
limit,
|
|
121
130
|
})
|
|
122
|
-
for (const coin of
|
|
131
|
+
for (const coin of gotCoins.data) {
|
|
123
132
|
allCoins.push({
|
|
124
133
|
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
125
134
|
coinObjectId: coin.coinObjectId,
|
|
126
135
|
balance: BigInt(coin.balance),
|
|
127
136
|
})
|
|
128
137
|
}
|
|
129
|
-
if (
|
|
138
|
+
if (gotCoins.data.length < limit) {
|
|
130
139
|
break
|
|
131
140
|
}
|
|
132
|
-
cursor =
|
|
141
|
+
cursor = gotCoins.data[limit - 1].coinObjectId
|
|
133
142
|
}
|
|
143
|
+
|
|
144
|
+
this.allCoins.set(coinType, allCoins)
|
|
134
145
|
return allCoins
|
|
135
146
|
}
|
|
136
147
|
|
|
@@ -235,7 +246,7 @@ export class AggregatorClient {
|
|
|
235
246
|
): Promise<SwapInPoolsResult | null> {
|
|
236
247
|
let result
|
|
237
248
|
try {
|
|
238
|
-
result = await swapInPools(this.client, params, this.signer)
|
|
249
|
+
result = await swapInPools(this.client, params, this.signer, this.env)
|
|
239
250
|
} catch (e) {
|
|
240
251
|
console.error("swapInPools error:", e)
|
|
241
252
|
return null
|
|
@@ -300,10 +311,12 @@ export class AggregatorClient {
|
|
|
300
311
|
refreshAllCoins,
|
|
301
312
|
payDeepFeeAmount,
|
|
302
313
|
} = params
|
|
303
|
-
|
|
304
|
-
this.allCoins = await this.getAllCoins()
|
|
305
|
-
}
|
|
314
|
+
|
|
306
315
|
const fromCoinType = routers[0].path[0].from
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
let fromCoins = await this.getCoins(fromCoinType, refreshAllCoins)
|
|
319
|
+
|
|
307
320
|
const targetCoinType = routers[0].path[routers[0].path.length - 1].target
|
|
308
321
|
const amountIn = routers.reduce(
|
|
309
322
|
(acc, router) => acc.add(router.amountIn),
|
|
@@ -321,16 +334,17 @@ export class AggregatorClient {
|
|
|
321
334
|
const amount = byAmountIn ? amountIn : amountLimit
|
|
322
335
|
const buildFromCoinRes = buildInputCoin(
|
|
323
336
|
txb,
|
|
324
|
-
|
|
337
|
+
fromCoins,
|
|
325
338
|
BigInt(amount.toString()),
|
|
326
339
|
fromCoinType
|
|
327
340
|
)
|
|
328
341
|
|
|
329
342
|
let deepCoin
|
|
330
343
|
if (payDeepFeeAmount && payDeepFeeAmount > 0) {
|
|
344
|
+
let deepCoins = await this.getCoins(this.deepbookv3DeepFeeType())
|
|
331
345
|
deepCoin = buildInputCoin(
|
|
332
346
|
txb,
|
|
333
|
-
|
|
347
|
+
deepCoins,
|
|
334
348
|
BigInt(payDeepFeeAmount),
|
|
335
349
|
this.deepbookv3DeepFeeType()
|
|
336
350
|
).targetCoin
|
|
@@ -347,9 +361,10 @@ export class AggregatorClient {
|
|
|
347
361
|
})
|
|
348
362
|
|
|
349
363
|
if (isMergeTragetCoin) {
|
|
364
|
+
let targetCoins = await this.getCoins(targetCoinType, refreshAllCoins)
|
|
350
365
|
const targetCoinRes = buildInputCoin(
|
|
351
366
|
txb,
|
|
352
|
-
|
|
367
|
+
targetCoins,
|
|
353
368
|
BigInt(0),
|
|
354
369
|
targetCoinType
|
|
355
370
|
)
|
|
@@ -369,9 +384,10 @@ export class AggregatorClient {
|
|
|
369
384
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
370
385
|
publishedAt(): string {
|
|
371
386
|
if (this.env === Env.Mainnet) {
|
|
372
|
-
return "
|
|
387
|
+
return "0xec2108d2092dd6f1f6fe45def639500e323596e0bab9fabc206461aadf357e6a" // version 4
|
|
373
388
|
} else {
|
|
374
|
-
return "0x0ed287d6c3fe4962d0994ffddc1d19a15fba6a81533f3f0dcc2bbcedebce0637"
|
|
389
|
+
// return "0x0ed287d6c3fe4962d0994ffddc1d19a15fba6a81533f3f0dcc2bbcedebce0637" // version 2
|
|
390
|
+
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"
|
|
375
391
|
}
|
|
376
392
|
}
|
|
377
393
|
|
package/src/transaction/cetus.ts
CHANGED
|
@@ -19,13 +19,13 @@ export class Cetus implements Dex {
|
|
|
19
19
|
this.globalConfig =
|
|
20
20
|
env === Env.Mainnet
|
|
21
21
|
? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f"
|
|
22
|
-
: "
|
|
22
|
+
: "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e"
|
|
23
23
|
|
|
24
24
|
this.partner =
|
|
25
25
|
partner ??
|
|
26
26
|
(env === Env.Mainnet
|
|
27
27
|
? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b"
|
|
28
|
-
: "
|
|
28
|
+
: "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
flash_swap(
|
package/src/transaction/swap.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions"
|
|
2
2
|
import { SwapInPoolsParams } from "~/client"
|
|
3
3
|
import { compareCoins, completionCoin } from "~/utils/coin"
|
|
4
|
-
import { SwapInPoolsResult, U64_MAX_BN, ZERO } from ".."
|
|
4
|
+
import { Env, SwapInPoolsResult, U64_MAX_BN, ZERO } from ".."
|
|
5
5
|
import { ConfigErrorCode, TransactionErrorCode } from "~/errors"
|
|
6
|
-
import { checkInvalidSuiAddress } from "~/utils/transaction"
|
|
6
|
+
import { checkInvalidSuiAddress, printTransaction } from "~/utils/transaction"
|
|
7
7
|
import { SuiClient } from "@mysten/sui/client"
|
|
8
8
|
import { BN } from "bn.js"
|
|
9
9
|
import { sqrtPriceX64ToPrice } from "~/math"
|
|
10
|
-
import { error } from "console"
|
|
11
10
|
|
|
12
11
|
export async function swapInPools(
|
|
13
12
|
client: SuiClient,
|
|
14
13
|
params: SwapInPoolsParams,
|
|
15
|
-
sender: string
|
|
14
|
+
sender: string,
|
|
15
|
+
env: Env
|
|
16
16
|
): Promise<SwapInPoolsResult> {
|
|
17
17
|
const { from, target, amount, byAmountIn, pools } = params
|
|
18
18
|
const fromCoin = completionCoin(from)
|
|
@@ -20,15 +20,14 @@ export async function swapInPools(
|
|
|
20
20
|
|
|
21
21
|
const tx = new Transaction()
|
|
22
22
|
const direction = compareCoins(fromCoin, targetCoin)
|
|
23
|
-
const integratePublishedAt =
|
|
24
|
-
"
|
|
23
|
+
const integratePublishedAt = env === Env.Mainnet ?
|
|
24
|
+
"0x15c0555d7601d98ca2659a8387d377a81b1e285ee0808484e101f96d05806187" :
|
|
25
|
+
"0x2918cf39850de6d5d94d8196dc878c8c722cd79db659318e00bff57fbb4e2ede"
|
|
25
26
|
const coinA = direction ? fromCoin : targetCoin
|
|
26
27
|
const coinB = direction ? targetCoin : fromCoin
|
|
27
28
|
|
|
28
29
|
const typeArguments = [coinA, coinB]
|
|
29
|
-
console.log("typeArguments", typeArguments)
|
|
30
|
-
|
|
31
|
-
console.log("pools", pools)
|
|
30
|
+
console.log("typeArguments", typeArguments, integratePublishedAt)
|
|
32
31
|
|
|
33
32
|
for (let i = 0; i < pools.length; i++) {
|
|
34
33
|
const args = [
|
|
@@ -51,6 +50,8 @@ export async function swapInPools(
|
|
|
51
50
|
)
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
printTransaction(tx)
|
|
54
|
+
|
|
54
55
|
const simulateRes = await client.devInspectTransactionBlock({
|
|
55
56
|
transactionBlock: tx,
|
|
56
57
|
sender,
|
|
@@ -97,7 +98,6 @@ export async function swapInPools(
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
const event = valueData[tempIndex].parsedJson.data
|
|
100
|
-
console.log("event", JSON.stringify(event, null, 2))
|
|
101
101
|
|
|
102
102
|
const currentSqrtPrice = event.step_results[0].current_sqrt_price
|
|
103
103
|
|
package/tests/router.test.ts
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { describe, test } from "@jest/globals"
|
|
2
2
|
import dotenv from "dotenv"
|
|
3
3
|
import { AggregatorClient } from "~/client"
|
|
4
|
-
import
|
|
5
|
-
M_CETUS,
|
|
6
|
-
M_ETH,
|
|
7
|
-
M_HASUI,
|
|
8
|
-
M_MICHI,
|
|
9
|
-
M_NAVI,
|
|
10
|
-
M_SHaSUI,
|
|
11
|
-
M_SSUI,
|
|
12
|
-
M_SSWP,
|
|
13
|
-
M_SUI,
|
|
14
|
-
M_USDC,
|
|
15
|
-
T_DBUSDC,
|
|
16
|
-
T_DBUSDT,
|
|
17
|
-
T_DEEP,
|
|
18
|
-
} from "./test_data.test"
|
|
4
|
+
import * as testData from "./test_data.test"
|
|
19
5
|
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519"
|
|
20
6
|
import { printTransaction } from "~/utils/transaction"
|
|
21
7
|
import BN from "bn.js"
|
|
@@ -47,48 +33,40 @@ describe("router module", () => {
|
|
|
47
33
|
keypair = buildTestAccount()
|
|
48
34
|
}
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// console.log("wallet", wallet, "\n", wallet.toString())
|
|
53
|
-
|
|
54
|
-
// const wallet =
|
|
55
|
-
// "0x2a6174f94a2c1d648de290297be27867527a6aaa263a4e0a567c9cd7656d3651"
|
|
56
|
-
const wallet =
|
|
57
|
-
"0xca171941521153181ff729d53489eaae7e99c3f4692884afd7cca61154e4cec4"
|
|
58
|
-
// const wallet =
|
|
59
|
-
// "0xaabf2fedcb36146db164bec930b74a47969c4df98216e049342a3c49b6d11580"
|
|
60
|
-
// const wallet = "0x410456cfc689666936b6bf80fbec958b69499b9f7183ecba07de577c17248a44"
|
|
61
|
-
// const wallet = "0xca171941521153181ff729d53489eaae7e99c3f4692884afd7cca61154e4cec4"
|
|
36
|
+
const wallet = keypair.getPublicKey().toSuiAddress()
|
|
62
37
|
console.log("wallet: ", wallet)
|
|
63
38
|
|
|
64
|
-
const endpoint =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// "https://api-sui.devcetus.com/router_v2/find_routes"
|
|
39
|
+
// // const endpoint =
|
|
40
|
+
// // "https://api-sui-cloudfront.cetus.zone/router_v2/find_routes"
|
|
41
|
+
const endpoint = aggregatorURL
|
|
68
42
|
|
|
69
43
|
const suiClient = new SuiClient({
|
|
70
|
-
url:
|
|
44
|
+
url: fullNodeURL,
|
|
71
45
|
})
|
|
46
|
+
// const suiClient = new SuiClient({
|
|
47
|
+
// url: "https://fullnode.testnet.sui.io:443",
|
|
48
|
+
// })
|
|
49
|
+
|
|
72
50
|
client = new AggregatorClient(endpoint, wallet, suiClient, Env.Mainnet)
|
|
73
51
|
})
|
|
74
52
|
|
|
75
|
-
test("Get
|
|
76
|
-
return client.
|
|
53
|
+
test("Get coins", () => {
|
|
54
|
+
return client.getCoins(testData.M_wUSDC).then((coins) => {
|
|
77
55
|
console.log(coins)
|
|
78
56
|
})
|
|
79
57
|
})
|
|
80
58
|
|
|
81
59
|
test("Downgrade swap in route", async () => {
|
|
82
|
-
const amount =
|
|
60
|
+
const amount = 1000000
|
|
83
61
|
const byAmountIn = true
|
|
84
62
|
|
|
85
63
|
const res: any = await client.swapInPools({
|
|
86
|
-
from:
|
|
87
|
-
target:
|
|
64
|
+
from: testData.M_USDC,
|
|
65
|
+
target: testData.M_SUI,
|
|
88
66
|
amount: new BN(amount),
|
|
89
67
|
byAmountIn,
|
|
90
68
|
pools: [
|
|
91
|
-
'
|
|
69
|
+
'0xb8d7d9e66a60c239e7a60110efcf8de6c705580ed924d0dde141f4a0e2c90105'
|
|
92
70
|
],
|
|
93
71
|
})
|
|
94
72
|
|
|
@@ -106,6 +84,8 @@ describe("router module", () => {
|
|
|
106
84
|
refreshAllCoins: true,
|
|
107
85
|
})
|
|
108
86
|
|
|
87
|
+
printTransaction(txb)
|
|
88
|
+
|
|
109
89
|
let result = await client.devInspectTransactionBlock(txb)
|
|
110
90
|
console.log("🚀 ~ file: router.test.ts:114 ~ test ~ result:", result)
|
|
111
91
|
}
|
|
@@ -114,8 +94,8 @@ describe("router module", () => {
|
|
|
114
94
|
test("Find router", async () => {
|
|
115
95
|
const amount = "4239267610000000000"
|
|
116
96
|
const res = await client.findRouters({
|
|
117
|
-
from: M_SUI,
|
|
118
|
-
target: M_USDC,
|
|
97
|
+
from: testData.M_SUI,
|
|
98
|
+
target: testData.M_USDC,
|
|
119
99
|
amount: new BN(amount),
|
|
120
100
|
byAmountIn: true,
|
|
121
101
|
depth: 3,
|
|
@@ -132,9 +112,9 @@ describe("router module", () => {
|
|
|
132
112
|
|
|
133
113
|
test("Build router tx", async () => {
|
|
134
114
|
const byAmountIn = true
|
|
135
|
-
const amount = "
|
|
136
|
-
const target =
|
|
137
|
-
const from =
|
|
115
|
+
const amount = "320000"
|
|
116
|
+
const target = "0x2::sui::SUI"
|
|
117
|
+
const from = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::eth::ETH"
|
|
138
118
|
|
|
139
119
|
const res = await client.findRouters({
|
|
140
120
|
from,
|
|
@@ -172,6 +152,7 @@ describe("router module", () => {
|
|
|
172
152
|
txb,
|
|
173
153
|
slippage: 0.01,
|
|
174
154
|
isMergeTragetCoin: false,
|
|
155
|
+
partner: "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5",
|
|
175
156
|
refreshAllCoins: true,
|
|
176
157
|
payDeepFeeAmount: 0,
|
|
177
158
|
})
|
|
@@ -195,8 +176,8 @@ describe("router module", () => {
|
|
|
195
176
|
const byAmountIn = false
|
|
196
177
|
const amount = "10000000000"
|
|
197
178
|
|
|
198
|
-
const from = M_USDC
|
|
199
|
-
const target = M_SSWP
|
|
179
|
+
const from = testData.M_USDC
|
|
180
|
+
const target = testData.M_SSWP
|
|
200
181
|
|
|
201
182
|
const res = await client.findRouters({
|
|
202
183
|
from,
|
|
@@ -238,8 +219,8 @@ describe("router module", () => {
|
|
|
238
219
|
|
|
239
220
|
test("Test Multi Input", async () => {
|
|
240
221
|
const amounts = [1000000000, 2000000000, 10000000000000]
|
|
241
|
-
const froms = [M_USDC, M_SUI, M_CETUS, M_NAVI]
|
|
242
|
-
const tos = [M_SUI, M_USDC, M_USDC, M_SUI]
|
|
222
|
+
const froms = [testData.M_USDC, testData.M_SUI, testData.M_CETUS, testData.M_NAVI]
|
|
223
|
+
const tos = [testData.M_SUI, testData.M_USDC, testData.M_USDC, testData.M_SUI]
|
|
243
224
|
|
|
244
225
|
for (let i = 0; i < froms.length; i++) {
|
|
245
226
|
const from = froms[i]
|
|
@@ -295,13 +276,13 @@ describe("router module", () => {
|
|
|
295
276
|
// const from = M_USDC
|
|
296
277
|
// const target = M_SUI
|
|
297
278
|
|
|
298
|
-
const from = M_SUI
|
|
279
|
+
const from = testData.M_SUI
|
|
299
280
|
// const target =
|
|
300
281
|
// "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
|
|
301
282
|
// const target =
|
|
302
283
|
// "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI"
|
|
303
284
|
|
|
304
|
-
const target = M_HASUI
|
|
285
|
+
const target = testData.M_HASUI
|
|
305
286
|
|
|
306
287
|
const res = await client.findRouters({
|
|
307
288
|
from,
|
package/tests/test_data.test.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Testnet
|
|
2
|
-
export const T_USDC = ""
|
|
2
|
+
export const T_USDC = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC"
|
|
3
|
+
export const T_USDT = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdt::USDT"
|
|
3
4
|
export const T_DEEP = "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"
|
|
4
5
|
export const T_DBUSDC = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC"
|
|
5
6
|
export const T_DBUSDT = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT"
|
|
6
7
|
|
|
7
8
|
// Mainnet
|
|
8
|
-
export const M_USDC =
|
|
9
|
+
export const M_USDC = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
|
|
10
|
+
export const M_wUSDC =
|
|
9
11
|
"0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
|
|
10
12
|
export const M_CETUS =
|
|
11
13
|
"0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
|