我已经尝试构建外部适配器,但不幸的是,我一直遇到错误:“您无权执行此请求”
如果您想知道如何准确构建一个,可以使用以下资源(基本上相同的材料但格式不同):
在上面的资源中,NodeJS 中使用了一个模板: https ://github.com/PatrickAlphaC/CL-EA-NodeJS-Template
这是我自己尝试的回购(有错误)。我刚刚修改了 index.js 文件: https ://github.com/gvandriel/CL-EA-NodeJS-Template
然后启动服务器
- 纱线(安装依赖项)
- 纱线开始
打开另一个终端并粘贴以下内容以发布提款请求:
curl -X POST -H "content-type:application/json" "http://localhost:8080/" --data '{ "id": 0, "data": { "asset": "USDT", "address": "0xe66273cC443F774653E885496f76b486F956B47F", "amount": 10 } }'
请注意,由于您要从 Binance 提款,您需要在您的帐户 API 设置中启用它并设置受限 IP 地址。此外,我相信您只能从您之前提取的地址中提取资金。另外不要忘记使用您自己的密钥更新 .env_sample 文件
代码中有什么作用?
我们知道第 58 行的总字符串正在工作,因为我们在外部适配器之外对其进行了测试。此外,我们还知道带有 X-MBX-APIKEY 的标头正在工作。因此,我们认为错误包括以下内容:
Requester.request(config, customError)
.then((response) => {
// It's common practice to store the desired value at the top-level
// result key. This allows different adapters to be compatible with
// one another.
response.data.result = Requester.validateResultNumber(response.data, [
"msg",
]);
callback(response.status, Requester.success(jobRunID, response));
})
.catch((error) => {
callback(500, Requester.errored(jobRunID, error));
});
该错误也可能在代码中的其他位置,因此请务必在此处检查修改后的 index.js 文件: https ://github.com/gvandriel/CL-EA-NodeJS-Template