zhangchunrui 1 тиждень тому
батько
коміт
c22f842169
1 змінених файлів з 5 додано та 1 видалено
  1. 5 1
      src/copy/index.ts

+ 5 - 1
src/copy/index.ts

@@ -49,7 +49,11 @@ export async function copyPosition(positionDetails: OpenPositionEvent['positionD
 			positionAddress,
 			maxUsdValue,
 		}),
-	}).then(res => res.json()).then(() => {
+	}).then(res => res.json()).then((response: unknown) => {
+		const data = response as { ok?: boolean, error?: string }
+		if (!data.ok) {
+			throw new Error(data.error ?? 'Failed to copy position')
+		}
 		console.log(`[${Date.now()}] 复制仓位成功`)
 		// 发送Discord通知,使用embeds
 		const solscanBaseUrl = 'https://solscan.io'