dynamic

package module
v0.0.0-...-c270618 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

README

dynamic-cosmos

working with cosmos chains dynamically

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroadcastTx

func NewBroadcastTx(ctx context.Context, bytes []byte, mode txv1beta1.BroadcastMode, txSvc txv1beta1.ServiceClient, watcher *tx.Watcher) (<-chan *BroadcastTx, error)

Types

type AddressHuman

type AddressHuman = string

AddressHuman is a string type alias for a human-readable address representation.

type AddressRaw

type AddressRaw = []byte

AddressRaw is a []byte type alias for a raw bytes address representation.

type Addresses

type Addresses struct {
	// contains filtered or unexported fields
}

Addresses provides utilities to work with addresses in cosmos-sdk based chains.

func NewAddresses

func NewAddresses(bech32Prefix string) *Addresses

NewAddresses instantiates a new *Addresses instance.

func (*Addresses) Decode

func (a *Addresses) Decode(address AddressHuman) (AddressRaw, error)

Decode decodes an AddressHuman representation into its AddressRaw format.

func (*Addresses) Derive

func (a *Addresses) Derive(address AddressRaw) (AddressHuman, error)

Derive derives an AddressRaw to its chain specific human-readable form.

func (*Addresses) DeriveFromPubKey

func (a *Addresses) DeriveFromPubKey(pubKey PubKeyRaw) (AddressHuman, error)

type AuthenticationOption

type AuthenticationOption func(opt *authenticationOptions)

func WithSigner

func WithSigner(s Signer) AuthenticationOption

WithSigner sets the signature provider for tx requests

func WithSignerInfoProvider

func WithSignerInfoProvider(s SignerInfoProvider) AuthenticationOption

WithSignerInfoProvider sets the SignerInfoProvider for Client

type BroadcastTx

type BroadcastTx = tx.Response

BroadcastTx is an alias of tx.Response and identifies a transaction which was broadcast

type BroadcastTxError

type BroadcastTxError struct {
	Response *abciv1beta1.TxResponse
}

BroadcastTxError identifies an error whilst broadcasting a TX.

func (*BroadcastTxError) Error

func (e *BroadcastTxError) Error() string

type Client

type Client struct {
	App       *reflectionv2alpha1.AppDescriptor
	Codec     *codec.Codec
	Addresses *Addresses
	// contains filtered or unexported fields
}

func Dial

func Dial(ctx context.Context, grpcEndpoint string, tmEndpoint string, dialOptions ...DialOption) (*Client, error)

func (*Client) ClientConn

func (c *Client) ClientConn() grpc.ClientConnInterface

func (*Client) Close

func (c *Client) Close() error

func (*Client) DynamicQuery

func (c *Client) DynamicQuery(ctx context.Context, method string, req, resp proto.Message) (err error)

func (*Client) NewTx

func (c *Client) NewTx() *Tx

type DialOption

type DialOption func(options *options)

DialOption defines a Client Dial option

func WithAppDescriptor

func WithAppDescriptor(desc *reflectionv2alpha1.AppDescriptor) DialOption

WithAppDescriptor allows to provide the application descriptor in case it was cached beforehand to speed up the dial process.

func WithAuthenticationOptions

func WithAuthenticationOptions(authOpts ...AuthenticationOption) DialOption

WithAuthenticationOptions sets the authentication settings for the client.

func WithRemoteRegistry

func WithRemoteRegistry(registry codec.ProtoFileRegistry) DialOption

WithRemoteRegistry allows to setup a custom protobuf file registry

type PubKeyRaw

type PubKeyRaw = []byte

PubKeyRaw is a []byte type alias for a raw public key address representation

type Signer

type Signer interface {
	Sign(addr string, bytes []byte) (signature []byte, err error)
	PubKeyForAddr(addr string) (*anypb.Any, error)
}

type SignerInfoExtended

type SignerInfoExtended struct {
	SignerInfo    *txv1beta1.SignerInfo
	AccountNumber uint64
}

SignerInfoExtended is like txv1beta1.SignerInfo but contains also the account number of the account.

func (SignerInfoExtended) String

func (s SignerInfoExtended) String() string

type SignerInfoProvider

type SignerInfoProvider interface {
	SignerInfo(ctx context.Context, addr string) (*SignerInfoExtended, error)
}

SignerInfoProvider provides information regarding signers.

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

func NewTx

func NewTx(cdc *codec.Codec, supportedMsgs map[protoreflect.FullName]struct{}, chainID string, signeInfoProvider SignerInfoProvider, signer Signer, watcher *tx.Watcher, txSvc txv1beta1.ServiceClient) *Tx

func (*Tx) AddMsg

func (t *Tx) AddMsg(m proto.Message) error

func (*Tx) AddMsgs

func (t *Tx) AddMsgs(msgs ...proto.Message) error

func (*Tx) AddSignerByAddr

func (t *Tx) AddSignerByAddr(addr string)

func (*Tx) AddSignerByPubKey

func (t *Tx) AddSignerByPubKey(pubKey []byte)

func (*Tx) Broadcast

func (t *Tx) Broadcast(ctx context.Context, mode txv1beta1.BroadcastMode) (<-chan *BroadcastTx, error)

func (*Tx) SetFee

func (t *Tx) SetFee(coins ...*basev1beta1.Coin)

func (*Tx) SetFeePayer

func (t *Tx) SetFeePayer(addr string)

SetFeePayer sets the Tx fee payer. It also adds fee payer as a signer of the transaction.

func (*Tx) SetGasLimit

func (t *Tx) SetGasLimit(limit uint64)

func (*Tx) SetMemo

func (t *Tx) SetMemo(memo string)

func (*Tx) SetTimeoutHeight

func (t *Tx) SetTimeoutHeight(height uint64)

func (*Tx) Sign

func (t *Tx) Sign(ctx context.Context) (*txv1beta1.TxRaw, error)

Directories

Path Synopsis
examples
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL