Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

JS/TS: Implement walletclient #164

Open
ashleyvega opened this issue Mar 27, 2021 · 0 comments
Open

JS/TS: Implement walletclient #164

ashleyvega opened this issue Mar 27, 2021 · 0 comments

Comments

@ashleyvega
Copy link
Contributor

At the moment, we have;

  • in the Console: src/contexts/wallet/ ts and tsx files
  • in this repo:
    • python walletclient: https://github.com/vegaprotocol/api/blob/develop/grpc/clients/python/vegaapiclient/walletclient.py
    • (in tests) javascript clunky wallet_server_login function
      function wallet_server_login(walletServerURL, walletName, walletPassphrase) {
      var request = new xhr.XMLHttpRequest();
      var token;
      request.onload = function () {
      if (request.status !== 200) {
      throw "Failed to log in to wallet server: HTTP " + request.status + " " + request.responseText;
      }
      var j = JSON.parse(request.responseText);
      if (j === undefined) {
      throw "Failed to get parse response JSON: " + request.responseText;
      }
      token = j.token;
      if (token === undefined) {
      throw "Failed to get token from response body: " + request.responseText;
      }
      }
      request.open("POST", walletServerURL + "/api/v1/auth/token", true);
      request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
      request.send(JSON.stringify({wallet: walletName, passphrase: walletPassphrase}, null, 2));
      return token;
      }

Task

Implement walletclient in Javascript/Typescript so it can be used by tests in this repo, as well as by other users of the api package (perhaps possibly the Console).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant