types

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeCreateWallet      = "create_wallet"
	EventTypeCreateTransaction = "create_transaction"
	EventTypeSignTransaction   = "sign_transaction"

	// Common
	AttributeKeySender      = "sender"
	AttributeKeyWallet      = "wallet"
	AttributeKeyTransaction = "transaction"

	// CreateWallet
	AttributeKeyOwners    = "owners"
	AttributeKeyWeights   = "weights"
	AttributeKeyThreshold = "threshold"

	// CreateTransaction
	AttributeKeyReceiver = "receiver"
	AttributeKeyCoins    = "coins"

	// SignTransaction
	AttributeKeySigner        = "signer"
	AttributeKeySignerWeight  = "signer_weight"
	AttributeKeyConfirmations = "confirmations"
	AttributeKeyConfirmed     = "confirmed"

	AttributeValueCategory = ModuleName
)

multisig module event types

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "multisig"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	QuerierRoute = ModuleName
)
View Source
const (
	MinOwnerCount = 2
	MaxOwnerCount = 16
	MinWeight     = 1
	MaxWeight     = 1024
)

Multisignature wallet limitations.

View Source
const CreateTransactionConst = "create_transaction"
View Source
const CreateWalletConst = "create_wallet"
View Source
const DefaultCodespace string = ModuleName

DefaultCodespace defines default multisig codespace.

View Source
const (
	DefaultParamspace = ModuleName
)

Default parameter namespace

View Source
const MultisigTransactionIDPrefix = "dxmstx"

MultisigTransactionIDPrefix is prefix for multisig transaction ID.

View Source
const SignTransactionConst = "sign_transaction"

Variables

View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func ErrDuplicateOwner

func ErrDuplicateOwner(address string) *sdkerrors.Error

func ErrInsufficientFunds

func ErrInsufficientFunds(funds string) *sdkerrors.Error

func ErrInvalidCoinToSend

func ErrInvalidCoinToSend(denom string) *sdkerrors.Error

func ErrInvalidOwner

func ErrInvalidOwner() *sdkerrors.Error

func ErrInvalidOwnerCount

func ErrInvalidOwnerCount(more bool) *sdkerrors.Error

func ErrInvalidSender

func ErrInvalidSender() *sdkerrors.Error

func ErrInvalidWeight

func ErrInvalidWeight(weight string, data string) *sdkerrors.Error

func ErrInvalidWeightCount

func ErrInvalidWeightCount(LenMsgWeights string, LenMsgOwners string) *sdkerrors.Error

func ErrWalletAccountNotFound

func ErrWalletAccountNotFound() *sdkerrors.Error

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for multisig module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the multisig genesis parameters

Types

type CodeType

type CodeType = uint32

CodeType defines the local code type.

const (
	CodeInvalidSender         CodeType = 101
	CodeInvalidOwnerCount     CodeType = 102
	CodeInvalidOwner          CodeType = 103
	CodeInvalidWeightCount    CodeType = 104
	CodeInvalidWeight         CodeType = 105
	CodeInvalidCoinToSend     CodeType = 106
	CodeInvalidAmountToSend   CodeType = 107
	CodeWalletAccountNotFound CodeType = 108
	CodeInsufficientFunds     CodeType = 109
	CodeDuplicateOwner        CodeType = 110
)

Custom errors codes.

type GenesisState

type GenesisState struct {
}

GenesisState - all multisig state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - default GenesisState used by Cosmos Hub

func NewGenesisState

func NewGenesisState() GenesisState

NewGenesisState creates a new GenesisState object

type MsgCreateTransaction

type MsgCreateTransaction struct {
	Sender   sdk.AccAddress `json:"sender" yaml:"sender"`
	Wallet   sdk.AccAddress `json:"wallet" yaml:"wallet"`
	Receiver sdk.AccAddress `json:"receiver" yaml:"receiver"`
	Coins    sdk.Coins      `json:"coins" yaml:"coins"`
}

MsgCreateTransaction defines a CreateTransaction message to create new transaction for multisignature wallet.

func NewMsgCreateTransaction

func NewMsgCreateTransaction(sender sdk.AccAddress, wallet sdk.AccAddress, receiver sdk.AccAddress, coins sdk.Coins) MsgCreateTransaction

NewMsgCreateTransaction creates a new MsgCreateTransaction instance.

func (MsgCreateTransaction) GetSignBytes

func (msg MsgCreateTransaction) GetSignBytes() []byte

GetSignBytes returns the canonical byte representation of the message used to generate a signature.

func (MsgCreateTransaction) GetSigners

func (msg MsgCreateTransaction) GetSigners() []sdk.AccAddress

GetSigners returns the list of signers required to sign the message.

func (MsgCreateTransaction) Route

func (msg MsgCreateTransaction) Route() string

Route returns name of the route for the message.

func (MsgCreateTransaction) Type

func (msg MsgCreateTransaction) Type() string

Type returns the name of the type for the message.

func (MsgCreateTransaction) ValidateBasic

func (msg MsgCreateTransaction) ValidateBasic() error

ValidateBasic performs basic validation of the message.

type MsgCreateWallet

type MsgCreateWallet struct {
	Sender    sdk.AccAddress   `json:"sender" yaml:"sender"`
	Owners    []sdk.AccAddress `json:"owners" yaml:"owners"`
	Weights   []uint           `json:"weights" yaml:"weights"`
	Threshold uint             `json:"threshold" yaml:"threshold"`
}

MsgCreateWallet defines a CreateWallet message to create new multisignature wallet.

func NewMsgCreateWallet

func NewMsgCreateWallet(sender sdk.AccAddress, owners []sdk.AccAddress, weights []uint, threshold uint) MsgCreateWallet

NewMsgCreateWallet creates a new MsgCreateWallet instance.

func (MsgCreateWallet) GetSignBytes

func (msg MsgCreateWallet) GetSignBytes() []byte

GetSignBytes returns the canonical byte representation of the message used to generate a signature.

func (MsgCreateWallet) GetSigners

func (msg MsgCreateWallet) GetSigners() []sdk.AccAddress

GetSigners returns the list of signers required to sign the message.

func (MsgCreateWallet) Route

func (msg MsgCreateWallet) Route() string

Route returns name of the route for the message.

func (MsgCreateWallet) Type

func (msg MsgCreateWallet) Type() string

Type returns the name of the type for the message.

func (MsgCreateWallet) ValidateBasic

func (msg MsgCreateWallet) ValidateBasic() error

ValidateBasic performs basic validation of the message.

type MsgSignTransaction

type MsgSignTransaction struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
	TxID   string         `json:"tx_id" yaml:"tx_id"`
}

MsgSignTransaction defines a SignTransaction message to sign existing transaction for multisignature wallet.

func NewMsgSignTransaction

func NewMsgSignTransaction(sender sdk.AccAddress, txID string) MsgSignTransaction

NewMsgSignTransaction is a constructor function for MsgCreateTransaction

func (MsgSignTransaction) GetSignBytes

func (msg MsgSignTransaction) GetSignBytes() []byte

GetSignBytes returns the canonical byte representation of the message used to generate a signature.

func (MsgSignTransaction) GetSigners

func (msg MsgSignTransaction) GetSigners() []sdk.AccAddress

GetSigners returns the list of signers required to sign the message.

func (MsgSignTransaction) Route

func (msg MsgSignTransaction) Route() string

Route returns name of the route for the message.

func (MsgSignTransaction) Type

func (msg MsgSignTransaction) Type() string

Type returns the name of the type for the message.

func (MsgSignTransaction) ValidateBasic

func (msg MsgSignTransaction) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type ParamSubspace

type ParamSubspace interface {
	WithKeyTable(table params.KeyTable) params.Subspace
	Get(ctx sdk.Context, key []byte, ptr interface{})
	GetParamSet(ctx sdk.Context, ps params.ParamSet)
	SetParamSet(ctx sdk.Context, ps params.ParamSet)
}

ParamSubspace defines the expected Subspace interfacace

type Params

type Params struct {
}

Params - used for initializing default parameter for multisig at genesis

func DefaultParams

func DefaultParams() Params

DefaultParams defines the parameters for this module

func NewParams

func NewParams() Params

NewParams creates a new Params object

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs - Implements params.ParamSet

func (Params) String

func (p Params) String() string

String implements the stringer interface for Params

type QueryTransactions

type QueryTransactions []Transaction

QueryTransactions specifies type containing set of multisig transactions.

func (QueryTransactions) String

func (n QueryTransactions) String() string

String implements fmt.Stringer interface.

type QueryWallets

type QueryWallets []Wallet

QueryWallets specifies type containing set of multisig wallets.

func (QueryWallets) String

func (n QueryWallets) String() string

String implements fmt.Stringer interface.

type Transaction

type Transaction struct {
	ID        string           `json:"id" yaml:"id"`
	Wallet    sdk.AccAddress   `json:"wallet" yaml:"wallet"`
	Receiver  sdk.AccAddress   `json:"receiver" yaml:"receiver"`
	Coins     sdk.Coins        `json:"coins" yaml:"coins"`
	Signers   []sdk.AccAddress `json:"signers" yaml:"signers"`
	CreatedAt int64            `json:"created_at" yaml:"created_at"` // block height
}

Transaction is a struct that contains all the metadata of a multi-signature wallet transaction.

func NewTransaction

func NewTransaction(wallet, receiver sdk.AccAddress, coins sdk.Coins, signers []sdk.AccAddress, height int64, salt []byte) (*Transaction, error)

NewTransaction returns a new Transaction.

func (*Transaction) String

func (t *Transaction) String() string

String implements fmt.Stringer interface.

type Wallet

type Wallet struct {
	Address   sdk.AccAddress   `json:"address" yaml:"address"`
	Owners    []sdk.AccAddress `json:"owners" yaml:"owners"`
	Weights   []uint           `json:"weights" yaml:"weights"`
	Threshold uint             `json:"threshold" yaml:"threshold"`
}

Wallet is a struct that contains all the metadata of a multi-signature wallet.

func NewWallet

func NewWallet(owners []sdk.AccAddress, weights []uint, threshold uint, salt []byte) (*Wallet, error)

NewWallet returns a new Wallet.

func (*Wallet) String

func (w *Wallet) String() string

String implements fmt.Stringer interface.

Jump to

Keyboard shortcuts

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