Documentation
¶
Index ¶
- func CDCToDKGIDMapping(cdc cadence.Value) map[string]int
- func CDCToString(v cadence.Value) string
- func CadenceArrayFrom[T any](slice []T, convert func(T) cadence.Value) cadence.Array
- func CadenceArrayTo[T any](arr cadence.Value, convert func(cadence.Value) T) []T
- func CadenceBool(value bool) cadence.Bool
- func CadenceString(value string) cadence.Value
- func CadenceUFix64(value string) cadence.Value
- func CadenceUInt64(value uint64) cadence.Value
- func CadenceUInt8(value uint8) cadence.Value
- func DKGIDMappingToCDC(idMapping map[string]int) cadence.Dictionary
- func DKGPubKeyFixture() string
- func DKGPubKeyFixtureCDC() cadence.String
- func DKGPubKeysFixture(n int) []string
- func DKGPubKeysFixtureCDC(n int) cadence.Array
- func StringToCDC(s string) cadence.Value
- func Submit(t *testing.T, b emulator.Emulator, tx *flow.Transaction, shouldRevert bool, ...) *types.TransactionResult
- func UnwrapOptional[T cadence.Value](optional cadence.Value) T
- type CandidateNodes
- type Cluster
- type ConfigMetadata
- type DelegatorIDs
- type EpochCommit
- type EpochCommitEvent
- type EpochMetadata
- type EpochRecover
- type EpochRecoverEvent
- func (evt EpochRecoverEvent) ClusterQCVoteData() cadence.Array
- func (evt EpochRecoverEvent) CollectorClusters() cadence.Array
- func (evt EpochRecoverEvent) Counter() cadence.UInt64
- func (evt EpochRecoverEvent) DKGFinalViews() (cadence.UInt64, cadence.UInt64, cadence.UInt64)
- func (evt EpochRecoverEvent) DKGGroupKey() cadence.Array
- func (evt EpochRecoverEvent) DKGPubKeys() cadence.Array
- func (evt EpochRecoverEvent) FinalView() cadence.UInt64
- func (evt EpochRecoverEvent) FirstView() cadence.UInt64
- func (evt EpochRecoverEvent) NodeInfo() cadence.Array
- func (evt EpochRecoverEvent) RandomSource() cadence.String
- func (evt EpochRecoverEvent) TargetDuration() cadence.UInt64
- func (evt EpochRecoverEvent) TargetEndTime() cadence.UInt64
- type EpochSetup
- type EpochSetupEvent
- type EpochStart
- type EpochStartEvent
- type EpochTimingConfig
- type EpochTotalRewardsPaid
- type EpochTotalRewardsPaidEvent
- type MachineAccountCreatedEvent
- type ResultSubmission
- type SharedAccountRegisteredEvent
- type StakingCollectionInfo
- type StakingInfo
- type UnlockedAccountRegisteredEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CDCToDKGIDMapping ¶
CDCToDKGIDMapping converts an ID mapping (map from node IDs to DKG indexes) from a Cadence dictionary representation to a Go map representation.
func CDCToString ¶
CDCToString converts a cadence.String to a Go string.
func CadenceArrayFrom ¶
CadenceArrayFrom constructs a Cadence array from a Go slice, converting each individual element with the convert function.
func CadenceArrayTo ¶
CadenceArrayTo converts a Cadence array to a Go slice, converting each individual element with the convert function
func CadenceBool ¶
CadenceBool returns a bool value from a bool
func CadenceString ¶
CadenceString returns a string value from a string representation
func CadenceUFix64 ¶
CadenceUFix64 returns a UFix64 value from a string representation
func CadenceUInt64 ¶
CadenceUInt64 returns a UInt64 value from a uint64
func CadenceUInt8 ¶
CadenceUInt8 returns a UInt8 value from a uint8
func DKGIDMappingToCDC ¶
func DKGIDMappingToCDC(idMapping map[string]int) cadence.Dictionary
DKGIDMappingToCDC converts an ID mapping (map from node IDs to DKG indexes) from a Go map representation to a Cadence dictionary representation.
func DKGPubKeyFixture ¶
func DKGPubKeyFixture() string
DKGPubKeyFixture constructs a fixture for a DKG public key string as accepted by FlowDKG (any hex-encoded 96-byte bytes).
func DKGPubKeyFixtureCDC ¶
DKGPubKeyFixtureCDC returns a Cadence string-typed version of DKGPubKeyFixture.
func DKGPubKeysFixture ¶
DKGPubKeysFixture constructs a fixture for a DKG public key string list as accepted by FlowDKG (any list of hex-encoded 96-byte bytes).
func DKGPubKeysFixtureCDC ¶
DKGPubKeysFixtureCDC returns a Cadence array-typed version of DKGPubKeysFixture.
func StringToCDC ¶
StringToCDC converts a Go string to a cadence.String.
func Submit ¶
func Submit( t *testing.T, b emulator.Emulator, tx *flow.Transaction, shouldRevert bool, expectedErrs ...error, ) *types.TransactionResult
Submit submits a transaction and checks if it fails or not, based on shouldRevert specification. If shouldRevert is true this function will ensures that the transaction error contains each of the expected errors.
Types ¶
type CandidateNodes ¶
type CandidateNodes struct {
// contains filtered or unexported fields
}
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Used to verify the values of the clusters in the smart contract
type ConfigMetadata ¶
type ConfigMetadata struct {
// contains filtered or unexported fields
}
Used to verify the configurable Epoch metadata in tests
type DelegatorIDs ¶
type DelegatorIDs struct {
// contains filtered or unexported fields
}
Struct for each delegator that specifies their node ID and delegator ID
type EpochCommit ¶
type EpochCommit struct {
// contains filtered or unexported fields
}
Used to verify the EpochCommit event fields in tests
type EpochCommitEvent ¶
type EpochCommitEvent flow.Event
func (EpochCommitEvent) Counter ¶
func (evt EpochCommitEvent) Counter() cadence.UInt64
type EpochMetadata ¶
type EpochMetadata struct {
// contains filtered or unexported fields
}
Used to verify epoch metadata in tests
type EpochRecover ¶
type EpochRecover struct {
// contains filtered or unexported fields
}
EpochRecover used to verify EpochRecover event fields in tests.
type EpochRecoverEvent ¶
type EpochRecoverEvent flow.Event
func (EpochRecoverEvent) ClusterQCVoteData ¶
func (evt EpochRecoverEvent) ClusterQCVoteData() cadence.Array
ClusterQCVoteData returns clusterQCVoteData field in EpochRecover event.
func (EpochRecoverEvent) CollectorClusters ¶
func (evt EpochRecoverEvent) CollectorClusters() cadence.Array
CollectorClusters returns clusterAssignments field in EpochRecover event.
func (EpochRecoverEvent) Counter ¶
func (evt EpochRecoverEvent) Counter() cadence.UInt64
Counter returns counter field in EpochRecover event.
func (EpochRecoverEvent) DKGFinalViews ¶
DKGFinalViews returns dkgFinalViews field in EpochRecover event.
func (EpochRecoverEvent) DKGGroupKey ¶
func (evt EpochRecoverEvent) DKGGroupKey() cadence.Array
DKGGroupKey returns dkgGroupKey field in EpochRecover event.
func (EpochRecoverEvent) DKGPubKeys ¶
func (evt EpochRecoverEvent) DKGPubKeys() cadence.Array
DKGPubKeys returns dkgPubKeys field in EpochRecover event.
func (EpochRecoverEvent) FinalView ¶
func (evt EpochRecoverEvent) FinalView() cadence.UInt64
FinalView returns finalView field in EpochRecover event.
func (EpochRecoverEvent) FirstView ¶
func (evt EpochRecoverEvent) FirstView() cadence.UInt64
FirstView returns firstView field in EpochRecover event.
func (EpochRecoverEvent) NodeInfo ¶
func (evt EpochRecoverEvent) NodeInfo() cadence.Array
NodeInfo returns nodeInfo field in EpochRecover event.
func (EpochRecoverEvent) RandomSource ¶
func (evt EpochRecoverEvent) RandomSource() cadence.String
RandomSource returns randomSource field in EpochRecover event.
func (EpochRecoverEvent) TargetDuration ¶
func (evt EpochRecoverEvent) TargetDuration() cadence.UInt64
TargetDuration returns targetDuration field in EpochRecover event.
func (EpochRecoverEvent) TargetEndTime ¶
func (evt EpochRecoverEvent) TargetEndTime() cadence.UInt64
TargetEndTime returns targetEndTime field in EpochRecover event.
type EpochSetup ¶
type EpochSetup struct {
// contains filtered or unexported fields
}
Used to verify the EpochSetup event fields in tests
type EpochSetupEvent ¶
type EpochSetupEvent flow.Event
func (EpochSetupEvent) Counter ¶
func (evt EpochSetupEvent) Counter() cadence.UInt64
func (EpochSetupEvent) NodeInfo ¶
func (evt EpochSetupEvent) NodeInfo() cadence.Array
type EpochStart ¶
type EpochStart struct {
// contains filtered or unexported fields
}
Used to verify the EpochStart event fields in tests
type EpochStartEvent ¶
type EpochStartEvent flow.Event
func (EpochStartEvent) Counter ¶
func (evt EpochStartEvent) Counter() cadence.UInt64
type EpochTimingConfig ¶
type EpochTimingConfig struct {
// contains filtered or unexported fields
}
EpochTimingConfig is used to verify timing config stored on-chain.
type EpochTotalRewardsPaid ¶
type EpochTotalRewardsPaid struct {
// contains filtered or unexported fields
}
Used to verify the EpochSetup event fields in tests
type EpochTotalRewardsPaidEvent ¶
type EpochTotalRewardsPaidEvent flow.Event
func (EpochTotalRewardsPaidEvent) FeesBurned ¶
func (evt EpochTotalRewardsPaidEvent) FeesBurned() cadence.UFix64
func (EpochTotalRewardsPaidEvent) FromFees ¶
func (evt EpochTotalRewardsPaidEvent) FromFees() cadence.UFix64
func (EpochTotalRewardsPaidEvent) Minted ¶
func (evt EpochTotalRewardsPaidEvent) Minted() cadence.UFix64
func (EpochTotalRewardsPaidEvent) Total ¶
func (evt EpochTotalRewardsPaidEvent) Total() cadence.UFix64
type ResultSubmission ¶
ResultSubmission is a Go structure representation the FlowDKG.ResultSubmission Cadence data structure. It is used to construct and operate on ResultSubmission objects from Cadence, in Go tests.
func GetDKGCanonicalFinalSubmission ¶
func GetDKGCanonicalFinalSubmission(t *testing.T, b emulator.Emulator, env templates.Environment) ResultSubmission
GetDKGCanonicalFinalSubmission executes a script to retrieve the canonical final submission, if any exists.
func GetDKGFinalSubmissions ¶
func GetDKGFinalSubmissions(t *testing.T, b emulator.Emulator, env templates.Environment) []ResultSubmission
GetDKGFinalSubmissions executes a script to retrieve all unique final submissions.
func ResultSubmissionFromCadence ¶
func ResultSubmissionFromCadence(cdc cadence.Value) ResultSubmission
ResultSubmissionFromCadence converts a Cadence-typed ResultSubmission to the Go representation.
func (*ResultSubmission) GroupPubKeyCDC ¶
func (rs *ResultSubmission) GroupPubKeyCDC() cadence.String
GroupPubKeyCDC returns the GroupPubKey field as a cadence String.
func (*ResultSubmission) IDMappingCDC ¶
func (rs *ResultSubmission) IDMappingCDC() cadence.Dictionary
IDMappingCDC returns the IDMapping field as a cadence {String: Int}.
func (*ResultSubmission) PubKeysCDC ¶
func (rs *ResultSubmission) PubKeysCDC() cadence.Array
PubKeysCDC returns the PubKeys field as a cadence [String].
type SharedAccountRegisteredEvent ¶
type SharedAccountRegisteredEvent interface {
}type StakingCollectionInfo ¶
type StakingCollectionInfo struct {
// contains filtered or unexported fields
}
/ Used to verify staking collection info in tests
type StakingInfo ¶
type StakingInfo struct {
// contains filtered or unexported fields
}
Used to verify staking info in tests
type UnlockedAccountRegisteredEvent ¶
type UnlockedAccountRegisteredEvent interface {
Address() flow.Address
}
Unlocked account Registered event