yhtx 1.0.5 → 1.0.7

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.
Files changed (2) hide show
  1. package/index.js +11 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -76,13 +76,15 @@ async function call(path, { apiKey, secret, data, method, recvWindow } = {}) {
76
76
  .then((r) => {
77
77
  let dt = r.data;
78
78
  if (dt?.code == 403 && msg == "Verification failure [校验失败]") {
79
- console.log("api issue: null"); //{code:403,msg:'Verification failure [校验失败]',data:null,ts:1758849372250}
80
- } else if (dt?.status == "error" && dt?.["err-code"] == "api-signature-not-valid") {
81
- console.log("api issue2: null"); ////{status: 'error','err-code': 'api-signature-not-valid','err-msg': 'Signature not valid: Verification failure [校验失败]',data:null}
79
+ console.log("api bug: null"); //{code:403,msg:'Verification failure [校验失败]',data:null,ts:1758849372250}
80
+ } else if (dt?.status == "error") {
81
+ if (dt?.["err-code"] == "api-signature-not-valid") {
82
+ console.log("api bug2: null"); ////{status: 'error','err-code': 'api-signature-not-valid','err-msg': 'Signature not valid: Verification failure [校验失败]',data:null}
83
+ } else if (dt?.err_code == 403) console.log("api bug3: undefined"); //{status:"error",err_code:403,err_msg:"Verification failure [校验失败]",ts:1758854139970};
82
84
  } else if (dt?.message == "Verification failure [校验失败]" && dt?.code == 1003) {
83
- console.log("api issue3: undefined"); //{ message: 'Verification failure [校验失败]', code: 1003, success: false }
85
+ console.log("api bug4: undefined"); //{ message: 'Verification failure [校验失败]', code: 1003, success: false }
84
86
  } else if (dt?.message == "Verification failure" && dt?.code == 12008) {
85
- console.log("api issue4: null"); //{ code: 12008, message: "Verification failure", data: null };
87
+ console.log("api bug5: null"); //{ code: 12008, message: "Verification failure", data: null };
86
88
  } else if (!(r.data?.code == 200 /*success*/ || r.data?.status == "ok")) {
87
89
  console.log(r.data); //if not code:200 or status:ok, then log //
88
90
  } //eg{message:'The account API interface queried is empty',code:40237,success:false}
@@ -90,8 +92,10 @@ async function call(path, { apiKey, secret, data, method, recvWindow } = {}) {
90
92
  let rs = r.data.data;
91
93
  if (rs == null && dt?.status == "error") {
92
94
  rs = r.data; //eg rs={status:"error","err-code":"dw-withdraw-precision-limit","err-msg":"withdraw amount precision cannot be greater than 6",data:null}
93
- } else if (rs == undefined && dt?.success == false && dt?.code != 1003) {
94
- rs = r.data; //eg rs={message:'The account API interface queried is empty',code:40237,success:false}
95
+ } else if (rs == undefined) {
96
+ if (![dt?.err_msg, dt?.message].includes("Verification failure [校验失败]")) {
97
+ rs = r.data; //eg rs={message:'The account API interface queried is empty',code:40237,success:false}
98
+ } // if (dt?.success == false && dt?.code != 1003 && /*bug3*/ dt?.err_code != 403) {
95
99
  }
96
100
 
97
101
  return rs; //rs=DATA | {status:'error','err=code','err-msg',data:null} | null(if api fail) | undefined(if apiFail)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yhtx",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "HTX API",
5
5
  "main": "index.js",
6
6
  "scripts": {