Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateMinFee(bodySize int, minFeeA uint, minFeeB uint) uint64
- func CalculateOptimalPoolCount(_ uint64, k uint64) uint64
- func CalculatePoolSaturation(poolStake uint64, totalActiveStake uint64, saturationPoint uint64) float64
- func ConvertToUtxorpcCardanoCostModels(models map[uint][]int64) *cardano.CostModels
- func RegisterEra(era Era)
- func ToUtxorpcBigInt(v uint64) *utxorpc.BigInt
- func TransactionBodyToUtxorpc(tx TransactionBody) (*utxorpc.Tx, error)
- func ValidatePoolPledge(_ PoolKeyHash, poolParams *PoolRegistrationCertificate, ...) bool
- type AdaPots
- type AddrKeyHash
- type Address
- func NewAddress(addr string) (Address, error)
- func NewAddressFromBytes(addrBytes []byte) (Address, error)
- func NewAddressFromParts(addrType uint8, networkId uint8, paymentAddr []byte, stakingAddr []byte) (Address, error)
- func NewByronAddressFromParts(byronAddrType uint64, paymentAddr []byte, attr ByronAddressAttributes) (Address, error)
- func NewByronAddressRedeem(pubkey []byte, attr ByronAddressAttributes) (Address, error)
- func (a *Address) ByronAttr() ByronAddressAttributes
- func (a Address) ByronType() uint64
- func (a Address) Bytes() ([]byte, error)
- func (a *Address) MarshalCBOR() ([]byte, error)
- func (a Address) MarshalJSON() ([]byte, error)
- func (a Address) NetworkId() uint
- func (a *Address) PayloadPayload() AddressPayload
- func (a Address) PaymentAddress() *Address
- func (a *Address) PaymentKeyHash() Blake2b224
- func (a Address) StakeAddress() *Address
- func (a *Address) StakeKeyHash() Blake2b224
- func (a *Address) StakingPayload() AddressPayload
- func (a Address) String() string
- func (a *Address) ToPlutusData() data.PlutusData
- func (a Address) Type() uint8
- func (a *Address) UnmarshalCBOR(data []byte) error
- type AddressPayload
- type AddressPayloadKeyHash
- type AddressPayloadPointer
- type AddressPayloadScriptHash
- type AssetFingerprint
- type AuthCommitteeHotCertificate
- type Blake2b160
- type Blake2b224
- type Blake2b256
- type Block
- type BlockHeader
- type BootstrapWitness
- type ByronAddressAttributes
- type CertState
- type Certificate
- type CertificateType
- type CertificateWrapper
- type Credential
- type CredentialHash
- type Datum
- type DatumHash
- type DeregistrationCertificate
- type DeregistrationDrepCertificate
- type Drep
- type Era
- type ExUnitPrice
- type ExUnits
- type GenesisHash
- type GenesisKeyDelegationCertificate
- type GenesisRat
- type GovAction
- type GovActionBase
- type GovActionId
- type GovAnchor
- type HardForkInitiationGovAction
- type InfoGovAction
- type IssuerVkey
- type LedgerState
- type LeiosEbCertificate
- func (c *LeiosEbCertificate) GetAggregateEligSig() []byte
- func (c *LeiosEbCertificate) GetAggregateVoteSig() []byte
- func (c *LeiosEbCertificate) SetAggregateEligSig(sig []byte)
- func (c *LeiosEbCertificate) SetAggregateVoteSig(sig []byte)
- func (c *LeiosEbCertificate) Type() uint
- func (c *LeiosEbCertificate) UnmarshalCBOR(cborData []byte) error
- func (c *LeiosEbCertificate) Utxorpc() (*utxorpc.Certificate, error)
- type MetaBytes
- type MetaInt
- type MetaList
- type MetaMap
- type MetaPair
- type MetaText
- type MirSource
- type MoveInstantaneousRewardsCertificate
- type MoveInstantaneousRewardsCertificateReward
- type MultiAsset
- func (m *MultiAsset[T]) Add(assets *MultiAsset[T])
- func (m *MultiAsset[T]) Asset(policyId Blake2b224, assetName []byte) T
- func (m *MultiAsset[T]) Assets(policyId Blake2b224) [][]byte
- func (m *MultiAsset[T]) Compare(assets *MultiAsset[T]) bool
- func (m *MultiAsset[T]) MarshalCBOR() ([]byte, error)
- func (m MultiAsset[T]) MarshalJSON() ([]byte, error)
- func (m *MultiAsset[T]) Policies() []Blake2b224
- func (m *MultiAsset[T]) String() string
- func (m *MultiAsset[T]) ToPlutusData() data.PlutusData
- func (m *MultiAsset[T]) UnmarshalCBOR(data []byte) error
- type MultiAssetTypeMint
- type MultiAssetTypeOutput
- type NativeScript
- type NativeScriptAll
- type NativeScriptAny
- type NativeScriptInvalidBefore
- type NativeScriptInvalidHereafter
- type NativeScriptNofK
- type NativeScriptPubkey
- type NewConstitutionGovAction
- type NoConfidenceGovAction
- type Nonce
- type PlutusV1Script
- type PlutusV2Script
- type PlutusV3Script
- type PoolId
- type PoolKeyHash
- type PoolMetadata
- type PoolMetadataHash
- type PoolRegistrationCertificate
- type PoolRelay
- type PoolRetirementCertificate
- type PoolRetirementInfo
- type PoolRewards
- type PoolState
- type ProposalProcedure
- type ProposalProcedureBase
- type ProtocolParameterUpdate
- type ProtocolParameters
- type ProtocolParametersProtocolVersion
- type RedeemerKey
- type RedeemerTag
- type RedeemerValue
- type RegistrationCertificate
- type RegistrationDrepCertificate
- type ResignCommitteeColdCertificate
- type RewardCalculationResult
- type RewardParameters
- type RewardService
- type RewardSnapshot
- type RewardState
- type Script
- type ScriptHash
- type ScriptRef
- type SlotState
- type StakeDelegationCertificate
- type StakeDeregistrationCertificate
- type StakeRegistrationCertificate
- type StakeRegistrationDelegationCertificate
- type StakeVoteDelegationCertificate
- type StakeVoteRegistrationDelegationCertificate
- type TipState
- type Transaction
- type TransactionBody
- type TransactionBodyBase
- func (b *TransactionBodyBase) AssetMint() *MultiAsset[MultiAssetTypeMint]
- func (b *TransactionBodyBase) AuxDataHash() *Blake2b256
- func (b *TransactionBodyBase) Certificates() []Certificate
- func (b *TransactionBodyBase) Collateral() []TransactionInput
- func (b *TransactionBodyBase) CollateralReturn() TransactionOutput
- func (b *TransactionBodyBase) CurrentTreasuryValue() int64
- func (b *TransactionBodyBase) Donation() uint64
- func (b *TransactionBodyBase) Fee() uint64
- func (b *TransactionBodyBase) Id() Blake2b256
- func (b *TransactionBodyBase) Inputs() []TransactionInput
- func (b *TransactionBodyBase) Outputs() []TransactionOutput
- func (b *TransactionBodyBase) ProposalProcedures() []ProposalProcedure
- func (b *TransactionBodyBase) ReferenceInputs() []TransactionInput
- func (b *TransactionBodyBase) RequiredSigners() []Blake2b224
- func (b *TransactionBodyBase) ScriptDataHash() *Blake2b256
- func (b *TransactionBodyBase) TTL() uint64
- func (b *TransactionBodyBase) TotalCollateral() uint64
- func (b *TransactionBodyBase) Utxorpc() (*utxorpc.Tx, error)
- func (b *TransactionBodyBase) ValidityIntervalStart() uint64
- func (b *TransactionBodyBase) VotingProcedures() VotingProcedures
- func (b *TransactionBodyBase) Withdrawals() map[*Address]uint64
- type TransactionInput
- type TransactionMetadataSet
- type TransactionMetadatum
- type TransactionOutput
- type TransactionWitnessRedeemers
- type TransactionWitnessSet
- type TreasuryWithdrawalGovAction
- type UpdateCommitteeGovAction
- type UpdateDrepCertificate
- type Utxo
- type UtxoState
- type UtxoValidationRuleFunc
- type VkeyWitness
- type Vote
- type VoteDelegationCertificate
- type VoteRegistrationDelegationCertificate
- type Voter
- type VotingProcedure
- type VotingProcedures
- type VrfKeyHash
- type VrfResult
Constants ¶
const ( AddressHeaderTypeMask = 0xF0 AddressHeaderNetworkMask = 0x0F AddressHashSize = 28 AddressNetworkTestnet = 0 AddressNetworkMainnet = 1 AddressTypeKeyKey = 0b0000 AddressTypeScriptKey = 0b0001 AddressTypeKeyScript = 0b0010 AddressTypeScriptScript = 0b0011 AddressTypeKeyPointer = 0b0100 AddressTypeScriptPointer = 0b0101 AddressTypeKeyNone = 0b0110 AddressTypeScriptNone = 0b0111 AddressTypeByron = 0b1000 AddressTypeNoneKey = 0b1110 AddressTypeNoneScript = 0b1111 ByronAddressTypePubkey = 0 ByronAddressTypeScript = 1 ByronAddressTypeRedeem = 2 )
const ( DrepTypeAddrKeyHash = 0 DrepTypeScriptHash = 1 DrepTypeAbstain = 2 DrepTypeNoConfidence = 3 )
const ( PoolRelayTypeSingleHostAddress = 0 PoolRelayTypeSingleHostName = 1 PoolRelayTypeMultiHostName = 2 )
const ( Blake2b256Size = 32 Blake2b224Size = 28 Blake2b160Size = 20 )
const ( CredentialTypeAddrKeyHash = 0 CredentialTypeScriptHash = 1 )
const ( VoterTypeConstitutionalCommitteeHotKeyHash uint8 = 0 VoterTypeConstitutionalCommitteeHotScriptHash uint8 = 1 VoterTypeDRepKeyHash uint8 = 2 VoterTypeDRepScriptHash uint8 = 3 VoterTypeStakingPoolKeyHash uint8 = 4 )
const ( GovVoteNo uint8 = 0 GovVoteYes uint8 = 1 GovVoteAbstain uint8 = 2 )
const ( GovActionTypeParameterChange = 0 GovActionTypeHardForkInitiation = 1 GovActionTypeTreasuryWithdrawal = 2 GovActionTypeNoConfidence = 3 GovActionTypeUpdateCommittee = 4 GovActionTypeNewConstitution = 5 GovActionTypeInfo = 6 )
const ( NonceTypeNeutral = 0 NonceTypeNonce = 1 )
const ( ScriptRefTypeNativeScript = 0 ScriptRefTypePlutusV1 = 1 ScriptRefTypePlutusV2 = 2 ScriptRefTypePlutusV3 = 3 )
Variables ¶
var EraInvalid = Era{
Id: 0,
Name: "invalid",
}
Functions ¶
func CalculateMinFee ¶ added in v0.142.0
CalculateMinFee computes the minimum fee for a transaction body given its CBOR-encoded size and the protocol parameters MinFeeA and MinFeeB
func CalculateOptimalPoolCount ¶ added in v0.141.0
CalculateOptimalPoolCount calculates the optimal number of stake pools totalActiveStake is unused as current implementation is simplified and only uses k parameter. TODO: implement real optimal pool count formula when requirements are finalized.
func CalculatePoolSaturation ¶ added in v0.141.0
func CalculatePoolSaturation( poolStake uint64, totalActiveStake uint64, saturationPoint uint64, ) float64
CalculatePoolSaturation calculates the saturation level of a pool Returns 1.0 (fully saturated) when saturationPointStake == 0 to handle edge cases like very small totalActiveStake or misconfigured saturationPoint parameters.
func ConvertToUtxorpcCardanoCostModels ¶ added in v0.102.0
func ConvertToUtxorpcCardanoCostModels( models map[uint][]int64, ) *cardano.CostModels
ConvertToUtxorpcCardanoCostModels converts a map of cost models for Plutus scripts into cardano.CostModels Only PlutusV(keys 1, 2, and 3) are supported.
func RegisterEra ¶
func RegisterEra(era Era)
func ToUtxorpcBigInt ¶ added in v0.139.0
ToUtxorpcBigInt converts a uint64 into a *utxorpc.BigInt pointer
func TransactionBodyToUtxorpc ¶ added in v0.117.0
func TransactionBodyToUtxorpc(tx TransactionBody) (*utxorpc.Tx, error)
TransactionBodyToUtxorpc is a common helper for converting TransactionBody to utxorpc.Tx
func ValidatePoolPledge ¶ added in v0.141.0
func ValidatePoolPledge( _ PoolKeyHash, poolParams *PoolRegistrationCertificate, ownerStake map[AddrKeyHash]uint64, ) bool
ValidatePoolPledge validates that a pool meets its pledge requirement poolID is unused as validation only depends on pool parameters and owner stake amounts
Types ¶
type AdaPots ¶ added in v0.141.0
type AdaPots struct {
Reserves uint64 // The reserves pot
Treasury uint64 // The treasury pot
Rewards uint64 // The rewards pot
}
AdaPots represents the three main ADA pots in Cardano
func CalculateAdaPots ¶ added in v0.141.0
func CalculateAdaPots( currentPots AdaPots, params RewardParameters, epochFees uint64, totalBlocksInEpoch uint32, ) AdaPots
CalculateAdaPots calculates the ADA pots for the next epoch
type AddrKeyHash ¶
type AddrKeyHash = Blake2b224
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func NewAddress ¶
NewAddress returns an Address based on the provided bech32/base58 address string It detects if the string has mixed case assumes it is a base58 encoded address otherwise, it assumes it is bech32 encoded
func NewAddressFromBytes ¶ added in v0.125.0
NewAddressFromBytes returns an Address based on the raw bytes provided
func NewAddressFromParts ¶
func NewAddressFromParts( addrType uint8, networkId uint8, paymentAddr []byte, stakingAddr []byte, ) (Address, error)
NewAddressFromParts returns an Address based on the individual parts of the address that are provided
func NewByronAddressFromParts ¶ added in v0.107.0
func NewByronAddressFromParts( byronAddrType uint64, paymentAddr []byte, attr ByronAddressAttributes, ) (Address, error)
func NewByronAddressRedeem ¶ added in v0.107.0
func NewByronAddressRedeem( pubkey []byte, attr ByronAddressAttributes, ) (Address, error)
func (*Address) ByronAttr ¶ added in v0.109.0
func (a *Address) ByronAttr() ByronAddressAttributes
func (*Address) MarshalCBOR ¶
func (Address) MarshalJSON ¶
func (*Address) PayloadPayload ¶ added in v0.134.0
func (a *Address) PayloadPayload() AddressPayload
PaymentPayload returns the payment payload
func (Address) PaymentAddress ¶
PaymentAddress returns a new Address with only the payment address portion. This will return nil for anything other than payment and script addresses
func (*Address) PaymentKeyHash ¶
func (a *Address) PaymentKeyHash() Blake2b224
PaymentKeyHash returns a new Blake2b224 hash of the payment key
func (Address) StakeAddress ¶
StakeAddress returns a new Address with only the stake key portion. This will return nil if the address is not a payment/staking key pair
func (*Address) StakeKeyHash ¶
func (a *Address) StakeKeyHash() Blake2b224
StakeKeyHash returns a new Blake2b224 hash of the stake key
func (*Address) StakingPayload ¶ added in v0.134.0
func (a *Address) StakingPayload() AddressPayload
StakingPayload returns the staking payload
func (*Address) ToPlutusData ¶ added in v0.129.0
func (a *Address) ToPlutusData() data.PlutusData
func (*Address) UnmarshalCBOR ¶
type AddressPayload ¶ added in v0.134.0
type AddressPayload interface {
// contains filtered or unexported methods
}
type AddressPayloadKeyHash ¶ added in v0.134.0
type AddressPayloadKeyHash struct {
Hash AddrKeyHash
}
type AddressPayloadPointer ¶ added in v0.134.0
type AddressPayloadScriptHash ¶ added in v0.134.0
type AddressPayloadScriptHash struct {
Hash ScriptHash
}
type AssetFingerprint ¶
type AssetFingerprint struct {
// contains filtered or unexported fields
}
func NewAssetFingerprint ¶
func NewAssetFingerprint(policyId []byte, assetName []byte) AssetFingerprint
func (AssetFingerprint) Hash ¶
func (a AssetFingerprint) Hash() Blake2b160
func (AssetFingerprint) String ¶
func (a AssetFingerprint) String() string
type AuthCommitteeHotCertificate ¶
type AuthCommitteeHotCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
ColdCredential Credential
HotCredential Credential
}
func (*AuthCommitteeHotCertificate) Type ¶ added in v0.116.0
func (c *AuthCommitteeHotCertificate) Type() uint
func (*AuthCommitteeHotCertificate) UnmarshalCBOR ¶
func (c *AuthCommitteeHotCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*AuthCommitteeHotCertificate) Utxorpc ¶
func (c *AuthCommitteeHotCertificate) Utxorpc() (*utxorpc.Certificate, error)
type Blake2b160 ¶
type Blake2b160 [Blake2b160Size]byte
func Blake2b160Hash ¶
func Blake2b160Hash(data []byte) Blake2b160
Blake2b160Hash generates a Blake2b-160 hash from the provided data
func NewBlake2b160 ¶
func NewBlake2b160(data []byte) Blake2b160
func (Blake2b160) Bytes ¶
func (b Blake2b160) Bytes() []byte
func (Blake2b160) MarshalCBOR ¶ added in v0.139.0
func (b Blake2b160) MarshalCBOR() ([]byte, error)
func (Blake2b160) MarshalJSON ¶ added in v0.139.0
func (b Blake2b160) MarshalJSON() ([]byte, error)
func (Blake2b160) String ¶
func (b Blake2b160) String() string
func (Blake2b160) ToPlutusData ¶ added in v0.129.0
func (b Blake2b160) ToPlutusData() data.PlutusData
type Blake2b224 ¶
type Blake2b224 [Blake2b224Size]byte
func Blake2b224Hash ¶
func Blake2b224Hash(data []byte) Blake2b224
Blake2b224Hash generates a Blake2b-224 hash from the provided data
func NewBlake2b224 ¶
func NewBlake2b224(data []byte) Blake2b224
func (Blake2b224) Bech32 ¶ added in v0.141.0
func (b Blake2b224) Bech32(prefix string) string
func (Blake2b224) Bytes ¶
func (b Blake2b224) Bytes() []byte
func (Blake2b224) MarshalCBOR ¶ added in v0.139.0
func (b Blake2b224) MarshalCBOR() ([]byte, error)
func (Blake2b224) MarshalJSON ¶ added in v0.100.0
func (b Blake2b224) MarshalJSON() ([]byte, error)
func (Blake2b224) String ¶
func (b Blake2b224) String() string
func (Blake2b224) ToPlutusData ¶ added in v0.129.0
func (b Blake2b224) ToPlutusData() data.PlutusData
type Blake2b256 ¶
type Blake2b256 [Blake2b256Size]byte
func Blake2b256Hash ¶
func Blake2b256Hash(data []byte) Blake2b256
Blake2b256Hash generates a Blake2b-256 hash from the provided data
func CalculateEpochNonce ¶ added in v0.108.0
func CalculateEpochNonce( stableBlockNonce []byte, prevEpochFirstBlockHash []byte, extraEntropy []byte, ) (Blake2b256, error)
CalculateEpochNonce calculates an epoch nonce from the rolling nonce (eta_v) value of the block immediately before the stability window and the block hash of the first block from the previous epoch.
func CalculateRollingNonce ¶ added in v0.108.0
func CalculateRollingNonce( prevBlockNonce []byte, blockVrf []byte, ) (Blake2b256, error)
CalculateRollingNonce calculates a rolling nonce (eta_v) value from the previous block's eta_v value and the current block's VRF result
func NewBlake2b256 ¶
func NewBlake2b256(data []byte) Blake2b256
func (Blake2b256) Bytes ¶
func (b Blake2b256) Bytes() []byte
func (Blake2b256) MarshalCBOR ¶ added in v0.139.0
func (b Blake2b256) MarshalCBOR() ([]byte, error)
func (Blake2b256) MarshalJSON ¶ added in v0.139.0
func (b Blake2b256) MarshalJSON() ([]byte, error)
func (Blake2b256) String ¶
func (b Blake2b256) String() string
func (Blake2b256) ToPlutusData ¶ added in v0.129.0
func (b Blake2b256) ToPlutusData() data.PlutusData
type Block ¶ added in v0.105.0
type Block interface {
BlockHeader
Header() BlockHeader
Type() int
Transactions() []Transaction
Utxorpc() (*utxorpc.Block, error)
}
type BlockHeader ¶ added in v0.105.0
type BlockHeader interface {
Hash() Blake2b256
PrevHash() Blake2b256
BlockNumber() uint64
SlotNumber() uint64
IssuerVkey() IssuerVkey
BlockBodySize() uint64
Era() Era
Cbor() []byte
BlockBodyHash() Blake2b256
}
type BootstrapWitness ¶ added in v0.110.0
type ByronAddressAttributes ¶ added in v0.107.0
func (*ByronAddressAttributes) MarshalCBOR ¶ added in v0.107.0
func (a *ByronAddressAttributes) MarshalCBOR() ([]byte, error)
func (*ByronAddressAttributes) UnmarshalCBOR ¶ added in v0.107.0
func (a *ByronAddressAttributes) UnmarshalCBOR(data []byte) error
type CertState ¶ added in v0.109.0
type CertState interface {
StakeRegistration([]byte) ([]StakeRegistrationCertificate, error)
}
CertState defines the interface for querying the certificate state
type Certificate ¶
type Certificate interface {
Cbor() []byte
Utxorpc() (*utxorpc.Certificate, error)
Type() uint
// contains filtered or unexported methods
}
type CertificateType ¶ added in v0.140.0
type CertificateType uint
const ( CertificateTypeStakeRegistration CertificateType = 0 CertificateTypeStakeDeregistration CertificateType = 1 CertificateTypeStakeDelegation CertificateType = 2 CertificateTypePoolRegistration CertificateType = 3 CertificateTypePoolRetirement CertificateType = 4 CertificateTypeGenesisKeyDelegation CertificateType = 5 CertificateTypeMoveInstantaneousRewards CertificateType = 6 CertificateTypeRegistration CertificateType = 7 CertificateTypeDeregistration CertificateType = 8 CertificateTypeVoteDelegation CertificateType = 9 CertificateTypeStakeVoteDelegation CertificateType = 10 CertificateTypeStakeRegistrationDelegation CertificateType = 11 CertificateTypeVoteRegistrationDelegation CertificateType = 12 CertificateTypeStakeVoteRegistrationDelegation CertificateType = 13 CertificateTypeAuthCommitteeHot CertificateType = 14 CertificateTypeResignCommitteeCold CertificateType = 15 CertificateTypeRegistrationDrep CertificateType = 16 CertificateTypeDeregistrationDrep CertificateType = 17 CertificateTypeUpdateDrep CertificateType = 18 CertificateTypeLeiosEb CertificateType = 19 )
type CertificateWrapper ¶
type CertificateWrapper struct {
Type uint
Certificate Certificate
}
func (*CertificateWrapper) MarshalCBOR ¶
func (c *CertificateWrapper) MarshalCBOR() ([]byte, error)
func (*CertificateWrapper) UnmarshalCBOR ¶
func (c *CertificateWrapper) UnmarshalCBOR(data []byte) error
type Credential ¶ added in v0.115.0
type Credential struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CredType uint
Credential CredentialHash
}
func (*Credential) Hash ¶ added in v0.115.0
func (c *Credential) Hash() Blake2b224
func (*Credential) ToPlutusData ¶ added in v0.129.0
func (c *Credential) ToPlutusData() data.PlutusData
func (*Credential) UnmarshalCBOR ¶ added in v0.115.0
func (c *Credential) UnmarshalCBOR(cborData []byte) error
func (*Credential) Utxorpc ¶ added in v0.115.0
func (c *Credential) Utxorpc() (*utxorpc.StakeCredential, error)
type CredentialHash ¶ added in v0.115.0
type CredentialHash = Blake2b224
type Datum ¶ added in v0.132.0
type Datum struct {
cbor.DecodeStoreCbor
Data data.PlutusData `json:"data"`
}
Datum represents a Plutus datum
func (*Datum) MarshalCBOR ¶ added in v0.132.0
func (*Datum) UnmarshalCBOR ¶ added in v0.132.0
type DatumHash ¶ added in v0.132.0
type DatumHash = Blake2b256
type DeregistrationCertificate ¶
type DeregistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
Amount int64
}
func (*DeregistrationCertificate) Type ¶ added in v0.116.0
func (c *DeregistrationCertificate) Type() uint
func (*DeregistrationCertificate) UnmarshalCBOR ¶
func (c *DeregistrationCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*DeregistrationCertificate) Utxorpc ¶
func (c *DeregistrationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type DeregistrationDrepCertificate ¶
type DeregistrationDrepCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
DrepCredential Credential
Amount int64
}
func (*DeregistrationDrepCertificate) Type ¶ added in v0.116.0
func (c *DeregistrationDrepCertificate) Type() uint
func (*DeregistrationDrepCertificate) UnmarshalCBOR ¶
func (c *DeregistrationDrepCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*DeregistrationDrepCertificate) Utxorpc ¶
func (c *DeregistrationDrepCertificate) Utxorpc() (*utxorpc.Certificate, error)
type Drep ¶
func (*Drep) ToPlutusData ¶ added in v0.134.0
func (d *Drep) ToPlutusData() data.PlutusData
func (*Drep) UnmarshalCBOR ¶
type ExUnitPrice ¶ added in v0.99.0
type ExUnits ¶ added in v0.111.0
type ExUnits struct {
cbor.StructAsArray
Memory int64
Steps int64
}
ExUnits represents the steps and memory usage for script execution
type GenesisHash ¶ added in v0.137.1
type GenesisHash = Blake2b224
GenesisHash is a type alias for the Blake2b-224 hash used for genesis keys
type GenesisKeyDelegationCertificate ¶
type GenesisKeyDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
GenesisHash []byte
GenesisDelegateHash []byte
VrfKeyHash VrfKeyHash
}
func (*GenesisKeyDelegationCertificate) Type ¶ added in v0.116.0
func (c *GenesisKeyDelegationCertificate) Type() uint
func (*GenesisKeyDelegationCertificate) UnmarshalCBOR ¶
func (c *GenesisKeyDelegationCertificate) UnmarshalCBOR(cborData []byte) error
func (*GenesisKeyDelegationCertificate) Utxorpc ¶
func (c *GenesisKeyDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type GenesisRat ¶ added in v0.99.0
GenesisRat is a convenience type for cbor.Rat
type GovAction ¶
type GovAction interface {
ToPlutusData() data.PlutusData
// contains filtered or unexported methods
}
type GovActionBase ¶ added in v0.134.0
type GovActionBase struct{}
type GovActionId ¶
type GovActionId struct {
cbor.StructAsArray
TransactionId [32]byte
GovActionIdx uint32
}
func (*GovActionId) ToPlutusData ¶ added in v0.130.0
func (id *GovActionId) ToPlutusData() data.PlutusData
type GovAnchor ¶
type GovAnchor struct {
cbor.StructAsArray
Url string
DataHash [32]byte
}
func (*GovAnchor) ToPlutusData ¶ added in v0.130.0
func (a *GovAnchor) ToPlutusData() data.PlutusData
type HardForkInitiationGovAction ¶
type HardForkInitiationGovAction struct {
cbor.StructAsArray
Type uint
ActionId *GovActionId
ProtocolVersion struct {
cbor.StructAsArray
Major uint
Minor uint
}
}
func (*HardForkInitiationGovAction) ToPlutusData ¶ added in v0.130.0
func (a *HardForkInitiationGovAction) ToPlutusData() data.PlutusData
type InfoGovAction ¶
type InfoGovAction struct {
cbor.StructAsArray
Type uint
}
func (*InfoGovAction) ToPlutusData ¶ added in v0.130.0
func (a *InfoGovAction) ToPlutusData() data.PlutusData
type IssuerVkey ¶
type IssuerVkey [32]byte
IssuerVkey represents the verification key for the stake pool that minted a block
func (IssuerVkey) Hash ¶
func (i IssuerVkey) Hash() Blake2b224
func (IssuerVkey) PoolId ¶
func (i IssuerVkey) PoolId() string
type LedgerState ¶ added in v0.109.0
LedgerState defines the interface for querying the ledger
type LeiosEbCertificate ¶ added in v0.136.0
type LeiosEbCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
ElectionId Blake2b256
EndorserBlockHash Blake2b256
PersistentVoters []uint
NonpersistentVoters map[Blake2b256][]byte
AggregateEligSig *[]byte
AggregateVoteSig []byte
}
func (*LeiosEbCertificate) GetAggregateEligSig ¶ added in v0.140.0
func (c *LeiosEbCertificate) GetAggregateEligSig() []byte
GetAggregateEligSig returns the aggregate eligibility signature as a byte slice
func (*LeiosEbCertificate) GetAggregateVoteSig ¶ added in v0.140.0
func (c *LeiosEbCertificate) GetAggregateVoteSig() []byte
GetAggregateVoteSig returns the aggregate vote signature as a byte slice
func (*LeiosEbCertificate) SetAggregateEligSig ¶ added in v0.140.0
func (c *LeiosEbCertificate) SetAggregateEligSig(sig []byte)
SetAggregateEligSig sets the aggregate eligibility signature from a byte slice
func (*LeiosEbCertificate) SetAggregateVoteSig ¶ added in v0.140.0
func (c *LeiosEbCertificate) SetAggregateVoteSig(sig []byte)
SetAggregateVoteSig sets the aggregate vote signature from a byte slice
func (*LeiosEbCertificate) Type ¶ added in v0.136.0
func (c *LeiosEbCertificate) Type() uint
func (*LeiosEbCertificate) UnmarshalCBOR ¶ added in v0.136.0
func (c *LeiosEbCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*LeiosEbCertificate) Utxorpc ¶ added in v0.136.0
func (c *LeiosEbCertificate) Utxorpc() (*utxorpc.Certificate, error)
type MetaList ¶ added in v0.141.0
type MetaList struct {
Items []TransactionMetadatum
}
type MetaPair ¶ added in v0.141.0
type MetaPair struct {
Key TransactionMetadatum
Value TransactionMetadatum
}
type MoveInstantaneousRewardsCertificate ¶
type MoveInstantaneousRewardsCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
Reward MoveInstantaneousRewardsCertificateReward
}
func (*MoveInstantaneousRewardsCertificate) Type ¶ added in v0.116.0
func (c *MoveInstantaneousRewardsCertificate) Type() uint
func (*MoveInstantaneousRewardsCertificate) UnmarshalCBOR ¶
func (c *MoveInstantaneousRewardsCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*MoveInstantaneousRewardsCertificate) Utxorpc ¶
func (c *MoveInstantaneousRewardsCertificate) Utxorpc() (*utxorpc.Certificate, error)
type MoveInstantaneousRewardsCertificateReward ¶
type MoveInstantaneousRewardsCertificateReward struct {
Source uint
Rewards map[*Credential]uint64
OtherPot uint64
}
func (*MoveInstantaneousRewardsCertificateReward) UnmarshalCBOR ¶
func (r *MoveInstantaneousRewardsCertificateReward) UnmarshalCBOR( data []byte, ) error
type MultiAsset ¶
type MultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint] struct { // contains filtered or unexported fields }
MultiAsset represents a collection of policies, assets, and quantities. It's used for TX outputs (uint64) and TX asset minting (int64 to allow for negative values for burning)
func NewMultiAsset ¶
func NewMultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint]( data map[Blake2b224]map[cbor.ByteString]T, ) MultiAsset[T]
NewMultiAsset creates a MultiAsset with the specified data
func (*MultiAsset[T]) Add ¶ added in v0.113.0
func (m *MultiAsset[T]) Add(assets *MultiAsset[T])
func (*MultiAsset[T]) Asset ¶
func (m *MultiAsset[T]) Asset(policyId Blake2b224, assetName []byte) T
func (*MultiAsset[T]) Assets ¶
func (m *MultiAsset[T]) Assets(policyId Blake2b224) [][]byte
func (*MultiAsset[T]) Compare ¶ added in v0.113.0
func (m *MultiAsset[T]) Compare(assets *MultiAsset[T]) bool
func (*MultiAsset[T]) MarshalCBOR ¶
func (m *MultiAsset[T]) MarshalCBOR() ([]byte, error)
func (MultiAsset[T]) MarshalJSON ¶
func (m MultiAsset[T]) MarshalJSON() ([]byte, error)
func (*MultiAsset[T]) Policies ¶
func (m *MultiAsset[T]) Policies() []Blake2b224
func (*MultiAsset[T]) String ¶ added in v0.135.0
func (m *MultiAsset[T]) String() string
String returns a stable, human-friendly representation of the MultiAsset. Output format: [<policyId>.<assetNameHex>=<amount>, ...] sorted by policyId, then asset name
func (*MultiAsset[T]) ToPlutusData ¶ added in v0.130.0
func (m *MultiAsset[T]) ToPlutusData() data.PlutusData
func (*MultiAsset[T]) UnmarshalCBOR ¶
func (m *MultiAsset[T]) UnmarshalCBOR(data []byte) error
type MultiAssetTypeMint ¶
type MultiAssetTypeMint = int64
type MultiAssetTypeOutput ¶
type MultiAssetTypeOutput = uint64
type NativeScript ¶ added in v0.110.0
type NativeScript struct {
cbor.DecodeStoreCbor
// contains filtered or unexported fields
}
func (NativeScript) Hash ¶ added in v0.132.0
func (s NativeScript) Hash() ScriptHash
func (*NativeScript) Item ¶ added in v0.110.0
func (n *NativeScript) Item() any
func (NativeScript) MarshalCBOR ¶ added in v0.142.0
func (n NativeScript) MarshalCBOR() ([]byte, error)
func (NativeScript) RawScriptBytes ¶ added in v0.137.0
func (s NativeScript) RawScriptBytes() []byte
func (*NativeScript) UnmarshalCBOR ¶ added in v0.110.0
func (n *NativeScript) UnmarshalCBOR(data []byte) error
type NativeScriptAll ¶ added in v0.110.0
type NativeScriptAll struct {
cbor.StructAsArray
Type uint
Scripts []NativeScript
}
type NativeScriptAny ¶ added in v0.110.0
type NativeScriptAny struct {
cbor.StructAsArray
Type uint
Scripts []NativeScript
}
type NativeScriptInvalidBefore ¶ added in v0.110.0
type NativeScriptInvalidBefore struct {
cbor.StructAsArray
Type uint
Slot uint64
}
type NativeScriptInvalidHereafter ¶ added in v0.110.0
type NativeScriptInvalidHereafter struct {
cbor.StructAsArray
Type uint
Slot uint64
}
type NativeScriptNofK ¶ added in v0.110.0
type NativeScriptNofK struct {
cbor.StructAsArray
Type uint
N uint
Scripts []NativeScript
}
type NativeScriptPubkey ¶ added in v0.110.0
type NativeScriptPubkey struct {
cbor.StructAsArray
Type uint
Hash []byte
}
type NewConstitutionGovAction ¶
type NewConstitutionGovAction struct {
cbor.StructAsArray
Type uint
ActionId *GovActionId
Constitution struct {
cbor.StructAsArray
Anchor GovAnchor
ScriptHash []byte
}
}
func (*NewConstitutionGovAction) ToPlutusData ¶ added in v0.130.0
func (a *NewConstitutionGovAction) ToPlutusData() data.PlutusData
type NoConfidenceGovAction ¶
type NoConfidenceGovAction struct {
cbor.StructAsArray
Type uint
ActionId *GovActionId
}
func (*NoConfidenceGovAction) ToPlutusData ¶ added in v0.130.0
func (a *NoConfidenceGovAction) ToPlutusData() data.PlutusData
type Nonce ¶ added in v0.99.0
type Nonce struct {
cbor.StructAsArray
Type uint
Value [32]byte
}
func (*Nonce) MarshalCBOR ¶ added in v0.108.0
func (*Nonce) UnmarshalCBOR ¶ added in v0.99.0
func (*Nonce) UnmarshalJSON ¶ added in v0.108.0
type PlutusV1Script ¶ added in v0.127.0
type PlutusV1Script []byte
func (PlutusV1Script) Hash ¶ added in v0.132.0
func (s PlutusV1Script) Hash() ScriptHash
func (PlutusV1Script) RawScriptBytes ¶ added in v0.137.0
func (s PlutusV1Script) RawScriptBytes() []byte
type PlutusV2Script ¶ added in v0.127.0
type PlutusV2Script []byte
func (PlutusV2Script) Hash ¶ added in v0.132.0
func (s PlutusV2Script) Hash() ScriptHash
func (PlutusV2Script) RawScriptBytes ¶ added in v0.137.0
func (s PlutusV2Script) RawScriptBytes() []byte
type PlutusV3Script ¶ added in v0.127.0
type PlutusV3Script []byte
func (PlutusV3Script) Evaluate ¶ added in v0.133.0
func (s PlutusV3Script) Evaluate( scriptContext data.PlutusData, budget ExUnits, ) (ExUnits, error)
func (PlutusV3Script) Hash ¶ added in v0.132.0
func (s PlutusV3Script) Hash() ScriptHash
func (PlutusV3Script) RawScriptBytes ¶ added in v0.137.0
func (s PlutusV3Script) RawScriptBytes() []byte
type PoolKeyHash ¶
type PoolKeyHash = Blake2b224
type PoolMetadata ¶
type PoolMetadata struct {
cbor.StructAsArray
Url string
Hash PoolMetadataHash
}
func (*PoolMetadata) Utxorpc ¶
func (p *PoolMetadata) Utxorpc() (*utxorpc.PoolMetadata, error)
type PoolMetadataHash ¶
type PoolMetadataHash = Blake2b256
type PoolRegistrationCertificate ¶
type PoolRegistrationCertificate struct {
cbor.StructAsArray ` json:"-"`
cbor.DecodeStoreCbor ` json:"-"`
CertType uint `json:"certType,omitempty"`
Operator PoolKeyHash `json:"operator"`
VrfKeyHash VrfKeyHash `json:"vrfKeyHash"`
Pledge uint64 `json:"pledge"`
Cost uint64 `json:"cost"`
Margin GenesisRat `json:"margin"`
RewardAccount AddrKeyHash `json:"rewardAccount"`
PoolOwners []AddrKeyHash `json:"poolOwners"`
Relays []PoolRelay `json:"relays"`
PoolMetadata *PoolMetadata `json:"poolMetadata,omitempty"`
}
func (*PoolRegistrationCertificate) Type ¶ added in v0.116.0
func (c *PoolRegistrationCertificate) Type() uint
func (*PoolRegistrationCertificate) UnmarshalCBOR ¶
func (c *PoolRegistrationCertificate) UnmarshalCBOR(cborData []byte) error
func (*PoolRegistrationCertificate) UnmarshalJSON ¶ added in v0.131.0
func (p *PoolRegistrationCertificate) UnmarshalJSON(data []byte) error
func (*PoolRegistrationCertificate) Utxorpc ¶
func (c *PoolRegistrationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type PoolRelay ¶
type PoolRelay struct {
Type int `json:"type"`
Port *uint32 `json:"port,omitempty"`
Ipv4 *net.IP `json:"ipv4,omitempty"`
Ipv6 *net.IP `json:"ipv6,omitempty"`
Hostname *string `json:"hostname,omitempty"`
}
func (*PoolRelay) UnmarshalCBOR ¶
type PoolRetirementCertificate ¶
type PoolRetirementCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
PoolKeyHash PoolKeyHash
Epoch uint64
}
func (*PoolRetirementCertificate) Type ¶ added in v0.116.0
func (c *PoolRetirementCertificate) Type() uint
func (*PoolRetirementCertificate) UnmarshalCBOR ¶
func (c *PoolRetirementCertificate) UnmarshalCBOR(cborData []byte) error
func (*PoolRetirementCertificate) Utxorpc ¶
func (c *PoolRetirementCertificate) Utxorpc() (*utxorpc.Certificate, error)
type PoolRetirementInfo ¶ added in v0.141.0
type PoolRetirementInfo struct {
RewardAddress AddrKeyHash // Pool reward address
Epoch uint64 // Epoch when retirement was announced
}
PoolRetirementInfo contains information about retired pools
type PoolRewards ¶ added in v0.141.0
type PoolRewards struct {
// Pool operator rewards
OperatorRewards uint64
// Delegator rewards by stake key hash
DelegatorRewards map[AddrKeyHash]uint64
// Total rewards for this pool
TotalRewards uint64
}
PoolRewards contains rewards for a specific pool
type PoolState ¶ added in v0.134.0
type PoolState interface {
// PoolCurrentState returns the latest active registration certificate for the given pool key hash.
// It also returns the epoch of a pending retirement certificate, if one exists.
// If the pool is not registered, the registration certificate will be nil.
PoolCurrentState(PoolKeyHash) (*PoolRegistrationCertificate, *uint64, error)
}
PoolState defines the interface for querying the current pool state
type ProposalProcedure ¶
type ProposalProcedureBase ¶ added in v0.134.0
type ProposalProcedureBase struct{}
type ProtocolParameterUpdate ¶ added in v0.95.0
type ProtocolParameterUpdate interface {
IsProtocolParameterUpdate()
Cbor() []byte
}
type ProtocolParameters ¶ added in v0.103.2
type ProtocolParametersProtocolVersion ¶ added in v0.99.0
type ProtocolParametersProtocolVersion struct {
cbor.StructAsArray
Major uint
Minor uint
}
type RedeemerKey ¶ added in v0.130.1
type RedeemerKey struct {
cbor.StructAsArray
Tag RedeemerTag
Index uint32
}
type RedeemerTag ¶ added in v0.110.0
type RedeemerTag uint8
const ( RedeemerTagSpend RedeemerTag = 0 RedeemerTagMint RedeemerTag = 1 RedeemerTagCert RedeemerTag = 2 RedeemerTagReward RedeemerTag = 3 RedeemerTagVoting RedeemerTag = 4 RedeemerTagProposing RedeemerTag = 5 )
type RedeemerValue ¶ added in v0.130.1
type RedeemerValue struct {
cbor.StructAsArray
Data Datum
ExUnits ExUnits
}
type RegistrationCertificate ¶
type RegistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
Amount int64
}
func (*RegistrationCertificate) Type ¶ added in v0.116.0
func (c *RegistrationCertificate) Type() uint
func (*RegistrationCertificate) UnmarshalCBOR ¶
func (c *RegistrationCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*RegistrationCertificate) Utxorpc ¶
func (c *RegistrationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type RegistrationDrepCertificate ¶
type RegistrationDrepCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
DrepCredential Credential
Amount int64
Anchor *GovAnchor
}
func (*RegistrationDrepCertificate) Type ¶ added in v0.116.0
func (c *RegistrationDrepCertificate) Type() uint
func (*RegistrationDrepCertificate) UnmarshalCBOR ¶
func (c *RegistrationDrepCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*RegistrationDrepCertificate) Utxorpc ¶
func (c *RegistrationDrepCertificate) Utxorpc() (*utxorpc.Certificate, error)
type ResignCommitteeColdCertificate ¶
type ResignCommitteeColdCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
ColdCredential Credential
Anchor *GovAnchor
}
func (*ResignCommitteeColdCertificate) Type ¶ added in v0.116.0
func (c *ResignCommitteeColdCertificate) Type() uint
func (*ResignCommitteeColdCertificate) UnmarshalCBOR ¶
func (c *ResignCommitteeColdCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*ResignCommitteeColdCertificate) Utxorpc ¶
func (c *ResignCommitteeColdCertificate) Utxorpc() (*utxorpc.Certificate, error)
type RewardCalculationResult ¶ added in v0.141.0
type RewardCalculationResult struct {
// Total rewards to be distributed
TotalRewards uint64
// Rewards per pool (operator + delegators)
PoolRewards map[PoolKeyHash]PoolRewards
// Updated ADA pots after reward distribution
UpdatedPots AdaPots
}
RewardCalculationResult contains the calculated rewards
func CalculateRewards ¶ added in v0.141.0
func CalculateRewards( pots AdaPots, snapshot RewardSnapshot, params RewardParameters, ) (*RewardCalculationResult, error)
CalculateRewards calculates stake pool and delegator rewards
type RewardParameters ¶ added in v0.141.0
type RewardParameters struct {
// Monetary expansion parameters
MonetaryExpansion uint64 // rho - monetary expansion rate (0.003 means 0.3%)
TreasuryGrowth uint64 // tau - treasury growth rate (0.2 means 20%)
// Decentralization parameter (0 = fully decentralized, 1 = fully centralized)
Decentralization uint64
// Protocol version for reward calculation rules
ProtocolVersion ProtocolParametersProtocolVersion
// Minimum pool cost
MinPoolCost uint64
// Pool influence parameter (a0)
PoolInfluence *big.Rat
// Expansion rate (rho)
ExpansionRate *big.Rat
// Treasury expansion rate (tau)
TreasuryRate *big.Rat
// Active slots coefficient (f) - from CIP-9
ActiveSlotsCoeff *big.Rat
// Expected slots per epoch - from network configuration
ExpectedSlotsPerEpoch uint32
}
RewardParameters contains the protocol parameters needed for reward calculation
type RewardService ¶ added in v0.141.0
type RewardService struct {
// contains filtered or unexported fields
}
RewardService provides reward calculation services for the ledger
func NewRewardService ¶ added in v0.141.0
func NewRewardService(ledgerState LedgerState) *RewardService
NewRewardService creates a new reward service
func (*RewardService) CalculateEpochRewards ¶ added in v0.141.0
func (rs *RewardService) CalculateEpochRewards( epoch uint64, ) (*RewardCalculationResult, error)
CalculateEpochRewards calculates rewards for the given epoch
func (*RewardService) ValidateRewardDistribution ¶ added in v0.141.0
func (rs *RewardService) ValidateRewardDistribution( expectedRewards *RewardCalculationResult, actualRewards map[AddrKeyHash]uint64, ) error
ValidateRewardDistribution validates that a reward distribution transaction is correct
type RewardSnapshot ¶ added in v0.141.0
type RewardSnapshot struct {
// Total active stake in the system
TotalActiveStake uint64
// Stake distribution by pool
PoolStake map[PoolKeyHash]uint64
// Delegator stake by pool
DelegatorStake map[PoolKeyHash]map[AddrKeyHash]uint64
// Pool parameters
PoolParams map[PoolKeyHash]*PoolRegistrationCertificate
// Stake registrations for reward eligibility
StakeRegistrations map[AddrKeyHash]bool
// Block production data for pool performance calculation
PoolBlocks map[PoolKeyHash]uint32 // Blocks produced by each pool
TotalBlocksInEpoch uint32 // Total blocks produced in epoch by stake pools
// Deregistration timing (slot when deregistration occurred)
// Accounts deregistered before reward calculation start (slot 172800)
// don't receive rewards (rewards go to reserves)
EarlyDeregistrations map[AddrKeyHash]uint64
// Accounts deregistered after reward calculation start but before epoch end
// receive rewards but they go to treasury since they can't be paid
LateDeregistrations map[AddrKeyHash]uint64
// Pool retirement information
RetiredPools map[PoolKeyHash]PoolRetirementInfo
// Multiple pool associations (for pre-Allegra behavior)
// Maps stake key to list of pools they have reward addresses for
StakeKeyPoolAssociations map[AddrKeyHash][]PoolKeyHash
}
RewardSnapshot represents the stake snapshot for reward calculation
type RewardState ¶ added in v0.141.0
type RewardState interface {
// CalculateRewards calculates rewards for the given epoch based on stake snapshot
CalculateRewards(
pots AdaPots,
snapshot RewardSnapshot,
params RewardParameters,
) (*RewardCalculationResult, error)
// GetAdaPots returns the current ADA pots
GetAdaPots() AdaPots
// UpdateAdaPots updates the ADA pots (typically called after reward calculation)
UpdateAdaPots(pots AdaPots) error
// GetRewardSnapshot returns the stake snapshot for reward calculation
GetRewardSnapshot(epoch uint64) (RewardSnapshot, error)
}
RewardState defines the interface for reward calculation and querying
type Script ¶ added in v0.127.0
type Script interface {
Hash() ScriptHash
RawScriptBytes() []byte
// contains filtered or unexported methods
}
type ScriptHash ¶ added in v0.132.0
type ScriptHash = Blake2b224
func NewScriptHashFromBech32 ¶ added in v0.141.0
func NewScriptHashFromBech32(scriptHash string) (ScriptHash, error)
type ScriptRef ¶ added in v0.127.0
func (*ScriptRef) MarshalCBOR ¶ added in v0.133.0
func (*ScriptRef) UnmarshalCBOR ¶ added in v0.127.0
type SlotState ¶ added in v0.134.0
type SlotState interface {
SlotToTime(uint64) (time.Time, error)
TimeToSlot(time.Time) (uint64, error)
}
SlotState defines the interface for querying slots
type StakeDelegationCertificate ¶
type StakeDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential *Credential
PoolKeyHash PoolKeyHash
}
func (*StakeDelegationCertificate) Type ¶ added in v0.116.0
func (c *StakeDelegationCertificate) Type() uint
func (*StakeDelegationCertificate) UnmarshalCBOR ¶
func (c *StakeDelegationCertificate) UnmarshalCBOR(cborData []byte) error
func (*StakeDelegationCertificate) Utxorpc ¶
func (c *StakeDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type StakeDeregistrationCertificate ¶
type StakeDeregistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
}
func (*StakeDeregistrationCertificate) Type ¶ added in v0.116.0
func (c *StakeDeregistrationCertificate) Type() uint
func (*StakeDeregistrationCertificate) UnmarshalCBOR ¶
func (c *StakeDeregistrationCertificate) UnmarshalCBOR(cborData []byte) error
func (*StakeDeregistrationCertificate) Utxorpc ¶
func (c *StakeDeregistrationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type StakeRegistrationCertificate ¶
type StakeRegistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
}
func (*StakeRegistrationCertificate) Type ¶ added in v0.116.0
func (c *StakeRegistrationCertificate) Type() uint
func (*StakeRegistrationCertificate) UnmarshalCBOR ¶
func (c *StakeRegistrationCertificate) UnmarshalCBOR(cborData []byte) error
func (*StakeRegistrationCertificate) Utxorpc ¶
func (c *StakeRegistrationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type StakeRegistrationDelegationCertificate ¶
type StakeRegistrationDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
PoolKeyHash PoolKeyHash
Amount int64
}
func (*StakeRegistrationDelegationCertificate) Type ¶ added in v0.116.0
func (c *StakeRegistrationDelegationCertificate) Type() uint
func (*StakeRegistrationDelegationCertificate) UnmarshalCBOR ¶
func (c *StakeRegistrationDelegationCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*StakeRegistrationDelegationCertificate) Utxorpc ¶
func (c *StakeRegistrationDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type StakeVoteDelegationCertificate ¶
type StakeVoteDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
PoolKeyHash PoolKeyHash
Drep Drep
}
func (*StakeVoteDelegationCertificate) Type ¶ added in v0.116.0
func (c *StakeVoteDelegationCertificate) Type() uint
func (*StakeVoteDelegationCertificate) UnmarshalCBOR ¶
func (c *StakeVoteDelegationCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*StakeVoteDelegationCertificate) Utxorpc ¶
func (c *StakeVoteDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type StakeVoteRegistrationDelegationCertificate ¶
type StakeVoteRegistrationDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
PoolKeyHash PoolKeyHash
Drep Drep
Amount int64
}
func (*StakeVoteRegistrationDelegationCertificate) Type ¶ added in v0.116.0
func (c *StakeVoteRegistrationDelegationCertificate) Type() uint
func (*StakeVoteRegistrationDelegationCertificate) UnmarshalCBOR ¶
func (c *StakeVoteRegistrationDelegationCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*StakeVoteRegistrationDelegationCertificate) Utxorpc ¶
func (c *StakeVoteRegistrationDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type Transaction ¶
type Transaction interface {
TransactionBody
Type() int
Cbor() []byte
Hash() Blake2b256
LeiosHash() Blake2b256
Metadata() TransactionMetadatum
IsValid() bool
Consumed() []TransactionInput
Produced() []Utxo
Witnesses() TransactionWitnessSet
}
type TransactionBody ¶
type TransactionBody interface {
Cbor() []byte
Fee() uint64
Id() Blake2b256
Inputs() []TransactionInput
Outputs() []TransactionOutput
TTL() uint64
ProtocolParameterUpdates() (uint64, map[Blake2b224]ProtocolParameterUpdate)
ValidityIntervalStart() uint64
ReferenceInputs() []TransactionInput
Collateral() []TransactionInput
CollateralReturn() TransactionOutput
TotalCollateral() uint64
Certificates() []Certificate
Withdrawals() map[*Address]uint64
AuxDataHash() *Blake2b256
RequiredSigners() []Blake2b224
AssetMint() *MultiAsset[MultiAssetTypeMint]
ScriptDataHash() *Blake2b256
VotingProcedures() VotingProcedures
ProposalProcedures() []ProposalProcedure
CurrentTreasuryValue() int64
Donation() uint64
Utxorpc() (*utxorpc.Tx, error)
}
type TransactionBodyBase ¶ added in v0.117.0
type TransactionBodyBase struct {
cbor.DecodeStoreCbor
// contains filtered or unexported fields
}
TransactionBodyBase provides a set of functions that return empty values to satisfy the TransactionBody interface. It also provides functionality for generating a transaction hash and storing/retrieving the original CBOR
func (*TransactionBodyBase) AssetMint ¶ added in v0.117.0
func (b *TransactionBodyBase) AssetMint() *MultiAsset[MultiAssetTypeMint]
func (*TransactionBodyBase) AuxDataHash ¶ added in v0.117.0
func (b *TransactionBodyBase) AuxDataHash() *Blake2b256
func (*TransactionBodyBase) Certificates ¶ added in v0.117.0
func (b *TransactionBodyBase) Certificates() []Certificate
func (*TransactionBodyBase) Collateral ¶ added in v0.117.0
func (b *TransactionBodyBase) Collateral() []TransactionInput
func (*TransactionBodyBase) CollateralReturn ¶ added in v0.117.0
func (b *TransactionBodyBase) CollateralReturn() TransactionOutput
func (*TransactionBodyBase) CurrentTreasuryValue ¶ added in v0.117.0
func (b *TransactionBodyBase) CurrentTreasuryValue() int64
func (*TransactionBodyBase) Donation ¶ added in v0.117.0
func (b *TransactionBodyBase) Donation() uint64
func (*TransactionBodyBase) Fee ¶ added in v0.117.0
func (b *TransactionBodyBase) Fee() uint64
func (*TransactionBodyBase) Id ¶ added in v0.136.0
func (b *TransactionBodyBase) Id() Blake2b256
func (*TransactionBodyBase) Inputs ¶ added in v0.117.0
func (b *TransactionBodyBase) Inputs() []TransactionInput
func (*TransactionBodyBase) Outputs ¶ added in v0.117.0
func (b *TransactionBodyBase) Outputs() []TransactionOutput
func (*TransactionBodyBase) ProposalProcedures ¶ added in v0.117.0
func (b *TransactionBodyBase) ProposalProcedures() []ProposalProcedure
func (*TransactionBodyBase) ReferenceInputs ¶ added in v0.117.0
func (b *TransactionBodyBase) ReferenceInputs() []TransactionInput
func (*TransactionBodyBase) RequiredSigners ¶ added in v0.117.0
func (b *TransactionBodyBase) RequiredSigners() []Blake2b224
func (*TransactionBodyBase) ScriptDataHash ¶ added in v0.117.0
func (b *TransactionBodyBase) ScriptDataHash() *Blake2b256
func (*TransactionBodyBase) TTL ¶ added in v0.117.0
func (b *TransactionBodyBase) TTL() uint64
func (*TransactionBodyBase) TotalCollateral ¶ added in v0.117.0
func (b *TransactionBodyBase) TotalCollateral() uint64
func (*TransactionBodyBase) Utxorpc ¶ added in v0.117.0
func (b *TransactionBodyBase) Utxorpc() (*utxorpc.Tx, error)
func (*TransactionBodyBase) ValidityIntervalStart ¶ added in v0.117.0
func (b *TransactionBodyBase) ValidityIntervalStart() uint64
func (*TransactionBodyBase) VotingProcedures ¶ added in v0.117.0
func (b *TransactionBodyBase) VotingProcedures() VotingProcedures
func (*TransactionBodyBase) Withdrawals ¶ added in v0.117.0
func (b *TransactionBodyBase) Withdrawals() map[*Address]uint64
type TransactionInput ¶
type TransactionInput interface {
Id() Blake2b256
Index() uint32
String() string
Utxorpc() (*utxorpc.TxInput, error)
ToPlutusData() data.PlutusData
}
type TransactionMetadataSet ¶ added in v0.141.0
type TransactionMetadataSet struct {
cbor.DecodeStoreCbor
// contains filtered or unexported fields
}
func (TransactionMetadataSet) GetMetadata ¶ added in v0.142.0
func (s TransactionMetadataSet) GetMetadata( key uint, ) (TransactionMetadatum, bool)
func (TransactionMetadataSet) MarshalCBOR ¶ added in v0.141.0
func (s TransactionMetadataSet) MarshalCBOR() ([]byte, error)
func (*TransactionMetadataSet) UnmarshalCBOR ¶ added in v0.141.0
func (s *TransactionMetadataSet) UnmarshalCBOR(cborData []byte) error
type TransactionMetadatum ¶ added in v0.141.0
type TransactionMetadatum interface {
TypeName() string
// contains filtered or unexported methods
}
func DecodeMetadatumRaw ¶ added in v0.141.0
func DecodeMetadatumRaw(b []byte) (TransactionMetadatum, error)
type TransactionOutput ¶
type TransactionOutput interface {
Address() Address
Amount() uint64
Assets() *MultiAsset[MultiAssetTypeOutput]
Datum() *Datum
DatumHash() *Blake2b256
Cbor() []byte
Utxorpc() (*utxorpc.TxOutput, error)
ScriptRef() Script
ToPlutusData() data.PlutusData
String() string
}
type TransactionWitnessRedeemers ¶ added in v0.110.0
type TransactionWitnessRedeemers interface {
Indexes(RedeemerTag) []uint
Value(uint, RedeemerTag) RedeemerValue
Iter() iter.Seq2[RedeemerKey, RedeemerValue]
}
type TransactionWitnessSet ¶ added in v0.110.0
type TransactionWitnessSet interface {
Vkey() []VkeyWitness
NativeScripts() []NativeScript
Bootstrap() []BootstrapWitness
PlutusData() []Datum
PlutusV1Scripts() []PlutusV1Script
PlutusV2Scripts() []PlutusV2Script
PlutusV3Scripts() []PlutusV3Script
Redeemers() TransactionWitnessRedeemers
}
type TreasuryWithdrawalGovAction ¶
type TreasuryWithdrawalGovAction struct {
cbor.StructAsArray
Type uint
Withdrawals map[*Address]uint64
PolicyHash []byte
}
func (*TreasuryWithdrawalGovAction) ToPlutusData ¶ added in v0.130.0
func (a *TreasuryWithdrawalGovAction) ToPlutusData() data.PlutusData
type UpdateCommitteeGovAction ¶
type UpdateCommitteeGovAction struct {
cbor.StructAsArray
Type uint
ActionId *GovActionId
Credentials []Credential
CredEpochs map[*Credential]uint
Quorum cbor.Rat
}
func (*UpdateCommitteeGovAction) ToPlutusData ¶ added in v0.130.0
func (a *UpdateCommitteeGovAction) ToPlutusData() data.PlutusData
type UpdateDrepCertificate ¶
type UpdateDrepCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
DrepCredential Credential
Anchor *GovAnchor
}
func (*UpdateDrepCertificate) Type ¶ added in v0.116.0
func (c *UpdateDrepCertificate) Type() uint
func (*UpdateDrepCertificate) UnmarshalCBOR ¶
func (c *UpdateDrepCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*UpdateDrepCertificate) Utxorpc ¶
func (c *UpdateDrepCertificate) Utxorpc() (*utxorpc.Certificate, error)
type Utxo ¶
type Utxo struct {
cbor.StructAsArray
Id TransactionInput
Output TransactionOutput
}
type UtxoState ¶ added in v0.109.0
type UtxoState interface {
UtxoById(TransactionInput) (Utxo, error)
}
UtxoState defines the interface for querying the UTxO state
type UtxoValidationRuleFunc ¶ added in v0.109.0
type UtxoValidationRuleFunc func(Transaction, uint64, LedgerState, ProtocolParameters) error
type VkeyWitness ¶ added in v0.110.0
type VkeyWitness struct {
cbor.StructAsArray
Vkey []byte
Signature []byte
}
type Vote ¶ added in v0.130.0
type Vote uint8
func (Vote) ToPlutusData ¶ added in v0.130.0
func (v Vote) ToPlutusData() data.PlutusData
type VoteDelegationCertificate ¶
type VoteDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
Drep Drep
}
func (*VoteDelegationCertificate) Type ¶ added in v0.116.0
func (c *VoteDelegationCertificate) Type() uint
func (*VoteDelegationCertificate) UnmarshalCBOR ¶
func (c *VoteDelegationCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*VoteDelegationCertificate) Utxorpc ¶
func (c *VoteDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type VoteRegistrationDelegationCertificate ¶
type VoteRegistrationDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential Credential
Drep Drep
Amount int64
}
func (*VoteRegistrationDelegationCertificate) Type ¶ added in v0.116.0
func (c *VoteRegistrationDelegationCertificate) Type() uint
func (*VoteRegistrationDelegationCertificate) UnmarshalCBOR ¶
func (c *VoteRegistrationDelegationCertificate) UnmarshalCBOR( cborData []byte, ) error
func (*VoteRegistrationDelegationCertificate) Utxorpc ¶
func (c *VoteRegistrationDelegationCertificate) Utxorpc() (*utxorpc.Certificate, error)
type Voter ¶
type Voter struct {
cbor.StructAsArray
Type uint8
Hash [28]byte
}
func (Voter) ToPlutusData ¶ added in v0.130.0
func (v Voter) ToPlutusData() data.PlutusData
type VotingProcedure ¶
type VotingProcedure struct {
cbor.StructAsArray
Vote uint8
Anchor *GovAnchor
}
func (VotingProcedure) ToPlutusData ¶ added in v0.130.0
func (vp VotingProcedure) ToPlutusData() data.PlutusData
type VotingProcedures ¶
type VotingProcedures map[*Voter]map[*GovActionId]VotingProcedure
VotingProcedures is a convenience type to avoid needing to duplicate the full type definition everywhere
type VrfKeyHash ¶
type VrfKeyHash = Blake2b256