Skip to content

Commit

Permalink
basic implementation of login through wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
janedegtiareva committed Jul 9, 2019
1 parent 9f52d71 commit 0126866
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion blank_project/src/config.js
Expand Up @@ -10,7 +10,7 @@
networkId: 'default',
nodeUrl: 'http://34.94.13.241:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
walletUrl: 'https://wallet.nearprotocol.com',
};
case 'local':
return {
Expand Down
11 changes: 11 additions & 0 deletions index.js
Expand Up @@ -105,3 +105,14 @@ exports.stake = async function(options) {
const result = await account.stake(options.publicKey, BigInt(options.amount));
console.log('Result: ', JSON.stringify(result));
}

exports.login = async function(options) {
if (!options.walletUrl) {
console.log("Log in is not needed on this environment. Please use appropriate master account for shell operations.")
} else {
const title = 'Near Shell';
const keyPair = await KeyPair.fromRandom('ed25519');
console.log(`Please navigate to this url and follow the insturctions to log in: ` +
`${options.walletUrl}/login/?title=${title}&public_key=${keyPair.getPublicKey()}&account_id=${options.accountId}`);
}
}

0 comments on commit 0126866

Please sign in to comment.