Skip to content

Commit 3eb9b9c

Browse files
committed
Fix lint issue
1 parent 7ac24c9 commit 3eb9b9c

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

examples/hdwallet/ecdsa/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const (
3030
ethCoinType = 60 // Ethereum
3131
ethAccount = 0 // Account 0
3232
ethChange = 0 // External chain
33+
34+
// Number of addresses to derive for the example run.
35+
derivedAddressCount = uint32(2)
3336
)
3437

3538
type DerivedAddress struct {
@@ -151,9 +154,9 @@ func main() {
151154
logger.Fatal("chain_code not found in config", fmt.Errorf("required for HD derivation"))
152155
}
153156

154-
addresses := make([]*DerivedAddress, 2)
155-
for i := 0; i < 2; i++ {
156-
childIndex := uint32(i)
157+
addresses := make([]*DerivedAddress, derivedAddressCount)
158+
for i := uint32(0); i < derivedAddressCount; i++ {
159+
childIndex := i
157160
path := []uint32{ethPurpose, ethCoinType, ethAccount, ethChange, childIndex}
158161

159162
// Derive child public key from master (NO MPC!)

examples/hdwallet/eddsa/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
solChange = 0 // External chain
3636

3737
// Number of addresses to derive; change this to derive more or fewer addresses.
38-
addressCount = 2
38+
addressCount = uint32(2)
3939
)
4040

4141
type DerivedAddress struct {
@@ -158,9 +158,8 @@ func main() {
158158
}
159159

160160
addresses := make([]*DerivedAddress, addressCount)
161-
for i := 0; i < addressCount; i++ {
162-
childIndex := uint32(i)
163-
path := []uint32{solPurpose, solCoinType, childIndex, solChange}
161+
for i := uint32(0); i < addressCount; i++ {
162+
path := []uint32{solPurpose, solCoinType, i, solChange}
164163

165164
// Derive child public key from master (NO MPC!)
166165
childPubKey, err := deriveChildPublicKeyEd25519(masterPubKey, chainCodeHex, path)
@@ -180,7 +179,7 @@ func main() {
180179
address := deriveSolanaAddress(childPubKey)
181180

182181
addresses[i] = &DerivedAddress{
183-
Index: childIndex,
182+
Index: i,
184183
DerivationPath: path,
185184
PublicKey: childPubKey,
186185
Address: address,

0 commit comments

Comments
 (0)