acala.js icon indicating copy to clipboard operation
acala.js copied to clipboard

API Manager

Open qwer951123 opened this issue 2 years ago • 2 comments

  • speed ​​measure
  • support connect the fastest endpoint
  • return promise/rxjs api
  • support report the endpoint health status
  • support manager multiply chains

qwer951123 avatar Jul 01 '22 08:07 qwer951123

configs

  • chains
    1. name, string, chain name
    2. endpoints, [string] the endpoints of the chain
    3. isRelayChain, boolean, should set true when the chain is a relay chain
    4. parachainId, number, the params chain id, will be ignored when the isRealyChain is true
    5. autoConnect, boolean, auto-connect when set true
    6. custom, (options) => options, custom API options configs
    7. timeout
  • endpoint health
    1. health
    2. busy
    3. error

qwer951123 avatar Jul 01 '22 09:07 qwer951123

methods

  • getApi get api
  • status$ subscribe to the status of the connected endpoint
  • health$ subscribe to the connected health of the connected endpoint
  • endpointsReport$ subscribe all endpoints ping-pong test result
  • connect manual connect
  • disconnect manual disconnect

qwer951123 avatar Jul 01 '22 09:07 qwer951123