mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 01:41:44 +00:00
feature/1220 origin handle exists method (#1241)
* feat: add docs and CI workflow for publishing to onsonr.dev * (refactor): Move hway,motr executables to their own repos * feat: simplify devnet and testnet configurations * refactor: update import path for didcrypto package * docs(networks): Add README with project overview, architecture, and community links * refactor: Move network configurations to deploy directory * build: update golang version to 1.23 * refactor: move logger interface to appropriate package * refactor: Move devnet configuration to networks/devnet * chore: improve release process with date variable * (chore): Move Crypto Library * refactor: improve code structure and readability in DID module * feat: integrate Trunk CI checks * ci: optimize CI workflow by removing redundant build jobs --------- Co-authored-by: Darp Alakun <i@prad.nu>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package transaction
|
||||
|
||||
import "context"
|
||||
|
||||
// ExecMode defines the execution mode
|
||||
type ExecMode uint8
|
||||
|
||||
// All possible execution modes.
|
||||
// For backwards compatibility and easier casting, the exec mode values must be the same as in cosmos/cosmos-sdk/types package.
|
||||
const (
|
||||
ExecModeCheck ExecMode = iota
|
||||
ExecModeReCheck
|
||||
ExecModeSimulate
|
||||
_
|
||||
_
|
||||
_
|
||||
_
|
||||
ExecModeFinalize
|
||||
)
|
||||
|
||||
// Service creates a transaction service.
|
||||
type Service interface {
|
||||
// ExecMode returns the current execution mode.
|
||||
ExecMode(ctx context.Context) ExecMode
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package transaction
|
||||
|
||||
type (
|
||||
// Msg uses structural types to define the interface for a message.
|
||||
Msg = interface {
|
||||
Reset()
|
||||
String() string
|
||||
ProtoMessage()
|
||||
}
|
||||
Identity = []byte
|
||||
)
|
||||
|
||||
// GenericMsg defines a generic version of a Msg.
|
||||
// The GenericMsg refers to the non pointer version of Msg,
|
||||
// and is required to allow its instantiations in generic contexts.
|
||||
type GenericMsg[T any] interface {
|
||||
*T
|
||||
Msg
|
||||
}
|
||||
|
||||
// Codec defines the TX codec, which converts a TX from bytes to its concrete representation.
|
||||
type Codec[T Tx] interface {
|
||||
// Decode decodes the tx bytes into a DecodedTx, containing
|
||||
// both concrete and bytes representation of the tx.
|
||||
Decode([]byte) (T, error)
|
||||
// DecodeJSON decodes the tx JSON bytes into a DecodedTx
|
||||
DecodeJSON([]byte) (T, error)
|
||||
}
|
||||
|
||||
// Tx defines the interface for a transaction.
|
||||
// All custom transactions must implement this interface.
|
||||
type Tx interface {
|
||||
// Hash returns the unique identifier for the Tx.
|
||||
Hash() [32]byte
|
||||
// GetMessages returns the list of state transitions of the Tx.
|
||||
GetMessages() ([]Msg, error)
|
||||
// GetSenders returns the tx state transition sender.
|
||||
GetSenders() ([]Identity, error) // TODO reduce this to a single identity if accepted
|
||||
// GetGasLimit returns the gas limit of the tx. Must return math.MaxUint64 for infinite gas
|
||||
// txs.
|
||||
GetGasLimit() (uint64, error)
|
||||
// Bytes returns the encoded version of this tx. Note: this is ideally cached
|
||||
// from the first instance of the decoding of the tx.
|
||||
Bytes() []byte
|
||||
}
|
||||
Reference in New Issue
Block a user