resourceadapter

package
v0.0.0-...-446988d Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0, Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EffectTypeNames = map[history.EffectType]string{
	history.EffectAccountCreated:                           "account_created",
	history.EffectAccountRemoved:                           "account_removed",
	history.EffectAccountCredited:                          "account_credited",
	history.EffectAccountDebited:                           "account_debited",
	history.EffectAccountThresholdsUpdated:                 "account_thresholds_updated",
	history.EffectAccountHomeDomainUpdated:                 "account_home_domain_updated",
	history.EffectAccountFlagsUpdated:                      "account_flags_updated",
	history.EffectAccountInflationDestinationUpdated:       "account_inflation_destination_updated",
	history.EffectSignerCreated:                            "signer_created",
	history.EffectSignerRemoved:                            "signer_removed",
	history.EffectSignerUpdated:                            "signer_updated",
	history.EffectTrustlineCreated:                         "trustline_created",
	history.EffectTrustlineRemoved:                         "trustline_removed",
	history.EffectTrustlineUpdated:                         "trustline_updated",
	history.EffectTrustlineAuthorized:                      "trustline_authorized",
	history.EffectTrustlineAuthorizedToMaintainLiabilities: "trustline_authorized_to_maintain_liabilities",
	history.EffectTrustlineDeauthorized:                    "trustline_deauthorized",
	history.EffectTrustlineFlagsUpdated:                    "trustline_flags_updated",

	history.EffectTrade:                              "trade",
	history.EffectDataCreated:                        "data_created",
	history.EffectDataRemoved:                        "data_removed",
	history.EffectDataUpdated:                        "data_updated",
	history.EffectSequenceBumped:                     "sequence_bumped",
	history.EffectClaimableBalanceCreated:            "claimable_balance_created",
	history.EffectClaimableBalanceClaimantCreated:    "claimable_balance_claimant_created",
	history.EffectClaimableBalanceClaimed:            "claimable_balance_claimed",
	history.EffectAccountSponsorshipCreated:          "account_sponsorship_created",
	history.EffectAccountSponsorshipUpdated:          "account_sponsorship_updated",
	history.EffectAccountSponsorshipRemoved:          "account_sponsorship_removed",
	history.EffectTrustlineSponsorshipCreated:        "trustline_sponsorship_created",
	history.EffectTrustlineSponsorshipUpdated:        "trustline_sponsorship_updated",
	history.EffectTrustlineSponsorshipRemoved:        "trustline_sponsorship_removed",
	history.EffectDataSponsorshipCreated:             "data_sponsorship_created",
	history.EffectDataSponsorshipUpdated:             "data_sponsorship_updated",
	history.EffectDataSponsorshipRemoved:             "data_sponsorship_removed",
	history.EffectClaimableBalanceSponsorshipCreated: "claimable_balance_sponsorship_created",
	history.EffectClaimableBalanceSponsorshipUpdated: "claimable_balance_sponsorship_updated",
	history.EffectClaimableBalanceSponsorshipRemoved: "claimable_balance_sponsorship_removed",
	history.EffectSignerSponsorshipCreated:           "signer_sponsorship_created",
	history.EffectSignerSponsorshipUpdated:           "signer_sponsorship_updated",
	history.EffectSignerSponsorshipRemoved:           "signer_sponsorship_removed",
	history.EffectClaimableBalanceClawedBack:         "claimable_balance_clawed_back",
	history.EffectLiquidityPoolDeposited:             "liquidity_pool_deposited",
	history.EffectLiquidityPoolWithdrew:              "liquidity_pool_withdrew",
	history.EffectLiquidityPoolTrade:                 "liquidity_pool_trade",
	history.EffectLiquidityPoolCreated:               "liquidity_pool_created",
	history.EffectLiquidityPoolRemoved:               "liquidity_pool_removed",
	history.EffectLiquidityPoolRevoked:               "liquidity_pool_revoked",
	history.EffectContractCredited:                   "contract_credited",
	history.EffectContractDebited:                    "contract_debited",
}

Functions

func NewEffect

func NewEffect(
	ctx context.Context,
	row history.Effect,
	ledger history.Ledger,
) (result hal.Pageable, err error)

NewEffect creates a new effect resource from the provided database representation of the effect.

func NewOperation

func NewOperation(
	ctx context.Context,
	operationRow history.Operation,
	transactionHash string,
	transactionRow *history.Transaction,
	ledger history.Ledger,
) (result hal.Pageable, err error)

NewOperation creates a new operation resource, finding the appropriate type to use based upon the row's type.

func PopulateAccountEntry

func PopulateAccountEntry(
	ctx context.Context,
	dest *protocol.Account,
	account history.AccountEntry,
	accountData []history.Data,
	accountSigners []history.AccountSigner,
	trustLines []history.TrustLine,
	ledger *history.Ledger,
) error

PopulateAccountEntry fills out the resource's fields

func PopulateAsset

func PopulateAsset(ctx context.Context, dest *protocol.Asset, asset xdr.Asset) error

func PopulateAssetBalance

func PopulateAssetBalance(dest *protocol.Balance, row history.TrustLine) (err error)

func PopulateAssetStat

func PopulateAssetStat(
	ctx context.Context,
	res *protocol.AssetStat,
	row history.ExpAssetStat,
	issuer history.AccountEntry,
) (err error)

PopulateAssetStat populates an AssetStat using asset stats and account entries generated from the ingestion system.

func PopulateBaseEffect

func PopulateBaseEffect(ctx context.Context, this *effects.Base, row history.Effect, ledger history.Ledger)

Populate loads this resource from `row`

func PopulateBaseOperation

func PopulateBaseOperation(ctx context.Context, dest *operations.Base, operationRow history.Operation, transactionHash string, transactionRow *history.Transaction, ledger history.Ledger) error

Populate fills out this resource using `row` as the source.

func PopulateClaimableBalance

func PopulateClaimableBalance(
	ctx context.Context,
	dest *protocol.ClaimableBalance,
	claimableBalance history.ClaimableBalance,
	ledger *history.Ledger,
) error

PopulateClaimableBalance fills out the resource's fields

func PopulateLedger

func PopulateLedger(ctx context.Context, dest *protocol.Ledger, row history.Ledger)

func PopulateLiquidityPool

func PopulateLiquidityPool(
	ctx context.Context,
	dest *protocol.LiquidityPool,
	liquidityPool history.LiquidityPool,
	ledger *history.Ledger,
) error

PopulateLiquidityPool fills out the resource's fields

func PopulateNativeBalance

func PopulateNativeBalance(dest *protocol.Balance, µg, buyingLiabilities, sellingLiabilities xdr.Int64) (err error)

func PopulateOffer

func PopulateOffer(ctx context.Context, dest *protocol.Offer, row history.Offer, ledger *history.Ledger)

PopulateOffer constructs an offer response struct from an offer row extracted from the the orbitr offers table.

func PopulatePath

func PopulatePath(ctx context.Context, dest *orbitr.Path, p paths.Path) (err error)

PopulatePath converts the paths.Path into a Path

func PopulatePoolShareBalance

func PopulatePoolShareBalance(dest *protocol.Balance, row history.TrustLine) (err error)

func PopulateRoot

func PopulateRoot(
	ctx context.Context,
	dest *orbitr.Root,
	ledgerState ledger.Status,
	hVersion, cVersion string,
	passphrase string,
	currentProtocolVersion int32,
	coreSupportedProtocolVersion int32,
	friendBotURL *url.URL,
	templates map[string]string,
)

Populate fills in the details

func PopulateTrade

func PopulateTrade(
	ctx context.Context,
	dest *protocol.Trade,
	row history.Trade,
)

Populate fills out the details of a trade using a row from the history_trades table.

func PopulateTradeAggregation

func PopulateTradeAggregation(
	ctx context.Context,
	dest *protocol.TradeAggregation,
	row history.TradeAggregation,
) error

PopulateTradeAggregation fills out the details of a trade aggregation using a row from the trade aggregations table.

func PopulateTransaction

func PopulateTransaction(
	ctx context.Context,
	transactionHash string,
	dest *protocol.Transaction,
	row history.Transaction,
) error

Populate fills out the details

func PopulateTransactionResultCodes

func PopulateTransactionResultCodes(ctx context.Context,
	transactionHash string,
	dest *protocol.TransactionResultCodes,
	fail *txsub.FailedTransactionError,
) (err error)

Populate fills out the details

Types

This section is empty.

Jump to

Keyboard shortcuts

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