Skip to content
This repository has been archived by the owner on Jun 23, 2020. It is now read-only.

Pointing to a AlphaNet or a different DevNet #105

Open
MaksymZavershynskyi opened this issue Mar 18, 2019 · 2 comments
Open

Pointing to a AlphaNet or a different DevNet #105

MaksymZavershynskyi opened this issue Mar 18, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@MaksymZavershynskyi
Copy link
Contributor

NEARStudio should support being pointed to a different AlphaNet or DevNet by either:

  1. Change in a config file;
  2. UI element in the studio itself that allows connecting to a different *Net.

Currently, in order to run NEARStudio on the top of AlphaNet or a different DevNet we need to go through a multistep hacky process.
Suppose we have AlphaNet/DevNet running on 34.208.224.21:3030 and we want to run studio locally on the laptop.

  1. Make sure that alice.near is in the initial authorities of the chain spec used by AlphaNet or DevNet;
  2. Clone https://github.com/nearprotocol/near-contract-helper to the local machine and modify in app.js local node connection to point to the AlphaNet/DevNet:
const localNodeConnection = new LocalNodeConnection('http://34.208.224.21:3030');
  1. Start near contract helper by setting its port to 3031:
export NEAR_CONTRACT_HELPER_PORT=3031
node app.js
  1. Clone https://github.com/nearprotocol/NEARStudio to the local machine and modify config.json:
"contractHelper": "http://127.0.0.1:3031",
"nodeUrl": "http://34.208.224.21:3030"
  1. Start near studio. Open "Hello World Example" template and modify doInitContract() function, to assign node URL
 // Getting config from cookies that are provided by the NEAR Studio.
  const config = await nearlib.dev.getConfig();
    config.nodeUrl = "http://34.208.224.21:3030";
    config.baseUrl = "http://127.0.0.1:3031";
    const options = {};
    options.nodeUrl = "http://34.208.224.21:3030";
    options.baseUrl = "http://127.0.0.1:3031";
  
  // Initializing connection to the NEAR DevNet.
  window.near = await nearlib.dev.connect(options);
  1. Save and press "Run"
@behaviary
Copy link
Contributor

Why not 1) as implementation with a UI element that manipulates config file associated with it?

Also If it were local, I would expect I could pass in through cli flag of some sort by manipulating settings. E.g. -h is host and -p is port.

@MaksymZavershynskyi
Copy link
Contributor Author

@potatodepaulo Yes, that would be good to have.

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

No branches or pull requests

6 participants