This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
572 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# CREATE WITH FAUCET | ||
yarn start create-account miralos-como-sonrien.testnet --ledgerPK --useFaucet | ||
|
||
# CREATE WITH ACCOUNT | ||
yarn start create-account ya.miralos-como-sonrien.testnet --ledgerPK --useAccount miralos-como-sonrien.testnet --useLedgerKey | ||
|
||
# SEND-NEAR | ||
yarn start send-near miralos-como-sonrien.testnet influencer.testnet 0.01 --useLedgerKey | ||
|
||
# CALL | ||
yarn start call hello.near-examples.testnet set_greeting '{"greeting":"Hola"}' --accountId miralos-como-sonrien.testnet --useLedgerKey | ||
|
||
# DEPLOY | ||
yarn start deploy miralos-como-sonrien.testnet ./contract.wasm --signWithLedger | ||
|
||
## ADD KEY | ||
yarn start add-key miralos-como-sonrien.testnet ed25519:GnsdHdSrhe8v3MMAQi2bnXR59xMDwdkSRAFZ961ydxWZ --signWithLedger | ||
|
||
## DELETE KEY | ||
yarn start delete-key miralos-como-sonrien.testnet ed25519:GnsdHdSrhe8v3MMAQi2bnXR59xMDwdkSRAFZ961ydxWZ --signWithLedger | ||
|
||
## DELETE | ||
yarn start delete miralos-como-sonrien.testnet influencer.testnet --useLedgerKey | ||
yarn start delete ya.miralos-como-sonrien.testnet influencer.testnet --signWithLedger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
const chalk = require('chalk'); | ||
|
||
async function assertCredentials(accountId, networkId, keyStore) { | ||
async function assertCredentials({ accountId, networkId, keyStore, signWithLedger }) { | ||
if (signWithLedger) return; | ||
|
||
const key = await keyStore.getKey(networkId, accountId); | ||
if(key) return; | ||
if (key) return; | ||
|
||
console.error(chalk`You are trying to use the account {bold.white ${accountId}}, but do not have the credentials locally (network: {bold.white ${networkId}})`); | ||
process.exit(1); | ||
} | ||
|
||
async function storeCredentials(accountId, networkId, keyStore, keyPair, force) { | ||
const key = await keyStore.getKey(networkId, accountId); | ||
if(key && !force){ | ||
|
||
if (key && !force) { | ||
console.log(chalk`The account {bold.white ${accountId}} already has local credentials (network: {bold.white ${networkId}})`); | ||
return; | ||
} | ||
|
||
console.log(chalk`Storing credentials for account: {bold.white ${accountId}} (network: {bold.white ${networkId}})`); | ||
console.log(`Saving key to '~/.near-credentials/${networkId}/${accountId}.json'`); | ||
await keyStore.setKey(networkId, accountId, keyPair); | ||
await keyStore.setKey(networkId, accountId, keyPair); | ||
} | ||
|
||
module.exports = {assertCredentials, storeCredentials}; | ||
module.exports = { assertCredentials, storeCredentials }; |
Oops, something went wrong.