data

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 124 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	FixerApiKeyConfigEnvName = "FIXER_API_KEY"
)

Variables ¶

View Source
var (
	ErrInvalidAccount = errors.New("invalid account")
)

Functions ¶

This section is empty.

Types ¶

type BlockchainData ¶

type BlockchainData interface {
	SubmitBlockchainTransaction(ctx context.Context, tx *solana.Transaction) (solana.Signature, error)
	RequestBlockchainAirdrop(ctx context.Context, account string, amount uint64) (solana.Signature, error)

	GetBlockchainAccountInfo(ctx context.Context, account string, commitment solana.Commitment) (*solana.AccountInfo, error)
	GetBlockchainAccountDataAfterBlock(ctx context.Context, account string, slot uint64) ([]byte, uint64, error)
	GetBlockchainBalance(ctx context.Context, account string) (uint64, uint64, error)
	GetBlockchainBlock(ctx context.Context, slot uint64) (*solana.Block, error)
	GetBlockchainBlockSignatures(ctx context.Context, slot uint64) ([]string, error)
	GetBlockchainBlocksWithLimit(ctx context.Context, start uint64, limit uint64) ([]uint64, error)
	GetBlockchainHistory(ctx context.Context, account string, commitment solana.Commitment, opts ...query.Option) ([]*solana.TransactionSignature, error)
	GetBlockchainMinimumBalanceForRentExemption(ctx context.Context, size uint64) (uint64, error)
	GetBlockchainLatestBlockhash(ctx context.Context) (solana.Blockhash, error)
	GetBlockchainSignatureStatuses(ctx context.Context, signatures []solana.Signature) ([]*solana.SignatureStatus, error)
	GetBlockchainSlot(ctx context.Context, commitment solana.Commitment) (uint64, error)
	GetBlockchainTokenAccountInfo(ctx context.Context, account string, commitment solana.Commitment) (*token.Account, error)
	GetBlockchainTokenAccountsByOwner(ctx context.Context, account string) ([]ed25519.PublicKey, error)
	GetBlockchainTransaction(ctx context.Context, sig string, commitment solana.Commitment) (*solana.ConfirmedTransaction, error)
	GetBlockchainTransactionTokenBalances(ctx context.Context, sig string) (*solana.TransactionTokenBalances, error)
	GetBlockchainFilteredProgramAccounts(ctx context.Context, program string, offset uint, filterValue []byte) ([]string, uint64, error)
}

func NewBlockchainProvider ¶

func NewBlockchainProvider(solanaEndpoint string) (BlockchainData, error)

type BlockchainProvider ¶

type BlockchainProvider struct {
	// contains filtered or unexported fields
}

func (*BlockchainProvider) GetBlockchainAccountDataAfterBlock ¶

func (dp *BlockchainProvider) GetBlockchainAccountDataAfterBlock(ctx context.Context, account string, slot uint64) ([]byte, uint64, error)

func (*BlockchainProvider) GetBlockchainAccountInfo ¶

func (dp *BlockchainProvider) GetBlockchainAccountInfo(ctx context.Context, account string, commitment solana.Commitment) (*solana.AccountInfo, error)

func (*BlockchainProvider) GetBlockchainBalance ¶

func (dp *BlockchainProvider) GetBlockchainBalance(ctx context.Context, account string) (uint64, uint64, error)

func (*BlockchainProvider) GetBlockchainBlock ¶

func (dp *BlockchainProvider) GetBlockchainBlock(ctx context.Context, slot uint64) (*solana.Block, error)

func (*BlockchainProvider) GetBlockchainBlockSignatures ¶

func (dp *BlockchainProvider) GetBlockchainBlockSignatures(ctx context.Context, slot uint64) ([]string, error)

func (*BlockchainProvider) GetBlockchainBlocksWithLimit ¶

func (dp *BlockchainProvider) GetBlockchainBlocksWithLimit(ctx context.Context, start uint64, limit uint64) ([]uint64, error)

func (*BlockchainProvider) GetBlockchainFilteredProgramAccounts ¶

func (dp *BlockchainProvider) GetBlockchainFilteredProgramAccounts(ctx context.Context, program string, offset uint, filterValue []byte) ([]string, uint64, error)

func (*BlockchainProvider) GetBlockchainHistory ¶

func (dp *BlockchainProvider) GetBlockchainHistory(ctx context.Context, account string, commitment solana.Commitment, opts ...query.Option) ([]*solana.TransactionSignature, error)

func (*BlockchainProvider) GetBlockchainLatestBlockhash ¶

func (dp *BlockchainProvider) GetBlockchainLatestBlockhash(ctx context.Context) (solana.Blockhash, error)

func (*BlockchainProvider) GetBlockchainMinimumBalanceForRentExemption ¶

func (dp *BlockchainProvider) GetBlockchainMinimumBalanceForRentExemption(ctx context.Context, size uint64) (uint64, error)

func (*BlockchainProvider) GetBlockchainSignatureStatuses ¶

func (dp *BlockchainProvider) GetBlockchainSignatureStatuses(ctx context.Context, signatures []solana.Signature) ([]*solana.SignatureStatus, error)

func (*BlockchainProvider) GetBlockchainSlot ¶

func (dp *BlockchainProvider) GetBlockchainSlot(ctx context.Context, commitment solana.Commitment) (uint64, error)

func (*BlockchainProvider) GetBlockchainTokenAccountInfo ¶

func (dp *BlockchainProvider) GetBlockchainTokenAccountInfo(ctx context.Context, account string, commitment solana.Commitment) (*token.Account, error)

func (*BlockchainProvider) GetBlockchainTokenAccountsByOwner ¶

func (dp *BlockchainProvider) GetBlockchainTokenAccountsByOwner(ctx context.Context, account string) ([]ed25519.PublicKey, error)

func (*BlockchainProvider) GetBlockchainTransaction ¶

func (dp *BlockchainProvider) GetBlockchainTransaction(ctx context.Context, sig string, commitment solana.Commitment) (*solana.ConfirmedTransaction, error)

func (*BlockchainProvider) GetBlockchainTransactionTokenBalances ¶

func (dp *BlockchainProvider) GetBlockchainTransactionTokenBalances(ctx context.Context, sig string) (*solana.TransactionTokenBalances, error)

func (*BlockchainProvider) RequestBlockchainAirdrop ¶

func (dp *BlockchainProvider) RequestBlockchainAirdrop(ctx context.Context, account string, amount uint64) (solana.Signature, error)

func (*BlockchainProvider) SubmitBlockchainTransaction ¶

func (dp *BlockchainProvider) SubmitBlockchainTransaction(ctx context.Context, tx *solana.Transaction) (solana.Signature, error)

type ConfigProvider ¶

type ConfigProvider func() *conf

ConfigProvider defines how config values are pulled

todo: Possibly introduce an override config provider, for things like scripts.

func WithEnvConfigs ¶

func WithEnvConfigs() ConfigProvider

WithEnvConfigs returns configuration pulled from environment variables

type DataProvider ¶

func (*DataProvider) GetBlockchainDataProvider ¶

func (p *DataProvider) GetBlockchainDataProvider() BlockchainData

func (*DataProvider) GetDatabaseDataProvider ¶

func (p *DataProvider) GetDatabaseDataProvider() DatabaseData

func (*DataProvider) GetEstimatedDataProvider ¶

func (p *DataProvider) GetEstimatedDataProvider() EstimatedData

func (*DataProvider) GetWebDataProvider ¶

func (p *DataProvider) GetWebDataProvider() WebData

type DatabaseData ¶

type DatabaseData interface {
	// Account Info
	// --------------------------------------------------------------------------------
	CreateAccountInfo(ctx context.Context, record *account.Record) error
	UpdateAccountInfo(ctx context.Context, record *account.Record) error
	GetAccountInfoByTokenAddress(ctx context.Context, address string) (*account.Record, error)
	GetAccountInfoByAuthorityAddress(ctx context.Context, address string) (*account.Record, error)
	GetLatestAccountInfosByOwnerAddress(ctx context.Context, address string) (map[commonpb.AccountType][]*account.Record, error)
	GetLatestAccountInfoByOwnerAddressAndType(ctx context.Context, address string, accountType commonpb.AccountType) (*account.Record, error)
	GetRelationshipAccountInfoByOwnerAddress(ctx context.Context, address, relationshipTo string) (*account.Record, error)
	GetPrioritizedAccountInfosRequiringDepositSync(ctx context.Context, limit uint64) ([]*account.Record, error)
	GetPrioritizedAccountInfosRequiringAutoReturnCheck(ctx context.Context, maxAge time.Duration, limit uint64) ([]*account.Record, error)
	GetAccountInfoCountRequiringDepositSync(ctx context.Context) (uint64, error)
	GetAccountInfoCountRequiringAutoReturnCheck(ctx context.Context) (uint64, error)

	// Currency
	// --------------------------------------------------------------------------------
	GetExchangeRate(ctx context.Context, code currency_lib.Code, t time.Time) (*currency.ExchangeRateRecord, error)
	GetAllExchangeRates(ctx context.Context, t time.Time) (*currency.MultiRateRecord, error)
	GetExchangeRateHistory(ctx context.Context, code currency_lib.Code, opts ...query.Option) ([]*currency.ExchangeRateRecord, error)
	ImportExchangeRates(ctx context.Context, data *currency.MultiRateRecord) error

	// Vault
	// --------------------------------------------------------------------------------
	GetKey(ctx context.Context, public_key string) (*vault.Record, error)
	GetKeyCount(ctx context.Context) (uint64, error)
	GetKeyCountByState(ctx context.Context, state vault.State) (uint64, error)
	GetAllKeysByState(ctx context.Context, state vault.State, opts ...query.Option) ([]*vault.Record, error)
	SaveKey(ctx context.Context, record *vault.Record) error

	// Nonce
	// --------------------------------------------------------------------------------
	GetNonce(ctx context.Context, address string) (*nonce.Record, error)
	GetNonceCount(ctx context.Context) (uint64, error)
	GetNonceCountByState(ctx context.Context, state nonce.State) (uint64, error)
	GetNonceCountByStateAndPurpose(ctx context.Context, state nonce.State, purpose nonce.Purpose) (uint64, error)
	GetAllNonceByState(ctx context.Context, state nonce.State, opts ...query.Option) ([]*nonce.Record, error)
	GetRandomAvailableNonceByPurpose(ctx context.Context, purpose nonce.Purpose) (*nonce.Record, error)
	SaveNonce(ctx context.Context, record *nonce.Record) error

	// Fulfillment
	// --------------------------------------------------------------------------------
	GetFulfillmentById(ctx context.Context, id uint64) (*fulfillment.Record, error)
	GetFulfillmentBySignature(ctx context.Context, signature string) (*fulfillment.Record, error)
	GetFulfillmentCount(ctx context.Context) (uint64, error)
	GetFulfillmentCountByState(ctx context.Context, state fulfillment.State) (uint64, error)
	GetFulfillmentCountByStateGroupedByType(ctx context.Context, state fulfillment.State) (map[fulfillment.Type]uint64, error)
	GetFulfillmentCountForMetrics(ctx context.Context, state fulfillment.State) (map[fulfillment.Type]uint64, error)
	GetFulfillmentCountByStateAndAddress(ctx context.Context, state fulfillment.State, address string) (uint64, error)
	GetFulfillmentCountByTypeStateAndAddress(ctx context.Context, fulfillmentType fulfillment.Type, state fulfillment.State, address string) (uint64, error)
	GetFulfillmentCountByTypeStateAndAddressAsSource(ctx context.Context, fulfillmentType fulfillment.Type, state fulfillment.State, address string) (uint64, error)
	GetFulfillmentCountByIntentAndState(ctx context.Context, intent string, state fulfillment.State) (uint64, error)
	GetFulfillmentCountByIntent(ctx context.Context, intent string) (uint64, error)
	GetFulfillmentCountByTypeActionAndState(ctx context.Context, intentId string, actionId uint32, fulfillmentType fulfillment.Type, state fulfillment.State) (uint64, error)
	GetPendingFulfillmentCountByType(ctx context.Context) (map[fulfillment.Type]uint64, error)
	GetAllFulfillmentsByState(ctx context.Context, state fulfillment.State, includeDisabledActiveScheduling bool, opts ...query.Option) ([]*fulfillment.Record, error)
	GetAllFulfillmentsByIntent(ctx context.Context, intent string, opts ...query.Option) ([]*fulfillment.Record, error)
	GetAllFulfillmentsByAction(ctx context.Context, intentId string, actionId uint32) ([]*fulfillment.Record, error)
	GetAllFulfillmentsByTypeAndAction(ctx context.Context, fulfillmentType fulfillment.Type, intentId string, actionId uint32) ([]*fulfillment.Record, error)
	GetFirstSchedulableFulfillmentByAddressAsSource(ctx context.Context, address string) (*fulfillment.Record, error)
	GetFirstSchedulableFulfillmentByAddressAsDestination(ctx context.Context, address string) (*fulfillment.Record, error)
	GetFirstSchedulableFulfillmentByType(ctx context.Context, fulfillmentType fulfillment.Type) (*fulfillment.Record, error)
	GetNextSchedulableFulfillmentByAddress(ctx context.Context, address string, intentOrderingIndex uint64, actionOrderingIndex, fulfillmentOrderingIndex uint32) (*fulfillment.Record, error)
	PutAllFulfillments(ctx context.Context, records ...*fulfillment.Record) error
	UpdateFulfillment(ctx context.Context, record *fulfillment.Record) error
	MarkFulfillmentAsActivelyScheduled(ctx context.Context, id uint64) error
	ActivelyScheduleTreasuryAdvanceFulfillments(ctx context.Context, treasury string, intentOrderingIndex uint64, limit int) (uint64, error)

	// Intent
	// --------------------------------------------------------------------------------
	SaveIntent(ctx context.Context, record *intent.Record) error
	GetIntent(ctx context.Context, intentID string) (*intent.Record, error)
	GetIntentBySignature(ctx context.Context, signature string) (*intent.Record, error)
	GetLatestIntentByInitiatorAndType(ctx context.Context, intentType intent.Type, owner string) (*intent.Record, error)
	GetAllIntentsByOwner(ctx context.Context, owner string, opts ...query.Option) ([]*intent.Record, error)
	GetIntentCountForAntispam(ctx context.Context, intentType intent.Type, phoneNumber string, states []intent.State, since time.Time) (uint64, error)
	GetIntentCountWithOwnerInteractionsForAntispam(ctx context.Context, sourceOwner, destinationOwner string, states []intent.State, since time.Time) (uint64, error)
	GetTransactedAmountForAntiMoneyLaundering(ctx context.Context, phoneNumber string, since time.Time) (uint64, float64, error)
	GetDepositedAmountForAntiMoneyLaundering(ctx context.Context, phoneNumber string, since time.Time) (uint64, float64, error)
	GetNetBalanceFromPrePrivacy2022Intents(ctx context.Context, account string) (int64, error)
	GetLatestSaveRecentRootIntentForTreasury(ctx context.Context, treasury string) (*intent.Record, error)
	GetOriginalGiftCardIssuedIntent(ctx context.Context, giftCardVault string) (*intent.Record, error)
	GetGiftCardClaimedIntent(ctx context.Context, giftCardVault string) (*intent.Record, error)

	// Action
	// --------------------------------------------------------------------------------
	PutAllActions(ctx context.Context, records ...*action.Record) error
	UpdateAction(ctx context.Context, record *action.Record) error
	GetActionById(ctx context.Context, intent string, actionId uint32) (*action.Record, error)
	GetAllActionsByIntent(ctx context.Context, intent string) ([]*action.Record, error)
	GetAllActionsByAddress(ctx context.Context, address string) ([]*action.Record, error)
	GetNetBalanceFromActions(ctx context.Context, address string) (int64, error)
	GetNetBalanceFromActionsBatch(ctx context.Context, accounts ...string) (map[string]int64, error)
	GetGiftCardClaimedAction(ctx context.Context, giftCardVault string) (*action.Record, error)
	GetGiftCardAutoReturnAction(ctx context.Context, giftCardVault string) (*action.Record, error)

	// Payment (mostly deprecated for legacy accounts and unmigrated processes)
	// --------------------------------------------------------------------------------
	GetPayment(ctx context.Context, sig string, index int) (*payment.Record, error)
	CreatePayment(ctx context.Context, record *payment.Record) error
	UpdateOrCreatePayment(ctx context.Context, record *payment.Record) error
	GetPaymentHistory(ctx context.Context, account string, opts ...query.Option) ([]*payment.Record, error)
	GetPaymentHistoryWithinBlockRange(ctx context.Context, account string, lowerBound, upperBound uint64, opts ...query.Option) ([]*payment.Record, error)
	GetLegacyTotalExternalDepositAmountFromPrePrivacy2022Accounts(ctx context.Context, account string) (uint64, error)

	// Transaction
	// --------------------------------------------------------------------------------
	GetTransaction(ctx context.Context, sig string) (*transaction.Record, error)
	SaveTransaction(ctx context.Context, record *transaction.Record) error

	// Messaging
	// --------------------------------------------------------------------------------
	CreateMessage(ctx context.Context, record *messaging.Record) error
	GetMessages(ctx context.Context, account string) ([]*messaging.Record, error)
	DeleteMessage(ctx context.Context, account string, messageID uuid.UUID) error

	// Phone
	// --------------------------------------------------------------------------------
	SavePhoneVerification(ctx context.Context, v *phone.Verification) error
	GetPhoneVerification(ctx context.Context, account, phoneNumber string) (*phone.Verification, error)
	GetLatestPhoneVerificationForAccount(ctx context.Context, account string) (*phone.Verification, error)
	GetLatestPhoneVerificationForNumber(ctx context.Context, phoneNumber string) (*phone.Verification, error)
	GetAllPhoneVerificationsForNumber(ctx context.Context, phoneNumber string) ([]*phone.Verification, error)
	SavePhoneLinkingToken(ctx context.Context, token *phone.LinkingToken) error
	UsePhoneLinkingToken(ctx context.Context, phoneNumber, code string) error
	FilterVerifiedPhoneNumbers(ctx context.Context, phoneNumbers []string) ([]string, error)
	SaveOwnerAccountPhoneSetting(ctx context.Context, phoneNumber string, newSettings *phone.OwnerAccountSetting) error
	IsPhoneNumberLinkedToAccount(ctx context.Context, phoneNumber string, tokenAccount string) (bool, error)
	IsPhoneNumberEnabledForRemoteSendToAccount(ctx context.Context, phoneNumber string, tokenAccount string) (bool, error)
	PutPhoneEvent(ctx context.Context, event *phone.Event) error
	GetLatestPhoneEventForNumberByType(ctx context.Context, phoneNumber string, eventType phone.EventType) (*phone.Event, error)
	GetPhoneEventCountForVerificationByType(ctx context.Context, verification string, eventType phone.EventType) (uint64, error)
	GetPhoneEventCountForNumberByTypeSinceTimestamp(ctx context.Context, phoneNumber string, eventType phone.EventType, since time.Time) (uint64, error)
	GetUniquePhoneVerificationIdCountForNumberSinceTimestamp(ctx context.Context, phoneNumber string, since time.Time) (uint64, error)

	// Contact
	// --------------------------------------------------------------------------------
	AddContact(ctx context.Context, owner *user.DataContainerID, contact string) error
	BatchAddContacts(ctx context.Context, owner *user.DataContainerID, contacts []string) error
	RemoveContact(ctx context.Context, owner *user.DataContainerID, contact string) error
	BatchRemoveContacts(ctx context.Context, owner *user.DataContainerID, contacts []string) error
	GetContacts(ctx context.Context, owner *user.DataContainerID, limit uint32, pageToken []byte) (contacts []string, nextPageToken []byte, err error)

	// User Identity
	// --------------------------------------------------------------------------------
	PutUser(ctx context.Context, record *identity.Record) error
	GetUserByID(ctx context.Context, id *user.UserID) (*identity.Record, error)
	GetUserByPhoneView(ctx context.Context, phoneNumber string) (*identity.Record, error)

	// User Storage Management
	// --------------------------------------------------------------------------------
	PutUserDataContainer(ctx context.Context, container *storage.Record) error
	GetUserDataContainerByID(ctx context.Context, id *user.DataContainerID) (*storage.Record, error)
	GetUserDataContainerByPhone(ctx context.Context, tokenAccount, phoneNumber string) (*storage.Record, error)

	// Timelock
	// --------------------------------------------------------------------------------
	SaveTimelock(ctx context.Context, record *timelock.Record) error
	GetTimelockByAddress(ctx context.Context, address string) (*timelock.Record, error)
	GetTimelockByVault(ctx context.Context, vault string) (*timelock.Record, error)
	GetTimelockByVaultBatch(ctx context.Context, vaults ...string) (map[string]*timelock.Record, error)
	GetAllTimelocksByState(ctx context.Context, state timelock_token.TimelockState, opts ...query.Option) ([]*timelock.Record, error)
	GetTimelockCountByState(ctx context.Context, state timelock_token.TimelockState) (uint64, error)

	// Push
	// --------------------------------------------------------------------------------
	PutPushToken(ctx context.Context, record *push.Record) error
	MarkPushTokenAsInvalid(ctx context.Context, pushToken string) error
	DeletePushToken(ctx context.Context, pushToken string) error
	GetAllValidPushTokensdByDataContainer(ctx context.Context, id *user.DataContainerID) ([]*push.Record, error)

	// Commitment
	// --------------------------------------------------------------------------------
	SaveCommitment(ctx context.Context, record *commitment.Record) error
	GetCommitmentByAddress(ctx context.Context, address string) (*commitment.Record, error)
	GetCommitmentByVault(ctx context.Context, vault string) (*commitment.Record, error)
	GetCommitmentByAction(ctx context.Context, intentId string, actionId uint32) (*commitment.Record, error)
	GetAllCommitmentsByState(ctx context.Context, state commitment.State, opts ...query.Option) ([]*commitment.Record, error)
	GetUpgradeableCommitmentsByOwner(ctx context.Context, owner string, limit uint64) ([]*commitment.Record, error)
	GetUsedTreasuryPoolDeficitFromCommitments(ctx context.Context, treasuryPool string) (uint64, error)
	GetTotalTreasuryPoolDeficitFromCommitments(ctx context.Context, treasuryPool string) (uint64, error)
	CountCommitmentsByState(ctx context.Context, state commitment.State) (uint64, error)
	CountCommitmentRepaymentsDivertedToVault(ctx context.Context, vault string) (uint64, error)

	// Treasury Pool
	// --------------------------------------------------------------------------------
	SaveTreasuryPool(ctx context.Context, record *treasury.Record) error
	GetTreasuryPoolByName(ctx context.Context, name string) (*treasury.Record, error)
	GetTreasuryPoolByAddress(ctx context.Context, address string) (*treasury.Record, error)
	GetTreasuryPoolByVault(ctx context.Context, vault string) (*treasury.Record, error)
	GetAllTreasuryPoolsByState(ctx context.Context, state treasury.TreasuryPoolState, opts ...query.Option) ([]*treasury.Record, error)
	SaveTreasuryPoolFunding(ctx context.Context, record *treasury.FundingHistoryRecord) error
	GetTotalAvailableTreasuryPoolFunds(ctx context.Context, vault string) (uint64, error)

	// Merkle Tree
	// --------------------------------------------------------------------------------
	InitializeNewMerkleTree(ctx context.Context, name string, levels uint8, seeds []merkletree.Seed, readOnly bool) (*merkletree.MerkleTree, error)
	LoadExistingMerkleTree(ctx context.Context, name string, readOnly bool) (*merkletree.MerkleTree, error)

	// External Deposits
	// --------------------------------------------------------------------------------
	SaveExternalDeposit(ctx context.Context, record *deposit.Record) error
	GetExternalDeposit(ctx context.Context, signature, destination string) (*deposit.Record, error)
	GetTotalExternalDepositedAmountInQuarks(ctx context.Context, account string) (uint64, error)
	GetTotalExternalDepositedAmountInQuarksBatch(ctx context.Context, accounts ...string) (map[string]uint64, error)
	GetTotalExternalDepositedAmountInUsd(ctx context.Context, account string) (float64, error)

	// Rendezvous
	// --------------------------------------------------------------------------------
	SaveRendezvous(ctx context.Context, record *rendezvous.Record) error
	GetRendezvous(ctx context.Context, key string) (*rendezvous.Record, error)
	DeleteRendezvous(ctx context.Context, key string) error

	// Requests
	// --------------------------------------------------------------------------------
	CreateRequest(ctx context.Context, record *paymentrequest.Record) error
	GetRequest(ctx context.Context, intentId string) (*paymentrequest.Record, error)

	// Paywall
	// --------------------------------------------------------------------------------
	CreatePaywall(ctx context.Context, record *paywall.Record) error
	GetPaywallByShortPath(ctx context.Context, path string) (*paywall.Record, error)

	// Event
	// --------------------------------------------------------------------------------
	SaveEvent(ctx context.Context, record *event.Record) error
	GetEvent(ctx context.Context, id string) (*event.Record, error)

	// Webhook
	// --------------------------------------------------------------------------------
	CreateWebhook(ctx context.Context, record *webhook.Record) error
	UpdateWebhook(ctx context.Context, record *webhook.Record) error
	GetWebhook(ctx context.Context, webhookId string) (*webhook.Record, error)
	CountWebhookByState(ctx context.Context, state webhook.State) (uint64, error)
	GetAllPendingWebhooksReadyToSend(ctx context.Context, limit uint64) ([]*webhook.Record, error)

	// Chat
	// --------------------------------------------------------------------------------
	PutChat(ctx context.Context, record *chat.Chat) error
	GetChatById(ctx context.Context, chatId chat.ChatId) (*chat.Chat, error)
	GetAllChatsForUser(ctx context.Context, user string, opts ...query.Option) ([]*chat.Chat, error)
	PutChatMessage(ctx context.Context, record *chat.Message) error
	DeleteChatMessage(ctx context.Context, chatId chat.ChatId, messageId string) error
	GetChatMessage(ctx context.Context, chatId chat.ChatId, messageId string) (*chat.Message, error)
	GetAllChatMessages(ctx context.Context, chatId chat.ChatId, opts ...query.Option) ([]*chat.Message, error)
	AdvanceChatPointer(ctx context.Context, chatId chat.ChatId, pointer string) error
	GetChatUnreadCount(ctx context.Context, chatId chat.ChatId) (uint32, error)
	SetChatMuteState(ctx context.Context, chatId chat.ChatId, isMuted bool) error
	SetChatSubscriptionState(ctx context.Context, chatId chat.ChatId, isSubscribed bool) error

	// Badge Count
	// --------------------------------------------------------------------------------
	AddToBadgeCount(ctx context.Context, owner string, amount uint32) error
	ResetBadgeCount(ctx context.Context, owner string) error
	GetBadgeCount(ctx context.Context, owner string) (*badgecount.Record, error)

	// Login
	// --------------------------------------------------------------------------------
	SaveLogins(ctx context.Context, record *login.MultiRecord) error
	GetLoginsByAppInstall(ctx context.Context, appInstallId string) (*login.MultiRecord, error)
	GetLatestLoginByOwner(ctx context.Context, owner string) (*login.Record, error)

	// Balance
	// --------------------------------------------------------------------------------
	SaveBalanceCheckpoint(ctx context.Context, record *balance.Record) error
	GetBalanceCheckpoint(ctx context.Context, account string) (*balance.Record, error)

	// Onramp
	// --------------------------------------------------------------------------------
	PutFiatOnrampPurchase(ctx context.Context, record *onramp.Record) error
	GetFiatOnrampPurchase(ctx context.Context, nonce uuid.UUID) (*onramp.Record, error)

	// User Preferences
	// --------------------------------------------------------------------------------
	SaveUserPreferences(ctx context.Context, record *preferences.Record) error
	GetUserPreferences(ctx context.Context, id *user.DataContainerID) (*preferences.Record, error)
	GetUserLocale(ctx context.Context, owner string) (language.Tag, error)

	// Airdrop
	// --------------------------------------------------------------------------------
	MarkIneligibleForAirdrop(ctx context.Context, owner string) error
	IsEligibleForAirdrop(ctx context.Context, owner string) (bool, error)

	// ExecuteInTx executes fn with a single DB transaction that is scoped to the call.
	// This enables more complex transactions that can span many calls across the provider.
	//
	// Note: This highly relies on the store implementations adding explicit support for
	// this, which was added way later than when most were written. When using this
	// function, ensure there is proper support for whatever is being called inside fn.
	ExecuteInTx(ctx context.Context, isolation sql.IsolationLevel, fn func(ctx context.Context) error) error
}

func NewDatabaseProvider ¶

func NewDatabaseProvider(dbConfig *pg.Config) (DatabaseData, error)

func NewTestDatabaseProvider ¶

func NewTestDatabaseProvider() DatabaseData

type DatabaseProvider ¶

type DatabaseProvider struct {
	// contains filtered or unexported fields
}

func (*DatabaseProvider) ActivelyScheduleTreasuryAdvanceFulfillments ¶

func (dp *DatabaseProvider) ActivelyScheduleTreasuryAdvanceFulfillments(ctx context.Context, treasury string, intentOrderingIndex uint64, limit int) (uint64, error)

func (*DatabaseProvider) AddContact ¶

func (dp *DatabaseProvider) AddContact(ctx context.Context, owner *user.DataContainerID, contact string) error

func (*DatabaseProvider) AddToBadgeCount ¶

func (dp *DatabaseProvider) AddToBadgeCount(ctx context.Context, owner string, amount uint32) error

Badge Count --------------------------------------------------------------------------------

func (*DatabaseProvider) AdvanceChatPointer ¶

func (dp *DatabaseProvider) AdvanceChatPointer(ctx context.Context, chatId chat.ChatId, pointer string) error

func (*DatabaseProvider) BatchAddContacts ¶

func (dp *DatabaseProvider) BatchAddContacts(ctx context.Context, owner *user.DataContainerID, contacts []string) error

func (*DatabaseProvider) BatchRemoveContacts ¶

func (dp *DatabaseProvider) BatchRemoveContacts(ctx context.Context, owner *user.DataContainerID, contacts []string) error

func (*DatabaseProvider) CountCommitmentRepaymentsDivertedToVault ¶

func (dp *DatabaseProvider) CountCommitmentRepaymentsDivertedToVault(ctx context.Context, vault string) (uint64, error)

func (*DatabaseProvider) CountCommitmentsByState ¶

func (dp *DatabaseProvider) CountCommitmentsByState(ctx context.Context, state commitment.State) (uint64, error)

func (*DatabaseProvider) CountWebhookByState ¶

func (dp *DatabaseProvider) CountWebhookByState(ctx context.Context, state webhook.State) (uint64, error)

func (*DatabaseProvider) CreateAccountInfo ¶

func (dp *DatabaseProvider) CreateAccountInfo(ctx context.Context, record *account.Record) error

Account Info --------------------------------------------------------------------------------

func (*DatabaseProvider) CreateMessage ¶

func (dp *DatabaseProvider) CreateMessage(ctx context.Context, record *messaging.Record) error

Messaging --------------------------------------------------------------------------------

func (*DatabaseProvider) CreatePayment ¶

func (dp *DatabaseProvider) CreatePayment(ctx context.Context, record *payment.Record) error

func (*DatabaseProvider) CreatePaywall ¶

func (dp *DatabaseProvider) CreatePaywall(ctx context.Context, record *paywall.Record) error

Paywall --------------------------------------------------------------------------------

func (*DatabaseProvider) CreateRequest ¶ added in v1.2.0

func (dp *DatabaseProvider) CreateRequest(ctx context.Context, record *paymentrequest.Record) error

Payment Request --------------------------------------------------------------------------------

func (*DatabaseProvider) CreateWebhook ¶

func (dp *DatabaseProvider) CreateWebhook(ctx context.Context, record *webhook.Record) error

Webhook --------------------------------------------------------------------------------

func (*DatabaseProvider) DeleteChatMessage ¶

func (dp *DatabaseProvider) DeleteChatMessage(ctx context.Context, chatId chat.ChatId, messageId string) error

func (*DatabaseProvider) DeleteMessage ¶

func (dp *DatabaseProvider) DeleteMessage(ctx context.Context, account string, messageID uuid.UUID) error

func (*DatabaseProvider) DeletePushToken ¶

func (dp *DatabaseProvider) DeletePushToken(ctx context.Context, pushToken string) error

func (*DatabaseProvider) DeleteRendezvous ¶

func (dp *DatabaseProvider) DeleteRendezvous(ctx context.Context, key string) error

func (*DatabaseProvider) ExecuteInTx ¶

func (dp *DatabaseProvider) ExecuteInTx(ctx context.Context, isolation sql.IsolationLevel, fn func(ctx context.Context) error) error

func (*DatabaseProvider) FilterVerifiedPhoneNumbers ¶

func (dp *DatabaseProvider) FilterVerifiedPhoneNumbers(ctx context.Context, phoneNumbers []string) ([]string, error)

func (*DatabaseProvider) GetAccountInfoByAuthorityAddress ¶

func (dp *DatabaseProvider) GetAccountInfoByAuthorityAddress(ctx context.Context, address string) (*account.Record, error)

func (*DatabaseProvider) GetAccountInfoByTokenAddress ¶

func (dp *DatabaseProvider) GetAccountInfoByTokenAddress(ctx context.Context, address string) (*account.Record, error)

func (*DatabaseProvider) GetAccountInfoCountRequiringAutoReturnCheck ¶

func (dp *DatabaseProvider) GetAccountInfoCountRequiringAutoReturnCheck(ctx context.Context) (uint64, error)

func (*DatabaseProvider) GetAccountInfoCountRequiringDepositSync ¶

func (dp *DatabaseProvider) GetAccountInfoCountRequiringDepositSync(ctx context.Context) (uint64, error)

func (*DatabaseProvider) GetActionById ¶

func (dp *DatabaseProvider) GetActionById(ctx context.Context, intent string, actionId uint32) (*action.Record, error)

func (*DatabaseProvider) GetAllActionsByAddress ¶

func (dp *DatabaseProvider) GetAllActionsByAddress(ctx context.Context, address string) ([]*action.Record, error)

func (*DatabaseProvider) GetAllActionsByIntent ¶

func (dp *DatabaseProvider) GetAllActionsByIntent(ctx context.Context, intent string) ([]*action.Record, error)

func (*DatabaseProvider) GetAllChatMessages ¶

func (dp *DatabaseProvider) GetAllChatMessages(ctx context.Context, chatId chat.ChatId, opts ...query.Option) ([]*chat.Message, error)

func (*DatabaseProvider) GetAllChatsForUser ¶

func (dp *DatabaseProvider) GetAllChatsForUser(ctx context.Context, user string, opts ...query.Option) ([]*chat.Chat, error)

func (*DatabaseProvider) GetAllCommitmentsByState ¶

func (dp *DatabaseProvider) GetAllCommitmentsByState(ctx context.Context, state commitment.State, opts ...query.Option) ([]*commitment.Record, error)

func (*DatabaseProvider) GetAllExchangeRates ¶

func (dp *DatabaseProvider) GetAllExchangeRates(ctx context.Context, t time.Time) (*currency.MultiRateRecord, error)

func (*DatabaseProvider) GetAllFulfillmentsByAction ¶

func (dp *DatabaseProvider) GetAllFulfillmentsByAction(ctx context.Context, intentId string, actionId uint32) ([]*fulfillment.Record, error)

func (*DatabaseProvider) GetAllFulfillmentsByIntent ¶

func (dp *DatabaseProvider) GetAllFulfillmentsByIntent(ctx context.Context, intent string, opts ...query.Option) ([]*fulfillment.Record, error)

func (*DatabaseProvider) GetAllFulfillmentsByState ¶

func (dp *DatabaseProvider) GetAllFulfillmentsByState(ctx context.Context, state fulfillment.State, includeDisabledActiveScheduling bool, opts ...query.Option) ([]*fulfillment.Record, error)

func (*DatabaseProvider) GetAllFulfillmentsByTypeAndAction ¶

func (dp *DatabaseProvider) GetAllFulfillmentsByTypeAndAction(ctx context.Context, fulfillmentType fulfillment.Type, intentId string, actionId uint32) ([]*fulfillment.Record, error)

func (*DatabaseProvider) GetAllIntentsByOwner ¶

func (dp *DatabaseProvider) GetAllIntentsByOwner(ctx context.Context, owner string, opts ...query.Option) ([]*intent.Record, error)

func (*DatabaseProvider) GetAllKeysByState ¶

func (dp *DatabaseProvider) GetAllKeysByState(ctx context.Context, state vault.State, opts ...query.Option) ([]*vault.Record, error)

func (*DatabaseProvider) GetAllNonceByState ¶

func (dp *DatabaseProvider) GetAllNonceByState(ctx context.Context, state nonce.State, opts ...query.Option) ([]*nonce.Record, error)

func (*DatabaseProvider) GetAllPendingWebhooksReadyToSend ¶

func (dp *DatabaseProvider) GetAllPendingWebhooksReadyToSend(ctx context.Context, limit uint64) ([]*webhook.Record, error)

func (*DatabaseProvider) GetAllPhoneVerificationsForNumber ¶

func (dp *DatabaseProvider) GetAllPhoneVerificationsForNumber(ctx context.Context, phoneNumber string) ([]*phone.Verification, error)

func (*DatabaseProvider) GetAllTimelocksByState ¶

func (dp *DatabaseProvider) GetAllTimelocksByState(ctx context.Context, state timelock_token.TimelockState, opts ...query.Option) ([]*timelock.Record, error)

func (*DatabaseProvider) GetAllTreasuryPoolsByState ¶

func (dp *DatabaseProvider) GetAllTreasuryPoolsByState(ctx context.Context, state treasury.TreasuryPoolState, opts ...query.Option) ([]*treasury.Record, error)

func (*DatabaseProvider) GetAllValidPushTokensdByDataContainer ¶

func (dp *DatabaseProvider) GetAllValidPushTokensdByDataContainer(ctx context.Context, id *user.DataContainerID) ([]*push.Record, error)

func (*DatabaseProvider) GetBadgeCount ¶

func (dp *DatabaseProvider) GetBadgeCount(ctx context.Context, owner string) (*badgecount.Record, error)

func (*DatabaseProvider) GetBalanceCheckpoint ¶ added in v1.3.2

func (dp *DatabaseProvider) GetBalanceCheckpoint(ctx context.Context, account string) (*balance.Record, error)

func (*DatabaseProvider) GetChatById ¶

func (dp *DatabaseProvider) GetChatById(ctx context.Context, chatId chat.ChatId) (*chat.Chat, error)

func (*DatabaseProvider) GetChatMessage ¶

func (dp *DatabaseProvider) GetChatMessage(ctx context.Context, chatId chat.ChatId, messageId string) (*chat.Message, error)

func (*DatabaseProvider) GetChatUnreadCount ¶

func (dp *DatabaseProvider) GetChatUnreadCount(ctx context.Context, chatId chat.ChatId) (uint32, error)

func (*DatabaseProvider) GetCommitmentByAction ¶

func (dp *DatabaseProvider) GetCommitmentByAction(ctx context.Context, intentId string, actionId uint32) (*commitment.Record, error)

func (*DatabaseProvider) GetCommitmentByAddress ¶

func (dp *DatabaseProvider) GetCommitmentByAddress(ctx context.Context, address string) (*commitment.Record, error)

func (*DatabaseProvider) GetCommitmentByVault ¶

func (dp *DatabaseProvider) GetCommitmentByVault(ctx context.Context, vault string) (*commitment.Record, error)

func (*DatabaseProvider) GetContacts ¶

func (dp *DatabaseProvider) GetContacts(ctx context.Context, owner *user.DataContainerID, limit uint32, pageToken []byte) (contacts []string, nextPageToken []byte, err error)

func (*DatabaseProvider) GetDepositedAmountForAntiMoneyLaundering ¶

func (dp *DatabaseProvider) GetDepositedAmountForAntiMoneyLaundering(ctx context.Context, phoneNumber string, since time.Time) (uint64, float64, error)

func (*DatabaseProvider) GetEvent ¶

func (dp *DatabaseProvider) GetEvent(ctx context.Context, id string) (*event.Record, error)

func (*DatabaseProvider) GetExchangeRate ¶

Currency --------------------------------------------------------------------------------

func (*DatabaseProvider) GetExchangeRateHistory ¶

func (dp *DatabaseProvider) GetExchangeRateHistory(ctx context.Context, code currency_lib.Code, opts ...query.Option) ([]*currency.ExchangeRateRecord, error)

func (*DatabaseProvider) GetExternalDeposit ¶

func (dp *DatabaseProvider) GetExternalDeposit(ctx context.Context, signature, account string) (*deposit.Record, error)

func (*DatabaseProvider) GetFiatOnrampPurchase ¶ added in v1.5.0

func (dp *DatabaseProvider) GetFiatOnrampPurchase(ctx context.Context, nonce uuid.UUID) (*onramp.Record, error)

func (*DatabaseProvider) GetFirstSchedulableFulfillmentByAddressAsDestination ¶

func (dp *DatabaseProvider) GetFirstSchedulableFulfillmentByAddressAsDestination(ctx context.Context, address string) (*fulfillment.Record, error)

func (*DatabaseProvider) GetFirstSchedulableFulfillmentByAddressAsSource ¶

func (dp *DatabaseProvider) GetFirstSchedulableFulfillmentByAddressAsSource(ctx context.Context, address string) (*fulfillment.Record, error)

func (*DatabaseProvider) GetFirstSchedulableFulfillmentByType ¶

func (dp *DatabaseProvider) GetFirstSchedulableFulfillmentByType(ctx context.Context, fulfillmentType fulfillment.Type) (*fulfillment.Record, error)

func (*DatabaseProvider) GetFulfillmentById ¶

func (dp *DatabaseProvider) GetFulfillmentById(ctx context.Context, id uint64) (*fulfillment.Record, error)

Fulfillment --------------------------------------------------------------------------------

func (*DatabaseProvider) GetFulfillmentBySignature ¶

func (dp *DatabaseProvider) GetFulfillmentBySignature(ctx context.Context, signature string) (*fulfillment.Record, error)

func (*DatabaseProvider) GetFulfillmentCount ¶

func (dp *DatabaseProvider) GetFulfillmentCount(ctx context.Context) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByIntent ¶

func (dp *DatabaseProvider) GetFulfillmentCountByIntent(ctx context.Context, intent string) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByIntentAndState ¶

func (dp *DatabaseProvider) GetFulfillmentCountByIntentAndState(ctx context.Context, intent string, state fulfillment.State) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByState ¶

func (dp *DatabaseProvider) GetFulfillmentCountByState(ctx context.Context, state fulfillment.State) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByStateAndAddress ¶

func (dp *DatabaseProvider) GetFulfillmentCountByStateAndAddress(ctx context.Context, state fulfillment.State, address string) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByStateGroupedByType ¶

func (dp *DatabaseProvider) GetFulfillmentCountByStateGroupedByType(ctx context.Context, state fulfillment.State) (map[fulfillment.Type]uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByTypeActionAndState ¶

func (dp *DatabaseProvider) GetFulfillmentCountByTypeActionAndState(ctx context.Context, intentId string, actionId uint32, fulfillmentType fulfillment.Type, state fulfillment.State) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByTypeStateAndAddress ¶

func (dp *DatabaseProvider) GetFulfillmentCountByTypeStateAndAddress(ctx context.Context, fulfillmentType fulfillment.Type, state fulfillment.State, address string) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountByTypeStateAndAddressAsSource ¶

func (dp *DatabaseProvider) GetFulfillmentCountByTypeStateAndAddressAsSource(ctx context.Context, fulfillmentType fulfillment.Type, state fulfillment.State, address string) (uint64, error)

func (*DatabaseProvider) GetFulfillmentCountForMetrics ¶

func (dp *DatabaseProvider) GetFulfillmentCountForMetrics(ctx context.Context, state fulfillment.State) (map[fulfillment.Type]uint64, error)

func (*DatabaseProvider) GetGiftCardAutoReturnAction ¶

func (dp *DatabaseProvider) GetGiftCardAutoReturnAction(ctx context.Context, giftCardVault string) (*action.Record, error)

func (*DatabaseProvider) GetGiftCardClaimedAction ¶

func (dp *DatabaseProvider) GetGiftCardClaimedAction(ctx context.Context, giftCardVault string) (*action.Record, error)

func (*DatabaseProvider) GetGiftCardClaimedIntent ¶

func (dp *DatabaseProvider) GetGiftCardClaimedIntent(ctx context.Context, giftCardVault string) (*intent.Record, error)

func (*DatabaseProvider) GetIntent ¶

func (dp *DatabaseProvider) GetIntent(ctx context.Context, intentID string) (*intent.Record, error)

Intent --------------------------------------------------------------------------------

func (*DatabaseProvider) GetIntentBySignature ¶

func (dp *DatabaseProvider) GetIntentBySignature(ctx context.Context, signature string) (*intent.Record, error)

func (*DatabaseProvider) GetIntentCountForAntispam ¶

func (dp *DatabaseProvider) GetIntentCountForAntispam(ctx context.Context, intentType intent.Type, phoneNumber string, states []intent.State, since time.Time) (uint64, error)

func (*DatabaseProvider) GetIntentCountWithOwnerInteractionsForAntispam ¶

func (dp *DatabaseProvider) GetIntentCountWithOwnerInteractionsForAntispam(ctx context.Context, sourceOwner, destinationOwner string, states []intent.State, since time.Time) (uint64, error)

func (*DatabaseProvider) GetKey ¶

func (dp *DatabaseProvider) GetKey(ctx context.Context, public_key string) (*vault.Record, error)

Vault --------------------------------------------------------------------------------

func (*DatabaseProvider) GetKeyCount ¶

func (dp *DatabaseProvider) GetKeyCount(ctx context.Context) (uint64, error)

func (*DatabaseProvider) GetKeyCountByState ¶

func (dp *DatabaseProvider) GetKeyCountByState(ctx context.Context, state vault.State) (uint64, error)

func (*DatabaseProvider) GetLatestAccountInfoByOwnerAddressAndType ¶

func (dp *DatabaseProvider) GetLatestAccountInfoByOwnerAddressAndType(ctx context.Context, address string, accountType commonpb.AccountType) (*account.Record, error)

func (*DatabaseProvider) GetLatestAccountInfosByOwnerAddress ¶

func (dp *DatabaseProvider) GetLatestAccountInfosByOwnerAddress(ctx context.Context, address string) (map[commonpb.AccountType][]*account.Record, error)

func (*DatabaseProvider) GetLatestIntentByInitiatorAndType ¶

func (dp *DatabaseProvider) GetLatestIntentByInitiatorAndType(ctx context.Context, intentType intent.Type, owner string) (*intent.Record, error)

func (*DatabaseProvider) GetLatestLoginByOwner ¶

func (dp *DatabaseProvider) GetLatestLoginByOwner(ctx context.Context, owner string) (*login.Record, error)

func (*DatabaseProvider) GetLatestPhoneEventForNumberByType ¶

func (dp *DatabaseProvider) GetLatestPhoneEventForNumberByType(ctx context.Context, phoneNumber string, eventType phone.EventType) (*phone.Event, error)

func (*DatabaseProvider) GetLatestPhoneVerificationForAccount ¶

func (dp *DatabaseProvider) GetLatestPhoneVerificationForAccount(ctx context.Context, account string) (*phone.Verification, error)

func (*DatabaseProvider) GetLatestPhoneVerificationForNumber ¶

func (dp *DatabaseProvider) GetLatestPhoneVerificationForNumber(ctx context.Context, phoneNumber string) (*phone.Verification, error)

func (*DatabaseProvider) GetLatestSaveRecentRootIntentForTreasury ¶

func (dp *DatabaseProvider) GetLatestSaveRecentRootIntentForTreasury(ctx context.Context, treasury string) (*intent.Record, error)

func (*DatabaseProvider) GetLegacyTotalExternalDepositAmountFromPrePrivacy2022Accounts ¶

func (dp *DatabaseProvider) GetLegacyTotalExternalDepositAmountFromPrePrivacy2022Accounts(ctx context.Context, account string) (uint64, error)

func (*DatabaseProvider) GetLoginsByAppInstall ¶

func (dp *DatabaseProvider) GetLoginsByAppInstall(ctx context.Context, appInstallId string) (*login.MultiRecord, error)

func (*DatabaseProvider) GetMessages ¶

func (dp *DatabaseProvider) GetMessages(ctx context.Context, account string) ([]*messaging.Record, error)

func (*DatabaseProvider) GetNetBalanceFromActions ¶

func (dp *DatabaseProvider) GetNetBalanceFromActions(ctx context.Context, address string) (int64, error)

func (*DatabaseProvider) GetNetBalanceFromActionsBatch ¶

func (dp *DatabaseProvider) GetNetBalanceFromActionsBatch(ctx context.Context, accounts ...string) (map[string]int64, error)

func (*DatabaseProvider) GetNetBalanceFromPrePrivacy2022Intents ¶

func (dp *DatabaseProvider) GetNetBalanceFromPrePrivacy2022Intents(ctx context.Context, account string) (int64, error)

func (*DatabaseProvider) GetNextSchedulableFulfillmentByAddress ¶

func (dp *DatabaseProvider) GetNextSchedulableFulfillmentByAddress(ctx context.Context, address string, intentOrderingIndex uint64, actionOrderingIndex, fulfillmentOrderingIndex uint32) (*fulfillment.Record, error)

func (*DatabaseProvider) GetNonce ¶

func (dp *DatabaseProvider) GetNonce(ctx context.Context, address string) (*nonce.Record, error)

Nonce --------------------------------------------------------------------------------

func (*DatabaseProvider) GetNonceCount ¶

func (dp *DatabaseProvider) GetNonceCount(ctx context.Context) (uint64, error)

func (*DatabaseProvider) GetNonceCountByState ¶

func (dp *DatabaseProvider) GetNonceCountByState(ctx context.Context, state nonce.State) (uint64, error)

func (*DatabaseProvider) GetNonceCountByStateAndPurpose ¶

func (dp *DatabaseProvider) GetNonceCountByStateAndPurpose(ctx context.Context, state nonce.State, purpose nonce.Purpose) (uint64, error)

func (*DatabaseProvider) GetOriginalGiftCardIssuedIntent ¶

func (dp *DatabaseProvider) GetOriginalGiftCardIssuedIntent(ctx context.Context, giftCardVault string) (*intent.Record, error)

func (*DatabaseProvider) GetPayment ¶

func (dp *DatabaseProvider) GetPayment(ctx context.Context, sig string, index int) (*payment.Record, error)

Payment --------------------------------------------------------------------------------

func (*DatabaseProvider) GetPaymentHistory ¶

func (dp *DatabaseProvider) GetPaymentHistory(ctx context.Context, account string, opts ...query.Option) ([]*payment.Record, error)

func (*DatabaseProvider) GetPaymentHistoryWithinBlockRange ¶

func (dp *DatabaseProvider) GetPaymentHistoryWithinBlockRange(ctx context.Context, account string, lowerBound, upperBound uint64, opts ...query.Option) ([]*payment.Record, error)

func (*DatabaseProvider) GetPaywallByShortPath ¶

func (dp *DatabaseProvider) GetPaywallByShortPath(ctx context.Context, path string) (*paywall.Record, error)

func (*DatabaseProvider) GetPendingFulfillmentCountByType ¶

func (dp *DatabaseProvider) GetPendingFulfillmentCountByType(ctx context.Context) (map[fulfillment.Type]uint64, error)

func (*DatabaseProvider) GetPhoneEventCountForNumberByTypeSinceTimestamp ¶

func (dp *DatabaseProvider) GetPhoneEventCountForNumberByTypeSinceTimestamp(ctx context.Context, phoneNumber string, eventType phone.EventType, since time.Time) (uint64, error)

func (*DatabaseProvider) GetPhoneEventCountForVerificationByType ¶

func (dp *DatabaseProvider) GetPhoneEventCountForVerificationByType(ctx context.Context, verification string, eventType phone.EventType) (uint64, error)

func (*DatabaseProvider) GetPhoneVerification ¶

func (dp *DatabaseProvider) GetPhoneVerification(ctx context.Context, account, phoneNumber string) (*phone.Verification, error)

func (*DatabaseProvider) GetPrioritizedAccountInfosRequiringAutoReturnCheck ¶

func (dp *DatabaseProvider) GetPrioritizedAccountInfosRequiringAutoReturnCheck(ctx context.Context, maxAge time.Duration, limit uint64) ([]*account.Record, error)

func (*DatabaseProvider) GetPrioritizedAccountInfosRequiringDepositSync ¶

func (dp *DatabaseProvider) GetPrioritizedAccountInfosRequiringDepositSync(ctx context.Context, limit uint64) ([]*account.Record, error)

func (*DatabaseProvider) GetRandomAvailableNonceByPurpose ¶

func (dp *DatabaseProvider) GetRandomAvailableNonceByPurpose(ctx context.Context, purpose nonce.Purpose) (*nonce.Record, error)

func (*DatabaseProvider) GetRelationshipAccountInfoByOwnerAddress ¶

func (dp *DatabaseProvider) GetRelationshipAccountInfoByOwnerAddress(ctx context.Context, address, relationshipTo string) (*account.Record, error)

func (*DatabaseProvider) GetRendezvous ¶

func (dp *DatabaseProvider) GetRendezvous(ctx context.Context, key string) (*rendezvous.Record, error)

func (*DatabaseProvider) GetRequest ¶ added in v1.2.0

func (dp *DatabaseProvider) GetRequest(ctx context.Context, intentId string) (*paymentrequest.Record, error)

func (*DatabaseProvider) GetTimelockByAddress ¶

func (dp *DatabaseProvider) GetTimelockByAddress(ctx context.Context, address string) (*timelock.Record, error)

func (*DatabaseProvider) GetTimelockByVault ¶

func (dp *DatabaseProvider) GetTimelockByVault(ctx context.Context, vault string) (*timelock.Record, error)

func (*DatabaseProvider) GetTimelockByVaultBatch ¶

func (dp *DatabaseProvider) GetTimelockByVaultBatch(ctx context.Context, vaults ...string) (map[string]*timelock.Record, error)

func (*DatabaseProvider) GetTimelockCountByState ¶

func (dp *DatabaseProvider) GetTimelockCountByState(ctx context.Context, state timelock_token.TimelockState) (uint64, error)

func (*DatabaseProvider) GetTotalAvailableTreasuryPoolFunds ¶

func (dp *DatabaseProvider) GetTotalAvailableTreasuryPoolFunds(ctx context.Context, vault string) (uint64, error)

func (*DatabaseProvider) GetTotalExternalDepositedAmountInQuarks ¶ added in v1.3.0

func (dp *DatabaseProvider) GetTotalExternalDepositedAmountInQuarks(ctx context.Context, account string) (uint64, error)

func (*DatabaseProvider) GetTotalExternalDepositedAmountInQuarksBatch ¶ added in v1.3.0

func (dp *DatabaseProvider) GetTotalExternalDepositedAmountInQuarksBatch(ctx context.Context, accounts ...string) (map[string]uint64, error)

func (*DatabaseProvider) GetTotalExternalDepositedAmountInUsd ¶

func (dp *DatabaseProvider) GetTotalExternalDepositedAmountInUsd(ctx context.Context, account string) (float64, error)

func (*DatabaseProvider) GetTotalTreasuryPoolDeficitFromCommitments ¶

func (dp *DatabaseProvider) GetTotalTreasuryPoolDeficitFromCommitments(ctx context.Context, treasuryPool string) (uint64, error)

func (*DatabaseProvider) GetTransactedAmountForAntiMoneyLaundering ¶

func (dp *DatabaseProvider) GetTransactedAmountForAntiMoneyLaundering(ctx context.Context, phoneNumber string, since time.Time) (uint64, float64, error)

func (*DatabaseProvider) GetTransaction ¶

func (dp *DatabaseProvider) GetTransaction(ctx context.Context, sig string) (*transaction.Record, error)

Transaction --------------------------------------------------------------------------------

func (*DatabaseProvider) GetTreasuryPoolByAddress ¶

func (dp *DatabaseProvider) GetTreasuryPoolByAddress(ctx context.Context, address string) (*treasury.Record, error)

func (*DatabaseProvider) GetTreasuryPoolByName ¶

func (dp *DatabaseProvider) GetTreasuryPoolByName(ctx context.Context, name string) (*treasury.Record, error)

func (*DatabaseProvider) GetTreasuryPoolByVault ¶

func (dp *DatabaseProvider) GetTreasuryPoolByVault(ctx context.Context, vault string) (*treasury.Record, error)

func (*DatabaseProvider) GetUniquePhoneVerificationIdCountForNumberSinceTimestamp ¶

func (dp *DatabaseProvider) GetUniquePhoneVerificationIdCountForNumberSinceTimestamp(ctx context.Context, phoneNumber string, since time.Time) (uint64, error)

func (*DatabaseProvider) GetUpgradeableCommitmentsByOwner ¶

func (dp *DatabaseProvider) GetUpgradeableCommitmentsByOwner(ctx context.Context, owner string, limit uint64) ([]*commitment.Record, error)

func (*DatabaseProvider) GetUsedTreasuryPoolDeficitFromCommitments ¶

func (dp *DatabaseProvider) GetUsedTreasuryPoolDeficitFromCommitments(ctx context.Context, treasuryPool string) (uint64, error)

func (*DatabaseProvider) GetUserByID ¶

func (dp *DatabaseProvider) GetUserByID(ctx context.Context, id *user.UserID) (*identity.Record, error)

func (*DatabaseProvider) GetUserByPhoneView ¶

func (dp *DatabaseProvider) GetUserByPhoneView(ctx context.Context, phoneNumber string) (*identity.Record, error)

func (*DatabaseProvider) GetUserDataContainerByID ¶

func (dp *DatabaseProvider) GetUserDataContainerByID(ctx context.Context, id *user.DataContainerID) (*storage.Record, error)

func (*DatabaseProvider) GetUserDataContainerByPhone ¶

func (dp *DatabaseProvider) GetUserDataContainerByPhone(ctx context.Context, tokenAccount, phoneNumber string) (*storage.Record, error)

func (*DatabaseProvider) GetUserLocale ¶ added in v1.6.0

func (dp *DatabaseProvider) GetUserLocale(ctx context.Context, owner string) (language.Tag, error)

func (*DatabaseProvider) GetUserPreferences ¶ added in v1.6.0

func (dp *DatabaseProvider) GetUserPreferences(ctx context.Context, id *user.DataContainerID) (*preferences.Record, error)

func (*DatabaseProvider) GetWebhook ¶

func (dp *DatabaseProvider) GetWebhook(ctx context.Context, webhookId string) (*webhook.Record, error)

func (*DatabaseProvider) ImportExchangeRates ¶

func (dp *DatabaseProvider) ImportExchangeRates(ctx context.Context, data *currency.MultiRateRecord) error

func (*DatabaseProvider) InitializeNewMerkleTree ¶

func (dp *DatabaseProvider) InitializeNewMerkleTree(ctx context.Context, name string, levels uint8, seeds []merkletree.Seed, readOnly bool) (*merkletree.MerkleTree, error)

Merkle Tree

func (*DatabaseProvider) IsEligibleForAirdrop ¶ added in v1.7.0

func (dp *DatabaseProvider) IsEligibleForAirdrop(ctx context.Context, owner string) (bool, error)

func (*DatabaseProvider) IsPhoneNumberEnabledForRemoteSendToAccount ¶

func (dp *DatabaseProvider) IsPhoneNumberEnabledForRemoteSendToAccount(ctx context.Context, phoneNumber string, ownerAccount string) (bool, error)

func (*DatabaseProvider) IsPhoneNumberLinkedToAccount ¶

func (dp *DatabaseProvider) IsPhoneNumberLinkedToAccount(ctx context.Context, phoneNumber string, ownerAccount string) (bool, error)

func (*DatabaseProvider) LoadExistingMerkleTree ¶

func (dp *DatabaseProvider) LoadExistingMerkleTree(ctx context.Context, name string, readOnly bool) (*merkletree.MerkleTree, error)

func (*DatabaseProvider) MarkFulfillmentAsActivelyScheduled ¶

func (dp *DatabaseProvider) MarkFulfillmentAsActivelyScheduled(ctx context.Context, id uint64) error

func (*DatabaseProvider) MarkIneligibleForAirdrop ¶ added in v1.7.0

func (dp *DatabaseProvider) MarkIneligibleForAirdrop(ctx context.Context, owner string) error

Airdrop --------------------------------------------------------------------------------

func (*DatabaseProvider) MarkPushTokenAsInvalid ¶

func (dp *DatabaseProvider) MarkPushTokenAsInvalid(ctx context.Context, pushToken string) error

func (*DatabaseProvider) PutAllActions ¶

func (dp *DatabaseProvider) PutAllActions(ctx context.Context, records ...*action.Record) error

Action --------------------------------------------------------------------------------

func (*DatabaseProvider) PutAllFulfillments ¶

func (dp *DatabaseProvider) PutAllFulfillments(ctx context.Context, records ...*fulfillment.Record) error

func (*DatabaseProvider) PutChat ¶

func (dp *DatabaseProvider) PutChat(ctx context.Context, record *chat.Chat) error

Chat --------------------------------------------------------------------------------

func (*DatabaseProvider) PutChatMessage ¶

func (dp *DatabaseProvider) PutChatMessage(ctx context.Context, record *chat.Message) error

func (*DatabaseProvider) PutFiatOnrampPurchase ¶ added in v1.5.0

func (dp *DatabaseProvider) PutFiatOnrampPurchase(ctx context.Context, record *onramp.Record) error

Onramp --------------------------------------------------------------------------------

func (*DatabaseProvider) PutPhoneEvent ¶

func (dp *DatabaseProvider) PutPhoneEvent(ctx context.Context, event *phone.Event) error

func (*DatabaseProvider) PutPushToken ¶

func (dp *DatabaseProvider) PutPushToken(ctx context.Context, record *push.Record) error

Push --------------------------------------------------------------------------------

func (*DatabaseProvider) PutUser ¶

func (dp *DatabaseProvider) PutUser(ctx context.Context, record *identity.Record) error

User Identity --------------------------------------------------------------------------------

func (*DatabaseProvider) PutUserDataContainer ¶

func (dp *DatabaseProvider) PutUserDataContainer(ctx context.Context, record *storage.Record) error

User Storage Management --------------------------------------------------------------------------------

func (*DatabaseProvider) RemoveContact ¶

func (dp *DatabaseProvider) RemoveContact(ctx context.Context, owner *user.DataContainerID, contact string) error

func (*DatabaseProvider) ResetBadgeCount ¶

func (dp *DatabaseProvider) ResetBadgeCount(ctx context.Context, owner string) error

func (*DatabaseProvider) SaveBalanceCheckpoint ¶ added in v1.3.2

func (dp *DatabaseProvider) SaveBalanceCheckpoint(ctx context.Context, record *balance.Record) error

Balance --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveCommitment ¶

func (dp *DatabaseProvider) SaveCommitment(ctx context.Context, record *commitment.Record) error

Commitment --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveEvent ¶

func (dp *DatabaseProvider) SaveEvent(ctx context.Context, record *event.Record) error

Event --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveExternalDeposit ¶

func (dp *DatabaseProvider) SaveExternalDeposit(ctx context.Context, record *deposit.Record) error

External Deposits --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveIntent ¶

func (dp *DatabaseProvider) SaveIntent(ctx context.Context, record *intent.Record) error

func (*DatabaseProvider) SaveKey ¶

func (dp *DatabaseProvider) SaveKey(ctx context.Context, record *vault.Record) error

func (*DatabaseProvider) SaveLogins ¶

func (dp *DatabaseProvider) SaveLogins(ctx context.Context, record *login.MultiRecord) error

Login --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveNonce ¶

func (dp *DatabaseProvider) SaveNonce(ctx context.Context, record *nonce.Record) error

func (*DatabaseProvider) SaveOwnerAccountPhoneSetting ¶

func (dp *DatabaseProvider) SaveOwnerAccountPhoneSetting(ctx context.Context, phoneNumber string, newSettings *phone.OwnerAccountSetting) error

func (*DatabaseProvider) SavePhoneLinkingToken ¶

func (dp *DatabaseProvider) SavePhoneLinkingToken(ctx context.Context, token *phone.LinkingToken) error

func (*DatabaseProvider) SavePhoneVerification ¶

func (dp *DatabaseProvider) SavePhoneVerification(ctx context.Context, v *phone.Verification) error

Phone --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveRendezvous ¶

func (dp *DatabaseProvider) SaveRendezvous(ctx context.Context, record *rendezvous.Record) error

Rendezvous --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveTimelock ¶

func (dp *DatabaseProvider) SaveTimelock(ctx context.Context, record *timelock.Record) error

Timelock --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveTransaction ¶

func (dp *DatabaseProvider) SaveTransaction(ctx context.Context, record *transaction.Record) error

func (*DatabaseProvider) SaveTreasuryPool ¶

func (dp *DatabaseProvider) SaveTreasuryPool(ctx context.Context, record *treasury.Record) error

Treasury Pool --------------------------------------------------------------------------------

func (*DatabaseProvider) SaveTreasuryPoolFunding ¶

func (dp *DatabaseProvider) SaveTreasuryPoolFunding(ctx context.Context, record *treasury.FundingHistoryRecord) error

func (*DatabaseProvider) SaveUserPreferences ¶ added in v1.6.0

func (dp *DatabaseProvider) SaveUserPreferences(ctx context.Context, record *preferences.Record) error

User Preferences --------------------------------------------------------------------------------

func (*DatabaseProvider) SetChatMuteState ¶

func (dp *DatabaseProvider) SetChatMuteState(ctx context.Context, chatId chat.ChatId, isMuted bool) error

func (*DatabaseProvider) SetChatSubscriptionState ¶

func (dp *DatabaseProvider) SetChatSubscriptionState(ctx context.Context, chatId chat.ChatId, isSubscribed bool) error

func (*DatabaseProvider) UpdateAccountInfo ¶

func (dp *DatabaseProvider) UpdateAccountInfo(ctx context.Context, record *account.Record) error

func (*DatabaseProvider) UpdateAction ¶

func (dp *DatabaseProvider) UpdateAction(ctx context.Context, record *action.Record) error

func (*DatabaseProvider) UpdateFulfillment ¶

func (dp *DatabaseProvider) UpdateFulfillment(ctx context.Context, record *fulfillment.Record) error

func (*DatabaseProvider) UpdateOrCreatePayment ¶

func (dp *DatabaseProvider) UpdateOrCreatePayment(ctx context.Context, record *payment.Record) error

func (*DatabaseProvider) UpdatePayment ¶

func (dp *DatabaseProvider) UpdatePayment(ctx context.Context, record *payment.Record) error

func (*DatabaseProvider) UpdateWebhook ¶

func (dp *DatabaseProvider) UpdateWebhook(ctx context.Context, record *webhook.Record) error

func (*DatabaseProvider) UsePhoneLinkingToken ¶

func (dp *DatabaseProvider) UsePhoneLinkingToken(ctx context.Context, phoneNumber, code string) error

type EstimatedData ¶

type EstimatedData interface {
	TestForKnownAccount(ctx context.Context, account []byte) (bool, error)
	AddKnownAccount(ctx context.Context, account []byte) error
}

func NewEstimatedProvider ¶

func NewEstimatedProvider() (EstimatedData, error)

type EstimatedProvider ¶

type EstimatedProvider struct {
	// contains filtered or unexported fields
}

func (*EstimatedProvider) AddKnownAccount ¶

func (p *EstimatedProvider) AddKnownAccount(ctx context.Context, account []byte) error

func (*EstimatedProvider) TestForKnownAccount ¶

func (p *EstimatedProvider) TestForKnownAccount(ctx context.Context, account []byte) (bool, error)

type Provider ¶

type Provider interface {
	BlockchainData
	DatabaseData
	WebData
	EstimatedData

	GetBlockchainDataProvider() BlockchainData
	GetDatabaseDataProvider() DatabaseData
	GetWebDataProvider() WebData
	GetEstimatedDataProvider() EstimatedData
}

func NewDataProvider ¶

func NewDataProvider(dbConfig *pg.Config, solanaEnv string, configProvider ConfigProvider) (Provider, error)

func NewDataProviderWithoutBlockchain ¶

func NewDataProviderWithoutBlockchain(dbConfig *pg.Config, configProvider ConfigProvider) (Provider, error)

func NewTestDataProvider ¶

func NewTestDataProvider() Provider

type WebData ¶

type WebData interface {
	GetCurrentExchangeRatesFromExternalProviders(ctx context.Context) (*currency.MultiRateRecord, error)
	GetPastExchangeRatesFromExternalProviders(ctx context.Context, t time.Time) (*currency.MultiRateRecord, error)
}

func NewWebProvider ¶

func NewWebProvider(configProvider ConfigProvider) (WebData, error)

type WebProvider ¶

type WebProvider struct {
	// contains filtered or unexported fields
}

func (*WebProvider) GetCurrentExchangeRatesFromExternalProviders ¶

func (dp *WebProvider) GetCurrentExchangeRatesFromExternalProviders(ctx context.Context) (*currency.MultiRateRecord, error)

Currency --------------------------------------------------------------------------------

func (*WebProvider) GetPastExchangeRatesFromExternalProviders ¶

func (dp *WebProvider) GetPastExchangeRatesFromExternalProviders(ctx context.Context, t time.Time) (*currency.MultiRateRecord, error)

Jump to

Keyboard shortcuts

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