Documentation
¶
Index ¶
- Constants
- Variables
- type Cosmosign
- type Option
- func WithFeeGranter(feeGranter sdktypes.AccAddress) Option
- func WithFeePayer(feePayer sdktypes.AccAddress) Option
- func WithFees(fees string) Option
- func WithGRPCConn(grpcConn *grpc.ClientConn) Option
- func WithGas(gas uint64) Option
- func WithGasMultipler(gasMultiplier float64) Option
- func WithGasPrices(gasPrices string) Option
- func WithKeyringAppName(keyringAppName string) Option
- func WithKeyringBackend(keyringBackend string) Option
- func WithKeyringRootDir(keyringRootDir string) Option
- func WithKeyringUID(keyringUID string) Option
- func WithMemo(memo string) Option
Examples ¶
Constants ¶
const ( DefaultAddressPrefix = "cosmos" DefaultGasMultiplier = 1.0 DefaultGasPrices = "0.0ustake" DefaultTimeout = 5 * time.Second )
Variables ¶
var ErrGRPCClientIsNil = errors.New("grpc client must be set")
Functions ¶
This section is empty.
Types ¶
type Cosmosign ¶
type Cosmosign struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient initializes a new cosmosign instance
Example ¶
package main
import (
"context"
"log"
"github.com/shapeshed/cosmosign"
)
func main() {
ctx := context.Background()
// Initialize cosmosign client (this requires network connectivity)
cs, err := cosmosign.NewClient(ctx,
cosmosign.WithGasPrices("0.0ustake"),
cosmosign.WithKeyringBackend("pass"),
cosmosign.WithKeyringRootDir("/home/cosmos/"),
cosmosign.WithKeyringUID("account1"),
)
if err != nil {
log.Fatalf("Failed to initialise cosmosign: %v", err)
}
// Log the initialized client
log.Printf("Cosmosign client initialized: %+v", cs)
// Note: This example will not run because it requires external network connectivity
// Output is omitted intentionally to avoid failures in testing environments.
}
func (*Cosmosign) ApplyOptions ¶
ApplyOptions applies options to the running client
Example ¶
package main
import (
"context"
"log"
"github.com/shapeshed/cosmosign"
)
func main() {
ctx := context.Background()
cs, err := cosmosign.NewClient(ctx,
cosmosign.WithGasPrices("0.0ustake"),
cosmosign.WithKeyringBackend("pass"),
cosmosign.WithKeyringRootDir("/home/cosmos/"),
cosmosign.WithKeyringUID("account1"),
)
if err != nil {
log.Fatalf("Failed to initialise cosmosign: %v", err)
}
err = cs.ApplyOptions(
cosmosign.WithGasPrices("0.01ustake"),
)
if err != nil {
log.Fatalf("Failed to apply options: %v", err)
}
log.Printf("Cosmosign client after applying options: %+v", cs)
// This example will not run as it requires network connectivity
}
func (*Cosmosign) SendMessages ¶
SendMessages signs and broadcasts a transaction with one or more messages
func (*Cosmosign) SendMessagesWaitTx ¶
SendMessagesWaitTx broadcasts a message and waits for it to be confirmed, returning the result.
type Option ¶
type Option func(*Cosmosign)
Option is a function that configures the Cosmosign client.
func WithFeeGranter ¶
func WithFeeGranter(feeGranter sdktypes.AccAddress) Option
WithFeeGranter sets the fee granter for the client.
func WithFeePayer ¶
func WithFeePayer(feePayer sdktypes.AccAddress) Option
WithFeePayer sets the fee payer for the client.
func WithGRPCConn ¶ added in v0.1.0
func WithGRPCConn(grpcConn *grpc.ClientConn) Option
WithGasPrices sets the multipler for gas simulation amount.
func WithGasMultipler ¶
WithGasPrices sets the multipler for gas simulation amount.
func WithGasPrices ¶
WithGasPrices sets the gas prices used for the client.
func WithKeyringAppName ¶ added in v0.2.0
WithKeyringUID sets the keyring uid (account) to use in signing.
func WithKeyringBackend ¶
WithKeyringBackend sets the backend to use for the keyring.
func WithKeyringRootDir ¶
WithKeyringBackend sets the backend to use for the keyring.
func WithKeyringUID ¶
WithKeyringUID sets the keyring uid (account) to use in signing.