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

JS/TS: Implement walletclient #164

@ashleyvega

Description

@ashleyvega

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions