Skip to content

Commit d365bcb

Browse files
authored
expose WritePrivateKeyToPath so it can be used externally (#217)
1 parent 87d2bd4 commit d365bcb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

chain/solana/provider/ctf_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (p *CTFChainProvider) Initialize(_ context.Context) (chain.BlockChain, erro
124124
keypairDir := p.t.TempDir()
125125

126126
keypairPath := filepath.Join(keypairDir, "solana-keypair.json")
127-
if err = writePrivateKeyToPath(keypairPath, privKey); err != nil {
127+
if err = WritePrivateKeyToPath(keypairPath, privKey); err != nil {
128128
return nil, fmt.Errorf("failed to write deployer keypair to file: %w", err)
129129
}
130130

chain/solana/provider/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ func isValidFilepath(fp string) error {
2323
return nil
2424
}
2525

26-
// writePrivateKeyToPath writes the provided Solana private key to the specified file path in JSON
26+
// WritePrivateKeyToPath writes the provided Solana private key to the specified file path in JSON
2727
// format. The private key is stored as an array of integers, where each integer represents a byte
2828
// of the private key.
29-
func writePrivateKeyToPath(keyPath string, privKey solana.PrivateKey) error {
29+
func WritePrivateKeyToPath(keyPath string, privKey solana.PrivateKey) error {
3030
b := []byte(privKey)
3131

3232
// Convert bytes to slice of integers for JSON conversion

chain/solana/provider/rpc_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (p *RPCChainProvider) Initialize(_ context.Context) (chain.BlockChain, erro
102102

103103
// Persist the deployer keypair to the KeypairDirPath for the Solana CLI to use
104104
keypairPath := filepath.Join(p.config.KeypairDirPath, "authority-keypair.json")
105-
if err := writePrivateKeyToPath(keypairPath, privKey); err != nil {
105+
if err := WritePrivateKeyToPath(keypairPath, privKey); err != nil {
106106
return nil, fmt.Errorf("failed to write deployer keypair to file: %w", err)
107107
}
108108

0 commit comments

Comments
 (0)