Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type Asset
- type AuthCommitteeHot
- type Block
- type BlockNonce
- type Certificate
- type Datum
- type Deregistration
- type DeregistrationDrep
- type Drep
- type Epoch
- type KeyWitness
- type MoveInstantaneousRewards
- type MoveInstantaneousRewardsReward
- type PParamUpdate
- type PParams
- type PlutusData
- type Pool
- type PoolRegistration
- type PoolRegistrationOwner
- type PoolRegistrationRelay
- type PoolRetirement
- type Redeemer
- type Registration
- type RegistrationDrep
- type ResignCommitteeCold
- type Script
- type StakeDelegation
- type StakeDeregistration
- type StakeRegistration
- type StakeRegistrationDelegation
- type StakeVoteDelegation
- type StakeVoteRegistrationDelegation
- type Tip
- type Transaction
- type UpdateDrep
- type Utxo
- type UtxoSlot
- type VoteDelegation
- type VoteRegistrationDelegation
- type WitnessScripts
Constants ¶
const ( // KeyWitnessTypeVkey represents a Vkey witness KeyWitnessTypeVkey uint8 = 0 // KeyWitnessTypeBootstrap represents a Bootstrap witness KeyWitnessTypeBootstrap uint8 = 1 )
Variables ¶
var ErrAccountNotFound = errors.New("account not found")
var ErrBlockNotFound = errors.New("block not found")
var ErrDrepNotFound = errors.New("drep not found")
var ErrPoolNotFound = errors.New("pool not found")
var MigrateModels = []any{ &Account{}, &Asset{}, &AuthCommitteeHot{}, &BlockNonce{}, &Certificate{}, &Datum{}, &Deregistration{}, &DeregistrationDrep{}, &Drep{}, &Epoch{}, &KeyWitness{}, &MoveInstantaneousRewards{}, &MoveInstantaneousRewardsReward{}, &Pool{}, &PoolRegistration{}, &PoolRegistrationOwner{}, &PoolRegistrationRelay{}, &PoolRetirement{}, &PParams{}, &PParamUpdate{}, &PlutusData{}, &Registration{}, &RegistrationDrep{}, &Redeemer{}, &ResignCommitteeCold{}, &Script{}, &StakeDelegation{}, &StakeDeregistration{}, &StakeRegistration{}, &StakeRegistrationDelegation{}, &StakeVoteDelegation{}, &StakeVoteRegistrationDelegation{}, &Tip{}, &Transaction{}, &UpdateDrep{}, &Utxo{}, &VoteDelegation{}, &VoteRegistrationDelegation{}, &WitnessScripts{}, }
MigrateModels contains a list of model objects that should have DB migrations applied
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
StakingKey []byte `gorm:"uniqueIndex"`
Pool []byte `gorm:"index"`
Drep []byte `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
CertificateID uint `gorm:"index"`
Active bool `gorm:"default:true"`
}
type Asset ¶
type Asset struct {
Name []byte `gorm:"index"`
NameHex []byte `gorm:"index"`
PolicyId []byte `gorm:"index"`
Fingerprint []byte `gorm:"index"`
ID uint `gorm:"primaryKey"`
UtxoID uint `gorm:"index"`
Amount types.Uint64 `gorm:"index"`
}
func ConvertMultiAssetToModels ¶
func ConvertMultiAssetToModels( multiAsset *lcommon.MultiAsset[lcommon.MultiAssetTypeOutput], ) []Asset
ConvertMultiAssetToModels converts a MultiAsset structure into a slice of Asset models. Each asset is populated with its name, hex-encoded name, policy ID, fingerprint, and amount. Returns an empty slice if multiAsset is nil or contains no assets.
type AuthCommitteeHot ¶
type AuthCommitteeHot struct {
ColdCredential []byte `gorm:"index"`
HostCredential []byte `gorm:"index"`
ID uint `gorm:"primarykey"`
CertificateID uint `gorm:"index"`
AddedSlot uint64
}
func (AuthCommitteeHot) TableName ¶
func (AuthCommitteeHot) TableName() string
type Block ¶
type BlockNonce ¶
type BlockNonce struct {
Hash []byte `gorm:"index:hash_slot"`
Nonce []byte
ID uint `gorm:"primarykey"`
Slot uint64 `gorm:"index:hash_slot"`
IsCheckpoint bool
}
func (BlockNonce) TableName ¶
func (BlockNonce) TableName() string
TableName overrides default table name
type Certificate ¶
type Certificate struct {
BlockHash []byte `gorm:"index"`
ID uint `gorm:"primaryKey"`
TransactionID uint `gorm:"index;uniqueIndex:uniq_tx_cert;constraint:OnDelete:CASCADE"`
CertificateID uint `gorm:"index"` // Polymorphic FK to certificate table based on CertType. Not DB-enforced.
Slot uint64 `gorm:"index"`
CertIndex uint `gorm:"column:cert_index;uniqueIndex:uniq_tx_cert"`
CertType uint `gorm:"index"`
}
Certificate maps transaction certificates to their specialized table records. Provides unified indexing across all certificate types without requiring joins.
All certificate types now have dedicated specialized models. The CertificateID field references the ID of the specific certificate record based on CertType.
func (Certificate) TableName ¶
func (Certificate) TableName() string
func (Certificate) Type ¶
func (c Certificate) Type() uint
type Datum ¶
type Deregistration ¶
type Deregistration struct {
StakingKey []byte `gorm:"index"`
ID uint `gorm:"primarykey"`
CertificateID uint `gorm:"index"`
AddedSlot uint64
Amount types.Uint64
}
func (Deregistration) TableName ¶
func (Deregistration) TableName() string
type DeregistrationDrep ¶
type DeregistrationDrep struct {
DrepCredential []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (DeregistrationDrep) TableName ¶
func (DeregistrationDrep) TableName() string
type Drep ¶
type Epoch ¶
type KeyWitness ¶
type KeyWitness struct {
ID uint `gorm:"primaryKey"`
TransactionID uint `gorm:"index"`
Type uint8 `gorm:"index"` // See KeyWitnessType* constants
Vkey []byte // Vkey witness key
Signature []byte // Witness signature
PublicKey []byte // For Bootstrap witness
ChainCode []byte // For Bootstrap witness
Attributes []byte // For Bootstrap witness
}
KeyWitness represents a key witness entry (Vkey or Bootstrap) Type: KeyWitnessTypeVkey = VkeyWitness, KeyWitnessTypeBootstrap = BootstrapWitness
func (KeyWitness) TableName ¶
func (KeyWitness) TableName() string
type MoveInstantaneousRewards ¶
type MoveInstantaneousRewards struct {
Pot uint `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
}
func (MoveInstantaneousRewards) TableName ¶
func (MoveInstantaneousRewards) TableName() string
type MoveInstantaneousRewardsReward ¶
type MoveInstantaneousRewardsReward struct {
Credential []byte
Amount types.Uint64
ID uint `gorm:"primarykey"`
MIRID uint `gorm:"index;constraint:OnDelete:CASCADE"`
}
func (MoveInstantaneousRewardsReward) TableName ¶
func (MoveInstantaneousRewardsReward) TableName() string
type PParamUpdate ¶
type PParamUpdate struct {
GenesisHash []byte
Cbor []byte
ID uint `gorm:"primarykey"`
AddedSlot uint64
Epoch uint64
}
func (PParamUpdate) TableName ¶
func (PParamUpdate) TableName() string
type PParams ¶
type PlutusData ¶
type PlutusData struct {
ID uint `gorm:"primaryKey"`
TransactionID uint `gorm:"index"`
Data []byte
Transaction *Transaction
}
PlutusData represents a Plutus data value in the witness set
func (PlutusData) TableName ¶
func (PlutusData) TableName() string
type Pool ¶
type Pool struct {
Margin *types.Rat
PoolKeyHash []byte `gorm:"uniqueIndex"`
VrfKeyHash []byte
RewardAccount []byte
Owners []PoolRegistrationOwner
Relays []PoolRegistrationRelay
Registration []PoolRegistration
Retirement []PoolRetirement
ID uint `gorm:"primarykey"`
Pledge types.Uint64
Cost types.Uint64
}
type PoolRegistration ¶
type PoolRegistration struct {
Margin *types.Rat
MetadataUrl string
VrfKeyHash []byte
PoolKeyHash []byte `gorm:"index"`
RewardAccount []byte
MetadataHash []byte
Owners []PoolRegistrationOwner
Relays []PoolRegistrationRelay
Pledge types.Uint64
Cost types.Uint64
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
PoolID uint `gorm:"index"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (PoolRegistration) TableName ¶
func (PoolRegistration) TableName() string
type PoolRegistrationOwner ¶
type PoolRegistrationOwner struct {
KeyHash []byte
ID uint `gorm:"primarykey"`
PoolRegistrationID uint `gorm:"index"`
PoolID uint `gorm:"index"`
}
func (PoolRegistrationOwner) TableName ¶
func (PoolRegistrationOwner) TableName() string
type PoolRegistrationRelay ¶
type PoolRegistrationRelay struct {
Ipv4 *net.IP
Ipv6 *net.IP
Hostname string
ID uint `gorm:"primarykey"`
PoolRegistrationID uint `gorm:"index"`
PoolID uint `gorm:"index"`
Port uint
}
func (PoolRegistrationRelay) TableName ¶
func (PoolRegistrationRelay) TableName() string
type PoolRetirement ¶
type PoolRetirement struct {
PoolKeyHash []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
PoolID uint `gorm:"index"`
Epoch uint64
AddedSlot uint64
}
func (PoolRetirement) TableName ¶
func (PoolRetirement) TableName() string
type Redeemer ¶
type Redeemer struct {
ID uint `gorm:"primaryKey"`
TransactionID uint `gorm:"index"`
Tag uint8 `gorm:"index"` // Redeemer tag
Index uint32 `gorm:"index"`
Data []byte // Plutus data
ExUnitsMemory uint64
ExUnitsCPU uint64
}
Redeemer represents a redeemer in the witness set
type Registration ¶
type Registration struct {
StakingKey []byte `gorm:"index"`
ID uint `gorm:"primarykey"`
CertificateID uint `gorm:"index"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (Registration) TableName ¶
func (Registration) TableName() string
type RegistrationDrep ¶
type RegistrationDrep struct {
AnchorUrl string
DrepCredential []byte `gorm:"index"`
AnchorHash []byte
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (RegistrationDrep) TableName ¶
func (RegistrationDrep) TableName() string
type ResignCommitteeCold ¶
type ResignCommitteeCold struct {
AnchorUrl string
ColdCredential []byte `gorm:"index"`
AnchorHash []byte
ID uint `gorm:"primarykey"`
CertificateID uint `gorm:"index"`
AddedSlot uint64
}
func (ResignCommitteeCold) TableName ¶
func (ResignCommitteeCold) TableName() string
type Script ¶
type Script struct {
ID uint `gorm:"primaryKey"`
Hash []byte `gorm:"index;unique"` // Script hash
Type uint8 `gorm:"index"` // Script type
Content []byte // Script content
CreatedSlot uint64 // Slot when this script was first seen
}
Script represents the content of a script, indexed by its hash This avoids storing duplicate script data when the same script appears in multiple transactions
type StakeDelegation ¶
type StakeDelegation struct {
StakingKey []byte `gorm:"index"`
PoolKeyHash []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
}
func (StakeDelegation) TableName ¶
func (StakeDelegation) TableName() string
type StakeDeregistration ¶
type StakeDeregistration struct {
StakingKey []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
}
func (StakeDeregistration) TableName ¶
func (StakeDeregistration) TableName() string
type StakeRegistration ¶
type StakeRegistration struct {
StakingKey []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (StakeRegistration) TableName ¶
func (StakeRegistration) TableName() string
type StakeRegistrationDelegation ¶
type StakeRegistrationDelegation struct {
StakingKey []byte `gorm:"index"`
PoolKeyHash []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (StakeRegistrationDelegation) TableName ¶
func (StakeRegistrationDelegation) TableName() string
type StakeVoteDelegation ¶
type StakeVoteDelegation struct {
StakingKey []byte `gorm:"index"`
PoolKeyHash []byte `gorm:"index"`
Drep []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
}
func (StakeVoteDelegation) TableName ¶
func (StakeVoteDelegation) TableName() string
type StakeVoteRegistrationDelegation ¶
type StakeVoteRegistrationDelegation struct {
StakingKey []byte `gorm:"index"`
PoolKeyHash []byte `gorm:"index"`
Drep []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (StakeVoteRegistrationDelegation) TableName ¶
func (StakeVoteRegistrationDelegation) TableName() string
type Transaction ¶
type Transaction struct {
Hash []byte `gorm:"uniqueIndex"`
BlockHash []byte `gorm:"index"`
Inputs []Utxo `gorm:"foreignKey:SpentAtTxId;references:Hash"`
Outputs []Utxo `gorm:"foreignKey:TransactionID;references:ID"`
ReferenceInputs []Utxo `gorm:"foreignKey:ReferencedByTxId;references:Hash"`
Collateral []Utxo `gorm:"foreignKey:CollateralByTxId;references:Hash"`
CollateralReturn *Utxo `gorm:"foreignKey:TransactionID;references:ID"`
KeyWitnesses []KeyWitness `gorm:"foreignKey:TransactionID;references:ID"`
WitnessScripts []WitnessScripts `gorm:"foreignKey:TransactionID;references:ID"`
Redeemers []Redeemer `gorm:"foreignKey:TransactionID;references:ID"`
PlutusData []PlutusData `gorm:"foreignKey:TransactionID;references:ID"`
ID uint `gorm:"primaryKey"`
Type int
BlockIndex uint32
Metadata []byte
Fee types.Uint64
TTL types.Uint64
Valid bool
}
Transaction represents a transaction record
func (Transaction) TableName ¶
func (Transaction) TableName() string
type UpdateDrep ¶
type UpdateDrep struct {
AnchorUrl string
Credential []byte `gorm:"index"`
AnchorHash []byte
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
}
func (UpdateDrep) TableName ¶
func (UpdateDrep) TableName() string
type Utxo ¶
type Utxo struct {
TransactionID *uint `gorm:"index"`
TxId []byte `gorm:"uniqueIndex:tx_id_output_idx"`
PaymentKey []byte `gorm:"index"`
StakingKey []byte `gorm:"index"`
Assets []Asset
Cbor []byte `gorm:"-"` // This is here for convenience but not represented in the metadata DB
SpentAtTxId []byte `gorm:"index"`
ReferencedByTxId []byte `gorm:"index"`
CollateralByTxId []byte `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64 `gorm:"index"`
DeletedSlot uint64 `gorm:"index"`
Amount types.Uint64 `gorm:"index"`
OutputIdx uint32 `gorm:"uniqueIndex:tx_id_output_idx"`
}
Utxo represents an unspent transaction output
type VoteDelegation ¶
type VoteDelegation struct {
StakingKey []byte `gorm:"index"`
Drep []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
}
func (VoteDelegation) TableName ¶
func (VoteDelegation) TableName() string
type VoteRegistrationDelegation ¶
type VoteRegistrationDelegation struct {
StakingKey []byte `gorm:"index"`
Drep []byte `gorm:"index"`
CertificateID uint `gorm:"index"`
ID uint `gorm:"primarykey"`
AddedSlot uint64
DepositAmount types.Uint64
}
func (VoteRegistrationDelegation) TableName ¶
func (VoteRegistrationDelegation) TableName() string
type WitnessScripts ¶
type WitnessScripts struct {
ID uint `gorm:"primaryKey"`
TransactionID uint `gorm:"index"`
Type uint8 `gorm:"index"` // Script type
ScriptHash []byte `gorm:"index"` // Hash of the script
}
WitnessScripts represents a reference to a script in the witness set Type corresponds to ScriptRefType constants from gouroboros/ledger/common: 0=NativeScript (ScriptRefTypeNativeScript) 1=PlutusV1 (ScriptRefTypePlutusV1) 2=PlutusV2 (ScriptRefTypePlutusV2) 3=PlutusV3 (ScriptRefTypePlutusV3)
To avoid storing duplicate script data for the same script used in multiple transactions, we store only the script hash here. The actual script content is stored separately in Script table, indexed by hash.
func (WitnessScripts) TableName ¶
func (WitnessScripts) TableName() string