mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-13 04:50:11 +00:00

* Add basic wallet library * Add CLI * Add multisig support * Add persistence to wallet * Add tests * go mod tidy * Fix lint errors * Fix wallet send command * Always use the password as byte slice * Remove redundant empty string * Use different salt per private key * Don't sign a signed transaction * Add comment * Remove old wallet * Change directory permissions * Use NormalizeRPCServerAddress * Fix compilation errors
35 lines
635 B
Go
35 lines
635 B
Go
package main
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"fmt"
|
|
"github.com/kaspanet/kaspad/cmd/kaspawallet/libkaspawallet"
|
|
)
|
|
|
|
func broadcast(conf *broadcastConfig) error {
|
|
client, err := connectToRPC(conf.NetParams(), conf.RPCServer)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
psTxBytes, err := hex.DecodeString(conf.Transaction)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
tx, err := libkaspawallet.ExtractTransaction(psTxBytes)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
transactionID, err := sendTransaction(client, tx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println("Transaction was sent successfully")
|
|
fmt.Printf("Transaction ID: \t%s\n", transactionID)
|
|
|
|
return nil
|
|
}
|