common

package
v0.0.0-...-3a5d5d8 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RosettaVersion tied back to the version of the rosetta go-sdk
	RosettaVersion = "1.4.6" // TODO (dm): set variable via build flags

	// Blockchain ..
	Blockchain = "Feechain"

	// NativeSymbol ..
	NativeSymbol = "FEE"

	// NativePrecision in the number of decimal places
	NativePrecision = 18

	// CurveType ..
	CurveType = types.Secp256k1

	// SignatureType ..
	SignatureType = types.EcdsaRecovery
)
View Source
const (
	// ExpendGasOperation is an operation that only affects the native currency.
	ExpendGasOperation = "Gas"

	// ContractCreationOperation is an operation that only affects the native currency.
	ContractCreationOperation = "ContractCreation"

	// NativeTransferOperation is an operation that only affects the native currency.
	NativeTransferOperation = "NativeTransfer"

	// NativeCrossShardTransferOperation is an operation that only affects the native currency.
	NativeCrossShardTransferOperation = "NativeCrossShardTransfer"

	// CreateValidatorOperation is an operation that only affects the native currency.
	CreateValidatorOperation = "CreateValidator"

	// EditValidatorOperation is an operation that only affects the native currency.
	EditValidatorOperation = "EditValidator"

	// DelegateOperation is an operation that only affects the native currency.
	DelegateOperation = "Delegate"

	// UndelegateOperation is an operation that only affects the native currency.
	UndelegateOperation = "Undelegate"

	// CollectRewardsOperation is an operation that only affects the native currency.
	CollectRewardsOperation = "CollectRewards"

	// GenesisFundsOperation is a side effect operation for genesis block only.
	// Note that no transaction can be constructed with this operation.
	GenesisFundsOperation = "Genesis"

	// PreStakingBlockRewardOperation is a side effect operation for pre-staking era only.
	// Note that no transaction can be constructed with this operation.
	PreStakingBlockRewardOperation = "PreStakingBlockReward"

	// UndelegationPayoutOperation is a side effect operation for committee election block only.
	// Note that no transaction can be constructed with this operation.
	UndelegationPayoutOperation = "UndelegationPayout"
)

Variables

View Source
var (
	// ReadTimeout ..
	ReadTimeout = 60 * time.Second

	// WriteTimeout ..
	WriteTimeout = 60 * time.Second

	// IdleTimeout ..
	IdleTimeout = 120 * time.Second

	// NativeCurrency ..
	NativeCurrency = types.Currency{
		Symbol:   NativeSymbol,
		Decimals: NativePrecision,
	}

	// NativeCurrencyHash for quick equivalent checks
	NativeCurrencyHash = types.Hash(NativeCurrency)
)
View Source
var (
	// CatchAllError ..
	CatchAllError = types.Error{
		Code:      0,
		Message:   "catch all error",
		Retriable: false,
	}

	// SanityCheckError ..
	SanityCheckError = types.Error{
		Code:      1,
		Message:   "sanity check error",
		Retriable: false,
	}

	// InvalidNetworkError ..
	InvalidNetworkError = types.Error{
		Code:      2,
		Message:   "invalid network error",
		Retriable: false,
	}

	// TransactionSubmissionError ..
	TransactionSubmissionError = types.Error{
		Code:      3,
		Message:   "transaction submission error",
		Retriable: true,
	}

	// StakingTransactionSubmissionError ..
	StakingTransactionSubmissionError = types.Error{
		Code:      4,
		Message:   "staking transaction submission error",
		Retriable: true,
	}

	// BlockNotFoundError ..
	BlockNotFoundError = types.Error{
		Code:      5,
		Message:   "block not found error",
		Retriable: false,
	}

	// TransactionNotFoundError ..
	TransactionNotFoundError = types.Error{
		Code:      6,
		Message:   "transaction or staking transaction not found",
		Retriable: false,
	}

	// ReceiptNotFoundError ..
	ReceiptNotFoundError = types.Error{
		Code:      7,
		Message:   "receipt not found",
		Retriable: false,
	}

	// UnsupportedCurveTypeError ..
	UnsupportedCurveTypeError = types.Error{
		Code:      8,
		Message:   "unsupported curve type",
		Retriable: false,
	}

	// InvalidTransactionConstructionError ..
	InvalidTransactionConstructionError = types.Error{
		Code:      9,
		Message:   "invalid transaction construction",
		Retriable: false,
	}

	// InvalidStakingConstructionError ..
	InvalidStakingConstructionError = types.Error{
		Code:      10,
		Message:   "invalid staking transaction construction",
		Retriable: false,
	}

	// ErrCallParametersInvalid ..
	ErrCallParametersInvalid = types.Error{
		Code:      11,
		Message:   "invalid call parameters",
		Retriable: false,
	}

	// ErrCallExecute ..
	ErrCallExecute = types.Error{
		Code:      12,
		Message:   "call execute error",
		Retriable: false,
	}

	// ErrCallMethodInvalid ..
	ErrCallMethodInvalid = types.Error{
		Code:      13,
		Message:   "call method invalid",
		Retriable: false,
	}

	// ErrGetStakingInfo ..
	ErrGetStakingInfo = types.Error{
		Code:      14,
		Message:   "get staking info error",
		Retriable: false,
	}
)
View Source
var (
	// PlainOperationTypes ..
	PlainOperationTypes = []string{
		ExpendGasOperation,
		NativeTransferOperation,
		NativeCrossShardTransferOperation,
		ContractCreationOperation,
		GenesisFundsOperation,
		PreStakingBlockRewardOperation,
		UndelegationPayoutOperation,
	}

	// StakingOperationTypes ..
	StakingOperationTypes = []string{
		staking.DirectiveCreateValidator.String(),
		staking.DirectiveEditValidator.String(),
		staking.DirectiveDelegate.String(),
		staking.DirectiveUndelegate.String(),
		staking.DirectiveCollectRewards.String(),
	}

	// MutuallyExclusiveOperations for invariant: A transaction can only contain 1 type of 'native' operation.
	MutuallyExclusiveOperations = map[string]interface{}{
		NativeTransferOperation:           struct{}{},
		NativeCrossShardTransferOperation: struct{}{},
	}
)
View Source
var (
	// SuccessOperationStatus for tx operations who's amount affects the account
	SuccessOperationStatus = &types.OperationStatus{
		Status:     "success",
		Successful: true,
	}

	// ContractFailureOperationStatus for tx operations who's amount does not affect the account
	// due to a contract call failure (but still incurs gas).
	ContractFailureOperationStatus = &types.OperationStatus{
		Status:     "contract_failure",
		Successful: false,
	}

	// FailureOperationStatus ..
	FailureOperationStatus = &types.OperationStatus{
		Status:     "failure",
		Successful: false,
	}
)

Functions

func GetNetwork

func GetNetwork(shardID uint32) (*types.NetworkIdentifier, error)

GetNetwork fetches the networking identifier for the given shard

func InitRosettaFile

func InitRosettaFile(file string)

func NewError

func NewError(rosettaError types.Error, detailStructure interface{}) *types.Error

NewError create a new error with a given detail structure

Types

type CollectRewardsMetadata

type CollectRewardsMetadata rpcV2.CollectRewardsMsg

CollectRewardsMetadata ..

func (*CollectRewardsMetadata) UnmarshalFromInterface

func (s *CollectRewardsMetadata) UnmarshalFromInterface(data interface{}) error

type CreateValidatorOperationMetadata

type CreateValidatorOperationMetadata rpcV2.CreateValidatorMsg

CreateValidatorOperationMetadata ..

func (*CreateValidatorOperationMetadata) UnmarshalFromInterface

func (s *CreateValidatorOperationMetadata) UnmarshalFromInterface(data interface{}) error

type CrossShardTransactionOperationMetadata

type CrossShardTransactionOperationMetadata struct {
	From *types.AccountIdentifier `json:"from"`
	To   *types.AccountIdentifier `json:"to"`
}

CrossShardTransactionOperationMetadata ..

func (*CrossShardTransactionOperationMetadata) UnmarshalFromInterface

func (s *CrossShardTransactionOperationMetadata) UnmarshalFromInterface(data interface{}) error

UnmarshalFromInterface ..

type DelegateOperationMetadata

type DelegateOperationMetadata rpcV2.DelegateMsg

DelegateOperationMetadata ..

func (*DelegateOperationMetadata) UnmarshalFromInterface

func (s *DelegateOperationMetadata) UnmarshalFromInterface(data interface{}) error

type EditValidatorOperationMetadata

type EditValidatorOperationMetadata rpcV2.EditValidatorMsg

EditValidatorOperationMetadata ..

func (*EditValidatorOperationMetadata) UnmarshalFromInterface

func (s *EditValidatorOperationMetadata) UnmarshalFromInterface(data interface{}) error

type LocalFix

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

func GetDefaultFix

func GetDefaultFix() *LocalFix

func (*LocalFix) IsForceTxFailed

func (f *LocalFix) IsForceTxFailed(txHash string) bool

func (*LocalFix) IsForceTxSuccess

func (f *LocalFix) IsForceTxSuccess(txHash string) bool

type SubNetworkMetadata

type SubNetworkMetadata struct {
	IsBeacon bool `json:"is_beacon"`
}

SubNetworkMetadata for the sub network identifier of a shard

func (*SubNetworkMetadata) UnmarshalFromInterface

func (s *SubNetworkMetadata) UnmarshalFromInterface(metadata interface{}) error

UnmarshalFromInterface ..

type SyncStatus

type SyncStatus int

SyncStatus ..

const (
	SyncingUnknown SyncStatus = iota
	SyncingNewBlock
	SyncingFinish
)

Sync status enum

func (SyncStatus) String

func (s SyncStatus) String() string

String ..

type UndelegateOperationMetadata

type UndelegateOperationMetadata rpcV2.UndelegateMsg

UndelegateOperationMetadata ..

func (*UndelegateOperationMetadata) UnmarshalFromInterface

func (s *UndelegateOperationMetadata) UnmarshalFromInterface(data interface{}) error

Jump to

Keyboard shortcuts

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