-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
896efc6
commit 798ef45
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/smartcontractkit/ccip-owner-contracts/tools/signing" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var derivationPath []uint | ||
|
||
var SignLedgerCmd = &cobra.Command{ | ||
Use: "sign-pk", | ||
Short: "Sign a proposal with a private key", | ||
Long: `Configure a private key in a .env file (using the PRIVATE_KEY var) and sign a proposal with it.`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
// Load proposal | ||
proposal, err := LoadProposal(proposalType, proposalPath) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// convert derivation path to []uint32 | ||
derivationPathUint32 := make([]uint32, len(derivationPath)) | ||
for i, v := range derivationPath { | ||
derivationPathUint32[i] = uint32(v) | ||
} | ||
|
||
err = signing.SignLedger(derivationPathUint32, proposal) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Write proposal to file | ||
err = WriteProposalToFile(proposal, proposalPath) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
func init() { | ||
SignLedgerCmd.Flags().UintSliceVar(&derivationPath, "derivation-path", []uint{44, 60, 0, 0, 0}, "Derivation path for the Ledger") | ||
} |