Skip to content

Commit

Permalink
Merge pull request #47 from wealdtech/credentials-set
Browse files Browse the repository at this point in the history
Set withdrawal credentials.
  • Loading branch information
mcdee authored Oct 31, 2022
2 parents fd1e4a9 + 7eb2c68 commit 30455e7
Show file tree
Hide file tree
Showing 42 changed files with 3,157 additions and 600 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ coverage.html
# Vim
*.sw?

# Local JSON files
*.json

# Local TODO
TODO.md
315 changes: 0 additions & 315 deletions cmd/account/create/process_internal_test.go

This file was deleted.

6 changes: 4 additions & 2 deletions cmd/account/derive/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ func output(ctx context.Context, data *dataOut) (string, error) {
if data.showPrivateKey {
builder.WriteString(fmt.Sprintf("Private key: %#x\n", data.key.Marshal()))
}
builder.WriteString(fmt.Sprintf("Public key: %#x", data.key.PublicKey().Marshal()))
if data.showWithdrawalCredentials {
withdrawalCredentials := util.SHA256(data.key.PublicKey().Marshal())
withdrawalCredentials[0] = byte(0) // BLS_WITHDRAWAL_PREFIX
builder.WriteString(fmt.Sprintf("\nWithdrawal credentials: %#x", withdrawalCredentials))
builder.WriteString(fmt.Sprintf("Withdrawal credentials: %#x\n", withdrawalCredentials))
}
if !(data.showPrivateKey || data.showWithdrawalCredentials) {
builder.WriteString(fmt.Sprintf("Public key: %#x\n", data.key.PublicKey().Marshal()))
}

return builder.String(), nil
Expand Down
6 changes: 3 additions & 3 deletions cmd/account/derive/output_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ func TestOutput(t *testing.T) {
key: blsPrivateKey("0x068dce0c90cb428ab37a74af0191eac49648035f1aaef077734b91e05985ec55"),
showPrivateKey: true,
},
needs: []string{"Public key", "Private key"},
needs: []string{"Private key"},
},
{
name: "WithdrawalCredentials",
dataOut: &dataOut{
key: blsPrivateKey("0x068dce0c90cb428ab37a74af0191eac49648035f1aaef077734b91e05985ec55"),
showWithdrawalCredentials: true,
},
needs: []string{"Public key", "Withdrawal credentials"},
needs: []string{"Withdrawal credentials"},
},
{
name: "All",
Expand All @@ -81,7 +81,7 @@ func TestOutput(t *testing.T) {
showPrivateKey: true,
showWithdrawalCredentials: true,
},
needs: []string{"Public key", "Private key", "Withdrawal credentials"},
needs: []string{"Private key", "Withdrawal credentials"},
},
}

Expand Down
Loading

0 comments on commit 30455e7

Please sign in to comment.