Hummingbot Gateway AMM Middleware

Hummingbot Gateway 是一个 REST API,它公开与各种区块链(钱包、节点和链交互)和去中心化交易所(定价、交易和流动性提供)的连接。
它用 Typescript 编写,并利用现有的区块链和 DEX SDK。使用网关的优势在于它提供了一种与编程语言无关的方法来与区块链和 DEX 进行交互。

官方文档

步骤

1
2
3
4
5
6
7
8
9
10
11
12
# Install dependencies
yarn

# Complile Typescript into JS
$ yarn build

# Run Gateway setup script, which helps you set configs and CERTS_PATH
$ chmod a+x gateway-setup.sh
$ ./gateway-setup.sh

# Start the Gateway server using PASSPHRASE
$ yarn start --passphrase=<PASSPHRASE>

./gateway-setup.sh 之前需要到hummingBot中执行gateway generate-certs 生成certs文件,复制路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  base  14:35:00  ...work/digital-trade/gateway   
$ ./gateway-setup.sh

=============== SETUP GATEWAY ===============


Do you want to copy over client certificates (Y/N) >>> y
Enter path to the Hummingbot certs folder >>> /Users/xxxx/work/digital-trade/hummingbot/certs
Files successfully copied from /Users/xxxx/work/digital-trade/hummingbot/certs to /Users/xxxx/work/digital-trade/gateway/certs

ℹ️ Confirm if this is correct:

Copy configs FROM: /Users/xxxx/work/digital-trade/gateway/src/templates
Copy configs TO: /Users/xxxx/work/digital-trade/gateway/conf

Copy certs FROM: /Users/xxxx/work/digital-trade/hummingbot/certs
Copy certs TO: /Users/xxxx/work/digital-trade/gateway/certs

Do you want to proceed? [Y/N] >>> y

mkdir: /Users/xxxx/work/digital-trade/gateway/conf: File exists
Files successfully copied from /Users/xxxx/work/digital-trade/gateway/src/templates to /Users/xxxx/work/digital-trade/gateway/conf

mkdir: /Users/xxxx/work/digital-trade/gateway/conf/lists: File exists
Files successfully copied from /Users/xxxx/work/digital-trade/gateway/src/templates/lists to /Users/xxxx/work/digital-trade/gateway/conf
Replaced list locations in: conf/celo.yml
Replaced list locations in: conf/osmosis.yml
Replaced list locations in: conf/cronos.yml
Replaced list locations in: conf/binance-smart-chain.yml
Replaced list locations in: conf/ethereum.yml
Replaced list locations in: conf/polygon.yml
Replaced list locations in: conf/avalanche.yml
Replaced list locations in: conf/harmony.yml
Replaced list locations in: conf/xdc.yml

启动后

1
2
3
4
5
6
7
8
9
10
11
$ yarn start --passphrase=123456
yarn run v1.22.4
$ /bin/bash ./startup.sh --passphrase=abcde
2024-11-27 08:04:55 | info | Gateway Version: 2.1.0
2024-11-27 08:04:55 | info | ⚡️ Starting Gateway API on port 15888...
(node:48566) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
2024-11-27 08:04:55 | info | The gateway server is secured behind HTTPS.
2024-11-27 08:04:55 | info | ⚡️ Swagger listening on port 8080. Read the Gateway API documentation at 127.0.0.1:8080
::ffff:127.0.0.1 - - [27/Nov/2024:06:44:57 +0000] "GET /connectors HTTP/1.1" 200 4181 "-" "Python/3.10 aiohttp/3.11.7"
::ffff:127.0.0.1 - - [27/Nov/2024:06:44:57 +0000] "GET /chain/config HTTP/1.1" 200 18304 "-" "Python/3.10 aiohttp/3.11.7"
Author

Gavin

Posted on

2024-11-27

Updated on

2024-11-27

Licensed under

Comments