@cetusprotocol/aggregator-sdk 0.11.1 → 0.12.1

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 CHANGED
@@ -29,7 +29,9 @@ Multi-Platform Support: Currently, we have integrated multiple mainstream DEXs o
29
29
 
30
30
  By using our aggregator, you can trade more efficiently and securely on the Sui blockchain, fully leveraging the various opportunities brought by decentralized finance (DeFi).
31
31
 
32
- # Install
32
+ # Aggregator SDK
33
+
34
+ ## Install
33
35
 
34
36
  The SDK is published to npm registry. To use the SDK in your project, you can
35
37
 
@@ -37,33 +39,15 @@ The SDK is published to npm registry. To use the SDK in your project, you can
37
39
  npm install @cetusprotocol/aggregator-sdk
38
40
  ```
39
41
 
40
- # Usage
41
-
42
- ## 1. Init client with rpc and package config
42
+ ## Usage
43
43
 
44
- 1. Fast init:
45
- ```typescript
46
- const client = new AggregatorClient({})
47
- ```
44
+ ### 1. Init client with rpc and package config
48
45
 
49
- 2. Full init:
50
- > Note: overlayFeeRate and overlayFeeReceiver are used for additional fee logic beyond protocol fees, allowing project parties to collect extra fees.
51
-
52
- ```typescript
53
- const client = new AggregatorClient({
54
- // endpoint, // If you do not have a exclusive aggregator api domain,just use cetus default aggregator endpoints.
55
- signer: wallet,
56
- client: suiClient,
57
- env: Env.Mainnet,
58
- pythUrls: ["YOUR_PYTH_URL", "ANOTHER_PYTH_URL"],
59
- partner: "YOUR_PARTNER_ID", // Partner ID for fee sharing. Set once during initialization instead of per swap.
60
- overlayFeeRate: 0.01, // Overlay fee rate (0.01 represents 1%). The denominator is 1000000, so 0.01% = 100
61
- overlayFeeReceiver: "0x..", // Address to receive the overlay fees
62
- })
63
- ```
64
- **Notes**: Some providers, such as HaedalHMM and Metastable, rely on Pyth oracle prices when build transactions. Currently, we have a default configuration that connects to Pyth's publicly available node. However, if you frequently build transactions, we recommend setting up a private Pyth node interface as an additional backup. This will ensure uninterrupted access to HaedalHMM and Metastable, even if the public node experiences occasional downtime.
46
+ ```typescript
47
+ const client = new AggregatorClient({})
48
+ ```
65
49
 
66
- ## 2. Get best router swap result from aggregator service
50
+ ### 2. Get best router swap result from aggregator service
67
51
 
68
52
  ```typescript
69
53
  const amount = new BN(1000000)
@@ -79,72 +63,97 @@ const routers = await client.findRouters({
79
63
  })
80
64
  ```
81
65
 
82
- ## 3. Confirm and do fast swap
66
+ ### 3. Confirm and do fast swap
67
+
83
68
  ```typescript
84
- const routerTx = new Transaction()
69
+ const txb = new Transaction()
85
70
 
86
71
  if (routerRes != null) {
87
72
  await client.fastRouterSwap({
88
73
  routers,
89
- txb: routerTx,
74
+ txb,
90
75
  slippage: 0.01,
91
- isMergeTragetCoin: true,
92
- refreshAllCoins: true
93
76
  })
94
77
 
95
- let result = await client.devInspectTransactionBlock(routerTx, keypair)
78
+ const result = await client.devInspectTransactionBlock(txb, keypair)
96
79
 
97
80
  if (result.effects.status.status === "success") {
98
- console.log("[Cetus] Transaction simulation successful")
99
- const result = await client.signAndExecuteTransaction(routerTx, keypair)
100
- console.log("[Cetus] Transaction executed successfully:", {
101
- digest: result.digest,
102
- status: result.effects?.status,
103
- gasUsed: result.effects?.gasUsed
104
- })
105
- } else {
106
- console.error("[Cetus] Transaction simulation failed:", result.effects?.status)
81
+ console.log("Sim exec transaction success")
82
+ const result = await client.signAndExecuteTransaction(txb, keypair)
107
83
  }
84
+ console.log("result", result)
108
85
  }
109
86
  ```
110
87
 
111
- ## 4. Build PTB and return target coin
88
+ ### 4. Build PTB and return target coin
112
89
 
113
90
  ```typescript
114
- const routerTx = new Transaction()
115
- const byAmountIn = true;
91
+ const txb = new Transaction()
92
+ const byAmountIn = true
116
93
 
117
94
  if (routerRes != null) {
118
95
  const targetCoin = await client.routerSwap({
119
96
  routers,
120
- txb: routerTx,
97
+ txb,
121
98
  inputCoin,
122
99
  slippage: 0.01,
123
100
  })
124
101
 
125
102
  // you can use this target coin object argument to build your ptb.
126
- client.transferOrDestroyCoin(
127
- txb,
128
- targetCoin,
129
- targetCoinType
130
- )
103
+ client.transferOrDestoryCoin(txb, targetCoin, targetCoinType)
131
104
 
132
- let result = await client.devInspectTransactionBlock(routerTx, keypair)
105
+ const result = await client.devInspectTransactionBlock(txb, keypair)
133
106
 
134
107
  if (result.effects.status.status === "success") {
135
- console.log("[Cetus] Transaction simulation successful")
136
- const result = await client.signAndExecuteTransaction(routerTx, keypair)
137
- console.log("[Cetus] Transaction executed successfully:", {
138
- digest: result.digest,
139
- status: result.effects?.status,
140
- gasUsed: result.effects?.gasUsed
141
- })
142
- } else {
143
- console.error("[Cetus] Transaction simulation failed:", result.effects?.status)
108
+ console.log("Sim exec transaction success")
109
+ const result = await client.signAndExecuteTransaction(txb, keypair)
144
110
  }
111
+ console.log("result", result)
145
112
  }
146
113
  ```
147
114
 
115
+ # Aggregator Contract Interface
116
+
117
+ ## Tags corresponding to different networks
118
+
119
+ | Contract | Tag of Repo | Latest published at address |
120
+ | ------------------------- | ----------- | ------------------------------------------------------------------ |
121
+ | CetusAggregatorV2 | mainnet | 0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032 |
122
+ | CetusAggregatorV2ExtendV1 | mainnet | 0x39402d188b7231036e52266ebafad14413b4bf3daea4ac17115989444e6cd516 |
123
+ | CetusAggregatorV2ExtendV2 | mainnet | 0x368d13376443a8051b22b42a9125f6a3bc836422bb2d9c4a53984b8d6624c326 |
124
+
125
+ ## Example
126
+
127
+ ```
128
+ CetusAggregatorV2 = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2/mainnet", rev = "mainnet", override = true }
129
+
130
+ CetusAggregatorV2ExtendV1 = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2-extend-v1", rev = "mainnet", override = true }
131
+
132
+ CetusAggregatorV2ExtendV2 = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2-extend-v2", rev = "mainnet", override = true }
133
+ ```
134
+
135
+ # Simple Aggregator Contract Interface(include cetus, flowxv3, turbos, bluefin)
136
+
137
+ ## Tags corresponding to different networks
138
+
139
+ | Contract | Tag of Repo | Latest published at address |
140
+ | --------------------- | ----------- | ------------------------------------------------------------------ |
141
+ | CetusAggregatorSimple | mainnet | 0x594d67abc0778023ac852800578271dd7e18698ad06e6298034858c77612333d |
142
+
143
+ ## Example
144
+
145
+ ```
146
+ CetusAggregatorSimple = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2/simple-mainnet", rev = "mainnet-v1.49.1", override = true }
147
+ ```
148
+
149
+ ## Usage
150
+
151
+ Cetus clmm interface is not complete(just have function definition), so it will fails when sui client check the code version. However, this does not affect its actual functionality. Therefore, we need to add a --dependencies-are-root during the build.
152
+
153
+ ```
154
+ sui move build --dependencies-are-root && sui client publish --dependencies-are-root
155
+ ```
156
+
148
157
  # More About Cetus
149
158
 
150
159
  Use the following links to learn more about Cetus:
package/dist/index.js CHANGED
@@ -5274,15 +5274,14 @@ var Cetus = class {
5274
5274
  this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
5275
5275
  this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
5276
5276
  }
5277
- flash_swap(client, txb, path, by_amount_in, packages) {
5277
+ flash_swap(client, txb, path, amount_arg, by_amount_in, packages) {
5278
5278
  const { direction, from, target } = path;
5279
5279
  const [func, coinAType, coinBType] = direction ? ["flash_swap_a2b", from, target] : ["flash_swap_b2a", target, from];
5280
- let amount = by_amount_in ? path.amountIn : path.amountOut;
5281
5280
  const args = [
5282
5281
  txb.object(this.globalConfig),
5283
5282
  txb.object(path.id),
5284
5283
  txb.object(this.partner),
5285
- txb.pure.u64(amount),
5284
+ amount_arg,
5286
5285
  txb.pure.bool(by_amount_in),
5287
5286
  txb.object(CLOCK_ADDRESS)
5288
5287
  ];
@@ -5805,7 +5804,7 @@ function swapInPools(client, params, sender, env) {
5805
5804
  const targetCoin = completionCoin(target);
5806
5805
  const tx = new transactions.Transaction();
5807
5806
  const direction = compareCoins(fromCoin, targetCoin);
5808
- const integratePublishedAt = env === 0 /* Mainnet */ ? "0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5807
+ const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5809
5808
  const coinA = direction ? fromCoin : targetCoin;
5810
5809
  const coinB = direction ? targetCoin : fromCoin;
5811
5810
  const typeArguments = [coinA, coinB];
@@ -7039,9 +7038,11 @@ var _AggregatorClient = class _AggregatorClient {
7039
7038
  );
7040
7039
  for (let i = 0; i < routers.length; i++) {
7041
7040
  const router = routers[i];
7041
+ let amount_arg = txb.pure.u64(router.amountOut.toString());
7042
7042
  for (let j = router.path.length - 1; j >= 0; j--) {
7043
7043
  const path = router.path[j];
7044
- const flashSwapResult = dex.flash_swap(this, txb, path, false);
7044
+ const flashSwapResult = dex.flash_swap(this, txb, path, amount_arg, false);
7045
+ amount_arg = flashSwapResult.payAmount;
7045
7046
  returnCoins.unshift(flashSwapResult.targetCoin);
7046
7047
  receipts.unshift(flashSwapResult.flashReceipt);
7047
7048
  }
@@ -7279,6 +7280,7 @@ var _AggregatorClient = class _AggregatorClient {
7279
7280
  byAmountIn,
7280
7281
  slippage
7281
7282
  );
7283
+ console.log("amountLimit", amountLimit.toString());
7282
7284
  const amount = byAmountIn ? expectedAmountIn : amountLimit;
7283
7285
  const buildFromCoinRes = buildInputCoin(
7284
7286
  txb,
@@ -7344,7 +7346,7 @@ var _AggregatorClient = class _AggregatorClient {
7344
7346
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7345
7347
  publishedAtV2() {
7346
7348
  if (this.env === 0 /* Mainnet */) {
7347
- return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
7349
+ return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7348
7350
  } else {
7349
7351
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7350
7352
  }
@@ -7352,14 +7354,14 @@ var _AggregatorClient = class _AggregatorClient {
7352
7354
  // Include deepbookv3, scallop, bluefin
7353
7355
  publishedAtV2Extend() {
7354
7356
  if (this.env === 0 /* Mainnet */) {
7355
- return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
7357
+ return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7356
7358
  } else {
7357
7359
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7358
7360
  }
7359
7361
  }
7360
7362
  publishedAtV2Extend2() {
7361
7363
  if (this.env === 0 /* Mainnet */) {
7362
- return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
7364
+ return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7363
7365
  } else {
7364
7366
  return "0x0";
7365
7367
  }
@@ -7760,7 +7762,7 @@ function processEndpoint(endpoint) {
7760
7762
 
7761
7763
  // src/api.ts
7762
7764
  var import_bn7 = __toESM(require_bn());
7763
- var SDK_VERSION = 1001101;
7765
+ var SDK_VERSION = 1001201;
7764
7766
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7765
7767
  return __async(this, null, function* () {
7766
7768
  let response;
package/dist/index.mjs CHANGED
@@ -5272,15 +5272,14 @@ var Cetus = class {
5272
5272
  this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
5273
5273
  this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
5274
5274
  }
5275
- flash_swap(client, txb, path, by_amount_in, packages) {
5275
+ flash_swap(client, txb, path, amount_arg, by_amount_in, packages) {
5276
5276
  const { direction, from, target } = path;
5277
5277
  const [func, coinAType, coinBType] = direction ? ["flash_swap_a2b", from, target] : ["flash_swap_b2a", target, from];
5278
- let amount = by_amount_in ? path.amountIn : path.amountOut;
5279
5278
  const args = [
5280
5279
  txb.object(this.globalConfig),
5281
5280
  txb.object(path.id),
5282
5281
  txb.object(this.partner),
5283
- txb.pure.u64(amount),
5282
+ amount_arg,
5284
5283
  txb.pure.bool(by_amount_in),
5285
5284
  txb.object(CLOCK_ADDRESS)
5286
5285
  ];
@@ -5803,7 +5802,7 @@ function swapInPools(client, params, sender, env) {
5803
5802
  const targetCoin = completionCoin(target);
5804
5803
  const tx = new Transaction();
5805
5804
  const direction = compareCoins(fromCoin, targetCoin);
5806
- const integratePublishedAt = env === 0 /* Mainnet */ ? "0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5805
+ const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5807
5806
  const coinA = direction ? fromCoin : targetCoin;
5808
5807
  const coinB = direction ? targetCoin : fromCoin;
5809
5808
  const typeArguments = [coinA, coinB];
@@ -7037,9 +7036,11 @@ var _AggregatorClient = class _AggregatorClient {
7037
7036
  );
7038
7037
  for (let i = 0; i < routers.length; i++) {
7039
7038
  const router = routers[i];
7039
+ let amount_arg = txb.pure.u64(router.amountOut.toString());
7040
7040
  for (let j = router.path.length - 1; j >= 0; j--) {
7041
7041
  const path = router.path[j];
7042
- const flashSwapResult = dex.flash_swap(this, txb, path, false);
7042
+ const flashSwapResult = dex.flash_swap(this, txb, path, amount_arg, false);
7043
+ amount_arg = flashSwapResult.payAmount;
7043
7044
  returnCoins.unshift(flashSwapResult.targetCoin);
7044
7045
  receipts.unshift(flashSwapResult.flashReceipt);
7045
7046
  }
@@ -7277,6 +7278,7 @@ var _AggregatorClient = class _AggregatorClient {
7277
7278
  byAmountIn,
7278
7279
  slippage
7279
7280
  );
7281
+ console.log("amountLimit", amountLimit.toString());
7280
7282
  const amount = byAmountIn ? expectedAmountIn : amountLimit;
7281
7283
  const buildFromCoinRes = buildInputCoin(
7282
7284
  txb,
@@ -7342,7 +7344,7 @@ var _AggregatorClient = class _AggregatorClient {
7342
7344
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7343
7345
  publishedAtV2() {
7344
7346
  if (this.env === 0 /* Mainnet */) {
7345
- return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
7347
+ return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7346
7348
  } else {
7347
7349
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7348
7350
  }
@@ -7350,14 +7352,14 @@ var _AggregatorClient = class _AggregatorClient {
7350
7352
  // Include deepbookv3, scallop, bluefin
7351
7353
  publishedAtV2Extend() {
7352
7354
  if (this.env === 0 /* Mainnet */) {
7353
- return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
7355
+ return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7354
7356
  } else {
7355
7357
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7356
7358
  }
7357
7359
  }
7358
7360
  publishedAtV2Extend2() {
7359
7361
  if (this.env === 0 /* Mainnet */) {
7360
- return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
7362
+ return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7361
7363
  } else {
7362
7364
  return "0x0";
7363
7365
  }
@@ -7758,7 +7760,7 @@ function processEndpoint(endpoint) {
7758
7760
 
7759
7761
  // src/api.ts
7760
7762
  var import_bn7 = __toESM(require_bn());
7761
- var SDK_VERSION = 1001101;
7763
+ var SDK_VERSION = 1001201;
7762
7764
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7763
7765
  return __async(this, null, function* () {
7764
7766
  let response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.11.1",
3
+ "version": "0.12.1",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,85 @@
1
+ #!/bin/bash
2
+
3
+ # 复制 aggregator-sdk 文件到 sui/aggregator 目录的脚本
4
+ # 作者: Auto Generated Script
5
+ # 日期: $(date)
6
+
7
+ set -e # 遇到错误时退出
8
+
9
+ # 定义源目录和目标目录
10
+ SOURCE_DIR="/home/ccbond/github/cetus/aggregator-sdk"
11
+ TARGET_DIR="/home/ccbond/github/sui/aggregator"
12
+
13
+ # 颜色定义
14
+ RED='\033[0;31m'
15
+ GREEN='\033[0;32m'
16
+ YELLOW='\033[1;33m'
17
+ NC='\033[0m' # No Color
18
+
19
+ # 打印带颜色的消息
20
+ print_message() {
21
+ local color=$1
22
+ local message=$2
23
+ echo -e "${color}${message}${NC}"
24
+ }
25
+
26
+ # 检查源目录是否存在
27
+ if [ ! -d "$SOURCE_DIR" ]; then
28
+ print_message $RED "错误: 源目录 $SOURCE_DIR 不存在!"
29
+ exit 1
30
+ fi
31
+
32
+ # 创建目标目录(如果不存在)
33
+ if [ ! -d "$TARGET_DIR" ]; then
34
+ print_message $YELLOW "目标目录 $TARGET_DIR 不存在,正在创建..."
35
+ mkdir -p "$TARGET_DIR"
36
+ fi
37
+
38
+ print_message $GREEN "开始复制文件..."
39
+ print_message $YELLOW "源目录: $SOURCE_DIR"
40
+ print_message $YELLOW "目标目录: $TARGET_DIR"
41
+ echo
42
+
43
+ # 复制 src 目录
44
+ if [ -d "$SOURCE_DIR/src" ]; then
45
+ print_message $GREEN "复制 src 目录..."
46
+ cp -r "$SOURCE_DIR/src" "$TARGET_DIR/"
47
+ else
48
+ print_message $RED "警告: src 目录不存在于源路径中"
49
+ fi
50
+
51
+ # 复制 package.json
52
+ if [ -f "$SOURCE_DIR/package.json" ]; then
53
+ print_message $GREEN "复制 package.json..."
54
+ cp "$SOURCE_DIR/package.json" "$TARGET_DIR/"
55
+ else
56
+ print_message $RED "警告: package.json 不存在于源路径中"
57
+ fi
58
+
59
+ # 复制 README.md (假设是 README.md)
60
+ if [ -f "$SOURCE_DIR/README.md" ]; then
61
+ print_message $GREEN "复制 README.md..."
62
+ cp "$SOURCE_DIR/README.md" "$TARGET_DIR/"
63
+ elif [ -f "$SOURCE_DIR/README" ]; then
64
+ print_message $GREEN "复制 README..."
65
+ cp "$SOURCE_DIR/README" "$TARGET_DIR/"
66
+ else
67
+ print_message $RED "警告: README 或 README.md 不存在于源路径中"
68
+ fi
69
+
70
+ # 复制 tests 目录
71
+ if [ -d "$SOURCE_DIR/tests" ]; then
72
+ print_message $GREEN "复制 tests 目录..."
73
+ cp -r "$SOURCE_DIR/tests" "$TARGET_DIR/"
74
+ else
75
+ print_message $RED "警告: tests 目录不存在于源路径中"
76
+ fi
77
+
78
+ echo
79
+ print_message $GREEN "复制完成!"
80
+ print_message $YELLOW "复制的文件和目录位于: $TARGET_DIR"
81
+
82
+ # 显示目标目录内容
83
+ echo
84
+ print_message $YELLOW "目标目录内容:"
85
+ ls -la "$TARGET_DIR"