Skip to content

Commit e61fe4c

Browse files
committed
refactor dependencies
1 parent 5e6c48a commit e61fe4c

22 files changed

+79
-81
lines changed

cmd/convert/address.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package convert
22

33
import (
44
"fmt"
5-
libutils "github.com/EscanBE/go-lib/utils"
65
"github.com/bcdevtools/devd/cmd/utils"
76
sdk "github.com/cosmos/cosmos-sdk/types"
87
"github.com/cosmos/cosmos-sdk/types/bech32"
@@ -27,7 +26,7 @@ func GetConvertAddressCmd() *cobra.Command {
2726
Args: cobra.RangeArgs(1, 2),
2827
Run: func(cmd *cobra.Command, args []string) {
2928
defer func() {
30-
libutils.PrintlnStdErr("WARN: DO NOT use this command to convert address across chains with different HD-Path! (eg: Ethermint 60 and Cosmos 118)")
29+
utils.PrintlnStdErr("WARN: DO NOT use this command to convert address across chains with different HD-Path! (eg: Ethermint 60 and Cosmos 118)")
3130
}()
3231

3332
normalizedInputAddress := strings.TrimSpace(strings.ToLower(args[0]))
@@ -43,7 +42,7 @@ func GetConvertAddressCmd() *cobra.Command {
4342
// case 1, is EVM address
4443

4544
if len(nextConvertToBech32Hrp) < 1 {
46-
libutils.PrintlnStdErr("ERR: missing Bech32 HRP as the second argument")
45+
utils.PrintlnStdErr("ERR: missing Bech32 HRP as the second argument")
4746
os.Exit(1)
4847
}
4948

@@ -60,7 +59,7 @@ func GetConvertAddressCmd() *cobra.Command {
6059
// case 1, but bytes addr (eg: interchain account)
6160

6261
if len(nextConvertToBech32Hrp) < 1 {
63-
libutils.PrintlnStdErr("ERR: missing Bech32 HRP as the second argument")
62+
utils.PrintlnStdErr("ERR: missing Bech32 HRP as the second argument")
6463
os.Exit(1)
6564
}
6665

@@ -76,7 +75,7 @@ func GetConvertAddressCmd() *cobra.Command {
7675
// case 2 + 3
7776
spl := strings.Split(normalizedInputAddress, "1")
7877
if len(spl) != 2 || len(spl[0]) < 1 || len(spl[1]) < 1 {
79-
libutils.PrintlnStdErr("ERR: invalid bech32 address")
78+
utils.PrintlnStdErr("ERR: invalid bech32 address")
8079
os.Exit(1)
8180
}
8281

cmd/convert/decimal_to_hexadecimal.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package convert
22

33
import (
44
"fmt"
5-
libutils "github.com/EscanBE/go-lib/utils"
65
"github.com/bcdevtools/devd/cmd/utils"
76
"github.com/spf13/cobra"
87
"math/big"
@@ -25,7 +24,7 @@ Support pipe.`,
2524

2625
bi, ok := new(big.Int).SetString(input, 10)
2726
if !ok {
28-
libutils.PrintlnStdErr("ERR: failed to convert decimal to hexadecimal")
27+
utils.PrintlnStdErr("ERR: failed to convert decimal to hexadecimal")
2928
os.Exit(1)
3029
}
3130
fmt.Printf("0x%x\n", bi)

cmd/convert/display_balance.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package convert
22

33
import (
44
"fmt"
5-
libutils "github.com/EscanBE/go-lib/utils"
65
"github.com/bcdevtools/devd/cmd/utils"
76
"github.com/spf13/cobra"
87
"math/big"
@@ -24,7 +23,7 @@ Sample: 10011100 + 6 = 10.0111`,
2423

2524
balance, ok := new(big.Int).SetString(rawBalanceStr, 10)
2625
if !ok {
27-
libutils.PrintlnStdErr("ERR: failed to read, raw balance is not a number")
26+
utils.PrintlnStdErr("ERR: failed to read, raw balance is not a number")
2827
os.Exit(1)
2928
}
3029

cmd/convert/hexadecimal_to_decimal.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package convert
22

33
import (
44
"fmt"
5-
libutils "github.com/EscanBE/go-lib/utils"
65
"github.com/bcdevtools/devd/cmd/utils"
76
"github.com/spf13/cobra"
87
"math/big"
@@ -29,7 +28,7 @@ Support pipe.`,
2928

3029
bi, ok := new(big.Int).SetString(input[2:], 16)
3130
if !ok {
32-
libutils.PrintlnStdErr("ERR: failed to convert hexadecimal to decimal")
31+
utils.PrintlnStdErr("ERR: failed to convert hexadecimal to decimal")
3332
os.Exit(1)
3433
}
3534

@@ -42,15 +41,15 @@ Support pipe.`,
4241

4342
bi, ok := new(big.Int).SetString(input, 16)
4443
if !ok {
45-
libutils.PrintlnStdErr("ERR: failed to convert hexadecimal to decimal")
44+
utils.PrintlnStdErr("ERR: failed to convert hexadecimal to decimal")
4645
os.Exit(1)
4746
}
4847

4948
fmt.Println(bi)
5049
return
5150
}
5251

53-
libutils.PrintlnStdErr("ERR: unrecognized hexadecimal")
52+
utils.PrintlnStdErr("ERR: unrecognized hexadecimal")
5453
os.Exit(1)
5554
},
5655
}

cmd/convert/raw_balance.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package convert
22

33
import (
44
"fmt"
5-
libutils "github.com/EscanBE/go-lib/utils"
65
"github.com/bcdevtools/devd/cmd/utils"
76
"github.com/spf13/cobra"
87
"os"
@@ -33,7 +32,7 @@ Sample: 10.0111 + 6 = 10011100`,
3332
if len(decimalsPoint) == 0 {
3433
decimalsPoint = "."
3534
} else if decimalsPoint != "." && decimalsPoint != "," {
36-
libutils.PrintlnStdErr("ERR: decimals point must be either '.' or ','")
35+
utils.PrintlnStdErr("ERR: decimals point must be either '.' or ','")
3736
os.Exit(1)
3837
}
3938

cmd/debug/intrinsic_gas.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package debug
33
import (
44
"encoding/hex"
55
"fmt"
6-
libutils "github.com/EscanBE/go-lib/utils"
76
"github.com/bcdevtools/devd/cmd/utils"
87
"github.com/ethereum/go-ethereum/core"
98
ethtypes "github.com/ethereum/go-ethereum/core/types"
@@ -22,13 +21,13 @@ func GetIntrinsicCommand() *cobra.Command {
2221
Run: func(_ *cobra.Command, args []string) {
2322
input := strings.ToLower(args[0])
2423
if !regexp.MustCompile(`^(0x)?[a-f\d]+$`).MatchString(input) {
25-
libutils.PrintlnStdErr("ERR: invalid EVM transaction input data format")
24+
utils.PrintlnStdErr("ERR: invalid EVM transaction input data format")
2625
os.Exit(1)
2726
}
2827

2928
input = strings.TrimPrefix(input, "0x")
3029
if len(input)%2 != 0 {
31-
libutils.PrintlnStdErr("ERR: invalid EVM transaction input string length", len(input), ", must be an even number of characters")
30+
utils.PrintlnStdErr("ERR: invalid EVM transaction input string length", len(input), ", must be an even number of characters")
3231
os.Exit(1)
3332
}
3433

cmd/query/balance.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package query
33
import (
44
"context"
55
"fmt"
6-
libutils "github.com/EscanBE/go-lib/utils"
76
"github.com/bcdevtools/devd/cmd/utils"
87
"github.com/ethereum/go-ethereum"
98
"github.com/ethereum/go-ethereum/common"
@@ -23,7 +22,7 @@ func GetQueryBalanceCommand() *cobra.Command {
2322

2423
evmAddrs, err := getEvmAddressFromAnyFormatAddress(args...)
2524
if err != nil {
26-
libutils.PrintlnStdErr("ERR:", err)
25+
utils.PrintlnStdErr("ERR:", err)
2726
return
2827
}
2928

@@ -54,13 +53,13 @@ func GetQueryBalanceCommand() *cobra.Command {
5453
Data: []byte{0x95, 0xd8, 0x9b, 0x41}, // symbol()
5554
}, contextHeight)
5655
if err != nil {
57-
libutils.PrintlnStdErr("ERR: failed to get symbol for contract", contractAddr, ":", err)
56+
utils.PrintlnStdErr("ERR: failed to get symbol for contract", contractAddr, ":", err)
5857
continue
5958
}
6059

6160
contractSymbol, err := utils.AbiDecodeString(bz)
6261
if err != nil {
63-
libutils.PrintlnStdErr("ERR: failed to decode symbol for contract", contractAddr, ":", err)
62+
utils.PrintlnStdErr("ERR: failed to decode symbol for contract", contractAddr, ":", err)
6463
continue
6564
}
6665

@@ -69,7 +68,7 @@ func GetQueryBalanceCommand() *cobra.Command {
6968
Data: []byte{0x31, 0x3c, 0xe5, 0x67}, // decimals()
7069
}, contextHeight)
7170
if err != nil {
72-
libutils.PrintlnStdErr("ERR: failed to get decimals for contract", contractAddr, ":", err)
71+
utils.PrintlnStdErr("ERR: failed to get decimals for contract", contractAddr, ":", err)
7372
continue
7473
}
7574

@@ -81,7 +80,7 @@ func GetQueryBalanceCommand() *cobra.Command {
8180
Data: append([]byte{0x70, 0xa0, 0x82, 0x31}, common.BytesToHash(accountAddr.Bytes()).Bytes()...), // balanceOf(address)
8281
}, contextHeight)
8382
if err != nil {
84-
libutils.PrintlnStdErr("ERR: failed to get contract token", contractAddr, "balance for", accountAddr, ":", err)
83+
utils.PrintlnStdErr("ERR: failed to get contract token", contractAddr, "balance for", accountAddr, ":", err)
8584
continue
8685
}
8786

cmd/query/debug_traceTransaction.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package query
33
import (
44
"encoding/hex"
55
"fmt"
6-
libutils "github.com/EscanBE/go-lib/utils"
76
"github.com/bcdevtools/devd/cmd/types"
87
"github.com/bcdevtools/devd/cmd/utils"
98
"github.com/ethereum/go-ethereum/core/vm"
@@ -25,7 +24,7 @@ func GetQueryTraceTxCommand() *cobra.Command {
2524
input := strings.ToLower(args[0])
2625

2726
if !regexp.MustCompile(`^0x[a-f\d]{64}$`).MatchString(input) {
28-
libutils.PrintlnStdErr("ERR: invalid EVM transaction hash format")
27+
utils.PrintlnStdErr("ERR: invalid EVM transaction hash format")
2928
os.Exit(1)
3029
}
3130

@@ -37,7 +36,7 @@ func GetQueryTraceTxCommand() *cobra.Command {
3736

3837
if tracer := cmd.Flag(flagTracer).Value.String(); tracer != "" {
3938
if !regexp.MustCompile(`^\w+$`).MatchString(tracer) {
40-
libutils.PrintlnStdErr("ERR: invalid tracer name:", tracer)
39+
utils.PrintlnStdErr("ERR: invalid tracer name:", tracer)
4140
os.Exit(1)
4241
}
4342
params = append(params, types.NewJsonRpcRawQueryParam(fmt.Sprintf(`{"tracer":"%s"}`, tracer)))
@@ -71,7 +70,7 @@ func GetQueryTraceTxCommand() *cobra.Command {
7170
bz, err := hex.DecodeString(resStruct.Output[10:])
7271
errMsg, err := utils.AbiDecodeString(bz)
7372
if err == nil && errMsg != "" {
74-
libutils.PrintfStdErr(
73+
utils.PrintfStdErr(
7574
"ERR: EVM execution reverted with message [%s], this translation can be omitted by providing flag '--%s'\n",
7675
errMsg,
7776
flagNoTranslate,

cmd/query/eth_getBlockByNumber.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package query
22

33
import (
4-
libutils "github.com/EscanBE/go-lib/utils"
54
"github.com/bcdevtools/devd/cmd/types"
65
"github.com/bcdevtools/devd/cmd/utils"
76
"github.com/spf13/cobra"
@@ -23,7 +22,7 @@ func GetQueryBlockCommand() *cobra.Command {
2322
input := strings.ToLower(args[0])
2423

2524
if regexp.MustCompile(`[a-f]`).MatchString(input) && !strings.HasPrefix(input, "0x") {
26-
libutils.PrintlnStdErr("Hexadecimal block number must have 0x prefix.")
25+
utils.PrintlnStdErr("Hexadecimal block number must have 0x prefix.")
2726
os.Exit(1)
2827
}
2928

@@ -32,13 +31,13 @@ func GetQueryBlockCommand() *cobra.Command {
3231
if strings.HasPrefix(input, "0x") {
3332
blockNumber, ok = new(big.Int).SetString(input[2:], 16)
3433
if !ok {
35-
libutils.PrintlnStdErr("ERR: invalid EVM hexadecimal block number")
34+
utils.PrintlnStdErr("ERR: invalid EVM hexadecimal block number")
3635
os.Exit(1)
3736
}
3837
} else {
3938
blockNumber, ok = new(big.Int).SetString(input, 10)
4039
if !ok {
41-
libutils.PrintlnStdErr("ERR: invalid EVM decimal block number")
40+
utils.PrintlnStdErr("ERR: invalid EVM decimal block number")
4241
os.Exit(1)
4342
}
4443
}

cmd/query/eth_getTransactionByHash.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package query
22

33
import (
44
"context"
5-
libutils "github.com/EscanBE/go-lib/utils"
65
"github.com/bcdevtools/devd/cmd/utils"
76
"github.com/ethereum/go-ethereum/common"
87
"github.com/spf13/cobra"
@@ -23,7 +22,7 @@ func GetQueryTxCommand() *cobra.Command {
2322
input := strings.ToLower(args[0])
2423

2524
if !regexp.MustCompile(`^0x[a-f\d]{64}$`).MatchString(input) {
26-
libutils.PrintlnStdErr("ERR: invalid EVM transaction hash format")
25+
utils.PrintlnStdErr("ERR: invalid EVM transaction hash format")
2726
os.Exit(1)
2827
}
2928

0 commit comments

Comments
 (0)