diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-25 09:34:20 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 06:24:48 +0800 |
commit | 5e22a862b77d4947361342972c28a8552d13018e (patch) | |
tree | 6ef99ff4d5b9d1f0c41e87c18b97d1987b5da9ab /packages/pipeline/src/data_sources/relayer-registry/index.ts | |
parent | bb440b683a7a4d966694de2b897f51f22dadb31c (diff) | |
download | dexon-0x-contracts-5e22a862b77d4947361342972c28a8552d13018e.tar dexon-0x-contracts-5e22a862b77d4947361342972c28a8552d13018e.tar.gz dexon-0x-contracts-5e22a862b77d4947361342972c28a8552d13018e.tar.bz2 dexon-0x-contracts-5e22a862b77d4947361342972c28a8552d13018e.tar.lz dexon-0x-contracts-5e22a862b77d4947361342972c28a8552d13018e.tar.xz dexon-0x-contracts-5e22a862b77d4947361342972c28a8552d13018e.tar.zst dexon-0x-contracts-5e22a862b77d4947361342972c28a8552d13018e.zip |
Implement fetching and parsing relayer info
Diffstat (limited to 'packages/pipeline/src/data_sources/relayer-registry/index.ts')
-rw-r--r-- | packages/pipeline/src/data_sources/relayer-registry/index.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/pipeline/src/data_sources/relayer-registry/index.ts b/packages/pipeline/src/data_sources/relayer-registry/index.ts new file mode 100644 index 000000000..c97b50d27 --- /dev/null +++ b/packages/pipeline/src/data_sources/relayer-registry/index.ts @@ -0,0 +1,33 @@ +import axios from 'axios'; + +export interface RelayerResponse { + name: string; + homepage_url: string; + app_url: string; + header_img: string; + logo_img: string; + networks: RelayerResponseNetwork[]; +} + +export interface RelayerResponseNetwork { + networkId: number; + sra_http_endpoint?: string; + sra_ws_endpoint?: string; + static_order_fields?: { + fee_recipient_addresses?: string[]; + taker_addresses?: string[]; + }; +} + +export class RelayerRegistrySource { + private _url: string; + + constructor(url: string) { + this._url = url; + } + + public async getRelayerInfoAsync(): Promise<RelayerResponse[]> { + const resp = await axios.get<RelayerResponse[]>(this._url); + return resp.data; + } +} |