Skip to content

Commit

Permalink
small tweaks to settings.js which is used from main.html
Browse files Browse the repository at this point in the history
to make local ui development experience better
  • Loading branch information
janedegtiareva committed Apr 1, 2019
1 parent 93544c8 commit b74ae50
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions blank_project/src/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</head>
<body style="background: #fff">
<div class="container">
Contract says:
Contract says 2:
<h1 id="contract-message"></h1>
</div>
<script src="https://cdn.jsdelivr.net/npm/nearlib@0.4.2/dist/nearlib.js"></script>
<script src="./settings.js"></script>
<script src="./settings_devnet.js"></script>
<script src="./main.js"></script>
</body>
</html>
Expand Down
2 changes: 1 addition & 1 deletion blank_project/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function doInitContract() {
window.near = await nearlib.dev.connect(settings);

// Initializing our contract APIs by contract name and configuration.
window.contract = await near.loadContract(contractName, {
window.contract = await near.loadContract(settings.contractName, {
// NOTE: This configuration only needed while NEAR is still in development
// View methods are read only. They don't modify the state, but usually return some value.
viewMethods: ["hello"],
Expand Down
2 changes: 1 addition & 1 deletion blank_project/src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ const settings = {
deps: {
createAccount: nearlib.dev.createAccountWithLocalNodeConnection
},
contractName: "hellotest" /* TODO: fill this in! */
};
const contractName = "contract2"; /* TODO: fill this in! */
10 changes: 10 additions & 0 deletions blank_project/src/settings_devnet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const settings = {
nodeUrl: "https://studio.nearprotocol.com/devnet",
baseUrl: "https://studio.nearprotocol.com/contract-api",
contractName: "hellotest",
deps: {
createAccount: (accountId, publicKey) =>
nearlib.dev.createAccountWithContractHelper(
{ baseUrl: "https://studio.nearprotocol.com/contract-api"}, accountId, publicKey)
}
};

0 comments on commit b74ae50

Please sign in to comment.