transform

package
v2.8.22 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EffectTypeNames = map[EffectType]string{
	EffectAccountCreated:                     "account_created",
	EffectAccountRemoved:                     "account_removed",
	EffectAccountCredited:                    "account_credited",
	EffectAccountDebited:                     "account_debited",
	EffectAccountThresholdsUpdated:           "account_thresholds_updated",
	EffectAccountHomeDomainUpdated:           "account_home_domain_updated",
	EffectAccountFlagsUpdated:                "account_flags_updated",
	EffectAccountInflationDestinationUpdated: "account_inflation_destination_updated",
	EffectSignerCreated:                      "signer_created",
	EffectSignerRemoved:                      "signer_removed",
	EffectSignerUpdated:                      "signer_updated",
	EffectTrustlineCreated:                   "trustline_created",
	EffectTrustlineRemoved:                   "trustline_removed",
	EffectTrustlineUpdated:                   "trustline_updated",
	EffectTrustlineFlagsUpdated:              "trustline_flags_updated",
	EffectOfferCreated:                       "offer_created",
	EffectOfferRemoved:                       "offer_removed",
	EffectOfferUpdated:                       "offer_updated",
	EffectTrade:                              "trade",
	EffectDataCreated:                        "data_created",
	EffectDataRemoved:                        "data_removed",
	EffectDataUpdated:                        "data_updated",
	EffectSequenceBumped:                     "sequence_bumped",
	EffectClaimableBalanceCreated:            "claimable_balance_created",
	EffectClaimableBalanceClaimed:            "claimable_balance_claimed",
	EffectClaimableBalanceClaimantCreated:    "claimable_balance_claimant_created",
	EffectAccountSponsorshipCreated:          "account_sponsorship_created",
	EffectAccountSponsorshipUpdated:          "account_sponsorship_updated",
	EffectAccountSponsorshipRemoved:          "account_sponsorship_removed",
	EffectTrustlineSponsorshipCreated:        "trustline_sponsorship_created",
	EffectTrustlineSponsorshipUpdated:        "trustline_sponsorship_updated",
	EffectTrustlineSponsorshipRemoved:        "trustline_sponsorship_removed",
	EffectDataSponsorshipCreated:             "data_sponsorship_created",
	EffectDataSponsorshipUpdated:             "data_sponsorship_updated",
	EffectDataSponsorshipRemoved:             "data_sponsorship_removed",
	EffectClaimableBalanceSponsorshipCreated: "claimable_balance_sponsorship_created",
	EffectClaimableBalanceSponsorshipUpdated: "claimable_balance_sponsorship_updated",
	EffectClaimableBalanceSponsorshipRemoved: "claimable_balance_sponsorship_removed",
	EffectSignerSponsorshipCreated:           "signer_sponsorship_created",
	EffectSignerSponsorshipUpdated:           "signer_sponsorship_updated",
	EffectSignerSponsorshipRemoved:           "signer_sponsorship_removed",
	EffectClaimableBalanceClawedBack:         "claimable_balance_clawed_back",
	EffectLiquidityPoolDeposited:             "liquidity_pool_deposited",
	EffectLiquidityPoolWithdrew:              "liquidity_pool_withdrew",
	EffectLiquidityPoolTrade:                 "liquidity_pool_trade",
	EffectLiquidityPoolCreated:               "liquidity_pool_created",
	EffectLiquidityPoolRemoved:               "liquidity_pool_removed",
	EffectLiquidityPoolRevoked:               "liquidity_pool_revoked",
	EffectContractCredited:                   "contract_credited",
	EffectContractDebited:                    "contract_debited",
	EffectExtendFootprintTtl:                 "extend_footprint_ttl",
	EffectRestoreFootprint:                   "restore_footprint",
}

EffectTypeNames stores a map of effect type ID and names

Functions

func AssetFromContractData

func AssetFromContractData(ledgerEntry xdr.LedgerEntry, passphrase string) *xdr.Asset

AssetFromContractData takes a ledger entry and verifies if the ledger entry corresponds to the asset info entry written to contract storage by the Stellar Asset Contract upon initialization.

Note that AssetFromContractData will ignore forged asset info entries by deriving the Stellar Asset Contract ID from the asset info entry and comparing it to the contract ID found in the ledger entry.

If the given ledger entry is a verified asset info entry, AssetFromContractData will return the corresponding Stellar asset. Otherwise, it returns nil.

References: https://github.com/stellar/rs-soroban-env/blob/v0.0.16/soroban-env-host/src/native_contract/token/public_types.rs#L21 https://github.com/stellar/rs-soroban-env/blob/v0.0.16/soroban-env-host/src/native_contract/token/asset_info.rs#L6 https://github.com/stellar/rs-soroban-env/blob/v0.0.16/soroban-env-host/src/native_contract/token/contract.rs#L115

The asset info in `ContractData` entry takes the following form:

  • Instance storage - it's part of contract instance data storage

  • Key: a vector with one element, which is the symbol "AssetInfo"

    ScVal{ Vec: ScVec({ ScVal{ Sym: ScSymbol("AssetInfo") }})}

  • Value: a map with two key-value pairs: code and issuer

    ScVal{ Map: ScMap( { ScVal{ Sym: ScSymbol("asset_code") } -> ScVal{ Str: ScString(...) } }, { ScVal{ Sym: ScSymbol("issuer") } -> ScVal{ Bytes: ScBytes(...) } } )}

func ContractBalanceFromContractData

func ContractBalanceFromContractData(ledgerEntry xdr.LedgerEntry, passphrase string) ([32]byte, *big.Int, bool)

ContractBalanceFromContractData takes a ledger entry and verifies that the ledger entry corresponds to the balance entry written to contract storage by the Stellar Asset Contract.

Reference:

https://github.com/stellar/rs-soroban-env/blob/da325551829d31dcbfa71427d51c18e71a121c5f/soroban-env-host/src/native_contract/token/storage_types.rs#L11-L24

func FarmHashAsset

func FarmHashAsset(assetCode, assetIssuer, assetType string) int64

func GetTransactionSet

func GetTransactionSet(transactionEntry historyarchive.Ledger) (transactionProcessing []xdr.TransactionEnvelope)

func PoolIDToString

func PoolIDToString(id xdr.PoolId) string

Types

type AccountOutput

type AccountOutput struct {
	AccountID            string      `json:"account_id"` // account address
	Balance              float64     `json:"balance"`
	BuyingLiabilities    float64     `json:"buying_liabilities"`
	SellingLiabilities   float64     `json:"selling_liabilities"`
	SequenceNumber       int64       `json:"sequence_number"`
	SequenceLedger       zero.Int    `json:"sequence_ledger"`
	SequenceTime         zero.Int    `json:"sequence_time"`
	NumSubentries        uint32      `json:"num_subentries"`
	InflationDestination string      `json:"inflation_destination"`
	Flags                uint32      `json:"flags"`
	HomeDomain           string      `json:"home_domain"`
	MasterWeight         int32       `json:"master_weight"`
	ThresholdLow         int32       `json:"threshold_low"`
	ThresholdMedium      int32       `json:"threshold_medium"`
	ThresholdHigh        int32       `json:"threshold_high"`
	Sponsor              null.String `json:"sponsor"`
	NumSponsored         uint32      `json:"num_sponsored"`
	NumSponsoring        uint32      `json:"num_sponsoring"`
	LastModifiedLedger   uint32      `json:"last_modified_ledger"`
	LedgerEntryChange    uint32      `json:"ledger_entry_change"`
	Deleted              bool        `json:"deleted"`
	ClosedAt             time.Time   `json:"closed_at"`
	LedgerSequence       uint32      `json:"ledger_sequence"`
}

AccountOutput is a representation of an account that aligns with the BigQuery table accounts

func TransformAccount

func TransformAccount(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (AccountOutput, error)

TransformAccount converts an account from the history archive ingestion system into a form suitable for BigQuery

func (AccountOutput) ToParquet

func (ao AccountOutput) ToParquet() interface{}

type AccountOutputParquet

type AccountOutputParquet struct {
	AccountID            string  `parquet:"name=account_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Balance              float64 `parquet:"name=balance, type=DOUBLE"`
	BuyingLiabilities    float64 `parquet:"name=buying_liabilities, type=DOUBLE"`
	SellingLiabilities   float64 `parquet:"name=selling_liabilities, type=DOUBLE"`
	SequenceNumber       int64   `parquet:"name=sequence_number, type=INT64"`
	SequenceLedger       int64   `parquet:"name=sequence_ledger, type=INT64"`
	SequenceTime         int64   `parquet:"name=sequence_time, type=INT64"`
	NumSubentries        int64   `parquet:"name=num_subentries, type=INT64, convertedtype=UINT_64"`
	InflationDestination string  `parquet:"name=inflation_destination, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Flags                int64   `parquet:"name=flags, type=INT64, convertedtype=UINT_64"`
	HomeDomain           string  `parquet:"name=home_domain, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	MasterWeight         int32   `parquet:"name=master_weight, type=INT32"`
	ThresholdLow         int32   `parquet:"name=threshold_low, type=INT32"`
	ThresholdMedium      int32   `parquet:"name=threshold_medium, type=INT32"`
	ThresholdHigh        int32   `parquet:"name=threshold_high, type=INT32"`
	Sponsor              string  `parquet:"name=sponsor, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	NumSponsored         int64   `parquet:"name=num_sponsored, type=INT64, convertedtype=UINT_64"`
	NumSponsoring        int64   `parquet:"name=num_sponsoring, type=INT64, convertedtype=UINT_64"`
	LastModifiedLedger   int64   `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange    int64   `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Deleted              bool    `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt             int64   `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence       int64   `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
}

AccountOutputParquet is a representation of an account that aligns with the BigQuery table accounts

type AccountSignerOutput

type AccountSignerOutput struct {
	AccountID          string      `json:"account_id"`
	Signer             string      `json:"signer"`
	Weight             int32       `json:"weight"`
	Sponsor            null.String `json:"sponsor"`
	LastModifiedLedger uint32      `json:"last_modified_ledger"`
	LedgerEntryChange  uint32      `json:"ledger_entry_change"`
	Deleted            bool        `json:"deleted"`
	ClosedAt           time.Time   `json:"closed_at"`
	LedgerSequence     uint32      `json:"ledger_sequence"`
}

AccountSignerOutput is a representation of an account signer that aligns with the BigQuery table account_signers

func TransformSigners

func TransformSigners(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) ([]AccountSignerOutput, error)

TransformSigners converts account signers from the history archive ingestion system into a form suitable for BigQuery

func (AccountSignerOutput) ToParquet

func (aso AccountSignerOutput) ToParquet() interface{}

type AccountSignerOutputParquet

type AccountSignerOutputParquet struct {
	AccountID          string `parquet:"name=account_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Signer             string `parquet:"name=signer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Weight             int32  `parquet:"name=weight, type=INT32"`
	Sponsor            string `parquet:"name=sponsor, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LastModifiedLedger int64  `parquet:"name=last_modified_ledger, type=INT64, convertedtype=INT64, convertedtype=UINT_64"`
	LedgerEntryChange  int64  `parquet:"name=ledger_entry_change, type=INT64, convertedtype=INT64, convertedtype=UINT_64"`
	Deleted            bool   `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt           int64  `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence     int64  `parquet:"name=ledger_sequence, type=INT64, convertedtype=INT64, convertedtype=UINT_64"`
}

AccountSignerOutputParquet is a representation of an account signer that aligns with the BigQuery table account_signers

type AssetFromContractDataFunc

type AssetFromContractDataFunc func(ledgerEntry xdr.LedgerEntry, passphrase string) *xdr.Asset

type AssetOutput

type AssetOutput struct {
	AssetCode      string    `json:"asset_code"`
	AssetIssuer    string    `json:"asset_issuer"`
	AssetType      string    `json:"asset_type"`
	AssetID        int64     `json:"asset_id"`
	ClosedAt       time.Time `json:"closed_at"`
	LedgerSequence uint32    `json:"ledger_sequence"`
}

AssetOutput is a representation of an asset that aligns with the BigQuery table history_assets

func TransformAsset

func TransformAsset(operation xdr.Operation, operationIndex int32, transactionIndex int32, ledgerSeq int32, lcm xdr.LedgerCloseMeta) (AssetOutput, error)

TransformAsset converts an asset from a payment operation into a form suitable for BigQuery

func (AssetOutput) ToParquet

func (ao AssetOutput) ToParquet() interface{}

type AssetOutputParquet

type AssetOutputParquet struct {
	AssetCode      string `parquet:"name=asset_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetIssuer    string `parquet:"name=asset_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetType      string `parquet:"name=asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetID        int64  `parquet:"name=asset_id, type=INT64"`
	ClosedAt       int64  `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence int64  `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
}

AssetOutputParquet is a representation of an asset that aligns with the BigQuery table history_assets

type ClaimableBalanceOutput

type ClaimableBalanceOutput struct {
	BalanceID          string      `json:"balance_id"`
	Claimants          []Claimant  `json:"claimants"`
	AssetCode          string      `json:"asset_code"`
	AssetIssuer        string      `json:"asset_issuer"`
	AssetType          string      `json:"asset_type"`
	AssetID            int64       `json:"asset_id"`
	AssetAmount        float64     `json:"asset_amount"`
	Sponsor            null.String `json:"sponsor"`
	Flags              uint32      `json:"flags"`
	LastModifiedLedger uint32      `json:"last_modified_ledger"`
	LedgerEntryChange  uint32      `json:"ledger_entry_change"`
	Deleted            bool        `json:"deleted"`
	ClosedAt           time.Time   `json:"closed_at"`
	LedgerSequence     uint32      `json:"ledger_sequence"`
	BalanceIDStrkey    string      `json:"balance_id_strkey"`
}

ClaimableBalanceOutput is a representation of a claimable balances that aligns with the BigQuery table claimable_balances

func TransformClaimableBalance

func TransformClaimableBalance(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (ClaimableBalanceOutput, error)

TransformClaimableBalance converts a claimable balance from the history archive ingestion system into a form suitable for BigQuery

type Claimant

type Claimant struct {
	Destination string             `json:"destination"`
	Predicate   xdr.ClaimPredicate `json:"predicate"`
}

Claimants

type ConfigSettingOutput

type ConfigSettingOutput struct {
	ConfigSettingId                        int32               `json:"config_setting_id"`
	ContractMaxSizeBytes                   uint32              `json:"contract_max_size_bytes"`
	LedgerMaxInstructions                  int64               `json:"ledger_max_instructions"`
	TxMaxInstructions                      int64               `json:"tx_max_instructions"`
	FeeRatePerInstructionsIncrement        int64               `json:"fee_rate_per_instructions_increment"`
	TxMemoryLimit                          uint32              `json:"tx_memory_limit"`
	LedgerMaxReadLedgerEntries             uint32              `json:"ledger_max_read_ledger_entries"`
	LedgerMaxDiskReadEntries               uint32              `json:"ledger_max_disk_read_entries"`
	LedgerMaxReadBytes                     uint32              `json:"ledger_max_read_bytes"`
	LedgerMaxDiskReadBytes                 uint32              `json:"ledger_max_disk_read_bytes"`
	LedgerMaxWriteLedgerEntries            uint32              `json:"ledger_max_write_ledger_entries"`
	LedgerMaxWriteBytes                    uint32              `json:"ledger_max_write_bytes"`
	TxMaxReadLedgerEntries                 uint32              `json:"tx_max_read_ledger_entries"`
	TxMaxDiskReadEntries                   uint32              `json:"tx_max_disk_read_entries"`
	TxMaxReadBytes                         uint32              `json:"tx_max_read_bytes"`
	TxMaxDiskReadBytes                     uint32              `json:"tx_max_disk_read_bytes"`
	TxMaxWriteLedgerEntries                uint32              `json:"tx_max_write_ledger_entries"`
	TxMaxWriteBytes                        uint32              `json:"tx_max_write_bytes"`
	FeeReadLedgerEntry                     int64               `json:"fee_read_ledger_entry"`
	FeeDiskReadLedgerEntry                 int64               `json:"fee_disk_read_ledger_entry"`
	FeeWriteLedgerEntry                    int64               `json:"fee_write_ledger_entry"`
	FeeRead1Kb                             int64               `json:"fee_read_1kb"`
	FeeWrite1Kb                            int64               `json:"fee_write_1kb"`
	FeeDiskRead1Kb                         int64               `json:"fee_disk_read_1kb"`
	BucketListTargetSizeBytes              int64               `json:"bucket_list_target_size_bytes"`
	SorobanStateTargetSizeBytes            int64               `json:"soroban_state_target_size_bytes"`
	WriteFee1KbBucketListLow               int64               `json:"write_fee_1kb_bucket_list_low"`
	RentFee1KBSorobanStateSizeLow          int64               `json:"rent_fee_1kb_soroban_state_size_low"`
	WriteFee1KbBucketListHigh              int64               `json:"write_fee_1kb_bucket_list_high"`
	RentFee1KBSorobanStateSizeHigh         int64               `json:"rent_fee_1kb_soroban_state_size_high"`
	BucketListWriteFeeGrowthFactor         uint32              `json:"bucket_list_write_fee_growth_factor"`
	SorobanStateRentFeeGrowthFactor        uint32              `json:"soroban_state_rent_fee_growth_factor"`
	FeeHistorical1Kb                       int64               `json:"fee_historical_1kb"`
	TxMaxContractEventsSizeBytes           uint32              `json:"tx_max_contract_events_size_bytes"`
	FeeContractEvents1Kb                   int64               `json:"fee_contract_events_1kb"`
	LedgerMaxTxsSizeBytes                  uint32              `json:"ledger_max_txs_size_bytes"`
	TxMaxSizeBytes                         uint32              `json:"tx_max_size_bytes"`
	FeeTxSize1Kb                           int64               `json:"fee_tx_size_1kb"`
	ContractCostParamsCpuInsns             []map[string]string `json:"contract_cost_params_cpu_insns"`
	ContractCostParamsMemBytes             []map[string]string `json:"contract_cost_params_mem_bytes"`
	ContractDataKeySizeBytes               uint32              `json:"contract_data_key_size_bytes"`
	ContractDataEntrySizeBytes             uint32              `json:"contract_data_entry_size_bytes"`
	MaxEntryTtl                            uint32              `json:"max_entry_ttl"`
	MinTemporaryTtl                        uint32              `json:"min_temporary_ttl"`
	MinPersistentTtl                       uint32              `json:"min_persistent_ttl"`
	AutoBumpLedgers                        uint32              `json:"auto_bump_ledgers"`
	PersistentRentRateDenominator          int64               `json:"persistent_rent_rate_denominator"`
	TempRentRateDenominator                int64               `json:"temp_rent_rate_denominator"`
	MaxEntriesToArchive                    uint32              `json:"max_entries_to_archive"`
	BucketListSizeWindowSampleSize         uint32              `json:"bucket_list_size_window_sample_size"`
	LiveSorobanStateSizeWindowSampleSize   uint32              `json:"live_soroban_state_size_window_sample_size"`
	LiveSorobanStateSizeWindowSamplePeriod uint32              `json:"live_soroban_state_size_window_sample_period"`
	EvictionScanSize                       uint64              `json:"eviction_scan_size"`
	StartingEvictionScanLevel              uint32              `json:"starting_eviction_scan_level"`
	LedgerMaxTxCount                       uint32              `json:"ledger_max_tx_count"`
	BucketListSizeWindow                   []uint64            `json:"bucket_list_size_window"`
	LiveSorobanStateSizeWindow             []uint64            `json:"live_soroban_state_size_window"`
	// P23 config settings
	LedgerMaxDependentTxClusters           uint32 `json:"ledger_max_dependent_tx_clusters"`
	TxMaxFootprintEntries                  uint32 `json:"tx_max_footprint_entries"`
	LedgerTargetCloseTimeMilliseconds      uint32 `json:"ledger_target_close_time_milliseconds"`
	NominationTimeoutInitialMilliseconds   uint32 `json:"nomination_timeout_initial_milliseconds"`
	NominationTimeoutIncrementMilliseconds uint32 `json:"nomination_timeout_increment_milliseconds"`
	BallotTimeoutInitialMilliseconds       uint32 `json:"ballot_timeout_initial_milliseconds"`
	BallotTimeoutIncrementMilliseconds     uint32 `json:"ballot_timeout_increment_milliseconds"`
	// P26 CAP-77 frozen ledger keys
	FrozenLedgerKeys           []string  `json:"frozen_ledger_keys"`
	FrozenLedgerKeysToFreeze   []string  `json:"frozen_ledger_keys_to_freeze"`
	FrozenLedgerKeysToUnfreeze []string  `json:"frozen_ledger_keys_to_unfreeze"`
	FreezeBypassTxs            []string  `json:"freeze_bypass_txs"`
	FreezeBypassTxsToAdd       []string  `json:"freeze_bypass_txs_to_add"`
	FreezeBypassTxsToRemove    []string  `json:"freeze_bypass_txs_to_remove"`
	LastModifiedLedger         uint32    `json:"last_modified_ledger"`
	LedgerEntryChange          uint32    `json:"ledger_entry_change"`
	Deleted                    bool      `json:"deleted"`
	ClosedAt                   time.Time `json:"closed_at"`
	LedgerSequence             uint32    `json:"ledger_sequence"`
}

ConfigSettingOutput is a representation of soroban config settings that aligns with the Bigquery table config_settings

func TransformConfigSetting

func TransformConfigSetting(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (ConfigSettingOutput, error)

TransformConfigSetting converts an config setting ledger change entry into a form suitable for BigQuery

func (ConfigSettingOutput) ToParquet

func (cso ConfigSettingOutput) ToParquet() interface{}

type ConfigSettingOutputParquet

type ConfigSettingOutputParquet struct {
	ConfigSettingId                        int32   `parquet:"name=config_setting_id, type=INT32"`
	ContractMaxSizeBytes                   int64   `parquet:"name=contract_max_size_bytes, type=INT64, convertedtype=UINT_64"`
	LedgerMaxInstructions                  int64   `parquet:"name=ledger_max_instructions, type=INT64"`
	TxMaxInstructions                      int64   `parquet:"name=tx_max_instructions, type=INT64"`
	FeeRatePerInstructionsIncrement        int64   `parquet:"name=fee_rate_per_instructions_increment, type=INT64"`
	TxMemoryLimit                          int64   `parquet:"name=tx_memory_limit, type=INT64, convertedtype=UINT_64"`
	LedgerMaxReadLedgerEntries             int64   `parquet:"name=ledger_max_read_ledger_entries, type=INT64, convertedtype=UINT_64"`
	LedgerMaxDiskReadEntries               int64   `parquet:"name=ledger_max_disk_read_entries, type=INT64, convertedtype=UINT_64"`
	LedgerMaxReadBytes                     int64   `parquet:"name=ledger_max_read_bytes, type=INT64, convertedtype=UINT_64"`
	LedgerMaxDiskReadBytes                 int64   `parquet:"name=ledger_max_disk_read_bytes, type=INT64, convertedtype=UINT_64"`
	LedgerMaxWriteLedgerEntries            int64   `parquet:"name=ledger_max_write_ledger_entries, type=INT64, convertedtype=UINT_64"`
	LedgerMaxWriteBytes                    int64   `parquet:"name=ledger_max_write_bytes, type=INT64, convertedtype=UINT_64"`
	TxMaxReadLedgerEntries                 int64   `parquet:"name=tx_max_read_ledger_entries, type=INT64, convertedtype=UINT_64"`
	TxMaxDiskReadEntries                   int64   `parquet:"name=tx_max_disk_read_entries, type=INT64, convertedtype=UINT_64"`
	TxMaxReadBytes                         int64   `parquet:"name=tx_max_read_bytes, type=INT64, convertedtype=UINT_64"`
	TxMaxDiskReadBytes                     int64   `parquet:"name=tx_max_disk_read_bytes, type=INT64, convertedtype=UINT_64"`
	TxMaxWriteLedgerEntries                int64   `parquet:"name=tx_max_write_ledger_entries, type=INT64, convertedtype=UINT_64"`
	TxMaxWriteBytes                        int64   `parquet:"name=tx_max_write_bytes, type=INT64, convertedtype=UINT_64"`
	FeeReadLedgerEntry                     int64   `parquet:"name=fee_read_ledger_entry, type=INT64"`
	FeeDiskReadLedgerEntry                 int64   `parquet:"name=fee_disk_read_ledger_entry, type=INT64"`
	FeeWriteLedgerEntry                    int64   `parquet:"name=fee_write_ledger_entry, type=INT64"`
	FeeRead1Kb                             int64   `parquet:"name=fee_read_1kb, type=INT64"`
	FeeWrite1Kb                            int64   `parquet:"name=fee_write_1kb, type=INT64"`
	FeeDiskRead1Kb                         int64   `parquet:"name=fee_disk_read_1kb, type=INT64"`
	BucketListTargetSizeBytes              int64   `parquet:"name=bucket_list_target_size_bytes, type=INT64"`
	SorobanStateTargetSizeBytes            int64   `parquet:"name=soroban_state_target_size_bytes, type=INT64"`
	WriteFee1KbBucketListLow               int64   `parquet:"name=write_fee_1kb_bucket_list_low, type=INT64"`
	RentFee1KBSorobanStateSizeLow          int64   `parquet:"name=rent_fee_1kb_soroban_state_size_low, type=INT64"`
	WriteFee1KbBucketListHigh              int64   `parquet:"name=write_fee_1kb_bucket_list_high, type=INT64"`
	RentFee1KBSorobanStateSizeHigh         int64   `parquet:"name=rent_fee_1kb_soroban_state_size_high, type=INT64"`
	BucketListWriteFeeGrowthFactor         int64   `parquet:"name=bucket_list_write_fee_growth_factor, type=INT64, convertedtype=UINT_64"`
	SorobanStateRentFeeGrowthFactor        int64   `parquet:"name=soroban_state_rent_fee_growth_factor, type=INT64, convertedtype=UINT_64"`
	FeeHistorical1Kb                       int64   `parquet:"name=fee_historical_1kb, type=INT64"`
	TxMaxContractEventsSizeBytes           int64   `parquet:"name=tx_max_contract_events_size_bytes, type=INT64, convertedtype=UINT_64"`
	FeeContractEvents1Kb                   int64   `parquet:"name=fee_contract_events_1kb, type=INT64"`
	LedgerMaxTxsSizeBytes                  int64   `parquet:"name=ledger_max_txs_size_bytes, type=INT64, convertedtype=UINT_64"`
	TxMaxSizeBytes                         int64   `parquet:"name=tx_max_size_bytes, type=INT64, convertedtype=UINT_64"`
	FeeTxSize1Kb                           int64   `parquet:"name=fee_tx_size_1kb, type=INT64"`
	ContractCostParamsCpuInsns             string  `parquet:"name=contract_cost_params_cpu_insns, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractCostParamsMemBytes             string  `parquet:"name=contract_cost_params_mem_bytes, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractDataKeySizeBytes               int64   `parquet:"name=contract_data_key_size_bytes, type=INT64, convertedtype=UINT_64"`
	ContractDataEntrySizeBytes             int64   `parquet:"name=contract_data_entry_size_bytes, type=INT64, convertedtype=UINT_64"`
	MaxEntryTtl                            int64   `parquet:"name=max_entry_ttl, type=INT64, convertedtype=UINT_64"`
	MinTemporaryTtl                        int64   `parquet:"name=min_temporary_ttl, type=INT64, convertedtype=UINT_64"`
	MinPersistentTtl                       int64   `parquet:"name=min_persistent_ttl, type=INT64, convertedtype=UINT_64"`
	AutoBumpLedgers                        int64   `parquet:"name=auto_bump_ledgers, type=INT64, convertedtype=UINT_64"`
	PersistentRentRateDenominator          int64   `parquet:"name=persistent_rent_rate_denominator, type=INT64"`
	TempRentRateDenominator                int64   `parquet:"name=temp_rent_rate_denominator, type=INT64"`
	MaxEntriesToArchive                    int64   `parquet:"name=max_entries_to_archive, type=INT64, convertedtype=UINT_64"`
	BucketListSizeWindowSampleSize         int64   `parquet:"name=bucket_list_size_window_sample_size, type=INT64, convertedtype=UINT_64"`
	LiveSorobanStateSizeWindowSampleSize   int64   `parquet:"name=live_soroban_state_size_window_sample_size, type=INT64, convertedtype=UINT_64"`
	LiveSorobanStateSizeWindowSamplePeriod int64   `parquet:"name=live_soroban_state_size_window_sample_period, type=INT64, convertedtype=UINT_64"`
	EvictionScanSize                       int64   `parquet:"name=eviction_scan_size, type=INT64"`
	StartingEvictionScanLevel              int64   `parquet:"name=starting_eviction_scan_level, type=INT64, convertedtype=UINT_64"`
	LedgerMaxTxCount                       int64   `parquet:"name=ledger_max_tx_count, type=INT64, convertedtype=UINT_64"`
	BucketListSizeWindow                   []int64 `parquet:"name=bucket_list_size_window, type=INT64, repetitiontype=REPEATED"`
	LiveSorobanStateSizeWindow             []int64 `parquet:"name=live_soroban_state_size_window, type=INT64, repetitiontype=REPEATED"`
	// P23 config settings
	LedgerMaxDependentTxClusters           int64 `parquet:"name=ledger_max_dependent_tx_clusters, type=INT64, convertedtype=UINT_64"`
	TxMaxFootprintEntries                  int64 `parquet:"name=tx_max_footprint_entries, type=INT64, convertedtype=UINT_64"`
	LedgerTargetCloseTimeMilliseconds      int64 `parquet:"name=ledger_target_close_time_milliseconds, type=INT64, convertedtype=UINT_64"`
	NominationTimeoutInitialMilliseconds   int64 `parquet:"name=nomination_timeout_initial_milliseconds, type=INT64, convertedtype=UINT_64"`
	NominationTimeoutIncrementMilliseconds int64 `parquet:"name=nomination_timeout_increment_milliseconds, type=INT64, convertedtype=UINT_64"`
	BallotTimeoutInitialMilliseconds       int64 `parquet:"name=ballot_timeout_initial_milliseconds, type=INT64, convertedtype=UINT_64"`
	BallotTimeoutIncrementMilliseconds     int64 `parquet:"name=ballot_timeout_increment_milliseconds, type=INT64, convertedtype=UINT_64"`
	// P26 CAP-77 frozen ledger keys
	FrozenLedgerKeys           string `parquet:"name=frozen_ledger_keys, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	FrozenLedgerKeysToFreeze   string `parquet:"name=frozen_ledger_keys_to_freeze, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	FrozenLedgerKeysToUnfreeze string `parquet:"name=frozen_ledger_keys_to_unfreeze, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	FreezeBypassTxs            string `parquet:"name=freeze_bypass_txs, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	FreezeBypassTxsToAdd       string `parquet:"name=freeze_bypass_txs_to_add, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	FreezeBypassTxsToRemove    string `parquet:"name=freeze_bypass_txs_to_remove, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LastModifiedLedger         int64  `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange          int64  `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Deleted                    bool   `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt                   int64  `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence             int64  `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
}

ConfigSettingOutputParquet is a representation of soroban config settings that aligns with the Bigquery table config_settings

type ContractBalanceFromContractDataFunc

type ContractBalanceFromContractDataFunc func(ledgerEntry xdr.LedgerEntry, passphrase string) ([32]byte, *big.Int, bool)

type ContractCodeOutput

type ContractCodeOutput struct {
	ContractCodeHash   string    `json:"contract_code_hash"`
	ContractCodeExtV   int32     `json:"contract_code_ext_v"`
	LastModifiedLedger uint32    `json:"last_modified_ledger"`
	LedgerEntryChange  uint32    `json:"ledger_entry_change"`
	Deleted            bool      `json:"deleted"`
	ClosedAt           time.Time `json:"closed_at"`
	LedgerSequence     uint32    `json:"ledger_sequence"`
	LedgerKeyHash      string    `json:"ledger_key_hash"`
	//ContractCodeCode                string `json:"contract_code"`
	NInstructions       uint32 `json:"n_instructions"`
	NFunctions          uint32 `json:"n_functions"`
	NGlobals            uint32 `json:"n_globals"`
	NTableEntries       uint32 `json:"n_table_entries"`
	NTypes              uint32 `json:"n_types"`
	NDataSegments       uint32 `json:"n_data_segments"`
	NElemSegments       uint32 `json:"n_elem_segments"`
	NImports            uint32 `json:"n_imports"`
	NExports            uint32 `json:"n_exports"`
	NDataSegmentBytes   uint32 `json:"n_data_segment_bytes"`
	LedgerKeyHashBase64 string `json:"ledger_key_hash_base_64"`
}

ContractCodeOutput is a representation of contract code that aligns with the Bigquery table soroban_contract_code

func TransformContractCode

func TransformContractCode(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (ContractCodeOutput, error)

TransformContractCode converts a contract code ledger change entry into a form suitable for BigQuery

func (ContractCodeOutput) ToParquet

func (cco ContractCodeOutput) ToParquet() interface{}

type ContractCodeOutputParquet

type ContractCodeOutputParquet struct {
	ContractCodeHash   string `parquet:"name=contract_code_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractCodeExtV   int32  `parquet:"name=contract_code_ext_v, type=INT32"`
	LastModifiedLedger int64  `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange  int64  `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Deleted            bool   `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt           int64  `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence     int64  `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
	LedgerKeyHash      string `parquet:"name=ledger_key_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	NInstructions      int64  `parquet:"name=n_instructions, type=INT64, convertedtype=UINT_64"`
	NFunctions         int64  `parquet:"name=n_functions, type=INT64, convertedtype=UINT_64"`
	NGlobals           int64  `parquet:"name=n_globals, type=INT64, convertedtype=UINT_64"`
	NTableEntries      int64  `parquet:"name=n_table_entries, type=INT64, convertedtype=UINT_64"`
	NTypes             int64  `parquet:"name=n_types, type=INT64, convertedtype=UINT_64"`
	NDataSegments      int64  `parquet:"name=n_data_segments, type=INT64, convertedtype=UINT_64"`
	NElemSegments      int64  `parquet:"name=n_elem_segments, type=INT64, convertedtype=UINT_64"`
	NImports           int64  `parquet:"name=n_imports, type=INT64, convertedtype=UINT_64"`
	NExports           int64  `parquet:"name=n_exports, type=INT64, convertedtype=UINT_64"`
	NDataSegmentBytes  int64  `parquet:"name=n_data_segment_bytes, type=INT64, convertedtype=UINT_64"`
}

ContractCodeOutputParquet is a representation of contract code that aligns with the Bigquery table soroban_contract_code

type ContractDataOutput

type ContractDataOutput struct {
	ContractId                string      `json:"contract_id"`
	ContractKeyType           string      `json:"contract_key_type"`
	ContractDurability        string      `json:"contract_durability"`
	ContractDataAssetCode     string      `json:"asset_code"`
	ContractDataAssetIssuer   string      `json:"asset_issuer"`
	ContractDataAssetType     string      `json:"asset_type"`
	ContractDataBalanceHolder string      `json:"balance_holder"`
	ContractDataBalance       string      `json:"balance"` // balance is a string because it is go type big.Int
	LastModifiedLedger        uint32      `json:"last_modified_ledger"`
	LedgerEntryChange         uint32      `json:"ledger_entry_change"`
	Deleted                   bool        `json:"deleted"`
	ClosedAt                  time.Time   `json:"closed_at"`
	LedgerSequence            uint32      `json:"ledger_sequence"`
	LedgerKeyHash             string      `json:"ledger_key_hash"`
	Key                       interface{} `json:"key"`
	KeyDecoded                interface{} `json:"key_decoded"`
	Val                       interface{} `json:"val"`
	ValDecoded                interface{} `json:"val_decoded"`
	ContractDataXDR           string      `json:"contract_data_xdr"`
	LedgerKeyHashBase64       string      `json:"ledger_key_hash_base_64"`
}

ContractDataOutput is a representation of contract data that aligns with the Bigquery table soroban_contract_data

func (ContractDataOutput) ToParquet

func (cdo ContractDataOutput) ToParquet() interface{}

type ContractDataOutputParquet

type ContractDataOutputParquet struct {
	ContractId                string      `parquet:"name=contract_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractKeyType           string      `parquet:"name=contract_key_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractDurability        string      `parquet:"name=contract_durability, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractDataAssetCode     string      `parquet:"name=asset_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractDataAssetIssuer   string      `parquet:"name=asset_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractDataAssetType     string      `parquet:"name=asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractDataBalanceHolder string      `parquet:"name=balance_holder, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractDataBalance       string      `parquet:"name=balance, type=BYTE_ARRAY, convertedtype=UTF8"`
	LastModifiedLedger        int64       `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange         int64       `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Deleted                   bool        `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt                  int64       `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence            int64       `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
	LedgerKeyHash             string      `parquet:"name=ledger_key_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Key                       interface{} `parquet:"name=key, type=MAP, convertedtype=MAP, keytype=BYTE_ARRAY, keyconvertedtype=UTF8, valuetype=STRING"`
	KeyDecoded                interface{} `parquet:"name=key_decoded, type=MAP, convertedtype=MAP, keytype=BYTE_ARRAY, keyconvertedtype=UTF8, valuetype=STRING"`
	Val                       interface{} `parquet:"name=val, type=MAP, convertedtype=MAP, keytype=BYTE_ARRAY, keyconvertedtype=UTF8, valuetype=STRING"`
	ValDecoded                interface{} `parquet:"name=val_decoded, type=MAP, convertedtype=MAP, keytype=BYTE_ARRAY, keyconvertedtype=UTF8, valuetype=STRING"`
	ContractDataXDR           string      `parquet:"name=contract_data_xdr, type=BYTE_ARRAY, convertedtype=UTF8"`
}

ContractDataOutputParquet is a representation of contract data that aligns with the Bigquery table soroban_contract_data

type ContractEventOutput

type ContractEventOutput struct {
	TransactionHash          string        `json:"transaction_hash"`
	TransactionID            int64         `json:"transaction_id"`
	Successful               bool          `json:"successful"`
	LedgerSequence           uint32        `json:"ledger_sequence"`
	ClosedAt                 time.Time     `json:"closed_at"`
	InSuccessfulContractCall bool          `json:"in_successful_contract_call"`
	ContractId               string        `json:"contract_id"`
	Type                     int32         `json:"type"`
	TypeString               string        `json:"type_string"`
	Topics                   []interface{} `json:"topics"`
	TopicsDecoded            []interface{} `json:"topics_decoded"`
	Data                     interface{}   `json:"data"`
	DataDecoded              interface{}   `json:"data_decoded"`
	ContractEventXDR         string        `json:"contract_event_xdr"`
	OperationID              null.Int      `json:"operation_id"`
}

ContractEventOutput is a representation of soroban contract events and diagnostic events

func TransformContractEvent

func TransformContractEvent(transaction ingest.LedgerTransaction, lhe xdr.LedgerHeaderHistoryEntry) ([]ContractEventOutput, error)

TransformContractEvent converts a transaction's contract events and diagnostic events into a form suitable for BigQuery. It is known that contract events are a subset of the diagnostic events XDR definition. We are opting to call all of these events contract events for better clarity to data analytics users.

func (ContractEventOutput) ToParquet

func (ceo ContractEventOutput) ToParquet() interface{}

type ContractEventOutputParquet

type ContractEventOutputParquet struct {
	TransactionHash          string        `parquet:"name=transaction_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TransactionID            int64         `parquet:"name=transaction_id, type=INT64"`
	Successful               bool          `parquet:"name=successful, type=BOOLEAN"`
	LedgerSequence           int64         `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
	ClosedAt                 int64         `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	InSuccessfulContractCall bool          `parquet:"name=in_successful_contract_call, type=BOOLEAN"`
	ContractId               string        `parquet:"name=contract_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Type                     int32         `parquet:"name=type, type=INT32"`
	TypeString               string        `parquet:"name=type_string, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Topics                   []interface{} `parquet:"name=topics, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TopicsDecoded            []interface{} `parquet:"name=topics_decoded, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Data                     interface{}   `parquet:"name=data, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	DataDecoded              interface{}   `parquet:"name=data_decoded, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ContractEventXDR         string        `parquet:"name=contract_event_xdr, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	OperationID              int64         `parquet:"name=operation_id, type=INT64"`
}

ContractEventOutputParquet is a representation of soroban contract events and diagnostic events

type DimAccount

type DimAccount struct {
	ID      uint64 `json:"account_id"`
	Address string `json:"address"`
}

DimAccount is a representation of an account that aligns with the BigQuery table dim_accounts

type DimMarket

type DimMarket struct {
	ID            uint64 `json:"market_id"`
	BaseCode      string `json:"base_code"`
	BaseIssuer    string `json:"base_issuer"`
	CounterCode   string `json:"counter_code"`
	CounterIssuer string `json:"counter_issuer"`
}

DimMarket is a representation of an account that aligns with the BigQuery table dim_markets

type DimOffer

type DimOffer struct {
	HorizonID     int64   `json:"horizon_offer_id"`
	DimOfferID    uint64  `json:"dim_offer_id"`
	MarketID      uint64  `json:"market_id"`
	MakerID       uint64  `json:"maker_id"`
	Action        string  `json:"action"`
	BaseAmount    float64 `json:"base_amount"`
	CounterAmount float64 `json:"counter_amount"`
	Price         float64 `json:"price"`
}

DimOffer is a representation of an account that aligns with the BigQuery table dim_offers

type EffectOutput

type EffectOutput struct {
	Address        string                 `json:"address"`
	AddressMuxed   null.String            `json:"address_muxed,omitempty"`
	OperationID    int64                  `json:"operation_id"`
	Details        map[string]interface{} `json:"details"`
	Type           int32                  `json:"type"`
	TypeString     string                 `json:"type_string"`
	LedgerClosed   time.Time              `json:"closed_at"`
	LedgerSequence uint32                 `json:"ledger_sequence"`
	EffectIndex    uint32                 `json:"index"`
	EffectId       string                 `json:"id"`
}

EffectOutput is a representation of an operation that aligns with the BigQuery table history_effects

func TransformEffect

func TransformEffect(transaction ingest.LedgerTransaction, ledgerSeq uint32, ledgerCloseMeta xdr.LedgerCloseMeta, networkPassphrase string) ([]EffectOutput, error)

func (EffectOutput) ToParquet

func (eo EffectOutput) ToParquet() interface{}

type EffectOutputParquet

type EffectOutputParquet struct {
	Address        string `parquet:"name=address, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AddressMuxed   string `parquet:"name=address_muxed, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	OperationID    int64  `parquet:"name=operation_id, type=INT64"`
	Details        string `parquet:"name=details, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Type           int32  `parquet:"name=type, type=INT32"`
	TypeString     string `parquet:"name=type_string, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LedgerClosed   int64  `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence int64  `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
	EffectIndex    int64  `parquet:"name=index, type=INT64, convertedtype=UINT_64"`
	EffectId       string `parquet:"name=id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
}

EffectOutputParquet is a representation of an operation that aligns with the BigQuery table history_effects

type EffectType

type EffectType int

EffectType is the numeric type for an effect

const (
	EffectAccountCreated                     EffectType = 0
	EffectAccountRemoved                     EffectType = 1
	EffectAccountCredited                    EffectType = 2
	EffectAccountDebited                     EffectType = 3
	EffectAccountThresholdsUpdated           EffectType = 4
	EffectAccountHomeDomainUpdated           EffectType = 5
	EffectAccountFlagsUpdated                EffectType = 6
	EffectAccountInflationDestinationUpdated EffectType = 7
	EffectSignerCreated                      EffectType = 10
	EffectSignerRemoved                      EffectType = 11
	EffectSignerUpdated                      EffectType = 12
	EffectTrustlineCreated                   EffectType = 20
	EffectTrustlineRemoved                   EffectType = 21
	EffectTrustlineUpdated                   EffectType = 22
	EffectTrustlineFlagsUpdated              EffectType = 26
	EffectOfferCreated                       EffectType = 30
	EffectOfferRemoved                       EffectType = 31
	EffectOfferUpdated                       EffectType = 32
	EffectTrade                              EffectType = 33
	EffectDataCreated                        EffectType = 40
	EffectDataRemoved                        EffectType = 41
	EffectDataUpdated                        EffectType = 42
	EffectSequenceBumped                     EffectType = 43
	EffectClaimableBalanceCreated            EffectType = 50
	EffectClaimableBalanceClaimantCreated    EffectType = 51
	EffectClaimableBalanceClaimed            EffectType = 52
	EffectAccountSponsorshipCreated          EffectType = 60
	EffectAccountSponsorshipUpdated          EffectType = 61
	EffectAccountSponsorshipRemoved          EffectType = 62
	EffectTrustlineSponsorshipCreated        EffectType = 63
	EffectTrustlineSponsorshipUpdated        EffectType = 64
	EffectTrustlineSponsorshipRemoved        EffectType = 65
	EffectDataSponsorshipCreated             EffectType = 66
	EffectDataSponsorshipUpdated             EffectType = 67
	EffectDataSponsorshipRemoved             EffectType = 68
	EffectClaimableBalanceSponsorshipCreated EffectType = 69
	EffectClaimableBalanceSponsorshipUpdated EffectType = 70
	EffectClaimableBalanceSponsorshipRemoved EffectType = 71
	EffectSignerSponsorshipCreated           EffectType = 72
	EffectSignerSponsorshipUpdated           EffectType = 73
	EffectSignerSponsorshipRemoved           EffectType = 74
	EffectClaimableBalanceClawedBack         EffectType = 80
	EffectLiquidityPoolDeposited             EffectType = 90
	EffectLiquidityPoolWithdrew              EffectType = 91
	EffectLiquidityPoolTrade                 EffectType = 92
	EffectLiquidityPoolCreated               EffectType = 93
	EffectLiquidityPoolRemoved               EffectType = 94
	EffectLiquidityPoolRevoked               EffectType = 95
	EffectContractCredited                   EffectType = 96
	EffectContractDebited                    EffectType = 97
	EffectExtendFootprintTtl                 EffectType = 98
	EffectRestoreFootprint                   EffectType = 99
)

type FactOfferEvent

type FactOfferEvent struct {
	LedgerSeq       uint32 `json:"ledger_id"`
	OfferInstanceID uint64 `json:"offer_instance_id"`
}

FactOfferEvent is a representation of an offer event that aligns with the BigQuery table fact_offer_events

type LedgerOutput

type LedgerOutput struct {
	Sequence                        uint32    `json:"sequence"` // sequence number of the ledger
	LedgerHash                      string    `json:"ledger_hash"`
	PreviousLedgerHash              string    `json:"previous_ledger_hash"`
	LedgerHeader                    string    `json:"ledger_header"` // base 64 encoding of the ledger header
	TransactionCount                int32     `json:"transaction_count"`
	OperationCount                  int32     `json:"operation_count"` // counts only operations that were a part of successful transactions
	SuccessfulTransactionCount      int32     `json:"successful_transaction_count"`
	FailedTransactionCount          int32     `json:"failed_transaction_count"`
	TxSetOperationCount             string    `json:"tx_set_operation_count"` // counts all operations, even those that are part of failed transactions
	ClosedAt                        time.Time `json:"closed_at"`              // UTC timestamp
	TotalCoins                      int64     `json:"total_coins"`
	FeePool                         int64     `json:"fee_pool"`
	BaseFee                         uint32    `json:"base_fee"`
	BaseReserve                     uint32    `json:"base_reserve"`
	MaxTxSetSize                    uint32    `json:"max_tx_set_size"`
	ProtocolVersion                 uint32    `json:"protocol_version"`
	LedgerID                        int64     `json:"id"`
	SorobanFeeWrite1Kb              int64     `json:"soroban_fee_write_1kb"`
	NodeID                          string    `json:"node_id"`
	Signature                       string    `json:"signature"`
	TotalByteSizeOfBucketList       uint64    `json:"total_byte_size_of_bucket_list"`
	TotalByteSizeOfLiveSorobanState uint64    `json:"total_byte_size_of_live_soroban_state"`
	EvictedLedgerKeysType           []string  `json:"evicted_ledger_keys_type"`
	EvictedLedgerKeysHash           []string  `json:"evicted_ledger_keys_hash"`
}

LedgerOutput is a representation of a ledger that aligns with the BigQuery table history_ledgers

func TransformLedger

func TransformLedger(inputLedger historyarchive.Ledger, lcm xdr.LedgerCloseMeta) (LedgerOutput, error)

TransformLedger converts a ledger from the history archive ingestion system into a form suitable for BigQuery

func (LedgerOutput) ToParquet

func (lo LedgerOutput) ToParquet() interface{}

type LedgerOutputParquet

type LedgerOutputParquet struct {
	Sequence                        int64    `parquet:"name=sequence, type=INT64, convertedtype=UINT_64"`
	LedgerHash                      string   `parquet:"name=ledger_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	PreviousLedgerHash              string   `parquet:"name=previous_ledger_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LedgerHeader                    string   `parquet:"name=ledger_header, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TransactionCount                int32    `parquet:"name=transaction_count, type=INT32"`
	OperationCount                  int32    `parquet:"name=operation_count, type=INT32"`
	SuccessfulTransactionCount      int32    `parquet:"name=successful_transaction_count, type=INT32"`
	FailedTransactionCount          int32    `parquet:"name=failed_transaction_count, type=INT32"`
	TxSetOperationCount             string   `parquet:"name=tx_set_operation_count, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ClosedAt                        int64    `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	TotalCoins                      int64    `parquet:"name=total_coins, type=INT64"`
	FeePool                         int64    `parquet:"name=fee_pool, type=INT64"`
	BaseFee                         int64    `parquet:"name=base_fee, type=INT64, convertedtype=UINT_64"`
	BaseReserve                     int64    `parquet:"name=base_reserve, type=INT64, convertedtype=UINT_64"`
	MaxTxSetSize                    int64    `parquet:"name=max_tx_set_size, type=INT64, convertedtype=UINT_64"`
	ProtocolVersion                 int64    `parquet:"name=protocol_version, type=INT64, convertedtype=UINT_64"`
	LedgerID                        int64    `parquet:"name=id, type=INT64"`
	SorobanFeeWrite1Kb              int64    `parquet:"name=soroban_fee_write_1kb, type=INT64"`
	NodeID                          string   `parquet:"name=node_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Signature                       string   `parquet:"name=signature, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TotalByteSizeOfBucketList       int64    `parquet:"name=total_byte_size_of_bucket_list, type=INT64, convertedtype=UINT_64"`
	TotalByteSizeOfLiveSorobanState int64    `parquet:"name=total_byte_size_of_live_soroban_state, type=INT64, convertedtype=UINT_64"`
	EvictedLedgerKeysType           []string `parquet:"name=evicted_ledger_keys_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	EvictedLedgerKeysHash           []string `parquet:"name=evicted_ledger_keys_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
}

LedgerOutputParquet is a representation of a ledger that aligns with the BigQuery table history_ledgers

type LedgerTransactionOutput

type LedgerTransactionOutput struct {
	LedgerSequence  uint32    `json:"ledger_sequence"`
	TxEnvelope      string    `json:"tx_envelope"`
	TxResult        string    `json:"tx_result"`
	TxMeta          string    `json:"tx_meta"`
	TxFeeMeta       string    `json:"tx_fee_meta"`
	TxLedgerHistory string    `json:"tx_ledger_history"`
	ClosedAt        time.Time `json:"closed_at"`
}

func TransformLedgerTransaction

func TransformLedgerTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHeaderHistoryEntry) (LedgerTransactionOutput, error)

TransformTransaction converts a transaction from the history archive ingestion system into a form suitable for BigQuery

type LiquidityPoolAsset

type LiquidityPoolAsset struct {
	AssetAType   string
	AssetACode   string
	AssetAIssuer string
	AssetAAmount float64
	AssetBType   string
	AssetBCode   string
	AssetBIssuer string
	AssetBAmount float64
}

LiquidityPoolAsset represents the asset pairs in a liquidity pool

type NormalizedOfferOutput

type NormalizedOfferOutput struct {
	Market  DimMarket
	Offer   DimOffer
	Account DimAccount
	Event   FactOfferEvent
}

NormalizedOfferOutput ties together the information for dim_markets, dim_offers, dim_accounts, and fact_offer-events

func TransformOfferNormalized

func TransformOfferNormalized(ledgerChange ingest.Change, ledgerSeq uint32) (NormalizedOfferOutput, error)

TransformOfferNormalized converts an offer into a normalized form, allowing it to be stored as part of the historical orderbook dataset

type OfferOutput

type OfferOutput struct {
	SellerID           string      `json:"seller_id"` // Account address of the seller
	OfferID            int64       `json:"offer_id"`
	SellingAssetType   string      `json:"selling_asset_type"`
	SellingAssetCode   string      `json:"selling_asset_code"`
	SellingAssetIssuer string      `json:"selling_asset_issuer"`
	SellingAssetID     int64       `json:"selling_asset_id"`
	BuyingAssetType    string      `json:"buying_asset_type"`
	BuyingAssetCode    string      `json:"buying_asset_code"`
	BuyingAssetIssuer  string      `json:"buying_asset_issuer"`
	BuyingAssetID      int64       `json:"buying_asset_id"`
	Amount             float64     `json:"amount"`
	PriceN             int32       `json:"pricen"`
	PriceD             int32       `json:"priced"`
	Price              float64     `json:"price"`
	Flags              uint32      `json:"flags"`
	LastModifiedLedger uint32      `json:"last_modified_ledger"`
	LedgerEntryChange  uint32      `json:"ledger_entry_change"`
	Deleted            bool        `json:"deleted"`
	Sponsor            null.String `json:"sponsor"`
	ClosedAt           time.Time   `json:"closed_at"`
	LedgerSequence     uint32      `json:"ledger_sequence"`
}

OfferOutput is a representation of an offer that aligns with the BigQuery table offers

func TransformOffer

func TransformOffer(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (OfferOutput, error)

TransformOffer converts an account from the history archive ingestion system into a form suitable for BigQuery

func (OfferOutput) ToParquet

func (oo OfferOutput) ToParquet() interface{}

type OfferOutputParquet

type OfferOutputParquet struct {
	SellerID           string  `parquet:"name=seller_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	OfferID            int64   `parquet:"name=offer_id, type=INT64"`
	SellingAssetType   string  `parquet:"name=selling_asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SellingAssetCode   string  `parquet:"name=selling_asset_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SellingAssetIssuer string  `parquet:"name=selling_asset_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SellingAssetID     int64   `parquet:"name=selling_asset_id, type=INT64"`
	BuyingAssetType    string  `parquet:"name=buying_asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingAssetCode    string  `parquet:"name=buying_asset_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingAssetIssuer  string  `parquet:"name=buying_asset_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingAssetID      int64   `parquet:"name=buying_asset_id, type=INT64"`
	Amount             float64 `parquet:"name=amount, type=DOUBLE"`
	PriceN             int32   `parquet:"name=pricen, type=INT32"`
	PriceD             int32   `parquet:"name=priced, type=INT32"`
	Price              float64 `parquet:"name=price, type=DOUBLE"`
	Flags              int64   `parquet:"name=flags, type=INT64, convertedtype=UINT_64"`
	LastModifiedLedger int64   `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange  int64   `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Deleted            bool    `parquet:"name=deleted, type=BOOLEAN"`
	Sponsor            string  `parquet:"name=sponsor, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	ClosedAt           int64   `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence     int64   `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
}

OfferOutputParquet is a representation of an offer that aligns with the BigQuery table offers

type OperationOutput

type OperationOutput struct {
	SourceAccount        string                 `json:"source_account"`
	SourceAccountMuxed   string                 `json:"source_account_muxed,omitempty"`
	Type                 int32                  `json:"type"`
	TypeString           string                 `json:"type_string"`
	OperationDetails     map[string]interface{} `json:"details"` //Details is a JSON object that varies based on operation type
	TransactionID        int64                  `json:"transaction_id"`
	OperationID          int64                  `json:"id"`
	ClosedAt             time.Time              `json:"closed_at"`
	OperationResultCode  string                 `json:"operation_result_code"`
	OperationTraceCode   string                 `json:"operation_trace_code"`
	LedgerSequence       uint32                 `json:"ledger_sequence"`
	OperationDetailsJSON map[string]interface{} `json:"details_json"`
}

OperationOutput is a representation of an operation that aligns with the BigQuery table history_operations

func TransformOperation

func TransformOperation(operation xdr.Operation, operationIndex int32, transaction ingest.LedgerTransaction, ledgerSeq int32, ledgerCloseMeta xdr.LedgerCloseMeta, network string) (OperationOutput, error)

TransformOperation converts an operation from the history archive ingestion system into a form suitable for BigQuery

func (OperationOutput) ToParquet

func (oo OperationOutput) ToParquet() interface{}

type OperationOutputParquet

type OperationOutputParquet struct {
	SourceAccount       string `parquet:"name=source_account, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SourceAccountMuxed  string `parquet:"name=source_account_muxed, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Type                int32  `parquet:"name=type, type=INT32"`
	TypeString          string `parquet:"name=type_string, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	OperationDetails    string `parquet:"name=details, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TransactionID       int64  `parquet:"name=transaction_id, type=INT64"`
	OperationID         int64  `parquet:"name=id, type=INT64"`
	ClosedAt            int64  `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	OperationResultCode string `parquet:"name=operation_result_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	OperationTraceCode  string `parquet:"name=operation_trace_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LedgerSequence      int64  `parquet:"name=ledger_sequence, type=INT64, convertedtype=INT64, convertedtype=UINT_64"`
}

OperationOutputParquet is a representation of an operation that aligns with the BigQuery table history_operations

type Path

type Path struct {
	AssetCode   string `json:"asset_code"`
	AssetIssuer string `json:"asset_issuer"`
	AssetType   string `json:"asset_type"`
}

Path is a representation of an asset without an ID that forms part of a path in a path payment

type PoolOutput

type PoolOutput struct {
	PoolID             string    `json:"liquidity_pool_id"`
	PoolType           string    `json:"type"`
	PoolFee            uint32    `json:"fee"`
	TrustlineCount     uint64    `json:"trustline_count"`
	PoolShareCount     float64   `json:"pool_share_count"`
	AssetAType         string    `json:"asset_a_type"`
	AssetACode         string    `json:"asset_a_code"`
	AssetAIssuer       string    `json:"asset_a_issuer"`
	AssetAReserve      float64   `json:"asset_a_amount"`
	AssetAID           int64     `json:"asset_a_id"`
	AssetBType         string    `json:"asset_b_type"`
	AssetBCode         string    `json:"asset_b_code"`
	AssetBIssuer       string    `json:"asset_b_issuer"`
	AssetBReserve      float64   `json:"asset_b_amount"`
	AssetBID           int64     `json:"asset_b_id"`
	LastModifiedLedger uint32    `json:"last_modified_ledger"`
	LedgerEntryChange  uint32    `json:"ledger_entry_change"`
	Deleted            bool      `json:"deleted"`
	ClosedAt           time.Time `json:"closed_at"`
	LedgerSequence     uint32    `json:"ledger_sequence"`
	PoolIDStrkey       string    `json:"liquidity_pool_id_strkey"`
}

PoolOutput is a representation of a liquidity pool that aligns with the Bigquery table liquidity_pools

func TransformPool

func TransformPool(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (PoolOutput, error)

TransformPool converts an liquidity pool ledger change entry into a form suitable for BigQuery

func (PoolOutput) ToParquet

func (po PoolOutput) ToParquet() interface{}

type PoolOutputParquet

type PoolOutputParquet struct {
	PoolID             string  `parquet:"name=liquidity_pool_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	PoolType           string  `parquet:"name=type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	PoolFee            int64   `parquet:"name=fee, type=INT64, convertedtype=UINT_64"`
	TrustlineCount     int64   `parquet:"name=trustline_count, type=INT64, convertedtype=UINT_64"`
	PoolShareCount     float64 `parquet:"name=pool_share_count, type=DOUBLE"`
	AssetAType         string  `parquet:"name=asset_a_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetACode         string  `parquet:"name=asset_a_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetAIssuer       string  `parquet:"name=asset_a_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetAReserve      float64 `parquet:"name=asset_a_amount, type=DOUBLE"`
	AssetAID           int64   `parquet:"name=asset_a_id, type=INT64"`
	AssetBType         string  `parquet:"name=asset_b_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetBCode         string  `parquet:"name=asset_b_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetBIssuer       string  `parquet:"name=asset_b_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetBReserve      float64 `parquet:"name=asset_b_amount, type=DOUBLE"`
	AssetBID           int64   `parquet:"name=asset_b_id, type=INT64"`
	LastModifiedLedger int64   `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange  int64   `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Deleted            bool    `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt           int64   `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence     int64   `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
}

PoolOutputParquet is a representation of a liquidity pool that aligns with the Bigquery table liquidity_pools

type Price

type Price struct {
	Numerator   int32 `json:"n"`
	Denominator int32 `json:"d"`
}

Price represents the price of an asset as a fraction

type RestoredKeyOutput added in v2.8.5

type RestoredKeyOutput struct {
	LedgerKeyHash      string    `json:"ledger_key_hash"`
	LedgerEntryType    string    `json:"ledger_entry_type"`
	LastModifiedLedger uint32    `json:"last_modified_ledger"`
	ClosedAt           time.Time `json:"closed_at"`
	LedgerSequence     uint32    `json:"ledger_sequence"`
}

RestoredKeyOutput is a representation of a restored key that aligns with the BigQuery table restored_key

func TransformRestoredKey added in v2.8.5

func TransformRestoredKey(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (RestoredKeyOutput, error)

TransformRestoredKey fetches keyhash from restored ledger change entry into a form suitable for BigQuery

type SchemaParquet

type SchemaParquet interface {
	ToParquet() interface{}
}

type SponsorshipOutput

type SponsorshipOutput struct {
	Operation      xdr.Operation
	OperationIndex uint32
}

type TestTransaction

type TestTransaction struct {
	Index         uint32
	EnvelopeXDR   string
	ResultXDR     string
	FeeChangesXDR string
	MetaXDR       string
	Hash          string
}

TestTransaction transaction meta

type TokenTransferOutput

type TokenTransferOutput struct {
	TransactionHash string      `json:"transaction_hash"`
	TransactionID   int64       `json:"transaction_id"`
	OperationID     null.Int    `json:"operation_id"`
	EventTopic      string      `json:"event_topic"`
	From            null.String `json:"from"`
	To              null.String `json:"to"`
	Asset           string      `json:"asset"`
	AssetType       string      `json:"asset_type"`
	AssetCode       null.String `json:"asset_code"`
	AssetIssuer     null.String `json:"asset_issuer"`
	Amount          float64     `json:"amount"`
	AmountRaw       string      `json:"amount_raw"`
	ContractID      string      `json:"contract_id"`
	LedgerSequence  uint32      `json:"ledger_sequence"`
	ClosedAt        time.Time   `json:"closed_at"`
	ToMuxed         null.String `json:"to_muxed"`
	ToMuxedID       null.String `json:"to_muxed_id"`
}

func TransformTokenTransfer

func TransformTokenTransfer(ledgerCloseMeta xdr.LedgerCloseMeta, networkPassphrase string) ([]TokenTransferOutput, error)

type TradeEffectDetails

type TradeEffectDetails struct {
	Seller            string `json:"seller"`
	SellerMuxed       string `json:"seller_muxed,omitempty"`
	SellerMuxedID     uint64 `json:"seller_muxed_id,omitempty"`
	OfferID           int64  `json:"offer_id"`
	SoldAmount        string `json:"sold_amount"`
	SoldAssetType     string `json:"sold_asset_type"`
	SoldAssetCode     string `json:"sold_asset_code,omitempty"`
	SoldAssetIssuer   string `json:"sold_asset_issuer,omitempty"`
	BoughtAmount      string `json:"bought_amount"`
	BoughtAssetType   string `json:"bought_asset_type"`
	BoughtAssetCode   string `json:"bought_asset_code,omitempty"`
	BoughtAssetIssuer string `json:"bought_asset_issuer,omitempty"`
}

TradeEffectDetails is a struct of data from `effects.DetailsString` when the effect type is trade

type TradeOutput

type TradeOutput struct {
	Order                        int32       `json:"order"`
	LedgerClosedAt               time.Time   `json:"ledger_closed_at"`
	SellingAccountAddress        string      `json:"selling_account_address"`
	SellingAssetCode             string      `json:"selling_asset_code"`
	SellingAssetIssuer           string      `json:"selling_asset_issuer"`
	SellingAssetType             string      `json:"selling_asset_type"`
	SellingAssetID               int64       `json:"selling_asset_id"`
	SellingAmount                float64     `json:"selling_amount"`
	BuyingAccountAddress         string      `json:"buying_account_address"`
	BuyingAssetCode              string      `json:"buying_asset_code"`
	BuyingAssetIssuer            string      `json:"buying_asset_issuer"`
	BuyingAssetType              string      `json:"buying_asset_type"`
	BuyingAssetID                int64       `json:"buying_asset_id"`
	BuyingAmount                 float64     `json:"buying_amount"`
	PriceN                       int64       `json:"price_n"`
	PriceD                       int64       `json:"price_d"`
	SellingOfferID               null.Int    `json:"selling_offer_id"`
	BuyingOfferID                null.Int    `json:"buying_offer_id"`
	SellingLiquidityPoolID       null.String `json:"selling_liquidity_pool_id"`
	LiquidityPoolFee             null.Int    `json:"liquidity_pool_fee"`
	HistoryOperationID           int64       `json:"history_operation_id"`
	TradeType                    int32       `json:"trade_type"`
	RoundingSlippage             null.Int    `json:"rounding_slippage"`
	SellerIsExact                null.Bool   `json:"seller_is_exact"`
	SellingLiquidityPoolIDStrkey null.String `json:"selling_liquidity_pool_id_strkey"`
}

TradeOutput is a representation of a trade that aligns with the BigQuery table history_trades

func TransformTrade

func TransformTrade(operationIndex int32, operationID int64, transaction ingest.LedgerTransaction, ledgerCloseTime time.Time) ([]TradeOutput, error)

TransformTrade converts a relevant operation from the history archive ingestion system into a form suitable for BigQuery

func (TradeOutput) ToParquet

func (to TradeOutput) ToParquet() interface{}

type TradeOutputParquet

type TradeOutputParquet struct {
	Order                  int32   `parquet:"name=order, type=INT32"`
	LedgerClosedAt         int64   `parquet:"name=ledger_closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	SellingAccountAddress  string  `parquet:"name=selling_account_address, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SellingAssetCode       string  `parquet:"name=selling_asset_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SellingAssetIssuer     string  `parquet:"name=selling_asset_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SellingAssetType       string  `parquet:"name=selling_asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	SellingAssetID         int64   `parquet:"name=selling_asset_id, type=INT64"`
	SellingAmount          float64 `parquet:"name=selling_amount, type=DOUBLE"`
	BuyingAccountAddress   string  `parquet:"name=buying_account_address, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingAssetCode        string  `parquet:"name=buying_asset_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingAssetIssuer      string  `parquet:"name=buying_asset_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingAssetType        string  `parquet:"name=buying_asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingAssetID          int64   `parquet:"name=buying_asset_id, type=INT64"`
	BuyingAmount           float64 `parquet:"name=buying_amount, type=DOUBLE"`
	PriceN                 int64   `parquet:"name=price_n, type=INT64"`
	PriceD                 int64   `parquet:"name=price_d, type=INT64"`
	SellingOfferID         int64   `parquet:"name=selling_offer_id, type=INT64"`
	BuyingOfferID          int64   `parquet:"name=buying_offer_id, type=INT64"`
	SellingLiquidityPoolID string  `parquet:"name=selling_liquidity_pool_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LiquidityPoolFee       int64   `parquet:"name=liquidity_pool_fee, type=INT64"`
	HistoryOperationID     int64   `parquet:"name=history_operation_id, type=INT64"`
	TradeType              int32   `parquet:"name=trade_type, type=INT32"`
	RoundingSlippage       int64   `parquet:"name=rounding_slippage, type=INT64"`
	SellerIsExact          bool    `parquet:"name=seller_is_exact, type=BOOLEAN"`
}

TradeOutputParquet is a representation of a trade that aligns with the BigQuery table history_trades

type TransactionOutput

type TransactionOutput struct {
	TransactionHash                      string         `json:"transaction_hash"`
	LedgerSequence                       uint32         `json:"ledger_sequence"`
	Account                              string         `json:"account"`
	AccountMuxed                         string         `json:"account_muxed,omitempty"`
	AccountSequence                      int64          `json:"account_sequence"`
	MaxFee                               uint32         `json:"max_fee"`
	FeeCharged                           int64          `json:"fee_charged"`
	OperationCount                       int32          `json:"operation_count"`
	TxEnvelope                           string         `json:"tx_envelope"`
	TxResult                             string         `json:"tx_result"`
	TxMeta                               string         `json:"tx_meta"`
	TxFeeMeta                            string         `json:"tx_fee_meta"`
	CreatedAt                            time.Time      `json:"created_at"`
	MemoType                             string         `json:"memo_type"`
	Memo                                 string         `json:"memo"`
	TimeBounds                           string         `json:"time_bounds"`
	Successful                           bool           `json:"successful"`
	TransactionID                        int64          `json:"id"`
	FeeAccount                           string         `json:"fee_account,omitempty"`
	FeeAccountMuxed                      string         `json:"fee_account_muxed,omitempty"`
	InnerTransactionHash                 string         `json:"inner_transaction_hash,omitempty"`
	NewMaxFee                            int64          `json:"new_max_fee,omitempty"`
	LedgerBounds                         string         `json:"ledger_bounds"`
	MinAccountSequence                   null.Int       `json:"min_account_sequence"`
	MinAccountSequenceAge                null.Int       `json:"min_account_sequence_age"`
	MinAccountSequenceLedgerGap          null.Int       `json:"min_account_sequence_ledger_gap"`
	ExtraSigners                         pq.StringArray `json:"extra_signers"`
	ClosedAt                             time.Time      `json:"closed_at"`
	ResourceFee                          int64          `json:"resource_fee"`
	SorobanResourcesInstructions         uint32         `json:"soroban_resources_instructions"`
	SorobanResourcesReadBytes            uint32         `json:"soroban_resources_read_bytes"`
	SorobanResourcesDiskReadBytes        uint32         `json:"soroban_resources_disk_read_bytes"`
	SorobanResourcesWriteBytes           uint32         `json:"soroban_resources_write_bytes"`
	SorobanResourcesArchivedEntries      []uint32       `json:"soroban_resources_archived_entries"`
	TransactionResultCode                string         `json:"transaction_result_code"`
	InclusionFeeBid                      int64          `json:"inclusion_fee_bid"`
	InclusionFeeCharged                  int64          `json:"inclusion_fee_charged"`
	ResourceFeeRefund                    int64          `json:"resource_fee_refund"`
	TotalNonRefundableResourceFeeCharged int64          `json:"non_refundable_resource_fee_charged"`
	TotalRefundableResourceFeeCharged    int64          `json:"refundable_resource_fee_charged"`
	RentFeeCharged                       int64          `json:"rent_fee_charged"`
	TxSigners                            []string       `json:"tx_signers"`
}

TransactionOutput is a representation of a transaction that aligns with the BigQuery table history_transactions

func TransformTransaction

func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHeaderHistoryEntry) (TransactionOutput, error)

TransformTransaction converts a transaction from the history archive ingestion system into a form suitable for BigQuery

func (TransactionOutput) ToParquet

func (to TransactionOutput) ToParquet() interface{}

type TransactionOutputParquet

type TransactionOutputParquet struct {
	TransactionHash                      string   `parquet:"name=transaction_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LedgerSequence                       int64    `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
	Account                              string   `parquet:"name=account, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AccountMuxed                         string   `parquet:"name=account_muxed, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AccountSequence                      int64    `parquet:"name=account_sequence, type=INT64"`
	MaxFee                               int64    `parquet:"name=max_fee, type=INT64, convertedtype=UINT_64"`
	FeeCharged                           int64    `parquet:"name=fee_charged, type=INT64"`
	OperationCount                       int32    `parquet:"name=operation_count, type=INT32"`
	TxEnvelope                           string   `parquet:"name=tx_envelope, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TxResult                             string   `parquet:"name=tx_result, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TxMeta                               string   `parquet:"name=tx_meta, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TxFeeMeta                            string   `parquet:"name=tx_fee_meta, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	CreatedAt                            int64    `parquet:"name=created_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	MemoType                             string   `parquet:"name=memo_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Memo                                 string   `parquet:"name=memo, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	TimeBounds                           string   `parquet:"name=time_bounds, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Successful                           bool     `parquet:"name=successful, type=BOOLEAN"`
	TransactionID                        int64    `parquet:"name=id, type=INT64"`
	FeeAccount                           string   `parquet:"name=fee_account, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	FeeAccountMuxed                      string   `parquet:"name=fee_account_muxed, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	InnerTransactionHash                 string   `parquet:"name=inner_transaction_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	NewMaxFee                            int64    `parquet:"name=new_max_fee, type=INT64"`
	LedgerBounds                         string   `parquet:"name=ledger_bounds, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	MinAccountSequence                   int64    `parquet:"name=min_account_sequence, type=INT64"`
	MinAccountSequenceAge                int64    `parquet:"name=min_account_sequence_age, type=INT64"`
	MinAccountSequenceLedgerGap          int64    `parquet:"name=min_account_sequence_ledger_gap, type=INT64"`
	ExtraSigners                         []string `parquet:"name=extra_signers, type=MAP, convertedtype=LIST, valuetype=BYTE_ARRAY, valueconvertedtype=UTF8"`
	ClosedAt                             int64    `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	ResourceFee                          int64    `parquet:"name=resource_fee, type=INT64"`
	SorobanResourcesInstructions         int64    `parquet:"name=soroban_resources_instructions, type=INT64, convertedtype=UINT_64"`
	SorobanResourcesReadBytes            int64    `parquet:"name=soroban_resources_read_bytes, type=INT64, convertedtype=UINT_64"`
	SorobanResourcesDiskReadBytes        int64    `parquet:"name=soroban_resources_disk_read_bytes, type=INT64, convertedtype=UINT_64"`
	SorobanResourcesWriteBytes           int64    `parquet:"name=soroban_resources_write_bytes, type=INT64, convertedtype=UINT_64"`
	SorobanResourcesArchivedEntries      []uint32 `parquet:"name=soroban_resources_archived_entries, type=INT32, repetitiontype=REPEATED"`
	TransactionResultCode                string   `parquet:"name=transaction_result_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	InclusionFeeBid                      int64    `parquet:"name=inclusion_fee_bid, type=INT64"`
	InclusionFeeCharged                  int64    `parquet:"name=inclusion_fee_charged, type=INT64"`
	ResourceFeeRefund                    int64    `parquet:"name=resource_fee_refund, type=INT64"`
	TotalNonRefundableResourceFeeCharged int64    `parquet:"name=non_refundable_resource_fee_charged, type=INT64"`
	TotalRefundableResourceFeeCharged    int64    `parquet:"name=refundable_resource_fee_charged, type=INT64"`
	RentFeeCharged                       int64    `parquet:"name=rent_fee_charged, type=INT64"`
}

TransactionOutputParquet is a representation of a transaction that aligns with the BigQuery table history_transactions

type TransformContractDataStruct

type TransformContractDataStruct struct {
	AssetFromContractData           AssetFromContractDataFunc
	ContractBalanceFromContractData ContractBalanceFromContractDataFunc
}

func (*TransformContractDataStruct) TransformContractData

func (t *TransformContractDataStruct) TransformContractData(ledgerChange ingest.Change, passphrase string, header xdr.LedgerHeaderHistoryEntry) (ContractDataOutput, error, bool)

TransformContractData converts a contract data ledger change entry into a form suitable for BigQuery

type TrustlineOutput

type TrustlineOutput struct {
	LedgerKey             string      `json:"ledger_key"`
	AccountID             string      `json:"account_id"`
	AssetCode             string      `json:"asset_code"`
	AssetIssuer           string      `json:"asset_issuer"`
	AssetType             string      `json:"asset_type"`
	AssetID               int64       `json:"asset_id"`
	Balance               float64     `json:"balance"`
	TrustlineLimit        int64       `json:"trust_line_limit"`
	LiquidityPoolID       string      `json:"liquidity_pool_id"`
	BuyingLiabilities     float64     `json:"buying_liabilities"`
	SellingLiabilities    float64     `json:"selling_liabilities"`
	Flags                 uint32      `json:"flags"`
	LastModifiedLedger    uint32      `json:"last_modified_ledger"`
	LedgerEntryChange     uint32      `json:"ledger_entry_change"`
	Sponsor               null.String `json:"sponsor"`
	Deleted               bool        `json:"deleted"`
	ClosedAt              time.Time   `json:"closed_at"`
	LedgerSequence        uint32      `json:"ledger_sequence"`
	LiquidityPoolIDStrkey string      `json:"liquidity_pool_id_strkey"`
}

TrustlineOutput is a representation of a trustline that aligns with the BigQuery table trust_lines

func TransformTrustline

func TransformTrustline(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (TrustlineOutput, error)

TransformTrustline converts a trustline from the history archive ingestion system into a form suitable for BigQuery

func (TrustlineOutput) ToParquet

func (to TrustlineOutput) ToParquet() interface{}

type TrustlineOutputParquet

type TrustlineOutputParquet struct {
	LedgerKey          string  `parquet:"name=ledger_key, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AccountID          string  `parquet:"name=account_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetCode          string  `parquet:"name=asset_code, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetIssuer        string  `parquet:"name=asset_issuer, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetType          string  `parquet:"name=asset_type, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	AssetID            int64   `parquet:"name=asset_id, type=INT64"`
	Balance            float64 `parquet:"name=balance, type=DOUBLE"`
	TrustlineLimit     int64   `parquet:"name=trust_line_limit, type=INT64"`
	LiquidityPoolID    string  `parquet:"name=liquidity_pool_id, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	BuyingLiabilities  float64 `parquet:"name=buying_liabilities, type=DOUBLE"`
	SellingLiabilities float64 `parquet:"name=selling_liabilities, type=DOUBLE"`
	Flags              int64   `parquet:"name=flags, type=INT64, convertedtype=UINT_64"`
	LastModifiedLedger int64   `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange  int64   `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Sponsor            string  `parquet:"name=sponsor, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	Deleted            bool    `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt           int64   `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence     int64   `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
}

TrustlineOutputParquet is a representation of a trustline that aligns with the BigQuery table trust_lines

type TtlOutput

type TtlOutput struct {
	KeyHash            string    `json:"key_hash"` // key_hash is contract_code_hash or contract_id
	LiveUntilLedgerSeq uint32    `json:"live_until_ledger_seq"`
	LastModifiedLedger uint32    `json:"last_modified_ledger"`
	LedgerEntryChange  uint32    `json:"ledger_entry_change"`
	Deleted            bool      `json:"deleted"`
	ClosedAt           time.Time `json:"closed_at"`
	LedgerSequence     uint32    `json:"ledger_sequence"`
}

TtlOutput is a representation of soroban ttl that aligns with the Bigquery table ttls

func TransformTtl

func TransformTtl(ledgerChange ingest.Change, header xdr.LedgerHeaderHistoryEntry) (TtlOutput, error)

TransformTtl converts an ttl ledger change entry into a form suitable for BigQuery

func (TtlOutput) ToParquet

func (to TtlOutput) ToParquet() interface{}

type TtlOutputParquet

type TtlOutputParquet struct {
	KeyHash            string `parquet:"name=key_hash, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
	LiveUntilLedgerSeq int64  `parquet:"name=live_until_ledger_seq, type=INT64, convertedtype=UINT_64"`
	LastModifiedLedger int64  `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"`
	LedgerEntryChange  int64  `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"`
	Deleted            bool   `parquet:"name=deleted, type=BOOLEAN"`
	ClosedAt           int64  `parquet:"name=closed_at, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	LedgerSequence     int64  `parquet:"name=ledger_sequence, type=INT64, convertedtype=UINT_64"`
}

TtlOutputParquet is a representation of soroban ttl that aligns with the Bigquery table ttls

Jump to

Keyboard shortcuts

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