From c56881c3e94b4ac267b4935e6bf03f94a82eba48 Mon Sep 17 00:00:00 2001 From: haodi <82733821@qq.com> Date: Sun, 16 Jan 2022 12:56:53 +0800 Subject: [PATCH] change default gas price --- cmd/subcommands/ethtransfer.go | 4 ++-- cmd/subcommands/root.go | 2 ++ cmd/subcommands/staking.go | 10 +++++----- cmd/subcommands/transfer.go | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/subcommands/ethtransfer.go b/cmd/subcommands/ethtransfer.go index a4c4feb..62779d4 100644 --- a/cmd/subcommands/ethtransfer.go +++ b/cmd/subcommands/ethtransfer.go @@ -171,7 +171,7 @@ func ethHandlerForBulkTransactions(txLog *transactionLog, index int) error { if txnFlags.GasPrice != nil { gasPrice = *txnFlags.GasPrice } else { - gasPrice = "1" // Reset to default for subsequent transactions + gasPrice = "30000" // Reset to default for subsequent transactions } if txnFlags.GasLimit != nil { gasLimit = *txnFlags.GasLimit @@ -271,7 +271,7 @@ Create an Ethereum compatible transaction, sign it, and send off to the Harmony cmdEthTransfer.Flags().BoolVar(&dryRun, "dry-run", false, "do not send signed transaction") cmdEthTransfer.Flags().BoolVar(&trueNonce, "true-nonce", false, "send transaction with on-chain nonce") cmdEthTransfer.Flags().StringVar(&amount, "amount", "0", "amount to send (ONE)") - cmdEthTransfer.Flags().StringVar(&gasPrice, "gas-price", "1", "gas price to pay (NANO)") + cmdEthTransfer.Flags().StringVar(&gasPrice, "gas-price", "30000", "gas price to pay (NANO)") cmdEthTransfer.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit") cmdEthTransfer.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for tx") cmdEthTransfer.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target") diff --git a/cmd/subcommands/root.go b/cmd/subcommands/root.go index fed40b1..d47ad1c 100644 --- a/cmd/subcommands/root.go +++ b/cmd/subcommands/root.go @@ -95,6 +95,8 @@ var ( } } else if endpoint.Match([]byte(node)) { chainName = endpointToChainID(node) + } else if strings.Contains(node, "api.harmony.one") { + chainName = chainIDWrapper{chainID: &common.Chain.MainNet} } else { chainName = chainIDWrapper{chainID: &common.Chain.TestNet} } diff --git a/cmd/subcommands/staking.go b/cmd/subcommands/staking.go index d7ae29b..e4a88a2 100644 --- a/cmd/subcommands/staking.go +++ b/cmd/subcommands/staking.go @@ -455,7 +455,7 @@ Create a new validator" ) subCmdNewValidator.Flags().StringVar(&blsPubKeyDir, "bls-pubkeys-dir", "", "directory to bls pubkeys storing pub.key, pub.pass files") subCmdNewValidator.Flags().StringVar(&stakingAmount, "amount", "0.0", "staking amount") - subCmdNewValidator.Flags().StringVar(&gasPrice, "gas-price", "1", "gas price to pay") + subCmdNewValidator.Flags().StringVar(&gasPrice, "gas-price", "30000", "gas price to pay") subCmdNewValidator.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit") subCmdNewValidator.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for transaction") subCmdNewValidator.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target") @@ -633,7 +633,7 @@ Create a new validator" subCmdEditValidator.Flags().StringVar(&slotKeyToRemove, "remove-bls-key", "", "remove BLS pubkey from slot") subCmdEditValidator.Flags().StringVar(&active, "active", "", "validator active true/false") - subCmdEditValidator.Flags().StringVar(&gasPrice, "gas-price", "1", "gas price to pay") + subCmdEditValidator.Flags().StringVar(&gasPrice, "gas-price", "30000", "gas price to pay") subCmdEditValidator.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit") subCmdEditValidator.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for transaction") subCmdEditValidator.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target") @@ -698,7 +698,7 @@ Delegating to a validator subCmdDelegate.Flags().Var(&delegatorAddress, "delegator-addr", "delegator's address") subCmdDelegate.Flags().Var(&validatorAddress, "validator-addr", "validator's address") subCmdDelegate.Flags().StringVar(&stakingAmount, "amount", "0", "staking amount") - subCmdDelegate.Flags().StringVar(&gasPrice, "gas-price", "1", "gas price to pay") + subCmdDelegate.Flags().StringVar(&gasPrice, "gas-price", "30000", "gas price to pay") subCmdDelegate.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit") subCmdDelegate.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for transaction") subCmdDelegate.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target") @@ -765,7 +765,7 @@ Delegating to a validator subCmdUnDelegate.Flags().Var(&delegatorAddress, "delegator-addr", "delegator's address") subCmdUnDelegate.Flags().Var(&validatorAddress, "validator-addr", "source validator's address") subCmdUnDelegate.Flags().StringVar(&stakingAmount, "amount", "0", "staking amount") - subCmdUnDelegate.Flags().StringVar(&gasPrice, "gas-price", "1", "gas price to pay") + subCmdUnDelegate.Flags().StringVar(&gasPrice, "gas-price", "30000", "gas price to pay") subCmdUnDelegate.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit") subCmdUnDelegate.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for transaction") subCmdUnDelegate.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target") @@ -820,7 +820,7 @@ Collect token rewards subCmdCollectRewards.Flags().BoolVar(&trueNonce, "true-nonce", false, "send transaction with on-chain nonce") subCmdCollectRewards.Flags().Var(&delegatorAddress, "delegator-addr", "delegator's address") - subCmdCollectRewards.Flags().StringVar(&gasPrice, "gas-price", "1", "gas price to pay") + subCmdCollectRewards.Flags().StringVar(&gasPrice, "gas-price", "30000", "gas price to pay") subCmdCollectRewards.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit") subCmdCollectRewards.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for tx") subCmdCollectRewards.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target") diff --git a/cmd/subcommands/transfer.go b/cmd/subcommands/transfer.go index e5e611c..a3fe6fb 100644 --- a/cmd/subcommands/transfer.go +++ b/cmd/subcommands/transfer.go @@ -255,7 +255,7 @@ func handlerForBulkTransactions(txLog *transactionLog, index int) error { if txnFlags.GasPrice != nil { gasPrice = *txnFlags.GasPrice } else { - gasPrice = "1" // Reset to default for subsequent transactions + gasPrice = "30000" // Reset to default for subsequent transactions } if txnFlags.GasLimit != nil { gasLimit = *txnFlags.GasLimit @@ -409,7 +409,7 @@ Create a transaction, sign it, and send off to the Harmony blockchain cmdTransfer.Flags().BoolVar(&offlineSign, "offline-sign", false, "output offline signing") cmdTransfer.Flags().BoolVar(&trueNonce, "true-nonce", false, "send transaction with on-chain nonce") cmdTransfer.Flags().StringVar(&amount, "amount", "0", "amount to send (ONE)") - cmdTransfer.Flags().StringVar(&gasPrice, "gas-price", "1", "gas price to pay (NANO)") + cmdTransfer.Flags().StringVar(&gasPrice, "gas-price", "30000", "gas price to pay (NANO)") cmdTransfer.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit") cmdTransfer.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for tx") cmdTransfer.Flags().Uint32Var(&fromShardID, "from-shard", 0, "source shard id")