From 8a5202af65fd83dbb653c50fb1ca114e3372319c Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Sat, 17 Apr 2021 17:20:04 +0300 Subject: [PATCH 1/7] dev-deploy usage restricted on mainnet --- commands/dev-deploy.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands/dev-deploy.js b/commands/dev-deploy.js index 99e6c0bd..c951b45d 100644 --- a/commands/dev-deploy.js +++ b/commands/dev-deploy.js @@ -36,6 +36,10 @@ module.exports = { }; async function devDeploy(options) { + const currentNetwork = options.networkId; + if (currentNetwork !== 'testnet' && currentNetwork !== 'default') { + throw Error(`Network ${currentNetwork} doesn't support dev-deploy. Use export NEAR_ENV=testnet to switch to TestNet`); + } await eventtracking.askForConsentIfNeeded(options); const { nodeUrl, helperUrl, masterAccount, wasmFile } = options; if (!helperUrl && !masterAccount) { From d36204ce52863a290c8e1195b3280524f84a7a3c Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Sun, 18 Apr 2021 03:03:58 +0300 Subject: [PATCH 2/7] networkId test issue changed --- test/test_contract.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_contract.sh b/test/test_contract.sh index ab85d49d..6a55da09 100755 --- a/test/test_contract.sh +++ b/test/test_contract.sh @@ -19,7 +19,10 @@ echo Deploying contract echo Deploying contract to temporary accountId # TODO: Specify helperUrl in project template +# dev-deploy is supported only on testnet, that is why we are temporary changing NEAR_ENV +ENV_STORAGE=$(echo $NEAR_ENV) && NEAR_ENV=testnet yes | ../bin/near dev-deploy +NEAR_ENV=$(echo $ENV_STORAGE) echo Calling functions ../bin/near call $testaccount setGreeting '{"message":"TEST"}' --accountId=test.near From c01dbf729687d91d1b17bec076b91305d9aa93e4 Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Sun, 18 Apr 2021 13:37:10 +0300 Subject: [PATCH 3/7] test_contract test --- test/test_contract.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_contract.sh b/test/test_contract.sh index 6a55da09..88f3f7f9 100755 --- a/test/test_contract.sh +++ b/test/test_contract.sh @@ -20,8 +20,8 @@ echo Deploying contract echo Deploying contract to temporary accountId # TODO: Specify helperUrl in project template # dev-deploy is supported only on testnet, that is why we are temporary changing NEAR_ENV -ENV_STORAGE=$(echo $NEAR_ENV) && NEAR_ENV=testnet -yes | ../bin/near dev-deploy +ENV_STORAGE=$(echo $NEAR_ENV) +yes | NEAR_ENV=testnet && ../bin/near dev-deploy NEAR_ENV=$(echo $ENV_STORAGE) echo Calling functions From 4c694a93aacd481f2eeb6c09287585353f8a3a19 Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Sun, 18 Apr 2021 13:45:43 +0300 Subject: [PATCH 4/7] test_contract test --- test/test_contract.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_contract.sh b/test/test_contract.sh index 88f3f7f9..7c7a7d9f 100755 --- a/test/test_contract.sh +++ b/test/test_contract.sh @@ -20,9 +20,10 @@ echo Deploying contract echo Deploying contract to temporary accountId # TODO: Specify helperUrl in project template # dev-deploy is supported only on testnet, that is why we are temporary changing NEAR_ENV -ENV_STORAGE=$(echo $NEAR_ENV) -yes | NEAR_ENV=testnet && ../bin/near dev-deploy -NEAR_ENV=$(echo $ENV_STORAGE) +export ENV_STORAGE=$(echo $NEAR_ENV) +export NEAR_ENV=testnet +yes | ../bin/near dev-deploy +export NEAR_ENV=$(echo $ENV_STORAGE) echo Calling functions ../bin/near call $testaccount setGreeting '{"message":"TEST"}' --accountId=test.near From be0018fffea18337562b8c2471ffe586a3648e26 Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Wed, 28 Apr 2021 13:11:57 +0300 Subject: [PATCH 5/7] dev acc name length increased --- commands/dev-deploy.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/commands/dev-deploy.js b/commands/dev-deploy.js index c951b45d..51f30dd9 100644 --- a/commands/dev-deploy.js +++ b/commands/dev-deploy.js @@ -36,9 +36,8 @@ module.exports = { }; async function devDeploy(options) { - const currentNetwork = options.networkId; - if (currentNetwork !== 'testnet' && currentNetwork !== 'default') { - throw Error(`Network ${currentNetwork} doesn't support dev-deploy. Use export NEAR_ENV=testnet to switch to TestNet`); + if (options.networkId === 'mainnet') { + throw Error(`MainNet doesn't support dev-deploy. Use export NEAR_ENV=testnet to switch to TestNet`); } await eventtracking.askForConsentIfNeeded(options); const { nodeUrl, helperUrl, masterAccount, wasmFile } = options; @@ -81,8 +80,8 @@ async function createDevAccountIfNeeded({ near, keyStore, networkId, init, maste } } let accountId; - // create random number with at least 7 digits - const randomNumber = Math.floor(Math.random() * (9999999 - 1000000) + 1000000); + // create random number with at least 14 digits + const randomNumber = Math.floor(Math.random() * (99999999999999 - 10000000000000) + 10000000000000); if (masterAccount) { accountId = `dev-${Date.now()}.${masterAccount}`; From 1b8f5b80ddb52a32551d4c190113d80d367021d8 Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Wed, 28 Apr 2021 13:18:49 +0300 Subject: [PATCH 6/7] lint fix --- commands/dev-deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/dev-deploy.js b/commands/dev-deploy.js index 51f30dd9..34e1341e 100644 --- a/commands/dev-deploy.js +++ b/commands/dev-deploy.js @@ -37,7 +37,7 @@ module.exports = { async function devDeploy(options) { if (options.networkId === 'mainnet') { - throw Error(`MainNet doesn't support dev-deploy. Use export NEAR_ENV=testnet to switch to TestNet`); + throw Error('MainNet doesn\'t support dev-deploy. Use export NEAR_ENV=testnet to switch to TestNet'); } await eventtracking.askForConsentIfNeeded(options); const { nodeUrl, helperUrl, masterAccount, wasmFile } = options; From 26b908f6cdad44a5611aa7134a10d3d5efd554ac Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Wed, 28 Apr 2021 13:30:11 +0300 Subject: [PATCH 7/7] set testnet env deleted fom contract tests --- test/test_contract.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/test_contract.sh b/test/test_contract.sh index 7c7a7d9f..ab85d49d 100755 --- a/test/test_contract.sh +++ b/test/test_contract.sh @@ -19,11 +19,7 @@ echo Deploying contract echo Deploying contract to temporary accountId # TODO: Specify helperUrl in project template -# dev-deploy is supported only on testnet, that is why we are temporary changing NEAR_ENV -export ENV_STORAGE=$(echo $NEAR_ENV) -export NEAR_ENV=testnet yes | ../bin/near dev-deploy -export NEAR_ENV=$(echo $ENV_STORAGE) echo Calling functions ../bin/near call $testaccount setGreeting '{"message":"TEST"}' --accountId=test.near